summaryrefslogtreecommitdiffstats
path: root/parts
diff options
context:
space:
mode:
Diffstat (limited to 'parts')
-rw-r--r--parts/Makefile.am11
-rw-r--r--parts/abbrev/Makefile.am20
-rw-r--r--parts/abbrev/README.dox20
-rw-r--r--parts/abbrev/abbrevconfigwidget.cpp121
-rw-r--r--parts/abbrev/abbrevconfigwidget.h43
-rw-r--r--parts/abbrev/abbrevconfigwidgetbase.ui190
-rw-r--r--parts/abbrev/abbrevpart.cpp696
-rw-r--r--parts/abbrev/abbrevpart.h113
-rw-r--r--parts/abbrev/addtemplatedlg.cpp59
-rw-r--r--parts/abbrev/addtemplatedlg.h41
-rw-r--r--parts/abbrev/addtemplatedlgbase.ui176
-rw-r--r--parts/abbrev/cpp_keywords84
-rw-r--r--parts/abbrev/kdevabbrev.desktop83
-rw-r--r--parts/abbrev/kdevabbrev.rc10
-rw-r--r--parts/abbrev/qt_classes409
-rw-r--r--parts/appwizard/Makefile.am28
-rw-r--r--parts/appwizard/README1
-rw-r--r--parts/appwizard/README.dox80
-rw-r--r--parts/appwizard/appwizarddlg.cpp1374
-rw-r--r--parts/appwizard/appwizarddlg.h209
-rw-r--r--parts/appwizard/appwizarddlgbase.ui659
-rw-r--r--parts/appwizard/appwizardfactory.cpp41
-rw-r--r--parts/appwizard/appwizardfactory.h32
-rw-r--r--parts/appwizard/appwizardpart.cpp98
-rw-r--r--parts/appwizard/appwizardpart.h45
-rw-r--r--parts/appwizard/common/Artistic124
-rw-r--r--parts/appwizard/common/COPYING340
-rw-r--r--parts/appwizard/common/COPYING.LIB481
-rw-r--r--parts/appwizard/common/LICENSE.BSD20
-rw-r--r--parts/appwizard/common/LICENSE.QPL103
-rw-r--r--parts/appwizard/common/Makefile.am46
-rw-r--r--parts/appwizard/common/admin.kdevtemplate5
-rw-r--r--parts/appwizard/common/dockbook.kdevtemplate64
-rw-r--r--parts/appwizard/common/gnome-Makefile.am16
-rw-r--r--parts/appwizard/common/gnome-Makefile.cvs5
-rw-r--r--parts/appwizard/common/gnome-app.lsm15
-rw-r--r--parts/appwizard/common/gnome-app.pngbin0 -> 3388 bytes
-rw-r--r--parts/appwizard/common/gnome-pixmaps-Makefile.am8
-rw-r--r--parts/appwizard/common/gnome/macros/ChangeLog859
-rw-r--r--parts/appwizard/common/gnome/macros/aclocal-include.m416
-rw-r--r--parts/appwizard/common/gnome/macros/autogen.sh145
-rw-r--r--parts/appwizard/common/gnome/macros/compiler-flags.m4109
-rw-r--r--parts/appwizard/common/gnome/macros/curses.m4318
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-Makefile.am40
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-bonobo-check.m4150
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-common.m414
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-fileutils.m4414
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-gettext.m4336
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-ghttp-check.m414
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-gnorba-check.m435
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-guile-checks.m4119
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-libgtop-check.m4182
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-objc-checks.m479
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-orbit-check.m433
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-print-check.m4171
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-pthread-check.m416
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-support.m468
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-undelfs.m420
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-vfs.m4120
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-x-checks.m480
-rw-r--r--parts/appwizard/common/gnome/macros/gnome-xml-check.m430
-rw-r--r--parts/appwizard/common/gnome/macros/gnome.m4124
-rw-r--r--parts/appwizard/common/gnome/macros/linger.m428
-rw-r--r--parts/appwizard/common/gnome/macros/need-declaration.m442
-rw-r--r--parts/appwizard/common/gnome2.kdevtemplate5
-rw-r--r--parts/appwizard/common/gnome2/macros/aclocal-include.m416
-rwxr-xr-xparts/appwizard/common/gnome2/macros/autogen.sh384
-rw-r--r--parts/appwizard/common/gnome2/macros/compiler-flags.m4141
-rw-r--r--parts/appwizard/common/gnome2/macros/curses.m4318
-rw-r--r--parts/appwizard/common/gnome2/macros/gnome-common.m430
-rw-r--r--parts/appwizard/common/gnome2/macros/gnome-deprecated-macros.m432
-rw-r--r--parts/appwizard/common/gnome2/macros/gnome2-macros.dep1
-rw-r--r--parts/appwizard/common/gnu.kdevtemplate5
-rw-r--r--parts/appwizard/common/gnu/AUTHORS1
-rw-r--r--parts/appwizard/common/gnu/COPYING340
-rw-r--r--parts/appwizard/common/gnu/ChangeLog0
-rw-r--r--parts/appwizard/common/gnu/INSTALL167
-rw-r--r--parts/appwizard/common/gnu/NEWS0
-rw-r--r--parts/appwizard/common/gnu/README0
-rw-r--r--parts/appwizard/common/gnu/TODO0
-rw-r--r--parts/appwizard/common/hi16-app-app.pngbin0 -> 1033 bytes
-rw-r--r--parts/appwizard/common/hi32-app-app.pngbin0 -> 2749 bytes
-rw-r--r--parts/appwizard/common/incadmin.kdevtemplate5
-rwxr-xr-xparts/appwizard/common/incadmin/config.guess1363
-rwxr-xr-xparts/appwizard/common/incadmin/config.sub1470
-rwxr-xr-xparts/appwizard/common/incadmin/depcomp441
-rwxr-xr-xparts/appwizard/common/incadmin/install-sh276
-rw-r--r--parts/appwizard/common/incadmin/ltmain.sh6343
-rwxr-xr-xparts/appwizard/common/incadmin/missing336
-rwxr-xr-xparts/appwizard/common/incadmin/mkinstalldirs111
-rw-r--r--parts/appwizard/common/kde-Makefile.am22
-rw-r--r--parts/appwizard/common/kde-Makefile.cvs10
-rw-r--r--parts/appwizard/common/kde-app.desktop44
-rw-r--r--parts/appwizard/common/kde-app.lsm16
-rw-r--r--parts/appwizard/common/kde-configure.in.in6
-rw-r--r--parts/appwizard/common/kde-doc-Makefile.am6
-rw-r--r--parts/appwizard/common/kde-doc-en-Makefile.am2
-rw-r--r--parts/appwizard/common/kde-index.docbook555
-rw-r--r--parts/appwizard/common/kde-part.desktop18
-rw-r--r--parts/appwizard/common/kde-po-Makefile.am1
-rw-r--r--parts/appwizard/common/scons.kdevtemplate5
-rw-r--r--parts/appwizard/common/scons/admin/generic.py194
-rw-r--r--parts/appwizard/common/scons/admin/kde.py856
-rw-r--r--parts/appwizard/common/scons/admin/scons-mini.tar.bz2bin0 -> 58214 bytes
-rwxr-xr-xparts/appwizard/common/scons/configure87
-rw-r--r--parts/appwizard/common/wx-Makefile.am1
-rw-r--r--parts/appwizard/common/wx-Makefile.cvs5
-rw-r--r--parts/appwizard/common/wx-configure.in55
-rwxr-xr-xparts/appwizard/common/wx/macros/autogen.sh6
-rw-r--r--parts/appwizard/filepropspage.cpp88
-rw-r--r--parts/appwizard/filepropspage.h42
-rw-r--r--parts/appwizard/filepropspagebase.ui168
-rw-r--r--parts/appwizard/importdlg.cpp582
-rw-r--r--parts/appwizard/importdlg.h64
-rw-r--r--parts/appwizard/importdlgbase.ui365
-rw-r--r--parts/appwizard/imports/.kdev_ignore0
-rw-r--r--parts/appwizard/imports/Makefile.am7
-rw-r--r--parts/appwizard/imports/ada5
-rw-r--r--parts/appwizard/imports/ada.kdevelop73
-rw-r--r--parts/appwizard/imports/c4
-rw-r--r--parts/appwizard/imports/c-auto8
-rw-r--r--parts/appwizard/imports/c-auto.kdevelop96
-rw-r--r--parts/appwizard/imports/c.kdevelop76
-rw-r--r--parts/appwizard/imports/cpp4
-rw-r--r--parts/appwizard/imports/cpp-auto8
-rw-r--r--parts/appwizard/imports/cpp-auto.kdevelop93
-rw-r--r--parts/appwizard/imports/cpp.kdevelop75
-rw-r--r--parts/appwizard/imports/fortran4
-rw-r--r--parts/appwizard/imports/fortran-auto8
-rw-r--r--parts/appwizard/imports/fortran-auto.kdevelop71
-rw-r--r--parts/appwizard/imports/fortran.kdevelop75
-rw-r--r--parts/appwizard/imports/gnome4
-rw-r--r--parts/appwizard/imports/gnome.kdevelop100
-rw-r--r--parts/appwizard/imports/java4
-rw-r--r--parts/appwizard/imports/java-ant4
-rw-r--r--parts/appwizard/imports/java-ant.kdevelop68
-rw-r--r--parts/appwizard/imports/java-auto8
-rw-r--r--parts/appwizard/imports/java-auto.kdevelop63
-rw-r--r--parts/appwizard/imports/java.kdevelop63
-rw-r--r--parts/appwizard/imports/kde5
-rw-r--r--parts/appwizard/imports/kde.kdevelop73
-rw-r--r--parts/appwizard/imports/pascal4
-rw-r--r--parts/appwizard/imports/pascal.kdevelop75
-rw-r--r--parts/appwizard/imports/perl4
-rw-r--r--parts/appwizard/imports/perl.kdevelop69
-rw-r--r--parts/appwizard/imports/php4
-rw-r--r--parts/appwizard/imports/php.kdevelop84
-rw-r--r--parts/appwizard/imports/python4
-rw-r--r--parts/appwizard/imports/python.kdevelop69
-rw-r--r--parts/appwizard/imports/qt4
-rw-r--r--parts/appwizard/imports/qt-auto4
-rw-r--r--parts/appwizard/imports/qt-auto.kdevelop43
-rw-r--r--parts/appwizard/imports/qt.kdevelop38
-rw-r--r--parts/appwizard/imports/qt4qmake4
-rw-r--r--parts/appwizard/imports/qt4qmake.kdevelop80
-rw-r--r--parts/appwizard/imports/qtqmake9
-rw-r--r--parts/appwizard/imports/qtqmake.kdevelop79
-rw-r--r--parts/appwizard/imports/qttmake4
-rw-r--r--parts/appwizard/imports/qttmake.kdevelop74
-rw-r--r--parts/appwizard/imports/ruby4
-rw-r--r--parts/appwizard/imports/ruby.kdevelop82
-rw-r--r--parts/appwizard/kdevappwizard.desktop87
-rw-r--r--parts/appwizard/kdevappwizard.rc10
-rw-r--r--parts/appwizard/kdevfile.cpp59
-rw-r--r--parts/appwizard/kdevfile.h57
-rw-r--r--parts/appwizard/kdevlicense.cpp116
-rw-r--r--parts/appwizard/kdevlicense.h75
-rw-r--r--parts/appwizard/licenses/BSD22
-rw-r--r--parts/appwizard/licenses/GPL18
-rw-r--r--parts/appwizard/licenses/GPL+Qt-Exception29
-rw-r--r--parts/appwizard/licenses/LGPL18
-rw-r--r--parts/appwizard/licenses/MIT21
-rw-r--r--parts/appwizard/licenses/Makefile.am6
-rw-r--r--parts/appwizard/licenses/NCSA24
-rw-r--r--parts/appwizard/licenses/QPL11
-rw-r--r--parts/appwizard/misc.cpp56
-rw-r--r--parts/appwizard/misc.h23
-rw-r--r--parts/appwizard/profilesupport.cpp44
-rw-r--r--parts/appwizard/profilesupport.h34
-rw-r--r--parts/appwizard/vcs_form.ui84
-rw-r--r--parts/astyle/Makefile.am16
-rw-r--r--parts/astyle/README.dox10
-rw-r--r--parts/astyle/astyle_adaptor.cpp270
-rw-r--r--parts/astyle/astyle_adaptor.h55
-rw-r--r--parts/astyle/astyle_part.cpp541
-rw-r--r--parts/astyle/astyle_part.h76
-rw-r--r--parts/astyle/astyle_widget.cpp346
-rw-r--r--parts/astyle/astyle_widget.h36
-rw-r--r--parts/astyle/astyleconfig.ui1332
-rw-r--r--parts/astyle/kdevastyle.desktop82
-rw-r--r--parts/astyle/kdevpart_astyle.rc17
-rw-r--r--parts/bookmarks/Makefile.am14
-rw-r--r--parts/bookmarks/README1
-rw-r--r--parts/bookmarks/README.dox20
-rw-r--r--parts/bookmarks/bookmarks_config.cpp138
-rw-r--r--parts/bookmarks/bookmarks_config.h53
-rw-r--r--parts/bookmarks/bookmarks_part.cpp568
-rw-r--r--parts/bookmarks/bookmarks_part.h109
-rw-r--r--parts/bookmarks/bookmarks_settings.cpp66
-rw-r--r--parts/bookmarks/bookmarks_settings.h41
-rw-r--r--parts/bookmarks/bookmarks_settings_base.ui240
-rw-r--r--parts/bookmarks/bookmarks_widget.cpp336
-rw-r--r--parts/bookmarks/bookmarks_widget.h72
-rw-r--r--parts/bookmarks/kdevbookmarks.desktop85
-rw-r--r--parts/classview/Makefile.am27
-rw-r--r--parts/classview/README.dox53
-rw-r--r--parts/classview/classtooldlg.cpp373
-rw-r--r--parts/classview/classtooldlg.h98
-rw-r--r--parts/classview/classtoolwidget.cpp159
-rw-r--r--parts/classview/classtoolwidget.h41
-rw-r--r--parts/classview/classtreebase.cpp637
-rw-r--r--parts/classview/classtreebase.h242
-rw-r--r--parts/classview/classviewpart.cpp279
-rw-r--r--parts/classview/classviewpart.h99
-rw-r--r--parts/classview/classviewwidget.cpp1295
-rw-r--r--parts/classview/classviewwidget.h414
-rw-r--r--parts/classview/digraphview.cpp414
-rw-r--r--parts/classview/digraphview.h66
-rw-r--r--parts/classview/hierarchydlg.cpp276
-rw-r--r--parts/classview/hierarchydlg.h61
-rw-r--r--parts/classview/kdevclassview.desktop82
-rw-r--r--parts/classview/kdevclassview.rc20
-rw-r--r--parts/classview/navigator.cpp539
-rw-r--r--parts/classview/navigator.h91
-rw-r--r--parts/classview/viewcombos.cpp214
-rw-r--r--parts/classview/viewcombos.h84
-rw-r--r--parts/ctags2/Makefile.am22
-rw-r--r--parts/ctags2/README.dox16
-rw-r--r--parts/ctags2/ctags2_createtagfile.cpp53
-rw-r--r--parts/ctags2/ctags2_createtagfile.h36
-rw-r--r--parts/ctags2/ctags2_createtagfilebase.ui151
-rw-r--r--parts/ctags2/ctags2_part.cpp371
-rw-r--r--parts/ctags2/ctags2_part.h69
-rw-r--r--parts/ctags2/ctags2_selecttagfile.cpp47
-rw-r--r--parts/ctags2/ctags2_selecttagfile.h33
-rw-r--r--parts/ctags2/ctags2_selecttagfilebase.ui128
-rw-r--r--parts/ctags2/ctags2_settingswidget.cpp173
-rw-r--r--parts/ctags2/ctags2_settingswidget.h69
-rw-r--r--parts/ctags2/ctags2_settingswidgetbase.ui382
-rw-r--r--parts/ctags2/ctags2_widget.cpp199
-rw-r--r--parts/ctags2/ctags2_widget.h56
-rw-r--r--parts/ctags2/ctags2_widgetbase.ui181
-rw-r--r--parts/ctags2/ctagskinds.cpp306
-rw-r--r--parts/ctags2/ctagskinds.h24
-rw-r--r--parts/ctags2/kdevctags2.desktop82
-rw-r--r--parts/ctags2/kdevpart_ctags2.rc12
-rw-r--r--parts/ctags2/readtags.c960
-rw-r--r--parts/ctags2/readtags.h251
-rw-r--r--parts/ctags2/tagitem.cpp23
-rw-r--r--parts/ctags2/tagitem.h29
-rw-r--r--parts/ctags2/tags.cpp171
-rw-r--r--parts/ctags2/tags.h74
-rw-r--r--parts/diff/Makefile.am18
-rw-r--r--parts/diff/README3
-rw-r--r--parts/diff/README.dox20
-rw-r--r--parts/diff/diffdlg.cpp48
-rw-r--r--parts/diff/diffdlg.h41
-rw-r--r--parts/diff/diffpart.cpp248
-rw-r--r--parts/diff/diffpart.h59
-rw-r--r--parts/diff/diffwidget.cpp348
-rw-r--r--parts/diff/diffwidget.h107
-rw-r--r--parts/diff/kdevdiff.desktop84
-rw-r--r--parts/diff/kdevdiff.rc9
-rw-r--r--parts/distpart/Makefile.am16
-rw-r--r--parts/distpart/README3
-rw-r--r--parts/distpart/README.dox24
-rw-r--r--parts/distpart/distpart_part.cpp84
-rw-r--r--parts/distpart/distpart_part.h55
-rw-r--r--parts/distpart/distpart_ui.ui1243
-rw-r--r--parts/distpart/distpart_widget.cpp605
-rw-r--r--parts/distpart/distpart_widget.h210
-rw-r--r--parts/distpart/kdevdistpart.desktop70
-rw-r--r--parts/distpart/kdevpart_distpart.rc8
-rw-r--r--parts/distpart/lsmsupport.cpp32
-rw-r--r--parts/distpart/lsmsupport.h35
-rw-r--r--parts/distpart/packagebase.cpp117
-rw-r--r--parts/distpart/packagebase.h84
-rw-r--r--parts/distpart/specsupport.cpp315
-rw-r--r--parts/distpart/specsupport.h54
-rw-r--r--parts/documentation/KDevDocumentationIface.cpp83
-rw-r--r--parts/documentation/KDevDocumentationIface.h52
-rw-r--r--parts/documentation/Makefile.am32
-rw-r--r--parts/documentation/README.dox21
-rw-r--r--parts/documentation/addcatalogdlg.cpp112
-rw-r--r--parts/documentation/addcatalogdlg.h53
-rw-r--r--parts/documentation/addcatalogdlgbase.ui209
-rw-r--r--parts/documentation/bookmarkview.cpp285
-rw-r--r--parts/documentation/bookmarkview.h82
-rw-r--r--parts/documentation/contentsview.cpp92
-rw-r--r--parts/documentation/contentsview.h53
-rw-r--r--parts/documentation/data/Makefile.am6
-rw-r--r--parts/documentation/data/checked.xpm23
-rw-r--r--parts/documentation/data/htdig.pngbin0 -> 2857 bytes
-rw-r--r--parts/documentation/data/long.html6
-rw-r--r--parts/documentation/data/nomatch.html21
-rw-r--r--parts/documentation/data/short.html1
-rw-r--r--parts/documentation/data/star.pngbin0 -> 195 bytes
-rw-r--r--parts/documentation/data/star_blank.pngbin0 -> 151 bytes
-rw-r--r--parts/documentation/data/syntax.html19
-rw-r--r--parts/documentation/data/unchecked.xpm22
-rw-r--r--parts/documentation/data/wrapper.html16
-rw-r--r--parts/documentation/docconfiglistview.cpp72
-rw-r--r--parts/documentation/docconfiglistview.h36
-rw-r--r--parts/documentation/docglobalconfigwidget.cpp259
-rw-r--r--parts/documentation/docglobalconfigwidget.h67
-rw-r--r--parts/documentation/docglobalconfigwidgetbase.ui572
-rw-r--r--parts/documentation/docprojectconfigwidget.cpp146
-rw-r--r--parts/documentation/docprojectconfigwidget.h41
-rw-r--r--parts/documentation/docprojectconfigwidgetbase.ui152
-rw-r--r--parts/documentation/documentation_part.cpp766
-rw-r--r--parts/documentation/documentation_part.h121
-rw-r--r--parts/documentation/documentation_widget.cpp142
-rw-r--r--parts/documentation/documentation_widget.h75
-rw-r--r--parts/documentation/docutils.cpp100
-rw-r--r--parts/documentation/docutils.h51
-rw-r--r--parts/documentation/editbookmarkdlg.ui165
-rw-r--r--parts/documentation/editcatalogdlg.cpp79
-rw-r--r--parts/documentation/editcatalogdlg.h56
-rw-r--r--parts/documentation/editcatalogdlgbase.ui196
-rw-r--r--parts/documentation/find_documentation.cpp347
-rw-r--r--parts/documentation/find_documentation.h81
-rw-r--r--parts/documentation/find_documentation_options.cpp192
-rw-r--r--parts/documentation/find_documentation_options.h66
-rw-r--r--parts/documentation/find_documentation_optionsbase.ui218
-rw-r--r--parts/documentation/find_documentationbase.ui167
-rw-r--r--parts/documentation/indexview.cpp190
-rw-r--r--parts/documentation/indexview.h64
-rw-r--r--parts/documentation/interfaces/Mainpage.dox10
-rw-r--r--parts/documentation/interfaces/Makefile.am16
-rw-r--r--parts/documentation/interfaces/kdevdocumentationplugin.cpp721
-rw-r--r--parts/documentation/interfaces/kdevdocumentationplugin.h421
-rw-r--r--parts/documentation/interfaces/kdevelopdocumentationplugins.desktop36
-rw-r--r--parts/documentation/kdevdocumentation.desktop82
-rw-r--r--parts/documentation/kdevpart_documentation.rc19
-rw-r--r--parts/documentation/plugins/Makefile.am3
-rw-r--r--parts/documentation/plugins/chm/Makefile.am14
-rw-r--r--parts/documentation/plugins/chm/docchmplugin.cpp198
-rw-r--r--parts/documentation/plugins/chm/docchmplugin.desktop44
-rw-r--r--parts/documentation/plugins/chm/docchmplugin.h50
-rw-r--r--parts/documentation/plugins/custom/Makefile.am10
-rw-r--r--parts/documentation/plugins/custom/doccustomplugin.cpp106
-rw-r--r--parts/documentation/plugins/custom/doccustomplugin.desktop44
-rw-r--r--parts/documentation/plugins/custom/doccustomplugin.h50
-rw-r--r--parts/documentation/plugins/devhelp/Makefile.am14
-rw-r--r--parts/documentation/plugins/devhelp/docdevhelpplugin.cpp386
-rw-r--r--parts/documentation/plugins/devhelp/docdevhelpplugin.desktop44
-rw-r--r--parts/documentation/plugins/devhelp/docdevhelpplugin.h60
-rw-r--r--parts/documentation/plugins/djvu/Makefile.am8
-rw-r--r--parts/documentation/plugins/djvu/docdjvuplugin.cpp103
-rw-r--r--parts/documentation/plugins/djvu/docdjvuplugin.desktop44
-rw-r--r--parts/documentation/plugins/djvu/docdjvuplugin.h50
-rw-r--r--parts/documentation/plugins/doxygen/Makefile.am13
-rw-r--r--parts/documentation/plugins/doxygen/docdoxygenplugin.cpp529
-rw-r--r--parts/documentation/plugins/doxygen/docdoxygenplugin.desktop45
-rw-r--r--parts/documentation/plugins/doxygen/docdoxygenplugin.h75
-rw-r--r--parts/documentation/plugins/kdevtoc/Makefile.am10
-rw-r--r--parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp277
-rw-r--r--parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop43
-rw-r--r--parts/documentation/plugins/kdevtoc/dockdevtocplugin.h54
-rw-r--r--parts/documentation/plugins/pdb/Makefile.am8
-rw-r--r--parts/documentation/plugins/pdb/docpdbplugin.cpp103
-rw-r--r--parts/documentation/plugins/pdb/docpdbplugin.desktop43
-rw-r--r--parts/documentation/plugins/pdb/docpdbplugin.h50
-rw-r--r--parts/documentation/plugins/pdf/Makefile.am8
-rw-r--r--parts/documentation/plugins/pdf/docpdfplugin.cpp103
-rw-r--r--parts/documentation/plugins/pdf/docpdfplugin.desktop43
-rw-r--r--parts/documentation/plugins/pdf/docpdfplugin.h50
-rw-r--r--parts/documentation/plugins/qt/Makefile.am14
-rw-r--r--parts/documentation/plugins/qt/docqtplugin.cpp339
-rw-r--r--parts/documentation/plugins/qt/docqtplugin.desktop44
-rw-r--r--parts/documentation/plugins/qt/docqtplugin.h56
-rw-r--r--parts/documentation/protocols/Makefile.am4
-rw-r--r--parts/documentation/protocols/chm/Makefile.am21
-rw-r--r--parts/documentation/protocols/chm/chm.cpp362
-rw-r--r--parts/documentation/protocols/chm/chm.h47
-rw-r--r--parts/documentation/protocols/chm/chm.protocol36
-rw-r--r--parts/documentation/protocols/chm/chmfile.cpp197
-rw-r--r--parts/documentation/protocols/chm/chmfile.h53
-rw-r--r--parts/documentation/protocols/chm/decompress.cpp796
-rw-r--r--parts/documentation/protocols/chm/decompress.h43
-rw-r--r--parts/documentation/protocols/chm/kchmpart.cpp123
-rw-r--r--parts/documentation/protocols/chm/kchmpart.desktop46
-rw-r--r--parts/documentation/protocols/chm/kchmpart.h82
-rw-r--r--parts/documentation/searchview.cpp330
-rw-r--r--parts/documentation/searchview.h75
-rw-r--r--parts/documentation/selecttopic.cpp49
-rw-r--r--parts/documentation/selecttopic.h40
-rw-r--r--parts/documentation/selecttopicbase.ui142
-rw-r--r--parts/documentation/tools/Makefile.am3
-rw-r--r--parts/documentation/tools/htdig/Makefile.am6
-rw-r--r--parts/documentation/tools/htdig/htdigindex.cpp491
-rw-r--r--parts/documentation/tools/htdig/htdigindex.h68
-rw-r--r--parts/doxygen/Makefile.am19
-rw-r--r--parts/doxygen/README1
-rw-r--r--parts/doxygen/README.dox75
-rw-r--r--parts/doxygen/config.cpp5166
-rw-r--r--parts/doxygen/config.h579
-rw-r--r--parts/doxygen/doxygenconfigwidget.cpp275
-rw-r--r--parts/doxygen/doxygenconfigwidget.h54
-rw-r--r--parts/doxygen/doxygenpart.cpp564
-rw-r--r--parts/doxygen/doxygenpart.h113
-rw-r--r--parts/doxygen/input.cpp499
-rw-r--r--parts/doxygen/input.h173
-rw-r--r--parts/doxygen/kdevdoxygen.desktop81
-rw-r--r--parts/doxygen/kdevdoxygen.rc14
-rw-r--r--parts/doxygen/lang_cfg.h34
-rw-r--r--parts/doxygen/messages.cpp301
-rw-r--r--parts/doxygen/messages.h11
-rw-r--r--parts/doxygen/version.cpp1
-rw-r--r--parts/doxygen/version.h23
-rw-r--r--parts/filecreate/Makefile.am23
-rw-r--r--parts/filecreate/README3
-rw-r--r--parts/filecreate/README.dox76
-rw-r--r--parts/filecreate/addglobaldlg.cpp106
-rw-r--r--parts/filecreate/addglobaldlg.h44
-rw-r--r--parts/filecreate/fcconfigwidget.cpp709
-rw-r--r--parts/filecreate/fcconfigwidget.h72
-rw-r--r--parts/filecreate/fcconfigwidgetbase.ui540
-rw-r--r--parts/filecreate/fctemplateedit.cpp36
-rw-r--r--parts/filecreate/fctemplateedit.h30
-rw-r--r--parts/filecreate/fctemplateeditbase.ui193
-rw-r--r--parts/filecreate/fctemplateeditbase.ui.h26
-rw-r--r--parts/filecreate/fctypeedit.cpp40
-rw-r--r--parts/filecreate/fctypeedit.h30
-rw-r--r--parts/filecreate/fctypeeditbase.ui282
-rw-r--r--parts/filecreate/fctypeeditbase.ui.h26
-rw-r--r--parts/filecreate/file-templates/Makefile.am2
-rw-r--r--parts/filecreate/file-templates/dox22
-rw-r--r--parts/filecreate/file-templates/qrc5
-rw-r--r--parts/filecreate/file-templates/ts2
-rw-r--r--parts/filecreate/file-templates/ui20
-rw-r--r--parts/filecreate/file-templates/ui-confdialog165
-rw-r--r--parts/filecreate/file-templates/ui-dialog20
-rw-r--r--parts/filecreate/file-templates/ui-dialog-qt422
-rw-r--r--parts/filecreate/file-templates/ui-dialogb123
-rw-r--r--parts/filecreate/file-templates/ui-dialogb-qt4100
-rw-r--r--parts/filecreate/file-templates/ui-dialogr123
-rw-r--r--parts/filecreate/file-templates/ui-dialogr-qt4100
-rw-r--r--parts/filecreate/file-templates/ui-mainwin436
-rw-r--r--parts/filecreate/file-templates/ui-mainwin-qt434
-rw-r--r--parts/filecreate/file-templates/ui-tabdialog147
-rw-r--r--parts/filecreate/file-templates/ui-widget20
-rw-r--r--parts/filecreate/file-templates/ui-widget-qt422
-rw-r--r--parts/filecreate/file-templates/ui-wizard28
-rw-r--r--parts/filecreate/filecreate_filedialog.cpp65
-rw-r--r--parts/filecreate/filecreate_filedialog.h46
-rw-r--r--parts/filecreate/filecreate_filetype.cpp21
-rw-r--r--parts/filecreate/filecreate_filetype.h63
-rw-r--r--parts/filecreate/filecreate_listitem.cpp101
-rw-r--r--parts/filecreate/filecreate_listitem.h49
-rw-r--r--parts/filecreate/filecreate_newfile.cpp162
-rw-r--r--parts/filecreate/filecreate_newfile.h59
-rw-r--r--parts/filecreate/filecreate_part.cpp562
-rw-r--r--parts/filecreate/filecreate_part.h144
-rw-r--r--parts/filecreate/filecreate_typechooser.h47
-rw-r--r--parts/filecreate/filecreate_typechoosersig.h28
-rw-r--r--parts/filecreate/filecreate_widget2.cpp228
-rw-r--r--parts/filecreate/filecreate_widget2.h113
-rw-r--r--parts/filecreate/filecreate_widget3.cpp119
-rw-r--r--parts/filecreate/filecreate_widget3.h50
-rw-r--r--parts/filecreate/kdevfilecreate.desktop77
-rw-r--r--parts/filecreate/kdevpart_filecreate.rc11
-rw-r--r--parts/filecreate/template-info.xml181
-rw-r--r--parts/filelist/Makefile.am20
-rw-r--r--parts/filelist/README.dox13
-rw-r--r--parts/filelist/fileinfo.h37
-rw-r--r--parts/filelist/filelist_item.cpp104
-rw-r--r--parts/filelist/filelist_item.h53
-rw-r--r--parts/filelist/filelist_widget.cpp300
-rw-r--r--parts/filelist/filelist_widget.h72
-rw-r--r--parts/filelist/kdevfilelist.desktop76
-rw-r--r--parts/filelist/kdevfilelist.rc24
-rw-r--r--parts/filelist/projectviewconfig.cpp47
-rw-r--r--parts/filelist/projectviewconfig.h38
-rw-r--r--parts/filelist/projectviewconfigbase.ui93
-rw-r--r--parts/filelist/projectviewpart.cpp585
-rw-r--r--parts/filelist/projectviewpart.h169
-rw-r--r--parts/filelist/projectviewprojectconfig.cpp41
-rw-r--r--parts/filelist/projectviewprojectconfig.h41
-rw-r--r--parts/filelist/projectviewprojectconfigbase.ui94
-rw-r--r--parts/filelist/toolbarguibuilder.cpp59
-rw-r--r--parts/filelist/toolbarguibuilder.h58
-rw-r--r--parts/fileselector/Makefile.am18
-rw-r--r--parts/fileselector/README.dox13
-rw-r--r--parts/fileselector/fileselector_part.cpp108
-rw-r--r--parts/fileselector/fileselector_part.h40
-rw-r--r--parts/fileselector/fileselector_widget.cpp821
-rw-r--r--parts/fileselector/fileselector_widget.h203
-rw-r--r--parts/fileselector/kactionselector.cpp537
-rw-r--r--parts/fileselector/kactionselector.h399
-rw-r--r--parts/fileselector/kbookmarkhandler.cpp99
-rw-r--r--parts/fileselector/kbookmarkhandler.h70
-rw-r--r--parts/fileselector/kdevfileselector.desktop89
-rw-r--r--parts/fileselector/kdevpart_fileselector.rc8
-rw-r--r--parts/fileview/Makefile.am26
-rw-r--r--parts/fileview/README.dox53
-rw-r--r--parts/fileview/addfilegroupdlg.cpp73
-rw-r--r--parts/fileview/addfilegroupdlg.h39
-rw-r--r--parts/fileview/filegroupsconfigwidget.cpp133
-rw-r--r--parts/fileview/filegroupsconfigwidget.h44
-rw-r--r--parts/fileview/filegroupsconfigwidgetbase.ui229
-rw-r--r--parts/fileview/filegroupspart.cpp97
-rw-r--r--parts/fileview/filegroupspart.h43
-rw-r--r--parts/fileview/filegroupswidget.cpp442
-rw-r--r--parts/fileview/filegroupswidget.h54
-rw-r--r--parts/fileview/fileitemfactory.cpp145
-rw-r--r--parts/fileview/fileitemfactory.h89
-rw-r--r--parts/fileview/filetreeviewwidgetimpl.cpp169
-rw-r--r--parts/fileview/filetreeviewwidgetimpl.h105
-rw-r--r--parts/fileview/filetreewidget.cpp387
-rw-r--r--parts/fileview/filetreewidget.h111
-rw-r--r--parts/fileview/fileviewpart.cpp161
-rw-r--r--parts/fileview/fileviewpart.h49
-rw-r--r--parts/fileview/kdevfilegroups.desktop86
-rw-r--r--parts/fileview/kdevfileview.desktop85
-rw-r--r--parts/fileview/partwidget.cpp144
-rw-r--r--parts/fileview/partwidget.h45
-rw-r--r--parts/fileview/stdfiletreewidgetimpl.cpp95
-rw-r--r--parts/fileview/stdfiletreewidgetimpl.h36
-rw-r--r--parts/fileview/vcscolorsconfigwidget.cpp109
-rw-r--r--parts/fileview/vcscolorsconfigwidget.h68
-rw-r--r--parts/fileview/vcscolorsconfigwidgetbase.ui267
-rw-r--r--parts/fileview/vcsfiletreewidgetimpl.cpp353
-rw-r--r--parts/fileview/vcsfiletreewidgetimpl.h67
-rw-r--r--parts/filter/Makefile.am17
-rw-r--r--parts/filter/README.dox52
-rw-r--r--parts/filter/filterpart.cpp160
-rw-r--r--parts/filter/filterpart.h41
-rw-r--r--parts/filter/kdevfilter.desktop82
-rw-r--r--parts/filter/kdevfilter.rc10
-rw-r--r--parts/filter/kdevfilterIface.cpp35
-rw-r--r--parts/filter/kdevfilterIface.h26
-rw-r--r--parts/filter/shellfilterdlg.cpp128
-rw-r--r--parts/filter/shellfilterdlg.h52
-rw-r--r--parts/filter/shellinsertdlg.cpp125
-rw-r--r--parts/filter/shellinsertdlg.h49
-rw-r--r--parts/fullscreen/Makefile.am15
-rw-r--r--parts/fullscreen/README.dox10
-rw-r--r--parts/fullscreen/fullscreen_part.cpp72
-rw-r--r--parts/fullscreen/fullscreen_part.h36
-rw-r--r--parts/fullscreen/kdevfullscreen.desktop86
-rw-r--r--parts/fullscreen/kdevpart_fullscreen.rc12
-rw-r--r--parts/grepview/Makefile.am19
-rw-r--r--parts/grepview/README.dox12
-rw-r--r--parts/grepview/grepdlg.cpp381
-rw-r--r--parts/grepview/grepdlg.h104
-rw-r--r--parts/grepview/grepviewpart.cpp150
-rw-r--r--parts/grepview/grepviewpart.h50
-rw-r--r--parts/grepview/grepviewwidget.cpp535
-rw-r--r--parts/grepview/grepviewwidget.h111
-rw-r--r--parts/grepview/kdevgrepview.desktop86
-rw-r--r--parts/grepview/kdevgrepview.rc9
-rw-r--r--parts/konsole/Makefile.am16
-rw-r--r--parts/konsole/README.dox49
-rw-r--r--parts/konsole/kdevkonsoleview.desktop86
-rw-r--r--parts/konsole/konsoleviewpart.cpp69
-rw-r--r--parts/konsole/konsoleviewpart.h36
-rw-r--r--parts/konsole/konsoleviewwidget.cpp124
-rw-r--r--parts/konsole/konsoleviewwidget.h55
-rw-r--r--parts/openwith/Makefile.am15
-rw-r--r--parts/openwith/README.dox52
-rw-r--r--parts/openwith/kdevopenwith.desktop82
-rw-r--r--parts/openwith/openwithpart.cpp138
-rw-r--r--parts/openwith/openwithpart.h36
-rw-r--r--parts/outputviews/Makefile.am35
-rw-r--r--parts/outputviews/README.dox16
-rw-r--r--parts/outputviews/appoutputviewpart.cpp178
-rw-r--r--parts/outputviews/appoutputviewpart.h56
-rw-r--r--parts/outputviews/appoutputwidget.cpp355
-rw-r--r--parts/outputviews/appoutputwidget.h69
-rw-r--r--parts/outputviews/commandcontinuationfilter.cpp40
-rw-r--r--parts/outputviews/commandcontinuationfilter.h29
-rw-r--r--parts/outputviews/compileerrorfilter.cpp128
-rw-r--r--parts/outputviews/compileerrorfilter.h48
-rw-r--r--parts/outputviews/directorystatusmessagefilter.cpp187
-rw-r--r--parts/outputviews/directorystatusmessagefilter.h39
-rw-r--r--parts/outputviews/filterdlg.ui164
-rw-r--r--parts/outputviews/kdevappoutputview.desktop84
-rw-r--r--parts/outputviews/kdevmakeview.desktop87
-rw-r--r--parts/outputviews/kdevmakeview.rc9
-rw-r--r--parts/outputviews/makeactionfilter.cpp319
-rw-r--r--parts/outputviews/makeactionfilter.h62
-rw-r--r--parts/outputviews/makeitem.cpp166
-rw-r--r--parts/outputviews/makeitem.h164
-rw-r--r--parts/outputviews/makeviewpart.cpp105
-rw-r--r--parts/outputviews/makeviewpart.h46
-rw-r--r--parts/outputviews/makewidget.cpp847
-rw-r--r--parts/outputviews/makewidget.h129
-rw-r--r--parts/outputviews/otherfilter.cpp26
-rw-r--r--parts/outputviews/otherfilter.h34
-rw-r--r--parts/outputviews/outputfilter.cpp24
-rw-r--r--parts/outputviews/outputfilter.h29
-rw-r--r--parts/outputviews/outputviewsfactory.cpp21
-rw-r--r--parts/outputviews/outputviewsfactory.h27
-rw-r--r--parts/partexplorer/Makefile.am17
-rw-r--r--parts/partexplorer/README3
-rw-r--r--parts/partexplorer/README.dox24
-rw-r--r--parts/partexplorer/kdevpartexplorer.desktop76
-rw-r--r--parts/partexplorer/kdevpartexplorer.rc8
-rw-r--r--parts/partexplorer/partexplorer_plugin.cpp65
-rw-r--r--parts/partexplorer/partexplorer_plugin.h48
-rw-r--r--parts/partexplorer/partexplorerform.cpp231
-rw-r--r--parts/partexplorer/partexplorerform.h49
-rw-r--r--parts/partexplorer/partexplorerformbase.ui139
-rw-r--r--parts/quickopen/Makefile.am17
-rw-r--r--parts/quickopen/README.dox52
-rw-r--r--parts/quickopen/kdevpart_quickopen.rc15
-rw-r--r--parts/quickopen/kdevquickopen.desktop80
-rw-r--r--parts/quickopen/quickopen_part.cpp139
-rw-r--r--parts/quickopen/quickopen_part.h57
-rw-r--r--parts/quickopen/quickopenbase.ui178
-rw-r--r--parts/quickopen/quickopenclassdialog.cpp219
-rw-r--r--parts/quickopen/quickopenclassdialog.h56
-rw-r--r--parts/quickopen/quickopendialog.cpp155
-rw-r--r--parts/quickopen/quickopendialog.h63
-rw-r--r--parts/quickopen/quickopenfiledialog.cpp121
-rw-r--r--parts/quickopen/quickopenfiledialog.h49
-rw-r--r--parts/quickopen/quickopenfunctionchooseform.cpp56
-rw-r--r--parts/quickopen/quickopenfunctionchooseform.h48
-rw-r--r--parts/quickopen/quickopenfunctionchooseformbase.ui231
-rw-r--r--parts/quickopen/quickopenfunctiondialog.cpp229
-rw-r--r--parts/quickopen/quickopenfunctiondialog.h60
-rw-r--r--parts/regexptest/Makefile.am17
-rw-r--r--parts/regexptest/README.dox49
-rw-r--r--parts/regexptest/kdevregexptest.desktop82
-rw-r--r--parts/regexptest/kdevregexptest.rc9
-rw-r--r--parts/regexptest/regexptestdlg.cpp263
-rw-r--r--parts/regexptest/regexptestdlg.h46
-rw-r--r--parts/regexptest/regexptestdlgbase.ui352
-rw-r--r--parts/regexptest/regexptestpart.cpp63
-rw-r--r--parts/regexptest/regexptestpart.h37
-rw-r--r--parts/replace/Makefile.am16
-rw-r--r--parts/replace/README3
-rw-r--r--parts/replace/README.dox24
-rw-r--r--parts/replace/kdevpart_replace.rc8
-rw-r--r--parts/replace/kdevreplace.desktop80
-rw-r--r--parts/replace/replace_part.cpp110
-rw-r--r--parts/replace/replace_part.h46
-rw-r--r--parts/replace/replace_widget.cpp486
-rw-r--r--parts/replace/replace_widget.h81
-rw-r--r--parts/replace/replacedlg.ui385
-rw-r--r--parts/replace/replacedlgimpl.cpp188
-rw-r--r--parts/replace/replacedlgimpl.h38
-rw-r--r--parts/replace/replaceitem.cpp147
-rw-r--r--parts/replace/replaceitem.h113
-rw-r--r--parts/replace/replaceview.cpp141
-rw-r--r--parts/replace/replaceview.h54
-rw-r--r--parts/scripting/Makefile.am20
-rw-r--r--parts/scripting/README18
-rw-r--r--parts/scripting/kdevscripting.desktop77
-rw-r--r--parts/scripting/kdevscripting.rc8
-rw-r--r--parts/scripting/scriptingglobalconfig.cpp48
-rw-r--r--parts/scripting/scriptingglobalconfig.h41
-rw-r--r--parts/scripting/scriptingglobalconfigbase.ui51
-rw-r--r--parts/scripting/scriptingpart.cpp108
-rw-r--r--parts/scripting/scriptingpart.h57
-rw-r--r--parts/snippet/COPYING340
-rw-r--r--parts/snippet/Makefile.am17
-rw-r--r--parts/snippet/README3
-rw-r--r--parts/snippet/README.dox16
-rw-r--r--parts/snippet/kdevpart_snippet.rc8
-rw-r--r--parts/snippet/kdevsnippet.desktop102
-rw-r--r--parts/snippet/snippet_part.cpp155
-rw-r--r--parts/snippet/snippet_part.h50
-rw-r--r--parts/snippet/snippet_widget.cpp970
-rw-r--r--parts/snippet/snippet_widget.h90
-rw-r--r--parts/snippet/snippetconfig.cpp20
-rw-r--r--parts/snippet/snippetconfig.h56
-rw-r--r--parts/snippet/snippetdlg.ui214
-rw-r--r--parts/snippet/snippetdlg.ui.h21
-rw-r--r--parts/snippet/snippetitem.cpp127
-rw-r--r--parts/snippet/snippetitem.h70
-rw-r--r--parts/snippet/snippetsettings.cpp52
-rw-r--r--parts/snippet/snippetsettings.h41
-rw-r--r--parts/snippet/snippetsettingsbase.ui228
-rw-r--r--parts/texttools/Makefile.am18
-rw-r--r--parts/texttools/README.dox49
-rw-r--r--parts/texttools/kdevtexttools.desktop84
-rw-r--r--parts/texttools/texttoolspart.cpp99
-rw-r--r--parts/texttools/texttoolspart.h39
-rw-r--r--parts/texttools/texttoolswidget.cpp400
-rw-r--r--parts/texttools/texttoolswidget.h54
-rw-r--r--parts/tipofday/Makefile.am24
-rw-r--r--parts/tipofday/README.dox8
-rw-r--r--parts/tipofday/hi16-action-ktip.pngbin0 -> 496 bytes
-rw-r--r--parts/tipofday/hi32-action-ktip.pngbin0 -> 1300 bytes
-rw-r--r--parts/tipofday/hi48-action-ktip.pngbin0 -> 1825 bytes
-rw-r--r--parts/tipofday/kdevpart_tipofday.rc8
-rw-r--r--parts/tipofday/kdevtipofday.desktop94
-rw-r--r--parts/tipofday/lo16-action-kdevelop_tip.pngbin0 -> 273 bytes
-rw-r--r--parts/tipofday/lo32-action-kdevelop_tip.pngbin0 -> 372 bytes
-rw-r--r--parts/tipofday/tipofday_part.cpp67
-rw-r--r--parts/tipofday/tipofday_part.h33
-rw-r--r--parts/tipofday/tips203
-rw-r--r--parts/tools/Makefile.am16
-rw-r--r--parts/tools/README.dox12
-rw-r--r--parts/tools/addtooldlg.ui245
-rw-r--r--parts/tools/addtooldlg.ui.h31
-rw-r--r--parts/tools/kapplicationtree.cpp258
-rw-r--r--parts/tools/kapplicationtree.h102
-rw-r--r--parts/tools/kdevpart_tools.rc14
-rw-r--r--parts/tools/kdevtools.desktop82
-rw-r--r--parts/tools/tools_part.cpp272
-rw-r--r--parts/tools/tools_part.h55
-rw-r--r--parts/tools/toolsconfig.cpp169
-rw-r--r--parts/tools/toolsconfig.h71
-rw-r--r--parts/tools/toolsconfigwidget.cpp284
-rw-r--r--parts/tools/toolsconfigwidget.h60
-rw-r--r--parts/tools/toolsconfigwidgetbase.ui410
-rw-r--r--parts/uimode/Makefile.am13
-rw-r--r--parts/uimode/README.dox8
-rw-r--r--parts/uimode/kdevuichooser.desktop87
-rw-r--r--parts/uimode/uichooser.ui250
-rw-r--r--parts/uimode/uichooser_part.cpp52
-rw-r--r--parts/uimode/uichooser_part.h32
-rw-r--r--parts/uimode/uichooser_widget.cpp153
-rw-r--r--parts/uimode/uichooser_widget.h42
-rw-r--r--parts/valgrind/Makefile.am15
-rw-r--r--parts/valgrind/README.dox45
-rw-r--r--parts/valgrind/dialog_widget.ui360
-rw-r--r--parts/valgrind/dialog_widget.ui.h21
-rw-r--r--parts/valgrind/kdevpart_valgrind.rc9
-rw-r--r--parts/valgrind/kdevvalgrind.desktop74
-rw-r--r--parts/valgrind/valgrind_dialog.cpp206
-rw-r--r--parts/valgrind/valgrind_dialog.h62
-rw-r--r--parts/valgrind/valgrind_part.cpp366
-rw-r--r--parts/valgrind/valgrind_part.h62
-rw-r--r--parts/valgrind/valgrind_widget.cpp205
-rw-r--r--parts/valgrind/valgrind_widget.h44
-rw-r--r--parts/valgrind/valgrinditem.cpp71
-rw-r--r--parts/valgrind/valgrinditem.h50
-rw-r--r--parts/vcsmanager/Makefile.am19
-rw-r--r--parts/vcsmanager/README.dox55
-rw-r--r--parts/vcsmanager/kdevvcsmanager.desktop65
-rw-r--r--parts/vcsmanager/vcsmanagerpart.cpp115
-rw-r--r--parts/vcsmanager/vcsmanagerpart.h57
-rw-r--r--parts/vcsmanager/vcsmanagerprojectconfig.cpp69
-rw-r--r--parts/vcsmanager/vcsmanagerprojectconfig.h45
-rw-r--r--parts/vcsmanager/vcsmanagerprojectconfigbase.ui58
739 files changed, 100872 insertions, 0 deletions
diff --git a/parts/Makefile.am b/parts/Makefile.am
new file mode 100644
index 00000000..ca6b7f6b
--- /dev/null
+++ b/parts/Makefile.am
@@ -0,0 +1,11 @@
+# This is the collection of parts. These are derived from various
+# interfaces in kdevelop/lib/interfaces which are in turn derived
+# from KPart.
+
+SUBDIRS = abbrev appwizard astyle bookmarks classview diff filecreate fileview \
+ fullscreen outputviews grepview valgrind distpart konsole tools regexptest doxygen \
+ fileselector tipofday filter uimode openwith texttools replace partexplorer \
+ quickopen snippet filelist ctags2 documentation scripting vcsmanager
+
+DOXYGEN_EMPTY = YES
+include ../Doxyfile.am
diff --git a/parts/abbrev/Makefile.am b/parts/abbrev/Makefile.am
new file mode 100644
index 00000000..0319852f
--- /dev/null
+++ b/parts/abbrev/Makefile.am
@@ -0,0 +1,20 @@
+# Here resides the abbrev part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevabbrev.la
+libkdevabbrev_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevabbrev_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevabbrev_la_SOURCES = abbrevpart.cpp abbrevconfigwidget.cpp abbrevconfigwidgetbase.ui addtemplatedlg.cpp addtemplatedlgbase.ui
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevabbrev.desktop
+
+sourcesdir = $(kde_datadir)/kdevabbrev/sources
+sources_DATA = qt_classes cpp_keywords
+
+rcdir = $(kde_datadir)/kdevabbrev
+rc_DATA = kdevabbrev.rc
diff --git a/parts/abbrev/README.dox b/parts/abbrev/README.dox
new file mode 100644
index 00000000..1c8b3002
--- /dev/null
+++ b/parts/abbrev/README.dox
@@ -0,0 +1,20 @@
+/** \class AbbrevPart
+Provides support for customizable abbrevations - short words which expand into commonly needed code structures.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a>
+
+\feature Feature 1
+\feature Feature 2
+
+\bug Bug1
+\bug Bug2
+
+\note
+Put you notes here (if you have them!) :)
+\verbatim
+Verbatin code here
+\endverbatim
+
+*/
diff --git a/parts/abbrev/abbrevconfigwidget.cpp b/parts/abbrev/abbrevconfigwidget.cpp
new file mode 100644
index 00000000..d7729249
--- /dev/null
+++ b/parts/abbrev/abbrevconfigwidget.cpp
@@ -0,0 +1,121 @@
+/***************************************************************************
+ * Copyright (C) 2002 Roberto Raggi *
+ * roberto@kdevelop.org *
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "abbrevconfigwidget.h"
+
+#include <kconfig.h>
+#include <kiconloader.h>
+
+#include <qlistview.h>
+#include <qmultilineedit.h>
+#include <qcheckbox.h>
+
+#include "addtemplatedlg.h"
+#include "abbrevpart.h"
+
+AbbrevConfigWidget::AbbrevConfigWidget(AbbrevPart *part, QWidget *parent, const char *name)
+ : AbbrevConfigWidgetBase(parent, name)
+{
+ m_part = part;
+
+ qWarning("creating abbrevconfigwidget for %d abbrevs", part->templates().allTemplates().count());
+ QPtrList<CodeTemplate> templates = part->templates().allTemplates();
+ CodeTemplate *templ;
+ for (templ = templates.first(); templ; templ = templates.next())
+ {
+ qWarning("creating item for code template ");
+ QListViewItem *it = new QListViewItem( listTemplates,
+ templ->name,
+ templ->description,
+ templ->suffixes,
+ templ->code,
+ templ->code );
+ it->setPixmap( 0, SmallIcon("template_source"));
+ }
+
+ checkWordCompletion->setChecked( part->autoWordCompletionEnabled() );
+ listTemplates->setSorting(2);
+}
+
+
+AbbrevConfigWidget::~AbbrevConfigWidget()
+{}
+
+
+void AbbrevConfigWidget::addTemplate()
+{
+ QStringList suffixesList = m_part->templates().suffixes();
+
+ AddTemplateDialog dlg( suffixesList, this );
+ if( dlg.exec() ){
+ QString templ = dlg.templ();
+ QString description = dlg.description();
+ QString suffixes = dlg.suffixes();
+ if( !(templ.isEmpty() || description.isEmpty()) || suffixes.isEmpty()) {
+ QListViewItem* item = new QListViewItem( listTemplates, templ, description, suffixes );
+ listTemplates->setSelected( item, true );
+ editCode->setFocus();
+ }
+ }
+}
+
+
+void AbbrevConfigWidget::removeTemplate()
+{
+ if (!listTemplates->selectedItem())
+ return;
+ delete listTemplates->selectedItem();
+}
+
+
+void AbbrevConfigWidget::selectionChanged()
+{
+ QListViewItem* item = listTemplates->selectedItem();
+ if( item ){
+ editCode->setText( item->text(3) );
+ }
+}
+
+
+void AbbrevConfigWidget::codeChanged()
+{
+ QListViewItem* item = listTemplates->selectedItem();
+ if( item ){
+ item->setText( 3, editCode->text() );
+ if (item->text(3) == item->text(4))
+ item->setPixmap( 0, SmallIcon("template_source") );
+ else
+ item->setPixmap( 0, SmallIcon("filesave") );
+ }
+}
+
+
+void AbbrevConfigWidget::accept()
+{
+ m_part->clearTemplates();
+
+ QListViewItem* item = listTemplates->firstChild();
+ while( item ){
+ m_part->addTemplate( item->text(0),
+ item->text(1),
+ item->text(2),
+ item->text(3) );
+ item = item->nextSibling();
+ }
+
+ m_part->setAutoWordCompletionEnabled( checkWordCompletion->isChecked() );
+}
+
+#include "abbrevconfigwidget.moc"
diff --git a/parts/abbrev/abbrevconfigwidget.h b/parts/abbrev/abbrevconfigwidget.h
new file mode 100644
index 00000000..b8cc1983
--- /dev/null
+++ b/parts/abbrev/abbrevconfigwidget.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (C) 2002 Roberto Raggi *
+ * roberto@kdevelop.org *
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _ABBREVCONFIGWIDGET_H_
+#define _ABBREVCONFIGWIDGET_H_
+
+#include "abbrevconfigwidgetbase.h"
+#include "abbrevpart.h"
+
+
+class AbbrevConfigWidget : public AbbrevConfigWidgetBase
+{
+ Q_OBJECT
+
+public:
+ AbbrevConfigWidget(AbbrevPart *part, QWidget *parent=0, const char *name=0);
+ ~AbbrevConfigWidget();
+
+public slots:
+ void accept();
+
+private:
+ virtual void addTemplate();
+ virtual void removeTemplate();
+ virtual void selectionChanged();
+ virtual void codeChanged();
+
+ AbbrevPart *m_part;
+};
+
+#endif
diff --git a/parts/abbrev/abbrevconfigwidgetbase.ui b/parts/abbrev/abbrevconfigwidgetbase.ui
new file mode 100644
index 00000000..fd432a3e
--- /dev/null
+++ b/parts/abbrev/abbrevconfigwidgetbase.ui
@@ -0,0 +1,190 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>AbbrevConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>abbrev_config_widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>474</width>
+ <height>410</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Code Templates</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Co&amp;de:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>editCode</cstring>
+ </property>
+ </widget>
+ <widget class="QMultiLineEdit" row="3" column="0">
+ <property name="name">
+ <cstring>editCode</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>checkWordCompletion</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Enable automatic word completion</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>buttonRemoveTemplate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <widget class="QListView" row="1" column="0" rowspan="3" colspan="1">
+ <column>
+ <property name="text">
+ <string>Template</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Suffixes</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listTemplates</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>buttonAddTemplate</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Templates:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>listTemplates</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonAddTemplate</sender>
+ <signal>clicked()</signal>
+ <receiver>abbrev_config_widget</receiver>
+ <slot>addTemplate()</slot>
+ </connection>
+ <connection>
+ <sender>buttonRemoveTemplate</sender>
+ <signal>clicked()</signal>
+ <receiver>abbrev_config_widget</receiver>
+ <slot>removeTemplate()</slot>
+ </connection>
+ <connection>
+ <sender>editCode</sender>
+ <signal>textChanged()</signal>
+ <receiver>abbrev_config_widget</receiver>
+ <slot>codeChanged()</slot>
+ </connection>
+ <connection>
+ <sender>listTemplates</sender>
+ <signal>selectionChanged()</signal>
+ <receiver>abbrev_config_widget</receiver>
+ <slot>selectionChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>checkWordCompletion</tabstop>
+ <tabstop>listTemplates</tabstop>
+ <tabstop>buttonAddTemplate</tabstop>
+ <tabstop>buttonRemoveTemplate</tabstop>
+ <tabstop>editCode</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">addTemplate()</slot>
+ <slot access="protected">codeChanged()</slot>
+ <slot access="protected">removeTemplate()</slot>
+ <slot access="protected">selectionChanged()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/abbrev/abbrevpart.cpp b/parts/abbrev/abbrevpart.cpp
new file mode 100644
index 00000000..181606f4
--- /dev/null
+++ b/parts/abbrev/abbrevpart.cpp
@@ -0,0 +1,696 @@
+/***************************************************************************
+ * Copyright (C) 2002 Roberto Raggi *
+ * roberto@kdevelop.org *
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "abbrevpart.h"
+
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qregexp.h>
+#include <qvbox.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kstandarddirs.h>
+#include <kdevgenericfactory.h>
+#include <kaction.h>
+#include <kconfig.h>
+#include <kio/netaccess.h>
+#include <kiconloader.h>
+#include <kdevplugininfo.h>
+
+#include <ktexteditor/document.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/codecompletioninterface.h>
+
+#include "kdevcore.h"
+#include "kdevpartcontroller.h"
+#include "abbrevconfigwidget.h"
+#include "kdeveditorutil.h"
+
+static const KDevPluginInfo data("kdevabbrev");
+
+class AbbrevFactory : public KDevGenericFactory<AbbrevPart>
+{
+public:
+ AbbrevFactory()
+ : KDevGenericFactory<AbbrevPart>( data )
+ { }
+
+ virtual KInstance *createInstance()
+ {
+ KInstance *instance = KDevGenericFactory<AbbrevPart>::createInstance();
+ KStandardDirs *dirs = instance->dirs();
+ dirs->addResourceType( "codetemplates",
+ KStandardDirs::kde_default( "data" ) + "kdevabbrev/templates/" );
+ dirs->addResourceType( "sources",
+ KStandardDirs::kde_default( "data" ) + "kdevabbrev/sources" );
+
+ return instance;
+ }
+};
+
+K_EXPORT_COMPONENT_FACTORY( libkdevabbrev, AbbrevFactory )
+
+AbbrevPart::AbbrevPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "AbbrevPart")
+{
+ setInstance(AbbrevFactory::instance());
+ setXMLFile("kdevabbrev.rc");
+
+ connect(partController(), SIGNAL(activePartChanged(KParts::Part*)),
+ this, SLOT(slotActivePartChanged(KParts::Part*)) );
+
+ connect(core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(configWidget(KDialogBase*)));
+
+ KAction *action;
+ action = new KAction( i18n("Expand Text"), CTRL + Key_J,
+ this, SLOT(slotExpandText()),
+ actionCollection(), "edit_expandtext" );
+ action->setToolTip( i18n("Expand current word") );
+ action->setWhatsThis( i18n("<b>Expand current word</b><p>Current word can be completed using the list of similar words in source files.") );
+
+ action = new KAction( i18n("Expand Abbreviation"), CTRL + Key_L,
+ this, SLOT(slotExpandAbbrev()),
+ actionCollection(), "edit_expandabbrev" );
+ action->setToolTip( i18n("Expand abbreviation") );
+ action->setWhatsThis( i18n("<b>Expand abbreviation</b><p>Enable and configure abbreviations in <b>KDevelop Settings</b>, <b>Abbreviations</b> tab.") );
+
+ load();
+
+ m_inCompletion = false;
+ docIface = 0;
+ editIface = 0;
+ viewCursorIface = 0;
+ completionIface = 0;
+
+ m_prevLine = -1;
+ m_prevColumn = -1;
+ m_sequenceLength = 0;
+
+ KConfig* config = AbbrevFactory::instance()->config();
+ KConfigGroupSaver group( config, "General" );
+ m_autoWordCompletionEnabled = config->readBoolEntry( "AutoWordCompletion", false );
+
+ updateActions();
+
+ slotActivePartChanged( partController()->activePart() );
+}
+
+
+AbbrevPart::~AbbrevPart()
+{
+ save();
+}
+
+bool AbbrevPart::autoWordCompletionEnabled() const
+{
+ return m_autoWordCompletionEnabled;
+}
+
+void AbbrevPart::setAutoWordCompletionEnabled( bool enabled )
+{
+ if( enabled == m_autoWordCompletionEnabled )
+ return;
+
+ KConfig* config = AbbrevFactory::instance()->config();
+ KConfigGroupSaver group( config, "General" );
+
+ m_autoWordCompletionEnabled = enabled;
+ config->writeEntry( "AutoWordCompletion", m_autoWordCompletionEnabled );
+ config->sync();
+
+ if( !docIface || !docIface->widget() )
+ return;
+
+ disconnect( docIface, 0, this, 0 );
+ disconnect( docIface->widget(), 0, this, 0 );
+
+ if( m_autoWordCompletionEnabled ){
+ connect( docIface->widget(), SIGNAL(completionAborted()),
+ this, SLOT(slotCompletionAborted()) );
+ connect( docIface->widget(), SIGNAL(completionDone()),
+ this, SLOT(slotCompletionDone()) );
+ connect( docIface->widget(), SIGNAL(aboutToShowCompletionBox()),
+ this, SLOT(slotAboutToShowCompletionBox()) );
+
+ connect( docIface, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) );
+ }
+}
+void AbbrevPart::load()
+{
+ KStandardDirs *dirs = AbbrevFactory::instance()->dirs();
+ QString localTemplatesFile = locateLocal("codetemplates", "templates", AbbrevFactory::instance());
+ QStringList files;
+ if (QFileInfo(localTemplatesFile).exists())
+ files << localTemplatesFile;
+ else
+ files = dirs->findAllResources("codetemplates", QString::null, false, true);
+
+ QString localSourcesFile = locateLocal("sources", "sources", AbbrevFactory::instance());
+ QStringList sourceFiles;
+ if (QFileInfo(localSourcesFile).exists())
+ sourceFiles << localSourcesFile;
+ else
+ sourceFiles = dirs->findAllResources("sources", QString::null, false, true);
+ kdDebug(9028) << "=========> sourceFiles: " << sourceFiles.join(" ") << endl;
+
+ this->m_completionFile = QString::null;
+ for( QStringList::Iterator it=sourceFiles.begin(); it!=sourceFiles.end(); ++it ) {
+ QString fn = *it;
+ kdDebug(9028) << "===> load file: " << fn << endl;
+ QFile f( fn );
+ if ( f.open(IO_ReadOnly) ) {
+ QTextStream stream( &f );
+ m_completionFile += ( stream.read() + QString("\n") );
+ f.close();
+ }
+ }
+
+ QStringList::ConstIterator it;
+ for (it = files.begin(); it != files.end(); ++it) {
+ QString fn = *it;
+ kdDebug(9028) << "fn = " << fn << endl;
+ QFile f( fn );
+ if ( f.open(IO_ReadOnly) ) {
+ QDomDocument doc;
+ doc.setContent( &f );
+ QDomElement root = doc.firstChild().toElement();
+ QDomElement e = root.firstChild().toElement();
+ while ( !e.isNull() ){
+ addTemplate( e.attribute("name"),
+ e.attribute("description"),
+ e.attribute("suffixes"),
+ e.attribute("code") );
+ e = e.nextSibling().toElement();
+ }
+ f.close();
+ }
+ }
+}
+
+
+void AbbrevPart::save()
+{
+ QString fn = AbbrevFactory::instance()->dirs()->saveLocation("codetemplates", "", true);
+ kdDebug(9028) << "fn = " << fn << endl;
+
+ QDomDocument doc( "Templates" );
+ QDomElement root = doc.createElement( "Templates" );
+ doc.appendChild( root );
+
+ QPtrList<CodeTemplate> templates = m_templates.allTemplates();
+ CodeTemplate *templ;
+ for (templ = templates.first(); templ; templ = templates.next())
+ {
+ QDomElement e = doc.createElement( "Template" );
+ e.setAttribute( "name", templ->name );
+ e.setAttribute( "description", templ->description );
+ e.setAttribute( "suffixes", templ->suffixes );
+ e.setAttribute( "code", templ->code );
+ root.appendChild( e );
+ }
+
+ QFile f( fn + "templates" );
+ if( f.open(IO_WriteOnly) ){
+ QTextStream stream( &f );
+ stream << doc.toString();
+ f.close();
+ }
+}
+
+
+QString AbbrevPart::currentWord() const
+{
+ return KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+}
+
+
+void AbbrevPart::configWidget(KDialogBase *dlg)
+{
+ QVBox *vbox = dlg->addVBoxPage(i18n("Abbreviations"), i18n("Abbreviations"), BarIcon( info()->icon(), KIcon::SizeMedium) );
+ AbbrevConfigWidget *w = new AbbrevConfigWidget(this, vbox, "abbrev config widget");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+}
+
+
+void AbbrevPart::slotExpandText()
+{
+ if( !editIface || !completionIface || !viewCursorIface )
+ return;
+
+ QString word = currentWord();
+ if (word.isEmpty())
+ return;
+
+ QValueList<KTextEditor::CompletionEntry> entries = findAllWords(editIface->text(), word);
+ if (entries.count() == 0) {
+ ; // some statusbar message?
+// } else if (entries.count() == 1) {
+// uint line, col;
+// viewCursorIface->cursorPositionReal(&line, &col);
+// QString txt = entries[0].text.mid(word.length());
+// editIface->insertText( line, col, txt );
+// viewCursorIface->setCursorPositionReal( line, col + txt.length() );
+ } else {
+ m_inCompletion = true;
+ completionIface->showCompletionBox(entries, word.length());
+ }
+}
+
+
+QValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const QString &text, const QString &prefix)
+{
+ QValueList<KTextEditor::CompletionEntry> entries;
+
+ KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
+ QWidget *view = partController()->activeWidget();
+ if (!part || !view) {
+ kdDebug(9028) << "no rw part" << endl;
+ return entries;
+ }
+
+ QString suffix = part->url().url();
+ int pos = suffix.findRev('.');
+ if (pos != -1)
+ suffix.remove(0, pos+1);
+ kdDebug(9028) << "AbbrevPart::findAllWords with suffix " << suffix << endl;
+
+ QMap<QString, bool> map;
+ QRegExp rx( QString("\\b") + prefix + "[a-zA-Z0-9_]+\\b" );
+
+ int idx = 0;
+ pos = 0;
+ int len = 0;
+ while ( (pos = rx.search(text, idx)) != -1 ) {
+ len = rx.matchedLength();
+ QString word = text.mid(pos, len);
+ if (map.find(word) == map.end()) {
+ KTextEditor::CompletionEntry e;
+ e.text = word;
+ entries << e;
+ map[ word ] = TRUE;
+ }
+ idx = pos + len + 1;
+ }
+
+ idx = 0;
+ pos = 0;
+ len = 0;
+ while ( (pos = rx.search(m_completionFile, idx)) != -1 ) {
+ len = rx.matchedLength();
+ QString word = m_completionFile.mid(pos, len);
+ if (map.find(word) == map.end()) {
+ KTextEditor::CompletionEntry e;
+ e.text = word;
+ entries << e;
+ map[ word ] = TRUE;
+ }
+ idx = pos + len + 1;
+ }
+
+
+ QMap<QString, CodeTemplate*> m = m_templates[suffix];
+ for (QMap<QString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) {
+ KTextEditor::CompletionEntry e;
+ e.text = it.data()->description + " <abbrev>";
+ e.userdata = it.key();
+ entries << e;
+ }
+
+ return entries;
+}
+
+
+void AbbrevPart::slotExpandAbbrev()
+{
+ KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
+ QWidget *view = partController()->activeWidget();
+ if (!part || !view) {
+ kdDebug(9028) << "no rw part" << endl;
+ return;
+ }
+
+ QString suffix = part->url().url();
+ int pos = suffix.findRev('.');
+ if (pos != -1)
+ suffix.remove(0, pos+1);
+
+ KTextEditor::EditInterface *editiface
+ = dynamic_cast<KTextEditor::EditInterface*>(part);
+ if (!editiface) {
+ kdDebug(9028) << "no editiface" << endl;
+ return;
+ }
+ KTextEditor::ViewCursorInterface *cursoriface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(view);
+ if (!cursoriface) {
+ kdDebug(9028) << "no viewcursoriface" << endl;
+ return;
+ }
+
+ QString word = currentWord();
+ kdDebug(9028) << "Expanding word " << word << " with suffix " << suffix << "." << endl;
+
+ QMap<QString, CodeTemplate*> m = m_templates[suffix];
+ for (QMap<QString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) {
+ if (it.key() != word)
+ continue;
+
+ uint line, col;
+ cursoriface->cursorPositionReal(&line, &col);
+
+ QString linestr = editIface->textLine(line);
+ int startPos = QMAX( QMIN( (int)col, (int)linestr.length()-1 ), 0 );
+ int endPos = startPos;
+ startPos--;
+ while (startPos >= 0 && ( linestr[startPos].isLetterOrNumber() || linestr[startPos] == '_' || linestr[startPos] == '~') )
+ startPos--;
+ while (endPos < (int)linestr.length() && ( linestr[endPos].isLetterOrNumber() || linestr[endPos] == '_' ) )
+ endPos++;
+
+ editiface->removeText( line, startPos+1, line, endPos );
+ insertChars(it.data()->code );
+ }
+}
+
+
+void AbbrevPart::insertChars( const QString &chars )
+{
+ unsigned line=0, col=0;
+ viewCursorIface->cursorPositionReal( &line, &col );
+
+ unsigned int currentLine=line, currentCol=col;
+
+ QString spaces;
+ QString s = editIface->textLine( currentLine );
+ uint i=0;
+ while( i<s.length() && s[ i ].isSpace() ){
+ spaces += s[ i ];
+ ++i;
+ }
+
+ bool foundPipe = false;
+ QString str;
+ QTextStream stream( &str, IO_WriteOnly );
+ QStringList lines = QStringList::split( "\n", chars );
+ QStringList::Iterator it = lines.begin();
+ line = currentLine;
+ while( it != lines.end() ){
+ QString lineText = *it;
+ if( it != lines.begin() ){
+ stream << spaces;
+ if( !foundPipe )
+ currentCol += spaces.length();
+ }
+
+ int idx = lineText.find( '|' );
+ if( idx != -1 ){
+ stream << lineText.left( idx ) << lineText.mid( idx+1 );
+ if( !foundPipe ){
+ foundPipe = true;
+ currentCol += lineText.left( idx ).length();
+ kdDebug(9007) << "found pipe at " << currentLine << ", " << currentCol << endl;
+ }
+ } else {
+ stream << lineText;
+ }
+
+ ++it;
+
+ if( it != lines.end() ){
+ stream << "\n";
+ if( !foundPipe ){
+ ++currentLine;
+ currentCol = 0;
+ }
+ }
+ }
+ editIface->insertText( line, col, str );
+ kdDebug(9007) << "go to " << currentLine << ", " << currentCol << endl;
+ viewCursorIface->setCursorPositionReal( currentLine, currentCol );
+}
+
+void AbbrevPart::addTemplate( const QString& templ,
+ const QString& descr,
+ const QString& suffixes,
+ const QString& code)
+{
+ m_templates.insert(templ, descr, code, suffixes);
+}
+
+
+void AbbrevPart::removeTemplate( const QString &suffixes, const QString &name )
+{
+ m_templates.remove( suffixes, name );
+}
+
+
+void AbbrevPart::clearTemplates()
+{
+ m_templates.clear();
+}
+
+CodeTemplateList AbbrevPart::templates() const
+{
+ return m_templates;
+}
+
+void AbbrevPart::slotActivePartChanged( KParts::Part* part )
+{
+ kdDebug(9028) << "AbbrevPart::slotActivePartChanged()" << endl;
+ KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( part );
+
+ if( !doc || !part->widget() || doc == docIface )
+ {
+ actionCollection()->action( "edit_expandtext" )->setEnabled( false );
+ actionCollection()->action( "edit_expandabbrev" )->setEnabled( false );
+ return;
+ }
+
+ docIface = doc;
+
+ if( !docIface ){
+ docIface = 0;
+ editIface = 0;
+ viewCursorIface = 0;
+ completionIface = 0;
+ }
+
+ editIface = dynamic_cast<KTextEditor::EditInterface*>( part );
+ viewCursorIface = dynamic_cast<KTextEditor::ViewCursorInterface*>( part->widget() );
+ completionIface = dynamic_cast<KTextEditor::CodeCompletionInterface*>( part->widget() );
+
+ updateActions();
+
+ if( !editIface || !viewCursorIface || !completionIface )
+ return;
+
+ disconnect( part->widget(), 0, this, 0 );
+ disconnect( doc, 0, this, 0 );
+
+ connect( part->widget(), SIGNAL(filterInsertString(KTextEditor::CompletionEntry*, QString*)),
+ this, SLOT(slotFilterInsertString(KTextEditor::CompletionEntry*, QString*)) );
+
+ if( autoWordCompletionEnabled() ){
+ connect( part->widget(), SIGNAL(completionAborted()), this, SLOT(slotCompletionAborted()) );
+ connect( part->widget(), SIGNAL(completionDone()), this, SLOT(slotCompletionDone()) );
+ connect( part->widget(), SIGNAL(aboutToShowCompletionBox()), this, SLOT(slotAboutToShowCompletionBox()) );
+ connect( doc, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) );
+ }
+
+ m_prevLine = -1;
+ m_prevColumn = -1;
+ m_sequenceLength = 0;
+ kdDebug(9028) << "AbbrevPart::slotActivePartChanged() -- OK" << endl;
+}
+
+void AbbrevPart::slotTextChanged()
+{
+ if( m_inCompletion )
+ return;
+
+ unsigned int line, col;
+ viewCursorIface->cursorPositionReal( &line, &col );
+
+ if( m_prevLine != int(line) || m_prevColumn+1 != int(col) || col == 0 ){
+ m_prevLine = line;
+ m_prevColumn = col;
+ m_sequenceLength = 1;
+ return;
+ }
+
+ QString textLine = editIface->textLine( line );
+ QChar ch = textLine[ col-1 ];
+ QChar currentChar = textLine[ col ];
+
+ if( currentChar.isLetterOrNumber() || currentChar == QChar('_') || !(ch.isLetterOrNumber() || ch == QChar('_')) ){
+ // reset
+ m_prevLine = -1;
+ return;
+ }
+
+ if( m_sequenceLength >= 3 )
+ slotExpandText();
+
+ ++m_sequenceLength;
+ m_prevLine = line;
+ m_prevColumn = col;
+}
+
+void AbbrevPart::slotFilterInsertString( KTextEditor::CompletionEntry* entry, QString* text )
+{
+ kdDebug(9028) << "AbbrevPart::slotFilterInsertString()" << endl;
+ KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
+ QWidget *view = partController()->activeWidget();
+ if (!part || !view) {
+ kdDebug(9028) << "no rw part" << endl;
+ return;
+ }
+
+ QString suffix = part->url().url();
+ int pos = suffix.findRev('.');
+ if (pos != -1)
+ suffix.remove(0, pos+1);
+ kdDebug(9028) << "AbbrevPart::slotFilterInsertString with suffix " << suffix << endl;
+
+ if( !entry || !text || !viewCursorIface || !editIface )
+ return;
+
+ QString expand( " <abbrev>" );
+ if( !entry->userdata.isNull() && entry->text.endsWith(expand) ){
+ QString macro = entry->text.left( entry->text.length() - expand.length() );
+ *text = "";
+ uint line, col;
+ viewCursorIface->cursorPositionReal( &line, &col );
+ editIface->removeText( line, col-currentWord().length(), line, col );
+ insertChars( m_templates[suffix][entry->userdata]->code );
+ }
+}
+
+void AbbrevPart::updateActions()
+{
+ actionCollection()->action( "edit_expandtext" )->setEnabled( docIface != 0 );
+ actionCollection()->action( "edit_expandabbrev" )->setEnabled( docIface != 0 );
+}
+
+void AbbrevPart::slotCompletionAborted()
+{
+ kdDebug(9028) << "AbbrevPart::slotCompletionAborted()" << endl;
+ m_inCompletion = false;
+}
+
+void AbbrevPart::slotCompletionDone()
+{
+ kdDebug(9028) << "AbbrevPart::slotCompletionDone()" << endl;
+ m_inCompletion = false;
+}
+
+void AbbrevPart::slotAboutToShowCompletionBox()
+{
+ kdDebug(9028) << "AbbrevPart::slotAboutToShowCompletionBox()" << endl;
+ m_inCompletion = true;
+}
+
+CodeTemplateList::CodeTemplateList( )
+{
+ allCodeTemplates.setAutoDelete(true);
+}
+
+CodeTemplateList::~ CodeTemplateList( )
+{
+}
+
+QMap< QString, CodeTemplate * > CodeTemplateList::operator [ ]( QString suffix )
+{
+ kdDebug(9028) << "CodeTemplateList::operator []" << endl;
+ QMap< QString, CodeTemplate * > selectedTemplates;
+ for (QMap<QString, QMap<QString, CodeTemplate* > >::const_iterator it = templates.begin(); it != templates.end(); ++it)
+ {
+ kdDebug(9028) << "CodeTemplateList::operator [] - suffixes " << it.key() << endl;
+ if (QStringList::split(",", it.key()).contains(suffix))
+ {
+ kdDebug(9028) << "CodeTemplateList::operator [] - suffixes " << it.key() << " contains " << suffix << endl;
+
+ QMap<QString, CodeTemplate* > m = it.data();
+ for (QMap<QString, CodeTemplate* >::const_iterator itt = m.begin(); itt != m.end(); ++itt)
+ {
+ kdDebug(9028) << "x" << endl;
+ selectedTemplates[itt.key()] = itt.data();
+ }
+ }
+ }
+ return selectedTemplates;
+}
+
+void CodeTemplateList::insert( QString name, QString description, QString code, QString suffixes )
+{
+ QString origSuffixes = suffixes;
+// QStringList suffixList;
+ int pos = suffixes.find('(');
+ if (pos == -1)
+ return;
+ suffixes.remove(0, pos+1);
+ pos = suffixes.find(')');
+ if (pos == -1)
+ return;
+ suffixes.remove(pos, suffixes.length()-pos);
+// suffixList = QStringList::split(",", suffixes);
+
+ CodeTemplate *t;
+ if (templates.contains(suffixes) && templates[suffixes].contains(name))
+ {
+ kdDebug(9028) << "found template for suffixes " << suffixes << " and name " << name << endl;
+ t = templates[suffixes][name];
+ }
+ else
+ {
+ kdDebug(9028) << "creating template for suffixes " << suffixes << " and name " << name << endl;
+ t = new CodeTemplate();
+ allCodeTemplates.append(t);
+ templates[suffixes][name] = t;
+ }
+ t->name = name;
+ t->description = description;
+ t->code = code;
+ t->suffixes = origSuffixes;
+ if (!m_suffixes.contains(origSuffixes))
+ m_suffixes.append(origSuffixes);
+}
+
+QPtrList< CodeTemplate > CodeTemplateList::allTemplates( ) const
+{
+ return allCodeTemplates;
+}
+
+void CodeTemplateList::remove( const QString & suffixes, const QString & name )
+{
+ allCodeTemplates.remove(templates[suffixes][name]);
+ templates[suffixes].remove(name);
+}
+
+void CodeTemplateList::clear( )
+{
+ templates.clear();
+ allCodeTemplates.clear();
+}
+
+QStringList CodeTemplateList::suffixes( )
+{
+ return m_suffixes;
+}
+
+#include "abbrevpart.moc"
diff --git a/parts/abbrev/abbrevpart.h b/parts/abbrev/abbrevpart.h
new file mode 100644
index 00000000..f0029b51
--- /dev/null
+++ b/parts/abbrev/abbrevpart.h
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright (C) 2002 Roberto Raggi *
+ * roberto@kdevelop.org *
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _ABBREVPART_H_
+#define _ABBREVPART_H_
+
+#include <qmap.h>
+#include <qptrlist.h>
+#include "kdevplugin.h"
+
+#include <ktexteditor/codecompletioninterface.h>
+
+class KDialogBase;
+
+namespace KParts{
+ class Part;
+}
+
+namespace KTextEditor{
+ class Document;
+ class EditInterface;
+ class ViewCursorInterface;
+}
+
+struct CodeTemplate {
+ QString name;
+ QString description;
+ QString code;
+ QString suffixes;
+};
+
+class CodeTemplateList {
+public:
+ CodeTemplateList();
+ ~CodeTemplateList();
+
+ QMap<QString, CodeTemplate* > operator[](QString suffix);
+ void insert(QString name, QString description, QString code, QString suffixes);
+ void remove(const QString &suffixes, const QString &name);
+ void clear();
+ QStringList suffixes();
+
+ QPtrList<CodeTemplate> allTemplates() const;
+
+private:
+ QMap<QString, QMap<QString, CodeTemplate* > > templates;
+ QPtrList<CodeTemplate> allCodeTemplates;
+ QStringList m_suffixes;
+};
+
+class AbbrevPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ AbbrevPart( QObject *parent, const char *name, const QStringList & );
+ ~AbbrevPart();
+
+ bool autoWordCompletionEnabled() const;
+ void setAutoWordCompletionEnabled( bool enabled );
+
+ void addTemplate(const QString &templ, const QString &descr,
+ const QString &suffixes, const QString &code);
+ void removeTemplate(const QString &suffixes, const QString &name);
+ void clearTemplates();
+ CodeTemplateList templates() const;
+
+private slots:
+ void slotExpandText();
+ void slotExpandAbbrev();
+ void configWidget(KDialogBase *dlg);
+ void slotActivePartChanged( KParts::Part* );
+ void slotTextChanged();
+ void slotCompletionAborted();
+ void slotCompletionDone();
+ void slotFilterInsertString( KTextEditor::CompletionEntry*, QString* );
+ void slotAboutToShowCompletionBox();
+
+private:
+ void updateActions();
+ void load();
+ void save();
+ QString currentWord() const;
+ QValueList<KTextEditor::CompletionEntry> findAllWords(const QString &text, const QString &prefix);
+ void insertChars( const QString &chars );
+// QAsciiDict<CodeTemplate> m_templates;
+ CodeTemplateList m_templates;
+ bool m_inCompletion;
+ int m_prevLine;
+ int m_prevColumn;
+ int m_sequenceLength;
+ bool m_autoWordCompletionEnabled;
+ QString m_completionFile;
+
+ KTextEditor::Document* docIface;
+ KTextEditor::EditInterface* editIface;
+ KTextEditor::ViewCursorInterface* viewCursorIface;
+ KTextEditor::CodeCompletionInterface* completionIface;
+};
+
+#endif
diff --git a/parts/abbrev/addtemplatedlg.cpp b/parts/abbrev/addtemplatedlg.cpp
new file mode 100644
index 00000000..3c84c2e1
--- /dev/null
+++ b/parts/abbrev/addtemplatedlg.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2002 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include "addtemplatedlg.h"
+#include <qcombobox.h>
+#include <klineedit.h>
+#include <qpushbutton.h>
+
+AddTemplateDialog::AddTemplateDialog( QStringList suffixesList, QWidget *parent, const char *name )
+ : AddTemplateDialogBase( parent, name )
+{
+ setFocusProxy( editTemplate );
+ comboSuffixes->insertStringList(suffixesList);
+ connect( editTemplate, SIGNAL(textChanged ( const QString & )), this, SLOT( textChanged()));
+ connect( editDescription, SIGNAL(textChanged ( const QString & )), this, SLOT( textChanged()));
+ buttonOk->setEnabled(false);
+}
+
+AddTemplateDialog::~AddTemplateDialog()
+{
+}
+
+void AddTemplateDialog::textChanged()
+{
+ buttonOk->setEnabled( !editTemplate->text().isEmpty() && !editDescription->text().isEmpty() );
+}
+
+QString AddTemplateDialog::templ() const
+{
+ return editTemplate->text();
+}
+
+QString AddTemplateDialog::description() const
+{
+ return editDescription->text();
+}
+
+QString AddTemplateDialog::suffixes() const
+{
+ return comboSuffixes->currentText();
+}
+
+#include "addtemplatedlg.moc"
diff --git a/parts/abbrev/addtemplatedlg.h b/parts/abbrev/addtemplatedlg.h
new file mode 100644
index 00000000..ddc22eb7
--- /dev/null
+++ b/parts/abbrev/addtemplatedlg.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2002 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#ifndef caddtemplatedialog_h
+#define caddtemplatedialog_h
+
+#include "addtemplatedlgbase.h"
+
+
+class AddTemplateDialog: public AddTemplateDialogBase
+{
+ Q_OBJECT
+
+public:
+ AddTemplateDialog( QStringList suffixesList, QWidget *parent=0, const char *name=0 );
+ virtual ~AddTemplateDialog();
+
+ QString templ() const;
+ QString description() const;
+ QString suffixes() const;
+private slots:
+ void textChanged();
+};
+
+#endif
diff --git a/parts/abbrev/addtemplatedlgbase.ui b/parts/abbrev/addtemplatedlgbase.ui
new file mode 100644
index 00000000..bfe5f0bb
--- /dev/null
+++ b/parts/abbrev/addtemplatedlgbase.ui
@@ -0,0 +1,176 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddTemplateDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AddTemplateDialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>348</width>
+ <height>161</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add Code Template</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Template:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>editTemplate</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Description:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>editDescription</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>editTemplate</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>editDescription</cstring>
+ </property>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>10</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>comboSuffixes</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>labelSuffixes</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Suffixes:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>comboSuffixes</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>AddTemplateDialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>AddTemplateDialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>editTemplate</tabstop>
+ <tabstop>editDescription</tabstop>
+ <tabstop>comboSuffixes</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/abbrev/cpp_keywords b/parts/abbrev/cpp_keywords
new file mode 100644
index 00000000..72d96901
--- /dev/null
+++ b/parts/abbrev/cpp_keywords
@@ -0,0 +1,84 @@
+K_DCOP
+k_dcop
+k_dcop_signals
+Q_OBJECT
+signals
+slots
+emit
+__int64
+__asm__
+and
+and_eq
+asm
+auto
+bitand
+bitor
+bool
+break
+case
+catch
+char
+class
+compl
+const
+const_cast
+continue
+default
+delete
+do
+double
+dynamic_cast
+else
+enum
+explicit
+export
+extern
+false
+float
+for
+friend
+goto
+if
+inline
+int
+long
+mutable
+namespace
+new
+not
+not_eq
+operator
+or
+or_eq
+private
+protected
+public
+register
+reinterpret_cast
+return
+short
+signed
+sizeof
+static
+static_cast
+struct
+switch
+template
+this
+throw
+true
+try
+typedef
+typeid
+typename
+union
+unsigned
+using
+virtual
+void
+volatile
+while
+xor
+xor_eq
+
+
diff --git a/parts/abbrev/kdevabbrev.desktop b/parts/abbrev/kdevabbrev.desktop
new file mode 100644
index 00000000..3e913e8d
--- /dev/null
+++ b/parts/abbrev/kdevabbrev.desktop
@@ -0,0 +1,83 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides support for customizable abbreviations - short words which expand into commonly needed code structures.
+Comment[ca]=Proporciona suport per a abreviatures personalitzables - paraules curtes que en expandir-se formen estructures de codi usades habitualment.
+Comment[da]=Sørger for støtte til brugerindrettede forkortelser - korte ord som udvides til almindeligt nyttige kodestrukturer.
+Comment[de]=Unterstützung für benutzerdefinierte Abkürzungen - Kurzbegriffe, die zu häufig verwendeten Quelltextstrukturen erweitert werden.
+Comment[el]=Προσφέρει υποστήριξη για προσαρμοσμένες συντομογραφίες - σύντομες λέξεις οι οποίες αναπτύσσονται σε συχνά χρησιμοποιούμενες δομές κώδικα.
+Comment[en_GB]=Provides support for customisable abbreviations - short words which expand into commonly needed code structures.
+Comment[es]=Proporciona soporte para las abreviaturas personalizables - palabras cortas que se expanden en estructuras utilizadas habitualmente.
+Comment[et]=Pakub kohandatavate lühendite toetust. Viimased on lühendid, mis laienevad sagedamini vajaminevateks koodistruktuurideks.
+Comment[eu]=Laburdura pertsonalizatuen euskarria eskeintzen du-normalean behar diren kode-egitura bezala zabalduko diren hitz motzak.
+Comment[fa]=پشتیبانی برای مختصرسازیهای سفارشی فراهم می‌کند - واژه‌های کوتاه که اغلب به ساختارهای کد مورد نیاز بسط می‌یابد.
+Comment[fr]=Fournit une prise en charge pour les abréviations personnalisables - mots abrégés qui s'étendent en structures de code communément nécessaires.
+Comment[gl]=Proporciona soporte para abreviaturas persoalizadas - palabras curtas que se expanden en estructuras de código usadas frecuentemente.
+Comment[hi]=मनपसंद किए जा सकने योग्य संक्षिप्त शब्दों जो कि सामान्यतया आवश्यक कोड स्ट्रक्चर में एक्सपांड हो सकें, के लिए समर्थन प्रदान करता है.
+Comment[hu]=Lehetővé teszi különféle rövidítések használatát (rövid kifejezések kódstruktúrává kibontását)
+Comment[it]=Offre il supporto per le abbreviazioni personalizzate - brevi parole che vengono espanse in strutture di codice richieste comunemente.
+Comment[ja]=短い単語を一般に必要とされるコードに展開する、カスタマイズ可能な略語のサポートを提供します。
+Comment[ms]=Menyediakan sokongan untuk kependekan boleh ditetapkan - perkataan pendek yang berkembang kepada struktur kod yang biasa diperlukan.
+Comment[nds]=Ünnerstütten för egen Afkörten - Kortwöör, de na faken bruukt Kodestrukturen utfooldt warrt.
+Comment[ne]=साझा आवश्यक सङ्केत बनावटमा विस्तार गरिने छोटो शब्द - अनुकूलन संक्षिप्त रूपका लागि समर्थन प्रदान गर्दछ ।
+Comment[nl]=Biedt ondersteuning voor afkortingen - korte stukjes tekst die expanderen tot veelgebruikte codestructuren.
+Comment[pl]=Umożliwia obsługę konfigurowalnych skrótów - krótkich słow rozszerzających się w często używane struktury kodu.
+Comment[pt]=Oferece o suporte para abreviaturas personalizadas - palavras curtas que podem expandir para estruturas de código normalmente necessárias.
+Comment[pt_BR]=Fornece suporte para abreviaturas personalizadas - palavras curtas que se expandem em estruturas de código normalmente necessárias.
+Comment[ru]=Предоставляет поддержку для настраиваемых сокращений - коротких слов, которые заменяются на часто используемые структуры кода.
+Comment[sk]=Poskytuje podporu pre prispôsobiteľné skratky - krátke slová, ktoré sa rozvinú do bežne potrebných kódových štruktúr.
+Comment[sr]=Обезбеђује подршку за прилагодљиве скраћенице — кратке речи које се проширују у уобичајено потребне структуре кôда.
+Comment[sr@Latn]=Obezbeđuje podršku za prilagodljive skraćenice — kratke reči koje se proširuju u uobičajeno potrebne strukture kôda.
+Comment[sv]=Ger stöd för anpassningsbara förkortningar: korta ord som expanderas till vanligt använda kodstrukturer.
+Comment[ta]=தேவைக்கேற்ப சுருக்கத்திற்கு இது ஆதரவு தரும்-குறியிடு வடிவத்திற்கு இந்த சுருக்கங்கள் மிகவும் உதவும்.
+Comment[tg]=Барои кӯтоҳ намоӣ ёрдами худро саҳм мегузорад, яъне калимаҳои кӯтоҳе, ки як хел вақт ба структураҳои коди истифода намоии истифода бурда мешавад.
+Comment[tr]=Özelleştirilebilir kısaltmalar için destek sağlar - sık ihtiyaç duyualan kod yapıları yerine geçen kısa kelimeler.
+Comment[zh_CN]=为自定义缩写提供支持 - 按需要扩展为所需代码结构的简短文字。
+Comment[zh_TW]=提供可調整的縮寫支援 - 將短的字擴展到常用的程式源碼結構。
+Name=KDevAbbrev
+Name[da]=KDevelop Forkortelser
+Name[de]=Abkürzungsmodul (KDevelop)
+Name[hi]=के-डेव-एब्रिवि
+Name[nds]=KDevelop-Afkörtenmoduul
+Name[pl]=KDevSkróty
+Name[sk]=KDev skratky
+Name[sv]=KDevelop förkortningar
+Name[zh_TW]=KDevelop 縮寫
+GenericName=Abbreviation Expansion
+GenericName[ca]=Expansió d'abreviatures
+GenericName[da]=Forkortelsesudvidelse
+GenericName[de]=Abkürzungsvervollständigung
+GenericName[el]=Ανάπτυξη συντομογραφιών
+GenericName[es]=Expansión de abreviaturas
+GenericName[et]=Lühendite laienemine
+GenericName[eu]=Laburduren zabalkuntza
+GenericName[fa]=بسط مختصرسازی
+GenericName[fr]=Expansion des abréviations
+GenericName[gl]=Expansión de abreviaturas
+GenericName[hi]=संक्षिप्त शब्द एक्सपांशन
+GenericName[hu]=Rövidítéskezelő
+GenericName[it]=Espansione delle abbreviazioni
+GenericName[ja]=略語拡張
+GenericName[ms]=Pengembang Kependekan
+GenericName[nds]=Afkörtenutfoolden
+GenericName[ne]=संक्षिप्त रूप विस्तार
+GenericName[nl]=Afkortingen expanderen
+GenericName[pl]=Rozwijanie skrótów
+GenericName[pt]=Expansão de Abreviaturas
+GenericName[pt_BR]=Expansão de Abreviaturas
+GenericName[ru]=Расширение сокращений
+GenericName[sk]=Rozvinutie skratiek
+GenericName[sr]=Проширење скраћеница
+GenericName[sr@Latn]=Proširenje skraćenica
+GenericName[sv]=Expansion av förkortningar
+GenericName[ta]=சுருக்கத்தின் விரிவாக்கம்
+GenericName[tg]=Васеъкунии кӯтоҳ карда шуда
+GenericName[tr]=Kısaltma Genişlemesi
+GenericName[zh_CN]=缩写扩展
+GenericName[zh_TW]=縮寫擴展
+ServiceTypes=KDevelop/Plugin
+Icon=fontsizeup
+X-KDE-Library=libkdevabbrev
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=CodeEditing
diff --git a/parts/abbrev/kdevabbrev.rc b/parts/abbrev/kdevabbrev.rc
new file mode 100644
index 00000000..e994ee76
--- /dev/null
+++ b/parts/abbrev/kdevabbrev.rc
@@ -0,0 +1,10 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevAbbrevPart" version="1">
+<MenuBar>
+ <Menu name="edit" >
+ <Action name="edit_expandtext"/>
+ <Action name="edit_expandabbrev"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/abbrev/qt_classes b/parts/abbrev/qt_classes
new file mode 100644
index 00000000..266307bc
--- /dev/null
+++ b/parts/abbrev/qt_classes
@@ -0,0 +1,409 @@
+QAccel
+QAccessible
+QApplication
+QAsciiDict
+QAsyncIO
+QAuBucket
+QBackInsertIterator
+QBaseBucket
+QBitArray
+QBitVal
+QBitmap
+QBoxLayout
+QBoxLayoutData
+QBrush
+QButton
+QButtonData
+QButtonGroup
+QButtonList
+QCDict
+QCList
+QCListIt
+QCString
+QCache
+QCanvas
+QCanvasChunk
+QCanvasData
+QCanvasEllipse
+QCanvasItem
+QCanvasItemExtra
+QCanvasLine
+QCanvasPixmap
+QCanvasPixmapArray
+QCanvasPolygon
+QCanvasPolygonalItem
+QCanvasRectangle
+QCanvasSprite
+QCanvasText
+QCanvasTextExtra
+QCanvasView
+QCanvasViewData
+QChar
+QCharRef
+QCharRef
+QCheckBox
+QCheckListItem
+QCleanupHandler
+QClipboard
+QColor
+QColorGroup
+QComboBox
+QComboBoxData
+QConnection
+QConnectionList
+QConnectionListIt
+QCursor
+QCustomMenuItem
+QDataSource
+QDataStream
+QDataStream
+QDate
+QDateTime
+QDeepCopy
+QDialog
+QDict
+QDir
+QDiskFont
+QDockArea
+QDockAreaLayout
+QDockWindow
+QDockWindowHandle
+QDockWindowResizeHandle
+QDockWindowTitleBar
+QDomAttr
+QDomCDATASection
+QDomCharacterData
+QDomComment
+QDomDocument
+QDomDocumentFragment
+QDomDocumentType
+QDomElement
+QDomEntity
+QDomEntityReference
+QDomImplementation
+QDomNamedNodeMap
+QDomNode
+QDomNodeList
+QDomNotation
+QDomProcessingInstruction
+QDomText
+QDragEnterEvent
+QDragLeaveEvent
+QDragMoveEvent
+QDragObject
+QDragObjectData
+QDropSite
+QEvent
+QEventLoop
+QFileDialog
+QFileDialogQFileListView
+QFileInfo
+QFilePreview
+QFocusData
+QFocusData
+QFocusEvent
+QFont
+QFontDatabase
+QFontEngine
+QFontInfo
+QFontMetrics
+QFontPrivate
+QFontStylePrivate
+QFtpCommand
+QGArray
+QGCacheIterator
+QGDItList
+QGDict
+QGDictIterator
+QGDictIterator
+QGL
+QGLCmap
+QGLColormap
+QGLOverlayWidget
+QGList
+QGListIterator
+QGListIteratorList
+QGListStdIterator
+QGVector
+QGfx
+QGridLayout
+QGridLayoutBox
+QGridLayoutData
+QGroupBox
+QGuardedPtr
+QHBoxLayout
+QHeader
+QHeaderData
+QHostAddress
+QHttpHeader
+QHttpRequest
+QIODevice
+QIconDragItem
+QIconFactory
+QIconSet
+QIconView
+QIconViewItem
+QIconViewItemLineEdit
+QIconViewPrivate
+QIconViewToolTip
+QImage
+QImageConsumer
+QImageDataMisc
+QImageDecoder
+QImageDrag
+QImageDragData
+QImageFormat
+QImageFormat
+QImageFormatType
+QImageIO
+QImageTextKeyLang
+QIntDict
+QInternal
+QJpUnicodeConv
+QKeyEvent
+QKeySequence
+QLNode
+QLabel
+QLayout
+QLayoutItem
+QLayoutIterator
+QLibrary
+QLineEdit
+QListBox
+QListBoxItem
+QListView
+QListViewItem
+QListViewItemIterator
+QListViewToolTip
+QLocale
+QMacDndExtra
+QMacMime
+QMacSavedPortInfo
+QMainWindow
+QMainWindowLayout
+QMap
+QMapConstIterator
+QMapIterator
+QMemberDict
+QMembuf
+QMenuBar
+QMenuData
+QMenuDataData
+QMenuItem
+QMenuItem
+QMenuItemData
+QMetaObject
+QMetaObject
+QMetaObjectCleanUp
+QMetaProperty
+QMetaProperty
+QMimeSource
+QMimeSourceFactory
+QMimeSourceFactory
+QMimeSourceFactoryData
+QMouseEvent
+QMovie
+QMovie
+QMultiCellPixmap
+QMultiLineEditCommand
+QMultiLineEditData
+QMutex
+QMutexLocker
+QNPInstance
+QNPStream
+QNPlugin
+QNetworkOperation
+QNetworkProtocol
+QNetworkProtocolFactoryBase
+QObject
+QObjectList
+QObjectListIt
+QObjectUserData
+QObjectUserData
+QOleDropTarget
+QPaintDevice
+QPaintDevice
+QPaintDeviceMetrics
+QPaintDeviceMetrics
+QPaintEvent
+QPainter
+QPalette
+QPen
+QPicture
+QPixmap
+QPixmapCache
+QPoint
+QPointArray
+QPolygonScanner
+QPolygonalProcessor
+QPopupMenu
+QPostEventList
+QPrinter
+QProcess
+QProgressDialogData
+QPtrCollection
+QPtrDict
+QPtrList
+QPtrVector
+QPushButton
+QRangeControl
+QRect
+QRect
+QRegExp
+QRegExpEngine
+QRegion
+QResizeEvent
+QSArgument
+QSEditor
+QSInterpreter
+QSObjectFactory
+QSProject
+QSScript
+QSStackFrame
+QSWrapperFactory
+QScrollViewData
+QSemaphore
+QSenderObjectList
+QSessionManager
+QSessionManagerData
+QSettings
+QSharedCleanupHandler
+QShowEvent
+QSignal
+QSignalMapperData
+QSignalVec
+QSimpleRichText
+QSimpleRichTextData
+QSingleCleanupHandler
+QSize
+QSizePolicy
+QSocket
+QSocketDevice
+QSocketNotifier
+QSoundData
+QSpacerItem
+QSpinBox
+QSplitter
+QSplitterHandle
+QSplitterLayoutStruct
+QSql
+QSqlCursor
+QSqlDatabase
+QSqlDriver
+QSqlDriverCreatorBase
+QSqlDriverExtension
+QSqlEditorFactory
+QSqlError
+QSqlExtension
+QSqlField
+QSqlFieldInfo
+QSqlForm
+QSqlIndex
+QSqlPropertyMap
+QSqlPropertyMap
+QSqlQuery
+QSqlRecord
+QSqlRecordInfo
+QSqlResult
+QStatusBar
+QStoredDragData
+QStrList
+QString
+QStringList
+QStyle
+QStyleFactory
+QStyleHintReturn
+QStyleOption
+QStyleSheet
+QStyleSheetItemData
+QSyntaxHighlighter
+QSyntaxHighlighterInternal
+QTSManip
+QTab
+QTabBar
+QTabWidgetData
+QTable
+QTableHeader
+QTableSelection
+QTextBrowser
+QTextBrowserData
+QTextCodec
+QTextCodec
+QTextCodecFactory
+QTextCommand
+QTextCursor
+QTextCustomItem
+QTextDecoder
+QTextDecoder
+QTextDocument
+QTextDrag
+QTextEdit
+QTextEncoder
+QTextFormat
+QTextFormatCollection
+QTextItem
+QTextOStreamIterator
+QTextParag
+QTextParagraph
+QTextStream
+QTextString
+QTextView
+QThread
+QThreadInstance
+QThreadStorage
+QThreadStorageData
+QTime
+QTimer
+QTimerEvent
+QTipManager
+QToolBar
+QToolButton
+QToolTipGroup
+QTranslator
+QTranslatorMessage
+QUrl
+QUrlInfo
+QUrlOperator
+QVBoxLayout
+QValidator
+QValueList
+QValueListConstIterator
+QValueListIterator
+QValueListNode
+QValueVector
+QVariant
+QWMatrix
+QWMatrix
+QWSDecoration
+QWSDisplay
+QWSManager
+QWSRegionManager
+QWaitCondition
+QWheelEvent
+QWidget
+QWidgetFactory
+QWidgetList
+QWidgetListIt
+QWidgetMapper
+QWidgetResizeHandler
+QWidgetStack
+QWindowsMime
+QWindowsXPStyle
+QWorkspaceChild
+QXmlAttributes
+QXmlContentHandler
+QXmlDTDHandler
+QXmlDeclHandler
+QXmlDefaultHandler
+QXmlEntityResolver
+QXmlErrorHandler
+QXmlInputSource
+QXmlLexicalHandler
+QXmlLocator
+QXmlNamespaceSupport
+QXmlParseException
+QXmlReader
+QXmlSimpleReader
+QPNGImageWriter
+QuickInterpreter
+UibStrTable
diff --git a/parts/appwizard/Makefile.am b/parts/appwizard/Makefile.am
new file mode 100644
index 00000000..cd37f1cb
--- /dev/null
+++ b/parts/appwizard/Makefile.am
@@ -0,0 +1,28 @@
+
+# Here resides the app wizard part.
+
+SUBDIRS = . imports common licenses
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \
+ -I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets \
+ -I$(top_srcdir)/src/profileengine/lib $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevappwizard.la
+libkdevappwizard_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevappwizard_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(top_builddir)/lib/util/libkdevutil.la \
+ $(top_builddir)/lib/widgets/propeditor/libkdevpropertyeditor.la $(top_builddir)/src/profileengine/lib/libprofileengine.la
+
+libkdevappwizard_la_SOURCES = appwizardfactory.cpp appwizardpart.cpp \
+ appwizarddlg.cpp importdlg.cpp filepropspagebase.ui filepropspage.cpp \
+ appwizarddlgbase.ui importdlgbase.ui misc.cpp vcs_form.ui\
+ kdevfile.cpp kdevlicense.cpp profilesupport.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevappwizard.desktop
+
+rcdir = $(kde_datadir)/kdevappwizard
+rc_DATA = kdevappwizard.rc
+noinst_HEADERS = profilesupport.h
diff --git a/parts/appwizard/README b/parts/appwizard/README
new file mode 100644
index 00000000..f3657a61
--- /dev/null
+++ b/parts/appwizard/README
@@ -0,0 +1 @@
+Please read the README.dox file \ No newline at end of file
diff --git a/parts/appwizard/README.dox b/parts/appwizard/README.dox
new file mode 100644
index 00000000..4e2858b0
--- /dev/null
+++ b/parts/appwizard/README.dox
@@ -0,0 +1,80 @@
+/** \class AppWizardPart
+Application Wizard.
+
+\verbatim
+The config files for the application Wizard understands following options
+
+Group [General]
+Name: this name will be displayed in the Treeview (Application Wizard)
+Icon: a screenshot from your application (190x140 pixel)
+Category: the category, will we displayed hierarchic in a
+ treeview (current implementation)
+Comment: a small comment for the template, longer comments should go
+ into a README.devel and shown on startup
+ShowFilesAfterGeneration:
+ this comma separated list of files will be opened after the project
+ generation, for instance a readme, path is relative to the project dir,
+ APPNAMEUC will be replaced with the project name in uppercase,
+ APPNAMELC will be replaced with the project name in lowercase,
+ APPNAME will be replaced with the project name.
+ (example: ShowFilesAfterGeneration=README.devel,APPNAMELC_plugin.cpp)
+DefaultDestinatonDir:
+ changes the default destination dir for the project (~)
+ to your value, HOMEDIR is a keyword
+FileTemplates:
+ a list of pairs of strings, where the first element is the
+ name a file template to be created, and the second element
+ is either CStyle, PStyle, ShellStyle, or None. With CStyle, the
+ application wizard proposes a file header in C comment style.
+ With PStyle the application wizard creates a header
+ in Pascal comment style. With ShellStyle, the application
+ wizard creates a header in shell comment style.
+
+an example for a php template:
+
+[General]
+Name=Simple PHP script
+Category=PHP
+Comment=This generates a simplistic 'Hello world' program in PHP (http://www.php.net)
+Icon= php.png
+ShowFilesAfterGeneration=README.devel
+DefaultDestinatonDir=HOMEDIR/public_html
+FileTemplates=php,ShellStyle
+
+The template project files (*.kdevelop) defines which parts are
+loaded for the project and how they are configured. The set of
+loaded parts is primarily determined by a set of key words.
+The following keywords are currently used:
+
+C C language
+C++ C++ language
+Java Java language
+Pascal Pascal language
+Python Python language
+PHP PHP language
+Perl Perl language
+Code Compiled to native, debuggable code
+JVM Executed and debugged in the Java VM
+GBA Game Boy Advance
+KDE KDE application/applet
+Qt Qt based
+Kicker Kicker applet
+kioslave KDE ioslave
+KOffice KOffice application
+KDevelop KDevelop plugin
+GNOME GNOME application
+\endverbatim
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\feature Provide a basic application framework (for plugins and applications for many languages) that you can use as a starting point.
+\feature Development for 3rd party developers made easy. :)
+\feature A further step to rapid application development (RAD).
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=appwizard&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">appwizard component at Bugzilla database</a>
+\bug The C/C++ applications use libtool as a degugging shell. That doesn't work. Please remove libtool from "Project Options...-> Debugger -> Debugging Shell" to make them work.
+
+\requirement <a href="http://www.perl.com"> perl </a> >= 5.004
+
+
+*/
diff --git a/parts/appwizard/appwizarddlg.cpp b/parts/appwizard/appwizarddlg.cpp
new file mode 100644
index 00000000..816786ff
--- /dev/null
+++ b/parts/appwizard/appwizarddlg.cpp
@@ -0,0 +1,1374 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2001 by Sandy Meier *
+ * smeier@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "appwizarddlg.h"
+
+#include <qvbox.h>
+#include <qbuttongroup.h>
+#include <qcombobox.h>
+#include <qtabwidget.h>
+#include <qwidgetstack.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qgrid.h>
+#include <qheader.h>
+#include <qmap.h>
+#include <qmultilineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qregexp.h>
+#include <qtextstream.h>
+#include <qtextview.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qvalidator.h>
+#include <qtimer.h>
+#include <klistview.h>
+#include <kiconview.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kiconloader.h>
+#include <kfiledialog.h>
+#include <kfile.h>
+#include <kapplication.h>
+#include <kpopupmenu.h>
+
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+#include <kio/netaccess.h>
+#include <qfile.h>
+#include <kmacroexpander.h>
+#include <karchive.h>
+#include <ktar.h>
+#include <ktempdir.h>
+#include <kfileitem.h>
+#include <kio/chmodjob.h>
+
+#include <qlayout.h>
+
+#include "domutil.h"
+#include "kdevversioncontrol.h"
+#include "kdevmakefrontend.h"
+#include "kdevpartcontroller.h"
+#include "kdevplugincontroller.h"
+#include "kdevappfrontend.h"
+#include "kdevplugininfo.h"
+#include "kdevlicense.h"
+#include "kdevcore.h"
+#include "appwizardfactory.h"
+#include "appwizardpart.h"
+#include "filepropspage.h"
+#include "misc.h"
+#include "profilesupport.h"
+#include "filetemplate.h"
+#include "settings.h"
+
+#include "blockingkprocess.h"
+
+#include "profileengine.h"
+#include "profile.h"
+
+#include "propeditor/property.h"
+#include "propeditor/multiproperty.h"
+#include "propeditor/propertylist.h"
+#include "propeditor/propertyeditor.h"
+
+AppWizardDialog::AppWizardDialog(AppWizardPart *part, QWidget *parent, const char *name)
+ : AppWizardDialogBase(parent, name,true), m_pCurrentAppInfo(0),
+ m_profileSupport(new ProfileSupport(part))
+{
+ kdDebug( 9010 ) << " ** AppWizardDialog::AppWizardDialog()" << endl;
+
+ m_customOptions = 0L;
+ loadLicenses();
+ connect( this, SIGNAL( selected( const QString & ) ), this, SLOT( pageChanged() ) );
+
+ helpButton()->hide();
+ templates_listview->header()->hide();
+ templates_listview->setColumnWidthMode(0, QListView::Maximum); //to provide horiz scrollbar.
+
+ m_templatesMenu = new KPopupMenu(templates_listview);
+ m_templatesMenu->insertItem(i18n("&Add to Favorites"), this, SLOT(addTemplateToFavourites()));
+
+ m_favouritesMenu = new KPopupMenu(favourites_iconview);
+ m_favouritesMenu->insertItem(i18n("&Remove Favorite"), this, SLOT(removeFavourite()));
+
+ m_pathIsValid=false;
+ m_part = part;
+ m_projectLocationWasChanged=false;
+ m_appsInfo.setAutoDelete(true);
+ m_tempFiles.setAutoDelete(true);
+
+ KConfig *config = kapp->config();
+
+ //config->setGroup("AppWizard");
+ //templates_tabwidget->setCurrentPage(config->readNumEntry("CurrentTab", 0));
+
+ config->setGroup("General Options");
+ QString defaultProjectsDir = config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/");
+
+ KStandardDirs *dirs = AppWizardFactory::instance()->dirs();
+ QStringList m_templateNames = dirs->findAllResources("apptemplates", QString::null, false, true);
+
+ kdDebug(9010) << "Templates: " << endl;
+ QStringList categories;
+
+ QStringList::Iterator it;
+ for (it = m_templateNames.begin(); it != m_templateNames.end(); ++it) {
+ kdDebug(9010) << (*it) << endl;
+
+ ApplicationInfo *info = new ApplicationInfo;
+ info->propValues = new PropertyLib::PropertyList();
+ info->templateFile = KGlobal::dirs()->findResource("apptemplates", *it);
+ info->templateName = (*it);
+
+ KConfig templateConfig(info->templateFile);
+ templateConfig.setGroup("General");
+
+ info->name = templateConfig.readEntry("Name");
+ info->icon = templateConfig.readEntry("Icon");
+ info->comment = templateConfig.readEntry("Comment");
+ info->fileTemplates = templateConfig.readEntry("FileTemplates");
+ info->openFilesAfterGeneration = templateConfig.readListEntry("ShowFilesAfterGeneration");
+ QString destDir = templateConfig.readPathEntry("DefaultDestinatonDir", defaultProjectsDir);
+ destDir.replace(QRegExp("HOMEDIR"), QDir::homeDirPath());
+ info->defaultDestDir = destDir;
+ QString category = templateConfig.readEntry("Category");
+ // format category to a unique status
+ if (category.right(1) == "/")
+ category.remove(category.length()-1, 1); // remove /
+ if (category.left(1) != "/")
+ category.prepend("/"); // prepend /
+ categories.append(category);
+ info->category = category;
+ info->sourceArchive = templateConfig.readEntry("Archive");
+
+ // Grab includes list
+ QStringList groups = templateConfig.groupList();
+ groups.remove("General");
+ QStringList::Iterator group = groups.begin();
+ for( ; group != groups.end(); ++group)
+ {
+ templateConfig.setGroup( (*group) );
+ QString type = templateConfig.readEntry("Type").lower();
+ if( type == "include" ) // Add value
+ {
+ info->includes.append( templateConfig.readEntry( "File" ) );
+ kdDebug(9010) << "Adding: " << templateConfig.readEntry( "File" ) << endl;
+ }
+ }
+
+ // Build builtins map to bootstrap.
+ QString source = kdevRoot( info->templateName );
+ info->subMap.insert("kdevelop", source );
+
+ // Add includes to the main template...
+ QStringList::Iterator include = info->includes.begin();
+ for( ; include != info->includes.end(); ++include)
+ {
+ if( !(*include).isEmpty() )
+ {
+ QString file = KMacroExpander::expandMacros( ( *include ), info->subMap);
+ KConfig tmpCfg( file );
+ tmpCfg.copyTo( "", &templateConfig);
+ kdDebug(9010) << "Merging: " << tmpCfg.name() << endl;
+ }
+ }
+
+ groups = templateConfig.groupList(); // Must get this again since its changed!
+ group = groups.begin();
+ for( ; group != groups.end(); ++group)
+ {
+ templateConfig.setGroup( (*group) );
+ QString type = templateConfig.readEntry("Type", "value").lower();
+ kdDebug(9010) << "Reading " << (*group) << " of type " << type << endl;
+ if( type == "value" ) // Add value
+ {
+ QString name = templateConfig.readEntry( "Value" );
+ QString label = templateConfig.readEntry( "Comment" );
+ QString type = templateConfig.readEntry( "ValueType", "String" );
+ QVariant::Type variantType = QVariant::nameToType( type.latin1());
+ QVariant value = templateConfig.readPropertyEntry( "Default", variantType );
+ value.cast( variantType ); // fix this in kdelibs...
+ if( !name.isEmpty() && !label.isEmpty() )
+ info->propValues->addProperty( new PropertyLib::Property( (int)variantType, name, label, value ) );
+
+ }
+ else if( type == "install" ) // copy dir
+ {
+ installFile file;
+ file.source = templateConfig.readPathEntry("Source");
+ file.dest = templateConfig.readPathEntry("Dest");
+ file.process = templateConfig.readBoolEntry("Process",true);
+ file.isXML = templateConfig.readBoolEntry("EscapeXML",false);
+ file.option = templateConfig.readEntry("Option");
+ info->fileList.append(file);
+ }
+ else if( type == "install archive" )
+ {
+ installArchive arch;
+ arch.source = templateConfig.readPathEntry("Source");
+ arch.dest = templateConfig.readPathEntry("Dest");
+ arch.process = templateConfig.readBoolEntry("Process",true);
+ arch.option = templateConfig.readEntry("Option", "" );
+ info->archList.append(arch);
+ }
+ else if( type == "mkdir" )
+ {
+ installDir dir;
+ dir.dir = templateConfig.readPathEntry("Dir");
+ dir.option = templateConfig.readEntry("Option", "" );
+ dir.perms = templateConfig.readNumEntry("Perms", 0777 );
+ info->dirList.append(dir);
+ }
+ else if( type == "finishcmd" )
+ {
+ info->finishCmd=templateConfig.readPathEntry("Command");
+ info->finishCmdDir=templateConfig.readPathEntry("Directory");
+ }
+ else if( type == "ui")
+ {
+ QString name = templateConfig.readPathEntry("File");
+ info->customUI = name;
+ }
+ else if( type == "message" )
+ {
+ info->message = templateConfig.readEntry( "Comment" );
+ }
+ }
+
+
+ m_appsInfo.append(info);
+ }
+
+ // Insert categories into list view
+ categories.sort();
+ for (it = categories.begin(); it != categories.end(); ++it)
+ insertCategoryIntoTreeView(*it);
+
+ // Insert items into list view
+ QPtrListIterator<ApplicationInfo> ait(m_appsInfo);
+ for (; ait.current(); ++ait) {
+ QListViewItem *item = m_categoryMap.find(ait.current()->category);
+ if (item)
+ {
+ item = new KListViewItem(item, ait.current()->name);
+ item->setPixmap(0, SmallIcon("kdevelop"));
+ }
+ else
+ kdDebug(9010) << "Error can't find category in categoryMap: "
+ << ait.current()->category << endl;
+ ait.current()->item = item;
+ }
+
+ //Load favourites from config
+ populateFavourites();
+
+ QString author, email;
+ AppWizardUtil::guessAuthorAndEmail(&author, &email);
+ author_edit->setText(author);
+ email_edit->setText(email);
+ QToolTip::add( dest_edit->button(), i18n("Choose projects directory") );
+ dest_edit->setURL(defaultProjectsDir);
+ dest_edit->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
+
+ loadVcs();
+
+ // addPage(m_sdi_fileprops_page,"Class/File Properties");
+
+ // licenseChanged();
+
+ setNextEnabled(generalPage, false);
+
+// QRegExp appname_regexp ("[a-zA-Z][a-zA-Z0-9_]*"); //Non-Unicode version
+ /* appname will start with a letter, and will contain letters,
+ digits or underscores. */
+ QRegExp appname_regexp ("[a-zA-Z][a-zA-Z0-9_]*");
+ // How about names like "__" or "123" for project name? Are they legal?
+ QRegExpValidator *appname_edit_validator;
+ appname_edit_validator = new QRegExpValidator (appname_regexp,
+ appname_edit,
+ "AppNameValidator");
+ appname_edit->setValidator(appname_edit_validator);
+
+ // insert the licenses into the license_combo
+ QDict< KDevLicense > lics( licenses() );
+ QDictIterator< KDevLicense > dit(lics);
+ int idx=1;
+ for( ; dit.current(); ++dit )
+ {
+ license_combo->insertItem( dit.currentKey(), idx++ );
+ if( dit.currentKey() == "GPL" )
+ license_combo->setCurrentItem( idx - 1 );
+ }
+
+ connect( license_combo, SIGNAL(activated(int)), this, SLOT(licenseChanged()) );
+
+ m_custom_options_layout = new QHBoxLayout( custom_options );
+ m_custom_options_layout->setAutoAdd(true);
+
+ showTemplates(false);
+}
+
+AppWizardDialog::~AppWizardDialog()
+{}
+
+void AppWizardDialog::loadVcs()
+{
+ m_vcsForm = new VcsForm();
+
+ int i=0;
+ m_vcsForm->combo->insertItem( i18n("no version control system", "None"), i );
+ m_vcsForm->stack->addWidget( 0, i++ );
+
+ // We query for all vcs integrators for KDevelop
+ KTrader::OfferList offers = KTrader::self()->query("KDevelop/VCSIntegrator", "");
+ KTrader::OfferList::const_iterator serviceIt = offers.begin();
+ for (; serviceIt != offers.end(); ++serviceIt)
+ {
+ KService::Ptr service = *serviceIt;
+ kdDebug(9010) << "AppWizardDialog::loadVcs: creating vcs integrator "
+ << service->name() << endl;
+
+ KLibFactory *factory = KLibLoader::self()->factory(QFile::encodeName(service->library()));
+ if (!factory) {
+ QString errorMessage = KLibLoader::self()->lastErrorMessage();
+ kdDebug(9010) << "There was an error loading the module " << service->name() << endl <<
+ "The diagnostics is:" << endl << errorMessage << endl;
+ continue;
+ }
+ QStringList args;
+ QObject *obj = factory->create(0, service->name().latin1(),
+ "KDevVCSIntegrator", args);
+ KDevVCSIntegrator *integrator = (KDevVCSIntegrator*) obj;
+
+ if (!integrator)
+ kdDebug(9010) << " failed to create vcs integrator " << service->name() << endl;
+ else
+ {
+ kdDebug(9010) << " success" << endl;
+
+ QString vcsName = service->property("X-KDevelop-VCS").toString();
+ m_vcsForm->combo->insertItem(vcsName, i);
+ m_integrators.insert(vcsName, integrator);
+
+ VCSDialog *vcs = integrator->integrator(m_vcsForm->stack);
+ if (vcs)
+ {
+ m_integratorDialogs[i] = vcs;
+ QWidget *w = vcs->self();
+ if (w)
+ m_vcsForm->stack->addWidget(w, i++);
+ else
+ kdDebug(9010) << " integrator widget is 0" << endl;
+ }
+ else
+ kdDebug(9010) << " integrator is 0" << endl;
+ }
+ }
+
+ addPage(m_vcsForm, i18n("Version Control System"));
+}
+
+void AppWizardDialog::updateNextButtons()
+{
+ bool validGeneralPage = m_pCurrentAppInfo
+ && !appname_edit->text().isEmpty()
+ && m_pathIsValid;
+ bool validPropsPage = !version_edit->text().isEmpty()
+ && !author_edit->text().isEmpty();
+
+ setFinishEnabled(m_lastPage, validGeneralPage && validPropsPage);
+ nextButton()->setEnabled(
+ currentPage() == generalPage ? validGeneralPage : validPropsPage );
+}
+
+void AppWizardDialog::textChanged()
+{
+// licenseChanged();
+
+ updateNextButtons();
+}
+
+void AppWizardDialog::licenseChanged()
+{
+ QValueList<AppWizardFileTemplate>::Iterator it;
+ if( license_combo->currentItem() == 0 )
+ {
+ for (it = m_fileTemplates.begin(); it != m_fileTemplates.end(); ++it)
+ {
+ QMultiLineEdit *edit = (*it).edit;
+ edit->setText( QString::null );
+ }
+ } else {
+ KDevLicense* lic = licenses()[ license_combo->currentText() ];
+ for (it = m_fileTemplates.begin(); it != m_fileTemplates.end(); ++it) {
+ QString style = (*it).style;
+ QMultiLineEdit *edit = (*it).edit;
+
+ KDevFile::CommentingStyle commentStyle = KDevFile::CPPStyle;
+ if (style == "PStyle") {
+ commentStyle = KDevFile::PascalStyle;
+ } else if (style == "AdaStyle") {
+ commentStyle = KDevFile::AdaStyle;
+ } else if (style == "ShellStyle") {
+ commentStyle = KDevFile::BashStyle;
+ } else if (style == "XMLStyle") {
+ commentStyle = KDevFile::XMLStyle;
+ }
+
+ QString text;
+ text = lic->assemble( commentStyle, author_edit->text(), email_edit->text() , 0 );
+ edit->setText(text);
+ }
+ }
+}
+
+QString AppWizardDialog::kdevRoot(const QString &templateName ) const
+{
+ QString source;
+ QFileInfo finfo(templateName);
+ QDir dir(finfo.dir());
+ dir.cdUp();
+ return dir.absPath();
+}
+
+void AppWizardDialog::accept()
+{
+ QFileInfo fi(finalLoc_label->text());
+ // check /again/ whether the dir already exists; maybe users create it in the meantime
+ if (fi.exists() ) {
+ KMessageBox::sorry(this, i18n("The directory you have chosen as the location for "
+ "the project already exists."));
+ showPage(generalPage);
+ appname_edit->setFocus();
+ projectLocationChanged();
+ return;
+ }
+
+ if( !QFileInfo(dest_edit->url()).isWritable() ){
+ KMessageBox::sorry(this, i18n("The directory you have chosen as the location for "
+ "the project is not writeable."));
+ showPage(generalPage);
+ appname_edit->setFocus();
+ projectLocationChanged();
+ return;
+ }
+
+ QString source = kdevRoot( m_pCurrentAppInfo->templateName );
+
+ // Unpack template archive to temp dir, and get the name
+ kdDebug(9010) << "Unpacking archive to temp dir" << endl;
+ KTempDir archDir;
+ archDir.setAutoDelete(true);
+ KTar templateArchive( source + "/" + m_pCurrentAppInfo->sourceArchive, "application/x-gzip" );
+ if( templateArchive.open( IO_ReadOnly ) )
+ {
+ //templateArchive.directory()->copyTo(archDir.name(), true);
+ unpackArchive(templateArchive.directory(), archDir.name(), false);
+ }
+ else
+ {
+ KMessageBox::sorry(this, i18n("The template %1 cannot be opened.").arg( source + "/" + m_pCurrentAppInfo->sourceArchive ) );
+ templateArchive.close();
+ return;
+ }
+ templateArchive.close();
+
+ kdDebug(9010) << "build macro map" << endl;
+ // Build KMacroExpander map
+ //m_customOptions->dataForm()->fillPropertyMap(&m_pCurrentAppInfo->subMap);
+ PropertyLib::PropertyList::Iterator idx = m_pCurrentAppInfo->propValues->begin();
+ for( ; idx != m_pCurrentAppInfo->propValues->end(); ++idx)
+ m_pCurrentAppInfo->subMap.insert( idx.data()->name(), idx.data()->value().toString() );
+
+ m_pCurrentAppInfo->subMap.insert("src", archDir.name() );
+ m_pCurrentAppInfo->subMap.insert("dest", finalLoc_label->text() );
+ m_pCurrentAppInfo->subMap.insert("APPNAME", appname_edit->text() );
+ m_pCurrentAppInfo->subMap.insert("APPNAMELC", appname_edit->text().lower() );
+ m_pCurrentAppInfo->subMap.insert("APPNAMESC", QString(appname_edit->text()[0]).upper() + appname_edit->text().mid(1));
+ m_pCurrentAppInfo->subMap.insert("APPNAMEUC", appname_edit->text().upper() );
+ m_pCurrentAppInfo->subMap.insert("AUTHOR", author_edit->text() );
+ m_pCurrentAppInfo->subMap.insert("EMAIL", email_edit->text() );
+ m_pCurrentAppInfo->subMap.insert("VERSION", version_edit->text());
+ m_pCurrentAppInfo->subMap.insert( "I18N", "i18n" );
+ m_pCurrentAppInfo->subMap.insert("YEAR", QString::number( QDate::currentDate().year() ) );
+
+ // This isn't too pretty, but we have several templates that use KAboutData::License_${LICENSE}
+ // and unsurprisingly, KAboutData doesn't cover every imaginable case.
+ // These are the licenses known to KDE-3.2 KAboutData, KDevelop doesn't have all of these as prepared options today
+ QString license = license_combo->currentText();
+ if ( license == "GPL" || license == "GPL_V2" || license == "LGPL" || license == "LGPL_V2"||
+ license == "BSD" || license == "NCSA" || license == "MIT" || license == "Artistic" ||
+ license == "QPL" || license == "QPL_V1_0" )
+ {
+ m_pCurrentAppInfo->subMap.insert("LICENSE", license );
+ }
+ else
+ {
+ m_pCurrentAppInfo->subMap.insert("LICENSE", "Custom" );
+ }
+
+
+ QStringList cleanUpSubstMap;
+ cleanUpSubstMap << "src" << "I18N" << "kdevelop";
+
+
+ kdDebug(9010) << "add template files" << endl;
+ // Add template files to the fileList
+ installDir templateDir;
+ templateDir.dir = "%{dest}/templates";
+ m_pCurrentAppInfo->dirList.prepend(templateDir);
+
+ installDir baseDir;
+ baseDir.dir = "%{dest}";
+ m_pCurrentAppInfo->dirList.prepend( baseDir );
+
+ // This is too silly for words, but it's either this or reimplementing FileTemplate
+ QString tempProjectDomSource = "<!DOCTYPE kdevelop><kdevelop><general><author>%1</author><email>%2</email><version>%3</version></general></kdevelop>";
+ tempProjectDomSource = tempProjectDomSource.arg( author_edit->text() ).arg( email_edit->text() ).arg( version_edit->text() );
+ QDomDocument tempProjectDom;
+ tempProjectDom.setContent( tempProjectDomSource );
+
+ QValueList<AppWizardFileTemplate>::Iterator it;
+ for (it = m_fileTemplates.begin(); it != m_fileTemplates.end(); ++it) {
+ KTempFile *tempFile = new KTempFile();
+ m_tempFiles.append(tempFile);
+
+ QString templateText( FileTemplate::makeSubstitutions( tempProjectDom, (*it).edit->text() ) );
+ QFile f;
+ f.open(IO_WriteOnly, tempFile->handle());
+ QTextStream temps(&f);
+ temps.setEncoding(QTextStream::UnicodeUTF8);
+ temps << templateText;
+ f.flush();
+ QString templateName( QString( "%1_TEMPLATE" ).arg( (*it).suffix ).upper() );
+ cleanUpSubstMap << templateName;
+ m_pCurrentAppInfo->subMap.insert( templateName, KMacroExpander::expandMacros(templateText , m_pCurrentAppInfo->subMap) );
+
+ installFile file;
+ file.source = tempFile->name();
+ file.dest = QString( "%{dest}/templates/%1" ).arg( (*it).suffix );
+ file.process = true;
+ file.isXML = false;
+ m_pCurrentAppInfo->fileList.append( file );
+ }
+
+ // Add license file to the file list
+ QString licenseFile, licenseName = i18n("Custom");
+
+ if( license_combo->currentItem() != 0 )
+ {
+ licenseName = license_combo->currentText();
+ KDevLicense* lic = licenses()[ licenseName ];
+ if( lic )
+ {
+ QStringList files( lic->copyFiles() );
+ QStringList::Iterator it = files.begin();
+ for( ; it != files.end(); ++it )
+ {
+ installFile file;
+ file.source = QString( "%{kdevelop}/template-common/%1" ).arg( *it );
+ file.dest = QString("%{dest}/%1").arg( *it );
+ file.process = true;
+ file.isXML = false;
+ m_pCurrentAppInfo->fileList.append( file );
+ }
+
+ m_pCurrentAppInfo->subMap.insert("LICENSEFILE", files.first() );
+ }
+ }
+
+ // Run macro expander on both the dir map and file maps
+ QValueList<installFile>::Iterator fileIt = m_pCurrentAppInfo->fileList.begin();
+ for( ; fileIt != m_pCurrentAppInfo->fileList.end(); ++fileIt)
+ {
+ (*fileIt).source = KMacroExpander::expandMacros((*fileIt).source , m_pCurrentAppInfo->subMap);
+ kdDebug(9010) << "Updating file dest: " << (*fileIt).dest << " with " << KMacroExpander::expandMacros((*fileIt).dest , m_pCurrentAppInfo->subMap) << endl;
+ (*fileIt).dest = KMacroExpander::expandMacros((*fileIt).dest , m_pCurrentAppInfo->subMap);
+ }
+
+ QValueList<installArchive>::Iterator archIt = m_pCurrentAppInfo->archList.begin();
+ for( ; archIt != m_pCurrentAppInfo->archList.end(); ++archIt)
+ {
+ (*archIt).source = KMacroExpander::expandMacros((*archIt).source , m_pCurrentAppInfo->subMap);
+ (*archIt).dest = KMacroExpander::expandMacros((*archIt).dest , m_pCurrentAppInfo->subMap);
+ }
+
+ QValueList<installDir>::Iterator dirIt = m_pCurrentAppInfo->dirList.begin();
+ for( ; dirIt != m_pCurrentAppInfo->dirList.end(); ++dirIt)
+ {
+ (*dirIt).dir = KMacroExpander::expandMacros((*dirIt).dir , m_pCurrentAppInfo->subMap);
+ }
+
+ if( !m_pCurrentAppInfo->finishCmd.isEmpty() )
+ {
+ m_pCurrentAppInfo->finishCmd = KMacroExpander::expandMacros(
+ m_pCurrentAppInfo->finishCmd, m_pCurrentAppInfo->subMap );
+ m_pCurrentAppInfo->finishCmdDir = KMacroExpander::expandMacros(
+ m_pCurrentAppInfo->finishCmdDir, m_pCurrentAppInfo->subMap );
+ }
+
+ QMap<QString,QString>::Iterator mapIt( m_pCurrentAppInfo->subMap.begin() );
+ for( ; mapIt != m_pCurrentAppInfo->subMap.end(); ++mapIt )
+ {
+ QString escaped( mapIt.data() );
+ escaped.replace( "&", "&amp;" );
+ escaped.replace( "<", "&lt;" );
+ escaped.replace( ">", "&gt;" );
+ m_pCurrentAppInfo->subMapXML.insert( mapIt.key(), escaped );
+ }
+
+ // Create dirs
+ dirIt = m_pCurrentAppInfo->dirList.begin();
+ for( ; dirIt != m_pCurrentAppInfo->dirList.end(); ++dirIt)
+ {
+ kdDebug( 9010 ) << "Process dir " << (*dirIt).dir << endl;
+ if( m_pCurrentAppInfo->subMap[(*dirIt).option] != "false" )
+ {
+ if( ! KIO::NetAccess::mkdir( (*dirIt).dir, this ) )
+ {
+ KMessageBox::sorry(this, i18n("The directory %1 cannot be created.").arg( (*dirIt).dir ) );
+ return;
+ }
+ }
+ }
+ // Unpack archives
+ archIt = m_pCurrentAppInfo->archList.begin();
+ for( ; archIt != m_pCurrentAppInfo->archList.end(); ++archIt)
+ {
+ if( m_pCurrentAppInfo->subMap[(*archIt).option] != "false" )
+ {
+ kdDebug( 9010 ) << "unpacking archive " << (*archIt).source << endl;
+ KTar archive( (*archIt).source, "application/x-gzip" );
+ if( archive.open( IO_ReadOnly ) )
+ {
+ unpackArchive( archive.directory(), (*archIt).dest, (*archIt).process );
+ }
+ else
+ {
+ KMessageBox::sorry(this, i18n("The archive %1 cannot be opened.").arg( (*archIt).source ) );
+ archive.close();
+ return;
+ }
+ archive.close();
+ }
+
+ }
+
+ // Copy files & Process
+ fileIt = m_pCurrentAppInfo->fileList.begin();
+ for( ; fileIt != m_pCurrentAppInfo->fileList.end(); ++fileIt)
+ {
+ kdDebug( 9010 ) << "Process file " << (*fileIt).source << endl;
+ if( m_pCurrentAppInfo->subMap[(*fileIt).option] != "false" )
+ {
+ if( !copyFile( *fileIt ) )
+ {
+ KMessageBox::sorry(this, i18n("The file %1 cannot be created.").arg( (*fileIt).dest) );
+ return;
+ }
+ setPermissions(*fileIt);
+ }
+ }
+ // if dir still does not exist
+ if (!fi.dir().exists()) {
+ KMessageBox::sorry(this, i18n("The directory above the chosen location does not exist and cannot be created."));
+ showPage(generalPage);
+ dest_edit->setFocus();
+ return;
+ }
+
+// KMessageBox::information(this, KMacroExpander::expandMacros(m_pCurrentAppInfo->message, m_pCurrentAppInfo->subMap));
+
+ QStringList::Iterator cleanIt = cleanUpSubstMap.begin();
+ for(;cleanIt != cleanUpSubstMap.end(); ++cleanIt )
+ {
+ m_pCurrentAppInfo->subMap.remove( *cleanIt );
+ }
+
+ if (!m_pCurrentAppInfo->finishCmd.isEmpty())
+ {
+ BlockingKProcess proc;
+ proc.setWorkingDirectory( m_pCurrentAppInfo->finishCmdDir );
+ proc.setUseShell( true );
+ proc << "cd" << m_pCurrentAppInfo->finishCmdDir << "&&";
+ proc << m_pCurrentAppInfo->finishCmd;
+ kdDebug(9010) << "Executing:" << proc.args() << endl;
+ proc.start( KProcess::NotifyOnExit );
+ if( !proc.isRunning() && !proc.normalExit() )
+ {
+ kdDebug(9010) << "Couldn't execute: " << proc.args() << endl;
+ }
+ }
+
+
+
+ int id = m_vcsForm->stack->id(m_vcsForm->stack->visibleWidget());
+ if (id)
+ {
+ VCSDialog *vcs = m_integratorDialogs[id];
+ if (vcs)
+ {
+ kdDebug(9010) << "vcs integrator dialog is ready" << endl;
+ vcs->accept();
+ }
+ else
+ kdDebug(9010) << "no vcs integrator dialog" << endl;
+ }
+ else
+ kdDebug(9010) << "vcs integrator wasn't selected" << endl;
+
+ openAfterGeneration();
+ QWizard::accept();
+}
+
+bool AppWizardDialog::copyFile( const installFile& file )
+{
+ kdDebug(9010) << "Copying file" << file.dest << endl;
+ return
+ copyFile( file.source, file.dest, file.isXML, file.process );
+}
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+bool AppWizardDialog::copyFile( const QString &source, const QString &dest, bool isXML, bool process )
+{
+ kdDebug( 9010 ) << "Copy: " << source << " to " << dest << endl;
+ if( process )
+ {
+ // Process the file and save it at the destFile location
+ QFile inputFile( source);
+ QFile outputFile( dest );
+
+ const QMap<QString,QString> &subMap = isXML ?
+ m_pCurrentAppInfo->subMapXML : m_pCurrentAppInfo->subMap;
+ if( inputFile.open( IO_ReadOnly ) && outputFile.open(IO_WriteOnly) )
+ {
+ QTextStream input( &inputFile );
+ input.setEncoding(QTextStream::UnicodeUTF8);
+ QTextStream output( &outputFile );
+ output.setEncoding(QTextStream::UnicodeUTF8);
+ while( !input.atEnd() )
+ output << KMacroExpander::expandMacros(input.readLine(), subMap) << "\n";
+ // Preserve file mode...
+ struct stat fmode;
+ ::fstat( inputFile.handle(), &fmode);
+ ::fchmod( outputFile.handle(), fmode.st_mode );
+
+ }
+ else
+ {
+ inputFile.close();
+ outputFile.close();
+ return false;
+ }
+ }
+ else
+ {
+ // Copy the source file to the destFile.
+ return KIO::NetAccess::copy( source, dest, this );
+ }
+ return true;
+}
+
+void AppWizardDialog::unpackArchive( const KArchiveDirectory *dir, const QString &dest, bool process )
+{
+ KIO::NetAccess::mkdir( dest , this );
+ kdDebug(9010) << "Dir : " << dir->name() << " at " << dest << endl;
+ QStringList entries = dir->entries();
+ kdDebug(9010) << "Entries : " << entries.join(",") << endl;
+
+ KTempDir tdir;
+
+ QStringList::Iterator entry = entries.begin();
+ for( ; entry != entries.end(); ++entry )
+ {
+
+ if( dir->entry( (*entry) )->isDirectory() )
+ {
+ const KArchiveDirectory *file = (KArchiveDirectory *)dir->entry( (*entry) );
+ unpackArchive( file , dest + "/" + file->name(), process);
+ }
+ else if( dir->entry( (*entry) )->isFile() )
+ {
+ const KArchiveFile *file = (KArchiveFile *) dir->entry( (*entry) );
+ if( !process )
+ {
+ file->copyTo( dest );
+ setPermissions(file, dest + "/" + file->name());
+ }
+ else
+ {
+ file->copyTo(tdir.name());
+ // assume that an archive does not contain XML files
+ // ( where should we currently get that info from? )
+ if ( !copyFile( QDir::cleanDirPath(tdir.name()+"/"+file->name()), dest + "/" + file->name(), false, process ) )
+ {
+ KMessageBox::sorry(this, i18n("The file %1 cannot be created.").arg( dest) );
+ return;
+ }
+ setPermissions(file, dest + "/" + file->name());
+ }
+ }
+ }
+ tdir.unlink();
+}
+
+void AppWizardDialog::templatesTreeViewClicked(QListViewItem *item)
+{
+ if( m_customOptions )
+ delete m_customOptions;
+
+ // Delete old file template pages
+ while (!m_fileTemplates.isEmpty()) {
+ QMultiLineEdit *edit = m_fileTemplates.first().edit;
+ removePage(edit);
+ delete edit;
+ m_fileTemplates.remove(m_fileTemplates.begin());
+ }
+ m_lastPage = 0;
+
+ ApplicationInfo *info = templateForItem(item);
+ if (info) {
+ m_pCurrentAppInfo = info;
+ if (!info->icon.isEmpty()) {
+ QFileInfo fi(info->templateName);
+ QDir dir(fi.dir());
+ dir.cdUp();
+ QPixmap pm;
+ pm.load(dir.filePath(info->icon));
+ icon_label->setPixmap(pm);
+ } else {
+ icon_label->clear();
+ }
+ desc_textview->setText(info->comment);
+// dest_edit->setURL(info->defaultDestDir);
+ m_projectLocationWasChanged = false;
+ //projectNameChanged(); // set the dest new
+
+ // Populate new custom options form
+ m_customOptions = new PropertyLib::PropertyEditor( custom_options );
+ m_customOptions->populateProperties(info->propValues);
+
+
+ // Create new file template pages
+ QStringList l = QStringList::split(",", info->fileTemplates);
+ if (l.empty()) //if the app template doesn't show file templates, we need to set another m_lastPage, aleXXX
+ m_lastPage=m_vcsForm;
+
+ QStringList::ConstIterator it = l.begin();
+ while (it != l.end()) {
+ AppWizardFileTemplate fileTemplate;
+ fileTemplate.suffix = *it;
+ ++it;
+ if (it != l.end()) {
+ fileTemplate.style = *it;
+ ++it;
+ } else
+ fileTemplate.style = "";
+
+ QMultiLineEdit *edit = new QMultiLineEdit(this);
+ edit->setWordWrap(QTextEdit::NoWrap);
+ edit->setFont(KGlobalSettings::fixedFont());
+ if (it == l.end())
+ m_lastPage = edit;
+ fileTemplate.edit = edit;
+ addPage(edit, i18n("Template for .%1 Files").arg(fileTemplate.suffix));
+ m_fileTemplates.append(fileTemplate);
+ }
+ licenseChanged(); // to populate the template views
+ textChanged(); // update Next button state
+ } else {
+ m_customOptions=0;
+ m_pCurrentAppInfo=0;
+ icon_label->clear();
+ desc_textview->clear();
+ nextButton()->setEnabled(false);
+ }
+}
+
+
+void AppWizardDialog::destButtonClicked(const QString& dir)
+{
+ if(!dir.isEmpty()) {
+
+ // set new location as default project dir?
+ KConfig *config = kapp->config();
+ config->setGroup("General Options");
+ QDir defPrjDir( config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()) );
+ QDir newDir (dir);
+ kdDebug(9010) << "DevPrjDir == newdir?: " << defPrjDir.absPath() << " == " << newDir.absPath() << endl;
+ if (defPrjDir != newDir) {
+ if (KMessageBox::questionYesNo(this, i18n("Set default project location to: %1?").arg( newDir.absPath() ),
+ i18n("New Project"), i18n("Set"), i18n("Do Not Set")) == KMessageBox::Yes)
+ {
+ config->writePathEntry("DefaultProjectsDir", newDir.absPath() + "/");
+ config->sync();
+ }
+ }
+ }
+}
+
+
+void AppWizardDialog::projectNameChanged()
+{
+ // Location was already edited by hand => don't change
+}
+
+
+void AppWizardDialog::projectLocationChanged()
+{
+ // Jakob Simon-Gaarde: Got tired of the anoying bug with the appname/location confussion.
+ // This version insures WYSIWYG and checks pathvalidity
+ finalLoc_label->setText(dest_edit->url() + (dest_edit->url().right(1)=="/" ? "":"/") + appname_edit->text());
+ QDir qd(dest_edit->url());
+ QFileInfo fi(dest_edit->url() + "/" + appname_edit->text());
+ if (!qd.exists() || appname_edit->displayText().isEmpty()||fi.exists())
+ {
+ if (!fi.exists() || appname_edit->displayText().isEmpty()) {
+ finalLoc_label->setText(finalLoc_label->text() + i18n("invalid location", " (invalid)"));
+ } else {
+ finalLoc_label->setText(finalLoc_label->text() + i18n(" (dir/file already exists)"));
+ }
+ m_pathIsValid=false;
+ } else {
+ m_pathIsValid=true;
+ }
+ updateNextButtons();
+}
+
+
+void AppWizardDialog::insertCategoryIntoTreeView(const QString &completeCategoryPath)
+{
+ kdDebug(9010) << "TemplateCategory: " << completeCategoryPath << endl;
+ QStringList categories = QStringList::split("/", completeCategoryPath);
+ QString category ="";
+ QListViewItem* pParentItem=0;
+
+ QStringList::ConstIterator it;
+ for (it = categories.begin(); it != categories.end(); ++it) {
+ category = category + "/" + *it;
+ QListViewItem *item = m_categoryMap.find(category);
+ if (!item) { // not found, create it
+ if (!pParentItem)
+ pParentItem = new KListViewItem(templates_listview,*it);
+ else
+ pParentItem = new KListViewItem(pParentItem,*it);
+
+ pParentItem->setPixmap(0, SmallIcon("folder"));
+ //pParentItem->setOpen(true);
+ kdDebug(9010) << "Category: " << category << endl;
+ m_categoryMap.insert(category,pParentItem);
+ m_categoryItems.append(pParentItem);
+ } else {
+ pParentItem = item;
+ }
+ }
+}
+
+
+ApplicationInfo *AppWizardDialog::templateForItem(QListViewItem *item)
+{
+ QPtrListIterator<ApplicationInfo> it(m_appsInfo);
+ for (; it.current(); ++it)
+ if (it.current()->item == item)
+ return it.current();
+
+ return 0;
+}
+
+void AppWizardDialog::openAfterGeneration()
+{
+ QString projectFile( finalLoc_label->text() + "/" + appname_edit->text().lower() + ".kdevelop" );
+
+ // Read the DOM of the newly created project
+ QFile file( projectFile );
+ if( !file.open( IO_ReadOnly ) )
+ return;
+ QDomDocument projectDOM;
+
+ int errorLine, errorCol;
+ QString errorMsg;
+ bool success = projectDOM.setContent( &file, &errorMsg, &errorLine, &errorCol);
+ file.close();
+ if ( !success )
+ {
+ KMessageBox::sorry( 0, i18n("This is not a valid project file.\n"
+ "XML error in line %1, column %2:\n%3")
+ .arg(errorLine).arg(errorCol).arg(errorMsg));
+ return;
+ }
+
+ // DOM Modifications go here
+ DomUtil::writeMapEntry( projectDOM, "substmap", m_pCurrentAppInfo->subMap );
+
+ //save the selected vcs
+ KTrader::OfferList offers = KTrader::self()->query("KDevelop/VCSIntegrator", QString("[X-KDevelop-VCS]=='%1'").arg(m_vcsForm->combo->currentText()));
+ if (offers.count() == 1)
+ {
+ KService::Ptr service = offers.first();
+ DomUtil::writeEntry(projectDOM, "/general/versioncontrol", service->property("X-KDevelop-VCSPlugin").toString());
+ }
+
+ // figure out what plugins we should disable by default
+ QString profileName = DomUtil::readEntry( projectDOM, "general/profile" );
+ if ( profileName.isEmpty() )
+ {
+ QString language = DomUtil::readEntry( projectDOM, "general/primarylanguage" );
+ QStringList keywords = DomUtil::readListEntry( projectDOM, "general/keywords", "keyword" );
+
+ profileName = Settings::profileByAttributes( language, keywords );
+ }
+
+ ProfileEngine & engine = m_part->pluginController()->engine();
+ Profile * profile = engine.findProfile( profileName );
+
+ QStringList disableList;
+ Profile::EntryList disableEntryList = profile->list( Profile::ExplicitDisable );
+ for ( Profile::EntryList::const_iterator it = disableEntryList.constBegin(); it != disableEntryList.constEnd(); ++it )
+ {
+ disableList << (*it).name;
+ }
+
+ QStringList projectIgnoreparts = DomUtil::readListEntry( projectDOM, "/general/ignoreparts", "part" );
+ projectIgnoreparts += disableList;
+ DomUtil::writeListEntry( projectDOM, "/general/ignoreparts", "part", projectIgnoreparts );
+
+ DomUtil::writeEntry( projectDOM, "/general/projectname", appname_edit->text() );
+
+ // write the dom back
+ if( !file.open( IO_WriteOnly ) )
+ return;
+ QTextStream ts( &file );
+ ts.setEncoding(QTextStream::UnicodeUTF8);
+ ts << projectDOM.toString(2);
+ file.close();
+
+ // open the new project
+ m_part->core()->openProject( projectFile );
+
+ // calculate the list of files to open after generation and use
+ // timer to queue opening (so that files will not be opened before the project
+ // which is also queued by ProjectManager )
+ KURL::List urlsToOpen;
+ QStringList::Iterator it = m_pCurrentAppInfo->openFilesAfterGeneration.begin();
+ for( ; it != m_pCurrentAppInfo->openFilesAfterGeneration.end(); ++it )
+ {
+ QString fileName( *it );
+ if ( !fileName.isNull() )
+ {
+ fileName = KMacroExpander::expandMacros(fileName, m_pCurrentAppInfo->subMap);
+ urlsToOpen.append(KURL::fromPathOrURL(fileName));
+ }
+ }
+ m_part->openFilesAfterGeneration(urlsToOpen);
+}
+
+void AppWizardDialog::pageChanged()
+{
+ kdDebug(9010) << "AppWizardDialog::pageChanged()" << endl;
+ projectLocationChanged();
+ if (currentPage() == m_lastPage)
+ finishButton()->setDefault(true);
+
+
+ //it is possible that project name was changed - we need to update all vcs integrator dialogs
+ for (QMap<int, VCSDialog*>::iterator it = m_integratorDialogs.begin();
+ it != m_integratorDialogs.end(); ++it)
+ (*it)->init(getProjectName(), getProjectLocation());
+}
+
+void AppWizardDialog::addTemplateToFavourites()
+{
+ addFavourite(templates_listview->currentItem());
+}
+
+void AppWizardDialog::addFavourite(QListViewItem* item, QString favouriteName)
+{
+ if(item->childCount())
+ return;
+
+ ApplicationInfo* info = templateForItem(item);
+
+ if(!info->favourite)
+ {
+ info->favourite = new KIconViewItem(favourites_iconview,
+ ((favouriteName=="")?info->name:favouriteName),
+ DesktopIcon("kdevelop"));
+
+ info->favourite->setRenameEnabled(true);
+ }
+}
+
+ApplicationInfo* AppWizardDialog::findFavouriteInfo(QIconViewItem* item)
+{
+ QPtrListIterator<ApplicationInfo> info(m_appsInfo);
+ for (; info.current(); ++info)
+ if (info.current()->favourite == item)
+ return info.current();
+
+ return 0;
+}
+
+void AppWizardDialog::favouritesIconViewClicked( QIconViewItem* item)
+{
+ ApplicationInfo* info = findFavouriteInfo(item);
+ templatesTreeViewClicked(info->item);
+}
+
+void AppWizardDialog::removeFavourite()
+{
+ QIconViewItem* curFavourite = favourites_iconview->currentItem();
+
+ //remove reference to favourite from associated appinfo
+ QPtrListIterator<ApplicationInfo> info(m_appsInfo);
+ for (; info.current(); ++info)
+ {
+ if(info.current()->favourite && info.current()->favourite == curFavourite)
+ {
+ info.current()->favourite = 0;
+ }
+ }
+
+ //remove favourite from iconview
+ delete curFavourite;
+ curFavourite=0;
+ favourites_iconview->sort(); //re-arrange all items.
+}
+
+void AppWizardDialog::populateFavourites()
+{
+ KConfig* config = kapp->config();
+ config->setGroup("AppWizard");
+
+ //favourites are stored in config as a list of templates and a seperate
+ //list of icon names.
+ QStringList templatesList = config->readPathListEntry("FavTemplates");
+ QStringList iconNamesList = config->readListEntry("FavNames");
+
+ QStringList::Iterator curTemplate = templatesList.begin();
+ QStringList::Iterator curIconName = iconNamesList.begin();
+ while(curTemplate != templatesList.end())
+ {
+ QPtrListIterator<ApplicationInfo> info(m_appsInfo);
+ for (; info.current(); ++info)
+ {
+ if(info.current()->templateName == *curTemplate)
+ {
+ addFavourite(info.current()->item, *curIconName);
+ break;
+ }
+ }
+ curTemplate++;
+ curIconName++;
+ }
+}
+
+void AppWizardDialog::done(int r)
+{
+ //need to save the template for each favourite and
+ //it's icon name. We have a one list for the templates
+ //and one for the names.
+
+ QStringList templatesList;
+ QStringList iconNamesList;
+
+ //Built the stringlists for each template that has a favourite.
+ QPtrListIterator<ApplicationInfo> it(m_appsInfo);
+ for (; it.current(); ++it)
+ {
+ if(it.current()->favourite)
+ {
+ templatesList.append(it.current()->templateName);
+ iconNamesList.append(it.current()->favourite->text());
+ }
+ }
+
+ KConfig* config = kapp->config();
+ config->setGroup("AppWizard");
+ config->writePathEntry("FavTemplates", templatesList);
+ config->writeEntry("FavNames", iconNamesList);
+ //config->writeEntry("CurrentTab", templates_tabwidget->currentPageIndex());
+ config->sync();
+
+ QDialog::done(r);
+}
+
+void AppWizardDialog::templatesContextMenu(QListViewItem* item, const QPoint& point, int)
+{
+ if(item && !item->childCount())
+ m_templatesMenu->popup(point);
+}
+
+void AppWizardDialog::favouritesContextMenu(QIconViewItem* item, const QPoint& point)
+{
+ if(item)
+ m_favouritesMenu->popup(point);
+}
+
+void AppWizardDialog::setPermissions(const KArchiveFile *source, QString dest)
+{
+ kdDebug(9010) << "AppWizardDialog::setPermissions(const KArchiveFile *source, QString dest)" << endl;
+ kdDebug(9010) << " dest: " << dest << endl;
+
+ if (source->permissions() & 00100)
+ {
+ kdDebug(9010) << "source is executable" << endl;
+ KIO::UDSEntry entry;
+ KURL kurl = KURL::fromPathOrURL(dest);
+ if (KIO::NetAccess::stat(kurl, entry, 0))
+ {
+ KFileItem it(entry, kurl);
+ int mode = it.permissions();
+ kdDebug(9010) << "stat shows permissions: " << mode << endl;
+ KIO::chmod(KURL::fromPathOrURL(dest), mode | 00100 );
+ }
+ }
+}
+
+void AppWizardDialog::setPermissions(const installFile &file)
+{
+ kdDebug(9010) << "AppWizardDialog::setPermissions(const installFile &file)" << endl;
+ kdDebug(9010) << " dest: " << file.dest << endl;
+
+ KIO::UDSEntry sourceentry;
+ KURL sourceurl = KURL::fromPathOrURL(file.source);
+ if (KIO::NetAccess::stat(sourceurl, sourceentry, 0))
+ {
+ KFileItem sourceit(sourceentry, sourceurl);
+ int sourcemode = sourceit.permissions();
+ if (sourcemode & 00100)
+ {
+ kdDebug(9010) << "source is executable" << endl;
+ KIO::UDSEntry entry;
+ KURL kurl = KURL::fromPathOrURL(file.dest);
+ if (KIO::NetAccess::stat(kurl, entry, 0))
+ {
+ KFileItem it(entry, kurl);
+ int mode = it.permissions();
+ kdDebug(9010) << "stat shows permissions: " << mode << endl;
+ KIO::chmod(KURL::fromPathOrURL(file.dest), mode | 00100 );
+ }
+ }
+ }
+}
+
+QDict<KDevLicense> AppWizardDialog::licenses()
+{
+ return m_licenses;
+}
+
+void AppWizardDialog::loadLicenses()
+{
+ // kdDebug(9010) << "======================== Entering loadLicenses" << endl;
+ KStandardDirs* dirs = KGlobal::dirs();
+ dirs->addResourceType( "licenses", KStandardDirs::kde_default( "data" ) + "kdevelop/licenses/" );
+ QStringList licNames = dirs->findAllResources( "licenses", QString::null, false, true );
+
+ QStringList::Iterator it;
+ for (it = licNames.begin(); it != licNames.end(); ++it)
+ {
+ QString licPath( dirs->findResource( "licenses", *it ) );
+ kdDebug(9010) << "Loading license file: " << licPath << endl;
+ QString licName = licPath.mid( licPath.findRev('/') + 1 );
+ KDevLicense* lic = new KDevLicense( licName, licPath );
+ m_licenses.insert( licName, lic );
+ }
+ // kdDebug(9010) << "======================== Done loadLicenses" << endl;
+}
+
+void AppWizardDialog::showTemplates(bool all)
+{
+ if (all)
+ {
+ QListViewItemIterator it(templates_listview);
+ while ( it.current() ) {
+ it.current()->setVisible(true);
+ ++it;
+ }
+ }
+ else
+ {
+ QPtrListIterator<ApplicationInfo> ait(m_appsInfo);
+ for (; ait.current(); ++ait)
+ {
+ ait.current()->item->setVisible(m_profileSupport->isInTemplateList(ait.current()->templateName));
+ }
+
+ QDictIterator<QListViewItem> dit(m_categoryMap);
+ for (; dit.current(); ++dit)
+ {
+ //checking whether all children are not visible
+ kdDebug(9010) << "check: " << dit.current()->text(0) << endl;
+ bool visible = false;
+ QListViewItemIterator it(dit.current());
+ while ( it.current() ) {
+ if ((it.current()->childCount() == 0) && it.current()->isVisible())
+ {
+ kdDebug(9010) << " visible: " << it.current()->text(0) << endl;
+ visible = true;
+ break;
+ }
+ ++it;
+ }
+ dit.current()->setVisible(visible);
+ }
+ checkAndHideItems(templates_listview);
+ }
+}
+
+void AppWizardDialog::checkAndHideItems(QListView *view)
+{
+ QListViewItem *item = view->firstChild();
+ while (item)
+ {
+ if (!m_categoryItems.contains(item))
+ continue;
+ checkAndHideItems(item);
+ item = item->nextSibling();
+ }
+}
+
+bool AppWizardDialog::checkAndHideItems(QListViewItem *item)
+{
+ if (!m_categoryItems.contains(item))
+ return !item->isVisible();
+ QListViewItem *child = item->firstChild();
+ bool hide = true;
+ while (child)
+ {
+ hide = hide && checkAndHideItems(child);
+ child = child->nextSibling();
+ }
+ kdDebug(9010) << "check_: " << item->text(0) << " hide: " << hide << endl;
+ if (hide)
+ {
+ item->setVisible(false);
+ return true;
+ }
+ return false;
+}
+
+#include "appwizarddlg.moc"
+
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
diff --git a/parts/appwizard/appwizarddlg.h b/parts/appwizard/appwizarddlg.h
new file mode 100644
index 00000000..7ce8c2ff
--- /dev/null
+++ b/parts/appwizard/appwizarddlg.h
@@ -0,0 +1,209 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2001 by Sandy Meier *
+ * smeier@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _APPWIZARDDIALOG_H_
+#define _APPWIZARDDIALOG_H_
+
+class AppWizardPart;
+class QMultiLineEdit;
+class QRadioButton;
+class KTempFile;
+class QWidgetStack;
+class QVBox;
+class KPopupMenu;
+class QHBoxLayout;
+class KArchiveDirectory;
+class KArchiveFile;
+class ProfileSupport;
+#include <qptrlist.h>
+#include <qdict.h>
+#include <klineedit.h>
+#include <qlabel.h>
+#include <qstringlist.h>
+#include <klistview.h>
+#include <kiconview.h>
+#include "kdevversioncontrol.h"
+#include "kdevvcsintegrator.h"
+#include "appwizarddlgbase.h"
+#include "vcs_form.h"
+//#include "autoform.h"
+#include "kdevlicense.h"
+
+namespace PropertyLib {
+ class PropertyList;
+ class PropertyEditor;
+}
+
+struct installFile
+{
+ QString source;
+ QString dest;
+ QString option;
+ bool process;
+ bool isXML;
+};
+
+struct installArchive
+{
+ QString source;
+ QString dest;
+ QString option;
+ bool process;
+};
+
+struct installDir
+{
+ QString dir;
+ QString option;
+ int perms;
+};
+
+struct ApplicationInfo
+{
+ QString templateName;
+ QString name;
+ QString comment;
+ QString icon;
+ QString category;
+ QString defaultDestDir;
+ QString fileTemplates;
+ QStringList openFilesAfterGeneration;
+ QString templateFile;
+ QMap<QString,QString> subMap;
+ QMap<QString,QString> subMapXML;
+ QStringList includes;
+
+ //QMap<autoKey,QVariant> subValues;
+ PropertyLib::PropertyList *propValues;
+
+ QValueList<installFile> fileList;
+ QValueList<installArchive> archList;
+ QValueList<installDir> dirList;
+ QString customUI;
+ QString message;
+ QString finishCmd;
+ QString finishCmdDir;
+ QString sourceArchive;
+
+ //! item pointer to the listview
+ QListViewItem *item;
+
+ //! pointer to favourite icon (NULL if there isn't one)
+ QIconViewItem *favourite;
+
+ ApplicationInfo()
+ : item( 0 ), favourite( 0 )
+ {}
+};
+
+struct AppWizardFileTemplate
+{
+ QString suffix;
+ QString style;
+ QMultiLineEdit *edit;
+
+ AppWizardFileTemplate()
+ : edit( 0 )
+ {}
+};
+
+
+class AppWizardDialog : public AppWizardDialogBase
+{
+ Q_OBJECT
+
+public:
+ AppWizardDialog( AppWizardPart *part, QWidget *parent=0, const char *name=0 );
+ ~AppWizardDialog();
+ QString getProjectName() { return appname_edit->text(); }
+ QString getProjectLocation() { return finalLoc_label->text(); }
+
+protected:
+ virtual void accept();
+
+ virtual QDict<KDevLicense> licenses();
+ void loadLicenses();
+
+protected slots:
+ virtual void templatesTreeViewClicked(QListViewItem*);
+ virtual void textChanged();
+ virtual void licenseChanged();
+ virtual void destButtonClicked(const QString&);
+ virtual void projectNameChanged();
+ virtual void projectLocationChanged();
+ virtual void favouritesIconViewClicked( QIconViewItem * );
+ virtual void templatesContextMenu(QListViewItem*, const QPoint&, int);
+ virtual void favouritesContextMenu(QIconViewItem* item, const QPoint& point);
+ virtual void addTemplateToFavourites();
+ virtual void done(int r);
+ virtual void removeFavourite();
+ virtual void pageChanged();
+
+private: //methods
+
+ ApplicationInfo *templateForItem(QListViewItem *item);
+ void insertCategoryIntoTreeView(const QString &completeCategoryPath);
+ void loadVcs();
+ void updateNextButtons();
+
+ void populateFavourites();
+ void addFavourite(QListViewItem* item, QString favouriteName="");
+ ApplicationInfo* findFavouriteInfo(QIconViewItem* item);
+
+ void unpackArchive( const KArchiveDirectory *dir, const QString &dest, bool process );
+ bool copyFile( const installFile& file );
+ bool copyFile( const QString &source, const QString &dest, bool isXML, bool process );
+ QString kdevRoot(const QString &templateName ) const;
+ void openAfterGeneration();
+
+ void setPermissions(const KArchiveFile *source, QString dest);
+ void setPermissions(const installFile &file);
+
+ void checkAndHideItems(QListView *view);
+ bool checkAndHideItems(QListViewItem *item);
+
+private: //data
+
+ QPtrList<ApplicationInfo> m_appsInfo;
+ QValueList<AppWizardFileTemplate> m_fileTemplates;
+ //! Store the category name and the pointer in the treeview
+ QDict<QListViewItem> m_categoryMap;
+ QValueList<QListViewItem*> m_categoryItems;
+ //! A list of currently available version control systems
+// QDict<KDevVersionControl> m_availVcs;
+
+ QHBoxLayout *m_custom_options_layout;
+ PropertyLib::PropertyEditor *m_customOptions;
+ AppWizardPart *m_part;
+ QWidget *m_lastPage;
+ QPtrList<KTempFile> m_tempFiles;
+ ApplicationInfo* m_pCurrentAppInfo;
+ bool m_projectLocationWasChanged;
+ VcsForm *m_vcsForm;
+ bool m_pathIsValid;
+ KPopupMenu* m_favouritesMenu;
+ KPopupMenu* m_templatesMenu;
+
+ QDict<KDevLicense> m_licenses;
+ QDict<KDevVCSIntegrator> m_integrators;
+ QMap<int, VCSDialog*> m_integratorDialogs;
+
+ ProfileSupport *m_profileSupport;
+
+public slots:
+ virtual void showTemplates(bool all);
+};
+
+#endif
+
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
diff --git a/parts/appwizard/appwizarddlgbase.ui b/parts/appwizard/appwizarddlgbase.ui
new file mode 100644
index 00000000..f6d1fa49
--- /dev/null
+++ b/parts/appwizard/appwizarddlgbase.ui
@@ -0,0 +1,659 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>AppWizardDialogBase</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>AppWizardDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>616</width>
+ <height>615</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Create New Project</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>generalPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>templates_tabwidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_allProjectsPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;All Projects</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListView" row="0" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>templates_listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="hScrollBarMode">
+ <enum>Auto</enum>
+ </property>
+ <property name="selectionMode" stdset="0">
+ <enum>Single</enum>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="fullWidth">
+ <bool>false</bool>
+ </property>
+ <property name="itemsMovable">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>showAll_box</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Show all project templates</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>m_favouritesPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Favorites</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIconView" row="0" column="0">
+ <property name="name">
+ <cstring>favourites_iconview</cstring>
+ </property>
+ <property name="arrangement">
+ <enum>LeftToRight</enum>
+ </property>
+ <property name="itemsMovable">
+ <bool>false</bool>
+ </property>
+ <property name="mode">
+ <enum>Select</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>icon_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>180</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>250</width>
+ <height>180</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>LineEditPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ <property name="hAlign" stdset="0">
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Properties</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>appname_label</cstring>
+ </property>
+ <property name="text">
+ <string>Application &amp;name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>appname_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>location_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Location:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>dest_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Final location:</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>appname_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>dest_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>finalLoc_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>TextLabel4</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QMultiLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>desc_textview</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>250</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="wordWrap">
+ <enum>WidgetWidth</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WizardPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Project Options</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>projectOptions</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>General Options</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>author_label</cstring>
+ </property>
+ <property name="text">
+ <string>Author:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>author_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>email_label</cstring>
+ </property>
+ <property name="text">
+ <string>Email:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>email_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>version_label</cstring>
+ </property>
+ <property name="text">
+ <string>Version:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>version_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>author_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>email_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout7</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>version_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>0.1</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>license_label</cstring>
+ </property>
+ <property name="text">
+ <string>License:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>license_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>Custom</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>license_combo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>optionsGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>550</width>
+ <height>270</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Custom Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QFrame" row="0" column="0">
+ <property name="name">
+ <cstring>custom_options</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>1</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>templates_listview</sender>
+ <signal>selectionChanged(QListViewItem*)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>templatesTreeViewClicked(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>author_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>textChanged()</slot>
+ </connection>
+ <connection>
+ <sender>version_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>textChanged()</slot>
+ </connection>
+ <connection>
+ <sender>appname_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>textChanged()</slot>
+ </connection>
+ <connection>
+ <sender>appname_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>projectLocationChanged()</slot>
+ </connection>
+ <connection>
+ <sender>dest_edit</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>destButtonClicked(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>dest_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>projectLocationChanged()</slot>
+ </connection>
+ <connection>
+ <sender>favourites_iconview</sender>
+ <signal>selectionChanged(QIconViewItem*)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>favouritesIconViewClicked(QIconViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>templates_listview</sender>
+ <signal>contextMenuRequested(QListViewItem*,const QPoint&amp;,int)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>templatesContextMenu(QListViewItem*,const QPoint&amp;,int)</slot>
+ </connection>
+ <connection>
+ <sender>favourites_iconview</sender>
+ <signal>contextMenuRequested(QIconViewItem*,const QPoint&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>favouritesContextMenu(QIconViewItem*,const QPoint&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>favourites_iconview</sender>
+ <signal>contextMenuRequested(QIconViewItem*,const QPoint&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>favouritesContextMenu(QIconViewItem*,const QPoint&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>showAll_box</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>showTemplates(bool)</slot>
+ </connection>
+ <connection>
+ <sender>dest_edit</sender>
+ <signal>returnPressed(const QString&amp;)</signal>
+ <receiver>AppWizardDialogBase</receiver>
+ <slot>projectLocationChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>author_edit</tabstop>
+ <tabstop>email_edit</tabstop>
+ <tabstop>version_edit</tabstop>
+ <tabstop>license_combo</tabstop>
+ <tabstop>appname_edit</tabstop>
+ <tabstop>dest_edit</tabstop>
+ <tabstop>templates_tabwidget</tabstop>
+ <tabstop>templates_listview</tabstop>
+ <tabstop>favourites_iconview</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="global" impldecl="in implementation">klistview.h</include>
+ <include location="global" impldecl="in implementation">kiconview.h</include>
+ <include location="global" impldecl="in declaration">kurlrequester.h</include>
+</includes>
+<slots>
+ <slot access="protected">licenseChanged()</slot>
+ <slot access="protected">destButtonClicked( const QString &amp; )</slot>
+ <slot access="protected">projectLocationChanged()</slot>
+ <slot access="protected">projectNameChanged()</slot>
+ <slot access="protected">textChanged()</slot>
+ <slot access="protected">templatesTreeViewClicked( QListViewItem * )</slot>
+ <slot access="protected">favouritesIconViewClicked( QIconViewItem * )</slot>
+ <slot access="protected">templatesContextMenu( QListViewItem *, const QPoint &amp;, int )</slot>
+ <slot access="protected">favouritesContextMenu( QIconViewItem *, const QPoint &amp; )</slot>
+ <slot>showTemplates(bool)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+ <includehint>kiconview.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/appwizard/appwizardfactory.cpp b/parts/appwizard/appwizardfactory.cpp
new file mode 100644
index 00000000..2ed254be
--- /dev/null
+++ b/parts/appwizard/appwizardfactory.cpp
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#include <kstandarddirs.h>
+#include <kdevplugininfo.h>
+
+#include "appwizardfactory.h"
+
+static const KDevPluginInfo data("kdevappwizard");
+K_EXPORT_COMPONENT_FACTORY( libkdevappwizard, AppWizardFactory )
+
+AppWizardFactory::AppWizardFactory()
+ : KDevGenericFactory<AppWizardPart>( data )
+{
+}
+
+KInstance *AppWizardFactory::createInstance()
+{
+ KInstance *instance = KDevGenericFactory<AppWizardPart>::createInstance();
+ KStandardDirs *dirs = instance->dirs();
+ dirs->addResourceType("apptemplates", KStandardDirs::kde_default("data") + "kdevappwizard/templates/");
+ dirs->addResourceType("appimports", KStandardDirs::kde_default("data") + "kdevappwizard/imports/");
+ dirs->addResourceType("appimportfiles", KStandardDirs::kde_default("data") + "kdevappwizard/importfiles/");
+
+ return instance;
+}
+
+const KDevPluginInfo *AppWizardFactory::info()
+{
+ return &data;
+}
+
diff --git a/parts/appwizard/appwizardfactory.h b/parts/appwizard/appwizardfactory.h
new file mode 100644
index 00000000..b162d1a2
--- /dev/null
+++ b/parts/appwizard/appwizardfactory.h
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _APPWIZARDFACTORY_H_
+#define _APPWIZARDFACTORY_H_
+
+#include <kdevgenericfactory.h>
+
+#include "appwizardpart.h"
+
+class KDevPluginInfo;
+
+class AppWizardFactory : public KDevGenericFactory<AppWizardPart>
+{
+public:
+ AppWizardFactory();
+
+ static const KDevPluginInfo *info();
+
+protected:
+ virtual KInstance *createInstance();
+};
+
+#endif
diff --git a/parts/appwizard/appwizardpart.cpp b/parts/appwizard/appwizardpart.cpp
new file mode 100644
index 00000000..8a19f548
--- /dev/null
+++ b/parts/appwizard/appwizardpart.cpp
@@ -0,0 +1,98 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qdir.h>
+#include <qwidget.h>
+#include <qtimer.h>
+
+#include "appwizardpart.h"
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <kdevcore.h>
+#include <kgenericfactory.h>
+#include <kstandarddirs.h>
+#include <kaction.h>
+#include <qmessagebox.h>
+
+#include "importdlg.h"
+#include "appwizarddlg.h"
+#include "appwizardfactory.h"
+#include <kdevmakefrontend.h>
+#include <kdevpartcontroller.h>
+#include <kdevlanguagesupport.h>
+#include <kdevcore.h>
+#include <codemodel.h>
+
+AppWizardPart::AppWizardPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(AppWizardFactory::info(), parent, name ? name : "AppWizardPart")
+{
+ setInstance(AppWizardFactory::instance());
+ setXMLFile("kdevappwizard.rc");
+
+ KAction *action;
+
+ action = new KAction( i18n("&New Project..."), "window_new", 0,
+ this, SLOT(slotNewProject()),
+ actionCollection(), "project_new" );
+ action->setToolTip( i18n("Generate a new project from a template") );
+ action->setWhatsThis( i18n("<b>New project</b><p>"
+ "This starts KDevelop's application wizard. "
+ "It helps you to generate a skeleton for your "
+ "application from a set of templates.") );
+
+ action = new KAction( i18n("&Import Existing Project..."),"wizard", 0,
+ this, SLOT(slotImportProject()),
+ actionCollection(), "project_import" );
+ action->setToolTip( i18n("Import existing project") );
+ action->setWhatsThis( i18n("<b>Import existing project</b><p>Creates a project file for a given directory.") );
+}
+
+
+AppWizardPart::~AppWizardPart()
+{
+}
+
+
+void AppWizardPart::slotNewProject()
+{
+ kdDebug(9010) << "new project" << endl;
+ AppWizardDialog dlg(this, 0, "app wizard");
+ dlg.templates_listview->setFocus();
+ dlg.exec();
+}
+
+
+void AppWizardPart::slotImportProject()
+{
+ ImportDialog dlg(this, 0, "import dialog");
+ dlg.exec();
+}
+
+void AppWizardPart::openFilesAfterGeneration(const KURL::List urlsToOpen)
+{
+ m_urlsToOpen = urlsToOpen;
+ connect( core(), SIGNAL( projectOpened() ), this, SLOT( openFilesAfterGeneration() ) );
+}
+
+void AppWizardPart::openFilesAfterGeneration()
+{
+ for (KURL::List::const_iterator it = m_urlsToOpen.begin(); it != m_urlsToOpen.end(); ++it)
+ partController()->editDocument(*it);
+ m_urlsToOpen.clear();
+ disconnect( core(), SIGNAL( projectOpened() ), this, SLOT( openFilesAfterGeneration() ) );
+}
+
+#include "appwizardpart.moc"
+
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
diff --git a/parts/appwizard/appwizardpart.h b/parts/appwizard/appwizardpart.h
new file mode 100644
index 00000000..0678d04a
--- /dev/null
+++ b/parts/appwizard/appwizardpart.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _APPWIZARDPART_H_
+#define _APPWIZARDPART_H_
+
+#include <qguardedptr.h>
+#include "kdevplugin.h"
+#include <qstring.h>
+#include <qstringlist.h>
+#include <kurl.h>
+
+class AppWizardDialog;
+
+
+class AppWizardPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ AppWizardPart( QObject *parent, const char *name, const QStringList & );
+ ~AppWizardPart();
+
+ void openFilesAfterGeneration(const KURL::List urlsToOpen);
+
+public slots:
+ void openFilesAfterGeneration();
+
+private slots:
+ void slotNewProject();
+ void slotImportProject();
+
+private:
+ KURL::List m_urlsToOpen;
+};
+
+#endif
diff --git a/parts/appwizard/common/Artistic b/parts/appwizard/common/Artistic
new file mode 100644
index 00000000..8f9bdefc
--- /dev/null
+++ b/parts/appwizard/common/Artistic
@@ -0,0 +1,124 @@
+The "Artistic License"
+
+ Preamble
+
+ The intent of this document is to state the conditions under which a
+ Package may be copied, such that the Copyright Holder maintains some
+ semblance of artistic control over the development of the package,
+ while giving the users of the package the right to use and distribute
+ the Package in a more-or-less customary fashion, plus the right to
+ make reasonable modifications.
+
+ Definitions
+
+ "Package" refers to the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection of files
+ created through textual modification.
+
+ "Standard Version" refers to such a Package if it has not been
+ modified, or has been modified in accordance with the wishes of the
+ Copyright Holder as specified below.
+
+ "Copyright Holder" is whoever is named in the copyright or
+ copyrights for the package.
+
+ "You" is you, if you're thinking about copying or distributing this
+ Package.
+
+ "Reasonable copying fee" is whatever you can justify on the basis
+ of media cost, duplication charges, time of people involved, and so
+ on. (You will not be required to justify it to the Copyright
+ Holder, but only to the computing community at large as a market
+ that must bear the fee.)
+
+ "Freely Available" means that no fee is charged for the item
+ itself, though there may be fees involved in handling the item. It
+ also means that recipients of the item may redistribute it under
+ the same conditions they received it.
+
+ 1. You may make and give away verbatim copies of the source form of
+ the Standard Version of this Package without restriction, provided
+ that you duplicate all of the original copyright notices and
+ associated disclaimers.
+ 2. You may apply bug fixes, portability fixes and other modifications
+ derived from the Public Domain or from the Copyright Holder. A
+ Package modified in such a way shall still be considered the
+ Standard Version.
+ 3. You may otherwise modify your copy of this Package in any way,
+ provided that you insert a prominent notice in each changed file
+ stating how and when you changed that file, and provided that you
+ do at least ONE of the following:
+
+ a. place your modifications in the Public Domain or otherwise make
+ them Freely Available, such as by posting said modifications to
+ Usenet or an equivalent medium, or placing the modifications on a
+ major archive site such as uunet.uu.net, or by allowing the
+ Copyright Holder to include your modifications in the Standard
+ Version of the Package.
+ b. use the modified Package only within your corporation or
+ organization.
+ c. rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided, and
+ provide a separate manual page for each non-standard executable
+ that clearly documents how it differs from the Standard Version.
+ d. make other distribution arrangements with the Copyright Holder.
+
+ You may distribute the programs of this Package in object code or
+ executable form, provided that you do at least ONE of the following:
+
+ a. distribute a Standard Version of the executables and library
+ files, together with instructions (in the manual page or
+ equivalent) on where to get the Standard Version.
+ b. accompany the distribution with the machine-readable source of the
+ Package with your modifications.
+ c. give non-standard executables non-standard names, and clearly
+ document the differences in manual pages (or equivalent), together
+ with instructions on where to get the Standard Version.
+ d. make other distribution arrangements with the Copyright Holder.
+
+ You may charge a reasonable copying fee for any distribution of this
+ Package. You may charge any fee you choose for support of this
+ Package. You may not charge a fee for this Package itself. However,
+ you may distribute this Package in aggregate with other (possibly
+ commercial) programs as part of a larger (possibly commercial)
+ software distribution provided that you do not advertise this Package
+ as a product of your own. You may embed this Package's interpreter
+ within an executable of yours (by linking); this shall be construed as
+ a mere form of aggregation, provided that the complete Standard
+ Version of the interpreter is so embedded.
+
+ The scripts and library files supplied as input to or produced as
+ output from the programs of this Package do not automatically fall
+ under the copyright of this Package, but belong to whomever generated
+ them, and may be sold commercially, and may be aggregated with this
+ Package. If such scripts or library files are aggregated with this
+ Package via the so-called "undump" or "unexec" methods of producing a
+ binary executable image, then distribution of such an image shall
+ neither be construed as a distribution of this Package nor shall it
+ fall under the restrictions of Paragraphs 3 and 4, provided that you
+ do not represent such an executable image as a Standard Version of
+ this Package.
+
+ C subroutines (or comparably compiled subroutines in other
+ languages) supplied by you and linked into this Package in order to
+ emulate subroutines and variables of the language defined by this
+ Package shall not be considered part of this Package, but are the
+ equivalent of input as in Paragraph 6, provided these subroutines do
+ not change the language in any way that would cause it to fail the
+ regression tests for the language.
+
+ Aggregation of this Package with a commercial distribution is always
+ permitted provided that the use of this Package is embedded; that is,
+ when no overt attempt is made to make this Package's interfaces
+ visible to the end user of the commercial distribution. Such use shall
+ not be construed as a distribution of this Package.
+
+ The name of the Copyright Holder may not be used to endorse or
+ promote products derived from this software without specific prior
+ written permission.
+
+ THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+ The End
diff --git a/parts/appwizard/common/COPYING b/parts/appwizard/common/COPYING
new file mode 100644
index 00000000..5b6e7c66
--- /dev/null
+++ b/parts/appwizard/common/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/parts/appwizard/common/COPYING.LIB b/parts/appwizard/common/COPYING.LIB
new file mode 100644
index 00000000..e38ffa83
--- /dev/null
+++ b/parts/appwizard/common/COPYING.LIB
@@ -0,0 +1,481 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330
+ Boston, MA 02111-1307, USA.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/parts/appwizard/common/LICENSE.BSD b/parts/appwizard/common/LICENSE.BSD
new file mode 100644
index 00000000..cca2a5c9
--- /dev/null
+++ b/parts/appwizard/common/LICENSE.BSD
@@ -0,0 +1,20 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/parts/appwizard/common/LICENSE.QPL b/parts/appwizard/common/LICENSE.QPL
new file mode 100644
index 00000000..85bc6356
--- /dev/null
+++ b/parts/appwizard/common/LICENSE.QPL
@@ -0,0 +1,103 @@
+ THE Q PUBLIC LICENSE
+ version 1.0
+
+ Copyright (C) 1999-2000 Troll Tech AS, Norway.
+ Everyone is permitted to copy and
+ distribute this license document.
+
+The intent of this license is to establish freedom to share and change the
+software regulated by this license under the open source model.
+
+This license applies to any software containing a notice placed by the
+copyright holder saying that it may be distributed under the terms of
+the Q Public License version 1.0. Such software is herein referred to as
+the Software. This license covers modification and distribution of the
+Software, use of third-party application programs based on the Software,
+and development of free software which uses the Software.
+
+ Granted Rights
+
+1. You are granted the non-exclusive rights set forth in this license
+ provided you agree to and comply with any and all conditions in this
+ license. Whole or partial distribution of the Software, or software
+ items that link with the Software, in any form signifies acceptance of
+ this license.
+
+2. You may copy and distribute the Software in unmodified form provided
+ that the entire package, including - but not restricted to - copyright,
+ trademark notices and disclaimers, as released by the initial developer
+ of the Software, is distributed.
+
+3. You may make modifications to the Software and distribute your
+ modifications, in a form that is separate from the Software, such as
+ patches. The following restrictions apply to modifications:
+
+ a. Modifications must not alter or remove any copyright notices in
+ the Software.
+
+ b. When modifications to the Software are released under this
+ license, a non-exclusive royalty-free right is granted to the
+ initial developer of the Software to distribute your modification
+ in future versions of the Software provided such versions remain
+ available under these terms in addition to any other license(s) of
+ the initial developer.
+
+4. You may distribute machine-executable forms of the Software or
+ machine-executable forms of modified versions of the Software, provided
+ that you meet these restrictions:
+
+ a. You must include this license document in the distribution.
+
+ b. You must ensure that all recipients of the machine-executable forms
+ are also able to receive the complete machine-readable source code
+ to the distributed Software, including all modifications, without
+ any charge beyond the costs of data transfer, and place prominent
+ notices in the distribution explaining this.
+
+ c. You must ensure that all modifications included in the
+ machine-executable forms are available under the terms of this
+ license.
+
+5. You may use the original or modified versions of the Software to
+ compile, link and run application programs legally developed by you
+ or by others.
+
+6. You may develop application programs, reusable components and other
+ software items that link with the original or modified versions of the
+ Software. These items, when distributed, are subject to the following
+ requirements:
+
+ a. You must ensure that all recipients of machine-executable forms of
+ these items are also able to receive and use the complete
+ machine-readable source code to the items without any charge
+ beyond the costs of data transfer.
+
+ b. You must explicitly license all recipients of your items to use
+ and re-distribute original and modified versions of the items in
+ both machine-executable and source code forms. The recipients must
+ be able to do so without any charges whatsoever, and they must be
+ able to re-distribute to anyone they choose.
+
+
+ c. If the items are not available to the general public, and the
+ initial developer of the Software requests a copy of the items,
+ then you must supply one.
+
+ Limitations of Liability
+
+In no event shall the initial developers or copyright holders be liable
+for any damages whatsoever, including - but not restricted to - lost
+revenue or profits or other direct, indirect, special, incidental or
+consequential damages, even if they have been advised of the possibility
+of such damages, except to the extent invariable law, if any, provides
+otherwise.
+
+ No Warranty
+
+The Software and this license document are provided AS IS with NO WARRANTY
+OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE.
+ Choice of Law
+
+This license is governed by the Laws of Norway. Disputes shall be settled
+by Oslo City Court.
diff --git a/parts/appwizard/common/Makefile.am b/parts/appwizard/common/Makefile.am
new file mode 100644
index 00000000..0a2b63f6
--- /dev/null
+++ b/parts/appwizard/common/Makefile.am
@@ -0,0 +1,46 @@
+CLEANFILES = *.tar.gz
+
+admin.tar.gz:
+ $(TAR) -cf admin.tar --exclude=.svn -C $(srcdir) admin
+ gzip admin.tar
+
+gnome.tar.gz:
+ $(TAR) -cf gnome.tar --exclude=.svn -C $(srcdir)/gnome macros
+ gzip gnome.tar
+
+gnome2.tar.gz:
+ $(TAR) -cf gnome2.tar --exclude=.svn -C $(srcdir)/gnome2 macros
+ gzip gnome2.tar
+
+gnu.tar.gz:
+ $(TAR) -cf gnu.tar --exclude=.svn -C $(srcdir)/gnu AUTHORS COPYING \
+ ChangeLog INSTALL NEWS README TODO
+ gzip gnu.tar
+
+wxwidgets.tar.gz:
+ $(TAR) -cf wxwidgets.tar --exclude=.svn -C $(srcdir)/wx macros
+ gzip wxwidgets.tar
+
+incadmin.tar.gz:
+ $(TAR) -cf incadmin.tar --exclude=.svn -C $(srcdir)/incadmin \
+ config.guess config.sub depcomp install-sh \
+ ltmain.sh missing mkinstalldirs
+ gzip incadmin.tar
+
+scons.tar.gz:
+ $(TAR) -cf scons.tar --exclude=.svn -C $(srcdir)/scons configure admin/scons-mini.tar.bz2 admin/generic.py admin/kde.py
+ gzip scons.tar
+
+appwizarddatadir = ${kde_datadir}/kdevappwizard
+commondatadir = ${appwizarddatadir}/template-common
+commondata_DATA = admin.tar.gz gnu.tar.gz incadmin.tar.gz gnome.tar.gz gnome2.tar.gz wxwidgets.tar.gz \
+ kde-app.lsm kde-Makefile.am kde-Makefile.cvs kde-configure.in.in \
+ kde-index.docbook kde-po-Makefile.am kde-doc-Makefile.am kde-doc-en-Makefile.am \
+ hi16-app-app.png hi32-app-app.png kde-app.desktop kde-part.desktop \
+ gnome-app.lsm gnome-Makefile.am gnome-Makefile.cvs \
+ gnome-pixmaps-Makefile.am gnome-app.png \
+ wx-configure.in wx-Makefile.am wx-Makefile.cvs \
+ COPYING COPYING.LIB LICENSE.QPL LICENSE.BSD Artistic \
+ admin.kdevtemplate gnu.kdevtemplate dockbook.kdevtemplate\
+ incadmin.kdevtemplate gnome2.kdevtemplate scons.kdevtemplate scons.tar.gz
+
diff --git a/parts/appwizard/common/admin.kdevtemplate b/parts/appwizard/common/admin.kdevtemplate
new file mode 100644
index 00000000..67172eda
--- /dev/null
+++ b/parts/appwizard/common/admin.kdevtemplate
@@ -0,0 +1,5 @@
+[ADMIN]
+Type=install archive
+Source=%{kdevelop}/template-common/admin.tar.gz
+Dest=%{dest}
+Process=false
diff --git a/parts/appwizard/common/dockbook.kdevtemplate b/parts/appwizard/common/dockbook.kdevtemplate
new file mode 100644
index 00000000..a6cacf95
--- /dev/null
+++ b/parts/appwizard/common/dockbook.kdevtemplate
@@ -0,0 +1,64 @@
+[DOCSOPT]
+Type = value
+ValueType=bool
+Value=INSTALL_DOCS
+Comment= Install Docbook documentation templates.
+Comment[ca]= Instal·la plantilles de documentació en Docbook.
+Comment[da]= Installerer Docbook dokumentationsskabeloner.
+Comment[de]= Installiert Docbook-Vorlagen für Dokumentation
+Comment[el]= Εγκατάσταση προτύπων τεκμηρίωσης Docbook.
+Comment[es]=Instalar plantillas de documentación Docbook.
+Comment[et]= Docbook-dokumendimallide paigaldamine.
+Comment[eu]= Instalatu Docbook dokumentazioaren txantiloiak.
+Comment[fa]= قالبهای مستندات Docbook را نصب می‌کند.
+Comment[fr]=Installe des modèles de documentation en Docbook.
+Comment[gl]=Instalar modelos de documentación Docbook
+Comment[hu]=DocBook-alapú dokumentációsablonok telepítése.
+Comment[it]=Installa modelli di documentazione docbook.
+Comment[ja]=Docbook ドキュメントテンプレートをインストール
+Comment[ms]=Pasang templat dokumentasi Docbook.
+Comment[nds]= Docbook-Dokmentatschoonvörlagen installeren
+Comment[ne]= डकबुक मिसिलीकरण टेम्प्लेट स्थापना गर्नुहोस्
+Comment[nl]=Installeert Docbook-documentatie-sjablonen.
+Comment[pl]=Instalacja szablonów dokumentacji Docbook.
+Comment[pt]= Instala os modelos de documentação em Docbook.
+Comment[pt_BR]= Instala os modelos de documentação em Docbook.
+Comment[ru]=Установка шаблонов Docbook.
+Comment[sk]=Nainštaluje šablóny dokumentácie Docbook.
+Comment[sr]=Инсталира Docbook документационе шаблоне.
+Comment[sr@Latn]=Instalira Docbook dokumentacione šablone.
+Comment[sv]= Installera Docbook-dokumentationsmallar.
+Comment[tr]=Docbook belgelendirme şablonlarını yükle.
+Comment[zh_CN]=安装 Docbook 文档模板。
+Comment[zh_TW]=安裝 Docbook 文件樣本。
+Default=true
+
+[DOCSDIR]
+Type=mkdir
+Dir=%{dest}/doc
+Option=INSTALL_DOCS
+
+[DOCSDIREN]
+Type=mkdir
+Dir=%{dest}/doc/en
+Option=INSTALL_DOCS
+
+[DOCSMAKEFILE.AM1]
+Type=install
+Source=%{kdevelop}/template-common/kde-doc-Makefile.am
+Dest=%{dest}/doc/Makefile.am
+Option=INSTALL_DOCS
+
+[DOCSMAKEFILE.AM2]
+Type=install
+Source=%{kdevelop}/template-common/kde-doc-en-Makefile.am
+Dest=%{dest}/doc/en/Makefile.am
+Option=INSTALL_DOCS
+
+[DOCS]
+Type=install
+Source=%{kdevelop}/template-common/kde-index.docbook
+Dest=%{dest}/doc/en/index.docbook
+Option=INSTALL_DOCS
+
+
diff --git a/parts/appwizard/common/gnome-Makefile.am b/parts/appwizard/common/gnome-Makefile.am
new file mode 100644
index 00000000..101299f8
--- /dev/null
+++ b/parts/appwizard/common/gnome-Makefile.am
@@ -0,0 +1,16 @@
+# not a GNU package. You can remove this line, if
+# have all needed files, that a GNU package needs
+AUTOMAKE_OPTIONS = foreign 1.4
+
+SUBDIRS = src pixmaps macros
+
+EXTRA_DIST = %{APPNAMELC}.lsm %{APPNAMELC}.desktop
+
+install-data-local:
+ $(mkinstalldirs) $(datadir)/gnome/apps/Applications/
+ $(INSTALL_DATA) $(srcdir)/%{APPNAMELC}.desktop $(datadir)/gnome/apps/Applications
+
+uninstall-local:
+ -rm -f $(datadir)/gnome/apps/Applications
+
+
diff --git a/parts/appwizard/common/gnome-Makefile.cvs b/parts/appwizard/common/gnome-Makefile.cvs
new file mode 100644
index 00000000..9d2c21a3
--- /dev/null
+++ b/parts/appwizard/common/gnome-Makefile.cvs
@@ -0,0 +1,5 @@
+default: all
+
+all:
+ srcdir=`pwd` NOCONFIGURE=1 sh macros/autogen.sh
+
diff --git a/parts/appwizard/common/gnome-app.lsm b/parts/appwizard/common/gnome-app.lsm
new file mode 100644
index 00000000..5c3ce51b
--- /dev/null
+++ b/parts/appwizard/common/gnome-app.lsm
@@ -0,0 +1,15 @@
+Begin3
+Title: %{APPNAME} -- Some description
+Version: %{VERSION}
+Entered-date:
+Description:
+Keywords: GNOME
+Author: %{AUTHOR} <%{EMAIL}>
+Maintained-by: %{AUTHOR} <%{EMAIL}>
+Home-page:
+Alternate-site:
+Primary-site: xxxxxx %{APPNAMELC}-%{VERSION}.tar.gz
+ xxx %{APPNAMELC}-%{VERSION}.lsm
+Platform: Linux. Needs GNOME 1.4
+Copying-policy: %{LICENSE}
+End
diff --git a/parts/appwizard/common/gnome-app.png b/parts/appwizard/common/gnome-app.png
new file mode 100644
index 00000000..b52af4b2
--- /dev/null
+++ b/parts/appwizard/common/gnome-app.png
Binary files differ
diff --git a/parts/appwizard/common/gnome-pixmaps-Makefile.am b/parts/appwizard/common/gnome-pixmaps-Makefile.am
new file mode 100644
index 00000000..eae71afa
--- /dev/null
+++ b/parts/appwizard/common/gnome-pixmaps-Makefile.am
@@ -0,0 +1,8 @@
+EXTRA_DIST = $APPNAMELC$.png
+
+install-data-local:
+ $(mkinstalldirs) $(datadir)
+ $(INSTALL_DATA) $(srcdir)/%{APPNAMELC}.png $(datadir)/pixmaps
+
+uninstall-local:
+ -rm -f $(datadir)/pixmaps
diff --git a/parts/appwizard/common/gnome/macros/ChangeLog b/parts/appwizard/common/gnome/macros/ChangeLog
new file mode 100644
index 00000000..1cd754ed
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/ChangeLog
@@ -0,0 +1,859 @@
+1999-08-02 Peter Teichman <pat4@acpub.duke.edu>
+
+ * removed gnome-conduit-check.m4 - it should be distributed with
+ gnome-pilot
+
+1999-07-30 Peter Teichman <pat4@acpub.duke.edu>
+
+ * gnome-conduit-check.m4: added new file of checks. anything that
+ provides a pilot conduit is going to want this
+
+1999-07-07 Tuomas J. Lukka <lukka@iki.fi>
+ * gnome-x-checks.m4: add a comment on how to get gtk-1.3 and
+ glib 1.3 from CVS
+
+1999-07-06 Tuomas J. Lukka <lukka@iki.fi>
+
+ * gnome-x-checks.m4: forbid compiling with Gtk-1.3 for now.
+ gnome only works with 1.2 so far.
+
+1999-07-05 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome.m4: Make "extra library" message slightly easier to read.
+
+Sat Jun 26 01:47:53 1999 Tim Janik <timj@gtk.org>
+
+ * compiler-flags.m4: give -Wunused to gcc instead of -Wno-unused.
+
+1999-06-11 Tuomas J. Lukka <lukka@iki.fi>
+
+ * gnome-guile-checks.m4: Debian has qt_null in -lqthreads but
+ no main. Changed both checks for 'main' to qt_null.
+ I hope this is correct - it shouldn't break anything.
+
+1999-05-11 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (MACROS): Add `gnome-bonobo-check.m4'.
+
+1999-05-09 Jacob Berkman <jberk+@cmu.edu>
+
+ * gnome-bonobo-check.m4: made test program return 0,
+ changed BONOBO_CHECK to not return "failure" on success
+
+1999-04-16 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-print-check.m4 (GNOME_PRINT_CHECK): Fix invocation of
+ AM_PATH_GNOME_PRINT.
+ * Makefile.am (MACROS): Sort lines.
+
+Sun Mar 28 23:39:48 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
+
+ * gnome-vfs.m4: Add --with-vfs option. GNOME_VFS_LIBS still needs
+ to be fixed but that's not a problem because there's no libvfs, yet.
+
+1999-03-10 Tomislav Vujec <tvujec@carnet.hr>
+
+ * aclocal-include.m4 (AM_ACLOCAL_INCLUDE): Add ACLOCAL_FLAGS in
+ ACLOCAL. This allows maintainer rules to work if any of the macros
+ change.
+
+1999-03-10 Tomislav Vujec <tvujec@carnet.hr>
+
+ * gnome.m4 (GNOME_INIT_HOOK): Wrapped position parameter in
+ testing for additional inits. It gets expanded while generating
+ configure, resulting in an empty parameter list - syntax error in
+ for statement.
+
+1999-03-09 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome.m4 (GNOME_INIT): Add a new paramater, which is passed to
+ GNOME_INIT_HOOK.
+ (GNOME_INIT_HOOK): New parameter "additional inits". This is a
+ list like "applets capplet", and the corresponding
+ GNOME_APPLETS_LIBS and GNOME_CAPPLETS_LIBS are defined.
+
+1998-03-01 Mark Crichton <crichton@gimp.org>
+
+ * gnome-objc-checks : Added HAVE_GNOME_OBJC conditional
+
+1998-02-27 Gregory McLean <gregm@comstar.net>
+
+ * gnome-x-checks.m4 : Require at least gtk+ 1.2 (pointless getting
+ bug reports with an old glib/gtk/gdk set..)
+
+1999-02-25 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-checks.m4: Require LibGTop >= 1.0.0.
+
+1999-02-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * compiler-flags.m4: Only add the compilation warnings if the
+ compiler is GCC.
+
+1999-02-20 Timur Bakeyev <mc@bat.ru>
+
+ * gnome.m4: Added and exported ZVT_LIBS.
+
+Tue Feb 16 19:35:42 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gnome-x-checks.m4: Require GTK+-1.1.16.
+
+1999-02-15 Timur Bakeyev <mc@bat.ru>
+
+ * gnome-gettext.m4: Work around a bug in BSDI's native sh, which in-
+ correctly expands ${LINGUAS=$ALL_LINGUAS}. Switched to if/fi variant.
+
+1999-02-15 Chris Lahey <clahey@umich.edu>
+
+ * gnome-print-check.m4: Copied this from libhnj/libhnj.m4. Almost
+ completely replaced the old version. The only usage difference is
+ that it defines GNOME_PRINT_LIBS instead of GNOME_PRINT_LIB and
+ defines GNOME_PRINT_CFLAGS as well.
+
+1999-02-10 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-objc-checks.m4: Applied a patch from Kenneth Stailey;
+ use $CFLAGS when invoking $OBJC so the user can add additional
+ include paths.
+
+1999-02-05 Martin Baulig <martin@home-of-linux.org>
+
+ * compiler-flags.m4: Don't add warning and compiler flags to
+ the CFLAGS and CXXFLAGS when they're cached. This fixes the
+ problem that CFLAGS and CXXFLAGS get longer and longer each
+ time you run a `config.status --recheck'.
+
+1999-02-04 Martin Baulig <martin@home-of-linux.org>
+
+ * aclocal-include.m4 (INSIDE_GNOME_COMMON): New automake
+ conditional that's always false.
+
+ * gnome-common.m4: New file. This defines a `GNOME_COMMON_INIT'
+ macro that should be used in all GNOME Applications outside
+ the CVS tree.
+
+ * Makefile.am: If we are `INSIDE_GNOME_COMMON', install all
+ $(MACROS), autogen.sh, gnome-common.m4 and a newly created
+ gnome-macros.dep in `$(datadir)/aclocal/gnome'.
+
+1999-01-24 Timur Bakeyev <mc@bat.ru>
+
+ * gnome-pthread-check.m4: Add recognition of 2 more libraries -
+ pthreads and pthread-support build in libc (as on BSDI).
+
+1999-01-23 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-checks.m4 (GNOME_LIBGTOP_DOCU): New macro. This
+ checks whether you have the LibGTop documentation installed and
+ defines `HAVE_LIBGTOP_DOCU' if appropriate. Also provides automake
+ conditional.
+
+1999-01-20 Martin Baulig <martin@home-of-linux.org>
+
+ * acinclude.m4 (ac_result): Unset CATOBJEXT so
+ that the macros and Makefiles correctly handle
+ disabling NLS when no gettext is found.
+
+1999-01-19 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-cxx-check.m4 (GNOME_CHECK_CXX): Rewrite to be saner.
+ Don't limit yourself to a fixed set of names for the compiler.
+
+1999-01-06 Nat Friedman <nat@nat.org>
+
+ * Makefile.am (MACROS): Added gnome-print-check.m4 to MACROS
+
+1999-01-05 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Include dirent.h before checking whether
+ `scandir' needs to be declared.
+ * need-declaration.m4: Revert change.
+
+1999-01-05 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * need-declaration.m4, gnome-support.m4: Fixed the scandir detection.
+
+1998-12-22 Jeff Garzik <jgarzik@pobox.com>
+
+ * gnome.m4: Added and exported GNOME_APPLET_LIBS.
+
+1998-12-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gnome-support.m4: Removed all the stuff for argp, that was
+ causing gnomesupport not to build.
+
+1998-12-15 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-gettext.m4: Add the hacked version of the gettext
+ macros that is used in Gtk+ here.
+
+ * autogen.sh: Accept both AM_GNU_GETTEXT and AM_GNOME_GETTEXT.
+
+1998-12-15 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: All parts of GNOME will now require
+ LibGTop >= 0.99.0 which is the latest version from CVS and
+ already feature-freezed for GNOME 1.0.
+
+1998-12-09 Martin Baulig <martin@home-of-linux.org>
+
+ * aclocal-include.m4 (AM_ACLOCAL_INCLUDE): Make this work
+ with more than one directory.
+
+1998-12-08 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: Moved into the LibGTop module.
+ This file contains too much stuff that should only be used
+ internally in LibGTop, so it's better to have it there.
+
+1998-12-06 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: Recognice OpenBSD as a valid
+ system and use the `freebsd' sysdeps directory for it.
+
+Sat Dec 5 23:30:01 PST 1998 Manish Singh <yosh@gimp.org>
+
+ * gnome-guile-checks.m4: clear GUILE_LIBS and GUILE_INCS if
+ guile isn't there (quick fix)
+
+1998-12-05 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: Recognice NetBSD as a valid
+ system and use the `freebsd' sysdeps directory for it.
+
+1998-12-03 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4 (GLIBTOP_LINUX_VERSION_CODE):
+ Define this to be the same as LINUX_VERSION_CODE either from
+ <linux/version.h> or from the running kernel.
+
+1998-12-02 Raja R Harinath <harinath@cs.umn.edu>
+
+ * autogen.sh: "Improve" indentation and messages somewhat.
+
+1998-12-01 Jeff Garzik <jgarzik@pobox.com>
+
+ * autogen.sh:
+ Platform fixes. grep -q is not portable, do not use.
+
+1998-12-01 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
+
+ * autogen.sh: Run gettextize if needed.
+ : Run libtoolize only if configure.in has "^AM_PROG_LIBTOOL".
+
+1998-11-30 Jeff Garzik <jgarzik@pobox.com>
+
+ * gnome.m4: Re-arranged tests such that "--without-gnome" is
+ fully supported. Not only is the logic now correct, programs
+ can test "want_gnome=yes/no" for the results of this arg.
+
+1998-11-27 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: All parts of GNOME will now require
+ LibGTop >= 0.29.0 which is the latest version from CVS.
+
+1998-11-20 James Henstridge <james@daa.com.au>
+
+ * gnome.m4(GNOME_INIT_HOOK): Changed the call to GNOME_GNORBA_CHECK
+ to GNOME_GNORBA_HOOK([],$2). Before if you specified that the
+ macro should not exit on errors, and you didn't have ORBit, the
+ script would fail anyway.
+
+1998-11-17 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: We need to check for <net/if_var.h>
+ and conditionally include it before <net/if_isppp.h> in the code
+ that check for I4B to make it work on FreeBSD 3.0.
+
+1998-10-25 Marius Vollmer <mvo@zagadka.ping.de>
+
+ * gnome-guile-checks.m4: Add GUILE_LIBS to LIBS when checking
+ whether guile works. Adding them to LDFLAGS does not work on all
+ systems. (Thanks to Rusty Chris Holleman)
+
+1998-11-12 Andrew T. Veliath <andrewtv@usa.net>
+
+ * gnome-orbit-check.m4: Remove AC_DEFINE(HAVE_ORBIT). Add
+ AM_CONDITIONAL for HAVE_ORBIT. gnome-gnorba-check.m4: Same with
+ HAVE_GNORBA. Change GNOME_ORBIT_HOOK and GNOME_GNORBA_HOOK to use
+ AC_CACHE_CHECK, setting both gnome_cv_orbit_found and
+ gnome_cv_gnorba_found.
+
+ * gnome.m4: (GNOME_INIT_HOOK): Add GNOME_GNORBA_CHECK if
+ gnome-config is found. New GNOMEGNORBA_LIBS library variable
+ (GNOMEGNORBA_LIBS is a superset of GNOMEUI_LIBS). Update
+ GNOME_LIBDIR and GNOME_INCLUDEDIR to to include the required
+ Gnorba info, if it is in a different location.
+
+ * Makefile.am (MACROS): Add gnome-gnorba-check.m4 to Makefile.
+
+ * gnome-gnorba-check.m4: New file.
+
+1998-11-12 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4 (vsnprintf): Remove easy-vsnprintf hack -- it
+ doesn't work for Solaris 2.5 binaries running on Solaris 2.6.
+ From Frederic Devernay <devernay@istar.fr>.
+
+1998-11-06 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Fix stupid type (sterror_r -> strerror_r).
+
+1998-11-04 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4 (need_gnome_support): Set this unconditionally
+ to `yes'. We'll soon be losing this variable.
+
+1998-10-20 Andrew Veliath <andrewtv@usa.net>
+
+ * gnome-orbit-check.m4 (GNOME_ORBIT_HOOK): Add ORBIT_IDL
+ detection; fix failure flag.
+
+1998-10-12 Martin Baulig <martin@home-of-linux.org>
+
+ * compiler-flags.m4 (warnCFLAGS): Added `-Wno-unused'.
+
+1998-10-11 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4 (libgtop_postinstall): Use `:' instead
+ of the empty string if there is nothing to do since the empty string
+ is no valid shell sytax.
+
+1998-10-11 Marius Vollmer <mvo@zagadka.ping.de>
+
+ * gnome-guile-checks.m4: Check for "guile-config" and then for
+ "build-guile", if guile-config couldn't be found. Do not
+ explicitely include output from "info libdir", it is already
+ included in "link". Use "compile" instead of "info includedir". Do
+ not include "1.2" in error message when Guile can't be found at
+ all.
+
+1998-10-11 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4 (GNOME_INIT_LIBGTOP): Added optional
+ third parameter which is the `script-if-enabled' parameter of
+ the GNOME_LIBGTOP_HOOOK.
+
+1998-10-05 Karl Eichwalder <ke@suse.de>
+
+ * gnome-xml-check.m4: Fix typo while signaling the error.
+
+1998-10-05 Raja R Harinath <harinath@cs.umn.edu>
+
+ * compiler-flags.m4 (warnCFLAGS): Remove `-W'.
+ (warn-unused): Remove.
+
+1998-10-01 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4 (libgtop_postinstall):
+ Added `AC_SUBST(libgtop_postinstall)'. This is used in
+ `src/daemon/Makefile.am' to make the server suid root or
+ sgid kmem if required.
+
+1998-09-28 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: Make it accept libgtop >= 0.25.0 again.
+
+ * gnome-libgtop-sysdeps.m4: Make the default not to build the
+ LibGTop examples.
+
+ * compiler-flags.m4 (--enable-warn-unused): New configure parameter
+ to add `-Wunused' to the warning flags.
+
+1998-09-27 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: Make it require libgtop >= 0.26.2.
+
+1998-09-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-ghttp-check.m4: Add checks for -lsocket -lnsl.
+
+1998-09-18 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Remove commented out code.
+
+1998-09-12 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: Added (AC_SUBST): `libgtop_have_sysinfo'.
+
+1998-09-09 Martin Baulig <baulig@merkur.uni-trier.de>
+
+ * gnome-libgtop-sysdeps.m4: Added check for SMP support.
+ (--with-libgtop-smp): New parameter, default is to enable
+ it only if you're running configure on a SMP system.
+ Added (AC_DEFINE): `HAVE_LIBGTOP_SMP' if enabled.
+ (LIBGTOP_SMP): New automake conditional.
+
+1998-09-02 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Remove check for `canonicalize_file_name'.
+
+1998-09-02 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-support.m4: Check for canonicalize_file_name () and
+ realpath () and add `canonicalize.o' to LIBOBJS if required.
+
+1998-08-30 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: Added (AC_SUBST): `LIBGTOP_VERSION_CODE'.
+ Added (AC_DEFINE_UNQUOTED): `LIBGTOP_VERSION', `LIBGTOP_VERSION_CODE',
+ `LIBGTOP_{MAJOR,MINOR,MICRO,SERVER}_VERSION'.
+
+1998-08-29 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: Make it require libgtop >= 0.26.0.
+ Added (AC_SUBST): `LIBGTOP_INTERFACE_AGE' and `LIBGTOP_BINARY_AGE'.
+
+1998-08-27 Christopher Blizzard <blizzard@appliedtheory.com>
+
+ * gnome-ghttp-check.m4: Umm...I think this works better. Doesn't
+ break anything anyway.
+ Oooo...it actually works now. Forgot a ,
+
+1998-08-26 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4 (GNOME_INIT_LIBGTOP): Make it work
+ with a brain-dead /bin/sh and a brain-dead /bin/test.
+
+ * gnome-libgtop-check.m4 (GNOME_INIT_LIBGTOP): Use `AC_MSG_WARN'
+ if LibGTop cannot be found and the `fail' argument is not given.
+
+1998-08-24 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-support.m4 (GCC_NEED_DECLARATIONS): Added `setreuid',
+ `setregid' and `getpagesize'.
+ (AC_TYPE_UID_T): New check.
+
+1998-08-24 Christopher Blizzard <blizzard@appliedtheory.com>
+
+ * Makefile.am (MACROS): Add gnome-ghttp-check.m4 to the Makefile.
+
+1998-08-23 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4 (GNOME_INIT_LIBGTOP): You can give
+ this macro two parameters: the required version number and
+ an optional `fail' argument to make it fail if LibGTop is
+ not found.
+
+1998-08-22 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-guile-checks.m4: Added check for `-lnsl' and `-lsocket'
+ if `build-guile' cannot be found.
+
+1998-08-20 Raja R Harinath <harinath@cs.umn.edu>
+
+ * compiler-flags.m4: New file. Defines the
+ GNOME_COMPILER_WARNINGS macro.
+ * autogen.sh (conf_flags): Add `--enable-compile-warnings' to list
+ of flags passed to `configure'.
+ * Makefile.am (MACROS): Add compiler-flags.m4.
+
+1998-08-18 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: make it require libgtop >= 0.25.0.
+ Added (AC_SUBST): `LIBGTOP_MICRO_VERSION' and `LIBGTOP_EXTRA_LIBS'.
+
+1998-08-17 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: Completely rewrote this file. It
+ uses now the `libgtop-config' script and also checks for
+ correct libgtop version.
+
+1998-08-06 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: Added `freebsd' directory.
+
+1998-08-04 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-x-checks.m4: Define USE_DEVGTK unconditionally to `true'.
+
+1998-08-04 Stuart Parmenter <pavlov@innerx.net>
+
+ * gnome-x-checks.m4: (AM_PATH_GTK) make it require GTK >= 1.1.1
+ dnl'd the dev_gtk since they will have to anyways.
+
+1998-08-04 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gnome.m4: (GNOME_INIT_HOOK): Call $1 also, if `gnome-config' is
+ found and used
+
+1998-08-02 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome.m4 (GNOME_CONFIG): Use the `gnome-config' program if it
+ exists.
+
+1998-08-01 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (EXTRA_DIST): Remove `macros.dep'.
+
+1998-07-30 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4 (GNOME_LIBGTOP_TYPES): New macro.
+ Checks for `u_int64_t' and `int64_t'.
+
+1998-07-29 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: Added (AC_SUBST):
+ `LIBGTOP_NAMES_LIBS', `LIBGTOP_NAMES_INCS',
+ `LIBGTOP_GUILE_LIBS', `LIBGTOP_GUILE_NAMES_LIBS',
+ `LIBGTOP_MAJOR_VERSION', `LIBGTOP_MINOR_VERSION',
+ `LIBGTOP_VERSION'.
+
+ * gnome-libgtop-sysdeps.m4 (libgtop_sysdeps_dir):
+ Added `AC_SUBST(libgtop_sysdeps_dir)'.
+
+1998-07-29 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Check for functions that `error.c' looks for.
+
+1998-07-29 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-fileutils.m4 (AM_FUNC_ERROR_AT_LINE): Removed.
+
+ * gnome-support.m4 (AM_FUNC_ERROR_AT_LINE): New check.
+
+1998-07-27 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * gnome-x-checks.m4: Changed Gtk version test to use
+ GTK_HAVE_FEATURES_1_1_0.
+
+Sun Jul 26 13:59:53 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
+
+ * Makefile.am (MACROS): Added gnome-xml-check.m4
+ * gnome-xml-check.m4: New file.
+
+1998-07-24 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4: No longer requiring
+ `GNOME_LIBGTOP_SYSDEPS'.
+
+Fri Jul 24 00:45:38 1998 Tom Tromey <tromey@cygnus.com>
+
+ * Makefile.am (MACROS): Added linger.m4.
+ * linger.m4: New file.
+
+Thu Jul 23 22:41:23 1998 Tom Tromey <tromey@cygnus.com>
+
+ * Makefile.am (MACROS): Added gnome-undelfs.m4, gnome-vfs.m4.
+ * gnome-undelfs.m4: New file.
+ * gnome-vfs.m4: New file.
+
+1998-07-22 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-fileutils.m4: Added some reasonable defaults to allow
+ cross compiling; removed `mountlist.o' and `fsusage.o' from
+ LIBOBJS.
+
+Tue Jul 21 23:44:53 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-guile-checks.m4: If no build-guile, link against readline
+ before termcap.
+
+1998-07-15 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (MACROS): Add `need-declaration.m4'.
+
+ * gnome-support.m4 (AC_REPLACE_FUNCS): Add memmove, strtod,
+ strtol, strtoul.
+ (GCC_NEED_DECLARATIONS): New check. Check whether `gethostname'
+ needs to be declared.
+
+ * need-declaration.m4: New file. Stolen from EGCS.
+
+1998-07-13 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4 (AC_REPLACE_FUNCS): Add check for `mkstemp'.
+
+Wed Jul 1 13:50:39 1998 Scott D. Heavner <sdh@po.cwru.edu>
+
+ * curses.m4: add some docs and start using with tcd
+
+1998-06-29 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (MACROS): Add all the `.m4' files here.
+
+Mon Jun 29 11:12:04 1998 Scott D. Heavner <sdh@po.cwru.edu>
+
+ * curses.m4: Need AC_SUBST(CURSES_INCLUDEDIR) not CURSES_INCLUDES
+
+Mon Jun 29 10:35:22 1998 Scott D. Heavner <sdh@po.cwru.edu>
+
+ * curses.m4: rm conftext* should read rm conftest*, was leaving
+ conftest.c files around.
+
+1998-06-27 Christopher Blizzard <blizzard@foo.appliedtheory.com>
+
+ * gnome-objc-checks.m4: Use egcs if it's available. The gcc that
+ ships with RedHat 5.1 doesn't do objc, egcs does.
+
+Fri Jun 26 14:36:08 1998 Scott D. Heavner <sdh@po.cwru.edu>
+
+ * curses.m4 (AC_CHECK_CURSES): New check. mangled out of mc's
+ configure.in
+
+1998-06-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-fileutils.m4 (AM_FUNC_ERROR_AT_LINE): New check.
+ (vprintf): New check.
+ (ftruncate.c): Remove check.
+ This needs to be further cleaned up to only list what is
+ needed for gdiskfree.
+ * Makefile.am (MACROS): Add gnome-fileutils.m4.
+
+1998-06-14 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4 (LINUX_TABLE): New automake conditional;
+ also defines HAVE_LINUX_TABLE.
+
+1998-06-13 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4: Added check for the table ()
+ system call in the linux kernel.
+
+1998-06-11 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-x-checks.m4 (USE_DEVGTK): Use AC_EGREP_CPP rather than
+ AC_CHECK_HEADER. AC_CHECK_HEADER is fooled by warnings.
+
+ * gnome-support.m4 (AC_PROG_AWK): Look for awk.
+ (CROSS_COMPILING): Remove conditional.
+
+Wed Jun 10 14:19:39 EDT 1998 Gregory McLean <gregm@comstar.net>
+
+ * gnome-x-checks.m4: More tweeks to make building against gtk 1.0
+ and gtk1.1 less painful.
+
+1998-06-08 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-support.m4 (CROSS_COMPILING): New automake conditional;
+ (need_gnome_support): added `AC_SUBST(need_gnome_support)'.
+
+1998-06-07 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-guile-checks.m4 (GNOME_CHECK_GUILE): When
+ cross-compiling, we now check for `$host_alias-buile-guile'.
+
+1998-06-03 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-guile-checks.m4 (GNOME_CHECK_GUILE): Looks also
+ in $GNOME_LIBDIR; added failflag: GNOME_CHECK_GUILE(fail)
+ will abort if guile cannot be found.
+
+1998-05-23 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4 (GNOME_LIBGTOP_HOOK):
+ (libgtop_use_machine_h): Set this to true on SunOS.
+
+1998-05-22 Martin Baulig <baulig@merkur.uni-trier.de>
+
+ * gnome-fileutils.m4 (GNOME_FILEUTILS_CHECKS): New file.
+ Imported from `configure.in' in GNU fileutils 3.16. It does
+ all the checks that are needed for the diskusage applet.
+
+1998-05-22 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-check.m4 (GNOME_LIBGTOP_HOOK): New file.
+ Checks whether libgtop is installed and reads its `libgtopConf.sh'
+ file if it can be found. Defines HAVE_LIBGTOP on success and
+ provides HAVE_LIBGTOP automake conditional.
+
+1998-05-21 Martin Baulig <martin@home-of-linux.org>
+
+ * gnome-libgtop-sysdeps.m4 (GNOME_LIBGTOP_SYSDEPS): New file.
+ (libgtop_sysdeps_dir): sysdeps directory libgtop uses.
+ (libgtop_use_machine_h): define HAVE_GLIBTOP_MACHINE_H if this
+ is `yes'.
+ (libgtop_need_server): we only need the libgtop server, when
+ this has a value of `yes'. Defines NEED_LIBGTOP and NEED_LIBGTOP
+ automake conditional.
+
+1998-05-19 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4 (strerror): New check.
+ (sys_errlist): Check for this variable, needed for `strerror'.
+ (program_invocation_name, program_invocation_short_name): Change
+ method used to check for these.
+
+1998-05-09 Raja R Harinath <harinath@cs.umn.edu>
+
+ * autogen.sh: Remove simple-minded check for `gtk+'.
+
+Fri Apr 24 16:43:38 1998 Owen Taylor <otaylor@gtk.org>
+
+ * autogen.sh: Pass the results of the environment variable
+ ACLOCAL_FLAGS to aclocal. This allows, for instance,
+
+ ACLOCAL_FLAGS="-I /home/owen/share/aclocal/" autogen.sh
+
+Sun Apr 19 01:35:53 EDT 1998 Gregory McLean <gregm@comstar.net>
+
+ * gnome-x-checks.m4: Updated the gtk check to check for 1.0.0.
+
+1998-04-08 Raja R Harinath <harinath@cs.umn.edu>
+
+ * autogen.sh: Update to list newer versions of packages.
+ * gnome-support.m4: Add `scandir' to AC_REPLACE_FUNCS.
+ Also run AC_HEADER_DIRENT.
+
+1998-03-31 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4 (AC_REPLACE_FUNCS): Look for vasprintf.
+
+Thu Mar 19 23:23:30 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome.m4: An empty true branch of an `if' statement is not valid
+ sh syntax. If GNOME_INIT_HOOK argument $1 is empty, use ":"
+ instead.
+
+1998-03-19 Miguel de Icaza <miguel@nuclecu.unam.mx>
+
+ * gnome.m4 (GNOME_INIT_HOOK): Provide a way to hook some code to
+ execute; Accept a probe mode.
+
+ (GNOME_INIT): Define in terms of GNOME_INIT_HOOK.
+
+Thu Mar 19 00:17:46 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-support.m4: Cache results of check for
+ program_invocation_short_name, program_invocation_name. Check to
+ make sure argp functions are in a library.
+
+ * gnome-support.m4: Cache results of argp check.
+
+Sun Mar 15 15:54:43 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gnome-x-checks.m4: Replaced checks for X and GTK
+ with AM_PATH_GTK. x_include, X_LIBS, etc, variables no longer
+ defined.
+
+1998-03-12 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Add a check for <linewrap.h> -- this enables
+ some optimizations when compiling `argp'.
+
+Mon Mar 9 19:32:42 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-support.m4: Build vsnprintf.o, not vsnprint.o.
+
+1998-03-09 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: Add check for `vsnprintf'.
+
+Sun Mar 8 17:04:28 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-support.m4: Set need_gnome_support shell variable. Define
+ BUILD_GNOME_SUPPORT automake conditional. Define LTLIBOBJS. Look
+ for argp_domain element in struct argp.
+
+Sat Mar 7 00:04:22 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-support.m4 (GNOME_SUPPORT_CHECKS): Add argp-pvh.o to
+ LIBOBJS.
+
+ * gnome-support.m4 (GNOME_SUPPORT_CHECKS): Check for strnlen().
+
+Wed Mar 4 01:02:55 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-support.m4 (GNOME_SUPPORT_CHECKS): Check for argp code,
+ strndup, program_invocation_name, program_invocation_short_name.
+
+Mon Mar 2 15:27:44 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-x-checks.m4 (GNOME_X_CHECKS): Also check for SMlib.h; some
+ Solaris systems have -lSM but not SMlib.h.
+
+Sun Mar 1 17:49:42 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome.m4 (GNOME_INIT): Changed spacing so --help output looks
+ right.
+
+Fri Feb 27 10:05:34 1998 Tom Tromey <tromey@cygnus.com>
+
+ * gnome-objc-checks.m4 (GNOME_CHECK_OBJC): Set OBJECTIVE_C shell
+ variable.
+
+1998-02-26 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-x-checks.m4 (CPPFLAGS): Put $X_CFLAGS here, not in
+ $CFLAGS.
+ (GNOME_HAVE_SM): New var. `true' if we have libSM, `false'
+ otherwise.
+
+1998-02-19 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome.m4: Remove `GNOME_CHECK_GNOME'.
+
+1998-02-18 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4 (GNOME_SUPPORT_CHECKS): Replace `strcasecmp' if
+ necessary.
+
+1998-02-15 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (MACROS): Add `gnome-pthread-check.m4'.
+ * gnome-pthread-check.m4: New file. Moved pthread check from
+ gnome-x-checks.m4 to here.
+ * gnome-objc-checks.m4: Use `gnome-pthread-check'.
+ (OBJC_LIBS): New config var.
+ * gnome-x-checks.m4: Add `AC_DEFINE(HAVE_LIBSM)' if `-lSM' is
+ already part of `$x_libs'.
+ Move pthread check to new file.
+
+Sat Feb 14 12:45:35 1998 Tom Tromey <tromey@cygnus.com>
+
+ * Makefile.am (macros.dep): Use single quotes, not double quotes.
+ Otherwise bash will interpret `$(...)' incorrectly.
+ (EXTRA_DIST): Include macros.dep in distribution.
+
+1998-02-14 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (macros.dep): Put back doubled `$'. We want the
+ expansion to occur in the including Makefile, not here.
+ Otherwise, there will be an extra `../' in the rule.
+
+Sat Feb 14 17:41:28 KST 1998 Changwoo Ryu <cwryu@adam.kaist.ac.kr>
+
+ * autogen.sh: multilple aclocal -I directories.
+
+Sat Feb 14 01:09:37 1998 Tom Tromey <tromey@cygnus.com>
+
+ * Makefile.am (macros.dep): Removed extra `$' from rule.
+
+ * gnome-x-checks.m4: Only check for -lSM if not already in
+ x_libs.
+
+1998-02-13 Raja R Harinath <harinath@cs.umn.edu>
+
+ * Makefile.am (EXTRA_DIST): Add `autogen.sh'.
+
+ * gnome-objc-checks.m4 (GNOME_INIT_OBJC): Solaris /bin/sh doesn't
+ understand `test -e'.
+
+ * autogen.sh: New file.
+
+ * gnome.m4 (GNOME_INIT): Look for gnomeConf.sh in $libdir, where
+ the installation actually installs it.
+
+ * Makefile.am (macros.dep): New maintainer rule for handling
+ automatic rebuilding of aclocal.m4 if any of the macros change.
+ (MACROS): New variable. List of all `m4' macros in this
+ directory.
+
+1998-02-12 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome-support.m4: New file. Defines GNOME_SUPPORT_CHECKS for
+ libsupport.a support.
+
+1998-02-10 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gnome.m4: New file. Moved AC_CHECK_GNOME from `configure.in' to
+ here, and renamed macro to GNOME_CHECK_GNOME.
+ * gnome-x-checks.m4: Likewise, move and renaming AC_GNOME_X_CHECKS
+ to GNOME_X_CHECKS.
+
+ * aclocal-include.m4: New file. Defines AM_ACLOCAL_INCLUDE macro
+ to provide extra search directories to `aclocal'.
+
+*Local Variables:
+*backup-inhibited: t
+*End:
diff --git a/parts/appwizard/common/gnome/macros/aclocal-include.m4 b/parts/appwizard/common/gnome/macros/aclocal-include.m4
new file mode 100644
index 00000000..abf6533f
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/aclocal-include.m4
@@ -0,0 +1,16 @@
+# aclocal-include.m4
+#
+# This macro adds the name macrodir to the set of directories
+# that `aclocal' searches for macros.
+
+# serial 1
+
+dnl AM_ACLOCAL_INCLUDE(macrodir)
+AC_DEFUN([AM_ACLOCAL_INCLUDE],
+[
+ AM_CONDITIONAL(INSIDE_GNOME_COMMON, test x = y)
+
+ test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+ for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
+])
diff --git a/parts/appwizard/common/gnome/macros/autogen.sh b/parts/appwizard/common/gnome/macros/autogen.sh
new file mode 100644
index 00000000..70273913
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/autogen.sh
@@ -0,0 +1,145 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`autoconf' installed to compile Gnome."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
+ (libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`libtool' installed to compile Gnome."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
+ grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
+ (gettext --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`gettext' installed to compile Gnome."
+ echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
+ grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
+ (gettext --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`gettext' installed to compile Gnome."
+ echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: You must have \`automake' installed to compile Gnome."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+ NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "**Error**: Missing \`aclocal'. The version of \`automake'"
+ echo "installed doesn't appear recent enough."
+ echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+if test -z "$*"; then
+ echo "**Warning**: I am going to run \`configure' with no arguments."
+ echo "If you wish to pass any to it, please specify them on the"
+ echo \`$0\'" command line."
+ echo
+fi
+
+case $CC in
+xlc )
+ am_opt=--include-deps;;
+esac
+
+for coin in `find $srcdir -name configure.in -print`
+do
+ dr=`dirname $coin`
+ if test -f $dr/NO-AUTO-GEN; then
+ echo skipping $dr -- flagged as no auto-gen
+ else
+ echo processing $dr
+ macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
+ ( cd $dr
+ aclocalinclude="$ACLOCAL_FLAGS"
+ for k in $macrodirs; do
+ if test -d $k; then
+ aclocalinclude="$aclocalinclude -I $k"
+ ##else
+ ## echo "**Warning**: No such directory \`$k'. Ignored."
+ fi
+ done
+ if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
+ if grep "sed.*POTFILES" configure.in >/dev/null; then
+ : do nothing -- we still have an old unmodified configure.in
+ else
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running gettextize... Ignore non-fatal messages."
+ echo "no" | gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ fi
+ if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
+ echo "Creating $dr/aclocal.m4 ..."
+ test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
+ echo "Running gettextize... Ignore non-fatal messages."
+ echo "no" | gettextize --force --copy
+ echo "Making $dr/aclocal.m4 writable ..."
+ test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
+ fi
+ if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
+ echo "Running libtoolize..."
+ libtoolize --force --copy
+ fi
+ echo "Running aclocal $aclocalinclude ..."
+ aclocal $aclocalinclude
+ if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
+ echo "Running autoheader..."
+ autoheader
+ fi
+ echo "Running automake --gnu $am_opt ..."
+ automake --add-missing --gnu $am_opt
+ echo "Running autoconf ..."
+ autoconf
+ )
+ fi
+done
+
+conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
+
+if test x$NOCONFIGURE = x; then
+ echo Running $srcdir/configure $conf_flags "$@" ...
+ $srcdir/configure $conf_flags "$@" \
+ && echo Now type \`make\' to compile $PKG_NAME || exit 1
+else
+ echo Skipping configure process.
+fi
diff --git a/parts/appwizard/common/gnome/macros/compiler-flags.m4 b/parts/appwizard/common/gnome/macros/compiler-flags.m4
new file mode 100644
index 00000000..278d5099
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/compiler-flags.m4
@@ -0,0 +1,109 @@
+dnl GNOME_COMPILE_WARNINGS
+dnl Turn on many useful compiler warnings
+dnl For now, only works on GCC
+AC_DEFUN([GNOME_COMPILE_WARNINGS],[
+ AC_ARG_ENABLE(compile-warnings,
+ [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=minimum)
+
+ AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+ warnCFLAGS=
+ if test "x$GCC" != xyes; then
+ enable_compile_warnings=no
+ fi
+
+ if test "x$enable_compile_warnings" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) warnCFLAGS="-Wall -Wunused" ;;
+ esac
+
+ ## -W is not all that useful. And it cannot be controlled
+ ## with individual -Wno-xxx flags, unlike -Wall
+ if test "x$enable_compile_warnings" = "xyes"; then
+ warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith"
+ fi
+ fi
+ fi
+ AC_MSG_RESULT($warnCFLAGS)
+
+ AC_ARG_ENABLE(iso-c,
+ [ --enable-iso-c Try to warn if code is not ISO C ],,
+ enable_iso_c=no)
+
+ AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
+ complCFLAGS=
+ if test "x$enable_iso_c" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) complCFLAGS="$complCFLAGS -ansi" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) complCFLAGS="$complCFLAGS -pedantic" ;;
+ esac
+ fi
+ fi
+ AC_MSG_RESULT($complCFLAGS)
+ if test "x$cflags_set" != "xyes"; then
+ CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS"
+ cflags_set=yes
+ AC_SUBST(cflags_set)
+ fi
+])
+
+dnl For C++, do basically the same thing.
+
+AC_DEFUN([GNOME_CXX_WARNINGS],[
+ AC_ARG_ENABLE(cxx-warnings,
+ [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum)
+
+ AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
+ warnCXXFLAGS=
+ if test "x$GCC" != xyes; then
+ enable_compile_warnings=no
+ fi
+ if test "x$enable_cxx_warnings" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CXXFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) warnCXXFLAGS="-Wall -Wno-unused" ;;
+ esac
+
+ ## -W is not all that useful. And it cannot be controlled
+ ## with individual -Wno-xxx flags, unlike -Wall
+ if test "x$enable_cxx_warnings" = "xyes"; then
+ warnCXXFLAGS="$warnCXXFLAGS -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wshadow -Woverloaded-virtual"
+ fi
+ fi
+ fi
+ AC_MSG_RESULT($warnCXXFLAGS)
+
+ AC_ARG_ENABLE(iso-cxx,
+ [ --enable-iso-cxx Try to warn if code is not ISO C++ ],,
+ enable_iso_cxx=no)
+
+ AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
+ complCXXFLAGS=
+ if test "x$enable_iso_cxx" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CXXFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
+ esac
+
+ case " $CXXFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
+ esac
+ fi
+ fi
+ AC_MSG_RESULT($complCXXFLAGS)
+ if test "x$cxxflags_set" != "xyes"; then
+ CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
+ cxxflags_set=yes
+ AC_SUBST(cxxflags_set)
+ fi
+])
diff --git a/parts/appwizard/common/gnome/macros/curses.m4 b/parts/appwizard/common/gnome/macros/curses.m4
new file mode 100644
index 00000000..3dd4ffaa
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/curses.m4
@@ -0,0 +1,318 @@
+dnl Curses detection: Munged from Midnight Commander's configure.in
+dnl
+dnl What it does:
+dnl =============
+dnl
+dnl - Determine which version of curses is installed on your system
+dnl and set the -I/-L/-l compiler entries and add a few preprocessor
+dnl symbols
+dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
+dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
+dnl Makefile.in's
+dnl - Modify the following configure variables (these are the only
+dnl curses.m4 variables you can access from within configure.in)
+dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
+dnl an ncurses.h that's been renamed to curses.h
+dnl is found.
+dnl CURSES_LIBS - sets -L and -l's appropriately
+dnl CFLAGS - if --with-sco, add -D_SVID3
+dnl has_curses - exports result of tests to rest of configure
+dnl
+dnl Usage:
+dnl ======
+dnl 1) Add lines indicated below to acconfig.h
+dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
+dnl 3) Instead of #include <curses.h> you should use the following to
+dnl properly locate ncurses or curses header file
+dnl
+dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
+dnl #include <ncurses.h>
+dnl #else
+dnl #include <curses.h>
+dnl #endif
+dnl
+dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
+dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
+dnl
+dnl Notes with automake:
+dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
+dnl configure.in
+dnl - your Makefile.am can look something like this
+dnl -----------------------------------------------
+dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
+dnl if HAS_CURSES
+dnl CURSES_TARGETS=name_of_curses_prog
+dnl endif
+dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
+dnl other_programs_SOURCES = blah blah blah
+dnl name_of_curses_prog_SOURCES = blah blah blah
+dnl other_programs_LDADD = blah
+dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
+dnl -----------------------------------------------
+dnl
+dnl
+dnl The following lines should be added to acconfig.h:
+dnl ==================================================
+dnl
+dnl /*=== Curses version detection defines ===*/
+dnl /* Found some version of curses that we're going to use */
+dnl #undef HAS_CURSES
+dnl
+dnl /* Use SunOS SysV curses? */
+dnl #undef USE_SUNOS_CURSES
+dnl
+dnl /* Use old BSD curses - not used right now */
+dnl #undef USE_BSD_CURSES
+dnl
+dnl /* Use SystemV curses? */
+dnl #undef USE_SYSV_CURSES
+dnl
+dnl /* Use Ncurses? */
+dnl #undef USE_NCURSES
+dnl
+dnl /* If you Curses does not have color define this one */
+dnl #undef NO_COLOR_CURSES
+dnl
+dnl /* Define if you want to turn on SCO-specific code */
+dnl #undef SCO_FLAVOR
+dnl
+dnl /* Set to reflect version of ncurses *
+dnl * 0 = version 1.*
+dnl * 1 = version 1.9.9g
+dnl * 2 = version 4.0/4.1 */
+dnl #undef NCURSES_970530
+dnl
+dnl /*=== End new stuff for acconfig.h ===*/
+dnl
+
+
+AC_DEFUN(AC_CHECK_CURSES,[
+ search_ncurses=true
+ screen_manager=""
+ has_curses=false
+
+ CFLAGS=${CFLAGS--O}
+
+ AC_SUBST(CURSES_LIBS)
+ AC_SUBST(CURSES_INCLUDEDIR)
+
+ AC_ARG_WITH(sco,
+ [ --with-sco Use this to turn on SCO-specific code],[
+ if test x$withval = xyes; then
+ AC_DEFINE(SCO_FLAVOR)
+ CFLAGS="$CFLAGS -D_SVID3"
+ fi
+ ])
+
+ AC_ARG_WITH(sunos-curses,
+ [ --with-sunos-curses Used to force SunOS 4.x curses],[
+ if test x$withval = xyes; then
+ AC_USE_SUNOS_CURSES
+ fi
+ ])
+
+ AC_ARG_WITH(osf1-curses,
+ [ --with-osf1-curses Used to force OSF/1 curses],[
+ if test x$withval = xyes; then
+ AC_USE_OSF1_CURSES
+ fi
+ ])
+
+ AC_ARG_WITH(vcurses,
+ [ --with-vcurses[=incdir] Used to force SysV curses],
+ if test x$withval != xyes; then
+ CURSES_INCLUDEDIR="-I$withval"
+ fi
+ AC_USE_SYSV_CURSES
+ )
+
+ AC_ARG_WITH(ncurses,
+ [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
+ if test x$withval = xno ; then
+ search_ncurses=false
+ elif test x$withval != xyes ; then
+ CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
+ CURSES_INCLUDEDIR="-I$withval/include"
+ search_ncurses=false
+ screen_manager="ncurses"
+ AC_DEFINE(USE_NCURSES)
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ fi
+ )
+
+ if $search_ncurses
+ then
+ AC_SEARCH_NCURSES()
+ fi
+
+
+])
+
+
+AC_DEFUN(AC_USE_SUNOS_CURSES, [
+ search_ncurses=false
+ screen_manager="SunOS 4.x /usr/5include curses"
+ AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
+ AC_DEFINE(USE_SUNOS_CURSES)
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(NO_COLOR_CURSES)
+ AC_DEFINE(USE_SYSV_CURSES)
+ CURSES_INCLUDEDIR="-I/usr/5include"
+ CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
+ AC_MSG_RESULT(Please note that some screen refreshs may fail)
+])
+
+AC_DEFUN(AC_USE_OSF1_CURSES, [
+ AC_MSG_RESULT(Using OSF1 curses)
+ search_ncurses=false
+ screen_manager="OSF1 curses"
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(NO_COLOR_CURSES)
+ AC_DEFINE(USE_SYSV_CURSES)
+ CURSES_LIBS="-lcurses"
+])
+
+AC_DEFUN(AC_USE_SYSV_CURSES, [
+ AC_MSG_RESULT(Using SysV curses)
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(USE_SYSV_CURSES)
+ search_ncurses=false
+ screen_manager="SysV/curses"
+ CURSES_LIBS="-lcurses"
+])
+
+dnl AC_ARG_WITH(bsd-curses,
+dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
+dnl search_ncurses=false
+dnl screen_manager="Ultrix/cursesX"
+dnl if test $system = ULTRIX
+dnl then
+dnl THIS_CURSES=cursesX
+dnl else
+dnl THIS_CURSES=curses
+dnl fi
+dnl
+dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
+dnl AC_DEFINE(HAS_CURSES)
+dnl has_curses=true
+dnl AC_DEFINE(USE_BSD_CURSES)
+dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
+dnl AC_WARN(Use of the bsdcurses extension has some)
+dnl AC_WARN(display/input problems.)
+dnl AC_WARN(Reconsider using xcurses)
+dnl)
+
+
+dnl
+dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
+dnl
+AC_DEFUN(AC_NCURSES, [
+ if $search_ncurses
+ then
+ if test -f $1/$2
+ then
+ AC_MSG_RESULT(Found ncurses on $1/$2)
+ CURSES_LIBS="$3"
+ CURSES_INCLUDEDIR="$4"
+ search_ncurses=false
+ screen_manager=$5
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(USE_NCURSES)
+ fi
+ fi
+])
+
+AC_DEFUN(AC_SEARCH_NCURSES, [
+ AC_CHECKING("location of ncurses.h file")
+
+ AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
+ AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
+ AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
+ AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
+
+ AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
+
+ AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
+
+ dnl
+ dnl We couldn't find ncurses, try SysV curses
+ dnl
+ if $search_ncurses
+ then
+ AC_EGREP_HEADER(init_color, /usr/include/curses.h,
+ AC_USE_SYSV_CURSES)
+ AC_EGREP_CPP(USE_NCURSES,[
+#include <curses.h>
+#ifdef __NCURSES_H
+#undef USE_NCURSES
+USE_NCURSES
+#endif
+],[
+ CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(USE_NCURSES)
+ search_ncurses=false
+ screen_manager="ncurses installed as curses"
+])
+ fi
+
+ dnl
+ dnl Try SunOS 4.x /usr/5{lib,include} ncurses
+ dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
+ dnl should be replaced by a more fine grained selection routine
+ dnl
+ if $search_ncurses
+ then
+ if test -f /usr/5include/curses.h
+ then
+ AC_USE_SUNOS_CURSES
+ fi
+ else
+ # check for ncurses version, to properly ifdef mouse-fix
+ AC_MSG_CHECKING(for ncurses version)
+ ncurses_version=unknown
+cat > conftest.$ac_ext <<EOF
+[#]line __oline__ "configure"
+#include "confdefs.h"
+#ifdef RENAMED_NCURSES
+#include <curses.h>
+#else
+#include <ncurses.h>
+#endif
+#undef VERSION
+VERSION:NCURSES_VERSION
+EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
+ egrep "VERSION:" >conftest.out 2>&1; then
+changequote(,)dnl
+ ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
+changequote([,])dnl
+ fi
+ rm -rf conftest*
+ AC_MSG_RESULT($ncurses_version)
+ case "$ncurses_version" in
+changequote(,)dnl
+ 4.[01])
+changequote([,])dnl
+ AC_DEFINE(NCURSES_970530,2)
+ ;;
+ 1.9.9g)
+ AC_DEFINE(NCURSES_970530,1)
+ ;;
+ 1*)
+ AC_DEFINE(NCURSES_970530,0)
+ ;;
+ esac
+ fi
+])
+
+
+
+
+
diff --git a/parts/appwizard/common/gnome/macros/gnome-Makefile.am b/parts/appwizard/common/gnome/macros/gnome-Makefile.am
new file mode 100644
index 00000000..e03dbeed
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-Makefile.am
@@ -0,0 +1,40 @@
+## Please update this variable if any new macros are created
+MACROS= \
+ aclocal-include.m4 \
+ compiler-flags.m4 \
+ curses.m4 \
+ gnome-bonobo-check.m4 \
+ gnome-fileutils.m4 \
+ gnome-gettext.m4 \
+ gnome-ghttp-check.m4 \
+ gnome-gnorba-check.m4 \
+ gnome-guile-checks.m4 \
+ gnome-libgtop-check.m4 \
+ gnome-objc-checks.m4 \
+ gnome-orbit-check.m4 \
+ gnome-print-check.m4 \
+ gnome-pthread-check.m4 \
+ gnome-support.m4 \
+ gnome-undelfs.m4 \
+ gnome-vfs.m4 \
+ gnome-x-checks.m4 \
+ gnome-xml-check.m4 \
+ gnome.m4 \
+ linger.m4 \
+ need-declaration.m4
+
+EXTRA_DIST=$(MACROS) gnome-common.m4 autogen.sh
+MAINTAINERCLEANFILES=macros.dep
+
+@MAINT@macros.dep: Makefile.am
+@MAINT@ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=macros/%)' > $@
+
+if INSIDE_GNOME_COMMON
+gnome_aclocaldir = $(datadir)/aclocal/gnome
+
+gnome-macros.dep: Makefile.am
+ @echo '$$(top_srcdir)/aclocal.m4: $(MACROS:%=$(gnome_aclocaldir)/%)' > $@
+
+gnome_aclocal_DATA = $(MACROS) gnome-macros.dep gnome-common.m4 autogen.sh
+
+endif
diff --git a/parts/appwizard/common/gnome/macros/gnome-bonobo-check.m4 b/parts/appwizard/common/gnome/macros/gnome-bonobo-check.m4
new file mode 100644
index 00000000..65e272cf
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-bonobo-check.m4
@@ -0,0 +1,150 @@
+# Configure paths for Bonobo
+# Miguel de Icaza, 99-04-12
+# Stolen from Chris Lahey 99-2-5
+# stolen from Manish Singh again
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_BONOBO ([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for Bonobo, and define BONOBO_CFLAGS and BONOBO_LIBS
+dnl
+AC_DEFUN([AM_PATH_BONOBO],
+[
+dnl
+dnl Get the cflags and libraries from the gnome-config script
+dnl
+AC_ARG_WITH(bonobo-prefix,[ --with-bonobo-prefix=PFX Prefix where Bonobo is installed (optional)],
+ bonobo_prefix="$withval", bonobo_prefix="")
+AC_ARG_WITH(bonobo-exec-prefix,[ --with-bonobo-exec-prefix=PFX Exec prefix where Bonobo is installed (optional)],
+ bonobo_exec_prefix="$withval", bonobo_exec_prefix="")
+AC_ARG_ENABLE(bonobotest, [ --disable-bonobotest Do not try to compile and run a test Bonobo program],
+ , enable_bonobotest=yes)
+
+ if test x$bonobo_exec_prefix != x ; then
+ bonobo_args="$bonobo_args --exec-prefix=$bonobo_exec_prefix"
+ if test x${GNOME_CONFIG+set} != xset ; then
+ GNOME_CONFIG=$bonobo_exec_prefix/bin/gnome-config
+ fi
+ fi
+ if test x$bonobo_prefix != x ; then
+ bonobo_args="$bonobo_args --prefix=$bonobo_prefix"
+ if test x${GNOME_CONFIG+set} != xset ; then
+ GNOME_CONFIG=$bonobo_prefix/bin/gnome-config
+ fi
+ fi
+
+ AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
+ min_bonobo_version=ifelse([$1], ,0.1.0,$1)
+ AC_MSG_CHECKING(for BONOBO - version >= $min_bonobo_version)
+ no_bonobo=""
+ if test "$GNOME_CONFIG" = "no" ; then
+ no_bonobo=yes
+ else
+ BONOBO_CFLAGS=`$GNOME_CONFIG $bonoboconf_args --cflags bonobo`
+ BONOBO_LIBS=`$GNOME_CONFIG $bonoboconf_args --libs bonobo`
+
+ bonobo_major_version=`$GNOME_CONFIG $bonobo_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ bonobo_minor_version=`$GNOME_CONFIG $bonobo_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ bonobo_micro_version=`$GNOME_CONFIG $bonobo_config_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_bonobotest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $BONOBO_CFLAGS"
+ LIBS="$LIBS $BONOBO_LIBS"
+dnl
+dnl Now check if the installed BONOBO is sufficiently new. (Also sanity
+dnl checks the results of gnome-config to some extent
+dnl
+ rm -f conf.bonobotest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <bonobo/gnome-object.h>
+
+static char*
+my_strdup (char *str)
+{
+ char *new_str;
+
+ if (str)
+ {
+ new_str = malloc ((strlen (str) + 1) * sizeof(char));
+ strcpy (new_str, str);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+int main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.bonobotest");
+ gnome_object_get_type ();
+ return 0;
+}
+
+],, no_bonobo=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_bonobo" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$GNOME_CONFIG" = "no" ; then
+ echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
+ echo "*** If BONOBO was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the GNOME_CONFIG environment variable to the"
+ echo "*** full path to gnome-config."
+ else
+ if test -f conf.bonobotest ; then
+ :
+ else
+ echo "*** Could not run BONOBO test program, checking why..."
+ CFLAGS="$CFLAGS $BONOBO_CFLAGS"
+ LIBS="$LIBS $BONOBO_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <bonobo/gnome-object.h>
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding BONOBO or finding the wrong"
+ echo "*** version of BONOBO. If it is not finding BONOBO, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means BONOBO was incorrectly installed"
+ echo "*** or that you have moved BONOBO since it was installed. In the latter case, you"
+ echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ BONOBO_CFLAGS=""
+ BONOBO_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(BONOBO_CFLAGS)
+ AC_SUBST(BONOBO_LIBS)
+ rm -f conf.bonobotest
+])
+
+AC_DEFUN([BONOBO_CHECK], [
+ AM_PATH_BONOBO(0.1.0,,[AC_MSG_ERROR(BONOBO not found)])
+])
+
diff --git a/parts/appwizard/common/gnome/macros/gnome-common.m4 b/parts/appwizard/common/gnome/macros/gnome-common.m4
new file mode 100644
index 00000000..b7238297
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-common.m4
@@ -0,0 +1,14 @@
+# gnome-common.m4
+#
+# This only for packages that are not in the GNOME CVS tree.
+
+dnl GNOME_COMMON_INIT
+
+AC_DEFUN([GNOME_COMMON_INIT],
+[
+ GNOME_ACLOCAL_DIR=`$ACLOCAL --print-ac-dir`/gnome
+ AC_SUBST(GNOME_ACLOCAL_DIR)
+
+ ACLOCAL="$ACLOCAL -I $GNOME_ACLOCAL_DIR"
+])
+
diff --git a/parts/appwizard/common/gnome/macros/gnome-fileutils.m4 b/parts/appwizard/common/gnome/macros/gnome-fileutils.m4
new file mode 100644
index 00000000..7c11a785
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-fileutils.m4
@@ -0,0 +1,414 @@
+dnl
+dnl GNOME_FILEUTILS_CHECKS
+dnl
+dnl checks that are needed for the diskusage applet.
+dnl
+
+AC_DEFUN([GNOME_FILEUTILS_CHECKS],
+[
+AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
+mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
+sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
+
+AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
+getcwd getmntinfo gettimeofday isascii lchown \
+listmntent memcpy mkfifo strchr strerror strrchr vprintf)
+
+dnl Set some defaults when cross-compiling
+
+if test x$cross_compiling = xyes ; then
+ case "$host_os" in
+ linux*)
+ fu_cv_sys_mounted_getmntent1=yes
+ fu_cv_sys_stat_statfs2_bsize=yes
+ ;;
+ sunos*)
+ fu_cv_sys_stat_statfs4=yes
+ ;;
+ freebsd*)
+ fu_cv_sys_stat_statfs2_bsize=yes
+ ;;
+ osf*)
+ fu_cv_sys_stat_statfs3_osf1=yes
+ ;;
+ esac
+fi
+
+# Determine how to get the list of mounted filesystems.
+list_mounted_fs=
+
+# If the getmntent function is available but not in the standard library,
+# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
+AC_FUNC_GETMNTENT
+
+# This test must precede the ones for getmntent because Unicos-9 is
+# reported to have the getmntent function, but its support is incompatible
+# with other getmntent implementations.
+
+# NOTE: Normally, I wouldn't use a check for system type as I've done for
+# `CRAY' below since that goes against the whole autoconf philosophy. But
+# I think there is too great a chance that some non-Cray system has a
+# function named listmntent to risk the false positive.
+
+if test -z "$list_mounted_fs"; then
+# Cray UNICOS 9
+AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
+AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
+[fu_cv_sys_mounted_cray_listmntent=no
+AC_EGREP_CPP(yes,
+[#ifdef _CRAY
+yes
+#endif
+], [test $ac_cv_func_listmntent = yes \
+&& fu_cv_sys_mounted_cray_listmntent=yes]
+)
+]
+)
+AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
+if test $fu_cv_sys_mounted_cray_listmntent = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_LISTMNTENT)
+fi
+fi
+
+if test $ac_cv_func_getmntent = yes; then
+
+# This system has the getmntent function.
+# Determine whether it's the one-argument variant or the two-argument one.
+
+if test -z "$list_mounted_fs"; then
+# 4.3BSD, SunOS, HP-UX, Dynix, Irix
+AC_MSG_CHECKING([for one-argument getmntent function])
+AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
+[test $ac_cv_header_mntent_h = yes \
+&& fu_cv_sys_mounted_getmntent1=yes \
+|| fu_cv_sys_mounted_getmntent1=no])
+AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
+if test $fu_cv_sys_mounted_getmntent1 = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_GETMNTENT1)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+# SVR4
+AC_MSG_CHECKING([for two-argument getmntent function])
+AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
+[AC_EGREP_HEADER(getmntent, sys/mnttab.h,
+fu_cv_sys_mounted_getmntent2=yes,
+fu_cv_sys_mounted_getmntent2=no)])
+AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
+if test $fu_cv_sys_mounted_getmntent2 = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_GETMNTENT2)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
+fi
+
+fi
+
+if test -z "$list_mounted_fs"; then
+# DEC Alpha running OSF/1.
+AC_MSG_CHECKING([for getfsstat function])
+AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
+[AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/mount.h>
+#include <sys/fs_types.h>],
+[struct statfs *stats;
+int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
+fu_cv_sys_mounted_getsstat=yes,
+fu_cv_sys_mounted_getsstat=no)])
+AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
+if test $fu_cv_sys_mounted_getsstat = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_GETFSSTAT)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+# AIX.
+AC_MSG_CHECKING([for mntctl function and struct vmount])
+AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
+[AC_TRY_CPP([#include <fshelp.h>],
+fu_cv_sys_mounted_vmount=yes,
+fu_cv_sys_mounted_vmount=no)])
+AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
+if test $fu_cv_sys_mounted_vmount = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_VMOUNT)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+# SVR3
+AC_MSG_CHECKING([for FIXME existence of three headers])
+AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
+[AC_TRY_CPP([
+#include <sys/statfs.h>
+#include <sys/fstyp.h>
+#include <mnttab.h>],
+fu_cv_sys_mounted_fread_fstyp=yes,
+fu_cv_sys_mounted_fread_fstyp=no)])
+AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
+if test $fu_cv_sys_mounted_fread_fstyp = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_FREAD_FSTYP)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+# 4.4BSD and DEC OSF/1.
+AC_MSG_CHECKING([for getmntinfo function])
+AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
+[
+ok=
+if test $ac_cv_func_getmntinfo = yes; then
+AC_EGREP_HEADER(f_type;, sys/mount.h,
+ok=yes)
+fi
+test -n "$ok" \
+&& fu_cv_sys_mounted_getmntinfo=yes \
+|| fu_cv_sys_mounted_getmntinfo=no
+])
+AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
+if test $fu_cv_sys_mounted_getmntinfo = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_GETMNTINFO)
+fi
+fi
+
+# FIXME: add a test for netbsd-1.1 here
+
+if test -z "$list_mounted_fs"; then
+# Ultrix
+AC_MSG_CHECKING([for getmnt function])
+AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
+[AC_TRY_CPP([
+#include <sys/fs_types.h>
+#include <sys/mount.h>],
+fu_cv_sys_mounted_getmnt=yes,
+fu_cv_sys_mounted_getmnt=no)])
+AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
+if test $fu_cv_sys_mounted_getmnt = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_GETMNT)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+# SVR2
+AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
+AC_CACHE_VAL(fu_cv_sys_mounted_fread,
+[AC_TRY_CPP([#include <mnttab.h>],
+fu_cv_sys_mounted_fread=yes,
+fu_cv_sys_mounted_fread=no)])
+AC_MSG_RESULT($fu_cv_sys_mounted_fread)
+if test $fu_cv_sys_mounted_fread = yes; then
+list_mounted_fs=found
+AC_DEFINE(MOUNTED_FREAD)
+fi
+fi
+
+if test -z "$list_mounted_fs"; then
+AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
+# FIXME -- no need to abort building the whole package
+# Can't build mountlist.c or anything that needs its functions
+fi
+
+AC_CHECKING(how to get filesystem space usage)
+space=no
+
+# Perform only the link test since it seems there are no variants of the
+# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
+# because that got a false positive on SCO OSR5. Adding the declaration
+# of a `struct statvfs' causes this test to fail (as it should) on such
+# systems. That system is reported to work fine with STAT_STATFS4 which
+# is what it gets when this test fails.
+if test $space = no; then
+# SVR4
+AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
+[AC_TRY_LINK([#include <sys/types.h>
+#include <sys/statvfs.h>],
+[struct statvfs fsd; statvfs (0, &fsd);],
+fu_cv_sys_stat_statvfs=yes,
+fu_cv_sys_stat_statvfs=no)])
+if test $fu_cv_sys_stat_statvfs = yes; then
+space=yes
+AC_DEFINE(STAT_STATVFS)
+fi
+fi
+
+if test $space = no; then
+# DEC Alpha running OSF/1
+AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
+AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
+[AC_TRY_RUN([
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+main ()
+{
+struct statfs fsd;
+fsd.f_fsize = 0;
+exit (statfs (".", &fsd, sizeof (struct statfs)));
+}],
+fu_cv_sys_stat_statfs3_osf1=yes,
+fu_cv_sys_stat_statfs3_osf1=no,
+fu_cv_sys_stat_statfs3_osf1=no)])
+AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
+if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
+space=yes
+AC_DEFINE(STAT_STATFS3_OSF1)
+fi
+fi
+
+if test $space = no; then
+# AIX
+AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
+member (AIX, 4.3BSD)])
+AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
+[AC_TRY_RUN([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+main ()
+{
+struct statfs fsd;
+fsd.f_bsize = 0;
+exit (statfs (".", &fsd));
+}],
+fu_cv_sys_stat_statfs2_bsize=yes,
+fu_cv_sys_stat_statfs2_bsize=no,
+fu_cv_sys_stat_statfs2_bsize=no)])
+AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
+if test $fu_cv_sys_stat_statfs2_bsize = yes; then
+space=yes
+AC_DEFINE(STAT_STATFS2_BSIZE)
+fi
+fi
+
+if test $space = no; then
+# SVR3
+AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
+AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
+[AC_TRY_RUN([#include <sys/types.h>
+#include <sys/statfs.h>
+main ()
+{
+struct statfs fsd;
+exit (statfs (".", &fsd, sizeof fsd, 0));
+}],
+fu_cv_sys_stat_statfs4=yes,
+fu_cv_sys_stat_statfs4=no,
+fu_cv_sys_stat_statfs4=no)])
+AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
+if test $fu_cv_sys_stat_statfs4 = yes; then
+space=yes
+AC_DEFINE(STAT_STATFS4)
+fi
+fi
+
+if test $space = no; then
+# 4.4BSD and NetBSD
+AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
+member (4.4BSD and NetBSD)])
+AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
+[AC_TRY_RUN([#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+main ()
+{
+struct statfs fsd;
+fsd.f_fsize = 0;
+exit (statfs (".", &fsd));
+}],
+fu_cv_sys_stat_statfs2_fsize=yes,
+fu_cv_sys_stat_statfs2_fsize=no,
+fu_cv_sys_stat_statfs2_fsize=no)])
+AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
+if test $fu_cv_sys_stat_statfs2_fsize = yes; then
+space=yes
+AC_DEFINE(STAT_STATFS2_FSIZE)
+fi
+fi
+
+if test $space = no; then
+# Ultrix
+AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
+AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
+[AC_TRY_RUN([#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+main ()
+{
+struct fs_data fsd;
+/* Ultrix's statfs returns 1 for success,
+0 for not mounted, -1 for failure. */
+exit (statfs (".", &fsd) != 1);
+}],
+fu_cv_sys_stat_fs_data=yes,
+fu_cv_sys_stat_fs_data=no,
+fu_cv_sys_stat_fs_data=no)])
+AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
+if test $fu_cv_sys_stat_fs_data = yes; then
+space=yes
+AC_DEFINE(STAT_STATFS2_FS_DATA)
+fi
+fi
+
+if test $space = no; then
+# SVR2
+AC_TRY_CPP([#include <sys/filsys.h>],
+AC_DEFINE(STAT_READ_FILSYS) space=yes)
+fi
+
+if test -n "$list_mounted_fs" && test $space != no; then
+DF_PROG="df"
+# LIBOBJS="$LIBOBJS fsusage.o"
+# LIBOBJS="$LIBOBJS mountlist.o"
+fi
+
+# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
+# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
+# enable the work-around code in fsusage.c.
+AC_MSG_CHECKING([for statfs that truncates block counts])
+AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
+[AC_TRY_COMPILE([
+#if !defined(sun) && !defined(__sun)
+choke -- this is a workaround for a Sun-specific problem
+#endif
+#include <sys/types.h>
+#include <sys/vfs.h>],
+[struct statfs t; long c = *(t.f_spare);],
+fu_cv_sys_truncating_statfs=yes,
+fu_cv_sys_truncating_statfs=no,
+)])
+if test $fu_cv_sys_truncating_statfs = yes; then
+AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS)
+fi
+AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
+
+AC_CHECKING(for AFS)
+test -d /afs && AC_DEFINE(AFS)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-gettext.m4 b/parts/appwizard/common/gnome/macros/gnome-gettext.m4
new file mode 100644
index 00000000..1dac989c
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-gettext.m4
@@ -0,0 +1,336 @@
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# Modified to never use included libintl.
+# Owen Taylor <otaylor@redhat.com>, 12/15/1998
+#
+#
+# This file can be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 5
+
+AC_DEFUN(AM_GNOME_WITH_NLS,
+ [AC_MSG_CHECKING([whether NLS is requested])
+ dnl Default is enabled NLS
+ AC_ARG_ENABLE(nls,
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+ AC_MSG_RESULT($USE_NLS)
+ AC_SUBST(USE_NLS)
+
+ USE_INCLUDED_LIBINTL=no
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ AC_DEFINE(ENABLE_NLS)
+# AC_MSG_CHECKING([whether included gettext is requested])
+# AC_ARG_WITH(included-gettext,
+# [ --with-included-gettext use the GNU gettext library included here],
+# nls_cv_force_use_gnu_gettext=$withval,
+# nls_cv_force_use_gnu_gettext=no)
+# AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+ nls_cv_force_use_gnu_gettext="no"
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ dnl User does not insist on using GNU NLS library. Figure out what
+ dnl to use. If gettext or catgets are available (in this order) we
+ dnl use this. Else we have to fall back to GNU NLS library.
+ dnl catgets is only used if permitted by option --with-catgets.
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ AC_CHECK_HEADER(libintl.h,
+ [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
+ gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ AC_CHECK_LIB(intl, bindtextdomain,
+ [AC_CACHE_CHECK([for gettext in libintl],
+ gt_cv_func_gettext_libintl,
+ [AC_CHECK_LIB(intl, gettext,
+ gt_cv_func_gettext_libintl=yes,
+ gt_cv_func_gettext_libintl=no)],
+ gt_cv_func_gettext_libintl=no)])
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ AC_DEFINE(HAVE_GETTEXT)
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+ if test "$MSGFMT" != "no"; then
+ AC_CHECK_FUNCS(dcgettext)
+ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+ AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr],
+ [CATOBJEXT=.gmo
+ DATADIRNAME=share],
+ [CATOBJEXT=.mo
+ DATADIRNAME=lib])
+ INSTOBJEXT=.mo
+ fi
+ fi
+
+ # Added by Martin Baulig 12/15/98 for libc5 systems
+ if test "$gt_cv_func_gettext_libc" != "yes" \
+ && test "$gt_cv_func_gettext_libintl" = "yes"; then
+ INTLLIBS=-lintl
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ fi
+ ])
+
+ if test "$CATOBJEXT" = "NONE"; then
+ AC_MSG_CHECKING([whether catgets can be used])
+ AC_ARG_WITH(catgets,
+ [ --with-catgets use catgets functions if available],
+ nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
+ AC_MSG_RESULT($nls_cv_use_catgets)
+
+ if test "$nls_cv_use_catgets" = "yes"; then
+ dnl No gettext in C library. Try catgets next.
+ AC_CHECK_LIB(i, main)
+ AC_CHECK_FUNC(catgets,
+ [AC_DEFINE(HAVE_CATGETS)
+ INTLOBJS="\$(CATOBJS)"
+ AC_PATH_PROG(GENCAT, gencat, no)dnl
+# if test "$GENCAT" != "no"; then
+# AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
+# if test "$GMSGFMT" = "no"; then
+# AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
+# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
+# fi
+# AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+# USE_INCLUDED_LIBINTL=yes
+# CATOBJEXT=.cat
+# INSTOBJEXT=.cat
+# DATADIRNAME=lib
+# INTLDEPS='$(top_builddir)/intl/libintl.a'
+# INTLLIBS=$INTLDEPS
+# LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+# nls_cv_header_intl=intl/libintl.h
+# nls_cv_header_libgt=intl/libgettext.h
+# fi
+ ])
+ fi
+ fi
+
+ if test "$CATOBJEXT" = "NONE"; then
+ dnl Neither gettext nor catgets in included in the C library.
+ dnl Fall back on GNU gettext library.
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" != "yes"; then
+ AC_DEFINE(ENABLE_NLS)
+ else
+ # Unset this variable since we use the non-zero value as a flag.
+ CATOBJEXT=
+# dnl Mark actions used to generate GNU NLS library.
+# INTLOBJS="\$(GETTOBJS)"
+# AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
+# AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+# AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+# [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+# AC_SUBST(MSGFMT)
+# USE_INCLUDED_LIBINTL=yes
+# CATOBJEXT=.gmo
+# INSTOBJEXT=.mo
+# DATADIRNAME=share
+# INTLDEPS='$(top_builddir)/intl/libintl.a'
+# INTLLIBS=$INTLDEPS
+# LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+# nls_cv_header_intl=intl/libintl.h
+# nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+ dnl Test whether we really found GNU xgettext.
+ if test "$XGETTEXT" != ":"; then
+ dnl If it is no GNU xgettext we define it as : so that the
+ dnl Makefiles still can work.
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT(
+ [found xgettext program is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+ AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
+ AC_OUTPUT_COMMANDS(
+ [case "$CONFIG_FILES" in *po/Makefile.in*)
+ sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+ esac])
+
+
+# # If this is used in GNU gettext we have to set USE_NLS to `yes'
+# # because some of the sources are only built for this goal.
+# if test "$PACKAGE" = gettext; then
+# USE_NLS=yes
+# USE_INCLUDED_LIBINTL=yes
+# fi
+
+ dnl These rules are solely for the distribution goal. While doing this
+ dnl we only have to keep exactly one list of the available catalogs
+ dnl in configure.in.
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(USE_INCLUDED_LIBINTL)
+ AC_SUBST(CATALOGS)
+ AC_SUBST(CATOBJEXT)
+ AC_SUBST(DATADIRNAME)
+ AC_SUBST(GMOFILES)
+ AC_SUBST(INSTOBJEXT)
+ AC_SUBST(INTLDEPS)
+ AC_SUBST(INTLLIBS)
+ AC_SUBST(INTLOBJS)
+ AC_SUBST(POFILES)
+ AC_SUBST(POSUB)
+ ])
+
+AC_DEFUN(AM_GNOME_GETTEXT,
+ [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([AC_ISC_POSIX])dnl
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_REQUIRE([AC_C_CONST])dnl
+ AC_REQUIRE([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+
+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h])
+ AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next])
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ AC_CHECK_FUNCS(stpcpy)
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ AC_DEFINE(HAVE_STPCPY)
+ fi
+
+ AM_LC_MESSAGES
+ AM_GNOME_WITH_NLS
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ AC_MSG_CHECKING(for catalogs to be installed)
+ NEW_LINGUAS=
+ if test "x$LINGUAS" = "x"; then
+ LINGUAS=$ALL_LINGUAS
+ fi
+ for lang in $LINGUAS; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT($LINGUAS)
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ dnl The reference to <locale.h> in the installed <libintl.h> file
+ dnl must be resolved because we cannot expect the users of this
+ dnl to define HAVE_LOCALE_H.
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+ AC_SUBST(INCLUDE_LOCALE_H)
+
+ dnl Determine which catalog format we have (if any is needed)
+ dnl For now we know about two different formats:
+ dnl Linux libc-5 and the normal X/Open format
+ test -d intl || mkdir intl
+ if test "$CATOBJEXT" = ".cat"; then
+ AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
+
+ dnl Transform the SED scripts while copying because some dumb SEDs
+ dnl cannot handle comments.
+ sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
+ fi
+ dnl po2tbl.sed is always needed.
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
+
+ dnl In the intl/Makefile.in we have a special dependency which makes
+ dnl only sense for gettext. We comment this out for non-gettext
+ dnl packages.
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+ AC_SUBST(GT_NO)
+ AC_SUBST(GT_YES)
+
+ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+ dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+ dnl Try to locate is.
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+ AC_SUBST(MKINSTALLDIRS)
+
+ dnl *** For now the libtool support in intl/Makefile is not for real.
+ l=
+ AC_SUBST(l)
+
+ dnl Generate list of files to be processed by xgettext which will
+ dnl be included in po/Makefile.
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ ])
+
diff --git a/parts/appwizard/common/gnome/macros/gnome-ghttp-check.m4 b/parts/appwizard/common/gnome/macros/gnome-ghttp-check.m4
new file mode 100644
index 00000000..1fc85783
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-ghttp-check.m4
@@ -0,0 +1,14 @@
+AC_DEFUN([GNOME_GHTTP_CHECK],[
+ AC_REQUIRE([GNOME_INIT_HOOK])
+ GHTTP_LIB=
+ AC_CHECK_FUNC(connect,,[
+ AC_CHECK_LIB(socket,connect,
+ GHTTP_LIB="-lsocket $GHTTP_LIB",,$GHTTP_LIB)])
+ AC_CHECK_FUNC(gethostbyname,,[
+ AC_CHECK_LIB(nsl,gethostbyname,
+ GHTTP_LIB="-lnsl $GHTTP_LIB",,$GHTTP_LIB)])
+ AC_CHECK_LIB(ghttp, ghttp_request_new,
+ GHTTP_LIB="-lghttp $GHTTP_LIB",,-L$gnome_prefix $GHTTP_LIB)
+ AC_SUBST(GHTTP_LIB)
+ AC_PROVIDE([GNOME_GHTTP_CHECK])
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-gnorba-check.m4 b/parts/appwizard/common/gnome/macros/gnome-gnorba-check.m4
new file mode 100644
index 00000000..dbac0a6c
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-gnorba-check.m4
@@ -0,0 +1,35 @@
+dnl
+dnl GNOME_GNORBA_HOOK (script-if-gnorba-found, failflag)
+dnl
+dnl if failflag is "failure" it aborts if gnorba is not found.
+dnl
+
+AC_DEFUN([GNOME_GNORBA_HOOK],[
+ GNOME_ORBIT_HOOK([],$2)
+ AC_CACHE_CHECK([for gnorba libraries],gnome_cv_gnorba_found,[
+ gnome_cv_gnorba_found=no
+ if test x$gnome_cv_orbit_found = xyes; then
+ GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
+ GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
+ if test -n "$GNORBA_LIBS"; then
+ gnome_cv_gnorba_found=yes
+ fi
+ fi
+ ])
+ AM_CONDITIONAL(HAVE_GNORBA, test x$gnome_cv_gnorba_found = xyes)
+ if test x$gnome_cv_orbit_found = xyes; then
+ $1
+ GNORBA_CFLAGS="`gnome-config --cflags gnorba gnomeui`"
+ GNORBA_LIBS="`gnome-config --libs gnorba gnomeui`"
+ AC_SUBST(GNORBA_CFLAGS)
+ AC_SUBST(GNORBA_LIBS)
+ else
+ if test x$2 = xfailure; then
+ AC_MSG_ERROR(gnorba library not installed or installation problem)
+ fi
+ fi
+])
+
+AC_DEFUN([GNOME_GNORBA_CHECK], [
+ GNOME_GNORBA_HOOK([],failure)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-guile-checks.m4 b/parts/appwizard/common/gnome/macros/gnome-guile-checks.m4
new file mode 100644
index 00000000..1086d30a
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-guile-checks.m4
@@ -0,0 +1,119 @@
+dnl
+dnl GNOME_CHECK_GUILE (failflag)
+dnl
+dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
+dnl
+
+AC_DEFUN([GNOME_CHECK_GUILE],
+[
+ saved_ldflags="$LDFLAGS"
+ saved_cppflags="$CPPFLAGS"
+ LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
+
+ AC_CHECK_LIB(qthreads,qt_null,[
+ QTTHREADS_LIB="-lqthreads"
+ ],[
+ AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
+ ],$LIBS)
+ AC_SUBST(QTTHREADS_LIB)
+
+ AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
+ AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
+
+ AC_SUBST(TERMCAP_LIB)
+ AC_SUBST(READLINE_LIB)
+
+ if test "x$cross_compiling" = "xyes" ; then
+ name_build_guile="$target_alias-guile-config"
+ else
+ name_build_guile="guile-config"
+ fi
+
+ AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
+
+ if test "x$BUILD_GUILE" = "xyes"; then
+ AC_MSG_CHECKING(whether $name_build_guile works)
+ if test x`$name_build_guile --version >/dev/null 2>&1 || \
+ echo no` = xno; then
+ BUILD_GUILE=no
+ fi
+ AC_MSG_RESULT($BUILD_GUILE)
+ else
+
+ if test "x$cross_compiling" = "xyes" ; then
+ name_build_guile="$target_alias-build-guile"
+ else
+ name_build_guile="build-guile"
+ fi
+
+ AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
+
+ if test "x$BUILD_GUILE" = "xyes"; then
+ AC_MSG_CHECKING(whether $name_build_guile works)
+ if test x`$name_build_guile --version >/dev/null 2>&1 || \
+ echo no` = xno; then
+ BUILD_GUILE=no
+ fi
+ AC_MSG_RESULT($BUILD_GUILE)
+ fi
+ fi
+
+ AC_CHECK_LIB(m, sin)
+
+ if test "x$BUILD_GUILE" = "xyes"; then
+ AC_MSG_CHECKING(for guile libraries)
+ GUILE_LIBS="`$name_build_guile link`"
+ AC_MSG_RESULT($GUILE_LIBS)
+ AC_MSG_CHECKING(for guile headers)
+ GUILE_INCS="`$name_build_guile compile`"
+ AC_MSG_RESULT($GUILE_INCS)
+ else
+ GUILE_LIBS="$GNOME_LIBDIR"
+ GUILE_INCS="$GNOME_INCLUDEDIR"
+ AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
+ AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS")
+ AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
+ AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl")
+ AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket")
+ GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB"
+ fi
+
+ AC_SUBST(GUILE_LIBS)
+ AC_SUBST(GUILE_INCS)
+
+ saved_LIBS="$LIBS"
+ LIBS="$LIBS $GUILE_LIBS"
+ CPPFLAGS="$saved_cppflags $GUILE_INCS"
+
+ AC_MSG_CHECKING(whether guile works)
+ AC_TRY_LINK([
+ #include <libguile.h>
+ #include <guile/gh.h>
+ ],[
+ gh_eval_str("(newline)");
+ scm_boot_guile(0,NULL,NULL,NULL);
+ ],[
+ ac_cv_guile_found=yes
+ AC_DEFINE(HAVE_GUILE)
+ ],[
+ ac_cv_guile_found=no
+ ])
+ AC_MSG_RESULT($ac_cv_guile_found)
+
+ if test x$ac_cv_guile_found = xno ; then
+ if test x$1 = xfail ; then
+ AC_MSG_ERROR(Can not find Guile on this system)
+ else
+ AC_MSG_WARN(Can not find Guile on this system)
+ fi
+ ac_cv_guile_found=no
+ GUILE_LIBS= GUILE_INCS=
+ fi
+
+ LIBS="$saved_LIBS"
+ LDFLAGS="$saved_ldflags"
+ CPPFLAGS="$saved_cppflags"
+
+ AC_SUBST(GUILE_LIBS)
+ AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-libgtop-check.m4 b/parts/appwizard/common/gnome/macros/gnome-libgtop-check.m4
new file mode 100644
index 00000000..81fbb601
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-libgtop-check.m4
@@ -0,0 +1,182 @@
+dnl
+dnl GNOME_LIBGTOP_TYPES
+dnl
+dnl some typechecks for libgtop.
+dnl
+
+AC_DEFUN([GNOME_LIBGTOP_TYPES],
+[
+ AC_CHECK_TYPE(u_int64_t, unsigned long long int)
+ AC_CHECK_TYPE(int64_t, long long int)
+])
+
+dnl
+dnl GNOME_LIBGTOP_HOOK (minversion, script-if-libgtop-enabled, failflag)
+dnl
+dnl if failflag is "fail" then GNOME_LIBGTOP_HOOK will abort if LibGTop
+dnl is not found.
+dnl
+
+AC_DEFUN([GNOME_LIBGTOP_HOOK],
+[
+ AC_REQUIRE([GNOME_LIBGTOP_TYPES])
+
+ AC_SUBST(LIBGTOP_LIBDIR)
+ AC_SUBST(LIBGTOP_INCLUDEDIR)
+ AC_SUBST(LIBGTOP_EXTRA_LIBS)
+ AC_SUBST(LIBGTOP_LIBS)
+ AC_SUBST(LIBGTOP_INCS)
+ AC_SUBST(LIBGTOP_NAMES_LIBS)
+ AC_SUBST(LIBGTOP_NAMES_INCS)
+ AC_SUBST(LIBGTOP_GUILE_INCS)
+ AC_SUBST(LIBGTOP_GUILE_LIBS)
+ AC_SUBST(LIBGTOP_GUILE_NAMES_INCS)
+ AC_SUBST(LIBGTOP_GUILE_NAMES_LIBS)
+ AC_SUBST(LIBGTOP_MAJOR_VERSION)
+ AC_SUBST(LIBGTOP_MINOR_VERSION)
+ AC_SUBST(LIBGTOP_MICRO_VERSION)
+ AC_SUBST(LIBGTOP_VERSION)
+ AC_SUBST(LIBGTOP_VERSION_CODE)
+ AC_SUBST(LIBGTOP_SERVER_VERSION)
+ AC_SUBST(LIBGTOP_INTERFACE_AGE)
+ AC_SUBST(LIBGTOP_BINARY_AGE)
+ AC_SUBST(LIBGTOP_BINDIR)
+ AC_SUBST(LIBGTOP_SERVER)
+
+ dnl Get the cflags and libraries from the libgtop-config script
+ dnl
+ AC_ARG_WITH(libgtop,
+ [ --with-libgtop=PFX Prefix where LIBGTOP is installed (optional)],
+ libgtop_config_prefix="$withval", libgtop_config_prefix="")
+ AC_ARG_WITH(libgtop-exec,
+ [ --with-libgtop-exec=PFX Exec prefix where LIBGTOP is installed (optional)],
+ libgtop_config_exec_prefix="$withval", libgtop_config_exec_prefix="")
+
+ if test x$libgtop_config_exec_prefix != x ; then
+ libgtop_config_args="$libgtop_config_args --exec-prefix=$libgtop_config_exec_prefix"
+ if test x${LIBGTOP_CONFIG+set} != xset ; then
+ LIBGTOP_CONFIG=$libgtop_config_exec_prefix/bin/libgtop-config
+ fi
+ fi
+ if test x$libgtop_config_prefix != x ; then
+ libgtop_config_args="$libgtop_config_args --prefix=$libgtop_config_prefix"
+ if test x${LIBGTOP_CONFIG+set} != xset ; then
+ LIBGTOP_CONFIG=$libgtop_config_prefix/bin/libgtop-config
+ fi
+ fi
+
+ AC_PATH_PROG(LIBGTOP_CONFIG, libgtop-config, no)
+ dnl IMPORTANT NOTICE:
+ dnl If you increase this number here, this means that *ALL*
+ dnl modules will require the new version, even if they explicitly
+ dnl give a lower number in their `configure.in' !!!
+ real_min_libgtop_version=1.0.0
+ min_libgtop_version=ifelse([$1], ,$real_min_libgtop_version,$1)
+ dnl I know, the following code looks really ugly, but if you want
+ dnl to make changes, please test it with a brain-dead /bin/sh and
+ dnl with a brain-dead /bin/test (not all shells/tests support the
+ dnl `<' operator to compare strings, that's why I convert everything
+ dnl into numbers and test them).
+ min_libgtop_major=`echo $min_libgtop_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ min_libgtop_minor=`echo $min_libgtop_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ min_libgtop_micro=`echo $min_libgtop_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ test x$min_libgtop_micro = x && min_libgtop_micro=0
+ real_min_libgtop_major=`echo $real_min_libgtop_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ real_min_libgtop_minor=`echo $real_min_libgtop_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ real_min_libgtop_micro=`echo $real_min_libgtop_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ test x$real_min_libgtop_micro = x && real_min_libgtop_micro=0
+ dnl You cannot require a version less then $real_min_libgtop_version,
+ dnl so you don't need to update each `configure.in' when it's increased.
+ if test $real_min_libgtop_major -gt $min_libgtop_major ; then
+ min_libgtop_major=$real_min_libgtop_major
+ min_libgtop_minor=$real_min_libgtop_minor
+ min_libgtop_micro=$real_min_libgtop_micro
+ elif test $real_min_libgtop_major = $min_libgtop_major ; then
+ if test $real_min_libgtop_minor -gt $min_libgtop_minor ; then
+ min_libgtop_minor=$real_min_libgtop_minor
+ min_libgtop_micro=$real_min_libgtop_micro
+ elif test $real_min_libgtop_minor = $min_libgtop_minor ; then
+ if test $real_min_libgtop_micro -gt $min_libgtop_micro ; then
+ min_libgtop_micro=$real_min_libgtop_micro
+ fi
+ fi
+ fi
+ min_libgtop_version="$min_libgtop_major.$min_libgtop_minor.$min_libgtop_micro"
+ AC_MSG_CHECKING(for libgtop - version >= $min_libgtop_version)
+ no_libgtop=""
+ if test "$LIBGTOP_CONFIG" = "no" ; then
+ no_libgtop=yes
+ else
+ configfile=`$LIBGTOP_CONFIG --config`
+ libgtop_major_version=`$LIBGTOP_CONFIG --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ libgtop_minor_version=`$LIBGTOP_CONFIG --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ libgtop_micro_version=`$LIBGTOP_CONFIG --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ test $libgtop_major_version != $min_libgtop_major && no_libgtop=yes
+ test $libgtop_minor_version -lt $min_libgtop_minor && no_libgtop=yes
+ if test $libgtop_minor_version = $min_libgtop_minor ; then
+ test $libgtop_micro_version -lt $min_libgtop_micro && no_libgtop=yes
+ fi
+ . $configfile
+ fi
+ if test x$no_libgtop = x ; then
+ AC_DEFINE(HAVE_LIBGTOP)
+ AC_DEFINE_UNQUOTED(LIBGTOP_VERSION, "$LIBGTOP_VERSION")
+ AC_DEFINE_UNQUOTED(LIBGTOP_VERSION_CODE, $LIBGTOP_VERSION_CODE)
+ AC_DEFINE_UNQUOTED(LIBGTOP_MAJOR_VERSION, $LIBGTOP_MAJOR_VERSION)
+ AC_DEFINE_UNQUOTED(LIBGTOP_MINOR_VERSION, $LIBGTOP_MINOR_VERSION)
+ AC_DEFINE_UNQUOTED(LIBGTOP_MICRO_VERSION, $LIBGTOP_MICRO_VERSION)
+ AC_DEFINE_UNQUOTED(LIBGTOP_SERVER_VERSION, $LIBGTOP_SERVER_VERSION)
+ AC_MSG_RESULT(yes)
+ dnl Note that an empty true branch is not valid sh syntax.
+ ifelse([$2], [], :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "x$3" = "xfail"; then
+ AC_MSG_ERROR(LibGTop >= $min_libgtop_version not found)
+ else
+ AC_MSG_WARN(LibGTop >= $min_libgtop_version not found)
+ fi
+ fi
+
+ AM_CONDITIONAL(HAVE_LIBGTOP, test x$no_libgtop != xyes)
+])
+
+AC_DEFUN([GNOME_INIT_LIBGTOP],[
+ GNOME_LIBGTOP_HOOK($1,[ifelse([$3], [], :, [$3])],$2)
+])
+
+dnl
+dnl GNOME_LIBGTOP_DOCU
+dnl
+dnl checks whether the documentation of LibGTop is installed
+dnl
+
+AC_DEFUN([GNOME_LIBGTOP_DOCU],
+[
+ AC_REQUIRE([GNOME_LIBGTOP_HOOK])
+
+ helpdir="$LIBGTOP_DATADIR/gnome/help/libgtop"
+
+ AC_MSG_CHECKING(whether you have the LibGTop Documentation)
+
+ if test -f "$helpdir/C/topic.dat" ; then
+ have_libgtop_docu=yes
+ AC_DEFINE(HAVE_LIBGTOP_DOCU)
+ else
+ have_libgtop_docu=no
+ fi
+
+ AC_MSG_RESULT($have_libgtop_docu)
+
+ AM_CONDITIONAL(HAVE_LIBGTOP_DOCU, test x$have_libgtop_docu = xyes)
+])
+
diff --git a/parts/appwizard/common/gnome/macros/gnome-objc-checks.m4 b/parts/appwizard/common/gnome/macros/gnome-objc-checks.m4
new file mode 100644
index 00000000..dc9691cf
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-objc-checks.m4
@@ -0,0 +1,79 @@
+AC_DEFUN([GNOME_CHECK_OBJC],
+[
+dnl Look for an ObjC compiler.
+dnl FIXME: extend list of possible names of ObjC compilers.
+ AC_CHECK_PROGS(OBJC, $OBJC egcs, "")
+ if test "x$OBJC" = "x" ; then
+ AC_CHECK_PROGS(OBJC, $OBJC egcc, "")
+ if test "x$OBJC" = "x" ; then
+ AC_CHECK_PROGS(OBJC, $OBJC gcc, "")
+ fi
+ fi
+
+ AC_REQUIRE([GNOME_PTHREAD_CHECK])
+
+ OBJC_LIBS="-lobjc $PTHREAD_LIB"
+ AC_CHECK_FUNC(sched_yield,,[
+ AC_CHECK_LIB(posix4,sched_yield,
+ OBJC_LIBS="$OBJC_LIBS -lposix4",, $OBJC_LIBS)])
+ AC_SUBST(OBJC_LIBS)
+
+ AC_CACHE_CHECK([if Objective C compiler ($OBJC) works],
+ ac_cv_prog_objc_works, [
+ if test -n "$OBJC"; then
+ cat > conftest.m <<EOF
+#include <objc/Object.h>
+@interface myRandomObj : Object
+{
+}
+@end
+@implementation myRandomObj
+@end
+int main () {
+ /* No, you are not seeing double. Remember that square brackets
+ are the autoconf m4 quotes. */
+ id myid = [[myRandomObj alloc]];
+ [[myid free]];
+ return 0;
+}
+EOF
+
+ $OBJC $CFLAGS -o conftest $LDFLAGS conftest.m $OBJC_LIBS 1>&AC_FD_CC 2>&1
+ result=$?
+ rm -f conftest*
+
+ if test $result -eq 0; then
+ ac_cv_prog_objc_works=yes
+ fi
+ else
+ ac_cv_prog_objc_works=no
+ fi
+ ])
+
+ AM_CONDITIONAL(OBJECTIVE_C, test x$ac_cv_prog_objc_works = xyes)
+ dnl Also set the shell variable OBJECTIVE_C to "yes" or "no".
+ OBJECTIVE_C=$ac_cv_prog_objc_works
+])
+
+AC_DEFUN([GNOME_INIT_OBJC],
+[
+ AC_MSG_CHECKING(for an obGnomeConf.sh)
+ my_gnome_libdir=`$GNOME_CONFIG --libdir`
+ if test -f $my_gnome_libdir/obGnomeConf.sh; then
+ . $my_gnome_libdir/obGnomeConf.sh
+ AC_MSG_RESULT(found $my_gnome_libdir)
+ ac_cv_have_gnome_objc=yes
+ else
+ AC_MSG_RESULT(not found)
+ AC_MSG_WARN(Could not find the obGnomeConf.sh file that is generated by gnome-objc install)
+ ac_cv_have_gnome_objc=no
+ fi
+
+ dnl Add a conditional on whether or not we have gnome-objc
+ AM_CONDITIONAL(HAVE_GNOME_OBJC, test x$ac_cv_have_gnome_objc = xyes)
+ HAVE_GNOME_OBJC=$ac_cv_have_gnome_objc
+
+ AC_SUBST(OBGNOME_INCLUDEDIR)
+ AC_SUBST(OBGNOME_LIBS)
+ AC_SUBST(OBGTK_LIBS)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-orbit-check.m4 b/parts/appwizard/common/gnome/macros/gnome-orbit-check.m4
new file mode 100644
index 00000000..54bf33aa
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-orbit-check.m4
@@ -0,0 +1,33 @@
+dnl
+dnl GNOME_ORBIT_HOOK (script-if-orbit-found, failflag)
+dnl
+dnl if failflag is "failure" it aborts if orbit is not found.
+dnl
+
+AC_DEFUN([GNOME_ORBIT_HOOK],[
+ AC_PATH_PROG(ORBIT_CONFIG,orbit-config,no)
+ AC_PATH_PROG(ORBIT_IDL,orbit-idl,no)
+ AC_CACHE_CHECK([for working ORBit environment],gnome_cv_orbit_found,[
+ if test x$ORBIT_CONFIG = xno -o x$ORBIT_IDL = xno; then
+ gnome_cv_orbit_found=no
+ else
+ gnome_cv_orbit_found=yes
+ fi
+ ])
+ AM_CONDITIONAL(HAVE_ORBIT, test x$gnome_cv_orbit_found = xyes)
+ if test x$gnome_cv_orbit_found = xyes; then
+ $1
+ ORBIT_CFLAGS=`orbit-config --cflags client server`
+ ORBIT_LIBS=`orbit-config --use-service=name --libs client server`
+ AC_SUBST(ORBIT_CFLAGS)
+ AC_SUBST(ORBIT_LIBS)
+ else
+ if test x$2 = xfailure; then
+ AC_MSG_ERROR(ORBit not installed or installation problem)
+ fi
+ fi
+])
+
+AC_DEFUN([GNOME_ORBIT_CHECK], [
+ GNOME_ORBIT_HOOK([],failure)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-print-check.m4 b/parts/appwizard/common/gnome/macros/gnome-print-check.m4
new file mode 100644
index 00000000..7d98281d
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-print-check.m4
@@ -0,0 +1,171 @@
+# Configure paths for GNOME-PRINT
+# Chris Lahey 99-2-5
+# stolen from Manish Singh again
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_GNOME_PRINT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for GNOME-PRINT, and define GNOME_PRINT_CFLAGS and GNOME_PRINT_LIBS
+dnl
+AC_DEFUN(AM_PATH_GNOME_PRINT,
+[dnl
+dnl Get the cflags and libraries from the gnome-config script
+dnl
+AC_ARG_WITH(gnome-print-prefix,[ --with-gnome-print-prefix=PFX Prefix where GNOME-PRINT is installed (optional)],
+ gnome_print_prefix="$withval", gnome_print_prefix="")
+AC_ARG_WITH(gnome-print-exec-prefix,[ --with-gnome-print-exec-prefix=PFX Exec prefix where GNOME-PRINT is installed (optional)],
+ gnome_print_exec_prefix="$withval", gnome_print_exec_prefix="")
+AC_ARG_ENABLE(gnome-printtest, [ --disable-gnome-printtest Do not try to compile and run a test GNOME-PRINT program],
+ , enable_gnome_printtest=yes)
+
+ if test x$gnome_print_exec_prefix != x ; then
+ gnome_print_args="$gnome_print_args --exec-prefix=$gnome_print_exec_prefix"
+ if test x${GNOME_CONFIG+set} != xset ; then
+ GNOME_CONFIG=$gnome_print_exec_prefix/bin/gnome-config
+ fi
+ fi
+ if test x$gnome_print_prefix != x ; then
+ gnome_print_args="$gnome_print_args --prefix=$gnome_print_prefix"
+ if test x${GNOME_CONFIG+set} != xset ; then
+ GNOME_CONFIG=$gnome_print_prefix/bin/gnome-config
+ fi
+ fi
+
+ AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
+ min_gnome_print_version=ifelse([$1], ,0.1.0,$1)
+ AC_MSG_CHECKING(for GNOME-PRINT - version >= $min_gnome_print_version)
+ no_gnome_print=""
+ if test "$GNOME_CONFIG" = "no" ; then
+ no_gnome_print=yes
+ else
+ GNOME_PRINT_CFLAGS=`$GNOME_CONFIG $gnome_printconf_args --cflags print`
+ GNOME_PRINT_LIBS=`$GNOME_CONFIG $gnome_printconf_args --libs print`
+
+ gnome_print_major_version=`$GNOME_CONFIG $gnome_print_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ gnome_print_minor_version=`$GNOME_CONFIG $gnome_print_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ gnome_print_micro_version=`$GNOME_CONFIG $gnome_print_config_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_gnome_printtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
+ LIBS="$LIBS $GNOME_PRINT_LIBS"
+dnl
+dnl Now check if the installed GNOME-PRINT is sufficiently new. (Also sanity
+dnl checks the results of gnome-config to some extent
+dnl
+ rm -f conf.gnome_printtest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libgnomeprint/gnome-print.h>
+
+static char*
+my_strdup (char *str)
+{
+ char *new_str;
+
+ if (str)
+ {
+ new_str = malloc ((strlen (str) + 1) * sizeof(char));
+ strcpy (new_str, str);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+int main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.gnome_printtest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = my_strdup("$min_gnome_print_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+ printf("%s, bad version string\n", "$min_gnome_print_version");
+ exit(1);
+ }
+ return 0;
+#if 0
+ if (($gnome_print_major_version > major) ||
+ (($gnome_print_major_version == major) && ($gnome_print_minor_version > minor)) ||
+ (($gnome_print_major_version == major) && ($gnome_print_minor_version == minor) && ($gnome_print_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'gnome-config print --version' returned %d.%d.%d, but the minimum version\n", $gnome_print_major_version, $gnome_print_minor_version, $gnome_print_micro_version);
+ printf("*** of GNOME-PRINT required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n");
+ printf("*** to point to the correct copy of gnome-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+#endif
+}
+
+],, no_gnome_print=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_gnome_print" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$GNOME_CONFIG" = "no" ; then
+ echo "*** The gnome-config script installed by GNOME-LIBS could not be found"
+ echo "*** If GNOME-PRINT was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the GNOME_CONFIG environment variable to the"
+ echo "*** full path to gnome-config."
+ else
+ if test -f conf.gnome_printtest ; then
+ :
+ else
+ echo "*** Could not run GNOME-PRINT test program, checking why..."
+ CFLAGS="$CFLAGS $GNOME_PRINT_CFLAGS"
+ LIBS="$LIBS $GNOME_PRINT_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <libgnomeprint/gnome-print.h>
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GNOME-PRINT or finding the wrong"
+ echo "*** version of GNOME-PRINT. If it is not finding GNOME-PRINT, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GNOME-PRINT was incorrectly installed"
+ echo "*** or that you have moved GNOME-PRINT since it was installed. In the latter case, you"
+ echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GNOME_PRINT_CFLAGS=""
+ GNOME_PRINT_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GNOME_PRINT_CFLAGS)
+ AC_SUBST(GNOME_PRINT_LIBS)
+ rm -f conf.gnome_printtest
+])
+
+AC_DEFUN([GNOME_PRINT_CHECK], [
+ AM_PATH_GNOME_PRINT(0.1.0,,[AC_MSG_ERROR(GNOME-PRINT not found)])
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-pthread-check.m4 b/parts/appwizard/common/gnome/macros/gnome-pthread-check.m4
new file mode 100644
index 00000000..a4eb3b48
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-pthread-check.m4
@@ -0,0 +1,16 @@
+dnl
+dnl And better, use gthreads instead...
+dnl
+
+AC_DEFUN([GNOME_PTHREAD_CHECK],[
+ PTHREAD_LIB=""
+ AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIB="-lpthread",
+ [AC_CHECK_LIB(pthreads, pthread_create, PTHREAD_LIB="-lpthreads",
+ [AC_CHECK_LIB(c_r, pthread_create, PTHREAD_LIB="-lc_r",
+ [AC_CHECK_FUNC(pthread_create)]
+ )]
+ )]
+ )
+ AC_SUBST(PTHREAD_LIB)
+ AC_PROVIDE([GNOME_PTHREAD_CHECK])
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-support.m4 b/parts/appwizard/common/gnome/macros/gnome-support.m4
new file mode 100644
index 00000000..2c1d0498
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-support.m4
@@ -0,0 +1,68 @@
+dnl GNOME_SUPPORT_CHECKS
+dnl Check for various support functions needed by the standard
+dnl Gnome libraries. Sets LIBOBJS, might define some macros.
+dnl This should only be used when building the Gnome libs;
+dnl Gnome clients should not need this macro.
+AC_DEFUN([GNOME_SUPPORT_CHECKS],[
+ # we need an `awk' to build `gnomesupport.h'
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # this should go away soon
+ need_gnome_support=yes
+
+ save_LIBOBJS="$LIBOBJS"
+ LIBOBJS=
+
+ AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
+
+ # for `scandir'
+ AC_HEADER_DIRENT
+
+ # copied from `configure.in' of `libiberty'
+ vars="program_invocation_short_name program_invocation_name sys_errlist"
+ for v in $vars; do
+ AC_MSG_CHECKING([for $v])
+ AC_CACHE_VAL(gnome_cv_var_$v,
+ [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
+ [eval "gnome_cv_var_$v=yes"],
+ [eval "gnome_cv_var_$v=no"])])
+ if eval "test \"`echo '$gnome_cv_var_'$v`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($n)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ done
+
+ AC_REPLACE_FUNCS(memmove mkstemp scandir strcasecmp strerror strndup strnlen)
+ AC_REPLACE_FUNCS(strtok_r strtod strtol strtoul vasprintf vsnprintf)
+
+ AC_CHECK_FUNCS(realpath,,LIBOBJS="$LIBOBJS canonicalize.o")
+
+ # to include `error.c' error.c has some HAVE_* checks
+ AC_CHECK_FUNCS(vprintf doprnt strerror_r)
+ AM_FUNC_ERROR_AT_LINE
+
+ # This is required if we declare setreuid () and setregid ().
+ AC_TYPE_UID_T
+
+ # see if we need to declare some functions. Solaris is notorious for
+ # putting functions into the `libc' but not listing them in the headers
+ AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h dirent.h)
+ GCC_NEED_DECLARATIONS(gethostname setreuid setregid getpagesize)
+ GCC_NEED_DECLARATION(scandir,[
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+])
+
+ # Turn our LIBOBJS into libtool objects. This is gross, but it
+ # requires changes to autoconf before it goes away.
+ LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/.lo/g'`
+ AC_SUBST(need_gnome_support)
+ AC_SUBST(LTLIBOBJS)
+
+ LIBOBJS="$save_LIBOBJS"
+ AM_CONDITIONAL(BUILD_GNOME_SUPPORT, test "$need_gnome_support" = yes)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-undelfs.m4 b/parts/appwizard/common/gnome/macros/gnome-undelfs.m4
new file mode 100644
index 00000000..c8ea6f4b
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-undelfs.m4
@@ -0,0 +1,20 @@
+dnl GNOME_UNDELFS_CHECKS
+dnl Check for ext2fs undel support.
+dnl Set shell variable ext2fs_undel to "yes" if we have it,
+dnl "no" otherwise. May define USE_EXT2FSLIB for cpp.
+dnl Will set EXT2FS_UNDEL_LIBS to required libraries.
+
+AC_DEFUN([GNOME_UNDELFS_CHECKS], [
+ AC_CHECK_HEADERS(ext2fs/ext2fs.h linux/ext2_fs.h)
+ ext2fs_undel=no
+ EXT2FS_UNDEL_LIBS=
+ if test x$ac_cv_header_ext2fs_ext2fs_h = xyes
+ then
+ if test x$ac_cv_header_linux_ext2_fs_h = xyes
+ then
+ AC_DEFINE(USE_EXT2FSLIB)
+ ext2fs_undel=yes
+ EXT2FS_UNDEL_LIBS="-lext2fs -lcom_err"
+ fi
+ fi
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-vfs.m4 b/parts/appwizard/common/gnome/macros/gnome-vfs.m4
new file mode 100644
index 00000000..137a39dd
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-vfs.m4
@@ -0,0 +1,120 @@
+dnl GNOME_VFS_CHECKS
+dnl Check for various functions needed by libvfs.
+dnl This has various effects:
+dnl Sets GNOME_VFS_LIBS to libraries required
+dnl Sets termnet to true or false depending on whether it is required.
+dnl If yes, defines USE_TERMNET.
+dnl Sets vfs_flags to "pretty" list of vfs implementations we include.
+dnl Sets shell variable use_vfs to yes (default, --with-vfs) or
+dnl "no" (--without-vfs).
+dnl Calls AC_SUBST(mcserv), which is either empty or "mcserv".
+
+dnl Private define
+AC_DEFUN([GNOME_WITH_VFS],[
+ dnl FIXME: network checks should probably be in their own macro.
+ AC_CHECK_LIB(nsl, t_accept)
+ AC_CHECK_LIB(socket, socket)
+
+ have_socket=no
+ AC_CHECK_FUNCS(socket, have_socket=yes)
+ if test $have_socket = no; then
+ # socket is not in the default libraries. See if it's in some other.
+ for lib in bsd socket inet; do
+ AC_CHECK_LIB($lib, socket, [
+ LIBS="$LIBS -l$lib"
+ have_socket=yes
+ AC_DEFINE(HAVE_SOCKET)
+ break])
+ done
+ fi
+
+ have_gethostbyname=no
+ AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
+ if test $have_gethostbyname = no; then
+ # gethostbyname is not in the default libraries. See if it's in some other.
+ for lib in bsd socket inet; do
+ AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
+ done
+ fi
+
+ vfs_flags="tarfs"
+ use_net_code=false
+ if test $have_socket = yes; then
+ AC_STRUCT_LINGER
+ AC_CHECK_FUNCS(pmap_set, , [
+ AC_CHECK_LIB(rpc, pmap_set, [
+ LIBS="-lrpc $LIBS"
+ AC_DEFINE(HAVE_PMAP_SET)
+ ])])
+ AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
+ dnl add for source routing support setsockopt
+ AC_CHECK_HEADERS(rpc/pmap_clnt.h)
+ vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
+ use_net_code=true
+ fi
+
+ dnl
+ dnl Samba support
+ dnl
+ smbfs=""
+ SAMBAFILES=""
+ AC_ARG_WITH(samba,
+ [--with-samba Support smb virtual file system],[
+ if test "x$withval != xno"; then
+ AC_DEFINE(WITH_SMBFS)
+ vfs_flags="$vfs_flags, smbfs"
+ smbfs="smbfs.o"
+ SAMBAFILES="\$(SAMBAFILES)"
+ fi
+ ])
+ AC_SUBST(smbfs)
+ AC_SUBST(SAMBAFILES)
+
+ dnl
+ dnl The termnet support
+ dnl
+ termnet=false
+ AC_ARG_WITH(termnet,
+ [--with-termnet If you want a termified net support],[
+ if test x$withval = xyes; then
+ AC_DEFINE(USE_TERMNET)
+ termnet=true
+ fi
+ ])
+
+ TERMNET=""
+ AC_DEFINE(USE_VFS)
+ if $use_net_code; then
+ AC_DEFINE(USE_NETCODE)
+ fi
+ mcserv=
+ if test $have_socket = yes; then
+ mcserv="mcserv"
+ if $termnet; then
+ TERMNET="-ltermnet"
+ fi
+ fi
+
+ AC_SUBST(TERMNET)
+ AC_SUBST(mcserv)
+
+dnl FIXME:
+dnl GNOME_VFS_LIBS=
+
+])
+
+AC_DEFUN([GNOME_VFS_CHECKS],[
+ use_vfs=yes
+ AC_ARG_WITH(vfs,
+ [--with-vfs Compile with the VFS code],
+ use_vfs=$withval
+ )
+ case $use_vfs in
+ yes) GNOME_WITH_VFS;;
+ no) use_vfs=no;;
+ *) use_vfs=no;;
+ dnl Should we issue a warning?
+ esac
+])
+
+
diff --git a/parts/appwizard/common/gnome/macros/gnome-x-checks.m4 b/parts/appwizard/common/gnome/macros/gnome-x-checks.m4
new file mode 100644
index 00000000..1e397ef8
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-x-checks.m4
@@ -0,0 +1,80 @@
+dnl GNOME_X_CHECKS
+dnl
+dnl Basic X11 related checks for X11. At the end, the following will be
+dnl defined/changed:
+dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK
+dnl CPPFLAGS Will include $X_CFLAGS
+dnl GNOME_HAVE_SM `true' or `false' depending on whether session
+dnl management is available. It is available if
+dnl both -lSM and X11/SM/SMlib.h exist. (Some
+dnl Solaris boxes have the library but not the header)
+dnl XPM_LIBS -lXpm if Xpm library is present, otherwise ""
+dnl
+dnl The following configure cache variables are defined (but not used):
+dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
+dnl
+AC_DEFUN([GNOME_X_CHECKS],
+[
+ AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
+ dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could
+ dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
+ dnl
+ dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
+ dnl CPPFLAGS, not CFLAGS
+ CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
+
+ saved_ldflags="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $GTK_LIBS"
+
+ gnome_cv_passdown_x_libs="$GTK_LIBS"
+ gnome_cv_passdown_X_LIBS="$GTK_LIBS"
+ gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
+ gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
+
+ LDFLAGS="$saved_ldflags $GTK_LIBS"
+
+dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
+ USE_DEVGTK=true
+
+dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
+dnl AC_EGREP_CPP(answer_affirmatively,
+dnl [#include <gtk/gtkfeatures.h>
+dnl #ifdef GTK_HAVE_FEATURES_1_1_0
+dnl answer_affirmatively
+dnl #endif
+dnl ], dev_gtk=yes, dev_gtk=no)
+dnl if test "$dev_gtk" = "yes"; then
+dnl USE_DEVGTK=true
+dnl fi
+dnl AC_MSG_RESULT("$dev_gtk")
+
+ GNOME_HAVE_SM=true
+ case "$GTK_LIBS" in
+ *-lSM*)
+ dnl Already found it.
+ ;;
+ *)
+ dnl Assume that if we have -lSM then we also have -lICE.
+ AC_CHECK_LIB(SM, SmcSaveYourselfDone,
+ [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
+ $x_libs -lICE)
+ ;;
+ esac
+
+ if test "$GNOME_HAVE_SM" = true; then
+ AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
+ fi
+
+ if test "$GNOME_HAVE_SM" = true; then
+ AC_DEFINE(HAVE_LIBSM)
+ fi
+
+ XPM_LIBS=""
+ AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
+ AC_SUBST(XPM_LIBS)
+
+ AC_REQUIRE([GNOME_PTHREAD_CHECK])
+ LDFLAGS="$saved_ldflags"
+
+ AC_PROVIDE([GNOME_X_CHECKS])
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome-xml-check.m4 b/parts/appwizard/common/gnome/macros/gnome-xml-check.m4
new file mode 100644
index 00000000..5d379d16
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome-xml-check.m4
@@ -0,0 +1,30 @@
+dnl
+dnl GNOME_XML_HOOK (script-if-xml-found, failflag)
+dnl
+dnl If failflag is "failure", script aborts due to lack of XML
+dnl
+dnl Check for availability of the libxml library
+dnl the XML parser uses libz if available too
+dnl
+
+AC_DEFUN([GNOME_XML_HOOK],[
+ AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
+ if test "$GNOME_CONFIG" = no; then
+ if test x$2 = xfailure; then
+ AC_MSG_ERROR(Could not find gnome-config)
+ fi
+ fi
+ AC_CHECK_LIB(xml, xmlNewDoc, [
+ $1
+ AC_SUBST(GNOME_XML_LIB)
+ GNOME_XML_LIB=`gnome-config --libs xml`
+ ], [
+ if test x$2 = xfailure; then
+ AC_MSG_ERROR(Could not link sample xml program)
+ fi
+ ], `gnome-config --libs xml`)
+])
+
+AC_DEFUN([GNOME_XML_CHECK], [
+ GNOME_XML_HOOK([],failure)
+])
diff --git a/parts/appwizard/common/gnome/macros/gnome.m4 b/parts/appwizard/common/gnome/macros/gnome.m4
new file mode 100644
index 00000000..a3a9ca74
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/gnome.m4
@@ -0,0 +1,124 @@
+dnl
+dnl GNOME_INIT_HOOK (script-if-gnome-enabled, [failflag], [additional-inits])
+dnl
+dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
+dnl is not found.
+dnl
+
+AC_DEFUN([GNOME_INIT_HOOK],[
+ AC_SUBST(GNOME_LIBS)
+ AC_SUBST(GNOMEUI_LIBS)
+ AC_SUBST(GNOMEGNORBA_LIBS)
+ AC_SUBST(GTKXMHTML_LIBS)
+ AC_SUBST(ZVT_LIBS)
+ AC_SUBST(GNOME_LIBDIR)
+ AC_SUBST(GNOME_INCLUDEDIR)
+
+ AC_ARG_WITH(gnome-includes,
+ [ --with-gnome-includes Specify location of GNOME headers],[
+ CFLAGS="$CFLAGS -I$withval"
+ ])
+
+ AC_ARG_WITH(gnome-libs,
+ [ --with-gnome-libs Specify location of GNOME libs],[
+ LDFLAGS="$LDFLAGS -L$withval"
+ gnome_prefix=$withval
+ ])
+
+ AC_ARG_WITH(gnome,
+ [ --with-gnome Specify prefix for GNOME files],
+ if test x$withval = xyes; then
+ want_gnome=yes
+ dnl Note that an empty true branch is not
+ dnl valid sh syntax.
+ ifelse([$1], [], :, [$1])
+ else
+ if test "x$withval" = xno; then
+ want_gnome=no
+ else
+ want_gnome=yes
+ LDFLAGS="$LDFLAGS -L$withval/lib"
+ CFLAGS="$CFLAGS -I$withval/include"
+ gnome_prefix=$withval/lib
+ fi
+ fi,
+ want_gnome=yes)
+
+ if test "x$want_gnome" = xyes; then
+
+ AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
+ if test "$GNOME_CONFIG" = "no"; then
+ no_gnome_config="yes"
+ else
+ AC_MSG_CHECKING(if $GNOME_CONFIG works)
+ if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
+ AC_MSG_RESULT(yes)
+ GNOME_GNORBA_HOOK([],$2)
+ GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
+ GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
+ GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
+ GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
+ ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
+ GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
+ GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
+ $1
+ else
+ AC_MSG_RESULT(no)
+ no_gnome_config="yes"
+ fi
+ fi
+
+ if test x$exec_prefix = xNONE; then
+ if test x$prefix = xNONE; then
+ gnome_prefix=$ac_default_prefix/lib
+ else
+ gnome_prefix=$prefix/lib
+ fi
+ else
+ gnome_prefix=`eval echo \`echo $libdir\``
+ fi
+
+ if test "$no_gnome_config" = "yes"; then
+ AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
+ if test -f $gnome_prefix/gnomeConf.sh; then
+ AC_MSG_RESULT(found)
+ echo "loading gnome configuration from" \
+ "$gnome_prefix/gnomeConf.sh"
+ . $gnome_prefix/gnomeConf.sh
+ $1
+ else
+ AC_MSG_RESULT(not found)
+ if test x$2 = xfail; then
+ AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
+ fi
+ fi
+ fi
+ fi
+
+ if test -n "$3"; then
+ n="$3"
+ for i in $n; do
+ AC_MSG_CHECKING(extra library \"$i\")
+ case $i in
+ applets)
+ AC_SUBST(GNOME_APPLETS_LIBS)
+ GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
+ AC_MSG_RESULT($GNOME_APPLETS_LIBS);;
+ capplet)
+ AC_SUBST(GNOME_CAPPLET_LIBS)
+ GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
+ AC_MSG_RESULT($GNOME_CAPPLET_LIBS);;
+ *)
+ AC_MSG_RESULT(unknown library)
+ esac
+ done
+ fi
+])
+
+dnl
+dnl GNOME_INIT ([additional-inits])
+dnl
+
+AC_DEFUN([GNOME_INIT],[
+ GNOME_INIT_HOOK([],fail,$1)
+])
diff --git a/parts/appwizard/common/gnome/macros/linger.m4 b/parts/appwizard/common/gnome/macros/linger.m4
new file mode 100644
index 00000000..dfa7c8ae
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/linger.m4
@@ -0,0 +1,28 @@
+dnl
+dnl Check for struct linger
+dnl
+AC_DEFUN(AC_STRUCT_LINGER, [
+av_struct_linger=no
+AC_MSG_CHECKING(struct linger is available)
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/socket.h>
+
+struct linger li;
+
+main ()
+{
+ li.l_onoff = 1;
+ li.l_linger = 120;
+ exit (0);
+}
+],[
+AC_DEFINE(HAVE_STRUCT_LINGER)
+av_struct_linger=yes
+],[
+av_struct_linger=no
+],[
+av_struct_linger=no
+])
+AC_MSG_RESULT($av_struct_linger)
+])
diff --git a/parts/appwizard/common/gnome/macros/need-declaration.m4 b/parts/appwizard/common/gnome/macros/need-declaration.m4
new file mode 100644
index 00000000..d5b7bc66
--- /dev/null
+++ b/parts/appwizard/common/gnome/macros/need-declaration.m4
@@ -0,0 +1,42 @@
+dnl See whether we need a declaration for a function.
+dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
+AC_DEFUN(GCC_NEED_DECLARATION,
+[AC_MSG_CHECKING([whether $1 must be declared])
+AC_CACHE_VAL(gcc_cv_decl_needed_$1,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+$2],
+[char *(*pfn) = (char *(*)) $1],
+eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
+if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
+ AC_MSG_RESULT(yes)
+ gcc_need_declarations="$gcc_need_declarations $1"
+ gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ AC_DEFINE_UNQUOTED($gcc_tr_decl)
+else
+ AC_MSG_RESULT(no)
+fi
+])dnl
+
+dnl Check multiple functions to see whether each needs a declaration.
+dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
+AC_DEFUN(GCC_NEED_DECLARATIONS,
+[for ac_func in $1
+do
+GCC_NEED_DECLARATION($ac_func, $2)
+done
+]
+)
diff --git a/parts/appwizard/common/gnome2.kdevtemplate b/parts/appwizard/common/gnome2.kdevtemplate
new file mode 100644
index 00000000..02f631bf
--- /dev/null
+++ b/parts/appwizard/common/gnome2.kdevtemplate
@@ -0,0 +1,5 @@
+[GNOME2]
+Type=install archive
+Source=%{kdevelop}/template-common/gnome2.tar.gz
+Dest=%{dest}
+
diff --git a/parts/appwizard/common/gnome2/macros/aclocal-include.m4 b/parts/appwizard/common/gnome2/macros/aclocal-include.m4
new file mode 100644
index 00000000..43f9dbc4
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/aclocal-include.m4
@@ -0,0 +1,16 @@
+# aclocal-include.m4
+#
+# This macro adds the name macrodir to the set of directories
+# that `aclocal' searches for macros.
+
+# serial 1
+
+dnl AM_ACLOCAL_INCLUDE(macrodir)
+AC_DEFUN([AM_ACLOCAL_INCLUDE],
+[
+ AM_CONDITIONAL(INSIDE_GNOME_COMMON, false)
+
+ test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+ for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
+])
diff --git a/parts/appwizard/common/gnome2/macros/autogen.sh b/parts/appwizard/common/gnome2/macros/autogen.sh
new file mode 100755
index 00000000..ac9e0b68
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/autogen.sh
@@ -0,0 +1,384 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+#name of package
+PKG_NAME=${PKG_NAME:-Package}
+srcdir=${srcdir:-.}
+
+# default version requirements ...
+REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.53}
+REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.4}
+REQUIRED_LIBTOOL_VERSION=${REQUIRED_LIBTOOL_VERSION:-1.4.3}
+REQUIRED_GETTEXT_VERSION=${REQUIRED_GETTEXT_VERSION:-0.10.40}
+REQUIRED_GLIB_GETTEXT_VERSION=${REQUIRED_GLIB_GETTEXT_VERSION:-2.2.0}
+REQUIRED_INTLTOOL_VERSION=${REQUIRED_INTLTOOL_VERSION:-0.25}
+REQUIRED_PKG_CONFIG_VERSION=${REQUIRED_PKG_CONFIG_VERSION:-0.14.0}
+REQUIRED_GTK_DOC_VERSION=${REQUIRED_GTK_DOC_VERSION:-1.0}
+REQUIRED_DOC_COMMON_VERSION=${REQUIRED_DOC_COMMON_VERSION:-2.3.0}
+
+# a list of required m4 macros. Package can set an initial value
+REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-}
+FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-}
+
+# if GNOME2_DIR set, modify ACLOCAL_FLAGS ...
+if [ -n "$GNOME2_DIR" ]; then
+ ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
+ LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
+ PATH="$GNOME2_DIR/bin:$PATH"
+ export PATH
+ export LD_LIBRARY_PATH
+fi
+
+
+# Not all echo versions allow -n, so we check what is possible. This test is
+# based on the one in autoconf.
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ;;
+ *c*,* ) ECHO_N=-n ;;
+ *) ECHO_N= ;;
+esac
+
+# some terminal codes ...
+boldface="`tput bold 2>/dev/null`"
+normal="`tput sgr0 2>/dev/null`"
+printbold() {
+ echo $ECHO_N "$boldface"
+ echo "$@"
+ echo $ECHO_N "$normal"
+}
+printerr() {
+ echo "$@" >&2
+}
+
+# Usage:
+# compare_versions MIN_VERSION ACTUAL_VERSION
+# returns true if ACTUAL_VERSION >= MIN_VERSION
+compare_versions() {
+ ch_min_version=$1
+ ch_actual_version=$2
+ ch_status=0
+ IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="."
+ set $ch_actual_version
+ for min in $ch_min_version; do
+ ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes
+ if [ -z "$ch_min" ]; then break; fi
+ if [ -z "$ch_cur" ]; then ch_status=1; break; fi
+ if [ $ch_cur -gt $ch_min ]; then break; fi
+ if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi
+ done
+ IFS="$ch_save_IFS"
+ return $ch_status
+}
+
+# Usage:
+# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE
+# checks to see if the package is available
+version_check() {
+ vc_package=$1
+ vc_variable=$2
+ vc_checkprogs=$3
+ vc_min_version=$4
+ vc_source=$5
+ vc_status=1
+
+ vc_checkprog=`eval echo "\\$$vc_variable"`
+ if [ -n "$vc_checkprog" ]; then
+ printbold "using $vc_checkprog for $vc_package"
+ return 0
+ fi
+
+ printbold "checking for $vc_package >= $vc_min_version..."
+ for vc_checkprog in $vc_checkprogs; do
+ echo $ECHO_N " testing $vc_checkprog... "
+ if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then
+ vc_actual_version=`$vc_checkprog --version | head -1 | \
+ sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'`
+ if compare_versions $vc_min_version $vc_actual_version; then
+ echo "found $vc_actual_version"
+ # set variable
+ eval "$vc_variable=$vc_checkprog"
+ vc_status=0
+ break
+ else
+ echo "too old (found version $vc_actual_version)"
+ fi
+ else
+ echo "not found."
+ fi
+ done
+ if [ "$vc_status" != 0 ]; then
+ printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
+ printerr " to build $PKG_NAME. Download the appropriate package for"
+ printerr " from your distribution or get the source tarball at"
+ printerr " $vc_source"
+ printerr
+ fi
+ return $vc_status
+}
+
+# Usage:
+# require_m4macro filename.m4
+# adds filename.m4 to the list of required macros
+require_m4macro() {
+ case "$REQUIRED_M4MACROS" in
+ $1\ * | *\ $1\ * | *\ $1) ;;
+ *) REQUIRED_M4MACROS="$REQUIRED_M4MACROS $1" ;;
+ esac
+}
+
+forbid_m4macro() {
+ case "$FORBIDDEN_M4MACROS" in
+ $1\ * | *\ $1\ * | *\ $1) ;;
+ *) FORBIDDEN_M4MACROS="$FORBIDDEN_M4MACROS $1" ;;
+ esac
+}
+
+# Usage:
+# check_m4macros
+# Checks that all the requested macro files are in the aclocal macro path
+# Uses REQUIRED_M4MACROS and ACLOCAL variables.
+check_m4macros() {
+ # construct list of macro directories
+ cm_macrodirs="`$ACLOCAL --print-ac-dir`"
+ set - $ACLOCAL_FLAGS
+ while [ $# -gt 0 ]; do
+ if [ "$1" = "-I" ]; then
+ cm_macrodirs="$cm_macrodirs $2"
+ shift
+ fi
+ shift
+ done
+
+ cm_status=0
+ if [ -n "$REQUIRED_M4MACROS" ]; then
+ printbold "Checking for required M4 macros..."
+ # check that each macro file is in one of the macro dirs
+ for cm_macro in $REQUIRED_M4MACROS; do
+ cm_macrofound=false
+ for cm_dir in $cm_macrodirs; do
+ if [ -f "$cm_dir/$cm_macro" ]; then
+ cm_macrofound=true
+ break
+ fi
+ # The macro dir in Cygwin environments may contain a file
+ # called dirlist containing other directories to look in.
+ if [ -f "$cm_dir/dirlist" ]; then
+ for cm_otherdir in `cat $cm_dir/dirlist`; do
+ if [ -f "$cm_otherdir/$cm_macro" ]; then
+ cm_macrofound=true
+ break
+ fi
+ done
+ fi
+ done
+ if $cm_macrofound; then
+ :
+ else
+ printerr " $cm_macro not found"
+ cm_status=1
+ fi
+ done
+ fi
+ if [ -n "$FORBIDDEN_M4MACROS" ]; then
+ printbold "Checking for forbidden M4 macros..."
+ # check that each macro file is in one of the macro dirs
+ for cm_macro in $FORBIDDEN_M4MACROS; do
+ cm_macrofound=false
+ for cm_dir in $cm_macrodirs; do
+ if [ -f "$cm_dir/$cm_macro" ]; then
+ cm_macrofound=true
+ break
+ fi
+ done
+ if $cm_macrofound; then
+ printerr " $cm_macro found (should be cleared from macros dir)"
+ cm_status=1
+ fi
+ done
+ fi
+ if [ "$cm_status" != 0 ]; then
+ printerr "***Error***: some autoconf macros required to build $PKG_NAME"
+ printerr " were not found in your aclocal path, or some forbidden"
+ printerr " macros were found. Perhaps you need to adjust your"
+ printerr " ACLOCAL_PATH?"
+ printerr
+ fi
+ return $cm_status
+}
+
+# try to catch the case where the macros2/ directory hasn't been cleared out.
+forbid_m4macro gnome-cxx-check.m4
+
+want_libtool=false
+want_gettext=false
+want_glib_gettext=false
+want_intltool=false
+want_pkg_config=false
+want_gtk_doc=false
+
+configure_files="`find $srcdir -name '{arch}' -prune -o -name configure.ac -print -or -name configure.in -print`"
+for configure_ac in $configure_files; do
+ if grep "^A[CM]_PROG_LIBTOOL" $configure_ac >/dev/null; then
+ want_libtool=true
+ fi
+ if grep "^AM_GNU_GETTEXT" $configure_ac >/dev/null; then
+ want_gettext=true
+ fi
+ if grep "^AM_GLIB_GNU_GETTEXT" $configure_ac >/dev/null; then
+ want_glib_gettext=true
+ fi
+ if grep "^AC_PROG_INTLTOOL" $configure_ac >/dev/null; then
+ want_intltool=true
+ fi
+ if grep "^PKG_CHECK_MODULES" $configure_ac >/dev/null; then
+ want_pkg_config=true
+ fi
+ if grep "^GTK_DOC_CHECK" $configure_ac >/dev/null; then
+ want_gtk_doc=true
+ fi
+done
+
+DIE=0
+
+#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13
+WANT_AUTOCONF_2_5=1
+export WANT_AUTOCONF_2_5
+version_check autoconf AUTOCONF 'autoconf2.50 autoconf autoconf-2.53' $REQUIRED_AUTOCONF_VERSION \
+ "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-$REQUIRED_AUTOCONF_VERSION.tar.gz" || DIE=1
+AUTOHEADER=`echo $AUTOCONF | sed s/autoconf/autoheader/`
+
+case $REQUIRED_AUTOMAKE_VERSION in
+ 1.4*) automake_progs="automake-1.4" ;;
+ 1.5*) automake_progs="automake-1.7 automake-1.6 automake-1.5" ;;
+ 1.6*) automake_progs="automake-1.7 automake-1.6" ;;
+ 1.7*) automake_progs="automake-1.7" ;;
+ 1.8*) automake_progs="automake-1.8" ;;
+esac
+version_check automake AUTOMAKE "$automake_progs automake" $REQUIRED_AUTOMAKE_VERSION \
+ "http://ftp.gnu.org/pub/gnu/automake/automake-$REQUIRED_AUTOMAKE_VERSION.tar.gz" || DIE=1
+ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/`
+
+if $want_libtool; then
+ version_check libtool LIBTOOLIZE libtoolize $REQUIRED_LIBTOOL_VERSION \
+ "http://ftp.gnu.org/pub/gnu/libtool/libtool-$REQUIRED_LIBTOOL_VERSION.tar.gz" || DIE=1
+ require_m4macro libtool.m4
+fi
+
+if $want_gettext; then
+ version_check gettext GETTEXTIZE gettextize $REQUIRED_GETTEXT_VERSION \
+ "http://ftp.gnu.org/pub/gnu/gettext/gettext-$REQUIRED_GETTEXT_VERSION.tar.gz" || DIE=1
+ require_m4macro gettext.m4
+fi
+
+if $want_glib_gettext; then
+ version_check glib-gettext GLIB_GETTEXTIZE glib-gettextize $REQUIRED_GLIB_GETTEXT_VERSION \
+ "ftp://ftp.gtk.org/pub/gtk/v2.2/glib-$REQUIRED_GLIB_GETTEXT_VERSION.tar.gz" || DIE=1
+ require_m4macro glib-gettext.m4
+fi
+
+if $want_intltool; then
+ version_check intltool INTLTOOLIZE intltoolize $REQUIRED_INTLTOOL_VERSION \
+ "http://ftp.gnome.org/pub/GNOME/sources/intltool/" || DIE=1
+ require_m4macro intltool.m4
+fi
+
+if $want_pkg_config; then
+ version_check pkg-config PKG_CONFIG pkg-config $REQUIRED_PKG_CONFIG_VERSION \
+ "'http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-$REQUIRED_PKG_CONFIG_VERSION.tar.gz" || DIE=1
+ require_m4macro pkg.m4
+fi
+
+if $want_gtk_doc; then
+ version_check gtk-doc GTKDOCIZE gtkdocize $REQUIRED_GTK_DOC_VERSION \
+ "http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/" || DIE=1
+ require_m4macro gtk-doc.m4
+fi
+
+if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then
+ version_check gnome-common DOC_COMMON gnome-doc-common \
+ $REQUIRED_DOC_COMMON_VERSION " " || DIE=1
+fi
+
+check_m4macros || DIE=1
+
+if [ "$DIE" -eq 1 ]; then
+ exit 1
+fi
+
+if test -z "$*"; then
+ printerr "**Warning**: I am going to run \`configure' with no arguments."
+ printerr "If you wish to pass any to it, please specify them on the"
+ printerr \`$0\'" command line."
+ printerr
+fi
+
+topdir=`pwd`
+for configure_ac in $configure_files; do
+ dirname=`dirname $configure_ac`
+ basename=`basename $configure_ac`
+ if test -f $dirname/NO-AUTO-GEN; then
+ echo skipping $dirname -- flagged as no auto-gen
+ else
+ printbold "Processing $configure_ac"
+ cd $dirname
+
+ aclocalinclude="$ACLOCAL_FLAGS"
+ printbold "Running $ACLOCAL..."
+ $ACLOCAL $aclocalinclude # || exit 1
+
+ if grep "GNOME_AUTOGEN_OBSOLETE" aclocal.m4 >/dev/null; then
+ printerr "*** obsolete gnome macros were used in $configure_ac"
+ fi
+
+ if grep "^A[CM]_PROG_LIBTOOL" $basename >/dev/null; then
+ printbold "Running $LIBTOOLIZE..."
+ $LIBTOOLIZE --force || exit 1
+ fi
+ if grep "^AM_GLIB_GNU_GETTEXT" $basename >/dev/null; then
+ printbold "Running $GLIB_GETTEXTIZE... Ignore non-fatal messages."
+ echo "no" | $GLIB_GETTEXTIZE --force --copy || exit 1
+ elif grep "^AM_GNU_GETTEXT" $basename >/dev/null; then
+ if grep "^AM_GNU_GETTEXT_VERSION" $basename > /dev/null; then
+ printbold "Running autopoint..."
+ autopoint --force || exit 1
+ else
+ printbold "Running $GETTEXTIZE... Ignore non-fatal messages."
+ echo "no" | $GETTEXTIZE --force --copy || exit 1
+ fi
+ fi
+ if grep "^AC_PROG_INTLTOOL" $basename >/dev/null; then
+ printbold "Running $INTLTOOLIZE..."
+ $INTLTOOLIZE --force --automake || exit 1
+ fi
+ if grep "^GTK_DOC_CHECK" $basename >/dev/null; then
+ printbold "Running $GTKDOCIZE..."
+ $GTKDOCIZE || exit 1
+ fi
+ if grep "^A[CM]_CONFIG_HEADER" $basename >/dev/null; then
+ printbold "Running $AUTOHEADER..."
+ $AUTOHEADER || exit 1
+ fi
+ if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then
+ printbold "Running gnome-doc-common..."
+ gnome-doc-common --copy || exit 1
+ fi
+
+ printbold "Running $AUTOMAKE..."
+ $AUTOMAKE --gnu --add-missing || exit 1
+
+ printbold "Running $AUTOCONF..."
+ $AUTOCONF || exit 1
+
+ cd $topdir
+ fi
+done
+
+conf_flags="--enable-maintainer-mode"
+
+#if test x$NOCONFIGURE = x; then
+# printbold Running $srcdir/configure $conf_flags "$@" ...
+# $srcdir/configure $conf_flags "$@" \
+# && echo Now type \`make\' to compile $PKG_NAME || exit 1
+#else
+# echo Skipping configure process.
+#fi
diff --git a/parts/appwizard/common/gnome2/macros/compiler-flags.m4 b/parts/appwizard/common/gnome2/macros/compiler-flags.m4
new file mode 100644
index 00000000..b2b022c0
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/compiler-flags.m4
@@ -0,0 +1,141 @@
+dnl GNOME_COMPILE_WARNINGS
+dnl Turn on many useful compiler warnings
+dnl For now, only works on GCC
+AC_DEFUN([GNOME_COMPILE_WARNINGS],[
+ dnl ******************************
+ dnl More compiler warnings
+ dnl ******************************
+
+ if test -z "$1" ; then
+ default_compile_warnings=yes
+ else
+ default_compile_warnings="$1"
+ fi
+
+ AC_ARG_ENABLE(compile-warnings,
+ [ --enable-compile-warnings=[no/minimum/yes/maximum/error] Turn on compiler warnings.],, [enable_compile_warnings="$default_compile_warnings"])
+
+ warnCFLAGS=
+ if test "x$GCC" != xyes; then
+ enable_compile_warnings=no
+ fi
+
+ warning_flags=
+ realsave_CFLAGS="$CFLAGS"
+
+ case "$enable_compile_warnings" in
+ no)
+ warning_flags=
+ ;;
+ minimum)
+ warning_flags="-Wall"
+ ;;
+ yes)
+ warning_flags="-Wall -Wmissing-prototypes"
+ ;;
+ maximum|error)
+ warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
+ CFLAGS="$warning_flags $CFLAGS"
+ for option in -Wno-sign-compare; do
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $option"
+ AC_MSG_CHECKING([whether gcc understands $option])
+ AC_TRY_COMPILE([], [],
+ has_option=yes,
+ has_option=no,)
+ CFLAGS="$SAVE_CFLAGS"
+ AC_MSG_RESULT($has_option)
+ if test $has_option = yes; then
+ warning_flags="$warning_flags $option"
+ fi
+ unset has_option
+ unset SAVE_CFLAGS
+ done
+ unset option
+ if test "$enable_compile_warnings" = "error" ; then
+ warning_flags="$warning_flags -Werror"
+ fi
+ ;;
+ *)
+ AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
+ ;;
+ esac
+ CFLAGS="$realsave_CFLAGS"
+ AC_MSG_CHECKING(what warning flags to pass to the C compiler)
+ AC_MSG_RESULT($warning_flags)
+
+ AC_ARG_ENABLE(iso-c,
+ [ --enable-iso-c Try to warn if code is not ISO C ],,
+ enable_iso_c=no)
+
+ AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
+ complCFLAGS=
+ if test "x$enable_iso_c" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) complCFLAGS="$complCFLAGS -ansi" ;;
+ esac
+ case " $CFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) complCFLAGS="$complCFLAGS -pedantic" ;;
+ esac
+ fi
+ fi
+ AC_MSG_RESULT($complCFLAGS)
+
+ WARN_CFLAGS="$warning_flags $complCFLAGS"
+ AC_SUBST(WARN_CFLAGS)
+])
+
+dnl For C++, do basically the same thing.
+
+AC_DEFUN([GNOME_CXX_WARNINGS],[
+ AC_ARG_ENABLE(cxx-warnings,
+ [ --enable-cxx-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_cxx_warnings=minimum)
+
+ AC_MSG_CHECKING(what warning flags to pass to the C++ compiler)
+ warnCXXFLAGS=
+ if test "x$GCC" != xyes; then
+ enable_compile_warnings=no
+ fi
+ if test "x$enable_cxx_warnings" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CXXFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) warnCXXFLAGS="-Wall -Wno-unused" ;;
+ esac
+
+ ## -W is not all that useful. And it cannot be controlled
+ ## with individual -Wno-xxx flags, unlike -Wall
+ if test "x$enable_cxx_warnings" = "xyes"; then
+ warnCXXFLAGS="$warnCXXFLAGS -Wshadow -Woverloaded-virtual"
+ fi
+ fi
+ fi
+ AC_MSG_RESULT($warnCXXFLAGS)
+
+ AC_ARG_ENABLE(iso-cxx,
+ [ --enable-iso-cxx Try to warn if code is not ISO C++ ],,
+ enable_iso_cxx=no)
+
+ AC_MSG_CHECKING(what language compliance flags to pass to the C++ compiler)
+ complCXXFLAGS=
+ if test "x$enable_iso_cxx" != "xno"; then
+ if test "x$GCC" = "xyes"; then
+ case " $CXXFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) complCXXFLAGS="$complCXXFLAGS -ansi" ;;
+ esac
+
+ case " $CXXFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) complCXXFLAGS="$complCXXFLAGS -pedantic" ;;
+ esac
+ fi
+ fi
+ AC_MSG_RESULT($complCXXFLAGS)
+
+ WARN_CXXFLAGS="$CXXFLAGS $warnCXXFLAGS $complCXXFLAGS"
+ AC_SUBST(WARN_CXXFLAGS)
+])
diff --git a/parts/appwizard/common/gnome2/macros/curses.m4 b/parts/appwizard/common/gnome2/macros/curses.m4
new file mode 100644
index 00000000..5307e13d
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/curses.m4
@@ -0,0 +1,318 @@
+dnl Curses detection: Munged from Midnight Commander's configure.in
+dnl
+dnl What it does:
+dnl =============
+dnl
+dnl - Determine which version of curses is installed on your system
+dnl and set the -I/-L/-l compiler entries and add a few preprocessor
+dnl symbols
+dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
+dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
+dnl Makefile.in's
+dnl - Modify the following configure variables (these are the only
+dnl curses.m4 variables you can access from within configure.in)
+dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
+dnl an ncurses.h that's been renamed to curses.h
+dnl is found.
+dnl CURSES_LIBS - sets -L and -l's appropriately
+dnl CFLAGS - if --with-sco, add -D_SVID3
+dnl has_curses - exports result of tests to rest of configure
+dnl
+dnl Usage:
+dnl ======
+dnl 1) Add lines indicated below to acconfig.h
+dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
+dnl 3) Instead of #include <curses.h> you should use the following to
+dnl properly locate ncurses or curses header file
+dnl
+dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
+dnl #include <ncurses.h>
+dnl #else
+dnl #include <curses.h>
+dnl #endif
+dnl
+dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
+dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
+dnl
+dnl Notes with automake:
+dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
+dnl configure.in
+dnl - your Makefile.am can look something like this
+dnl -----------------------------------------------
+dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
+dnl if HAS_CURSES
+dnl CURSES_TARGETS=name_of_curses_prog
+dnl endif
+dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
+dnl other_programs_SOURCES = blah blah blah
+dnl name_of_curses_prog_SOURCES = blah blah blah
+dnl other_programs_LDADD = blah
+dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
+dnl -----------------------------------------------
+dnl
+dnl
+dnl The following lines should be added to acconfig.h:
+dnl ==================================================
+dnl
+dnl /*=== Curses version detection defines ===*/
+dnl /* Found some version of curses that we're going to use */
+dnl #undef HAS_CURSES
+dnl
+dnl /* Use SunOS SysV curses? */
+dnl #undef USE_SUNOS_CURSES
+dnl
+dnl /* Use old BSD curses - not used right now */
+dnl #undef USE_BSD_CURSES
+dnl
+dnl /* Use SystemV curses? */
+dnl #undef USE_SYSV_CURSES
+dnl
+dnl /* Use Ncurses? */
+dnl #undef USE_NCURSES
+dnl
+dnl /* If you Curses does not have color define this one */
+dnl #undef NO_COLOR_CURSES
+dnl
+dnl /* Define if you want to turn on SCO-specific code */
+dnl #undef SCO_FLAVOR
+dnl
+dnl /* Set to reflect version of ncurses *
+dnl * 0 = version 1.*
+dnl * 1 = version 1.9.9g
+dnl * 2 = version 4.0/4.1 */
+dnl #undef NCURSES_970530
+dnl
+dnl /*=== End new stuff for acconfig.h ===*/
+dnl
+
+
+AC_DEFUN([AC_CHECK_CURSES],[
+ search_ncurses=true
+ screen_manager=""
+ has_curses=false
+
+ CFLAGS=${CFLAGS--O}
+
+ AC_SUBST(CURSES_LIBS)
+ AC_SUBST(CURSES_INCLUDEDIR)
+
+ AC_ARG_WITH(sco,
+ [ --with-sco Use this to turn on SCO-specific code],[
+ if test x$withval = xyes; then
+ AC_DEFINE(SCO_FLAVOR)
+ CFLAGS="$CFLAGS -D_SVID3"
+ fi
+ ])
+
+ AC_ARG_WITH(sunos-curses,
+ [ --with-sunos-curses Used to force SunOS 4.x curses],[
+ if test x$withval = xyes; then
+ AC_USE_SUNOS_CURSES
+ fi
+ ])
+
+ AC_ARG_WITH(osf1-curses,
+ [ --with-osf1-curses Used to force OSF/1 curses],[
+ if test x$withval = xyes; then
+ AC_USE_OSF1_CURSES
+ fi
+ ])
+
+ AC_ARG_WITH(vcurses,
+ [ --with-vcurses[=incdir] Used to force SysV curses],
+ if test x$withval != xyes; then
+ CURSES_INCLUDEDIR="-I$withval"
+ fi
+ AC_USE_SYSV_CURSES
+ )
+
+ AC_ARG_WITH(ncurses,
+ [ --with-ncurses[=dir] Compile with ncurses/locate base dir],
+ if test x$withval = xno ; then
+ search_ncurses=false
+ elif test x$withval != xyes ; then
+ CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
+ CURSES_INCLUDEDIR="-I$withval/include"
+ search_ncurses=false
+ screen_manager="ncurses"
+ AC_DEFINE(USE_NCURSES)
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ fi
+ )
+
+ if $search_ncurses
+ then
+ AC_SEARCH_NCURSES()
+ fi
+
+
+])
+
+
+AC_DEFUN([AC_USE_SUNOS_CURSES], [
+ search_ncurses=false
+ screen_manager="SunOS 4.x /usr/5include curses"
+ AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
+ AC_DEFINE(USE_SUNOS_CURSES)
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(NO_COLOR_CURSES)
+ AC_DEFINE(USE_SYSV_CURSES)
+ CURSES_INCLUDEDIR="-I/usr/5include"
+ CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
+ AC_MSG_RESULT(Please note that some screen refreshs may fail)
+])
+
+AC_DEFUN([AC_USE_OSF1_CURSES], [
+ AC_MSG_RESULT(Using OSF1 curses)
+ search_ncurses=false
+ screen_manager="OSF1 curses"
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(NO_COLOR_CURSES)
+ AC_DEFINE(USE_SYSV_CURSES)
+ CURSES_LIBS="-lcurses"
+])
+
+AC_DEFUN([AC_USE_SYSV_CURSES], [
+ AC_MSG_RESULT(Using SysV curses)
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(USE_SYSV_CURSES)
+ search_ncurses=false
+ screen_manager="SysV/curses"
+ CURSES_LIBS="-lcurses"
+])
+
+dnl AC_ARG_WITH(bsd-curses,
+dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
+dnl search_ncurses=false
+dnl screen_manager="Ultrix/cursesX"
+dnl if test $system = ULTRIX
+dnl then
+dnl THIS_CURSES=cursesX
+dnl else
+dnl THIS_CURSES=curses
+dnl fi
+dnl
+dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
+dnl AC_DEFINE(HAS_CURSES)
+dnl has_curses=true
+dnl AC_DEFINE(USE_BSD_CURSES)
+dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
+dnl AC_MSG_WARN(Use of the bsdcurses extension has some)
+dnl AC_MSG_WARN(display/input problems.)
+dnl AC_MSG_WARN(Reconsider using xcurses)
+dnl)
+
+
+dnl
+dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
+dnl
+AC_DEFUN([AC_NCURSES], [
+ if $search_ncurses
+ then
+ if test -f $1/$2
+ then
+ AC_MSG_RESULT(Found ncurses on $1/$2)
+ CURSES_LIBS="$3"
+ CURSES_INCLUDEDIR="$4"
+ search_ncurses=false
+ screen_manager=$5
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(USE_NCURSES)
+ fi
+ fi
+])
+
+AC_DEFUN([AC_SEARCH_NCURSES], [
+ AC_CHECKING("location of ncurses.h file")
+
+ AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
+ AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
+ AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
+ AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
+
+ AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
+
+ AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
+
+ dnl
+ dnl We couldn't find ncurses, try SysV curses
+ dnl
+ if $search_ncurses
+ then
+ AC_EGREP_HEADER(init_color, /usr/include/curses.h,
+ AC_USE_SYSV_CURSES)
+ AC_EGREP_CPP(USE_NCURSES,[
+#include <curses.h>
+#ifdef __NCURSES_H
+#undef USE_NCURSES
+USE_NCURSES
+#endif
+],[
+ CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
+ AC_DEFINE(HAS_CURSES)
+ has_curses=true
+ AC_DEFINE(USE_NCURSES)
+ search_ncurses=false
+ screen_manager="ncurses installed as curses"
+])
+ fi
+
+ dnl
+ dnl Try SunOS 4.x /usr/5{lib,include} ncurses
+ dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
+ dnl should be replaced by a more fine grained selection routine
+ dnl
+ if $search_ncurses
+ then
+ if test -f /usr/5include/curses.h
+ then
+ AC_USE_SUNOS_CURSES
+ fi
+ else
+ # check for ncurses version, to properly ifdef mouse-fix
+ AC_MSG_CHECKING(for ncurses version)
+ ncurses_version=unknown
+cat > conftest.$ac_ext <<EOF
+[#]line __oline__ "configure"
+#include "confdefs.h"
+#ifdef RENAMED_NCURSES
+#include <curses.h>
+#else
+#include <ncurses.h>
+#endif
+#undef VERSION
+VERSION:NCURSES_VERSION
+EOF
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC |
+ egrep "VERSION:" >conftest.out 2>&1; then
+changequote(,)dnl
+ ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'`
+changequote([,])dnl
+ fi
+ rm -rf conftest*
+ AC_MSG_RESULT($ncurses_version)
+ case "$ncurses_version" in
+changequote(,)dnl
+ 4.[01])
+changequote([,])dnl
+ AC_DEFINE(NCURSES_970530,2)
+ ;;
+ 1.9.9g)
+ AC_DEFINE(NCURSES_970530,1)
+ ;;
+ 1*)
+ AC_DEFINE(NCURSES_970530,0)
+ ;;
+ esac
+ fi
+])
+
+
+
+
+
diff --git a/parts/appwizard/common/gnome2/macros/gnome-common.m4 b/parts/appwizard/common/gnome2/macros/gnome-common.m4
new file mode 100644
index 00000000..20302d1f
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/gnome-common.m4
@@ -0,0 +1,30 @@
+# gnome-common.m4
+#
+
+dnl GNOME_COMMON_INIT
+
+AC_DEFUN([GNOME_COMMON_INIT],
+[
+ AC_CACHE_VAL(ac_cv_gnome_aclocal_dir,
+ [ac_cv_gnome_aclocal_dir="$GNOME_COMMON_MACROS_DIR"])
+ AC_CACHE_VAL(ac_cv_gnome_aclocal_flags,
+ [ac_cv_gnome_aclocal_flags="$ACLOCAL_FLAGS"])
+ GNOME_ACLOCAL_DIR="$ac_cv_gnome_aclocal_dir"
+ GNOME_ACLOCAL_FLAGS="$ac_cv_gnome_aclocal_flags"
+ AC_SUBST(GNOME_ACLOCAL_DIR)
+ AC_SUBST(GNOME_ACLOCAL_FLAGS)
+
+ ACLOCAL="$ACLOCAL $GNOME_ACLOCAL_FLAGS"
+
+ AM_CONDITIONAL(INSIDE_GNOME_DOCU, false)
+])
+
+AC_DEFUN([GNOME_DEBUG_CHECK],
+[
+ AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]], enable_debug="$enableval", enable_debug=no)
+
+ if test x$enable_debug = xyes ; then
+ AC_DEFINE(GNOME_ENABLE_DEBUG,1,
+ [Enable additional debugging at the expense of performance and size])
+ fi
+])
diff --git a/parts/appwizard/common/gnome2/macros/gnome-deprecated-macros.m4 b/parts/appwizard/common/gnome2/macros/gnome-deprecated-macros.m4
new file mode 100644
index 00000000..b27ba528
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/gnome-deprecated-macros.m4
@@ -0,0 +1,32 @@
+-*- mode: autoconf -*-
+
+# GNOME_AUTOGEN_OBSOLETE
+# this marker is checked for in the aclocal.m4 file to check for bad macros ...
+
+AU_DEFUN([AM_GNOME2_GETTEXT], [AM_GLIB_GNU_GETTEXT])
+AU_DEFUN([GNOME_GTKDOC_CHECK], [GTK_DOC_CHECK])
+AU_DEFUN([GNOME2_X_CHECKS], [])
+AU_DEFUN([GNOME_PTHREAD_CHECK], [])
+AU_DEFUN([GNOME_CHECK_PKGCONFIG], [])
+AU_DEFUN([GNOME_REQUIRE_PKGCONFIG], [])
+AU_DEFUN([GNOME_PLATFORM_GNOME_2], [])
+
+AU_DEFUN([GNOME_CHECK_CXX],
+[
+ # see if a C++ compiler exists and works
+ AC_PROG_CXX
+ if test "x$ac_cv_prog_cxx_works" = xno; then
+ AC_MSG_WARN(ifelse([$1], , "No C++ compiler", [$1]))
+ fi
+ AM_CONDITIONAL(CXX_PRESENT, test "x$ac_cv_prog_cxx_works" != xno)
+])
+
+# for aclocal-1.4's benefit
+# AC_DEFUN([AM_GNOME2_GETTEXT], [])
+# AC_DEFUN([GNOME_GTKDOC_CHECK], [])
+# AC_DEFUN([GNOME2_X_CHECKS], [])
+# AC_DEFUN([GNOME_PTHREAD_CHECK], [])
+# AC_DEFUN([GNOME_CHECK_PKGCONFIG], [])
+# AC_DEFUN([GNOME_REQUIRE_PKGCONFIG], [])
+# AC_DEFUN([GNOME_PLATFORM_GNOME_2], [])
+# AC_DEFUN([GNOME_CHECK_CXX], [])
diff --git a/parts/appwizard/common/gnome2/macros/gnome2-macros.dep b/parts/appwizard/common/gnome2/macros/gnome2-macros.dep
new file mode 100644
index 00000000..89233770
--- /dev/null
+++ b/parts/appwizard/common/gnome2/macros/gnome2-macros.dep
@@ -0,0 +1 @@
+$(top_srcdir)/aclocal.m4: /opt/gnome/share/aclocal/gnome2-macros/compiler-flags.m4 /opt/gnome/share/aclocal/gnome2-macros/curses.m4 /opt/gnome/share/aclocal/gnome2-macros/gnome-common.m4 /opt/gnome/share/aclocal/gnome2-macros/gnome-deprecated-macros.m4
diff --git a/parts/appwizard/common/gnu.kdevtemplate b/parts/appwizard/common/gnu.kdevtemplate
new file mode 100644
index 00000000..29e75291
--- /dev/null
+++ b/parts/appwizard/common/gnu.kdevtemplate
@@ -0,0 +1,5 @@
+[GNU]
+Type=install archive
+Source=%{kdevelop}/template-common/gnu.tar.gz
+Dest=%{dest}
+
diff --git a/parts/appwizard/common/gnu/AUTHORS b/parts/appwizard/common/gnu/AUTHORS
new file mode 100644
index 00000000..09a8c466
--- /dev/null
+++ b/parts/appwizard/common/gnu/AUTHORS
@@ -0,0 +1 @@
+%{AUTHOR} <%{EMAIL}>
diff --git a/parts/appwizard/common/gnu/COPYING b/parts/appwizard/common/gnu/COPYING
new file mode 100644
index 00000000..5b6e7c66
--- /dev/null
+++ b/parts/appwizard/common/gnu/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/parts/appwizard/common/gnu/ChangeLog b/parts/appwizard/common/gnu/ChangeLog
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/parts/appwizard/common/gnu/ChangeLog
diff --git a/parts/appwizard/common/gnu/INSTALL b/parts/appwizard/common/gnu/INSTALL
new file mode 100644
index 00000000..02a4a074
--- /dev/null
+++ b/parts/appwizard/common/gnu/INSTALL
@@ -0,0 +1,167 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes a while. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 4. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/parts/appwizard/common/gnu/NEWS b/parts/appwizard/common/gnu/NEWS
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/parts/appwizard/common/gnu/NEWS
diff --git a/parts/appwizard/common/gnu/README b/parts/appwizard/common/gnu/README
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/parts/appwizard/common/gnu/README
diff --git a/parts/appwizard/common/gnu/TODO b/parts/appwizard/common/gnu/TODO
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/parts/appwizard/common/gnu/TODO
diff --git a/parts/appwizard/common/hi16-app-app.png b/parts/appwizard/common/hi16-app-app.png
new file mode 100644
index 00000000..4ed606c1
--- /dev/null
+++ b/parts/appwizard/common/hi16-app-app.png
Binary files differ
diff --git a/parts/appwizard/common/hi32-app-app.png b/parts/appwizard/common/hi32-app-app.png
new file mode 100644
index 00000000..45ae1a11
--- /dev/null
+++ b/parts/appwizard/common/hi32-app-app.png
Binary files differ
diff --git a/parts/appwizard/common/incadmin.kdevtemplate b/parts/appwizard/common/incadmin.kdevtemplate
new file mode 100644
index 00000000..c94c2be5
--- /dev/null
+++ b/parts/appwizard/common/incadmin.kdevtemplate
@@ -0,0 +1,5 @@
+[INCADMIN]
+Type=install archive
+Source=%{kdevelop}/template-common/incadmin.tar.gz
+Dest=%{dest}
+Process=false
diff --git a/parts/appwizard/common/incadmin/config.guess b/parts/appwizard/common/incadmin/config.guess
new file mode 100755
index 00000000..5145e357
--- /dev/null
+++ b/parts/appwizard/common/incadmin/config.guess
@@ -0,0 +1,1363 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-10-21'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+ || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $files ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ;
+unset files'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ eval $set_cc_for_build
+ cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
+ if test "$?" = 0 ; then
+ case `$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
+ 3-1307)
+ UNAME_MACHINE="alphaev7"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy && rmdir $tmpdir
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ DRS?6000:UNIX_SV:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7 && exit 0 ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c \
+ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:*:*:PowerMAX_OS)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ fi ;;
+ esac
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+ rm -f $dummy.c $dummy && rmdir $tmpdir
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ # Determine whether the default compiler uses glibc.
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #if __GLIBC__ >= 2
+ LIBC=gnu
+ #else
+ LIBC=
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ rm -f $dummy.c && rmdir $tmpdir
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ x86:Interix*:3*)
+ echo i386-pc-interix3
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ rm -f $dummy.c && rmdir $tmpdir
+ test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ rm -f $dummy.c && rmdir $tmpdir
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/parts/appwizard/common/incadmin/config.sub b/parts/appwizard/common/incadmin/config.sub
new file mode 100755
index 00000000..1dea9b79
--- /dev/null
+++ b/parts/appwizard/common/incadmin/config.sub
@@ -0,0 +1,1470 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-09-05'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ns16k | ns32k \
+ | openrisc | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+ | clipper-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* \
+ | m32r-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39 | mipstx39el \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+ | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ or32 | or32-*)
+ basic_machine=or32-unknown
+ os=-coff
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i686-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3d)
+ basic_machine=alpha-cray
+ os=-unicos
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic4x | c4x*)
+ basic_machine=tic4x-unknown
+ os=-coff
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ windows32)
+ basic_machine=i386-pc
+ os=-windows32-msvcrt
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+ basic_machine=sh-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto*)
+ os=-nto-qnx
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/parts/appwizard/common/incadmin/depcomp b/parts/appwizard/common/incadmin/depcomp
new file mode 100755
index 00000000..4c20c6c9
--- /dev/null
+++ b/parts/appwizard/common/incadmin/depcomp
@@ -0,0 +1,441 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. This file always lives in the current directory.
+ # Also, the AIX compiler puts `$object:' at the start of each line;
+ # $object doesn't have directory information.
+ stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ outname="$stripped.o"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Must come before tru64.
+
+ # Intel's C compiler understands `-MD -MF file'. However
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 AIX compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+
+ tmpdepfile1="$object.d"
+ tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
+ if test "$libtool" = yes; then
+ "$@" -Wc,-MD
+ else
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile1"; then
+ tmpdepfile="$tmpdepfile1"
+ else
+ tmpdepfile="$tmpdepfile2"
+ fi
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a space and a tab in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ test -z "$dashmflag" && dashmflag=-M
+ ( IFS=" "
+ case " $* " in
+ *" --mode=compile "*) # this is libtool, let us make it quiet
+ for arg
+ do # cycle over the arguments
+ case "$arg" in
+ "--mode=compile")
+ # insert --quiet before "--mode=compile"
+ set fnord "$@" --quiet
+ shift # fnord
+ ;;
+ esac
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # "$arg"
+ done
+ ;;
+ esac
+ "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ # X makedepend
+ (
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in no)
+ set ""; shift
+ cleared=yes
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift;;
+ -*)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tail +3 "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ ( IFS=" "
+ case " $* " in
+ *" --mode=compile "*)
+ for arg
+ do # cycle over the arguments
+ case $arg in
+ "--mode=compile")
+ # insert --quiet before "--mode=compile"
+ set fnord "$@" --quiet
+ shift # fnord
+ ;;
+ esac
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # "$arg"
+ done
+ ;;
+ esac
+ "$@" -E |
+ sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ ( IFS=" "
+ case " $* " in
+ *" --mode=compile "*)
+ for arg
+ do # cycle over the arguments
+ case $arg in
+ "--mode=compile")
+ # insert --quiet before "--mode=compile"
+ set fnord "$@" --quiet
+ shift # fnord
+ ;;
+ esac
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # "$arg"
+ done
+ ;;
+ esac
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ ) &
+ proc=$!
+ "$@"
+ stat=$?
+ wait "$proc"
+ if test "$stat" != 0; then exit $stat; fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/parts/appwizard/common/incadmin/install-sh b/parts/appwizard/common/incadmin/install-sh
new file mode 100755
index 00000000..36f96f3e
--- /dev/null
+++ b/parts/appwizard/common/incadmin/install-sh
@@ -0,0 +1,276 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd=$cpprog
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "$0: no input file specified" >&2
+ exit 1
+else
+ :
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d "$dst" ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=$mkdirprog
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f "$src" ] || [ -d "$src" ]
+ then
+ :
+ else
+ echo "$0: $src does not exist" >&2
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "$0: no destination specified" >&2
+ exit 1
+ else
+ :
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d "$dst" ]
+ then
+ dst=$dst/`basename "$src"`
+ else
+ :
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+ '
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp=$pathcomp$1
+ shift
+
+ if [ ! -d "$pathcomp" ] ;
+ then
+ $mkdirprog "$pathcomp"
+ else
+ :
+ fi
+
+ pathcomp=$pathcomp/
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd "$dst" &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ dstfile=`basename "$dst" $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ :
+ fi
+
+# Make a couple of temp file names in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+ rmtmp=$dstdir/#rm.$$#
+
+# Trap to clean up temp files at exit.
+
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd "$src" "$dsttmp" &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
+
+# Now remove or move aside any old file at destination location. We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons. In this case, the final cleanup
+# might fail but the new file should still install successfully.
+
+{
+ if [ -f "$dstdir/$dstfile" ]
+ then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+ $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+ {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+} &&
+
+# Now rename the file to the real destination.
+
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+
+fi &&
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+
+{
+ (exit 0); exit
+}
diff --git a/parts/appwizard/common/incadmin/ltmain.sh b/parts/appwizard/common/incadmin/ltmain.sh
new file mode 100644
index 00000000..b36e997f
--- /dev/null
+++ b/parts/appwizard/common/incadmin/ltmain.sh
@@ -0,0 +1,6343 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5a
+TIMESTAMP=" (1.1240 2003/06/26 06:55:19)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo A|tr A '\301'` in
+ A) # EBCDIC based system
+ SP2NL="tr '\100' '\n'"
+ NL2SP="tr '\r\n' '\100\100'"
+ ;;
+ *) # Assume ASCII based system
+ SP2NL="tr '\040' '\012'"
+ NL2SP="tr '\015\012' '\040\040'"
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" "}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ $echo "$modename: not configured to build any kind of library" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+win32_libid () {
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+ grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 | \
+ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
+ if test "X$win32_nmres" = "Ximport" ; then
+ win32_libid_type="x86 archive import"
+ else
+ win32_libid_type="x86 archive static"
+ fi
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $echo $win32_libid_type
+}
+
+# End of Shell function definitions
+#####################################
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ tag)
+ tagname="$arg"
+
+ # Check whether tagname contains only valid characters
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ $echo "$progname: invalid tag name: $tagname" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $tagname in
+ CC)
+ # Don't test for the "default" C tag, as we know, it's there, but
+ # not specially marked.
+ ;;
+ *)
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
+ taglist="$taglist $tagname"
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
+ else
+ $echo "$progname: ignoring unknown tag $tagname" 1>&2
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ $echo
+ $echo "Copyright (C) 2003 Free Software Foundation, Inc."
+ $echo "This is free software; see the source for copying conditions. There is NO"
+ $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+ exit 0
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
+ done
+ exit 0
+ ;;
+
+ --debug)
+ $echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ $echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ $echo "enable shared libraries"
+ else
+ $echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ $echo "enable static libraries"
+ else
+ $echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ --tag) prevopt="--tag" prev=tag ;;
+ --tag=*)
+ set tag "$optarg" ${1+"$@"}
+ shift
+ prev=tag
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+ $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
+ case $nonopt in
+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_output=
+ arg_mode=normal
+ libobj=
+
+ for arg
+ do
+ case "$arg_mode" in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test -n "$libobj" ; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ arg_mode=target
+ continue
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ base_compile="$base_compile $lastarg"
+ continue
+ ;;
+
+ * )
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ case $lastarg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ base_compile="$base_compile $lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ $echo "$modename: you must specify an argument for -Xcompile"
+ exit 1
+ ;;
+ target)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ *)
+ # Get the name of the library object.
+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSifmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.ii) xform=ii ;;
+ *.class) xform=class ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ *.java) xform=java ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Infer tagged configuration to use if any are available and
+ # if one wasn't chosen via the "--tag" command line option.
+ # Only attempt this if the compiler in the base compile
+ # command doesn't match the default compiler.
+ if test -n "$available_tags" && test -z "$tagname"; then
+ case $base_compile in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+ case "$base_compile " in
+ "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit 1
+# else
+# $echo "$modename: using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+
+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir=
+ else
+ xdir=$xdir/
+ fi
+ lobj=${xdir}$objdir/$objname
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ $echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ $run $rm "$libobj" "${libobj}T"
+
+ # Create a libtool object file (analogous to a ".la" file),
+ # but don't create it if we're doing a dry run.
+ test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $srcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $srcfile"
+ fi
+
+ if test ! -d "${xdir}$objdir"; then
+ $show "$mkdir ${xdir}$objdir"
+ $run $mkdir ${xdir}$objdir
+ status=$?
+ if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $status
+ fi
+ fi
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ command="$command -o $lobj"
+ fi
+
+ $run $rm "$lobj" "$output_obj"
+
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ $show "$mv $output_obj $lobj"
+ if $run $mv $output_obj $lobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the PIC object to the libtool object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ else
+ # No PIC object so indicate it doesn't exist in the libtool
+ # object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $srcfile"
+ else
+ command="$base_compile $srcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$obj" "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+ else
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+ fi
+
+ $run $mv "${libobj}T" "${libobj}"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ base_compile="$nonopt"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ add_flags=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ base_compile="$base_compile $arg"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat $save_arg`
+ do
+# moreargs="$moreargs $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit 1
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ done
+ else
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit 1
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ xcclinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ exit 1
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-freebsd*-gnu*)
+ # prevent being parsed by the freebsd regexp below
+ ;;
+ *-*-mingw* | *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ deplibs="$deplibs -framework System"
+ continue
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-freebsd*-gnu*)
+ # prevent being parsed by the freebsd regexp below
+ ;;
+ *-*-openbsd*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # gcc -m* arguments should be passed to the linker via $compiler_flags
+ # in order to pass architecture information to the linker
+ # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
+ # but this is not reliable with gcc because gcc may use -mfoo to
+ # select a different linker, different libraries, etc, while
+ # -Wl,-mfoo simply passes -mfoo to the linker.
+ -m*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ if test "$with_gcc" = "yes" ; then
+ compiler_flags="$compiler_flags $arg"
+ fi
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # in order for the loader to find any dlls it needs.
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ add_flags="$add_flags $arg"
+ ;;
+
+ *.$objext)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit 1
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit 1
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ add_flags="$add_flags $arg"
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Infer tagged configuration to use if any are available and
+ # if one wasn't chosen via the "--tag" command line option.
+ # Only attempt this if the compiler in the base link
+ # command doesn't match the default compiler.
+ if test -n "$available_tags" && test -z "$tagname"; then
+ case $base_compile in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
+ case $base_compile in
+ "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
+ # The compiler in $compile_command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit 1
+# else
+# $echo "$modename: using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ case $host in
+ *cygwin* | *mingw* | *pw32*)
+ # don't eliminate duplcations in $postdeps and $predeps
+ duplicate_compiler_generated_deps=yes
+ ;;
+ *)
+ duplicate_compiler_generated_deps=$duplicate_deps
+ ;;
+ esac
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+ esac
+ pre_post_deps="$pre_post_deps $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ continue
+ fi
+ if test "$pass" = conv && test "$allow_undefined" = yes; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ for search_ext in .la $shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if (${SED} -e '2q' $lib |
+ grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ library_names=
+ old_library=
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ ;;
+ *)
+ $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ if test "$deplibs_check_method" != pass_all; then
+ $echo
+ $echo "*** Warning: Trying to link with static lib archive $deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because the file extensions .$libext of this argument makes me believe"
+ $echo "*** that it is just a static archive that I should not used here."
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the"
+ $echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib'" 1>&2
+ exit 1
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ #echo "Adding $deplib to \$deplibs"
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit 1
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit 1
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit 1
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit 1
+ fi
+ if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ dlprefiles="$dlprefiles $lib $dependency_libs"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit 1
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on some systems (darwin)
+ if test "$shouldnotlink" = yes && test "$pass" = link ; then
+ $echo
+ if test "$linkmode" = prog; then
+ $echo "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $echo "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $echo "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ eval cmds=\"$extract_expsyms_cmds\"
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ eval cmds=\"$old_archive_from_expsyms_cmds\"
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5* ) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a module then we can not link against it, someone
+ # is ignoring the new warnings I added
+ if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
+ $echo "** Warning, lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ $echo
+ $echo "** And there doesn't seem to be a static archive available"
+ $echo "** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ $echo
+ $echo "*** Warning: This system can not link to static lib archive $lib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ $echo "*** But as you try to build a module library, libtool will still create "
+ $echo "*** a static module, that should work as long as the dlopening application"
+ $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ #if test -n "$dependency_libs" &&
+ # { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
+ # test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ #fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ if test "$absdir" != "$libdir"; then
+ # Sure, some shells/systems don't implement the -ef.
+ # Those will have to live with the warning.
+ test "$absdir" -ef "$libdir" > /dev/null 2>&1 ||
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="$absdir"
+ fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ # we do not want to link against static libs, but need to link against shared
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$path/$depdepl" ; then
+ depdepl="$path/$depdepl"
+ fi
+ # do not add paths which are already there
+ case " $newlib_search_path " in
+ *" $path "*) ;;
+ *) newlib_search_path="$newlib_search_path $path";;
+ esac
+ path=""
+ fi
+ ;;
+ *)
+ path="-L$path"
+ ;;
+ esac
+
+ ;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ # Again, we only want to link against shared libraries
+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+ for tmp in $newlib_search_path ; do
+ if test -f "$tmp/lib$tmp_libs.dylib" ; then
+ eval depdepl="$tmp/lib$tmp_libs.dylib"
+ break
+ fi
+ done
+ path=""
+ ;;
+ *) continue ;;
+ esac
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$deplibs $depdepl" ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$deplibs $path" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ tmp_libs="$tmp_libs $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ objs="$objs$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval shared_ext=\"$shrext\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval shared_ext=\"$shrext\"
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit 1
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the non-libtool"
+ $echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
+ fi
+ fi
+
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test "$#" -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$2"
+ number_minor="$3"
+ number_revision="$4"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ darwin|linux|osf|windows)
+ current=`expr $number_major + $number_minor`
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ current=`expr $number_major + $number_minor - 1`
+ age="$number_minor"
+ revision="$number_minor"
+ ;;
+ esac
+ ;;
+ no)
+ current="$2"
+ revision="$3"
+ age="$4"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $revision in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $age in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ irix | nonstopux)
+ major=`expr $current - $age + 1`
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=.`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+ fi
+
+ if test "$mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$echo "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ removelist="$removelist $p"
+ ;;
+ *) ;;
+ esac
+ done
+ if test -n "$removelist"; then
+ $show "${rm}r $removelist"
+ $run ${rm}r $removelist
+ fi
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ for path in $notinst_path; do
+ lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+ deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+ dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+ done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ if true || test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) dlfiles="$dlfiles $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-freebsd*-gnu*)
+ # Prevent $arg from being parsed by the freebsd regexp below.
+ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $LTCC -o conftest conftest.c $deplibs
+ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" -ne "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which I believe you do not have"
+ $echo "*** because a test_compile did reveal that the linker did not use it for"
+ $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ $rm conftest
+ $LTCC -o conftest conftest.c $i
+ # Did it work?
+ if test "$?" -eq 0 ; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because a test_compile did reveal that the linker did not use this one"
+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning! Library $i is needed by this library but I was not able to"
+ $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** library that it depends on before this library will be fully"
+ $echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval $echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+ done
+ fi
+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
+ | grep . >/dev/null; then
+ $echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ $echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ $echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ $echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ $echo
+ $echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $echo "*** dependencies of module $libname. Therefore, libtool will create"
+ $echo "*** a static module, that should work as long as the dlopening"
+ $echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ $echo "*** The inter-library dependencies that have been dropped here will be"
+ $echo "*** automatically added whenever a program is linked with this library"
+ $echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ $echo
+ $echo "*** Since this library must not contain undefined symbols,"
+ $echo "*** because either the platform does not support them or"
+ $echo "*** it was explicitly requested with -no-undefined,"
+ $echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && test "$fast_install" = no && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ if len=`expr "X$cmd" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "$mkdir $xdir"
+ $run $mkdir "$xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ # We will extract separately just the conflicting names and we will no
+ # longer touch any unique names. It is faster to leave these extract
+ # automatically by $AR in one run.
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+ if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+ $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+ $AR t "$xabs" | sort | uniq -cd | while read -r count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+ $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ fi
+
+ libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Add all flags from the command line. We here create a library,
+ # but those flags were only added to compile_command and
+ # finalize_command, which are only used when creating executables.
+ # So do it by hand here.
+ compiler_flags="$compiler_flags $add_flags"
+ # Only add it to commands which use CC, instead of LD, i.e.
+ # only to $compiler_flags
+ #linker_flags="$linker_flags $add_flags"
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval cmds=\"$module_expsym_cmds\"
+ else
+ eval cmds=\"$module_cmds\"
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ delfiles=
+ last_robj=
+ k=1
+ output=$output_objdir/$save_output-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len"; }; then
+ objlist="$objlist $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+ fi
+ last_robj=$output_objdir/$save_output-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$save_output-${k}.$objext
+ objlist=$obj
+ len=1
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ if ${skipped_export-false}; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+ fi
+
+ # Set up a command to remove the reloadale object files
+ # after they are used.
+ i=0
+ while test "$i" -lt "$k"
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
+ done
+
+ $echo "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ eval cmds=\"$archive_cmds\"
+ fi
+
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~$rm $delfiles\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+ exit 0
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case $output in
+ *.lo)
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "$mkdir $xdir"
+ $run $mkdir "$xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ # We will extract separately just the conflicting names and we will no
+ # longer touch any unique names. It is faster to leave these extract
+ # automatically by $AR in one run.
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+ if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+ $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+ $AR t "$xabs" | sort | uniq -cd | while read -r count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+ $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ fi
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
+ ;;
+ esac
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval '$echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ # AIX runtime linking requires linking programs with -Wl,-brtl and libs with -Wl,-G
+ # Also add -bnolibpath to the beginning of the link line, to clear the hardcoded runpath.
+ # Otherwise, things like the -L path to libgcc.a are accidentally hardcoded by ld.
+ # This does not apply on AIX for ia64, which uses a SysV linker.
+ case "$host" in
+ ia64-*-aix5*) ;;
+ *-*-aix4* | *-*-aix5*)
+ compile_command=`$echo "X$compile_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"`
+ finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;;
+ esac
+
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit 0
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case $0 in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ cwrappersource=`$echo ${objdir}/lt-${output}.c`
+ cwrapper=`$echo ${output}.exe`
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
+
+ cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "/bin/sh $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+#define DIR_SEPARATOR '/'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#ifndef DIR_SEPARATOR_2
+#define DIR_SEPARATOR_2 '\\'
+#endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+char * basename (const char *name);
+char * fnqualify(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int i;
+
+ program_name = (char *) xstrdup ((char *) basename (argv[0]));
+ newargz = XMALLOC(char *, argc+2);
+EOF
+
+ cat >> $cwrappersource <<EOF
+ newargz[0] = "$SHELL";
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = fnqualify(argv[0]);
+ /* we know the script has the same name, without the .exe */
+ /* so make sure newargz[1] doesn't end in .exe */
+ strendzap(newargz[1],".exe");
+ for (i = 1; i < argc; i++)
+ newargz[i+1] = xstrdup(argv[i]);
+ newargz[argc+1] = NULL;
+EOF
+
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",newargz);
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+ void * p = (void *) malloc (num);
+ if (!p)
+ lt_fatal ("Memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+char *
+basename (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha (name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return (char *) base;
+}
+
+char *
+fnqualify(const char *path)
+{
+ size_t size;
+ char *p;
+ char tmp[LT_PATHMAX + 1];
+
+ assert(path != NULL);
+
+ /* Is it qualified already? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha (path[0]) && path[1] == ':')
+ return xstrdup (path);
+#endif
+ if (IS_DIR_SEPARATOR (path[0]))
+ return xstrdup (path);
+
+ /* prepend the current directory */
+ /* doesn't handle '~' */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
+ p = XMALLOC(char, size);
+ sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
+ return p;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert(str != NULL);
+ assert(pat != NULL);
+
+ len = strlen(str);
+ patlen = strlen(pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp(str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+ const char * message, va_list ap)
+{
+ fprintf (stderr, "%s: %s: ", program_name, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+EOF
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ $echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ $echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ exec \$progdir/\$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "$mkdir $xdir"
+ $run $mkdir "$xdir"
+ status=$?
+ if test "$status" -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ # We will extract separately just the conflicting names and we will no
+ # longer touch any unique names. It is faster to leave these extract
+ # automatically by $AR in one run.
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+ if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
+ $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
+ $AR t "$xabs" | sort | uniq -cd | while read -r count name
+ do
+ i=1
+ while test "$i" -le "$count"
+ do
+ # Put our $i before any first dot (extension)
+ # Never overwrite any file
+ name_to="$name"
+ while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
+ do
+ name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
+ done
+ $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
+ $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
+ i=`expr $i + 1`
+ done
+ done
+ fi
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ compiler_flags="$compiler_flags $add_flags"
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ eval cmds=\"$old_archive_cmds\"
+
+ if len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # the command line is too long to link in one step, link in parts
+ $echo "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ # GNU ar 2.10+ was changed to match POSIX; thus no paths are
+ # encoded into archives. This makes 'ar r' malfunction in
+ # this piecewise linking case whenever conflicting object
+ # names appear in distinct ar calls; check, warn and compensate.
+ if (for obj in $save_oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
+ $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
+ AR_FLAGS=cq
+ fi
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ for obj in $save_oldobjs
+ do
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~$old_archive_cmds\"
+ fi
+ fi
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes && test "$fast_install" = no; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit 1
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit 1
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # To insure that "foo" is sourced, and not "foo.exe",
+ # finese the cygwin/MSYS system by explicitly sourcing "foo."
+ # which disallows the automatic-append-.exe behavior.
+ case $build in
+ *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+ *) wrapperdot=${wrapper} ;;
+ esac
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . ${wrapperdot} ;;
+ *) . ./${wrapperdot} ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # To insure that "foo" is sourced, and not "foo.exe",
+ # finese the cygwin/MSYS system by explicitly sourcing "foo."
+ # which disallows the automatic-append-.exe behavior.
+ case $build in
+ *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
+ *) wrapperdot=${wrapper} ;;
+ esac
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . ${wrapperdot} ;;
+ *) . ./${wrapperdot} ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyways
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $0 --finish$current_libdirs'
+ else
+ exit 0
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ exit 0
+
+ $echo "----------------------------------------------------------------------"
+ $echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $echo " $libdir"
+ done
+ $echo
+ $echo "If you ever happen to want to link against installed libraries"
+ $echo "in a given directory, LIBDIR, you must either use libtool, and"
+ $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ $echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ $echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $echo
+ $echo "See any operating system documentation about shared libraries for"
+ $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ $echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ rmdirs=
+
+ origobjdir="$objdir"
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$origobjdir"
+ else
+ objdir="$dir/$origobjdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+ test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+ if test "$mode" = uninstall; then
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+ # Read the .lo file
+ . $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" \
+ && test "$pic_object" != none; then
+ rmfiles="$rmfiles $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" \
+ && test "$non_pic_object" != none; then
+ rmfiles="$rmfiles $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ noexename=`$echo $name|${SED} 's,.exe$,,'`
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ rmfiles="$rmfiles $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$noexename
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+ objdir="$origobjdir"
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit 1
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --tag=TAG use configuration variables from tag TAG
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+ exit 0
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/parts/appwizard/common/incadmin/missing b/parts/appwizard/common/incadmin/missing
new file mode 100755
index 00000000..6a37006e
--- /dev/null
+++ b/parts/appwizard/common/incadmin/missing
@@ -0,0 +1,336 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing 0.4 - GNU automake"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal*)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1Help2man' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+ # We have makeinfo, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ tar)
+ shift
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ fi
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/parts/appwizard/common/incadmin/mkinstalldirs b/parts/appwizard/common/incadmin/mkinstalldirs
new file mode 100755
index 00000000..d2d5f21b
--- /dev/null
+++ b/parts/appwizard/common/incadmin/mkinstalldirs
@@ -0,0 +1,111 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage" 1>&2
+ exit 0
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+case $dirmode in
+ '')
+ if mkdir -p -- . 2>/dev/null; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ fi
+ ;;
+esac
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=""
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# End:
+# mkinstalldirs ends here
diff --git a/parts/appwizard/common/kde-Makefile.am b/parts/appwizard/common/kde-Makefile.am
new file mode 100644
index 00000000..06057100
--- /dev/null
+++ b/parts/appwizard/common/kde-Makefile.am
@@ -0,0 +1,22 @@
+SUBDIRS = $(TOPSUBDIRS)
+
+$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
+ cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
+
+$(top_srcdir)/subdirs:
+ cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
+
+$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
+ @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4
+
+MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
+
+package-messages:
+ cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
+ $(MAKE) -C po merge
+
+EXTRA_DIST = admin %{LICENSEFILE} configure.in.in
+
+dist-hook:
+ cd $(top_distdir) && perl admin/am_edit -padmin
+ cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
diff --git a/parts/appwizard/common/kde-Makefile.cvs b/parts/appwizard/common/kde-Makefile.cvs
new file mode 100644
index 00000000..4c0afd1a
--- /dev/null
+++ b/parts/appwizard/common/kde-Makefile.cvs
@@ -0,0 +1,10 @@
+all:
+ @echo "This Makefile is only for the CVS repository"
+ @echo "This will be deleted before making the distribution"
+ @echo ""
+ $(MAKE) -f admin/Makefile.common cvs
+
+dist:
+ $(MAKE) -f admin/Makefile.common dist
+
+.SILENT:
diff --git a/parts/appwizard/common/kde-app.desktop b/parts/appwizard/common/kde-app.desktop
new file mode 100644
index 00000000..7389904a
--- /dev/null
+++ b/parts/appwizard/common/kde-app.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Name=%{APPNAME}
+Exec=%{APPNAMELC} %i -caption "%c"
+Icon=%{APPNAMELC}
+Type=Application
+X-DocPath=%{APPNAMELC}/%{APPNAMELC}.html
+Comment=A KDE KPart Application
+Comment[br]=Ur meziant Kpart evit KDE
+Comment[ca]=Una aplicació KPart per al KDE
+Comment[cy]=Cymhwysiad KPart KDE
+Comment[da]=Et KDE KPart-program
+Comment[de]=Eine auf der Komponententechnik KPart basierende KDE-Anwendung
+Comment[el]=Μια εφαρμογή KPart του KDE
+Comment[es]=Una aplicación KPart de KDE
+Comment[et]=KDE KPart rakendus
+Comment[eu]=KDE KPart aplikazio bat
+Comment[fa]=یک کاربرد KDE KPart
+Comment[fr]=Une application KPart pour KDE
+Comment[ga]=Feidhmchlár KPart KDE
+Comment[gl]=Unha aplicación KPart de KDE
+Comment[hi]=एक केडीई के-पार्ट अनुप्रयोग
+Comment[hu]=KPart-alapú KDE-alkalmazás
+Comment[is]=KDE KPart forrit
+Comment[it]=Applicazione KPart di KDE
+Comment[ja]=KDE KPart アプリケーション
+Comment[lt]=KDE KPart programa
+Comment[nds]=En KPart-Deelprogramm för KDE
+Comment[ne]=एउटा केडीई KPart अनुप्रयोग
+Comment[nl]=Een KDE KPart-toepassing
+Comment[pl]=Osadzalny element KPart KDE
+Comment[pt]=Uma Aplicação KPart do KDE
+Comment[pt_BR]=Um Aplicativo KPart do KDE
+Comment[ru]=Приложение KPart для KDE
+Comment[sk]=KDE KPart aplikácia
+Comment[sl]=Program KPart za KDE
+Comment[sr]=KDE KPart програм
+Comment[sr@Latn]=KDE KPart program
+Comment[sv]=Ett KDE Kpart-program
+Comment[ta]=கெடி கெபார்ட் பயன்பாடு
+Comment[tg]=Ба кор андохтани KPart барои KDE
+Comment[tr]=Bir KDE KPart Uygulaması
+Comment[zh_CN]=一个 KDE KPart 应用程序
+Comment[zh_TW]=KDE KPart 應用程式
+Terminal=false
diff --git a/parts/appwizard/common/kde-app.lsm b/parts/appwizard/common/kde-app.lsm
new file mode 100644
index 00000000..54a725e6
--- /dev/null
+++ b/parts/appwizard/common/kde-app.lsm
@@ -0,0 +1,16 @@
+Begin3
+Title: %{APPNAME} -- Some description
+Version: %{VERSION}
+Entered-date:
+Description:
+Keywords: KDE Qt
+Author: %{AUTHOR} <%{EMAIL}>
+Maintained-by: %{AUTHOR} <%{EMAIL}>
+Home-page:
+Alternate-site:
+Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
+ xxxxxx %{APPNAMELC}-%{VERSION}.tar.gz
+ xxx %{APPNAMELC}-%{VERSION}.lsm
+Platform: Linux. Needs KDE
+Copying-policy: %{LICENSE}
+End
diff --git a/parts/appwizard/common/kde-configure.in.in b/parts/appwizard/common/kde-configure.in.in
new file mode 100644
index 00000000..f1244521
--- /dev/null
+++ b/parts/appwizard/common/kde-configure.in.in
@@ -0,0 +1,6 @@
+#MIN_CONFIG(3.2.0)
+
+AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION})
+AC_C_BIGENDIAN
+AC_CHECK_KDEMAXPATHLEN
+
diff --git a/parts/appwizard/common/kde-doc-Makefile.am b/parts/appwizard/common/kde-doc-Makefile.am
new file mode 100644
index 00000000..a1f777a1
--- /dev/null
+++ b/parts/appwizard/common/kde-doc-Makefile.am
@@ -0,0 +1,6 @@
+# the SUBDIRS is filled automatically by am_edit. If files are
+# in this directory they are installed into the english dir
+
+KDE_LANG = en
+KDE_DOCS = %{APPNAMELC}
+SUBDIRS = $(AUTODIRS)
diff --git a/parts/appwizard/common/kde-doc-en-Makefile.am b/parts/appwizard/common/kde-doc-en-Makefile.am
new file mode 100644
index 00000000..bdd63b79
--- /dev/null
+++ b/parts/appwizard/common/kde-doc-en-Makefile.am
@@ -0,0 +1,2 @@
+KDE_DOCS = %{APPNAMELC}
+KDE_LANG = en
diff --git a/parts/appwizard/common/kde-index.docbook b/parts/appwizard/common/kde-index.docbook
new file mode 100644
index 00000000..036d8dba
--- /dev/null
+++ b/parts/appwizard/common/kde-index.docbook
@@ -0,0 +1,555 @@
+<?xml version="1.0" ?>
+<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
+ <!ENTITY %{APPNAMELC} "<application>%{APPNAME} %{VERSION}</application>">
+ <!ENTITY kappname "&%{APPNAMELC};"><!-- Do *not* replace kappname-->
+ <!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc -->
+ <!ENTITY % addindex "IGNORE">
+ <!ENTITY % English "INCLUDE"><!-- change language only here -->
+
+
+ <!-- Do not define any other entities; instead, use the entities
+ from kde-genent.entities and $LANG/user.entities. -->
+]>
+<!-- kdoctemplate v0.8 October 1 1999
+ Minor update to "Credits and Licenses" section on August 24, 2000
+ Removed "Revision history" section on 22 January 2001
+ Changed to Installation/Help menu entities 18 October 2001
+ Other minor cleanup and changes 18 October 2001 -->
+
+
+<!--
+This template was designed by: David Rugge davidrugge@mindspring.com
+with lots of help from: Eric Bischoff ebisch@cybercable.tm.fr
+and Frederik Fouvry fouvry@sfs.nphil.uni-tuebingen.de
+of the KDE DocBook team.
+
+You may freely use this template for writing any sort of KDE documentation.
+If you have any changes or improvements, please let us know.
+
+Remember:
+- in XML, the case of the <tags> and attributes is relevant ;
+- also, quote all attributes.
+
+Please don't forget to remove all these comments in your final documentation,
+thanks ;-).
+-->
+
+<!-- ................................................................ -->
+
+<!-- The language must NOT be changed here. -->
+
+<book lang="&language;">
+
+<!-- This header contains all of the meta-information for the document such
+as Authors, publish date, the abstract, and Keywords -->
+
+<bookinfo>
+<title>The &%{APPNAMELC}; Handbook</title>
+
+<authorgroup>
+<author>
+<firstname></firstname>
+<othername></othername>
+<surname>%{AUTHOR}</surname>
+<affiliation>
+<address><email>%{EMAIL}</email></address>
+</affiliation>
+</author>
+</authorgroup>
+
+<!-- TRANS:ROLES_OF_TRANSLATORS -->
+
+<copyright>
+<year>1999</year>
+<year>%{YEAR}</year>
+<holder>%{AUTHOR}</holder>
+</copyright>
+<!-- Translators: put here the copyright notice of the translation -->
+<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
+ and in the FDL itself on how to use it. -->
+<legalnotice>&FDLNotice;</legalnotice>
+
+<!-- Date and version information of the documentation
+Don't forget to include this last date and this last revision number, we
+need them for translation coordination !
+Please respect the format of the date (YYYY-MM-DD) and of the version
+(V.MM.LL), it could be used by automation scripts.
+Do NOT change these in the translation. -->
+
+<date>2001-10-18</date>
+<releaseinfo>%{VERSION}</releaseinfo>
+
+<!-- Abstract about this handbook -->
+
+<abstract>
+<para>
+&%{APPNAMELC}; is an application specially designed to do nothing you would
+ever want.
+</para>
+</abstract>
+
+<!-- This is a set of Keywords for indexing by search engines.
+Please at least include KDE, the KDE package it is in, the name
+ of your application, and a few relevant keywords. -->
+
+<keywordset>
+<keyword>KDE</keyword>
+<keyword>%{APPNAME}</keyword>
+<keyword>nothing</keyword>
+<keyword>nothing else</keyword>
+</keywordset>
+
+</bookinfo>
+
+<!-- The contents of the documentation begin here. Label
+each chapter so with the id attribute. This is necessary for two reasons: it
+allows you to easily reference the chapter from other chapters of your
+document, and if there is no ID, the name of the generated HTML files will vary
+from time to time making it hard to manage for maintainers and for the CVS
+system. Any chapter labelled (OPTIONAL) may be left out at the author's
+discretion. Other chapters should not be left out in order to maintain a
+consistent documentation style across all KDE apps. -->
+
+<chapter id="introduction">
+<title>Introduction</title>
+
+<!-- The introduction chapter contains a brief introduction for the
+application that explains what it does and where to report
+problems. Basically a long version of the abstract. Don't include a
+revision history. (see installation appendix comment) -->
+
+<para>
+&%{APPNAMELC}; is a program that lets you do absolutely nothing. Please report
+any problems or feature requests to the &kde; mailing lists.
+</para>
+</chapter>
+
+<chapter id="using-%{APPNAMELC}">
+<title>Using &%{APPNAMELC};</title>
+
+<!-- This chapter should tell the user how to use your app. You should use as
+many sections (Chapter, Sect1, Sect3, etc...) as is necessary to fully document
+your application. -->
+
+<para>
+
+<!-- Note that all graphics should be in .png format. Use no gifs because of
+patent issues. -->
+
+<screenshot>
+<screeninfo>Here's a screenshot of &%{APPNAMELC};</screeninfo>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="screenshot.png" format="PNG"/>
+ </imageobject>
+ <imageobject>
+ <imagedata fileref="screenshot.eps" format="EPS"/>
+ </imageobject>
+ <textobject>
+ <phrase>Screenshot</phrase>
+ </textobject>
+ </mediaobject>
+</screenshot>
+</para>
+
+
+<sect1 id="%{APPNAMELC}-features">
+<title>More &%{APPNAMELC}; features</title>
+
+<para>It slices! It dices! and it comes with a free toaster!</para>
+<para>
+The Squiggle Tool <guiicon><inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="squiggle.png" format="PNG"/>
+ </imageobject>
+ <imageobject>
+ <imagedata fileref="squiggle.eps" format="EPS"/>
+ </imageobject>
+ <textobject>
+ <phrase>Squiggle</phrase>
+ </textobject>
+</inlinemediaobject></guiicon> is used to draw squiggly lines all over
+the &%{APPNAMELC}; main window. It's not a bug, it's a feature!
+</para>
+
+</sect1>
+</chapter>
+
+<chapter id="commands">
+<title>Command Reference</title>
+
+<!-- (OPTIONAL, BUT RECOMMENDED) This chapter should list all of the
+application windows and their menubar and toolbar commands for easy reference.
+Also include any keys that have a special function but have no equivalent in the
+menus or toolbars. This may not be necessary for small apps or apps with no tool
+or menu bars. -->
+
+<sect1 id="%{APPNAMELC}-mainwindow">
+<title>The main &%{APPNAMELC}; window</title>
+
+<sect2>
+<title>The File Menu</title>
+<para>
+<variablelist>
+<varlistentry>
+<term><menuchoice>
+<shortcut>
+<keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
+</shortcut>
+<guimenu>File</guimenu>
+<guimenuitem>New</guimenuitem>
+</menuchoice></term>
+<listitem><para><action>Creates a new document</action></para></listitem>
+</varlistentry>
+<varlistentry>
+<term><menuchoice>
+<shortcut>
+<keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo>
+</shortcut>
+<guimenu>File</guimenu>
+<guimenuitem>Save</guimenuitem>
+</menuchoice></term>
+<listitem><para><action>Saves the document</action></para></listitem>
+</varlistentry>
+<varlistentry>
+<term><menuchoice>
+<shortcut>
+<keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo>
+</shortcut>
+<guimenu>File</guimenu>
+<guimenuitem>Quit</guimenuitem>
+</menuchoice></term>
+<listitem><para><action>Quits</action> &%{APPNAMELC};</para></listitem>
+</varlistentry>
+</variablelist>
+</para>
+
+</sect2>
+
+<sect2>
+<title>The <guimenu>Help</guimenu> Menu</title>
+
+<!-- Assuming you have a standard help menu (help, what's this, about -->
+<!-- &%{APPNAMELC};, about KDE) then the documentation is already written. -->
+<!-- The following entity is valid anywhere that a variablelist is -->
+<!-- valid. -->
+
+&help.menu.documentation;
+
+</sect2>
+
+</sect1>
+</chapter>
+
+<chapter id="developers">
+<title>Developer's Guide to &%{APPNAMELC};</title>
+
+<!-- (OPTIONAL) A Programming/Scripting reference chapter should be
+used for apps that use plugins or that provide their own scripting hooks
+and/or development libraries. -->
+
+<para>
+Programming &%{APPNAMELC}; plugins is a joy to behold. Just read through the next
+66 pages of API's to learn how!
+</para>
+
+<!-- Use refentries to describe APIs. Refentries are fairly complicated and you
+should consult the docbook reference for further details. The example below was
+taken from that reference and shortened a bit for readability. -->
+
+<refentry id="re-1007-unmanagechildren-1">
+<refmeta>
+<refentrytitle>XtUnmanageChildren</refentrytitle>
+<refmiscinfo>Xt - Geometry Management</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>XtUnmanageChildren
+</refname>
+<refpurpose>remove a list of children from a parent widget's managed
+list.
+<indexterm id="ix-1007-unmanagechildren-1"><primary>widgets</primary><secondary>removing</secondary></indexterm>
+<indexterm id="ix-1007-unmanagechildren-2"><primary>XtUnmanageChildren</primary></indexterm>
+</refpurpose>
+
+</refnamediv>
+<refsynopsisdiv>
+<refsynopsisdivinfo>
+<date>4 March 1996</date>
+</refsynopsisdivinfo>
+<synopsis>
+void XtUnmanageChildren(<replaceable class="parameter">children</replaceable>, <replaceable class="parameter">num_children</replaceable>)
+ WidgetList <replaceable class="parameter">children</replaceable>;
+ Cardinal <replaceable class="parameter">num_children</replaceable>;
+</synopsis>
+
+<refsect2 id="r2-1007-unmanagechildren-1">
+<title>Inputs</title>
+<variablelist>
+<varlistentry>
+<term><replaceable class="parameter">children</replaceable>
+</term>
+<listitem>
+<para>Specifies an array of child widgets. Each child must be of
+class RectObj or any subclass thereof.
+</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term><replaceable class="parameter">num_children</replaceable>
+</term>
+<listitem>
+<para>Specifies the number of elements in <replaceable class="parameter">children</replaceable>.
+</para>
+</listitem>
+</varlistentry>
+</variablelist>
+</refsect2></refsynopsisdiv>
+
+<refsect1 id="r1-1007-unmanagechildren-1">
+<title>Description
+</title>
+<para><function>XtUnmanageChildren()</function> unmaps the specified widgets
+and removes them from their parent's geometry management.
+The widgets will disappear from the screen, and (depending
+on its parent) may no longer have screen space allocated for
+them.
+</para>
+<para>Each of the widgets in the <replaceable class="parameter">children</replaceable> array must have
+the same parent.
+</para>
+<para>See the &ldquo;Algorithm&rdquo; section below for full details of the
+widget unmanagement procedure.
+</para>
+</refsect1>
+
+<refsect1 id="r1-1007-unmanagechildren-2">
+<title>Usage</title>
+<para>Unmanaging widgets is the usual method for temporarily
+making them invisible. They can be re-managed with
+<function>XtManageChildren()</function>.
+</para>
+<para>You can unmap a widget, but leave it under geometry
+management by calling <function>XtUnmapWidget()</function>. You can
+destroy a widget's window without destroying the widget by
+calling <function>XtUnrealizeWidget()</function>. You can destroy a
+widget completely with <function>XtDestroyWidget()</function>.
+</para>
+<para>If you are only going to unmanage a single widget, it is
+more convenient to call <function>XtUnmanageChild()</function>. It is
+often more convenient to call <function>XtUnmanageChild()</function>
+several times than it is to declare and initialize an array
+of widgets to pass to <function>XtUnmanageChildren()</function>. Calling
+<function>XtUnmanageChildren()</function> is more efficient, however,
+because it only calls the parent's <function>change_managed()</function>
+method once.
+</para>
+</refsect1>
+
+<refsect1 id="r1-1007-unmanagechildren-3">
+<title>Algorithm
+</title>
+<para><function>XtUnmanageChildren()</function> performs the following:
+</para>
+<variablelist>
+<varlistentry>
+<term>-
+</term>
+<listitem>
+<para>Ignores the child if it already is unmanaged or is being
+destroyed.
+</para>
+</listitem>
+</varlistentry>
+<varlistentry>
+<term>-
+</term>
+<listitem>
+<para>Otherwise, if the child is realized, it makes it nonvisible
+by unmapping it.
+</para>
+</listitem>
+</varlistentry>
+</variablelist>
+<para>
+</para>
+</refsect1>
+
+<refsect1 id="r1-1007-unmanagechildren-4">
+<title>Structures</title>
+<para>The <type>WidgetList</type> type is simply an array of widgets:
+</para>
+<screen id="sc-1007-unmanagechildren-1">typedef Widget *WidgetList;
+</screen>
+</refsect1>
+</refentry>
+
+</chapter>
+
+<chapter id="faq">
+<title>Questions and Answers</title>
+
+<!-- (OPTIONAL but recommended) This chapter should include all of the silly
+(and not-so-silly) newbie questions that fill up your mailbox. This chapter
+should be reserved for BRIEF questions and answers! If one question uses more
+than a page or so then it should probably be part of the
+"Using this Application" chapter instead. You should use links to
+cross-reference questions to the parts of your documentation that answer them.
+This is also a great place to provide pointers to other FAQ's if your users
+must do some complicated configuration on other programs in order for your
+application work. -->
+
+&reporting.bugs;
+&updating.documentation;
+
+<qandaset id="faqlist">
+<qandaentry>
+<question>
+<para>My Mouse doesn't work. How do I quit &%{APPNAMELC};?</para>
+</question>
+<answer>
+<para>You silly goose! Check out the <link linkend="commands">Commands
+Section</link> for the answer.</para>
+</answer>
+</qandaentry>
+<qandaentry>
+<question>
+<para>Why can't I twiddle my documents?</para>
+</question>
+<answer>
+<para>You can only twiddle your documents if you have the foobar.lib
+installed.</para>
+</answer>
+</qandaentry>
+</qandaset>
+</chapter>
+
+<chapter id="credits">
+
+<!-- Include credits for the programmers, documentation writers, and
+contributors here. The license for your software should then be included below
+the credits with a reference to the appropriate license file included in the KDE
+distribution. -->
+
+<title>Credits and License</title>
+
+<para>
+&%{APPNAMELC};
+</para>
+<para>
+Program copyright %{YEAR} %{AUTHOR} <email>%{EMAIL}</email>
+</para>
+<para>
+Contributors:
+<itemizedlist>
+<listitem><para>Konqui the KDE Dragon <email>konqui@kde.org</email></para>
+</listitem>
+<listitem><para>Tux the Linux Penguin <email>tux@linux.org</email></para>
+</listitem>
+</itemizedlist>
+</para>
+
+<para>
+Documentation copyright %{YEAR} %{AUTHOR} <email>%{EMAIL}</email>
+</para>
+
+<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
+
+&underFDL; <!-- FDL: do not remove -->
+
+<!-- Determine which license your application is licensed under,
+ and delete all the remaining licenses below:
+
+ (NOTE: All documentation are licensed under the FDL,
+ regardless of what license the application uses) -->
+
+&underGPL; <!-- GPL License -->
+&underBSDLicense; <!-- BSD License -->
+&underArtisticLicense; <!-- BSD Artistic License -->
+&underX11License; <!-- X11 License -->
+
+</chapter>
+
+<appendix id="installation">
+<title>Installation</title>
+
+<sect1 id="getting-%{APPNAMELC}">
+<title>How to obtain &%{APPNAMELC};</title>
+
+<!-- This first entity contains boiler plate for applications that are
+part of KDE CVS. You should remove it if you are releasing your
+application -->
+
+&install.intro.documentation;
+
+</sect1>
+
+<sect1 id="requirements">
+<title>Requirements</title>
+
+<!--
+List any special requirements for your application here. This should include:
+.Libraries or other software that is not included in kdesupport,
+kdelibs, or kdebase.
+.Hardware requirements like amount of RAM, disk space, graphics card
+capabilities, screen resolution, special expansion cards, etc.
+.Operating systems the app will run on. If your app is designed only for a
+specific OS, (you wrote a graphical LILO configurator for example) put this
+information here.
+-->
+
+<para>
+In order to successfully use &%{APPNAMELC};, you need &kde; 1.1. Foobar.lib is
+required in order to support the advanced &%{APPNAMELC}; features. &%{APPNAMELC}; uses
+about 5 megs of memory to run, but this may vary depending on your
+platform and configuration.
+</para>
+
+<para>
+All required libraries as well as &%{APPNAMELC}; itself can be found
+on <ulink url="ftp://ftp.%{APPNAMELC}.org">The &%{APPNAMELC}; home page</ulink>.
+</para>
+
+<!-- For a list of updates, you may refer to the application web site
+or the ChangeLog file, or ... -->
+<para>
+You can find a list of changes at <ulink
+url="http://apps.kde.org/%{APPNAMELC}">http://apps.kde.org/%{APPNAMELC}</ulink>.
+</para>
+</sect1>
+
+<sect1 id="compilation">
+<title>Compilation and Installation</title>
+
+<!-- This entity contains the boilerplate text for standard -->
+<!-- compilation instructions. If your application requires any -->
+<!-- special handling, remove it, and replace with your own text. -->
+
+&install.compile.documentation;
+
+</sect1>
+
+<sect1 id="configuration">
+<title>Configuration</title>
+
+<para>Don't forget to tell your system to start the <filename>dtd</filename>
+dicer-toaster daemon first, or &%{APPNAMELC}; won't work !</para>
+
+</sect1>
+
+</appendix>
+
+&documentation.index;
+</book>
+
+<!--
+Local Variables:
+mode: sgml
+sgml-minimize-attributes:nil
+sgml-general-insert-case:lower
+sgml-indent-step:0
+sgml-indent-data:nil
+End:
+
+vim:tabstop=2:shiftwidth=2:expandtab
+-->
+
diff --git a/parts/appwizard/common/kde-part.desktop b/parts/appwizard/common/kde-part.desktop
new file mode 100644
index 00000000..01cc9d37
--- /dev/null
+++ b/parts/appwizard/common/kde-part.desktop
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Name=%{APPNAME}Part
+Name[br]=Perzh%{APPNAME}
+Name[ca]=Part per a %{APPNAME}
+Name[el]=Τμήμα%{APPNAME}
+Name[et]=%{APPNAME} komponent
+Name[fa]=جزء %{APPNAME}
+Name[gl]=%{APPNAME} Part
+Name[ja]=%{APPNAME} パート
+Name[ne]=%{APPNAME}भाग
+Name[pt_BR]=Parte %{APPNAME}
+Name[sv]=%{APPNAME}-del
+Name[ta]=%{APPNAME}பாகம்
+Name[tr]=%{APPNAME} Bileşeni
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
+ServiceTypes=KParts/ReadOnlyPart,KParts/ReadWritePart
+X-KDE-Library=lib%{APPNAMELC}part
+Type=Service
diff --git a/parts/appwizard/common/kde-po-Makefile.am b/parts/appwizard/common/kde-po-Makefile.am
new file mode 100644
index 00000000..0fa209cd
--- /dev/null
+++ b/parts/appwizard/common/kde-po-Makefile.am
@@ -0,0 +1 @@
+POFILES = AUTO
diff --git a/parts/appwizard/common/scons.kdevtemplate b/parts/appwizard/common/scons.kdevtemplate
new file mode 100644
index 00000000..7cf03e0b
--- /dev/null
+++ b/parts/appwizard/common/scons.kdevtemplate
@@ -0,0 +1,5 @@
+[SCONS]
+Type=install archive
+Source=%{kdevelop}/template-common/scons.tar.gz
+Dest=%{dest}
+Process=false
diff --git a/parts/appwizard/common/scons/admin/generic.py b/parts/appwizard/common/scons/admin/generic.py
new file mode 100644
index 00000000..55c37c90
--- /dev/null
+++ b/parts/appwizard/common/scons/admin/generic.py
@@ -0,0 +1,194 @@
+## Thomas Nagy, 2005
+
+"""
+Detect and store the most common options
+* kdecxxflags : debug=1 (-g) or debug=full (-g3, slower)
+ else use the user CXXFLAGS if any, - or -O2 by default
+* prefix : the installation path
+* extraincludes : a list of paths separated by ':'
+ie: scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
+"""
+
+BOLD ="\033[1m"
+RED ="\033[91m"
+GREEN ="\033[92m"
+YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
+CYAN ="\033[96m"
+NORMAL ="\033[0m"
+
+import os
+
+def exists(env):
+ return true
+
+def generate(env):
+ ## Bksys requires scons 0.96
+ env.EnsureSConsVersion(0, 96)
+
+ import sys
+ env['HELP']=0
+ if '--help' in sys.argv or '-h' in sys.argv or 'help' in sys.argv:
+ env['HELP']=1
+
+ if env['HELP']:
+ print """
+"""+BOLD+"""*** Generic options ***
+-----------------------"""+NORMAL+"""
+"""+BOLD+"""* debug """+NORMAL+""": debug=1 (-g) or debug=full (-g3, slower) else use environment CXXFLAGS, or -O2 by default
+"""+BOLD+"""* prefix """+NORMAL+""": the installation path
+"""+BOLD+"""* extraincludes """+NORMAL+""": a list of paths separated by ':'
+ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
+"""+NORMAL
+
+ ## Global cache directory
+ ## Put all project files in it so a rm -rf cache will clean up the config
+ if not env.has_key('CACHEDIR'):
+ env['CACHEDIR'] = os.getcwd()+'/cache/'
+ if not os.path.isdir(env['CACHEDIR']):
+ os.mkdir(env['CACHEDIR'])
+
+ ## SCons cache directory
+ ## this avoids recompiling the same files over and over again: very handy when working with cvs
+ env.CacheDir(os.getcwd()+'/cache/objects')
+
+ ## Avoid spreading .sconsign files everywhere - keep this line
+ env.SConsignFile(env['CACHEDIR']+'/scons_signatures')
+
+ # Special trick for installing rpms ...
+ env['DESTDIR']=''
+ if 'install' in sys.argv and os.environ.has_key('DESTDIR'):
+ env['DESTDIR']=os.environ['DESTDIR']+'/'
+ print CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR']
+
+ # load the options
+ from SCons.Options import Options, PathOption
+ cachefile=env['CACHEDIR']+'generic.cache.py'
+ opts = Options(cachefile)
+ opts.AddOptions(
+ ( 'KDECCFLAGS', 'C flags' ),
+ ( 'KDECXXFLAGS', 'debug level for the project : full or just anything' ),
+ ( 'KDELINKFLAGS', 'additional link flags' ),
+ ( 'PREFIX', 'prefix for installation' ),
+ ( 'EXTRAINCLUDES', 'extra include paths for the project' ),
+ ( 'ISCONFIGURED', 'is the project configured' ),
+ )
+ opts.Update(env)
+
+ # use this to avoid an error message 'how to make target configure ?'
+ env.Alias('configure', None)
+
+ import SCons.Util
+
+ if 'install' in sys.argv:
+ env['_INSTALL']=1
+ else:
+ env['_INSTALL']=0
+ if 'configure' in sys.argv:
+ env['_CONFIGURE']=1
+ else:
+ env['_CONFIGURE']=0
+
+ # configure the environment if needed
+ if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('ISCONFIGURED')):
+
+ import re
+ def makeHashTable(args):
+ table = { }
+ for arg in args:
+ if len(arg) > 1:
+ lst=arg.split('=')
+ if len(lst) < 2:
+ continue
+ key=lst[0]
+ value=lst[1]
+ if len(key) > 0 and len(value) >0:
+ table[key] = value
+ return table
+
+ env['ARGS']=makeHashTable(sys.argv)
+
+ # be paranoid, unset existing variables
+ if env.has_key('KDECXXFLAGS'):
+ env.__delitem__('KDECXXFLAGS')
+ if env.has_key('KDECCFLAGS'):
+ env.__delitem__('KDECCFLAGS')
+ if env.has_key('KDELINKFLAGS'):
+ env.__delitem__('KDELINKFLAGS')
+ if env.has_key('PREFIX'):
+ env.__delitem__('PREFIX')
+ if env.has_key('EXTRAINCLUDES'):
+ env.__delitem__('EXTRAINCLUDES')
+ if env.has_key('ISCONFIGURED'):
+ env.__delitem__('ISCONFIGURED')
+
+ if env['ARGS'].get('debug', None):
+ debuglevel = env['ARGS'].get('debug', None)
+ print CYAN+'** Enabling debug for the project **' + NORMAL
+ if (debuglevel == "full"):
+ env['KDECXXFLAGS'] = ['-DDEBUG', '-g3']
+ else:
+ env['KDECXXFLAGS'] = ['-DDEBUG', '-g']
+ else:
+ if os.environ.has_key('CXXFLAGS'):
+ # user-defined flags (gentooers will be elighted)
+ env['KDECXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
+ env.Append( KDECXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
+ else:
+ env.Append(KDECXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG'])
+
+ if os.environ.has_key('CFLAGS'):
+ env['KDECCFLAGS'] = SCons.Util.CLVar( os.environ['CFLAGS'] )
+
+ ## FreeBSD settings (contributed by will at freebsd dot org)
+ if os.uname()[0] == "FreeBSD":
+ if os.environ.has_key('PTHREAD_LIBS'):
+ env.AppendUnique( KDELINKFLAGS = SCons.Util.CLVar( os.environ['PTHREAD_LIBS'] ) )
+ else:
+ syspf = os.popen('/sbin/sysctl kern.osreldate')
+ osreldate = int(syspf.read().split()[1])
+ syspf.close()
+ if osreldate < 500016:
+ env.AppendUnique( KDELINKFLAGS = ['-pthread'])
+ env.AppendUnique( KDECXXFLAGS = ['-D_THREAD_SAFE'])
+ elif osreldate < 502102:
+ env.AppendUnique( KDELINKFLAGS = ['-lc_r'])
+ env.AppendUnique( KDECXXFLAGS = ['-D_THREAD_SAFE'])
+ else:
+ env.AppendUnique( KDELINKFLAGS = ['-pthread'])
+
+ # User-specified prefix
+ if env['ARGS'].get('prefix', None):
+ env['PREFIX'] = env['ARGS'].get('prefix', None)
+ print CYAN+'** set the installation prefix for the project : ' + env['PREFIX'] +' **'+ NORMAL
+ elif env.has_key('PREFIX'):
+ env.__delitem__('PREFIX')
+
+ # User-specified include paths
+ env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
+ if env['ARGS'].get('extraincludes', None):
+ print CYAN+'** set extra include paths for the project : ' + env['EXTRAINCLUDES'] +' **'+ NORMAL
+ elif env.has_key('EXTRAINCLUDES'):
+ env.__delitem__('EXTRAINCLUDES')
+
+ env['ISCONFIGURED']=1
+
+ # And finally save the options in the cache
+ opts.Save(cachefile, env)
+
+ if env.has_key('KDECXXFLAGS'):
+ env.AppendUnique( CPPFLAGS = env['KDECXXFLAGS'] )
+
+ if env.has_key('KDECCFLAGS'):
+ env.AppendUnique( CCFLAGS = env['KDECCFLAGS'] )
+
+ if env.has_key('KDELINKFLAGS'):
+ env.AppendUnique( LINKFLAGS = env['KDELINKFLAGS'] )
+
+ if env.has_key('EXTRAINCLUDES'):
+ incpaths = []
+ for dir in str(env['EXTRAINCLUDES']).split(':'):
+ incpaths.append( dir )
+ env.Append(CPPPATH = incpaths)
+
+ env.Export("env")
+
diff --git a/parts/appwizard/common/scons/admin/kde.py b/parts/appwizard/common/scons/admin/kde.py
new file mode 100644
index 00000000..bea63d4e
--- /dev/null
+++ b/parts/appwizard/common/scons/admin/kde.py
@@ -0,0 +1,856 @@
+# Made from scons qt.py and (heavily) modified into kde.py
+# Thomas Nagy, 2004, 2005 <tnagy2^8@yahoo.fr>
+
+"""
+Run scons -h to display the associated help, or look below ..
+"""
+
+BOLD ="\033[1m"
+RED ="\033[91m"
+GREEN ="\033[92m"
+YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
+CYAN ="\033[96m"
+NORMAL ="\033[0m"
+
+import os, re, types
+
+# Returns the name of the shared object (i.e. libkdeui.so.4)
+# referenced by a libtool archive (like libkdeui.la)
+def getSOfromLA(lafile):
+ contents = open(lafile, 'r').read()
+ match = re.search("^dlname='([^']*)'$", contents, re.M)
+ if match:
+ return match.group(1)
+ return None
+
+def exists(env):
+ return True
+
+def detect_kde(env):
+ """ Detect the qt and kde environment using kde-config mostly """
+
+ prefix = env['ARGS'].get('prefix', None)
+ execprefix = env['ARGS'].get('execprefix', None)
+ datadir = env['ARGS'].get('datadir', None)
+ libdir = env['ARGS'].get('libdir', None)
+ libsuffix = env['ARGS'].get('libsuffix', '')
+ kdeincludes = env['ARGS'].get('kdeincludes', None)
+ kdelibs = env['ARGS'].get('kdelibs', None)
+ qtincludes = env['ARGS'].get('qtincludes', None)
+ qtlibs = env['ARGS'].get('qtlibs', None)
+
+ if libdir:
+ libdir = libdir+libsuffix
+
+ ## Detect the kde libraries
+ print "Checking for kde-config : ",
+ kde_config = os.popen("which kde-config 2>/dev/null").read().strip()
+ if len(kde_config):
+ print GREEN+"kde-config was found"+NORMAL
+ else:
+ print RED+"kde-config was NOT found in your PATH"+NORMAL
+ print "Make sure kde is installed properly"
+ print "(missing package kdebase-devel?)"
+ env.Exit(1)
+ env['KDEDIR'] = os.popen('kde-config -prefix').read().strip()
+
+ print "Checking for kde version : ",
+ kde_version = os.popen("kde-config --version|grep KDE").read().strip().split()[1]
+ if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
+ print RED+kde_version
+ print RED+"Your kde version can be too old"+NORMAL
+ print RED+"Please make sure kde is at least 3.2"+NORMAL
+ else:
+ print GREEN+kde_version+NORMAL
+
+ ## Detect the qt library
+ print "Checking for the qt library : ",
+ qtdir = os.getenv("QTDIR")
+ if qtdir:
+ print GREEN+"qt is in "+qtdir+NORMAL
+ else:
+ libdir = os.popen('kde-config --expandvars --install lib').read().strip()
+ libkdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libkdeui.la')
+ m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2])
+ if m:
+ qtdir = m.group(1)
+ print YELLOW+"qt was found as "+m.group(1)+NORMAL
+ else:
+ print RED+"qt was not found"+NORMAL
+ print RED+"Please set QTDIR first (/usr/lib/qt3?)"+NORMAL
+ env.Exit(1)
+ env['QTDIR'] = qtdir.strip()
+
+ ## Find the necessary programs uic and moc
+ print "Checking for uic : ",
+ uic = qtdir + "/bin/uic"
+ if os.path.isfile(uic):
+ print GREEN+"uic was found as "+uic+NORMAL
+ else:
+ uic = os.popen("which uic 2>/dev/null").read().strip()
+ if len(uic):
+ print YELLOW+"uic was found as "+uic+NORMAL
+ else:
+ uic = os.popen("which uic 2>/dev/null").read().strip()
+ if len(uic):
+ print YELLOW+"uic was found as "+uic+NORMAL
+ else:
+ print RED+"uic was not found - set QTDIR put it in your PATH ?"+NORMAL
+ env.Exit(1)
+ env['QT_UIC'] = uic
+
+ print "Checking for moc : ",
+ moc = qtdir + "/bin/moc"
+ if os.path.isfile(moc):
+ print GREEN + "moc was found as " + moc + NORMAL
+ else:
+ moc = os.popen("which moc 2>/dev/null").read().strip()
+ if len(moc):
+ print YELLOW + "moc was found as " + moc + NORMAL
+ elif os.path.isfile("/usr/share/qt3/bin/moc"):
+ moc = "/usr/share/qt3/bin/moc"
+ print YELLOW + "moc was found as " + moc + NORMAL
+ else:
+ print RED + "moc was not found - set QTDIR or put it in your PATH ?" + NORMAL
+ env.Exit(1)
+ env['QT_MOC'] = moc
+
+ ## check for the qt and kde includes
+ print "Checking for the qt includes : ",
+ if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"):
+ # The user told where to look for and it looks valid
+ print GREEN + "ok " + qtincludes + NORMAL
+ else:
+ if os.path.isfile(qtdir + "/include/qlayout.h"):
+ # Automatic detection
+ print GREEN + "ok " + qtdir + "/include/ " + NORMAL
+ qtincludes = qtdir + "/include/"
+ elif os.path.isfile("/usr/include/qt3/qlayout.h"):
+ # Debian probably
+ print YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL
+ qtincludes = "/usr/include/qt3"
+ else:
+ print RED + "the qt headers were not found" + NORMAL
+ env.Exit(1)
+
+ print "Checking for the kde includes : ",
+ kdeprefix = os.popen("kde-config --prefix").read().strip()
+ if not kdeincludes:
+ kdeincludes = kdeprefix+"/include/"
+ if os.path.isfile(kdeincludes + "/klineedit.h"):
+ print GREEN + "ok " + kdeincludes + NORMAL
+ else:
+ if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"):
+ # Debian, Fedora probably
+ print YELLOW + "the kde headers were found in " + kdeprefix + "/include/kde/" + NORMAL
+ kdeincludes = kdeprefix + "/include/kde/"
+ else:
+ print RED + "The kde includes were NOT found" + NORMAL
+ env.Exit(1)
+
+ if prefix:
+ ## use the user-specified prefix
+ if not execprefix:
+ execprefix = prefix
+ if not datadir:
+ datadir=prefix+"/share"
+ if not libdir:
+ libdir=execprefix+"/lib"+libsuffix
+
+ subst_vars = lambda x: x.replace('${exec_prefix}', execprefix).replace('${datadir}',datadir).replace('${libdir}', libdir)
+ debian_fix = lambda x: x.replace('/usr/share', '${datadir}')
+ env['KDEBIN'] = subst_vars(os.popen('kde-config --install exe').read().strip())
+ env['KDEAPPS'] = subst_vars(os.popen('kde-config --install apps').read().strip())
+ env['KDEDATA'] = subst_vars(os.popen('kde-config --install data').read().strip())
+ env['KDEMODULE']= subst_vars(os.popen('kde-config --install module').read().strip())
+ env['KDELOCALE']= subst_vars(os.popen('kde-config --install locale').read().strip())
+ env['KDEDOC'] = subst_vars( debian_fix(os.popen('kde-config --install html').read().strip()) )
+ env['KDEKCFG'] = subst_vars(os.popen('kde-config --install kcfg').read().strip())
+ env['KDEXDG'] = subst_vars(os.popen('kde-config --install xdgdata-apps').read().strip())
+ env['KDEXDGDIR']= subst_vars(os.popen('kde-config --install xdgdata-dirs').read().strip())
+ env['KDEMENU'] = subst_vars(os.popen('kde-config --install apps').read().strip())
+ env['KDEMIME'] = subst_vars(os.popen('kde-config --install mime').read().strip())
+ env['KDEICONS'] = subst_vars(os.popen('kde-config --install icon').read().strip())
+ env['KDESERV'] = subst_vars(os.popen('kde-config --install services').read().strip())
+ else:
+ # the user has given no prefix, install as a normal kde app
+ env['PREFIX'] = os.popen('kde-config --prefix').read().strip()
+ env['KDEBIN'] = os.popen('kde-config --expandvars --install exe').read().strip()
+ env['KDEAPPS'] = os.popen('kde-config --expandvars --install apps').read().strip()
+ env['KDEDATA'] = os.popen('kde-config --expandvars --install data').read().strip()
+ env['KDEMODULE']= os.popen('kde-config --expandvars --install module').read().strip()
+ env['KDELOCALE']= os.popen('kde-config --expandvars --install locale').read().strip()
+ env['KDEDOC'] = os.popen('kde-config --expandvars --install html').read().strip()
+ env['KDEKCFG'] = os.popen('kde-config --expandvars --install kcfg').read().strip()
+ env['KDEXDG'] = os.popen('kde-config --expandvars --install xdgdata-apps').read().strip()
+ env['KDEXDGDIR']= os.popen('kde-config --expandvars --install xdgdata-dirs').read().strip()
+ env['KDEMENU'] = os.popen('kde-config --expandvars --install apps').read().strip()
+ env['KDEMIME'] = os.popen('kde-config --expandvars --install mime').read().strip()
+ env['KDEICONS'] = os.popen('kde-config --expandvars --install icon').read().strip()
+ env['KDESERV'] = os.popen('kde-config --expandvars --install services').read().strip()
+
+ env['QTPLUGINS']=os.popen('kde-config --expandvars --install qtplugins').read().strip()
+
+ ## kde libs and includes
+ env['KDEINCLUDEPATH']=kdeincludes
+ if not kdelibs:
+ kdelibs=os.popen('kde-config --expandvars --install lib').read().strip()
+ env['KDELIBPATH']=kdelibs
+
+ ## qt libs and includes
+ env['QTINCLUDEPATH']=qtincludes
+ if not qtlibs:
+ qtlibs=qtdir+"/lib"
+ env['QTLIBPATH']=qtlibs
+
+def generate(env):
+ """"Set up the qt and kde environment and builders - the moc part is difficult to understand """
+ if env['HELP']:
+ print """
+"""+BOLD+"""*** KDE options ***
+-------------------"""+NORMAL+"""
+"""+BOLD+"""* prefix """+NORMAL+""": base install path, ie: /usr/local
+"""+BOLD+"""* execprefix """+NORMAL+""": install path for binaries, ie: /usr/bin
+"""+BOLD+"""* datadir """+NORMAL+""": install path for the data, ie: /usr/local/share
+"""+BOLD+"""* libdir """+NORMAL+""": install path for the libs, ie: /usr/lib
+"""+BOLD+"""* libsuffix """+NORMAL+""": suffix of libraries on amd64, ie: 64, 32
+"""+BOLD+"""* kdeincludes"""+NORMAL+""": path to the kde includes (/usr/include/kde on debian, ...)
+"""+BOLD+"""* qtincludes """+NORMAL+""": same punishment, for qt includes (/usr/include/qt on debian, ...)
+"""+BOLD+"""* kdelibs """+NORMAL+""": path to the kde libs, for linking the programs
+"""+BOLD+"""* qtlibs """+NORMAL+""": same punishment, for qt libraries
+ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
+"""+NORMAL
+
+ import SCons.Defaults
+ import SCons.Tool
+ import SCons.Util
+
+ ui_extensions = [".ui"]
+ header_extensions = [".h", ".hxx", ".hpp", ".hh"]
+ source_extensions = [".cpp", ".cxx", ".cc"]
+
+ def find_file(filename, paths, node_factory):
+ retval = None
+ for dir in paths:
+ node = node_factory(filename, dir)
+ if node.rexists():
+ return node
+ return None
+
+ class _Metasources:
+ """ Callable class, which works as an emitter for Programs, SharedLibraries
+ and StaticLibraries."""
+
+ def __init__(self, objBuilderName):
+ self.objBuilderName = objBuilderName
+
+ def __call__(self, target, source, env):
+ """ Smart autoscan function. Gets the list of objects for the Program
+ or Lib. Adds objects and builders for the special qt files. """
+ try:
+ if int(env.subst('$QT_AUTOSCAN')) == 0:
+ return target, source
+ except ValueError:
+ pass
+
+ try:
+ qtdebug = int(env.subst('$QT_DEBUG'))
+ except ValueError:
+ qtdebug = 0
+
+ # some shortcuts used in the scanner
+ FS = SCons.Node.FS.default_fs
+ splitext = SCons.Util.splitext
+ objBuilder = getattr(env, self.objBuilderName)
+
+ # some regular expressions:
+ # Q_OBJECT detection
+ q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
+
+ # The following is kind of hacky to get builders working properly (FIXME) ??
+ objBuilderEnv = objBuilder.env
+ objBuilder.env = env
+ mocBuilderEnv = env.Moc.env
+ env.Moc.env = env
+
+ # make a deep copy for the result; MocH objects will be appended
+ out_sources = source[:]
+
+ for obj in source:
+ if not obj.has_builder():
+ # binary obj file provided
+ if qtdebug:
+ print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj)
+ continue
+ cpp = obj.sources[0]
+ if not splitext(str(cpp))[1] in source_extensions:
+ if qtdebug:
+ print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp)
+ # c or fortran source
+ continue
+ #cpp_contents = comment.sub('', cpp.get_contents())
+ cpp_contents = cpp.get_contents()
+
+ h = None
+ ui = None
+
+ for ui_ext in ui_extensions:
+ # try to find the ui file in the corresponding source directory
+ uiname = splitext(cpp.name)[0] + ui_ext
+ ui = find_file(uiname, (cpp.get_dir(),), FS.File)
+ if ui:
+ if qtdebug:
+ print "scons: qt: found .ui file of header" #% (str(h), str(cpp))
+ #h_contents = comment.sub('', h.get_contents())
+ break
+
+ # if we have a .ui file, do not continue, it is automatically handled by Uic
+ if ui:
+ continue
+
+ for h_ext in header_extensions:
+ # try to find the header file in the corresponding source
+ # directory
+ hname = splitext(cpp.name)[0] + h_ext
+ h = find_file(hname, (cpp.get_dir(),), FS.File)
+ if h:
+ if qtdebug:
+ print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))
+ #h_contents = comment.sub('', h.get_contents())
+ h_contents = h.get_contents()
+ break
+
+ if not h and qtdebug:
+ print "scons: qt: no header for '%s'." % (str(cpp))
+ if h and q_object_search.search(h_contents):
+ # h file with the Q_OBJECT macro found -> add .moc or _moc.cpp file
+ moc_cpp = None
+
+ if env.has_key('NOMOCSCAN'):
+ moc_cpp = env.Moc(h)
+ else:
+ reg = '\n\s*#include\s*("|<)'+splitext(cpp.name)[0]+'.moc("|>)'
+ meta_object_search = re.compile(reg)
+ if meta_object_search.search(cpp_contents):
+ moc_cpp = env.Moc(h)
+ else:
+ moc_cpp = env.Moccpp(h)
+ moc_o = objBuilder(moc_cpp)
+ out_sources.append(moc_o)
+ if qtdebug:
+ print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp[0]))
+
+ if cpp and q_object_search.search(cpp_contents):
+ print "error, bksys cannot handle cpp files with Q_OBJECT classes"
+ print "if you are sure this is a feature worth the effort, "
+ print "report this to the authors tnagyemail-mail yahoo.fr"
+
+ # restore the original env attributes (FIXME)
+ objBuilder.env = objBuilderEnv
+ env.Moc.env = mocBuilderEnv
+
+ return (target, out_sources)
+
+ MetasourcesShared = _Metasources('SharedObject')
+ MetasourcesStatic = _Metasources('StaticObject')
+
+ CLVar = SCons.Util.CLVar
+ splitext = SCons.Util.splitext
+ Builder = SCons.Builder.Builder
+
+ # Detect the environment - replaces ./configure implicitely and store the options into a cache
+ from SCons.Options import Options
+ cachefile=env['CACHEDIR']+'kde.cache.py'
+ opts = Options(cachefile)
+ opts.AddOptions(
+ ('PREFIX', 'root of the program installation'),
+
+ ('QTDIR', 'root of qt directory'),
+ ('QTLIBPATH', 'path to the qt libraries'),
+ ('QTINCLUDEPATH', 'path to the qt includes'),
+ ('QT_UIC', 'moc directory'),
+ ('QT_MOC', 'moc executable command'),
+ ('QTPLUGINS', 'uic executable command'),
+ ('KDEDIR', 'root of kde directory'),
+ ('KDELIBPATH', 'path to the kde libs'),
+ ('KDEINCLUDEPATH', 'path to the kde includes'),
+
+ ('KDEBIN', 'installation path of the kde binaries'),
+ ('KDEMODULE', 'installation path of the parts and libs'),
+ ('KDEAPPS', ''),
+ ('KDEDATA', 'installation path of the application data'),
+ ('KDELOCALE', ''),
+ ('KDEDOC', 'installation path of the application documentation'),
+ ('KDEKCFG', 'installation path of the .kcfg files'),
+ ('KDEXDG', 'installation path of the service types'),
+ ('KDEXDGDIR', 'installation path of the xdg service directories'),
+ ('KDEMENU', ''),
+ ('KDEMIME', 'installation path of to the mimetypes'),
+ ('KDEICONS', ''),
+ ('KDESERV', ''),
+ )
+ opts.Update(env)
+
+ # reconfigure when things are missing
+ if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('QTDIR') or not env.has_key('KDEDIR')):
+ detect_kde(env)
+
+ # finally save the configuration to the cache file
+ opts.Save(cachefile, env)
+
+ ## set default variables, one can override them in sconscript files
+ env.Append(CXXFLAGS = ['-I'+env['KDEINCLUDEPATH'], '-I'+env['QTINCLUDEPATH'] ])
+ env.Append(LIBPATH = [env['KDELIBPATH'], env['QTLIBPATH'] ])
+
+ env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
+
+ env['QT_AUTOSCAN'] = 1
+ env['QT_DEBUG'] = 0
+ env['QT_UIC_HFLAGS'] = '-L $QTPLUGINS -nounload'
+ env['QT_UIC_CFLAGS'] = '$QT_UIC_HFLAGS -tr tr2i18n'
+ env['QT_LIBS'] = 'qt-mt'
+ env['QT_UICIMPLPREFIX'] = ''
+ env['QT_UICIMPLSUFFIX'] = '.cpp'
+
+ env['QT_MOCHPREFIX'] = ''
+ env['QT_MOCHSUFFIX'] = '.moc'
+ env['KDE_KCFG_IMPLPREFIX'] = ''
+ env['KDE_KCFG_IMPL_HSUFFIX'] = '.h'
+ env['KDE_KCFG_IMPL_CSUFFIX'] = '.cpp'
+ env['KDE_SKEL_IMPL_SUFFIX'] = '.skel'
+ env['MEINPROC'] = 'meinproc'
+ env['MSGFMT'] = 'msgfmt'
+
+ ## ui file processing
+ def uic_processing(target, source, env):
+ inc_kde = '#include <klocale.h>\n#include <kdialog.h>\n'
+ inc_moc = '#include "%s"\n' % target[2].name
+ comp_h = '$QT_UIC $QT_UIC_HFLAGS -o %s %s' % (target[0].path, source[0].path)
+ comp_c = '$QT_UIC $QT_UIC_CFLAGS -impl %s %s' % (target[0].path, source[0].path)
+ comp_moc = '$QT_MOC -o %s %s' % (target[2].path, target[0].path)
+
+ ret = env.Execute(comp_h)
+ if ret:
+ return ret
+
+ dest = open( target[1].path, "w" )
+ dest.write(inc_kde)
+ dest.close()
+
+ ret = env.Execute( comp_c+" >> "+target[1].path )
+ if ret:
+ return ret
+
+ dest = open( target[1].path, "a" )
+ dest.write(inc_moc)
+ dest.close()
+
+ ret = env.Execute( comp_moc )
+ return ret
+
+ def uicEmitter(target, source, env):
+ adjustixes = SCons.Util.adjustixes
+ bs = SCons.Util.splitext(str(source[0].name))[0]
+ bs = os.path.join(str(target[0].get_dir()),bs)
+ # first target is automatically added by builder (.h file)
+ if len(target) < 2:
+ # second target is .cpp file
+ target.append(adjustixes(bs,
+ env.subst('$QT_UICIMPLPREFIX'),
+ env.subst('$QT_UICIMPLSUFFIX')))
+ if len(target) < 3:
+ # third target is .moc file
+ target.append(adjustixes(bs,
+ env.subst('$QT_MOCHPREFIX'),
+ env.subst('$QT_MOCHSUFFIX')))
+ return target, source
+
+ UIC_BUILDER = Builder(
+ action = uic_processing,
+ emitter = uicEmitter,
+ suffix = '.h',
+ src_suffix = '.ui')
+
+ ## moc file processing
+ env['QT_MOCCOM'] = ('$QT_MOC -o ${TARGETS[0]} $SOURCE')
+
+ MOC_BUILDER = Builder(
+ action = '$QT_MOCCOM',
+ suffix = '.moc',
+ src_suffix = '.h')
+
+ MOCCPP_BUILDER = Builder(
+ action = '$QT_MOCCOM',
+ suffix = '_moc.cpp',
+ src_suffix = '.h')
+
+ ## kcfg file processing
+ def kcfgGenerator(target, source, env, for_signature):
+ act=[]
+ act.append('kconfig_compiler -d'+str(source[0].get_dir())+' '+source[1].path+' '+source[0].path)
+ return act
+
+ def kcfgEmitter(target, source, env):
+ adjustixes = SCons.Util.adjustixes
+ bs = SCons.Util.splitext(str(source[0].name))[0]
+ bs = os.path.join(str(target[0].get_dir()),bs)
+ # .h file is automatically added
+ if len(target) < 2:
+ # add .cpp file
+ target.append(adjustixes(bs, env.subst('$KDE_KCFG_IMPLPREFIX'), env.subst('$KDE_KCFG_IMPL_CSUFFIX')))
+
+ if len(source) <2:
+ if not os.path.isfile(str(source[0])):
+ print RED+'kcfg file given'+str(source[0])+' does not exist !'+NORMAL
+ return target, source
+ kfcgfilename=""
+ kcfgFileDeclRx = re.compile("^[fF]ile\s*=\s*(.+)\s*$")
+ for line in file(str(source[0]), "r").readlines():
+ match = kcfgFileDeclRx.match(line.strip())
+ if match:
+ kcfgfilename = match.group(1)
+ break
+ source.append(str(source[0].get_dir())+'/'+kcfgfilename)
+ return target, source
+
+ KCFG_BUILDER = Builder(
+ generator = kcfgGenerator,
+ emitter = kcfgEmitter,
+ suffix = '.h',
+ src_suffix = '.kcfgc')
+
+ ## dcop processing
+ def dcopGenerator(target, source, env, for_signature):
+ act=[]
+ act.append('dcopidl '+source[0].path+' > '+target[1].path+'|| ( rm -f '+target[1].path+' ; false)')
+ act.append('dcopidl2cpp --c++-suffix cpp --no-signals --no-stub '+target[1].path)
+ return act
+
+ def dcopEmitter(target, source, env):
+ bs = SCons.Util.splitext(str(source[0].name))[0]
+ bs = os.path.join(str(target[0].get_dir()),bs)
+ target.append(bs+'.kidl')
+ #target.append(bs+'_skel.cpp')
+ return target, source
+
+ DCOP_BUILDER = Builder(
+ generator = dcopGenerator,
+ emitter = dcopEmitter,
+ suffix = '_skel.cpp',
+ src_suffix = '.h')
+
+ ## documentation processing
+ MEINPROC_BUILDER = Builder(
+ action = '$MEINPROC --check --cache $TARGET $SOURCE',
+ suffix = '.cache.bz2')
+
+ ## translation files builder
+ TRANSFILES_BUILDER = Builder(
+ action = '$MSGFMT $SOURCE -o $TARGET',
+ suffix = '.gmo',
+ src_suffix = '.po')
+
+ ## libtool file builder
+ def la_file(target, source, env):
+ dest=open(target[0].path, 'w')
+ sname=source[0].name
+ dest.write("dlname='%s'\n" % sname)
+ dest.write("library_names='%s %s %s'\n" % (sname, sname, sname))
+ dest.write("old_library=''\n")
+ dest.write("dependency_libs=''\n")
+ dest.write("current=0\n")
+ dest.write("age=0\n")
+ dest.write("revision=0\n")
+ dest.write("installed=yes\n")
+ dest.write("shouldnotlink=no\n")
+ dest.write("dlopen=''\n")
+ dest.write("dlpreopen=''\n")
+ dest.write("libdir='%s'" % env['KDEMODULE'])
+ dest.close()
+ return 0
+
+ LA_BUILDER = Builder(
+ action = la_file,
+ suffix = '.la',
+ src_suffix = env['SHLIBSUFFIX'])
+
+ ## register the builders
+ env['BUILDERS']['Uic'] = UIC_BUILDER
+ env['BUILDERS']['Moc'] = MOC_BUILDER
+ env['BUILDERS']['Moccpp'] = MOCCPP_BUILDER
+ env['BUILDERS']['Dcop'] = DCOP_BUILDER
+ env['BUILDERS']['Kcfg'] = KCFG_BUILDER
+ env['BUILDERS']['LaFile'] = LA_BUILDER
+ env['BUILDERS']['Meinproc'] = MEINPROC_BUILDER
+ env['BUILDERS']['Transfiles']= TRANSFILES_BUILDER
+
+ static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
+ static_obj.src_builder.append('Uic')
+ shared_obj.src_builder.append('Uic')
+ static_obj.src_builder.append('Kcfg')
+ shared_obj.src_builder.append('Kcfg')
+ static_obj.src_builder.append('LaFile')
+ shared_obj.src_builder.append('LaFile')
+ static_obj.src_builder.append('Meinproc')
+ shared_obj.src_builder.append('Meinproc')
+ static_obj.src_builder.append('Transfiles')
+ shared_obj.src_builder.append('Transfiles')
+
+ ## Find the files to moc, dcop, and link against kde and qt
+ env.AppendUnique(PROGEMITTER = [MetasourcesStatic], SHLIBEMITTER=[MetasourcesShared], LIBEMITTER =[MetasourcesStatic])
+
+ ## Handy helpers for building kde programs
+ ## You should not have to modify them ..
+
+ ## return a list of things
+ def make_list(e):
+ if type(e) is types.ListType:
+ return e
+ else:
+ return e.split()
+
+ #import SCons.Util
+ skel_ext = [".skel", ".SKEL"]
+ def KDEfiles(lenv, target, source):
+ """ Returns a list of files for scons (handles kde tricks like .skel)
+ It also makes custom checks against double includes like : ['file.ui', 'file.cpp']
+ (file.cpp is already included because of file.ui) """
+
+ src=[]
+ ui_files=[]
+ kcfg_files=[]
+ skel_files=[]
+ other_files=[]
+
+ source_=make_list(source)
+
+ # For each file, check wether it is a dcop file or not, and create the complete list of sources
+ for file in source_:
+ bs = SCons.Util.splitext(file)[0]
+ ext = SCons.Util.splitext(file)[1]
+ if ext in skel_ext:
+ lenv.Dcop(bs+'.h')
+ src.append(bs+'_skel.cpp')
+ elif ext == ".moch":
+ lenv.Moccpp(bs+'.h')
+ src.append(bs+'_moc.cpp')
+ else:
+ src.append(file)
+
+ if ext == '.ui':
+ ui_files.append(bs)
+ elif ext == '.kcfgc':
+ kcfg_files.append(bs)
+ elif ext == '.skel':
+ skel_files.append(bs)
+ else:
+ other_files.append(bs)
+
+ # Now check against typical newbie errors
+ for file in ui_files:
+ for ofile in other_files:
+ if ofile == file:
+ print RED+"WARNING: You have included "+file+".ui and another file of the same prefix"+NORMAL
+ print "Files generated by uic (file.h, file.cpp must not be included"
+ for file in kcfg_files:
+ for ofile in other_files:
+ if ofile == file:
+ print RED+"WARNING: You have included "+file+".kcfg and another file of the same prefix"+NORMAL
+ print "Files generated by kconfig_compiler (settings.h, settings.cpp) must not be included"
+ return src
+
+
+ """
+ In the future, these functions will contain the code that will dump the
+ configuration for re-use from an IDE
+ """
+ import glob
+ def KDEinstall(lenv, restype, subdir, files):
+ if not env['_INSTALL']:
+ return
+ basedir=env['DESTDIR']
+ if len(restype)>0:
+ if not lenv.has_key(restype):
+ print RED+"unknown resource type "+restype+NORMAL
+ else:
+ basedir += lenv[restype]+'/'
+ #print file # <- useful to trace stuff :)
+ install_list = env.Install(basedir+subdir+'/', files)
+ env.Alias('install', install_list)
+ return install_list
+
+ def KDEinstallas(lenv, restype, destfile, file):
+ if not env['_INSTALL']:
+ return
+ basedir=env['DESTDIR']
+ if len(restype)>0:
+ if not lenv.has_key(restype):
+ print RED+"unknown resource type "+restype+NORMAL
+ else:
+ basedir += lenv[restype]+'/'
+ install_list = env.InstallAs(basedir+destfile, file)
+ env.Alias('install', install_list)
+ return install_list
+
+ def KDEprogram(lenv, target, source):
+ """ Makes a kde program
+ The program is installed except if one sets env['NOAUTOINSTALL'] """
+ src = KDEfiles(lenv, target, source)
+ program_list = lenv.Program(target, src)
+ if not lenv.has_key('NOAUTOINSTALL'):
+ KDEinstall(lenv, 'KDEBIN', '', target)
+ return program_list
+
+ def KDEshlib(lenv, target, source, kdelib=0, libprefix='lib'):
+ """ Makes a shared library for kde (.la file for klibloader)
+ The library is installed except if one sets env['NOAUTOINSTALL'] """
+ src = KDEfiles(lenv, target, source)
+ lenv['LIBPREFIX']=libprefix
+ library_list = lenv.SharedLibrary(target, src)
+ lafile_list = lenv.LaFile(target, library_list)
+ if not lenv.has_key('NOAUTOINSTALL'):
+ install_dir = 'KDEMODULE'
+ if kdelib==1:
+ install_dir = 'KDELIBPATH'
+ KDEinstall(lenv, install_dir, '', library_list)
+ KDEinstall(lenv, install_dir, '', lafile_list)
+ return library_list
+
+ def KDEstaticlib(lenv, target, source):
+ """ Makes a static library for kde - in practice you should not use static libraries
+ 1. they take more memory than shared ones
+ 2. makefile.am needed it because of limitations
+ (cannot handle sources in separate folders - takes extra processing) """
+ src = KDEfiles(lenv, target, source)
+ return lenv.StaticLibrary(target, src)
+ # do not install static libraries by default
+
+ def KDEaddflags_cxx(lenv, fl):
+ """ Compilation flags for C++ programs """
+ lenv.AppendUnique(CXXFLAGS = make_list(fl))
+
+ def KDEaddflags_c(lenv, fl):
+ """ Compilation flags for C programs """
+ lenv.AppendUnique(CFLAGS = make_list(fl))
+
+ def KDEaddflags_link(lenv, fl):
+ """ Add link flags - Use this if KDEaddlibs below is not enough """
+ lenv.AppendUnique(LINKFLAGS = make_list(fl))
+
+ def KDEaddlibs(lenv, libs):
+ """ Helper function """
+ lenv.AppendUnique(LIBS = make_list(libs))
+
+ def KDEaddpaths_includes(lenv, paths):
+ """ Add new include paths """
+ lenv.AppendUnique(CPPPATH = make_list(paths))
+
+ def KDEaddpaths_libs(lenv, paths):
+ """ Add paths to libraries """
+ lenv.AppendUnique(LIBPATH = make_list(paths))
+
+ def KDElang(lenv, folder, appname):
+ """ Process translations (.po files) in a po/ dir """
+ transfiles = glob.glob(folder+'/*.po')
+ for lang in transfiles:
+ result = lenv.Transfiles(lang)
+ country = SCons.Util.splitext(result[0].name)[0]
+ KDEinstallas(lenv, 'KDELOCALE', country+'/LC_MESSAGES/'+appname+'.mo', result)
+
+ def subdirs(lenv, folderlist):
+ flist=make_list(folderlist)
+ for i in flist:
+ lenv.SConscript(i+"/SConscript")
+
+ def KDEicon(lenv, icname='*', path='./'):
+ """ Emulates the behaviour of Makefile.am to install icons
+ Contributed by: "Andrey Golovizin" <grooz@gorodok@net> """
+ type_dic = { 'action' : 'actions', 'app' : 'apps', 'device' :
+ 'devices', 'filesys' : 'filesystems', 'mime' : 'mimetypes' }
+ dir_dic = {
+ 'los' :'locolor/16x16',
+ 'lom' :'locolor/32x32',
+ 'him' :'hicolor/32x32',
+ 'hil' :'hicolor/48x48',
+ 'lo16' :'locolor/16x16',
+ 'lo22' :'locolor/22x22',
+ 'lo32' :'locolor/32x32',
+ 'hi16' :'hicolor/16x16',
+ 'hi22' :'hicolor/22x22',
+ 'hi32' :'hicolor/32x32',
+ 'hi48' :'hicolor/48x48',
+ 'hi64' :'hicolor/64x64',
+ 'hi128':'hicolor/128x128',
+ 'hisc' :'hicolor/scalable',
+ 'cr16' :'crystalsvg/16x16',
+ 'cr22' :'crystalsvg/22x22',
+ 'cr32' :'crystalsvg/32x32',
+ 'cr48' :'crystalsvg/48x48',
+ 'cr64' :'crystalsvg/64x64',
+ 'cr128':'crystalsvg/128x128',
+ 'crsc' :'crystalsvg/scalable'
+ }
+
+ iconfiles = []
+ for ext in "png xpm mng svg svgz".split():
+ files = glob.glob(path+'/'+'*-*-%s.%s' % (icname, ext))
+ iconfiles += files
+ for iconfile in iconfiles:
+ lst = iconfile.split('/')
+ filename = lst[ len(lst) - 1 ]
+ tmp = filename.split('-')
+ if len(tmp)!=3:
+ print RED+'WARNING: icon filename has unknown format: '+iconfile+NORMAL
+ continue
+ [icon_dir, icon_type, icon_filename]=tmp
+ try:
+ destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename)
+ except KeyError:
+ print RED+'WARNING: unknown icon type: '+iconfile+NORMAL
+ continue
+ ## Do not use KDEinstallas here, as parsing from an ide will be necessary
+ if env['_INSTALL']:
+ env.Alias('install', env.InstallAs( env['DESTDIR']+'/'+destfile, iconfile ) )
+
+ def KDEuse(lenv, flags):
+ _flags=make_list(flags)
+ if 'environ' in _flags:
+ ## The scons developers advise against using this but it is mostly innocuous :)
+ import os
+ lenv.AppendUnique( ENV = os.environ )
+ if not 'lang_qt' in _flags:
+ ## Use this define if you are using the kde translation scheme (.po files)
+ lenv.Append( CPPFLAGS = '-DQT_NO_TRANSLATION' )
+ if 'rpath' in _flags:
+ ## Use this to set rpath - this may cause trouble if folders are moved (chrpath)
+ lenv.Append( RPATH = [env['QTLIBPATH'], env['KDELIBPATH'], env['KDEMODULE']] )
+ if 'thread' in _flags:
+ ## Uncomment the following if you need threading support
+ lenv.KDEaddflags_cxx( ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] )
+ if not 'nohelp' in _flags:
+ if lenv['_CONFIGURE'] or lenv['HELP']:
+ env.Exit(0)
+
+ ## To use kdDebug(intvalue)<<"some trace"<<endl; you need to define -DDEBUG
+ ## it is done in admin/generic.py automatically when you do scons configure debug=1
+
+ # Attach the functions to the environment so that sconscripts can use them
+ from SCons.Script.SConscript import SConsEnvironment
+ SConsEnvironment.KDEprogram = KDEprogram
+ SConsEnvironment.KDEshlib = KDEshlib
+ SConsEnvironment.KDEstaticlib = KDEstaticlib
+ SConsEnvironment.KDEinstall = KDEinstall
+ SConsEnvironment.KDEinstallas = KDEinstallas
+ SConsEnvironment.KDElang = KDElang
+ SConsEnvironment.KDEicon = KDEicon
+
+ SConsEnvironment.KDEaddflags_cxx = KDEaddflags_cxx
+ SConsEnvironment.KDEaddflags_c = KDEaddflags_c
+ SConsEnvironment.KDEaddflags_link = KDEaddflags_link
+ SConsEnvironment.KDEaddlibs = KDEaddlibs
+ SConsEnvironment.KDEaddpaths_includes = KDEaddpaths_includes
+ SConsEnvironment.KDEaddpaths_libs = KDEaddpaths_libs
+
+ SConsEnvironment.subdirs = subdirs
+ SConsEnvironment.KDEuse = KDEuse
+
diff --git a/parts/appwizard/common/scons/admin/scons-mini.tar.bz2 b/parts/appwizard/common/scons/admin/scons-mini.tar.bz2
new file mode 100644
index 00000000..0c1ce52e
--- /dev/null
+++ b/parts/appwizard/common/scons/admin/scons-mini.tar.bz2
Binary files differ
diff --git a/parts/appwizard/common/scons/configure b/parts/appwizard/common/scons/configure
new file mode 100755
index 00000000..289a6843
--- /dev/null
+++ b/parts/appwizard/common/scons/configure
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Fancy colors used to beautify the output a bit.
+#
+NORMAL="\033[0m"
+BOLD="\033[1m"
+RED="\033[91m"
+YELLOW="\033[93m"
+GREEN="\033[92m"
+
+# Checks for Python interpreter. Honours $PYTHON if set. Stores path to
+# interpreter in $PYTHON.
+#
+checkPython()
+{
+ if [ -z $PYTHON ]; then
+ PYTHON=`which python 2>/dev/null`
+ fi
+ echo -n "Checking for Python : "
+ if [ ! -x "$PYTHON" ]; then
+ echo -e $GREEN"not found!"$NORMAL
+ echo "Please make sure that the Python interpreter is available in your PATH"
+ echo "or invoke configure using the PYTHON flag, e.g."
+ echo "$ PYTHON=/usr/local/bin/python configure"
+ exit 1
+ fi
+ echo -e $GREEN"$PYTHON"$NORMAL
+}
+
+# Checks for SCons. Honours $SCONS if set. Stores path to 'scons' in $SCONS.
+# Requires that $PYTHON is set.
+#
+checkSCons()
+{
+ echo -n "Checking for SCons : "
+ if [ -z $SCONS ]; then
+ SCONS=`which scons 2>/dev/null`
+ fi
+ if [ ! -x "$SCONS" ]; then
+ echo -e $BOLD"not found, will use mini distribution."$NORMAL
+ tar xjf admin/scons-mini.tar.bz2
+ SCONS="./scons"
+ else
+ echo -e $GREEN"$SCONS"$NORMAL
+ fi
+ SCONS="$SCONS -Q"
+}
+
+# Generates a Makefile. Requires that $SCONS is set.
+#
+generateMakefile()
+{
+ cat > Makefile << EOF
+all:
+ @$SCONS
+
+# it is also possible to use
+# @$SCONS -j4
+
+install:
+ @$SCONS install
+
+clean:
+ @$SCONS -c
+
+uninstall:
+ @$SCONS -c install
+
+dist:
+ @$SCONS dist
+
+distclean:
+ @$SCONS -c
+ rm -rf cache/
+EOF
+}
+
+checkPython
+checkSCons
+
+if [[ "$1" == "--help" ]]; then
+ $SCONS --help
+ exit
+fi
+
+generateMakefile
+$SCONS configure $@
+
diff --git a/parts/appwizard/common/wx-Makefile.am b/parts/appwizard/common/wx-Makefile.am
new file mode 100644
index 00000000..af437a64
--- /dev/null
+++ b/parts/appwizard/common/wx-Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/parts/appwizard/common/wx-Makefile.cvs b/parts/appwizard/common/wx-Makefile.cvs
new file mode 100644
index 00000000..4bbd3a59
--- /dev/null
+++ b/parts/appwizard/common/wx-Makefile.cvs
@@ -0,0 +1,5 @@
+default: all
+
+all:
+ srcdir=`pwd` sh macros/autogen.sh
+
diff --git a/parts/appwizard/common/wx-configure.in b/parts/appwizard/common/wx-configure.in
new file mode 100644
index 00000000..1b4ba73d
--- /dev/null
+++ b/parts/appwizard/common/wx-configure.in
@@ -0,0 +1,55 @@
+AC_INIT(src/%{APPNAMELC}.cpp)
+AM_INIT_AUTOMAKE(%{APPNAMELC}, %{VERSION})
+
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_LIBTOOL_DLOPEN
+AC_PROG_LIBTOOL
+
+CPPFLAGS="$CPPFLAGS -Wall -g -fexceptions"
+CXXFLAGS="$CXXFLAGS -Wall -g -fexceptions"
+
+WXCONFIG=wx-config
+AC_ARG_WITH(wx-config,
+[[ --with-wx-config=FILE Use the given path to wx-config when determining
+ wxWidgets configuration; defaults to "wx-config"]],
+[
+ if test "$withval" != "yes" -a "$withval" != ""; then
+ WXCONFIG=$withval
+ fi
+])
+
+wxversion=0
+
+AC_DEFUN([WXTEST],
+[
+ AC_REQUIRE([AC_PROG_AWK])
+ AC_MSG_CHECKING([wxWidgets version])
+ if wxversion=`$WXCONFIG --version`; then
+ AC_MSG_RESULT([$wxversion])
+ else
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
+ fi])
+
+# Call WXTEST func
+WXTEST
+
+# Verify minimus requires
+vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
+if test -n "$vers" && test "$vers" -ge 2003003; then
+ WX_CPPFLAGS="`$WXCONFIG --cppflags`"
+ WX_CXXFLAGS="`$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`"
+ WX_LIBS="`$WXCONFIG --libs`"
+else
+ AC_MSG_ERROR([wxWidgets 2.3.3 or newer is required])
+fi
+
+
+CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
+CXXFLAGS="$CXXFLAGS $WX_CPPFLAGS"
+
+
+AC_SUBST(WX_LIBS)
+
+AC_OUTPUT(Makefile src/Makefile)
diff --git a/parts/appwizard/common/wx/macros/autogen.sh b/parts/appwizard/common/wx/macros/autogen.sh
new file mode 100755
index 00000000..97cce9df
--- /dev/null
+++ b/parts/appwizard/common/wx/macros/autogen.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+aclocal
+libtoolize --automake --force --copy
+automake -a -c
+autoconf
+
diff --git a/parts/appwizard/filepropspage.cpp b/parts/appwizard/filepropspage.cpp
new file mode 100644
index 00000000..8b60e369
--- /dev/null
+++ b/parts/appwizard/filepropspage.cpp
@@ -0,0 +1,88 @@
+#include "filepropspage.h"
+#include <qlistbox.h>
+#include <klineedit.h>
+#include <qtextview.h>
+#include <klocale.h>
+#include <qlabel.h>
+#include <qmultilineedit.h>
+
+/*
+ * Constructs a FilePropsPage which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+FilePropsPage::FilePropsPage( QWidget* parent, const char* name, WFlags fl )
+ : FilePropsPageBase( parent, name, fl ){
+ m_props = new QPtrList<ClassFileProp>;
+ m_current_class = 9999; // no current
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+FilePropsPage::~FilePropsPage()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * public slot
+ */
+void FilePropsPage::slotSelectionChanged()
+{
+ int item = classes_listbox->currentItem();
+ ClassFileProp* prop;
+ // save the old values
+ if (m_current_class != 9999){ // != no selected
+ prop = m_props->at(m_current_class);
+ prop->m_classname = classname_edit->text();
+ prop->m_headerfile = headerfile_edit->text();
+ if(m_different_header_impl){
+ prop->m_implfile = implfile_edit->text();
+ }
+ if(prop->m_change_baseclass){
+ prop->m_baseclass = baseclass_edit->text();
+ }
+ }
+ prop = m_props->at(item);
+ classname_edit->setText(prop->m_classname);
+ desc_textview->setText(prop->m_description);
+ headerfile_edit->setText(prop->m_headerfile);
+ if(m_different_header_impl){
+ implfile_edit->setText(prop->m_implfile);
+ }
+ baseclass_edit->setText(prop->m_baseclass);
+ if(prop->m_change_baseclass){
+ baseclass_edit->setEnabled(true);
+ }
+ else {
+ baseclass_edit->setEnabled(false);
+ }
+ m_current_class = item;
+}
+
+void FilePropsPage::setClassFileProps(QPtrList<ClassFileProp> props,bool different_header_impl){
+ *m_props = props;
+ m_different_header_impl = different_header_impl;
+ if (!m_different_header_impl){
+ implfile_edit->hide();
+ implfile_label->hide();
+ headerfile_label->setText(i18n("Header/Implementation file:"));
+
+ }
+ // fill the listbox
+ ClassFileProp* prop;
+ for ( prop=m_props->first(); prop != 0; prop=m_props->next() ){
+ classes_listbox->insertItem(prop->m_classname);
+ }
+ classes_listbox->setSelected(0,true);
+ slotSelectionChanged();
+}
+
+QPtrList<ClassFileProp> FilePropsPage::getClassFileProps(){
+ return *m_props;
+}
+void FilePropsPage::slotClassnameChanged(const QString& text){
+ classes_listbox->changeItem(text, classes_listbox->currentItem());
+}
+
+#include "filepropspage.moc"
diff --git a/parts/appwizard/filepropspage.h b/parts/appwizard/filepropspage.h
new file mode 100644
index 00000000..3435dfa2
--- /dev/null
+++ b/parts/appwizard/filepropspage.h
@@ -0,0 +1,42 @@
+#ifndef FILEPROPSPAGE_H
+#define FILEPROPSPAGE_H
+#include "filepropspagebase.h"
+#include <qstring.h>
+#include <qptrlist.h>
+
+
+class ClassFileProp {
+ public:
+ QString m_classname;
+ QString m_implfile;
+ QString m_headerfile;
+ QString m_baseclass;
+ QString m_description; // rich text
+ /** to idetify this object*/
+ QString m_key;
+ bool m_change_baseclass;
+};
+
+class FilePropsPage : public FilePropsPageBase
+{
+ Q_OBJECT
+
+public:
+ FilePropsPage( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~FilePropsPage();
+ void setClassFileProps(QPtrList<ClassFileProp> props,bool different_header_impl=true);
+ QPtrList<ClassFileProp> getClassFileProps();
+
+public slots:
+ void slotSelectionChanged();
+ virtual void slotClassnameChanged(const QString&);
+ protected:
+
+ QPtrList<ClassFileProp>* m_props;
+ bool m_different_header_impl;
+ uint m_current_class;
+
+};
+
+
+#endif // FILEPROPSPAGE_H
diff --git a/parts/appwizard/filepropspagebase.ui b/parts/appwizard/filepropspagebase.ui
new file mode 100644
index 00000000..2137d685
--- /dev/null
+++ b/parts/appwizard/filepropspagebase.ui
@@ -0,0 +1,168 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>FilePropsPageBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>410</width>
+ <height>366</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>GroupBox7</cstring>
+ </property>
+ <property name="title">
+ <string>Customize</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Class name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="0">
+ <property name="name">
+ <cstring>classname_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>TextLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Base class:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="0">
+ <property name="name">
+ <cstring>baseclass_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>headerfile_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="1">
+ <property name="name">
+ <cstring>implfile_label</cstring>
+ </property>
+ <property name="text">
+ <string>Implementation file:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>headerfile_label</cstring>
+ </property>
+ <property name="text">
+ <string>Header file:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>implfile_edit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Classes:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Description:</string>
+ </property>
+ </widget>
+ <widget class="QListBox" row="1" column="0">
+ <property name="name">
+ <cstring>classes_listbox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QMultiLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>desc_textview</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="wordWrap">
+ <enum>WidgetWidth</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>classname_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>Form1</receiver>
+ <slot>slotClassnameChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>classes_listbox</sender>
+ <signal>mouseButtonClicked(int,QListBoxItem*,const QPoint&amp;)</signal>
+ <receiver>Form1</receiver>
+ <slot>slotSelectionChanged()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>classes_listbox</tabstop>
+ <tabstop>classname_edit</tabstop>
+ <tabstop>headerfile_edit</tabstop>
+ <tabstop>baseclass_edit</tabstop>
+ <tabstop>implfile_edit</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot>slotSelectionChanged()</slot>
+ <slot>slotClassnameChanged(const QString&amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/appwizard/importdlg.cpp b/parts/appwizard/importdlg.cpp
new file mode 100644
index 00000000..b900181d
--- /dev/null
+++ b/parts/appwizard/importdlg.cpp
@@ -0,0 +1,582 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "importdlg.h"
+#include <stdlib.h>
+#include <qcombobox.h>
+#include <qdir.h>
+#include <qfile.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <klineedit.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+#include <qtextstream.h>
+#include <qtooltip.h>
+#include <qcheckbox.h>
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kfiledialog.h>
+#include <kinstance.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <kcursor.h>
+#include <kfile.h>
+#include <kurlrequester.h>
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+#include <kprocess.h>
+
+#include "kdevcore.h"
+#include "kdevversioncontrol.h"
+#include "kdevplugincontroller.h"
+
+#include "domutil.h"
+#include "settings.h"
+#include "profile.h"
+#include "profileengine.h"
+
+#include "appwizardfactory.h"
+#include "appwizardpart.h"
+#include "misc.h"
+
+
+ImportDialog::ImportDialog(AppWizardPart *part, QWidget *parent, const char *name)
+ : ImportDialogBase(parent, name, true), m_part(part)
+{
+ QString author, email;
+ AppWizardUtil::guessAuthorAndEmail(&author, &email);
+ author_edit->setText(author);
+ email_edit->setText(email);
+ QToolTip::add( urlinput_edit->button(), i18n("Choose directory to import") );
+ urlinput_edit->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
+
+ KStandardDirs *dirs = AppWizardFactory::instance()->dirs();
+ importNames = dirs->findAllResources("appimports", QString::null, false, true);
+ importNames.sort();
+
+ QStringList::ConstIterator it;
+ for (it = importNames.begin(); it != importNames.end(); ++it) {
+ KConfig config(KGlobal::dirs()->findResource("appimports", *it));
+ config.setGroup("General");
+ QString type = config.readEntry("Comment");
+ project_combo->insertItem(type);
+
+ if (config.hasGroup("Infrastructure"))
+ {
+ config.setGroup("Infrastructure");
+ m_infrastructure[type].isOn = true;
+ m_infrastructure[type].comment = config.readEntry("Comment");
+ m_infrastructure[type].command = config.readEntry("Command");
+ m_infrastructure[type].existingPattern = config.readEntry("ExistingProjectPattern");
+ }
+ else
+ m_infrastructure[type].isOn = false;
+ }
+
+ infrastructureBox->setEnabled(false);
+ setProjectType("c");
+ connect( name_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotProjectNameChanged( const QString & ) ) );
+// scanAvailableVCS();
+ connect( fetchModuleButton, SIGNAL(clicked()),
+ this, SLOT(slotFetchModulesFromRepository()) );
+ connect(urlinput_edit, SIGNAL(urlSelected(const QString& )), this, SLOT(dirChanged()));
+ connect(urlinput_edit, SIGNAL(returnPressed(const QString& )), this, SLOT(dirChanged()));
+ slotProjectNameChanged( name_edit->text() );
+}
+
+
+ImportDialog::~ImportDialog()
+{}
+
+void ImportDialog::slotProjectNameChanged( const QString &_text )
+{
+ ok_button->setEnabled( !_text.isEmpty() && !urlinput_edit->url().contains( QRegExp("\\s") ) );
+}
+
+void ImportDialog::accept()
+{
+ QDir dir(urlinput_edit->url());
+ if (urlinput_edit->url().isEmpty() || !dir.exists()) {
+ KMessageBox::sorry(this, i18n("You have to choose a directory."));
+ return;
+ }
+
+ QString projectName = name_edit->text();
+ if (projectName.isEmpty()) {
+ KMessageBox::sorry(this, i18n("You have to choose a project name."));
+ return;
+ }
+
+ for (uint i=0; i < projectName.length(); ++i)
+ if (!projectName[i].isLetterOrNumber() && projectName[i] != '_') {
+ KMessageBox::sorry(this, i18n("Your application name should only contain letters and numbers."));
+ return;
+ }
+
+ if (infrastructureBox->isVisible() && infrastructureBox->isChecked())
+ createProjectInfrastructure();
+
+// QString author = author_edit->text();
+// QString email = email_edit->text();
+
+ QFileInfo finfo(importNames[project_combo->currentItem()]);
+ QDir importdir(finfo.dir());
+ importdir.cdUp();
+ QFile src(importdir.filePath("importfiles/" + finfo.fileName() + ".kdevelop"));
+ kdDebug(9010) << "Import template " << src.name() << endl;
+ if (!src.open(IO_ReadOnly)) {
+ KMessageBox::sorry(this, i18n("Cannot open project template."));
+ return;
+ }
+
+ // Read the DOM of the newly created project
+ QDomDocument projectDOM;
+
+ int errorLine, errorCol;
+ QString errorMsg;
+ bool success = projectDOM.setContent( &src, &errorMsg, &errorLine, &errorCol);
+ src.close();
+ if ( !success )
+ {
+ KMessageBox::sorry( 0, i18n("This is not a valid project file.\n"
+ "XML error in line %1, column %2:\n%3")
+ .arg(errorLine).arg(errorCol).arg(errorMsg));
+ return;
+ }
+
+ DomUtil::writeEntry( projectDOM, "/general/author", author_edit->text() );
+ DomUtil::writeEntry( projectDOM, "/general/email" , email_edit->text() );
+ DomUtil::writeEntry( projectDOM, "/general/projectname", name_edit->text() );
+ if ( !projectVersion.isNull()){
+ DomUtil::writeEntry( projectDOM, "/general/version", projectVersion );
+ } else {
+ DomUtil::writeEntry( projectDOM, "/general/version", "1" );
+ }
+
+ // figure out what plugins we should disable by default
+ QString profileName = DomUtil::readEntry( projectDOM, "general/profile" );
+ if ( profileName.isEmpty() )
+ {
+ QString language = DomUtil::readEntry( projectDOM, "general/primarylanguage" );
+ QStringList keywords = DomUtil::readListEntry( projectDOM, "general/keywords", "keyword" );
+
+ profileName = Settings::profileByAttributes( language, keywords );
+ }
+
+ ProfileEngine & engine = m_part->pluginController()->engine();
+ Profile * profile = engine.findProfile( profileName );
+
+ QStringList disableList;
+ Profile::EntryList disableEntryList = profile->list( Profile::ExplicitDisable );
+ for ( Profile::EntryList::const_iterator it = disableEntryList.constBegin(); it != disableEntryList.constEnd(); ++it )
+ {
+ disableList << (*it).name;
+ }
+
+ DomUtil::writeListEntry( projectDOM, "/general/ignoreparts", "part", disableList );
+
+
+ // write the dom back
+ QFile dest(dir.filePath(projectName + ".kdevelop"));
+ if (!dest.open(IO_WriteOnly)) {
+ KMessageBox::sorry(this, i18n("Cannot write the project file."));
+ return;
+ }
+ QTextStream ts( &dest );
+ ts.setEncoding(QTextStream::UnicodeUTF8);
+ ts << projectDOM.toString(2);
+ dest.close();
+
+
+// QTextStream srcstream(&src);
+// QTextStream deststream(&dest);
+//
+// while (!srcstream.atEnd()) {
+// QString line = srcstream.readLine();
+// line.replace(QRegExp("\\$APPNAMELC\\$"), projectName);
+// line.replace(QRegExp("\\$AUTHOR\\$"), author);
+// line.replace(QRegExp("\\$EMAIL\\$"), email);
+// deststream << line << endl;
+// }
+//
+// dest.close();
+// src.close();
+
+ m_part->core()->openProject(dir.filePath(projectName + ".kdevelop"));
+
+ kdDebug(9010) << "OPENING PROJECT: " << dir.filePath(projectName + ".kdevelop") << endl;
+
+ QDialog::accept();
+}
+
+
+// Checks if the directory dir and all of its subdirectories
+// (one level recursion) have files that follow patterns
+// patterns is comma-separated
+static bool dirHasFiles(QDir &dir, const QString &patterns)
+{
+ QStringList::ConstIterator pit, sit;
+
+ QStringList patternList = QStringList::split(",", patterns);
+ for (pit = patternList.begin(); pit != patternList.end(); ++pit) {
+ if (!dir.entryList(*pit, QDir::Files).isEmpty()) {
+ kdDebug(9010) << "Has files " << (*pit) << endl;
+ return true;
+ }
+ }
+
+ QStringList subdirList = dir.entryList("*", QDir::Dirs);
+ for (sit = subdirList.begin(); sit != subdirList.end(); ++sit) {
+ QDir subdir(dir);
+ subdir.cd(*sit);
+ for (pit = patternList.begin(); pit != patternList.end(); ++pit) {
+ if (!subdir.entryList(*pit, QDir::Files).isEmpty()) {
+ kdDebug(9010) << "Has files " << (*pit) << " in " << (*sit) << endl;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+void ImportDialog::dirChanged()
+{
+ kdDebug(9010) << "ImportDialog::dirChanged" << endl;
+ QString dirName = urlinput_edit->url();
+ QDir dir(dirName);
+ if (!dir.exists())
+ return;
+
+ if ( dirName.contains( QRegExp("\\s") ) )
+ {
+ ok_button->setEnabled( false );
+ return;
+ }else
+ {
+ ok_button->setEnabled( true );
+ }
+
+ // KDevelop legacy project?
+ QStringList files = dir.entryList("*.kdevprj");
+ if (!files.isEmpty()) {
+ scanLegacyKDevelopProject(dir.absFilePath(files.first()));
+ return;
+ }
+
+ // Studio legacy project?
+ files = dir.entryList("*.studio");
+ if (!files.isEmpty()) {
+ scanLegacyStudioProject(dir.absFilePath(files.first()));
+ return;
+ }
+
+ // Automake based?
+ if ( dir.exists("configure.in.in")|| dir.exists("configure.ac")|| dir.exists("configure.in")) {
+ scanAutomakeProject(dirName);
+ return;
+ }
+
+ // Remove any characters from the dirName that would be invalid in a project name
+ QString projectName(dir.dirName().replace(QRegExp("[^a-zA-Z0-9_]"), "_"));
+
+ // Set the project name
+ name_edit->setText(projectName);
+
+ // QMake based?
+ files = dir.entryList("*.pro");
+ if (!files.isEmpty()) {
+ setProjectType("qtqmake");
+ return;
+ }
+
+ // C++?
+ if (dirHasFiles(dir, "*.cpp,*.c++,*.cxx,*.C,*.cc,*.ocl")) {
+ setProjectType("cpp");
+ return;
+ }
+
+ // Fortran?
+ if (dirHasFiles(dir, "*.f77,*.f,*.for,*.ftn")) {
+ setProjectType("fortran");
+ return;
+ }
+
+ // Python?
+ if (dirHasFiles(dir, "*.py")) {
+ setProjectType("python");
+ return;
+ }
+
+ // Perl?
+ if (dirHasFiles(dir, "*.pl,*.pm")) {
+ setProjectType("perl");
+ return;
+ }
+}
+
+
+void ImportDialog::scanLegacyKDevelopProject(const QString &fileName)
+{
+ kdDebug(9010) << "Scanning legacy KDevelop project file " << fileName << endl;
+
+ KSimpleConfig config(fileName, true);
+ config.setGroup("General");
+ author_edit->setText(config.readEntry("author"));
+ email_edit->setText(config.readEntry("email"));
+ name_edit->setText(config.readEntry("project_name"));
+
+ QString legacyType = config.readEntry("project_type");
+ if (QStringList::split(",", "normal_kde,normal_kde2,kde2_normal,mdi_kde2").contains(legacyType))
+ setProjectType("kde");
+ else if (legacyType == "normal_gnome")
+ setProjectType("gnome");
+ else if (legacyType == "normal_empty")
+ setProjectType("cpp-auto");
+ else
+ setProjectType("cpp");
+}
+
+
+void ImportDialog::scanLegacyStudioProject(const QString &fileName)
+{
+ kdDebug(9010) << "Scanning legacy studio project file " << fileName << endl;
+
+ // Not much to do here...
+ KSimpleConfig config(fileName, true);
+ config.setGroup("kdestudio");
+ name_edit->setText(config.readEntry("Name"));
+}
+
+
+void ImportDialog::scanAutomakeProject(const QString &dirName)
+{
+ kdDebug(9010) << "Scanning automake project directory " << dirName << endl;
+
+ bool stop = false;
+ if (QFile::exists(dirName + "/admin/am_edit")) {
+ setProjectType("kde");
+ stop = true;
+ } else if (QFile::exists(dirName + "/macros/gnome.m4")) {
+ setProjectType("gnome");
+ stop = true;
+ } else {
+ setProjectType("c-auto");
+ }
+
+ // if we get an authors file, use it.
+ QFile af(dirName + "/AUTHORS");
+ if (af.open(IO_ReadOnly)){
+ QTextStream astream(&af);
+
+ QRegExp authorre("(.*)<(.*)>");
+ while (!astream.atEnd()) {
+ QString s = astream.readLine();
+ if (authorre.search(s) != -1) {
+ author_edit->setText(authorre.cap(1).stripWhiteSpace());
+ email_edit->setText(authorre.cap(2).stripWhiteSpace());
+ break;
+ }
+ }
+ af.close();
+ }
+
+ // we ignore old AC_INIT that had no version..
+ // only match the if there is a comma and at least two args..
+ // AC_INIT (package, version, [bug-report], [tarname])
+ QRegExp ac_init("^AC_INIT\\s*\\(\\s*([^,]+),([^,\\)]+)(.*)");
+
+ // AM_INIT_AUTOMAKE([OPTIONS])
+ // example: AM_INIT_AUTOMAKE([gnits 1.5 no-define dist-bzip2])
+ QRegExp am_autoSpace("^AM_INIT_AUTOMAKE\\s{0,}\\(\\s{0,}([\\[\\s]{0,}[^\\s]+)\\s+([^\\s\\)\\]]+)(.*)");
+
+ // AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+ QRegExp am_autoComma("^AM_INIT_AUTOMAKE\\s*\\(\\s*([^,]+),([^,\\)]+)(.*)");
+
+ // look for version in a define.
+ // AC_DEFINE(VERSION, "5.6")
+ QRegExp ac_define("^AC_DEFINE\\s*\\(\\s*[^,]+,([^\\)]+)");
+ QRegExp version("(\\bversion\\b)");
+ version.setCaseSensitive(FALSE);
+
+ QTextStream cstream;
+ // try for configure.in.in, configure.in, then configure.ac
+ QFile configInIn(dirName + "/configure.in.in");
+ QFile configIn(dirName+"/configure.in");
+ QFile configAc(dirName+"/configure.ac");
+ if (configInIn.open(IO_ReadOnly)){
+ cstream.setDevice(&configInIn);
+ while (!cstream.atEnd()) {
+ QString line = cstream.readLine();
+ if ( ac_init.search(line) >= 0){
+ projectVersion=ac_init.cap(2).stripWhiteSpace();
+ }
+ else if ( am_autoComma.search(line) >= 0 ){
+ projectVersion=am_autoComma.cap(2).stripWhiteSpace();
+ }
+ else if ( am_autoSpace.search(line) >= 0 ){
+ projectVersion=am_autoSpace.cap(2).stripWhiteSpace();
+ }
+ else if ( ac_define.search(line) >=0 && version.search(line) >=0) {
+ projectVersion=ac_define.cap(2).stripWhiteSpace();
+ }
+ }
+ configInIn.close();
+ }
+
+ if (configIn.open(IO_ReadOnly)){
+ cstream.setDevice(&configIn);
+ }
+ else{
+ if (configAc.open(IO_ReadOnly)){
+ cstream.setDevice(&configAc);
+ }
+ else{
+ return;
+ }
+ }
+
+ QRegExp namere("\\s*AM_INIT_AUTOMAKE\\((.*),.*\\).*");
+ QRegExp cppre("\\s*AC_PROG_CXX");
+ QRegExp f77re("\\s*AC_PROG_F77");
+ while (!cstream.atEnd()) {
+ QString line = cstream.readLine();
+ if ( ac_init.search(line) >= 0){
+ projectVersion=ac_init.cap(2).stripWhiteSpace();
+ }
+ else if ( am_autoComma.search(line) >= 0 ){
+ projectVersion=am_autoComma.cap(2).stripWhiteSpace();
+ }
+ else if ( am_autoSpace.search(line) >= 0 ){
+ projectVersion=am_autoSpace.cap(2).stripWhiteSpace();
+ }
+ else if ( ac_define.search(line) >=0 && version.search(line) >=0) {
+ projectVersion=ac_define.cap(2).stripWhiteSpace();
+ }
+
+ if (namere.search(line) == 0)
+ name_edit->setText(namere.cap(1).stripWhiteSpace());
+ if (!stop)
+ continue;
+ else if (cppre.search(line) == 0)
+ setProjectType("cpp-auto");
+ else if (f77re.search(line) == 0)
+ setProjectType("fortran-auto");
+ }
+
+ if ( configIn.isOpen()) configIn.close();
+ if ( configAc.isOpen()) configAc.close();
+}
+
+
+void ImportDialog::setProjectType(const QString &type)
+{
+ kdDebug(9010) << "Setting project type " << type << endl;
+ QString suffix = "/" + type;
+ int suffixLength = suffix.length();
+
+ int i=0;
+ QStringList::ConstIterator it;
+ for (it = importNames.begin(); it != importNames.end(); ++it) {
+ if ((*it).right(suffixLength) == suffix) {
+ project_combo->setCurrentItem(i);
+ break;
+ }
+ ++i;
+ }
+}
+/*
+void ImportDialog::scanAvailableVCS()
+{
+// vcsCombo->insertStringList( m_part->registeredVersionControls() );
+ int i = 0;
+ KTrader::OfferList offers = KTrader::self()->query("KDevelop/VersionControl");
+ KTrader::OfferList::const_iterator it = offers.begin();
+ while( it != offers.end() )
+ {
+ vcsCombo->insertItem( (*it)->genericName(), i++ );
+ ++it;
+ }
+}
+*/
+/*
+void ImportDialog::slotFinishedCheckout( QString destinationDir )
+{
+ urlinput_edit->setURL( destinationDir );
+
+ setCursor( KCursor::arrowCursor() );
+// setEnabled( true );
+}
+*/
+/*
+void ImportDialog::slotFetchModulesFromRepository()
+{
+
+ KDevVersionControl *vcs = m_part->versionControlByName( vcsCombo->currentText() );
+ if (!vcs)
+ return;
+
+ setCursor( KCursor::waitCursor() );
+// setEnabled( false );
+
+ connect( vcs, SIGNAL(finishedFetching(QString)),
+ this, SLOT(slotFinishedCheckout(QString)) );
+
+ //restore cursor if we can't fetch repository
+ if ( !vcs->fetchFromRepository() )
+ setCursor( KCursor::arrowCursor() );
+
+}
+*/
+void ImportDialog::projectTypeChanged( const QString &type )
+{
+ if (m_infrastructure[type].isOn)
+ {
+ infrastructureBox->setEnabled(true);
+ infrastructureBox->setText(m_infrastructure[type].comment);
+ }
+ else
+ {
+ infrastructureBox->setEnabled(false);
+ infrastructureBox->setText(i18n("Generate build system infrastrucure"));
+ }
+}
+
+void ImportDialog::createProjectInfrastructure( )
+{
+ kdDebug(9010) << "ImportDialog::createProjectInfrastructure" << endl;
+ InfrastructureCmd cmd = m_infrastructure[project_combo->currentText()];
+ if (!cmd.isOn)
+ return;
+
+ QDir dir (urlinput_edit->url());
+ QStringList files = dir.entryList(cmd.existingPattern);
+ if (!files.isEmpty()) {
+ if (KMessageBox::questionYesNo(this, i18n("Project infrastrucure already exists in target directory.\nGenerate new project infrastructure and overwrite old?"), QString::null, i18n("Generate"), i18n("Do Not Generate")) == KMessageBox::No)
+ return;
+ }
+
+ QString command = "cd " + urlinput_edit->url() + " && " + cmd.command;
+ kdDebug(9010) << "executing " << command.ascii() << endl;
+ system(command.ascii());
+}
+
+void ImportDialog::projectTypeChanged( int type )
+{
+ projectTypeChanged(project_combo->text(type));
+}
+
+
+#include "importdlg.moc"
diff --git a/parts/appwizard/importdlg.h b/parts/appwizard/importdlg.h
new file mode 100644
index 00000000..daa136b6
--- /dev/null
+++ b/parts/appwizard/importdlg.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _IMPORTDLG_H_
+#define _IMPORTDLG_H_
+
+#include "importdlgbase.h"
+#include <qstringlist.h>
+
+
+class AppWizardPart;
+
+struct InfrastructureCmd{
+ bool isOn;
+ QString comment;
+ QString command;
+ QString existingPattern;
+};
+
+class ImportDialog : public ImportDialogBase
+{
+ Q_OBJECT
+
+public:
+ ImportDialog( AppWizardPart *part, QWidget *parent=0, const char *name=0 );
+ ~ImportDialog();
+
+protected:
+ virtual void accept();
+
+protected slots:
+ virtual void dirChanged();
+ virtual void projectTypeChanged(const QString &type);
+ virtual void projectTypeChanged(int type);
+
+private slots:
+// void slotFinishedCheckout( QString destinationDir );
+// void slotFetchModulesFromRepository();
+ void slotProjectNameChanged( const QString &_text );
+private:
+// void scanAvailableVCS();
+ void scanLegacyKDevelopProject(const QString &fileName);
+ void scanLegacyStudioProject(const QString &fileName);
+ void scanAutomakeProject(const QString &dirName);
+ void setProjectType(const QString &type);
+
+ void createProjectInfrastructure();
+
+ QStringList importNames;
+ AppWizardPart *m_part;
+ QString projectVersion;
+
+ QMap<QString, InfrastructureCmd> m_infrastructure;
+};
+
+#endif
diff --git a/parts/appwizard/importdlgbase.ui b/parts/appwizard/importdlgbase.ui
new file mode 100644
index 00000000..101c8c58
--- /dev/null
+++ b/parts/appwizard/importdlgbase.ui
@@ -0,0 +1,365 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>ImportDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>import_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>437</width>
+ <height>293</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Import Existing Project</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>dir_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Directory:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>urlinput_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>vcsCombo</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>fetchModuleButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Fetch &amp;Module</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Fetch from:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>vcsCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>name_label</cstring>
+ </property>
+ <property name="text">
+ <string>Project &amp;name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>name_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>name_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="10" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ok_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancel_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QComboBox" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>project_combo</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>project_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Project type:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>project_combo</cstring>
+ </property>
+ </widget>
+ <widget class="Line" row="9" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>urlinput_edit</cstring>
+ </property>
+ </widget>
+ <spacer row="8" column="2">
+ <property name="name">
+ <cstring>Spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Email:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>email_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="7" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>email_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If there exists a file AUTHOR in the
+directory, and it has email addresses
+formated as XXXX &lt;.....&gt; the XXXX
+will be the author, everything between
+&lt;....&gt; is the email address.</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="6" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>author_edit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>If there exists a file AUTHOR in the
+directory, and it has email addresses
+formated as XXXX &lt;.....&gt; the XXXX
+will be the author, everything between
+&lt;....&gt; is the email address.</string>
+ </property>
+ </widget>
+ <spacer row="5" column="2">
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>author_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Author:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>author_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>infrastructureBox</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Generate build system infrastructure</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>ok_button</sender>
+ <signal>clicked()</signal>
+ <receiver>import_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancel_button</sender>
+ <signal>clicked()</signal>
+ <receiver>import_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>project_combo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>import_dialog</receiver>
+ <slot>projectTypeChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>project_combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>import_dialog</receiver>
+ <slot>projectTypeChanged(int)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>urlinput_edit</tabstop>
+ <tabstop>vcsCombo</tabstop>
+ <tabstop>fetchModuleButton</tabstop>
+ <tabstop>name_edit</tabstop>
+ <tabstop>project_combo</tabstop>
+ <tabstop>author_edit</tabstop>
+ <tabstop>email_edit</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">dirButtonClicked()</slot>
+ <slot>dirChanged()</slot>
+ <slot access="protected">projectTypeChanged(const QString &amp;)</slot>
+ <slot access="protected">projectTypeChanged(int)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/appwizard/imports/.kdev_ignore b/parts/appwizard/imports/.kdev_ignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/parts/appwizard/imports/.kdev_ignore
diff --git a/parts/appwizard/imports/Makefile.am b/parts/appwizard/imports/Makefile.am
new file mode 100644
index 00000000..5047de18
--- /dev/null
+++ b/parts/appwizard/imports/Makefile.am
@@ -0,0 +1,7 @@
+appwizarddatadir = ${kde_datadir}/kdevappwizard
+importsdir = ${appwizarddatadir}/imports
+importfilesdir = ${appwizarddatadir}/importfiles
+
+imports_DATA = c-auto cpp-auto fortran-auto java-auto kde gnome c cpp fortran python php perl java java-ant qttmake qtqmake qt4qmake ruby pascal ada
+importfiles_DATA = c-auto.kdevelop cpp-auto.kdevelop fortran-auto.kdevelop java-auto.kdevelop kde.kdevelop gnome.kdevelop c.kdevelop cpp.kdevelop fortran.kdevelop python.kdevelop php.kdevelop perl.kdevelop java.kdevelop java-ant.kdevelop qttmake.kdevelop qtqmake.kdevelop qt4qmake.kdevelop ruby.kdevelop pascal.kdevelop ada.kdevelop
+
diff --git a/parts/appwizard/imports/ada b/parts/appwizard/imports/ada
new file mode 100644
index 00000000..246fd3fe
--- /dev/null
+++ b/parts/appwizard/imports/ada
@@ -0,0 +1,5 @@
+# KDE Config File
+[General]
+Comment=Ada Application
+Comment[fr]=Une application ADA
+
diff --git a/parts/appwizard/imports/ada.kdevelop b/parts/appwizard/imports/ada.kdevelop
new file mode 100644
index 00000000..779c8bbd
--- /dev/null
+++ b/parts/appwizard/imports/ada.kdevelop
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAdaProject</projectmanagement>
+ <primarylanguage>Ada</primarylanguage>
+ <keywords>
+ <keyword>Ada</keyword>
+ <keyword>Code</keyword>
+ </keywords>
+ </general>
+ <kdevadaproject>
+ <run>
+ <terminal>true</terminal>
+ </run>
+ </kdevadaproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="adb"/>
+ <type ext="ads"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/c b/parts/appwizard/imports/c
new file mode 100644
index 00000000..c87f05ef
--- /dev/null
+++ b/parts/appwizard/imports/c
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Generic C Application (Custom Buildsystem)
+Comment[fr]=Une application C gnrique (Makefiles personnaliss)
diff --git a/parts/appwizard/imports/c-auto b/parts/appwizard/imports/c-auto
new file mode 100644
index 00000000..223a5010
--- /dev/null
+++ b/parts/appwizard/imports/c-auto
@@ -0,0 +1,8 @@
+# KDE Config File
+[General]
+Comment=Generic C Application (Automake-based)
+Comment[fr]=Une application C g��ique (Makefiles bas� sur Automake)
+
+#[Infrastructure]
+#Comment=Attempt to generate Autotools project infrastructure
+#Command=autoscan && cp configure.scan configure.in
diff --git a/parts/appwizard/imports/c-auto.kdevelop b/parts/appwizard/imports/c-auto.kdevelop
new file mode 100644
index 00000000..fd5a3f2e
--- /dev/null
+++ b/parts/appwizard/imports/c-auto.kdevelop
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAutoProject</projectmanagement>
+ <primarylanguage>C</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevautoproject>
+ <general>
+ <useconfiguration>debug</useconfiguration>
+ </general>
+ <run>
+ </run>
+ <configurations>
+ <optimized>
+ <builddir>optimized</builddir>
+ <ccompiler>GccOptions</ccompiler>
+ <cxxcompiler>GppOptions</cxxcompiler>
+ <f77compiler>G77Options</f77compiler>
+ <cflags>-O2 -g0</cflags>
+ </optimized>
+ <debug>
+ <configargs>--enable-debug=full</configargs>
+ <builddir>debug</builddir>
+ <ccompiler>GccOptions</ccompiler>
+ <cxxcompiler>GppOptions</cxxcompiler>
+ <f77compiler>G77Options</f77compiler>
+ <cflags>-O0 -g3</cflags>
+ </debug>
+ </configurations>
+ </kdevautoproject>
+ <kdevdebugger>
+ <general>
+ <dbgshell>libtool</dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>w3c-svg</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <filetypes/>
+ <useglobaltypes>
+ <type ext="c" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/c.kdevelop b/parts/appwizard/imports/c.kdevelop
new file mode 100644
index 00000000..24e1423d
--- /dev/null
+++ b/parts/appwizard/imports/c.kdevelop
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevCustomProject</projectmanagement>
+ <primarylanguage>C</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevcustomproject>
+ <run>
+ </run>
+ </kdevcustomproject>
+ <kdevdebugger>
+ <general>
+ <dbgshell></dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>w3c-svg</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <filetypes/>
+ <useglobaltypes>
+ <type ext="c" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/cpp b/parts/appwizard/imports/cpp
new file mode 100644
index 00000000..425ac81c
--- /dev/null
+++ b/parts/appwizard/imports/cpp
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Generic C++ Application (Custom Buildsystem)
+Comment[fr]=Une application C++ gnrique (Makefiles personnaliss)
diff --git a/parts/appwizard/imports/cpp-auto b/parts/appwizard/imports/cpp-auto
new file mode 100644
index 00000000..f1555d2f
--- /dev/null
+++ b/parts/appwizard/imports/cpp-auto
@@ -0,0 +1,8 @@
+# KDE Config File
+[General]
+Comment=Generic C++ Application (Automake based)
+Comment[fr]=Une application C++ g��ique (Makefiles bas� sur Automake)
+
+#[Infrastructure]
+#Comment=Attempt to generate Autotools project infrastructure
+#Command=autoscan && cp configure.scan configure.in
diff --git a/parts/appwizard/imports/cpp-auto.kdevelop b/parts/appwizard/imports/cpp-auto.kdevelop
new file mode 100644
index 00000000..8ebabddf
--- /dev/null
+++ b/parts/appwizard/imports/cpp-auto.kdevelop
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAutoProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevautoproject>
+ <general>
+ <useconfiguration>debug</useconfiguration>
+ </general>
+ <configurations>
+ <optimized>
+ <builddir>optimized</builddir>
+ <ccompiler>GccOptions</ccompiler>
+ <cxxcompiler>GppOptions</cxxcompiler>
+ <f77compiler>G77Options</f77compiler>
+ <cxxflags>-O2 -g0</cxxflags>
+ </optimized>
+ <debug>
+ <configargs>--enable-debug=full</configargs>
+ <builddir>debug</builddir>
+ <ccompiler>GccOptions</ccompiler>
+ <cxxcompiler>GppOptions</cxxcompiler>
+ <f77compiler>G77Options</f77compiler>
+ <cxxflags>-O0 -g3</cxxflags>
+ </debug>
+ </configurations>
+ </kdevautoproject>
+ <kdevdebugger>
+ <general>
+ <dbgshell>libtool</dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>sw</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>w3c-svg</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <filetypes/>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/cpp.kdevelop b/parts/appwizard/imports/cpp.kdevelop
new file mode 100644
index 00000000..4642acce
--- /dev/null
+++ b/parts/appwizard/imports/cpp.kdevelop
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevCustomProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevcustomproject>
+ <run>
+ </run>
+ </kdevcustomproject>
+ <kdevdebugger>
+ <general>
+ <dbgshell></dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>sw</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>w3c-svg</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <filetypes/>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/fortran b/parts/appwizard/imports/fortran
new file mode 100644
index 00000000..5294ff24
--- /dev/null
+++ b/parts/appwizard/imports/fortran
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Fortran Application (Custom Buildsystem)
+Comment[fr]=Une application FORTRAN (Makefiles personnaliss)
diff --git a/parts/appwizard/imports/fortran-auto b/parts/appwizard/imports/fortran-auto
new file mode 100644
index 00000000..b6193ae0
--- /dev/null
+++ b/parts/appwizard/imports/fortran-auto
@@ -0,0 +1,8 @@
+# KDE Config File
+[General]
+Comment=Fortran Application (Automake based)
+Comment[fr]=Une application FORTRAN (Makefiles bas� sur Automake)
+
+#[Infrastructure]
+#Comment=Attempt to generate Autotools project infrastructure
+#Command=autoscan && cp configure.scan configure.in
diff --git a/parts/appwizard/imports/fortran-auto.kdevelop b/parts/appwizard/imports/fortran-auto.kdevelop
new file mode 100644
index 00000000..8f7e0637
--- /dev/null
+++ b/parts/appwizard/imports/fortran-auto.kdevelop
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAutoProject</projectmanagement>
+ <primarylanguage>Fortran77</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell>libtool</dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="f"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/fortran.kdevelop b/parts/appwizard/imports/fortran.kdevelop
new file mode 100644
index 00000000..cc1b11b9
--- /dev/null
+++ b/parts/appwizard/imports/fortran.kdevelop
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevCustomProject</projectmanagement>
+ <primarylanguage>Fortran77</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevautoproject>
+ <general>
+ </general>
+ </kdevautoproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell></dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="f"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/gnome b/parts/appwizard/imports/gnome
new file mode 100644
index 00000000..03fdf349
--- /dev/null
+++ b/parts/appwizard/imports/gnome
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=GNOME C Application (Automake based)
+Comment[fr]=Une application C pour GNOME (Makefiles bass sur Automake)
diff --git a/parts/appwizard/imports/gnome.kdevelop b/parts/appwizard/imports/gnome.kdevelop
new file mode 100644
index 00000000..a02ad52f
--- /dev/null
+++ b/parts/appwizard/imports/gnome.kdevelop
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAutoProject</projectmanagement>
+ <primarylanguage>C</primarylanguage>
+ <ignoreparts>
+ <part>KDevJavaDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevautoproject>
+ <general>
+ <useconfiguration>debug</useconfiguration>
+ </general>
+ <configurations>
+ <optimized>
+ <builddir>optimized</builddir>
+ <ccompiler>GccOptions</ccompiler>
+ <cxxcompiler>GppOptions</cxxcompiler>
+ <f77compiler>G77Options</f77compiler>
+ <cflags>-O2 -g0</cflags>
+ </optimized>
+ <debug>
+ <configargs>--enable-debug=full</configargs>
+ <builddir>debug</builddir>
+ <ccompiler>GccOptions</ccompiler>
+ <cxxcompiler>GppOptions</cxxcompiler>
+ <f77compiler>G77Options</f77compiler>
+ <cflags>-O0 -g3</cflags>
+ </debug>
+ </configurations>
+ </kdevautoproject>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.c;*.h" name="Sources" />
+ <group pattern="*.glade" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*.po" name="Translations" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnustep</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell>libtool</dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="c"/>
+ <type ext="h"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/java b/parts/appwizard/imports/java
new file mode 100644
index 00000000..2fb51257
--- /dev/null
+++ b/parts/appwizard/imports/java
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Java Application (Automake based)
+Comment[fr]=Une application JAVA (Makefiles bass sur Automake)
diff --git a/parts/appwizard/imports/java-ant b/parts/appwizard/imports/java-ant
new file mode 100644
index 00000000..114d9bf7
--- /dev/null
+++ b/parts/appwizard/imports/java-ant
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Java Application (Ant based)
+Comment[fr]=Une application JAVA (Makefiles bass sur Ant)
diff --git a/parts/appwizard/imports/java-ant.kdevelop b/parts/appwizard/imports/java-ant.kdevelop
new file mode 100644
index 00000000..73595a85
--- /dev/null
+++ b/parts/appwizard/imports/java-ant.kdevelop
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAntProject</projectmanagement>
+ <primarylanguage>Java</primarylanguage>
+ <ignoreparts>
+ <part>KDevDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevcustomproject>
+ <build>
+ <buildtool>ant</buildtool>
+ </build>
+ </kdevcustomproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="java"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/java-auto b/parts/appwizard/imports/java-auto
new file mode 100644
index 00000000..d821abc1
--- /dev/null
+++ b/parts/appwizard/imports/java-auto
@@ -0,0 +1,8 @@
+# KDE Config File
+[General]
+Comment=Java Application (Automake based)
+Comment[fr]=Une application JAVA (Makefiles bas� sur Automake)
+
+#[Infrastructure]
+#Comment=Attempt to generate Autotools project infrastructure
+#Command=autoscan && cp configure.scan configure.in
diff --git a/parts/appwizard/imports/java-auto.kdevelop b/parts/appwizard/imports/java-auto.kdevelop
new file mode 100644
index 00000000..a4ccfa24
--- /dev/null
+++ b/parts/appwizard/imports/java-auto.kdevelop
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAutoProject</projectmanagement>
+ <primarylanguage>Java</primarylanguage>
+ <ignoreparts>
+ <part>KDevDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="java"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/java.kdevelop b/parts/appwizard/imports/java.kdevelop
new file mode 100644
index 00000000..a4ccfa24
--- /dev/null
+++ b/parts/appwizard/imports/java.kdevelop
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevAutoProject</projectmanagement>
+ <primarylanguage>Java</primarylanguage>
+ <ignoreparts>
+ <part>KDevDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="java"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/kde b/parts/appwizard/imports/kde
new file mode 100644
index 00000000..13614802
--- /dev/null
+++ b/parts/appwizard/imports/kde
@@ -0,0 +1,5 @@
+# KDE Config File
+[General]
+Comment=KDE C++ Application (Automake based)
+Comment[fr]=Une application KDE (Makefiles bass sur Automake)
+
diff --git a/parts/appwizard/imports/kde.kdevelop b/parts/appwizard/imports/kde.kdevelop
new file mode 100644
index 00000000..dbd5d288
--- /dev/null
+++ b/parts/appwizard/imports/kde.kdevelop
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevKDEAutoProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ <keyword>KDE</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*.po;*.ts" name="Translations" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>w3c-svg</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell>libtool</dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/pascal b/parts/appwizard/imports/pascal
new file mode 100644
index 00000000..f9310298
--- /dev/null
+++ b/parts/appwizard/imports/pascal
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Pascal Application
+Comment[fr]=Une application PASCAL \ No newline at end of file
diff --git a/parts/appwizard/imports/pascal.kdevelop b/parts/appwizard/imports/pascal.kdevelop
new file mode 100644
index 00000000..cc3c8bbd
--- /dev/null
+++ b/parts/appwizard/imports/pascal.kdevelop
@@ -0,0 +1,75 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevPascalProject</projectmanagement>
+ <primarylanguage>Pascal</primarylanguage>
+ <keywords>
+ <keyword>Pascal</keyword>
+ <keyword>Code</keyword>
+ </keywords>
+ </general>
+ <kdevpascalproject>
+ <run>
+ <terminal>true</terminal>
+ </run>
+ </kdevpascalproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="pp"/>
+ <type ext="pas"/>
+ <type ext="dpr"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/perl b/parts/appwizard/imports/perl
new file mode 100644
index 00000000..d23d86ed
--- /dev/null
+++ b/parts/appwizard/imports/perl
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Perl Application
+Comment[fr]=Une application PERL
diff --git a/parts/appwizard/imports/perl.kdevelop b/parts/appwizard/imports/perl.kdevelop
new file mode 100644
index 00000000..6a22ce95
--- /dev/null
+++ b/parts/appwizard/imports/perl.kdevelop
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevScriptProject</projectmanagement>
+ <primarylanguage>Perl</primarylanguage>
+ <ignoreparts>
+ </ignoreparts>
+ </general>
+ <kdevscriptproject>
+ <run>
+ </run>
+ </kdevscriptproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="perl"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/php b/parts/appwizard/imports/php
new file mode 100644
index 00000000..a8aa5992
--- /dev/null
+++ b/parts/appwizard/imports/php
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=PHP Application
+Comment[fr]=Une application PHP \ No newline at end of file
diff --git a/parts/appwizard/imports/php.kdevelop b/parts/appwizard/imports/php.kdevelop
new file mode 100644
index 00000000..53704660
--- /dev/null
+++ b/parts/appwizard/imports/php.kdevelop
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevScriptProject</projectmanagement>
+ <primarylanguage>PHP</primarylanguage>
+ <ignoreparts>
+ <part>KDevDoxygen</part>
+ <part>KDevdistpart</part>
+ </ignoreparts>
+ </general>
+ <kdevscriptproject>
+ <general>
+ </general>
+ </kdevscriptproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>gtk</toc>
+ <toc>kde</toc>
+ <toc>gnustep</toc>
+ <toc>python</toc>
+ <toc>perl</toc>
+ </ignoretocs>
+ </kdevdoctreeview>
+<kdevphpsupport>
+ <codeHelp>
+ <codeCompletion>true</codeCompletion>
+ <codeHinting>true</codeHinting>
+ <realtimeParsing>false</realtimeParsing>
+ </codeHelp>
+</kdevphpsupport>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>ada</toc>
+ <toc>ada_bugs_gcc</toc>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>sw</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="php"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/python b/parts/appwizard/imports/python
new file mode 100644
index 00000000..d824ebf5
--- /dev/null
+++ b/parts/appwizard/imports/python
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Python Application
+Comment[fr]=Une application PYTHON
diff --git a/parts/appwizard/imports/python.kdevelop b/parts/appwizard/imports/python.kdevelop
new file mode 100644
index 00000000..fd589a32
--- /dev/null
+++ b/parts/appwizard/imports/python.kdevelop
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevScriptProject</projectmanagement>
+ <primarylanguage>Python</primarylanguage>
+ <ignoreparts>
+ <part>KDevDebugger</part>
+ <part>KDevJavaDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevscriptproject>
+ <run>
+ </run>
+ </kdevscriptproject>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="py"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/qt b/parts/appwizard/imports/qt
new file mode 100644
index 00000000..038a31a4
--- /dev/null
+++ b/parts/appwizard/imports/qt
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Generic C++ Application with Custom Buildsystem
+Comment[fr]=Une application C++ gnrique (Makefiles personnaliss)
diff --git a/parts/appwizard/imports/qt-auto b/parts/appwizard/imports/qt-auto
new file mode 100644
index 00000000..ed937063
--- /dev/null
+++ b/parts/appwizard/imports/qt-auto
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Qt C++ Application (Automake based)
+Comment[fr]=Une application C++ pour Qt (Makefiles bass sur Automake)
diff --git a/parts/appwizard/imports/qt-auto.kdevelop b/parts/appwizard/imports/qt-auto.kdevelop
new file mode 100644
index 00000000..47ffdd4d
--- /dev/null
+++ b/parts/appwizard/imports/qt-auto.kdevelop
@@ -0,0 +1,43 @@
+<!DOCTYPE kdevelop>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevKDEAutoProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*.po;*.ts" name="Translations" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>gtk</toc>
+ <toc>gnustep</toc>
+ <toc>python</toc>
+ <toc>php</toc>
+ <toc>perl</toc>
+ </ignoretocs>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell>libtool</dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/qt.kdevelop b/parts/appwizard/imports/qt.kdevelop
new file mode 100644
index 00000000..9ad4b9bc
--- /dev/null
+++ b/parts/appwizard/imports/qt.kdevelop
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevCustomProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*.po;*.ts" name="Translations" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevcustomproject>
+ <run>
+ </run>
+ </kdevcustomproject>
+ <kdevdebugger>
+ <general>
+ <dbgshell></dbgshell>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/qt4qmake b/parts/appwizard/imports/qt4qmake
new file mode 100644
index 00000000..3dc9fe5b
--- /dev/null
+++ b/parts/appwizard/imports/qt4qmake
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Qt4 C++ Application (QMake4 based)
+Comment[fr]=Une application C++ pour Qt4 (Makefiles bas� sur QMake4)
diff --git a/parts/appwizard/imports/qt4qmake.kdevelop b/parts/appwizard/imports/qt4qmake.kdevelop
new file mode 100644
index 00000000..dedc866b
--- /dev/null
+++ b/parts/appwizard/imports/qt4qmake.kdevelop
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevTrollProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell/>
+ </general>
+ </kdevdebugger>
+ <kdevcppsupport>
+ <qt>
+ <version>4</version>
+ <used>true</used>
+ <includestyle>4</includestyle>
+ <designerintegration>ExternalDesigner</designerintegration>
+ </qt>
+ </kdevcppsupport>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ <type ext="qrc" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/qtqmake b/parts/appwizard/imports/qtqmake
new file mode 100644
index 00000000..24e9160e
--- /dev/null
+++ b/parts/appwizard/imports/qtqmake
@@ -0,0 +1,9 @@
+# KDE Config File
+[General]
+Comment=Qt C++ Application (QMake based)
+Comment[fr]=Une application C++ pour Qt (Makefiles bas� sur QMake)
+
+[Infrastructure]
+Comment=Attempt to generate QMake build system infrastructure
+Command=qmake -project
+ExistingProjectPattern=*.pro
diff --git a/parts/appwizard/imports/qtqmake.kdevelop b/parts/appwizard/imports/qtqmake.kdevelop
new file mode 100644
index 00000000..e3ef09b3
--- /dev/null
+++ b/parts/appwizard/imports/qtqmake.kdevelop
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevTrollProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell/>
+ </general>
+ </kdevdebugger>
+ <kdevcppsupport>
+ <qt>
+ <version>3</version>
+ <used>true</used>
+ <includestyle>3</includestyle>
+ <designerintegration>KDevEmbeddedDesigner</designerintegration>
+ </qt>
+ </kdevcppsupport>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/qttmake b/parts/appwizard/imports/qttmake
new file mode 100644
index 00000000..83743191
--- /dev/null
+++ b/parts/appwizard/imports/qttmake
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Qt C++ Application (TMake based)
+Comment[fr]=Une application C++ pour Qt (Makefiles bass sur TMake)
diff --git a/parts/appwizard/imports/qttmake.kdevelop b/parts/appwizard/imports/qttmake.kdevelop
new file mode 100644
index 00000000..b2607be6
--- /dev/null
+++ b/parts/appwizard/imports/qttmake.kdevelop
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevTMakeProject</projectmanagement>
+ <primarylanguage>C++</primarylanguage>
+ <keywords>
+ <keyword>Qt</keyword>
+ </keywords>
+ </general>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.cpp;*.cxx;*.h" name="Sources" />
+ <group pattern="*.ui" name="User Interface" />
+ <group pattern="*.png" name="Icons" />
+ <group pattern="*" name="Others" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>ruby</toc>
+ <toc>ruby_bugs</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevdebugger>
+ <general>
+ <dbgshell/>
+ </general>
+ </kdevdebugger>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ <type ext="cpp" />
+ <type ext="h" />
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/imports/ruby b/parts/appwizard/imports/ruby
new file mode 100644
index 00000000..de9a469e
--- /dev/null
+++ b/parts/appwizard/imports/ruby
@@ -0,0 +1,4 @@
+# KDE Config File
+[General]
+Comment=Ruby Application
+Comment[fr]=Une application RUBY
diff --git a/parts/appwizard/imports/ruby.kdevelop b/parts/appwizard/imports/ruby.kdevelop
new file mode 100644
index 00000000..c831d76a
--- /dev/null
+++ b/parts/appwizard/imports/ruby.kdevelop
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<kdevelop>
+ <general>
+ <author>%{AUTHOR}</author>
+ <email>%{EMAIL}</email>
+ <version>%{VERSION}</version>
+ <projectmanagement>KDevScriptProject</projectmanagement>
+ <primarylanguage>Ruby</primarylanguage>
+ <keywords>
+ <keyword>Ruby</keyword>
+ </keywords>
+ <ignoreparts>
+ <part>KDevDoxygen</part>
+ <part>KDevdistpart</part>
+ <part>KDevVisualBoyAdvance</part>
+ <part>KDevDebugger</part>
+ </ignoreparts>
+ </general>
+ <kdevscriptproject>
+ <general>
+ <activedir>src</activedir>
+ <includepatterns>*.rb</includepatterns>
+ <excludepatterns>*~</excludepatterns>
+ </general>
+ </kdevscriptproject>
+ <kdevfileview>
+ <groups>
+ <group pattern="*.rb" name="Scripts" />
+ </groups>
+ </kdevfileview>
+ <kdevdoctreeview>
+ <ignoretocs>
+ <toc>bash</toc>
+ <toc>bash_bugs</toc>
+ <toc>c++_bugs_gcc</toc>
+ <toc>clanlib</toc>
+ <toc>w3c-dom-level2-html</toc>
+ <toc>fortran_bugs_gcc</toc>
+ <toc>gnome1</toc>
+ <toc>gnustep</toc>
+ <toc>gtk</toc>
+ <toc>gtk_bugs</toc>
+ <toc>haskell</toc>
+ <toc>haskell_bugs_ghc</toc>
+ <toc>java_bugs_gcc</toc>
+ <toc>java_bugs_sun</toc>
+ <toc>kde2book</toc>
+ <toc>libc</toc>
+ <toc>libstdc++</toc>
+ <toc>opengl</toc>
+ <toc>pascal_bugs_fp</toc>
+ <toc>php</toc>
+ <toc>php_bugs</toc>
+ <toc>perl</toc>
+ <toc>perl_bugs</toc>
+ <toc>python</toc>
+ <toc>python_bugs</toc>
+ <toc>qt-kdev3</toc>
+ <toc>sdl</toc>
+ <toc>stl</toc>
+ <toc>w3c-svg</toc>
+ <toc>sw</toc>
+ <toc>w3c-uaag10</toc>
+ <toc>wxwidgets_bugs</toc>
+ </ignoretocs>
+ <ignoreqt_xml>
+ <toc>Guide to the Qt Translation Tools</toc>
+ <toc>Qt Assistant Manual</toc>
+ <toc>Qt Designer Manual</toc>
+ <toc>Qt Reference Documentation</toc>
+ <toc>qmake User Guide</toc>
+ </ignoreqt_xml>
+ <ignoredoxygen>
+ <toc>KDE Libraries (Doxygen)</toc>
+ </ignoredoxygen>
+ </kdevdoctreeview>
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="rb"/>
+ </useglobaltypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/appwizard/kdevappwizard.desktop b/parts/appwizard/kdevappwizard.desktop
new file mode 100644
index 00000000..64123324
--- /dev/null
+++ b/parts/appwizard/kdevappwizard.desktop
@@ -0,0 +1,87 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Application Wizard
+Comment[br]=Skoazeller meziant
+Comment[ca]=Assistent d'aplicacions
+Comment[da]=Programguide
+Comment[de]=Anwendungs-Assistent für KDevelop
+Comment[el]=Μάγος εφαρμογής
+Comment[es]=Asistente de aplicaciones
+Comment[et]=Rakenduse nõustaja
+Comment[eu]=Aplikazio morroia
+Comment[fa]=جادوگر کاربرد
+Comment[fr]=Assistant de création d'applications
+Comment[ga]=Treoraí Feidhmchláir
+Comment[gl]=Asistente de aplicación
+Comment[hi]=अनुप्रयोग विज़ार्ड
+Comment[hu]=Alkalmazásvarázsló
+Comment[it]=Procedura guidata applicazione
+Comment[ja]=アプリケーションウィザード
+Comment[ms]=Wizard Aplikasi
+Comment[nds]=Programm-Hölper
+Comment[ne]=अनुप्रयोग विजार्ड
+Comment[nl]=Toepassingassistent
+Comment[pl]=Asystent tworzenia programu
+Comment[pt]=Assistente de Aplicações
+Comment[pt_BR]=Assistente de Aplicativo
+Comment[ru]=Мастер создания приложений
+Comment[sk]=Aplikačný sprievodca
+Comment[sl]=Čarovnik za programe
+Comment[sr]=Чаробњак за програме
+Comment[sr@Latn]=Čarobnjak za programe
+Comment[sv]=Programguide
+Comment[ta]=பயன்பாட்டு வழிகாட்டி
+Comment[tg]=Устои сохтани гузориш
+Comment[tr]=Uygulama Sihirbazı
+Comment[zh_CN]=应用程序向导
+Comment[zh_TW]=應用程式精靈
+Name=KDevAppWizard
+Name[da]=KDevelop Programguide
+Name[de]=Anwendungs-Assistent (KDevelop)
+Name[hi]=के-डेव-एप-विज़ार्ड
+Name[nds]=Programm-Hölper (KDevelop)
+Name[pl]=KDevAsystentApli
+Name[sk]=KDev aplikačný sprievodca
+Name[sv]=KDevelop programguide
+Name[zh_TW]=KDevelop 應用程式精靈
+GenericName=Application Wizard
+GenericName[br]=Skoazeller meziant
+GenericName[ca]=Assistent d'aplicacions
+GenericName[da]=Programguide
+GenericName[de]=Anwendungs-Assistent
+GenericName[el]=Μάγος εφαρμογής
+GenericName[es]=Asistente de aplicaciones
+GenericName[et]=Rakenduse nõustaja
+GenericName[eu]=Aplikazio morroia
+GenericName[fa]=جادوگر کاربرد
+GenericName[fr]=Assistant d'applications
+GenericName[ga]=Treoraí Feidhmchláir
+GenericName[gl]=Asistente de aplicación
+GenericName[hi]=अनुप्रयोग विज़ार्ड
+GenericName[hu]=Alkalmazásvarázsló
+GenericName[it]=Procedura guidata applicazione
+GenericName[ja]=アプリケーションウィザード
+GenericName[ms]=Wizard Aplikasi
+GenericName[nds]=Programm-Hölper
+GenericName[ne]=अनुप्रयोग विजार्ड
+GenericName[nl]=Toepassingassistent
+GenericName[pl]=Asystent tworzenia programu
+GenericName[pt]=Assistente de Aplicações
+GenericName[pt_BR]=Assistente de Aplicativo
+GenericName[ru]=Мастер создания приложений
+GenericName[sk]=Aplikačný sprievodca
+GenericName[sl]=Čarovnik za programe
+GenericName[sr]=Чаробњак за програме
+GenericName[sr@Latn]=Čarobnjak za programe
+GenericName[sv]=Programguide
+GenericName[ta]=பயன்பாடு வழிகாட்டி
+GenericName[tg]=Устои сохтани гузориш
+GenericName[tr]=Uygulama Sihirbazı
+GenericName[zh_CN]=应用程序向导
+GenericName[zh_TW]=應用程式精靈
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevappwizard
+X-KDevelop-Scope=Core
+X-KDevelop-Version=5
+X-KDevelop-Properties=ProjectCreation
diff --git a/parts/appwizard/kdevappwizard.rc b/parts/appwizard/kdevappwizard.rc
new file mode 100644
index 00000000..c86e0f44
--- /dev/null
+++ b/parts/appwizard/kdevappwizard.rc
@@ -0,0 +1,10 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevAppWizard" version="1">
+<MenuBar>
+ <Menu name="project" >
+ <Action name="project_new" group="project_new"/>
+ <Action name="project_import" group="project_import"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/appwizard/kdevfile.cpp b/parts/appwizard/kdevfile.cpp
new file mode 100644
index 00000000..1e57e1e6
--- /dev/null
+++ b/parts/appwizard/kdevfile.cpp
@@ -0,0 +1,59 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Sascha Cunz <mail@sacu.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevfile.h"
+
+static struct MimeTypeMapping
+{
+ const char* szMimeType;
+ KDevFile::CommentingStyle commentStyle;
+} mimeTypeMapping[] = {
+{ "text/x-c++hdr", KDevFile::CPPStyle },
+{ "text/x-c++src", KDevFile::CPPStyle },
+{ "text/x-chdr", KDevFile::CStyle },
+{ "text/x-csrc", KDevFile::CStyle },
+{ "text/adasrc", KDevFile::AdaStyle },
+{ "text/x-pascal", KDevFile::PascalStyle },
+{ "text/x-perl", KDevFile::BashStyle },
+{ "text/xml", KDevFile::XMLStyle },
+{ "text/x-xslt", KDevFile::XMLStyle },
+{ "text/x-xslfo", KDevFile::XMLStyle },
+{ "text/html", KDevFile::XMLStyle },
+{ "text/docbook", KDevFile::XMLStyle },
+{ "application/x-php", KDevFile::CPPStyle },
+{ "application/x-shellscript",KDevFile::BashStyle },
+{ NULL, KDevFile::NoCommenting }
+};
+
+KDevFile::CommentingStyle KDevFile::commentingStyleFromMimeType( const QString& mimeType )
+{
+ int idx = 0;
+ while( mimeTypeMapping[idx].szMimeType )
+ {
+ if( mimeType == mimeTypeMapping[idx].szMimeType )
+ return mimeTypeMapping[idx].commentStyle;
+ idx++;
+ }
+ return KDevFile::NoCommenting;
+}
+
+KDevFile::CommentingStyle KDevFile::commentingStyleFromMimeType( KMimeType::Ptr mimeType )
+{
+ return commentingStyleFromMimeType( mimeType->name() );
+}
+
diff --git a/parts/appwizard/kdevfile.h b/parts/appwizard/kdevfile.h
new file mode 100644
index 00000000..578c420e
--- /dev/null
+++ b/parts/appwizard/kdevfile.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Sascha Cunz <sascha@sacu.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+@file kdevfile.h
+File abstraction layer.
+*/
+#ifndef KDEVFILE_H
+#define KDEVFILE_H
+
+#include <kmimetype.h>
+
+/**
+File abstraction.
+*/
+class KDevFile
+{
+public:
+ /**Styles of comment-formats a source file can have.*/
+ enum CommentingStyle
+ {
+ NoCommenting, //!< file seems to be unable to contain comments
+ CPPStyle, //!< C Style: <pre>/* comment */</pre>
+ CStyle, //!< C++ Style: <pre>// comment</pre>
+ AdaStyle, //!< Ada Style: <pre>-- comment --</pre>
+ PascalStyle, //!< Pascal Style: <pre>{ comment }</pre>
+ BashStyle, //!< Shell Style: <pre># comment</pre>
+ XMLStyle //!< XML Style: <pre><!-- comment --></pre>
+ };
+
+public:
+ /**@return A commenting style for a given mime type.
+ @param mimeType A string which defines a mime type (like "text/x-c+++src").*/
+ static CommentingStyle commentingStyleFromMimeType(const QString& mimeType);
+
+ /**@return A commenting style for a given mime type.
+ @param mimeType The mime type.*/
+ static CommentingStyle commentingStyleFromMimeType( KMimeType::Ptr mimeType );
+};
+
+#endif
diff --git a/parts/appwizard/kdevlicense.cpp b/parts/appwizard/kdevlicense.cpp
new file mode 100644
index 00000000..0af182a0
--- /dev/null
+++ b/parts/appwizard/kdevlicense.cpp
@@ -0,0 +1,116 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Sascha Cunz <sascha@sacu.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevlicense.h"
+
+#include <qfile.h>
+#include <qdatetime.h>
+#include <qregexp.h>
+
+KDevLicense::KDevLicense( const QString& name, const QString& fileName )
+ : m_name( name )
+{
+ readFile( fileName );
+}
+
+void KDevLicense::readFile( const QString& fileName )
+{
+ QFile f(fileName);
+ if (!f.open(IO_ReadOnly))
+ return;
+ QTextStream stream(&f);
+ QString str;
+ enum { readingText, readingFiles } mode = readingText;
+ for(;;)
+ {
+ str = stream.readLine();
+ if( str.isNull() )
+ break;
+ if( str == "[FILES]" )
+ mode = readingFiles;
+ else if( str == "[PREFIX]" )
+ mode = readingText;
+ else if( mode == readingFiles )
+ {
+ if( !str.isEmpty() )
+ {
+ m_copyFiles.append( str );
+ }
+ } else
+ m_rawLines.append( str );
+ }
+
+}
+
+QString KDevLicense::assemble( KDevFile::CommentingStyle commentingStyle, const QString& author, const QString& email, int leadingSpaces )
+{
+ // first, build a CPP Style license
+
+ QString strFill;
+ strFill.fill( ' ', leadingSpaces );
+
+ QString str =
+ strFill + "/***************************************************************************\n" +
+ strFill + " * Copyright (C) $YEAR$ by $AUTHOR$ *\n" +
+ strFill + " * $EMAIL$ *\n" +
+ strFill + " * *\n";
+
+// str = str.arg(QDate::currentDate().year()).arg(author.left(45),-45).arg(email.left(67),-67);
+
+ QStringList::Iterator it;
+ for( it = m_rawLines.begin(); it != m_rawLines.end(); ++it )
+ {
+ str += QString( "%1 * %2 *\n").arg( strFill ).arg( *it, -69 );
+ }
+
+ str += strFill + " ***************************************************************************/\n";
+
+ switch( commentingStyle )
+ {
+ case KDevFile::CPPStyle:
+ case KDevFile::CStyle:
+ return str;
+
+ case KDevFile::PascalStyle:
+ str.replace(QRegExp("/\\**\n \\*"), "{\n ");
+ str.replace(QRegExp("\\*\n \\*"), " \n ");
+ str.replace(QRegExp(" *\\**/\n"), "}\n");
+ return str;
+
+ case KDevFile::AdaStyle:
+ str.replace(QRegExp("/\\*"), "--");
+ str.replace(QRegExp(" \\*"), "--");
+ str.replace(QRegExp("\\*/"), "*");
+ return str;
+
+ case KDevFile::BashStyle:
+ str.replace(QRegExp("\\*|/"), "#");
+ str.replace(QRegExp("\n ##"), "\n##");
+ str.replace(QRegExp("\n #"), "\n# ");
+ return str;
+
+ case KDevFile::XMLStyle:
+ str.replace(QRegExp("/\\*"), "<!--");
+ str.replace(QRegExp("\n \\*"), "\n<!--");
+ str.replace(QRegExp("\\*/?\n"), "-->\n");
+ str.replace(QRegExp("\\*"), "_");
+ return str;
+ }
+
+ return "currently unknown/unsupported commenting style";
+}
diff --git a/parts/appwizard/kdevlicense.h b/parts/appwizard/kdevlicense.h
new file mode 100644
index 00000000..23fbc0c6
--- /dev/null
+++ b/parts/appwizard/kdevlicense.h
@@ -0,0 +1,75 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Sascha Cunz <sascha@sacu.de>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEVLICENSE_H
+#define KDEVLICENSE_H
+
+/**
+@file kdevfile.h
+The interface to installed licenses.
+*/
+
+#include <qstringlist.h>
+
+#include "kdevfile.h"
+
+/*The interface to installed licenses.*/
+class KDevLicense
+{
+public:
+ /**Constructs a KDevLicense and loads the given license template file.
+ @param name The name of this license.
+ @param fileName The file name where license template text is kept.*/
+ KDevLicense(const QString& name, const QString& fileName);
+
+public:
+ /**Assembles the license to a string suitable for replacement of a %{LICENSE} .*/
+ QString assemble(KDevFile::CommentingStyle commentingStyle, const QString& author, const QString& email, int leadingSpaces );
+
+ /**
+ * returns the name of this license.
+ */
+ QString name() const { return m_name; }
+
+ /**
+ * returns list of files tat must be present in the project's root directory
+ * if any source files uses this license.
+ */
+ QStringList copyFiles(){ return m_copyFiles; }
+
+private:
+ void readFile( const QString& fileName );
+
+private:
+ /**
+ * Name of this license
+ */
+ QString m_name;
+ /**
+ * Raw lines of the license. Should contain no spaces at
+ * the start or end of each line.
+ */
+ QStringList m_rawLines;
+ /**
+ * List of files that must be added to the project, if any
+ * file in the project uses this license.
+ */
+ QStringList m_copyFiles;
+};
+
+#endif
diff --git a/parts/appwizard/licenses/BSD b/parts/appwizard/licenses/BSD
new file mode 100644
index 00000000..88bb7cc8
--- /dev/null
+++ b/parts/appwizard/licenses/BSD
@@ -0,0 +1,22 @@
+[FILES]
+LICENSE.BSD
+
+[PREFIX]
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/parts/appwizard/licenses/GPL b/parts/appwizard/licenses/GPL
new file mode 100644
index 00000000..58bc3bdb
--- /dev/null
+++ b/parts/appwizard/licenses/GPL
@@ -0,0 +1,18 @@
+[FILES]
+COPYING
+
+[PREFIX]
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the
+Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \ No newline at end of file
diff --git a/parts/appwizard/licenses/GPL+Qt-Exception b/parts/appwizard/licenses/GPL+Qt-Exception
new file mode 100644
index 00000000..f06a70b8
--- /dev/null
+++ b/parts/appwizard/licenses/GPL+Qt-Exception
@@ -0,0 +1,29 @@
+[FILES]
+COPYING
+
+[PREFIX]
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the
+Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+In addition, as a special exception, the copyright holders give
+permission to link the code of this program with any edition of
+the Qt library by Trolltech AS, Norway (or with modified versions
+of Qt that use the same license as Qt), and distribute linked
+combinations including the two. You must obey the GNU General
+Public License in all respects for all of the code used other than
+Qt. If you modify this file, you may extend this exception to
+your version of the file, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from
+your version. \ No newline at end of file
diff --git a/parts/appwizard/licenses/LGPL b/parts/appwizard/licenses/LGPL
new file mode 100644
index 00000000..754c091a
--- /dev/null
+++ b/parts/appwizard/licenses/LGPL
@@ -0,0 +1,18 @@
+[FILES]
+COPYING.LIB
+
+[PREFIX]
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this program; if not, write to the
+Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \ No newline at end of file
diff --git a/parts/appwizard/licenses/MIT b/parts/appwizard/licenses/MIT
new file mode 100644
index 00000000..c180220e
--- /dev/null
+++ b/parts/appwizard/licenses/MIT
@@ -0,0 +1,21 @@
+[FILES]
+LICENSE.MIT
+
+[PREFIX]
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/parts/appwizard/licenses/Makefile.am b/parts/appwizard/licenses/Makefile.am
new file mode 100644
index 00000000..07a5868f
--- /dev/null
+++ b/parts/appwizard/licenses/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/sourceinfo $(all_includes)
+METASOURCES = AUTO
+
+kdevelopdatadir = ${kde_datadir}/kdevelop
+licensesdir = ${kdevelopdatadir}/licenses
+licenses_DATA = GPL LGPL BSD QPL GPL+Qt-Exception MIT NCSA
diff --git a/parts/appwizard/licenses/NCSA b/parts/appwizard/licenses/NCSA
new file mode 100644
index 00000000..f073df23
--- /dev/null
+++ b/parts/appwizard/licenses/NCSA
@@ -0,0 +1,24 @@
+[FILES]
+LICENSE.NCSA
+
+[PREFIX]
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal with the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.
+ * Neither the names of <Name of Development Group, Name of Institution>, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. \ No newline at end of file
diff --git a/parts/appwizard/licenses/QPL b/parts/appwizard/licenses/QPL
new file mode 100644
index 00000000..67a2c9e9
--- /dev/null
+++ b/parts/appwizard/licenses/QPL
@@ -0,0 +1,11 @@
+[FILES]
+LICENSE.QPL
+
+[PREFIX]
+This program may be distributed under the terms of the Q Public
+License as defined by Trolltech AS of Norway and appearing in the
+file LICENSE.QPL included in the packaging of this file.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \ No newline at end of file
diff --git a/parts/appwizard/misc.cpp b/parts/appwizard/misc.cpp
new file mode 100644
index 00000000..3590b589
--- /dev/null
+++ b/parts/appwizard/misc.cpp
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann and Harald Fernengel *
+ * bernd@kdevelop.org, harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "misc.h"
+
+#include <qstring.h>
+#include <kemailsettings.h>
+
+#include <pwd.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <kconfig.h>
+
+void AppWizardUtil::guessAuthorAndEmail(QString *author, QString *email)
+{
+ KEMailSettings emailConfig;
+ emailConfig.setProfile( emailConfig.defaultProfileName() );
+ QString fromAddr = emailConfig.getSetting( KEMailSettings::EmailAddress );
+ QString name = emailConfig.getSetting( KEMailSettings::RealName );
+
+ if ( !fromAddr.isEmpty() && !name.isEmpty() ) {
+ *author = name;
+ *email = fromAddr;
+ return;
+ }
+
+ struct passwd *pw = ::getpwuid(getuid());
+ // pw==0 => the system must be really fucked up
+ if (!pw)
+ return;
+
+ char hostname[512];
+
+ // I guess we don't have to support users with longer host names ;-)
+ (void) ::gethostname(hostname, sizeof hostname);
+
+ if ( name.isEmpty() )
+ *author = QString::fromLocal8Bit( pw->pw_gecos );
+ else
+ *author = name;
+ if ( fromAddr.isEmpty() )
+ *email = QString(pw->pw_name) + "@" + hostname;
+ else
+ *email = fromAddr;
+}
+
diff --git a/parts/appwizard/misc.h b/parts/appwizard/misc.h
new file mode 100644
index 00000000..1378943b
--- /dev/null
+++ b/parts/appwizard/misc.h
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _MISC_H_
+#define _MISC_H_
+
+#include <qstring.h>
+
+class AppWizardUtil
+{
+public:
+ static void guessAuthorAndEmail(QString *author, QString *email);
+};
+
+#endif
diff --git a/parts/appwizard/profilesupport.cpp b/parts/appwizard/profilesupport.cpp
new file mode 100644
index 00000000..5445a228
--- /dev/null
+++ b/parts/appwizard/profilesupport.cpp
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "profilesupport.h"
+
+#include <qfileinfo.h>
+
+#include <kdebug.h>
+#include <kconfig.h>
+
+#include <kdevplugincontroller.h>
+
+ProfileSupport::ProfileSupport(KDevPlugin *parent)
+{
+ KURL::List resources = parent->pluginController()->profileResourcesRecursive("*.appwizard");
+
+ for (KURL::List::const_iterator it = resources.constBegin(); it != resources.constEnd(); ++it)
+ {
+ KConfig config((*it).path());
+ config.setGroup("General");
+ m_templateList += config.readListEntry("List");
+ }
+}
+
+bool ProfileSupport::isInTemplateList(const QString &templateUrl)
+{
+ return m_templateList.contains(QFileInfo(templateUrl).baseName());
+}
diff --git a/parts/appwizard/profilesupport.h b/parts/appwizard/profilesupport.h
new file mode 100644
index 00000000..befc3d21
--- /dev/null
+++ b/parts/appwizard/profilesupport.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef PROFILESUPPORT_H
+#define PROFILESUPPORT_H
+
+#include <kdevplugin.h>
+
+class ProfileSupport{
+public:
+ ProfileSupport(KDevPlugin *parent);
+ bool isInTemplateList(const QString &templateUrl);
+
+private:
+ QStringList m_templateList;
+};
+
+#endif
diff --git a/parts/appwizard/vcs_form.ui b/parts/appwizard/vcs_form.ui
new file mode 100644
index 00000000..27075a88
--- /dev/null
+++ b/parts/appwizard/vcs_form.ui
@@ -0,0 +1,84 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>VcsForm</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>VcsForm</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Vcs Form</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QWidgetStack" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>stack</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>page</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Version control system:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>combo</cstring>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>110</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>combo</sender>
+ <signal>activated(int)</signal>
+ <receiver>stack</receiver>
+ <slot>raiseWidget(int)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in declaration">qwidgetstack.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/astyle/Makefile.am b/parts/astyle/Makefile.am
new file mode 100644
index 00000000..dc3712b2
--- /dev/null
+++ b/parts/astyle/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = -I$(top_srcdir)/lib/astyle -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevastyle.la
+libkdevastyle_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevastyle_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/lib/astyle/libastyle.la
+
+libkdevastyle_la_SOURCES = astyle_part.cpp astyleconfig.ui astyle_widget.cpp astyle_adaptor.cpp
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevastyle.desktop
+
+rc_DATA = kdevpart_astyle.rc
+rcdir = $(kde_datadir)/kdevastyle
diff --git a/parts/astyle/README.dox b/parts/astyle/README.dox
new file mode 100644
index 00000000..4b7d4778
--- /dev/null
+++ b/parts/astyle/README.dox
@@ -0,0 +1,10 @@
+/** \class AStylePart
+A plugin for formatting of sourcecode according to a specified set of rules.
+
+\authors <a href="mailto: <mhk AT caldera.de>">Matthias Hlzer-Klpfel</a>
+
+\feature formats source code according to a specified set of rules
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=astyle&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">astyle component at Bugzilla database</a>
+
+*/
diff --git a/parts/astyle/astyle_adaptor.cpp b/parts/astyle/astyle_adaptor.cpp
new file mode 100644
index 00000000..124da96e
--- /dev/null
+++ b/parts/astyle/astyle_adaptor.cpp
@@ -0,0 +1,270 @@
+#include "astyle_adaptor.h"
+
+#include "astyle_widget.h"
+
+#include <string>
+
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kconfig.h>
+
+
+
+ASStringIterator::ASStringIterator(const QString &text)
+ : ASSourceIterator(), _content(text)
+{
+ _is = new QTextStream(&_content, IO_ReadOnly);
+}
+
+
+ASStringIterator::~ASStringIterator()
+{
+ delete _is;
+}
+
+
+bool ASStringIterator::hasMoreLines() const
+{
+ return !_is->eof();
+}
+
+
+string ASStringIterator::nextLine()
+{
+ return _is->readLine().utf8().data();
+}
+
+
+KDevFormatter::KDevFormatter(const QMap<QString, QVariant>& options)
+{
+// for ( QMap<QString, QVariant>::ConstIterator iter = options.begin();iter != options.end();iter++ )
+// {
+// kdDebug ( 9009 ) << "format: " << iter.key() << "=" << iter.data() << endl;
+// }
+
+ setCStyle();
+
+ // style
+ QString s = options["FStyle"].toString();
+ if ( predefinedStyle( s ) )
+ {
+ return;
+ }
+
+ // fill
+ int wsCount = options["FillCount"].toInt();
+ if (options["Fill"].toString() == "Tabs")
+ {
+ setTabIndentation(wsCount, options["FillForce"].toBool() );
+ m_indentString = "\t";
+ } else
+ {
+ setSpaceIndentation(wsCount);
+ m_indentString = "";
+ m_indentString.fill(' ', wsCount);
+ }
+
+ setTabSpaceConversionMode(options["FillForce"].toBool());
+ setEmptyLineFill(options["Fill_EmptyLines"].toBool());
+
+ // indent
+ setSwitchIndent(options["IndentSwitches"].toBool());
+ setClassIndent(options["IndentClasses"].toBool());
+ setCaseIndent(options["IndentCases"].toBool());
+ setBracketIndent(options["IndentBrackets"].toBool());
+ setNamespaceIndent(options["IndentNamespaces"].toBool());
+ setLabelIndent(options["IndentLabels"].toBool());
+ setBlockIndent(options["IndentBlocks"].toBool());
+ setPreprocessorIndent(options["IndentPreprocessors"].toBool());
+
+ // continuation
+ setMaxInStatementIndentLength(options["MaxStatement"].toInt());
+ if (options["MinConditional"].toInt() != -1)
+ setMinConditionalIndentLength(options["MinConditional"].toInt());
+
+ // brackets
+ s = options["Brackets"].toString();
+ if (s == "Break")
+ setBracketFormatMode(astyle::BREAK_MODE);
+ else if (s == "Attach")
+ setBracketFormatMode(astyle::ATTACH_MODE);
+ else if (s == "Linux")
+ setBracketFormatMode(astyle::BDAC_MODE);
+ else
+ setBracketFormatMode(astyle::NONE_MODE);
+
+ setBreakClosingHeaderBracketsMode(options["BracketsCloseHeaders"].toBool());
+ // blocks
+ setBreakBlocksMode(options["BlockBreak"].toBool());
+ if (options["BlockBreakAll"].toBool()){
+ setBreakBlocksMode(true);
+ setBreakClosingHeaderBlocksMode(true);
+ }
+ setBreakElseIfsMode(options["BlockIfElse"].toBool());
+
+ // padding
+ setOperatorPaddingMode(options["PadOperators"].toBool());
+ setParensInsidePaddingMode(options["PadParenthesesIn"].toBool());
+ setParensOutsidePaddingMode(options["PadParenthesesOut"].toBool());
+ setParensUnPaddingMode(options["PadParenthesesUn"].toBool());
+
+ // oneliner
+ setBreakOneLineBlocksMode(!options["KeepBlocks"].toBool());
+ setSingleStatementsMode(!options["KeepStatements"].toBool());
+}
+
+KDevFormatter::KDevFormatter( AStyleWidget * widget )
+{
+ setCStyle();
+
+ if ( widget->Style_ANSI->isChecked() )
+ {
+ predefinedStyle( "ANSI" );
+ return;
+ }
+ if ( widget->Style_GNU->isChecked() )
+ {
+ predefinedStyle( "GNU" );
+ return;
+ }
+ if ( widget->Style_JAVA->isChecked() )
+ {
+ predefinedStyle( "JAVA" );
+ return;
+ }
+ if ( widget->Style_KR->isChecked() )
+ {
+ predefinedStyle( "KR" );
+ return;
+ }
+ if ( widget->Style_Linux->isChecked() )
+ {
+ predefinedStyle( "Linux" );
+ return;
+ }
+
+ // fill
+ if ( widget->Fill_Tabs->isChecked() )
+ {
+ setTabIndentation(widget->Fill_TabCount->value(), widget->Fill_ForceTabs->isChecked());
+ m_indentString = "\t";
+ }
+ else
+ {
+ setSpaceIndentation( widget->Fill_SpaceCount->value() );
+ m_indentString = "";
+ m_indentString.fill(' ', widget->Fill_SpaceCount->value());
+ }
+
+ setTabSpaceConversionMode(widget->Fill_ConvertTabs->isChecked());
+ setEmptyLineFill(widget->Fill_EmptyLines->isChecked());
+
+ // indent
+ setSwitchIndent( widget->Indent_Switches->isChecked() );
+ setClassIndent( widget->Indent_Classes->isChecked() );
+ setCaseIndent( widget->Indent_Cases->isChecked() );
+ setBracketIndent( widget->Indent_Brackets->isChecked() );
+ setNamespaceIndent( widget->Indent_Namespaces->isChecked() );
+ setLabelIndent( widget->Indent_Labels->isChecked() );
+ setBlockIndent( widget->Indent_Blocks->isChecked());
+ setPreprocessorIndent(widget->Indent_Preprocessors->isChecked());
+
+ // continuation
+ setMaxInStatementIndentLength( widget->Continue_MaxStatement->value() );
+ setMinConditionalIndentLength( widget->Continue_MinConditional->value() );
+
+ // brackets
+ if ( widget->Brackets_Break->isChecked() )
+ {
+ setBracketFormatMode( astyle::BREAK_MODE );
+ }
+ else if ( widget->Brackets_Attach->isChecked() )
+ {
+ setBracketFormatMode( astyle::ATTACH_MODE );
+ }
+ else if ( widget->Brackets_Linux->isChecked())
+ {
+ setBracketFormatMode( astyle::BDAC_MODE );
+ }
+ else{
+ setBracketFormatMode( astyle::NONE_MODE );
+ }
+
+ setBreakClosingHeaderBracketsMode( widget->Brackets_CloseHeaders->isChecked());
+
+ // blocks
+ setBreakBlocksMode(widget->Block_Break->isChecked());
+ if (widget->Block_BreakAll->isChecked()){
+ setBreakBlocksMode(true);
+ setBreakClosingHeaderBlocksMode(true);
+ }
+ setBreakElseIfsMode(widget->Block_IfElse->isChecked());
+
+ // padding
+ setOperatorPaddingMode( widget->Pad_Operators->isChecked() );
+
+ setParensInsidePaddingMode( widget->Pad_ParenthesesIn->isChecked() );
+ setParensOutsidePaddingMode( widget->Pad_ParenthesesOut->isChecked() );
+ setParensUnPaddingMode( widget->Pad_ParenthesesUn->isChecked() );
+
+ // oneliner
+ setBreakOneLineBlocksMode( !widget->Keep_Blocks->isChecked() );
+ setSingleStatementsMode( !widget->Keep_Statements->isChecked() );
+}
+
+bool KDevFormatter::predefinedStyle( const QString & style )
+{
+ if (style == "ANSI")
+ {
+ setBracketIndent(false);
+ setSpaceIndentation(4);
+ setBracketFormatMode(astyle::BREAK_MODE);
+ setClassIndent(false);
+ setSwitchIndent(false);
+ setNamespaceIndent(false);
+ return true;
+ }
+ if (style == "KR")
+ {
+ setBracketIndent(false);
+ setSpaceIndentation(4);
+ setBracketFormatMode(astyle::ATTACH_MODE);
+ setClassIndent(false);
+ setSwitchIndent(false);
+ setNamespaceIndent(false);
+ return true;
+ }
+ if (style == "Linux")
+ {
+ setBracketIndent(false);
+ setSpaceIndentation(8);
+ setBracketFormatMode(astyle::BDAC_MODE);
+ setClassIndent(false);
+ setSwitchIndent(false);
+ setNamespaceIndent(false);
+ return true;
+ }
+ if (style == "GNU")
+ {
+ setBlockIndent(true);
+ setSpaceIndentation(2);
+ setBracketFormatMode(astyle::BREAK_MODE);
+ setClassIndent(false);
+ setSwitchIndent(false);
+ setNamespaceIndent(false);
+ return true;
+ }
+ if (style == "JAVA")
+ {
+ setJavaStyle();
+ setBracketIndent(false);
+ setSpaceIndentation(4);
+ setBracketFormatMode(astyle::ATTACH_MODE);
+ setSwitchIndent(false);
+ return true;
+ }
+ return false;
+}
diff --git a/parts/astyle/astyle_adaptor.h b/parts/astyle/astyle_adaptor.h
new file mode 100644
index 00000000..2367c4d7
--- /dev/null
+++ b/parts/astyle/astyle_adaptor.h
@@ -0,0 +1,55 @@
+#ifndef __ASTYLE_ADAPTOR_H__
+#define __ASTYLE_ADAPTOR_H__
+
+
+#include <qstring.h>
+#include <qtextstream.h>
+#include <qmap.h>
+#include <qvariant.h>
+
+#include "astyle.h"
+
+#define GLOBALDOC_OPTIONS 1
+#define PROJECTDOC_OPTIONS 2
+
+
+class ASStringIterator : public astyle::ASSourceIterator
+{
+public:
+
+ ASStringIterator(const QString &string);
+ virtual ~ASStringIterator();
+
+ virtual bool hasMoreLines() const;
+ virtual string nextLine();
+
+
+private:
+
+ QString _content;
+ QTextStream *_is;
+
+};
+
+class AStyleWidget;
+
+class KDevFormatter : public astyle::ASFormatter
+{
+public:
+
+ KDevFormatter(const QMap<QString, QVariant>& options);
+ KDevFormatter( AStyleWidget * widget );
+ QString indentString() const
+ {
+ return m_indentString;
+ }
+
+private:
+ bool predefinedStyle( const QString & style );
+
+private:
+ QString m_indentString;
+};
+
+
+#endif
diff --git a/parts/astyle/astyle_part.cpp b/parts/astyle/astyle_part.cpp
new file mode 100644
index 00000000..526af170
--- /dev/null
+++ b/parts/astyle/astyle_part.cpp
@@ -0,0 +1,541 @@
+#include "astyle_part.h"
+
+#include <qwhatsthis.h>
+#include <qvbox.h>
+#include <qtextstream.h>
+#include <qpopupmenu.h>
+#include <kdeversion.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kdevgenericfactory.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kparts/partmanager.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/document.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/selectioninterface.h>
+#include <kprogress.h>
+#include <kdevcore.h>
+#include <kdevapi.h>
+#include <kdevpartcontroller.h>
+#include <kdevplugininfo.h>
+#include <configwidgetproxy.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <qlineedit.h>
+#include <qregexp.h>
+
+#include "astyle_widget.h"
+#include "astyle_adaptor.h"
+
+static const KDevPluginInfo data("kdevastyle");
+
+namespace {
+ const char* defaultFormatExtensions = "*.cpp *.h *.hpp,*.c *.h,*.cxx *.hxx,*.c++ *.h++,*.cc *.hh,*.C *.H,*.diff ,*.inl,*.java,*.moc,*.patch,*.tlh,*.xpm";
+}
+
+
+typedef KDevGenericFactory<AStylePart> AStyleFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevastyle, AStyleFactory( data ) )
+
+AStylePart::AStylePart(QObject *parent, const char *name, const QStringList &)
+ : KDevSourceFormatter(&data, parent, name ? name : "AStylePart")
+{
+ setInstance(AStyleFactory::instance());
+
+ setXMLFile("kdevpart_astyle.rc");
+
+ formatTextAction = new KAction(i18n("&Reformat Source"), 0, this, SLOT(beautifySource()), actionCollection(), "edit_astyle");
+ formatTextAction->setEnabled(false);
+ formatTextAction->setToolTip(i18n("Reformat source"));
+ formatTextAction->setWhatsThis(i18n("<b>Reformat source</b><p>Source reformatting functionality using <b>astyle</b> library. "
+ "Also available in <b>New Class</b> and <b>Subclassing</b> wizards."));
+
+ formatFileAction = new KAction(i18n("Format files"), 0, this, SLOT(formatFilesSelect()), actionCollection(), "tools_astyle");
+ formatFileAction->setEnabled(false);
+ formatFileAction->setToolTip(i18n("Format files"));
+ formatFileAction->setWhatsThis(i18n("<b>Fomat files</b><p>Formatting functionality using <b>astyle</b> library. "
+ "Also available in <b>New Class</b> and <b>Subclassing</b> wizards."));
+ formatFileAction->setEnabled ( true );
+
+ m_configProxy = new ConfigWidgetProxy(core());
+ m_configProxy->createGlobalConfigPage(i18n("Formatting"), GLOBALDOC_OPTIONS, info()->icon());
+ m_configProxy->createProjectConfigPage(i18n("Formatting"), PROJECTDOC_OPTIONS, info()->icon());
+
+
+ connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase* ,QWidget*,unsigned int)), this, SLOT(insertConfigWidget(const KDialogBase*,QWidget*,unsigned int)));
+
+ connect(partController(), SIGNAL(activePartChanged(KParts::Part*)), this, SLOT(activePartChanged(KParts::Part*)));
+
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+
+ loadGlobal();
+ //use the globals first, project level will override later..
+ m_project=m_global;
+ m_projectExtensions = m_globalExtensions;
+ setExtensions(m_globalExtensions.join("\n"),false);
+
+ // maybe there is a file open already
+ activePartChanged( partController()->activePart() );
+
+}
+
+void AStylePart::loadGlobal()
+{
+// kdDebug(9009) << "Load global"<<endl;
+ KConfig *config = kapp->config();
+ config->setGroup("AStyle");
+ QString options = config->readEntry("Options","BlockBreak=0,BlockBreakAll=0,BlockIfElse=0,Brackets=Break,BracketsCloseHeaders=0,FStyle=UserDefined,Fill=Tabs,FillCount=4,FillEmptyLines=0,FillForce=0,IndentBlocks=0,IndentBrackets=0,IndentCases=0,IndentClasses=1,IndentLabels=1,IndentNamespaces=1,IndentPreprocessors=0,IndentSwitches=1,KeepBlocks=1,KeepStatements=1,MaxStatement=40,MinConditional=-1,PadOperators=0,PadParenthesesIn=1,PadParenthesesOut=1,PadParenthesesUn=1,");
+ m_globalExtensions=QStringList::split(",",config->readEntry("Extensions",defaultFormatExtensions));
+
+ QStringList pairs = QStringList::split( ",", options);
+ QStringList::Iterator it;
+ for ( it = pairs.begin(); it != pairs.end(); ++it ) {
+ QStringList bits = QStringList::split( "=", (*it) );
+ m_global[bits[0]] = bits[1];
+ }
+
+
+// for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++)
+// {
+// kdDebug(9009) << "load: " <<iter.key() << "="<< iter.data() << endl;
+// }
+}
+
+void AStylePart::saveGlobal()
+{
+ QString options;
+ for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++)
+ {
+// kdDebug(9009) <<"saveGlobal" <<iter.key() << "="<< iter.data() << endl;
+ options += iter.key();
+ options += "=";
+ options += iter.data().toString();
+ options += ",";
+ }
+// for (QMap<QString, QVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++)
+// {
+// kdDebug(9009) << "project before: " <<iter.key() << "="<< iter.data() << endl;
+// }
+
+ KConfig *config = kapp->config();
+ config->setGroup("AStyle");
+ config->writeEntry("Options",options);
+ config->writeEntry("Extensions",m_globalExtensions.join(","));
+
+ config->sync();
+// for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++)
+// {
+// kdDebug(9009) << "global after: " <<iter.key() << "="<< iter.data() << endl;
+// }
+// for (QMap<QString, QVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++)
+// {
+// kdDebug(9009) << "project after: " <<iter.key() << "="<< iter.data() << endl;
+// }
+}
+
+AStylePart::~AStylePart()
+{
+ saveGlobal();
+ delete m_configProxy;
+}
+
+void AStylePart::beautifySource()
+{
+ KTextEditor::EditInterface *iface
+ = dynamic_cast<KTextEditor::EditInterface*>(partController()->activePart());
+ if (!iface)
+ return;
+
+ bool has_selection = false;
+
+ KTextEditor::SelectionInterface *sel_iface
+ = dynamic_cast<KTextEditor::SelectionInterface*>(partController()->activePart());
+ if (sel_iface && sel_iface->hasSelection())
+ has_selection = true;
+
+ //if there is a selection, we only format it.
+ ASStringIterator is(has_selection ? sel_iface->selection() : iface->text());
+ KDevFormatter formatter(m_project);
+
+ formatter.init(&is);
+
+ QString output;
+ QTextStream os(&output, IO_WriteOnly);
+
+ // put the selection back to the same indent level.
+ // taking note of the config options.
+ unsigned int indentCount=0;
+ QString indentWith("");
+ if ( has_selection){
+ QString original = sel_iface->selection();
+ for (;indentCount<original.length();indentCount++){
+ QChar ch = original[indentCount];
+ if ( ch.isSpace()){
+ if ( ch == QChar('\n') || ch == QChar('\r')){
+ indentWith="";
+ }
+ else{
+ indentWith+=original[indentCount];
+ }
+ }
+ else{
+ break;
+ }
+ }
+
+ int wsCount = m_project["FillCount"].toInt();
+ if (m_project["Fill"].toString() == "Tabs")
+ {
+ // tabs and wsCount spaces to be a tab
+ QString replace;
+ for (int i =0;i<wsCount;i++)
+ replace+=' ';
+
+ indentWith=indentWith.replace(replace, QChar('\t'));
+ indentWith=indentWith.remove(' ');
+ } else
+ {
+ if ( m_project["FillForce"].toBool()){
+ //convert tabs to spaces
+ QString replace;
+ for (int i =0;i<wsCount;i++)
+ replace+=' ';
+
+ indentWith=indentWith.replace(QChar('\t'),replace);
+ }
+ }
+ }
+
+ while (formatter.hasMoreLines()){
+ if ( has_selection ){
+ os << indentWith;
+ }
+ os << QString::fromUtf8(formatter.nextLine().c_str()) << endl;
+ }
+
+ uint col = 0;
+ uint line = 0;
+
+ if(has_selection) //there was a selection, so only change the part of the text related to it
+ {
+ //remove the final newline character, unless it should be there
+ if ( !sel_iface->selection().endsWith( "\n" ) )
+ output.setLength(output.length()-1);
+
+ sel_iface->removeSelectedText();
+ cursorPos( partController()->activePart(), &col, &line );
+ iface->insertText( col, line, output);
+
+ return;
+ }
+
+ cursorPos( partController()->activePart(), &col, &line );
+
+ iface->setText( output );
+
+ setCursorPos( partController()->activePart(), col, line );
+}
+
+void AStylePart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo)
+{
+ switch (pageNo)
+ {
+ case GLOBALDOC_OPTIONS:
+ {
+ AStyleWidget *w = new AStyleWidget(this, true, page, "astyle config widget");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ break;
+ }
+ case PROJECTDOC_OPTIONS:
+ {
+ AStyleWidget *w = new AStyleWidget(this, false, page, "astyle config widget");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ break;
+ }
+ }
+}
+
+QString AStylePart::getGlobalExtensions(){
+ QString values = m_globalExtensions.join("\n");
+ return values.stripWhiteSpace();
+}
+QString AStylePart::getProjectExtensions(){
+ QString values = m_projectExtensions.join("\n");
+ return values.stripWhiteSpace();
+}
+
+
+/**
+ * Extensions from the widget passed in.
+ * We preserve the order, so common extensions will
+ * end up at the top
+ * @param ext
+ */
+void AStylePart::setExtensions ( QString ext, bool global )
+{
+ kdDebug(9009) << "setExtensions " << ext<<endl;
+ if ( global){
+ m_globalExtensions.clear();
+ m_globalExtensions=QStringList::split ( QRegExp("\n"), ext );
+ }
+ else{
+ m_searchExtensions.clear();
+ m_projectExtensions.clear();
+ m_projectExtensions = QStringList::split ( QRegExp("\n"), ext );
+ QStringList bits = QStringList::split(QRegExp("\\s+"),ext);
+ for ( QStringList::Iterator iter = bits.begin(); iter != bits.end(); iter++ )
+ {
+ QString ending=*iter;
+ if ( ending.startsWith ( "*" ) )
+ {
+ if (ending.length() ==1 ){
+ // special case.. any file.
+ m_searchExtensions.insert(ending, ending);
+ }
+ else{
+ m_searchExtensions.insert( ending.mid( 1 ), ending);
+ }
+ }
+ else
+ {
+ m_searchExtensions.insert(ending, ending);
+ }
+ }
+ }
+}
+
+void AStylePart::activePartChanged ( KParts::Part *part )
+{
+ bool enabled = false;
+
+ KParts::ReadWritePart *rw_part = dynamic_cast<KParts::ReadWritePart*> ( part );
+
+ if ( rw_part )
+ {
+ KTextEditor::EditInterface *iface = dynamic_cast<KTextEditor::EditInterface*> ( rw_part );
+
+ if ( iface )
+ {
+ // check for the everything case..
+ if ( m_searchExtensions.find ( "*" ) == m_searchExtensions.end() )
+ {
+ QString extension = rw_part->url().path();
+ int pos = extension.findRev ( '.' );
+ if ( pos >= 0 )
+ {
+ extension = extension.mid ( pos );
+ enabled = ( m_searchExtensions.find ( extension ) != m_searchExtensions.end() );
+ }
+ }
+ else
+ {
+ enabled = true;
+ }
+ }
+ }
+
+ formatTextAction->setEnabled ( enabled );
+}
+
+QString AStylePart::formatSource( const QString text, AStyleWidget * widget, const QMap<QString, QVariant>& options )
+{
+ ASStringIterator is(text);
+ KDevFormatter * formatter = ( widget)? new KDevFormatter( widget ) : new KDevFormatter(options);
+
+ formatter->init(&is);
+
+ QString output;
+ QTextStream os(&output, IO_WriteOnly);
+
+ while ( formatter->hasMoreLines() )
+ os << QString::fromUtf8( formatter->nextLine().c_str() ) << endl;
+
+ delete formatter;
+
+ return output;
+}
+
+void AStylePart::cursorPos( KParts::Part *part, uint * line, uint * col )
+{
+ if (!part || !part->inherits("KTextEditor::Document")) return;
+
+ KTextEditor::ViewCursorInterface *iface = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
+ if (iface)
+ {
+ iface->cursorPositionReal( line, col );
+ }
+}
+
+void AStylePart::setCursorPos( KParts::Part *part, uint line, uint col )
+{
+ if (!part || !part->inherits("KTextEditor::Document")) return;
+
+ KTextEditor::ViewCursorInterface *iface = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
+ if (iface)
+ {
+ iface->setCursorPositionReal( line, col );
+ }
+}
+
+QString AStylePart::formatSource( const QString text )
+{
+ return formatSource(text, 0, m_project);
+}
+
+QString AStylePart::indentString( ) const
+{
+ KDevFormatter formatter(m_project);
+ return formatter.indentString();
+}
+
+void AStylePart::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ if (context->hasType( Context::EditorContext ))
+ {
+ popup->insertSeparator();
+ int id = popup->insertItem( i18n("Format selection"), this, SLOT(beautifySource()) );
+ popup->setWhatsThis(id, i18n("<b>Format</b><p>Formats the current selection, if possible"));
+ }
+ else if ( context->hasType( Context::FileContext )){
+ const FileContext *ctx = static_cast<const FileContext*>(context);
+ m_urls = ctx->urls();
+
+ popup->insertSeparator();
+ int id = popup->insertItem( i18n("Format files"), this, SLOT(formatFiles()) );
+ popup->setWhatsThis(id, i18n("<b>Format files</b><p>Formats selected files if possible"));
+
+ }
+}
+
+void AStylePart::restorePartialProjectSession(const QDomElement * el)
+{
+ kdDebug(9009) << "Load project" << endl;
+ QDomElement style = el->namedItem("AStyle").toElement();
+
+ if (style.attribute("FStyle", "GLOBAL") == "GLOBAL")
+ {
+ m_project = m_global;
+ m_project["FStyle"] = "GLOBAL";
+ m_projectExtensions=m_globalExtensions;
+ }
+ else
+ {
+ for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++)
+ {
+ m_project[iter.key()] = style.attribute(iter.key(),iter.data().toString());
+ }
+
+ QDomElement exten = el->namedItem("Extensions").toElement();
+ QString ext = exten.attribute("ext").simplifyWhiteSpace();
+ if ( ext.isEmpty()){
+ ext=defaultFormatExtensions;
+ }
+ setExtensions(ext.replace(QChar(','), QChar('\n')),false);
+ }
+}
+
+
+void AStylePart::savePartialProjectSession(QDomElement * el)
+{
+ QDomDocument domDoc = el->ownerDocument();
+ if (domDoc.isNull())
+ return;
+
+ QDomElement style = domDoc.createElement("AStyle");
+ style.setAttribute("FStyle", m_project["FStyle"].toString());
+ if (m_project["FStyle"] != "GLOBAL")
+ {
+ for (QMap<QString, QVariant>::iterator iter = m_project.begin();iter != m_project.end();iter++)
+ {
+ style.setAttribute(iter.key(),iter.data().toString());
+ }
+ QDomElement exten = domDoc.createElement ( "Extensions" );
+ exten.setAttribute ( "ext", m_projectExtensions.join(",").simplifyWhiteSpace() );
+ el->appendChild(exten);
+ }
+ el->appendChild(style);
+}
+
+void AStylePart::formatFilesSelect(){
+ m_urls.clear();
+ QStringList filenames = KFileDialog::getOpenFileNames ( QString::null, getProjectExtensions(),0,"Select files to format" );
+
+ for(QStringList::Iterator it = filenames.begin(); it != filenames.end();it++){
+ m_urls << *it;
+ }
+ formatFiles();
+}
+
+
+/**
+ * Format the selected files with the current style.
+ */
+void AStylePart::formatFiles()
+{
+ KURL::List::iterator it = m_urls.begin();
+ while ( it != m_urls.end() )
+ {
+ kdDebug ( 9009 ) << "Selected " << ( *it ).pathOrURL() << endl;
+ ++it;
+ }
+
+ uint processed = 0;
+ for ( uint fileCount = 0; fileCount < m_urls.size(); fileCount++ )
+ {
+ QString fileName = m_urls[fileCount].pathOrURL();
+
+ bool found = false;
+ for ( QMap<QString, QString>::Iterator it = m_searchExtensions.begin(); it != m_searchExtensions.end(); ++it )
+ {
+ QRegExp re ( it.data(), true, true );
+ if ( re.search ( fileName ) == 0 && ( uint ) re.matchedLength() == fileName.length() )
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if ( found )
+ {
+ QString backup = fileName + "#";
+ QFile fin ( fileName );
+ QFile fout ( backup );
+ if ( fin.open ( IO_ReadOnly ) )
+ {
+ if ( fout.open ( IO_WriteOnly ) )
+ {
+ QString fileContents ( fin.readAll() );
+ fin.close();
+ QTextStream outstream ( &fout );
+ outstream << formatSource ( fileContents );
+ fout.close();
+ QDir().rename ( backup, fileName );
+ processed++;
+ }
+ else
+ {
+ KMessageBox::sorry ( 0, i18n ( "Not able to write %1" ).arg ( backup ) );
+ }
+ }
+ else
+ {
+ KMessageBox::sorry ( 0, i18n ( "Not able to read %1" ).arg ( fileName ) );
+ }
+ }
+ }
+ if ( processed != 0 )
+ {
+ KMessageBox::information ( 0, i18n ( "Processed %1 files ending with extensions %2" ).arg ( processed ).arg(getProjectExtensions().stripWhiteSpace()) );
+ }
+ m_urls.clear();
+
+}
+
+
+#include "astyle_part.moc"
diff --git a/parts/astyle/astyle_part.h b/parts/astyle/astyle_part.h
new file mode 100644
index 00000000..bf572dcc
--- /dev/null
+++ b/parts/astyle/astyle_part.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2001 Matthias H�zer-Klpfel <mhk@caldera.de>
+ */
+
+
+#ifndef __KDEVPART_ASTYLE_H__
+#define __KDEVPART_ASTYLE_H__
+
+class KDialogBase;
+#include <kdevsourceformatter.h>
+#include <kaction.h>
+#include <kparts/part.h>
+#include <kdevplugin.h>
+#include <kdebug.h>
+#include <qmap.h>
+#include <qvariant.h>
+
+class AStyleWidget;
+class QPopupMenu;
+class Context;
+class ConfigWidgetProxy;
+
+class AStylePart : public KDevSourceFormatter
+{
+ Q_OBJECT
+
+public:
+
+ AStylePart(QObject *parent, const char *name, const QStringList &);
+ ~AStylePart();
+
+ QString formatSource(const QString text, AStyleWidget * widget, const QMap<QString, QVariant>& options);
+ virtual QString formatSource(const QString text);
+ QString indentString() const;
+ void saveGlobal();
+ void setExtensions(QString ext, bool global);
+ QString getProjectExtensions();
+ QString getGlobalExtensions();
+ void restorePartialProjectSession(const QDomElement * el);
+ void savePartialProjectSession(QDomElement * el);
+
+ QMap<QString, QVariant>& getProjectOptions(){return m_project;}
+ QMap<QString, QVariant>& getGlobalOptions(){return m_global;}
+
+
+private slots:
+
+ void activePartChanged(KParts::Part *part);
+ void beautifySource();
+ void formatFiles();
+ void formatFilesSelect();
+ void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo);
+ void contextMenu(QPopupMenu *popup, const Context *context);
+
+private:
+
+ void cursorPos( KParts::Part *part, uint * col, uint * line );
+ void setCursorPos( KParts::Part *part, uint col, uint line );
+
+ void loadGlobal();
+
+ ConfigWidgetProxy *m_configProxy;
+ KAction *formatTextAction;
+ KAction *formatFileAction;
+
+ // the configurable options.
+ QMap<QString, QVariant> m_project;
+ QMap<QString, QVariant> m_global;
+ QStringList m_projectExtensions;
+ QStringList m_globalExtensions;
+ QMap<QString, QString> m_searchExtensions;
+ KURL::List m_urls;
+};
+
+
+#endif
diff --git a/parts/astyle/astyle_widget.cpp b/parts/astyle/astyle_widget.cpp
new file mode 100644
index 00000000..0622b91b
--- /dev/null
+++ b/parts/astyle/astyle_widget.cpp
@@ -0,0 +1,346 @@
+#include "astyle_part.h"
+#include "astyle_widget.h"
+
+#include <qradiobutton.h>
+#include <qtabwidget.h>
+#include <qmultilineedit.h>
+#include <qbuttongroup.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kdevcore.h>
+
+
+AStyleWidget::AStyleWidget(AStylePart * part, bool global, QWidget *parent, const char *name)
+ : AStyleConfig(parent, name), m_part(part), isGlobalWidget(global)
+{
+ // which style changed - disable the other pages.
+ connect(StyleGroup, SIGNAL(clicked(int)), this, SLOT(styleChanged()));
+ connect(ConfigTabs, SIGNAL(currentChanged(QWidget*)), this, SLOT(styleChanged()) );
+
+ connect(FillingGroup, SIGNAL(clicked(int)), this, SLOT(styleChanged()));
+ connect(Fill_ForceTabs, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Fill_TabCount, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
+ connect(Fill_SpaceCount, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
+
+ connect(BracketGroup, SIGNAL(clicked(int)), this, SLOT(styleChanged()));
+ connect(Brackets_CloseHeaders, SIGNAL(clicked()), this, SLOT(styleChanged()));
+
+ connect(Indent_Switches, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Cases, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Classes, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Brackets, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Namespaces, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Labels, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Blocks, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Indent_Preprocessors, SIGNAL(clicked()), this, SLOT(styleChanged()));
+
+ connect(Continue_MaxStatement, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
+ connect(Continue_MinConditional, SIGNAL(valueChanged(int)), this, SLOT(styleChanged()));
+
+ connect(Block_Break, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Block_BreakAll, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Block_IfElse, SIGNAL(clicked()), this, SLOT(styleChanged()));
+
+ connect(Pad_ParenthesesIn, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Pad_ParenthesesOut, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Pad_ParenthesesUn, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Pad_Operators, SIGNAL(clicked()), this, SLOT(styleChanged()));
+
+ connect(Keep_Statements, SIGNAL(clicked()), this, SLOT(styleChanged()));
+ connect(Keep_Blocks, SIGNAL(clicked()), this, SLOT(styleChanged()));
+
+
+ QMap<QString, QVariant> option;
+ if ( isGlobalWidget){
+ Style_Global->hide();
+ option = m_part->getGlobalOptions();
+ }
+ else{
+ Style_Global->show();
+ option = m_part->getProjectOptions();
+ }
+
+ // style
+ QString s = option["FStyle"].toString();
+ // fake the id so we disable the other pages.
+ int id=0;
+ if (s == "ANSI") id=1;
+ if (s == "KR") id=2;
+ if (s == "Linux") id=3;
+ if (s == "GNU") id=4;
+ if (s == "JAVA") id=5;
+ if (s == "GLOBAL") id = 6;
+ StyleGroup->setButton(id);
+
+ if ( isGlobalWidget ){
+ GeneralExtension->setText(m_part->getGlobalExtensions());
+ GeneralExtension->setEnabled(true);
+ globalOptions=true;
+ }
+ else{
+ if ( id == 6){
+ GeneralExtension->setText(m_part->getGlobalExtensions());
+ GeneralExtension->setEnabled(false);
+ globalOptions=true;
+ }
+ else{
+ GeneralExtension->setText(m_part->getProjectExtensions());
+ GeneralExtension->setEnabled(true);
+ globalOptions=false;
+ }
+ }
+
+ m_lastExt=GeneralExtension->text();
+
+ if (s == "UserDefined" || s =="GLOBAL" )
+ {
+ int wsCount = option["FillCount"].toInt();
+ if (option["Fill"].toString() == "Tabs")
+ {
+ Fill_Tabs->setChecked(true);
+ Fill_TabCount->setValue(wsCount);
+ Fill_TabCount->setEnabled(true);
+ Fill_ForceTabs->setChecked(option["FillForce"].toBool());
+ Fill_ForceTabs->setEnabled(true);
+ }
+ else
+ {
+ Fill_Spaces->setChecked(true);
+ Fill_SpaceCount->setValue(wsCount);
+ Fill_SpaceCount->setEnabled(true);
+ Fill_ConvertTabs->setChecked(option["FillForce"].toBool());
+ Fill_ConvertTabs->setEnabled(true);
+ }
+
+ Fill_EmptyLines->setChecked(option["FillEmptyLines"].toBool());
+
+ // indent
+ Indent_Switches->setChecked(option["IndentSwitches"].toBool());
+ Indent_Cases->setChecked(option["IndentCases"].toBool());
+ Indent_Classes->setChecked(option["IndentClasses"].toBool());
+ Indent_Brackets->setChecked(option["IndentBrackets"].toBool());
+ Indent_Namespaces->setChecked(option["IndentNamespaces"].toBool());
+ Indent_Labels->setChecked(option["IndentLabels"].toBool());
+ Indent_Blocks->setChecked(option["IndentBlocks"].toBool());
+ Indent_Preprocessors->setChecked(option["IndentPreprocessors"].toBool());
+
+ // contiuation
+ Continue_MaxStatement->setValue(option["MaxStatement"].toInt());
+ Continue_MinConditional->setValue(option["MinConditional"].toInt());
+
+ // brackets
+ s = option["Brackets"].toString();
+ if (s == "Break")
+ Brackets_Break->setChecked(true);
+ else if (s == "Attach")
+ Brackets_Attach->setChecked(true);
+ else if (s == "Linux")
+ Brackets_Linux->setChecked(true);
+ else
+ Brackets_None->setChecked(true);
+
+ Brackets_CloseHeaders->setChecked(option["BracketsCloseHeaders"].toBool());
+
+ Block_Break->setChecked(option["BlockBreak"].toBool());
+ Block_BreakAll->setChecked(option["BlockBreakAll"].toBool());
+ Block_IfElse->setChecked(option["BlockIfElse"].toBool());
+
+ // padding
+ Pad_ParenthesesIn->setChecked(option["PadParenthesesIn"].toBool());
+ Pad_ParenthesesOut->setChecked(option["PadParenthesesOut"].toBool());
+ Pad_ParenthesesUn->setChecked(option["PadParenthesesUn"].toBool());
+
+ Pad_Operators->setChecked(option["PadOperators"].toBool());
+
+ // oneliner
+ Keep_Statements->setChecked(option["KeepStatements"].toBool());
+ Keep_Blocks->setChecked(option["KeepBlocks"].toBool());
+ }
+
+
+ styleChanged();
+}
+
+
+AStyleWidget::~AStyleWidget()
+{
+}
+
+
+void AStyleWidget::accept()
+{
+ QMap<QString, QVariant>* m_option;
+ if ( isGlobalWidget){
+ m_option = &(m_part->getGlobalOptions());
+ m_part->setExtensions(GeneralExtension->text(),true);
+ }
+ else{
+ m_option = &(m_part->getProjectOptions());
+ m_part->setExtensions(GeneralExtension->text(),false);
+ }
+
+
+ // style
+ if (Style_ANSI->isChecked())
+ (*m_option)["FStyle"] = "ANSI";
+ else if (Style_KR->isChecked())
+ (*m_option)["FStyle"] = "KR";
+ else if (Style_Linux->isChecked())
+ (*m_option)["FStyle"] = "Linux";
+ else if (Style_GNU->isChecked())
+ (*m_option)["FStyle"] = "GNU";
+ else if (Style_JAVA->isChecked())
+ (*m_option)["FStyle"] = "JAVA";
+ else if (Style_Global->isChecked()){
+ QMap<QString,QVariant>& global = m_part->getGlobalOptions();
+ QMap<QString,QVariant>& project = m_part->getProjectOptions();
+ project=global;
+ project["FStyle"]="GLOBAL";
+ }
+ else if (Style_UserDefined->isChecked())
+ {
+ (*m_option)["FStyle"] = "UserDefined";
+
+ // fill
+ if (Fill_Tabs->isChecked())
+ {
+ (*m_option)["Fill"] = "Tabs";
+ (*m_option)["FillCount"] = Fill_TabCount->value();
+ (*m_option)["FillForce"] = Fill_ForceTabs->isChecked();
+ }
+ else
+ {
+ (*m_option)["Fill"] = "Spaces";
+ (*m_option)["FillCount"] = Fill_SpaceCount->value();
+ (*m_option)["FillForce"] = Fill_ConvertTabs->isChecked();
+ }
+
+ (*m_option)["FillEmptyLines"] = Fill_EmptyLines->isChecked();
+
+ // indent
+ (*m_option)["IndentSwitches"] = Indent_Switches->isChecked();
+ (*m_option)["IndentCases"] = Indent_Cases->isChecked();
+ (*m_option)["IndentClasses"] = Indent_Classes->isChecked();
+ (*m_option)["IndentBrackets"] = Indent_Brackets->isChecked();
+ (*m_option)["IndentNamespaces"] = Indent_Namespaces->isChecked();
+ (*m_option)["IndentLabels"] = Indent_Labels->isChecked();
+ (*m_option)["IndentBlocks"] = Indent_Blocks->isChecked();
+ (*m_option)["IndentPreprocessors"] = Indent_Preprocessors->isChecked();
+
+ // continuation
+ (*m_option)["MaxStatement"] = Continue_MaxStatement->value();
+ (*m_option)["MinConditional"] = Continue_MinConditional->value();
+
+ // brackets
+ if ( Brackets_None->isChecked())
+ (*m_option)["Brackets"] = "None";
+ else if (Brackets_Break->isChecked())
+ (*m_option)["Brackets"] = "Break";
+ else if (Brackets_Attach->isChecked())
+ (*m_option)["Brackets"] = "Attach";
+ else if (Brackets_Linux->isChecked())
+ (*m_option)["Brackets"] = "Linux";
+
+ (*m_option)["BracketsCloseHeaders"] = Brackets_CloseHeaders->isChecked();
+
+ // blocks
+ (*m_option)["BlockBreak"] = Block_Break->isChecked();
+ (*m_option)["BlockBreakAll"] = Block_BreakAll->isChecked();
+ (*m_option)["BlockIfElse"] = Block_IfElse->isChecked();
+
+ // padding
+ (*m_option)["PadParenthesesIn"] = Pad_ParenthesesIn->isChecked();
+ (*m_option)["PadParenthesesOut"] = Pad_ParenthesesOut->isChecked();
+ (*m_option)["PadParenthesesUn"] = Pad_ParenthesesUn->isChecked();
+
+ (*m_option)["PadOperators"] = Pad_Operators->isChecked();
+
+ // oneliner
+ (*m_option)["KeepStatements"] = Keep_Statements->isChecked();
+ (*m_option)["KeepBlocks"] = Keep_Blocks->isChecked();
+ }
+
+ if ( isGlobalWidget){
+ QMap<QString, QVariant>& project = m_part->getProjectOptions();
+ if ( project["FStyle"] == "GLOBAL"){
+ project = m_part->getGlobalOptions();
+ project["FStyle"] = "GLOBAL";
+ }
+ m_part->saveGlobal();
+ }
+
+// for ( QMap<QString, QVariant>::ConstIterator iter = m_option->begin();iter != m_option->end();iter++ )
+// {
+// kdDebug ( 9009 ) << "widget: " << iter.key() << "=" << iter.data() << endl;
+// }
+
+}
+
+/**
+ * Change the sample formatting text depending on what tab is selected.
+ *
+ * @param id Tab selected
+ */
+void AStyleWidget::styleChanged( )
+{
+ // disable the tabs for predefined sample
+ // only user define id==0, enables the other tabs
+ ConfigTabs->setTabEnabled(tab_2, Style_UserDefined->isChecked());
+ ConfigTabs->setTabEnabled(tab_3, Style_UserDefined->isChecked());
+ ConfigTabs->setTabEnabled(tab_4, Style_UserDefined->isChecked());
+
+ int id = ConfigTabs->currentPageIndex();
+
+ StyleExample->clear();
+
+ QString bracketSample = "namespace foospace {\n\tint Foo(){\n\tif (isBar)\n{\nbar(); \n\treturn 1; } else \nreturn 0;}}\n\nvoid test(){\n\tif (isFoo){\n\tbar();\n} else\n{\n\tbar();\n}\n}\n";
+
+ QString indentSample = "#define foobar(A)\\\n{Foo();Bar();}\n#define anotherFoo(B)\\\nreturn Bar()\n\nnamespace Bar\n{\nclass Foo\n{public:\nFoo();\nvirtual ~Foo();\n};\nswitch (foo)\n{\ncase 1:\na+=1;\nbreak;\ncase 2:\n{\na += 2;\n break;\n}\n}\nif (isFoo)\n{\nbar();\n}\nelse\n{\nanotherBar();\n}\nint foo()\n\twhile(isFoo)\n\t\t{\n\t\t\t...\n\t\t\tgoto error;\n\t\t....\n\t\terror:\n\t\t\t...\n\t\t}\n\t}\nfooArray[]={ red,\n\tgreen,\n\tdarkblue};\nfooFunction(barArg1,\n\tbarArg2,\n\tbarArg3);\n";
+
+ QString formattingSample = "void func(){\n\tif(isFoo(a,b))\n\tbar(a,b);\nif(isFoo)\n\ta=bar((b-c)*a,*d--);\nif( isFoo( a,b ) )\n\tbar(a, b);\nif (isFoo) {isFoo=false;cat << isFoo <<endl;}\nif(isFoo)DoBar();if (isFoo){\n\tbar();\n}\n\telse if(isBar()){\n\tannotherBar();\n}\n}\n";
+
+ QString styleSample = "\t//Tabs & Brackets\nnamespace foo{\n" + bracketSample + "}\n\t// Indentation\n" + indentSample + "\t// Formatting\n" + formattingSample;
+
+ switch(id){
+ case 1:
+ StyleExample->setText( m_part->formatSource( bracketSample, this,m_part->getProjectOptions() ) );
+ break;
+ case 2:
+ StyleExample->setText( m_part->formatSource( indentSample, this,m_part->getProjectOptions() ) );
+ break;
+ case 3:
+ StyleExample->setText( m_part->formatSource( formattingSample, this,m_part->getProjectOptions() ) );
+ break;
+ default:
+ {
+ if ( Style_Global->isChecked() ){
+ StyleExample->setText( m_part->formatSource( styleSample, 0, m_part->getGlobalOptions()) );
+ }
+ else
+ {
+ StyleExample->setText( m_part->formatSource( styleSample, this, m_part->getProjectOptions() ) );
+ }
+ }
+ }
+
+ if ( Style_Global->isChecked()){
+ if ( !globalOptions){
+ m_lastExt = GeneralExtension->text();
+ GeneralExtension->setEnabled ( false );
+ GeneralExtension->setText ( m_part->getGlobalExtensions() );
+ globalOptions=!globalOptions;
+ }
+ }
+ else{
+ if ( globalOptions){
+ GeneralExtension->setEnabled ( true );
+ GeneralExtension->setText ( m_lastExt );
+ globalOptions=!globalOptions;
+ }
+ }
+}
+
+#include "astyle_widget.moc"
diff --git a/parts/astyle/astyle_widget.h b/parts/astyle/astyle_widget.h
new file mode 100644
index 00000000..ac779985
--- /dev/null
+++ b/parts/astyle/astyle_widget.h
@@ -0,0 +1,36 @@
+#ifndef __ASTYLE_WIDGET_H__
+#define __ASTYLE_WIDGET_H__
+
+#include "astyleconfig.h"
+
+class AStylePart;
+class KDevPart;
+
+
+class AStyleWidget : public AStyleConfig
+{
+ Q_OBJECT
+
+public:
+
+ AStyleWidget( AStylePart * part, bool global, QWidget *parent=0, const char *name=0 );
+ ~AStyleWidget();
+
+
+public slots:
+
+ void accept();
+
+
+private slots:
+ void styleChanged();
+
+private:
+ AStylePart * m_part;
+ bool isGlobalWidget;
+ QString m_lastExt;
+ bool globalOptions;
+};
+
+
+#endif
diff --git a/parts/astyle/astyleconfig.ui b/parts/astyle/astyleconfig.ui
new file mode 100644
index 00000000..38063bb6
--- /dev/null
+++ b/parts/astyle/astyleconfig.ui
@@ -0,0 +1,1332 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>AStyleConfig</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>AStyleConfig</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>711</width>
+ <height>722</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Artistic Style Configuration</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>ConfigTabs</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;General</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>StyleGroup</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>350</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>&amp;Style</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_UserDefined</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;User defined</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>0</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select options from other tabs.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_ANSI</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;ANSI</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>ANSI style formatting/indenting.
+Brackets Break
+Use 4 spaces
+Indent Bracket=false
+Indent Class=false
+Indent Switch=false
+Indent NameSpace=false</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_KR</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Kernighan &amp;&amp; Ritchie</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Kernighan &amp; Ritchie style formatting/indenting.
+Brackets Attach
+Use 4 spaces
+Indent Class=false
+Indent Switch=false
+Indent Namespaces=false
+</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_Linux</cstring>
+ </property>
+ <property name="text">
+ <string>Linu&amp;x</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>3</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Linux mode (8 spaces per indent, break definition-block brackets but attach command-block brackets).
+Brackets Linux
+Use 8 spaces
+Indent Bracket=false
+Indent Class=false
+Indent Switch=false
+Indent NameSpace=false</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_GNU</cstring>
+ </property>
+ <property name="text">
+ <string>G&amp;NU</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>4</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>GNU style formatting/indenting.
+Brackets Break
+Use 2 spaces
+Indent Block=true
+Indent Bracket=false
+Indent Class=false
+Indent Switch=false
+Indent NameSpace=false</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_JAVA</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;JAVA</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>5</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Java mode, with standard java style formatting/indenting.
+Java Style
+Use 4 spaces
+Brackets Attach
+Indent Bracket=false
+Indent Switch=false</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Style_Global</cstring>
+ </property>
+ <property name="text">
+ <string>Use Global &amp;Options</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>6</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Use the global defaults. See the menu:
+Settings/Configure Kdevelop/Formatting.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>FrameFilesFormat</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Files to format</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>GeneralExtension</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>*.c *.h
+*.cpp *.hpp
+*.C *.H
+*.cxx *.hxx
+*.cc *.hh
+*.c++ *.h++
+*.inl *.tlh
+*.moc *.xpm
+*.diff *.patch
+*.java</string>
+ </property>
+ <property name="wordWrap">
+ <enum>WidgetWidth</enum>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Set the extensions of files that the
+formatter will try to reformat. Use a
+space separated list, e.g. *.cpp *.hpp.
+Can use * on its own for any file.</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Set the extensions of files that the
+formatter will try to reformat. Use a
+space separated list, e.g. *.cpp *.hpp.
+Can use * on its own for any file.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab &amp;&amp; Bra&amp;ckets</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>FillingGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>&amp;Filling</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>20</number>
+ </property>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>Fill_EmptyLines</cstring>
+ </property>
+ <property name="text">
+ <string>Fill empt&amp;y lines</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Fill empty lines with the white space of their previous lines.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>Fill_Tabs</cstring>
+ </property>
+ <property name="text">
+ <string>U&amp;se tabs</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="2">
+ <property name="name">
+ <cstring>Fill_SpaceCount</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Number of spaces to use per indent.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="4">
+ <property name="name">
+ <cstring>Fill_ConvertTabs</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Con&amp;vert tabs</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Convert tabs to spaces.</string>
+ </property>
+ </widget>
+ <spacer row="0" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer13</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>34</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>Fill_Spaces</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>&amp;Use spaces:</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="0" column="2">
+ <property name="name">
+ <cstring>Fill_TabCount</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>4</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Number of spaces that will be converted to a tab.
+The number of spaces per tab is controled by the editor.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="4">
+ <property name="name">
+ <cstring>Fill_ForceTabs</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>F&amp;orce tabs</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Force tabs to be used in areas Astyle would prefer to use spaces.</string>
+ </property>
+ </widget>
+ <spacer row="0" column="3" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer13_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>21</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>BracketGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Brackets</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="spacing">
+ <number>20</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Brackets_None</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;No Change</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The brackets will not be changed.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Brackets_Break</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Break</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Break brackets from pre-block code (i.e. ANSI C/C++ style).</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Brackets_Attach</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Attach</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Attach brackets to pre-block code (i.e. Java/K&amp;R style).
+See also Formatting/Blocks/Break if-else</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>Brackets_Linux</cstring>
+ </property>
+ <property name="text">
+ <string>Linu&amp;x style</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Break brackets from class/function declarations,
+but attach brackets to pre-block command statements.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Brackets_CloseHeaders</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Brea&amp;k closing headers</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Break brackets before closing headers (e.g. 'else', 'catch', ...)
+from their immediately preceding closing brackets.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Indentation</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>ContinueationGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Contin&amp;uation</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QSpinBox" row="0" column="1">
+ <property name="name">
+ <cstring>Continue_MaxStatement</cstring>
+ </property>
+ <property name="value">
+ <number>40</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent a maximal # spaces in a continuous statement,
+relative to the previous line.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Maximum in statement:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent a maximal # spaces in a continuous statement,
+relative to the previous line.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Minimum in conditional:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent a minimal # spaces in a continuous conditional
+belonging to a conditional header.</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>Continue_MinConditional</cstring>
+ </property>
+ <property name="specialValueText">
+ <string>Twice current</string>
+ </property>
+ <property name="minValue">
+ <number>-1</number>
+ </property>
+ <property name="value">
+ <number>-1</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent a minimal # spaces in a continuous conditional
+belonging to a conditional header.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>IndentGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Indented &amp;Entities</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Switches</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Switches</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent 'switch' blocks, so that the inner 'case XXX:'
+headers are indented in relation to the switch block.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Cases</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Case statements</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent case blocks from the 'case XXX:' headers.
+Case statements not enclosed in blocks are NOT indented.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Classes</cstring>
+ </property>
+ <property name="text">
+ <string>Cla&amp;sses</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent 'class' blocks, so that the inner 'public:',
+'protected:' and 'private: headers are indented in
+relation to the class block.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Brackets</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Brackets</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add extra indentation to '{' and '}' block brackets.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Namespaces</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Namespaces</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent the contents of namespace blocks.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Labels</cstring>
+ </property>
+ <property name="text">
+ <string>L&amp;abels</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent labels so that they appear one indent less than
+the current indentation level, rather than being
+flushed completely to the left (which is the default).</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Blocks</cstring>
+ </property>
+ <property name="text">
+ <string>Bloc&amp;ks</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Add extra indentation entire blocks (including brackets).</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Indent_Preprocessors</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>#Prepr&amp;ocessors</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Indent multi-line #define statements.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>For&amp;matting</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>BlockGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Blocks</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>Block_Break</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Break blocks</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Insert empty lines around unrelated blocks, labels, classes,...
+Known problems:
+
+1. If a statement is NOT part of a block,
+the following statements are all double spaced.
+Statements enclosed in a block are formatted
+correctly.
+
+2. Comments are broken from the block.
+</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>Block_BreakAll</cstring>
+ </property>
+ <property name="text">
+ <string>Break bl&amp;ocks all</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Like --break-blocks, except also insert empty lines
+around closing headers (e.g. 'else', 'catch', ...).
+
+Known problems:
+
+1. If a statement is NOT part of a block,
+the following statements are all double spaced.
+Statements enclosed in a block are formatted
+correctly.
+
+2. Comments are broken from the block.
+</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>Block_IfElse</cstring>
+ </property>
+ <property name="text">
+ <string>Break i&amp;f-else</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Break 'else if()' statements into two different lines.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>PaddingGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Padding</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Pad_ParenthesesIn</cstring>
+ </property>
+ <property name="text">
+ <string>Add spa&amp;ces inside parentheses</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Insert space padding around parenthesis on the inside only.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Pad_ParenthesesOut</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;dd spaces outside parentheses</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Insert space padding around parenthesis on the outside only.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Pad_ParenthesesUn</cstring>
+ </property>
+ <property name="text">
+ <string>Remove &amp;unnecessary spaces around parentheses</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Remove unnecessary space padding around parenthesis.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Pad_Operators</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add spaces around operators</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Insert space padding around operators.
+Once padded, operators stay padded.
+There is no unpad operator option.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>OneLinersGroup</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>One Liners</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Keep_Statements</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Keep one-line statements</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Do not break lines containing multiple statements into
+multiple single-statement lines.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>Keep_Blocks</cstring>
+ </property>
+ <property name="text">
+ <string>Keep o&amp;ne-line blocks</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Do not break blocks residing completely on one line.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ <widget class="QGroupBox" row="0" column="1">
+ <property name="name">
+ <cstring>GroupBox4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Example</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QMultiLineEdit" row="0" column="0">
+ <property name="name">
+ <cstring>StyleExample</cstring>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>237</red>
+ <green>237</green>
+ <blue>237</blue>
+ </color>
+ <color>
+ <red>110</red>
+ <green>110</green>
+ <blue>110</blue>
+ </color>
+ <color>
+ <red>146</red>
+ <green>146</green>
+ <blue>146</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>217</red>
+ <green>220</green>
+ <blue>194</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>84</red>
+ <green>112</green>
+ <blue>152</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </active>
+ <disabled>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>253</red>
+ <green>253</green>
+ <blue>253</blue>
+ </color>
+ <color>
+ <red>110</red>
+ <green>110</green>
+ <blue>110</blue>
+ </color>
+ <color>
+ <red>146</red>
+ <green>146</green>
+ <blue>146</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ <color>
+ <red>217</red>
+ <green>220</green>
+ <blue>194</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>84</red>
+ <green>112</green>
+ <blue>152</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </disabled>
+ <inactive>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>253</red>
+ <green>253</green>
+ <blue>253</blue>
+ </color>
+ <color>
+ <red>110</red>
+ <green>110</green>
+ <blue>110</blue>
+ </color>
+ <color>
+ <red>146</red>
+ <green>146</green>
+ <blue>146</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>217</red>
+ <green>220</green>
+ <blue>194</blue>
+ </color>
+ <color>
+ <red>220</red>
+ <green>220</green>
+ <blue>220</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>84</red>
+ <green>112</green>
+ <blue>152</blue>
+ </color>
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </inactive>
+ </palette>
+ </property>
+ <property name="font">
+ <font>
+ <family>misc-fixed</family>
+ </font>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="undoDepth">
+ <number>0</number>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>Fill_Tabs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>Fill_TabCount</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>Fill_Tabs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>Fill_ForceTabs</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>Fill_Spaces</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>Fill_SpaceCount</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>Fill_Spaces</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>Fill_ConvertTabs</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>Brackets_Attach</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>Brackets_CloseHeaders</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>Brackets_Linux</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>Brackets_CloseHeaders</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>ConfigTabs</tabstop>
+ <tabstop>Style_UserDefined</tabstop>
+ <tabstop>Fill_Tabs</tabstop>
+ <tabstop>Fill_TabCount</tabstop>
+ <tabstop>Fill_ForceTabs</tabstop>
+ <tabstop>Fill_SpaceCount</tabstop>
+ <tabstop>Fill_ConvertTabs</tabstop>
+ <tabstop>Fill_EmptyLines</tabstop>
+ <tabstop>Brackets_None</tabstop>
+ <tabstop>Brackets_CloseHeaders</tabstop>
+ <tabstop>Indent_Switches</tabstop>
+ <tabstop>Indent_Cases</tabstop>
+ <tabstop>Indent_Classes</tabstop>
+ <tabstop>Indent_Brackets</tabstop>
+ <tabstop>Indent_Namespaces</tabstop>
+ <tabstop>Indent_Labels</tabstop>
+ <tabstop>Indent_Blocks</tabstop>
+ <tabstop>Indent_Preprocessors</tabstop>
+ <tabstop>Continue_MaxStatement</tabstop>
+ <tabstop>Continue_MinConditional</tabstop>
+ <tabstop>Block_Break</tabstop>
+ <tabstop>Block_BreakAll</tabstop>
+ <tabstop>Block_IfElse</tabstop>
+ <tabstop>Pad_ParenthesesIn</tabstop>
+ <tabstop>Pad_ParenthesesOut</tabstop>
+ <tabstop>Pad_ParenthesesUn</tabstop>
+ <tabstop>Pad_Operators</tabstop>
+ <tabstop>Keep_Statements</tabstop>
+ <tabstop>Keep_Blocks</tabstop>
+ <tabstop>StyleExample</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot>allFiles()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/astyle/kdevastyle.desktop b/parts/astyle/kdevastyle.desktop
new file mode 100644
index 00000000..261e2edf
--- /dev/null
+++ b/parts/astyle/kdevastyle.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=A plugin for formatting of sourcecode according to a specified set of rules. When loaded it is found in the Tools menu.
+Comment[ca]=Un connector per a donar format al codi font d'acord a una sèrie de regles especificades. Quan està carregat apareixerà en el menú Eines.
+Comment[da]=Et plugin til at formatere kildekode ifølge et angivet sæt regler. Når det er indlæst er det i værktøjsmenuen.
+Comment[de]=Ein Modul zur Formatierung der Quelltexte nach vorgegebenen Regeln. Ist das Modul geladen, kann es über das Menü "Werkzeuge" aufgerufen werden.
+Comment[el]=Ένα πρόσθετο για τη μορφοποίηση του πηγαίου κώδικα σύμφωνα με το ορισμένο σύνολο κανόνων. Όταν φορτωθεί μπορεί να βρεθεί στο μενού εργαλείων.
+Comment[es]=Un complemento para dar formato al código fuente de acuerdo una serie de reglas especificadas. Cuando está cargado, aparece en el menú Herramientas.
+Comment[et]=Plugin lähtekoodi vormindamiseks vastavalt konkreetsetele reeglitele. Kasutamisel leiab selle tööriistade menüüst.
+Comment[eu]=Iturburu kodea emandako arau sorten arabera formateatuko da. Kargatzean Tresnak menuan aurkituko duzu.
+Comment[fa]=وصله‌ای برای قالب‌بندی کد منبع طبق یک سری قوانین مشخص‌شده. در هنگام بارگذاری در گزینگان ابزار یافت می‌شود.
+Comment[fr]=Un module externe pour le formatage du code source selon un ensemble de règles spécifié. Lorsqu'il est chargé, ce module externe se trouve dans le menu « Outils ».
+Comment[gl]=Unha extensión para formatear código seguindo un conxunto de regras. Cando se carga atópase no menú Ferramentas.
+Comment[hu]=Bővítőmodul forráskód formázásához, megadott szabályok alapján. Az Eszközök menüből érhető el, ha be van töltve.
+Comment[it]=Un plugin per formattare il codice sorgente secondo uno specifico insieme di regole. Quando sarà caricato lo troverai nel menu Strumenti.
+Comment[ja]=指定された規則にソースコードを書式化するためのプラグイン。読み込まれるとツールメニューで見つかります。
+Comment[ms]=Plugin untuk memformat kod sumber mengikut set peraturan yang ditetapkan. Apabila dimuatkan ia berada di menu Alatan.
+Comment[nds]=En Moduul för't Borntextformateren na angeven Regeln. Wenn dat Moduul laadt is, lett sik dat binnen dat Warktüüchmenü finnen.
+Comment[ne]=नियमको निर्दिष्ट सेट अनुसार स्रोतसङ्केतको ढाँचाबद्धताका लागि प्लगइन । लोड भएपछि यो उपकरण मेनुमा फेला पार्न सकिन्छ ।
+Comment[nl]=Een plugin om broncode te formatteren volgens een speciale set regels. Te vinden onder het menu Gereedschap.
+Comment[pl]=Wtyczka do formatowania kodu źródłowego zgodnie z podanymi zasadami. Po wczytaniu pojawia się w menu Narzędzia.
+Comment[pt]=Um 'plugin' para a formatação do código-fonte de acordo com um conjunto específico de regras. Quando é carregado, encontrar-se-á no menu Ferramentas.
+Comment[pt_BR]=Um plug-in para formatação do código fonte de acordo com um conjunto específico de regras. Quando carregado é encontrado no menu Ferramentas.
+Comment[ru]=Модуль для форматирования кода по установленным правилам.
+Comment[sk]=Modul pre formátovanie zdrojového kódu podľa špecifických pravidiel.Po načítaní ho nájdete v menu Nástroje.
+Comment[sr]=Прикључак за форматирање изворног кôда према прецизираном скупу правила. Када је учитан, налази се у менију „Алати“.
+Comment[sr@Latn]=Priključak za formatiranje izvornog kôda prema preciziranom skupu pravila. Kada je učitan, nalazi se u meniju „Alati“.
+Comment[sv]=Ett insticksprogram för att formatera källkod enligt en given uppsättning regler. När det laddats finns det i verktygsmenyn.
+Comment[ta]=மூல குறிமுறை வடிவத்தை மாற்றும் சொருகிக்கு சில குறிப்பிட்ட விதிமுறைகள் உள்ளது. ஏற்றியபின் இதனை கருவிப்பட்டியில் காணலாம்.
+Comment[tg]=Модул барои қолабгузории код аз рӯи қонунҳои гузошта шуда.
+Comment[tr]=Belli kurallara göre kaynak kodu biçimlendirmeye yarayan bir eklenti. Yüklendiğinde Araçlar menüsünde bulunabilir.
+Comment[zh_CN]=一个按照指定规则格式化源代码的插件。启动后显示在工具菜单。
+Comment[zh_TW]=一個根據特定規則將程式源碼格式化的外掛程式。載入後可以在工具選單中找到。
+Name=KDevAStyle
+Name[da]=KDevelop en stil
+Name[de]=Artistic-Style-Unterstützung (KDevelop)
+Name[hi]=के-डेव-ए-स्टाइल
+Name[nds]=Kodestil-Ünnerstütten för KDevelop
+Name[pl]=KDevStylA
+Name[sk]=KDev štýl
+Name[sv]=KDevelop A-stil
+Name[zh_TW]=KDevelop AStyle
+GenericName=Source Code Formatter
+GenericName[ca]=Formatador de codi font
+GenericName[da]=Kildekode-formatering
+GenericName[de]=Quelltext-Formatierer
+GenericName[el]=Μορφοποιητής πηγαίου κώδικα
+GenericName[es]=Formateador de código fuente
+GenericName[et]=Lähtekoodi vormindaja
+GenericName[eu]=Iturburu kode formateatzailea
+GenericName[fa]=قالب‌دهندۀ کد منبع
+GenericName[fr]=Formatage de code source
+GenericName[gl]=Formateador de código
+GenericName[hi]=स्रोत कोड फ़ॉर्मेटर
+GenericName[hu]=Forráskód-formázó
+GenericName[it]=Formattatore del codice sorgente
+GenericName[ja]=ソースコードフォーマッタ
+GenericName[ms]=Pemformat Kod Sumber
+GenericName[nds]=Borntext-Formateren
+GenericName[ne]=स्रोत सङ्केत ढाँचाबद्धक
+GenericName[nl]=Broncode formatteren
+GenericName[pl]=Formatowanie kodu źródłowego
+GenericName[pt]=Formatador de Código Fonte
+GenericName[pt_BR]=Formatador de Código Fonte
+GenericName[ru]=Форматирование исходного кода
+GenericName[sk]=Formátovač zdrojového kódu
+GenericName[sl]=Oblikovalec izvorne kode
+GenericName[sr]=Форматер изворног кода
+GenericName[sr@Latn]=Formater izvornog koda
+GenericName[sv]=Källkodsformatering
+GenericName[ta]=மூல குறியை வடிவமைப்பவர்
+GenericName[tg]=Қолабгузори коди берунӣ
+GenericName[tr]=Kaynak Kodu Biçimlendirici
+GenericName[zh_CN]=源代码格式化
+GenericName[zh_TW]=程式源碼格式器
+Icon=kdevelop
+ServiceTypes=KDevelop/SourceFormatter
+X-KDE-Library=libkdevastyle
+X-KDevelop-Version=5
+X-KDevelop-Scope=Project
+X-KDevelop-Properties=CDevelopment,CPPDevelopment,JavaDevelopment
diff --git a/parts/astyle/kdevpart_astyle.rc b/parts/astyle/kdevpart_astyle.rc
new file mode 100644
index 00000000..69037425
--- /dev/null
+++ b/parts/astyle/kdevpart_astyle.rc
@@ -0,0 +1,17 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevAStyle" version="6">
+<MenuBar>
+ <Menu name="edit">
+ <Action name="edit_astyle" group="edit_astyle"/>
+ </Menu>
+ <Menu name="tools" >
+ <Action name="tools_astyle" group="tools_astyle"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="astyleToolBar">
+ <text>Astyle Toolbar</text>
+ <Action name="tools_astyle" group="tools_astyle"/>
+ <Action name="edit_astyle" group="edit_astyle"/>
+</ToolBar>
+
+</kpartgui>
diff --git a/parts/bookmarks/Makefile.am b/parts/bookmarks/Makefile.am
new file mode 100644
index 00000000..87589dfe
--- /dev/null
+++ b/parts/bookmarks/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevbookmarks.la
+libkdevbookmarks_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevbookmarks_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevbookmarks_la_SOURCES = bookmarks_part.cpp bookmarks_widget.cpp bookmarks_settings_base.ui bookmarks_settings.cpp bookmarks_config.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevbookmarks.desktop
+
+noinst_HEADERS = bookmarks_settings.h bookmarks_config.h
diff --git a/parts/bookmarks/README b/parts/bookmarks/README
new file mode 100644
index 00000000..335789a8
--- /dev/null
+++ b/parts/bookmarks/README
@@ -0,0 +1 @@
+Please read the README.dox file
diff --git a/parts/bookmarks/README.dox b/parts/bookmarks/README.dox
new file mode 100644
index 00000000..10d86bd3
--- /dev/null
+++ b/parts/bookmarks/README.dox
@@ -0,0 +1,20 @@
+/** \class BookmarksPart
+This plugin provides a navigation view for bookmarks and persistance to editor bookmarks
+so that it is possible to have bookmarks in files that are not open and that these
+bookmarks are saved with the project.
+
+\feature Provides a navigation view for bookmarks
+
+\feature Persists bookmarks between sessions
+
+\authors <a href="jens.dagerbo AT swipnet.se">Jens Dagerbo</a> aka teatime
+
+\maintainer <a href="jens.dagerbo AT swipnet.se">Jens Dagerbo</a> aka teatime
+
+\bug Pre KDE-3.2 / KDE-3.1.3, using source reformatting, or
+the ReplacePart will result in katepart messing up bookmarks
+(and breakpoints). There is no current workaround.
+
+\requirement KDE >= 3.1.3
+
+*/
diff --git a/parts/bookmarks/bookmarks_config.cpp b/parts/bookmarks/bookmarks_config.cpp
new file mode 100644
index 00000000..095c3f83
--- /dev/null
+++ b/parts/bookmarks/bookmarks_config.cpp
@@ -0,0 +1,138 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kconfig.h>
+#include <kapplication.h>
+
+#include "bookmarks_config.h"
+
+BookmarksConfig::BookmarksConfig()
+{
+ _context = 5;
+ _codeline = Never; // 0 - Never, 1 - Only if Comment, 2 - Always
+ _tooltip = true;
+}
+
+
+BookmarksConfig::~BookmarksConfig()
+{
+}
+
+
+/*!
+ \fn BookmarksConfig::writeConfig()
+ */
+void BookmarksConfig::writeConfig()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Bookmarks");
+
+ config->writeEntry("Context", _context );
+ config->writeEntry("Codeline", _codeline );
+ config->writeEntry("ToolTip", _tooltip );
+ config->writeEntry("Token", _token );
+
+ config->sync();
+}
+
+
+/*!
+ \fn BookmarksConfig::readConfig()
+ */
+void BookmarksConfig::readConfig()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Bookmarks");
+
+ _context = config->readPropertyEntry( "Context", 5 ).toInt();
+ _tooltip = config->readBoolEntry( "ToolTip", true );
+ _token = config->readEntry( "Token", "//" );
+ unsigned int cl = config->readPropertyEntry( "Codeline", 0 ).toInt();
+
+ switch( cl )
+ {
+ case 1:
+ _codeline = Token;
+ break;
+ case 2:
+ _codeline = Always;
+ break;
+ default:
+ _codeline = Never;
+ }
+
+ if ( _context > 15 ) _context = 15;
+}
+
+
+/*!
+ \fn BookmarksConfig::toolTip
+ */
+bool BookmarksConfig::toolTip()
+{
+ return _tooltip;
+}
+
+
+/*!
+ \fn BookmarksConfig::codeline
+ */
+BookmarksConfig::CodeLineType BookmarksConfig::codeline()
+{
+ return _codeline;
+}
+
+
+/*!
+ \fn BookmarksConfig::context()
+ */
+unsigned int BookmarksConfig::context()
+{
+ return _context;
+}
+
+
+/*!
+ \fn BookmarksConfig::setCodeline( CodeLineType )
+ */
+void BookmarksConfig::setCodeline( CodeLineType codeline )
+{
+ _codeline = codeline;
+}
+
+/*!
+ \fn BookmarksConfig::setContext( unsigned int )
+ */
+void BookmarksConfig::setContext( unsigned int context )
+{
+ _context = context;
+}
+
+
+/*!
+ \fn BookmarksConfig::setToolTip( bool )
+ */
+void BookmarksConfig::setToolTip( bool tooltip )
+{
+ _tooltip = tooltip;
+}
+
+QString BookmarksConfig::token( )
+{
+ return _token;
+}
+
+void BookmarksConfig::setToken( QString const & token )
+{
+ _token = token;
+}
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/bookmarks_config.h b/parts/bookmarks/bookmarks_config.h
new file mode 100644
index 00000000..c372eb51
--- /dev/null
+++ b/parts/bookmarks/bookmarks_config.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef BOOKMARKS_CONFIG_H
+#define BOOKMARKS_CONFIG_H
+
+/**
+@author KDevelop Authors
+*/
+class BookmarksConfig
+{
+
+public:
+
+ enum CodeLineType { Never = 0, Token, Always };
+
+ BookmarksConfig();
+ ~BookmarksConfig();
+
+ bool toolTip();
+ void setToolTip( bool );
+
+ CodeLineType codeline();
+ void setCodeline( CodeLineType );
+
+ unsigned int context();
+ void setContext( unsigned int );
+
+ QString token();
+ void setToken( QString const & );
+
+ void readConfig();
+ void writeConfig();
+
+private:
+ bool _tooltip;
+ CodeLineType _codeline;
+ unsigned int _context;
+ QString _token;
+
+};
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/bookmarks_part.cpp b/parts/bookmarks/bookmarks_part.cpp
new file mode 100644
index 00000000..f23863af
--- /dev/null
+++ b/parts/bookmarks/bookmarks_part.cpp
@@ -0,0 +1,568 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qwhatsthis.h>
+#include <qvbox.h>
+#include <qtimer.h>
+#include <qtextstream.h>
+#include <qfile.h>
+
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <ktexteditor/markinterface.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/document.h>
+#include <kaction.h>
+#include <kdialogbase.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include "domutil.h"
+
+#include "bookmarks_widget.h"
+#include "bookmarks_part.h"
+#include "bookmarks_settings.h"
+#include "bookmarks_config.h"
+
+#include <configwidgetproxy.h>
+#include <kdevplugininfo.h>
+
+#define BOOKMARKSETTINGSPAGE 1
+
+typedef KDevGenericFactory<BookmarksPart> BookmarksFactory;
+static const KDevPluginInfo data("kdevbookmarks");
+K_EXPORT_COMPONENT_FACTORY( libkdevbookmarks, BookmarksFactory( data ) )
+
+BookmarksPart::BookmarksPart(QObject *parent, const char *name, const QStringList& )
+ : KDevPlugin(&data, parent, name ? name : "BookmarksPart" )
+{
+ setInstance(BookmarksFactory::instance());
+
+ _widget = new BookmarksWidget(this);
+
+ _widget->setCaption(i18n("Bookmarks"));
+ _widget->setIcon(SmallIcon( info()->icon() ));
+
+ _marksChangeTimer = new QTimer( this );
+
+ QWhatsThis::add(_widget, i18n("<b>Bookmarks</b><p>"
+ "The bookmark viewer shows all the source bookmarks in the project."));
+
+ mainWindow()->embedSelectView(_widget, i18n("Bookmarks"), i18n("Source bookmarks"));
+
+ _editorMap.setAutoDelete( true );
+ _settingMarks = false;
+
+ connect( partController(), SIGNAL( partAdded( KParts::Part * ) ), this, SLOT( partAdded( KParts::Part * ) ) );
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("Bookmarks"), BOOKMARKSETTINGSPAGE, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+ connect( _widget, SIGNAL( removeAllBookmarksForURL( const KURL & ) ),
+ this, SLOT( removeAllBookmarksForURL( const KURL & ) ) );
+ connect( _widget, SIGNAL( removeBookmarkForURL( const KURL &, int ) ),
+ this, SLOT( removeBookmarkForURL( const KURL &, int ) ) );
+
+ connect( _marksChangeTimer, SIGNAL( timeout() ), this, SLOT( marksChanged() ) );
+
+ _config = new BookmarksConfig;
+ _config->readConfig();
+
+ storeBookmarksForAllURLs();
+ updateContextStringForAll();
+ _widget->update( _editorMap );
+}
+
+BookmarksPart::~BookmarksPart()
+{
+ if( _widget ) {
+ mainWindow()->removeView( _widget );
+ delete _widget;
+ }
+ delete _config;
+ delete _configProxy;
+}
+
+void BookmarksPart::partAdded( KParts::Part * part )
+{
+ //kdDebug(0) << "BookmarksPart::partAdded()" << endl;
+
+ if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( part ) )
+ {
+ if ( setBookmarksForURL( ro_part ) )
+ {
+ updateContextStringForURL( ro_part );
+ if ( EditorData * data = _editorMap.find( ro_part->url().path() ) )
+ {
+ _widget->updateURL( data );
+ }
+
+ // connect to this editor
+ KTextEditor::Document * doc = static_cast<KTextEditor::Document*>( ro_part );
+ connect( doc, SIGNAL( marksChanged() ), this, SLOT( marksEvent() ) );
+
+ // workaround for a katepart oddity where it drops all bookmarks on 'reload'
+ connect( doc, SIGNAL( completed() ), this, SLOT( reload() ) );
+ }
+ }
+}
+
+void BookmarksPart::reload()
+{
+ //kdDebug(0) << "BookmarksPart::reload()" << endl;
+
+ QObject * senderobj = const_cast<QObject*>( sender() );
+ if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( senderobj ) )
+ {
+ if ( partIsSane( ro_part ) )
+ {
+ setBookmarksForURL( ro_part );
+ }
+ }
+}
+
+void BookmarksPart::marksEvent()
+{
+ //kdDebug(0) << "BookmarksPart::marksEvent()" << endl;
+
+ if ( ! _settingMarks )
+ {
+ QObject * senderobj = const_cast<QObject*>( sender() );
+ KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( senderobj );
+
+ if ( partIsSane( ro_part ) && !_dirtyParts.contains( ro_part ) )
+ {
+ _dirtyParts.push_back( ro_part );
+ _marksChangeTimer->start( 1000, true );
+ }
+ }
+}
+
+void BookmarksPart::marksChanged()
+{
+ //kdDebug(0) << "BookmarksPart::marksChanged()" << endl;
+
+ QValueListIterator<KParts::ReadOnlyPart*> it = _dirtyParts.begin();
+ while ( it != _dirtyParts.end() )
+ {
+ KParts::ReadOnlyPart * ro_part = *it;
+ if ( partIsSane( ro_part ) )
+ {
+ if ( dynamic_cast<KTextEditor::MarkInterface*>( ro_part ) )
+ {
+ if ( EditorData * data = storeBookmarksForURL( ro_part ) )
+ {
+ updateContextStringForURL( ro_part );
+ _widget->updateURL( data );
+ }
+ else
+ {
+ _widget->removeURL( ro_part->url() );
+ }
+ }
+ }
+ ++it;
+ }
+ _dirtyParts.clear();
+}
+
+void BookmarksPart::restorePartialProjectSession( const QDomElement * el )
+{
+ //kdDebug(0) << "BookmarksPart::restorePartialProjectSession()" << endl;
+
+ if ( ! el ) return;
+
+ QDomElement bookmarksList = el->namedItem( "bookmarks" ).toElement();
+ if ( bookmarksList.isNull() ) return;
+
+ QDomElement bookmark = bookmarksList.firstChild().toElement();
+ while ( ! bookmark.isNull() )
+ {
+ QString path = bookmark.attribute( "url" );
+ if ( path != QString::null )
+ {
+ EditorData * data = new EditorData;
+ data->url.setPath( path );
+
+ QDomElement mark = bookmark.firstChild().toElement();
+ while ( ! mark.isNull() )
+ {
+ QString line = mark.attribute( "line" );
+ if ( line != QString::null )
+ {
+ data->marks.append( qMakePair( line.toInt(), QString() ) );
+ }
+ mark = mark.nextSibling().toElement();
+ }
+
+ if ( ! data->marks.isEmpty() )
+ {
+ _editorMap.insert( data->url.path(), data );
+ }
+ else
+ {
+ delete data;
+ }
+ }
+ bookmark = bookmark.nextSibling().toElement();
+ }
+ setBookmarksForAllURLs();
+ updateContextStringForAll();
+ _widget->update( _editorMap );
+}
+
+void BookmarksPart::savePartialProjectSession( QDomElement * el )
+{
+ //kdDebug(0) << "BookmarksPart::savePartialProjectSession()" << endl;
+
+ if ( ! el ) return;
+
+ QDomDocument domDoc = el->ownerDocument();
+ if ( domDoc.isNull() ) return;
+
+ QDomElement bookmarksList = domDoc.createElement( "bookmarks" );
+
+ QDictIterator<EditorData> it( _editorMap );
+ while ( it.current() )
+ {
+ QDomElement bookmark = domDoc.createElement( "bookmark" );
+ bookmark.setAttribute( "url", it.current()->url.path() );
+ bookmarksList.appendChild( bookmark );
+
+ QValueListIterator< QPair<int,QString> > it2 = it.current()->marks.begin();
+ while ( it2 != it.current()->marks.end() )
+ {
+ QDomElement line = domDoc.createElement( "mark" );
+ line.setAttribute( "line", (*it2).first );
+ bookmark.appendChild( line );
+ ++it2;
+ }
+ ++it;
+ }
+
+ if ( ! bookmarksList.isNull() )
+ {
+ el->appendChild( bookmarksList );
+ }
+}
+
+void BookmarksPart::removeAllBookmarksForURL( KURL const & url )
+{
+ //kdDebug(0) << "BookmarksPart::removeAllBookmarksForURL()" << endl;
+
+ _editorMap.remove( url.path() );
+
+ setBookmarksForURL( partForURL( url ) );
+ _widget->removeURL( url );
+}
+
+void BookmarksPart::removeBookmarkForURL( KURL const & url, int line )
+{
+ //kdDebug(0) << "BookmarksPart::removeBookmarkForURL()" << endl;
+
+ if ( EditorData * data = _editorMap.find( url.path() ) )
+ {
+ QValueListIterator< QPair<int,QString> > it = data->marks.begin();
+ while ( it != data->marks.end() )
+ {
+ if ( (*it).first == line )
+ {
+ data->marks.remove( it );
+ break;
+ }
+ ++it;
+ }
+
+ if ( data->marks.isEmpty() )
+ {
+ removeAllBookmarksForURL( url );
+ }
+ else
+ {
+ setBookmarksForURL( partForURL( url ) );
+ _widget->updateURL( data );
+ }
+ }
+}
+
+void BookmarksPart::updateContextStringForURL( KParts::ReadOnlyPart * ro_part )
+{
+ if ( ! ro_part ) return;
+
+ KTextEditor::EditInterface * ed =
+ dynamic_cast<KTextEditor::EditInterface *>( ro_part );
+
+ EditorData * data = _editorMap.find( ro_part->url().path() );
+
+ if ( ! ( data && ed ) ) return;
+
+ QValueListIterator< QPair<int,QString> > it = data->marks.begin();
+ while ( it != data->marks.end() )
+ {
+ (*it).second = ed->textLine( (*it).first );
+ ++it;
+ }
+}
+
+void BookmarksPart::updateContextStringForURL( KURL const & url )
+{
+ updateContextStringForURL( partForURL( url ) );
+}
+
+void BookmarksPart::updateContextStringForAll()
+{
+ QDictIterator<EditorData> it( _editorMap );
+ while ( it.current() )
+ {
+ if ( ! it.current()->marks.isEmpty() )
+ {
+ updateContextStringForURL( it.current()->url );
+ }
+ ++it;
+ }
+}
+
+bool BookmarksPart::setBookmarksForURL( KParts::ReadOnlyPart * ro_part )
+{
+ if ( KTextEditor::MarkInterface * mi = dynamic_cast<KTextEditor::MarkInterface *>(ro_part) )
+ {
+ clearBookmarksForURL( ro_part );
+
+ _settingMarks = true;
+
+ if ( EditorData * data = _editorMap.find( ro_part->url().path() ) )
+ {
+ // we've seen this one before, apply stored bookmarks
+
+ QValueListIterator< QPair<int,QString> > it = data->marks.begin();
+ while ( it != data->marks.end() )
+ {
+ mi->addMark( (*it).first, KTextEditor::MarkInterface::markType01 );
+ ++it;
+ }
+ }
+ _settingMarks = false;
+
+ // true == this is a MarkInterface
+ return true;
+ }
+ return false;
+}
+
+// Note: This method is only a convenience method to clear the bookmark marks,
+// the way a hypothetical KTextEditor::MarkInterface::clearMarks( uint markType )
+// would work.
+bool BookmarksPart::clearBookmarksForURL( KParts::ReadOnlyPart * ro_part )
+{
+ if ( KTextEditor::MarkInterface * mi = dynamic_cast<KTextEditor::MarkInterface *>(ro_part) )
+ {
+ _settingMarks = true;
+
+ QPtrList<KTextEditor::Mark> marks = mi->marks();
+ QPtrListIterator<KTextEditor::Mark> it( marks );
+ while ( it.current() )
+ {
+ if ( it.current()->type & KTextEditor::MarkInterface::markType01 )
+ {
+ mi->removeMark( it.current()->line, KTextEditor::MarkInterface::markType01 );
+ }
+ ++it;
+ }
+
+ _settingMarks = false;
+
+ // true == this is a MarkInterface
+ return true;
+ }
+ return false;
+}
+
+EditorData * BookmarksPart::storeBookmarksForURL( KParts::ReadOnlyPart * ro_part )
+{
+ //kdDebug(0) << "BookmarksPart::storeBookmarksForURL()" << endl;
+
+ if ( KTextEditor::MarkInterface * mi = dynamic_cast<KTextEditor::MarkInterface *>( ro_part ) )
+ {
+ EditorData * data = new EditorData;
+ data->url = ro_part->url();
+
+ // removing previous data for this url, if any
+ _editorMap.remove( data->url.path() );
+
+ QPtrList<KTextEditor::Mark> marks = mi->marks();
+ QPtrListIterator<KTextEditor::Mark> it( marks );
+ while ( it.current() )
+ {
+ if ( it.current()->type & KTextEditor::MarkInterface::markType01 )
+ {
+ int line = it.current()->line;
+ data->marks.append( qMakePair( line, QString() ) );
+ }
+ ++it;
+ }
+
+ if ( ! data->marks.isEmpty() )
+ {
+ _editorMap.insert( data->url.path(), data );
+ }
+ else
+ {
+ delete data;
+ data = 0;
+ }
+ return data;
+ }
+ return 0;
+}
+
+void BookmarksPart::setBookmarksForAllURLs()
+{
+ if( const QPtrList<KParts::Part> * partlist = partController()->parts() )
+ {
+ QPtrListIterator<KParts::Part> it( *partlist );
+ while ( KParts::Part* part = it.current() )
+ {
+ if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( part ) )
+ {
+ setBookmarksForURL( ro_part );
+ }
+ ++it;
+ }
+ }
+}
+
+void BookmarksPart::storeBookmarksForAllURLs()
+{
+ if( const QPtrList<KParts::Part> * partlist = partController()->parts() )
+ {
+ QPtrListIterator<KParts::Part> it( *partlist );
+ while ( KParts::Part* part = it.current() )
+ {
+ if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( part ) )
+ {
+ storeBookmarksForURL( ro_part );
+ }
+ ++it;
+ }
+ }
+}
+
+// reimplemented from PartController::partForURL to avoid linking
+KParts::ReadOnlyPart * BookmarksPart::partForURL( KURL const & url )
+{
+ QPtrListIterator<KParts::Part> it( *partController()->parts() );
+ while( it.current() )
+ {
+ KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(it.current());
+ if (ro_part && url == ro_part->url())
+ {
+ return ro_part;
+ }
+ ++it;
+ }
+ return 0;
+}
+
+bool BookmarksPart::partIsSane( KParts::ReadOnlyPart * ro_part )
+{
+ return ( ro_part != 0 ) &&
+ partController()->parts()->contains( ro_part) &&
+ !ro_part->url().path().isEmpty();
+}
+
+void BookmarksPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ kdDebug() << k_funcinfo << endl;
+
+ if ( pagenumber == BOOKMARKSETTINGSPAGE )
+ {
+ BookmarkSettings * w = new BookmarkSettings( this, page );
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) );
+ }
+}
+
+////////////////////////////////////////////
+
+QStringList BookmarksPart::getContextFromStream( QTextStream & istream, unsigned int line, unsigned int context )
+{
+ kdDebug() << k_funcinfo << endl;
+
+ int startline = context > line ? 0 : line - context;
+ int endline = line + context;
+
+ int n = 0;
+ QStringList list;
+ while ( !istream.atEnd() )
+ {
+ QString templine = istream.readLine();
+ if ( (n >= startline) && ( n <= endline ) )
+ {
+ list << templine;
+ }
+ n++;
+ }
+
+ // maybe pad empty lines to the tail
+ while( n < endline )
+ {
+ list.append( " " );
+ n++;
+ }
+
+ // maybe pad empty lines to the head
+ while( list.count() < ( context * 2 + 1) )
+ {
+ list.prepend( " " );
+ }
+
+ return list;
+}
+
+QStringList BookmarksPart::getContext( KURL const & url, unsigned int line, unsigned int context )
+{
+ // if the file is open - get the line from the editor buffer
+ if ( KTextEditor::EditInterface * ei = dynamic_cast<KTextEditor::EditInterface*>( partForURL( url ) ) )
+ {
+ kdDebug() << "the file is open - get the line from the editor buffer" << endl;
+
+ QString ibuffer = ei->text();
+ QTextStream istream( &ibuffer, IO_ReadOnly );
+ return getContextFromStream( istream, line, context );
+ }
+ else if ( url.isLocalFile() ) // else the file is not open - get the line from the file on disk
+ {
+ kdDebug() << "the file is not open - get the line from the file on disk" << endl;
+
+ QFile file( url.path() );
+ QString buffer;
+
+ if ( file.open( IO_ReadOnly ) )
+ {
+ QTextStream istream( &file );
+ return getContextFromStream( istream, line, context );
+ }
+ }
+ return QStringList( i18n("Could not find file") );
+}
+
+BookmarksConfig * BookmarksPart::config( )
+{
+ return _config;
+}
+
+#include "bookmarks_part.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/bookmarks_part.h b/parts/bookmarks/bookmarks_part.h
new file mode 100644
index 00000000..32a105ad
--- /dev/null
+++ b/parts/bookmarks/bookmarks_part.h
@@ -0,0 +1,109 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef __KDEVPART_BOOKMARKS_H__
+#define __KDEVPART_BOOKMARKS_H__
+
+
+#include <qguardedptr.h>
+#include <qvaluelist.h>
+#include <qdict.h>
+#include <qpair.h>
+
+#include <kparts/part.h>
+#include <kurl.h>
+
+#include <kdevplugin.h>
+
+class QTimer;
+class KDialogBase;
+class BookmarksConfig;
+class ConfigWidgetProxy;
+
+struct EditorData
+{
+ KURL url;
+ QValueList< QPair<int,QString> > marks;
+};
+
+class BookmarksWidget;
+class QDomElement;
+
+class BookmarksPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ BookmarksPart(QObject *parent, const char *name, const QStringList &);
+ ~BookmarksPart();
+
+ // reimplemented from KDevPlugin
+ void restorePartialProjectSession( const QDomElement * el );
+ void savePartialProjectSession( QDomElement * el );
+
+ BookmarksConfig * config();
+
+ QStringList getContext( KURL const & url, unsigned int line, unsigned int context );
+
+private slots:
+ // connected to partcontroller
+ void partAdded( KParts::Part * part );
+
+ // connected to KTextEditor::MarkInterface
+ void marksEvent();
+
+ // connected to _marksChangeTimer
+ void marksChanged();
+
+ // connected to KParts::ReadOnlyPart
+ void reload();
+
+ // connected to BookmarksWidget
+ void removeAllBookmarksForURL( const KURL & );
+ void removeBookmarkForURL( const KURL &, int );
+
+ void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
+
+private:
+ bool setBookmarksForURL( KParts::ReadOnlyPart * );
+ bool clearBookmarksForURL( KParts::ReadOnlyPart * );
+ void setBookmarksForAllURLs();
+
+ EditorData * storeBookmarksForURL( KParts::ReadOnlyPart * );
+ void storeBookmarksForAllURLs();
+
+ void updateContextStringForURL( KParts::ReadOnlyPart * );
+ void updateContextStringForURL( KURL const & url );
+ void updateContextStringForAll();
+
+ QStringList getContextFromStream( QTextStream & istream, unsigned int line, unsigned int context );
+
+ KParts::ReadOnlyPart * partForURL( KURL const & url );
+ bool partIsSane( KParts::ReadOnlyPart * );
+
+ QGuardedPtr<BookmarksWidget> _widget;
+ QDict<EditorData> _editorMap;
+ bool _settingMarks; // are we currently in the process of setting bookmarks?
+
+ BookmarksConfig * _config;
+
+ ConfigWidgetProxy * _configProxy;
+
+ QTimer * _marksChangeTimer;
+ QValueList<KParts::ReadOnlyPart*> _dirtyParts;
+};
+
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/bookmarks_settings.cpp b/parts/bookmarks/bookmarks_settings.cpp
new file mode 100644
index 00000000..235ec261
--- /dev/null
+++ b/parts/bookmarks/bookmarks_settings.cpp
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qspinbox.h>
+#include <klineedit.h>
+
+#include "bookmarks_part.h"
+#include "bookmarks_config.h"
+#include "bookmarks_settings.h"
+
+
+BookmarkSettings::BookmarkSettings( BookmarksPart * part, QWidget* parent, const char* name, WFlags fl )
+: BookmarkSettingsBase( parent, name, fl ), m_part( part )
+{
+ m_part->config()->readConfig();
+
+ if ( m_part->config()->codeline() == BookmarksConfig::Never )
+ {
+ radioButton1->setChecked( true );
+ }
+ else if ( m_part->config()->codeline() == BookmarksConfig::Token )
+ {
+ radioButton2->setChecked( true );
+ }
+ else
+ {
+ radioButton3->setChecked( true );
+ }
+
+ checkBox1->setChecked( m_part->config()->toolTip() );
+ spinBox1->setValue( m_part->config()->context() );
+ lineEdit1->setText( m_part->config()->token() );
+}
+
+BookmarkSettings::~BookmarkSettings()
+{
+}
+
+void BookmarkSettings::slotAccept()
+{
+ BookmarksConfig::CodeLineType codeline = BookmarksConfig::Never;
+ codeline = radioButton1->isChecked() ? BookmarksConfig::Never : codeline;
+ codeline = radioButton2->isChecked() ? BookmarksConfig::Token : codeline;
+ codeline = radioButton3->isChecked() ? BookmarksConfig::Always : codeline;
+ m_part->config()->setCodeline( codeline );
+ m_part->config()->setToolTip( checkBox1->isChecked() );
+ m_part->config()->setContext( spinBox1->value() );
+ m_part->config()->setToken( lineEdit1->text() );
+
+ m_part->config()->writeConfig();
+}
+
+
+#include "bookmarks_settings.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/bookmarks_settings.h b/parts/bookmarks/bookmarks_settings.h
new file mode 100644
index 00000000..3fa6c5e9
--- /dev/null
+++ b/parts/bookmarks/bookmarks_settings.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef BOOKMARKS_SETTINGS_H
+#define BOOKMARKS_SETTINGS_H
+
+#include "bookmarks_settings_base.h"
+
+class BookmarksPart;
+
+class BookmarkSettings : public BookmarkSettingsBase
+{
+ Q_OBJECT
+
+public:
+ BookmarkSettings( BookmarksPart * part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~BookmarkSettings();
+
+public slots:
+ void slotAccept();
+
+protected:
+
+protected slots:
+
+private:
+
+ BookmarksPart * m_part;
+
+};
+
+#endif
+
diff --git a/parts/bookmarks/bookmarks_settings_base.ui b/parts/bookmarks/bookmarks_settings_base.ui
new file mode 100644
index 00000000..2d7ab1a2
--- /dev/null
+++ b/parts/bookmarks/bookmarks_settings_base.ui
@@ -0,0 +1,240 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>BookmarkSettingsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>BookmarkSettingsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>622</width>
+ <height>490</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Code Tooltip</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, a tooltip will be shown when the mouse is over the bookmark, containing the text in the area surrounding it. &lt;p&gt; How many surrounding lines to include is decided by the value in the context box.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>checkBox1</cstring>
+ </property>
+ <property name="text">
+ <string>Show code &amp;tooltip</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Lines of context:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>spinBox1</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QSpinBox">
+ <property name="name">
+ <cstring>spinBox1</cstring>
+ </property>
+ <property name="maxValue">
+ <number>15</number>
+ </property>
+ <property name="value">
+ <number>3</number>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>121</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Show Bookmarked Codeline in Bookmark Panel</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This decides if the bookmark panel should show the content of the bookmarked line in addition to the line number.&lt;p&gt;This can be made optional depending on the start of the line, typically used for only showing lines containing a comment.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Never</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Only lines beginning with the following string:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>lineEdit1</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>71</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>radioButton3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Always</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Always show the bookmarked line in addition to the line number</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>240</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>checkBox1</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>spinBox1</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>checkBox1</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>textLabel1</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>radioButton2</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>lineEdit1</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/bookmarks/bookmarks_widget.cpp b/parts/bookmarks/bookmarks_widget.cpp
new file mode 100644
index 00000000..683c32e1
--- /dev/null
+++ b/parts/bookmarks/bookmarks_widget.cpp
@@ -0,0 +1,336 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qdict.h>
+#include <qheader.h>
+#include <qtooltip.h>
+#include <qpair.h>
+#include <qstylesheet.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <kpopupmenu.h>
+#include <klocale.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevcore.h>
+
+
+#include "bookmarks_part.h"
+#include "bookmarks_widget.h"
+#include "bookmarks_config.h"
+
+namespace
+{
+
+// shamelessly lifted from kdelibs/kate/part/kateviewhelpers.cpp
+static const char* const bookmark_xpm[]={
+"12 12 4 1",
+"b c #808080",
+"a c #000080",
+"# c #0000ff",
+". c None",
+"........###.",
+".......#...a",
+"......#.##.a",
+".....#.#..aa",
+"....#.#...a.",
+"...#.#.a.a..",
+"..#.#.a.a...",
+".#.#.a.a....",
+"#.#.a.a.....",
+"#.#a.a......",
+"#...a.......",
+".aaa........"};
+
+}
+
+class BookmarkItem : public QListViewItem
+{
+public:
+ BookmarkItem( QListView * parent, KURL const & url )
+ : QListViewItem( parent, url.fileName() ),
+ _url( url ), _line( -1 ), _isBookmark( false )
+ {}
+
+ BookmarkItem( QListViewItem * parent, KURL const & url, QPair<int,QString> mark )
+ : QListViewItem( parent, QString::number( mark.first +1 ).rightJustify( 5 ) ),
+ _url( url ), _line( mark.first ), _isBookmark( true )
+ {
+ BookmarksWidget * lv = static_cast<BookmarksWidget*>( listView() );
+ BookmarksConfig::CodeLineType codeline = lv->config()->codeline();
+
+ if ( codeline == BookmarksConfig::Never )
+ {
+ return;
+ }
+
+ if ( codeline == BookmarksConfig::Token )
+ {
+ if ( mark.second.startsWith( lv->config()->token() ) )
+ {
+ setText( 0, text( 0 ) + " " + mark.second );
+ }
+ return;
+ }
+
+ setText( 0, text( 0 ) + " " + mark.second );
+ }
+
+ KURL url()
+ {
+ return _url;
+ }
+ int line()
+ {
+ return _line;
+ }
+
+ QString tipText()
+ {
+ if ( _isBookmark )
+ {
+ BookmarksWidget * w = static_cast<BookmarksWidget*> ( listView() );
+ QStringList list = w->getContext( _url, _line );
+
+ QString code = "<qt><table><tr><td><pre>";
+ for ( uint i = 0; i < list.count(); i++)
+ {
+ QString temp = QStyleSheet::escape( list[i] );
+
+ if ( i == (list.count() / 2) ) // count() is always odd
+ {
+ temp = "<b>" + temp + "</b>";
+ }
+ code += temp + "\n";
+ }
+ code += "</pre></td></tr></table></qt>";
+
+ return code;
+ }
+ else
+ {
+ return _url.prettyURL();
+ }
+ }
+
+ bool isBookmark()
+ {
+ return _isBookmark;
+ }
+
+private:
+ KURL _url;
+ int _line;
+ bool _isBookmark;
+ QString _code;
+
+};
+
+BookmarksWidget::BookmarksWidget(BookmarksPart *part)
+ : KListView(0, "bookmarks widget"), QToolTip( viewport() ),
+ _part( part )
+
+{
+ addColumn( QString::null );
+ header()->hide();
+ setRootIsDecorated( true );
+ setResizeMode( QListView::LastColumn );
+ setAllColumnsShowFocus( true );
+// setSortColumn( -1 );
+
+ connect( this, SIGNAL( executed( QListViewItem * ) ), this, SLOT( itemClicked( QListViewItem * ) ) );
+ connect( this, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( itemClicked( QListViewItem * ) ) );
+ connect( this, SIGNAL( contextMenuRequested ( QListViewItem *, const QPoint & , int ) ),
+ this, SLOT( popupMenu(QListViewItem *, const QPoint & , int ) ) );
+}
+
+
+BookmarksWidget::~BookmarksWidget()
+{}
+
+void BookmarksWidget::maybeTip(const QPoint &p)
+{
+// kdDebug(0) << "ToolTip::maybeTip()" << endl;
+
+ if ( ! _part->config()->toolTip() ) return;
+
+ BookmarkItem * item = dynamic_cast<BookmarkItem*>( itemAt( p ) );
+ QRect r = itemRect( item );
+
+ if ( item && r.isValid() )
+ {
+ tip( r, item->tipText() );
+ }
+}
+
+void BookmarksWidget::update( QDict<EditorData> const & map )
+{
+// kdDebug(0) << "BookmarksWidget::update()" << endl;
+
+ QListView::clear();
+
+ QDictIterator<EditorData> it( map );
+ while ( it.current() )
+ {
+ if ( ! it.current()->marks.isEmpty() )
+ {
+ createURL( it.current() );
+ }
+ ++it;
+ }
+}
+
+void BookmarksWidget::updateURL( EditorData * data )
+{
+// kdDebug(0) << "BookmarksWidget::updateURL()" << endl;
+
+ // remove the node that contains 'data'
+ removeURL( data->url );
+
+ // create it again with new data
+ createURL( data );
+}
+
+void BookmarksWidget::createURL( EditorData * data )
+{
+// kdDebug(0) << "BookmarksWidget::createURL()" << endl;
+
+ if ( data )
+ {
+ QListViewItem * file = new BookmarkItem( this, data->url );
+ file->setOpen( true );
+ file->setPixmap( 0, SmallIcon( "document" ) );
+
+ QValueListIterator< QPair<int,QString> > it = data->marks.begin();
+ while ( it != data->marks.end() )
+ {
+ QListViewItem * item = new BookmarkItem( file, data->url, *it );
+ item->setPixmap( 0, QPixmap((const char**)bookmark_xpm) );
+ ++it;
+ }
+ }
+}
+
+bool BookmarksWidget::removeURL( KURL const & url )
+{
+// kdDebug(0) << "BookmarksWidget::removeURL()" << endl;
+
+ QListViewItem * item = firstChild();
+ while ( item )
+ {
+ BookmarkItem * bm = static_cast<BookmarkItem*>(item);
+ if ( bm->url() == url )
+ {
+ delete item;
+ return true;
+ }
+ item = item->nextSibling();
+ }
+ return false;
+}
+
+void BookmarksWidget::doEmitRemoveBookMark()
+{
+// kdDebug(0) << "BookmarksWidget::doEmitRemoveBookMark()" << endl;
+
+ if ( _selectedItem->isBookmark() )
+ {
+ emit removeBookmarkForURL( _selectedItem->url(), _selectedItem->line() );
+ }
+ else
+ {
+ emit removeAllBookmarksForURL( _selectedItem->url() );
+ }
+}
+
+void BookmarksWidget::popupMenu( QListViewItem * item, const QPoint & p, int )
+{
+// kdDebug(0) << "BookmarksWidget::contextMenuRequested()" << endl;
+
+ if ( item )
+ {
+ _selectedItem = static_cast<BookmarkItem *>(item);
+
+ KPopupMenu popup;
+
+ if ( _selectedItem->isBookmark() )
+ {
+ popup.insertTitle( _selectedItem->url().fileName() + i18n(", line ")
+ + QString::number( _selectedItem->line() +1 ) );
+
+ popup.insertItem( i18n("Remove This Bookmark"), this, SLOT( doEmitRemoveBookMark() ) );
+ }
+ else
+ {
+ popup.insertTitle( _selectedItem->url().fileName() + i18n( ", All" ) );
+ popup.insertItem( i18n("Remove These Bookmarks"), this, SLOT( doEmitRemoveBookMark() ) );
+ }
+
+ popup.insertSeparator();
+
+ popup.insertItem( i18n( "Collapse All" ), this, SLOT(collapseAll()) );
+ popup.insertItem( i18n( "Expand All" ), this, SLOT(expandAll()) );
+
+ popup.exec(p);
+ }
+
+}
+
+void BookmarksWidget::itemClicked( QListViewItem * clickedItem )
+{
+// kdDebug(0) << "BookmarksWidget::itemClicked()" << endl;
+
+ if ( ! clickedItem )
+ return;
+
+ BookmarkItem * item = static_cast<BookmarkItem*>( clickedItem );
+ _part->partController()->editDocument( item->url(), item->line() );
+
+}
+
+BookmarksConfig * BookmarksWidget::config( )
+{
+ return _part->config();
+}
+
+QStringList BookmarksWidget::getContext( KURL const & url, unsigned int line )
+{
+ return _part->getContext( url, line, config()->context() );
+}
+
+void BookmarksWidget::collapseAll( )
+{
+ QListViewItem * it = firstChild();
+ while( it )
+ {
+ it->setOpen( false );
+ it = it->nextSibling();
+ }
+}
+
+void BookmarksWidget::expandAll( )
+{
+ QListViewItem * it = firstChild();
+ while( it )
+ {
+ it->setOpen( true );
+ it = it->nextSibling();
+ }
+}
+
+
+#include "bookmarks_widget.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/bookmarks_widget.h b/parts/bookmarks/bookmarks_widget.h
new file mode 100644
index 00000000..96bfe046
--- /dev/null
+++ b/parts/bookmarks/bookmarks_widget.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __BOOKMARKS_WIDGET_H__
+#define __BOOKMARKS_WIDGET_H__
+
+
+#include <qwidget.h>
+#include <qstring.h>
+//#include <qlistview.h>
+#include <qtooltip.h>
+
+#include <klistview.h>
+
+#include "bookmarks_part.h"
+
+class BookmarksPart;
+class BookmarkItem;
+class BookmarksConfig;
+
+class BookmarksWidget : public KListView, public QToolTip
+{
+ Q_OBJECT
+
+public:
+ BookmarksWidget( BookmarksPart * );
+ ~BookmarksWidget();
+
+ void update( QDict<EditorData> const & );
+ void updateURL( EditorData * );
+ bool removeURL( KURL const & );
+
+ BookmarksConfig * config();
+ QStringList getContext( KURL const &, unsigned int );
+
+signals:
+ void removeAllBookmarksForURL( const KURL & );
+ void removeBookmarkForURL( const KURL &, int );
+
+protected:
+ void maybeTip( QPoint const & );
+
+private slots:
+ void itemClicked( QListViewItem * );
+ void popupMenu( QListViewItem * , const QPoint & , int );
+ void collapseAll();
+ void expandAll();
+ void doEmitRemoveBookMark();
+
+private:
+ void createURL( EditorData * );
+
+ BookmarksPart * _part;
+ BookmarkItem * _selectedItem;
+
+// static CodeLineType _s_codeline;
+
+ friend class BookmarkItem;
+};
+
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/bookmarks/kdevbookmarks.desktop b/parts/bookmarks/kdevbookmarks.desktop
new file mode 100644
index 00000000..bd5151bd
--- /dev/null
+++ b/parts/bookmarks/kdevbookmarks.desktop
@@ -0,0 +1,85 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Plugin that provides navigation and overview of active source bookmarks and persists them between sessions.
+Comment[ca]=Connector que proporciona navegació i visió de conjunt dels marcadors actius en el codi font i els manté entre sessions.
+Comment[da]=Plugin der sørger for navigation og overblik for aktive kilde-bogmærker og lader dem overleve mellem sessioner.
+Comment[de]=Ein Modul, das die Navigation in und die Übersicht über Quelltext-Lesezeichen ermöglicht und diese zwischen den Arbeitssitzungen speichert.
+Comment[el]=Πρόσθετο που προσφέρει πλοήγηση και περίληψη των ενεργών σελιδοδεικτών στον κώδικα καθώς και τη διατήρηση αυτών μεταξύ των συνεδριών.
+Comment[es]=Complemento que proporciona navegación de marcadores del código activos y los mantiene entre sesiones.
+Comment[et]=Plugin, mis võimaldab näha ja liikuda aktiivse koodi järjehoidjate vahel ning peab need seansside vahel meeles.
+Comment[eu]=Iturburu laster-marka aktiboen arakatze eta ikuspegi orokorra eskeintzen duen plugina da eta hauek sesioen artean mantentzen ditu.
+Comment[fa]=وصله‌ای که ناوش و خلاصۀ چوب الفهای فعال منبع را فراهم می‌کند و آنها را در بین نشستها می‌گذارد
+Comment[fr]=Module externe qui fournit une navigation et une vue d'ensemble des signets du source actif, et les maintient persistants entre les sessions.
+Comment[gl]=Extensión que proporciona navegación e vista xeral de marcadores activos no código e que se encarga de mantelos entre sesións.
+Comment[hu]=Bővítőmodul a forrásfájlok könyvjelzőinek áttekintéséhez, eltárolásához
+Comment[it]=Plugin che offre la navigazione e l'anteprima dei segnalibri nel codice attivo e rimane nelle varie sessioni.
+Comment[ja]=セッション間でアクティブなソースのブックマークや主張の外観やナビゲーションを提供するプラグイン。
+Comment[ms]=Plugin yang menyediakan pengemudian dan pandangan umum bagi tandalaman sumber aktif dan mengekalkan mereka antara sesi.
+Comment[nds]=En Moduul, wat dat Stüern twischen un de Översicht över Borntext-Leestekens praatstellt, un disse över Törns wohrt.
+Comment[ne]=प्लगइनले सक्रिय स्रोत पुस्तकचिनोको नेभिगेसन र समिक्षा प्रदान गर्दछ र सत्रहरू बिच तिनीहरूलाई राख्दछ ।
+Comment[nl]=Plugin die bladwijzers biedt die ook blijven bestaan tussen opeenvolgende sessies.
+Comment[pl]=Wtyczka umożliwiająca nawigację i uzyskiwanie informacji na temat aktywnych zakładek w kodzie oraz przenoszenie ich między sesjami.
+Comment[pt]=Um 'plugin' que oferece uma navegação e uma vista geral sobre os favoritos de código activos, mantendo-os persistentes entre sessões.
+Comment[pt_BR]=Plug-in que fornece navegação e uma visão geral dos marcadores de código ativos e persiste entre sessões.
+Comment[ru]=Модуль, который обеспечивает навигацию и просмотр активных закладок в коде, а также их сохранение в проекте.
+Comment[sk]=Modul proskytuje navigáciu a prehľad aktívnych zdrojových záložiek a ich pretrvanie medzi sedeniami.
+Comment[sr]=Прикључак који обезбеђује навигацију и преглед активних маркера изворног кôда и одржава их између сесија.
+Comment[sr@Latn]=Priključak koji obezbeđuje navigaciju i pregled aktivnih markera izvornog kôda i održava ih između sesija.
+Comment[sv]=Insticksprogram som tillhandahåller navigering och översikt över aktiva källkodsbokmärken och gör dem bestående mellan sessioner.
+Comment[ta]=நடப்பில் உள்ள புத்தக குறியீடு மூலத்திற்கு மேற்பார்வை மற்றும் வழிசெலுத்தும் வசதிகளை சொருகி உங்களுக்கு தரும் மற்றும் அமர்வுக்கு இடையே இதனை பரிசோதிக்கும்.
+Comment[tg]=Модуле, ки навигатсия ва намоиши поягузории фаъолро дар код таъмин месозад, ва боз барои нигоҳ доштан дар лоиҳа ҳам.
+Comment[tr]=Etkin kaynak yerimlerinin dolaşımını, gözden geçirilmesini ve oturumlar arasında devamlılığını sağlayan bir eklenti.
+Comment[zh_CN]=提供当前源文件书签的浏览、预览和保存的插件。
+Comment[zh_TW]=提供目前程式碼書籤的導覽與概觀,並保持在工作階段間。
+Name=KDevBookmarks
+Name[da]=KDevelop bogmærker
+Name[de]=Lesezeichen-Unterstützung (KDevelop)
+Name[hi]=के-डेव-बुकमार्क्स
+Name[nds]=Leestekens-Ünnerstütten (KDevelop)
+Name[pl]=KDevZakładki
+Name[sk]=KDev záložky
+Name[sv]=KDevelop bokmärken
+Name[zh_TW]=KDevelop 書籤
+GenericName=Bookmarks
+GenericName[br]=Sinedoù
+GenericName[ca]=Marcadors
+GenericName[cy]=Tudnodau
+GenericName[da]=Bogmærker
+GenericName[de]=Unterstützung für Lesezeichen
+GenericName[el]=Σελιδοδείκτες
+GenericName[es]=Marcadores
+GenericName[et]=Järjehoidjad
+GenericName[eu]=Laster-markak
+GenericName[fa]=چوب‌ الفها
+GenericName[fr]=Signets
+GenericName[ga]=Leabharmharcanna
+GenericName[gl]=Marcadores
+GenericName[hi]= पसंदीदा
+GenericName[hu]=Könyvjelzők
+GenericName[it]=Segnalibri
+GenericName[ja]=ブックマーク
+GenericName[ms]=Tandabuku
+GenericName[nds]=Leestekens-Ünnerstütten
+GenericName[ne]=पुस्तकचिनो
+GenericName[nl]=Bladwijzers
+GenericName[pl]=Zakładki
+GenericName[pt]=Favoritos
+GenericName[pt_BR]=Marcadores
+GenericName[ru]=Закладки
+GenericName[sk]=Záložky
+GenericName[sl]=Zaznamki
+GenericName[sr]=Маркери
+GenericName[sr@Latn]=Markeri
+GenericName[sv]=Bokmärken
+GenericName[ta]=புத்தகக்குறியின்
+GenericName[tg]=Поягузор
+GenericName[tr]=Yerimleri
+GenericName[zh_CN]=书签
+GenericName[zh_TW]=書籤
+Icon=bookmark
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Project
+X-KDE-Library=libkdevbookmarks
+X-KDevelop-Version=5
+X-KDevelop-Properties=CodeEditing
diff --git a/parts/classview/Makefile.am b/parts/classview/Makefile.am
new file mode 100644
index 00000000..de0de499
--- /dev/null
+++ b/parts/classview/Makefile.am
@@ -0,0 +1,27 @@
+# Here resides the class view part.
+
+INCLUDES = -I$(top_srcdir)/lib/compat -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions \
+ -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevclassview.la
+libkdevclassview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevclassview_la_LIBADD = $(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/widgets/libkdevwidgets.la $(LIB_KHTML) $(top_builddir)/lib/interfaces/extensions/libkdevextensions.la
+
+libkdevclassview_la_SOURCES = classviewpart.cpp classviewwidget.cpp \
+ digraphview.cpp hierarchydlg.cpp navigator.cpp viewcombos.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevclassview.desktop
+
+rcdir = $(kde_datadir)/kdevclassview
+rc_DATA = kdevclassview.rc
+
+
+QTDIR = /home/bernd/kdesrc/qt-copy
+
+foo: digraphview.cpp digraphview.h
+ $(QTDIR)/bin/moc digraphview.h > digraphview.moc ; \
+ g++ digraphview.cpp -I$(QTDIR)/include -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt -lX11 -lXext -o foo
+noinst_HEADERS = viewcombos.h navigator.h
diff --git a/parts/classview/README.dox b/parts/classview/README.dox
new file mode 100644
index 00000000..78049424
--- /dev/null
+++ b/parts/classview/README.dox
@@ -0,0 +1,53 @@
+/** \class ClassViewPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a>
+...
+\authors <a href="mailto:nth author AT provider.com">nth author full name</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=classview&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">classview component at Bugzilla database</a>
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/classview/classtooldlg.cpp b/parts/classview/classtooldlg.cpp
new file mode 100644
index 00000000..91ed28fc
--- /dev/null
+++ b/parts/classview/classtooldlg.cpp
@@ -0,0 +1,373 @@
+/***************************************************************************
+ * Copyright (C) 1999 by Jonas Nordin *
+ * jonas.nordin@syncom.se *
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "classtooldlg.h"
+
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include "kdevlanguagesupport.h"
+#include "classstore.h"
+#include "parsedclass.h"
+#include "classviewpart.h"
+
+
+ClassToolDialog::ClassToolDialog( ClassViewPart *part )
+ : QWidget(0, "class tool dialog")
+{
+ currentOperation = ViewNone;
+ comboAccess = (PIAccess)-1;
+ currentClass = 0;
+ m_part = part;
+
+ class_combo = new QComboBox(false, this);
+
+ QPushButton *close_button = new KPushButton(KStdGuiItem::close(), this);
+
+ parents_button = new QToolButton(this);
+ parents_button->setPixmap( UserIcon("CTparents", KIcon::DefaultState, ClassViewFactory::instance()) );
+ parents_button->setToggleButton(true);
+ parents_button->setFixedSize(parents_button->sizeHint());
+ QToolTip::add(parents_button, i18n("Show parents"));
+
+ children_button = new QToolButton(this);
+ children_button->setPixmap( UserIcon("CTchildren", KIcon::DefaultState, ClassViewFactory::instance()) );
+ children_button->setToggleButton(true);
+ children_button->setFixedSize(children_button->sizeHint());
+ QToolTip::add(children_button, i18n("Show children"));
+
+ clients_button = new QToolButton(this);
+ clients_button->setPixmap( UserIcon("CTclients", KIcon::DefaultState, ClassViewFactory::instance()) );
+ clients_button->setToggleButton(true);
+ clients_button->setFixedSize(clients_button->sizeHint());
+ QToolTip::add(clients_button, i18n("Show clients"));
+
+ suppliers_button = new QToolButton(this);
+ suppliers_button->setPixmap( UserIcon("CTsuppliers", KIcon::DefaultState, ClassViewFactory::instance()) );
+ suppliers_button->setToggleButton(true);
+ suppliers_button->setFixedSize(suppliers_button->sizeHint());
+ QToolTip::add(suppliers_button, i18n("Show suppliers"));
+
+ methods_button = new QToolButton(this);
+ methods_button->setPixmap( UserIcon("CVpublic_meth", KIcon::DefaultState, ClassViewFactory::instance()) );
+ methods_button->setToggleButton(true);
+ methods_button->setFixedSize(methods_button->sizeHint());
+ QToolTip::add(methods_button, i18n("Show methods"));
+
+ attributes_button = new QToolButton(this);
+ attributes_button->setPixmap( UserIcon("CVpublic_var", KIcon::DefaultState, ClassViewFactory::instance()) );
+ attributes_button->setToggleButton(true);
+ attributes_button->setFixedSize(attributes_button->sizeHint());
+ QToolTip::add(attributes_button, i18n("Show attributes"));
+
+ access_combo = new QComboBox(false, this, "access combo");
+ access_combo->setMinimumWidth(100);
+ access_combo->setSizeLimit(10);
+ access_combo->insertItem(i18n("member access","All"));
+ access_combo->insertItem(i18n("member access","Public"));
+ access_combo->insertItem(i18n("member access","Protected"));
+ access_combo->insertItem(i18n("member access","Private"));
+ access_combo->insertItem(i18n("member access","Package"));
+
+ class_tree = new ClassToolWidget(part, this);
+ // classTree->setMinimumSize( 500, 400 );
+
+ QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
+ QHBoxLayout *firstrowLayout = new QHBoxLayout();
+ QHBoxLayout *secondrowLayout = new QHBoxLayout();
+ layout->addLayout(firstrowLayout);
+ layout->addLayout(secondrowLayout);
+
+ firstrowLayout->addWidget(class_combo, 1);
+ firstrowLayout->addWidget(close_button, 0);
+
+ secondrowLayout->addWidget(parents_button);
+ secondrowLayout->addWidget(children_button);
+ secondrowLayout->addWidget(clients_button);
+ secondrowLayout->addWidget(suppliers_button);
+ secondrowLayout->addStretch();
+ secondrowLayout->addWidget(methods_button);
+ secondrowLayout->addWidget(attributes_button);
+ secondrowLayout->addWidget(access_combo);
+
+ layout->addWidget(class_tree, 10);
+
+ connect( class_combo, SIGNAL(activated(const QString&)),
+ this, SLOT(slotClassComboChoice(const QString&)) );
+ connect( close_button, SIGNAL(clicked()),
+ this, SLOT(slotClose()) );
+ connect( access_combo, SIGNAL(activated(const QString&)),
+ this, SLOT(slotAccessComboChoice(const QString&)) );
+ connect( parents_button, SIGNAL(clicked()), SLOT(viewParents()));
+ connect( children_button, SIGNAL(clicked()), SLOT(viewChildren()));
+ connect( clients_button, SIGNAL(clicked()), SLOT(viewClients()));
+ connect( suppliers_button, SIGNAL(clicked()), SLOT(viewSuppliers()));
+ connect( methods_button, SIGNAL(clicked()), SLOT(viewMethods()));
+ connect( attributes_button, SIGNAL(clicked()), SLOT(viewAttributes()));
+
+ connect( part, SIGNAL(setLanguageSupport(KDevLanguageSupport*)),
+ this, SLOT(setLanguageSupport(KDevLanguageSupport*)) );
+
+ m_part->registerClassToolDialog(this);
+}
+
+
+ClassToolDialog::~ClassToolDialog()
+{
+ m_part->unregisterClassToolDialog(this);
+}
+
+
+void ClassToolDialog::setLanguageSupport(KDevLanguageSupport *ls)
+{
+ if (ls) {
+ disconnect(ls, 0, this, 0);
+ connect(ls, SIGNAL(updatedSourceInfo()), this, SLOT(refresh()));
+ } else
+ refresh();
+
+ currentOperation = ViewNone;
+}
+
+
+void ClassToolDialog::setClassName(const QString &name)
+{
+ if ( class_combo->count() == 0 ) refresh();
+
+ QListBox *lb = class_combo->listBox();
+
+ for (int i=0; i < (int)lb->count(); ++i)
+ if (lb->text(i) == name) {
+ class_combo->setCurrentItem(i);
+ break;
+ }
+
+ if (!name.isEmpty())
+ currentClass = m_part->classStore()->getClassByName(name);
+ else
+ currentClass = 0;
+}
+
+
+void ClassToolDialog::viewNone()
+{
+ currentOperation = ViewNone;
+ refresh();
+}
+
+
+/** View the parents of the current class. */
+void ClassToolDialog::viewParents()
+{
+ currentOperation = ViewParents;
+ refresh();
+}
+
+
+/** View the children of the current class. */
+void ClassToolDialog::viewChildren()
+{
+ currentOperation = ViewChildren;
+ refresh();
+}
+
+
+/** View all classes that has this class as an attribute. */
+void ClassToolDialog::viewClients()
+{
+ currentOperation = ViewClients;
+ refresh();
+}
+
+
+/** View all classes that this class has as attributes. */
+void ClassToolDialog::viewSuppliers()
+{
+ currentOperation = ViewSuppliers;
+ refresh();
+}
+
+
+/** View methods in this class and parents. */
+void ClassToolDialog::viewMethods()
+{
+ currentOperation = ViewMethods;
+ refresh();
+}
+
+
+/** View attributes in this class and parents. */
+void ClassToolDialog::viewAttributes()
+{
+ currentOperation = ViewAttributes;
+ refresh();
+}
+
+
+void ClassToolDialog::slotAccessComboChoice(const QString &str)
+{
+ if( str == i18n("member access","All") )
+ comboAccess = (PIAccess)-1;
+ else if( str == i18n("member access","Public") )
+ comboAccess = PIE_PUBLIC;
+ else if( str == i18n("member access","Protected") )
+ comboAccess = PIE_PROTECTED;
+ else if( str == i18n("member access","Private") )
+ comboAccess = PIE_PRIVATE;
+ else if( str == i18n("member access","Package") )
+ comboAccess = PIE_PACKAGE;
+
+ // Update the view if the choice affected the data.
+ if (currentOperation == ViewMethods || currentOperation == ViewAttributes)
+ buildTree();
+}
+
+
+void ClassToolDialog::slotClose()
+{
+ delete this;
+ // QTimer::singleShot(0, this, SLOT(delayedClose()));
+}
+
+
+void ClassToolDialog::delayedClose()
+{
+ delete this;
+}
+
+
+void ClassToolDialog::slotClassComboChoice(const QString &str)
+{
+ setClassName(str);
+ refresh();
+}
+
+
+void ClassToolDialog::refresh()
+{
+ // Clear the combo box and fill it with the new items.
+ // Try to select the previously selected class
+
+ QString oldName = class_combo->currentText();
+
+ class_combo->clear();
+ QStringList list = m_part->classStore()->getSortedClassNameList();
+ class_combo->insertStringList(list);
+ setClassName(oldName);
+
+ // Rebuild the tree and caption/button state
+ buildTree();
+}
+
+
+/** Change the caption depending on the current operation. */
+void ClassToolDialog::updateCaptionAndButtons()
+{
+ QString caption;
+ QToolButton *button;
+
+ switch (currentOperation)
+ {
+ case ViewParents:
+ button = parents_button;
+ caption = i18n("Parents");
+ break;
+ case ViewChildren:
+ button = children_button;
+ caption = i18n("Children");
+ break;
+ case ViewClients:
+ button = clients_button;
+ caption = i18n("Clients");
+ break;
+ case ViewSuppliers:
+ button = suppliers_button;
+ caption = i18n("Suppliers");
+ break;
+ case ViewMethods:
+ button = methods_button;
+ caption = i18n("%1 Methods").arg(access_combo->currentText());
+ break;
+ case ViewAttributes:
+ button = attributes_button;
+ caption = i18n("%1 Attributes").arg(access_combo->currentText());
+ break;
+ default:
+ button = 0;
+ caption = i18n("Class Tool Dialog");
+ break;
+ }
+
+ parents_button->setOn(false);
+ children_button->setOn(false);
+ clients_button->setOn(false);
+ suppliers_button->setOn(false);
+ methods_button->setOn(false);
+ attributes_button->setOn(false);
+
+ if (button) {
+ button->setOn(true);
+ setCaption(i18n("%1 of Class %2").arg(caption).arg(currentClass->name()));
+ } else
+ setCaption(caption);
+}
+
+
+void ClassToolDialog::buildTree()
+{
+ if (!currentClass)
+ currentOperation = ViewNone;
+
+ updateCaptionAndButtons();
+
+ class_tree->clear();
+
+ switch (currentOperation)
+ {
+ case ViewParents:
+ class_tree->insertClassAndClasses(currentClass, currentClass->parents);
+ break;
+ case ViewChildren:
+ {
+ QValueList<ParsedClass*> list = m_part->classStore()->getClassesByParent(currentClass->name());
+ class_tree->insertClassAndClasses(currentClass, list);
+ }
+ break;
+ case ViewClients:
+ {
+ QValueList<ParsedClass*> list = m_part->classStore()->getClassClients(currentClass->name());
+ class_tree->insertClassAndClasses(currentClass, list);
+ }
+ break;
+ case ViewSuppliers:
+ {
+ QValueList<ParsedClass*> list = m_part->classStore()->getClassSuppliers(currentClass->name());
+ class_tree->insertClassAndClasses(currentClass, list);
+ }
+ break;
+ case ViewMethods:
+ class_tree->insertAllClassMethods(currentClass, comboAccess);
+ break;
+ case ViewAttributes:
+ class_tree->insertAllClassAttributes(currentClass, comboAccess);
+ break;
+ default:
+ break;
+ }
+}
+
+#include "classtooldlg.moc"
diff --git a/parts/classview/classtooldlg.h b/parts/classview/classtooldlg.h
new file mode 100644
index 00000000..1ab8b5c1
--- /dev/null
+++ b/parts/classview/classtooldlg.h
@@ -0,0 +1,98 @@
+/***************************************************************************
+ * Copyright (C) 1999 by Jonas Nordin *
+ * jonas.nordin@syncom.se *
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _CLASSTOOLDLG_H_
+#define _CLASSTOOLDLG_H_
+
+#include <qdialog.h>
+#include <qlabel.h>
+#include <qtoolbutton.h>
+#include <qcombobox.h>
+#include <qlayout.h>
+#include "classtoolwidget.h"
+#include "parseditem.h"
+
+class ClassViewPart;
+class ClassStore;
+class ParsedClass;
+
+
+class ClassToolDialog : public QWidget
+{
+ Q_OBJECT
+
+public:
+ enum Operations { ViewParents, ViewChildren, ViewClients, ViewSuppliers,
+ ViewMethods, ViewAttributes, ViewNone };
+
+ ClassToolDialog( ClassViewPart *part );
+ ~ClassToolDialog();
+
+ void setClassName(const QString &name);
+
+public slots:
+
+ /** View nothing. */
+ void viewNone();
+ /** View the parents of the current class. */
+ void viewParents();
+ /** View the children of the current class. */
+ void viewChildren();
+ /** View all classes that has this class as an attribute. */
+ void viewClients();
+ /** View all classes that this class has as attributes. */
+ void viewSuppliers();
+ /** View methods in this class and parents. */
+ void viewMethods();
+ /** View attributes in this class and parents. */
+ void viewAttributes();
+
+private slots:
+ void setLanguageSupport(KDevLanguageSupport *ls);
+ void refresh();
+
+ void delayedClose();
+ void slotClose();
+ void slotAccessComboChoice(const QString &str);
+ void slotClassComboChoice(const QString &str);
+
+
+private:
+ void updateCaptionAndButtons();
+ void buildTree();
+
+ ClassToolWidget *class_tree;
+ QComboBox *class_combo;
+
+ QToolButton *parents_button;
+ QToolButton *children_button;
+ QToolButton *clients_button;
+ QToolButton *suppliers_button;
+ QToolButton *methods_button;
+ QToolButton *attributes_button;
+ QComboBox *access_combo;
+
+ /** Store that holds all classes in the system. */
+ ClassStore *m_store;
+ KDevLanguageSupport *m_ls;
+ ClassViewPart *m_part;
+
+ /** The class we are currently viewing. */
+ ParsedClass *currentClass;
+ /** The current exportstatus selected in the combo. */
+ PIAccess comboAccess;
+ /** Stores what operation the user selected last. */
+ Operations currentOperation;
+};
+
+#endif
diff --git a/parts/classview/classtoolwidget.cpp b/parts/classview/classtoolwidget.cpp
new file mode 100644
index 00000000..f800bd15
--- /dev/null
+++ b/parts/classview/classtoolwidget.cpp
@@ -0,0 +1,159 @@
+/***************************************************************************
+ * Copyright (C) 1999 by Jonas Nordin *
+ * jonas.nordin@syncom.se *
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "classtoolwidget.h"
+
+#include <kconfig.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kpopupmenu.h>
+#include "classstore.h"
+
+
+ClassToolWidget::ClassToolWidget(ClassViewPart *part, QWidget *parent)
+ : ClassTreeBase(part, parent, "class tool widget")
+{}
+
+
+ClassToolWidget::~ClassToolWidget()
+{}
+
+
+KPopupMenu *ClassToolWidget::createPopup()
+{
+ KPopupMenu *popup = contextItem? contextItem->createPopup() : 0;
+ if (!popup) {
+ popup = new KPopupMenu(this);
+ popup->insertTitle(i18n("Class Tool"));
+ }
+
+ return popup;
+}
+
+
+void ClassToolWidget::insertClassAndClasses(ParsedClass *parsedClass, QValueList<ParsedClass*> classList)
+{
+ ClassTreeItem *root = new ClassTreeClassItem(this, 0, parsedClass);
+
+ ClassTreeItem *lastItem = 0;
+
+ QValueList<ParsedClass*>::ConstIterator it;
+ for (it = classList.begin(); it != classList.end(); ++it) {
+ lastItem = new ClassTreeClassItem(root, lastItem, *it);
+ lastItem->setExpandable(false);
+ }
+
+ if (!root->firstChild())
+ root->setExpandable(false);
+ else
+ root->setOpen(true);
+}
+
+
+void ClassToolWidget::insertClassAndClasses(ParsedClass *parsedClass, const QPtrList<ParsedParent> &parentList)
+{
+ ClassTreeItem *root = new ClassTreeClassItem(this, 0, parsedClass);
+
+ ClassTreeItem *lastItem = 0;
+
+ QPtrListIterator<ParsedParent> it(parentList);
+ for (; it.current(); ++it) {
+ ParsedClass *parentClass = m_part->classStore()->getClassByName((*it)->name());
+ lastItem = new ClassTreeClassItem(root, lastItem, parentClass);
+ lastItem->setExpandable(false);
+ }
+
+ if (!root->firstChild())
+ root->setExpandable(false);
+ else
+ root->setOpen(true);
+}
+
+
+void ClassToolWidget::addClassAndAttributes(ParsedClass *parsedClass, PIAccess filter, ClassTreeItem **lastItem)
+{
+ *lastItem = new ClassTreeClassItem(this, *lastItem, parsedClass);
+
+ ClassTreeItem *ilastItem = 0;
+
+ QValueList<ParsedAttribute*> attrList = parsedClass->getSortedAttributeList();
+ QValueList<ParsedAttribute*>::ConstIterator it;
+ for (it = attrList.begin(); it != attrList.end(); ++it) {
+ if (filter == (PIAccess)-1 || filter == (*it)->access())
+ ilastItem = new ClassTreeAttrItem(*lastItem, ilastItem, *it);
+ }
+
+ if (!(*lastItem)->firstChild())
+ (*lastItem)->setExpandable(false);
+ else
+ (*lastItem)->setOpen(true);
+}
+
+
+void ClassToolWidget::addClassAndMethods(ParsedClass *parsedClass, PIAccess filter, ClassTreeItem **lastItem)
+{
+ *lastItem = new ClassTreeClassItem(this, *lastItem, parsedClass);
+
+ ClassTreeItem *ilastItem = 0;
+
+ QValueList<ParsedMethod*> methodList = parsedClass->getSortedMethodList();
+ QValueList<ParsedMethod*>::ConstIterator it;
+ for (it = methodList.begin(); it != methodList.end(); ++it) {
+ if (filter == (PIAccess)-1 || filter == (*it)->access())
+ ilastItem = new ClassTreeMethodItem(*lastItem, ilastItem, *it);
+ }
+
+ if (!(*lastItem)->firstChild())
+ (*lastItem)->setExpandable(false);
+ else
+ (*lastItem)->setOpen(true);
+}
+
+
+void ClassToolWidget::insertAllClassMethods(ParsedClass *parsedClass, PIAccess filter)
+{
+ ClassTreeItem *lastItem = 0;
+
+ // First treat all parents.
+ for ( ParsedParent *pParent = parsedClass->parents.first();
+ pParent != 0;
+ pParent = parsedClass->parents.next() )
+ {
+ ParsedClass *parentClass = m_part->classStore()->getClassByName(pParent->name());
+ if (parentClass)
+ addClassAndMethods(parentClass, filter, &lastItem);
+ }
+
+ // Add the current class
+ addClassAndMethods(parsedClass, filter, &lastItem);
+}
+
+
+void ClassToolWidget::insertAllClassAttributes(ParsedClass *parsedClass, PIAccess filter)
+{
+ ClassTreeItem *lastItem = 0;
+ // First treat all parents.
+ for ( ParsedParent *pParent = parsedClass->parents.first();
+ pParent != 0;
+ pParent = parsedClass->parents.next() )
+ {
+ ParsedClass *parentClass = m_part->classStore()->getClassByName(pParent->name());
+ if (parentClass)
+ addClassAndAttributes(parentClass, filter, &lastItem);
+ }
+
+ // Add the current class
+ addClassAndAttributes(parsedClass, filter, &lastItem);
+}
+
+#include "classtoolwidget.moc"
diff --git a/parts/classview/classtoolwidget.h b/parts/classview/classtoolwidget.h
new file mode 100644
index 00000000..75119e8f
--- /dev/null
+++ b/parts/classview/classtoolwidget.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 1999 by Jonas Nordin *
+ * jonas.nordin@syncom.se *
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _CLASSTOOLWIDGET_H_
+#define _CLASSTOOLWIDGET_H_
+
+#include "classtreebase.h"
+
+
+class ClassToolWidget : public ClassTreeBase
+{
+ Q_OBJECT
+
+public:
+ ClassToolWidget(ClassViewPart *part, QWidget *parent=0);
+ ~ClassToolWidget();
+
+ void insertClassAndClasses(ParsedClass *parsedClass, QValueList<ParsedClass*> classList);
+ void insertClassAndClasses(ParsedClass *parsedClass, const QPtrList<ParsedParent> &parentList);
+ void insertAllClassMethods(ParsedClass *parsedClass, PIAccess filter);
+ void insertAllClassAttributes(ParsedClass *parsedClass, PIAccess filter);
+
+protected:
+ virtual KPopupMenu *createPopup();
+
+private:
+ void addClassAndAttributes(ParsedClass *parsedClass, PIAccess filter, ClassTreeItem **lastItem);
+ void addClassAndMethods(ParsedClass *parsedClass, PIAccess filter, ClassTreeItem **lastItem);
+};
+
+#endif
diff --git a/parts/classview/classtreebase.cpp b/parts/classview/classtreebase.cpp
new file mode 100644
index 00000000..f5c0f4b9
--- /dev/null
+++ b/parts/classview/classtreebase.cpp
@@ -0,0 +1,637 @@
+/***************************************************************************
+ * Copyright (C) 1999 by Jonas Nordin *
+ * jonas.nordin@syncom.se *
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "classtreebase.h"
+
+#include <qtooltip.h>
+#include <qheader.h>
+#include <qregexp.h>
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kpopupmenu.h>
+#include <klocale.h>
+#include <kiconloader.h>
+
+#include "kdevcore.h"
+#include "kdevlanguagesupport.h"
+#include "kdevmainwindow.h"
+#include "kdevpartcontroller.h"
+#include "classstore.h"
+
+#include "classviewpart.h"
+#include "classtooldlg.h"
+
+KPopupMenu *ClassTreeItem::createPopup()
+{
+ if (!m_item || m_item->itemType() == PIT_SCOPE)
+ return 0;
+
+ KDevLanguageSupport::Features features = classTree()->m_part->languageSupport()->features();
+
+ KPopupMenu *popup = new KPopupMenu();
+ if (features & KDevLanguageSupport::Declarations)
+ popup->insertItem( i18n("Go to Declaration"), classTree(), SLOT(slotGotoDeclaration()) );
+ if (m_item->itemType() == PIT_METHOD)
+ popup->insertItem( i18n("Go to Definition"), classTree(), SLOT(slotGotoImplementation()) );
+
+ QString title;
+ switch(m_item->itemType()) {
+ case PIT_CLASS:
+ {
+ title = i18n("Class");
+ bool hasAddMethod = features & KDevLanguageSupport::AddMethod;
+ bool hasAddAttribute = features & KDevLanguageSupport::AddAttribute;
+ if (hasAddMethod)
+ popup->insertItem( i18n("Add Method..."), classTree(), SLOT(slotAddMethod()));
+ if (hasAddAttribute)
+ popup->insertItem( i18n("Add Attribute..."), classTree(), SLOT(slotAddAttribute()));
+ popup->insertSeparator();
+ popup->insertItem( i18n("Parent Classes..."), classTree(), SLOT(slotClassBaseClasses()));
+ popup->insertItem( i18n("Child Classes..."), classTree(), SLOT(slotClassDerivedClasses()));
+ popup->insertItem( i18n("Class Tool..."), classTree(), SLOT(slotClassTool()));
+ }
+ break;
+ case PIT_STRUCT:
+ title = i18n("Struct");
+ break;
+ case PIT_ATTRIBUTE:
+ if (m_item->isGlobal())
+ title = i18n("Variable");
+ else
+ title = i18n("Attribute");
+ break;
+ case PIT_METHOD:
+ if (static_cast<ParsedMethod*>(m_item)->isSlot())
+ title = i18n("Slot");
+ else if (static_cast<ParsedMethod*>(m_item)->isSignal())
+ title = i18n("Signal");
+ else if (m_item->isGlobal())
+ title = i18n("Function");
+ else
+ title = i18n("Method");
+ break;
+ default:
+ ;
+ }
+ popup->insertSeparator();
+ popup->insertTitle(title, -1, 0);
+
+ return popup;
+}
+
+
+QString ClassTreeItem::scopedText() const
+{
+ if (m_item)
+ return m_item->path();
+
+ return QString::null;
+}
+
+
+void ClassTreeItem::getDeclaration(QString *toFile, int *toLine)
+{
+ if (m_item) {
+ *toFile = m_item->declaredInFile();
+ *toLine = m_item->declaredOnLine();
+ }
+}
+
+
+void ClassTreeItem::getImplementation(QString *toFile, int *toLine)
+{
+ if (m_item) {
+ *toFile = m_item->definedInFile();
+ *toLine = m_item->definedOnLine();
+ }
+}
+
+
+QString ClassTreeItem::text( int ) const
+{
+ if (m_item)
+ return m_item->asString();
+ return QString::null;
+}
+
+
+QString ClassTreeItem::tipText() const
+{
+ // Purposefully avoid virtual dispatch here
+ return ClassTreeItem::text(0);
+}
+
+
+void ClassTreeOrganizerItem::init()
+{
+ setExpandable(true);
+ setPixmap(0, SmallIcon("folder"));
+}
+
+
+void ClassTreeScopeItem::init()
+{
+ setExpandable(true);
+ setPixmap(0, UserIcon("CVnamespace", KIcon::DefaultState, ClassViewFactory::instance()));
+}
+
+
+QString ClassTreeScopeItem::text( int col ) const
+{
+ if (!m_item)
+ return QString::null;
+ if (m_item->name().isEmpty())
+ return i18n("Global");
+ return ClassTreeItem::text( col );
+}
+
+
+void ClassTreeScopeItem::setOpen(bool o)
+{
+ if ( !m_item)
+ return;
+
+ kdDebug(9003) << (o? "Open scope item" : "Close scope item") << endl;
+ if (o && childCount() == 0) {
+
+ ParsedScopeContainer *pScope = static_cast<ParsedScopeContainer*>(m_item);
+ ClassTreeItem *lastItem = 0;
+
+ // Ok, this is a hack...
+ KDevLanguageSupport::Features features = classTree()->m_part->languageSupport()->features();
+
+ // Add namespaces
+ QValueList<ParsedScopeContainer*> scopeList = pScope->getSortedScopeList();
+ QValueList<ParsedScopeContainer*>::ConstIterator it;
+ for (it = scopeList.begin(); it != scopeList.end(); ++it)
+ lastItem = new ClassTreeScopeItem(this, lastItem, *it);
+
+ if (features & KDevLanguageSupport::Classes) {
+ // Add classes
+ QValueList<ParsedClass*> classList = pScope->getSortedClassList();
+ QValueList<ParsedClass*>::ConstIterator it;
+ for (it = classList.begin(); it != classList.end(); ++it)
+ lastItem = new ClassTreeClassItem(this, lastItem, *it);
+ }
+
+ if (features & KDevLanguageSupport::Structs) {
+ // Add structs
+ QValueList<ParsedClass*> structList = pScope->getSortedStructList();
+ QValueList<ParsedClass*>::ConstIterator it;
+ for (it = structList.begin(); it != structList.end(); ++it)
+ lastItem = new ClassTreeClassItem(this, lastItem, *it, true);
+ }
+
+ if (features & KDevLanguageSupport::Functions) {
+ // Add functions
+ QValueList<ParsedMethod*> methodList = pScope->getSortedMethodList();
+ QValueList<ParsedMethod*>::ConstIterator it;
+ for (it = methodList.begin(); it != methodList.end(); ++it)
+ lastItem = new ClassTreeMethodItem(this, lastItem, *it);
+ }
+
+ if (features & KDevLanguageSupport::Variables) {
+ // Add attributes
+ QValueList<ParsedAttribute*> attrList = pScope->getSortedAttributeList();
+ QValueList<ParsedAttribute*>::ConstIterator it;
+ for (it = attrList.begin(); it != attrList.end(); ++it)
+ lastItem = new ClassTreeAttrItem(this, lastItem, *it);
+ }
+
+ }
+
+ ClassTreeItem::setOpen(o);
+}
+
+
+void ClassTreeClassItem::init()
+{
+ setExpandable(true);
+ setPixmap(0, UserIcon(m_isStruct ? "CVstruct" : "CVclass", KIcon::DefaultState, ClassViewFactory::instance()));
+}
+
+
+void ClassTreeClassItem::setOpen(bool o)
+{
+ if ( !m_item )
+ return;
+ kdDebug(9003) << (o? "Open class item" : "Close class item") << endl;
+ if (o && childCount() == 0) {
+
+ ParsedClass *pClass = static_cast<ParsedClass*>(m_item);
+ ClassTreeItem *lastItem = 0;
+
+ // Add nested classes
+ QValueList<ParsedClass*> classList = pClass->getSortedClassList();
+ QValueList<ParsedClass*>::ConstIterator classIt;
+ for (classIt = classList.begin(); classIt != classList.end(); ++classIt)
+ lastItem = new ClassTreeClassItem(this, lastItem, *classIt);
+
+ // Add nested structs
+ QValueList<ParsedClass*> structList = pClass->getSortedStructList();
+ QValueList<ParsedClass*>::ConstIterator structIt;
+ for (structIt = structList.begin(); structIt != structList.end(); ++structIt)
+ lastItem = new ClassTreeClassItem(this, lastItem, *structIt, true);
+
+ // Add methods
+ QValueList<ParsedMethod*> methodList = pClass->getSortedMethodList();
+ QValueList<ParsedMethod*>::ConstIterator methodIt;
+ for (methodIt = methodList.begin(); methodIt != methodList.end(); ++methodIt)
+ lastItem = new ClassTreeMethodItem(this, lastItem, *methodIt);
+
+ // Add slots
+ QValueList<ParsedMethod*> slotList = pClass->getSortedSlotList();
+ QValueList<ParsedMethod*>::ConstIterator slotIt;
+ for (slotIt = slotList.begin(); slotIt != slotList.end(); ++slotIt)
+ lastItem = new ClassTreeMethodItem(this, lastItem, *slotIt);
+
+ // Add signals
+ QValueList<ParsedMethod*> signalList = pClass->getSortedSignalList();
+ QValueList<ParsedMethod*>::ConstIterator signalIt;
+ for (signalIt = signalList.begin(); signalIt != signalList.end(); ++signalIt)
+ lastItem = new ClassTreeMethodItem(this, lastItem, *signalIt);
+
+ // Add attributes
+ QValueList<ParsedAttribute*> attrList = pClass->getSortedAttributeList();
+ QValueList<ParsedAttribute*>::ConstIterator attrIt;
+ for (attrIt = attrList.begin(); attrIt != attrList.end(); ++attrIt)
+ lastItem = new ClassTreeAttrItem(this, lastItem, *attrIt);
+
+ }
+
+ ClassTreeItem::setOpen(o);
+}
+
+ClassTreeMethodItem::ClassTreeMethodItem(ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedMethod *parsedMethod)
+ : ClassTreeItem(parent, lastSibling, parsedMethod)
+{
+ QString icon;
+
+ if ( !parsedMethod )
+ return;
+
+ if (parsedMethod->isSignal())
+ icon = "CVpublic_signal";
+ else if (parsedMethod->isSlot()) {
+ if (parsedMethod->isPublic())
+ icon = "CVpublic_slot";
+ else if (parsedMethod->isProtected())
+ icon = "CVprotected_slot";
+ else
+ icon = "CVprivate_slot";
+ }
+ else if (parsedMethod->isPublic())
+ icon = "CVpublic_meth";
+ else if (parsedMethod->isProtected())
+ icon = "CVprotected_meth";
+ else if (parsedMethod->isPrivate())
+ icon = "CVprivate_meth";
+ else if (parsedMethod->isPackage())
+ icon = "CVpackage_meth";
+ else
+ icon = "CVglobal_meth";
+
+ setPixmap(0, UserIcon(icon, KIcon::DefaultState, ClassViewFactory::instance()));
+}
+
+QString ClassTreeMethodItem::text( int ) const
+{
+ QString str;
+
+ if ( !m_item )
+ return QString::null;
+
+ ParsedMethod* method = static_cast<ParsedMethod*>(m_item);
+
+ str = method->name();
+
+ if( method->arguments.count() > 0 ) {
+ str += "( ";
+ for ( ParsedArgument *arg = method->arguments.first(); arg != NULL; arg = method->arguments.next() ) {
+ if ( arg != method->arguments.getFirst() )
+ str += ", ";
+
+ str += arg->toString();
+ }
+ str += " )";
+ } else {
+ str += "()";
+ }
+
+ if( method->isConst() )
+ str += " const";
+
+ return str;
+}
+
+
+ClassTreeAttrItem::ClassTreeAttrItem(ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedAttribute *parsedAttr)
+ : ClassTreeItem(parent, lastSibling, parsedAttr)
+{
+ QString icon;
+
+ if ( !parsedAttr )
+ return;
+
+ if (parsedAttr->isPublic())
+ icon = "CVpublic_var";
+ else if (parsedAttr->isProtected())
+ icon = "CVprotected_var";
+ else if (parsedAttr->isPrivate())
+ icon = "CVprivate_var";
+ else if (parsedAttr->isPackage())
+ icon = "CVpackage_var";
+ else
+ icon = "CVglobal_var";
+
+ setPixmap(0, UserIcon(icon, KIcon::DefaultState, ClassViewFactory::instance()));
+}
+
+
+QString ClassTreeAttrItem::text( int ) const
+{
+ if ( !m_item )
+ return QString::null;
+ return m_item->name();
+}
+
+ClassTreeScriptItem::ClassTreeScriptItem(ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedScript *parsedScript)
+ : ClassTreeItem(parent, lastSibling, parsedScript)
+{
+ QString icon;
+
+ if ( !parsedScript )
+ return;
+
+ setExpandable(true);
+
+ //need a icon for scripts
+ icon = "CVpublic_var";
+ setPixmap(0, UserIcon(icon, KIcon::DefaultState, ClassViewFactory::instance()));
+}
+
+
+QString ClassTreeScriptItem::text( int ) const
+{
+ if ( !m_item )
+ return QString::null;
+ return m_item->name();
+}
+
+void ClassTreeScriptItem::setOpen(bool o)
+{
+ if ( !m_item )
+ return;
+ kdDebug(9003) << (o? "Open script item" : "Close script item") << endl;
+ if (o && childCount() == 0) {
+
+ ParsedScript *pClass = static_cast<ParsedScript*>(m_item);
+ ClassTreeItem *lastItem = 0;
+
+ // Add methods
+ QValueList<ParsedMethod*> methodList = pClass->getSortedMethodList();
+ QValueList<ParsedMethod*>::ConstIterator methodIt;
+ for (methodIt = methodList.begin(); methodIt != methodList.end(); ++methodIt)
+ lastItem = new ClassTreeMethodItem(this, lastItem, *methodIt);
+
+ // Add attributes
+ QValueList<ParsedAttribute*> attrList = pClass->getSortedAttributeList();
+ QValueList<ParsedAttribute*>::ConstIterator attrIt;
+ for (attrIt = attrList.begin(); attrIt != attrList.end(); ++attrIt)
+ lastItem = new ClassTreeAttrItem(this, lastItem, *attrIt);
+
+ }
+
+ ClassTreeItem::setOpen(o);
+}
+
+
+class ClassToolTip : public QToolTip
+{
+public:
+ ClassToolTip( QWidget *parent )
+ : QToolTip(parent)
+ {}
+
+protected:
+ void maybeTip(const QPoint &p);
+};
+
+
+void ClassToolTip::maybeTip(const QPoint &p)
+{
+ ClassTreeBase *ctw = static_cast<ClassTreeBase*>(parentWidget());
+
+ QListViewItem *item = ctw->itemAt(p);
+ QRect r = ctw->itemRect(item);
+
+ if (item && r.isValid()) {
+ ClassTreeItem *ctitem = static_cast<ClassTreeItem*>(item);
+ QString str = ctitem->tipText();
+ if (!str.isEmpty())
+ tip(r, str);
+ }
+}
+
+
+ClassTreeBase::ClassTreeBase(ClassViewPart *part, QWidget *parent, const char *name)
+ : KListView(parent, name)
+{
+ setFocusPolicy(ClickFocus);
+ setRootIsDecorated(true);
+ setResizeMode(QListView::LastColumn);
+ setSorting(-1);
+ header()->hide();
+ addColumn(QString::null);
+
+ (void) new ClassToolTip(this);
+
+ connect( this, SIGNAL(executed(QListViewItem*)),
+ this, SLOT(slotItemExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int)),
+ this, SLOT(slotItemPressed(int, QListViewItem*)) );
+ connect( this, SIGNAL(returnPressed( QListViewItem*)),
+ SLOT( slotItemExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)),
+ this, SLOT(slotContextMenuRequested(QListViewItem*, const QPoint&)) );
+
+ m_part = part;
+}
+
+
+ClassTreeBase::~ClassTreeBase()
+{}
+
+
+ClassTreeBase::TreeState ClassTreeBase::treeState() const
+{
+ TreeState state;
+
+ ClassTreeBase *that = const_cast<ClassTreeBase*>(this);
+ QListViewItemIterator it(that);
+ for (; it.current(); ++it)
+ if (it.current()->isOpen()) {
+ QStringList path;
+ QListViewItem *item = it.current();
+ while (item) {
+ path.prepend(item->text(0));
+ item = item->parent();
+ }
+ state.append(path);
+ }
+
+ return state;
+}
+
+
+void ClassTreeBase::setTreeState(TreeState state)
+{
+ TreeStateIterator tsit;
+ for (tsit = state.begin(); tsit != state.end(); ++tsit) {
+ QListViewItemIterator it(this);
+ for (; it.current(); ++it) {
+ QStringList path;
+ QListViewItem *item = it.current();
+ while (item) {
+ path.prepend(item->text(0));
+ item = item->parent();
+ }
+ if (*tsit == path) {
+ it.current()->setOpen(true);
+ break;
+ }
+ }
+ }
+}
+
+
+
+
+void ClassTreeBase::slotItemExecuted( QListViewItem* item )
+{
+ if (!item)
+ return;
+
+ // toggle open state for parents
+ if (item->childCount() > 0)
+ setOpen(item, !isOpen(item));
+
+ // We assume here that ALL (!) items in the list view
+ // are ClassTreeItem's
+ ClassTreeItem *ctitem = static_cast<ClassTreeItem*>(item);
+ if (ctitem->isOrganizer())
+ return;
+
+ QString toFile;
+ int toLine = -1;
+ if (dynamic_cast<ClassTreeClassItem*>(item)) {
+ ctitem->getDeclaration(&toFile, &toLine);
+ }
+ else {
+ ctitem->getImplementation(&toFile, &toLine);
+ }
+ m_part->partController()->editDocument(toFile, toLine);
+ m_part->mainWindow()->lowerView(this);
+}
+
+
+void ClassTreeBase::slotItemPressed(int button, QListViewItem *item)
+{
+ if (!item)
+ return;
+
+ // We assume here that ALL (!) items in the list view
+ // are ClassTreeItem's
+ ClassTreeItem *ctitem = static_cast<ClassTreeItem*>(item);
+ if (ctitem->isOrganizer())
+ return;
+
+ if (button == MidButton) {
+ QString toFile;
+ int toLine = -1;
+ ctitem->getDeclaration(&toFile, &toLine);
+ m_part->partController()->editDocument(toFile, toLine);
+ m_part->mainWindow()->lowerView(this);
+ }
+}
+
+void ClassTreeBase::slotContextMenuRequested(QListViewItem *item, const QPoint &p)
+{
+ contextItem = static_cast<ClassTreeItem*>(item);
+
+ KPopupMenu *popup = createPopup();
+ popup->exec(p);
+ delete popup;
+}
+
+void ClassTreeBase::slotGotoDeclaration()
+{
+ QString toFile;
+ int toLine = -1;
+
+ contextItem->getDeclaration(&toFile, &toLine);
+ m_part->partController()->editDocument(toFile, toLine);
+}
+
+
+void ClassTreeBase::slotGotoImplementation()
+{
+ QString toFile;
+ int toLine = -1;
+
+ contextItem->getImplementation(&toFile, &toLine);
+ m_part->partController()->editDocument(toFile, toLine);
+}
+
+
+void ClassTreeBase::slotAddMethod()
+{
+ if (m_part->languageSupport())
+ m_part->languageSupport()->addMethod(contextItem->scopedText());
+}
+
+
+void ClassTreeBase::slotAddAttribute()
+{
+ if (m_part->languageSupport())
+ m_part->languageSupport()->addAttribute(contextItem->scopedText());
+}
+
+
+void ClassTreeBase::slotClassBaseClasses()
+{
+ ClassToolDialog *dlg = new ClassToolDialog(m_part);
+ dlg->setClassName(contextItem->scopedText());
+ dlg->viewParents();
+}
+
+
+void ClassTreeBase::slotClassDerivedClasses()
+{
+ ClassToolDialog *dlg = new ClassToolDialog(m_part);
+ dlg->setClassName(contextItem->scopedText());
+ dlg->viewChildren();
+}
+
+
+void ClassTreeBase::slotClassTool()
+{
+ ClassToolDialog *dlg = new ClassToolDialog(m_part);
+ dlg->setClassName(contextItem->scopedText());
+ dlg->viewNone();
+}
+
+#include "classtreebase.moc"
diff --git a/parts/classview/classtreebase.h b/parts/classview/classtreebase.h
new file mode 100644
index 00000000..e019bcc2
--- /dev/null
+++ b/parts/classview/classtreebase.h
@@ -0,0 +1,242 @@
+/***************************************************************************
+ * Copyright (C) 1999 by Jonas Nordin *
+ * jonas.nordin@syncom.se *
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _CLASSTREEBASE_H_
+#define _CLASSTREEBASE_H_
+
+#include <klistview.h>
+#include "parseditem.h"
+#include "parsedscopecontainer.h"
+#include "parsedclass.h"
+#include "parsedmethod.h"
+#include "parsedattribute.h"
+#include "classviewpart.h"
+#include "parsedscript.h"
+
+class ClassTreeItem;
+class KPopupMenu;
+
+
+class ClassTreeBase : public KListView
+{
+ Q_OBJECT
+
+public:
+ ClassTreeBase( ClassViewPart *part, QWidget *parent=0, const char *name=0 );
+ ~ClassTreeBase();
+
+protected:
+ typedef QValueList<QStringList> TreeState;
+ typedef QValueList<QStringList>::Iterator TreeStateIterator;
+ TreeState treeState() const;
+ void setTreeState(TreeState state);
+
+ ClassTreeItem *contextItem;
+ virtual KPopupMenu *createPopup() = 0;
+
+private slots:
+ void slotItemExecuted(QListViewItem*);
+ void slotItemPressed(int button, QListViewItem *item);
+ void slotContextMenuRequested(QListViewItem *item, const QPoint &p);
+ void slotGotoDeclaration();
+ void slotGotoImplementation();
+ void slotAddMethod();
+ void slotAddAttribute();
+ void slotClassBaseClasses();
+ void slotClassDerivedClasses();
+ void slotClassTool();
+
+protected:
+ ClassViewPart *m_part;
+ friend class ClassTreeItem;
+ friend class ClassTreeScopeItem;
+};
+
+
+class ClassTreeItem : public QListViewItem, public NotifyClient
+{
+public:
+ ClassTreeItem( ClassTreeBase *parent, ClassTreeItem *lastSibling, ParsedItem *parsedItem )
+ : QListViewItem(parent, lastSibling), NotifyClient(), m_item(parsedItem)
+ {
+ init();
+ }
+ ClassTreeItem( ClassTreeItem *parent, ClassTreeItem *lastSibling, ParsedItem *parsedItem )
+ : QListViewItem(parent, lastSibling), NotifyClient(), m_item(parsedItem)
+ {
+ init();
+ }
+ ClassTreeItem( const ClassTreeItem& other )
+ : QListViewItem( other.parent(), other.nextSibling()), NotifyClient()
+ {
+ m_item = other.m_item;
+ init();
+ }
+ ClassTreeItem& operator=( const ClassTreeItem& other )
+ {
+ m_item = other.m_item;
+ init();
+ return *this;
+ }
+ ~ClassTreeItem()
+ {
+ if ( m_item )
+ m_item->unregisterNotifyClient( (NotifyClient*)this );
+ }
+
+ // m_item has been deleted.
+ void notify() { m_item = 0; }
+
+ KPopupMenu *createPopup();
+ bool isOrganizer() { return !m_item; }
+ void init()
+ {
+ if ( m_item )
+ m_item->registerNotifyClient( (NotifyClient*)this );
+ }
+
+ void getDeclaration(QString *toFile, int *toLine);
+ void getImplementation(QString *toFile, int *toLine);
+
+ virtual QString scopedText() const;
+ virtual QString text( int ) const;
+ virtual QString tipText() const;
+
+protected:
+ ClassTreeBase *classTree()
+ { return static_cast<ClassTreeBase*>(listView()); }
+ ParsedItem *m_item;
+};
+
+
+class ClassTreeOrganizerItem : public ClassTreeItem
+{
+public:
+ ClassTreeOrganizerItem( ClassTreeBase *parent, ClassTreeItem *lastSibling,
+ const QString &text )
+ : ClassTreeItem(parent, lastSibling, 0 )
+ , m_text( text )
+ { init(); }
+ ClassTreeOrganizerItem( ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ const QString &text )
+ : ClassTreeItem(parent, lastSibling, 0 )
+ , m_text( text )
+ { init(); }
+ ~ClassTreeOrganizerItem()
+ {}
+
+ virtual QString text( int ) const { return m_text; }
+
+private:
+ QString m_text;
+
+ void init();
+};
+
+
+class ClassTreeScopeItem : public ClassTreeItem
+{
+public:
+ ClassTreeScopeItem( ClassTreeBase *parent, ClassTreeItem *lastSibling,
+ ParsedScopeContainer *parsedScope )
+ : ClassTreeItem(parent, lastSibling, parsedScope)
+ {
+ init();
+ }
+ ClassTreeScopeItem( ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedScopeContainer *parsedScope )
+ : ClassTreeItem(parent, lastSibling, parsedScope)
+ {
+ init();
+ }
+ ~ClassTreeScopeItem()
+ {
+ }
+
+ virtual QString text( int ) const;
+ virtual void setOpen(bool o);
+
+private:
+ void init();
+};
+
+
+class ClassTreeClassItem : public ClassTreeItem
+{
+public:
+ ClassTreeClassItem( ClassTreeBase *parent, ClassTreeItem *lastSibling,
+ ParsedClass *parsedClass, bool isStruct=false )
+ : ClassTreeItem(parent, lastSibling, parsedClass), m_isStruct( isStruct )
+ {
+ init();
+ }
+ ClassTreeClassItem( ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedClass *parsedClass, bool isStruct=false )
+ : ClassTreeItem(parent, lastSibling, parsedClass), m_isStruct( isStruct )
+ {
+ init();
+ }
+ ~ClassTreeClassItem()
+ {
+ }
+
+ virtual void setOpen(bool o);
+
+private:
+ void init();
+
+private:
+ bool m_isStruct;
+};
+
+
+class ClassTreeMethodItem : public ClassTreeItem
+{
+public:
+ ClassTreeMethodItem( ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedMethod *parsedMethod );
+ ~ClassTreeMethodItem()
+ {
+ }
+
+ virtual QString text( int ) const;
+};
+
+
+class ClassTreeAttrItem : public ClassTreeItem
+{
+public:
+ ClassTreeAttrItem( ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedAttribute *parsedAttr );
+ ~ClassTreeAttrItem()
+ {
+ }
+
+ virtual QString text( int ) const;
+};
+
+class ClassTreeScriptItem : public ClassTreeItem
+{
+public:
+ ClassTreeScriptItem( ClassTreeItem *parent, ClassTreeItem *lastSibling,
+ ParsedScript *parsedScript );
+ ~ClassTreeScriptItem()
+ {
+ }
+
+ virtual QString text( int ) const;
+ virtual void setOpen(bool o);
+};
+
+
+#endif
diff --git a/parts/classview/classviewpart.cpp b/parts/classview/classviewpart.cpp
new file mode 100644
index 00000000..b37ed50b
--- /dev/null
+++ b/parts/classview/classviewpart.cpp
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ * Copyright (C) 2003 Alexander Dymo (cloudtemple@mksat.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <qwhatsthis.h>
+#include <qlistview.h>
+#include <qfileinfo.h>
+#include <qlineedit.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kpopupmenu.h>
+#include <kdebug.h>
+#include <kmimetype.h>
+
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <kdevlanguagesupport.h>
+#include <kcomboview.h>
+#include <kdevpartcontroller.h>
+#include <kdevproject.h>
+#include <urlutil.h>
+#include <kdevplugininfo.h>
+
+#include <codemodel.h>
+#include <codemodel_utils.h>
+
+#include "classviewwidget.h"
+#include "classviewpart.h"
+#include "hierarchydlg.h"
+#include "navigator.h"
+
+#include "klistviewaction.h"
+
+#include <ktexteditor/document.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/view.h>
+#include <ktexteditor/selectioninterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/clipboardinterface.h>
+
+
+class FunctionCompletion : public CustomCompleter {
+ public:
+ FunctionCompletion() {
+ setOrder( Insertion );
+ };
+ typedef QMap<QString, QString> FuncMap;
+ FuncMap nameMap; /// real -> short
+ FuncMap revNameMap; /// short -> real
+
+ static const QString processName( QString function ) {
+ QString args;
+ QString fScope;
+ int cutpos;
+
+ if((cutpos = function.find('(')) != -1) {
+ args = function.right( function.length() - cutpos );
+ function = function.left( cutpos );
+ } else {
+ return function;
+ }
+ if((cutpos = function.findRev(':')) != -1 || (cutpos = function.findRev('.')) != -1) {
+ fScope = function.left( cutpos + 1 );
+ function = function.right( function.length() - cutpos - 1);
+ }
+
+ return function;
+ }
+
+ virtual void addItem ( const QString &item ) {
+ QString newItemName = item;
+ KCompletion::addItem(newItemName);
+ QString tx = processName( item );
+ tx += " \"" + item + "\"";
+ nameMap[item] = tx;
+ revNameMap[tx] = item;
+ if(tx.length() == 0) {
+ kdDebug() << "function-name-extraction failed with \"" << item << "\"" << endl;
+ }else{
+ KCompletion::addItem( tx );
+ kdDebug() << "addding \"" << item << "\" as \"" << tx << "\"" << endl;
+ }
+ KCompletion::addItem( item );
+ }
+
+ virtual void removeItem ( const QString &item ) {
+ FuncMap::iterator it = nameMap.find( item );
+ if( it != nameMap.end() ) {
+ KCompletion::removeItem( *it );
+ revNameMap.remove( *it );
+ nameMap.remove( it );
+ }
+ }
+
+ virtual void clear() {
+ nameMap.clear();
+ revNameMap.clear();
+ KCompletion::clear();
+ }
+
+ virtual void postProcessMatch ( QString *match ) const {
+ FuncMap::const_iterator it = revNameMap.find( *match );
+ if( it != revNameMap.end() ) {
+ *match = *it;
+ }
+ };
+
+ virtual void postProcessMatches ( QStringList *matches ) const {
+ QStringList::iterator it = matches->begin();
+
+ while( it != matches->end() ) {
+ postProcessMatch( &(*it) );
+ ++it;
+ }
+ }
+
+ virtual void postProcessMatches ( KCompletionMatches *matches ) const {
+ }
+};
+
+
+typedef KDevGenericFactory<ClassViewPart> ClassViewFactory;
+static const KDevPluginInfo data("kdevclassview");
+K_EXPORT_COMPONENT_FACTORY( libkdevclassview, ClassViewFactory( data ) )
+
+ClassViewPart::ClassViewPart(QObject *parent, const char *name, const QStringList& )
+ :/// KDevPlugin( &data, parent, name ? name : "ClassViewPart" ),
+ KDevCodeBrowserFrontend( &data, parent, name ? name : "ClassViewPart" ),
+ m_activeDocument(0), m_activeView(0), m_activeSelection(0), m_activeEditor(0), m_activeViewCursor(0), m_hierarchyDlg(0)
+{
+ setInstance(ClassViewFactory::instance());
+ setXMLFile("kdevclassview.rc");
+
+ navigator = new Navigator(this);
+
+ setupActions();
+
+ m_widget = new ClassViewWidget(this);
+ m_widget->setIcon( SmallIcon("view_tree") );
+ m_widget->setCaption(i18n("Class Browser"));
+ mainWindow()->embedSelectView( m_widget, i18n("Classes"), i18n("Class browser") );
+ QWhatsThis::add(m_widget, i18n("<b>Class browser</b><p>"
+ "The class browser shows all namespaces, classes and namespace and class members in a project."));
+
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) );
+ connect( core(), SIGNAL(languageChanged()), this, SLOT(slotProjectOpened()) );
+ connect( partController(), SIGNAL(activePartChanged(KParts::Part*)),
+ this, SLOT(activePartChanged(KParts::Part*)));
+}
+
+bool ClassViewPart::jumpedToItem( ItemDom item ) {
+ if(!m_widget) return false;
+ return m_widget->selectItem(item);
+}
+
+ClassViewPart::~ClassViewPart()
+{
+ mainWindow()->removeView( m_widget );
+ delete (ClassViewWidget*) m_widget;
+ delete m_hierarchyDlg;
+}
+
+void ClassViewPart::slotProjectOpened( )
+{
+ connect( languageSupport(), SIGNAL(updatedSourceInfo()), navigator, SLOT(refresh()) );
+ connect( languageSupport(), SIGNAL(addedSourceInfo(const QString& )), navigator, SLOT(addFile(const QString& )));
+ navigator->refresh();
+}
+
+void ClassViewPart::slotProjectClosed( )
+{
+// navigator->refresh();
+// disconnect( languageSupport(), SIGNAL(updatedSourceInfo()), navigator, SLOT(refresh()) );
+}
+
+void ClassViewPart::setupActions( )
+{
+ m_functionsnav = new KListViewAction( new KComboView(true, 150, 0, "m_functionsnav_combo", new FunctionCompletion() ), i18n("Functions Navigation"), 0, 0, 0, actionCollection(), "functionsnav_combo", true );
+ connect(m_functionsnav->view(), SIGNAL(activated(QListViewItem*)), navigator, SLOT(selectFunctionNav(QListViewItem*)));
+// m_functionsnav->view()->setEditable(false);
+ connect(m_functionsnav->view(), SIGNAL(focusGranted()), navigator, SLOT(functionNavFocused()));
+ connect(m_functionsnav->view(), SIGNAL(focusLost()), navigator, SLOT(functionNavUnFocused()));
+ m_functionsnav->setToolTip(i18n("Functions in file"));
+ m_functionsnav->setWhatsThis(i18n("<b>Function navigator</b><p>Navigates over functions contained in the file."));
+// m_functionsnav->view()->setCurrentText(NAV_NODEFINITION);
+ m_functionsnav->view()->setDefaultText(NAV_NODEFINITION);
+
+ new KAction( i18n("Focus Navigator"), 0, this, SLOT(slotFocusNavbar()), actionCollection(), "focus_navigator" );
+
+ if (langHasFeature(KDevLanguageSupport::Classes))
+ {
+ KAction *ac = new KAction(i18n("Class Inheritance Diagram"), "view_tree", 0, this, SLOT(graphicalClassView()), actionCollection(), "inheritance_dia");
+ ac->setToolTip(i18n("Class inheritance diagram"));
+ ac->setWhatsThis(i18n("<b>Class inheritance diagram</b><p>Displays inheritance relationship between classes in project. "
+ "Note, it does not display classes outside inheritance hierarchy."));
+ }
+}
+
+bool ClassViewPart::langHasFeature(KDevLanguageSupport::Features feature)
+{
+ bool result = false;
+ if (languageSupport())
+ result = (feature & languageSupport()->features());
+ return result;
+}
+
+void ClassViewPart::graphicalClassView( )
+{
+ if( !m_hierarchyDlg )
+ m_hierarchyDlg = new HierarchyDialog(this);
+ m_hierarchyDlg->refresh();
+ m_hierarchyDlg->show();
+}
+
+void ClassViewPart::refresh() {
+ if( navigator )
+ navigator->refresh();
+}
+
+void ClassViewPart::activePartChanged( KParts::Part * part)
+{
+ navigator->stopTimer();
+ if (m_activeView)
+ {
+ disconnect(m_activeView, SIGNAL(cursorPositionChanged()),
+ navigator, SLOT(slotCursorPositionChanged()));
+ }
+
+ kdDebug() << "ClassViewPart::activePartChanged()" << endl;
+
+ m_activeDocument = dynamic_cast<KTextEditor::Document*>( part );
+ m_activeView = part ? dynamic_cast<KTextEditor::View*>( part->widget() ) : 0;
+ m_activeEditor = dynamic_cast<KTextEditor::EditInterface*>( part );
+ m_activeSelection = dynamic_cast<KTextEditor::SelectionInterface*>( part );
+ m_activeViewCursor = part ? dynamic_cast<KTextEditor::ViewCursorInterface*>( m_activeView ) : 0;
+
+ m_activeFileName = QString::null;
+
+ if (m_activeDocument)
+ {
+ m_activeFileName = URLUtil::canonicalPath( m_activeDocument->url().path() );
+ navigator->refreshNavBars(m_activeFileName);
+ navigator->syncFunctionNavDelayed(200);
+/* if ( languageSupport()->mimeTypes().find(
+ KMimeType::findByPath(m_activeFileName)) != languageSupport()->mimeTypes().end() )
+ m_activeFileName = QString::null;*/
+ }
+ if( m_activeViewCursor )
+ {
+ connect(m_activeView, SIGNAL(cursorPositionChanged()),
+ navigator, SLOT(slotCursorPositionChanged()) );
+ }
+}
+void ClassViewPart::slotFocusNavbar()
+{
+ m_functionsnav->view()->setFocus();
+}
+
+#include "classviewpart.moc"
diff --git a/parts/classview/classviewpart.h b/parts/classview/classviewpart.h
new file mode 100644
index 00000000..d10553e4
--- /dev/null
+++ b/parts/classview/classviewpart.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __KDEVPART_CLASSVIEW_H__
+#define __KDEVPART_CLASSVIEW_H__
+
+#include "kdevlanguagesupport.h"
+#include "viewcombos.h"
+
+#include <qguardedptr.h>
+#include <qmap.h>
+
+#include <kdevplugin.h>
+
+#include <codemodel.h>
+#include <codebrowserfrontend.h>
+
+using namespace Extensions;
+
+namespace KParts { class Part; }
+namespace KTextEditor
+{
+ class Document;
+ class View;
+ class EditInterface;
+ class SelectionInterface;
+ class ViewCursorInterface;
+}
+
+
+class ClassViewWidget;
+class KListViewAction;
+class QListViewItem;
+class KToolBarPopupAction;
+class NamespaceItem;
+class Navigator;
+class HierarchyDialog;
+class ClassViewPart : public Extensions::KDevCodeBrowserFrontend
+{
+ Q_OBJECT
+public:
+ ClassViewPart(QObject *parent, const char *name, const QStringList &);
+ virtual ~ClassViewPart();
+
+ bool langHasFeature(KDevLanguageSupport::Features feature);
+
+ KListViewAction *m_functionsnav;
+ Navigator *navigator;
+
+ inline ClassViewWidget* widget() {
+ return &( *m_widget );
+ }
+
+ virtual bool jumpedToItem( ItemDom item );
+
+private slots:
+ void slotProjectOpened();
+ void slotProjectClosed();
+ void graphicalClassView();
+ void refresh();
+ void slotFocusNavbar();
+
+ void activePartChanged(KParts::Part*);
+
+private:
+ void setupActions();
+
+ QGuardedPtr<ClassViewWidget> m_widget;
+
+ QString m_activeFileName;
+ KTextEditor::Document* m_activeDocument;
+ KTextEditor::View* m_activeView;
+ KTextEditor::SelectionInterface* m_activeSelection;
+ KTextEditor::EditInterface* m_activeEditor;
+ KTextEditor::ViewCursorInterface* m_activeViewCursor;
+
+ HierarchyDialog* m_hierarchyDlg;
+ friend class Navigator;
+};
+
+
+#endif
diff --git a/parts/classview/classviewwidget.cpp b/parts/classview/classviewwidget.cpp
new file mode 100644
index 00000000..f26f1b92
--- /dev/null
+++ b/parts/classview/classviewwidget.cpp
@@ -0,0 +1,1295 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Partially based on KDE Studio ClassListView http://www.thekompany.com/projects/kdestudio/
+ */
+
+#include "classviewpart.h"
+#include "classviewwidget.h"
+
+#include <kiconloader.h>
+#include <kinstance.h>
+#include <kurl.h>
+#include <kaction.h>
+#include <kactionclasses.h>
+#include <kpopupmenu.h>
+#include <kconfig.h>
+
+#include <urlutil.h>
+#include <kdevcore.h>
+#include <kdevlanguagesupport.h>
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+#include <codemodel.h>
+#include <codemodel_utils.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+
+#include <qheader.h>
+#include <qdir.h>
+#include <qstylesheet.h>
+#include <qstringlist.h>
+
+// namespace ?!?
+
+ClassViewWidget::ClassViewWidget( ClassViewPart * part )
+ : KListView( 0, "ClassViewWidget" ), QToolTip( viewport() ), m_part( part ), m_projectDirectoryLength( 0 )
+{
+ addColumn( "" );
+ header()->hide();
+ setSorting( 0 );
+ setRootIsDecorated( true );
+ setAllColumnsShowFocus( true );
+
+ m_projectItem = 0;
+
+ connect( this, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(slotExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(executed(QListViewItem*)), this, SLOT(slotExecuted(QListViewItem*)) );
+ connect( m_part->core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
+ connect( m_part->core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) );
+ connect( m_part->core(), SIGNAL(languageChanged()), this, SLOT(slotProjectOpened()) );
+
+ QStringList lst;
+ lst << i18n( "Group by Directories" ) << i18n( "Plain List" ) << i18n( "Java Like Mode" );
+ m_actionViewMode = new KSelectAction( i18n("View Mode"), KShortcut(), m_part->actionCollection(), "classview_mode" );
+ m_actionViewMode->setItems( lst );
+ m_actionViewMode->setWhatsThis(i18n("<b>View mode</b><p>Class browser items can be grouped by directories, listed in a plain or java like view."));
+
+ m_actionNewClass = new KAction( i18n("New Class..."), KShortcut(), this, SLOT(slotNewClass()),
+ m_part->actionCollection(), "classview_new_class" );
+ m_actionNewClass->setWhatsThis(i18n("<b>New class</b><p>Calls the <b>New Class</b> wizard."));
+
+ m_actionCreateAccessMethods = new KAction( i18n("Create get/set Methods"), KShortcut(), this, SLOT(slotCreateAccessMethods()), m_part->actionCollection(), "classview_create_access_methods" );
+
+
+ m_actionAddMethod = new KAction( i18n("Add Method..."), KShortcut(), this, SLOT(slotAddMethod()),
+ m_part->actionCollection(), "classview_add_method" );
+ m_actionAddMethod->setWhatsThis(i18n("<b>Add method</b><p>Calls the <b>New Method</b> wizard."));
+ m_actionAddAttribute = new KAction( i18n("Add Attribute..."), KShortcut(), this, SLOT(slotAddAttribute()),
+ m_part->actionCollection(), "classview_add_attribute" );
+ m_actionAddAttribute->setWhatsThis(i18n("<b>Add attribute</b><p>Calls the <b>New Attribute</b> wizard."));
+
+ m_actionOpenDeclaration = new KAction( i18n("Open Declaration"), KShortcut(), this, SLOT(slotOpenDeclaration()),
+ m_part->actionCollection(), "classview_open_declaration" );
+ m_actionOpenDeclaration->setWhatsThis(i18n("<b>Open declaration</b><p>Opens a file where the selected item is declared and jumps to the declaration line."));
+ m_actionOpenImplementation = new KAction( i18n("Open Implementation"), KShortcut(), this, SLOT(slotOpenImplementation()),
+ m_part->actionCollection(), "classview_open_implementation" );
+ m_actionOpenImplementation->setWhatsThis(i18n("<b>Open implementation</b><p>Opens a file where the selected item is defined (implemented) and jumps to the definition line."));
+
+ m_actionFollowEditor = new KToggleAction( i18n("Follow Editor"), KShortcut(), this, SLOT(slotFollowEditor()), m_part->actionCollection(), "classview_follow_editor" );
+
+ KConfig* config = m_part->instance()->config();
+ config->setGroup( "General" );
+ setViewMode( config->readNumEntry( "ViewMode", KDevelop3ViewMode ) );
+ m_doFollowEditor = config->readBoolEntry( "FollowEditor", false );
+}
+
+ClassViewWidget::~ClassViewWidget( )
+{
+ KConfig* config = m_part->instance()->config();
+ config->setGroup( "General" );
+ config->writeEntry( "ViewMode", viewMode() );
+ config->writeEntry( "FollowEditor", m_doFollowEditor );
+ config->sync();
+}
+
+template <class ModelType, class ListItemType>
+ static bool selectItemG( ItemDom item, const QMap<KSharedPtr<ModelType>, ListItemType*>& map )
+{
+ ModelType* c = dynamic_cast<ModelType*>( &(*item) );
+
+ if( c ) {
+ KSharedPtr<ModelType> d( c );
+ typename QMap<KSharedPtr<ModelType>, ListItemType*>::ConstIterator it = map.find(d);
+ if( it != map.end() ) {
+ ( *it )->select();
+ return true;
+ }
+ }
+ return false;
+}
+
+
+void ClassViewWidget::slotExecuted( QListViewItem* item )
+{
+ if( ClassViewItem* cbitem = dynamic_cast<ClassViewItem*>( item ) ){
+ if( cbitem->hasImplementation() )
+ cbitem->openImplementation();
+ else
+ cbitem->openDeclaration();
+ }
+}
+
+void ClassViewWidget::clear( )
+{
+ KListView::clear();
+ removedText.clear();
+ m_projectItem = 0;
+}
+
+void restoreOpenNodes( QStringList & list, QListViewItem * item )
+{
+ if ( item && !list.isEmpty() )
+ {
+ if ( item->text( 0 ) == list.first() )
+ {
+ item->setOpen( true );
+ list.pop_front();
+ restoreOpenNodes( list, item->firstChild() );
+ }
+ else
+ {
+ restoreOpenNodes( list, item->nextSibling() );
+ }
+ }
+}
+
+void storeOpenNodes( QValueList<QStringList> & openNodes, QStringList const & list, QListViewItem * item )
+{
+ if ( item )
+ {
+ if ( item->isOpen() )
+ {
+ QStringList mylist( list );
+ mylist << item->text( 0 );
+ openNodes << mylist;
+ storeOpenNodes( openNodes, mylist, item->firstChild() );
+ }
+ storeOpenNodes( openNodes, list, item->nextSibling() );
+ }
+}
+
+void ClassViewWidget::refresh()
+{
+ if( !m_part->project() )
+ return;
+
+ QValueList<QStringList> openNodes;
+ storeOpenNodes( openNodes, QStringList(), firstChild() );
+ int scrollbarPos = verticalScrollBar()->value();
+
+ clear();
+ m_projectItem = new FolderBrowserItem( this, this, m_part->project()->projectName() );
+ m_projectItem->setOpen( true );
+ blockSignals( true );
+
+ FileList fileList = m_part->codeModel()->fileList();
+ FileList::Iterator it = fileList.begin();
+ while( it != fileList.end() ){
+ insertFile( (*it)->name() );
+ ++it;
+ }
+
+ QValueList<QStringList>::iterator itt = openNodes.begin();
+ while ( itt != openNodes.end() )
+ {
+ restoreOpenNodes ( *itt, firstChild() );
+ ++itt;
+ }
+ verticalScrollBar()->setValue( scrollbarPos );
+
+ blockSignals( false );
+}
+
+void ClassViewWidget::slotProjectOpened( )
+{
+ m_projectItem = new FolderBrowserItem( this, this, m_part->project()->projectName() );
+ m_projectItem->setOpen( true );
+
+ m_projectDirectory = URLUtil::canonicalPath( m_part->project()->projectDirectory() );
+ if( m_projectDirectory.isEmpty() )
+ m_projectDirectory = m_part->project()->projectDirectory();
+
+ m_projectDirectoryLength = m_projectDirectory.length() + 1;
+
+ connect( m_part->languageSupport(), SIGNAL(updatedSourceInfo()),
+ this, SLOT(refresh()) );
+ connect( m_part->languageSupport(), SIGNAL(aboutToRemoveSourceInfo(const QString&)),
+ this, SLOT(removeFile(const QString&)) );
+ connect( m_part->languageSupport(), SIGNAL(addedSourceInfo(const QString&)),
+ this, SLOT(insertFile(const QString&)) );
+}
+
+void ClassViewWidget::slotProjectClosed( )
+{
+}
+
+
+void ClassViewWidget::insertFile( const QString& fileName )
+{
+ QString fn = URLUtil::canonicalPath( fileName );
+ //kdDebug() << "======================== insertFile(" << fn << ")" << endl;
+
+ FileDom dom = m_part->codeModel()->fileByName( fn );
+ if( !dom )
+ return;
+
+ fn = URLUtil::relativePathToFile(m_part->project()->projectDirectory(), fn);
+ QStringList path;
+
+ switch( viewMode() )
+ {
+ case KDevelop3ViewMode:
+ {
+ path = QStringList::split( "/", fn );
+ path.pop_back();
+ }
+ break;
+
+ case KDevelop2ViewMode:
+ {
+ }
+ break;
+
+ case JavaLikeViewMode:
+ {
+ QStringList l = QStringList::split( "/", fn );
+ l.pop_back();
+
+ QString package = l.join(".");
+ if( !package.isEmpty() )
+ path.push_back( package );
+ }
+ break;
+ }
+
+ m_projectItem->processFile( dom, path );
+}
+
+void ClassViewWidget::removeFile( const QString& fileName )
+{
+ QString fn = URLUtil::canonicalPath( fileName );
+ //kdDebug() << "======================== removeFile(" << fn << ")" << endl;
+
+ FileDom dom = m_part->codeModel()->fileByName( fn );
+ if( !dom )
+ return;
+
+ fn = URLUtil::relativePathToFile(m_part->project()->projectDirectory(), fn);
+ QStringList path;
+
+ switch( viewMode() )
+ {
+ case KDevelop3ViewMode:
+ {
+ path = QStringList::split( "/", fn );
+ path.pop_back();
+ }
+ break;
+
+ case KDevelop2ViewMode:
+ {
+ }
+ break;
+
+ case JavaLikeViewMode:
+ {
+ QStringList l = QStringList::split( "/", fn );
+ l.pop_back();
+
+ QString package = l.join(".");
+ if( !package.isEmpty() )
+ path.push_back( package );
+ }
+ break;
+ }
+
+ m_projectItem->processFile( dom, path, true );
+}
+
+void ClassViewWidget::contentsContextMenuEvent( QContextMenuEvent * ev )
+{
+ KPopupMenu menu( this );
+
+ ClassViewItem* item = dynamic_cast<ClassViewItem*>( selectedItem() );
+
+ m_actionFollowEditor->plug( &menu );
+ m_actionFollowEditor->setChecked( m_doFollowEditor );
+ menu.insertSeparator();
+
+ m_actionOpenDeclaration->setEnabled( item && item->hasDeclaration() );
+ m_actionOpenImplementation->setEnabled( item && item->hasImplementation() );
+
+ m_actionOpenDeclaration->plug( &menu );
+ m_actionOpenImplementation->plug( &menu );
+ menu.insertSeparator();
+
+ bool sep = false;
+ if( item && item->isClass() ){
+ if( m_part->langHasFeature(KDevLanguageSupport::AddMethod) ) {
+ m_actionAddMethod->plug( &menu );
+ sep = true;
+ }
+
+ if( m_part->langHasFeature(KDevLanguageSupport::AddAttribute) ) {
+ m_actionAddAttribute->plug( &menu );
+ sep = true;
+ }
+ }
+
+ if (item && item->isVariable()){
+ if( m_part->langHasFeature(KDevLanguageSupport::CreateAccessMethods) )
+ m_actionCreateAccessMethods->plug( &menu );
+ }
+
+ if( item && item->model() ){
+ CodeModelItemContext context( item->model() );
+ m_part->core()->fillContextMenu( &menu, &context );
+// sep = true;
+ }
+ if (sep)
+ menu.insertSeparator();
+
+ int oldViewMode = viewMode();
+ m_actionViewMode->plug( &menu );
+
+ menu.exec( ev->globalPos() );
+
+ if( viewMode() != oldViewMode )
+ refresh();
+
+ ev->consume();
+}
+
+void ClassViewWidget::setViewMode( int mode ) {
+ m_actionViewMode->setCurrentItem( mode );
+}
+
+int ClassViewWidget::viewMode( ) const
+{
+ return m_actionViewMode->currentItem();
+}
+
+QString ClassViewItem::comment() {
+ return QString();
+}
+
+void ClassViewItem::select( ) {
+ setOpen(true);
+ listView()->setCurrentItem(this);
+ QListViewItem* c = firstChild();
+ int size = 0;
+ if(c != 0) {
+ while(c->nextSibling()) {
+ c = c->nextSibling();
+ size++;
+ }
+ listView()->ensureItemVisible(c);
+ }
+ listView()->ensureItemVisible(this);
+}
+
+
+bool ClassViewWidget::selectItem( ItemDom item ) {
+ if(!m_projectItem || !isVisible()) return false;
+ if(item->isFunctionDefinition() && dynamic_cast<FunctionDefinitionModel*>(&(*item)) != 0) {
+ FunctionList lst;
+ FileList fileList = m_part->codeModel()->fileList();
+ CodeModelUtils::findFunctionDeclarations( FindOp2(FunctionDefinitionDom( (FunctionDefinitionModel*)&(*item) )), fileList, lst );
+ if(lst.isEmpty()) return false;
+
+ item = *lst.begin();
+ }
+
+ return m_projectItem->selectItem( item );
+}
+
+
+QString NamespaceDomBrowserItem::comment() {
+ return m_dom->comment();
+}
+
+bool FolderBrowserItem::selectItem(ItemDom item)
+{
+ if(item->kind() == CodeModelItem::Class) {
+ if( selectItemG ( item, m_classes ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Function) {
+ if( selectItemG ( item, m_functions ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::TypeAlias) {
+ if( selectItemG ( item, m_typeAliases ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Variable) {
+ if( selectItemG ( item, m_variables ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Namespace) {
+ ///searching for namespaces is currently not supported and not useful
+ }
+
+ for( QMap<ClassDom, ClassDomBrowserItem*>::Iterator it = m_classes.begin(); it != m_classes.end(); ++it ) {
+ if( (*it)->selectItem(item) )
+ return true;
+ }
+
+ for( QMap<QString, NamespaceDomBrowserItem*>::Iterator it = m_namespaces.begin(); it != m_namespaces.end(); ++it ) {
+ if( (*it)->selectItem(item) )
+ return true;
+ }
+
+ for( QMap<QString, FolderBrowserItem*>::Iterator it = m_folders.begin(); it != m_folders.end(); ++it ) {
+ if( (*it)->selectItem(item) ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+void FolderBrowserItem::processFile( FileDom file, QStringList& path, bool remove )
+{
+ if( path.isEmpty() ){
+ NamespaceList namespaceList = file->namespaceList();
+ ClassList classList = file->classList();
+ TypeAliasList typeAliasList = file->typeAliasList();
+ FunctionList functionList = file->functionList();
+ VariableList variableList = file->variableList();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ processNamespace( *it, remove );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ processClass( *it, remove );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ processTypeAlias( *it, remove );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ processFunction( *it, remove );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ processVariable( *it, remove );
+
+ return;
+ }
+
+ QString current = path.front();
+ path.pop_front();
+
+ FolderBrowserItem* item = m_folders.contains( current ) ? m_folders[ current ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new FolderBrowserItem( m_widget, this, current );
+ if( listView()->removedText.contains(current) )
+ item->setOpen( true );
+ m_folders.insert( current, item );
+ }
+
+ item->processFile( file, path, remove );
+
+ if( remove && item->childCount() == 0 ){
+ m_folders.remove( current );
+ if( item->isOpen() ){
+ listView()->removedText << current;
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void FolderBrowserItem::processNamespace( NamespaceDom ns, bool remove )
+{
+ NamespaceDomBrowserItem* item = m_namespaces.contains( ns->name() ) ? m_namespaces[ ns->name() ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new NamespaceDomBrowserItem( this, ns );
+ if( listView()->removedText.contains(ns->name()) )
+ item->setOpen( true );
+ m_namespaces.insert( ns->name(), item );
+ }
+
+ NamespaceList namespaceList = ns->namespaceList();
+ ClassList classList = ns->classList();
+ TypeAliasList typeAliasList = ns->typeAliasList();
+ FunctionList functionList = ns->functionList();
+ VariableList variableList = ns->variableList();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ item->processNamespace( *it, remove );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ item->processClass( *it, remove );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ item->processTypeAlias( *it, remove );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ item->processFunction( *it, remove );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ item->processVariable( *it, remove );
+
+ if( remove && item->childCount() == 0 ){
+ m_namespaces.remove( ns->name() );
+ if( item->isOpen() ){
+ listView()->removedText << ns->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void FolderBrowserItem::processClass( ClassDom klass, bool remove )
+{
+ ClassDomBrowserItem* item = m_classes.contains( klass ) ? m_classes[ klass ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new ClassDomBrowserItem( this, klass );
+ if( listView()->removedText.contains(klass->name()) )
+ item->setOpen( true );
+ m_classes.insert( klass, item );
+ }
+
+ ClassList classList = klass->classList();
+ TypeAliasList typeAliasList = klass->typeAliasList();
+ FunctionList functionList = klass->functionList();
+ VariableList variableList = klass->variableList();
+
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ item->processClass( *it, remove );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ item->processTypeAlias( *it, remove );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ item->processFunction( *it, remove );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ item->processVariable( *it, remove );
+
+ if( remove && item->childCount() == 0 ){
+ m_classes.remove( klass );
+ if( item->isOpen() ){
+ listView()->removedText << klass->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void FolderBrowserItem::processTypeAlias( TypeAliasDom typeAlias, bool remove )
+{
+ TypeAliasDomBrowserItem* item = m_typeAliases.contains( typeAlias ) ? m_typeAliases[ typeAlias ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new TypeAliasDomBrowserItem( this, typeAlias );
+ if( listView()->removedText.contains(typeAlias->name()) )
+ item->setOpen( true );
+ m_typeAliases.insert( typeAlias, item );
+ }
+
+ if( remove && item->childCount() == 0 ){
+ m_typeAliases.remove( typeAlias );
+ if( item->isOpen() ){
+ listView()->removedText << typeAlias->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void FolderBrowserItem::processFunction( FunctionDom fun, bool remove )
+{
+ FunctionDomBrowserItem* item = m_functions.contains( fun ) ? m_functions[ fun ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new FunctionDomBrowserItem( this, fun );
+ m_functions.insert( fun, item );
+ }
+
+ if( remove ){
+ m_functions.remove( fun );
+ delete( item );
+ item = 0;
+ }
+}
+
+void FolderBrowserItem::processVariable( VariableDom var, bool remove )
+{
+ VariableDomBrowserItem* item = m_variables.contains( var ) ? m_variables[ var ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new VariableDomBrowserItem( this, var );
+ m_variables.insert( var, item );
+ }
+
+ if( remove ){
+ m_variables.remove( var );
+ delete( item );
+ item = 0;
+ }
+}
+
+// ------------------------------------------------------------------------
+bool NamespaceDomBrowserItem::selectItem( ItemDom item)
+{
+ if(item->kind() == CodeModelItem::Class) {
+ if( selectItemG ( item, m_classes ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Function) {
+ if( selectItemG ( item, m_functions ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::TypeAlias) {
+ if( selectItemG ( item, m_typeAliases ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Variable) {
+ if( selectItemG ( item, m_variables ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Namespace) {
+ ///currently not neccessary..
+ }
+
+ for(QMap<ClassDom, ClassDomBrowserItem*>::Iterator it = m_classes.begin(); it != m_classes.end(); ++it) {
+ if( (*it)->selectItem(item) )
+ return true;
+ }
+
+ for(QMap<QString, NamespaceDomBrowserItem*>::Iterator it = m_namespaces.begin(); it != m_namespaces.end(); ++it) {
+ if( (*it)->selectItem(item) )
+ return true;
+ }
+ return false;
+}
+
+
+void NamespaceDomBrowserItem::processNamespace( NamespaceDom ns, bool remove )
+{
+ NamespaceDomBrowserItem* item = m_namespaces.contains( ns->name() ) ? m_namespaces[ ns->name() ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new NamespaceDomBrowserItem( this, ns );
+ if( listView()->removedText.contains(ns->name()) )
+ item->setOpen( true );
+ m_namespaces.insert( ns->name(), item );
+ }
+
+ NamespaceList namespaceList = ns->namespaceList();
+ ClassList classList = ns->classList();
+ TypeAliasList typeAliasList = ns->typeAliasList();
+ FunctionList functionList = ns->functionList();
+ VariableList variableList = ns->variableList();
+
+ for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ item->processNamespace( *it, remove );
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ item->processClass( *it, remove );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ item->processTypeAlias( *it, remove );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ item->processFunction( *it, remove );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ item->processVariable( *it, remove );
+
+ if( remove && item->childCount() == 0 ){
+ m_namespaces.remove( ns->name() );
+ if( item->isOpen() ){
+ listView()->removedText << ns->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void NamespaceDomBrowserItem::processClass( ClassDom klass, bool remove )
+{
+ ClassDomBrowserItem* item = m_classes.contains( klass ) ? m_classes[ klass ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new ClassDomBrowserItem( this, klass );
+ if( listView()->removedText.contains(klass->name()) )
+ item->setOpen( true );
+ m_classes.insert( klass, item );
+ }
+
+ ClassList classList = klass->classList();
+ TypeAliasList typeAliasList = klass->typeAliasList();
+ FunctionList functionList = klass->functionList();
+ VariableList variableList = klass->variableList();
+
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ item->processClass( *it, remove );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ item->processTypeAlias( *it, remove );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ item->processFunction( *it, remove );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ item->processVariable( *it, remove );
+
+ if( remove && item->childCount() == 0 ){
+ m_classes.remove( klass );
+ if( item->isOpen() ){
+ listView()->removedText << klass->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void NamespaceDomBrowserItem::processTypeAlias( TypeAliasDom typeAlias, bool remove )
+{
+ TypeAliasDomBrowserItem* item = m_typeAliases.contains( typeAlias ) ? m_typeAliases[ typeAlias ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new TypeAliasDomBrowserItem( this, typeAlias );
+ if( listView()->removedText.contains(typeAlias->name()) )
+ item->setOpen( true );
+ m_typeAliases.insert( typeAlias, item );
+ }
+
+ if( remove && item->childCount() == 0 ){
+ m_typeAliases.remove( typeAlias );
+ if( item->isOpen() ){
+ listView()->removedText << typeAlias->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void NamespaceDomBrowserItem::processFunction( FunctionDom fun, bool remove )
+{
+ FunctionDomBrowserItem* item = m_functions.contains( fun ) ? m_functions[ fun ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new FunctionDomBrowserItem( this, fun );
+ m_functions.insert( fun, item );
+ }
+
+ if( remove ){
+ m_functions.remove( fun );
+ delete( item );
+ item = 0;
+ }
+}
+
+void NamespaceDomBrowserItem::processVariable( VariableDom var, bool remove )
+{
+ VariableDomBrowserItem* item = m_variables.contains( var ) ? m_variables[ var ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new VariableDomBrowserItem( this, var );
+ m_variables.insert( var, item );
+ }
+
+ if( remove ){
+ m_variables.remove( var );
+ delete( item );
+ item = 0;
+ }
+}
+
+// ------------------------------------------------------------------------
+
+
+bool ClassDomBrowserItem::selectItem(ItemDom item)
+{
+ if(item->kind() == CodeModelItem::Class) {
+ if( selectItemG ( item, m_classes ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Function) {
+ if( selectItemG ( item, m_functions ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::TypeAlias) {
+ if( selectItemG ( item, m_typeAliases ) ) return true;
+ }
+
+ if(item->kind() == CodeModelItem::Variable) {
+ if( selectItemG ( item, m_variables ) ) return true;
+ }
+
+ for(QMap<ClassDom, ClassDomBrowserItem*>::Iterator it = m_classes.begin(); it != m_classes.end(); ++it) {
+ if( (*it)->selectItem(item) )
+ return true;
+ }
+ return false;
+}
+
+
+void ClassDomBrowserItem::processClass( ClassDom klass, bool remove )
+{
+ ClassDomBrowserItem* item = m_classes.contains( klass ) ? m_classes[ klass ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new ClassDomBrowserItem( this, klass );
+ if( listView()->removedText.contains(klass->name()) )
+ item->setOpen( true );
+ m_classes.insert( klass, item );
+ }
+
+ ClassList classList = klass->classList();
+ TypeAliasList typeAliasList = klass->typeAliasList();
+ FunctionList functionList = klass->functionList();
+ VariableList variableList = klass->variableList();
+
+ for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
+ item->processClass( *it, remove );
+ for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
+ item->processTypeAlias( *it, remove );
+ for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
+ item->processFunction( *it, remove );
+ for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
+ item->processVariable( *it, remove );
+
+ if( remove && item->childCount() == 0 ){
+ m_classes.remove( klass );
+ if( item->isOpen() ){
+ listView()->removedText << klass->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void ClassDomBrowserItem::processTypeAlias( TypeAliasDom typeAlias, bool remove )
+{
+ TypeAliasDomBrowserItem* item = m_typeAliases.contains( typeAlias ) ? m_typeAliases[ typeAlias ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new TypeAliasDomBrowserItem( this, typeAlias );
+ if( listView()->removedText.contains(typeAlias->name()) )
+ item->setOpen( true );
+ m_typeAliases.insert( typeAlias, item );
+ }
+
+ if( remove && item->childCount() == 0 ){
+ m_typeAliases.remove( typeAlias );
+ if( item->isOpen() ){
+ listView()->removedText << typeAlias->name();
+ }
+ delete( item );
+ item = 0;
+ }
+}
+
+void ClassDomBrowserItem::processFunction( FunctionDom fun, bool remove )
+{
+ FunctionDomBrowserItem* item = m_functions.contains( fun ) ? m_functions[ fun ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new FunctionDomBrowserItem( this, fun );
+ m_functions.insert( fun, item );
+ }
+
+ if( remove ){
+ m_functions.remove( fun );
+ delete( item );
+ item = 0;
+ }
+}
+
+void ClassDomBrowserItem::processVariable( VariableDom var, bool remove )
+{
+ VariableDomBrowserItem* item = m_variables.contains( var ) ? m_variables[ var ] : 0;
+ if( !item ){
+ if( remove )
+ return;
+
+ item = new VariableDomBrowserItem( this, var );
+ m_variables.insert( var, item );
+ }
+
+ if( remove ){
+ m_variables.remove( var );
+ delete( item );
+ item = 0;
+ }
+}
+
+void FolderBrowserItem::setup( )
+{
+ ClassViewItem::setup();
+ setPixmap( 0, SmallIcon("folder") );
+ setExpandable( true );
+}
+
+void NamespaceDomBrowserItem::setup( )
+{
+ ClassViewItem::setup();
+ setPixmap( 0, UserIcon("CVnamespace", KIcon::DefaultState, listView()->m_part->instance()) );
+ setExpandable( true );
+
+ QString txt = listView()->m_part->languageSupport()->formatModelItem(m_dom.data(), true);
+ setText( 0, txt );
+}
+
+void ClassDomBrowserItem::setup( )
+{
+ ClassViewItem::setup();
+ setPixmap( 0, UserIcon("CVclass", KIcon::DefaultState, listView()->m_part->instance()) );
+ setExpandable( true );
+
+ QString txt = listView()->m_part->languageSupport()->formatModelItem(m_dom.data(), true);
+ setText( 0, txt );
+}
+
+void TypeAliasDomBrowserItem::setup( )
+{
+ ClassViewItem::setup();
+ setPixmap( 0, UserIcon("CVtypedef", KIcon::DefaultState, listView()->m_part->instance()) );
+ setExpandable( false );
+
+ QString txt = listView()->m_part->languageSupport()->formatModelItem(m_dom.data(), true);
+ setText( 0, txt );
+}
+
+void FunctionDomBrowserItem::setup( )
+{
+ ClassViewItem::setup();
+
+ QString iconName;
+ QString methodType;
+
+ if ( m_dom->isSignal() )
+ methodType = "signal";
+ else if (m_dom->isSlot() )
+ methodType = "slot";
+ else
+ methodType = "meth";
+
+ if( m_dom->access() == CodeModelItem::Private )
+ iconName = "CVprivate_" + methodType;
+ else if( m_dom->access() == CodeModelItem::Protected )
+ iconName = "CVprotected_" + methodType;
+ else
+ iconName = "CVpublic_" + methodType;
+
+ setPixmap( 0, UserIcon(iconName, KIcon::DefaultState, listView()->m_part->instance()) );
+
+ QString txt = listView()->m_part->languageSupport()->formatModelItem(m_dom.data(), true);
+
+ item() = highlightFunctionName(txt, 1, m_styles);
+}
+
+void FunctionDomBrowserItem::openDeclaration()
+{
+ int startLine, startColumn;
+ m_dom->getStartPosition( &startLine, &startColumn );
+ listView()->m_part->partController()->editDocument( KURL(m_dom->fileName()), startLine );
+}
+
+void FunctionDomBrowserItem::openImplementation()
+{
+ FunctionDefinitionList lst;
+ FileList fileList = listView()->m_part->codeModel()->fileList();
+ CodeModelUtils::findFunctionDefinitions( FindOp(m_dom), fileList, lst );
+
+ if( lst.isEmpty() )
+ return;
+
+ FunctionDefinitionDom fun;
+ QFileInfo fileInfo( m_dom->fileName() );
+ QString path = fileInfo.dirPath( true );
+
+ for( FunctionDefinitionList::Iterator it=lst.begin(); it!=lst.end(); ++it )
+ {
+ QFileInfo defFileInfo( (*it)->fileName() );
+ QString defPath = defFileInfo.dirPath( true );
+
+ if( path != defPath )
+ continue;
+
+ if( defFileInfo.baseName() == fileInfo.baseName() ) {
+ fun = *it;
+ } else if( !fun ) {
+ fun = *it;
+ }
+ }
+
+ if( !fun ) {
+ fun = lst.front();
+ }
+
+ int startLine, startColumn;
+ fun->getStartPosition( &startLine, &startColumn );
+ listView()->m_part->partController()->editDocument( KURL(fun->fileName()), startLine );
+}
+
+void VariableDomBrowserItem::setup( )
+{
+ ClassViewItem::setup();
+ QString iconName;
+ if( m_dom->access() == CodeModelItem::Private )
+ iconName = "CVprivate_var";
+ else if( m_dom->access() == CodeModelItem::Protected )
+ iconName = "CVprotected_var";
+ else
+ iconName = "CVpublic_var";
+
+ setPixmap( 0, UserIcon(iconName, KIcon::DefaultState, listView()->m_part->instance()) );
+
+ QString txt = listView()->m_part->languageSupport()->formatModelItem(m_dom.data(), true);
+ setText( 0, txt );
+}
+
+void VariableDomBrowserItem::openDeclaration()
+{
+ int startLine, startColumn;
+ m_dom->getStartPosition( &startLine, &startColumn );
+
+ listView()->m_part->partController()->editDocument( KURL(m_dom->fileName()), startLine );
+}
+
+void VariableDomBrowserItem::openImplementation()
+{
+}
+
+QString FolderBrowserItem::key( int , bool ) const
+{
+ return "0 " + text( 0 );
+}
+
+QString NamespaceDomBrowserItem::key( int , bool ) const
+{
+ return "1 " + text( 0 );
+}
+
+QString ClassDomBrowserItem::key( int , bool ) const
+{
+ return "2 " + text( 0 );
+}
+
+QString TypeAliasDomBrowserItem::key( int , bool ) const
+{
+ return "3 " + text( 0 );
+}
+
+QString FunctionDomBrowserItem::key( int , bool ) const
+{
+ return "4 " + text( 0 );
+}
+
+QString VariableDomBrowserItem::key( int , bool ) const
+{
+ return "5 " + text( 0 );
+}
+
+void ClassViewWidget::slotNewClass( )
+{
+ if( m_part->languageSupport()->features() & KDevLanguageSupport::NewClass )
+ m_part->languageSupport()->addClass();
+}
+
+void ClassViewWidget::slotAddMethod( )
+{
+ if ( !selectedItem() ) return;
+
+ if( m_part->languageSupport()->features() & KDevLanguageSupport::AddMethod )
+ m_part->languageSupport()->addMethod( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
+}
+
+void ClassViewWidget::slotAddAttribute( )
+{
+ if ( !selectedItem() ) return;
+
+ if( m_part->languageSupport()->features() & KDevLanguageSupport::AddAttribute )
+ m_part->languageSupport()->addAttribute( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
+}
+
+void ClassViewWidget::slotOpenDeclaration( )
+{
+ if ( !selectedItem() ) return;
+
+ static_cast<ClassViewItem*>( selectedItem() )->openDeclaration();
+}
+
+void ClassViewWidget::slotOpenImplementation( )
+{
+ if ( !selectedItem() ) return;
+
+ static_cast<ClassViewItem*>( selectedItem() )->openImplementation();
+}
+
+void ClassDomBrowserItem::openDeclaration( )
+{
+ int startLine, startColumn;
+ m_dom->getStartPosition( &startLine, &startColumn );
+ listView()->m_part->partController()->editDocument( KURL(m_dom->fileName()), startLine );
+}
+
+void TypeAliasDomBrowserItem::openDeclaration( )
+{
+ int startLine, startColumn;
+ m_dom->getStartPosition( &startLine, &startColumn );
+ listView()->m_part->partController()->editDocument( KURL(m_dom->fileName()), startLine );
+}
+
+bool FunctionDomBrowserItem::hasImplementation() const
+{
+ FunctionDefinitionList lst;
+ FileList fileList = listView()->m_part->codeModel()->fileList();
+ CodeModelUtils::findFunctionDefinitions( FindOp(m_dom), fileList, lst );
+
+ return !lst.isEmpty();
+}
+
+void ClassViewWidget::maybeTip( QPoint const & p )
+{
+ ClassViewItem * item = dynamic_cast<ClassViewItem*>( itemAt( p ) );
+ if ( !item ) return;
+
+ QString tooltip;
+
+ if ( item->isNamespace() )
+ {
+ NamespaceDomBrowserItem * nitem = dynamic_cast<NamespaceDomBrowserItem*>( item );
+ if ( nitem )
+ {
+ tooltip = nitem->dom()->scope().join("::") + "::" + nitem->dom()->name();
+ }
+ }
+ else if ( item->isClass() )
+ {
+ ClassDomBrowserItem * citem = dynamic_cast<ClassDomBrowserItem*>( item );
+ if ( citem )
+ {
+ tooltip = citem->dom()->scope().join("::") + "::"
+ + citem->dom()->name() + " : "
+ + citem->dom()->baseClassList().join(", ");
+ }
+ }
+ else if ( item->isFunction() )
+ {
+ FunctionDomBrowserItem * fitem = dynamic_cast<FunctionDomBrowserItem*>( item );
+ if ( fitem )
+ {
+ QString access;
+ if ( fitem->dom()->access() == CodeModelItem::Private )
+ access = "[private] ";
+ else if ( fitem->dom()->access() == CodeModelItem::Protected )
+ access = "[protected] ";
+ else if ( fitem->dom()->access() == CodeModelItem::Public )
+ access = "[public] ";
+
+ QStringList arguments;
+ ArgumentList const & list = fitem->dom()->argumentList();
+ ArgumentList::ConstIterator it( list.begin() );
+ while ( it != list.end() )
+ {
+ arguments << ((*it)->type() + " " + (*it)->name());
+ ++it;
+ }
+
+ QString strstatic = fitem->dom()->isStatic() ? QString( "[static] " ) : QString::null;
+ QString strsignal = fitem->dom()->isSignal() ? QString( "[signal] " ) : QString::null;
+ QString strslot = fitem->dom()->isSlot() ? QString( "[slot] " ) : QString::null;
+ QString strresult = !fitem->dom()->resultType().isEmpty() ? fitem->dom()->resultType() + " " : QString::null;
+
+ QString strconstant = fitem->dom()->isConstant() ? QString( " [const]" ) : QString::null;
+ QString strabstract = fitem->dom()->isAbstract() ? QString( " [abstract]" ) : QString::null;
+
+ tooltip = access + strstatic + strsignal + strslot + strresult
+ + fitem->dom()->scope().join("::") + "::" + fitem->dom()->name()
+ + "(" + arguments.join(", ") + ")" + strconstant + strabstract;
+ }
+ }
+ else if ( item->isVariable() )
+ {
+ VariableDomBrowserItem * vitem = dynamic_cast<VariableDomBrowserItem*>( item );
+ if ( vitem )
+ {
+ QString access;
+ if ( vitem->dom()->access() == CodeModelItem::Private )
+ access = "[private] ";
+ else if ( vitem->dom()->access() == CodeModelItem::Protected )
+ access = "[protected] ";
+ else if ( vitem->dom()->access() == CodeModelItem::Public )
+ access = "[public] ";
+
+ QString strstatic = vitem->dom()->isStatic() ? QString( "[static] " ) : QString::null;
+ tooltip = access + strstatic + vitem->dom()->type() + " " + vitem->dom()->name();
+ }
+ }
+ else if ( item->isTypeAlias() )
+ {
+ if( TypeAliasDomBrowserItem * titem = dynamic_cast<TypeAliasDomBrowserItem*>( item ) )
+ {
+ tooltip = QString( "[Type] " ) + titem->dom()->type() + " " + titem->dom()->name();
+ }
+ }
+
+ const int maxCommentSize = 300;
+
+ if( !item->comment().isEmpty() ) {
+ tooltip += "\n";
+ tooltip += item->comment().length() > maxCommentSize ? item->comment().left( maxCommentSize ) + " [...]" : item->comment();
+ }
+
+ kdDebug(0) << tooltip << endl;
+
+ QRect r = itemRect( item );
+
+ if ( item && r.isValid() && !tooltip.isEmpty() )
+ {
+ tip( r, QString("<qt><pre>") + QStyleSheet::escape( tooltip ) + QString("</pre></qt>") );
+ }
+}
+
+void ClassViewWidget::slotCreateAccessMethods( )
+{
+ if ( !selectedItem() ) return;
+
+ if( m_part->languageSupport()->features() & KDevLanguageSupport::CreateAccessMethods )
+ {
+ VariableDomBrowserItem* item = dynamic_cast<VariableDomBrowserItem*>( selectedItem() );
+ if (item == 0)
+ return;
+
+ m_part->languageSupport()->createAccessMethods(static_cast<ClassModel*>(static_cast<ClassDomBrowserItem*>(item->parent())->dom()),static_cast<VariableModel*>(item->dom()));
+ }
+}
+
+void ClassViewWidget::slotFollowEditor()
+{
+ m_doFollowEditor = m_actionFollowEditor->isChecked();
+}
+
+bool ClassViewWidget::doFollowEditor()
+{
+ return m_doFollowEditor;
+}
+
+
+#include "classviewwidget.moc"
diff --git a/parts/classview/classviewwidget.h b/parts/classview/classviewwidget.h
new file mode 100644
index 00000000..0e9fa04b
--- /dev/null
+++ b/parts/classview/classviewwidget.h
@@ -0,0 +1,414 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+// *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Partially based on KDE Studio ClassListView http://www.thekompany.com/projects/kdestudio/
+ */
+
+#ifndef __CLASSVIEW_WIDGET_H__
+#define __CLASSVIEW_WIDGET_H__
+
+#include <klistview.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qmap.h>
+#include <qtooltip.h>
+#include <codemodel.h>
+#include <fancylistviewitem.h>
+#include <navigator.h>
+
+class KDevProject;
+class ClassViewPart;
+class ClassViewItem;
+class FolderBrowserItem;
+class NamespaceDomBrowserItem;
+class ClassDomBrowserItem;
+class TypeAliasDomBrowserItem;
+class FunctionDomBrowserItem;
+class VariableDomBrowserItem;
+class KSelectAction;
+class KToggleAction;
+
+class ClassViewWidget : public KListView, public QToolTip
+{
+ Q_OBJECT
+public:
+ enum ViewMode
+ {
+ KDevelop3ViewMode = 0,
+ KDevelop2ViewMode,
+ JavaLikeViewMode
+ };
+
+public:
+ ClassViewWidget( ClassViewPart *part );
+ virtual ~ClassViewWidget();
+
+ int viewMode() const;
+ void setViewMode( int mode );
+
+ void clear();
+
+ bool selectItem(ItemDom item);
+ bool doFollowEditor();
+
+ inline TextPaintStyleStore& paintStyles() {
+ return m_paintStyles;
+ }
+
+private slots:
+ void slotNewClass();
+ void slotAddMethod();
+ void slotAddAttribute();
+ void slotOpenDeclaration();
+ void slotOpenImplementation();
+ void slotCreateAccessMethods();
+ void slotFollowEditor();
+
+protected:
+ void contentsContextMenuEvent( QContextMenuEvent* );
+ void maybeTip( QPoint const & );
+
+private slots:
+ void slotProjectOpened();
+ void slotProjectClosed();
+ void refresh();
+ void insertFile( const QString& fileName );
+ void removeFile( const QString& fileName );
+ void slotExecuted( QListViewItem* item );
+
+private:
+ ClassViewPart* m_part;
+ QStringList removedText;
+ QString m_projectDirectory;
+ int m_projectDirectoryLength;
+ FolderBrowserItem* m_projectItem;
+ KSelectAction* m_actionViewMode;
+ KAction* m_actionNewClass;
+ KAction* m_actionAddMethod;
+ KAction* m_actionAddAttribute;
+ KAction* m_actionOpenDeclaration;
+ KAction* m_actionOpenImplementation;
+ KAction* m_actionCreateAccessMethods;
+ KToggleAction * m_actionFollowEditor;
+ bool m_doFollowEditor;
+ friend class ClassViewItem;
+ friend class FolderBrowserItem;
+ friend class NamespaceDomBrowserItem;
+ friend class ClassDomBrowserItem;
+ friend class TypeAliasDomBrowserItem;
+ friend class FunctionDomBrowserItem;
+ friend class VariableDomBrowserItem;
+ TextPaintStyleStore m_paintStyles;
+};
+
+class ClassViewItem: public FancyListViewItem
+{
+ private:
+public:
+ ClassViewItem( QListView* parent, const QString& text=QString::null )
+ : FancyListViewItem( static_cast<ClassViewWidget*>( parent )->m_paintStyles, parent, text ) {}
+ ClassViewItem( QListViewItem* parent, const QString& text=QString::null )
+ : FancyListViewItem( static_cast<ClassViewWidget*>( parent->listView() )->m_paintStyles, parent, text ) {}
+
+ virtual const CodeModelItem* model() const { return 0; }
+
+ virtual bool isFolder() const { return false; }
+ virtual bool isFile() const { return false; }
+ virtual bool isNamespace() const { return false; }
+ virtual bool isClass() const { return false; }
+ virtual bool isFunction() const { return false; }
+ virtual bool isVariable() const { return false; }
+ virtual bool isTypeAlias() const { return false; }
+
+ virtual bool hasDeclaration() const { return false; }
+ virtual bool hasImplementation() const { return false; }
+
+ virtual void openDeclaration() {}
+ virtual void openImplementation() {}
+
+ void select();
+
+ virtual QString comment();
+
+ ClassViewWidget* listView() { return static_cast<ClassViewWidget*>( QListViewItem::listView() ); }
+ const ClassViewWidget* listView() const { return static_cast<ClassViewWidget*>( QListViewItem::listView() ); }
+};
+
+class FolderBrowserItem: public ClassViewItem
+{
+public:
+ FolderBrowserItem( ClassViewWidget* widget, QListView* parent, const QString& name=QString::null )
+ : ClassViewItem( parent, name ), m_widget(widget) {}
+ FolderBrowserItem( ClassViewWidget* widget, QListViewItem* parent, const QString& name=QString::null )
+ : ClassViewItem( parent, name ), m_widget(widget) {}
+
+ virtual bool isFolder() const { return true; }
+
+ void setup();
+ QString key( int, bool ) const;
+
+ void processFile( FileDom file, QStringList& path, bool remove=false );
+ void processNamespace( NamespaceDom ns, bool remove=false );
+ void processClass( ClassDom klass, bool remove=false );
+ void processTypeAlias( TypeAliasDom typeAlias, bool remove=false );
+ void processFunction( FunctionDom fun, bool remove=false );
+ void processVariable( VariableDom var, bool remove=false );
+ bool selectItem(ItemDom item);
+
+private:
+ QMap<QString, FolderBrowserItem*> m_folders;
+ QMap<QString, NamespaceDomBrowserItem*> m_namespaces;
+ QMap<ClassDom, ClassDomBrowserItem*> m_classes;
+ QMap<TypeAliasDom, TypeAliasDomBrowserItem*> m_typeAliases;
+ QMap<FunctionDom, FunctionDomBrowserItem*> m_functions;
+ QMap<VariableDom, VariableDomBrowserItem*> m_variables;
+
+ ClassViewWidget* m_widget;
+};
+
+class NamespaceDomBrowserItem: public ClassViewItem
+{
+public:
+ NamespaceDomBrowserItem( QListView* parent, NamespaceDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+ NamespaceDomBrowserItem( QListViewItem* parent, NamespaceDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+
+ const CodeModelItem* model() const { return m_dom; }
+
+ virtual bool isNamespace() const { return true; }
+
+ void setup();
+ QString key( int, bool ) const;
+
+ void processNamespace( NamespaceDom ns, bool remove=false );
+ void processClass( ClassDom klass, bool remove=false );
+ void processTypeAlias( TypeAliasDom typeAlias, bool remove=false );
+ void processFunction( FunctionDom fun, bool remove=false );
+ void processVariable( VariableDom var, bool remove=false );
+ bool selectItem( ItemDom item );
+ virtual QString comment();
+
+ NamespaceDom dom() { return m_dom; }
+
+private:
+ NamespaceDom m_dom;
+ QMap<QString, NamespaceDomBrowserItem*> m_namespaces;
+ QMap<ClassDom, ClassDomBrowserItem*> m_classes;
+ QMap<TypeAliasDom, TypeAliasDomBrowserItem*> m_typeAliases;
+ QMap<FunctionDom, FunctionDomBrowserItem*> m_functions;
+ QMap<VariableDom, VariableDomBrowserItem*> m_variables;
+};
+
+class ClassDomBrowserItem: public ClassViewItem
+{
+public:
+ ClassDomBrowserItem( QListView* parent, ClassDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+ ClassDomBrowserItem( QListViewItem* parent, ClassDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+
+ const CodeModelItem* model() const { return m_dom; }
+ virtual bool isClass() const { return true; }
+
+ virtual bool hasDeclaration() const { return true; }
+ virtual void openDeclaration();
+
+ void setup();
+ QString key( int, bool ) const;
+
+ void processClass( ClassDom klass, bool remove=false );
+ void processTypeAlias( TypeAliasDom typeAlias, bool remove=false );
+ void processFunction( FunctionDom fun, bool remove=false );
+ void processVariable( VariableDom var, bool remove=false );
+
+ virtual QString comment() {
+ if( !m_dom ) return "";
+ return m_dom->comment();
+ }
+
+ bool selectItem(ItemDom item);
+ ClassDom dom() { return m_dom; }
+
+private:
+ ClassDom m_dom;
+ QMap<ClassDom, ClassDomBrowserItem*> m_classes;
+ QMap<TypeAliasDom, TypeAliasDomBrowserItem*> m_typeAliases;
+ QMap<FunctionDom, FunctionDomBrowserItem*> m_functions;
+ QMap<VariableDom, VariableDomBrowserItem*> m_variables;
+};
+
+class TypeAliasDomBrowserItem: public ClassViewItem
+{
+public:
+ TypeAliasDomBrowserItem( QListView* parent, TypeAliasDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+ TypeAliasDomBrowserItem( QListViewItem* parent, TypeAliasDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+
+ const CodeModelItem* model() const { return m_dom; }
+ virtual bool isTypeAlias() const { return true; }
+
+ virtual bool hasDeclaration() const { return true; }
+ virtual void openDeclaration();
+
+ virtual QString comment() {
+ if( !m_dom ) return "";
+ return m_dom->comment();
+ }
+
+ void setup();
+ QString key( int, bool ) const;
+
+ TypeAliasDom dom() { return m_dom; }
+
+private:
+ TypeAliasDom m_dom;
+};
+
+class FunctionDomBrowserItem: public ClassViewItem
+{
+public:
+ FunctionDomBrowserItem( QListView* parent, FunctionDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+ FunctionDomBrowserItem( QListViewItem* parent, FunctionDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+
+ const CodeModelItem* model() const { return m_dom; }
+ virtual bool isFunction() const { return true; }
+
+ virtual bool hasDeclaration() const { return true; }
+ virtual bool hasImplementation() const;
+
+ virtual void openDeclaration();
+ virtual void openImplementation();
+
+ virtual QString comment() {
+ if( !m_dom ) return "";
+ return m_dom->comment();
+ }
+
+ void setup();
+ QString key( int, bool ) const;
+
+ FunctionDom dom() { return m_dom; }
+
+private:
+ FunctionDom m_dom;
+};
+
+class VariableDomBrowserItem: public ClassViewItem
+{
+public:
+ VariableDomBrowserItem( QListView* parent, VariableDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+ VariableDomBrowserItem( QListViewItem* parent, VariableDom dom )
+ : ClassViewItem( parent, dom->name() ), m_dom( dom ) {}
+
+ const CodeModelItem* model() const { return m_dom; }
+ virtual bool isVariable() const { return true; }
+
+ virtual bool hasDeclaration() const { return true; }
+ virtual bool hasImplementation() const { return false; }
+
+ virtual QString comment() {
+ if( !m_dom ) return "";
+ return m_dom->comment();
+ }
+
+ virtual void openDeclaration();
+ virtual void openImplementation();
+
+ void setup();
+ QString key( int, bool ) const;
+
+ VariableDom dom() { return m_dom; }
+
+private:
+ VariableDom m_dom;
+};
+
+struct FindOp2 ///a template would look nicer
+{
+ FindOp2( const FunctionDefinitionDom& dom ): m_dom( dom ) {}
+
+ bool operator() ( const FunctionDom& def ) const
+ {
+ if( m_dom->name() != def->name() )
+ return false;
+
+ if( m_dom->isConstant() != m_dom->isConstant() )
+ return false;
+
+ QString scope1 = QString("::") + m_dom->scope().join("::");
+ QString scope2 = QString("::") + def->scope().join("::");
+ if( !scope1.endsWith(scope2) )
+ return false;
+
+ const ArgumentList args = m_dom->argumentList();
+ const ArgumentList args2 = def->argumentList();
+ if( args.size() != args2.size() )
+ return false;
+
+ for( uint i=0; i<args.size(); ++i ){
+ if( args[i]->type() != args[i]->type() )
+ return false;
+ }
+
+ return true;
+ }
+
+ private:
+ const FunctionDefinitionDom& m_dom;
+};
+
+struct FindOp
+{
+ FindOp( const FunctionDom& dom ): m_dom( dom ) {}
+
+ bool operator() ( const FunctionDefinitionDom& def ) const
+ {
+ if( m_dom->name() != def->name() )
+ return false;
+
+ if( m_dom->isConstant() != m_dom->isConstant() )
+ return false;
+
+ QString scope1 = QString("::") + m_dom->scope().join("::");
+ QString scope2 = QString("::") + def->scope().join("::");
+ if( !scope1.endsWith(scope2) )
+ return false;
+
+ const ArgumentList args = m_dom->argumentList();
+ const ArgumentList args2 = def->argumentList();
+ if( args.size() != args2.size() )
+ return false;
+
+ for( uint i=0; i<args.size(); ++i ){
+ if( args[i]->type() != args2[i]->type() )
+ return false;
+ }
+
+ return true;
+ }
+
+private:
+ const FunctionDom& m_dom;
+};
+
+#endif
diff --git a/parts/classview/digraphview.cpp b/parts/classview/digraphview.cpp
new file mode 100644
index 00000000..b566757f
--- /dev/null
+++ b/parts/classview/digraphview.cpp
@@ -0,0 +1,414 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "digraphview.h"
+
+#include <math.h>
+#include <stdlib.h>
+#include <qapplication.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
+#include <qtextstream.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <kstandarddirs.h>
+#include <kglobalsettings.h>
+#include <ktempfile.h>
+#include <kdeversion.h>
+#include <kdebug.h>
+
+struct DigraphNode
+{
+ int x;
+ int y;
+ int w;
+ int h;
+ QString name;
+};
+
+
+struct DigraphEdge
+{
+ QPointArray points;
+};
+
+
+DigraphView::DigraphView(QWidget *parent, const char *name)
+ : QScrollView(parent, name, WRepaintNoErase|WStaticContents|WResizeNoErase)
+{
+ viewport()->setBackgroundMode(PaletteBase);
+
+ QPaintDeviceMetrics m(this);
+ xscale = m.logicalDpiX();
+ yscale = m.logicalDpiY();
+
+ width = -1;
+ height = -1;
+
+ nodes.setAutoDelete(true);
+ edges.setAutoDelete(true);
+ selNode = 0;
+}
+
+
+DigraphView::~DigraphView()
+{
+}
+
+
+int DigraphView::toXPixel(double x)
+{
+ return (int) (x*xscale);
+}
+
+
+int DigraphView::toYPixel(double y)
+{
+ return height - (int) (y*yscale);
+}
+
+
+void DigraphView::setRenderedExtent(double w, double h)
+{
+ width = (int) (w*xscale);
+ height = (int) (h*yscale);
+ resizeContents(width+1, height+1);
+}
+
+
+void DigraphView::addRenderedNode(const QString &name,
+ double x, double y, double w, double h)
+{
+ DigraphNode *node = new DigraphNode;
+ node->x = toXPixel(x);
+ node->y = toYPixel(y);
+ node->w = (int) (w*xscale);
+ node->h = (int) (h*yscale);
+ node->name = name;
+ nodes.append(node);
+}
+
+
+void DigraphView::addRenderedEdge(const QString &/*name1*/, const QString &/*name2*/,
+ QMemArray<double> coords)
+{
+ if (coords.count() < 4)
+ return;
+
+ DigraphEdge *edge = new DigraphEdge;
+ edge->points.resize(coords.count()/2);
+
+ for (uint i = 0; i < edge->points.count(); ++i)
+ edge->points[i] = QPoint(toXPixel(coords[2*i]), toYPixel(coords[2*i+1]));
+
+ edges.append(edge);
+}
+
+
+void DigraphView::addEdge(const QString &name1, const QString &name2)
+{
+ QString line;
+ line = "\"";
+ line += name1;
+ line += "\" -> \"";
+ line += name2;
+ line += "\";";
+ inputs.append(line);
+}
+
+
+void DigraphView::clear()
+{
+ nodes.clear();
+ edges.clear();
+ selNode = 0;
+ width = -1;
+ height = -1;
+ inputs.clear();
+ viewport()->update();
+}
+
+
+void DigraphView::setSelected(const QString &name)
+{
+ QPtrListIterator<DigraphNode> it(nodes);
+ for (; it.current(); ++it) {
+ if (it.current()->name == name) {
+ updateContents(selNode->x-selNode->w/2, selNode->y-selNode->h/2,
+ selNode->w, selNode->h);
+ selNode = it.current();
+ updateContents(selNode->x-selNode->w/2, selNode->y-selNode->h/2,
+ selNode->w, selNode->h);
+ return;
+ }
+ }
+}
+
+
+void DigraphView::ensureVisible(const QString &name)
+{
+ QPtrListIterator<DigraphNode> it(nodes);
+ for (; it.current(); ++it) {
+ if (it.current()->name == name) {
+ QScrollView::ensureVisible((*it)->x, (*it)->y, (*it)->w, (*it)->h);
+ return;
+ }
+ }
+}
+
+
+QStringList DigraphView::splitLine(QString str)
+{
+ QStringList result;
+
+ while (!str.isEmpty()) {
+ if (str[0] == '"') {
+ int pos = str.find('"', 1);
+ if (pos == -1)
+ pos = str.length();
+ result << str.mid(1, pos-1);
+ str.remove(0, pos+1);
+ } else {
+ int pos = str.find(' ');
+ if (pos == -1)
+ pos = str.length();
+ result << str.left(pos);
+ str.remove(0, pos+1);
+ }
+ uint i = 0; while (i<str.length() && str[i] == ' ') ++i;
+ str.remove(0, i);
+ }
+
+ return result;
+}
+
+
+void DigraphView::parseDotResults(const QStringList &list)
+{
+ QStringList::ConstIterator it;
+ for (it = list.begin(); it != list.end(); ++it) {
+ QStringList tokens = splitLine(*it);
+ if (tokens.count() == 0)
+ continue;
+ if (tokens[0] == "graph") {
+ if (tokens.count() < 4)
+ continue;
+ setRenderedExtent(tokens[2].toDouble(), tokens[3].toDouble());
+ } else if (tokens[0] == "node") {
+ if (tokens.count() < 6)
+ continue;
+ addRenderedNode(tokens[1], tokens[2].toDouble(), tokens[3].toDouble(),
+ tokens[4].toDouble(), tokens[5].toDouble());
+ } else if (tokens[0] == "edge") {
+ if (tokens.count() < 8)
+ continue;
+ QMemArray<double> coords(tokens.count()-6);
+ for (uint i=0; i != tokens.count()-6; ++i)
+ coords[i] = tokens[i+4].toDouble();
+ addRenderedEdge(tokens[1], tokens[2], coords);
+ }
+ }
+}
+
+
+void DigraphView::process( const QString& file, const QString& ext )
+{
+ QString cmd = KGlobal::dirs()->findExe("dot");
+ if (cmd.isEmpty()) {
+ KMessageBox::sorry(0, i18n("You do not have 'dot' installed.\nIt can be downloaded from www.graphviz.org."));
+ return;
+ }
+
+ QStringList results;
+
+ KTempFile ifile, ofile;
+ QTextStream &is = *ifile.textStream();
+ is << "digraph G {" << endl;
+ is << "rankdir=LR;" << endl;
+ is << "node [shape=box,fontname=Helvetica,fontsize=12];" << endl;
+ QStringList::Iterator it;
+ for (it = inputs.begin(); it != inputs.end(); ++it)
+ is << (*it) << endl;
+ is << "}" << endl;
+ ifile.close();
+
+ KProcess proc;
+ if( !file.isEmpty() && !ext.isEmpty() )
+ {
+ proc << cmd << QString("-T")+ext << ifile.name() << "-o" << file;
+ kdDebug() << "Executing: " << cmd <<" "<<QString("-T")+ext <<" "<< ifile.name() << "-o"<<file << endl;
+ }else
+ {
+ proc << cmd << "-Tplain" << ifile.name() << "-o" << ofile.name();
+ }
+ proc.start(KProcess::Block);
+
+ if( !file.isEmpty() && !ext.isEmpty() )
+ {
+ return;
+ }
+
+ QTextStream &os = *ofile.textStream();
+ while (!os.atEnd())
+ results << os.readLine();
+ ofile.close();
+
+ parseDotResults(results);
+ inputs.clear();
+
+ if (nodes.first())
+ selNode = nodes.first();
+ viewport()->update();
+}
+
+void DigraphView::drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph)
+{
+ QRect clipRect(clipx, clipy, clipw, cliph);
+ p->eraseRect(clipRect);
+
+ p->setFont(KGlobalSettings::generalFont());
+ QPtrListIterator<DigraphNode> it1(nodes);
+ for (; it1.current(); ++it1) {
+ QRect r((*it1)->x-(*it1)->w/2, (*it1)->y-(*it1)->h/2, (*it1)->w, (*it1)->h);
+ if (r.intersects(clipRect)) {
+ if (it1.current() == selNode)
+ p->fillRect(r, QBrush(lightGray, SolidPattern));
+ else
+ p->drawRect(r);
+ p->drawText(r, AlignCenter, (*it1)->name);
+ }
+ }
+ p->setBrush(QBrush(black, SolidPattern));
+ QPtrListIterator<DigraphEdge> it2(edges);
+ for (; it2.current(); ++it2) {
+ int n = (*it2)->points.count();
+ for (int i=0; i+3 < n; i+=3)
+ {
+ QPointArray a(4);
+ QPointArray &b = (*it2)->points;
+ for (int j=0; j<4; ++j)
+ a.setPoint(j, b.point(i+j));
+ if (a.boundingRect().intersects(clipRect))
+ p->drawCubicBezier((*it2)->points, i);
+ }
+ QPoint p1 = (*it2)->points[n-2];
+ QPoint p2 = (*it2)->points[n-1];
+ QPoint d = p1-p2;
+ double l = sqrt(d.x()*d.x()+d.y()*d.y());
+ double d11 = (10.0)/l*d.x();
+ double d12 = (10.0)/l*d.y();
+ double d21 = -(3.0/l)*d.y();
+ double d22 = (3.0/l)*d.x();
+ QPointArray triangle(3);
+ triangle[0] = p2 + QPoint((int)(d11+d21),(int)(d12+d22));
+ triangle[1] = p2 + QPoint((int)(d11-d21),(int)(d12-d22));
+ triangle[2] = p2;
+ p->drawPolygon(triangle, true);
+ }
+}
+
+
+void DigraphView::contentsMousePressEvent(QMouseEvent *e)
+{
+ QPtrListIterator<DigraphNode> it1(nodes);
+ for (; it1.current(); ++it1) {
+ QRect r((*it1)->x-(*it1)->w/2, (*it1)->y-(*it1)->h/2, (*it1)->w, (*it1)->h);
+ if (r.contains(e->pos())) {
+ if (selNode) {
+ QRect oldr(selNode->x-selNode->w/2, selNode->y-selNode->h/2,
+ selNode->w, selNode->h);
+ updateContents(oldr);
+ }
+ selNode = it1.current();
+ emit selected(selNode->name);
+ updateContents(r);
+ }
+
+ }
+}
+
+
+QSize DigraphView::sizeHint() const
+{
+ if (width == -1)
+ return QSize(100, 100); // arbitrary
+
+ QSize dsize = KGlobalSettings::desktopGeometry(viewport()).size();
+ kdDebug(9003) << "sizehint for inheritance diagram" << dsize << " " << width << " " << height << endl;
+ return QSize(width, height).boundedTo(QSize(dsize.width()*2/3, dsize.height()*2/3));
+}
+
+
+#if 0
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ DigraphView *dw = new DigraphView(0, "dot widget");
+dw->addEdge( "5th Edition", "6th Edition");
+dw->addEdge( "5th Edition", "PWB 1.0");
+dw->addEdge( "6th Edition", "LSX");
+dw->addEdge( "6th Edition", "1 BSD");
+dw->addEdge( "6th Edition", "Mini Unix");
+dw->addEdge( "6th Edition", "Wollongong");
+dw->addEdge( "6th Edition", "Interdata");
+dw->addEdge( "Interdata", "Unix/TS 3.0");
+dw->addEdge( "Interdata", "PWB 2.0");
+dw->addEdge( "Interdata", "7th Edition");
+dw->addEdge( "7th Edition", "8th Edition");
+dw->addEdge( "7th Edition", "32V");
+dw->addEdge( "7th Edition", "V7M");
+dw->addEdge( "7th Edition", "Ultrix-11");
+dw->addEdge( "7th Edition", "Xenix");
+dw->addEdge( "7th Edition", "UniPlus+");
+dw->addEdge( "V7M", "Ultrix-11");
+dw->addEdge( "8th Edition", "9th Edition");
+dw->addEdge( "1 BSD", "2 BSD");
+dw->addEdge( "2 BSD", "2.8 BSD");
+dw->addEdge( "2.8 BSD", "Ultrix-11");
+dw->addEdge( "2.8 BSD", "2.9 BSD");
+dw->addEdge( "32V", "3 BSD");
+dw->addEdge( "3 BSD", "4 BSD");
+dw->addEdge( "4 BSD", "4.1 BSD");
+dw->addEdge( "4.1 BSD", "4.2 BSD");
+dw->addEdge( "4.1 BSD", "2.8 BSD");
+dw->addEdge( "4.1 BSD", "8th Edition");
+dw->addEdge( "4.2 BSD", "4.3 BSD");
+dw->addEdge( "4.2 BSD", "Ultrix-32");
+dw->addEdge( "PWB 1.0", "PWB 1.2");
+dw->addEdge( "PWB 1.0", "USG 1.0");
+dw->addEdge( "PWB 1.2", "PWB 2.0");
+dw->addEdge( "USG 1.0", "CB Unix 1");
+dw->addEdge( "USG 1.0", "USG 2.0");
+dw->addEdge( "CB Unix 1", "CB Unix 2");
+dw->addEdge( "CB Unix 2", "CB Unix 3");
+dw->addEdge( "CB Unix 3", "Unix/TS++");
+dw->addEdge( "CB Unix 3", "PDP-11 Sys V");
+dw->addEdge( "USG 2.0", "USG 3.0");
+dw->addEdge( "USG 3.0", "Unix/TS 3.0");
+dw->addEdge( "PWB 2.0", "Unix/TS 3.0");
+dw->addEdge( "Unix/TS 1.0", "Unix/TS 3.0");
+dw->addEdge( "Unix/TS 3.0", "TS 4.0");
+dw->addEdge( "Unix/TS++", "TS 4.0");
+dw->addEdge( "CB Unix 3", "TS 4.0");
+dw->addEdge( "TS 4.0", "System V.0");
+dw->addEdge( "System V.0", "System V.2");
+dw->addEdge( "System V.2", "System V.3");
+ dw->process();
+ dw->show();
+
+ return app.exec();
+}
+#endif
+
+#include "digraphview.moc"
diff --git a/parts/classview/digraphview.h b/parts/classview/digraphview.h
new file mode 100644
index 00000000..c5fb2a28
--- /dev/null
+++ b/parts/classview/digraphview.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DIGRAPHVIEW_H_
+#define _DIGRAPHVIEW_H_
+
+#include <qptrlist.h>
+#include <qscrollview.h>
+#include <qstringlist.h>
+#include <qimage.h>
+
+class DigraphNode;
+class DigraphEdge;
+
+
+class DigraphView : public QScrollView
+{
+ Q_OBJECT
+
+public:
+ DigraphView(QWidget *parent, const char *name);
+ ~DigraphView();
+
+ void addEdge(const QString &name1, const QString &name2);
+ void process(const QString& file = "", const QString& ext = "");
+ void clear();
+ void setSelected(const QString &name);
+ void ensureVisible(const QString &name);
+
+signals:
+ void selected(const QString &name);
+
+protected:
+ virtual void drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph);
+ virtual void contentsMousePressEvent(QMouseEvent *e);
+ virtual QSize sizeHint() const;
+
+private:
+ int toXPixel(double x);
+ int toYPixel(double x);
+
+ void setRenderedExtent(double w, double h);
+ void addRenderedNode(const QString &name,
+ double x, double y, double w, double h);
+ void addRenderedEdge(const QString &name1, const QString &name2,
+ QMemArray<double> coords);
+ static QStringList splitLine(QString str);
+ void parseDotResults(const QStringList &list);
+
+ double xscale, yscale;
+ int width, height;
+ QStringList inputs;
+ QPtrList<DigraphNode> nodes;
+ QPtrList<DigraphEdge> edges;
+ DigraphNode *selNode;
+};
+
+#endif
diff --git a/parts/classview/hierarchydlg.cpp b/parts/classview/hierarchydlg.cpp
new file mode 100644
index 00000000..21a54031
--- /dev/null
+++ b/parts/classview/hierarchydlg.cpp
@@ -0,0 +1,276 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "hierarchydlg.h"
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <kpushbutton.h>
+#include <kstdguiitem.h>
+#include <kfile.h>
+#include <kfiledialog.h>
+#include <kurlrequesterdlg.h>
+#include <kurlrequester.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+
+#include <qlayout.h>
+#include <qfileinfo.h>
+#include <qlistview.h>
+#include <qapplication.h>
+#include <qsplitter.h>
+
+#include "kdevlanguagesupport.h"
+#include "kcomboview.h"
+
+#include "classviewpart.h"
+//#include "classtoolwidget.h"
+#include "digraphview.h"
+#include "viewcombos.h"
+
+
+HierarchyDialog::HierarchyDialog( ClassViewPart *part )
+ : QDialog(0, "hierarchy dialog", false)
+{
+ class_combo = new KComboView(true, 150, this);
+ class_combo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
+// class_combo->setMinimumWidth(150);
+ namespace_combo = new KComboView(true, 150, this);
+ namespace_combo->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
+// namespace_combo->setMinimumWidth(150);
+
+ QPushButton *close_button = new KPushButton(KStdGuiItem::close(), this);
+ QPushButton *save_button = new KPushButton(KStdGuiItem::save(), this);
+ QPushButton *refresh_button = new KPushButton(i18n("Refresh"), this);
+
+ QSplitter *splitter = new QSplitter(Vertical, this);
+ digraph = new DigraphView(splitter, "digraph view");
+// member_tree = new ClassToolWidget(part, splitter);
+
+ QBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
+ QBoxLayout *combo_layout = new QHBoxLayout();
+ layout->addLayout(combo_layout);
+ combo_layout->addWidget(namespace_combo);
+ combo_layout->addWidget(class_combo);
+ combo_layout->addSpacing(60);
+ combo_layout->addWidget(refresh_button);
+ combo_layout->addWidget(save_button);
+ combo_layout->addWidget(close_button);
+ layout->addWidget(splitter);
+
+ connect( namespace_combo, SIGNAL(activated(QListViewItem*)),
+ this, SLOT(slotNamespaceComboChoice(QListViewItem*)) );
+ connect( class_combo, SIGNAL(activated(QListViewItem*)),
+ this, SLOT(slotClassComboChoice(QListViewItem*)) );
+ connect( namespace_combo, SIGNAL(textChanged(const QString&)),
+ this, SLOT(slotNamespaceComboChoice(const QString&)) );
+ connect( class_combo, SIGNAL(textChanged(const QString&)),
+ this, SLOT(slotClassComboChoice(const QString&)) );
+ connect( close_button, SIGNAL(clicked()),
+ this, SLOT(hide()) );
+ connect( save_button, SIGNAL(clicked()),
+ this, SLOT(save()) );
+ connect( refresh_button, SIGNAL(clicked()),
+ this, SLOT(refresh()) );
+ connect( digraph, SIGNAL(selected(const QString&)),
+ this, SLOT(classSelected(const QString&)) );
+
+ m_part = part;
+// m_part->registerHierarchyDialog(this);
+ refresh();
+}
+
+
+HierarchyDialog::~HierarchyDialog()
+{
+// m_part->unregisterHierarchyDialog(this);
+}
+
+void HierarchyDialog::save()
+{
+ KURLRequesterDlg dlg(QString::null, this, "save_inheritance");
+ dlg.fileDialog()->setFilter("image/png image/jpeg image/bmp image/svg+xml");
+ dlg.fileDialog()->setOperationMode( KFileDialog::Saving );
+ dlg.fileDialog()->setMode( KFile::File | KFile::LocalOnly );
+ dlg.urlRequester()->setMode( KFile::File | KFile::LocalOnly );
+ if(dlg.exec() && dlg.selectedURL().isLocalFile())
+ {
+ QFileInfo fi(dlg.selectedURL().pathOrURL());
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ KDevLanguageSupport *ls = m_part->languageSupport();
+ for (QMap<QString, ClassDom>::const_iterator it = classes.begin(); it != classes.end(); ++it)
+ {
+ kdDebug(9003) << "Adding class to graph: " << it.key() << endl;
+ QString formattedName = ls->formatClassName(it.key());
+ QStringList baseClasses = it.data()->baseClassList();
+ for (QStringList::const_iterator bit = baseClasses.begin(); bit != baseClasses.end(); ++bit)
+ {
+ QMap<QString, QString>::const_iterator baseIt = uclasses.find(*bit);
+ if (baseIt != uclasses.end())
+ {
+ QString formattedParentName = ls->formatClassName(baseIt.data());
+ digraph->addEdge(formattedParentName, formattedName);
+ }
+ }
+ }
+ digraph->process(fi.absFilePath(), fi.extension());
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+void HierarchyDialog::refresh()
+{
+ digraph->clear();
+ classes.clear();
+ uclasses.clear();
+ ViewCombosOp::refreshNamespaces(m_part, namespace_combo);
+ processNamespace("", m_part->codeModel()->globalNamespace());
+
+ KDevLanguageSupport *ls = m_part->languageSupport();
+
+ for (QMap<QString, ClassDom>::const_iterator it = classes.begin(); it != classes.end(); ++it)
+ {
+ kdDebug(9003) << "Adding class to graph: " << it.key() << endl;
+ QString formattedName = ls->formatClassName(it.key());
+ QStringList baseClasses = it.data()->baseClassList();
+ for (QStringList::const_iterator bit = baseClasses.begin(); bit != baseClasses.end(); ++bit)
+ {
+ QMap<QString, QString>::const_iterator baseIt = uclasses.find(*bit);
+ if (baseIt != uclasses.end())
+ {
+ QString formattedParentName = ls->formatClassName(baseIt.data());
+ digraph->addEdge(formattedParentName, formattedName);
+ }
+ }
+ }
+ digraph->process();
+}
+
+void HierarchyDialog::setLanguageSupport(KDevLanguageSupport *ls)
+{
+ if (ls)
+ connect(ls, SIGNAL(updatedSourceInfo()), this, SLOT(refresh()));
+ else
+ refresh();
+}
+
+
+void HierarchyDialog::slotClassComboChoice(QListViewItem * item)
+{
+ ClassItem *ci = dynamic_cast<ClassItem*>(item);
+ if (!ci)
+ return;
+
+ KDevLanguageSupport *ls = m_part->languageSupport();
+
+ QString className = ls->formatClassName(uclasses[item->text(0)]);
+ digraph->setSelected(className);
+ digraph->ensureVisible(className);
+ classSelected(className);
+}
+
+void HierarchyDialog::slotClassComboChoice( const QString& itemText )
+{
+ QListViewItem* item = class_combo->listView()->firstChild();
+ while( item )
+ {
+ if( item->text(0) == itemText )
+ {
+ ClassItem *ci = dynamic_cast<ClassItem*>(item);
+ if (!ci)
+ return;
+
+ KDevLanguageSupport *ls = m_part->languageSupport();
+
+ QString className = ls->formatClassName(uclasses[item->text(0)]);
+ digraph->setSelected(className);
+ digraph->ensureVisible(className);
+ classSelected(className);
+ return;
+ }
+ item = item->nextSibling();
+ }
+}
+
+void HierarchyDialog::classSelected(const QString &/*className*/)
+{
+/* ParsedClass *currentClass = m_part->classStore()->getClassByName(className);
+ member_tree->clear();
+ if (currentClass) {
+ KDevLanguageSupport::Features features = m_part->languageSupport()->features();
+ if (features & KDevLanguageSupport::Functions)
+ member_tree->insertAllClassMethods(currentClass, (PIAccess)-1);
+ if (features & KDevLanguageSupport::Variables)
+ member_tree->insertAllClassAttributes(currentClass, (PIAccess)-1);
+ }*/
+}
+
+void HierarchyDialog::slotNamespaceComboChoice( QListViewItem * item )
+{
+ NamespaceItem *ni = dynamic_cast<NamespaceItem*>(item);
+ if (!ni)
+ return;
+ ViewCombosOp::refreshClasses(m_part, class_combo, ni->dom()->name());
+}
+
+void HierarchyDialog::slotNamespaceComboChoice( const QString& itemText )
+{
+ QListViewItem* item = namespace_combo->listView()->firstChild();
+ while( item )
+ {
+ if( item->text(0) == itemText )
+ {
+ NamespaceItem *ni = dynamic_cast<NamespaceItem*>(item);
+ if (!ni)
+ return;
+ ViewCombosOp::refreshClasses(m_part, class_combo, ni->dom()->name());
+ return;
+ }
+ item = item->nextSibling();
+ }
+}
+
+void HierarchyDialog::processNamespace( QString prefix, NamespaceDom dom )
+{
+ qWarning("processNamespace: prefix %s", prefix.latin1());
+ QString prefixInc = prefix.isEmpty() ? "" : ".";
+// QString nsprefix = dom->name().isEmpty() ? QString("") : prefixInc + dom->name();
+
+ NamespaceList namespaceList = dom->namespaceList();
+ for (NamespaceList::const_iterator it = namespaceList.begin(); it != namespaceList.end(); ++it)
+ {
+ qWarning("about to processNamespace: prefix %s", (prefixInc + (*it)->name()).latin1());
+ processNamespace(prefixInc + (*it)->name(), *it);
+ }
+
+ ClassList classList = dom->classList();
+ for (ClassList::const_iterator it = classList.begin(); it != classList.end(); ++it)
+ {
+ processClass(prefix, *it);
+ }
+}
+
+void HierarchyDialog::processClass( QString prefix, ClassDom dom )
+{
+ qWarning("processClass: prefix %s class %s", prefix.latin1(), dom->name().latin1());
+
+ QString prefixInc = prefix.isEmpty() ? "" : ".";
+ classes[prefix + prefixInc + dom->name()] = dom;
+ uclasses[dom->name()] = prefix + prefixInc + dom->name();
+
+ ClassList classList = dom->classList();
+ for (ClassList::const_iterator it = classList.begin(); it != classList.end(); ++it)
+ {
+ processClass(prefix + prefixInc + dom->name(), *it);
+ }
+}
+
+#include "hierarchydlg.moc"
diff --git a/parts/classview/hierarchydlg.h b/parts/classview/hierarchydlg.h
new file mode 100644
index 00000000..82cf2d4a
--- /dev/null
+++ b/parts/classview/hierarchydlg.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _HIERARCHYDLG_H_
+#define _HIERARCHYDLG_H_
+
+#include <qdialog.h>
+
+#include "codemodel.h"
+
+class ClassViewPart;
+class KDevLanguageSupport;
+class DigraphView;
+class ClassToolWidget;
+class KComboView;
+class QListViewItem;
+
+class HierarchyDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ HierarchyDialog( ClassViewPart *part );
+ ~HierarchyDialog();
+public slots:
+ void refresh();
+
+private slots:
+ void setLanguageSupport(KDevLanguageSupport *ls);
+ void slotClassComboChoice(QListViewItem *item);
+ void slotNamespaceComboChoice(QListViewItem *item);
+ void slotClassComboChoice(const QString&);
+ void slotNamespaceComboChoice(const QString&);
+ void classSelected(const QString &className);
+ void save();
+
+private:
+ void processNamespace(QString prefix, NamespaceDom dom);
+ void processClass(QString prefix, ClassDom dom);
+
+ QMap<QString, ClassDom> classes;
+ //QMap<class name, fully qualified class name>
+ //like MyClass - MyNamespace.MyClass
+ QMap<QString, QString> uclasses;
+
+ KComboView *namespace_combo;
+ KComboView *class_combo;
+ DigraphView *digraph;
+// ClassToolWidget *member_tree;
+ ClassViewPart *m_part;
+};
+
+#endif
diff --git a/parts/classview/kdevclassview.desktop b/parts/classview/kdevclassview.desktop
new file mode 100644
index 00000000..08c0de1e
--- /dev/null
+++ b/parts/classview/kdevclassview.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=This plugin displays a graphical view of all the classes in the project, complete with methods and attributes, and provides a way of direct source navigation.
+Comment[ca]=Aquest connector mostra una vista gràfica de totes les classes del projecte, completant-lo amb mètodes i atributs, i proporciona una forma de navegar directament a través del codi font.
+Comment[da]=Dette plugin giver en grafisk visning af alle klasserne i projektet, fuldstændig med metoder og attributter og sørger for en måde at have direkte kildenavigation.
+Comment[de]=Dieses Modul zeigt eine grafische Ansicht aller Klassen im Projekt, einschließlich der Methoden und Attribute und ermöglicht die Navigation in den betreffenden Quelltexten.
+Comment[el]=Αυτό το πρόσθετο εμφανίζει μια γραφική προβολή όλων των κλάσεων του έργου, πλήρης με μεθόδους και χαρακτηριστικά, και προσφέρει μια μέθοδο απευθείας πλοήγησης στον κώδικα.
+Comment[es]=Este complemento muestra una vista gráfica de todas las clases del proyecto, completándolo con métodos y atributos, y proporciona una forma de navegar directamente por el código fuente.
+Comment[et]=See plugin näitab graafiliselt kõiki projekti klasse koos meetodite ja atribuutidega ning võimaldab nende vahel kiiresti liikuda.
+Comment[eu]=Plugin honek proiektuak dituen klase guztien ikuspegi grafiko bat bistaratzen du, metodo eta atributuekin osatuta, eta iturburuen arteko nabigazio zuzena eskeintzen du.
+Comment[fa]=این وصله یک نمای نگاره‌ای از همۀ رده‌ها در پروژه را نمایش می‌دهد، با روشها و ویژگیها کامل می‌کند و یک راه ناوش مستقیم منبع فراهم می‌کند.
+Comment[fr]=Ce module externe affiche une vue graphique de toutes les classes dans le projet, la complète avec des méthodes et des attributs, et offre un moyen de naviguer directement dans le source.
+Comment[gl]=Esta extensión mostra unha vista gráfica de tódalas clases do proxecto, cos métodos e os atributos, e proporciona unha maneira para navegar o código directamente.
+Comment[hu]=Bővítőmodul egy projekt osztályainak áttekintéséhez, a tagfüggvényekkel és az attribútumokkal együtt, navigálási lehetőséggel
+Comment[it]=Questo plugin offre una rappresentazione grafica di tutte le classi nel progetto, complete con metodi e attributi, e fornisce un modo per la navigazione diretta nei sorgenti.
+Comment[ja]=このプラグインは、プロジェクトの中のすべてのクラスを視覚的に表示します。また、メソッドや属性を補完し、直接的なソース操作を提供します。
+Comment[ms]=Plugin ini memaparkan paparan bergrafik bagi semua kelas dalam projek, lengkap dengan kaedah dan ciri, dan menyediakan kaedah kemudian sumber secara terus.
+Comment[nds]=Dit Moduul wiest en graafsch Ansicht vun all Klassen vun en Projekt, komplett mit Metoden un Attributen, un stellt dat Stüern binnen de Borntexten praat.
+Comment[ne]=यो प्लगइनले विधि र विशेषतासँग परियोजनामा सबै कक्षको ग्राफिकल दृश्य प्रर्दशन गर्दछ र प्रत्यक्ष स्रोत नेभिगेसनको उपाय प्रदान गर्दछ ।
+Comment[nl]=Deze plugin toont een grafische weergave van alle klassen in een project, compleet met methoden en attributen, en biedt directe navigatie hiertussen.
+Comment[pl]=Ta wtyczka pokazuje graficzny widok wszystkich klas w projekcie z metodami i atrybutami oraz umożliwia bezpośrednią nawigację w kodzie źródłowym..
+Comment[pt]=Este 'plugin' mostra uma vista gráfica de todas as classes no projecto, completas com os métodos e atributos, oferecendo uma forma de navegação directa sobre o código.
+Comment[pt_BR]=Este plug-in exibe uma visão gráfica de todas as classes no projeto, juntamente com métodos e atributos, e fornece uma maneira de navegar diretamente no código.
+Comment[ru]=Этот модуль показывает список классов в проекте, включая методы и атрибуты, а также предоставляет возможности навигации по коду.
+Comment[sk]=Modul zobrazí grafický pohľad na triedy v projekte, spolu s metódami a atribútmi, a umožní priamy prístup k zdrojovému kódu.
+Comment[sr]=Овај прикључак приказује графички изглед свих класа у пројекту, заједно са методама и атрибутима, и обезбеђује начин директне навигације кроз изворни кôд.
+Comment[sr@Latn]=Ovaj priključak prikazuje grafički izgled svih klasa u projektu, zajedno sa metodama i atributima, i obezbeđuje način direktne navigacije kroz izvorni kôd.
+Comment[sv]=Insticksprogrammet visar en grafisk bild av alla klasser i ett projekt, tillsammans med metoder och egenskaper, och ger möjlighet till direkt navigering i källkoden.
+Comment[ta]=இந்த சொருகி திட்டப்பணியில் உள்ள வகுப்புகளின், முறைகள் மற்றும் பண்புகளை உங்களுக்கு வரைகலை பார்வையில் அளிக்கும்,மற்றும் மூலத்தை வழி செலுத்த இது நேர்வழி அளிக்கும்.
+Comment[tg]=Ин модул рӯйхати синфҳоро дар лоиҳа намоиш медиҳад, ва боз методҳо ва атрибутҳо ва боз ҳам имкони кодро роҳ медиҳад.
+Comment[tr]=Bu eklenti projedeki sınıfların bütün yöntem ve öznitelikleri ile grafiksel bir görünümü gösterir ve doğrudan kaynak dolaşımını sağlar.
+Comment[zh_CN]=这个插件以图形显示工程中所有的类,包括完整的方法和属性,并提供浏览源文件的方法。
+Comment[zh_TW]=這個外掛程式顯示專案中所有類別、完整方法與屬性的圖形檢視,並提供源碼導覽。
+Name=KDevClassView
+Name[da]=KDevelop klassevisning
+Name[de]=Klassenansicht (KDevelop)
+Name[hi]=के-डेव-क्लॉस-व्यू
+Name[nds]=KlassKieker (KDevelop)
+Name[pl]=KDevWidokKlas
+Name[sk]=KDev pohľad na triedy
+Name[sv]=KDevelop klassvisning
+Name[tg]=Намоиши снфи KDev
+Name[zh_TW]=KDevelop 類別檢視
+GenericName=Class View
+GenericName[ca]=Visor de classes
+GenericName[da]=Klassevisning
+GenericName[de]=Klassenansicht
+GenericName[el]=Προβολή κλάσεων
+GenericName[es]=Visor de clases
+GenericName[et]=Klasside vaade
+GenericName[eu]=Klase ikuspegia
+GenericName[fa]=نمای رده
+GenericName[fr]=Vue des classes
+GenericName[gl]=Vista de clases
+GenericName[hi]=क्लॉस व्यू
+GenericName[hu]=Osztálynézegető
+GenericName[it]=Visualizza classe
+GenericName[ja]=クラスビュー
+GenericName[ms]=Paparan Kelas
+GenericName[nds]=Klasskieker
+GenericName[ne]=कक्ष दृश्य
+GenericName[nl]=Klassenweergave
+GenericName[pl]=Widok klas
+GenericName[pt]=Vista de Classe
+GenericName[pt_BR]=Visualizador de Classe
+GenericName[ru]=Просмотр классов
+GenericName[sk]=Pohľad na triedy
+GenericName[sl]=Prikaz razreda
+GenericName[sr]=Преглед класа
+GenericName[sr@Latn]=Pregled klasa
+GenericName[sv]=Klassvisning
+GenericName[ta]=வகுப்புக்காட்சி
+GenericName[tg]=Намоиши синфҳо
+GenericName[tr]=Sınıf Görünümü
+GenericName[zh_CN]=类查看器
+GenericName[zh_TW]=類別檢視
+ServiceTypes=KDevelop/CodeBrowserFrontend
+X-KDE-Library=libkdevclassview
+X-KDevelop-Version=5
+X-KDevelop-Scope=Project
+X-KDevelop-Properties=CodeNavigation
diff --git a/parts/classview/kdevclassview.rc b/parts/classview/kdevclassview.rc
new file mode 100644
index 00000000..b5f7a9fb
--- /dev/null
+++ b/parts/classview/kdevclassview.rc
@@ -0,0 +1,20 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevClassView" version="10">
+<MenuBar>
+ <Menu name="project" >
+ <Action name="inheritance_dia" group="project_classes" />
+ </Menu>
+</MenuBar>
+<Menu name="kdevhidden" >
+ <Action name="navigator_jump_to_next_function"/>
+ <Action name="navigator_jump_to_previous_function"/>
+</Menu>
+
+<ToolBar name="browserToolBar">
+ <text>Browser Toolbar</text>
+ <Separator/>
+ <Action name="classview_sync_with_editor" />
+ <Action name="functionsnav_combo" />
+</ToolBar>
+</kpartgui>
+
diff --git a/parts/classview/navigator.cpp b/parts/classview/navigator.cpp
new file mode 100644
index 00000000..f0e2ff19
--- /dev/null
+++ b/parts/classview/navigator.cpp
@@ -0,0 +1,539 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * Portions Copyright (C) 2002-2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "navigator.h"
+
+#include <qtimer.h>
+
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <kapplication.h>
+#include <ktexteditor/viewcursorinterface.h>
+
+#include <kcomboview.h>
+#include <klistviewaction.h>
+#include <kdevpartcontroller.h>
+#include <kdevlanguagesupport.h>
+#include <kdevmainwindow.h>
+#include <codemodel_utils.h>
+#include "classviewpart.h"
+#include "classviewwidget.h"
+
+//using namespace Widgets;
+
+//#define BOLDFONTSMALLER
+
+
+namespace
+{
+ template<class T>
+ QValueList<T> QValueList_reversed ( const QValueList<T> & list )
+ {
+ QValueList<T> rList;
+ typename QValueList<T>::ConstIterator it = list.begin();
+ while ( it != list.end() )
+ {
+ rList.push_front ( *it );
+ ++it;
+ }
+ return rList;
+ }
+}
+
+struct NavOp
+{
+ NavOp(Navigator *navigator, const QString &fullName)
+ :m_navigator(navigator), m_fullName(fullName) {}
+
+ bool operator() ( const FunctionDefinitionDom& def ) const
+ {
+ return (m_navigator->fullFunctionDefinitionName(def) == m_fullName);
+ }
+ bool operator() ( const FunctionDom& def ) const
+ {
+ return (m_navigator->fullFunctionDeclarationName(def) == m_fullName);
+ }
+
+private:
+ Navigator *m_navigator;
+ QString m_fullName;
+};
+
+
+
+class FunctionNavItem: public FancyListViewItem {
+private:
+public:
+ enum Type { Declaration, Definition };
+
+ FunctionNavItem(TextPaintStyleStore& styles, ClassViewPart *part, QListView *parent, QString name, Type type)
+ :FancyListViewItem(styles, parent, name, ""), m_part(part), m_type(type) {}
+ FunctionNavItem(TextPaintStyleStore& styles, ClassViewPart *part, QListViewItem *parent, QString name, Type type)
+ :FancyListViewItem(styles, parent, name, ""), m_part(part), m_type(type) {}
+ ~FunctionNavItem() {}
+
+ virtual void setup()
+ {
+ FancyListViewItem::setup();
+ setPixmap( 0, UserIcon("CVpublic_meth", KIcon::DefaultState, m_part->instance()) );
+ }
+ Type type() { return m_type; }
+
+private:
+ ClassViewPart *m_part;
+ Type m_type;
+};
+
+
+Navigator::Navigator(ClassViewPart *parent, const char *name)
+ : QObject(parent, name), m_part(parent)
+{
+ m_state = GoToDefinitions;
+ m_navNoDefinition = true;
+
+ m_actionSyncWithEditor = new KAction( i18n("Sync ClassView"), "view_tree", KShortcut(), this,
+ SLOT(slotSyncWithEditor()), m_part->actionCollection(), "classview_sync_with_editor" );
+
+ KAction * action = new KAction( i18n("Jump to next function"), CTRL+ALT+Key_PageDown, this,
+ SLOT(slotJumpToNextFunction()), m_part->actionCollection(), "navigator_jump_to_next_function" );
+ action->plug( &m_dummyActionWidget );
+
+ action = new KAction( i18n("Jump to previous function"), CTRL+ALT+Key_PageUp, this,
+ SLOT(slotJumpToPreviousFunction()), m_part->actionCollection(), "navigator_jump_to_previous_function" );
+ action->plug( &m_dummyActionWidget );
+
+ m_syncTimer = new QTimer(this);
+ connect(m_syncTimer, SIGNAL(timeout()), this, SLOT(syncFunctionNav()));
+}
+
+Navigator::~Navigator()
+{
+}
+
+void Navigator::selectFunctionNav(QListViewItem *item)
+{
+ FunctionNavItem *nav = dynamic_cast<FunctionNavItem*>(item);
+ if (!nav)
+ return;
+
+ FileDom file = m_part->codeModel()->fileByName(m_part->m_activeFileName);
+ if (!file)
+ return;
+
+ switch (nav->type())
+ {
+ case FunctionNavItem::Definition: //jump to definition
+ {
+ FileList files = file->wholeGroup();
+ FunctionDefinitionList deflist;
+ CodeModelUtils::findFunctionDefinitions(NavOp(this, nav->text(0)), files, deflist);
+ if (deflist.count() < 1)
+ return;
+
+ FunctionDefinitionDom fun = deflist.first();
+ if (!fun)
+ return;
+ int startLine = 0, startColumn = 0;
+ fun->getStartPosition(&startLine, &startColumn);
+ m_part->partController()->editDocument(KURL(fun->fileName()), startLine);
+ break;
+ }
+ case FunctionNavItem::Declaration: //jump to declaration
+ {
+ FileList files = file->wholeGroup();
+ FunctionList declist;
+ CodeModelUtils::findFunctionDeclarations(NavOp(this, nav->text(0)), files, declist);
+ if (declist.count() < 1)
+ return;
+
+ FunctionDom fun = declist.first();
+ if (!fun)
+ return;
+ int startLine = 0, startColumn = 0;
+ fun->getStartPosition(&startLine, &startColumn);
+ m_part->partController()->editDocument(KURL(fun->fileName()), startLine);
+ break;
+ }
+ }
+}
+
+void Navigator::functionNavUnFocused()
+{
+ /*if (m_navNoDefinition)
+ m_part->m_functionsnav->view()->setCurrentText(NAV_NODEFINITION);
+ else*/
+ if (m_part->m_functionsnav->view()->currentItem())
+ m_part->m_functionsnav->view()->setCurrentText(m_part->m_functionsnav->view()->currentItem()->text(0));
+ else
+ m_part->m_functionsnav->view()->setCurrentText(NAV_NODEFINITION);
+}
+
+void Navigator::functionNavFocused()
+{
+ m_navNoDefinition = (m_part->m_functionsnav->view()->currentText() == NAV_NODEFINITION);
+ m_part->m_functionsnav->view()->setCurrentText("");
+}
+
+void Navigator::slotCursorPositionChanged()
+{
+ //FIXME: we assume that background parser delay is set globally in kdeveloprc file
+ //for all available language supports
+ //this is reasonable assumption because problem reporter should be the same for all languages
+ KConfig* config = kapp->config();
+ config->setGroup( "General Options" );
+ int m_delay = config->readNumEntry( "BgParserDelay", 500 );
+
+ m_syncTimer->changeInterval(500 >= m_delay+100 ? 500 : m_delay+100 );
+}
+
+void Navigator::stopTimer( )
+{
+ m_syncTimer->stop();
+}
+
+void Navigator::syncFunctionNavDelayed(int delay)
+{
+ m_syncTimer->changeInterval(delay);
+}
+
+void Navigator::syncFunctionNav()
+{
+ m_syncTimer->stop();
+
+ if (FunctionDom fun = currentFunction())
+ {
+ if ( m_part->widget()->doFollowEditor() )
+ {
+ ItemDom dom(fun);
+ m_part->jumpedToItem( dom );
+ }
+
+ if( !fun->isFunctionDefinition() ) {
+ if (m_functionNavDecls[fullFunctionDeclarationName(fun)])
+ {
+ m_part->m_functionsnav->view()->blockSignals(true);
+ m_part->m_functionsnav->view()->setCurrentActiveItem(m_functionNavDecls[fullFunctionDeclarationName(fun)]);
+ m_part->m_functionsnav->view()->blockSignals(false);
+ }
+ } else {
+ if (m_functionNavDefs[fullFunctionDeclarationName(fun)])
+ {
+ m_part->m_functionsnav->view()->blockSignals(true);
+ m_part->m_functionsnav->view()->setCurrentActiveItem(m_functionNavDefs[fullFunctionDeclarationName(fun)]);
+ m_part->m_functionsnav->view()->blockSignals(false);
+ }
+ }
+ }
+ else
+ m_part->m_functionsnav->view()->setCurrentText(NAV_NODEFINITION);
+}
+
+void Navigator::refreshNavBars(const QString &activeFileName, bool clear)
+{
+ kdDebug(9003) << k_funcinfo << endl;
+ if (clear)
+ {
+ m_part->m_functionsnav->view()->clear();
+ m_functionNavDefs.clear();
+ m_functionNavDecls.clear();
+ }
+
+ FileDom file = m_part->codeModel()->fileByName(activeFileName);
+ if (!file)
+ return;
+
+ QStringList toLeave;
+
+ FunctionList list1 = CodeModelUtils::allFunctionsExhaustive(file);
+ FunctionList::const_iterator flEnd = list1.end();
+ for (FunctionList::const_iterator it = list1.begin(); it != flEnd; ++it)
+ {
+ QString fullName = fullFunctionDeclarationName(*it);
+
+ if (clear || !m_functionNavDecls[fullName] && m_part->m_functionsnav->view()->listView())
+ {
+ FunctionNavItem *item = new FunctionNavItem(m_styles, m_part,
+ m_part->m_functionsnav->view()->listView(), fullName,
+ FunctionNavItem::Declaration);
+ m_functionNavDecls[fullName] = item;
+ item->setItem( 0, fullFunctionItem( *it ) );
+
+ m_part->m_functionsnav->view()->addItem(item);
+ }
+ toLeave << fullName;
+ }
+ kdDebug(9003) << k_funcinfo << "leave list: " << toLeave << endl;
+
+ //remove items not in toLeave list
+ QMap<QString, QListViewItem*>::iterator it = m_functionNavDecls.begin();
+ while ( it != m_functionNavDecls.end() )
+ {
+ QMap<QString, QListViewItem*>::iterator it2 = it;
+ ++it;
+ if ( !toLeave.contains( it2.key() ) )
+ {
+ if (it2.data())
+ {
+ m_part->m_functionsnav->view()->removeItem(it2.data());
+ }
+ m_functionNavDecls.remove(it2);
+ }
+ }
+
+ toLeave.clear();
+ FunctionDefinitionList list = CodeModelUtils::allFunctionDefinitionsExhaustive(file);
+ for (FunctionDefinitionList::const_iterator it = list.begin(); it != list.end(); ++it)
+ {
+ QString fullName = fullFunctionDefinitionName(*it);
+
+ if (clear || !m_functionNavDefs[fullName])
+ {
+ FunctionNavItem *item = new FunctionNavItem(m_styles, m_part,
+ m_part->m_functionsnav->view()->listView(), fullName, FunctionNavItem::Definition);
+ m_functionNavDefs[fullName] = item;
+ item->setItem( 0, fullFunctionItem( *it ) );
+ m_part->m_functionsnav->view()->addItem(item);
+ }
+
+ //remove unnecessary items with function declarations for which a definition item was created
+ if (m_functionNavDecls[fullName])
+ {
+ m_part->m_functionsnav->view()->removeItem(m_functionNavDecls[fullName]);
+ m_functionNavDecls.remove(fullName);
+ }
+
+ toLeave << fullName;
+ }
+
+ kdDebug(9003) << k_funcinfo << "leave list: " << toLeave << endl;
+ //remove items not in toLeave list
+ QMap<QString, QListViewItem*>::iterator itt = m_functionNavDefs.begin();
+ while ( itt != m_functionNavDefs.end() )
+ {
+ QMap<QString, QListViewItem*>::iterator it2 = itt;
+ ++itt;
+ if ( !toLeave.contains( it2.key() ) )
+ {
+ if (it2.data())
+ {
+ m_part->m_functionsnav->view()->removeItem(it2.data());
+ }
+ m_functionNavDefs.remove(it2);
+ }
+ }
+}
+
+void Navigator::refresh()
+{
+ refreshNavBars(m_part->m_activeFileName, true);
+}
+
+void Navigator::addFile(const QString & file)
+{
+ kdDebug(9003) << k_funcinfo << "file: " << file << endl;
+ if (file == m_part->m_activeFileName)
+ {
+ kdDebug(9003) << k_funcinfo << "processing active file" << endl;
+ refreshNavBars(m_part->m_activeFileName, false);
+ }
+}
+
+
+
+
+FunctionDom Navigator::currentFunction()
+{
+ if (!m_part->m_activeViewCursor)
+ return FunctionDom();
+
+ unsigned int line, column;
+ m_part->m_activeViewCursor->cursorPositionReal(&line, &column);
+ CodeModelUtils::CodeModelHelper hlp( m_part->codeModel(), m_part->codeModel()->fileByName( m_part->m_activeFileName) );
+ return hlp.functionAt( line, column );
+}
+
+
+///Some time this might be moved into the language-support-part, so each language
+///can highlight as it likes
+TextPaintItem highlightFunctionName(QString function, int type, TextPaintStyleStore& styles) {
+ TextPaintItem ret;
+
+ if( !styles.hasStyle( type ) ) {
+ QFont font = styles.getStyle( 0 ).font;
+
+ switch(type) {
+ case 1:
+ default:
+ font.setWeight( QFont::DemiBold );
+ ///since bold makes the font a little bigger, make it smaller again
+#ifdef BOLDFONTSMALLER
+ font.setPointSize( (font.pointSize() * 9) / 10 );
+#endif
+ }
+
+ styles.addStyle( type, font );
+ }
+
+ QString args;
+ QString fScope;
+ int cutpos;
+
+ if((cutpos = function.find('(')) != -1) {
+ args = function.right( function.length() - cutpos );
+ function = function.left( cutpos );
+ } else {
+ ret.addItem( function );
+ return ret;
+ }
+ if((cutpos = function.findRev(':')) != -1 || (cutpos = function.findRev('.')) != -1) {
+ fScope = function.left( cutpos + 1 );
+ function = function.right( function.length() - cutpos - 1);
+ }
+ if( !fScope.isEmpty() ) ret.addItem(fScope);
+ ret.addItem( function, type );
+ if( !args.isEmpty() ) ret.addItem(args);
+ return ret;
+}
+
+
+template <class DomType>
+TextPaintItem Navigator::fullFunctionItem(DomType fun)
+{
+
+ QStringList scope = fun->scope();
+ QString function = scope.join(".");
+ if (!function.isEmpty())
+ function += ".";
+ function += m_part->languageSupport()->formatModelItem(fun, true);
+ function = m_part->languageSupport()->formatClassName(function);
+
+ return highlightFunctionName(function, 1, m_styles);
+}
+
+QString Navigator::fullFunctionDefinitionName(FunctionDefinitionDom fun)
+{
+ QStringList scope = fun->scope();
+ QString funName = scope.join(".");
+ if (!funName.isEmpty())
+ funName += ".";
+ funName += m_part->languageSupport()->formatModelItem(fun, true);
+ funName = m_part->languageSupport()->formatClassName(funName);
+
+ return funName;
+}
+
+QString Navigator::fullFunctionDeclarationName(FunctionDom fun)
+{
+ QStringList scope = fun->scope();
+ QString funName = scope.join(".");
+ if (!funName.isEmpty())
+ funName += ".";
+ funName += m_part->languageSupport()->formatModelItem(fun, true);
+ funName = m_part->languageSupport()->formatClassName(funName);
+
+ return funName;
+}
+
+void Navigator::slotSyncWithEditor()
+{
+ kdDebug(9003) << k_funcinfo << endl;
+
+ if (FunctionDom fun = currentFunction())
+ {
+ m_part->mainWindow()->raiseView( m_part->widget() );
+
+ ItemDom dom(fun);
+ m_part->jumpedToItem( dom );
+ }
+}
+
+void Navigator::slotJumpToNextFunction()
+{
+ kdDebug ( 9003 ) << k_funcinfo << endl;
+
+ if ( !m_part->m_activeViewCursor ) return;
+ unsigned int currentLine, currentCol;
+ m_part->m_activeViewCursor->cursorPositionReal ( &currentLine, &currentCol );
+
+ QValueList<int> lines = functionStartLines();
+ if ( lines.isEmpty() ) return;
+
+ QValueList<int>::iterator it = lines.begin();
+ while ( it != lines.end() )
+ {
+ if ( *it > currentLine )
+ {
+ KURL url;
+ url.setPath ( m_part->m_activeFileName );
+ m_part->partController()->editDocument ( url, *it );
+ break;
+ }
+ ++it;
+ }
+}
+
+void Navigator::slotJumpToPreviousFunction()
+{
+ kdDebug ( 9003 ) << k_funcinfo << endl;
+
+ if ( !m_part->m_activeViewCursor ) return;
+ unsigned int currentLine, currentCol;
+ m_part->m_activeViewCursor->cursorPositionReal ( &currentLine, &currentCol );
+
+ QValueList<int> lines = QValueList_reversed<int> ( functionStartLines() );
+ if ( lines.isEmpty() ) return;
+
+ QValueList<int>::iterator it = lines.begin();
+ while ( it != lines.end() )
+ {
+ if ( *it < currentLine )
+ {
+ KURL url;
+ url.setPath ( m_part->m_activeFileName );
+ m_part->partController()->editDocument ( url, *it );
+ break;
+ }
+ ++it;
+ }
+}
+
+QValueList<int> Navigator::functionStartLines()
+{
+ FileDom file = m_part->codeModel()->fileByName ( m_part->m_activeFileName );
+ if ( !file ) return QValueList<int>();
+
+ QValueList<int> lines;
+ FunctionDefinitionList list = CodeModelUtils::allFunctionDefinitionsExhaustive ( file );
+ FunctionDefinitionList::const_iterator it = list.begin();
+ while ( it != list.end() )
+ {
+ int line, col;
+ ( *it )->getStartPosition ( &line, &col );
+ lines << line;
+ ++it;
+ }
+ qHeapSort ( lines );
+
+ return lines;
+}
+
+#include "navigator.moc"
diff --git a/parts/classview/navigator.h b/parts/classview/navigator.h
new file mode 100644
index 00000000..0168ccca
--- /dev/null
+++ b/parts/classview/navigator.h
@@ -0,0 +1,91 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef NAVIGATOR_H
+#define NAVIGATOR_H
+
+#include <qobject.h>
+#include <codemodel.h>
+#include <qfont.h>
+#include <fancylistviewitem.h>
+
+class TextPaintStyleStore;
+class QTimer;
+class ClassViewPart;
+class QListViewItem;
+class KAction;
+
+#define NAV_NODEFINITION "(no function)"
+
+class TextPaintItem;
+TextPaintItem highlightFunctionName( QString function, int type, TextPaintStyleStore& styles );
+
+class Navigator : public QObject
+{
+Q_OBJECT
+public:
+ enum NavigationState { GoToDefinitions, GoToDeclarations };
+
+ Navigator(ClassViewPart *parent, const char *name = 0);
+ ~Navigator();
+
+ void stopTimer();
+ void refreshNavBars(const QString &activeFileName, bool clear = true);
+
+ QString fullFunctionDefinitionName(FunctionDefinitionDom fun);
+ QString fullFunctionDeclarationName(FunctionDom fun);
+
+ template <class DomType>
+ TextPaintItem fullFunctionItem(DomType fun);
+
+public slots:
+ void selectFunctionNav(QListViewItem *item);
+ void syncFunctionNav();
+ void syncFunctionNavDelayed(int delay);
+ void functionNavFocused();
+ void functionNavUnFocused();
+ void slotCursorPositionChanged();
+ void refresh();
+ void addFile(const QString &file);
+ void slotSyncWithEditor();
+ void slotJumpToNextFunction();
+ void slotJumpToPreviousFunction();
+
+protected:
+
+ FunctionDom currentFunction();
+ QValueList<int> functionStartLines();
+
+private:
+ ClassViewPart *m_part;
+ QTimer *m_syncTimer;
+ NavigationState m_state;
+
+ QWidget m_dummyActionWidget;
+ KAction* m_actionSyncWithEditor;
+
+ bool m_navNoDefinition;
+
+ QMap<QString, QListViewItem*> m_functionNavDefs;
+ QMap<QString, QListViewItem*> m_functionNavDecls;
+
+ TextPaintStyleStore m_styles;
+};
+
+#endif
diff --git a/parts/classview/viewcombos.cpp b/parts/classview/viewcombos.cpp
new file mode 100644
index 00000000..fc4d02fc
--- /dev/null
+++ b/parts/classview/viewcombos.cpp
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2003 Alexander Dymo (cloudtemple@mksat.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include "klistviewaction.h"
+#include "kcomboview.h"
+
+#include "viewcombos.h"
+#include "classviewpart.h"
+
+NamespaceItem::NamespaceItem(ClassViewPart *part, QListView *parent, QString name, NamespaceDom dom)
+ :QListViewItem(parent, name), m_dom(dom), m_part(part)
+{
+}
+
+NamespaceItem::NamespaceItem(ClassViewPart *part, QListViewItem *parent, QString name, NamespaceDom dom)
+ :QListViewItem(parent, name), m_dom(dom), m_part(part)
+{
+}
+
+NamespaceItem::~ NamespaceItem( )
+{
+}
+
+NamespaceDom NamespaceItem::dom() const
+{
+ return m_dom;
+}
+
+void NamespaceItem::setup()
+{
+ QListViewItem::setup();
+ setPixmap( 0, UserIcon("CVnamespace", KIcon::DefaultState, m_part->instance()) );
+}
+
+
+ClassItem::ClassItem(ClassViewPart *part, QListView *parent, QString name, ClassDom dom)
+ :QListViewItem(parent, name), m_dom(dom), m_part(part)
+{
+}
+
+ClassItem::ClassItem(ClassViewPart *part, QListViewItem *parent, QString name, ClassDom dom)
+ :QListViewItem(parent, name), m_dom(dom), m_part(part)
+{
+}
+
+ClassItem::~ ClassItem( )
+{
+}
+
+ClassDom ClassItem::dom() const
+{
+ return m_dom;
+}
+
+void ClassItem::setup()
+{
+ QListViewItem::setup();
+ setPixmap( 0, UserIcon("CVclass", KIcon::DefaultState, m_part->instance()) );
+}
+
+
+FunctionItem::FunctionItem(ClassViewPart *part, QListView *parent, QString name, FunctionDom dom)
+ :QListViewItem(parent, name), m_dom(dom), m_part(part)
+{
+}
+
+FunctionItem::FunctionItem(ClassViewPart *part, QListViewItem *parent, QString name, FunctionDom dom)
+ :QListViewItem(parent, name), m_dom(dom), m_part(part)
+{
+}
+
+FunctionItem::~ FunctionItem( )
+{
+}
+
+FunctionDom FunctionItem::dom() const
+{
+ return m_dom;
+}
+
+void FunctionItem::setup()
+{
+ QListViewItem::setup();
+ QString iconName;
+ if( m_dom->access() == CodeModelItem::Private )
+ iconName = "CVprivate_meth";
+ else if( m_dom->access() == CodeModelItem::Protected )
+ iconName = "CVprotected_meth";
+ else
+ iconName = "CVpublic_meth";
+ setPixmap( 0, UserIcon(iconName, KIcon::DefaultState, m_part->instance()) );
+}
+
+
+namespace ViewCombosOp{
+
+void refreshNamespaces(ClassViewPart *part, KComboView *view)
+{
+ view->clear();
+
+ NamespaceItem *global_item = new NamespaceItem( part, view->listView(), i18n("(Global Namespace)"), part->codeModel()->globalNamespace() );
+ view->addItem(global_item);
+ global_item->setPixmap( 0, UserIcon("CVnamespace", KIcon::DefaultState, part->instance()) );
+ NamespaceList namespaces = part->codeModel()->globalNamespace()->namespaceList();
+ for (NamespaceList::const_iterator it = namespaces.begin(); it != namespaces.end(); ++it)
+ {
+ NamespaceItem *item = new NamespaceItem(part, view->listView(), part->languageSupport()->formatModelItem(*it), *it);
+ view->addItem(item);
+ item->setOpen(true);
+ }
+ view->setCurrentActiveItem(global_item);
+}
+
+void refreshClasses(ClassViewPart *part, KComboView *view, const QString &dom)
+{
+ view->clear();
+
+ view->setCurrentText(EmptyClasses);
+ NamespaceDom nsdom;
+ if (dom == "::")
+ nsdom = part->codeModel()->globalNamespace();
+ else
+ {
+ nsdom = namespaceByName(part->codeModel()->globalNamespace(), dom);
+ if (!nsdom)
+ return;
+ }
+ ClassList classes = nsdom->classList();
+ for (ClassList::const_iterator it = classes.begin(); it != classes.end(); ++it)
+ {
+ ClassItem *item = new ClassItem(part, view->listView(), part->languageSupport()->formatModelItem(*it), *it);
+ view->addItem(item);
+ item->setOpen(true);
+ }
+}
+
+void refreshFunctions(ClassViewPart *part, KComboView *view, const ClassDom & dom)
+{
+ view->clear();
+
+ view->setCurrentText(EmptyFunctions);
+ FunctionList functions = dom->functionList();
+ for (FunctionList::const_iterator it = functions.begin(); it != functions.end(); ++it)
+ {
+ FunctionItem *item = new FunctionItem(part, view->listView(), part->languageSupport()->formatModelItem(*it, true), *it);
+ view->addItem(item);
+ item->setOpen(true);
+ }
+}
+
+void refreshFunctions(ClassViewPart *part, KComboView *view, const QString & dom)
+{
+ view->clear();
+
+ view->setCurrentText(EmptyFunctions);
+ NamespaceDom nsdom;
+ if (dom == "::")
+ nsdom = part->codeModel()->globalNamespace();
+ else
+ {
+ nsdom = namespaceByName(part->codeModel()->globalNamespace(), dom);
+ if (!nsdom)
+ return;
+ }
+ FunctionList functions = nsdom->functionList();
+ for (FunctionList::const_iterator it = functions.begin(); it != functions.end(); ++it)
+ {
+ FunctionItem *item = new FunctionItem(part, view->listView(), part->languageSupport()->formatModelItem(*it, true), *it);
+ view->addItem(item);
+ item->setOpen(true);
+ }
+}
+
+
+}
+
+NamespaceDom ViewCombosOp::namespaceByName( NamespaceDom dom, QString name )
+{
+ NamespaceDom result;
+
+ result = dom->namespaceByName(name);
+ if (!result)
+ {
+ NamespaceList nslist = dom->namespaceList();
+ for (NamespaceList::const_iterator it = nslist.begin(); it != nslist.end(); ++it)
+ {
+ result = namespaceByName(*it, name);
+ if (result)
+ break;
+ }
+ }
+ return result;
+}
+
diff --git a/parts/classview/viewcombos.h b/parts/classview/viewcombos.h
new file mode 100644
index 00000000..4734b856
--- /dev/null
+++ b/parts/classview/viewcombos.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003 Alexander Dymo (cloudtemple@mksat.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#ifndef VIEWCOMBOS_H
+#define VIEWCOMBOS_H
+
+#include <klocale.h>
+
+#include <qlistview.h>
+
+#include "codemodel.h"
+
+class ClassViewPart;
+class KComboView;
+
+const QString EmptyClasses = i18n("(Classes)");
+const QString EmptyFunctions = i18n("(Functions)");
+
+class NamespaceItem: public QListViewItem{
+public:
+ NamespaceItem(ClassViewPart *part, QListView *parent, QString name, NamespaceDom dom);
+ NamespaceItem(ClassViewPart *part, QListViewItem *parent, QString name, NamespaceDom dom);
+ ~NamespaceItem();
+ NamespaceDom dom() const;
+ virtual void setup();
+private:
+ NamespaceDom m_dom;
+ ClassViewPart *m_part;
+};
+
+class ClassItem: public QListViewItem{
+public:
+ ClassItem(ClassViewPart *part, QListView *parent, QString name, ClassDom dom);
+ ClassItem(ClassViewPart *part, QListViewItem *parent, QString name, ClassDom dom);
+ ~ClassItem();
+ ClassDom dom() const;
+ virtual void setup();
+private:
+ ClassDom m_dom;
+ ClassViewPart *m_part;
+};
+
+class FunctionItem: public QListViewItem{
+public:
+ FunctionItem(ClassViewPart *part, QListView *parent, QString name, FunctionDom dom);
+ FunctionItem(ClassViewPart *part, QListViewItem *parent, QString name, FunctionDom dom);
+ ~FunctionItem();
+ FunctionDom dom() const;
+ virtual void setup();
+private:
+ FunctionDom m_dom;
+ ClassViewPart *m_part;
+};
+
+namespace ViewCombosOp{
+
+enum ProcessType {Refresh, Reload};
+
+void refreshNamespaces(ClassViewPart *part, KComboView *view);
+void refreshClasses(ClassViewPart *part, KComboView *view, const QString &dom);
+void refreshFunctions(ClassViewPart *part, KComboView *view, const ClassDom & dom);
+void refreshFunctions(ClassViewPart *part, KComboView *view, const QString & dom);
+
+NamespaceDom namespaceByName(NamespaceDom dom, QString name);
+
+}
+
+#endif
diff --git a/parts/ctags2/Makefile.am b/parts/ctags2/Makefile.am
new file mode 100644
index 00000000..06b3cfea
--- /dev/null
+++ b/parts/ctags2/Makefile.am
@@ -0,0 +1,22 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevctags2.la
+libkdevctags2_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevctags2_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevctags2_la_SOURCES = ctags2_part.cpp readtags.c ctags2_widgetbase.ui \
+ ctags2_widget.cpp tags.cpp ctagskinds.cpp ctags2_settingswidgetbase.ui \
+ ctags2_settingswidget.cpp ctags2_selecttagfilebase.ui ctags2_selecttagfile.cpp \
+ ctags2_createtagfilebase.ui ctags2_createtagfile.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevctags2.desktop
+
+rc_DATA = kdevpart_ctags2.rc
+rcdir = $(kde_datadir)/kdevctags2
+
+noinst_HEADERS = ctags2_widget.h tags.h readtags.h ctagskinds.h \
+ ctags2_settingswidget.h
diff --git a/parts/ctags2/README.dox b/parts/ctags2/README.dox
new file mode 100644
index 00000000..e45d0bff
--- /dev/null
+++ b/parts/ctags2/README.dox
@@ -0,0 +1,16 @@
+/** \class ctags2
+This is a CTAGS frontend based on the 'readtags' library.
+
+\authors <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a>
+
+\maintainer <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a>
+
+\feature A very fast CTAGS lookup plugin
+\feature Through the use of regular expressions, it is clever enough to find matches even
+if the match-containing file is open and edited (and the editor contents do not match the file on disk).
+
+\requirement Needs "Exuberant CTAGS" to work. http://ctags.sourceforge.net/
+
+\todo Probably a lot, but mainly configurability.
+
+*/
diff --git a/parts/ctags2/ctags2_createtagfile.cpp b/parts/ctags2/ctags2_createtagfile.cpp
new file mode 100644
index 00000000..b1ced0dd
--- /dev/null
+++ b/parts/ctags2/ctags2_createtagfile.cpp
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kurlrequester.h>
+#include <klineedit.h>
+
+#include "ctags2_createtagfile.h"
+#include "ctags2_part.h"
+
+
+CreateTagFile::CreateTagFile(QWidget* parent, const char* name, bool modal, WFlags fl)
+: CTags2CreateTagFileBase( parent, name, modal, fl )
+{
+ dirToTag->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly);
+ newTagFilePath->setMode( KFile::File | KFile::LocalOnly );
+ createTagFileButton->setEnabled( false );
+}
+
+CreateTagFile::~CreateTagFile()
+{
+}
+
+void CreateTagFile::validate()
+{
+ bool valid = ( !displayName->text().isEmpty() && !newTagFilePath->url().isEmpty() && !dirToTag->url().isEmpty() );
+
+ createTagFileButton->setEnabled( valid );
+}
+
+QString CreateTagFile::name( )
+{
+ return displayName->text();
+}
+
+QString CreateTagFile::tagsfilePath( )
+{
+ return newTagFilePath->url();
+}
+
+QString CreateTagFile::directory( )
+{
+ return dirToTag->url();
+}
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_createtagfile.h b/parts/ctags2/ctags2_createtagfile.h
new file mode 100644
index 00000000..93b530d4
--- /dev/null
+++ b/parts/ctags2/ctags2_createtagfile.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CTAGS2_CREATETAGFILE_H
+#define CTAGS2_CREATETAGFILE_H
+
+#include "ctags2_part.h"
+#include "ctags2_createtagfilebase.h"
+
+
+class CreateTagFile : public CTags2CreateTagFileBase {
+
+Q_OBJECT
+
+public:
+ CreateTagFile(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~CreateTagFile();
+ QString name();
+ QString tagsfilePath();
+ QString directory();
+
+private:
+
+public slots:
+ virtual void validate();
+};
+
+#endif
diff --git a/parts/ctags2/ctags2_createtagfilebase.ui b/parts/ctags2/ctags2_createtagfilebase.ui
new file mode 100644
index 00000000..bf4469f3
--- /dev/null
+++ b/parts/ctags2/ctags2_createtagfilebase.ui
@@ -0,0 +1,151 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>CTags2CreateTagFileBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>CTags2CreateTagFileBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>198</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Create new tags file</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>displayName</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_3</cstring>
+ </property>
+ <property name="text">
+ <string>Target tags file path:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>newTagFilePath</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Directory to tag:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>dirToTag</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout6</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>81</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>createTagFileButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Create</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;ancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CTags2CreateTagFileBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>createTagFileButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CTags2CreateTagFileBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>displayName</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>CTags2CreateTagFileBase</receiver>
+ <slot>validate()</slot>
+ </connection>
+ <connection>
+ <sender>newTagFilePath</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>CTags2CreateTagFileBase</receiver>
+ <slot>validate()</slot>
+ </connection>
+ <connection>
+ <sender>dirToTag</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>CTags2CreateTagFileBase</receiver>
+ <slot>validate()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>createTagFile()</slot>
+ <slot>validate()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/ctags2/ctags2_part.cpp b/parts/ctags2/ctags2_part.cpp
new file mode 100644
index 00000000..29b564e6
--- /dev/null
+++ b/parts/ctags2/ctags2_part.cpp
@@ -0,0 +1,371 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qwhatsthis.h>
+#include <qpopupmenu.h>
+#include <qtextstream.h>
+#include <qfile.h>
+#include <qregexp.h>
+
+#include <klineedit.h>
+#include <klistview.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <ktexteditor/document.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <kprocess.h>
+#include <kdebug.h>
+#include <kstringhandler.h>
+#include <kdialogbase.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kaction.h>
+
+#include "kdevappfrontend.h"
+#include <kdevgenericfactory.h>
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+#include <kdevplugininfo.h>
+#include "configwidgetproxy.h"
+#include "domutil.h"
+#include "kdeveditorutil.h"
+
+#include "ctags2_settingswidget.h"
+#include "ctags2_widget.h"
+#include "ctags2_part.h"
+#include "tags.h"
+
+#define CTAGSSETTINGSPAGE 1
+
+namespace ctags
+{
+#include "readtags.h"
+}
+
+typedef KDevGenericFactory<CTags2Part> CTags2Factory;
+static const KDevPluginInfo data("kdevctags2");
+K_EXPORT_COMPONENT_FACTORY( libkdevctags2, CTags2Factory( data ) )
+
+CTags2Part::CTags2Part(QObject *parent, const char *name, const QStringList& )
+ : KDevPlugin(&data, parent, name ? name : "ctags2Part" )
+{
+ setInstance(CTags2Factory::instance());
+ setXMLFile("kdevpart_ctags2.rc");
+
+ QDomDocument & dom = *projectDom();
+ QString customTagFile = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" );
+ if ( customTagFile.isEmpty() )
+ {
+ customTagFile = project()->projectDirectory() + "/tags";
+ }
+ QStringList tagFiles = DomUtil::readListEntry(dom, "/ctagspart/activeTagsFiles", "file");
+ tagFiles.push_front(customTagFile);
+
+ Tags::setTagFiles(tagFiles);
+
+ m_widget = new CTags2Widget(this);
+
+ QWhatsThis::add(m_widget, i18n("<b>CTags</b><p>Result view for a tag lookup. Click a line to go to the corresponding place in the code."));
+ m_widget->setCaption(i18n("CTags Lookup"));
+ mainWindow()->embedOutputView( m_widget, i18n( "CTags" ), i18n( "CTags lookup results" ) );
+
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("CTags"), CTAGSSETTINGSPAGE, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+ new KAction( i18n("Lookup Current Text"), 0, CTRL+Key_Underscore, this, SLOT(slotLookup()), actionCollection(), "ctags_lookup_shortcut");
+ new KAction( i18n("Lookup Current Text as Declaration"), 0, CTRL+Key_Semicolon, this, SLOT(slotLookupDeclaration()), actionCollection(), "ctags_declaration_shortcut");
+ new KAction( i18n("Lookup Current Text as Definition"), 0, CTRL+Key_Colon, this, SLOT(slotLookupDefinition()), actionCollection(), "ctags_definition_shortcut");
+ new KAction( i18n("Jump to Next Match"), 0, 0, this, SLOT(slotGoToNext()), actionCollection(), "ctags_jump_to_next");
+ new KAction( i18n("Open Lookup Dialog"), 0, 0, this, SLOT(slotOpenLookup()), actionCollection(), "ctags_input_shortcut");
+}
+
+
+CTags2Part::~CTags2Part()
+{
+ if ( m_widget )
+ {
+ mainWindow()->removeView( m_widget );
+ }
+ delete m_widget;
+ delete _configProxy;
+}
+
+void CTags2Part::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ if ( pagenumber == CTAGSSETTINGSPAGE )
+ {
+ CTags2SettingsWidget * w = new CTags2SettingsWidget( this, page );
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) );
+ connect( w, SIGNAL(newTagsfileName(const QString& )), this, SLOT(updateTagsfileName(const QString& )) );
+ }
+}
+
+void CTags2Part::updateTagsfileName( const QString & )
+{
+ m_widget->updateDBDateLabel();
+}
+
+// wrapper for creating a tag file for the current project
+bool CTags2Part::createTagsFile()
+{
+ // check if user specified a custom tag file name
+ QDomDocument & dom = *projectDom();
+ QString tagsFileCustom = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" ).stripWhiteSpace();
+
+ return createTagsFile(tagsFileCustom, project()->projectDirectory());
+}
+
+// creates a new tag file with the specified name for the specified source directory
+bool CTags2Part::createTagsFile(const QString& tagFile, const QString& dir)
+{
+/*
+ KProcess proc;
+ proc.setWorkingDirectory( project()->projectDirectory() );
+
+ proc << "ctags";
+ proc << "-R" << "--c++-types=+px" << "--excmd=pattern" << "--exclude=Makefile";
+
+ bool success = proc.start(KProcess::Block);
+
+ return success;
+*/
+
+ // get name of the ctags binary
+ KConfig * config = kapp->config();
+ config->setGroup( "CTAGS" );
+ QString ctagsBinary = config->readEntry( "ctags binary" ).stripWhiteSpace();
+ if ( ctagsBinary.isEmpty() )
+ {
+ ctagsBinary = "ctags";
+ }
+
+ // set a default argument list
+ QString argsDefault = "-R --c++-types=+px --excmd=pattern --exclude=Makefile --exclude=.";
+
+ QDomDocument & dom = *projectDom();
+ QString argsCustom = DomUtil::readEntry( dom, "/ctagspart/customArguments" ).stripWhiteSpace();
+ QString commandline = ctagsBinary + " " + ( argsCustom.isEmpty() ? argsDefault : argsCustom ) + ( tagFile.isEmpty() ? "" : " -f " + tagFile );
+ commandline += " ";
+ commandline += dir;
+
+ if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
+ appFrontend->startAppCommand(dir, commandline, false);
+
+ return true;
+}
+
+void CTags2Part::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ if (!context->hasType( Context::EditorContext ))
+ return;
+
+ const EditorContext *econtext = static_cast<const EditorContext*>(context);
+ QString ident = econtext->currentWord();
+ if (ident.isEmpty())
+ return;
+
+ KConfig * config = kapp->config();
+ config->setGroup( "CTAGS" );
+ bool showDeclaration = config->readBoolEntry( "ShowDeclaration", true );
+ bool showDefinition = config->readBoolEntry( "ShowDefinition", true );
+ bool showLookup = config->readBoolEntry( "ShowLookup", true );
+
+ if ( Tags::hasTag( ident ) && ( showDefinition || showDeclaration || showLookup ) )
+ {
+ m_contextString = ident;
+ QString squeezed = KStringHandler::csqueeze(ident, 30);
+
+ popup->insertSeparator();
+
+ if ( showDeclaration )
+ popup->insertItem( i18n("CTags - Go to Declaration: %1").arg(squeezed), this, SLOT(slotGotoDeclaration()) );
+
+ if ( showDefinition )
+ popup->insertItem( i18n("CTags - Go to Definition: %1").arg(squeezed), this, SLOT(slotGotoDefinition()) );
+
+ if ( showLookup )
+ popup->insertItem( i18n("CTags - Lookup: %1").arg(squeezed), this, SLOT(slotGotoTag()) );
+ }
+}
+
+void CTags2Part::showHits( Tags::TagList const & tags )
+{
+ m_widget->displayHitsAndClear( tags );
+
+ mainWindow()->raiseView( m_widget );
+ m_widget->output_view->setFocus();
+}
+
+void CTags2Part::slotGotoTag( )
+{
+ showHits( Tags::getExactMatches( m_contextString ) );
+}
+
+void CTags2Part::gotoTagForTypes( QStringList const & types )
+{
+ Tags::TagList list = Tags::getMatches( m_contextString, false, types );
+
+ if ( list.count() < 1 ) return;
+
+ KConfig * config = kapp->config();
+ config->setGroup("CTAGS");
+ bool jumpToFirst = config->readBoolEntry( "JumpToFirst", false );
+
+ if ( list.count() == 1 || jumpToFirst )
+ {
+ Tags::TagEntry tag = list.first();
+ KURL url;
+ QString fileWithTagInside;
+ // assume relative path to project directory if path does not start with slash
+ if (tag.file[0] != '/') {
+ fileWithTagInside = project()->projectDirectory() + "/" + tag.file;
+ }
+ else {
+ fileWithTagInside = tag.file;
+ }
+ url.setPath(fileWithTagInside);
+ partController()->editDocument( url, getFileLineFromPattern( url, tag.pattern ) );
+ m_widget->displayHitsAndClear( list );
+ }
+ else
+ {
+ showHits( list );
+ }
+}
+
+void CTags2Part::slotGotoDefinition( )
+{
+ QStringList types;
+ types << "S" << "d" << "f" << "t" << "v";
+ gotoTagForTypes( types );
+}
+
+void CTags2Part::slotGotoDeclaration( )
+{
+ QStringList types;
+ types << "L" << "c" << "e" << "g" << "m" << "n" << "p" << "s" << "u" << "x";
+ gotoTagForTypes( types );
+}
+
+
+int CTags2Part::getFileLineFromStream( QTextStream & istream, QString const & pattern )
+{
+ if ( pattern.isEmpty() ) return -1;
+
+ // ctags interestingly escapes "/", but apparently nothing else. lets revert that
+ QString unescaped = pattern;
+ unescaped.replace( "\\/", "/" );
+
+ // most of the time, the ctags pattern has the form /^foo$/
+ // but this isn't true for some macro definitions
+ // where the form is only /^foo/
+ // I have no idea if this is a ctags bug or not, but we have to deal with it
+
+ QString reduced, escaped, re_string;
+ if ( unescaped.endsWith( "$/" ) )
+ {
+ reduced = unescaped.mid( 2, unescaped.length() -4 );
+ escaped = QRegExp::escape( reduced );
+ re_string = QString( "^" + escaped + "$" );
+ }
+ else
+ {
+ reduced = unescaped.mid( 2, unescaped.length() -3 );
+ escaped = QRegExp::escape( reduced );
+ re_string = QString( "^" + escaped );
+ }
+
+ QRegExp re( re_string );
+
+ int n = 0;
+ while ( !istream.atEnd() )
+ {
+ if ( re.search( istream.readLine() ) > -1 )
+ {
+ return n;
+ }
+ n++;
+ }
+ return -1;
+}
+
+int CTags2Part::getFileLineFromPattern( KURL const & url, QString const & pattern )
+{
+ // if the file is open - get the line from the editor buffer
+ if ( KTextEditor::EditInterface * ei = dynamic_cast<KTextEditor::EditInterface*>( partController()->partForURL( url ) ) )
+ {
+ QString ibuffer = ei->text();
+ QTextStream istream( &ibuffer, IO_ReadOnly );
+ return getFileLineFromStream( istream, pattern );
+ }
+ else // else the file is not open - get the line from the file on disk
+ {
+ QFile file( url.path() );
+ QString buffer;
+
+ if ( file.open( IO_ReadOnly ) )
+ {
+ QTextStream istream( &file );
+ return getFileLineFromStream( istream, pattern );
+ }
+ }
+ return -1;
+}
+
+void CTags2Part::slotLookupDeclaration( )
+{
+ m_contextString = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+ if ( !m_contextString.isEmpty() )
+ {
+ slotGotoDeclaration();
+ }
+}
+
+void CTags2Part::slotLookupDefinition( )
+{
+ m_contextString = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+ if ( !m_contextString.isEmpty() )
+ {
+ slotGotoDefinition();
+ }
+}
+
+void CTags2Part::slotLookup( )
+{
+ m_contextString = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+ if ( !m_contextString.isEmpty() )
+ {
+ slotGotoTag();
+ }
+}
+
+void CTags2Part::slotOpenLookup( )
+{
+ mainWindow()->raiseView( m_widget );
+ m_widget->input_edit->setFocus();
+}
+
+void CTags2Part::slotGoToNext( )
+{
+ m_widget->goToNext();
+}
+
+#include "ctags2_part.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_part.h b/parts/ctags2/ctags2_part.h
new file mode 100644
index 00000000..77725500
--- /dev/null
+++ b/parts/ctags2/ctags2_part.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __KDEVPART_CTAGS2_H__
+#define __KDEVPART_CTAGS2_H__
+
+#include <qguardedptr.h>
+#include <qstring.h>
+
+#include <kdevplugin.h>
+#include "tags.h"
+
+class QPopupMenu;
+class Context;
+class KURL;
+class QTextStream;
+class CTags2Widget;
+class ConfigWidgetProxy;
+class KDialogBase;
+
+class CTags2Part : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ CTags2Part(QObject *parent, const char *name, const QStringList &);
+ ~CTags2Part();
+
+ int getFileLineFromPattern( KURL const & url, QString const & pattern);
+ bool createTagsFile();
+ bool createTagsFile(const QString& tagFile, const QString& dir);
+
+private slots:
+ void slotLookupDeclaration();
+ void slotLookupDefinition();
+ void slotLookup();
+ void slotOpenLookup();
+ void slotGoToNext();
+ void slotGotoDefinition();
+ void slotGotoDeclaration();
+ void slotGotoTag();
+ void contextMenu(QPopupMenu *, const Context *);
+ void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
+ void updateTagsfileName( const QString & name );
+
+private:
+ int getFileLineFromStream( QTextStream & stream, QString const & pattern);
+ void gotoTagForTypes( QStringList const & types );
+ void showHits( Tags::TagList const & tags );
+
+ QGuardedPtr<CTags2Widget> m_widget;
+ QString m_contextString ;
+
+ ConfigWidgetProxy * _configProxy;
+};
+
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_selecttagfile.cpp b/parts/ctags2/ctags2_selecttagfile.cpp
new file mode 100644
index 00000000..d9ae94be
--- /dev/null
+++ b/parts/ctags2/ctags2_selecttagfile.cpp
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kurlrequester.h>
+#include <klineedit.h>
+
+#include "ctags2_selecttagfile.h"
+
+
+SelectTagFile::SelectTagFile( QWidget* parent, const char* name, bool modal, WFlags fl)
+: SelectTagFileBase( parent, name, modal, fl )
+{
+ tagFile->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
+ okButton->setEnabled( false );
+}
+
+SelectTagFile::~SelectTagFile()
+{
+}
+
+void SelectTagFile::validate()
+{
+ bool valid = ( !displayName->text().isEmpty() && !tagFile->url().isEmpty() );
+
+ okButton->setEnabled( valid );
+}
+
+QString SelectTagFile::name( )
+{
+ return displayName->text();
+}
+
+QString SelectTagFile::tagsfilePath( )
+{
+ return tagFile->url();
+}
+
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_selecttagfile.h b/parts/ctags2/ctags2_selecttagfile.h
new file mode 100644
index 00000000..103ba98c
--- /dev/null
+++ b/parts/ctags2/ctags2_selecttagfile.h
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CTAGS2_SELECTTAGFILE_H
+#define CTAGS2_SELECTTAGFILE_H
+
+#include "ctags2_selecttagfilebase.h"
+
+class SelectTagFile : public SelectTagFileBase {
+ Q_OBJECT
+
+ public:
+ SelectTagFile( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SelectTagFile();
+ QString name();
+ QString tagsfilePath();
+
+public slots:
+ virtual void validate();
+};
+
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_selecttagfilebase.ui b/parts/ctags2/ctags2_selecttagfilebase.ui
new file mode 100644
index 00000000..cddd5f26
--- /dev/null
+++ b/parts/ctags2/ctags2_selecttagfilebase.ui
@@ -0,0 +1,128 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>SelectTagFileBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SelectTagFileBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>373</width>
+ <height>146</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add tags file</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>displayName</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Tags file:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>tagFile</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>101</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>O&amp;K</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>SelectTagFileBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>SelectTagFileBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>displayName</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>SelectTagFileBase</receiver>
+ <slot>validate()</slot>
+ </connection>
+ <connection>
+ <sender>tagFile</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>SelectTagFileBase</receiver>
+ <slot>validate()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>validate()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/ctags2/ctags2_settingswidget.cpp b/parts/ctags2/ctags2_settingswidget.cpp
new file mode 100644
index 00000000..4bcdb122
--- /dev/null
+++ b/parts/ctags2/ctags2_settingswidget.cpp
@@ -0,0 +1,173 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qheader.h>
+
+#include <klineedit.h>
+#include <klistview.h>
+#include <kdevproject.h>
+#include <kapplication.h>
+#include <kurlcompletion.h>
+#include <kurlrequester.h>
+#include <kconfig.h>
+#include <kurl.h>
+#include <kdevplugin.h>
+#include <domutil.h>
+
+#include "ctags2_settingswidget.h"
+#include "ctags2_part.h"
+#include "ctags2_selecttagfile.h"
+#include "ctags2_createtagfile.h"
+
+
+CTags2SettingsWidget::CTags2SettingsWidget( CTags2Part * part, QWidget* parent, const char* name, WFlags fl )
+ : CTags2SettingsWidgetBase( parent, name, fl ), m_part( part )
+{
+ binaryPath->completionObject()->setMode( KURLCompletion::FileCompletion );
+ binaryPath->setMode( KFile::File | KFile::LocalOnly );
+ binaryPath->setShowLocalProtocol( false );
+
+ tagfilePath->completionObject()->setMode( KURLCompletion::FileCompletion );
+ tagfilePath->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
+ tagfilePath->setShowLocalProtocol( false );
+
+ otherTagFiles->setSorting( -1 );
+// otherTagFiles->addColumn( "" );
+// otherTagFiles->header()->hide();
+ otherTagFiles->setFullWidth( true );
+
+ loadSettings();
+}
+
+CTags2SettingsWidget::~CTags2SettingsWidget()
+{
+}
+
+void CTags2SettingsWidget::loadSettings()
+{
+ QDomDocument & dom = *m_part->projectDom();
+
+ QString customArgs = DomUtil::readEntry( dom, "/ctagspart/customArguments" );
+ if ( !customArgs.isEmpty() )
+ {
+ tagfileCustomBox->setChecked( true );
+ tagfileCustomEdit->setText( customArgs );
+ }
+
+ QString customTagfile = DomUtil::readEntry( dom, "/ctagspart/customTagfilePath" );
+ if (customTagfile.isEmpty())
+ {
+ customTagfile = m_part->project()->projectDirectory() + "/tags";
+ }
+ tagfilePath->setURL(customTagfile);
+
+ QStringList activeTagsFiles = DomUtil::readListEntry(dom, "/ctagspart/activeTagsFiles", "file");
+
+ KConfig * config = kapp->config();
+ config->setGroup( "CTAGS" );
+ showDeclarationBox->setChecked( config->readBoolEntry( "ShowDeclaration", true ) );
+ showDefinitionBox->setChecked( config->readBoolEntry( "ShowDefinition", true ) );
+ showLookupBox->setChecked( config->readBoolEntry( "ShowLookup", true ) );
+ jumpToFirstBox->setChecked( config->readBoolEntry( "JumpToFirst", false ) );
+ QString ctagsBinary = config->readEntry( "ctags binary" ).stripWhiteSpace();
+ if ( !ctagsBinary.isEmpty() )
+ {
+ binaryPath->setURL( ctagsBinary );
+ }
+
+ config->setGroup( "CTAGS-tagsfiles" );
+ QMap<QString,QString> entryMap = config->entryMap( "CTAGS-tagsfiles" );
+ QMap<QString,QString>::const_iterator it = entryMap.begin();
+ while ( it != entryMap.end() )
+ {
+ QString file = config->readPathEntry( it.key() );
+ new TagsItem( otherTagFiles, it.key(), file, activeTagsFiles.contains( file ) );
+ ++it;
+ }
+}
+
+void CTags2SettingsWidget::storeSettings()
+{
+ QDomDocument & dom = *m_part->projectDom();
+ DomUtil::writeEntry( dom, "/ctagspart/customArguments", tagfileCustomEdit->text() );
+ DomUtil::writeEntry( dom, "/ctagspart/customTagfilePath", tagfilePath->url() );
+
+ KConfig * config = kapp->config();
+ config->setGroup( "CTAGS" );
+ config->writeEntry( "ShowDeclaration", showDeclarationBox->isChecked() );
+ config->writeEntry( "ShowDefinition", showDefinitionBox->isChecked() );
+ config->writeEntry( "ShowLookup", showLookupBox->isChecked() );
+ config->writeEntry( "JumpToFirst", jumpToFirstBox->isChecked() );
+ config->writeEntry( "ctags binary", binaryPath->url() );
+
+ config->deleteGroup( "CTAGS-tagsfiles" );
+ config->setGroup( "CTAGS-tagsfiles" );
+
+ QStringList activeTagsFiles;
+ TagsItem * item = static_cast<TagsItem*>( otherTagFiles->firstChild() );
+ while ( item )
+ {
+ config->writePathEntry( item->name(), item->tagsfilePath() );
+ if ( item->isOn() )
+ {
+ activeTagsFiles.append( item->tagsfilePath() );
+ }
+ item = static_cast<TagsItem*>( item->nextSibling() );
+ }
+ DomUtil::writeListEntry( dom, "/ctagspart/activeTagsFiles", "file", activeTagsFiles );
+
+ activeTagsFiles.push_front( tagfilePath->url() );
+ Tags::setTagFiles( activeTagsFiles );
+
+ config->sync();
+
+ emit newTagsfileName( tagfilePath->url() );
+}
+
+void CTags2SettingsWidget::slotAccept( )
+{
+ storeSettings();
+}
+
+void CTags2SettingsWidget::createNewTagSlot()
+{
+ CreateTagFile* dlg = new CreateTagFile;
+ if ( dlg->exec() == QDialog::Accepted )
+ {
+ m_part->createTagsFile( dlg->tagsfilePath(), dlg->directory() );
+ new TagsItem( otherTagFiles, dlg->name(), dlg->tagsfilePath(), true );
+ }
+}
+
+void CTags2SettingsWidget::addNewTagFile()
+{
+ SelectTagFile* dlg = new SelectTagFile;
+
+ if ( dlg->exec() == QDialog::Accepted )
+ {
+ new TagsItem( otherTagFiles, dlg->name(), dlg->tagsfilePath(), true );
+ }
+}
+
+void CTags2SettingsWidget::removeTagFile()
+{
+ if (!otherTagFiles->selectedItem())
+ return;
+
+ delete otherTagFiles->selectedItem();
+}
+
+
+#include "ctags2_settingswidget.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_settingswidget.h b/parts/ctags2/ctags2_settingswidget.h
new file mode 100644
index 00000000..ac208ad4
--- /dev/null
+++ b/parts/ctags2/ctags2_settingswidget.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CTAGS2_SETTINGSWIDGET_H
+#define CTAGS2_SETTINGSWIDGET_H
+
+#include <qlistview.h>
+
+#include "ctags2_settingswidgetbase.h"
+
+class CTags2Part;
+
+class TagsItem : public QCheckListItem
+{
+public:
+ TagsItem( QListView * parent, QString name, QString tagsfilePath, bool active )
+ : QCheckListItem( parent, name, QCheckListItem::CheckBox ), m_name( name ), m_tagsfilePath( tagsfilePath )
+ {
+ setOn( active );
+ setText( 1, tagsfilePath );
+ }
+ QString name() { return m_name; }
+ QString tagsfilePath() { return m_tagsfilePath; }
+
+private:
+ QString m_name;
+ QString m_tagsfilePath;
+};
+
+
+
+class CTags2SettingsWidget : public CTags2SettingsWidgetBase
+{
+ Q_OBJECT
+
+public:
+ CTags2SettingsWidget( CTags2Part * part, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~CTags2SettingsWidget();
+
+signals:
+ void newTagsfileName( const QString & name );
+
+public slots:
+ void slotAccept();
+ void createNewTagSlot();
+ void addNewTagFile();
+ void removeTagFile();
+
+protected:
+
+protected slots:
+
+private:
+ void loadSettings();
+ void storeSettings();
+
+ CTags2Part * m_part;
+};
+
+#endif
+
diff --git a/parts/ctags2/ctags2_settingswidgetbase.ui b/parts/ctags2/ctags2_settingswidgetbase.ui
new file mode 100644
index 00000000..27898206
--- /dev/null
+++ b/parts/ctags2/ctags2_settingswidgetbase.ui
@@ -0,0 +1,382 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>CTags2SettingsWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>CTags2SettingsWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>460</width>
+ <height>456</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget8</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Ge&amp;neral</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Editor Context Menu</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>showDeclarationBox</cstring>
+ </property>
+ <property name="text">
+ <string>Show "&amp;Go To Declaration"</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, an option to go directly to the matching tag declaration will be shown. If more than one match, all matches will be shown in the main ctags result view.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>showDefinitionBox</cstring>
+ </property>
+ <property name="text">
+ <string>Show "Go To &amp;Definition"</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, an option to go directly to the matching tag definition will be shown. If more than one match, all matches will be shown in the main ctags result view.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>showLookupBox</cstring>
+ </property>
+ <property name="text">
+ <string>Show "CT&amp;ags Lookup"</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If checked, an option to do a full lookup of all macthing tags is shown in the context menu. The results will be shown in the main ctags results view.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>jumpToFirstBox</cstring>
+ </property>
+ <property name="text">
+ <string>When more than one hit, go directl&amp;y to the first</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If more than one hit was produced from an attempt to find an exact match, go to the first match in the list. Note: the &lt;i&gt;Go To Next Match&lt;/i&gt; shortcut can be used to step between the matches.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>tagfileCustomBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Use custom tagfile generation arguments</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The default arguments should be fine, but if needed a custom generation arguments string can be used.</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>tagfileCustomEdit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="readOnly">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter custom arguments to ctags database creation here. Note: do not set a custom tags file filename here, do that below instead.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Paths</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the path to the exuberant ctags binary. If empty, &lt;i&gt;ctags&lt;/i&gt; will be executed via $PATH. Note that it is sometimes installed as &lt;i&gt;exuberant-ctags&lt;/i&gt;.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Path to ctags binary:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>binaryPath</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the path to the exuberant ctags binary. If empty, &lt;i&gt;ctags&lt;/i&gt; will be executed via $PATH. Note that it is sometimes installed as &lt;i&gt;exuberant-ctags&lt;/i&gt;.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Mana&amp;ge tag files</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Path to project tag file:</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="0">
+ <property name="name">
+ <cstring>tagfilePath</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter the full path of the project tagfile. If empty, the file will be called &lt;i&gt;tags&lt;/i&gt; and reside in the root of the project.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Other tag files:</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="1">
+ <property name="name">
+ <cstring>layout21</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="0" column="0">
+ <property name="name">
+ <cstring>createButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Create...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="0">
+ <property name="name">
+ <cstring>addButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="0">
+ <property name="name">
+ <cstring>removeButton</cstring>
+ </property>
+ <property name="text">
+ <string>Remo&amp;ve</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>61</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KListView" row="2" column="0" rowspan="2" colspan="1">
+ <column>
+ <property name="text">
+ <string>Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Tags file</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>otherTagFiles</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>addButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CTags2SettingsWidgetBase</receiver>
+ <slot>addNewTagFile()</slot>
+ </connection>
+ <connection>
+ <sender>removeButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CTags2SettingsWidgetBase</receiver>
+ <slot>removeTagFile()</slot>
+ </connection>
+ <connection>
+ <sender>createButton</sender>
+ <signal>clicked()</signal>
+ <receiver>CTags2SettingsWidgetBase</receiver>
+ <slot>createNewTagSlot()</slot>
+ </connection>
+ <connection>
+ <sender>tagfileCustomBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>tagfileCustomEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>tagfileCustomBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>tagfileCustomEdit</receiver>
+ <slot>clear()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>createNewTagSlot()</slot>
+ <slot>addNewTagFile()</slot>
+ <slot>removeTagFile()</slot>
+ <slot>moveUpTagFile()</slot>
+ <slot>moveDownTagFile()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/ctags2/ctags2_widget.cpp b/parts/ctags2/ctags2_widget.cpp
new file mode 100644
index 00000000..7196ed1b
--- /dev/null
+++ b/parts/ctags2/ctags2_widget.cpp
@@ -0,0 +1,199 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qtimer.h>
+#include <qlabel.h>
+#include <qfileinfo.h>
+#include <qdatetime.h>
+#include <qfocusdata.h>
+
+#include <klineedit.h>
+#include <klistview.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kurl.h>
+#include <kapplication.h>
+
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+
+#include "ctags2_widget.h"
+#include "tags.h"
+
+class TagItem : public QListViewItem
+{
+public:
+ TagItem(QListView * lv, QString const & tag, QString const & type, QString const & file, QString const & pattern );
+
+ QString tag;
+ QString type;
+ QString file;
+ QString pattern;
+};
+
+TagItem::TagItem( QListView * lv, QString const & tag, QString const & type, QString const & file, QString const & pattern )
+ : QListViewItem( lv, tag, type, file ), tag(tag), type(type), file(file), pattern(pattern)
+{
+}
+
+CTags2Widget::CTags2Widget( CTags2Part * part, const char* name, WFlags fl)
+: CTags2WidgetBase(0,name,fl), _part(part)
+{
+ output_view->setColumnWidthMode(0,QListView::Maximum);
+ output_view->setColumnWidthMode(1,QListView::Maximum);
+ output_view->setColumnWidthMode(2,QListView::Maximum);
+
+ _typeTimeout = new QTimer( this );
+ connect( _typeTimeout, SIGNAL(timeout()), this, SLOT(line_edit_changed()) );
+
+ connect( output_view, SIGNAL(executed(QListViewItem*)), this, SLOT(itemExecuted(QListViewItem*)) );
+ connect( output_view, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(itemExecuted(QListViewItem*)) );
+
+ updateDBDateLabel();
+}
+
+CTags2Widget::~CTags2Widget()
+{
+}
+
+void CTags2Widget::displayHits( Tags::TagList const & list )
+{
+ output_view->clear();
+ showHitCount( list.count() );
+
+ Tags::TagList::ConstIterator it = list.begin();
+ while( it != list.end() )
+ {
+ new TagItem( output_view, (*it).tag, (*it).type, (*it).file, (*it).pattern );
+ ++it;
+ }
+
+ output_view->adjustColumn(0);
+ output_view->adjustColumn(1);
+ output_view->adjustColumn(2);
+
+}
+
+void CTags2Widget::displayHitsAndClear( Tags::TagList const & list )
+{
+ input_edit->blockSignals( true );
+ input_edit->clear();
+ input_edit->blockSignals( false );
+
+ displayHits( list );
+}
+
+void CTags2Widget::line_edit_changed( )
+{
+ displayHits( Tags::getPartialMatches( input_edit->text() ) );
+}
+
+void CTags2Widget::line_edit_changed_delayed( )
+{
+ showHitCount( calculateHitCount() );
+ _typeTimeout->start( 500, true );
+}
+
+void CTags2Widget::showHitCount( int n )
+{
+ hitcount_label->setText( i18n("Hits: %1").arg( n ) );
+}
+
+int CTags2Widget::calculateHitCount( )
+{
+ return Tags::numberOfPartialMatches( input_edit->text() ) ;
+}
+
+void CTags2Widget::itemExecuted( QListViewItem * item )
+{
+ TagItem * tagItem = static_cast<TagItem*>( item );
+
+ KURL url;
+ QString fileWithTagInside;
+ // assume relative path to project directory if path does not start with slash
+ if (tagItem->file[0] != '/') {
+ fileWithTagInside = _part->project()->projectDirectory() + "/" + tagItem->file;
+ }
+ else {
+ fileWithTagInside = tagItem->file;
+ }
+
+ url.setPath(fileWithTagInside);
+
+ _part->partController()->editDocument( url, _part->getFileLineFromPattern( url, tagItem->pattern ) );
+}
+
+void CTags2Widget::regeneratebutton_clicked()
+{
+ QApplication::setOverrideCursor(Qt::waitCursor);
+
+ _part->createTagsFile();
+
+ QApplication::restoreOverrideCursor();
+
+ updateDBDateLabel();
+}
+
+void CTags2Widget::updateDBDateLabel( )
+{
+ QStringList tagFiles = Tags::getTagFiles();
+ QFileInfo tagsdb(tagFiles[0]);
+ if ( tagsdb.exists() )
+ {
+ datetime_label->setText( tagsdb.created().date().toString( Qt::ISODate ) );
+ }
+ else
+ {
+ datetime_label->setText( i18n("No CTags database found") );
+ }
+}
+
+void CTags2Widget::focusInEvent( QFocusEvent* )
+{
+ updateDBDateLabel();
+ input_edit->setFocus();
+}
+
+void CTags2Widget::goToNext( )
+{
+ QListViewItem * item = output_view->firstChild();
+ while( item )
+ {
+ if ( item->isSelected() )
+ {
+ // found the current, take the next
+ item->setSelected( false );
+ if ( (item = item->nextSibling()) != NULL )
+ {
+ item->setSelected( true );
+ output_view->repaint( true );
+ itemExecuted( item );
+ return;
+ }
+ else
+ {
+ break;
+ }
+ }
+ item = item->nextSibling();
+ }
+ // use the first
+ if ( (item = output_view->firstChild()) != NULL )
+ {
+ item->setSelected( true );
+ itemExecuted( item );
+ }
+}
+
+#include "ctags2_widget.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
+
diff --git a/parts/ctags2/ctags2_widget.h b/parts/ctags2/ctags2_widget.h
new file mode 100644
index 00000000..2a4423a4
--- /dev/null
+++ b/parts/ctags2/ctags2_widget.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CTAGS2_WIDGET_H
+#define CTAGS2_WIDGET_H
+
+#include "ctags2_widgetbase.h"
+#include "ctags2_part.h"
+#include "tags.h"
+
+class QTimer;
+class QListViewItem;
+
+class CTags2Widget : public CTags2WidgetBase
+{
+ Q_OBJECT
+
+public:
+ CTags2Widget( CTags2Part * part, const char* name = 0, WFlags fl = 0 );
+ ~CTags2Widget();
+
+ void displayHits( Tags::TagList const & );
+ void displayHitsAndClear( Tags::TagList const & );
+
+ void updateDBDateLabel();
+ void goToNext();
+
+protected:
+ void focusInEvent( QFocusEvent *e );
+
+private slots:
+ virtual void line_edit_changed();
+ virtual void line_edit_changed_delayed();
+ virtual void regeneratebutton_clicked();
+ void itemExecuted( QListViewItem * );
+
+private:
+ void showHitCount( int );
+ int calculateHitCount();
+
+ CTags2Part * _part;
+ QTimer * _typeTimeout;
+
+};
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/ctags2/ctags2_widgetbase.ui b/parts/ctags2/ctags2_widgetbase.ui
new file mode 100644
index 00000000..ef564767
--- /dev/null
+++ b/parts/ctags2/ctags2_widgetbase.ui
@@ -0,0 +1,181 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>CTags2WidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>CTags2WidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>780</width>
+ <height>397</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>2</number>
+ </property>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>Tag</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>File</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>output_view</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Result view for a tag lookup. Click a line to go to the corresponding place in the code.</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Lookup:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>input_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Type the identifier you want to lookup. &lt;p&gt; The identifier will populate and display a reducing list as you type.</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>hitcount_label</cstring>
+ </property>
+ <property name="text">
+ <string>Hits:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>80</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>datetime_label</cstring>
+ </property>
+ <property name="text">
+ <string>Date:</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>generate_button</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>NoFocus</enum>
+ </property>
+ <property name="text">
+ <string>Regenerate</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Press to regenerate CTags database.&lt;p&gt;This will take some time on a large project.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>input_edit</sender>
+ <signal>returnPressed()</signal>
+ <receiver>CTags2WidgetBase</receiver>
+ <slot>line_edit_changed()</slot>
+ </connection>
+ <connection>
+ <sender>input_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>CTags2WidgetBase</receiver>
+ <slot>line_edit_changed_delayed()</slot>
+ </connection>
+ <connection>
+ <sender>generate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>CTags2WidgetBase</receiver>
+ <slot>regeneratebutton_clicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>input_edit</tabstop>
+ <tabstop>output_view</tabstop>
+</tabstops>
+<slots>
+ <slot access="private">line_edit_changed_delayed()</slot>
+ <slot access="private">line_edit_changed()</slot>
+ <slot access="private">regeneratebutton_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistview.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/ctags2/ctagskinds.cpp b/parts/ctags2/ctagskinds.cpp
new file mode 100644
index 00000000..c8d5ef93
--- /dev/null
+++ b/parts/ctags2/ctagskinds.cpp
@@ -0,0 +1,306 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "ctagskinds.h"
+
+#include <klocale.h>
+
+struct CTagsKindMapping {
+ char abbrev;
+ const char *verbose;
+};
+
+
+struct CTagsExtensionMapping {
+ const char *extension;
+ CTagsKindMapping *kinds;
+};
+
+
+static CTagsKindMapping kindMappingAsm[] = {
+ { 'd', I18N_NOOP("define") },
+ { 'l', I18N_NOOP("label") },
+ { 'm', I18N_NOOP("macro") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingAsp[] = {
+ { 'f', I18N_NOOP("function") },
+ { 's', I18N_NOOP("subroutine") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingAwk[] = {
+ { 'f', I18N_NOOP("function") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingBeta[] = {
+ { 'f', I18N_NOOP("fragment definition") },
+ { 'p', I18N_NOOP("any pattern") },
+ { 's', I18N_NOOP("slot") },
+ { 'v', I18N_NOOP("pattern") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingC[] = {
+ { 'c', I18N_NOOP("class") },
+ { 'd', I18N_NOOP("macro") },
+ { 'e', I18N_NOOP("enumerator") },
+ { 'f', I18N_NOOP("function") },
+ { 'g', I18N_NOOP("enumeration") },
+ { 'l', I18N_NOOP("local variable") },
+ { 'm', I18N_NOOP("member") },
+ { 'n', I18N_NOOP("namespace") },
+ { 'p', I18N_NOOP("prototype") },
+ { 's', I18N_NOOP("struct") },
+ { 't', I18N_NOOP("typedef") },
+ { 'u', I18N_NOOP("union") },
+ { 'v', I18N_NOOP("variable") },
+ { 'x', I18N_NOOP("external variable") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingCobol[] = {
+ { 'p', I18N_NOOP("paragraph") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingEiffel[] = {
+ { 'c', I18N_NOOP("class") },
+ { 'f', I18N_NOOP("feature") },
+ { 'l', I18N_NOOP("local entity") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingFortran[] = {
+ { 'b', I18N_NOOP("block") },
+ { 'c', I18N_NOOP("common") },
+ { 'e', I18N_NOOP("entry") },
+ { 'f', I18N_NOOP("function") },
+ { 'i', I18N_NOOP("interface") },
+ { 'k', I18N_NOOP("type component") },
+ { 'l', I18N_NOOP("label") },
+ { 'L', I18N_NOOP("local") },
+ { 'm', I18N_NOOP("module") },
+ { 'n', I18N_NOOP("namelist") },
+ { 'p', I18N_NOOP("program") },
+ { 's', I18N_NOOP("subroutine") },
+ { 't', I18N_NOOP("type") },
+ { 'v', I18N_NOOP("variable") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingJava[] = {
+ { 'c', I18N_NOOP("class") },
+ { 'f', I18N_NOOP("field") },
+ { 'i', I18N_NOOP("interface") },
+ { 'm', I18N_NOOP("method") },
+ { 'p', I18N_NOOP("package") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingLisp[] = {
+ { 'f', I18N_NOOP("function") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingMake[] = {
+ { 'm', I18N_NOOP("macro") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingPascal[] = {
+ { 'f', I18N_NOOP("function") },
+ { 'p', I18N_NOOP("procedure") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingPerl[] = {
+ { 's', I18N_NOOP("subroutine") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingPHP[] = {
+ { 'c', I18N_NOOP("class") },
+ { 'f', I18N_NOOP("function") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingPython[] = {
+ { 'c', I18N_NOOP("class") },
+ { 'f', I18N_NOOP("function") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingRexx[] = {
+ { 's', I18N_NOOP("subroutine") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingRuby[] = {
+ { 'c', I18N_NOOP("class") },
+ { 'f', I18N_NOOP("function") },
+ { 'm', I18N_NOOP("mixin") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingScheme[] = {
+ { 'f', I18N_NOOP("function") },
+ { 's', I18N_NOOP("set") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingSh[] = {
+ { 'f', I18N_NOOP("function") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingSlang[] = {
+ { 'f', I18N_NOOP("function") },
+ { 'n', I18N_NOOP("namespace") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingTcl[] = {
+ { 'p', I18N_NOOP("procedure") },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping kindMappingVim[] = {
+ { 'f', I18N_NOOP("function") },
+ { 0 , 0 }
+};
+
+
+static CTagsExtensionMapping extensionMapping[] = {
+ { "asm", kindMappingAsm },
+ { "s", kindMappingAsm },
+ { "S", kindMappingAsm },
+ { "asp", kindMappingAsp },
+ { "asa", kindMappingAsp },
+ { "awk", kindMappingAwk },
+ { "c++", kindMappingC },
+ { "cc", kindMappingC },
+ { "cp" , kindMappingC },
+ { "cpp", kindMappingC },
+ { "cxx", kindMappingC },
+ { "h" , kindMappingC },
+ { "h++", kindMappingC },
+ { "hh" , kindMappingC },
+ { "hp" , kindMappingC },
+ { "hpp", kindMappingC },
+ { "hxx", kindMappingC },
+ { "beta", kindMappingBeta },
+ { "cob", kindMappingCobol },
+ { "COB", kindMappingCobol },
+ { "e", kindMappingEiffel },
+ { "f" , kindMappingFortran },
+ { "for" , kindMappingFortran },
+ { "ftn" , kindMappingFortran },
+ { "f77" , kindMappingFortran },
+ { "f90" , kindMappingFortran },
+ { "f95" , kindMappingFortran },
+ { "java", kindMappingJava },
+ { "cl", kindMappingLisp },
+ { "clisp", kindMappingLisp },
+ { "el", kindMappingLisp },
+ { "l", kindMappingLisp },
+ { "lisp", kindMappingLisp },
+ { "lsp", kindMappingLisp },
+ { "ml", kindMappingLisp },
+ { "mak", kindMappingMake },
+ { "p", kindMappingPascal },
+ { "pas", kindMappingPascal },
+ { "pl", kindMappingPerl },
+ { "pm", kindMappingPerl },
+ { "perl", kindMappingPerl },
+ { "php", kindMappingPHP },
+ { "php3", kindMappingPHP },
+ { "phtml", kindMappingPHP },
+ { "py", kindMappingPython },
+ { "python", kindMappingPython },
+ { "cmd", kindMappingRexx },
+ { "rexx", kindMappingRexx },
+ { "rx", kindMappingRexx },
+ { "rb", kindMappingRuby },
+ { "sch", kindMappingScheme },
+ { "scheme", kindMappingScheme },
+ { "scm", kindMappingScheme },
+ { "sm", kindMappingScheme },
+ { "SCM", kindMappingScheme },
+ { "SM", kindMappingScheme },
+ { "sh", kindMappingSh },
+ { "SH", kindMappingSh },
+ { "bsh", kindMappingSh },
+ { "bash", kindMappingSh },
+ { "ksh", kindMappingSh },
+ { "zsh", kindMappingSh },
+ { "sl", kindMappingSlang },
+ { "tcl", kindMappingTcl },
+ { "wish", kindMappingTcl },
+ { "vim", kindMappingVim },
+ { 0 , 0 }
+};
+
+
+static CTagsKindMapping *findKindMapping(const QString &extension)
+{
+ const char *pextension = extension.latin1();
+
+ CTagsExtensionMapping *pem = extensionMapping;
+ while (pem->extension != 0) {
+ if (strcmp(pem->extension, pextension) == 0)
+ return pem->kinds;
+ ++pem;
+ }
+
+ return 0;
+}
+
+
+QString CTagsKinds::findKind( const char * kindChar, const QString &extension )
+{
+ if ( kindChar == 0 ) return QString::null;
+
+ CTagsKindMapping *kindMapping = findKindMapping(extension);
+ if (kindMapping) {
+ CTagsKindMapping *pkm = kindMapping;
+ while (pkm->verbose != 0) {
+ if (pkm->abbrev == *kindChar)
+ return i18n(pkm->verbose);
+ ++pkm;
+ }
+ }
+
+ return QString::null;
+}
diff --git a/parts/ctags2/ctagskinds.h b/parts/ctags2/ctagskinds.h
new file mode 100644
index 00000000..de695319
--- /dev/null
+++ b/parts/ctags2/ctagskinds.h
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _CTAGSKINDS_H_
+#define _CTAGSKINDS_H_
+
+#include <qstring.h>
+
+
+class CTagsKinds
+{
+public:
+ static QString findKind( const char * kindChar, const QString &extension);
+};
+
+#endif
diff --git a/parts/ctags2/kdevctags2.desktop b/parts/ctags2/kdevctags2.desktop
new file mode 100644
index 00000000..a63d45de
--- /dev/null
+++ b/parts/ctags2/kdevctags2.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Icon=kdevelop
+Comment=CTags is a source navigation tool with support for many languages. When loaded it provides a context menu for finding type declarations/definitions and also a query dialog. http://ctags.sourceforge.net/
+Comment[ca]=CTags és una eina de navegació de codi font amb suport per a diversos llenguatges. En carregar-se proporciona un menú de context per a localitzar les declaracions/definicions de tipus i també un diàleg de consultes. http://ctags.sourceforge.net/
+Comment[da]=CTags er et kildenavigationsværktøj med støtte for mange sprog. Når det er indlæst sørger det for en sammenhængsmenu til at finde type-deklarationer/definitioner og også en forespørgselsdialog. http://ctags.sourceforge.net/
+Comment[de]=CTags ist ein Navigationswerkzeug, das viele Sprachen unterstützt. Ist es geladen, bietet es ein Kontextmenü zum Suchen von Typ-Deklarationen und -Definitionen und einen Abfragedialog im Menü "Werkzeuge". http://ctags.sourceforge.net/
+Comment[el]=Το CTags είναι ένα εργαλείο πλοήγησης κώδικα με υποστήριξη πολλών γλωσσών. Όταν φορτωθεί προσφέρει ένα σχετικό μενού εύρεσης δηλώσεων/ορισμών τύπων και ένα διάλογο αναζήτησης. http://ctags.sourceforge.net/
+Comment[en_GB]=CTags is a source navigation tool with support for many languages. When loaded it provides a context menu for finding type declarations/definitions and also a query dialogue. http://ctags.sourceforge.net/
+Comment[es]=CTags es una herramienta de navegación del código fuente con soporte para varios lenguajes. Al cargarse, proporciona un menú contextual para localizar las declaraciones/definiciones de tipos y también un diálogo de consultas. http://ctags.sourceforge.net/
+Comment[et]=CTags on liikumisvahend paljude keelte toega. Laadimisel pakub see kontekstimenüüd deklaratsioonide/definitsioonide tüübi leidmiseks, samuti päringudialoogi tööriistade menüü vahendusel. Vaata internetis http://ctags.sourceforge.net/
+Comment[eu]=CTags hizkuntza askotako euskarria duen iturburu nabigazio tresna bat da. Kargatzean mota deklarazio/definizioak aurkitzeko testuinguru menu bat eskeintzen du eta baita kontsulta elkarrizketa-koadro bat ere Tresnak menuan.http://ctags.sourceforge.net/
+Comment[fa]=CTags یک ابزار ناوش منبع با پشتیبانی از زبانهای زیادی است. در هنگام بارگذاری، یک گزینگان متن برای یافتن تعاریف/اعلانهای نوع و همچنین یک محاورۀ پرس‌وجو فراهم می‌کند. http://ctags.sourceforge.net/
+Comment[fr]=CTags est un outil de navigation dans les sources comprenant une prise en charge pour de nombreux langages. Une fois chargé, il fournit un menu contextuel pour la recherche de déclarations / définitions de types, ainsi qu'une boîte de dialogue de requête. http://ctags.sourceforge.net/
+Comment[gl]=CTags é unha ferramenta para a navegación de código con soporte para moitas linguaxes. Cando se carga proporciona un menú contextual para atopar declaracións/definicións de tipos e tamén un diálogo de peticións. http://ctags.sourceforge.net/
+Comment[hu]=A CTags egy többféle nyelvet is támogató forrásnavigációs eszköz. Lehetővé teszi felbukkanó menüből típusdeklarációk és -megvalósítások keresését, lekérdezését. http://ctags.sourceforge.net/
+Comment[it]=CTags è uno strumento per la navigazione nel codice sorgente con supporto per molti linguaggi. Quando caricato offre un menu contestuale per ricercare i tipi di dichiarazioni/definizioni e anche una finestra per compiere interrogazioni. http://ctags.sourceforge.net/
+Comment[ja]=CTags は色々な言語をサポートしたソースナビゲーションツールです。読み込まれると、型の宣言や定義を見つけたり、ツールメニューの中で対話的な問い合わせを行うコンテキストメニューを提供します。http://ctags.sourceforge.net/
+Comment[ms]=CTags adalah alatan pengemudi sumber dengan sokongan untuk banyak bahasa. Apabila dimuatkan ia menyediakan menu konteks untuk mencari pengisytiharan/definisi dan juga dialog pertanyaan. http://ctags.sourceforge.net/
+Comment[nds]=CTags is en Navigatschoonwarktüüch, wat vele Spraken ünnerstütt. Wenn dat laadt is, stellt dat en Rechtsklickmenü för't Söken na Typ-Deklaratschonen un -Definitschonen praat, un ok noch en Affraagdialoog. http://ctags.sourceforge.net/
+Comment[ne]=CTags स्रोत नेभिगेसन उपकरण हो जसले धेरै भाषा समर्थन गर्दछ । लोड गरेपछि यसले टाइप घोषणा/परिभाषा र क्वेरी संवाद पनि फेला पार्नका लागि प्रसङ्ग मेनु प्रदान गर्दछ । http://ctags.sourceforge.net/
+Comment[nl]=CTags is een krachtige tool voor het navigeren in broncode met ondersteuning voor veel talen. Wanneer de plugin geladen is biedt deze een contextmenu voor het vinden van typedeclaraties, en ook een ondervragingsdialoog. Web: http://ctags.sourceforge.net/
+Comment[pl]=CTags to narzędzie do nawigacji w kodzie źródłowym obsługujące wiele języków. Po wczytaniu udostępnia menu kontekstowe pozwalające znajdować deklaracje/definicje oraz okno dialogowe w menu Narzędzia. http://ctags.sourceforge.net/
+Comment[pt]=O CTags é uma ferramenta de navegação no código com suporte para várias linguagens. Quando é carregado, oferece um menu de contexto para encontrar as declarações/definições de tipos, assim como uma janela de pesquisa. http://ctags.sourceforge.net/
+Comment[pt_BR]=CTags é uma ferramenta de navegação de código com suporte para muitas linguagens. Quando carregada ela oferece um menu de contexto para encontrar declarações/definições de tipo e também um diálogo de consulta no menu Ferramentas. http://ctags.sourceforge.net/
+Comment[ru]=CTags - это средство навигации по коду, поддерживающее многие языки. Будучи загружено, оно предоставляет контекстное меню для нахождения описания и определения типа выбранного символа, а также диалог запроса. http://ctags.sourceforge.net/
+Comment[sk]=CTags je navigačný nástroj pre zdrojový kód pre veľa jazykov.Po načítaní poskytuje kontextové menu pre hľadanie deklarácie/definície a tiež vyhľadávací dialóg. http://ctags.sourceforge.net/
+Comment[sr]=CTags је алат за навигацију кроз изворни кôд са подршком за многе језике. Када је учитан, обезбеђује контекстни мени за проналажење декларација/дефиниција типова, а такође и дијалог за упите. http://ctags.sourceforge.net/
+Comment[sr@Latn]=CTags je alat za navigaciju kroz izvorni kôd sa podrškom za mnoge jezike. Kada je učitan, obezbeđuje kontekstni meni za pronalaženje deklaracija/definicija tipova, a takođe i dijalog za upite. http://ctags.sourceforge.net/
+Comment[sv]=Ctags är ett verktyg för källkodsnavigering med stöd för många språk. När det laddats tillhandahåller det en sammanhangsberoende meny för att hitta typdeklarationer eller definitioner, och dessutom en frågedialogruta. http://ctags.sourceforge.net/
+Comment[ta]=Cதத்தல்கள் இது ஒரு மூல வழி செலுத்தும் கருவி இது நிறைய மொழிகளை ஆதரிக்கும். ஏற்றும் பொழுது எழுத்து உருவை காண உதவும் ஒரு பட்டியலும் மற்றும் கருவிப்பட்டியலில் கேள்வி உரையாடல்களும் இது அளிக்கும்.http://ctags.sourceforge.net/
+Comment[tg]=CTags-ин воситаи навигадсия дар код мебошад, ки бисёр забонҳоро дастрасӣ менамояд. Ҳангоми пурбор намудан, вай менюи қаринагинро пешниҳод менамояд, барои ёфтани тасвир ва муаян сохтани намуди нишонаҳои интихоб карда шуда ва боз гуфтугӯи дархостро мегузорад. http://ctags.sourceforge.net/
+Comment[tr]=CTags birçok dili destekleyen bir kaynak dolaşım aracıdır. Yüklendiğinde tip tanımlamalarını bulmayı sağlayan bir bağlam menüsü ve bir sorgu penceresi sunar.
+Comment[zh_CN]=CTags 是一个支持多种语言源文件浏览的工具。启动后在上下文菜单中提供查找类型的声明/定义,并在工具菜单中提供查询对话框。http://ctags.sourceforge.net/
+Comment[zh_TW]=CTags 是支援許多種語言的程式源碼導覽工具。它載入後會提供一個選單,尋找型態的宣告、定義,並提供一個查詢對話框。http://ctags.sourceforge.net/
+Name=KDevCTags2
+Name[da]=KDevelop CTags2
+Name[nds]=KDevelop-CTags2
+Name[sk]=KDev CTags2
+Name[sv]=KDevelop ctags-2
+Name[tg]=KDevCТегҳо2
+Name[zh_TW]=KDevelop CTags2
+GenericName=CTags Frontend
+GenericName[ca]=Entorn per a CTags
+GenericName[da]=CTags-grænseflade
+GenericName[de]=Unterstützung für CTags
+GenericName[el]=Πρόγραμμα CTags
+GenericName[es]=Entorno de CTags
+GenericName[et]=CTagsi kasutajaliides
+GenericName[eu]=CTags interfazea
+GenericName[fa]=پایانۀ CTags
+GenericName[fr]=Interface pour CTags
+GenericName[ga]=Comhéadan CTags
+GenericName[gl]=Frontal para CTags
+GenericName[hi]=सी-टैग्स-फ्रन्टएन्ड
+GenericName[hu]=CTags-kezelő
+GenericName[it]=Interfaccia a CTags
+GenericName[ja]=CTags フロントエンド
+GenericName[ms]=Antaradepan CTags
+GenericName[nds]=CTags-Böversiet
+GenericName[ne]=CTags फ्रेन्टइन्ड
+GenericName[nl]=Frontend voor CTags
+GenericName[pl]=Interfejs do CTags
+GenericName[pt]=Interface de CTags
+GenericName[pt_BR]=Interface do CTags
+GenericName[ru]=Интерфейс к CTags
+GenericName[sk]=CTags rozhranie
+GenericName[sl]=Vmesnik za CTags
+GenericName[sr]=Интерфејс CTags-а
+GenericName[sr@Latn]=Interfejs CTags-a
+GenericName[sv]=Ctags-gränssnitt
+GenericName[ta]=CTags முன்பகுதி
+GenericName[tg]=Интерфейс дар CTags
+GenericName[tr]=CTags Önucu
+GenericName[zh_CN]=CTags前端
+GenericName[zh_TW]=CTags 前端介面
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Project
+X-KDE-Library=libkdevctags2
+X-KDevelop-Version=5
+X-KDevelop-Properties=CodeNavigation
diff --git a/parts/ctags2/kdevpart_ctags2.rc b/parts/ctags2/kdevpart_ctags2.rc
new file mode 100644
index 00000000..e8745b3b
--- /dev/null
+++ b/parts/ctags2/kdevpart_ctags2.rc
@@ -0,0 +1,12 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="ctags" library="libkdevctags2" version="3">
+ <MenuBar>
+ </MenuBar>
+ <Menu name="hidden">
+ <Action name="ctags_lookup_shortcut"/>
+ <Action name="ctags_declaration_shortcut"/>
+ <Action name="ctags_definition_shortcut"/>
+ <Action name="ctags_jump_to_next"/>
+ <Action name="ctags_input_shortcut"/>
+ </Menu>
+</kpartplugin>
diff --git a/parts/ctags2/readtags.c b/parts/ctags2/readtags.c
new file mode 100644
index 00000000..38014d3f
--- /dev/null
+++ b/parts/ctags2/readtags.c
@@ -0,0 +1,960 @@
+/*
+*
+* Copyright (c) 1996-2003, Darren Hiebert
+*
+* This source code is released into the public domain.
+*
+* This module contains functions for reading tag files.
+*/
+
+/*
+* INCLUDE FILES
+*/
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h> /* to declare off_t */
+
+#include "readtags.h"
+
+/*
+* MACROS
+*/
+#define TAB '\t'
+
+
+/*
+* DATA DECLARATIONS
+*/
+typedef struct {
+ size_t size;
+ char *buffer;
+} vstring;
+
+/* Information about current tag file */
+struct sTagFile {
+ /* has the file been opened and this structure initialized? */
+ short initialized;
+ /* format of tag file */
+ short format;
+ /* how is the tag file sorted? */
+ sortType sortMethod;
+ /* pointer to file structure */
+ FILE* fp;
+ /* file position of first character of `line' */
+ off_t pos;
+ /* size of tag file in seekable positions */
+ off_t size;
+ /* last line read */
+ vstring line;
+ /* name of tag in last line read */
+ vstring name;
+ /* defines tag search state */
+ struct {
+ /* file position of last match for tag */
+ off_t pos;
+ /* name of tag last searched for */
+ const char *name;
+ /* length of name for partial matches */
+ size_t nameLength;
+ /* peforming partial match */
+ short partial;
+ /* ignoring case */
+ short ignorecase;
+ } search;
+ /* miscellaneous extension fields */
+ struct {
+ /* number of entries in `list' */
+ unsigned short max;
+ /* list of key value pairs */
+ tagExtensionField *list;
+ } fields;
+ /* buffers to be freed at close */
+ struct {
+ /* name of program author */
+ char *author;
+ /* name of program */
+ char *name;
+ /* URL of distribution */
+ char *url;
+ /* program version */
+ char *version;
+ } program;
+};
+
+/*
+* DATA DEFINITIONS
+*/
+const char *const EmptyString = "";
+const char *const PseudoTagPrefix = "!_";
+
+/*
+* FUNCTION DEFINITIONS
+*/
+
+/*
+ * Compare two strings, ignoring case.
+ * Return 0 for match, < 0 for smaller, > 0 for bigger
+ * Make sure case is folded to uppercase in comparison (like for 'sort -f')
+ * This makes a difference when one of the chars lies between upper and lower
+ * ie. one of the chars [ \ ] ^ _ ` for ascii. (The '_' in particular !)
+ */
+static int struppercmp (const char *s1, const char *s2)
+{
+ int result;
+ do
+ {
+ result = toupper ((int) *s1) - toupper ((int) *s2);
+ } while (result == 0 && *s1++ != '\0' && *s2++ != '\0');
+ return result;
+}
+
+static int strnuppercmp (const char *s1, const char *s2, size_t n)
+{
+ int result;
+ do
+ {
+ result = toupper ((int) *s1) - toupper ((int) *s2);
+ } while (result == 0 && --n > 0 && *s1++ != '\0' && *s2++ != '\0');
+ return result;
+}
+
+static int growString (vstring *s)
+{
+ int result = 0;
+ size_t newLength;
+ char *newLine;
+ if (s->size == 0)
+ {
+ newLength = 128;
+ newLine = (char*) malloc (newLength);
+ *newLine = '\0';
+ }
+ else
+ {
+ newLength = 2 * s->size;
+ newLine = (char*) realloc (s->buffer, newLength);
+ }
+ if (newLine == NULL)
+ perror ("string too large");
+ else
+ {
+ s->buffer = newLine;
+ s->size = newLength;
+ result = 1;
+ }
+ return result;
+}
+
+/* Copy name of tag out of tag line */
+static void copyName (tagFile *const file)
+{
+ size_t length;
+ const char *end = strchr (file->line.buffer, '\t');
+ if (end == NULL)
+ {
+ end = strchr (file->line.buffer, '\n');
+ if (end == NULL)
+ end = strchr (file->line.buffer, '\r');
+ }
+ if (end != NULL)
+ length = end - file->line.buffer;
+ else
+ length = strlen (file->line.buffer);
+ while (length >= file->name.size)
+ growString (&file->name);
+ strncpy (file->name.buffer, file->line.buffer, length);
+ file->name.buffer [length] = '\0';
+}
+
+static int readTagLineRaw (tagFile *const file)
+{
+ int result = 1;
+ int reReadLine;
+
+ /* If reading the line places any character other than a null or a
+ * newline at the last character position in the buffer (one less than
+ * the buffer size), then we must resize the buffer and reattempt to read
+ * the line.
+ */
+ do
+ {
+ char *const pLastChar = file->line.buffer + file->line.size - 2;
+ char *line;
+
+ file->pos = ftell (file->fp);
+ reReadLine = 0;
+ *pLastChar = '\0';
+ line = fgets (file->line.buffer, (int) file->line.size, file->fp);
+ if (line == NULL)
+ {
+ /* read error */
+ if (! feof (file->fp))
+ perror ("readTagLine");
+ result = 0;
+ }
+ else if (*pLastChar != '\0' &&
+ *pLastChar != '\n' && *pLastChar != '\r')
+ {
+ /* buffer overflow */
+ growString (&file->line);
+ fseek (file->fp, file->pos, SEEK_SET);
+ reReadLine = 1;
+ }
+ else
+ {
+ size_t i = strlen (file->line.buffer);
+ while (i > 0 &&
+ (file->line.buffer [i - 1] == '\n' || file->line.buffer [i - 1] == '\r'))
+ {
+ file->line.buffer [i - 1] = '\0';
+ --i;
+ }
+ }
+ } while (reReadLine && result);
+ if (result)
+ copyName (file);
+ return result;
+}
+
+static int readTagLine (tagFile *const file)
+{
+ int result;
+ do
+ {
+ result = readTagLineRaw (file);
+ } while (result && *file->name.buffer == '\0');
+ return result;
+}
+
+static tagResult growFields (tagFile *const file)
+{
+ tagResult result = TagFailure;
+ unsigned short newCount = 2 * file->fields.max;
+ tagExtensionField *newFields = (tagExtensionField*)
+ realloc (file->fields.list, newCount * sizeof (tagExtensionField));
+ if (newFields == NULL)
+ perror ("too many extension fields");
+ else
+ {
+ file->fields.list = newFields;
+ file->fields.max = newCount;
+ result = TagSuccess;
+ }
+ return result;
+}
+
+static void parseExtensionFields (tagFile *const file, tagEntry *const entry,
+ char *const string)
+{
+ char *p = string;
+ while (p != NULL && *p != '\0')
+ {
+ while (*p == TAB)
+ *p++ = '\0';
+ if (*p != '\0')
+ {
+ char *colon;
+ char *field = p;
+ p = strchr (p, TAB);
+ if (p != NULL)
+ *p++ = '\0';
+ colon = strchr (field, ':');
+ if (colon == NULL)
+ entry->kind = field;
+ else
+ {
+ const char *key = field;
+ const char *value = colon + 1;
+ *colon = '\0';
+ if (strcmp (key, "kind") == 0)
+ entry->kind = value;
+ else if (strcmp (key, "file") == 0)
+ entry->fileScope = 1;
+ else if (strcmp (key, "line") == 0)
+ entry->address.lineNumber = atol (value);
+ else
+ {
+ if (entry->fields.count == file->fields.max)
+ growFields (file);
+ file->fields.list [entry->fields.count].key = key;
+ file->fields.list [entry->fields.count].value = value;
+ ++entry->fields.count;
+ }
+ }
+ }
+ }
+}
+
+static void parseTagLine (tagFile *file, tagEntry *const entry)
+{
+ int i;
+ char *p = file->line.buffer;
+ char *tab = strchr (p, TAB);
+ int fieldsPresent = 0;
+
+ entry->fields.list = NULL;
+ entry->fields.count = 0;
+ entry->kind = NULL;
+ entry->fileScope = 0;
+
+ entry->name = p;
+ if (tab != NULL)
+ {
+ *tab = '\0';
+ p = tab + 1;
+ entry->file = p;
+ tab = strchr (p, TAB);
+ if (tab != NULL)
+ {
+ *tab = '\0';
+ p = tab + 1;
+ if (*p == '/' || *p == '?')
+ {
+ /* parse pattern */
+ int delimiter = *(unsigned char*) p;
+ entry->address.lineNumber = 0;
+ entry->address.pattern = p;
+ do
+ {
+ p = strchr (p + 1, delimiter);
+ } while (p != NULL && *(p - 1) == '\\');
+ if (p == NULL)
+ {
+ /* invalid pattern */
+ }
+ else
+ ++p;
+ }
+ else if (isdigit ((int) *(unsigned char*) p))
+ {
+ /* parse line number */
+ entry->address.pattern = p;
+ entry->address.lineNumber = atol (p);
+ while (isdigit ((int) *(unsigned char*) p))
+ ++p;
+ }
+ else
+ {
+ /* invalid pattern */
+ }
+ if ( p != NULL )
+ {
+ fieldsPresent = (strncmp (p, ";\"", 2) == 0);
+ *p = '\0';
+ if (fieldsPresent)
+ parseExtensionFields (file, entry, p + 2);
+ }
+ }
+ }
+ if (entry->fields.count > 0)
+ entry->fields.list = file->fields.list;
+ for (i = entry->fields.count ; i < file->fields.max ; ++i)
+ {
+ file->fields.list [i].key = NULL;
+ file->fields.list [i].value = NULL;
+ }
+}
+
+static char *duplicate (const char *str)
+{
+ char *result = NULL;
+ if (str != NULL)
+ {
+ result = (char*) malloc (strlen (str) + 1);
+ if (result == NULL)
+ perror (NULL);
+ else
+ strcpy (result, str);
+ }
+ return result;
+}
+
+static void readPseudoTags (tagFile *const file, tagFileInfo *const info)
+{
+ fpos_t startOfLine;
+ const size_t prefixLength = strlen (PseudoTagPrefix);
+ if (info != NULL)
+ {
+ info->file.format = 1;
+ info->file.sort = TAG_UNSORTED;
+ info->program.author = NULL;
+ info->program.name = NULL;
+ info->program.url = NULL;
+ info->program.version = NULL;
+ }
+ while (1)
+ {
+ fgetpos (file->fp, &startOfLine);
+ if (! readTagLine (file))
+ break;
+ if (strncmp (file->line.buffer, PseudoTagPrefix, prefixLength) != 0)
+ break;
+ else
+ {
+ tagEntry entry;
+ const char *key, *value;
+ parseTagLine (file, &entry);
+ key = entry.name + prefixLength;
+ value = entry.file;
+ if (strcmp (key, "TAG_FILE_SORTED") == 0)
+ file->sortMethod = (sortType) atoi (value);
+ else if (strcmp (key, "TAG_FILE_FORMAT") == 0)
+ file->format = atoi (value);
+ else if (strcmp (key, "TAG_PROGRAM_AUTHOR") == 0)
+ file->program.author = duplicate (value);
+ else if (strcmp (key, "TAG_PROGRAM_NAME") == 0)
+ file->program.name = duplicate (value);
+ else if (strcmp (key, "TAG_PROGRAM_URL") == 0)
+ file->program.url = duplicate (value);
+ else if (strcmp (key, "TAG_PROGRAM_VERSION") == 0)
+ file->program.version = duplicate (value);
+ if (info != NULL)
+ {
+ info->file.format = file->format;
+ info->file.sort = file->sortMethod;
+ info->program.author = file->program.author;
+ info->program.name = file->program.name;
+ info->program.url = file->program.url;
+ info->program.version = file->program.version;
+ }
+ }
+ }
+ fsetpos (file->fp, &startOfLine);
+}
+
+static void gotoFirstLogicalTag (tagFile *const file)
+{
+ fpos_t startOfLine;
+ const size_t prefixLength = strlen (PseudoTagPrefix);
+ rewind (file->fp);
+ while (1)
+ {
+ fgetpos (file->fp, &startOfLine);
+ if (! readTagLine (file))
+ break;
+ if (strncmp (file->line.buffer, PseudoTagPrefix, prefixLength) != 0)
+ break;
+ }
+ fsetpos (file->fp, &startOfLine);
+}
+
+static tagFile *initialize (const char *const filePath, tagFileInfo *const info)
+{
+ tagFile *result = (tagFile*) malloc (sizeof (tagFile));
+ if (result != NULL)
+ {
+ memset (result, 0, sizeof (tagFile));
+ growString (&result->line);
+ growString (&result->name);
+ result->fields.max = 20;
+ result->fields.list = (tagExtensionField*) malloc (
+ result->fields.max * sizeof (tagExtensionField));
+ result->fp = fopen (filePath, "r");
+ if (result->fp == NULL)
+ {
+ free (result);
+ result = NULL;
+ info->status.error_number = errno;
+ }
+ else
+ {
+ fseek (result->fp, 0, SEEK_END);
+ result->size = ftell (result->fp);
+ rewind (result->fp);
+ readPseudoTags (result, info);
+ info->status.opened = 1;
+ result->initialized = 1;
+ }
+ }
+ return result;
+}
+
+static void terminate (tagFile *const file)
+{
+ fclose (file->fp);
+
+ free (file->line.buffer);
+ free (file->name.buffer);
+ free (file->fields.list);
+
+ if (file->program.author != NULL)
+ free (file->program.author);
+ if (file->program.name != NULL)
+ free (file->program.name);
+ if (file->program.url != NULL)
+ free (file->program.url);
+ if (file->program.version != NULL)
+ free (file->program.version);
+
+ memset (file, 0, sizeof (tagFile));
+
+ free (file);
+}
+
+static tagResult readNext (tagFile *const file, tagEntry *const entry)
+{
+ tagResult result = TagFailure;
+ if (file == NULL || ! file->initialized)
+ result = TagFailure;
+ else if (! readTagLine (file))
+ result = TagFailure;
+ else
+ {
+ if (entry != NULL)
+ parseTagLine (file, entry);
+ result = TagSuccess;
+ }
+ return result;
+}
+
+static const char *readFieldValue (
+ const tagEntry *const entry, const char *const key)
+{
+ const char *result = NULL;
+ int i;
+ if (strcmp (key, "kind") == 0)
+ result = entry->kind;
+ else if (strcmp (key, "file") == 0)
+ result = EmptyString;
+ else for (i = 0 ; i < entry->fields.count && result == NULL ; ++i)
+ if (strcmp (entry->fields.list [i].key, key) == 0)
+ result = entry->fields.list [i].value;
+ return result;
+}
+
+static int readTagLineSeek (tagFile *const file, const off_t pos)
+{
+ int result = 0;
+ if (fseek (file->fp, pos, SEEK_SET) == 0)
+ {
+ result = readTagLine (file); /* read probable partial line */
+ if (pos > 0 && result)
+ result = readTagLine (file); /* read complete line */
+ }
+ return result;
+}
+
+static int nameComparison (tagFile *const file)
+{
+ int result;
+ if (file->search.ignorecase)
+ {
+ if (file->search.partial)
+ result = strnuppercmp (file->search.name, file->name.buffer,
+ file->search.nameLength);
+ else
+ result = struppercmp (file->search.name, file->name.buffer);
+ }
+ else
+ {
+ if (file->search.partial)
+ result = strncmp (file->search.name, file->name.buffer,
+ file->search.nameLength);
+ else
+ result = strcmp (file->search.name, file->name.buffer);
+ }
+ return result;
+}
+
+static void findFirstNonMatchBefore (tagFile *const file)
+{
+#define JUMP_BACK 512
+ int more_lines;
+ int comp;
+ off_t start = file->pos;
+ off_t pos = start;
+ do
+ {
+ if (pos < (off_t) JUMP_BACK)
+ pos = 0;
+ else
+ pos = pos - JUMP_BACK;
+ more_lines = readTagLineSeek (file, pos);
+ comp = nameComparison (file);
+ } while (more_lines && comp == 0 && pos > 0 && pos < start);
+}
+
+static tagResult findFirstMatchBefore (tagFile *const file)
+{
+ tagResult result = TagFailure;
+ int more_lines;
+ off_t start = file->pos;
+ findFirstNonMatchBefore (file);
+ do
+ {
+ more_lines = readTagLine (file);
+ if (nameComparison (file) == 0)
+ result = TagSuccess;
+ } while (more_lines && result != TagSuccess && file->pos < start);
+ return result;
+}
+
+static tagResult findBinary (tagFile *const file)
+{
+ tagResult result = TagFailure;
+ off_t lower_limit = 0;
+ off_t upper_limit = file->size;
+ off_t last_pos = 0;
+ off_t pos = upper_limit / 2;
+ while (result != TagSuccess)
+ {
+ if (! readTagLineSeek (file, pos))
+ {
+ /* in case we fell off end of file */
+ result = findFirstMatchBefore (file);
+ break;
+ }
+ else if (pos == last_pos)
+ {
+ /* prevent infinite loop if we backed up to beginning of file */
+ break;
+ }
+ else
+ {
+ const int comp = nameComparison (file);
+ last_pos = pos;
+ if (comp < 0)
+ {
+ upper_limit = pos;
+ pos = lower_limit + ((upper_limit - lower_limit) / 2);
+ }
+ else if (comp > 0)
+ {
+ lower_limit = pos;
+ pos = lower_limit + ((upper_limit - lower_limit) / 2);
+ }
+ else if (pos == 0)
+ result = TagSuccess;
+ else
+ result = findFirstMatchBefore (file);
+ }
+ }
+ return result;
+}
+
+static tagResult findSequential (tagFile *const file)
+{
+ tagResult result = TagFailure;
+ if (file->initialized)
+ {
+ while (result == TagFailure && readTagLine (file))
+ {
+ if (nameComparison (file) == 0)
+ result = TagSuccess;
+ }
+ }
+ return result;
+}
+
+static tagResult find (tagFile *const file, tagEntry *const entry,
+ const char *const name, const int options)
+{
+ tagResult result = TagFailure;
+ file->search.name = name;
+ file->search.nameLength = strlen (name);
+ file->search.partial = (options & TAG_PARTIALMATCH) != 0;
+ file->search.ignorecase = (options & TAG_IGNORECASE) != 0;
+ fseek (file->fp, 0, SEEK_END);
+ file->size = ftell (file->fp);
+ rewind (file->fp);
+ if ((file->sortMethod == TAG_SORTED && !file->search.ignorecase) ||
+ (file->sortMethod == TAG_FOLDSORTED && file->search.ignorecase))
+ {
+#ifdef DEBUG
+ printf ("<performing binary search>\n");
+#endif
+ result = findBinary (file);
+ }
+ else
+ {
+#ifdef DEBUG
+ printf ("<performing sequential search>\n");
+#endif
+ result = findSequential (file);
+ }
+
+ if (result != TagSuccess)
+ file->search.pos = file->size;
+ else
+ {
+ file->search.pos = file->pos;
+ if (entry != NULL)
+ parseTagLine (file, entry);
+ }
+ return result;
+}
+
+static tagResult findNext (tagFile *const file, tagEntry *const entry)
+{
+ tagResult result = TagFailure;
+ if ((file->sortMethod == TAG_SORTED && !file->search.ignorecase) ||
+ (file->sortMethod == TAG_FOLDSORTED && file->search.ignorecase))
+ {
+ result = tagsNext (file, entry);
+ if (result == TagSuccess && nameComparison (file) != 0)
+ result = TagFailure;
+ }
+ else
+ {
+ result = findSequential (file);
+ if (result == TagSuccess && entry != NULL)
+ parseTagLine (file, entry);
+ }
+ return result;
+}
+
+/*
+* EXTERNAL INTERFACE
+*/
+
+extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info)
+{
+ return initialize (filePath, info);
+}
+
+extern tagResult tagsSetSortType (tagFile *const file, const sortType type)
+{
+ tagResult result = TagFailure;
+ if (file != NULL && file->initialized)
+ {
+ file->sortMethod = type;
+ result = TagSuccess;
+ }
+ return result;
+}
+
+extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
+{
+ tagResult result = TagFailure;
+ if (file != NULL && file->initialized)
+ {
+ gotoFirstLogicalTag (file);
+ result = readNext (file, entry);
+ }
+ return result;
+}
+
+extern tagResult tagsNext (tagFile *const file, tagEntry *const entry)
+{
+ tagResult result = TagFailure;
+ if (file != NULL && file->initialized)
+ result = readNext (file, entry);
+ return result;
+}
+
+extern const char *tagsField (const tagEntry *const entry, const char *const key)
+{
+ const char *result = NULL;
+ if (entry != NULL)
+ result = readFieldValue (entry, key);
+ return result;
+}
+
+extern tagResult tagsFind (tagFile *const file, tagEntry *const entry,
+ const char *const name, const int options)
+{
+ tagResult result = TagFailure;
+ if (file != NULL && file->initialized)
+ result = find (file, entry, name, options);
+ return result;
+}
+
+extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry)
+{
+ tagResult result = TagFailure;
+ if (file != NULL && file->initialized)
+ result = findNext (file, entry);
+ return result;
+}
+
+extern tagResult tagsClose (tagFile *const file)
+{
+ tagResult result = TagFailure;
+ if (file != NULL && file->initialized)
+ {
+ terminate (file);
+ result = TagSuccess;
+ }
+ return result;
+}
+
+/*
+* TEST FRAMEWORK
+*/
+
+#ifdef READTAGS_MAIN
+
+static const char *TagFileName = "tags";
+static const char *ProgramName;
+static int extensionFields;
+static int SortOverride;
+static sortType SortMethod;
+
+static void printTag (const tagEntry *entry)
+{
+ int i;
+ int first = 1;
+ const char* separator = ";\"";
+ const char* const empty = "";
+/* "sep" returns a value only the first time it is evaluated */
+#define sep (first ? (first = 0, separator) : empty)
+ printf ("%s\t%s\t%s",
+ entry->name, entry->file, entry->address.pattern);
+ if (extensionFields)
+ {
+ if (entry->kind != NULL && entry->kind [0] != '\0')
+ printf ("%s\tkind:%s", sep, entry->kind);
+ if (entry->fileScope)
+ printf ("%s\tfile:", sep);
+#if 0
+ if (entry->address.lineNumber > 0)
+ printf ("%s\tline:%lu", sep, entry->address.lineNumber);
+#endif
+ for (i = 0 ; i < entry->fields.count ; ++i)
+ printf ("%s\t%s:%s", sep, entry->fields.list [i].key,
+ entry->fields.list [i].value);
+ }
+ putchar ('\n');
+#undef sep
+}
+
+static void findTag (const char *const name, const int options)
+{
+ tagFileInfo info;
+ tagEntry entry;
+ tagFile *const file = tagsOpen (TagFileName, &info);
+ if (file == NULL)
+ {
+ fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
+ ProgramName, strerror (info.status.error_number), name);
+ exit (1);
+ }
+ else
+ {
+ if (SortOverride)
+ tagsSetSortType (file, SortMethod);
+ if (tagsFind (file, &entry, name, options) == TagSuccess)
+ {
+ do
+ {
+ printTag (&entry);
+ } while (tagsFindNext (file, &entry) == TagSuccess);
+ }
+ tagsClose (file);
+ }
+}
+
+static void listTags (void)
+{
+ tagFileInfo info;
+ tagEntry entry;
+ tagFile *const file = tagsOpen (TagFileName, &info);
+ if (file == NULL)
+ {
+ fprintf (stderr, "%s: cannot open tag file: %s: %s\n",
+ ProgramName, strerror (info.status.error_number), TagFileName);
+ exit (1);
+ }
+ else
+ {
+ while (tagsNext (file, &entry) == TagSuccess)
+ printTag (&entry);
+ tagsClose (file);
+ }
+}
+
+const char *const Usage =
+ "Find tag file entries matching specified names.\n\n"
+ "Usage: %s [-ilp] [-s[0|1]] [-t file] [name(s)]\n\n"
+ "Options:\n"
+ " -e Include extension fields in output.\n"
+ " -i Perform case-insensitive matching.\n"
+ " -l List all tags.\n"
+ " -p Perform partial matching.\n"
+ " -s[0|1|2] Override sort detection of tag file.\n"
+ " -t file Use specified tag file (default: \"tags\").\n"
+ "Note that options are acted upon as encountered, so order is significant.\n";
+
+extern int main (int argc, char **argv)
+{
+ int options = 0;
+ int actionSupplied = 0;
+ int i;
+ ProgramName = argv [0];
+ if (argc == 1)
+ {
+ fprintf (stderr, Usage, ProgramName);
+ exit (1);
+ }
+ for (i = 1 ; i < argc ; ++i)
+ {
+ const char *const arg = argv [i];
+ if (arg [0] != '-')
+ {
+ findTag (arg, options);
+ actionSupplied = 1;
+ }
+ else
+ {
+ size_t j;
+ for (j = 1 ; arg [j] != '\0' ; ++j)
+ {
+ switch (arg [j])
+ {
+ case 'e': extensionFields = 1; break;
+ case 'i': options |= TAG_IGNORECASE; break;
+ case 'p': options |= TAG_PARTIALMATCH; break;
+ case 'l': listTags (); actionSupplied = 1; break;
+
+ case 't':
+ if (arg [j+1] != '\0')
+ {
+ TagFileName = arg + j + 1;
+ j += strlen (TagFileName);
+ }
+ else if (i + 1 < argc)
+ TagFileName = argv [++i];
+ else
+ {
+ fprintf (stderr, Usage, ProgramName);
+ exit (1);
+ }
+ break;
+ case 's':
+ SortOverride = 1;
+ ++j;
+ if (arg [j] == '\0')
+ SortMethod = TAG_SORTED;
+ else if (strchr ("012", arg[j]) != NULL)
+ SortMethod = (sortType) (arg[j] - '0');
+ else
+ {
+ fprintf (stderr, Usage, ProgramName);
+ exit (1);
+ }
+ break;
+ default:
+ fprintf (stderr, "%s: unknown option: %c\n",
+ ProgramName, arg[j]);
+ exit (1);
+ break;
+ }
+ }
+ }
+ }
+ if (! actionSupplied)
+ {
+ fprintf (stderr,
+ "%s: no action specified: specify tag name(s) or -l option\n",
+ ProgramName);
+ exit (1);
+ }
+ return 0;
+}
+
+#endif
+
+/* vi:set tabstop=8 shiftwidth=4: */
diff --git a/parts/ctags2/readtags.h b/parts/ctags2/readtags.h
new file mode 100644
index 00000000..4d4228fc
--- /dev/null
+++ b/parts/ctags2/readtags.h
@@ -0,0 +1,251 @@
+/*
+*
+* Copyright (c) 1996-2003, Darren Hiebert
+*
+* This source code is released for the public domain.
+*
+* This file defines the public interface for looking up tag entries in tag
+* files.
+*
+* The functions defined in this interface are intended to provide tag file
+* support to a software tool. The tag lookups provided are sufficiently fast
+* enough to permit opening a sorted tag file, searching for a matching tag,
+* then closing the tag file each time a tag is looked up (search times are
+* on the order of hundreths of a second, even for huge tag files). This is
+* the recommended use of this library for most tool applications. Adhering
+* to this approach permits a user to regenerate a tag file at will without
+* the tool needing to detect and resynchronize with changes to the tag file.
+* Even for an unsorted 24MB tag file, tag searches take about one second.
+*/
+#ifndef READTAGS_H
+#define READTAGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+* MACROS
+*/
+
+/* Options for tagsSetSortType() */
+typedef enum {
+ TAG_UNSORTED, TAG_SORTED, TAG_FOLDSORTED
+} sortType ;
+
+/* Options for tagsFind() */
+#define TAG_FULLMATCH 0x0
+#define TAG_PARTIALMATCH 0x1
+
+#define TAG_OBSERVECASE 0x0
+#define TAG_IGNORECASE 0x2
+
+/*
+* DATA DECLARATIONS
+*/
+
+typedef enum { TagFailure = 0, TagSuccess = 1 } tagResult;
+
+struct sTagFile;
+
+typedef struct sTagFile tagFile;
+
+/* This structure contains information about the tag file. */
+typedef struct {
+
+ struct {
+ /* was the tag file successfully opened? */
+ int opened;
+
+ /* errno value when 'opened' is false */
+ int error_number;
+ } status;
+
+ /* information about the structure of the tag file */
+ struct {
+ /* format of tag file (1 = original, 2 = extended) */
+ short format;
+
+ /* how is the tag file sorted? */
+ sortType sort;
+ } file;
+
+
+ /* information about the program which created this tag file */
+ struct {
+ /* name of author of generating program (may be null) */
+ const char *author;
+
+ /* name of program (may be null) */
+ const char *name;
+
+ /* URL of distribution (may be null) */
+ const char *url;
+
+ /* program version (may be null) */
+ const char *version;
+ } program;
+
+} tagFileInfo;
+
+/* This structure contains information about an extension field for a tag.
+ * These exist at the end of the tag in the form "key:value").
+ */
+typedef struct {
+
+ /* the key of the extension field */
+ const char *key;
+
+ /* the value of the extension field (may be an empty string) */
+ const char *value;
+
+} tagExtensionField;
+
+/* This structure contains information about a specific tag. */
+typedef struct {
+
+ /* name of tag */
+ const char *name;
+
+ /* path of source file containing definition of tag */
+ const char *file;
+
+ /* address for locating tag in source file */
+ struct {
+ /* pattern for locating source line
+ * (may be NULL if not present) */
+ const char *pattern;
+
+ /* line number in source file of tag definition
+ * (may be zero if not known) */
+ unsigned long lineNumber;
+ } address;
+
+ /* kind of tag (may by name, character, or NULL if not known) */
+ const char *kind;
+
+ /* is tag of file-limited scope? */
+ short fileScope;
+
+ /* miscellaneous extension fields */
+ struct {
+ /* number of entries in `list' */
+ unsigned short count;
+
+ /* list of key value pairs */
+ tagExtensionField *list;
+ } fields;
+
+} tagEntry;
+
+
+/*
+* FUNCTION PROTOTYPES
+*/
+
+/*
+* This function must be called before calling other functions in this
+* library. It is passed the path to the tag file to read and a (possibly
+* null) pointer to a structure which, if not null, will be populated with
+* information about the tag file. If successful, the function will return a
+* handle which must be supplied to other calls to read information from the
+* tag file, and info.status.opened will be set to true. If unsuccessful,
+* info.status.opened will be set to false and info.status.error_number will
+* be set to the errno value representing the system error preventing the tag
+* file from being successfully opened.
+*/
+extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info);
+
+/*
+* This function allows the client to override the normal automatic detection
+* of how a tag file is sorted. Permissible values for `type' are
+* TAG_UNSORTED, TAG_SORTED, TAG_FOLDSORTED. Tag files in the new extended
+* format contain a key indicating whether or not they are sorted. However,
+* tag files in the original format do not contain such a key even when
+* sorted, preventing this library from taking advantage of fast binary
+* lookups. If the client knows that such an unmarked tag file is indeed
+* sorted (or not), it can override the automatic detection. Note that
+* incorrect lookup results will result if a tag file is marked as sorted when
+* it actually is not. The function will return TagSuccess if called on an
+* open tag file or TagFailure if not.
+*/
+extern tagResult tagsSetSortType (tagFile *const file, const sortType type);
+
+/*
+* Reads the first tag in the file, if any. It is passed the handle to an
+* opened tag file and a (possibly null) pointer to a structure which, if not
+* null, will be populated with information about the first tag file entry.
+* The function will return TagSuccess another tag entry is found, or
+* TagFailure if not (i.e. it reached end of file).
+*/
+extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry);
+
+/*
+* Step to the next tag in the file, if any. It is passed the handle to an
+* opened tag file and a (possibly null) pointer to a structure which, if not
+* null, will be populated with information about the next tag file entry. The
+* function will return TagSuccess another tag entry is found, or TagFailure
+* if not (i.e. it reached end of file). It will always read the first tag in
+* the file immediately after calling tagsOpen().
+*/
+extern tagResult tagsNext (tagFile *const file, tagEntry *const entry);
+
+/*
+* Retrieve the value associated with the extension field for a specified key.
+* It is passed a pointer to a structure already populated with values by a
+* previous call to tagsNext(), tagsFind(), or tagsFindNext(), and a string
+* containing the key of the desired extension field. If no such field of the
+* specified key exists, the function will return null.
+*/
+extern const char *tagsField (const tagEntry *const entry, const char *const key);
+
+/*
+* Find the first tag matching `name'. The structure pointed to by `entry'
+* will be populated with information about the tag file entry. If a tag file
+* is sorted using the C locale, a binary search algorithm is used to search
+* the tag file, resulting in very fast tag lookups, even in huge tag files.
+* Various options controlling the matches can be combined by bit-wise or-ing
+* certain values together. The available values are:
+*
+* TAG_PARTIALMATCH
+* Tags whose leading characters match `name' will qualify.
+*
+* TAG_FULLMATCH
+* Only tags whose full lengths match `name' will qualify.
+*
+* TAG_IGNORECASE
+* Matching will be performed in a case-insenstive manner. Note that
+* this disables binary searches of the tag file.
+*
+* TAG_OBSERVECASE
+* Matching will be performed in a case-senstive manner. Note that
+* this enables binary searches of the tag file.
+*
+* The function will return TagSuccess if a tag matching the name is found, or
+* TagFailure if not.
+*/
+extern tagResult tagsFind (tagFile *const file, tagEntry *const entry, const char *const name, const int options);
+
+/*
+* Find the next tag matching the name and options supplied to the most recent
+* call to tagsFind() for the same tag file. The structure pointed to by
+* `entry' will be populated with information about the tag file entry. The
+* function will return TagSuccess if another tag matching the name is found,
+* or TagFailure if not.
+*/
+extern tagResult tagsFindNext (tagFile *const file, tagEntry *const entry);
+
+/*
+* Call tagsTerminate() at completion of reading the tag file, which will
+* close the file and free any internal memory allocated. The function will
+* return TagFailure is no file is currently open, TagSuccess otherwise.
+*/
+extern tagResult tagsClose (tagFile *const file);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* vi:set tabstop=8 shiftwidth=4: */
diff --git a/parts/ctags2/tagitem.cpp b/parts/ctags2/tagitem.cpp
new file mode 100644
index 00000000..e2ddf158
--- /dev/null
+++ b/parts/ctags2/tagitem.cpp
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "tagitem.h"
+
+TagItem::TagItem( QListView * lv, QString const & tag, QString const & type, QString const & file, QString const & pattern )
+ : QListViewItem( lv ), tag(tag), type(type), file(file), pattern(pattern)
+{}
+
+TagItem::~TagItem()
+{
+}
+
+
+
diff --git a/parts/ctags2/tagitem.h b/parts/ctags2/tagitem.h
new file mode 100644
index 00000000..fddb823d
--- /dev/null
+++ b/parts/ctags2/tagitem.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef TAGITEM_H
+#define TAGITEM_H
+
+#include <qlistview.h>
+
+class TagItem : public QListViewItem
+{
+public:
+ TagItem(QListView * lv, QString const & tag, QString const & type, QString const & file, QString const & pattern );
+ ~TagItem();
+
+ QString tag;
+ QString type;
+ QString file;
+ QString pattern;
+};
+
+#endif
diff --git a/parts/ctags2/tags.cpp b/parts/ctags2/tags.cpp
new file mode 100644
index 00000000..3ba98159
--- /dev/null
+++ b/parts/ctags2/tags.cpp
@@ -0,0 +1,171 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+namespace ctags
+{
+#include "readtags.h"
+}
+
+#include "ctagskinds.h"
+
+#include "tags.h"
+
+QStringList Tags::_tagFiles;
+
+Tags::TagEntry::TagEntry() {}
+
+Tags::TagEntry::TagEntry( const QString & tag, const QString & type, const QString & file, const QString & pattern )
+ : tag(tag), type(type), file(file), pattern(pattern)
+{}
+
+
+bool Tags::hasTag(const QString & tag )
+{
+ QStringList::iterator it;
+ for (it = _tagFiles.begin(); it != _tagFiles.end() ; it++) {
+ if (hasTag((*it).ascii(), tag))
+ return true;
+ }
+
+ return false;
+}
+
+bool Tags::hasTag(const char* tagFile, const QString & tag )
+{
+ ctags::tagFileInfo info;
+ ctags::tagFile * file = ctags::tagsOpen(tagFile, &info );
+ ctags::tagEntry entry;
+
+ bool found = ( ctags::tagsFind( file, &entry, tag.ascii(), TAG_FULLMATCH | TAG_OBSERVECASE ) == ctags::TagSuccess );
+
+ ctags::tagsClose( file );
+
+ return found;
+}
+
+unsigned int Tags::numberOfMatches( const QString & tagpart, bool partial )
+{
+ unsigned int n = 0;
+ QStringList::iterator it;
+ for (it = _tagFiles.begin(); it != _tagFiles.end(); it++)
+ {
+ n += numberOfMatches( (*it).ascii(), tagpart, partial );
+ }
+
+ return n;
+}
+
+unsigned int Tags::numberOfMatches(const char* tagFile, const QString & tagpart, bool partial )
+{
+ unsigned int n = 0;
+
+ if ( tagpart.isEmpty() ) return 0;
+
+ ctags::tagFileInfo info;
+ ctags::tagFile * file = ctags::tagsOpen( tagFile, &info );
+ ctags::tagEntry entry;
+
+ if ( ctags::tagsFind( file, &entry, tagpart.ascii(), TAG_OBSERVECASE | (partial ? TAG_PARTIALMATCH : TAG_FULLMATCH) ) == ctags::TagSuccess )
+ {
+ do
+ {
+ n++;
+ }
+ while ( ctags::tagsFindNext( file, &entry ) == ctags::TagSuccess );
+ }
+
+ ctags::tagsClose( file );
+
+ return n;
+}
+
+
+Tags::TagList Tags::getMatches( const QString & tagpart, bool partial, const QStringList & types )
+{
+ Tags::TagList list;
+
+ // build a compound tag list from all the configured tag files
+ QStringList::iterator it;
+ for ( it = _tagFiles.begin(); it != _tagFiles.end(); it++ )
+ {
+ list += getMatches((*it).ascii(), tagpart, partial, types);
+ }
+
+ return list;
+}
+
+Tags::TagList Tags::getMatches(const char* tagFile, const QString & tagpart, bool partial, const QStringList & types )
+{
+ Tags::TagList list;
+
+ if ( tagpart.isEmpty() ) return list;
+
+ ctags::tagFileInfo info;
+ ctags::tagFile * file = ctags::tagsOpen(tagFile, &info );
+ ctags::tagEntry entry;
+
+ if ( ctags::tagsFind( file, &entry, tagpart.ascii(), TAG_OBSERVECASE | (partial ? TAG_PARTIALMATCH : TAG_FULLMATCH) ) == ctags::TagSuccess )
+ {
+ do
+ {
+ QString type( CTagsKinds::findKind( entry.kind, QString( entry.file ).section( '.', -1 ) ) );
+ QString file( entry.file );
+
+ if ( type.isEmpty() && file.endsWith( "Makefile" ) )
+ {
+ type = "macro";
+ }
+ if ( types.isEmpty() || types.contains( entry.kind ) )
+ {
+ list << TagEntry( QString( entry.name ), type, file, QString( entry.address.pattern ) );
+ }
+ }
+ while ( ctags::tagsFindNext( file, &entry ) == ctags::TagSuccess );
+ }
+
+ ctags::tagsClose( file );
+
+ return list;
+}
+
+void Tags::setTagFiles(const QStringList& tagFiles )
+{
+ _tagFiles = tagFiles;
+}
+
+QStringList Tags::getTagFiles( )
+{
+ return _tagFiles;
+}
+
+unsigned int Tags::numberOfPartialMatches( const QString & tagpart )
+{
+ return numberOfMatches( tagpart, true );
+}
+
+unsigned int Tags::numberOfExactMatches( const QString & tagpart )
+{
+ return numberOfMatches( tagpart, false );
+}
+
+Tags::TagList Tags::getPartialMatches( const QString & tagpart )
+{
+ return getMatches( tagpart, true );
+}
+
+Tags::TagList Tags::getExactMatches( const QString & tag )
+{
+ return getMatches( tag, false );
+}
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
+
+
diff --git a/parts/ctags2/tags.h b/parts/ctags2/tags.h
new file mode 100644
index 00000000..1d7e3604
--- /dev/null
+++ b/parts/ctags2/tags.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef TAGS_H
+#define TAGS_H
+
+#include <qvaluelist.h>
+#include <qcstring.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+class Tags
+{
+public:
+
+ struct TagEntry
+ {
+ TagEntry();
+ TagEntry( const QString & tag, const QString & type, const QString & file, const QString & pattern );
+
+ QString tag;
+ QString type;
+ QString file;
+ QString pattern;
+ };
+
+ typedef QValueList<TagEntry> TagList;
+
+ /**
+ * Method to set the tag database filename
+ * @param file the tag database filename
+ */
+ static void setTagFiles(const QStringList& tagFiles);
+
+ static QStringList getTagFiles();
+
+ /**
+ * Method to check if the tag database contains a specific tag
+ * @param tag Tag to look up
+ * @return returns true if tag database contains 'tag'
+ */
+ static bool hasTag( const QString & tag );
+
+ static unsigned int numberOfPartialMatches( const QString & tagpart );
+ static unsigned int numberOfExactMatches( const QString & tag );
+ static unsigned int numberOfMatches( const QString & tagpart, bool partial );
+
+ static TagList getPartialMatches( const QString & tagpart );
+ static TagList getExactMatches( const QString & tag );
+ static TagList getMatches( const QString & tagpart, bool partial, const QStringList & types = QStringList() );
+
+private:
+ static Tags::TagList getMatches(const char* tagFile,
+ const QString & tagpart,
+ bool partial,
+ const QStringList & types );
+ static unsigned int numberOfMatches(const char* tagFile,
+ const QString & tagpart,
+ bool partial );
+ static bool hasTag(const char* tagFile, const QString & tag );
+ static QStringList _tagFiles;
+};
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/diff/Makefile.am b/parts/diff/Makefile.am
new file mode 100644
index 00000000..300e2deb
--- /dev/null
+++ b/parts/diff/Makefile.am
@@ -0,0 +1,18 @@
+# Here resides the valgrind part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevdiff.la
+libkdevdiff_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevdiff_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevdiff_la_SOURCES = diffpart.cpp diffwidget.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevdiff.desktop
+
+rcdir = $(kde_datadir)/kdevdiff
+rc_DATA = kdevdiff.rc
diff --git a/parts/diff/README b/parts/diff/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/diff/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/diff/README.dox b/parts/diff/README.dox
new file mode 100644
index 00000000..6659ac71
--- /dev/null
+++ b/parts/diff/README.dox
@@ -0,0 +1,20 @@
+/** \class DiffPart
+This DiffPart is an outputview that shows "diffs" between files.
+
+If "kompare" from KDESDK is installed, it'll use
+its widget to display the diff, otherwise
+in a QTextEdit with simple highlighting
+Just right-click on a CVS or Perforce file
+and select "diff to repository" to see it in action.
+
+\authors <a href="mailto:harry AT kdevelop.org">Harald Fernengel</a>
+
+\maintainer <a href="mailto:harry AT kdevelop.org">Harald Fernengel</a>
+
+\feature Shows "diffs" between files
+\feature If "kompare" from KDESDK is installed, it'll use its widget to display the diff otherwise in a QTextEdit with simple highlighting
+\feature Works with all VCS systems supported by KDevelop
+
+\requirement If "kompare" from KDESDK is installed, it'll use its widget to display the diff.
+
+*/
diff --git a/parts/diff/diffdlg.cpp b/parts/diff/diffdlg.cpp
new file mode 100644
index 00000000..049a3d60
--- /dev/null
+++ b/parts/diff/diffdlg.cpp
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Harald Fernengel *
+ * harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+
+#include <klocale.h>
+
+#include "diffdlg.h"
+#include "diffwidget.h"
+
+DiffDlg::DiffDlg( QWidget *parent, const char *name ):
+ KDialogBase( parent, name, true, i18n("Difference Viewer"), Ok )
+{
+ diffWidget = new DiffWidget( this, "Main Diff Widget" );
+ setMainWidget( diffWidget );
+
+ QVBoxLayout* layout = new QVBoxLayout( this, 0, spacingHint() );
+ layout->addWidget( diffWidget );
+}
+
+DiffDlg::~DiffDlg()
+{
+}
+
+void DiffDlg::slotClear()
+{
+ diffWidget->slotClear();
+}
+
+void DiffDlg::setDiff( const QString& diff )
+{
+ diffWidget->setDiff( diff );
+}
+
+void DiffDlg::openURL( const KURL& url )
+{
+ diffWidget->openURL( url );
+}
+
+#include "diffdlg.moc"
diff --git a/parts/diff/diffdlg.h b/parts/diff/diffdlg.h
new file mode 100644
index 00000000..6f47dcf2
--- /dev/null
+++ b/parts/diff/diffdlg.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Harald Fernengel *
+ * harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DIFFDLG_H_
+#define _DIFFDLG_H_
+
+#include <kdialogbase.h>
+#include <kurl.h>
+
+class DiffWidget;
+
+class DiffDlg : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ DiffDlg( QWidget *parent = 0, const char *name = 0 );
+ virtual ~DiffDlg();
+
+public slots:
+ /** The URL has to point to a diff file */
+ void openURL( const KURL& url );
+ /** Pass a diff file in here */
+ void setDiff( const QString& diff );
+ /** clears the difference viewer */
+ void slotClear();
+
+private:
+ DiffWidget* diffWidget;
+
+};
+
+#endif
diff --git a/parts/diff/diffpart.cpp b/parts/diff/diffpart.cpp
new file mode 100644
index 00000000..8f04b060
--- /dev/null
+++ b/parts/diff/diffpart.cpp
@@ -0,0 +1,248 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Harald Fernengel *
+ * harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "diffpart.h"
+
+#include <sys/stat.h>
+
+#include <qwhatsthis.h>
+#include <qpopupmenu.h>
+
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kaction.h>
+#include <kfiledialog.h>
+#include <kprocess.h>
+#include <kio/jobclasses.h>
+#include <kio/job.h>
+#include <kparts/part.h>
+#include <ktexteditor/editinterface.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevpartcontroller.h"
+#include "kdevplugininfo.h"
+
+#include "diffdlg.h"
+#include "diffwidget.h"
+
+static const KDevPluginInfo data("kdevdiff");
+
+typedef KDevGenericFactory<DiffPart> DiffFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevdiff, DiffFactory( data ) )
+
+DiffPart::DiffPart(QObject *parent, const char *name, const QStringList &)
+ : KDevDiffFrontend(&data, parent, name ? name : "DiffPart"), proc(0)
+{
+ setInstance(DiffFactory::instance());
+ setXMLFile("kdevdiff.rc");
+
+ diffWidget = new DiffWidget(this, 0, "diffWidget");
+ diffWidget->setIcon( SmallIcon("editcopy") );
+ QString nm( i18n( "Diff" ) );
+ diffWidget->setCaption( i18n( "Diff Output" ) );
+ QWhatsThis::add(diffWidget, i18n("<b>Difference viewer</b><p>Shows output of the diff format. "
+ "Can utilize every installed component that is able to show diff output. "
+ "For example if you have Kompare installed, Difference Viewer can use its graphical diff view."));
+ mainWindow()->embedOutputView( diffWidget, nm, i18n("Output of the diff command") );
+ mainWindow()->setViewAvailable( diffWidget, false );
+
+ KAction *action = new KAction( i18n("Difference Viewer..."), 0,
+ this, SLOT(slotExecDiff()),
+ actionCollection(), "tools_diff" );
+ action->setToolTip(i18n("Difference viewer"));
+ action->setWhatsThis(i18n("<b>Difference viewer</b><p>Shows the contents of a patch file."));
+
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+}
+
+static bool urlIsEqual(const KURL &a, const KURL &b)
+{
+ if (a.isLocalFile() && b.isLocalFile())
+ {
+ struct stat aStat, bStat;
+
+ if ((::stat(QFile::encodeName(a.fileName()), &aStat) == 0)
+ && (::stat(QFile::encodeName(b.fileName()), &bStat) == 0))
+ {
+ return (aStat.st_dev == bStat.st_dev) && (aStat.st_ino == bStat.st_ino);
+ }
+ }
+
+ return a == b;
+}
+
+static KParts::ReadWritePart* partForURL(const KURL &url, KDevPartController* pc)
+{
+ if ( !pc )
+ return 0;
+ QPtrListIterator<KParts::Part> it(*(pc->parts()));
+ for ( ; it.current(); ++it)
+ {
+ KParts::ReadWritePart *rw_part = dynamic_cast<KParts::ReadWritePart*>(it.current());
+ if ( rw_part && dynamic_cast<KTextEditor::EditInterface*>(it.current()) && urlIsEqual(url, rw_part->url()) )
+ return rw_part;
+ }
+
+ return 0;
+}
+
+void DiffPart::contextMenu( QPopupMenu* popup, const Context* context )
+{
+ if ( context->hasType( Context::EditorContext ) )
+ {
+ const EditorContext *eContext = static_cast<const EditorContext*>(context);
+ popupFile = eContext->url();
+ }
+ else if ( context->hasType( Context::FileContext ) )
+ {
+ const FileContext * fContext = static_cast<const FileContext*>( context );
+ popupFile.setPath( fContext->urls().first().fileName() ); //@fixme - assuming absolute path. is this correct?
+ }
+ else
+ {
+ return;
+ }
+
+ KParts::ReadWritePart* rw_part = partForURL( popupFile, partController() );
+ if ( !rw_part ) return;
+
+ if ( partController()->documentState( rw_part->url() ) != Clean )
+ {
+ int id = popup->insertItem( i18n( "Difference to Disk File" ),
+ this, SLOT(localDiff()) );
+ popup->setWhatsThis(id, i18n("<b>Difference to disk file</b><p>Shows the difference between "
+ "the file contents in this editor and the file contents on disk."));
+ }
+}
+
+DiffPart::~DiffPart()
+{
+ if ( diffWidget )
+ mainWindow()->removeView( diffWidget );
+
+ delete proc;
+ delete (DiffWidget*) diffWidget;
+}
+
+void DiffPart::localDiff()
+{
+ KParts::ReadWritePart* rw_part = partForURL( popupFile, partController() );
+ if ( !rw_part )
+ return;
+
+ KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>(rw_part);
+ if ( !editIface )
+ return;
+ buffer = editIface->text().local8Bit();
+ resultBuffer = resultErr = QString::null;
+
+ delete proc;
+ proc = new KProcess();
+
+ *proc << "diff";
+ *proc << "-u" << popupFile.path() << "-";
+ proc->setWorkingDirectory( popupFile.directory() );
+
+ connect( proc, SIGNAL(processExited( KProcess* )),
+ this, SLOT(processExited( KProcess* )) );
+ connect( proc, SIGNAL(receivedStdout( KProcess*, char*, int )),
+ this, SLOT(receivedStdout( KProcess*, char*, int )) );
+ connect( proc, SIGNAL(receivedStderr( KProcess*, char*, int )),
+ this, SLOT(receivedStderr( KProcess*, char*, int )) );
+ connect( proc, SIGNAL(wroteStdin( KProcess* )),
+ this, SLOT(wroteStdin( KProcess* )) );
+
+ if ( !proc->start( KProcess::NotifyOnExit, KProcess::All ) ) {
+ KMessageBox::error( 0, i18n( "Could not invoke the \"diff\" command." ) );
+ delete proc;
+ proc = 0;
+ return;
+ }
+ proc->writeStdin( buffer.data(), buffer.length() );
+}
+
+void DiffPart::processExited( KProcess* p )
+{
+ // diff has exit status 0 and 1 for success
+ if ( p->normalExit() && ( p->exitStatus() == 0 || p->exitStatus() == 1 ) ) {
+ if ( resultBuffer.isEmpty() )
+ KMessageBox::information( 0, i18n("DiffPart: No differences found.") );
+ else
+ showDiff( resultBuffer );
+ } else {
+ KMessageBox::error( 0, i18n("Diff command failed (%1):\n").arg( p->exitStatus() ) + resultErr );
+ }
+ resultBuffer = resultErr = QString::null;
+ delete proc;
+ proc = 0;
+}
+
+void DiffPart::receivedStdout( KProcess* /* p */, char* buf, int buflen )
+{
+ resultBuffer += QString::fromLocal8Bit( buf, buflen );
+}
+
+void DiffPart::receivedStderr( KProcess* /* p */, char* buf, int buflen )
+{
+ kdDebug(9033) << "received Stderr: " << QString::fromLocal8Bit( buf, buflen ) << endl;
+ resultErr += QString::fromLocal8Bit( buf, buflen );
+}
+
+void DiffPart::wroteStdin( KProcess* p )
+{
+ buffer = 0L;
+ p->closeStdin();
+}
+
+void DiffPart::openURL( const KURL& url )
+{
+ diffWidget->slotClear();
+ diffWidget->openURL( url );
+ mainWindow()->raiseView( diffWidget );
+/*
+ DiffDlg* diffDlg = new DiffDlg( 0, "diffDlg" );
+
+ diffDlg->openURL( url );
+ diffDlg->exec();
+ delete diffDlg;
+*/
+}
+
+void DiffPart::showDiff( const QString& diff )
+{
+ diffWidget->slotClear();
+ diffWidget->setDiff( diff );
+ mainWindow()->setViewAvailable( diffWidget, true );
+ mainWindow()->raiseView( diffWidget );
+/*
+ DiffDlg* diffDlg = new DiffDlg( 0, "diffDlg" );
+
+ diffDlg->setDiff( diff );
+ diffDlg->exec();
+ delete diffDlg;
+*/
+}
+
+void DiffPart::slotExecDiff()
+{
+ KURL url = KFileDialog::getOpenURL( QString::null, QString::null, 0, i18n("Please Select Patch File") );
+
+ if ( url.isEmpty() )
+ return;
+
+ openURL( url );
+}
+
+#include "diffpart.moc"
diff --git a/parts/diff/diffpart.h b/parts/diff/diffpart.h
new file mode 100644
index 00000000..f89d0d18
--- /dev/null
+++ b/parts/diff/diffpart.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Harald Fernengel *
+ * harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DIFFPART_H_
+#define _DIFFPART_H_
+
+#include <qguardedptr.h>
+#include <qcstring.h>
+
+#include "kdevplugin.h"
+#include "kdevdifffrontend.h"
+
+class QPopupMenu;
+class Context;
+class KProcess;
+class DiffWidget;
+class QCString;
+
+class DiffPart : public KDevDiffFrontend
+{
+ Q_OBJECT
+
+public:
+ DiffPart( QObject *parent, const char *name, const QStringList & );
+ virtual ~DiffPart();
+
+ void openURL( const KURL& url );
+ void showDiff( const QString& diff );
+ void showDiff( const KURL &, const KURL & ) { /** @todo */ }
+
+public slots:
+ void slotExecDiff();
+
+private slots:
+ void contextMenu( QPopupMenu* popup, const Context* context );
+ void localDiff();
+ void processExited( KProcess* p );
+ void receivedStdout( KProcess* p, char* buf, int buflen );
+ void receivedStderr( KProcess* p, char* buf, int buflen );
+ void wroteStdin( KProcess* p );
+
+private:
+ QGuardedPtr<DiffWidget> diffWidget;
+ KURL popupFile;
+ KProcess* proc;
+ QCString buffer;
+ QString resultBuffer;
+ QString resultErr;
+};
+
+#endif
diff --git a/parts/diff/diffwidget.cpp b/parts/diff/diffwidget.cpp
new file mode 100644
index 00000000..0b3399ab
--- /dev/null
+++ b/parts/diff/diffwidget.cpp
@@ -0,0 +1,348 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Harald Fernengel *
+ * harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+#include <qtextedit.h>
+#include <qpopupmenu.h>
+#include <qcursor.h>
+#include <qfile.h>
+
+#include <kconfig.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kservice.h>
+#include <ktempfile.h>
+#include <kpopupmenu.h>
+#include <kiconloader.h>
+#include <kfiledialog.h>
+#include <kmessagebox.h>
+
+#include <kparts/componentfactory.h>
+#include <kparts/part.h>
+
+#include <kio/jobclasses.h>
+#include <kio/job.h>
+
+#include <kdevmainwindow.h>
+
+#include "diffpart.h"
+#include "diffwidget.h"
+
+// yup, magic value for the popupmenu-id
+static const int POPUP_BASE = 130977;
+
+QStringList KDiffTextEdit::extParts;
+QStringList KDiffTextEdit::extPartsTranslated;
+
+KDiffTextEdit::KDiffTextEdit( QWidget* parent, const char* name ): QTextEdit( parent, name )
+{
+ KConfig* config = kapp->config();
+ config->setGroup( "Diff" );
+ _highlight = config->readBoolEntry( "Highlight", true );
+
+ searchExtParts();
+}
+
+KDiffTextEdit::~KDiffTextEdit()
+{
+ KConfig* config = kapp->config();
+
+ config->setGroup( "Diff" );
+ config->writeEntry( "Highlight", _highlight );
+}
+
+QPopupMenu* KDiffTextEdit::createPopupMenu()
+{
+ return createPopupMenu( QPoint() );
+}
+
+QPopupMenu* KDiffTextEdit::createPopupMenu( const QPoint& p )
+{
+ QPopupMenu* popup = QTextEdit::createPopupMenu( p );
+ if ( !popup )
+ popup = new QPopupMenu( this );
+
+ int i = 0;
+
+ for ( QStringList::Iterator it = extPartsTranslated.begin(); it != extPartsTranslated.end(); ++it ) {
+ popup->insertItem( i18n( "Show in %1" ).arg( *it ), i + POPUP_BASE, i );
+ i++;
+ }
+ if ( !extPartsTranslated.isEmpty() )
+ popup->insertSeparator( i );
+ connect( popup, SIGNAL(activated(int)), this, SLOT(popupActivated(int)) );
+
+ popup->insertItem( SmallIconSet( "filesaveas" ), i18n( "&Save As..." ), this, SLOT(saveAs()), CTRL + Key_S, POPUP_BASE - 2, 0 );
+ popup->setItemEnabled( POPUP_BASE - 2, length() > 0 );
+
+ popup->insertSeparator( 1 );
+
+ popup->insertItem( i18n( "Highlight Syntax" ), this, SLOT(toggleSyntaxHighlight()), 0, POPUP_BASE - 1, 2 );
+ popup->setItemChecked( POPUP_BASE - 1, _highlight );
+ popup->insertSeparator( 3 );
+
+ popup->insertSeparator();
+ popup->insertItem( i18n("Hide view"), parent(), SLOT(hideView()) );
+
+ return popup;
+}
+
+void KDiffTextEdit::saveAs()
+{
+ QString fName = KFileDialog::getSaveFileName();
+ if ( fName.isEmpty() )
+ return;
+
+ QFile f( fName );
+ if ( f.open( IO_WriteOnly ) ) {
+ QTextStream stream( &f );
+ int pCount = paragraphs();
+ for ( int i = 0; i < pCount; ++i )
+ stream << text( i ) << "\n";
+ f.close();
+ } else {
+ KMessageBox::sorry( 0, i18n("Unable to open file."), i18n("Diff Frontend") );
+ }
+}
+
+void KDiffTextEdit::toggleSyntaxHighlight()
+{
+ _highlight = !_highlight;
+ if ( _highlight )
+ applySyntaxHighlight();
+ else
+ clearSyntaxHighlight();
+}
+
+void KDiffTextEdit::applySyntaxHighlight()
+{
+ // the diff has been loaded so we apply a simple highlighting
+ static QColor cAdded( 190, 190, 237);
+ static QColor cRemoved( 190, 237, 190 );
+
+ if ( !_highlight )
+ return;
+
+ int paragCount = paragraphs();
+ for ( int i = 0; i < paragCount; ++i ) {
+ QString txt = text( i );
+ if ( txt.length() > 0 ) {
+ if ( txt.startsWith( "+" ) || txt.startsWith( ">" ) ) {
+ setParagraphBackgroundColor( i, cAdded );
+ } else if ( txt.startsWith( "-" ) || txt.startsWith( "<" ) ) {
+ setParagraphBackgroundColor( i, cRemoved );
+ }
+ }
+ }
+}
+
+void KDiffTextEdit::clearSyntaxHighlight()
+{
+ int paragCount = paragraphs();
+ for ( int i = 0; i < paragCount; ++i ) {
+ clearParagraphBackground( i );
+ }
+}
+
+void KDiffTextEdit::searchExtParts()
+{
+ // only execute once
+ static bool init = false;
+ if ( init )
+ return;
+ init = true;
+
+ // search all parts that can handle text/x-diff
+ KTrader::OfferList offers = KTrader::self()->query("text/x-diff", "('KParts/ReadOnlyPart' in ServiceTypes) and ('text/x-diff' in ServiceTypes) and (DesktopEntryName != 'katepart')");
+ KTrader::OfferList::const_iterator it;
+ for ( it = offers.begin(); it != offers.end(); ++it ) {
+ KService::Ptr ptr = (*it);
+ extPartsTranslated << ptr->name();
+ extParts << ptr->desktopEntryName();
+ }
+ return;
+}
+
+void KDiffTextEdit::popupActivated( int id )
+{
+ id -= POPUP_BASE;
+ if ( id < 0 || id > (int)extParts.count() )
+ return;
+
+ emit externalPartRequested( extParts[ id ] );
+}
+
+DiffWidget::DiffWidget( DiffPart * part, QWidget *parent, const char *name, WFlags f ):
+ QWidget( parent, name, f ), m_part( part ), tempFile( 0 )
+{
+ job = 0;
+ extPart = 0;
+
+ te = new KDiffTextEdit( this, "Main Diff Viewer" );
+ te->setReadOnly( true );
+ te->setTextFormat( QTextEdit::PlainText );
+// te->setMinimumSize( 300, 200 );
+ connect( te, SIGNAL(externalPartRequested(const QString&)), this, SLOT(loadExtPart(const QString&)) );
+
+ QVBoxLayout* layout = new QVBoxLayout( this );
+ layout->addWidget( te );
+}
+
+DiffWidget::~DiffWidget()
+{
+ m_part = 0;
+ delete tempFile;
+}
+
+void DiffWidget::setExtPartVisible( bool visible )
+{
+ if ( !extPart || !extPart->widget() ) {
+ te->show();
+ return;
+ }
+ if ( visible ) {
+ te->hide();
+ extPart->widget()->show();
+ } else {
+ te->show();
+ extPart->widget()->hide();
+ }
+}
+
+void DiffWidget::loadExtPart( const QString& partName )
+{
+ if ( extPart ) {
+ setExtPartVisible( false );
+ delete extPart;
+ extPart = 0;
+ }
+
+ KService::Ptr extService = KService::serviceByDesktopName( partName );
+ if ( !extService )
+ return;
+
+ extPart = KParts::ComponentFactory::createPartInstanceFromService<KParts::ReadOnlyPart>( extService, this, 0, this, 0 );
+ if ( !extPart || !extPart->widget() )
+ return;
+
+ layout()->add( extPart->widget() );
+
+ setExtPartVisible( true );
+
+ if ( te->paragraphs() > 0 )
+ populateExtPart();
+}
+
+void DiffWidget::slotClear()
+{
+ rawDiff = QString();
+ te->clear();
+ if ( extPart )
+ extPart->closeURL();
+}
+
+// internally for the TextEdit only!
+void DiffWidget::slotAppend( const QString& str )
+{
+ te->append( str );
+}
+
+// internally for the TextEdit only!
+void DiffWidget::slotAppend( KIO::Job*, const QByteArray& ba )
+{
+ slotAppend( QString( ba ) );
+}
+
+void DiffWidget::populateExtPart()
+{
+ if ( !extPart )
+ return;
+
+ bool ok = false;
+ int paragCount = te->paragraphs();
+ if ( extPart->openStream( "text/plain", KURL() ) ) {
+ for ( int i = 0; i < paragCount; ++i )
+ extPart->writeStream( rawDiff.local8Bit() );
+ ok = extPart->closeStream();
+ } else {
+ // workaround for parts that cannot handle streams
+ delete tempFile;
+ tempFile = new KTempFile();
+ tempFile->setAutoDelete( true );
+ *(tempFile->textStream()) << rawDiff.local8Bit() << endl;
+ tempFile->close();
+ ok = extPart->openURL( KURL::fromPathOrURL( tempFile->name() ) );
+ }
+ if ( !ok )
+ setExtPartVisible( false );
+}
+
+// internally for the TextEdit only!
+void DiffWidget::slotFinished()
+{
+ te->applySyntaxHighlight();
+ populateExtPart();
+}
+
+void DiffWidget::setDiff( const QString& diff )
+{
+ slotClear();
+ rawDiff = diff;
+ slotAppend( diff );
+ slotFinished();
+}
+
+void DiffWidget::openURL( const KURL& url )
+{
+ if ( job )
+ job->kill();
+
+ KIO::TransferJob* job = KIO::get( url );
+ if ( !job )
+ return;
+
+ connect( job, SIGNAL(data( KIO::Job *, const QByteArray & )),
+ this, SLOT(slotAppend( KIO::Job*, const QByteArray& )) );
+ connect( job, SIGNAL(result( KIO::Job * )),
+ this, SLOT(slotFinished()) );
+}
+
+void DiffWidget::contextMenuEvent( QContextMenuEvent* /* e */ )
+{
+ QPopupMenu* popup = new QPopupMenu( this );
+
+ if ( !te->isVisible() )
+ {
+ popup->insertItem( i18n("Display &Raw Output"), this, SLOT(showTextEdit()) );
+ popup->insertSeparator();
+ popup->insertItem( i18n("Hide view"), this, SLOT(hideView()) );
+ }
+
+ popup->exec( QCursor::pos() );
+ delete popup;
+}
+
+void DiffWidget::showExtPart()
+{
+ setExtPartVisible( true );
+}
+
+void DiffWidget::showTextEdit()
+{
+ setExtPartVisible( false );
+}
+
+void DiffWidget::hideView()
+{
+ m_part->mainWindow()->setViewAvailable( this, false );
+}
+
+#include "diffwidget.moc"
diff --git a/parts/diff/diffwidget.h b/parts/diff/diffwidget.h
new file mode 100644
index 00000000..665b1110
--- /dev/null
+++ b/parts/diff/diffwidget.h
@@ -0,0 +1,107 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Harald Fernengel *
+ * harry@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DIFFWIDGET_H_
+#define _DIFFWIDGET_H_
+
+#include <qwidget.h>
+#include <qtextedit.h>
+#include <qstringlist.h>
+
+#include <kurl.h>
+
+class KTempFile;
+class DiffPart;
+
+namespace KIO {
+ class Job;
+}
+
+namespace KParts {
+ class ReadOnlyPart;
+}
+
+// Helper class that displays a modified RMB popup menu
+class KDiffTextEdit: public QTextEdit
+{
+ Q_OBJECT
+public:
+ KDiffTextEdit( QWidget* parent = 0, const char* name = 0 );
+ virtual ~KDiffTextEdit();
+ void applySyntaxHighlight();
+ void clearSyntaxHighlight();
+
+signals:
+ void externalPartRequested( const QString& partName );
+
+protected:
+ virtual QPopupMenu* createPopupMenu( const QPoint& );
+ virtual QPopupMenu* createPopupMenu();
+
+private slots:
+ void popupActivated( int );
+ void toggleSyntaxHighlight();
+ void saveAs();
+
+private:
+ static void searchExtParts();
+ static QStringList extParts;
+ static QStringList extPartsTranslated;
+ bool _highlight;
+};
+
+class DiffWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DiffWidget( DiffPart * part, QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ virtual ~DiffWidget();
+
+public slots:
+ /** The URL has to point to a diff file */
+ void openURL( const KURL& url );
+ /** Pass a diff file in here */
+ void setDiff( const QString& diff );
+ /** clears the difference viewer */
+ void slotClear();
+
+private slots:
+ /** appends a piece of "diff" */
+ void slotAppend( const QString& str );
+ /** overloaded for convenience */
+ void slotAppend( KIO::Job*, const QByteArray& ba );
+ /** call this when the whole "diff" has been sent.
+ * Don't call slotAppend afterwards!
+ */
+ void slotFinished();
+ void showExtPart();
+ void showTextEdit();
+ void loadExtPart( const QString& partName );
+ void hideView();
+
+protected:
+ void contextMenuEvent( QContextMenuEvent* e );
+
+private:
+ void setExtPartVisible( bool visible );
+ void populateExtPart();
+
+private:
+ DiffPart * m_part;
+ KDiffTextEdit* te;
+ KIO::Job* job;
+ KParts::ReadOnlyPart* extPart;
+ KTempFile* tempFile;
+ QString rawDiff;
+};
+
+#endif
diff --git a/parts/diff/kdevdiff.desktop b/parts/diff/kdevdiff.desktop
new file mode 100644
index 00000000..f9779903
--- /dev/null
+++ b/parts/diff/kdevdiff.desktop
@@ -0,0 +1,84 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Difference Viewer
+Comment[ca]=Visor de diferències
+Comment[da]=Diff-fremviser
+Comment[de]=Betrachter für Abweichungen
+Comment[el]=Προβολέας διαφορών
+Comment[es]=Visor de diferencias
+Comment[et]=Erinevuste näitaja
+Comment[eu]=Desberdintasun ikustailea
+Comment[fa]=مشاهده‌گر تفاوت
+Comment[fr]=Afficheur de différences
+Comment[ga]=Amharcán Difríochtaí
+Comment[gl]=Visor de diferenzas
+Comment[hi]=भिन्नता प्रदर्शक
+Comment[hu]=Fájlok közötti eltérések megjelenítése
+Comment[it]=Visualizzatore di differenze
+Comment[ja]=差分ビューア
+Comment[ms]=Pelihat Perbezaan
+Comment[nds]=En Verscheelkieker
+Comment[ne]=फरक दृश्यकर्ता
+Comment[nl]=Weergave van verschillen
+Comment[pl]=Przeglądarka różnic
+Comment[pt]=Visualizador de Diferenças
+Comment[pt_BR]=Visualizador de Diferenças
+Comment[ru]=Просмотр различий
+Comment[sk]=Prezerač rozdielov
+Comment[sl]=Pregledovalnik razlik
+Comment[sr]=Програм за прегледање разлика
+Comment[sr@Latn]=Program za pregledanje razlika
+Comment[sv]=Visning av jämförelser
+Comment[ta]=பாகுபாடு காட்சியாளர்
+Comment[tg]=Намоишгари фарқкунанда
+Comment[tr]=Fark Görüntüleyicisi
+Comment[zh_CN]=差别查看器
+Comment[zh_TW]=比較檢視器
+Name=KDevDiff
+Name[da]=KDevelop diff-fremviser
+Name[de]=Abweichungsansicht (KDevelop)
+Name[hi]=के-डेव-डिफ़
+Name[nds]=KDevelop-Verscheelkieker
+Name[sk]=KDev rozdiel
+Name[sv]=KDevelop jämför
+Name[zh_TW]=KDevelop 比較
+GenericName=Difference Viewer
+GenericName[ca]=Visor de diferències
+GenericName[da]=Diff-fremviser
+GenericName[de]=Betrachter für Abweichungen
+GenericName[el]=Προβολέας διαφορών
+GenericName[es]=Visor de diferencias
+GenericName[et]=Erinevuste näitaja
+GenericName[eu]=Desberdintasun ikustailea
+GenericName[fa]=مشاهده‌گر تفاوت
+GenericName[fr]=Afficheur de différences
+GenericName[ga]=Amharcán Difríochtaí
+GenericName[gl]=Visor de diferenzas
+GenericName[hi]=भिन्नता प्रदर्शक
+GenericName[hu]=Diff-megjelenítő
+GenericName[it]=Visualizzatore delle differenze
+GenericName[ja]=差分ビューア
+GenericName[ms]=Pelihat Perbezaan
+GenericName[nds]=Verscheelkieker
+GenericName[ne]=फरक दृश्यकर्ता
+GenericName[nl]=Weergave van verschillen
+GenericName[pl]=Przeglądarka różnic
+GenericName[pt]=Visualizador de Diferenças
+GenericName[pt_BR]=Visualizador de Diferenças
+GenericName[ru]=Просмотр различий
+GenericName[sk]=Prezerač rozdielov
+GenericName[sl]=Pregledovalnik razlik
+GenericName[sr]=Програм за прегледање разлика
+GenericName[sr@Latn]=Program za pregledanje razlika
+GenericName[sv]=Visning av jämförelser
+GenericName[ta]=வெவ்வேறு பார்வையாளர்கள்
+GenericName[tg]=Намоишгари фарқкунанда
+GenericName[tr]=Fark Görüntüleyicisi
+GenericName[zh_CN]=差别查看器
+GenericName[zh_TW]=比較檢視器
+ServiceTypes=KDevelop/DiffFrontend
+X-KDE-Library=libkdevdiff
+X-KDevelop-Version=5
+X-KDevelop-Properties=CodeEditing
+X-KDevelop-Scope=Core
diff --git a/parts/diff/kdevdiff.rc b/parts/diff/kdevdiff.rc
new file mode 100644
index 00000000..37059573
--- /dev/null
+++ b/parts/diff/kdevdiff.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevDiff" version="1">
+<MenuBar>
+ <Menu name="tools" >
+ <Action name="tools_diff" group="tools_file_operations"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/distpart/Makefile.am b/parts/distpart/Makefile.am
new file mode 100644
index 00000000..0a1d949f
--- /dev/null
+++ b/parts/distpart/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevdistpart.la
+libkdevdistpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevdistpart_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevdistpart_la_SOURCES = distpart_ui.ui distpart_part.cpp distpart_widget.cpp packagebase.cpp lsmsupport.cpp specsupport.cpp
+
+METASOURCES = AUTO
+KDEICON = AUTO
+servicedir = $(kde_servicesdir)
+service_DATA = kdevdistpart.desktop
+
+rc_DATA = kdevpart_distpart.rc
+rcdir = $(kde_datadir)/kdevdistpart
diff --git a/parts/distpart/README b/parts/distpart/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/distpart/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/distpart/README.dox b/parts/distpart/README.dox
new file mode 100644
index 00000000..994b4f84
--- /dev/null
+++ b/parts/distpart/README.dox
@@ -0,0 +1,24 @@
+/** \class DistpartPart
+This part aims to provide some help to the developpers for packaging
+and publishing their projects by ftp protocol.
+
+Only RPM package format is supported for now. More to come.
+If you want to develop a new package support, please have a look at
+specsupport.h and specsupport.cpp. Help is always welcome :-)
+
+\authors <a href="mailto:geiseri AT yahoo.com">Ian Reinart Geiser</a>
+
+\maintainer <a href="mailto:Yann.Hodique AT lifl.fr">Yann Hodique</a>
+
+\feature provide some help to the developpers for packaging and publishing their projects by ftp protocol
+\feature support RPM package format
+
+\bug Development package, documentation package, application icon and local
+options (in publishing tab) are currently ignored.
+
+\bug The creation of the source archive is just a
+call to "dist" or "dist-bzip2" target of the Makefile. If those
+targets don't exist, nothing is done to solve the problem (for
+example when the project is QMake-based)
+
+*/
diff --git a/parts/distpart/distpart_part.cpp b/parts/distpart/distpart_part.cpp
new file mode 100644
index 00000000..b719533d
--- /dev/null
+++ b/parts/distpart/distpart_part.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "distpart_part.h"
+
+#include <qwhatsthis.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdebug.h>
+
+#include "kdevcore.h"
+#include <kdevplugininfo.h>
+
+#include "distpart_widget.h"
+
+#include <kdialogbase.h>
+
+typedef KDevGenericFactory<DistpartPart> DistpartFactory;
+static const KDevPluginInfo data("kdevdistpart");
+K_EXPORT_COMPONENT_FACTORY( libkdevdistpart, DistpartFactory( data ) )
+
+DistpartPart::DistpartPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "DistpartPart") {
+
+ kdDebug(9007) << "DistpartPart::DistpartPart()" << endl;
+ setInstance(DistpartFactory::instance());
+
+ setXMLFile("kdevpart_distpart.rc");
+
+ m_action = new KAction( i18n("Distribution && Publishing"), "package", 0,
+ this, SLOT(show()),
+ actionCollection(), "make_dist" );
+
+ m_action->setToolTip(i18n("Make source and binary distribution"));
+ m_action->setWhatsThis(i18n("<b>Project distribution & publishing</b><p>Helps users package and publish their software."));
+ //QWhatsThis::add(m_widget, i18n("This will help users package and publish their software."));
+
+ m_dlg = new KDialogBase( 0 , "dist_part", false, i18n("Distribution & Publishing"), KDialogBase::Ok|KDialogBase::Cancel);
+
+ m_dialog = new DistpartDialog(this, m_dlg );
+ m_dlg->setMainWidget(m_dialog);
+
+ connect( m_dlg, SIGNAL(okClicked()), m_dialog, SLOT(slotokayPushButtonPressed()));
+ connect( m_dlg, SIGNAL(cancelClicked()), m_dialog, SLOT(slotcancelPushButtonPressed()));
+ // Package types
+ //RpmPackage = new SpecSupport(this);
+ //LsmPackage = new LsmSupport(this);
+}
+
+
+DistpartPart::~DistpartPart() {
+ kdDebug(9007) << "DistpartPart::~DistpartPart()" << endl;
+ delete m_dialog;
+ //delete RpmPackage;
+ //delete LsmPackage;
+}
+
+void DistpartPart::show() {
+ m_dlg->exec();
+}
+
+void DistpartPart::hide() {
+ m_dlg->cancel();
+}
+
+#include "distpart_part.moc"
diff --git a/parts/distpart/distpart_part.h b/parts/distpart/distpart_part.h
new file mode 100644
index 00000000..c8caa0a3
--- /dev/null
+++ b/parts/distpart/distpart_part.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+
+#ifndef __KDEVPART_DISTPART_H__
+#define __KDEVPART_DISTPART_H__
+
+
+#include <qguardedptr.h>
+#include <kdevplugin.h>
+#include <kaction.h>
+
+#include "packagebase.h"
+
+class DistpartDialog;
+class KDialogBase;
+
+class DistpartPart : public KDevPlugin {
+ Q_OBJECT
+
+public:
+
+ DistpartPart(QObject *parent, const char *name, const QStringList &);
+ ~DistpartPart();
+
+public slots:
+ void show();
+ void hide();
+
+private:
+ packageBase *RpmPackage, *LsmPackage;
+ QGuardedPtr<DistpartDialog> m_dialog;
+ KAction *m_action;
+ QGuardedPtr<KDialogBase> m_dlg;
+};
+
+
+#endif
diff --git a/parts/distpart/distpart_ui.ui b/parts/distpart/distpart_ui.ui
new file mode 100644
index 00000000..a987c009
--- /dev/null
+++ b/parts/distpart/distpart_ui.ui
@@ -0,0 +1,1243 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>distpart_ui</class>
+<author>Ian Reinhart Geiser &lt;geiseri@yahoo.com&gt;</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>packaging_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>606</width>
+ <height>649</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Prepare for Release</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout30</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>titleLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>&lt;H2&gt;Project Packaging &amp; Publishing&lt;/H2&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>KDevelopGraphic</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>48</width>
+ <height>48</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>48</width>
+ <height>48</height>
+ </size>
+ </property>
+ <property name="pixmap">
+ <pixmap>"kdevelop"</pixmap>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>actions_box</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="tabPosition">
+ <enum>Top</enum>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Source &amp;Distribution</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox" row="1" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>srcDistFileListBox</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>customProjectCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Use custom options</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Default is: %n-%v.tar.gz</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>Layout19</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>sourceOptionsGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Source Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>bzipCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Use &amp;bzip2 instead of gzip</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout34</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>archiveNameLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;Archive name format: &lt;/b&gt;&lt;br&gt; %n - File name &lt;br&gt; %v - File version &lt;br&gt; %d - Date of archive</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>archNameFormatLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>archNameFormatLineEdit</cstring>
+ </property>
+ <property name="text">
+ <string>%n-%v</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter the filename using the format options. </string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer37</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addFile</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Add Files</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>createSrcArchPushButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Create Source Archive</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>resetSrcPushButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>R&amp;eset</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLabel" row="0" column="1">
+ <property name="name">
+ <cstring>fileListLabel</cstring>
+ </property>
+ <property name="text">
+ <string>File &amp;list:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>srcDistFileListBox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Package &amp;Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout12</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout11</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>licenseLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>vendorLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Ve&amp;ndor:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>vendorLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>releaseLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>appNameLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Application name</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>vendorLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>appNameLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Application name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>appNameLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>summaryLabel</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;ummary:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>summaryLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>licenseLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;License:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>licenseLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>releaseLabel</cstring>
+ </property>
+ <property name="text">
+ <string>R&amp;elease:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>releaseLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>versionLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Version:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>versionLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="5" column="1">
+ <property name="name">
+ <cstring>summaryLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="7" column="1">
+ <property name="name">
+ <cstring>packagerLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>versionLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Version of the file package.
+Menu item: Project/Project Options/General/Version
+changes project compiled version number</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>groupLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Group:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>groupLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>packagerLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Pac&amp;kager:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>packagerLineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="6" column="1">
+ <property name="name">
+ <cstring>groupLineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>2</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>advancedOptionsGroupBox</cstring>
+ </property>
+ <property name="title">
+ <string>Advanced Package Op&amp;tions</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>devPackageCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Create development package</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>docsPackageCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Create documentation package</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>appIconCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Include application icon</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>archLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Architecture target:&lt;BR&gt;&lt;b&gt;(Note: You must have a compiler that supports this target)&lt;/b&gt;</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>i386</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>i586</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>i686</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>AMD K6</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>AMD K7</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>PPC</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>PPC G3</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>PPC Altevec</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Dec Alpha (AXP)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Sparc</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>archComboBox</cstring>
+ </property>
+ <property name="currentItem">
+ <number>0</number>
+ </property>
+ <property name="autoResize">
+ <bool>true</bool>
+ </property>
+ <property name="sizeLimit">
+ <number>10</number>
+ </property>
+ <property name="autoCompletion">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout13</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout8</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>srcPackagePushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Build Source
+Package</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>buildAllPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Build Binar&amp;y
+Package</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>exportSPECPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;xport
+Build Files</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>importSPECPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>I&amp;mport
+Build Files</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout16</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>projectDescriptionLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Description:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>projectDescriptionMultilineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>projectDescriptionMultilineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="resizePolicy">
+ <enum>Manual</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout15</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>C&amp;hangelog:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>projectChangelogMultilineEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KTextEdit">
+ <property name="name">
+ <cstring>projectChangelogMultilineEdit</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Pr&amp;oject Publishing</string>
+ </attribute>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>localOptionsGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Local Options</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout15</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>genHTMLCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Ge&amp;nerate HTML information page</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>useRPMInfoCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;User information generated by RPM</string>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer7</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout21</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>genHTMLPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Generate</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>resetHTMLPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>R&amp;eset</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>remoteOptionsGroupBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Re&amp;mote Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KListBox" row="1" column="1">
+ <property name="name">
+ <cstring>uploadFileListBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>Layout23</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>fileSubmissionLabel</cstring>
+ </property>
+ <property name="text">
+ <string>File su&amp;bmission list:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>uploadFileListBox</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer24</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>uploadAddFileToolButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>+</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>uploadRemoveToolButton</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>Layout25</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>uploadCustomCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Upload to &amp;custom FTP site</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>uploadftpkdeorgCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Upload files to ftp.&amp;kde.org</string>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>Spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>0</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton" row="7" column="0">
+ <property name="name">
+ <cstring>uploadSubmitPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Sub&amp;mit</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>uploadURLLineEdit</cstring>
+ </property>
+ <property name="text">
+ <string>ftp://username:password@ftp.server.com/path/</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="7" column="1">
+ <property name="name">
+ <cstring>uploadResetPushButton</cstring>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>uploadAppsKDEcomCheckBox</cstring>
+ </property>
+ <property name="text">
+ <string>Upload to &amp;apps.kde.com</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buildAllPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>packaging_dialog</receiver>
+ <slot>slotbuildAllPushButtonPressed()</slot>
+ </connection>
+ <connection>
+ <sender>exportSPECPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>packaging_dialog</receiver>
+ <slot>slotexportSPECPushButtonPressed()</slot>
+ </connection>
+ <connection>
+ <sender>srcPackagePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>packaging_dialog</receiver>
+ <slot>slotsrcPackagePushButtonPressed()</slot>
+ </connection>
+ <connection>
+ <sender>importSPECPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>packaging_dialog</receiver>
+ <slot>slotimportSPECPushButtonPressed()</slot>
+ </connection>
+ <connection>
+ <sender>addFile</sender>
+ <signal>clicked()</signal>
+ <receiver>packaging_dialog</receiver>
+ <slot>slotAddFileButtonPressed()</slot>
+ </connection>
+ <connection>
+ <sender>srcDistFileListBox</sender>
+ <signal>clicked(QListBoxItem*)</signal>
+ <receiver>packaging_dialog</receiver>
+ <slot>slotRemoveFile(QListBoxItem*)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>actions_box</tabstop>
+ <tabstop>customProjectCheckBox</tabstop>
+ <tabstop>bzipCheckBox</tabstop>
+ <tabstop>archNameFormatLineEdit</tabstop>
+ <tabstop>createSrcArchPushButton</tabstop>
+ <tabstop>resetSrcPushButton</tabstop>
+ <tabstop>srcDistFileListBox</tabstop>
+ <tabstop>appNameLineEdit</tabstop>
+ <tabstop>versionLineEdit</tabstop>
+ <tabstop>releaseLineEdit</tabstop>
+ <tabstop>vendorLineEdit</tabstop>
+ <tabstop>licenseLineEdit</tabstop>
+ <tabstop>summaryLineEdit</tabstop>
+ <tabstop>groupLineEdit</tabstop>
+ <tabstop>packagerLineEdit</tabstop>
+ <tabstop>projectDescriptionMultilineEdit</tabstop>
+ <tabstop>projectChangelogMultilineEdit</tabstop>
+ <tabstop>devPackageCheckBox</tabstop>
+ <tabstop>docsPackageCheckBox</tabstop>
+ <tabstop>appIconCheckBox</tabstop>
+ <tabstop>archComboBox</tabstop>
+ <tabstop>genHTMLCheckBox</tabstop>
+ <tabstop>useRPMInfoCheckBox</tabstop>
+ <tabstop>genHTMLPushButton</tabstop>
+ <tabstop>resetHTMLPushButton</tabstop>
+ <tabstop>uploadftpkdeorgCheckBox</tabstop>
+ <tabstop>uploadAppsKDEcomCheckBox</tabstop>
+ <tabstop>uploadCustomCheckBox</tabstop>
+ <tabstop>uploadURLLineEdit</tabstop>
+ <tabstop>uploadSubmitPushButton</tabstop>
+ <tabstop>uploadResetPushButton</tabstop>
+ <tabstop>uploadAddFileToolButton</tabstop>
+ <tabstop>uploadRemoveToolButton</tabstop>
+ <tabstop>uploadFileListBox</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="global" impldecl="in implementation">kiconloader.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+ <include location="global" impldecl="in implementation">klistbox.h</include>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">ktextedit.h</include>
+</includes>
+<slots>
+ <slot>slotbuildAllPushButtonPressed()</slot>
+ <slot>slotexportSPECPushButtonPressed()</slot>
+ <slot>slotimportSPECPushButtonPressed()</slot>
+ <slot>slotsrcPackagePushButtonPressed()</slot>
+ <slot>slotAddFileButtonPressed()</slot>
+ <slot>slotRemoveFile(QListBoxItem *item)</slot>
+</slots>
+<pixmapfunction>DesktopIcon</pixmapfunction>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klistbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>ktextedit.h</includehint>
+ <includehint>ktextedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/distpart/distpart_widget.cpp b/parts/distpart/distpart_widget.cpp
new file mode 100644
index 00000000..71c981e8
--- /dev/null
+++ b/parts/distpart/distpart_widget.cpp
@@ -0,0 +1,605 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "distpart_widget.h"
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kprocess.h>
+#include <kfiledialog.h>
+#include <kio/netaccess.h>
+#include <klocale.h>
+#include "kdevproject.h"
+#include "domutil.h"
+#include <ktar.h>
+#include <kmessagebox.h>
+
+#include <kdevcore.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qnetwork.h>
+#include <qurloperator.h>
+#include <qmessagebox.h>
+#include "distpart_part.h"
+#include <qdir.h>
+#include <qfile.h>
+#include <qregexp.h>
+#include <qstringlist.h>
+#include <qtabwidget.h>
+#include "kdevmakefrontend.h"
+#include <kprogress.h>
+
+#include <qerrormessage.h>
+#include "specsupport.h"
+#include "lsmsupport.h"
+
+DistpartDialog::DistpartDialog(DistpartPart *part, QWidget *parent)
+ :distpart_ui(parent, "dist_widget"), m_part(part) {
+ m_spec = new SpecSupport(m_part);
+
+ connect( customProjectCheckBox, SIGNAL(toggled(bool) ),
+ this, SLOT(slotcustomProjectCheckBoxChanged()));
+ connect( uploadCustomCheckBox, SIGNAL(toggled(bool)),
+ this, SLOT(slotuploadCustomCheckBoxChanged()));
+
+// connect( okayPushButton, SIGNAL(clicked()),
+// this, SLOT(slotokayPushButtonPressed()));
+// connect( cancelPushButton, SIGNAL(clicked()),
+// this, SLOT(slotcancelPushButtonPressed()));
+/* connect(help_PushButton, SIGNAL(clicked()),
+ this, SLOT(slothelp_PushButtonPressed()));*/
+ connect( createSrcArchPushButton, SIGNAL(clicked()),
+ this, SLOT(slotcreateSrcArchPushButtonPressed()));
+ connect( resetSrcPushButton, SIGNAL(clicked()),
+ this, SLOT(slotresetSrcPushButtonPressed()));
+
+ connect( genHTMLPushButton, SIGNAL(clicked()),
+ this, SLOT(slotgenHTMLPushButtonPressed()));
+ connect( resetHTMLPushButton, SIGNAL(clicked()),
+ this, SLOT(slotresetHTMLPushButtonPressed()));
+ connect( uploadSubmitPushButton, SIGNAL(clicked()),
+ this, SLOT(slotuploadSubmitPushButtonPressed()));
+ connect( uploadResetPushButton, SIGNAL(clicked()),
+ this, SLOT(slotuploadResetPushButtonPressed()));
+ connect( uploadAddFileToolButton, SIGNAL(clicked()),
+ this, SLOT(slotuploadAddFileToolButtonPressed()));
+ connect( uploadRemoveToolButton, SIGNAL(clicked()),
+ this, SLOT(slotuploadRemoveToolButtonPressed()));
+ connect ( srcDistFileListBox, SIGNAL(clicked(QListBoxItem *item)), this, SLOT(slotRemoveFile(QListBoxItem *item)));
+// connect( buildAllPushButton, SIGNAL( clicked() ), this, SLOT( slotbuildAllPushButtonPressed() ));
+// connect( exportSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotexportSPECPushButtonPressed( ) ) );
+// connect( srcPackagePushButton, SIGNAL( clicked() ), this, SLOT( slotsrcPackagePushButtonPressed() ) );
+// connect( importSPECPushButton, SIGNAL( clicked() ), this, SLOT( slotimportSPECPushButtonPressed() ) );
+ loadSettings();
+
+
+ localOptionsGroupBox->setEnabled(false);
+ devPackageCheckBox->setEnabled(false);
+ docsPackageCheckBox->setEnabled(false);
+ appIconCheckBox->setEnabled(false);
+ uploadftpkdeorgCheckBox->setEnabled(false);
+ uploadAppsKDEcomCheckBox->setEnabled(false);
+}
+
+
+DistpartDialog::~DistpartDialog() {
+}
+
+// QPushButton* okayPushButton;
+
+void DistpartDialog::slotokayPushButtonPressed() {
+ storeSettings();
+// accept();
+}
+// QPushButton* cancelPushButton;
+
+void DistpartDialog::slotcancelPushButtonPressed() {
+// reject();
+}
+// QPushButton* help_PushButton;
+
+/*void DistpartDialog::slothelp_PushButtonPressed() {
+ QMessageBox::about(this,i18n("Distpart Help"),i18n("In order to build a RPM package :\n\t1) Create a source archive\n\t2) Generate a SPEC File\n\t3) Build the package"));
+}*/
+
+// QPushButton* createSrcArchPushButton;
+void DistpartDialog::slotcreateSrcArchPushButtonPressed() {
+ kdDebug() << "Starting archive..." << endl;
+ QString dist = (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? "application/x-bzip2" : "application/x-gzip";
+
+ QString filename = m_part->project()->projectDirectory() + "/" + getSourceName();
+
+ KTar tar(filename, dist);
+ if ( tar.open(IO_WriteOnly) )
+ {
+ //QStringList files = m_part->project()->distFiles();
+ KProgressDialog *prog = new KProgressDialog( 0, "dialog", i18n("Building Package"), "", true );
+ prog->show();
+ for( uint idx = 0; idx < srcDistFileListBox->numRows(); ++idx)
+ {
+ QString file = srcDistFileListBox->text(idx);
+ if ( !tar.addLocalFile( m_part->project()->projectDirectory() + "/" + file, getappNameFormatLineEditText() + "/" + file) )
+ {
+ kdDebug() << "Failed to write file " << file << endl;
+ }
+ else
+ {
+ prog->setLabel(i18n("Adding file: %1").arg( file) );
+ prog->progressBar()->setValue( (idx*100)/srcDistFileListBox->numRows() );
+ }
+ }
+ tar.close( );
+ prog->hide();
+ delete prog;
+ KMessageBox::information( this, i18n("Archive made at: %1").arg( filename ), i18n("Archive Done") );
+
+ }
+ else
+ {
+ kdDebug() << "Failed to open archive..." << endl;
+ }
+
+}
+
+// QPushButton* resetSrcPushButton;
+void DistpartDialog::slotresetSrcPushButtonPressed() {
+ srcDistFileListBox->clear();
+ loadSettings();
+}
+
+
+
+// QPushButton* genHTMLPushButton;
+void DistpartDialog::slotgenHTMLPushButtonPressed() {}
+
+// QPushButton* resetHTMLPushButton;
+void DistpartDialog::slotresetHTMLPushButtonPressed() {}
+
+// QToolButton* uploadAddFileToolButton;
+void DistpartDialog::slotuploadAddFileToolButtonPressed() {
+ uploadFileListBox->insertStringList(KFileDialog::getOpenFileNames());
+}
+
+// QToolButton* uploadRemoveToolButton;
+void DistpartDialog::slotuploadRemoveToolButtonPressed() {
+ for(unsigned int i=0; i< uploadFileListBox->count(); i++)
+ if ( uploadFileListBox->isSelected(i)) uploadFileListBox->removeItem(i);
+}
+
+// QPushButton* uploadSubmitPushButton;
+void DistpartDialog::slotuploadSubmitPushButtonPressed() {
+
+ if(getuploadftpkdeorgCheckBoxState() || getuploadAppsKDEcomCheckBoxState())
+ kdDebug() << "Implement ftp.kde.org & apps.kde.com ftp transfer" << endl;
+ else {
+ for(unsigned int i=0; i< uploadFileListBox->count(); i++)
+ KIO::NetAccess::copy(KURL::fromPathOrURL( uploadFileListBox->text(i) ),
+ KURL::fromPathOrURL( getuploadURLLineEditText() + uploadFileListBox->text(i).replace(QRegExp("[^/]*/"),"") ));
+ }
+}
+
+// QPushButton* uploadResetPushButton;
+void DistpartDialog::slotuploadResetPushButtonPressed() {
+ uploadFileListBox->clear();
+}
+
+// Connect Slots to the following widgets and add
+// accessors and mutators
+
+
+// QCheckBox* customProjectCheckBox;
+void DistpartDialog::slotcustomProjectCheckBoxChanged() {
+ kdDebug () << "New State" << customProjectCheckBox->isChecked() << endl;
+ sourceOptionsGroupBox->setEnabled( customProjectCheckBox->isChecked());
+}
+
+bool DistpartDialog::getcustomProjectCheckBoxState() {
+ return customProjectCheckBox->isChecked();
+}
+
+void DistpartDialog::setcustomProjectCheckBoxState(bool state) {
+ customProjectCheckBox->setChecked(state);
+}
+
+// QCheckBox* uploadCustomCheckBox;
+void DistpartDialog::slotuploadCustomCheckBoxChanged() {
+ uploadURLLineEdit->setEnabled( uploadCustomCheckBox->isChecked());
+}
+
+bool DistpartDialog::getuploadCustomCheckBoxState() {
+ return uploadCustomCheckBox->isChecked();
+}
+
+void DistpartDialog::setuploadCustomCheckBoxState(bool state) {
+ uploadCustomCheckBox->setChecked(state);
+}
+
+// Add accessors and mutators for the following
+
+// QCheckBox* bzipCheckBox;
+bool DistpartDialog::getbzipCheckBoxState() {
+ return bzipCheckBox->isChecked();
+}
+
+void DistpartDialog::setbzipCheckBoxState(bool state) {
+ bzipCheckBox->setChecked(state);
+}
+
+// QCheckBox* appIconCheckBox;
+bool DistpartDialog::getappIconCheckBoxState() {
+ return appIconCheckBox->isChecked();
+}
+
+void DistpartDialog::setappIconCheckBoxState(bool state) {
+ appIconCheckBox->setChecked(state);
+}
+
+// QCheckBox* genHTMLCheckBox;
+bool DistpartDialog::getgenHTMLCheckBoxState() {
+ return genHTMLCheckBox->isChecked();
+}
+
+void DistpartDialog::setgenHTMLCheckBoxState(bool state) {
+ genHTMLCheckBox->setChecked(state);
+}
+
+// QCheckBox* useRPMInfoCheckBox;
+bool DistpartDialog::getuseRPMInfoCheckBoxState() {
+ return useRPMInfoCheckBox->isChecked();
+}
+
+void DistpartDialog::setuseRPMInfoCheckBoxState(bool state) {
+ useRPMInfoCheckBox->setChecked(state);
+}
+
+// QCheckBox* uploadAppsKDEcomCheckBox;
+bool DistpartDialog::getuploadAppsKDEcomCheckBoxState() {
+ return uploadAppsKDEcomCheckBox->isChecked();
+}
+
+void DistpartDialog::setuploadAppsKDEcomCheckBoxState(bool state) {
+ uploadAppsKDEcomCheckBox->setChecked(state);
+}
+
+// QCheckBox* uploadftpkdeorgCheckBox;
+bool DistpartDialog::getuploadftpkdeorgCheckBoxState() {
+ return uploadftpkdeorgCheckBox->isChecked();
+}
+
+void DistpartDialog::setuploadftpkdeorgCheckBoxState(bool state) {
+ uploadftpkdeorgCheckBox->setChecked(state);
+}
+
+// QCheckBox* devPackageCheckBox;
+bool DistpartDialog::getdevPackageCheckBoxState() {
+ return devPackageCheckBox->isChecked();
+}
+
+void DistpartDialog::setdevPackageCheckBoxState(bool state) {
+ devPackageCheckBox->setChecked(state);
+}
+
+// QCheckBox* docsPackageCheckBox;
+bool DistpartDialog::getdocsPackageCheckBoxState() {
+ return docsPackageCheckBox->isChecked();
+}
+
+void DistpartDialog::setdocsPackageCheckBoxState(bool state) {
+ docsPackageCheckBox->setChecked(state);
+}
+
+// QLineEdit* archNameFormatLineEdit;
+QString DistpartDialog::getarchNameFormatLineEditText() {
+ return archNameFormatLineEdit->text();
+}
+
+void DistpartDialog::setarchNameFormatLineEditText(QString text) {
+ archNameFormatLineEdit->setText(text);
+}
+
+// QLineEdit* appNameLineEdit;
+QString DistpartDialog::getappNameFormatLineEditText() {
+ return appNameLineEdit->text();
+}
+
+void DistpartDialog::setappNameFormatLineEditText(QString text) {
+ appNameLineEdit->setText(text);
+}
+
+// QLineEdit* summaryLineEdit;
+QString DistpartDialog::getsummaryLineEditText() {
+ return summaryLineEdit->text();
+}
+
+void DistpartDialog::setsummaryLineEditText(QString text) {
+ summaryLineEdit->setText(text);
+}
+
+// QLineEdit* groupLineEdit;
+QString DistpartDialog::getgroupLineEditText() {
+ return groupLineEdit->text();
+}
+
+void DistpartDialog::setgroupLineEditText(QString text) {
+ groupLineEdit->setText(text);
+}
+
+// QLineEdit* releaseLineEdit;
+QString DistpartDialog::getreleaseLineEditText() {
+ return releaseLineEdit->text();
+}
+
+void DistpartDialog::setreleaseLineEditText(QString text) {
+ releaseLineEdit->setText(text);
+}
+
+// QLineEdit* VersionLineEdit;
+QString DistpartDialog::getversionLineEditText() {
+ return versionLineEdit->text();
+}
+
+void DistpartDialog::setversionLineEditText(QString text) {
+ versionLineEdit->setText( text );
+}
+
+// QLineEdit* VendorLineEdit;
+QString DistpartDialog::getvendorLineEditText() {
+ return vendorLineEdit->text();
+}
+
+void DistpartDialog::setvendorLineEditText(QString text) {
+ vendorLineEdit->setText(text);
+}
+
+// QLineEdit* LicenseLineEdit;
+QString DistpartDialog::getlicenseLineEditText() {
+ return licenseLineEdit->text();
+}
+
+void DistpartDialog::setlicenseLineEditText(QString text) {
+ licenseLineEdit->setText(text);
+}
+
+// QLineEdit* uploadURLLineEdit;
+QString DistpartDialog::getuploadURLLineEditText() {
+ return uploadURLLineEdit->text();
+}
+
+void DistpartDialog::setuploadURLLineEditText(QString text) {
+ uploadURLLineEdit->setText(text);
+}
+
+// QLineEdit* PackagerLineEdit;
+QString DistpartDialog::getpackagerLineEditText() {
+ return packagerLineEdit->text();
+}
+
+void DistpartDialog::setpackagerLineEditText(QString text) {
+ packagerLineEdit->setText(text);
+}
+
+// QComboBox* archComboBox;
+QString DistpartDialog::getarchComboBoxText() {
+ return archComboBox->currentText();
+}
+
+int DistpartDialog::getarchComboBoxItem() {
+ return archComboBox->currentItem();
+}
+
+void DistpartDialog::setarchComboBoxItem(int item) {
+ archComboBox->setCurrentItem( item );
+}
+
+// QListBox* uploadFileListBox;
+QString DistpartDialog::getuploadFileListBoxText() {
+ return uploadFileListBox->currentText();
+}
+
+int DistpartDialog::getuploadFileListBoxItem() {
+ return uploadFileListBox->currentItem();
+}
+
+void DistpartDialog::setuploadFileListBoxItem(int item) {
+ uploadFileListBox->setCurrentItem( item);
+}
+
+// QListBox* srcDistFileListBox;
+QString DistpartDialog::getsrcDistFileListBoxText() {
+ return srcDistFileListBox->currentText ();
+}
+
+int DistpartDialog::getsrcDistFileListBoxItem() {
+ return srcDistFileListBox->currentItem ();
+}
+
+void DistpartDialog::setsrcDistFileListBoxItem(int item) {
+ srcDistFileListBox->setCurrentItem( item );
+}
+
+// QMultiLineEdit* projectDescriptionMultilineEdit;
+QString DistpartDialog::getprojectDescriptionMultilineEditText() {
+ return projectDescriptionMultilineEdit->text();
+}
+
+void DistpartDialog::setprojectDescriptionMultilineEditText(QString text) {
+ projectDescriptionMultilineEdit->setText(text);
+}
+
+QString DistpartDialog::getprojectChangelogMultilineEditText() {
+ return projectChangelogMultilineEdit->text();
+}
+
+void DistpartDialog::setprojectChangelogMultilineEditText(QString text) {
+ projectChangelogMultilineEdit->setText(text);
+}
+
+QString DistpartDialog::getSourceName() {
+ QString name = (getcustomProjectCheckBoxState()) ? getarchNameFormatLineEditText() : QString("%n-%v");
+ name += (getcustomProjectCheckBoxState() && getbzipCheckBoxState()) ? ".tar.bz2" : ".tar.gz";
+ return name.replace(QRegExp("%n"),getappNameFormatLineEditText())
+ .replace(QRegExp("%v"),getversionLineEditText())
+ .replace(QRegExp("%d"),QDate::currentDate().toString("yyyyMMdd"));
+}
+
+void DistpartDialog::loadSettings() {
+ QDomDocument &dom = *m_part->projectDom();
+
+ srcDistFileListBox->insertStringList( m_part->project()->distFiles() );
+
+ // First Tab
+ setcustomProjectCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom",false));
+ slotcustomProjectCheckBoxChanged();
+ setbzipCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/bzip",false));
+ setarchNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/archname"));
+
+
+ // Second Tab
+ setappNameFormatLineEditText(DomUtil::readEntry(dom,"/dist/appname", m_part->project()->projectName() ));
+ setversionLineEditText(DomUtil::readEntry(dom,"/dist/version",DomUtil::readEntry(dom,"/general/version")));
+ setreleaseLineEditText(DomUtil::readEntry(dom,"/dist/release"));
+ setvendorLineEditText(DomUtil::readEntry(dom,"/dist/vendor"));
+ setlicenseLineEditText(DomUtil::readEntry(dom,"/dist/licence"));
+ setsummaryLineEditText(DomUtil::readEntry(dom,"/dist/summary"));
+ setgroupLineEditText(DomUtil::readEntry(dom,"/dist/group"));
+ setpackagerLineEditText(DomUtil::readEntry(dom,"/dist/packager"));
+ setprojectDescriptionMultilineEditText(DomUtil::readEntry(dom,"/dist/description",DomUtil::readEntry(dom,"/general/description")));
+ setprojectChangelogMultilineEditText(DomUtil::readEntry(dom,"/dist/changelog"));
+ setdevPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/devpackage"));
+ setdocsPackageCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/docspackage"));
+ setappIconCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appicon"));
+ setarchComboBoxItem(DomUtil::readIntEntry(dom,"/dist/arch"));
+
+ // Third Tab
+ setgenHTMLCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/genHTML"));
+ setuseRPMInfoCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/useRPM"));
+ setuploadftpkdeorgCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/ftpkde"));
+ setuploadAppsKDEcomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/appskde"));
+ setuploadCustomCheckBoxState(DomUtil::readBoolEntry(dom,"/dist/custom"));
+ slotuploadCustomCheckBoxChanged();
+ setuploadURLLineEditText(DomUtil::readEntry(dom,"/dist/url"));
+}
+
+void DistpartDialog::storeSettings() {
+ QDomDocument &dom = *m_part->projectDom();
+
+ // First Tab
+ DomUtil::writeBoolEntry(dom,"/dist/custom",getcustomProjectCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/bzip",getbzipCheckBoxState());
+ DomUtil::writeEntry(dom,"/dist/archname",getarchNameFormatLineEditText());
+
+ // Second Tab
+ DomUtil::writeEntry(dom,"/dist/appname",getappNameFormatLineEditText());
+ DomUtil::writeEntry(dom,"/dist/version",getversionLineEditText());
+ DomUtil::writeEntry(dom,"/dist/release",getreleaseLineEditText());
+ DomUtil::writeEntry(dom,"/dist/vendor",getvendorLineEditText());
+ DomUtil::writeEntry(dom,"/dist/licence",getlicenseLineEditText());
+ DomUtil::writeEntry(dom,"/dist/summary",getsummaryLineEditText());
+ DomUtil::writeEntry(dom,"/dist/group",getgroupLineEditText());
+ DomUtil::writeEntry(dom,"/dist/packager",getpackagerLineEditText());
+ DomUtil::writeEntry(dom,"/dist/description",getprojectDescriptionMultilineEditText());
+ DomUtil::writeEntry(dom,"/dist/changelog",getprojectChangelogMultilineEditText());
+ DomUtil::writeBoolEntry(dom,"/dist/devpackage",getdevPackageCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/docspackage",getdocsPackageCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/appicon",getappIconCheckBoxState());
+ DomUtil::writeIntEntry(dom,"/dist/arch",getarchComboBoxItem());
+
+ // Third Tab
+ DomUtil::writeBoolEntry(dom,"/dist/genHTML",getgenHTMLCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/useRPM",getuseRPMInfoCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/ftpkde",getuploadftpkdeorgCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/appskde",getuploadAppsKDEcomCheckBoxState());
+ DomUtil::writeBoolEntry(dom,"/dist/custom",getuploadCustomCheckBoxState());
+ DomUtil::writeEntry(dom,"/dist/url",getuploadURLLineEditText());
+}
+// Populate Spec Data from UI;
+void DistpartDialog::setPackageData()
+{
+ m_spec->setAppRevision( releaseLineEdit->text());
+ m_spec->setAppName( appNameLineEdit->text());
+ m_spec->setAppVendor( vendorLineEdit->text());
+ m_spec->setAppLicense( licenseLineEdit->text());
+ m_spec->setAppSummary( summaryLineEdit->text());
+ m_spec->setAppPackager( packagerLineEdit->text());
+ m_spec->setAppVersion( versionLineEdit->text());
+ m_spec->setAppGroup( groupLineEdit->text());
+ m_spec->setAppDescription( projectDescriptionMultilineEdit->text());
+ m_spec->setAppChangelog( projectChangelogMultilineEdit->text());
+}
+// Populate UI from Spec data;
+void DistpartDialog::getPackageData()
+{
+ releaseLineEdit->setText(m_spec->getAppRevision());
+ appNameLineEdit->setText(m_spec->getAppName());
+ vendorLineEdit->setText(m_spec->getAppVendor());
+ licenseLineEdit->setText(m_spec->getAppLicense( ));
+ summaryLineEdit->setText(m_spec->getAppSummary( ));
+ packagerLineEdit->setText(m_spec->getAppPackager( ));
+ versionLineEdit->setText(m_spec->getAppVersion());
+ groupLineEdit->setText(m_spec->getAppGroup( ));
+ projectDescriptionMultilineEdit->setText(m_spec->getAppDescription( ));
+ projectChangelogMultilineEdit->setText(m_spec->getAppChangelog( ));
+}
+void DistpartDialog::slotbuildAllPushButtonPressed( )
+{
+ setPackageData();
+ m_spec->slotbuildAllPushButtonPressed();
+}
+
+void DistpartDialog::slotexportSPECPushButtonPressed( )
+{
+ setPackageData();
+ m_spec->slotexportSPECPushButtonPressed();
+}
+
+void DistpartDialog::slotimportSPECPushButtonPressed( )
+{
+ m_spec->slotimportSPECPushButtonPressed();
+ getPackageData();
+}
+
+void DistpartDialog::slotsrcPackagePushButtonPressed( )
+{
+ setPackageData();
+ m_spec->slotsrcPackagePushButtonPressed();
+}
+
+
+void DistpartDialog::slotAddFileButtonPressed(){
+ QStringList filenames = KFileDialog::getOpenFileNames();
+ for(uint count =0; count< filenames.size(); count++){
+ QString base = m_part->project()->projectDirectory() +"/";
+ srcDistFileListBox->insertItem(filenames[count].remove(base));
+ }
+}
+
+void DistpartDialog::slotRemoveFile(QListBoxItem *item){
+ if ( KMessageBox::Yes == KMessageBox::warningYesNo( this, i18n("Remove %1").arg( item->text() ), i18n("Remove File") )){
+ for(uint count =0; count< srcDistFileListBox->numRows(); count++){
+ if ( item == srcDistFileListBox->item(count)){
+ srcDistFileListBox->removeItem(count);
+ break;
+ }
+ }
+ }
+}
+
+#include "distpart_widget.moc"
diff --git a/parts/distpart/distpart_widget.h b/parts/distpart/distpart_widget.h
new file mode 100644
index 00000000..81d91700
--- /dev/null
+++ b/parts/distpart/distpart_widget.h
@@ -0,0 +1,210 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __DISTPART_WIDGET_H__
+#define __DISTPART_WIDGET_H__
+
+
+#include <qwidget.h>
+#include <qstring.h>
+#include "distpart_ui.h"
+#include <klistbox.h>
+#include <qcheckbox.h>
+#include <kpushbutton.h>
+#include <klineedit.h>
+#include <ktextedit.h>
+#include <qcombobox.h>
+#include <qprogressbar.h>
+
+class KDevProject;
+class DistpartPart;
+class QUrlOperator;
+class KProcess;
+class QTabWidget;
+class SpecSupport;
+
+namespace KParts {
+class ReadOnlyPart;
+}
+
+
+class DistpartDialog : public distpart_ui {
+ Q_OBJECT
+
+public:
+
+ DistpartDialog(DistpartPart *part, QWidget *parent);
+ ~DistpartDialog();
+
+signals:
+ void okay();
+ void cancel();
+ void help();
+ void createsrc();
+ void resetsrc();
+ void buildall();
+ void savespec();
+ void loadspec();
+ void srcrpm();
+ void genhtml();
+ void resethtml();
+ void upload();
+ void resetupload();
+
+ // Accessors and mutators to control GUI
+ // Connect Slots to the following widgets
+
+
+public slots:
+ // QPushButton* okayPushButton;
+
+
+ void slotokayPushButtonPressed();
+ // QPushButton* cancelPushButton;
+ void slotcancelPushButtonPressed();
+ // QPushButton* help_PushButton;
+// void slothelp_PushButtonPressed();
+ // QPushButton* createSrcArchPushButton;
+ void slotcreateSrcArchPushButtonPressed();
+ // QPushButton* resetSrcPushButton;
+ void slotresetSrcPushButtonPressed();
+
+ // QPushButton* genHTMLPushButton;
+ void slotgenHTMLPushButtonPressed();
+ // QPushButton* resetHTMLPushButton;
+ void slotresetHTMLPushButtonPressed();
+ // QToolButton* uploadAddFileToolButton;
+ void slotuploadAddFileToolButtonPressed();
+ // QToolButton* uploadRemoveToolButton;
+ void slotuploadRemoveToolButtonPressed();
+ // QPushButton* uploadSubmitPushButton;
+ void slotuploadSubmitPushButtonPressed();
+ // QPushButton* uploadResetPushButton;
+ void slotuploadResetPushButtonPressed();
+
+ // Connect Slots to the following widgets and add
+ // accessors and mutators
+ // QCheckBox* customProjectCheckBox;
+ void slotcustomProjectCheckBoxChanged();
+ // QCheckBox* uploadCustomCheckBox;
+ void slotuploadCustomCheckBoxChanged();
+
+ void slotbuildAllPushButtonPressed();
+ void slotexportSPECPushButtonPressed();
+ void slotimportSPECPushButtonPressed();
+ void slotsrcPackagePushButtonPressed();
+ void slotAddFileButtonPressed();
+ void slotRemoveFile(QListBoxItem *item);
+
+public:
+ bool getcustomProjectCheckBoxState();
+ void setcustomProjectCheckBoxState(bool state);
+ bool getuploadCustomCheckBoxState();
+ void setuploadCustomCheckBoxState(bool state);
+
+ // Add accessors and mutators for the following
+
+ // QCheckBox* bzipCheckBox;
+ bool getbzipCheckBoxState();
+ void setbzipCheckBoxState(bool state);
+ // QCheckBox* appIconCheckBox;
+ bool getappIconCheckBoxState();
+ void setappIconCheckBoxState(bool state);
+ // QCheckBox* genHTMLCheckBox;
+ bool getgenHTMLCheckBoxState();
+ void setgenHTMLCheckBoxState(bool state);
+ // QCheckBox* useRPMInfoCheckBox;
+ bool getuseRPMInfoCheckBoxState();
+ void setuseRPMInfoCheckBoxState(bool state);
+ // QCheckBox* uploadAppsKDEcomCheckBox;
+ bool getuploadAppsKDEcomCheckBoxState();
+ void setuploadAppsKDEcomCheckBoxState(bool state);
+ // QCheckBox* uploadftpkdeorgCheckBox;
+ bool getuploadftpkdeorgCheckBoxState();
+ void setuploadftpkdeorgCheckBoxState(bool state);
+ // QCheckBox* devPackageCheckBox;
+ bool getdevPackageCheckBoxState();
+ void setdevPackageCheckBoxState(bool state);
+ // QCheckBox* docsPackageCheckBox;
+ bool getdocsPackageCheckBoxState();
+ void setdocsPackageCheckBoxState(bool state);
+ // QLineEdit* archNameFormatLineEdit;
+ QString getarchNameFormatLineEditText();
+ void setarchNameFormatLineEditText(QString text);
+ // QLineEdit* appNameLineEdit;
+ QString getappNameFormatLineEditText();
+ void setappNameFormatLineEditText(QString text);
+ // QLineEdit* summaryLineEdit;
+ QString getsummaryLineEditText();
+ void setsummaryLineEditText(QString text);
+ // QLineEdit* groupLineEdit;
+ QString getgroupLineEditText();
+ void setgroupLineEditText(QString text);
+ // QLineEdit* releaseLineEdit;
+ QString getreleaseLineEditText();
+ void setreleaseLineEditText(QString text);
+ // QLineEdit* VersionLineEdit;
+ QString getversionLineEditText();
+ void setversionLineEditText(QString text);
+ // QLineEdit* VendorLineEdit;
+ QString getvendorLineEditText();
+ void setvendorLineEditText(QString text);
+ // QLineEdit* LicenseLineEdit;
+ QString getlicenseLineEditText();
+ void setlicenseLineEditText(QString text);
+ // QLineEdit* uploadURLLineEdit;
+ QString getuploadURLLineEditText();
+ void setuploadURLLineEditText(QString text);
+ // QLineEdit* PackagerLineEdit;
+ QString getpackagerLineEditText();
+ void setpackagerLineEditText(QString text);
+ // QComboBox* archComboBox;
+ QString getarchComboBoxText();
+ int getarchComboBoxItem();
+ void setarchComboBoxItem(int item);
+ // QListBox* uploadFileListBox;
+ QString getuploadFileListBoxText();
+ int getuploadFileListBoxItem();
+ void setuploadFileListBoxItem(int item);
+ // QListBox* srcDistFileListBox;
+ QString getsrcDistFileListBoxText();
+ int getsrcDistFileListBoxItem();
+ void setsrcDistFileListBoxItem(int item);
+ // QMultiLineEdit* projectDescriptionMultilineEdit;
+ QString getprojectDescriptionMultilineEditText();
+ void setprojectDescriptionMultilineEditText(QString text);
+
+ QString getprojectChangelogMultilineEditText();
+ void setprojectChangelogMultilineEditText(QString text);
+
+ QString getSourceName();
+
+private:
+ void loadSettings();
+ void storeSettings();
+ void setPackageData();
+ void getPackageData();
+
+ SpecSupport *m_spec;
+ DistpartPart *m_part;
+ QString dir;
+};
+
+
+#endif
diff --git a/parts/distpart/kdevdistpart.desktop b/parts/distpart/kdevdistpart.desktop
new file mode 100644
index 00000000..8eaf44ee
--- /dev/null
+++ b/parts/distpart/kdevdistpart.desktop
@@ -0,0 +1,70 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Aids in building and publishing the final project. Supports creation of RPM packages or source packages.
+Comment[ca]=Ajuda en la construcció i publicació del projecte final. Suporta la creació de paquets RPM o paquets font.
+Comment[da]=Hjælper til med at bygge og publicere det færdige projekt. Understøtter at oprette RPM-pakker og kildekodepakker.
+Comment[de]=Unterstützt beim Erstellen und Ausliefern des fertigen Projekts. Derzeit werden RPM- und Quell-Pakete unterstützt.
+Comment[el]=Βοηθά στην κατασκευή και δημοσίευση του τελικού έργου. Για την ώρα υποστηρίζεται μόνο η μορφή RPM.
+Comment[es]=Ayuda en la construcción y publicación del proyecto final. Contempla la creación de paquetes RPM y de código fuente.
+Comment[et]=Abi valmisprojekti ehitamisel ja avaldamisel. Toetatud on RPM-pakettide ja lähtekoodipakettide loomine.
+Comment[fr]=Outil d'aide à la construction et à la publication du projet final. Prend en charge la création de paquetages RPM ou de paquetages de sources.
+Comment[hu]=A projekt felépítésében és publikálásában segít. RPM és forráscsomagok készítését teszi lehetővé.
+Comment[it]=Aiuta nella compilazione e pubblicazione del progetto finale. Supporta la creazione di pacchetti RPM o di pacchetti sorgenti.
+Comment[ms]=Membantu dalam membina dan menerbitkan projek akhir. Menyokong penciptaan pakej RPM atau pakej sumber.
+Comment[nds]=Ünnerstütten för't Opstellen un Apenmaken vun't fardige Projekt. Ünnerstütt dat Opstellen vun RPMs un Bornpaketen.
+Comment[nl]=Helpt bij het bouwen en publiceren van het uiteindelijke project. Ondersteunt het aanmaken van RPM-pakketten of broncodepakketten.
+Comment[pl]=Pomoc w budowaniu i publikowaniu projektu. Obsługuje tworzenie pakietów RPM i paczek ze źródłami.
+Comment[pt]=Ajuda na construção e publicação do projecto final. Suporta a criação de pacotes RPM ou pacotes com código-fonte.
+Comment[pt_BR]=Auxilia na compilação e publicação do projeto final. Suporta a criação de pacotes RPM ou pacotes fontes.
+Comment[ru]=Помощник по сборке и распространению окончательных версий проекта. Поддерживает создание пакетов RPM или пакетов с исходным кодом.
+Comment[sk]=Pomáha pri vytváraní a publikovaní finálneho projektu. Podporované sú RPM a zdrojové balíčky.
+Comment[sr]=Помаже у грађењу и објављивању коначног пројекта. За сада је подржано стварање RPM и изворних пакета.
+Comment[sr@Latn]=Pomaže u građenju i objavljivanju konačnog projekta. Za sada je podržano stvaranje RPM i izvornih paketa.
+Comment[sv]=Hjälper till att bygga och publicera det färdiga projektet. Stöder att skapa RPM-paket och källkodspaket.
+Comment[zh_TW]=協助建立與發布最終專案版本。支援建立 RPM 套件與 RPM 源碼套件。
+Name=KDevdistpart
+Name[da]=KDevelop distpart
+Name[de]=Unterstützung für Paketerstellung (KDevelop)
+Name[hi]=के-डेव-डिस्टपार्ट
+Name[nds]=Paketopstell-Ünnerstütten för't KDevelop
+Name[sk]=KDev distribúcia
+Name[sv]=KDevelop distributionsdel
+Name[zh_TW]=KDevelop 發布元件
+GenericName=Final Packaging Support
+GenericName[ca]=Suport per a l'empaquetat final
+GenericName[da]=Endelig pakkestøtte
+GenericName[de]=Unterstützung für Paketerstellung
+GenericName[el]=Υποστήριξη τελικού πακέτου
+GenericName[es]=Soporte para empaquetado final
+GenericName[et]=Lõpp-pakendamise toetus
+GenericName[eu]=Azken paketatze euskarria
+GenericName[fa]=پشتیبانی بسته‌بندی نهایی
+GenericName[fr]=Gestion du conditionnement final
+GenericName[gl]=Soporte para empaquetado final
+GenericName[hu]=Csomagelőkészítő
+GenericName[it]=Supporto finale per la creazione di pacchetti
+GenericName[ja]=最終パッケージ化サポート
+GenericName[nds]=Ünnerstütten för't Paketopstellen
+GenericName[ne]=अन्तिम प्याकेजिङ समर्थन
+GenericName[nl]=Ondersteuning voor projectpublicatie
+GenericName[pl]=Obsługa ostatecznego pakowania
+GenericName[pt]=Suporte a Empacotamento Final
+GenericName[pt_BR]=Suporte ao Empacotamento Final
+GenericName[ru]=Сборка и распространение пакетов
+GenericName[sk]=Podpora finálneho balíčkovania
+GenericName[sl]=Podpora končnemu ustarjanju paketov
+GenericName[sr]=Подршка за коначно паковање
+GenericName[sr@Latn]=Podrška za konačno pakovanje
+GenericName[sv]=Stöd för slutpaketering
+GenericName[ta]=ஆதரவுள்ள கடைசி தொகுப்பு
+GenericName[tg]=Ҷамъкунӣ ва ҷорӣ намудани пакетҳо
+GenericName[tr]=Son Paketleme Desteği
+GenericName[zh_CN]=最终打包支持
+GenericName[zh_TW]=最終包裝支援
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevdistpart
+X-KDevelop-Version=5
+X-KDevelop-Scope=Project
+X-KDevelop-Properties=ProjectPackaging
diff --git a/parts/distpart/kdevpart_distpart.rc b/parts/distpart/kdevpart_distpart.rc
new file mode 100644
index 00000000..8b142d04
--- /dev/null
+++ b/parts/distpart/kdevpart_distpart.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="distpart" library="libdistpartplugin" version="2">
+<MenuBar>
+ <Menu name="project"><Text>&amp;Project</Text>
+ <Action name="make_dist" group="tools_project_operations"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/distpart/lsmsupport.cpp b/parts/distpart/lsmsupport.cpp
new file mode 100644
index 00000000..84414f6a
--- /dev/null
+++ b/parts/distpart/lsmsupport.cpp
@@ -0,0 +1,32 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "lsmsupport.h"
+
+LsmSupport::LsmSupport() : packageBase() {
+
+}
+
+LsmSupport::~LsmSupport() {
+}
+
+QString LsmSupport::generatePackage( )
+{
+ return "";
+}
diff --git a/parts/distpart/lsmsupport.h b/parts/distpart/lsmsupport.h
new file mode 100644
index 00000000..3f50c7ea
--- /dev/null
+++ b/parts/distpart/lsmsupport.h
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __LSMSUPPORT_H__
+#define __LSMSUPPORT_H__
+
+#include "packagebase.h"
+#include "distpart_part.h"
+
+class LsmSupport : public packageBase
+{
+
+public:
+ LsmSupport();
+ virtual ~LsmSupport();
+QString generatePackage( );
+};
+
+#endif
diff --git a/parts/distpart/packagebase.cpp b/parts/distpart/packagebase.cpp
new file mode 100644
index 00000000..797c2613
--- /dev/null
+++ b/parts/distpart/packagebase.cpp
@@ -0,0 +1,117 @@
+#include "packagebase.h"
+
+packageBase::packageBase() {
+
+}
+
+packageBase::~packageBase() {}
+
+QString packageBase::getAppName() {
+ return AppName;
+}
+
+QString packageBase::getAppVersion() {
+ return AppVersion;
+}
+
+QString packageBase::getAppRevision() {
+ return AppRevision;
+}
+
+QString packageBase::getAppGroup() {
+ return AppGroup;
+}
+
+QString packageBase::getAppPackager() {
+ return AppPackager;
+}
+
+QString packageBase::getAppURL() {
+ return AppURL;
+}
+
+QString packageBase::getAppSummary() {
+ return AppSummary;
+}
+
+QString packageBase::getAppVendor() {
+ return AppVendor;
+}
+
+QString packageBase::getAppLicense() {
+ return AppLicense;
+}
+
+QString packageBase::getAppArch() {
+ return AppArch;
+}
+
+QString packageBase::getAppDescription() {
+ return AppDescription;
+}
+
+QString packageBase::getAppChangelog() {
+ return AppChangelog;
+}
+
+QString packageBase::getAppSource() {
+ return AppSource;
+}
+
+QStringList packageBase::getAppFileList() {
+ return AppFileList;
+}
+
+void packageBase::setAppName(const QString& name) {
+ AppName = name;
+}
+
+void packageBase::setAppVersion(const QString& version){
+ AppVersion = version;
+}
+
+void packageBase::setAppRevision(const QString& revision){
+ AppRevision = revision;
+}
+
+void packageBase::setAppGroup(const QString& group){
+ AppGroup = group;
+}
+
+void packageBase::setAppPackager(const QString& packager){
+ AppPackager = packager;
+}
+
+void packageBase::setAppURL(const QString& url)
+{
+ AppURL = url;
+}
+
+void packageBase::setAppSummary(const QString& summary){
+ AppSummary = summary;
+}
+
+void packageBase::setAppVendor(const QString& vendor){
+ AppVendor = vendor;
+}
+
+void packageBase::setAppLicense(const QString& licence){
+ AppLicense = licence;
+}
+
+void packageBase::setAppArch(const QString& arch){
+ AppArch = arch;
+}
+
+void packageBase::setAppDescription(const QString& description){
+ AppDescription = description;
+}
+
+void packageBase::setAppChangelog(const QString& changelog){
+ AppChangelog = changelog;
+}
+
+void packageBase::setAppFileList( const QStringList & list )
+{
+ AppFileList = list;
+}
diff --git a/parts/distpart/packagebase.h b/parts/distpart/packagebase.h
new file mode 100644
index 00000000..17148982
--- /dev/null
+++ b/parts/distpart/packagebase.h
@@ -0,0 +1,84 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __PACKAGEBASE_H__
+#define __PACKAGEBASE_H__
+
+#include <kurl.h>
+#include <qstringlist.h>
+
+class packageBase
+{
+
+public:
+ packageBase();
+ virtual ~packageBase();
+
+// Generic accessors and mutators for child classes
+ virtual QString generatePackage( ) = 0 ;
+ //virtual bool loadFile(KURL theFile) = 0;
+ //virtual bool saveFile(KURL theFile) = 0;
+
+ virtual QString getAppName();
+ virtual QString getAppVersion();
+ virtual QString getAppRevision();
+ virtual QString getAppGroup();
+ virtual QString getAppPackager();
+ virtual QString getAppURL();
+ virtual QString getAppSummary();
+ virtual QString getAppVendor();
+ virtual QString getAppLicense();
+ virtual QString getAppArch();
+ virtual QString getAppDescription();
+ virtual QString getAppChangelog();
+ virtual QString getAppSource();
+ virtual QStringList getAppFileList();
+
+ virtual void setAppName(const QString&);
+ virtual void setAppVersion(const QString&);
+ virtual void setAppRevision(const QString&);
+ virtual void setAppGroup(const QString&);
+ virtual void setAppPackager(const QString&);
+ virtual void setAppURL(const QString&);
+ virtual void setAppSummary(const QString&);
+ virtual void setAppVendor(const QString&);
+ virtual void setAppLicense(const QString&);
+ virtual void setAppArch(const QString&);
+ virtual void setAppDescription(const QString&);
+ virtual void setAppChangelog(const QString&);
+ virtual void setAppFileList(const QStringList &list);
+
+ private:
+ QString AppName;
+ QString AppVersion;
+ QString AppRevision;
+ QString AppGroup;
+ QString AppPackager;
+ QString AppURL;
+ QString AppSummary;
+ QString AppVendor;
+ QString AppLicense;
+ QString AppArch;
+ QString AppDescription;
+ QString AppChangelog;
+ QString AppSource;
+ QStringList AppFileList;
+};
+
+#endif
diff --git a/parts/distpart/specsupport.cpp b/parts/distpart/specsupport.cpp
new file mode 100644
index 00000000..b9ba6e1e
--- /dev/null
+++ b/parts/distpart/specsupport.cpp
@@ -0,0 +1,315 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "specsupport.h"
+#include "kdevproject.h"
+#include "kdevmakefrontend.h"
+#include "distpart_widget.h"
+
+#include <kdebug.h>
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <kprocess.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qerrormessage.h>
+#include <qregexp.h>
+#include <qpushbutton.h>
+//#include <qvbox.h>
+#include <qgroupbox.h>
+#include <qtabwidget.h>
+#include <qmessagebox.h>
+
+/// \FIXME This is at least the fifth place in the kdevelop code something like this exists
+QString QRegExp_escape(const QString& str )
+{
+#if QT_VERSION >= 0x030100
+ return QRegExp::escape(str);
+#else
+ // this block is copyrighted by Trolltech AS (GPL)
+ static const char meta[] = "$()*+.?[\\]^{|}";
+ QString quoted = str;
+ int i = 0;
+
+ while ( i < (int) quoted.length() ) {
+ if ( strchr(meta, quoted[i].latin1()) != 0 )
+ quoted.insert( i++, "\\" );
+ i++;
+ }
+ return quoted;
+#endif
+}
+
+SpecSupport::SpecSupport(DistpartPart *part) : packageBase(), m_part(part) {
+ dir = "";
+
+// srcPackagePushButton = new QPushButton(i18n("Src Package"),area());
+// buildAllPushButton = new QPushButton(i18n("Src/Binary Packages"),area());
+// exportSPECPushButton = new QPushButton(i18n("Export SPEC File"),area());
+// importSPECPushButton = new QPushButton(i18n("Import SPEC File"),area());
+//
+//
+//
+// connect(buildAllPushButton, SIGNAL(clicked()),
+// this, SLOT(slotbuildAllPushButtonPressed()));
+// connect(exportSPECPushButton, SIGNAL(clicked()),
+// this, SLOT(slotexportSPECPushButtonPressed()));
+// connect(importSPECPushButton, SIGNAL(clicked()),
+// this, SLOT(slotimportSPECPushButtonPressed()));
+// connect(srcPackagePushButton, SIGNAL(clicked()),
+// this, SLOT(slotsrcPackagePushButtonPressed()));
+
+ parseDotRpmmacros();
+}
+
+SpecSupport::~SpecSupport() {
+}
+
+// QPushButton* buildAllPushButton;
+void SpecSupport::slotbuildAllPushButtonPressed() {
+ QMap<QString,QString>::Iterator it;
+ QFile file1(dir + "/" + getAppSource());
+ QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource());
+ if (!file2.exists()) {
+ if (!file1.exists()) {
+ QMessageBox::critical(0 ,i18n("Error"),i18n("You need to create a source archive first."));
+ return;
+ }
+ else
+ if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir,"cd " + KProcess::quote(dir) +
+ " && cp " + KProcess::quote(getAppSource()) + " " + KProcess::quote(*(map.find("_sourcedir"))));
+ }
+ if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir,"cd " + KProcess::quote((((it = map.find("_specdir")) != map.end()) ? (*it) : dir)) +
+ " && rpmbuild -ba " + m_part->project()->projectName() + ".spec");
+}
+
+// QPushButton* exportSPECPushButton;
+void SpecSupport::slotexportSPECPushButtonPressed() {
+ QMap<QString,QString>::Iterator it;
+ QString specname = ((it = map.find("_specdir")) != map.end()) ? (*it) : (m_part->project()->projectDirectory());
+ specname += ("/" + m_part->project()->projectName() + ".spec");
+ QFile file(specname);
+
+ if(file.open(IO_WriteOnly)) {
+ QTextStream stream(&file);
+ stream << generatePackage();
+ file.close();
+ } else {
+ kdDebug() << "TODO : intercept write error in SpecSupport::slotexportSPECPushButtonPressed()";
+ }
+}
+
+QString SpecSupport::getInfo(QString s, QString motif) {
+ QRegExp re(motif + "[ \t]*([^ \t].*[^ \t])[ \t]*");
+ if (re.exactMatch(s))
+ return re.cap(1);
+ return QString::null;
+}
+
+// QPushButton* importSPECPushButton;
+void SpecSupport::slotimportSPECPushButtonPressed() {
+ QString fileName = KFileDialog::getOpenFileName(dir,"*.spec");
+ if( fileName.isEmpty())
+ return;
+ QFile file(fileName);
+
+ if(file.open(IO_ReadOnly)) {
+ QTextStream stream(&file);
+
+ while (!stream.atEnd()) {
+ QString s = stream.readLine();
+ QString info;
+ if (!(info = getInfo(s,"Name:")).isEmpty())
+ setAppName(info);
+ else if (!(info = getInfo(s,"Version:")).isEmpty())
+ setAppVersion(info);
+ else if (!(info = getInfo(s,"Release:")).isEmpty())
+ setAppRevision(info);
+ else if (!(info = getInfo(s,"Vendor:")).isEmpty())
+ setAppVendor(info);
+ else if (!(info = getInfo(s,"Copyright:")).isEmpty())
+ setAppLicense(info);
+ else if (!(info = getInfo(s,"Summary:")).isEmpty())
+ setAppSummary(info);
+ else if (!(info = getInfo(s,"Group:")).isEmpty())
+ setAppGroup(info);
+ else if (!(info = getInfo(s,"Packager:")).isEmpty())
+ setAppPackager(info);
+ else if (s.startsWith("%description")) {
+ QString desc;
+ while (!stream.atEnd()) {
+ QString str = stream.readLine();
+ if (str.startsWith("%")) break;
+ else desc += str + "\n";
+ }
+ setAppDescription(desc);
+ }
+ else if (s.startsWith("%changelog")) {
+ QString change;
+ while (!stream.atEnd()) {
+ QString str = stream.readLine();
+ if (str.startsWith("%")) break;
+ else change += str + "\n";
+ }
+ setAppChangelog(change);
+ }
+ }
+ }
+}
+
+void SpecSupport::slotAddFileButtonPressed(){
+QString filename = KFileDialog::getOpenFileName ();
+}
+
+// QPushButton* srcPackagePushButton;
+void SpecSupport::slotsrcPackagePushButtonPressed() {
+ QMap<QString,QString>::Iterator it;
+
+ QFile file1(dir + "/" + getAppSource());
+ QFile file2(*(map.find("_sourcedir")) + "/" + getAppSource());
+ if (!file2.exists()) {
+ if (!file1.exists()) {
+ QMessageBox::critical(0,i18n("Error"),i18n("You need to create a source archive first."));
+ return;
+ }
+ else
+ if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir,"cd " + KProcess::quote(dir) +
+ " && cp " + KProcess::quote(getAppSource()) + " " + KProcess::quote(*(map.find("_sourcedir"))));
+ }
+ if (KDevMakeFrontend *makeFrontend = m_part->extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir,"cd " + KProcess::quote((((it = map.find("_specdir")) != map.end()) ? (*it) : dir)) +
+ " && rpmbuild -bs " + m_part->project()->projectName() + ".spec");
+}
+
+void SpecSupport::parseDotRpmmacros() {
+ QFile dotfile(QDir::homeDirPath() + "/.rpmmacros");
+
+ if (!dotfile.open(IO_ReadOnly)) {
+// QErrorMessage * msg = new QErrorMessage(this);
+// msg->message("It seems you don't have a ~/.rpmmacros\nYou may experience problems building packages.\n");
+// msg->exec();
+ return;
+ }
+ QTextStream stream(&dotfile);
+
+ // Perhaps will it appear as a necessity to parse the global rpm config file?
+
+ // Pre defined macros :
+ map.insert("name",getAppName());
+
+ // .rpmmacros parsing :
+ while (!stream.atEnd()) {
+ QString s = stream.readLine();
+ QRegExp re("%([^ \t]*)[ \t][ \t]*([^\t]*)$");
+ if(re.exactMatch(s)) {
+ QRegExp subst("%\\{([^%]*)\\}");
+ QString value = re.cap(2).stripWhiteSpace();
+
+ while(subst.search(value) != -1) {
+ value.replace(QRegExp("%\\{"+ QRegExp_escape( subst.cap(1) ) +"\\}"),*map.find(subst.cap(1)));
+ }
+ map.insert(re.cap(1),value);
+ }
+ }
+ dotfile.close();
+
+ // create directories if necessary :
+ createRpmDirectoryFromMacro("_topdir");
+ createRpmDirectoryFromMacro("_tmppath");
+ createRpmDirectoryFromMacro("_builddir");
+ createRpmDirectoryFromMacro("_rpmdir");
+ createRpmDirectoryFromMacro("_sourcedir");
+ createRpmDirectoryFromMacro("_specdir");
+ createRpmDirectoryFromMacro("_srcrpmdir");
+}
+
+bool SpecSupport::createRpmDirectoryFromMacro(const QString & name) {
+ QMap<QString,QString>::Iterator it;
+ if((it = map.find(name)) != map.end()) {
+ QDir dir(*it);
+ if (!dir.exists()) return dir.mkdir(*it);
+ }
+ return false;
+}
+
+QString SpecSupport::generatePackage( )
+{
+ QString spec;
+ spec += "# This spec file was generated by KDevelop \n";
+ spec += "# Please report any problem to KDevelop Team <kdevelop-devel@kdevelop.org> \n";
+ spec += "# Thanks to Matthias Saou for his explanations on http://freshrpms.net/docs/fight.html\n\n";
+
+ spec += "Name: " + getAppName() + "\n";
+ spec += "Version: " + getAppVersion() + "\n";
+ spec += "Release: " + getAppRevision() + "\n";
+ spec += "Vendor: " + getAppVendor() + "\n";
+ spec += "Copyright: " + getAppLicense() + "\n";
+ spec += "Summary: " + getAppSummary() + "\n";
+ spec += "Group: " + getAppGroup() + "\n";
+ spec += "Packager: " + getAppPackager() + "\n";
+ spec += "BuildRoot: %{_tmppath}/%{name}-root \n";
+ spec += "Source: " + getAppSource() + "\n";
+
+ spec += "\n";
+ spec += "%description\n";
+ spec += getAppDescription()+ "\n";
+
+ spec += "\n";
+ spec += "%prep\n";
+ spec += "%setup\n";
+ spec += "CFLAGS=\"$RPM_OPT_FLAGS\" CXXFLAGS=\"$RPM_OPT_FLAGS\" ./configure \\ \n";
+ spec += "--target=" + getAppArch() + "\n";
+ spec += "--disable-debug --enable-debug=no \n";
+
+ spec += "\n";
+ spec += "%build\n";
+ spec += "%configure\n";
+ spec += "make\n";
+
+ spec += "\n";
+ spec += "%install\n";
+ spec += "rm -rf %{buildroot}\n";
+ spec += "%makeinstall\n";
+
+ spec += "\n";
+ spec += "%clean\n";
+ spec += "rm -rf %{buildroot}\n";
+
+ spec += "\n";
+ spec += "%post -p /sbin/ldconfig\n";
+
+ spec += "%postun -p /sbin/ldconfig\n";
+
+ spec += "%files\n";
+ spec += "%defattr(-, root, root)\n";
+ spec += "%doc AUTHORS COPYING ChangeLog NEWS README TODO\n";
+ spec += "%{_bindir}/*\n";
+ spec += "%{_libdir}/*.so.*\n";
+ spec += "%{_datadir}/%{name}\n";
+ spec += "%{_mandir}/man8/*\n";
+
+ spec += "%changelog\n";
+ spec += getAppChangelog() + "\n";
+
+ return spec;
+}
diff --git a/parts/distpart/specsupport.h b/parts/distpart/specsupport.h
new file mode 100644
index 00000000..d64642e9
--- /dev/null
+++ b/parts/distpart/specsupport.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2004 by ian reinhart geiser *
+ * geiseri@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __SPECSUPPORT_H__
+#define __SPECSUPPORT_H__
+
+#include <qstring.h>
+#include <qmap.h>
+#include "packagebase.h"
+#include "distpart_part.h"
+#include "distpart_widget.h"
+
+class SpecSupport : public packageBase {
+
+public:
+ SpecSupport(DistpartPart *part);
+ ~SpecSupport();
+
+public:
+ QString generatePackage();
+ void slotbuildAllPushButtonPressed();
+ void slotexportSPECPushButtonPressed();
+ void slotimportSPECPushButtonPressed();
+ void slotsrcPackagePushButtonPressed();
+ void slotAddFileButtonPressed();
+
+private:
+ void parseDotRpmmacros();
+ bool createRpmDirectoryFromMacro(const QString & name);
+
+ QString getInfo(QString s, QString motif);
+
+ QString dir;
+ DistpartPart *m_part;
+ QMap<QString,QString> map;
+};
+
+#endif
diff --git a/parts/documentation/KDevDocumentationIface.cpp b/parts/documentation/KDevDocumentationIface.cpp
new file mode 100644
index 00000000..baac8b52
--- /dev/null
+++ b/parts/documentation/KDevDocumentationIface.cpp
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "KDevDocumentationIface.h"
+
+#include "documentation_part.h"
+
+KDevDocumentationIface::KDevDocumentationIface(DocumentationPart *part)
+ :QObject(part), DCOPObject("KDevDocumentation"), m_part(part)
+{
+}
+
+KDevDocumentationIface::~KDevDocumentationIface()
+{
+}
+
+void KDevDocumentationIface::lookupInIndex(QString term)
+{
+ m_part->lookInDocumentationIndex(term);
+}
+
+void KDevDocumentationIface::findInFinder(QString term)
+{
+ m_part->findInDocumentation(term);
+}
+
+void KDevDocumentationIface::searchInDocumentation(QString term)
+{
+ m_part->searchInDocumentation(term);
+}
+
+void KDevDocumentationIface::lookupInIndex()
+{
+ m_part->lookInDocumentationIndex();
+}
+
+void KDevDocumentationIface::searchInDocumentation()
+{
+ m_part->searchInDocumentation();
+}
+
+void KDevDocumentationIface::manPage(QString term)
+{
+ m_part->manPage(term);
+}
+
+void KDevDocumentationIface::infoPage(QString term)
+{
+ m_part->infoPage(term);
+}
+
+void KDevDocumentationIface::manPage()
+{
+ m_part->manPage();
+}
+
+void KDevDocumentationIface::infoPage()
+{
+ m_part->infoPage();
+}
+
+void KDevDocumentationIface::findInFinder( )
+{
+ m_part->findInDocumentation();
+}
+
+#include "KDevDocumentationIface.moc"
diff --git a/parts/documentation/KDevDocumentationIface.h b/parts/documentation/KDevDocumentationIface.h
new file mode 100644
index 00000000..e2fd402b
--- /dev/null
+++ b/parts/documentation/KDevDocumentationIface.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef KDEVDOCUMENTATIONIFACE_H
+#define KDEVDOCUMENTATIONIFACE_H
+
+#include <qobject.h>
+#include <dcopobject.h>
+
+class DocumentationPart;
+
+class KDevDocumentationIface : public QObject, public DCOPObject {
+ Q_OBJECT
+ K_DCOP
+public:
+ KDevDocumentationIface(DocumentationPart *part);
+ ~KDevDocumentationIface();
+
+k_dcop:
+ void lookupInIndex(QString term);
+ void findInFinder(QString term);
+ void searchInDocumentation(QString term);
+ void manPage(QString term);
+ void infoPage(QString term);
+
+ void lookupInIndex();
+ void findInFinder();
+ void searchInDocumentation();
+ void manPage();
+ void infoPage();
+
+private:
+ DocumentationPart *m_part;
+};
+
+#endif
diff --git a/parts/documentation/Makefile.am b/parts/documentation/Makefile.am
new file mode 100644
index 00000000..b8f4505d
--- /dev/null
+++ b/parts/documentation/Makefile.am
@@ -0,0 +1,32 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevdocumentation.la
+libkdevdocumentation_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevdocumentation_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la $(LIB_KHTML)
+
+libkdevdocumentation_la_SOURCES = documentation_part.cpp \
+ documentation_widget.cpp contentsview.cpp indexview.cpp docglobalconfigwidgetbase.ui \
+ docglobalconfigwidget.cpp docconfiglistview.cpp editcatalogdlgbase.ui editcatalogdlg.cpp \
+ docutils.cpp searchview.cpp bookmarkview.cpp editbookmarkdlg.ui \
+ find_documentationbase.ui find_documentation.cpp find_documentation_optionsbase.ui \
+ find_documentation_options.cpp selecttopicbase.ui selecttopic.cpp docprojectconfigwidgetbase.ui \
+ docprojectconfigwidget.cpp KDevDocumentationIface.cpp KDevDocumentationIface.skel \
+ addcatalogdlgbase.ui addcatalogdlg.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevdocumentation.desktop
+
+rcdir = $(kde_datadir)/kdevdocumentation
+rc_DATA = kdevpart_documentation.rc
+
+noinst_HEADERS = contentsview.h indexview.h docglobalconfigwidget.h \
+ docconfiglistview.h editcatalogdlg.h docutils.h searchview.h bookmarkview.h selecttopic.h \
+ docprojectconfigwidget.h KDevDocumentationIface.h addcatalogdlg.h
+SUBDIRS = interfaces plugins tools data protocols
+
+DOXYGEN_EMPTY = YES
+include ../../Doxyfile.am
diff --git a/parts/documentation/README.dox b/parts/documentation/README.dox
new file mode 100644
index 00000000..63658d49
--- /dev/null
+++ b/parts/documentation/README.dox
@@ -0,0 +1,21 @@
+/** \class Documentation
+Documentation plugin for KDevelop.
+
+\authors <a href="mailto:cloudtemple@mksat.net">Alexander Dymo</a>
+
+\maintainer <a href="mailto:cloudtemple@mksat.net">Alexander Dymo</a>
+
+\feature Qt API browsing
+\feature KDE API browsing
+\feature Devhelp books browsing (GTK/GNOME API)
+\feature KDevelopTOC browsing
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=documentation&
+bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">
+Documentation viewer at Bugzilla database</a>
+
+\requirement Ht://Dig requires htdig to be installed.
+
+\todo Add support for documentation profiles. Application wizard or an application template
+can select necessary profile to modify the list of enabled documentation catalogs.
+*/
diff --git a/parts/documentation/addcatalogdlg.cpp b/parts/documentation/addcatalogdlg.cpp
new file mode 100644
index 00000000..9c46d2d1
--- /dev/null
+++ b/parts/documentation/addcatalogdlg.cpp
@@ -0,0 +1,112 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "addcatalogdlg.h"
+
+#include <qlabel.h>
+#include <qcombobox.h>
+
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+#include <kdebug.h>
+
+#include "docutils.h"
+#include "kdevdocumentationplugin.h"
+
+AddCatalogDlg::AddCatalogDlg( QValueList<DocumentationPlugin*> const & plugins,
+ QWidget* parent, const char* name, bool modal, WFlags fl)
+ :AddCatalogDlgBase(parent,name, modal,fl), m_plugins( plugins )
+{
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_plugins.constBegin(); it != m_plugins.constEnd(); ++it)
+ {
+ docTypeCombo->insertItem( (*it)->pluginName() );
+ }
+
+ docTypeChanged( QString() );
+}
+
+AddCatalogDlg::~AddCatalogDlg()
+{
+}
+
+void AddCatalogDlg::locationURLChanged(const QString &text)
+{
+ DocumentationPlugin * plugin = this->plugin();
+ if ( !plugin ) return;
+
+ titleEdit->setText( plugin->catalogTitle(DocUtils::noEnvURL(text)) );
+}
+
+void AddCatalogDlg::accept()
+{
+ QDialog::accept();
+}
+
+QString AddCatalogDlg::title() const
+{
+ return titleEdit->text();
+}
+
+QString AddCatalogDlg::url() const
+{
+ return DocUtils::envURL(locationURL);
+}
+
+void AddCatalogDlg::setTitle(const QString &title)
+{
+ titleEdit->setText(title);
+}
+
+void AddCatalogDlg::setURL(const QString &url)
+{
+ locationURL->setURL(url);
+}
+
+DocumentationPlugin * AddCatalogDlg::plugin( )
+{
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_plugins.constBegin(); it != m_plugins.constEnd(); ++it)
+ {
+ if ( docTypeCombo->currentText() == (*it)->pluginName() )
+ {
+ return *it;
+ }
+ }
+ return 0;
+}
+
+void AddCatalogDlg::docTypeChanged( const QString & )
+{
+ kdDebug() << k_funcinfo << endl;
+
+ DocumentationPlugin * plugin = this->plugin();
+ if ( plugin )
+ {
+ titleLabel->setEnabled( plugin->hasCapability(DocumentationPlugin::CustomDocumentationTitles) );
+ titleEdit->setEnabled( plugin->hasCapability(DocumentationPlugin::CustomDocumentationTitles) );
+ locationURL->setMode( plugin->catalogLocatorProps().first );
+ locationURL->setFilter( plugin->catalogLocatorProps().second );
+ }
+
+}
+
+
+
+#include "addcatalogdlg.moc"
diff --git a/parts/documentation/addcatalogdlg.h b/parts/documentation/addcatalogdlg.h
new file mode 100644
index 00000000..a04d5edc
--- /dev/null
+++ b/parts/documentation/addcatalogdlg.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef ADDCATALOGDLG_H
+#define ADDCATALOGDLG_H
+
+#include <qvaluelist.h>
+#include "addcatalogdlgbase.h"
+
+class DocumentationPlugin;
+
+class AddCatalogDlg: public AddCatalogDlgBase
+{
+ Q_OBJECT
+ public:
+ AddCatalogDlg( QValueList<DocumentationPlugin*> const & plugins, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~AddCatalogDlg();
+
+ QString title() const;
+ void setTitle(const QString &title);
+ QString url() const;
+ void setURL(const QString &url);
+ DocumentationPlugin * plugin();
+
+ public slots:
+ virtual void locationURLChanged(const QString &text);
+ virtual void docTypeChanged( const QString & );
+
+ protected slots:
+ virtual void accept();
+
+ private:
+ QValueList<DocumentationPlugin*> const & m_plugins;
+};
+
+#endif
diff --git a/parts/documentation/addcatalogdlgbase.ui b/parts/documentation/addcatalogdlgbase.ui
new file mode 100644
index 00000000..5274d12b
--- /dev/null
+++ b/parts/documentation/addcatalogdlgbase.ui
@@ -0,0 +1,209 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>AddCatalogDlgBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>AddCatalogDlgBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>398</width>
+ <height>222</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Documentation Catalog Properties</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout20</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="3" column="0">
+ <property name="name">
+ <cstring>titleEdit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Type:</string>
+ </property>
+ </widget>
+ <spacer row="6" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>18</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KURLRequester" row="1" column="0">
+ <property name="name">
+ <cstring>locationURL</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Locatio&amp;n:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>locationURL</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>titleLabel</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Title:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>titleEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="5" column="0">
+ <property name="name">
+ <cstring>docTypeCombo</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>AddCatalogDlgBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>AddCatalogDlgBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>locationURL</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>AddCatalogDlgBase</receiver>
+ <slot>locationURLChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>docTypeCombo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>AddCatalogDlgBase</receiver>
+ <slot>docTypeChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>locationURL</sender>
+ <signal>urlSelected(const QString&amp;)</signal>
+ <receiver>AddCatalogDlgBase</receiver>
+ <slot>locationURLChanged(const QString&amp;)</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>locationURLChanged( const QString &amp; )</slot>
+ <slot>docTypeChanged( const QString &amp; )</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/documentation/bookmarkview.cpp b/parts/documentation/bookmarkview.cpp
new file mode 100644
index 00000000..33f67da4
--- /dev/null
+++ b/parts/documentation/bookmarkview.cpp
@@ -0,0 +1,285 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "bookmarkview.h"
+
+#include <qlayout.h>
+#include <qheader.h>
+#include <qpoint.h>
+
+#include <klineedit.h>
+#include <kstandarddirs.h>
+#include <klocale.h>
+#include <kdialog.h>
+#include <kpushbutton.h>
+#include <kurlrequester.h>
+#include <kpopupmenu.h>
+#include <kparts/part.h>
+#include <khtml_part.h>
+#include <dom/html_document.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevdocumentationplugin.h>
+
+#include "documentation_part.h"
+#include "documentation_widget.h"
+#include "editbookmarkdlg.h"
+#include "docutils.h"
+
+DocBookmarkManager::DocBookmarkManager(DocumentationPart */*part*/)
+ :KBookmarkManager(locateLocal("data",
+ "kdevdocumentation/bookmarks/bookmarks.xml"), false)
+{
+ setEditorOptions(i18n("Documentation"), false);
+}
+
+DocBookmarkOwner::DocBookmarkOwner(DocumentationPart *part)
+ :KBookmarkOwner(), m_part(part)
+{
+}
+
+void DocBookmarkOwner::openBookmarkURL(const QString &_url)
+{
+ m_part->partController()->showDocument(KURL(_url));
+}
+
+QString DocBookmarkOwner::currentURL() const
+{
+ KParts::ReadOnlyPart *activePart = dynamic_cast<KParts::ReadOnlyPart*>(m_part->partController()->activePart());
+ if (activePart)
+ return activePart->url().url();
+ else
+ return QString::null;
+}
+
+QString DocBookmarkOwner::currentTitle() const
+{
+ KParts::ReadOnlyPart *activePart = dynamic_cast<KParts::ReadOnlyPart*>(m_part->partController()->activePart());
+ if (activePart)
+ {
+ KHTMLPart *htmlPart = dynamic_cast<KHTMLPart*>(activePart);
+ if (htmlPart)
+ return htmlPart->htmlDocument().title().string();
+ return activePart->url().prettyURL();
+ }
+ else
+ return QString::null;
+}
+
+class DocBookmarkItem: public DocumentationItem {
+public:
+ DocBookmarkItem(Type type, KListView *parent, const QString &name)
+ :DocumentationItem(type, parent, name)
+ {
+ }
+ DocBookmarkItem(Type type, KListView *parent, DocumentationItem *after, const QString &name)
+ :DocumentationItem(type, parent, after, name)
+ {
+ }
+ DocBookmarkItem(Type type, DocumentationItem *parent, const QString &name)
+ :DocumentationItem(type, parent, name)
+ {
+ }
+ void setBookmark(const KBookmark &bm) { m_bm = bm; }
+ KBookmark bookmark() const { return m_bm; }
+
+private:
+ KBookmark m_bm;
+};
+
+
+
+//class BookmarkView
+
+BookmarkView::BookmarkView(DocumentationWidget *parent, const char *name)
+ :QWidget(parent, name), m_widget(parent)
+{
+ m_bmManager = new DocBookmarkManager(m_widget->part());
+ m_bmOwner = new DocBookmarkOwner(m_widget->part());
+
+ QVBoxLayout *l = new QVBoxLayout(this, 0, KDialog::spacingHint());
+ m_view = new KListView(this);
+ m_view->addColumn(i18n("Title"));
+ m_view->setSorting(-1);
+ m_view->header()->hide();
+ m_view->setResizeMode(QListView::AllColumns);
+ m_view->setAllColumnsShowFocus( true );
+ l->addWidget(m_view);
+ QHBoxLayout *l2 = new QHBoxLayout(l, KDialog::spacingHint());
+ m_addButton = new KPushButton(i18n("Add"), this);
+ m_editButton = new KPushButton(i18n("Edit..."), this);
+ m_removeButton = new KPushButton(i18n("Remove"), this);
+ l2->addWidget(m_addButton);
+ l2->addWidget(m_editButton);
+ l2->addWidget(m_removeButton);
+ l2->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed));
+ l->addSpacing(2);
+
+ showBookmarks();
+
+ connect(m_view, SIGNAL(executed(QListViewItem*, const QPoint&, int )),
+ this, SLOT(itemExecuted(QListViewItem*, const QPoint&, int )));
+ connect(m_addButton, SIGNAL(pressed()), this, SLOT(addBookmark()));
+ connect(m_editButton, SIGNAL(clicked()), this, SLOT(editBookmark()));
+ connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
+
+ connect(m_widget->part(), SIGNAL(bookmarkLocation(const QString&, const KURL& )),
+ this, SLOT(addBookmark(const QString&, const KURL& )));
+ connect(m_view, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int )),
+ this, SLOT(itemMouseButtonPressed(int, QListViewItem*, const QPoint&, int )));
+}
+
+BookmarkView::~BookmarkView()
+{
+ delete m_bmManager;
+ delete m_bmOwner;
+}
+
+void BookmarkView::showBookmarks()
+{
+ const KBookmarkGroup &group = m_bmManager->root();
+ DocBookmarkItem *item = 0;
+ for (KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm))
+ {
+ if (item == 0)
+ item = new DocBookmarkItem(DocumentationItem::Document, m_view, bm.fullText());
+ else
+ item = new DocBookmarkItem(DocumentationItem::Document, m_view, item, bm.fullText());
+ item->setURL(bm.url());
+ item->setBookmark(bm);
+ }
+}
+
+void BookmarkView::itemExecuted(QListViewItem *item, const QPoint &// p
+ , int // col
+ )
+{
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
+ if (!docItem)
+ return;
+ m_widget->part()->partController()->showDocument(docItem->url());
+}
+
+void BookmarkView::removeBookmark()
+{
+ if (!m_view->currentItem())
+ return;
+ DocBookmarkItem *item = dynamic_cast<DocBookmarkItem*>(m_view->currentItem());
+ m_bmManager->root().deleteBookmark(item->bookmark());
+ m_bmManager->save();
+ delete item;
+}
+
+void BookmarkView::editBookmark()
+{
+ if (!m_view->currentItem())
+ return;
+ DocBookmarkItem *item = dynamic_cast<DocBookmarkItem*>(m_view->currentItem());
+ if (!item)
+ return;
+
+ EditBookmarkDlg dlg(this);
+ dlg.setCaption(i18n("Edit Bookmark"));
+ dlg.nameEdit->setText(item->bookmark().fullText());
+ dlg.locationEdit->setURL(item->bookmark().url().url());
+ dlg.nameEdit->setFocus();
+ if (dlg.exec())
+ {
+ item->bookmark().internalElement().namedItem("title").firstChild().toText().setData(dlg.nameEdit->text());
+ item->bookmark().internalElement().setAttribute("href", KURL(dlg.locationEdit->url()).url());
+ m_bmManager->save();
+
+ item->setText(0, item->bookmark().fullText());
+ item->setURL(item->bookmark().url());
+ }
+}
+
+void BookmarkView::addBookmark()
+{
+ QString title = m_bmOwner->currentTitle();
+ QString url = m_bmOwner->currentURL();
+
+ KPopupMenu menu;
+ bool useMenu = false;
+ if (!title.isEmpty() && !url.isEmpty())
+ {
+ menu.insertItem(i18n("Current Document"), 1);
+ menu.insertItem(i18n("Custom..."), 2);
+ useMenu = true;
+ }
+ int mode = 2;
+ if (useMenu)
+ {
+ m_addButton->setDown(true);
+ mode = menu.exec(mapToGlobal(QPoint(m_addButton->x(), m_addButton->y()+m_addButton->height())));
+ m_addButton->setDown(false);
+ }
+
+ switch (mode)
+ {
+ case 1:
+ addBookmark(title, url);
+ break;
+ case 2:
+ EditBookmarkDlg dlg(this);
+ dlg.setCaption(i18n("Add Bookmark"));
+/* dlg.nameEdit->setText(title);
+ dlg.locationEdit->setURL(url);*/
+ dlg.nameEdit->setFocus();
+ if (dlg.exec())
+ addBookmark(dlg.nameEdit->text(), KURL(dlg.locationEdit->url()));
+ m_addButton->setDown(false);
+ break;
+ }
+}
+
+void BookmarkView::addBookmark(const QString &title, const KURL &url)
+{
+ KBookmark bm = m_bmManager->root().addBookmark(m_bmManager, title, url);
+ m_bmManager->save();
+
+ DocBookmarkItem *item = 0;
+ if (m_view->lastItem())
+ item = dynamic_cast<DocBookmarkItem*>(m_view->lastItem());
+ if (item == 0)
+ item = new DocBookmarkItem(DocumentationItem::Document, m_view, bm.fullText());
+ else
+ item = new DocBookmarkItem(DocumentationItem::Document, m_view, item, bm.fullText());
+ item->setURL(bm.url());
+ item->setBookmark(bm);
+}
+
+void BookmarkView::itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int // c
+ )
+{
+ if ((button != Qt::RightButton) || (!item))
+ return;
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
+ if (!docItem)
+ return;
+
+ DocUtils::docItemPopup(m_widget->part(), docItem, pos, false, true);
+}
+
+void BookmarkView::focusInEvent(QFocusEvent */*e*/)
+{
+ m_view->setFocus();
+}
+
+#include "bookmarkview.moc"
diff --git a/parts/documentation/bookmarkview.h b/parts/documentation/bookmarkview.h
new file mode 100644
index 00000000..a46aa573
--- /dev/null
+++ b/parts/documentation/bookmarkview.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef BOOKMARKVIEW_H
+#define BOOKMARKVIEW_H
+
+#include <qwidget.h>
+
+#include <kbookmarkmanager.h>
+
+class KListView;
+class KPushButton;
+class DocumentationPart;
+class DocumentationWidget;
+class QListViewItem;
+
+class DocBookmarkManager: public KBookmarkManager {
+public:
+ DocBookmarkManager(DocumentationPart *part);
+};
+
+class DocBookmarkOwner: public KBookmarkOwner {
+public:
+ DocBookmarkOwner(DocumentationPart *part);
+
+ virtual void openBookmarkURL(const QString &_url);
+ virtual QString currentTitle() const;
+ virtual QString currentURL() const;
+
+private:
+ DocumentationPart *m_part;
+};
+
+class BookmarkView : public QWidget
+{
+ Q_OBJECT
+public:
+ BookmarkView(DocumentationWidget *parent = 0, const char *name = 0);
+ ~BookmarkView();
+
+public slots:
+ void addBookmark(const QString &title, const KURL &url);
+
+protected:
+ void showBookmarks();
+ virtual void focusInEvent(QFocusEvent *e);
+
+protected slots:
+ void itemExecuted(QListViewItem *item, const QPoint &p, int col);
+ void addBookmark();
+ void editBookmark();
+ void removeBookmark();
+ void itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int c);
+
+private:
+ DocumentationWidget *m_widget;
+ KListView *m_view;
+ KPushButton *m_addButton;
+ KPushButton *m_editButton;
+ KPushButton *m_removeButton;
+
+ DocBookmarkManager *m_bmManager;
+ DocBookmarkOwner *m_bmOwner;
+};
+
+#endif
diff --git a/parts/documentation/contentsview.cpp b/parts/documentation/contentsview.cpp
new file mode 100644
index 00000000..e69b048e
--- /dev/null
+++ b/parts/documentation/contentsview.cpp
@@ -0,0 +1,92 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "contentsview.h"
+
+#include <qheader.h>
+#include <qlayout.h>
+
+#include <kdebug.h>
+#include <klistview.h>
+#include <klocale.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevdocumentationplugin.h>
+
+#include "documentation_widget.h"
+#include "documentation_part.h"
+#include "docutils.h"
+
+ContentsView::ContentsView(DocumentationWidget *parent, const char *name)
+ :QWidget(parent, name), m_widget(parent)
+{
+ QVBoxLayout *cl = new QVBoxLayout(this, 0, 0);
+ m_view = new KListView(this);
+ cl->addWidget(m_view);
+
+ m_view->addColumn(i18n( "Contents" ));
+ m_view->header()->hide();
+ m_view->setResizeMode(QListView::AllColumns);
+ m_view->setRootIsDecorated(true);
+ m_view->setSorting(-1);
+ m_view->setAllColumnsShowFocus( true );
+
+ connect(m_view, SIGNAL(executed(QListViewItem*, const QPoint&, int )),
+ this, SLOT(itemExecuted(QListViewItem*, const QPoint&, int )));
+ connect(m_view, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int )),
+ this, SLOT(itemMouseButtonPressed(int, QListViewItem*, const QPoint&, int )));
+}
+
+ContentsView::~ContentsView()
+{
+ if (m_widget && m_widget->index())
+ m_widget->index()->clear();
+}
+
+void ContentsView::itemExecuted(QListViewItem *item, const QPoint &// p
+ , int // col
+ )
+{
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
+ if (!docItem)
+ return;
+ KURL url = DocUtils::noEnvURL(docItem->url());
+ if (url.isEmpty() || !url.isValid())
+ return;
+ m_widget->part()->partController()->showDocument(url);
+}
+
+void ContentsView::itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int // c
+ )
+{
+ if ((button != Qt::RightButton) || (!item))
+ return;
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
+ if (!docItem)
+ return;
+
+ DocUtils::docItemPopup(m_widget->part(), docItem, pos, true, true);
+}
+
+void ContentsView::focusInEvent(QFocusEvent */*e*/)
+{
+ m_view->setFocus();
+}
+
+#include "contentsview.moc"
diff --git a/parts/documentation/contentsview.h b/parts/documentation/contentsview.h
new file mode 100644
index 00000000..aaac6eee
--- /dev/null
+++ b/parts/documentation/contentsview.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef CONTENTSVIEW_H
+#define CONTENTSVIEW_H
+
+#include <qwidget.h>
+
+class FindDocumentation;
+class DocumentationWidget;
+class QListViewItem;
+class KListView;
+
+class ContentsView : public QWidget
+{
+ Q_OBJECT
+public:
+ ContentsView(DocumentationWidget *parent, const char *name = 0);
+ ~ContentsView();
+
+ KListView *view() const { return m_view; }
+
+protected slots:
+ void itemExecuted(QListViewItem *item, const QPoint &p, int col);
+ void itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int c);
+
+protected:
+ virtual void focusInEvent(QFocusEvent *e);
+
+private:
+ DocumentationWidget *m_widget;
+ KListView *m_view;
+
+friend class FindDocumentation;
+};
+
+#endif
diff --git a/parts/documentation/data/Makefile.am b/parts/documentation/data/Makefile.am
new file mode 100644
index 00000000..920c492a
--- /dev/null
+++ b/parts/documentation/data/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+METASOURCES = AUTO
+htmldir = $(kde_datadir)/kdevdocumentation/en
+picsdir = $(kde_datadir)/kdevdocumentation/pics
+html_DATA = long.html nomatch.html short.html syntax.html wrapper.html
+pics_DATA = checked.xpm htdig.png star.png star_blank.png unchecked.xpm
diff --git a/parts/documentation/data/checked.xpm b/parts/documentation/data/checked.xpm
new file mode 100644
index 00000000..1ed19024
--- /dev/null
+++ b/parts/documentation/data/checked.xpm
@@ -0,0 +1,23 @@
+/* XPM */
+static char*unchecked[]={
+"16 16 4 1",
+"# c #000000",
+"+ c #ffffff",
+"D c #000000",
+". c None",
+"................",
+"............++++",
+"..++++++++++DDD+",
+"..+########DDD+.",
+"..+#++++++DDD+..",
+"+DDD+...+DDD#+..",
+"++DDD+++DDD+#+..",
+"..+DDDDDDD++#+..",
+"..+#DDDDD+.+#+..",
+"..+#++DD+..+#+..",
+"..+#+++++..+#+..",
+"..+#++++++++#+..",
+"..+##########+..",
+"..++++++++++++..",
+"................",
+"................"};
diff --git a/parts/documentation/data/htdig.png b/parts/documentation/data/htdig.png
new file mode 100644
index 00000000..fe6e7c92
--- /dev/null
+++ b/parts/documentation/data/htdig.png
Binary files differ
diff --git a/parts/documentation/data/long.html b/parts/documentation/data/long.html
new file mode 100644
index 00000000..1d0fa4ce
--- /dev/null
+++ b/parts/documentation/data/long.html
@@ -0,0 +1,6 @@
+<dl><dt><strong><a href="$&(URL)">$&(TITLE)</a></strong>$(STARSLEFT)
+</dt><dd>$(EXCERPT)<br>
+<i><a href="$&(URL)">$&(URL)</a></i>
+<font size="-1">$(MODIFIED), $(SIZE) bytes</font>
+</dd></dl>
+
diff --git a/parts/documentation/data/nomatch.html b/parts/documentation/data/nomatch.html
new file mode 100644
index 00000000..8951a604
--- /dev/null
+++ b/parts/documentation/data/nomatch.html
@@ -0,0 +1,21 @@
+<html><head><title>No match for '$&(LOGICAL_WORDS)'</title></head>
+<body bgcolor="#ffffff" text="#000000" link="#aa0000">
+<h1><img src="$(PICDIR)kdevdocumentation/pics/htdig.png">
+Search results</h1>
+<hr noshade size="4">
+<h2>No matches were found for '$&(LOGICAL_WORDS)'</h2>
+<p>
+Check the spelling of the search word(s) you used.
+If the spelling is correct and you only used one word,
+try using one or more similar search words with "<b>Any</b>."
+</p><p>
+If the spelling is correct and you used more than one
+word with "<b>Any</b>," try using one or more similar search
+words with "<b>Any</b>."</p><p>
+If the spelling is correct and you used more than one
+word with "<b>All</b>," try using one or more of the same words
+with "<b>Any</b>."</p>
+<hr noshade size="4">
+<a href="http://www.htdig.org/">
+<img src="$(PICDIR)kdevdocumentation/pics/htdig.png" border="0">ht://Dig $(VERSION)</a>
+</body></html>
diff --git a/parts/documentation/data/short.html b/parts/documentation/data/short.html
new file mode 100644
index 00000000..e3e5e447
--- /dev/null
+++ b/parts/documentation/data/short.html
@@ -0,0 +1 @@
+$(STARSRIGHT) <strong><a href="$&(URL)">$&(TITLE)</a></strong><br>
diff --git a/parts/documentation/data/star.png b/parts/documentation/data/star.png
new file mode 100644
index 00000000..692cd35e
--- /dev/null
+++ b/parts/documentation/data/star.png
Binary files differ
diff --git a/parts/documentation/data/star_blank.png b/parts/documentation/data/star_blank.png
new file mode 100644
index 00000000..2689281a
--- /dev/null
+++ b/parts/documentation/data/star_blank.png
Binary files differ
diff --git a/parts/documentation/data/syntax.html b/parts/documentation/data/syntax.html
new file mode 100644
index 00000000..9701c37f
--- /dev/null
+++ b/parts/documentation/data/syntax.html
@@ -0,0 +1,19 @@
+<html><head><title>Error in Boolean search for '$&(WORDS)'</title></head>
+<body bgcolor="#ffffff" text="#000000" link="#aa0000">
+<h1><img src="$(PICDIR)kdevdocumentation/pics/htdig.png">
+Error in Boolean search for '$&(LOGICAL_WORDS)'</h1>
+<hr noshade size="4">
+Boolean expressions need to be 'correct' in order for the search
+system to use them.
+The expression you entered has errors in it.<p>
+Examples of correct expressions are: <b>cat and dog</b>, <b>cat
+not dog</b>, <b>cat or (dog not nose)</b>.<br>Note that
+the operator <b>not</b> has the meaning of 'without'.
+<blockquote><b>
+$(SYNTAXERROR)
+</b></blockquote>
+<hr noshade size="4">
+<a href="http://www.htdig.org/">
+<img src="$(PICDIR)kdevdocumentation/pics/htdig.png" border="0">ht://Dig $(VERSION)</a>
+</body></html>
+
diff --git a/parts/documentation/data/unchecked.xpm b/parts/documentation/data/unchecked.xpm
new file mode 100644
index 00000000..e447281a
--- /dev/null
+++ b/parts/documentation/data/unchecked.xpm
@@ -0,0 +1,22 @@
+/* XPM */
+static char*unchecked[]={
+"16 16 3 1",
+"# c #000000",
+"+ c #ffffff",
+". c None",
+"................",
+"................",
+"..++++++++++++..",
+"..+##########+..",
+"..+#++++++++#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#+......+#+..",
+"..+#++++++++#+..",
+"..+##########+..",
+"..++++++++++++..",
+"................",
+"................"};
diff --git a/parts/documentation/data/wrapper.html b/parts/documentation/data/wrapper.html
new file mode 100644
index 00000000..20c1bbf2
--- /dev/null
+++ b/parts/documentation/data/wrapper.html
@@ -0,0 +1,16 @@
+<html><head><title>Search results for '$&(WORDS)'</title></head>
+<body bgcolor="#ffffff" text="#000000" link="#aa0000">
+<h2><img src=$(PICDIR)kdevdocumentation/pics/htdig.png>
+Search results for '$&(LOGICAL_WORDS)'</h2>
+<hr noshade size="4">
+<b>
+More <img src=$(PICDIR)kdevdocumentation/pics/star.png alt="*">'s indicate a better match.
+</b>
+<hr noshade size="1">
+$(HTSEARCH_RESULTS)
+$(PAGEHEADER)
+$(PREVPAGE) $(PAGELIST) $(NEXTPAGE)
+<hr noshade size="4">
+<a href="http://www.htdig.org/">
+<img src=$(PICDIR)kdevdocumentation/pics/htdig.png border="0">ht://Dig $(VERSION)</a>
+</body></html>
diff --git a/parts/documentation/docconfiglistview.cpp b/parts/documentation/docconfiglistview.cpp
new file mode 100644
index 00000000..0865f105
--- /dev/null
+++ b/parts/documentation/docconfiglistview.cpp
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docconfiglistview.h"
+
+#include <klocale.h>
+
+#include "kdevdocumentationplugin.h"
+
+DocConfigListView::DocConfigListView(QWidget *parent, const char *name)
+ :KListView(parent, name)
+{
+// setSorting(-1);
+ addColumn(i18n("TOC"));
+ addColumn(i18n("Index"));
+ addColumn(i18n("Search"));
+ addColumn(i18n("Title"));
+// addColumn(i18n("URL"));
+ setColumnWidthMode(0, QListView::Maximum);
+ setColumnWidthMode(1, QListView::Maximum);
+ setColumnWidthMode(2, QListView::Maximum);
+ setColumnWidthMode(3, QListView::Maximum);
+// setColumnWidthMode(4, QListView::Maximum);
+ setAllColumnsShowFocus(true);
+ setResizeMode( QListView::LastColumn );
+
+ connect(this, SIGNAL(clicked(QListViewItem*, const QPoint&, int)),
+ this, SLOT(clickedItem(QListViewItem*, const QPoint&, int )));
+}
+
+DocConfigListView::~DocConfigListView()
+{
+}
+
+void DocConfigListView::clickedItem(QListViewItem *item, const QPoint &// pnt
+ , int c)
+{
+ if (!item)
+ return;
+ ConfigurationItem *cfg = dynamic_cast<ConfigurationItem*>(item);
+ if (!cfg)
+ return;
+ if (c == 0)
+ {
+ cfg->setContents(!cfg->contents());
+ if (!cfg->contents())
+ cfg->setIndex(false);
+ }
+ if ((c == 1) && (cfg->indexPossible()))
+ cfg->setIndex(!cfg->index());
+ else if ((c == 2) && (cfg->fullTextSearchPossible()))
+ cfg->setFullTextSearch(!cfg->fullTextSearch());
+ repaintItem(item);
+}
+
+#include "docconfiglistview.moc"
diff --git a/parts/documentation/docconfiglistview.h b/parts/documentation/docconfiglistview.h
new file mode 100644
index 00000000..089980cf
--- /dev/null
+++ b/parts/documentation/docconfiglistview.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCCONFIGLISTVIEW_H
+#define DOCCONFIGLISTVIEW_H
+
+#include <klistview.h>
+
+class DocConfigListView : public KListView
+{
+ Q_OBJECT
+public:
+ DocConfigListView(QWidget *parent = 0, const char *name = 0);
+ ~DocConfigListView();
+
+protected slots:
+ void clickedItem(QListViewItem *item, const QPoint &pnt, int c);
+};
+
+#endif
diff --git a/parts/documentation/docglobalconfigwidget.cpp b/parts/documentation/docglobalconfigwidget.cpp
new file mode 100644
index 00000000..cef510dc
--- /dev/null
+++ b/parts/documentation/docglobalconfigwidget.cpp
@@ -0,0 +1,259 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2002 by Sebastian Kratzert *
+ * skratzert@gmx.de *
+ * Copyright (C) 2003-2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docglobalconfigwidget.h"
+
+#include <qlayout.h>
+#include <qtoolbox.h>
+#include <qcheckbox.h>
+#include <qwidgetstack.h>
+
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kprocess.h>
+#include <kstandarddirs.h>
+#include <kapplication.h>
+#include <kurlrequester.h>
+#include <kfontcombo.h>
+#include <khtml_part.h>
+#include <khtml_settings.h>
+
+#include "kdevdocumentationplugin.h"
+#include "kdevpartcontroller.h"
+
+#include "docconfiglistview.h"
+#include "documentation_part.h"
+#include "documentation_widget.h"
+#include "editcatalogdlg.h"
+#include "addcatalogdlg.h"
+#include "contentsview.h"
+#include "indexview.h"
+#include "docutils.h"
+
+DocGlobalConfigWidget::DocGlobalConfigWidget(DocumentationPart *part,
+ DocumentationWidget *widget, QWidget *parent, const char *name, WFlags fl)
+ :DocGlobalConfigWidgetBase(parent, name, fl), m_part(part), m_widget(widget)
+{
+ m_View = new DocConfigListView( viewHolder );
+ viewHolder->addWidget( m_View );
+ viewHolder->raiseWidget( m_View );
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin();
+ it != m_part->m_plugins.constEnd(); ++it)
+ {
+ (*it)->loadCatalogConfiguration( m_View );
+ }
+
+ KConfig *config = m_part->config();
+ //read full text search settings
+ config->setGroup("htdig");
+ QString databaseDir = kapp->dirs()->saveLocation("data",
+ "kdevdocumentation/search");
+ databaseDirEdit->setURL(config->readPathEntry("databaseDir", databaseDir));
+ htdigbinEdit->setURL(config->readPathEntry("htdigbin", kapp->dirs()->findExe("htdig")));
+ htmergebinEdit->setURL(config->readPathEntry("htmergebin", kapp->dirs()->findExe("htmerge")));
+ htsearchbinEdit->setURL(config->readPathEntry("htsearchbin", kapp->dirs()->findExe("htsearch")));
+ if (config->readBoolEntry("IsSetup", false) == false)
+ {
+ QFileInfo fi(htsearchbinEdit->url());
+ if (!fi.exists())
+ {
+ //try to guess htsearch location on Debian
+ QFileInfo fi("/usr/lib/cgi-bin/htsearch");
+ if (!fi.exists())
+ {
+ //try to guess htsearch location on SuSE
+ QFileInfo fi("/srv/www/cgi-bin/htsearch");
+ if (fi.exists())
+ htsearchbinEdit->setURL("/srv/www/cgi-bin/htsearch");
+ }
+ else
+ htsearchbinEdit->setURL("/usr/lib/cgi-bin/htsearch");
+ }
+ }
+
+ find_box->setChecked(m_part->hasContextFeature(DocumentationPart::Finder));
+ index_box->setChecked(m_part->hasContextFeature(DocumentationPart::IndexLookup));
+ search_box->setChecked(m_part->hasContextFeature(DocumentationPart::FullTextSearch));
+ man_box->setChecked(m_part->hasContextFeature(DocumentationPart::GotoMan));
+ info_box->setChecked(m_part->hasContextFeature(DocumentationPart::GotoInfo));
+
+ useAssistant_box->setChecked(m_part->isAssistantUsed());
+
+ // Having app-specific settings isn't pretty, but this setting is nonsensical in kdevassistant
+ if ( kapp->instanceName().find("kdevassistant") != -1 )
+ useAssistant_box->hide();
+
+ //font sizes and zoom levels
+ KHTMLPart htmlpart;
+ KConfig *appConfig = KGlobal::config();
+ appConfig->setGroup("KHTMLPart");
+ standardFont_combo->setCurrentText(appConfig->readEntry("StandardFont",
+ htmlpart.settings()->stdFontName()));
+ fixedFont_combo->setCurrentText(appConfig->readEntry("FixedFont",
+ htmlpart.settings()->fixedFontName()));
+ zoom_combo->setCurrentText(appConfig->readEntry("Zoom", "100"));
+}
+
+DocGlobalConfigWidget::~DocGlobalConfigWidget()
+{
+}
+
+/*$SPECIALIZATION$*/
+void DocGlobalConfigWidget::collectionsBoxCurrentChanged(int // box
+ )
+{
+}
+
+void DocGlobalConfigWidget::removeCollectionButtonClicked()
+{
+ ConfigurationItem *item = dynamic_cast<ConfigurationItem*>(activeView()->currentItem());
+ if (!item)
+ return;
+ item->docPlugin()->deleteCatalogConfiguration(item);
+ delete activeView()->currentItem();
+}
+
+void DocGlobalConfigWidget::editCollectionButtonClicked()
+{
+ ConfigurationItem *item = dynamic_cast<ConfigurationItem*>(activeView()->currentItem());
+ if (!item)
+ return;
+ EditCatalogDlg dlg( item->docPlugin(), this, "edit collection dlg", true);
+ dlg.setURL(item->url());
+ dlg.setTitle(item->title());
+ if (dlg.exec())
+ {
+ item->docPlugin()->deleteCatalogConfiguration(item); // this removes the old entry by name
+ item->docPlugin()->editCatalogConfiguration(item, dlg.title(), dlg.url());
+ }
+}
+
+void DocGlobalConfigWidget::addCollectionButtonClicked()
+{
+ AddCatalogDlg dlg( m_part->m_plugins, this, "add collection dlg", true);
+ if (dlg.exec())
+ {
+ dlg.plugin()->addCatalogConfiguration(activeView(), dlg.title(), dlg.url());
+ }
+}
+
+KListView *DocGlobalConfigWidget::activeView()
+{
+ return m_View;
+}
+
+void DocGlobalConfigWidget::accept()
+{
+ //write catalog settings
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin();
+ it != m_part->m_plugins.constEnd(); ++it)
+ {
+ (*it)->saveCatalogConfiguration( m_View );
+ //@todo: take restrictions into account
+ (*it)->reinit(m_widget->contents(), m_widget->index(), QStringList());
+ }
+
+ KConfig *config = m_part->config();
+ //write full text search settings
+ config->setGroup("htdig");
+ config->writePathEntry("databaseDir", DocUtils::envURL(databaseDirEdit));
+ config->writePathEntry("htdigbin", DocUtils::envURL(htdigbinEdit));
+ config->writePathEntry("htmergebin", DocUtils::envURL(htmergebinEdit));
+ config->writePathEntry("htsearchbin", DocUtils::envURL(htsearchbinEdit));
+
+ //write full text search locations file
+ QString ftsLocationsFile = locateLocal("data", "kdevdocumentation/search/locations.txt");
+ QFile f(ftsLocationsFile);
+ QStringList locs;
+ if (f.open(IO_ReadWrite | IO_Truncate))
+ {
+ QTextStream str(&f);
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin();
+ it != m_part->m_plugins.constEnd(); ++ it)
+ {
+ QStringList app = (*it)->fullTextSearchLocations();
+ for (QStringList::const_iterator it2 = app.constBegin();
+ it2 != app.constEnd(); ++it2)
+ {
+ if (!locs.contains(*it2))
+ locs.append(*it2);
+ }
+ }
+ str << locs.join("\n");
+
+ f.close();
+ }
+
+ //write editor context menu configuration
+ m_part->setContextFeature(DocumentationPart::Finder, find_box->isChecked());
+ m_part->setContextFeature(DocumentationPart::IndexLookup, index_box->isChecked());
+ m_part->setContextFeature(DocumentationPart::FullTextSearch, search_box->isChecked());
+ m_part->setContextFeature(DocumentationPart::GotoMan, man_box->isChecked());
+ m_part->setContextFeature(DocumentationPart::GotoInfo, info_box->isChecked());
+
+ m_part->setAssistantUsed(useAssistant_box->isChecked());
+
+ //font sizes and zoom levels
+ KConfig *appConfig = KGlobal::config();
+ appConfig->setGroup("KHTMLPart");
+ appConfig->writeEntry("StandardFont", standardFont_combo->currentText());
+ appConfig->writeEntry("FixedFont", fixedFont_combo->currentText());
+ appConfig->writeEntry("Zoom", zoom_combo->currentText());
+
+ appConfig->sync();
+ updateConfigForHTMLParts();
+ config->sync();
+
+ //refill the index
+ kdDebug() << "refill the index" << endl;
+ if (m_part->m_hasIndex)
+ {
+ kdDebug() << "m_part->m_hasIndex" << endl;
+ m_part->m_widget->index()->refill();
+ }
+}
+
+void DocGlobalConfigWidget::updateConfigForHTMLParts()
+{
+ KURL::List urls = m_part->partController()->openURLs();
+ for (KURL::List::const_iterator it = urls.constBegin(); it != urls.constEnd(); ++it)
+ {
+ KHTMLPart *htmlPart = dynamic_cast<KHTMLPart*>(m_part->partController()->partForURL(*it));
+ if (htmlPart)
+ {
+ KConfig *appConfig = KGlobal::config();
+ appConfig->setGroup("KHTMLPart");
+ htmlPart->setStandardFont(appConfig->readEntry("StandardFont"));
+ htmlPart->setFixedFont(appConfig->readEntry("FixedFont"));
+ //hack to force reloading the page
+ if (htmlPart->zoomFactor() == appConfig->readEntry("Zoom").toInt())
+ {
+ htmlPart->setZoomFactor(htmlPart->zoomFactor()-1);
+ htmlPart->setZoomFactor(htmlPart->zoomFactor()+1);
+ }
+ htmlPart->setZoomFactor(appConfig->readEntry("Zoom").toInt());
+ }
+ }
+}
+
+#include "docglobalconfigwidget.moc"
diff --git a/parts/documentation/docglobalconfigwidget.h b/parts/documentation/docglobalconfigwidget.h
new file mode 100644
index 00000000..95b518e5
--- /dev/null
+++ b/parts/documentation/docglobalconfigwidget.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCGLOBALCONFIGWIDGET_H
+#define DOCGLOBALCONFIGWIDGET_H
+
+#include "docglobalconfigwidgetbase.h"
+
+#include <qmap.h>
+
+class DocumentationPart;
+class DocumentationWidget;
+class DocumentationPlugin;
+class KListView;
+
+class DocGlobalConfigWidget : public DocGlobalConfigWidgetBase
+{
+ Q_OBJECT
+public:
+ DocGlobalConfigWidget(DocumentationPart *part, DocumentationWidget *widget,
+ QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
+ ~DocGlobalConfigWidget();
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void collectionsBoxCurrentChanged(int box);
+
+ virtual void removeCollectionButtonClicked();
+ virtual void editCollectionButtonClicked();
+ virtual void addCollectionButtonClicked();
+
+ virtual void accept();
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+ KListView *activeView();
+ void updateConfigForHTMLParts();
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+
+private:
+ DocumentationPart *m_part;
+ DocumentationWidget *m_widget;
+
+ KListView * m_View;
+};
+
+#endif
+
diff --git a/parts/documentation/docglobalconfigwidgetbase.ui b/parts/documentation/docglobalconfigwidgetbase.ui
new file mode 100644
index 00000000..1af1e011
--- /dev/null
+++ b/parts/documentation/docglobalconfigwidgetbase.ui
@@ -0,0 +1,572 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>DocGlobalConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>DocGlobalConfigWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>553</width>
+ <height>397</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Documentation</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>docTab</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Documentation Collections</string>
+ </attribute>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QWidgetStack">
+ <property name="name">
+ <cstring>viewHolder</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addCollectionButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>editCollectionButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>removeCollectionButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Full Text &amp;Search</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer20</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>190</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>htsearchbinLabel</cstring>
+ </property>
+ <property name="text">
+ <string>htse&amp;arch executable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>htsearchbinEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="4" column="1">
+ <property name="name">
+ <cstring>htsearchbinEdit</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Minimum</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>databaseDirEdit</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="3" column="1">
+ <property name="name">
+ <cstring>htmergebinEdit</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>htdigbinLabel</cstring>
+ </property>
+ <property name="text">
+ <string>htdi&amp;g executable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>htdigbinEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>htdigbinEdit</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>databaseDirLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Database di&amp;rectory:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>databaseDirEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>htmergebinLabel</cstring>
+ </property>
+ <property name="text">
+ <string>ht&amp;merge executable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>htmergebinEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>TabPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>O&amp;ther</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Editor Context Menu Items</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>find_box</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Find in documentation</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>index_box</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Look in documentation index</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>search_box</cstring>
+ </property>
+ <property name="text">
+ <string>S&amp;earch in documentation</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>info_box</cstring>
+ </property>
+ <property name="text">
+ <string>Goto &amp;infopage</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>man_box</cstring>
+ </property>
+ <property name="text">
+ <string>Goto &amp;manpage</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>useAssistant_box</cstring>
+ </property>
+ <property name="text">
+ <string>Use KDevelop &amp;Assistant to browse documentation</string>
+ </property>
+ </widget>
+ <widget class="QGroupBox" row="2" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Fonts &amp;&amp; Sizes</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Sta&amp;ndard font:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>standardFont_combo</cstring>
+ </property>
+ </widget>
+ <widget class="KFontCombo" row="0" column="1">
+ <property name="name">
+ <cstring>standardFont_combo</cstring>
+ </property>
+ </widget>
+ <widget class="KFontCombo" row="1" column="1">
+ <property name="name">
+ <cstring>fixedFont_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Fi&amp;xed font:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fixedFont_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Zoom factor:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>zoom_combo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="2" column="1">
+ <item>
+ <property name="text">
+ <string>20</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>40</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>60</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>80</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>90</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>95</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>100</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>105</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>110</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>120</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>140</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>160</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>180</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>200</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>250</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>300</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>zoom_combo</cstring>
+ </property>
+ <property name="currentItem">
+ <number>6</number>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>addCollectionButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DocGlobalConfigWidgetBase</receiver>
+ <slot>addCollectionButtonClicked()</slot>
+ </connection>
+ <connection>
+ <sender>editCollectionButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DocGlobalConfigWidgetBase</receiver>
+ <slot>editCollectionButtonClicked()</slot>
+ </connection>
+ <connection>
+ <sender>removeCollectionButton</sender>
+ <signal>clicked()</signal>
+ <receiver>DocGlobalConfigWidgetBase</receiver>
+ <slot>removeCollectionButtonClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>docTab</tabstop>
+ <tabstop>addCollectionButton</tabstop>
+ <tabstop>editCollectionButton</tabstop>
+ <tabstop>removeCollectionButton</tabstop>
+ <tabstop>databaseDirEdit</tabstop>
+ <tabstop>htdigbinEdit</tabstop>
+ <tabstop>htmergebinEdit</tabstop>
+ <tabstop>htsearchbinEdit</tabstop>
+ <tabstop>useAssistant_box</tabstop>
+ <tabstop>find_box</tabstop>
+ <tabstop>index_box</tabstop>
+ <tabstop>search_box</tabstop>
+ <tabstop>info_box</tabstop>
+ <tabstop>man_box</tabstop>
+</tabstops>
+<slots>
+ <slot>addCollectionButtonClicked()</slot>
+ <slot>editCollectionButtonClicked()</slot>
+ <slot>removeCollectionButtonClicked()</slot>
+ <slot>collectionsBoxCurrentChanged( int )</slot>
+ <slot>updateConfig()</slot>
+ <slot>updateIndex()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kfontcombo.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kfontcombo.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/documentation/docprojectconfigwidget.cpp b/parts/documentation/docprojectconfigwidget.cpp
new file mode 100644
index 00000000..0fd97c95
--- /dev/null
+++ b/parts/documentation/docprojectconfigwidget.cpp
@@ -0,0 +1,146 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docprojectconfigwidget.h"
+
+#include <qdir.h>
+#include <qcombobox.h>
+
+#include <kdebug.h>
+#include <kurlrequester.h>
+
+#include "domutil.h"
+#include "urlutil.h"
+#include "kdevproject.h"
+#include "kdevdocumentationplugin.h"
+
+#include "documentation_part.h"
+#include "documentation_widget.h"
+
+DocProjectConfigWidget::DocProjectConfigWidget(DocumentationPart *part, QWidget *parent, const char *name)
+ :DocProjectConfigWidgetBase(parent, name), m_part(part)
+{
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin();
+ it != m_part->m_plugins.constEnd(); ++it)
+ {
+ if ((*it)->hasCapability(DocumentationPlugin::ProjectDocumentation))
+ {
+ docSystemCombo->insertItem((*it)->pluginName());
+ m_plugins[(*it)->pluginName()] = *it;
+ }
+ }
+ QString projectDocSystem = DomUtil::readEntry(*(m_part->projectDom()), "/kdevdocumentation/projectdoc/docsystem");
+
+ bool hasProjectDoc = false;
+ for (int i = 0; i < docSystemCombo->count(); ++i)
+ {
+ if (docSystemCombo->text(i) == projectDocSystem)
+ {
+ docSystemCombo->setCurrentItem(i);
+ hasProjectDoc = true;
+ changeDocSystem(docSystemCombo->currentText());
+ break;
+ }
+ }
+ if (!hasProjectDoc && docSystemCombo->count() > 0)
+ {
+ docSystemCombo->setCurrentItem(0);
+ changeDocSystem(docSystemCombo->currentText());
+ }
+
+ manualURL->setURL(DomUtil::readEntry(*(m_part->projectDom()), "/kdevdocumentation/projectdoc/usermanualurl"));
+}
+
+void DocProjectConfigWidget::changeDocSystem(const QString &text)
+{
+ if (text.isEmpty())
+ return;
+
+ DocumentationPlugin *plugin = m_plugins[text];
+ if (!plugin)
+ return;
+
+ catalogURL->setMode(plugin->catalogLocatorProps().first);
+ catalogURL->setFilter(plugin->catalogLocatorProps().second);
+
+ QString projectDocURL = DomUtil::readEntry(*(m_part->projectDom()), "/kdevdocumentation/projectdoc/docurl");
+ if (!projectDocURL.isEmpty())
+ projectDocURL = QDir::cleanDirPath(m_part->project()->projectDirectory() + "/" + projectDocURL);
+
+ catalogURL->setURL(projectDocURL);
+ catalogURL->setEnabled(true);
+}
+
+void DocProjectConfigWidget::accept()
+{
+ if (manualURL->url().isEmpty())
+ {
+ if (m_part->m_userManualPlugin)
+ {
+ delete m_part->m_userManualPlugin;
+ m_part->m_userManualPlugin = 0;
+ }
+ }
+ else
+ {
+ if (m_part->m_userManualPlugin)
+ {
+ delete m_part->m_userManualPlugin;
+ m_part->m_userManualPlugin = 0;
+ }
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_part->m_plugins.constBegin();
+ it != m_part->m_plugins.constEnd(); ++it)
+ {
+ if ((*it)->hasCapability(DocumentationPlugin::ProjectUserManual))
+ m_part->m_userManualPlugin = (*it)->projectDocumentationPlugin(DocumentationPlugin::UserManual);
+ }
+ if (m_part->m_userManualPlugin)
+ m_part->m_userManualPlugin->init(m_part->m_widget->contents(), m_part->m_widget->index(), manualURL->url());
+ }
+ m_part->saveProjectDocumentationInfo();
+
+ if (docSystemCombo->currentText().isEmpty())
+ return;
+ if (catalogURL->url().isEmpty())
+ {
+ if (m_part->m_projectDocumentationPlugin)
+ {
+ delete m_part->m_projectDocumentationPlugin;
+ m_part->m_projectDocumentationPlugin = 0;
+ }
+ m_part->saveProjectDocumentationInfo();
+ return;
+ }
+
+ DocumentationPlugin *plugin = m_plugins[docSystemCombo->currentText()];
+ if (!plugin)
+ return;
+
+ if (m_part->m_projectDocumentationPlugin)
+ {
+ delete m_part->m_projectDocumentationPlugin;
+ m_part->m_projectDocumentationPlugin = 0;
+ }
+ m_part->m_projectDocumentationPlugin = plugin->projectDocumentationPlugin(DocumentationPlugin::APIDocs);
+ m_part->m_projectDocumentationPlugin->init(m_part->m_widget->contents(), m_part->m_widget->index(), catalogURL->url());
+
+ m_part->saveProjectDocumentationInfo();
+}
+
+#include "docprojectconfigwidget.moc"
diff --git a/parts/documentation/docprojectconfigwidget.h b/parts/documentation/docprojectconfigwidget.h
new file mode 100644
index 00000000..5905f6eb
--- /dev/null
+++ b/parts/documentation/docprojectconfigwidget.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCPROJECTCONFIGWIDGET_H
+#define DOCPROJECTCONFIGWIDGET_H
+
+#include "docprojectconfigwidgetbase.h"
+
+class DocumentationPart;
+class DocumentationPlugin;
+
+class DocProjectConfigWidget: public DocProjectConfigWidgetBase {
+ Q_OBJECT
+public:
+ DocProjectConfigWidget(DocumentationPart *part, QWidget *parent = 0, const char *name = 0);
+
+public slots:
+ virtual void changeDocSystem(const QString &text);
+ virtual void accept();
+
+private:
+ DocumentationPart *m_part;
+ QMap<QString, DocumentationPlugin*> m_plugins;
+};
+#endif
diff --git a/parts/documentation/docprojectconfigwidgetbase.ui b/parts/documentation/docprojectconfigwidgetbase.ui
new file mode 100644
index 00000000..ccff4bfc
--- /dev/null
+++ b/parts/documentation/docprojectconfigwidgetbase.ui
@@ -0,0 +1,152 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>DocProjectConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>DocProjectConfigWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>484</width>
+ <height>292</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>60</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Project API Documentation</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>catalogURL</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Ca&amp;talog location:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>catalogURL</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>C&amp;ollection type:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>docSystemCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>docSystemCombo</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Project User Manual</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Location:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>manualURL</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="0">
+ <property name="name">
+ <cstring>manualURL</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>docSystemCombo</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>DocProjectConfigWidgetBase</receiver>
+ <slot>changeDocSystem(const QString&amp;)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>catalogURL</tabstop>
+ <tabstop>docSystemCombo</tabstop>
+</tabstops>
+<slots>
+ <slot>changeDocSystem(const QString &amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/documentation/documentation_part.cpp b/parts/documentation/documentation_part.cpp
new file mode 100644
index 00000000..0402efd5
--- /dev/null
+++ b/parts/documentation/documentation_part.cpp
@@ -0,0 +1,766 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "documentation_part.h"
+
+#include <unistd.h>
+
+#include <qtimer.h>
+#include <qdir.h>
+#include <qwhatsthis.h>
+#include <qlayout.h>
+#include <qpopupmenu.h>
+#include <qtabwidget.h>
+#include <qapplication.h>
+
+#include <kapplication.h>
+#include <dcopclient.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <ktrader.h>
+#include <kdebug.h>
+#include <kparts/componentfactory.h>
+#include <kservice.h>
+#include <kdialogbase.h>
+#include <kaction.h>
+#include <kactionclasses.h>
+#include <kbookmark.h>
+#include <kbookmarkmenu.h>
+#include <kinputdialog.h>
+#include <kstringhandler.h>
+#include <kconfig.h>
+#include <kwin.h>
+#include <ktexteditor/document.h>
+
+#include "kdevplugininfo.h"
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+#include "kdevgenericfactory.h"
+#include "kdevdocumentationplugin.h"
+#include "configwidgetproxy.h"
+#include "kdevpartcontroller.h"
+#include "domutil.h"
+#include "urlutil.h"
+#include "kdeveditorutil.h"
+
+#include "documentation_widget.h"
+#include "docglobalconfigwidget.h"
+#include "docprojectconfigwidget.h"
+#include "contentsview.h"
+#include "find_documentation.h"
+
+#include "KDevDocumentationIface.h"
+
+#define GLOBALDOC_OPTIONS 1
+#define PROJECTDOC_OPTIONS 2
+
+static const KDevPluginInfo data("kdevdocumentation");
+
+typedef KDevGenericFactory<DocumentationPart> DocumentationFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevdocumentation, DocumentationFactory( data ) )
+
+DocumentationPart::DocumentationPart(QObject *parent, const char *name, const QStringList& )
+ :KDevPlugin(&data, parent, name ? name : "DocumentationPart" ),
+ m_projectDocumentationPlugin(0), m_userManualPlugin(0), m_hasIndex(false)
+{
+ setInstance(DocumentationFactory::instance());
+ setXMLFile("kdevpart_documentation.rc");
+
+ m_configProxy = new ConfigWidgetProxy(core());
+ m_configProxy->createGlobalConfigPage(i18n("Documentation"), GLOBALDOC_OPTIONS, info()->icon() );
+ m_configProxy->createProjectConfigPage(i18n("Project Documentation"), PROJECTDOC_OPTIONS, info()->icon() );
+ connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int)));
+ connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)));
+ connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()));
+ connect(core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()));
+
+ m_widget = new DocumentationWidget(this);
+ m_widget->setIcon(SmallIcon( info()->icon() ));
+ m_widget->setCaption(i18n("Documentation"));
+
+ QWhatsThis::add(m_widget, i18n("<b>Documentation browser</b><p>"
+ "The documentation browser gives access to various "
+ "documentation sources (Qt DCF, Doxygen, KDoc, KDevelopTOC and DevHelp "
+ "documentation) and the KDevelop manuals. It also provides documentation index "
+ "and full text search capabilities."));
+
+ mainWindow()->embedSelectViewRight(m_widget, i18n("Documentation"),
+ i18n("Documentation browser"));
+
+ setupActions();
+
+ QTimer::singleShot(0, this, SLOT(init()));
+
+ new KDevDocumentationIface(this);
+}
+
+DocumentationPart::~DocumentationPart()
+{
+ if ( m_widget )
+ {
+ mainWindow()->removeView( m_widget );
+ }
+ delete m_widget;
+ delete m_configProxy;
+}
+
+void DocumentationPart::loadDocumentationPlugins()
+{
+ KTrader::OfferList docPluginOffers =
+ KTrader::self()->query(QString::fromLatin1("KDevelop/DocumentationPlugins"),
+ QString("[X-KDevelop-Version] == %1").arg(KDEVELOP_PLUGIN_VERSION));
+
+ KTrader::OfferList::ConstIterator serviceIt = docPluginOffers.begin();
+ for ( ; serviceIt != docPluginOffers.end(); ++serviceIt )
+ {
+ KService::Ptr docPluginService;
+ docPluginService = *serviceIt;
+ kdDebug() << "DocumentationPart::loadDocumentationPlugins: creating plugin"
+ << docPluginService->name() << endl;
+
+ int error;
+ DocumentationPlugin *docPlugin = KParts::ComponentFactory
+ ::createInstanceFromService<DocumentationPlugin>(docPluginService, 0,
+ docPluginService->name().latin1(), QStringList(), &error);
+ if (!docPlugin)
+ kdDebug() << " failed to create doc plugin " << docPluginService->name() << endl;
+ else
+ {
+ kdDebug() << " success" << endl;
+ docPlugin->init(m_widget->contents());
+ connect(this, SIGNAL(indexSelected(IndexBox* )), docPlugin, SLOT(createIndex(IndexBox* )));
+ m_plugins.append(docPlugin);
+ }
+ }
+}
+
+void DocumentationPart::emitIndexSelected(IndexBox *indexBox)
+{
+ if (!m_hasIndex)
+ {
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ emit indexSelected(indexBox);
+ indexBox->fill();
+ m_hasIndex = true;
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+void DocumentationPart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo)
+{
+ switch (pageNo)
+ {
+ case GLOBALDOC_OPTIONS:
+ {
+ DocGlobalConfigWidget *w1 = new DocGlobalConfigWidget(this, m_widget, page, "doc config widget");
+ connect(dlg, SIGNAL(okClicked()), w1, SLOT(accept()));
+ break;
+ }
+ case PROJECTDOC_OPTIONS:
+ {
+ DocProjectConfigWidget *w1 = new DocProjectConfigWidget(this, page, "doc project config");
+ connect(dlg, SIGNAL(okClicked()), w1, SLOT(accept()));
+ break;
+ }
+ }
+}
+
+KConfig *DocumentationPart::config()
+{
+ return DocumentationFactory::instance()->config();
+}
+
+bool DocumentationPart::configure(int page)
+{
+ KDialogBase dlg(KDialogBase::Plain, i18n("Documentation Settings"),
+ KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, m_widget,
+ "docsettings dialog");
+
+ QVBoxLayout *l = new QVBoxLayout(dlg.plainPage(), 0, 0);
+ DocGlobalConfigWidget *w1 = new DocGlobalConfigWidget(this, m_widget, dlg.plainPage());
+ l->addWidget(w1);
+ w1->docTab->setCurrentPage(page);
+ connect(&dlg, SIGNAL(okClicked()), w1, SLOT(accept()));
+ return (dlg.exec() == QDialog::Accepted);
+}
+
+void DocumentationPart::setupActions()
+{
+/* KActionMenu *menu = new KActionMenu(i18n("&Bookmarks"), actionCollection(), "doc_bookmarks");
+ KBookmarkMenu *bm = new KBookmarkMenu(new DocBookmarkManager(this),
+ new DocBookmarkOwner(this), menu->popupMenu(), actionCollection(), true);*/
+ KAction *action;
+
+ action = new KAction(i18n("&Search in Documentation..."), CTRL+ALT+Key_S,
+ this, SLOT(searchInDocumentation()),
+ actionCollection(), "help_search_in_doc" );
+ action->setToolTip(i18n("Full text search in the documentation"));
+ action->setWhatsThis(i18n("<b>Search in documentation</b><p>"
+ "Opens the Search in documentation tab. It allows "
+ "a search term to be entered which will be searched for in "
+ "the documentation. For this to work, a "
+ "full text index must be created first, which can be done in the "
+ "configuration dialog of the documentation plugin."));
+
+ action = new KAction(i18n("&Look in Documentation Index..."), CTRL+ALT+Key_I,
+ this, SLOT(lookInDocumentationIndex()),
+ actionCollection(), "help_look_in_index" );
+ action->setToolTip(i18n("Look in the documentation index"));
+ action->setWhatsThis(i18n("<b>Look in documentation index</b><p>"
+ "Opens the documentation index tab. It allows "
+ "a term to be entered which will be looked for in "
+ "the documentation index."));
+
+ action = new KAction(i18n("Man Page..."), 0,
+ this, SLOT(manPage()),
+ actionCollection(), "help_manpage" );
+ action->setToolTip(i18n("Show a manpage"));
+ action->setWhatsThis(i18n("<b>Show a manpage</b><p>Opens a man page using embedded viewer."));
+
+ action = new KAction(i18n("Info Page..."), 0,
+ this, SLOT(infoPage()),
+ actionCollection(), "help_infopage");
+ action->setToolTip(i18n("Show an infopage"));
+ action->setWhatsThis(i18n("<b>Show an infopage</b><p>Opens an info page using embedded viewer."));
+
+ action = new KAction(i18n("Find Documentation..."), 0,
+ this, SLOT(findInDocumentation()),
+ actionCollection(), "help_find_documentation");
+ action->setToolTip(i18n("Find Documentation"));
+ action->setWhatsThis(i18n("<b>Find documentation</b><p>"
+ "Opens the documentation finder tab and searches "
+ "all possible sources of documentation like "
+ "table of contents, index, man and info databases, "
+ "Google, etc."));
+}
+
+void DocumentationPart::emitBookmarkLocation(const QString &title, const KURL &url)
+{
+ emit bookmarkLocation(title, url);
+}
+
+void DocumentationPart::searchInDocumentation()
+{
+ QString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+
+ if ( word.isEmpty() )
+ {
+ if ( isAssistantUsed() )
+ callAssistant ( "KDevDocumentation", "searchInDocumentation()" );
+ else
+ {
+ mainWindow()->raiseView ( m_widget );
+ m_widget->searchInDocumentation();
+ }
+ }
+ else
+ {
+ if ( isAssistantUsed() )
+ callAssistant ( "KDevDocumentation", "searchInDocumentation(QString)", word );
+ else
+ {
+ mainWindow()->raiseView ( m_widget );
+ m_widget->searchInDocumentation ( word );
+ }
+ }
+}
+
+void DocumentationPart::searchInDocumentation(const QString &term)
+{
+ mainWindow()->raiseView(m_widget);
+ m_widget->searchInDocumentation(term);
+}
+
+void DocumentationPart::contextSearchInDocumentation()
+{
+ if (isAssistantUsed())
+ callAssistant("KDevDocumentation", "searchInDocumentation(QString)", m_contextStr);
+ else
+ searchInDocumentation(m_contextStr);
+}
+
+void DocumentationPart::manPage()
+{
+ QString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+
+ if ( isAssistantUsed() )
+ {
+ if ( word.isEmpty() )
+ {
+ callAssistant ( "KDevDocumentation", "manPage()" );
+ }
+ else
+ {
+ callAssistant ( "KDevDocumentation", "manPage(QString)", word );
+ }
+ }
+ else
+ {
+ bool ok;
+ QString manpage = KInputDialog::getText ( i18n ( "Show Manual Page" ), i18n ( "Show manpage on:" ), word, &ok, 0 );
+ if ( ok && !manpage.isEmpty() )
+ manPage ( manpage );
+ }
+}
+
+void DocumentationPart::infoPage()
+{
+ QString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+
+ if ( isAssistantUsed() )
+ {
+ if ( word.isEmpty() )
+ {
+ callAssistant ( "KDevDocumentation", "infoPage()" );
+ }
+ else
+ {
+ callAssistant ( "KDevDocumentation", "infoPage(QString)", word );
+ }
+ }
+ else
+ {
+ bool ok;
+ QString infopage = KInputDialog::getText ( i18n ( "Show Info Page" ), i18n ( "Show infopage on:" ), word, &ok, 0 );
+ if ( ok && !infopage.isEmpty() )
+ infoPage ( infopage );
+ }
+}
+
+void DocumentationPart::manPage(const QString &term)
+{
+ QString url = QString::fromLatin1("man:/%1").arg(term);
+ partController()->showDocument(KURL(url));
+}
+
+void DocumentationPart::infoPage(const QString &term)
+{
+ QString url = QString::fromLatin1("info:/%1").arg(term);
+ partController()->showDocument(KURL(url));
+}
+
+void DocumentationPart::contextManPage()
+{
+ if (isAssistantUsed())
+ callAssistant("KDevDocumentation", "manPage(QString)", m_contextStr);
+ else
+ manPage(m_contextStr);
+}
+
+void DocumentationPart::contextInfoPage()
+{
+ if (isAssistantUsed())
+ callAssistant("KDevDocumentation", "infoPage(QString)", m_contextStr);
+ else
+ infoPage(m_contextStr);
+}
+
+void DocumentationPart::contextFindDocumentation()
+{
+ if (isAssistantUsed())
+ callAssistant("KDevDocumentation", "findInFinder(QString)", m_contextStr);
+ else
+ findInDocumentation(m_contextStr);
+}
+
+void DocumentationPart::findInDocumentation()
+{
+ QString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+
+ if ( word.isEmpty() )
+ {
+ if ( isAssistantUsed() )
+ callAssistant ( "KDevDocumentation", "findInFinder()" );
+ else
+ {
+ mainWindow()->raiseView ( m_widget );
+ m_widget->findInDocumentation();
+ }
+ }
+ else
+ {
+ if ( isAssistantUsed() )
+ callAssistant ( "KDevDocumentation", "findInFinder(QString)", word );
+ else
+ {
+ mainWindow()->raiseView ( m_widget );
+ m_widget->findInDocumentation ( word );
+ }
+ }
+}
+
+void DocumentationPart::findInDocumentation(const QString &term)
+{
+ mainWindow()->raiseView(m_widget);
+ m_widget->findInDocumentation(term);
+}
+
+void DocumentationPart::lookInDocumentationIndex()
+{
+ QString word = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+
+ if ( word.isEmpty() )
+ {
+ if ( isAssistantUsed() )
+ callAssistant ( "KDevDocumentation", "lookupInIndex()" );
+ else
+ {
+ mainWindow()->raiseView ( m_widget );
+ m_widget->lookInDocumentationIndex();
+ }
+ }
+ else
+ {
+ if ( isAssistantUsed() )
+ callAssistant ( "KDevDocumentation", "lookupInIndex(QString)", word );
+ else
+ {
+ mainWindow()->raiseView ( m_widget );
+ m_widget->lookInDocumentationIndex ( word );
+ }
+ }
+}
+
+void DocumentationPart::lookInDocumentationIndex(const QString &term)
+{
+ mainWindow()->raiseView(m_widget);
+ m_widget->lookInDocumentationIndex(term);
+}
+
+void DocumentationPart::contextLookInDocumentationIndex()
+{
+ if (isAssistantUsed())
+ callAssistant("KDevDocumentation", "lookupInIndex(QString)", m_contextStr);
+ else
+ lookInDocumentationIndex(m_contextStr);
+}
+
+void DocumentationPart::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ if (context->hasType(Context::EditorContext))
+ {
+ const EditorContext *econtext = static_cast<const EditorContext*>(context);
+ QString ident = econtext->currentWord();
+ if (!ident.isEmpty())
+ {
+ m_contextStr = ident;
+ QString squeezed = KStringHandler::csqueeze(m_contextStr, 30);
+ int id = -1;
+ if (hasContextFeature(Finder)) {
+ id = popup->insertItem(i18n("Find Documentation: %1").arg(squeezed),
+ this, SLOT(contextFindDocumentation()));
+ popup->setWhatsThis(id, i18n("<b>Find documentation</b><p>"
+ "Opens the documentation finder tab and searches "
+ "all possible sources of documentation like "
+ "table of contents, index, man and info databases, "
+ "Google, etc."));
+ }
+ if (hasContextFeature(IndexLookup)) {
+ id = popup->insertItem(i18n("Look in Documentation Index: %1").arg(squeezed),
+ this, SLOT(contextLookInDocumentationIndex()));
+ popup->setWhatsThis(id, i18n("<b>Look in documentation index</b><p>"
+ "Opens the documentation index tab. It allows "
+ "a term to be entered which will be looked for in "
+ "the documentation index."));
+ }
+ if (hasContextFeature(FullTextSearch)) {
+ id = popup->insertItem(i18n("Search in Documentation: %1").arg(squeezed),
+ this, SLOT(contextSearchInDocumentation()));
+ popup->setWhatsThis(id, i18n("<b>Search in documentation</b><p>Searches "
+ "for a term under the cursor in "
+ "the documentation. For this to work, "
+ "a full text index must be created first, which can be done in the "
+ "configuration dialog of the documentation plugin."));
+ }
+ if (hasContextFeature(GotoMan)) {
+ id = popup->insertItem(i18n("Goto Manpage: %1").arg(squeezed),
+ this, SLOT(contextManPage()));
+ popup->setWhatsThis(id, i18n("<b>Goto manpage</b><p>Tries to open a man page for the term under the cursor."));
+ }
+ if (hasContextFeature(GotoInfo)) {
+ id = popup->insertItem( i18n("Goto Infopage: %1").arg(squeezed),
+ this, SLOT(contextInfoPage()) );
+ popup->setWhatsThis(id, i18n("<b>Goto infopage</b><p>Tries to open an info page for the term under the cursor."));
+ }
+ if (id != -1)
+ popup->insertSeparator();
+ }
+ }
+}
+
+bool DocumentationPart::hasContextFeature(ContextFeature feature)
+{
+ KConfig *config = DocumentationFactory::instance()->config();
+ QString group = config->group();
+ config->setGroup("Context Features");
+ switch (feature)
+ {
+ case Finder:
+ return config->readBoolEntry("Finder", true);
+ break;
+ case IndexLookup:
+ return config->readBoolEntry("IndexLookup", false);
+ break;
+ case FullTextSearch:
+ return config->readBoolEntry("FullTextSearch", true);
+ break;
+ case GotoMan:
+ return config->readBoolEntry("GotoMan", false);
+ break;
+ case GotoInfo:
+ return config->readBoolEntry("GotoInfo", false);
+ break;
+ }
+ config->setGroup(group);
+ return false;
+}
+
+void DocumentationPart::setContextFeature(ContextFeature feature, bool b)
+{
+ KConfig *config = DocumentationFactory::instance()->config();
+ QString group = config->group();
+ config->setGroup("Context Features");
+ QString key;
+ switch (feature)
+ {
+ case Finder:
+ key = "Finder";
+ break;
+ case IndexLookup:
+ key = "IndexLookup";
+ break;
+ case FullTextSearch:
+ key = "FullTextSearch";
+ break;
+ case GotoMan:
+ key = "GotoMan";
+ break;
+ case GotoInfo:
+ key = "GotoInfo";
+ break;
+ }
+ if (!key.isEmpty())
+ config->writeEntry(key, b);
+ config->setGroup(group);
+}
+
+void DocumentationPart::projectOpened()
+{
+ QString projectDocSystem = DomUtil::readEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docsystem");
+ QString projectDocURL = DomUtil::readEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docurl");
+ if (!projectDocURL.isEmpty())
+ projectDocURL = QDir::cleanDirPath(project()->projectDirectory() + "/" + projectDocURL);
+ QString userManualURL = DomUtil::readEntry(*(projectDom()), "/kdevdocumentation/projectdoc/usermanualurl");
+
+ for (QValueList<DocumentationPlugin*>::const_iterator it = m_plugins.constBegin();
+ it != m_plugins.constEnd(); ++it)
+ {
+ if ((*it)->hasCapability(DocumentationPlugin::ProjectDocumentation) &&
+ ((*it)->pluginName() == projectDocSystem))
+ m_projectDocumentationPlugin = (*it)->projectDocumentationPlugin(DocumentationPlugin::APIDocs);
+ if ((*it)->hasCapability(DocumentationPlugin::ProjectUserManual))
+ {
+ kdDebug() << "creating user manual for type: " << DocumentationPlugin::UserManual << endl;
+ m_userManualPlugin = (*it)->projectDocumentationPlugin(DocumentationPlugin::UserManual);
+ }
+ }
+ if (m_projectDocumentationPlugin)
+ m_projectDocumentationPlugin->init(m_widget->contents(), m_widget->index(), projectDocURL);
+ if (m_userManualPlugin && !userManualURL.isEmpty())
+ m_userManualPlugin->init(m_widget->contents(), m_widget->index(), userManualURL);
+}
+
+void DocumentationPart::projectClosed()
+{
+// saveProjectDocumentationInfo();
+
+ delete m_projectDocumentationPlugin;
+ m_projectDocumentationPlugin = 0;
+ delete m_userManualPlugin;
+ m_userManualPlugin = 0;
+}
+
+void DocumentationPart::saveProjectDocumentationInfo()
+{
+ if (m_projectDocumentationPlugin)
+ {
+ DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docsystem", m_projectDocumentationPlugin->pluginName());
+
+ QString relPath = URLUtil::extractPathNameRelative(project()->projectDirectory(),
+ m_projectDocumentationPlugin->catalogURL());
+ DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docurl", relPath);
+ }
+ else
+ {
+ DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docsystem", "");
+ DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/docurl", "");
+ }
+ if (m_userManualPlugin)
+ DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/usermanualurl", m_userManualPlugin->catalogURL());
+ else
+ DomUtil::writeEntry(*(projectDom()), "/kdevdocumentation/projectdoc/usermanualurl", "");
+}
+
+QCString DocumentationPart::startAssistant()
+{
+ static QCString lastAssistant = "";
+
+ if (!lastAssistant.isEmpty() && KApplication::dcopClient()->isApplicationRegistered(lastAssistant))
+ return lastAssistant;
+
+ const char *function = 0;
+ QString app = "kdevassistant";
+ function = "start_service_by_desktop_name(QString,QStringList)";
+ QStringList URLs;
+
+ QByteArray data, replyData;
+ QCString replyType;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << app << URLs;
+
+ if (!KApplication::dcopClient()->call("klauncher", "klauncher", function, data, replyType, replyData))
+ {
+ kdDebug() << "call failed" << endl;
+ lastAssistant = "";
+ }
+ else
+ {
+ QDataStream reply(replyData, IO_ReadOnly);
+
+ if ( replyType != "serviceResult" )
+ {
+ kdDebug() << "unexpected result: " << replyType.data() << endl;
+ lastAssistant = "";
+ }
+ int result;
+ QCString dcopName;
+ QString error;
+ reply >> result >> dcopName >> error;
+ if (result != 0)
+ {
+ kdDebug() << "Error: " << error << endl;
+ lastAssistant = "";
+ }
+ if (!dcopName.isEmpty())
+ {
+ lastAssistant = dcopName;
+ kdDebug() << dcopName.data() << endl;
+
+ //@fixme: is there another way to wait for the remote object to be loaded
+ while (!KApplication::dcopClient()->remoteObjects(dcopName).contains("KDevDocumentation"))
+ usleep(500);
+ }
+ }
+ return lastAssistant;
+}
+
+bool DocumentationPart::isAssistantUsed() const
+{
+ // hack to solve BR #90334 - don't call kdevassistant via DCOP if we ARE kdevassistant
+ if ( kapp->instanceName().find("kdevassistant") != -1 )
+ {
+ return false;
+ }
+
+ return m_assistantUsed;
+}
+
+void DocumentationPart::setAssistantUsed(bool b)
+{
+ m_assistantUsed = b;
+ //use global config to store different settings for kdevassistant and kdevelop
+ KConfig *config = kapp->config();
+ config->setGroup("Documentation");
+ config->writeEntry("UseAssistant", isAssistantUsed());
+}
+
+void DocumentationPart::activateAssistantWindow(const QCString &ref)
+{
+ kdDebug() << "DocumentationPart::activateAssistantWindow" << endl;
+ QByteArray data, replyData;
+ QCString replyType;
+ if (KApplication::dcopClient()->call(ref, "MainWindow", "getWinID()", data, replyType, replyData))
+ {
+ kdDebug() << " call successful " << endl;
+ QDataStream reply(replyData, IO_ReadOnly);
+
+ int winId;
+ reply >> winId;
+ kdDebug() << "Win ID: " << winId << endl;
+ KWin::forceActiveWindow(winId);
+
+ KApplication::dcopClient()->send(ref, "MainWindow", "show()", QByteArray());
+ }
+}
+
+void DocumentationPart::callAssistant(const QCString &interface, const QCString &method)
+{
+ QCString ref = startAssistant();
+ QByteArray data;
+ if (KApplication::dcopClient()->send(ref, interface, method, data))
+ activateAssistantWindow(ref);
+ else
+ kdDebug() << "problem communicating with: " << ref;
+}
+
+void DocumentationPart::callAssistant(const QCString &interface, const QCString &method, const QString &dataStr)
+{
+ QCString ref = startAssistant();
+ QByteArray data;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << dataStr;
+ if (KApplication::dcopClient()->send(ref, interface, method, data))
+ activateAssistantWindow(ref);
+ else
+ kdDebug() << "problem communicating with: " << ref;
+}
+
+void DocumentationPart::loadSettings()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Documentation");
+ m_assistantUsed = config->readBoolEntry("UseAssistant", false);
+
+ if (QString(KGlobal::instance()->aboutData()->appName()) == "kdevassistant")
+ {
+ int page = config->readNumEntry("LastPage", 0);
+ switch (page)
+ {
+ case 1:
+ lookInDocumentationIndex();
+ break;
+ case 2:
+ findInDocumentation();
+ break;
+ case 3:
+ searchInDocumentation();
+ break;
+ }
+ }
+}
+
+void DocumentationPart::init( )
+{
+ loadDocumentationPlugins();
+ loadSettings();
+}
+
+#include "documentation_part.moc"
diff --git a/parts/documentation/documentation_part.h b/parts/documentation/documentation_part.h
new file mode 100644
index 00000000..cad19d7a
--- /dev/null
+++ b/parts/documentation/documentation_part.h
@@ -0,0 +1,121 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __KDEVPART_DOCUMENTATION_H__
+#define __KDEVPART_DOCUMENTATION_H__
+
+#include <qguardedptr.h>
+#include <kdevplugin.h>
+
+
+class FindDocumentation;
+class DocumentationWidget;
+class IndexBox;
+class KConfig;
+class KDialogBase;
+class ConfigWidgetProxy;
+class DocumentationPlugin;
+class ProjectDocumentationPlugin;
+class KURL;
+class Context;
+class QPopupMenu;
+
+/*
+ Please read the README.dox file for more info about this part
+ */
+class DocumentationPart : public KDevPlugin
+{
+ Q_OBJECT
+public:
+ enum ContextFeature { Finder, IndexLookup, FullTextSearch, GotoMan, GotoInfo };
+
+ DocumentationPart(QObject *parent, const char *name, const QStringList &);
+ ~DocumentationPart();
+
+ void emitIndexSelected(IndexBox *indexBox);
+ void emitBookmarkLocation(const QString &title, const KURL &url);
+ bool configure(int page = 0);
+
+ bool hasContextFeature(ContextFeature feature);
+ void setContextFeature(ContextFeature feature, bool b);
+
+ bool isAssistantUsed() const;
+ void setAssistantUsed(bool b);
+
+public slots:
+ void lookInDocumentationIndex();
+ void lookInDocumentationIndex(const QString &term);
+ void contextLookInDocumentationIndex();
+ void contextFindDocumentation();
+ void findInDocumentation();
+ void findInDocumentation(const QString &term);
+ void searchInDocumentation();
+ void searchInDocumentation(const QString &term);
+ void contextSearchInDocumentation();
+ void manPage();
+ void manPage(const QString &term);
+ void contextManPage();
+ void infoPage();
+ void infoPage(const QString &term);
+ void contextInfoPage();
+ void projectOpened();
+ void projectClosed();
+
+signals:
+ void indexSelected(IndexBox *indexBox);
+ void bookmarkLocation(const QString &title, const KURL &url);
+
+protected:
+ void loadDocumentationPlugins();
+ KConfig *config();
+ void setupActions();
+ void loadSettings();
+ void saveProjectDocumentationInfo();
+
+ QCString startAssistant();
+ void activateAssistantWindow(const QCString &ref);
+ void callAssistant(const QCString &interface, const QCString &method);
+ void callAssistant(const QCString &interface, const QCString &method, const QString &dataStr);
+
+protected slots:
+ void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo);
+ void contextMenu(QPopupMenu *popup, const Context *context);
+
+private slots:
+ void init();
+
+private:
+ QGuardedPtr<DocumentationWidget> m_widget;
+ ConfigWidgetProxy *m_configProxy;
+
+ QValueList<DocumentationPlugin*> m_plugins;
+ ProjectDocumentationPlugin *m_projectDocumentationPlugin;
+ ProjectDocumentationPlugin *m_userManualPlugin;
+
+ QString m_contextStr;
+ bool m_hasIndex;
+ bool m_assistantUsed;
+
+friend class DocGlobalConfigWidget;
+friend class DocProjectConfigWidget;
+friend class SearchView;
+friend class FindDocumentation;
+};
+
+#endif
diff --git a/parts/documentation/documentation_widget.cpp b/parts/documentation/documentation_widget.cpp
new file mode 100644
index 00000000..255a834e
--- /dev/null
+++ b/parts/documentation/documentation_widget.cpp
@@ -0,0 +1,142 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "documentation_widget.h"
+
+#include <qlayout.h>
+#include <qtoolbox.h>
+
+#include <klineedit.h>
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kconfig.h>
+
+#include <kdevcore.h>
+#include <kdevdocumentationplugin.h>
+
+#include "documentation_part.h"
+#include "contentsview.h"
+#include "indexview.h"
+#include "searchview.h"
+#include "bookmarkview.h"
+#include "find_documentation.h"
+
+DocumentationWidget::DocumentationWidget(DocumentationPart *part)
+ :QWidget(0, "documentation widget"), m_part(part)
+{
+ QVBoxLayout *l = new QVBoxLayout(this, 0, 0);
+
+ m_tab = new QToolBox(this);
+ l->addWidget(m_tab);
+
+ m_contents = new ContentsView(this);
+ m_tab->addItem(m_contents, i18n("Contents"));
+
+ m_index = new IndexView(this);
+ m_tab->addItem(m_index, i18n("Index"));
+
+ m_finder = new FindDocumentation(this);
+ m_tab->addItem(m_finder,i18n("Finder"));
+
+ m_search = new SearchView(m_part, this);
+ m_tab->addItem(m_search, i18n("Search"));
+
+ m_bookmarks = new BookmarkView(this);
+ m_tab->addItem(m_bookmarks, i18n("Bookmarks"));
+
+ connect(m_tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
+}
+
+DocumentationWidget::~DocumentationWidget()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Documentation");
+ config->writeEntry("LastPage", m_tab->currentIndex());
+}
+
+void DocumentationWidget::tabChanged(int t)
+{
+ if (!m_tab->item(t))
+ return;
+ m_tab->item(t)->setFocus();
+ if (m_tab->item(t) == m_index)
+ m_part->emitIndexSelected(m_index->indexBox());
+}
+
+IndexBox *DocumentationWidget::index() const
+{
+ return m_index->indexBox();
+}
+
+void DocumentationWidget::searchInDocumentation()
+{
+ m_tab->setCurrentItem(m_search);
+ m_search->askSearchTerm();
+}
+
+void DocumentationWidget::searchInDocumentation(const QString &term)
+{
+ m_tab->setCurrentItem(m_search);
+ m_search->setSearchTerm(term);
+ m_search->search();
+}
+
+void DocumentationWidget::lookInDocumentationIndex()
+{
+ m_tab->setCurrentItem(m_index);
+ m_index->askSearchTerm();
+}
+
+void DocumentationWidget::lookInDocumentationIndex(const QString &term)
+{
+ m_tab->setCurrentItem(m_index);
+ m_index->setSearchTerm(term);
+ //adymo: let's allow the user to press enter here ;)
+// m_index->searchInIndex();
+}
+
+void DocumentationWidget::findInDocumentation(const QString &term)
+{
+ m_tab->setCurrentItem(m_finder);
+ m_finder->setSearchTerm(term);
+ m_finder->startSearch();
+}
+
+void DocumentationWidget::findInDocumentation()
+{
+ m_tab->setCurrentItem(m_finder);
+ m_finder->search_term->setFocus();
+}
+
+void DocumentationWidget::focusInEvent(QFocusEvent */*e*/)
+{
+ if (m_tab->currentItem())
+ m_tab->currentItem()->setFocus();
+}
+
+KListView * DocumentationWidget::contents( ) const
+{
+ return m_contents->view();
+}
+
+#include "documentation_widget.moc"
diff --git a/parts/documentation/documentation_widget.h b/parts/documentation/documentation_widget.h
new file mode 100644
index 00000000..c3a43ce7
--- /dev/null
+++ b/parts/documentation/documentation_widget.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef __DOCUMENTATION_WIDGET_H__
+#define __DOCUMENTATION_WIDGET_H__
+
+#include <qwidget.h>
+
+class FindDocumentation;
+class KDevProject;
+class DocumentationPart;
+class ContentsView;
+class IndexView;
+class DocumentationCatalogItem;
+class QToolBox;
+class IndexBox;
+class SearchView;
+class BookmarkView;
+class KListView;
+
+class DocumentationWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ DocumentationWidget(DocumentationPart *part);
+ ~DocumentationWidget();
+
+ DocumentationPart *part() const { return m_part; }
+
+ KListView *contents() const;
+ IndexBox *index() const;
+
+public slots:
+ void lookInDocumentationIndex();
+ void lookInDocumentationIndex(const QString &term);
+ void searchInDocumentation();
+ void searchInDocumentation(const QString &term);
+ void findInDocumentation();
+ void findInDocumentation(const QString &term);
+
+protected:
+ virtual void focusInEvent(QFocusEvent *e);
+
+protected slots:
+ void tabChanged(int t);
+
+private:
+ DocumentationPart *m_part;
+ ContentsView *m_contents;
+ IndexView *m_index;
+ SearchView *m_search;
+ BookmarkView *m_bookmarks;
+ FindDocumentation *m_finder;
+ QToolBox *m_tab;
+
+friend class FindDocumentation;
+};
+
+#endif
diff --git a/parts/documentation/docutils.cpp b/parts/documentation/docutils.cpp
new file mode 100644
index 00000000..52b1964b
--- /dev/null
+++ b/parts/documentation/docutils.cpp
@@ -0,0 +1,100 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docutils.h"
+
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+#include <kpopupmenu.h>
+#include <klocale.h>
+#include <kstringhandler.h>
+
+#include <kdevpartcontroller.h>
+
+#include "kdevdocumentationplugin.h"
+#include "documentation_part.h"
+
+QString DocUtils::noEnvURL(const QString &url)
+{
+ return KURLCompletion::replacedPath(url, true, true);
+}
+
+KURL DocUtils::noEnvURL(const KURL &url)
+{
+ QString replaced = KURLCompletion::replacedPath(url.url(), true, true);
+ KURL kurl(replaced);
+ kurl.setQuery(url.query());
+ kurl.setRef(url.ref());
+ return kurl;
+}
+
+QString DocUtils::envURL(KURLRequester *req)
+{
+ if (req->lineEdit())
+ return req->lineEdit()->text();
+ else if (req->comboBox())
+ return req->comboBox()->currentText();
+ else
+ return req->url();
+}
+
+void DocUtils::docItemPopup(DocumentationPart *part, DocumentationItem *docItem,
+ const QPoint &pos, bool showBookmark, bool showSearch, int titleCol)
+{
+ docItemPopup(part, docItem->text(titleCol), docItem->url(), pos, showBookmark, showSearch);
+}
+
+void DocUtils::docItemPopup(DocumentationPart *part, IndexItem *docItem, const QPoint &pos,
+ bool showBookmark, bool showSearch)
+{
+ //FIXME: index item can have more than one url, what to do?
+ KURL url;
+ if (docItem->urls().count() > 0)
+ url = docItem->urls().first().second;
+ docItemPopup(part, docItem->text(), url, pos, showBookmark, showSearch);
+}
+
+void DocUtils::docItemPopup(DocumentationPart *part, const QString &title, const KURL &url,
+ const QPoint &pos, bool showBookmark, bool showSearch)
+{
+ KPopupMenu menu;
+ menu.insertTitle(i18n("Documentation"));
+ menu.insertItem(i18n("Open in Current Tab"), 1);
+ menu.insertItem(i18n("Open in New Tab"), 2);
+ if (showBookmark)
+ {
+ menu.insertSeparator();
+ menu.insertItem(i18n("Bookmark This Location"), 3);
+ }
+ if (showSearch)
+ {
+ menu.insertSeparator();
+ menu.insertItem(QString("%1: %2").arg(i18n("Search")).arg(KStringHandler::csqueeze(title,20)), 4);
+ }
+
+ switch (menu.exec(pos))
+ {
+ case 1: part->partController()->showDocument(url); break;
+ case 2: part->partController()->showDocument(url, true); break;
+ case 3: part->emitBookmarkLocation(title, url); break;
+ case 4: part->searchInDocumentation(title); break;
+ }
+}
diff --git a/parts/documentation/docutils.h b/parts/documentation/docutils.h
new file mode 100644
index 00000000..75b52324
--- /dev/null
+++ b/parts/documentation/docutils.h
@@ -0,0 +1,51 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOC_UTILS_H
+#define DOC_UTILS_H
+
+#include <qstring.h>
+
+class KURLRequester;
+class KPopupMenu;
+class DocumentationItem;
+class DocumentationPart;
+class QPoint;
+class IndexItem;
+class KURL;
+
+namespace DocUtils{
+
+/**Returns an url selected in KURLRequester but does not
+resolve environment variables.*/
+QString envURL(KURLRequester *req);
+/**Resolves environment variables in url.*/
+QString noEnvURL(const QString &url);
+/**Resolves environment variables in url.*/
+KURL noEnvURL(const KURL &url);
+
+void docItemPopup(DocumentationPart *part, DocumentationItem *docItem, const QPoint &pos,
+ bool showBookmark = false, bool showSearch = false, int titleCol = 0);
+void docItemPopup(DocumentationPart *part, IndexItem *docItem, const QPoint &pos,
+ bool showBookmark = false, bool showSearch = false);
+void docItemPopup(DocumentationPart *part, const QString &title, const KURL &url,
+ const QPoint &pos, bool showBookmark = false, bool showSearch = false);
+}
+
+#endif
diff --git a/parts/documentation/editbookmarkdlg.ui b/parts/documentation/editbookmarkdlg.ui
new file mode 100644
index 00000000..fec2dc11
--- /dev/null
+++ b/parts/documentation/editbookmarkdlg.ui
@@ -0,0 +1,165 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>EditBookmarkDlg</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditBookmarkDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>323</width>
+ <height>121</height>
+ </rect>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="1" column="1">
+ <property name="name">
+ <cstring>locationEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>nameEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Location:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>locationEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>nameEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>EditBookmarkDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>EditBookmarkDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>nameEdit</tabstop>
+ <tabstop>locationEdit</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/documentation/editcatalogdlg.cpp b/parts/documentation/editcatalogdlg.cpp
new file mode 100644
index 00000000..11f4c4fc
--- /dev/null
+++ b/parts/documentation/editcatalogdlg.cpp
@@ -0,0 +1,79 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "editcatalogdlg.h"
+
+#include <qlabel.h>
+
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+
+#include "docutils.h"
+#include "kdevdocumentationplugin.h"
+
+EditCatalogDlg::EditCatalogDlg(DocumentationPlugin *plugin, QWidget* parent,
+ const char* name, bool modal, WFlags fl)
+ :EditCatalogBase(parent,name, modal,fl), m_plugin(plugin)
+{
+ if (m_plugin->hasCapability(DocumentationPlugin::CustomDocumentationTitles))
+ {
+ titleLabel->setEnabled(true);
+ titleEdit->setEnabled(true);
+ }
+ locationURL->setMode(m_plugin->catalogLocatorProps().first);
+ locationURL->setFilter(m_plugin->catalogLocatorProps().second);
+}
+
+EditCatalogDlg::~EditCatalogDlg()
+{
+}
+
+/*$SPECIALIZATION$*/
+void EditCatalogDlg::locationURLChanged(const QString &text)
+{
+ titleEdit->setText(m_plugin->catalogTitle(DocUtils::noEnvURL(text)));
+}
+
+void EditCatalogDlg::accept()
+{
+ QDialog::accept();
+}
+
+QString EditCatalogDlg::title() const
+{
+ return titleEdit->text();
+}
+
+QString EditCatalogDlg::url() const
+{
+ return DocUtils::envURL(locationURL);
+}
+
+void EditCatalogDlg::setTitle(const QString &title)
+{
+ titleEdit->setText(title);
+}
+
+void EditCatalogDlg::setURL(const QString &url)
+{
+ locationURL->setURL(url);
+}
+
+#include "editcatalogdlg.moc"
diff --git a/parts/documentation/editcatalogdlg.h b/parts/documentation/editcatalogdlg.h
new file mode 100644
index 00000000..5628fa99
--- /dev/null
+++ b/parts/documentation/editcatalogdlg.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef EDITCATALOGDLG_H
+#define EDITCATALOGDLG_H
+
+#include "editcatalogdlgbase.h"
+
+class DocumentationPlugin;
+
+class EditCatalogDlg : public EditCatalogBase
+{
+ Q_OBJECT
+public:
+ EditCatalogDlg(DocumentationPlugin *plugin,
+ QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+ ~EditCatalogDlg();
+ /*$PUBLIC_FUNCTIONS$*/
+
+ QString title() const;
+ void setTitle(const QString &title);
+ QString url() const;
+ void setURL(const QString &url);
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void locationURLChanged(const QString &text);
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+ virtual void accept();
+
+private:
+ DocumentationPlugin *m_plugin;
+};
+
+#endif
diff --git a/parts/documentation/editcatalogdlgbase.ui b/parts/documentation/editcatalogdlgbase.ui
new file mode 100644
index 00000000..3fd4caf9
--- /dev/null
+++ b/parts/documentation/editcatalogdlgbase.ui
@@ -0,0 +1,196 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>EditCatalogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>EditCatalogBase</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>404</width>
+ <height>163</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Documentation Catalog Properties</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Location:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>locationURL</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="1" column="0">
+ <property name="name">
+ <cstring>locationURL</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>titleLabel</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Title:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>titleEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="0">
+ <property name="name">
+ <cstring>titleEdit</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>EditCatalogBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>EditCatalogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>locationURL</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>EditCatalogBase</receiver>
+ <slot>locationURLChanged(const QString&amp;)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>locationURL</tabstop>
+ <tabstop>titleEdit</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<slots>
+ <slot>locationURLChanged( const QString &amp; )</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/documentation/find_documentation.cpp b/parts/documentation/find_documentation.cpp
new file mode 100644
index 00000000..6195536e
--- /dev/null
+++ b/parts/documentation/find_documentation.cpp
@@ -0,0 +1,347 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Tobias Glaesser *
+ * tobi.web@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "find_documentation.h"
+
+#include <stdlib.h>
+#include <qcheckbox.h>
+#include <qheader.h>
+#include <qapplication.h>
+#include <qstringlist.h>
+
+#include <klineedit.h>
+#include <kprocess.h>
+#include <klistbox.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevdocumentationplugin.h>
+
+#include "documentation_widget.h"
+#include "documentation_part.h"
+#include "indexview.h"
+#include "find_documentation_options.h"
+#include "docutils.h"
+#include "contentsview.h"
+
+#include <klocale.h>
+
+FindDocumentation::FindDocumentation(DocumentationWidget* parent, const char* name)
+ :FindDocumentationBase(parent, name),
+ man_item(0), info_item(0), index_item(0), google_item(0), contents_item(0),
+ last_item(0), m_widget(parent)
+{
+ QWidget* tmp = QApplication::desktop();
+ setGeometry(tmp->width()/2 - width()/2, tmp->height()/2 - height()/2, width(), height());
+ proc_man = new KProcess( this );
+ proc_info = new KProcess( this );
+
+ connect( proc_man, SIGNAL(processExited( KProcess* )),
+ this, SLOT(procManExited( KProcess* )) );
+ connect( proc_man, SIGNAL(receivedStdout( KProcess*, char*, int)),
+ this, SLOT(procManReadStdout( KProcess*, char*, int)) );
+
+ connect( proc_info, SIGNAL(processExited( KProcess* )),
+ this, SLOT(procInfoExited( KProcess* )) );
+ connect( proc_info, SIGNAL(receivedStdout( KProcess*, char*, int)),
+ this, SLOT(procInfoReadStdout( KProcess*, char*, int)) );
+
+ result_list->header()->hide();
+ result_list->setSorting(-1);
+
+ m_options = new FindDocumentationOptions(this);
+}
+
+FindDocumentation::~FindDocumentation()
+{
+}
+
+/*$SPECIALIZATION$*/
+void FindDocumentation::buttonPressedOnItem( int button, QListViewItem * item, const QPoint & pos, int // c
+ )
+{
+ if ((button != Qt::RightButton) || (!item))
+ return;
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
+ if (!docItem)
+ return;
+
+ DocUtils::docItemPopup(m_widget->part(), docItem->text(0), docItem->url(), pos, true, false);
+}
+
+void FindDocumentation::clickOnItem( QListViewItem * item )
+{
+ if(!item)
+ return;
+
+ if(item == man_item || item == info_item || item == index_item || item == google_item)
+ return;
+
+ DocumentationItem* doc_item = dynamic_cast<DocumentationItem*>(item);
+
+ if(item->parent() == man_item ||
+ item->parent() == info_item ||
+ item->parent() == google_item ||
+ item->parent() == index_item ||
+ item->parent() == contents_item)
+ m_widget->part()->partController()->showDocument(doc_item->url());
+}
+
+void FindDocumentation::procInfoExited( KProcess* )
+{
+ if (proc_info->normalExit() && proc_info->exitStatus() == 0)
+ {
+ QStringList lines = QStringList::split("\n", proc_info_out);
+ for( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it )
+ {
+ if( (*it) == "*")
+ break;
+
+ DocumentationItem* newitem = new DocumentationItem(DocumentationItem::Document, info_item, *it);
+ newitem->setURL(KURL("info:/" + search_term->text()));
+ }
+ }
+ proc_info_out = "";
+
+ if(info_item->firstChild() && m_options->goto_first_match->isOn())
+ {
+ m_widget->part()->partController()->showDocument(dynamic_cast<DocumentationItem*>(info_item->firstChild())->url());
+ first_match_found = true;
+ }
+}
+
+void FindDocumentation::procManExited( KProcess* )
+{
+ if (proc_man->normalExit() && proc_man->exitStatus() == 0)
+ {
+ QStringList lines = QStringList::split("\n", proc_man_out);
+ for( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it )
+ {
+ DocumentationItem* newitem = new DocumentationItem(DocumentationItem::Document, man_item, search_term->text());
+ newitem->setURL(KURL("man://" + *it));
+ }
+ }
+ proc_man_out = "";
+
+ if(man_item->firstChild() && m_options->goto_first_match->isOn())
+ {
+ m_widget->part()->partController()->showDocument(dynamic_cast<DocumentationItem*>(man_item->firstChild())->url());
+ first_match_found = true;
+ }
+}
+
+void FindDocumentation::procInfoReadStdout( KProcess*, char* buf, int len)
+{
+ proc_info_out += QString::fromLatin1( buf, len );
+}
+
+void FindDocumentation::procManReadStdout( KProcess*, char* buf, int len)
+{
+ proc_man_out += QString::fromLatin1( buf, len );
+}
+
+void FindDocumentation::searchInInfo()
+{
+ info_item = new KListViewItem(result_list, last_item, "Info");
+ info_item->setOpen(true);
+ last_item = info_item;
+
+ proc_info->clearArguments();
+ //Search Info documents
+ *proc_info << "info";
+ *proc_info << "-w";
+ *proc_info << search_term->text();
+
+ if ( !proc_info->start( KProcess::NotifyOnExit, KProcess::Stdout ) )
+ {
+ // error handling
+ }
+}
+
+void FindDocumentation::searchInMan()
+{
+ man_item = new KListViewItem( result_list, last_item, i18n("Manual") );
+ man_item->setOpen(true);
+ last_item = man_item;
+
+ proc_man->clearArguments();
+ //Search Manpages
+ *proc_man << "man";
+ *proc_man << "-w";
+ *proc_man << search_term->text();
+
+ if ( !proc_man->start( KProcess::NotifyOnExit, KProcess::Stdout ) )
+ {
+ // error handling
+ }
+
+}
+
+void FindDocumentation::searchInGoogle()
+{
+ google_item = new KListViewItem(result_list, last_item, "Google");
+ google_item->setOpen(true);
+ last_item = google_item;
+
+ DocumentationItem* newitem = new DocumentationItem(DocumentationItem::Document,
+ google_item, "First result for: " + search_term->text());
+ newitem->setURL(KURL("http://www.google.com/search?q=" + search_term->text() + "&btnI"));
+ newitem = new DocumentationItem(DocumentationItem::Document, google_item, "All results for: " + search_term->text());
+ newitem->setURL(KURL("http://www.google.com/search?q=" + search_term->text()));
+
+ if (google_item->firstChild() && m_options->goto_first_match->isOn())
+ {
+ m_widget->part()->partController()->showDocument(dynamic_cast<DocumentationItem*>(google_item->firstChild())->url());
+ first_match_found = true;
+ }
+}
+
+void FindDocumentation::searchInContents()
+{
+ contents_item = new KListViewItem( result_list, last_item, i18n("Contents") );
+ contents_item->setOpen(true);
+ last_item = contents_item;
+
+ QListViewItemIterator it( m_widget->m_contents->m_view );
+ while ( it.current() )
+ {
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(it.current());
+
+ if (docItem->type() == DocumentationItem::Catalog)
+ {
+ DocumentationCatalogItem *catalogItem = dynamic_cast<DocumentationCatalogItem*>(it.current());
+ catalogItem->load();
+ catalogItem->plugin()->setCatalogURL(catalogItem);
+ }
+ if (it.current()->text(0).contains(search_term->text(),false))
+ {
+ DocumentationItem* newitem = new DocumentationItem(DocumentationItem::Document,
+ contents_item, it.current()->text(0) );
+ newitem->setURL(docItem->url());
+ }
+ ++it;
+ }
+
+ if (contents_item->firstChild() && m_options->goto_first_match->isOn())
+ {
+ m_widget->part()->partController()->showDocument(dynamic_cast<DocumentationItem*>(contents_item->firstChild())->url());
+ first_match_found = true;
+ }
+}
+
+void FindDocumentation::searchInIndex()
+{
+ index_item =new KListViewItem(result_list, last_item , "Index");
+ index_item->setOpen(true);
+ last_item = index_item;
+
+ m_widget->part()->emitIndexSelected(m_widget->m_index->indexBox());
+ m_widget->m_index->setSearchTerm(search_term->text());
+ m_widget->m_index->showIndex(search_term->text());
+
+ if(m_widget->m_index->m_index->selectedItem())
+ {
+ IndexItem* item = dynamic_cast<IndexItem*>(m_widget->m_index->m_index->selectedItem());
+ DocumentationItem* newitem = 0;
+ while(item)
+ {
+ if(!item->text().contains(search_term->text(),false))
+ break;
+
+ IndexItem::List urls = item->urls();
+ for (IndexItem::List::const_iterator it = urls.begin(); it != urls.end(); ++it)
+ {
+ QString text = item->text();
+ if (urls.count() > 1)
+ text = (*it).first;
+ if(newitem)
+ newitem = new DocumentationItem(DocumentationItem::Document, index_item,
+ newitem, text);
+ else
+ newitem = new DocumentationItem(DocumentationItem::Document,
+ index_item, text);
+
+ newitem->setURL((*it).second);
+ }
+
+ item = dynamic_cast<IndexItem*>(item->next());
+ }
+ }
+
+ if(index_item->firstChild() && m_options->goto_first_match->isOn())
+ {
+ m_widget->part()->partController()->showDocument(
+ dynamic_cast<DocumentationItem*>(index_item->firstChild())->url());
+ first_match_found = true;
+ }
+}
+
+void FindDocumentation::startSearch()
+{
+ //Clear the contents of the listview
+ result_list->clear();
+
+ last_item = NULL;
+ first_match_found = false;
+
+ QListViewItem* item = m_options->source_list->firstChild();
+
+ while ( item && ( !m_options->goto_first_match->isOn() || !first_match_found ))
+ {
+ if ( m_options->isMan(dynamic_cast<QCheckListItem*>(item)) )
+ searchInMan();
+ else if ( m_options->isInfo(dynamic_cast<QCheckListItem*>(item)) )
+ searchInInfo();
+ else if ( m_options->isIndex(dynamic_cast<QCheckListItem*>(item)) )
+ searchInIndex();
+ else if ( m_options->isGoogle(dynamic_cast<QCheckListItem*>(item)) )
+ searchInGoogle();
+ else if ( m_options->isContents(dynamic_cast<QCheckListItem*>(item)) )
+ searchInContents();
+
+ item = item->itemBelow();
+ }
+
+ //Set the focus to the listview and the first child to the
+ //current item of the list, so that you can brows the items with your keyboard
+ result_list->setFocus();
+ if(result_list->firstChild())
+ result_list->setCurrentItem(result_list->firstChild());
+
+}
+
+void FindDocumentation::setSearchTerm( const QString & term )
+{
+ search_term->setText(term);
+}
+
+void FindDocumentation::clickOptions()
+{
+ if( m_options->exec() == QDialog::Accepted )
+ m_options->writeOptions();
+ else
+ m_options->readOptions();
+}
+
+void FindDocumentation::focusInEvent( QFocusEvent * // e
+ )
+{
+ search_term->setFocus();
+}
+
+#include "find_documentation.moc"
diff --git a/parts/documentation/find_documentation.h b/parts/documentation/find_documentation.h
new file mode 100644
index 00000000..26afa5be
--- /dev/null
+++ b/parts/documentation/find_documentation.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Tobias Glaesser *
+ * tobi.web@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef FINDDOCUMENTATION_H
+#define FINDDOCUMENTATION_H
+
+#include "find_documentationbase.h"
+
+class DocumentationWidget;
+class KListViewItem;
+class FindDocumentationOptions;
+class KProcess;
+
+class FindDocumentation : public FindDocumentationBase
+{
+Q_OBJECT
+public:
+ FindDocumentation(DocumentationWidget* parent, const char* name = 0);
+ ~FindDocumentation();
+ /*$PUBLIC_FUNCTIONS$*/
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void buttonPressedOnItem( int button, QListViewItem * item, const QPoint & pos, int c );
+ virtual void clickOnItem( QListViewItem * item );
+ virtual void procInfoExited( KProcess* );
+ virtual void procManExited( KProcess* );
+ virtual void procManReadStdout( KProcess*, char*, int );
+ virtual void procInfoReadStdout( KProcess*, char*, int );
+ virtual void searchInInfo();
+ virtual void searchInMan();
+ virtual void searchInGoogle();
+ virtual void searchInContents();
+ virtual void searchInIndex();
+ virtual void startSearch();
+ virtual void setSearchTerm( const QString & term );
+ virtual void clickOptions();
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+ virtual void focusInEvent(QFocusEvent *e);
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+
+private:
+ KProcess* proc_man;
+ KProcess* proc_info;
+ QString proc_man_out;
+ QString proc_info_out;
+ KListViewItem* man_item;
+ KListViewItem* info_item;
+ KListViewItem* index_item;
+ KListViewItem* google_item;
+ KListViewItem* contents_item;
+ KListViewItem* last_item;
+ DocumentationWidget* m_widget;
+ FindDocumentationOptions* m_options;
+ bool first_match_found;
+
+};
+
+#endif
+
diff --git a/parts/documentation/find_documentation_options.cpp b/parts/documentation/find_documentation_options.cpp
new file mode 100644
index 00000000..ba3ab46f
--- /dev/null
+++ b/parts/documentation/find_documentation_options.cpp
@@ -0,0 +1,192 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Tobias Glaesser *
+ * tobi.web@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "find_documentation_options.h"
+
+#include <qheader.h>
+#include <qcheckbox.h>
+
+#include <klistview.h>
+#include <klocale.h>
+
+#include <kconfig.h>
+#include <kapplication.h>
+
+FindDocumentationOptions::FindDocumentationOptions(QWidget* parent, const char* name, bool modal)
+ :FindDocumentationOptionsBase(parent,name, modal),
+ m_man_item(0), m_info_item(0), m_index_item(0), m_google_item(0), m_contents_item(0)
+{
+ readOptions();
+
+ source_list->header()->hide();
+ source_list->setSorting(-1);
+}
+
+FindDocumentationOptions::~FindDocumentationOptions()
+{
+}
+
+/*$SPECIALIZATION$*/
+bool FindDocumentationOptions::isContents( QCheckListItem * item )
+{
+ if ( item == m_contents_item && m_contents_item->isOn() )
+ return true;
+ else
+ return false;
+}
+
+bool FindDocumentationOptions::isGoogle( QCheckListItem * item )
+{
+ if ( item == m_google_item && m_google_item->isOn() )
+ return true;
+ else
+ return false;
+}
+
+bool FindDocumentationOptions::isIndex( QCheckListItem * item )
+{
+ if ( item == m_index_item && m_index_item->isOn() )
+ return true;
+ else
+ return false;
+}
+
+bool FindDocumentationOptions::isInfo( QCheckListItem * item )
+{
+ if ( item == m_info_item && m_info_item->isOn() )
+ return true;
+ else
+ return false;
+}
+
+bool FindDocumentationOptions::isMan( QCheckListItem * item )
+{
+ if ( item == m_man_item && m_man_item->isOn() )
+ return true;
+ else
+ return false;
+}
+
+void FindDocumentationOptions::sourceMoveDown()
+{
+ if (!source_list->currentItem())
+ return;
+ if (source_list->currentItem()->nextSibling() == 0)
+ return;
+
+ source_list->currentItem()->moveItem(source_list->currentItem()->nextSibling());
+}
+
+void FindDocumentationOptions::sourceMoveUp()
+{
+ if (!source_list->currentItem())
+ return;
+ if (source_list->currentItem() == source_list->firstChild())
+ return;
+
+ QListViewItem *item = source_list->firstChild();
+ while (item->nextSibling() != source_list->currentItem())
+ item = item->nextSibling();
+ item->moveItem( source_list->currentItem());
+}
+
+void FindDocumentationOptions::writeOptions()
+{
+ config = kapp->config();
+ config->setGroup("DocumentationFinder");
+
+ config->writeEntry("goto_first_match", goto_first_match->isChecked());
+
+ QListViewItemIterator it( source_list );
+ int i = 0;
+ while ( it.current() )
+ {
+ if ( it.current() == m_man_item )
+ {
+ config->writeEntry("Manpage",i);
+ config->writeEntry("ManpageEnabled",m_man_item->isOn());
+ }
+ else if ( it.current() == m_info_item )
+ {
+ config->writeEntry("Info",i);
+ config->writeEntry("InfoEnabled",m_info_item->isOn());
+ }
+ else if ( it.current() == m_index_item )
+ {
+ config->writeEntry("Index",i);
+ config->writeEntry("IndexEnabled",m_index_item->isOn());
+ }
+ else if ( it.current() == m_google_item )
+ {
+ config->writeEntry("Google",i);
+ config->writeEntry("GoogleEnabled",m_google_item->isOn());
+ }
+ else if ( it.current() == m_contents_item )
+ {
+ config->writeEntry("Contents",i);
+ config->writeEntry("ContentsEnabled",m_contents_item->isOn());
+ }
+ ++it;
+ ++i;
+ }
+
+ config->sync();
+}
+
+void FindDocumentationOptions::readOptions()
+{
+ config = kapp->config();
+ config->setGroup("DocumentationFinder");
+
+ source_list->clear();
+
+ for(int i = 4; i > -1; --i )
+ {
+ if( config->readPropertyEntry( "Manpage" , 0 ) == i)
+ {
+ m_man_item = new QCheckListItem( source_list, i18n("Manual"), QCheckListItem::CheckBox );
+ m_man_item->setOn(config->readBoolEntry( "ManpageEnabled" , true));
+ }
+ if( config->readPropertyEntry( "Info" , 1 ) == i)
+ {
+ m_info_item = new QCheckListItem( source_list, i18n("Info"), QCheckListItem::CheckBox );
+ m_info_item->setOn(config->readBoolEntry( "InfoEnabled" , true));
+ }
+ if( config->readPropertyEntry( "Index" , 2 ) == i)
+ {
+ m_index_item = new QCheckListItem( source_list, i18n("Index"), QCheckListItem::CheckBox );
+ m_index_item->setOn(config->readBoolEntry( "IndexEnabled" , true));
+ }
+ if( config->readPropertyEntry( "Google" , 3 ) == i)
+ {
+ m_google_item = new QCheckListItem( source_list, i18n("Google"), QCheckListItem::CheckBox );
+ m_google_item->setOn(config->readBoolEntry( "GoogleEnabled" , false));
+ }
+ if( config->readPropertyEntry( "Contents" , 4 ) == i)
+ {
+ m_contents_item = new QCheckListItem( source_list, i18n("Contents"), QCheckListItem::CheckBox );
+ m_contents_item->setOn(config->readBoolEntry( "ContentsEnabled" , false));
+ }
+ }
+
+ goto_first_match->setChecked(config->readBoolEntry( "goto_first_match" , false));
+}
+
+#include "find_documentation_options.moc"
+
diff --git a/parts/documentation/find_documentation_options.h b/parts/documentation/find_documentation_options.h
new file mode 100644
index 00000000..e2c24f9c
--- /dev/null
+++ b/parts/documentation/find_documentation_options.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Tobias Glaesser *
+ * tobi.web@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef FIND_DOCUMENTATIONOPTIONS_H
+#define FIND_DOCUMENTATIONOPTIONS_H
+
+#include "find_documentation_optionsbase.h"
+
+class QCheckListItem;
+class KConfig;
+
+class FindDocumentationOptions : public FindDocumentationOptionsBase
+{
+Q_OBJECT
+public:
+ FindDocumentationOptions(QWidget* parent = 0, const char* name = 0, bool modal = FALSE);
+ ~FindDocumentationOptions();
+ /*$PUBLIC_FUNCTIONS$*/
+ virtual bool isContents( QCheckListItem * item );
+ virtual bool isGoogle( QCheckListItem * item );
+ virtual bool isIndex( QCheckListItem * item );
+ virtual bool isInfo( QCheckListItem * item );
+ virtual bool isMan( QCheckListItem * item );
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ virtual void sourceMoveDown();
+ virtual void sourceMoveUp();
+ virtual void writeOptions();
+ virtual void readOptions();
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+
+private:
+ QCheckListItem *m_man_item;
+ QCheckListItem *m_info_item;
+ QCheckListItem *m_index_item;
+ QCheckListItem *m_google_item;
+ QCheckListItem *m_contents_item;
+
+ KConfig* config;
+};
+
+#endif
+
diff --git a/parts/documentation/find_documentation_optionsbase.ui b/parts/documentation/find_documentation_optionsbase.ui
new file mode 100644
index 00000000..c2beadc9
--- /dev/null
+++ b/parts/documentation/find_documentation_optionsbase.ui
@@ -0,0 +1,218 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>FindDocumentationOptionsBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FindDocumentationOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>349</width>
+ <height>310</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Find Documentation Options</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="1" column="0">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>source_list</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>Layout9_3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer5</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>moveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>movedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>goto_first_match</cstring>
+ </property>
+ <property name="text">
+ <string>Go to first match</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>You can enable and disable search
+sources and change their priority here.</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>FindDocumentationOptionsBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>FindDocumentationOptionsBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>moveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FindDocumentationOptionsBase</receiver>
+ <slot>sourceMoveUp()</slot>
+ </connection>
+ <connection>
+ <sender>movedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FindDocumentationOptionsBase</receiver>
+ <slot>sourceMoveDown()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>sourceMoveUp()</slot>
+ <slot>sourceMoveDown()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/documentation/find_documentationbase.ui b/parts/documentation/find_documentationbase.ui
new file mode 100644
index 00000000..58e6aeb0
--- /dev/null
+++ b/parts/documentation/find_documentationbase.ui
@@ -0,0 +1,167 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>FindDocumentationBase</class>
+<author>Tobias Gläßer</author>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>FindDocumentationBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>222</width>
+ <height>504</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>Find Documentation</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Search term:</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="2">
+ <property name="name">
+ <cstring>button_search</cstring>
+ </property>
+ <property name="text">
+ <string>Search</string>
+ </property>
+ <property name="default">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>search_term</cstring>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="0">
+ <property name="name">
+ <cstring>butten_options</cstring>
+ </property>
+ <property name="text">
+ <string>Options</string>
+ </property>
+ </widget>
+ <spacer row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>100</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KListView" row="2" column="0" rowspan="1" colspan="3">
+ <column>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>result_list</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>button_search</sender>
+ <signal>clicked()</signal>
+ <receiver>FindDocumentationBase</receiver>
+ <slot>startSearch()</slot>
+ </connection>
+ <connection>
+ <sender>result_list</sender>
+ <signal>executed(QListViewItem*)</signal>
+ <receiver>FindDocumentationBase</receiver>
+ <slot>clickOnItem(QListViewItem*)</slot>
+ </connection>
+ <connection>
+ <sender>butten_options</sender>
+ <signal>clicked()</signal>
+ <receiver>FindDocumentationBase</receiver>
+ <slot>clickOptions()</slot>
+ </connection>
+ <connection>
+ <sender>result_list</sender>
+ <signal>mouseButtonPressed(int,QListViewItem*,const QPoint&amp;,int)</signal>
+ <receiver>FindDocumentationBase</receiver>
+ <slot>buttonPressedOnItem(int,QListViewItem*,const QPoint&amp;,int)</slot>
+ </connection>
+ <connection>
+ <sender>search_term</sender>
+ <signal>returnPressed()</signal>
+ <receiver>FindDocumentationBase</receiver>
+ <slot>startSearch()</slot>
+ </connection>
+ <connection>
+ <sender>result_list</sender>
+ <signal>returnPressed(QListViewItem*)</signal>
+ <receiver>FindDocumentationBase</receiver>
+ <slot>clickOnItem(QListViewItem*)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>search_term</tabstop>
+ <tabstop>button_search</tabstop>
+ <tabstop>result_list</tabstop>
+ <tabstop>butten_options</tabstop>
+</tabstops>
+<slots>
+ <slot>clickOptions()</slot>
+ <slot>setSearchTerm( const QString &amp; term )</slot>
+ <slot>startSearch()</slot>
+ <slot>searchInIndex()</slot>
+ <slot>searchInContents()</slot>
+ <slot>searchInGoogle()</slot>
+ <slot>searchInMan()</slot>
+ <slot>searchInInfo()</slot>
+ <slot>procManReadFromStdout()</slot>
+ <slot>procInfoReadFromStdout()</slot>
+ <slot>clickOnItem( QListViewItem * item )</slot>
+ <slot>buttonPressedOnItem( int button, QListViewItem * item, const QPoint &amp; pos, int c )</slot>
+</slots>
+<layoutdefaults spacing="1" margin="1"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/documentation/indexview.cpp b/parts/documentation/indexview.cpp
new file mode 100644
index 00000000..3c245aee
--- /dev/null
+++ b/parts/documentation/indexview.cpp
@@ -0,0 +1,190 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "indexview.h"
+
+#include <qapplication.h>
+#include <qevent.h>
+#include <qlayout.h>
+#include <qlabel.h>
+
+#include <klineedit.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kurl.h>
+#include <kdebug.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevdocumentationplugin.h>
+
+#include "docutils.h"
+#include "selecttopic.h"
+#include "documentation_part.h"
+#include "documentation_widget.h"
+
+IndexView::IndexView(DocumentationWidget *parent, const char *name)
+ :QWidget(parent, name), m_widget(parent)
+{
+ QVBoxLayout *l = new QVBoxLayout(this, 0, 0);
+
+ QHBoxLayout *hl = new QHBoxLayout(this, 0, 0);
+ m_edit = new KLineEdit(this);
+ hl->addWidget(new QLabel(m_edit, i18n("&Look for:"), this));
+ hl->addWidget(m_edit);
+ l->addLayout(hl);
+
+ m_index = new IndexBox(this);
+ l->addWidget(m_index);
+
+ connect(m_index, SIGNAL(executed(QListBoxItem* )), this, SLOT(searchInIndex(QListBoxItem* )));
+ connect(m_index, SIGNAL(mouseButtonPressed(int, QListBoxItem*, const QPoint& )),
+ this, SLOT(itemMouseButtonPressed(int, QListBoxItem*, const QPoint& )));
+ connect(m_edit, SIGNAL(returnPressed()), this, SLOT(searchInIndex()));
+ connect(m_edit, SIGNAL(textChanged(const QString&)), this, SLOT(showIndex(const QString&)));
+
+ m_edit->installEventFilter(this);
+}
+
+IndexView::~IndexView()
+{
+}
+
+void IndexView::searchInIndex()
+{
+ if (m_index->currentItem() != -1)
+ searchInIndex(m_index->item(m_index->currentItem()));
+}
+
+void IndexView::searchInIndex(QListBoxItem *item)
+{
+ kdDebug() << "IndexView::searchInIndex" << endl;
+ IndexItem *indexItem = dynamic_cast<IndexItem*>(item);
+ if (!indexItem)
+ return;
+
+ IndexItem::List urls = indexItem->urls();
+ if (urls.count() == 1)
+ m_widget->part()->partController()->showDocument(urls.first().second);
+ else if (urls.count() == 0) ;
+ else
+ {
+ SelectTopic *dia = new SelectTopic(urls);
+ dia->topicLabel->setText(dia->topicLabel->text().arg(item->text()));
+ if (dia->exec())
+ m_widget->part()->partController()->showDocument(dia->selectedURL());
+ delete dia;
+ }
+}
+
+void IndexView::showIndex(const QString &term)
+{
+ QListBoxItem *i = m_index->firstItem();
+ QString sl = term.lower();
+ while (i)
+ {
+ QString t = i->text();
+ if ((t.length() >= sl.length()) && (i->text().left(term.length()).lower() == sl))
+ {
+ m_index->setCurrentItem(i);
+ m_index->setTopItem(m_index->index(i));
+ break;
+ }
+ i = i->next();
+ }
+/*
+ for (uint i = 0; i < m_index->count(); ++ i)
+ {
+ if (m_index->text(i).startsWith(term))
+ {
+ m_index->setCurrentItem(i);
+ m_index->setTopItem(i);
+ }
+ }*/
+}
+
+bool IndexView::eventFilter(QObject *watched, QEvent *e)
+{
+ if (!watched || !e)
+ return true;
+
+ if ((watched == m_edit) && (e->type() == QEvent::KeyPress))
+ {
+ QKeyEvent *ke = (QKeyEvent*)e;
+ if (ke->key() == Key_Up)
+ {
+ int i = m_index->currentItem();
+ if (--i >= 0)
+ {
+ m_index->setCurrentItem(i);
+ m_edit->blockSignals(true);
+ m_edit->setText(m_index->currentText());
+ m_edit->blockSignals(false);
+ }
+ return true;
+ } else if (ke->key() == Key_Down)
+ {
+ int i = m_index->currentItem();
+ if ( ++i < int(m_index->count()) )
+ {
+ m_index->setCurrentItem(i);
+ m_edit->blockSignals(true);
+ m_edit->setText(m_index->currentText());
+ m_edit->blockSignals(false);
+ }
+ return true;
+ } else if ((ke->key() == Key_Next) || (ke->key() == Key_Prior))
+ {
+ QApplication::sendEvent(m_index, e);
+ m_edit->blockSignals(true);
+ m_edit->setText(m_index->currentText());
+ m_edit->blockSignals(false);
+ }
+ }
+
+ return QWidget::eventFilter(watched, e);
+}
+
+void IndexView::itemMouseButtonPressed(int button, QListBoxItem *item, const QPoint &pos)
+{
+ if ((button != Qt::RightButton) || (!item))
+ return;
+ IndexItem *docItem = dynamic_cast<IndexItem*>(item);
+ if (!docItem)
+ return;
+
+ DocUtils::docItemPopup(m_widget->part(), docItem, pos, false, true);
+}
+
+void IndexView::setSearchTerm(const QString &term)
+{
+ m_edit->setFocus();
+ m_edit->setText(term);
+}
+
+void IndexView::askSearchTerm( )
+{
+ m_edit->setFocus();
+}
+
+void IndexView::focusInEvent(QFocusEvent */*e*/)
+{
+ m_edit->setFocus();
+}
+
+#include "indexview.moc"
diff --git a/parts/documentation/indexview.h b/parts/documentation/indexview.h
new file mode 100644
index 00000000..50ffa704
--- /dev/null
+++ b/parts/documentation/indexview.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef INDEXVIEW_H
+#define INDEXVIEW_H
+
+#include <qwidget.h>
+
+class IndexBox;
+class KLineEdit;
+class QListBoxItem;
+class DocumentationWidget;
+class FindDocumentation;
+
+class IndexView : public QWidget
+{
+ Q_OBJECT
+public:
+ IndexView(DocumentationWidget *parent = 0, const char *name = 0);
+ ~IndexView();
+
+ virtual bool eventFilter(QObject *watched, QEvent *e);
+ IndexBox *indexBox() const { return m_index; }
+
+public slots:
+ void searchInIndex();
+ void setSearchTerm(const QString &term);
+ void askSearchTerm();
+
+protected slots:
+ void searchInIndex(QListBoxItem *item);
+ void showIndex(const QString &term);
+
+ void itemMouseButtonPressed(int button, QListBoxItem *item, const QPoint &pos);
+
+protected:
+ virtual void focusInEvent(QFocusEvent *e);
+
+private:
+ DocumentationWidget *m_widget;
+
+ IndexBox *m_index;
+ KLineEdit *m_edit;
+
+friend class FindDocumentation;
+};
+
+#endif
diff --git a/parts/documentation/interfaces/Mainpage.dox b/parts/documentation/interfaces/Mainpage.dox
new file mode 100644
index 00000000..85126a6e
--- /dev/null
+++ b/parts/documentation/interfaces/Mainpage.dox
@@ -0,0 +1,10 @@
+/**
+@mainpage The KDevelop Documentation Part Interfaces Library
+
+This library contains interfaces to implement KDevelop documentation plugins.
+
+<b>Link with</b>: -ldocumentation_interfaces
+
+<b>Include path</b>: -I\$(kde_includes)/kdevelop/parts/documentation
+*/
+
diff --git a/parts/documentation/interfaces/Makefile.am b/parts/documentation/interfaces/Makefile.am
new file mode 100644
index 00000000..206f62f9
--- /dev/null
+++ b/parts/documentation/interfaces/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ $(all_includes)
+METASOURCES = AUTO
+partincludedirdir = $(includedir)/kdevelop/parts/documentation
+lib_LTLIBRARIES = libdocumentation_interfaces.la
+libdocumentation_interfaces_la_LDFLAGS = $(all_libraries)
+libdocumentation_interfaces_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KIO)
+libdocumentation_interfaces_la_SOURCES = kdevdocumentationplugin.cpp
+partincludedir_HEADERS = kdevdocumentationplugin.h
+servicetypedir = $(kde_servicetypesdir)
+servicetype_DATA = kdevelopdocumentationplugins.desktop
+
+DOXYGEN_REFERENCES = dcop interfaces kdecore kdefx kdeui khtml kmdi kio kjs kparts kutils kdevutil kdevinterfaces
+DOXYGEN_PROJECTNAME = KDevelop Documentation Part Interfaces Library
+DOXYGEN_DOCDIRPREFIX = kdevdoc
+include ../../../Doxyfile.am
diff --git a/parts/documentation/interfaces/kdevdocumentationplugin.cpp b/parts/documentation/interfaces/kdevdocumentationplugin.cpp
new file mode 100644
index 00000000..8e336c83
--- /dev/null
+++ b/parts/documentation/interfaces/kdevdocumentationplugin.cpp
@@ -0,0 +1,721 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 by Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#include "kdevdocumentationplugin.h"
+
+#include <qfile.h>
+#include <qpainter.h>
+#include <qstyle.h>
+#include <qheader.h>
+#include <qtextstream.h>
+
+#include <kstandarddirs.h>
+#include <kiconloader.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdirwatch.h>
+#include <klocale.h>
+
+//class DocumentationItem
+
+DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListView *parent,
+ const QString &name)
+ :KListViewItem(parent, name), m_type(type)
+{
+ init();
+}
+
+DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListViewItem *parent,
+ const QString &name)
+ :KListViewItem(parent, name), m_type(type)
+{
+ init();
+}
+
+DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListView *parent,
+ KListViewItem *after, const QString &name)
+ :KListViewItem(parent, after, name), m_type(type)
+{
+ init();
+}
+
+DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListViewItem * parent,
+ KListViewItem * after, const QString & name )
+ :KListViewItem(parent, after, name), m_type(type)
+{
+ init();
+}
+
+
+void DocumentationItem::init( )
+{
+ QString icon;
+
+ switch (m_type)
+ {
+ case Collection:
+ case Catalog:
+ icon = "folder";
+ break;
+ case Book:
+ icon = "contents";
+ break;
+ default:
+ icon = "document";
+ }
+
+ setPixmap(0, SmallIcon(icon));
+}
+
+
+
+
+
+//class DocumentationCatalogItem
+
+
+DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin,
+ KListView *parent, const QString &name)
+ :DocumentationItem(DocumentationItem::Catalog, parent, name), m_plugin(plugin),
+ isLoaded(false), isActivated(false), m_isProjectDocumentationItem(false)
+{
+ setExpandable(true);
+ m_plugin->addCatalog(this);
+}
+
+DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin,
+ DocumentationItem *parent, const QString &name)
+ :DocumentationItem(DocumentationItem::Catalog, parent, name), m_plugin(plugin),
+ isLoaded(false), isActivated(false), m_isProjectDocumentationItem(false)
+{
+ setExpandable(true);
+ m_plugin->addCatalog(this);
+}
+
+DocumentationCatalogItem::~ DocumentationCatalogItem( )
+{
+ m_plugin->clearCatalog(this);
+}
+
+void DocumentationCatalogItem::setOpen(bool o)
+{
+ if (o)
+ {
+ load();
+ }
+ DocumentationItem::setOpen(o);
+}
+
+void DocumentationCatalogItem::load()
+{
+if(isLoaded)
+return;
+
+ plugin()->createTOC(this);
+ isLoaded = true;
+}
+
+void DocumentationCatalogItem::activate()
+{
+ if (!isActivated)
+ {
+ plugin()->setCatalogURL(this);
+ isActivated = true;
+ }
+ DocumentationItem::activate();
+}
+
+
+
+
+//class IndexItemProto
+
+IndexItemProto::IndexItemProto(DocumentationPlugin *plugin, DocumentationCatalogItem *catalog,
+ IndexBox *listbox, const QString &text, const QString &description)
+ : m_listbox(listbox), m_text(text), m_description(description)
+{
+ plugin->indexes[catalog].append(this);
+ m_listbox->addIndexItem(this);
+}
+
+IndexItemProto::~IndexItemProto()
+{
+ m_listbox->removeIndexItem(this);
+}
+
+
+//class IndexItem
+
+IndexItem::IndexItem(IndexBox *listbox, const QString &text)
+ :QListBoxText(listbox, text), m_listbox(listbox)
+{
+}
+
+IndexItem::List IndexItem::urls() const
+{
+ List urlList;
+ QValueList<IndexItemProto*> itemProtos = m_listbox->items[text()];
+ for (QValueList<IndexItemProto*>::const_iterator it = itemProtos.begin();
+ it != itemProtos.end(); ++it)
+ urlList.append(qMakePair((*it)->description(), (*it)->url()));
+ return urlList;
+}
+
+
+
+
+//class ConfigurationItem
+
+ConfigurationItem::ConfigurationItem(QListView *parent, DocumentationPlugin * plugin, const QString &title, const QString &url,
+ bool indexPossible, bool fullTextSearchPossible)
+ :QCheckListItem(parent, "", QCheckListItem::CheckBox), m_title(title), m_url(url),
+ m_origTitle(title), m_contents(true), m_index(false), m_fullTextSearch(false),
+ m_indexPossible(indexPossible), m_fullTextSearchPossible(fullTextSearchPossible),
+ m_docPlugin( plugin )
+{
+ setText(3, m_title);
+ setText(4, m_url);
+}
+
+void ConfigurationItem::paintCell(QPainter *p, const QColorGroup &cg, int column,
+ int width, int align)
+{
+ if ( (column == 0) || (column == 1) || (column == 2) )
+ {
+ if ( !p )
+ return;
+
+ QListView *lv = listView();
+ if ( !lv )
+ return;
+
+ const BackgroundMode bgmode = lv->viewport()->backgroundMode();
+ const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode );
+ p->fillRect(0, 0, width, height(), cg.brush(crole));
+
+ QFontMetrics fm(lv->fontMetrics());
+ int boxsize = lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv);
+ int marg = lv->itemMargin();
+ int styleflags = QStyle::Style_Default;
+
+ if (((column == 0) && m_contents) || ((column == 1) && m_index) || ((column == 2) && m_fullTextSearch))
+ styleflags |= QStyle::Style_On;
+ else
+ styleflags |= QStyle::Style_Off;
+ if ((column == 0) || ((column == 1) && m_indexPossible) || ((column == 2) && m_fullTextSearchPossible))
+ styleflags |= QStyle::Style_Enabled;
+
+ int x = 0;
+ int y = 0;
+ x += 3;
+ if (align & AlignVCenter)
+ y = ((height() - boxsize) / 2) + marg;
+ else
+ y = (fm.height() + 2 + marg - boxsize) / 2;
+
+ QStyleOption opt(this);
+ lv->style().drawPrimitive(QStyle::PE_CheckListIndicator, p,
+ QRect(x, y, boxsize, fm.height() + 2 + marg), cg, styleflags, opt);
+
+ return;
+ }
+ QListViewItem::paintCell(p, cg, column, width, align);
+}
+
+int ConfigurationItem::width(const QFontMetrics &fm, const QListView *lv, int c) const
+{
+ if ((c == 0) || (c == 1) || (c == 2))
+ return lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv) + 4;
+ return QListViewItem::width(fm, lv, c);
+}
+
+
+
+
+
+
+
+
+//class DocumentationPlugin
+
+DocumentationPlugin::DocumentationPlugin(KConfig *pluginConfig, QObject *parent, const char *name)
+ :QObject(parent, name), config(pluginConfig), m_indexCreated(false)
+{
+}
+
+DocumentationPlugin::~DocumentationPlugin()
+{
+}
+
+void DocumentationPlugin::autoSetup()
+{
+ config->setGroup("General");
+ if ( ! config->readBoolEntry("Autosetup", false) )
+ {
+ autoSetupPlugin();
+ config->setGroup("General");
+ config->writeEntry("Autosetup", true);
+ config->sync();
+ }
+}
+
+void DocumentationPlugin::reload()
+{
+ clear();
+ for (QValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin();
+ it != catalogs.end(); ++it)
+ {
+ createTOC(*it);
+ }
+}
+
+void DocumentationPlugin::clear()
+{
+ for (QValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin();
+ it != catalogs.end(); ++it)
+ {
+ clearCatalog(*it);
+ }
+}
+
+void DocumentationPlugin::clearCatalog(DocumentationCatalogItem *item)
+{
+ //clear named catalog map
+ for (QMap<QString, DocumentationCatalogItem*>::iterator it = namedCatalogs.begin();
+ it != namedCatalogs.end(); ++it)
+ {
+ if (it.data() == item)
+ {
+ namedCatalogs.remove(it);
+ break;
+ }
+ }
+ //clear indexes for catalog
+ QValueList<IndexItemProto *> idx = indexes[item];
+ for (QValueList<IndexItemProto *>::iterator it = idx.begin(); it != idx.end(); ++it)
+ {
+ delete *it;
+ }
+ indexes.remove(item);
+
+ //remove catalog
+ catalogs.remove(item);
+}
+
+void DocumentationPlugin::createIndex(IndexBox *index)
+{
+ if (m_indexCreated)
+ return;
+
+ for (QValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin();
+ it != catalogs.end(); ++it)
+ {
+ loadIndex(index, *it);
+ }
+ m_indexCreated = true;
+}
+
+void DocumentationPlugin::cacheIndex(DocumentationCatalogItem *item)
+{
+ kdDebug() << "Creating index cache for " << item->text(0) << endl;
+
+ QString cacheName = locateLocal("data", QString("kdevdocumentation/index/cache_") + item->text(0));
+ QFile cacheFile(cacheName);
+ if (!cacheFile.open(IO_WriteOnly))
+ return;
+
+ QTextStream str(&cacheFile);
+ str.setEncoding(QTextStream::Unicode);
+ str << CACHE_VERSION << endl;
+
+ QValueList<IndexItemProto*> catalogIndexes = indexes[item];
+ for (QValueList<IndexItemProto*>::const_iterator it = catalogIndexes.constBegin();
+ it != catalogIndexes.constEnd(); ++it)
+ {
+ str << (*it)->text() << endl;
+ str << (*it)->description() << endl;
+ str << (*it)->url().url() << endl;
+ }
+
+ cacheFile.close();
+}
+
+bool DocumentationPlugin::loadCachedIndex(IndexBox *index, DocumentationCatalogItem *item)
+{
+ QString cacheName = locateLocal("data", QString("kdevdocumentation/index/cache_") + item->cacheVersion() + item->text(0));
+ QFile cacheFile(cacheName);
+ if (!cacheFile.open(IO_ReadOnly))
+ return false;
+
+ kdDebug() << "Using cached index for item: " << item->text(0) << endl;
+
+ QTextStream str(&cacheFile);
+ str.setEncoding(QTextStream::Unicode);
+ QString cache = str.read();
+ QStringList cacheList = QStringList::split("\n", cache, true);
+ QString ver = cacheList.first();
+ if (ver != CACHE_VERSION)
+ {
+ kdDebug() << "Wrong cache version: " << ver << endl;
+ return false;
+ }
+ QStringList::const_iterator it = cacheList.begin();
+ it++;
+ QString s[3]; int c = 0;
+ for (; it != cacheList.end(); ++it)
+ {
+ s[c] = *it;
+ if (c == 2)
+ {
+ IndexItemProto *ii = new IndexItemProto(this, item, index, s[0], s[1]);
+ ii->addURL(KURL(s[2]));
+ c = 0;
+ }
+ else c++;
+ }
+ cacheFile.close();
+
+ return true;
+}
+
+void DocumentationPlugin::addCatalog(DocumentationCatalogItem *item)
+{
+ catalogs.append(item);
+ namedCatalogs[item->text(0)] = item;
+// indexes[item] = QValueList<IndexItem*>();
+}
+
+void DocumentationPlugin::addCatalogConfiguration(KListView *configurationView,
+ const QString &title, const QString &url)
+{
+ new ConfigurationItem(configurationView, this, title, url,
+ hasCapability(Index), hasCapability(FullTextSearch));
+}
+
+void DocumentationPlugin::editCatalogConfiguration(ConfigurationItem *configurationItem,
+ const QString &title, const QString &url)
+{
+ configurationItem->setTitle(title);
+ configurationItem->setURL(url);
+}
+
+void DocumentationPlugin::deleteCatalogConfiguration(const ConfigurationItem *const configurationItem)
+{
+ deletedConfigurationItems << configurationItem->title();
+}
+
+void DocumentationPlugin::clearCatalogIndex(DocumentationCatalogItem *item)
+{
+ //clear indexes for catalog
+ QValueList<IndexItemProto *> idx = indexes[item];
+ for (QValueList<IndexItemProto *>::iterator it = idx.begin(); it != idx.end(); ++it)
+ {
+ delete *it;
+ }
+ indexes.remove(item);
+}
+
+void DocumentationPlugin::loadIndex(IndexBox *index, DocumentationCatalogItem *item)
+{
+ if (!indexEnabled(item))
+ return;
+ if (!needRefreshIndex(item) && loadCachedIndex(index, item))
+ return;
+ createIndex(index, item);
+ cacheIndex(item);
+}
+
+void DocumentationPlugin::init(KListView *contents)
+{
+ config->setGroup("Locations");
+ QMap<QString, QString> entryMap = config->entryMap("Locations");
+
+ for (QMap<QString, QString>::const_iterator it = entryMap.begin();
+ it != entryMap.end(); ++it)
+ {
+ if (catalogEnabled(it.key()))
+ createCatalog(contents, it.key(), config->readPathEntry(it.key()));
+ }
+}
+
+void DocumentationPlugin::reinit(KListView *contents, IndexBox *index, QStringList restrictions)
+{
+ config->setGroup("Locations");
+ QMap<QString, QString> entryMap = config->entryMap("Locations");
+
+ //remove deleted in configuration catalogs
+ for (QStringList::const_iterator it = deletedConfigurationItems.constBegin();
+ it != deletedConfigurationItems.constEnd(); ++it)
+ {
+ if (namedCatalogs.contains(*it))
+ delete namedCatalogs[*it];
+ }
+ deletedConfigurationItems.clear();
+
+ //update configuration
+ for (QMap<QString, QString>::const_iterator it = entryMap.begin();
+ it != entryMap.end(); ++it)
+ {
+ config->setGroup("Locations");
+ if (restrictions.contains(it.key()) || (!catalogEnabled(it.key())))
+ {
+ if (namedCatalogs.contains(it.key()))
+ delete namedCatalogs[it.key()];
+ }
+ else
+ {
+ kdDebug() << "updating 1" << endl;
+ if (!namedCatalogs.contains(it.key())) //create catalog if it does not exist
+ {
+ DocumentationCatalogItem * item = createCatalog(contents, it.key(), config->readPathEntry(it.key()));
+ loadIndex(index, item);
+ index->setDirty(true);
+// index->refill(indexes[item]);
+ }
+ else if (!indexEnabled(namedCatalogs[it.key()])) //clear index if it is disabled in configuration
+ {
+ kdDebug() << " updating: clearCatalogIndex" << endl;
+ clearCatalogIndex(namedCatalogs[it.key()]);
+ }
+ else if ( (indexEnabled(namedCatalogs[it.key()])) //index is requested in configuration but does not yet exist
+ && (!indexes.contains(namedCatalogs[it.key()])) )
+ {
+ kdDebug() << " index requested " << endl;
+ loadIndex(index, namedCatalogs[it.key()]);
+ index->setDirty(true);
+ }
+ m_indexCreated = true;
+ }
+ }
+}
+
+void DocumentationPlugin::loadCatalogConfiguration(KListView *configurationView)
+{
+ config->setGroup("Locations");
+ QMap<QString, QString> entryMap = config->entryMap("Locations");
+
+ for (QMap<QString, QString>::const_iterator it = entryMap.begin();
+ it != entryMap.end(); ++it)
+ {
+ if (namedCatalogs.contains(it.key())
+ && namedCatalogs[it.key()]->isProjectDocumentationItem())
+ continue;
+
+ config->setGroup("Locations");
+ ConfigurationItem *item = new ConfigurationItem(configurationView, this, it.key(),
+ config->readPathEntry(it.key()),
+ hasCapability(Index), hasCapability(FullTextSearch));
+ config->setGroup("TOC Settings");
+ item->setContents(config->readBoolEntry(item->title(), true));
+ config->setGroup("Index Settings");
+ item->setIndex(config->readBoolEntry(item->title(), false));
+ config->setGroup("Search Settings");
+ item->setFullTextSearch(config->readBoolEntry(item->title(), false));
+ }
+}
+
+void DocumentationPlugin::saveCatalogConfiguration(KListView *configurationView)
+{
+ config->setGroup("Locations");
+
+ for (QStringList::const_iterator it = deletedConfigurationItems.constBegin();
+ it != deletedConfigurationItems.constEnd(); ++it)
+ {
+ config->deleteEntry(*it);
+ }
+
+ QListViewItemIterator it(configurationView);
+ while (it.current())
+ {
+ ConfigurationItem *confItem = dynamic_cast<ConfigurationItem*>(it.current());
+ if ( confItem->docPlugin() != this )
+ {
+ ++it;
+ continue;
+ }
+
+ config->setGroup("Locations");
+ if (confItem->isChanged())
+ config->deleteEntry(confItem->origTitle());
+ config->writePathEntry(confItem->title(), confItem->url());
+
+ config->setGroup("TOC Settings");
+ if (confItem->isChanged())
+ config->deleteEntry(confItem->origTitle());
+ config->writeEntry(confItem->title(), confItem->contents());
+
+ config->setGroup("Index Settings");
+ if (confItem->isChanged())
+ config->deleteEntry(confItem->origTitle());
+ config->writeEntry(confItem->title(), confItem->index());
+
+ config->setGroup("Search Settings");
+ if (confItem->isChanged())
+ config->deleteEntry(confItem->origTitle());
+ config->writeEntry(confItem->title(), confItem->fullTextSearch());
+
+ ++it;
+ }
+ config->sync();
+}
+
+void DocumentationPlugin::setIndexEnabled( DocumentationCatalogItem * item, bool e )
+{
+ QString group = config->group();
+ config->setGroup("Index Settings");
+ config->writeEntry(item->text(0), e);
+ config->setGroup(group);
+}
+
+bool DocumentationPlugin::indexEnabled( DocumentationCatalogItem * item ) const
+{
+ QString group = config->group();
+ config->setGroup("Index Settings");
+ bool b = config->readBoolEntry(item->text(0), false);
+ config->setGroup(group);
+ return b;
+}
+
+bool DocumentationPlugin::catalogEnabled(const QString &name) const
+{
+ QString group = config->group();
+ config->setGroup("TOC Settings");
+ bool b = config->readBoolEntry(name, true);
+ config->setGroup(group);
+ return b;
+}
+
+void DocumentationPlugin::setCatalogEnabled(const QString &name, bool e)
+{
+ QString group = config->group();
+ config->setGroup("TOC Settings");
+ config->writeEntry(name, e);
+ config->setGroup(group);
+}
+
+
+
+
+//class IndexBox
+
+IndexBox::IndexBox(QWidget *parent, const char *name)
+ :KListBox(parent, name), m_dirty(false)
+{
+}
+
+void IndexBox::addIndexItem(IndexItemProto *item)
+{
+ items[item->text()].append(item);
+}
+
+void IndexBox::removeIndexItem(IndexItemProto *item)
+{
+ QString text = item->text();
+ items[text].remove(item);
+ if (items[text].count() == 0)
+ {
+ items.remove(text);
+ QListBoxItem *item = findItem(text, Qt::CaseSensitive | Qt::ExactMatch);
+ if (item)
+ delete item;
+ }
+}
+
+void IndexBox::fill()
+{
+ for (QMap<QString, QValueList<IndexItemProto*> >::const_iterator it = items.begin();
+ it != items.end(); ++it)
+ {
+ new IndexItem(this, it.key());
+ }
+}
+
+void IndexBox::setDirty(bool dirty)
+{
+ m_dirty = dirty;
+}
+
+void IndexBox::refill()
+{
+ if (m_dirty)
+ {
+ clear();
+ fill();
+ setDirty(false);
+ }
+}
+
+
+ProjectDocumentationPlugin::ProjectDocumentationPlugin(DocumentationPlugin *docPlugin, DocumentationPlugin::ProjectDocType type)
+ :QObject(0, 0), m_docPlugin(docPlugin), m_catalog(0), m_type(type), m_contents(0), m_index(0)
+{
+ kdDebug() << "ProjectDocumentationPlugin::ProjectDocumentationPlugin for type " << type << endl;
+
+ m_watch = new KDirWatch(this);
+ connect(m_watch, SIGNAL(dirty(const QString&)), this, SLOT(reinit()));
+ m_watch->startScan();
+}
+
+ProjectDocumentationPlugin::~ProjectDocumentationPlugin()
+{
+ deinit();
+}
+
+void ProjectDocumentationPlugin::init(KListView *contents, IndexBox *index, const QString &url)
+{
+ m_contents = contents;
+ m_index = index;
+ m_url = url;
+
+ if (m_catalog)
+ deinit();
+ m_catalog = m_docPlugin->createCatalog(contents,
+ m_type == DocumentationPlugin::APIDocs ? i18n("Project API Documentation")
+ : i18n("Project User Manual"), url);
+ if (m_catalog)
+ {
+ m_catalog->setProjectDocumentationItem(true);
+ m_watch->addFile(url);
+ }
+}
+
+void ProjectDocumentationPlugin::reinit()
+{
+ deinit();
+ if (m_contents != 0 && m_index != 0 && m_url != 0)
+ init(m_contents, m_index, m_url);
+}
+
+void ProjectDocumentationPlugin::deinit()
+{
+ m_watch->removeFile(m_url);
+ delete m_catalog;
+ m_catalog = 0;
+}
+
+QString ProjectDocumentationPlugin::pluginName() const
+{
+ return m_docPlugin->pluginName();
+}
+
+QString ProjectDocumentationPlugin::catalogURL() const
+{
+ return m_url;
+}
+
+#include "kdevdocumentationplugin.moc"
diff --git a/parts/documentation/interfaces/kdevdocumentationplugin.h b/parts/documentation/interfaces/kdevdocumentationplugin.h
new file mode 100644
index 00000000..5d100ab5
--- /dev/null
+++ b/parts/documentation/interfaces/kdevdocumentationplugin.h
@@ -0,0 +1,421 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 by Alexander Dymo <cloudtemple@mksat.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef KDEV_DOC_PLUGIN_H
+#define KDEV_DOC_PLUGIN_H
+
+#include <qmap.h>
+#include <qvaluelist.h>
+#include <qpair.h>
+
+#include <klistbox.h>
+#include <klistview.h>
+#include <kurl.h>
+#include <kfile.h>
+
+#define CACHE_VERSION "3"
+
+/**Documentation list item.
+Stores the type of a documentation it represents and an URL.*/
+class DocumentationItem: public KListViewItem
+{
+public:
+ /**Type of documentation which is represented by this item.*/
+ enum Type {
+ Collection /**<Collection - a collection of catalogs, folder with catalogs.*/,
+ Catalog /**<Catalog - a term which defines a document or a group of documents.*/,
+ Book /**<Book - a document with nested documents.*/,
+ Document /**<Document.*/
+ };
+
+ DocumentationItem(Type type, KListView *parent, const QString &name);
+ DocumentationItem(Type type, KListView *parent, KListViewItem *after, const QString &name);
+ DocumentationItem(Type type, KListViewItem *parent, const QString &name);
+ DocumentationItem(Type type, KListViewItem *parent, KListViewItem *after, const QString &name);
+
+ virtual void setURL(const KURL &url) { m_url = url; }
+ virtual KURL url() const { return m_url; }
+
+ Type type() const { return m_type; }
+
+ void setType(Type t) {
+ if(t != m_type) {
+ m_type = t;
+ init();
+ }
+ }
+private:
+ void init();
+
+ KURL m_url;
+ Type m_type;
+};
+
+class DocumentationPlugin;
+
+/**Documentation catalog list item.*/
+class DocumentationCatalogItem: public DocumentationItem
+{
+public:
+ DocumentationCatalogItem(DocumentationPlugin* plugin, KListView *parent, const QString &name);
+ DocumentationCatalogItem(DocumentationPlugin* plugin, DocumentationItem *parent, const QString &name);
+ virtual ~DocumentationCatalogItem();
+
+ DocumentationPlugin* plugin() const { return m_plugin; }
+
+ virtual void setOpen(bool o);
+ void load();
+
+ virtual bool isProjectDocumentationItem() const { return m_isProjectDocumentationItem; }
+ virtual void setProjectDocumentationItem(bool b) { m_isProjectDocumentationItem = b; }
+
+ virtual QString cacheVersion() const { return ""; } /// should return a short string that identifies the version of the catalog
+
+protected:
+ virtual void activate();
+
+private:
+ DocumentationPlugin* m_plugin;
+ bool isLoaded;
+ bool isActivated;
+ bool m_isProjectDocumentationItem;
+};
+
+class IndexBox;
+
+/**Prototype of index item.
+Prototypes represent an index are used to build index items after index generation.*/
+class IndexItemProto
+{
+public:
+ IndexItemProto(DocumentationPlugin *plugin, DocumentationCatalogItem *catalog, IndexBox *listbox,
+ const QString &text, const QString &description);
+ ~IndexItemProto();
+
+ void addURL(const KURL &url) { m_url = url; }
+ KURL url() const { return m_url; }
+ QString text() const { return m_text; }
+ QString description() const { return m_description; }
+
+private:
+ KURL m_url;
+ IndexBox *m_listbox;
+ QString m_text;
+ QString m_description;
+};
+
+/**Documentation index item.*/
+class IndexItem: public QListBoxText {
+public:
+ typedef QPair<QString, KURL> URL;
+ typedef QValueList<URL> List;
+
+ IndexItem(IndexBox *listbox, const QString &text);
+
+ List urls() const;
+
+private:
+ IndexBox *m_listbox;
+};
+
+/**Documentation index view.*/
+class IndexBox: public KListBox{
+public:
+ IndexBox(QWidget *parent = 0, const char *name = 0);
+
+ virtual void addIndexItem(IndexItemProto *item);
+ virtual void removeIndexItem(IndexItemProto *item);
+ virtual void fill();
+ virtual void refill();
+ virtual void setDirty(bool dirty);
+// virtual void refill(QValueList<IndexItemProto*> &items);
+
+private:
+ QMap<QString, QValueList<IndexItemProto*> > items;
+ friend class IndexItem;
+
+ bool m_dirty;
+};
+
+class QPainter;
+class QColorGroup;
+class QFontMetrics;
+class DocumentationPlugin;
+
+/**Documentation configuration item.*/
+class ConfigurationItem: public QCheckListItem
+{
+public:
+ ConfigurationItem(QListView *parent, DocumentationPlugin * plugin, const QString &title, const QString &url,
+ bool indexPossible, bool fullTextSearchPossible);
+
+ virtual QString title() const { return m_title; }
+ virtual void setTitle(const QString title) { setText(3, m_title = title); }
+ virtual QString url() const { return m_url; }
+ virtual void setURL(const QString url) { setText(4, m_url = url); }
+
+ virtual bool isChanged() const { return m_title == m_origTitle; }
+ virtual QString origTitle() const {return m_origTitle; }
+
+ virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align);
+ virtual int width(const QFontMetrics &fm, const QListView *lv, int c) const;
+
+ bool contents() const { return m_contents; }
+ void setContents(bool contents) { m_contents = contents; }
+ bool index() const { return m_index; }
+ void setIndex(bool index) { m_index = index; }
+ bool fullTextSearch() const { return m_fullTextSearch; }
+ void setFullTextSearch(bool fullTextSearch) { m_fullTextSearch = fullTextSearch; }
+
+ bool indexPossible() const { return m_indexPossible; }
+ bool fullTextSearchPossible() const { return m_fullTextSearchPossible; }
+
+ DocumentationPlugin * docPlugin() { return m_docPlugin; }
+
+private:
+ QString m_title;
+ QString m_url;
+ QString m_origTitle;
+
+ bool m_contents;
+ bool m_index;
+ bool m_fullTextSearch;
+
+ bool m_indexPossible;
+ bool m_fullTextSearchPossible;
+
+ DocumentationPlugin * m_docPlugin;
+};
+
+
+class ProjectDocumentationPlugin;
+
+/**
+@short Documentation Plugin Interface
+
+All KDevelop documentation plugins must implement this interface.
+Documentation plugin handles certain documentation type. It provides
+methods to load documentation catalogs and indexes for a documentation
+of that type. It also has methods to configure catalogs and provides
+a list of URL's for the full text search tool.
+*/
+class DocumentationPlugin: public QObject
+{
+ Q_OBJECT
+public:
+ /**Capability of documentation plugin.*/
+ enum Capability { Index=1 /**<index can be built for catalogs*/,
+ FullTextSearch=2 /**<full text search is possible in catalog locations*/,
+ CustomDocumentationTitles=4 /**<user can specify titles for documentation catalogs*/,
+ ProjectDocumentation=8 /**<plugin can handle project API documentation*/,
+ ProjectUserManual=16 /**<plugin can handle project user manual*/ };
+ /**Possible project documentation types.*/
+ enum ProjectDocType { APIDocs, UserManual };
+
+ /**Constructor. Should initialize capabilities of the plugin by using setCapabilities
+ protected method. For example,
+ @code
+ setCapabilities(Index | FullTextSearch);
+ @endcode
+ */
+ DocumentationPlugin(KConfig *pluginConfig, QObject *parent =0, const char *name =0);
+ virtual ~DocumentationPlugin();
+
+ /**Returns the i18n name of the plugin.*/
+ virtual QString pluginName() const = 0;
+
+ /**Creates documentation catalog with given title and url.*/
+ virtual DocumentationCatalogItem *createCatalog(KListView *contents, const QString &title, const QString &url) = 0;
+
+ /**Initialize a list of catalogs.
+ @param contents the listview to fill with catalogs
+ */
+ virtual void init(KListView *contents);
+ /**Reloads a list of catalogs. This method should add missing catalogs to the view,
+ update index for added catalogs and also delete restricted catalogs.
+ @param contents the listview to fill with catalogs
+ @param index the listbox with index to update
+ @param restrictions the list of catalogs names to remove
+ */
+ virtual void reinit(KListView *contents, IndexBox *index, QStringList restrictions);
+ /**Initializes plugin configuration. Documentation plugins should be able to
+ initialize the default configuration on startup without any user interaction.
+ Call this in the constructor of your plugin.*/
+ virtual void autoSetup();
+ /**Plugin specific automatic setup code. This method is called by @ref autoSetup.*/
+ virtual void autoSetupPlugin() = 0;
+
+ /**Indicates if a catalog with specified name is enabled. Documentation plugin
+ should check this and do not load catalogs disabled in configuration.
+ All catalogs are enabled by default.*/
+ virtual bool catalogEnabled(const QString &name) const;
+ /**Enables or disables documentation catalog.*/
+ virtual void setCatalogEnabled(const QString &name, bool e);
+
+ /**Indicates if an index of given catalog should be rebuilt. This method
+ is used by index caching algorythm to make a descision to rebuild index
+ or to load it from cache.*/
+ virtual bool needRefreshIndex(DocumentationCatalogItem *item) = 0;
+ /**Indicates if an index is enabled for given catalog. If documentation plugin
+ has Index capability, indices for it's catalogs can be enabled/disabled
+ in configuration dialog.*/
+ virtual bool indexEnabled(DocumentationCatalogItem *item) const;
+ /**Enables or disables index for documentation catalog.*/
+ virtual void setIndexEnabled(DocumentationCatalogItem *item, bool e);
+ /**Builds index for given catalog. This method should fill index with
+ IndexItem objects.
+ @param index the listbox which contains index items
+ @param item the catalog item that holds an index being built
+ */
+ virtual void createIndex(IndexBox *index, DocumentationCatalogItem *item) = 0;
+
+ /**Creates a table of contents for given catalog. Documentation part uses
+ lazy loading of toc's to reduce startup time. This means that createTOC
+ will be called on expand event of catalog item.*/
+ virtual void createTOC(DocumentationCatalogItem *item) = 0;
+ /**Sets the URL to the catalog. This method will be called each time user
+ clicks the documentation item. If it is too much overhead to determine the
+ documentation catalog url in @ref createCatalog method then you can set it here.*/
+ virtual void setCatalogURL(DocumentationCatalogItem *item) = 0;
+ virtual QStringList fullTextSearchLocations() = 0;
+
+ /**Loads catalog configuration and fills configurationView with ConfigurationItem objects.*/
+ virtual void loadCatalogConfiguration(KListView *configurationView);
+ /**Saves catalog configuration basing on configurationView and
+ deletedConfigurationItems contents. If you use KConfig to store configuration,
+ it is important that you call KConfig::sync() method after saving.*/
+ virtual void saveCatalogConfiguration(KListView *configurationView);
+ /**Adds new catalog to a configuration.*/
+ virtual void addCatalogConfiguration(KListView *configurationView,
+ const QString &title, const QString &url);
+ /**Edits catalog configuration.*/
+ virtual void editCatalogConfiguration(ConfigurationItem *configurationItem,
+ const QString &title, const QString &url);
+ /**Removes catalog from configuration. configurationItem should not be removed here.*/
+ virtual void deleteCatalogConfiguration(const ConfigurationItem *const configurationItem);
+
+ /**Returns a mode and a filter for catalog locator dialogs.*/
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps() = 0;
+ /**Returns a title of catalog defined by an url parameter.*/
+ virtual QString catalogTitle(const QString &url) = 0;
+
+ /**Reloads documentation catalogs and indices.*/
+ virtual void reload();
+ /**Clears documentation catalogs and indices.*/
+ virtual void clear();
+
+ /**Checks if documentation plugin has given capability.*/
+ bool hasCapability(Capability cap) const { return m_capabilities & cap; }
+
+ /**Sets dirty flag for all indices. Index caching algorythm will update
+ the cache next time @ref createIndex is called.*/
+ void setDirtyIndex(bool dirty) { m_indexCreated = dirty; }
+
+ /**Caches index for documentation catalog. Reimplement this only if custom
+ caching algorythm is used (do not forget to reimplement also @ref loadCachedIndex
+ and @ref createIndex).*/
+ virtual void cacheIndex(DocumentationCatalogItem *item);
+ /**Loads index from the cache. Reimplement this only if custom
+ caching algorythm is used (do not forget to reimplement also @ref cacheIndex
+ and @ref createIndex).*/
+ virtual bool loadCachedIndex(IndexBox *index, DocumentationCatalogItem *item);
+
+ /**Returns associated project documentation plugin. Default implementation returns zero.
+ Reimplement this if the documentation plugin can also handle project documentation.*/
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType /* type */) { return 0; }
+
+public slots:
+ /**Creates index and fills index listbox. Reimplement this only if custom
+ caching algorythm is used (do not forget to reimplement also @ref cacheIndex
+ and @ref loadCachedIndex).*/
+ virtual void createIndex(IndexBox *index);
+
+protected:
+ /**A list of loaded documentation catalogs.*/
+ QValueList<DocumentationCatalogItem*> catalogs;
+ /**A map of names of loaded documentation catalogs.*/
+ QMap<QString, DocumentationCatalogItem*> namedCatalogs;
+ /**A map of indices of loaded documentation catalogs.*/
+ QMap<DocumentationCatalogItem*, QValueList<IndexItemProto*> > indexes;
+
+ /**Sets capabilities of documentation plugin.*/
+ void setCapabilities(int caps) { m_capabilities = caps; }
+ /**Clears index of given catalog.*/
+ virtual void clearCatalogIndex(DocumentationCatalogItem *item);
+ /**Loads index from cache or creates and caches it if does not exist.*/
+ void loadIndex(IndexBox *index, DocumentationCatalogItem *item);
+
+ /**Stores items deleted from configuration. @ref saveCatalogConfiguration
+ uses this to remove entries from configuration file.*/
+ QStringList deletedConfigurationItems;
+
+ /**Configuration object used by a plugin.*/
+ KConfig *config;
+
+private:
+ /**Adds catalog item to catalogs, namedCatalogs and indexes lists and maps.*/
+ virtual void addCatalog(DocumentationCatalogItem *item);
+ /**Removes catalog item from catalogs, namedCatalogs and indexes lists and maps.*/
+ virtual void clearCatalog(DocumentationCatalogItem *item);
+
+ int m_capabilities;
+ bool m_indexCreated;
+
+
+friend class IndexItemProto;
+friend class DocumentationCatalogItem;
+};
+
+
+/**
+@short Project documentation plugin
+
+Represents functionality to display project documentation catalog and index in documentation browser.
+*/
+class ProjectDocumentationPlugin: public QObject {
+ Q_OBJECT
+public:
+ ProjectDocumentationPlugin(DocumentationPlugin *docPlugin, DocumentationPlugin::ProjectDocType type);
+ virtual ~ProjectDocumentationPlugin();
+
+ /**Initializes project documentation plugin - creates documentation catalog.*/
+ virtual void init(KListView *contents, IndexBox *index, const QString &url);
+ /**Deinitializes project documentation plugin - removes documentation catalog.*/
+ virtual void deinit();
+
+ QString pluginName() const;
+ QString catalogURL() const;
+
+public slots:
+ /**Performs reinitialization if project documentation has changed (after building api documentation).*/
+ virtual void reinit();
+
+protected:
+ DocumentationPlugin *m_docPlugin;
+ DocumentationCatalogItem *m_catalog;
+
+private:
+ DocumentationPlugin::ProjectDocType m_type;
+
+ class KDirWatch *m_watch;
+ class KListView *m_contents;
+ class IndexBox *m_index;
+ QString m_url;
+};
+
+#endif
diff --git a/parts/documentation/interfaces/kdevelopdocumentationplugins.desktop b/parts/documentation/interfaces/kdevelopdocumentationplugins.desktop
new file mode 100644
index 00000000..08fed218
--- /dev/null
+++ b/parts/documentation/interfaces/kdevelopdocumentationplugins.desktop
@@ -0,0 +1,36 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=KDevelop/DocumentationPlugins
+X-KDE-Derived=KDevelop/Plugin
+Name=KDevelop Documentation Plugin Interface
+Name[ca]=Interfície de connectors de documentació de KDevelop
+Name[da]=KDevelop grænseflade for dokumentations-plugin
+Name[de]=Schnittstelle für Dokumentationsmodul (KDevelop)
+Name[el]=Διασύνδεση πρόσθετου τεκμηρίωσης KDevelop
+Name[es]=Interfaz de complemento de documentación de KDevelop
+Name[et]=KDevelopi dokumentatsiooniplugina liides
+Name[eu]=KDevelop-en dokumentazio plugin interfazea
+Name[fa]=واسط وصلۀ مستندات KDevelop
+Name[fr]=Interface du module externe de documentation de KDevelop
+Name[gl]=Interface da extensión de documentación de KDevelop
+Name[hu]=KDevelop dokumentációmodul-felület
+Name[it]=Interfaccia a plugin della documentazione di KDevelop
+Name[ja]=KDevelop ドキュメンテーションプラグイン インターフェース
+Name[ms]=Antaramuka Plugin Dokumentasi KDevelop
+Name[nds]=KDevelop-Koppelsteed för't Dokmentatschoon-Moduul
+Name[ne]=केडीई विकास मिसिलीकरण प्लगइन इन्टरफेस
+Name[nl]=KDevelop Documentatie Plugin Interface
+Name[pl]=Interfejs do wtyczki dokumentacji dla KDevelop
+Name[pt]=Interface de 'Plugin' de Documentação do KDevelop
+Name[pt_BR]=Interface de Plug-in de Documentação do KDevelop
+Name[ru]=Интерфейс для модулей документации KDevelop
+Name[sk]=KDevelop rozhranie pre dokumentačný modul
+Name[sl]=Vmesnik vstavka dokumentacije v KDevelopu
+Name[sr]=Интерфејс KDevelop-овог прикључка за документацију
+Name[sr@Latn]=Interfejs KDevelop-ovog priključka za dokumentaciju
+Name[sv]=KDevelop insticksgränssnitt för dokumentation
+Name[ta]=Kமுன்னேற்று தொகுப்பான் தேர்வுகள் உரை இடைமுகம் உள்ளீடு
+Name[tg]=Интерфейс барои модулҳои ҳуҷҷатноки KDevelop
+Name[tr]=KDevelop Belgelendirme Eklentisi Arayüzü
+Name[zh_CN]=KDevelop 文档插件接口
+Name[zh_TW]=KDevelop 文件外掛程式介面
diff --git a/parts/documentation/kdevdocumentation.desktop b/parts/documentation/kdevdocumentation.desktop
new file mode 100644
index 00000000..415d1e2e
--- /dev/null
+++ b/parts/documentation/kdevdocumentation.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=The Documentation plugin offers browsing and searching in local and online documentation with support for multiple documentation systems.
+Comment[ca]=El connector de documentació ofereix navegació i recerca en documentació local i en línia amb suport per a múltiples sistemes de documentació.
+Comment[da]=Dokumentations-plugin tilbyder visning og søgning i lokal og online dokumentation med understøttelse af flere dokumentations-systemer.
+Comment[de]=Die Dokumentations-Komponente bietet eine Browsefunktion und Unterstützung für die Suche in mehreren Hilfedokumenten und Dokumentationssystemen.
+Comment[el]=Το πρόσθετο τεκμηρίωσης προσφέρει περιήγηση και αναζήτηση σε τοπική και απομακρυσμένη τεκμηρίωση για πολλαπλά συστήματα τεκμηρίωσης.
+Comment[es]=El complemento de documentación proporciona navegación y búsqueda en la documentación, tanto local como en línea, y permite múltiples sistemas de documentación.
+Comment[et]=Dokumentatsiooniplugin võimaldab lehitseda ja otsida nii kohalikus kui võrgudokumentatsioonis paljusid dokumentatsioonisüsteeme kasutades.
+Comment[eu]=Dokumentazio-pluginak lokaleko eta urruneko dokumentazio arakatzeko eta bilatzeko aukera ematen dizu, eta dokumentazio-sistema anitz onartzen ditu.
+Comment[fa]=وصلۀ مستندسازی، مرور و جستجو در مستندات محلی و برخط را با پشتیبانی از سیستمهای مستندسازی چندگانه، ارائه می‌کند.
+Comment[fr]=Le module externe de documentation offre une navigation et une recherche dans la documentation locale et en ligne ainsi que la prise en charge de systèmes de documentation mutiples.
+Comment[gl]=A extensión de documentación ofrece navegación e búsqueda en documentación local e en liña con soporte para múltiples sistemas de documentación.
+Comment[hu]=Dokumentációmegjelenítő elem helyi és távoli dokumentáció böngészéséhez, keresési lehetőséggel. Többféle formátumot támogat.
+Comment[it]=Il plugin di documentazione offre navigazione e ricerca in locale e documentazione in linea con supporto per sistemi di documentazione multipla.
+Comment[ms]=Plugin dokumentasi menawarkan pelungsuran dan pencarian dalam dokumentasi tempatan dan dalam talian dengan sokongan untuk pelbagai sistem dokumentasi.
+Comment[nds]=Mit dat Dokmentatschoon-Moduul kannst Du lokale un Tokoppel-Dokmentatschoon dörkieken un -söken, mehr Dokmentatschoonsystemen warrt ünnerstütt.
+Comment[ne]=मिसिलीकरण प्लगइनले बहुविध मिसिलीकरण प्रणालीको समर्थनसँग अनलाइन मिसिलीकरण र स्थानीय रूपमा ब्राउज र खोजी गर्न दिन्छ ।
+Comment[nl]=De documentatieplugin welke het mogelijk maakt om door lokale documentatie en documentatie op afstand te bladeren en te zoeken. Met ondersteuning voor verschillende documentatiesystemen.
+Comment[pl]=Kontrola dokumentacji z obsługą przeglądania i wyszukiwania w różnych plikach pomocy i systemach dokumentacji.
+Comment[pt]=O 'plugin' de documentação oferece navegação e procura em documentação local e em rede com suporte para vários sistemas de documentação.
+Comment[pt_BR]=A documentação do plug-in oferece navegação e busca na documentação local e online com suporte para diversos sistemas de documentação.
+Comment[ru]=Модуль документации позволяет упростить работу с документацией.
+Comment[sk]=Dokumentačný modul proskytuje prehliadanie a vyhľadávanie v lokálnej a online dokumentácie s podporou viacerých dokumentačných systémov.
+Comment[sr]=Прикључак за документацију са подршком за прегледање и тражење у локалној и документацији на вези, за више документационих система.
+Comment[sr@Latn]=Priključak za dokumentaciju sa podrškom za pregledanje i traženje u lokalnoj i dokumentaciji na vezi, za više dokumentacionih sistema.
+Comment[sv]=Dokumentationsinsticksprogrammet erbjuder bläddring och sökning i lokal dokumentation och dokumentation på nätet, med stöd för flera dokumentationssystem.
+Comment[tr]=Belgelendirme eklentisi, çoklu belgelendirme sistemlerine destek ile, yerel ve çevrimiçi belgelere gözatma ve bu belgelerde arama yapılmasına izin verir.
+Comment[zh_CN]=文档插件提供了本地和在线文档中提供浏览和搜索功能,支持多种文档系统
+Comment[zh_TW]=文件外掛程式提供對本地與線上文件的瀏覽與搜尋功能,並支援多重文件系統。
+Name=KDevDocumentation
+Name[da]=KDevelop dokumentation
+Name[nds]=KDevelop-Dokmentatschoon
+Name[pt_BR]=KDevDocumentação
+Name[sk]=KDev dokumentácia
+Name[sv]=KDevelop dokumentation
+Name[ta]=KDev ஆவணமாக்கல்
+Name[tg]=Ҳуҷҷатҳои KDev
+Name[zh_TW]=KDevelop 文件
+GenericName=Documentation
+GenericName[br]=Teuliadur
+GenericName[ca]=Documentació
+GenericName[cy]=Dogfenniaeth
+GenericName[da]=Dokumentation
+GenericName[de]=Dokumentationsbaum
+GenericName[el]=Τεκμηρίωση
+GenericName[es]=Documentación
+GenericName[et]=Dokumentatsioon
+GenericName[eu]=Dokumentazioa
+GenericName[fa]=مستندات
+GenericName[ga]=Doiciméadú
+GenericName[gl]=Documentación
+GenericName[hi]=दस्तावेज़ीकरण
+GenericName[hu]=Dokumentáció
+GenericName[it]=Documentazione
+GenericName[ja]=ドキュメンテーション
+GenericName[ms]=Dokumentasi
+GenericName[nds]=Dokmentatschoon
+GenericName[ne]=मिसिलीकरण
+GenericName[nl]=Documentatie
+GenericName[pl]=Dokumentacja
+GenericName[pt]=Documentação
+GenericName[pt_BR]=Documentação
+GenericName[ru]=Просмотр документации
+GenericName[sk]=Dokumentácia
+GenericName[sl]=Dokumentacija
+GenericName[sr]=Документација
+GenericName[sr@Latn]=Dokumentacija
+GenericName[sv]=Dokumentation
+GenericName[ta]=ஆவணமாக்கல்
+GenericName[tg]=Намоиши ҳуҷҷатҳо
+GenericName[tr]=Belgelendirme
+GenericName[zh_CN]=文档
+GenericName[zh_TW]=文件
+Icon=khelpcenter
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Global
+X-KDE-Library=libkdevdocumentation
+X-KDevelop-Version=5
+X-KDevelop-Mode=AssistantMode
+X-KDevelop-Properties=Documentation
diff --git a/parts/documentation/kdevpart_documentation.rc b/parts/documentation/kdevpart_documentation.rc
new file mode 100644
index 00000000..f8dac85a
--- /dev/null
+++ b/parts/documentation/kdevpart_documentation.rc
@@ -0,0 +1,19 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="documentation" library="libdocumentationplugin" version="4">
+<MenuBar>
+<!-- <Action name="doc_bookmarks"/> -->
+<!-- <Menu name="tools"><Text>&amp;Tools</Text>
+ <Action name="plugin_action"/>
+ </Menu> -->
+ <Menu name="help">
+ <Action name="help_look_in_index"/>
+ <Action name="help_search_in_doc"/>
+ <Action name="help_manpage"/>
+ <Action name="help_infopage"/>
+ <Action name="help_find_documentation" />
+ </Menu>
+</MenuBar>
+<!--<ToolBar name="extraToolBar">
+ <Action name="plugin_action"/>
+</ToolBar> -->
+</kpartplugin>
diff --git a/parts/documentation/plugins/Makefile.am b/parts/documentation/plugins/Makefile.am
new file mode 100644
index 00000000..c2002f78
--- /dev/null
+++ b/parts/documentation/plugins/Makefile.am
@@ -0,0 +1,3 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+METASOURCES = AUTO
+SUBDIRS = qt doxygen devhelp kdevtoc chm custom
diff --git a/parts/documentation/plugins/chm/Makefile.am b/parts/documentation/plugins/chm/Makefile.am
new file mode 100644
index 00000000..6df1ba52
--- /dev/null
+++ b/parts/documentation/plugins/chm/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = libdocchmplugin.la
+
+noinst_HEADERS = docchmplugin.h
+kde_services_DATA = docchmplugin.desktop
+
+libdocchmplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+libdocchmplugin_la_SOURCES = docchmplugin.cpp
+libdocchmplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la
diff --git a/parts/documentation/plugins/chm/docchmplugin.cpp b/parts/documentation/plugins/chm/docchmplugin.cpp
new file mode 100644
index 00000000..e2b2b556
--- /dev/null
+++ b/parts/documentation/plugins/chm/docchmplugin.cpp
@@ -0,0 +1,198 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docchmplugin.h"
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+#include <kio/netaccess.h>
+#include <iostream>
+#include <fstream>
+#include <qvaluevector.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <qregexp.h>
+
+#include "../../../../config.h"
+
+static const KDevPluginInfo data("docchmplugin");
+typedef KDevGenericFactory<DocCHMPlugin> DocCHMPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocchmplugin, DocCHMPluginFactory(data) )
+
+DocCHMPlugin::DocCHMPlugin(QObject* parent, const char* name, QStringList // args
+ )
+ :DocumentationPlugin(DocCHMPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(CustomDocumentationTitles); // | Index | FullTextSearch | ProjectDocumentation
+ autoSetup();
+}
+
+DocCHMPlugin::~DocCHMPlugin()
+{
+}
+
+
+DocumentationCatalogItem* DocCHMPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title);
+ item->setURL(KURL(url));
+
+ return item;
+}
+
+QPair<KFile::Mode, QString> DocCHMPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "*.chm");
+}
+
+QString DocCHMPlugin::catalogTitle(const QString& // url
+ )
+{
+ return QString::null;
+}
+
+QString DocCHMPlugin::pluginName() const
+{
+ return i18n("CHM Documentation Collection");
+}
+
+
+QString DocCHMPlugin::getSpecialData(const QString& name, KURL url) {
+ QString ret = "";
+ url.setProtocol("ms-its");
+
+ url.addPath("/:" + name);
+ QString tmpFile;
+ if( KIO::NetAccess::download( url, tmpFile, 0 ) )
+ {
+ std::filebuf fb;
+ fb.open (tmpFile.ascii(), std::ios::in);
+ std::istream is(&fb);
+ char buf[5000] = " ";
+ while(is.good()) {
+ is.getline(buf, 5000);
+ ret += buf; ret += "\n";
+ }
+ fb.close();
+ KIO::NetAccess::removeTempFile( tmpFile );
+ } else {
+ kdDebug(9002) << "DocCHMPlugin::getSpecialData could not download data from " << url.url() << endl;
+ }
+ return ret;
+}
+
+
+///this currently is useless, because htdig cannot use kioslaves
+QStringList DocCHMPlugin::fullTextSearchLocations()
+{
+ //return QStringList::split( '\n', getSpecialData("contents", m_url));
+ return QStringList();
+}
+
+bool DocCHMPlugin::needRefreshIndex(DocumentationCatalogItem* // item
+ )
+{
+ return false;
+}
+
+void DocCHMPlugin::autoSetupPlugin()
+{
+ return;
+}
+
+void DocCHMPlugin::createIndex(IndexBox* // index
+ , DocumentationCatalogItem* // item
+ )
+{
+ return;
+}
+
+
+static KListViewItem* chainEnd(KListViewItem *parent) {
+ if(parent == 0) return 0;
+ KListViewItem* ret = dynamic_cast<KListViewItem*>(parent->firstChild());
+ if(ret == 0) return 0;
+ while(ret->nextSibling() != 0) {
+ ret = dynamic_cast<KListViewItem*>(ret->nextSibling());
+ }
+ return ret;
+}
+
+static QString decodeHTML(const QString& s) {
+ QRegExp rx(QString::fromLatin1("&#(\\d+);|&nbsp;"));
+ QString out = s;
+ int pos = rx.search(out);
+ while(pos > -1) {
+ QString found = rx.cap(0);
+ if(found != "&nbsp;") {
+ out.replace(pos, found.length(), static_cast<char>(rx.cap(1).toInt()));
+ }else{
+ out.replace(pos, found.length(), " ");
+ }
+ pos = rx.search(out, pos+1);
+ }
+ return out;
+}
+
+
+void DocCHMPlugin::createTOC(DocumentationCatalogItem* item)
+{
+ QStringList lines = QStringList::split("\n", getSpecialData("catalog", item->url()) );
+ if(lines.count() % 4 != 0) { kdDebug(9002) << "DocCHMPlugin::createTOC: wrong count of strings"; return;}
+
+ QValueVector<DocumentationItem*> items;
+ items.push_back(item);
+ for(QStringList::Iterator it = lines.begin(); it != lines.end();) {
+ bool ok1 = true, ok2 = true;
+ int parent = (*it).toInt(&ok1);
+ ++it;
+ int current = (*it).toInt(&ok2);
+ ++it;
+ if(int(items.size()) != current || !ok1 || !ok2 || parent < 0 || parent >= int(items.size()) || current < 0 || current != int(items.size())) {
+ kdDebug(9002) << "DocCHMPlugin::createTOC error while parsing output of ioslave" << endl;
+ break;
+ }
+
+ QString& name(*it);
+ ++it;
+ KURL url(*it);
+ ++it;
+
+ items.push_back(new DocumentationItem(
+ DocumentationItem::Document, items[parent], chainEnd(items[parent]), decodeHTML(name)));
+ items[current]->setURL(url);
+ if(parent != 0) items[parent]->setType(DocumentationItem::Book);
+ }
+
+
+ return;
+}
+
+void DocCHMPlugin::setCatalogURL(DocumentationCatalogItem* item)
+{
+ KURL chmURL = item->url();
+ chmURL.setProtocol("ms-its");
+ chmURL.addPath("/");
+ item->setURL(chmURL);
+}
+
+#include "docchmplugin.moc"
diff --git a/parts/documentation/plugins/chm/docchmplugin.desktop b/parts/documentation/plugins/chm/docchmplugin.desktop
new file mode 100644
index 00000000..1e538ed7
--- /dev/null
+++ b/parts/documentation/plugins/chm/docchmplugin.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=DocCHMPlugin
+Name[da]=DocCHM-plugin
+Name[hu]=DocCHMPPlugin
+Name[sk]=Doc CHM modul
+Name[sv]=CHM-dokumentationsinsticksmodul
+Name[ta]=DocCHM சொருகு
+Name[zh_TW]=Doc CHM 外掛程式
+Exec=blubb
+Comment=Documentation plugin for CHM documentation
+Comment[ca]=Connector de documentació per a documentació CHM
+Comment[da]=Dokumentations-plugin for CHM-dokumentation
+Comment[de]=Dokumentations-Modul für CHM-Dokumentation
+Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση CHM
+Comment[es]=Complemento de documentación para CHM
+Comment[et]=CHM dokumentatsiooni plugin
+Comment[eu]=CHM dokumentazioarako dokumentazioa plugin-aDocumentation plugin for CHM documentation
+Comment[fa]=وصلۀ مستندسازی برای مستندات CHM
+Comment[fr]=Module externe de documentation pour la documentation CHM
+Comment[gl]=Extensión de documentación para documentación CHM
+Comment[hu]=Dokumentációmodul CHM formátumú dokumentációhoz
+Comment[it]=Plugin di documentazione per file CHM
+Comment[ja]=CHM ドキュメンテーションのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk dokumentasi CHM
+Comment[nds]=Dokmentatschoon-Moduul för CHM-Dokmentatschonen
+Comment[ne]=CHM मिसिलीकरणका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor CHM documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie CHM
+Comment[pt]='Plugin' para documentação CHM
+Comment[pt_BR]=Plug-in de documentação para documento CHM
+Comment[ru]=Модуль для просмотра документации в файлах CHM
+Comment[sk]=Dokumentačný modul pre CHM dokumentáciu
+Comment[sr]=Документациони прикључак за CHM документацију
+Comment[sr@Latn]=Dokumentacioni priključak za CHM dokumentaciju
+Comment[sv]=Dokumentationsinsticksmodul för CHM-dokumentation
+Comment[ta]= CHM ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои намоиши файлҳои CHM-е, ки ҳуҷҷатҳо мавҷуд аст
+Comment[tr]=CHM belgelendirmesi için belgelendirme eklentisi
+Comment[zh_CN]=CHM 文档的文档插件
+Comment[zh_TW]=CHM 文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=5
+X-KDE-Library=libdocchmplugin
diff --git a/parts/documentation/plugins/chm/docchmplugin.h b/parts/documentation/plugins/chm/docchmplugin.h
new file mode 100644
index 00000000..69bc441b
--- /dev/null
+++ b/parts/documentation/plugins/chm/docchmplugin.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCCHMPLUGIN_H
+#define DOCCHMPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+
+class DocCHMPlugin :public DocumentationPlugin
+{
+ Q_OBJECT
+public:
+ DocCHMPlugin(QObject* parent, const char* name, QStringList args = QStringList());
+ ~DocCHMPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+ virtual QString catalogTitle(const QString& url);
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+ virtual void createTOC(DocumentationCatalogItem* item);
+
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual void autoSetupPlugin();
+protected:
+ QString getSpecialData(const QString& name, KURL url);
+};
+
+#endif
diff --git a/parts/documentation/plugins/custom/Makefile.am b/parts/documentation/plugins/custom/Makefile.am
new file mode 100644
index 00000000..999dc853
--- /dev/null
+++ b/parts/documentation/plugins/custom/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libdoccustomplugin.la
+libdoccustomplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+libdoccustomplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la
+noinst_HEADERS = doccustomplugin.h
+libdoccustomplugin_la_SOURCES = doccustomplugin.cpp
+kde_services_DATA = doccustomplugin.desktop
diff --git a/parts/documentation/plugins/custom/doccustomplugin.cpp b/parts/documentation/plugins/custom/doccustomplugin.cpp
new file mode 100644
index 00000000..b3cc7685
--- /dev/null
+++ b/parts/documentation/plugins/custom/doccustomplugin.cpp
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "doccustomplugin.h"
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+static const KDevPluginInfo data("doccustomplugin");
+typedef KDevGenericFactory<DocCustomPlugin> DocCustomPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdoccustomplugin, DocCustomPluginFactory(data) )
+
+DocCustomPlugin::DocCustomPlugin(QObject* parent, const char* name, const QStringList // args
+ )
+ :DocumentationPlugin(DocCustomPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(CustomDocumentationTitles | ProjectUserManual);
+ autoSetup();
+}
+
+DocCustomPlugin::~DocCustomPlugin()
+{
+}
+
+bool DocCustomPlugin::needRefreshIndex(DocumentationCatalogItem* // item
+ )
+{
+ return false;
+}
+
+QString DocCustomPlugin::pluginName() const
+{
+ return i18n("Custom Documentation Collection");
+}
+
+DocumentationCatalogItem* DocCustomPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title);
+ item->setURL(KURL(url));
+ return item;
+}
+
+QPair<KFile::Mode, QString> DocCustomPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "all/allfiles");
+}
+
+QString DocCustomPlugin::catalogTitle(const QString& /*url*/)
+{
+ return QString::null;
+}
+
+QStringList DocCustomPlugin::fullTextSearchLocations()
+{
+ return QStringList();
+}
+
+
+void DocCustomPlugin::autoSetupPlugin()
+{
+ return;
+}
+
+void DocCustomPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocCustomPlugin::createTOC(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocCustomPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+ProjectDocumentationPlugin *DocCustomPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == UserManual)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
diff --git a/parts/documentation/plugins/custom/doccustomplugin.desktop b/parts/documentation/plugins/custom/doccustomplugin.desktop
new file mode 100644
index 00000000..09b018e7
--- /dev/null
+++ b/parts/documentation/plugins/custom/doccustomplugin.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=DocCustomPlugin
+Name[da]=Brugerdefineret doc-plugin
+Name[sk]=Doc vlastný modul
+Name[sv]=Egen dokumentationsinsticksmodul
+Name[ta]=ஆவண தனிப்பயன் சொருகுப்பொருள்
+Name[zh_TW]=Doc 自訂外掛程式
+Exec=blubb
+Comment=Documentation plugin for all types of documentation
+Comment[ca]=Connector de documentació per a tot tipus de documentació
+Comment[da]=Dokumentations-plugin for alle typer dokumentation
+Comment[de]=Komponente für alle Arten von Dokumentation
+Comment[el]=Πρόσθετο τεκμηρίωσης για όλους τους τύπους τεκμηρίωσης
+Comment[es]=Complemento de documentación para todos los tipos de documentación
+Comment[et]=Igat tüüpi dokumentatsiooni plugin
+Comment[eu]=Dokumentu mota guztientzako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای همۀ انواع مستندات
+Comment[fr]=Module externe de documentation pour tous les types de documentation
+Comment[gl]=Extensión de documentación para tódolos tipos de documentación
+Comment[hu]=Dokumentációmodul mindenféle dokumentációhoz
+Comment[it]=Plugin di documentazione per tutti i tipi di documentazione
+Comment[ja]=全種類のドキュメンテーションのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk semua jenis dokumentasi
+Comment[nds]=Dokmentatschoon-Moduul för all Oorden vun Dokmentatschoon
+Comment[ne]=सबै प्रकारको मिसिलीकरणका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor alle typen documentatie
+Comment[pl]=Wtyczka dokumentacji dla wszystkich typów dokumentacji
+Comment[pt]='Plugin' para documentação de todos os tipos
+Comment[pt_BR]=Plug-in de documentação para todos os tipos de documentação
+Comment[ru]=Модуль для работы с документацией
+Comment[sk]=Dokumentačný modul pre všetky typy dokumentácie
+Comment[sl]=Dokumentacijski vstavek za vse vrste dokumentacije
+Comment[sr]=Документациони прикључак за све типове документације
+Comment[sr@Latn]=Dokumentacioni priključak za sve tipove dokumentacije
+Comment[sv]=Dokumentationsinsticksmodul för alla typer av dokumentation
+Comment[ta]=எல்லா வகை ஆவணமயமாக்கலுக்கான ஆவணமயமாக்கல் சொருகுப்பொருள்
+Comment[tg]=Модул барои кор кардан бо ҳуҷҷатҳо
+Comment[tr]=Her tür belgelendirme için belgelendirme eklentisi
+Comment[zh_CN]=全部类型文档的文档插件
+Comment[zh_TW]=所有型態的文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=5
+X-KDE-Library=libdoccustomplugin
diff --git a/parts/documentation/plugins/custom/doccustomplugin.h b/parts/documentation/plugins/custom/doccustomplugin.h
new file mode 100644
index 00000000..2888af81
--- /dev/null
+++ b/parts/documentation/plugins/custom/doccustomplugin.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCCUSTOMPLUGIN_H
+#define DOCCUSTOMPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+
+class DocCustomPlugin : public DocumentationPlugin {
+public:
+ DocCustomPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocCustomPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+
+ virtual void createTOC(DocumentationCatalogItem* item);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual QString catalogTitle(const QString& url);
+
+ virtual void autoSetupPlugin();
+
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type);
+};
+
+#endif
diff --git a/parts/documentation/plugins/devhelp/Makefile.am b/parts/documentation/plugins/devhelp/Makefile.am
new file mode 100644
index 00000000..e0682833
--- /dev/null
+++ b/parts/documentation/plugins/devhelp/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = libdocdevhelpplugin.la
+
+noinst_HEADERS = docdevhelpplugin.h
+kde_services_DATA = docdevhelpplugin.desktop
+
+libdocdevhelpplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+libdocdevhelpplugin_la_SOURCES = docdevhelpplugin.cpp
+libdocdevhelpplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la
diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp
new file mode 100644
index 00000000..dca19e51
--- /dev/null
+++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp
@@ -0,0 +1,386 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docdevhelpplugin.h"
+
+#include <unistd.h>
+
+#include <qdom.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qdialog.h>
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include "../../../../config.h"
+
+class DevHelpDocumentationCatalogItem: public DocumentationCatalogItem
+{
+public:
+ DevHelpDocumentationCatalogItem(const QString &devHelpFile, DocumentationPlugin* plugin,
+ KListView *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_devHelpFile(devHelpFile)
+ {
+ }
+ DevHelpDocumentationCatalogItem(const QString &devHelpFile, DocumentationPlugin* plugin,
+ DocumentationItem *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_devHelpFile(devHelpFile)
+ {
+ }
+ QString devHelpFile() const { return m_devHelpFile; }
+
+ virtual QString cacheVersion() const {
+ unsigned int checksum=0;
+ for(int a=0;a<m_devHelpFile.length(); a++) {
+ checksum += (a+1) * (int)m_devHelpFile[a];
+ }
+ QString str;
+ QTextOStream( &str ) << checksum;
+ return str;
+ }
+
+protected:
+
+private:
+ QString m_devHelpFile;
+};
+
+
+static const KDevPluginInfo data("docdevhelpplugin");
+typedef KDevGenericFactory<DocDevHelpPlugin> DocDevHelpPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocdevhelpplugin, DocDevHelpPluginFactory(data) )
+
+DocDevHelpPlugin::DocDevHelpPlugin(QObject* parent, const char* name,
+ const QStringList /*args*/)
+ :DocumentationPlugin(DocDevHelpPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(Index | FullTextSearch | ProjectDocumentation);
+ autoSetup();
+}
+
+DocDevHelpPlugin::~DocDevHelpPlugin()
+{
+}
+
+DocumentationCatalogItem* DocDevHelpPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ return new DevHelpDocumentationCatalogItem(url, this, contents, title);
+}
+
+QPair<KFile::Mode, QString> DocDevHelpPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "*.devhelp");
+}
+
+QString DocDevHelpPlugin::catalogTitle(const QString& url)
+{
+ QFileInfo fi(url);
+ if (!fi.exists())
+ return QString::null;
+
+ QFile f(url);
+ if (!f.open(IO_ReadOnly))
+ return QString::null;
+
+ QDomDocument doc;
+ if (!doc.setContent(&f))
+ return QString::null;
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+
+ return docEl.attribute("title", QString::null);
+}
+
+QString DocDevHelpPlugin::pluginName() const
+{
+ return i18n("Devhelp Documentation Collection");
+}
+
+QStringList DocDevHelpPlugin::fullTextSearchLocations()
+{
+ QStringList locs;
+
+ QMap<QString, QString> entryMap = config->entryMap("Locations");
+
+ for (QMap<QString, QString>::const_iterator it = entryMap.begin();
+ it != entryMap.end(); ++it)
+ {
+ config->setGroup("Search Settings");
+ if (config->readBoolEntry(it.key(), false))
+ {
+ config->setGroup("Locations");
+ QFileInfo fi(config->readPathEntry(it.key()));
+ locs << fi.dirPath(true);
+ }
+ }
+
+ return locs;
+}
+
+bool DocDevHelpPlugin::needRefreshIndex(DocumentationCatalogItem* item)
+{
+ DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item);
+ if (!dhItem)
+ return false;
+
+ QFileInfo fi(dhItem->devHelpFile());
+ config->setGroup("Index");
+ if (fi.lastModified() > config->readDateTimeEntry(dhItem->text(0), new QDateTime()))
+ {
+ kdDebug() << "need rebuild index for " << dhItem->text(0) << endl;
+ config->writeEntry(item->text(0), fi.lastModified());
+ return true;
+ }
+ else
+ return false;
+}
+
+void DocDevHelpPlugin::autoSetupPlugin()
+{
+ QValueStack<QString> scanStack;
+
+ pushToScanStack(scanStack, getenv("DEVHELP_SEARCH_PATH"));
+ pushToScanStack(scanStack, QString(getenv("HOME")) + "/.devhelp/books");
+
+ QString dhexepath = DocDevHelpPluginFactory::instance()->dirs()->findExe("devhelp");
+ if (!dhexepath.isEmpty())
+ {
+ QFileInfo fi(dhexepath);
+ QString path = KURL(fi.dirPath(true)).upURL().path(1);
+ pushToScanStack(scanStack, path + "share/devhelp/books");
+ pushToScanStack(scanStack, path + "share/gtk-doc/html");
+ }
+
+ pushToScanStack(scanStack, "/usr/share/gtk-doc/html");
+ pushToScanStack(scanStack, "/usr/share/devhelp/books/");
+ pushToScanStack(scanStack, "/usr/local/share/devhelp/books");
+ pushToScanStack(scanStack, "/usr/local/share/gtk-doc/html");
+ pushToScanStack(scanStack, "/opt/gnome/share/devhelp/books");
+ pushToScanStack(scanStack, "/opt/gnome/share/gtk-doc/html");
+ pushToScanStack(scanStack, "/opt/gnome2/share/devhelp/books");
+ pushToScanStack(scanStack, "/opt/gnome2/share/gtk-doc/html");
+
+ //fill the list of scan dirs (with subdirectories)
+ QStringList scanList;
+ QDir dir;
+ do
+ {
+ dir.setPath(scanStack.pop());
+ if (!dir.exists())
+ continue;
+ scanList << dir.path();
+
+ const QFileInfoList *dirEntries = dir.entryInfoList();
+ if ( !dirEntries ) continue;
+ QPtrListIterator<QFileInfo> it(*dirEntries);
+ for (; it.current(); ++it)
+ {
+ QString fileName = it.current()->fileName();
+ if (fileName == "." || fileName == "..")
+ continue;
+ QString path = it.current()->absFilePath();
+ if (it.current()->isDir())
+ {
+ scanStack.push(path);
+ }
+ }
+ } while (!scanStack.isEmpty());
+
+ for (QStringList::const_iterator it = scanList.begin(); it != scanList.end(); ++it)
+ {
+ scanDevHelpDir(*it);
+ }
+}
+
+void DocDevHelpPlugin::scanDevHelpDir(const QString &path)
+{
+ QDir d(path);
+ if (! d.exists() || !d.isReadable())
+ return;
+
+ d.setFilter(QDir::Files);
+ //scan for *.devhelp files
+ const QFileInfoList *list = d.entryInfoList();
+ QFileInfoListIterator it( *list );
+ QFileInfo *fi;
+ while ( (fi = it.current()) != 0 )
+ {
+ if (fi->extension() == "devhelp")
+ {
+ config->setGroup("Locations");
+ config->writePathEntry(catalogTitle(fi->absFilePath()), fi->absFilePath());
+ }
+ ++it;
+ }
+}
+
+void DocDevHelpPlugin::pushToScanStack(QValueStack<QString> &stack, const QString &value)
+{
+ if ( (!value.isEmpty()) && (!stack.contains(value)) )
+ {
+ stack << value;
+ kdDebug() << "Devhelp scan stack: +: " << value << endl;
+ }
+}
+
+void DocDevHelpPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item)
+{
+ DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item);
+ if (!dhItem)
+ return;
+
+ QFileInfo fi(dhItem->devHelpFile());
+
+ QFile f(dhItem->devHelpFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl;
+ return;
+ }
+
+ QDomDocument doc;
+ if (!doc.setContent(&f))
+ {
+ kdDebug() << "Not a valid devhelp file: " << dhItem->devHelpFile() << endl;
+ return;
+ }
+ f.close();
+
+ QString baseUrl = KURL(dhItem->devHelpFile()).directory();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement chaptersEl = docEl.namedItem("functions").toElement();
+ QDomElement childEl = chaptersEl.firstChild().toElement();
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == "function")
+ {
+ QString name = childEl.attribute("name");
+ QString url = childEl.attribute("link");
+
+ IndexItemProto *ii = new IndexItemProto(this, item, index, name, item->text(0));
+ ii->addURL(KURL(baseUrl+"/"+url));
+ }
+ childEl = childEl.nextSibling().toElement();
+ }
+}
+
+void DocDevHelpPlugin::createTOC(DocumentationCatalogItem* item)
+{
+ DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item);
+ if (!dhItem)
+ return;
+
+ QFileInfo fi(dhItem->devHelpFile());
+
+ QFile f(dhItem->devHelpFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl;
+ return;
+ }
+
+ QDomDocument doc;
+ if (!doc.setContent(&f))
+ {
+ kdDebug() << "Not a valid devhelp file: " << dhItem->devHelpFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement chaptersEl = docEl.namedItem("chapters").toElement();
+
+ QDomElement childEl = chaptersEl.lastChild().toElement();
+ QString baseUrl = KURL(dhItem->devHelpFile()).directory();
+ addTocSect(dhItem, childEl, baseUrl, true);
+}
+
+void DocDevHelpPlugin::addTocSect(DocumentationItem *parent, QDomElement childEl,
+ QString baseUrl, bool book)
+{
+ while (!childEl.isNull())
+ {
+ if ( (childEl.tagName() == "sub") || (childEl.tagName() == "chapter"))
+ {
+ QString name = childEl.attribute("name");
+ QString url = childEl.attribute("link");
+
+ if (name.isEmpty() && url.contains("ix"))
+ name = "Index";
+
+ DocumentationItem *item = new DocumentationItem(
+ book ? DocumentationItem::Book : DocumentationItem::Document, parent, name);
+ item->setURL(KURL(baseUrl+"/"+url));
+
+ QDomElement grandchildEl = childEl.lastChild().toElement();
+ addTocSect(item, grandchildEl, baseUrl);
+ }
+ childEl = childEl.previousSibling().toElement();
+ }
+}
+
+void DocDevHelpPlugin::setCatalogURL(DocumentationCatalogItem* item)
+{
+ DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item);
+ if (!dhItem)
+ return;
+
+ QFileInfo fi(dhItem->devHelpFile());
+
+ QFile f(dhItem->devHelpFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f))
+ {
+ kdDebug(9002) << "Not a valid Devhelp file: " << dhItem->devHelpFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement titleEl = docEl.namedItem("book").toElement();
+
+ if (item->url().isEmpty())
+ {
+ KURL url(fi.dirPath(true) + "/" + docEl.attribute("link", QString::null));
+ item->setURL(url);
+ }
+}
+
+ProjectDocumentationPlugin *DocDevHelpPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == APIDocs)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
+
+#include "docdevhelpplugin.moc"
diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.desktop b/parts/documentation/plugins/devhelp/docdevhelpplugin.desktop
new file mode 100644
index 00000000..14c3f700
--- /dev/null
+++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=DevHelpPlugin
+Name[da]=DevHelp-plugin
+Name[sk]=DevHelp modul
+Name[sv]=DevHelp-insticksmodul
+Name[ta]=Devஉதவி சொருகு
+Name[zh_TW]=DevHelp 外掛程式
+Comment=Documentation plugin for DevHelp documentation
+Comment[ca]=Connector de documentació per a documentació DevHelp
+Comment[da]=Dokumentations-plugin for DevHelp-dokumentation
+Comment[de]=Komponente für DevHelp-Dokumentation
+Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση DevHelp
+Comment[es]=Complemento de documentación para documentación DevHelp
+Comment[et]=DevHelp dokumentatsiooni plugin
+Comment[eu]=DevHelp dokumentaziorako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای مستندات DevHelp
+Comment[fr]=Module externe de documentation pour la documentation DevHelp
+Comment[gl]=Extensión de documentación para documentación DevHelp
+Comment[hu]=Dokumentációmodul DevHelp-dokumentációhoz
+Comment[it]=Plugin di documentazione per file DevHelp
+Comment[ja]=DevHelp ドキュメンテーションのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk dokumentasi DevHelp
+Comment[nds]=Dokmentatschoon-Moduul för DevHelp-Dokmentatschoon
+Comment[ne]=DevHelp मिसिलीकरणका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin fvoor DevHelp documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie DevHelp
+Comment[pt]='Plugin' para documentação DevHelp
+Comment[pt_BR]=Plug-in de documentação para documento DevHelp
+Comment[ru]=Модуль для просмотра документации DevHelp
+Comment[sk]=Dokumentačný modul pre DevHelp dokumentáciu
+Comment[sl]=Dokumentacijski vstavek za dokumentacijo DevHelp
+Comment[sr]=Документациони прикључак за DevHelp документацију
+Comment[sr@Latn]=Dokumentacioni priključak za DevHelp dokumentaciju
+Comment[sv]=Dokumentationsinsticksmodul för DevHelp-dokumentation
+Comment[ta]= DevHelp ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиш намудани DevHelp-и асоснок карда шуда
+Comment[tr]=DevHelp belgelendirmesi için belgelendirme eklentisi
+Comment[zh_CN]=DevHelp 文档的文档插件
+Comment[zh_TW]=DevHelp 文件外掛程式
+Exec=blubb
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=5
+X-KDE-Library=libdocdevhelpplugin
diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.h b/parts/documentation/plugins/devhelp/docdevhelpplugin.h
new file mode 100644
index 00000000..ab0b0ece
--- /dev/null
+++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCDEVHELPPLUGIN_H
+#define DOCDEVHELPPLUGIN_H
+
+#include <qvaluestack.h>
+#include <qdom.h>
+
+#include <kdevdocumentationplugin.h>
+
+class DocDevHelpPlugin: public DocumentationPlugin
+{
+ Q_OBJECT
+public:
+ DocDevHelpPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocDevHelpPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual QString catalogTitle(const QString& url);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual void createTOC(DocumentationCatalogItem* item);
+
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+ virtual void autoSetupPlugin();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type);
+
+protected:
+ void pushToScanStack(QValueStack<QString> &stack, const QString &value);
+ void scanDevHelpDir(const QString &path);
+ void addTocSect(DocumentationItem *parent, QDomElement childEl, QString baseUrl, bool book=false);
+};
+
+#endif
diff --git a/parts/documentation/plugins/djvu/Makefile.am b/parts/documentation/plugins/djvu/Makefile.am
new file mode 100644
index 00000000..716be5df
--- /dev/null
+++ b/parts/documentation/plugins/djvu/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libdocdjvuplugin.la
+libdocdjvuplugin_la_LDFLAGS = $(all_libraries)
+libdocdjvuplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+noinst_HEADERS = docdjvuplugin.h
+libdocdjvuplugin_la_SOURCES = docdjvuplugin.cpp
+kde_services_DATA = docdjvuplugin.desktop
diff --git a/parts/documentation/plugins/djvu/docdjvuplugin.cpp b/parts/documentation/plugins/djvu/docdjvuplugin.cpp
new file mode 100644
index 00000000..0c53943e
--- /dev/null
+++ b/parts/documentation/plugins/djvu/docdjvuplugin.cpp
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Mathieu Chouinard *
+ * mathieu.chouinard@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docdjvuplugin.h"
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+
+#include <kdevgenericfactory.h>
+
+static const KAboutData data("docdjvuplugin", I18N_NOOP("Djvu documentation plugin"), "1.0");
+typedef KDevGenericFactory<DocDjvuPlugin> DocDjvuPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocdjvuplugin, DocDjvuPluginFactory(&data) )
+
+DocDjvuPlugin::DocDjvuPlugin(QObject* parent, const char* name, const QStringList args)
+ :DocumentationPlugin(DocDjvuPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(CustomDocumentationTitles | ProjectUserManual);
+ autoSetup();
+}
+
+DocDjvuPlugin::~DocDjvuPlugin()
+{
+}
+
+bool DocDjvuPlugin::needRefreshIndex(DocumentationCatalogItem* item)
+{
+ return false;
+}
+
+QString DocDjvuPlugin::pluginName() const
+{
+ return i18n("Djvu Documentation Collection");
+}
+
+DocumentationCatalogItem* DocDjvuPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title);
+ item->setURL(KURL(url));
+ return item;
+}
+
+QPair<KFile::Mode, QString> DocDjvuPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "all/allfiles");
+}
+
+QString DocDjvuPlugin::catalogTitle(const QString& /*url*/)
+{
+ return QString::null;
+}
+
+QStringList DocDjvuPlugin::fullTextSearchLocations()
+{
+ return QStringList();
+}
+
+
+void DocDjvuPlugin::autoSetupPlugin()
+{
+ return;
+}
+
+void DocDjvuPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocDjvuPlugin::createTOC(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocDjvuPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+ProjectDocumentationPlugin *DocDjvuPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == UserManual)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
diff --git a/parts/documentation/plugins/djvu/docdjvuplugin.desktop b/parts/documentation/plugins/djvu/docdjvuplugin.desktop
new file mode 100644
index 00000000..c88aa6a9
--- /dev/null
+++ b/parts/documentation/plugins/djvu/docdjvuplugin.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=DocDjvuPlugin
+Name[da]=DocDjvu-plugin
+Name[ms]=PluginDocDjvu
+Name[sk]=Doc Djvu modul
+Name[sv]=DocDjvu-insticksmodul
+Name[ta]=DocQt சொருகு
+Name[zh_TW]=Djvu 文件外掛程式
+Exec=blubb
+Comment=Documentation plugin for djvu format
+Comment[ca]=Connector de documentació per al format djvu
+Comment[da]=Dokumentations-plugin for djvu-dokumentation
+Comment[de]=Komponente für das DjVu-Dokumentationsformat
+Comment[el]=Πρόσθετο τεκμηρίωσης για τη μορφή djvu
+Comment[es]=Complemento de documentación para el formato djvu
+Comment[et]=Djvu vormingus dokumentatsiooni plugin
+Comment[eu]=Djvu dokumentaziorako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای قالب djvu
+Comment[fr]=Module externe de documentation pour le format djvu
+Comment[gl]=Extensión de documentación para o formato djvu
+Comment[hu]=Dokumentációmodul djvu formátumú dokumentációhoz
+Comment[it]=Plugin documentazione per il formato djvu
+Comment[ja]=djvu フォーマットのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk format djvu
+Comment[nds]=Dokmentatschoon-Moduul för dat djvu-Dokmentatschoonformaat
+Comment[ne]=djvu ढाँचाका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor het djvu-formaat
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie djvu
+Comment[pt]='Plugin' para documentação no formato djvu
+Comment[pt_BR]=Plug-in de documentação para o formato djvu
+Comment[ru]=Модуль для просмотра документации в формате DJVU
+Comment[sk]=Dokumentačný modul pre Djvu dokumentáciu
+Comment[sr]=Документациони прикључак за djvu формат
+Comment[sr@Latn]=Dokumentacioni priključak za djvu format
+Comment[sv]=Dokumentationsinsticksmodul för djvu-format
+Comment[ta]= CHM ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиш намудани ҳуҷҷатҳо дар формати DJVU
+Comment[tr]=djvu biçimi için belgelendirme eklentisi
+Comment[zh_CN]=djvu 格式文档插件
+Comment[zh_TW]=Djvu 格式文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=1
+X-KDE-Library=libdocdjvuplugin
diff --git a/parts/documentation/plugins/djvu/docdjvuplugin.h b/parts/documentation/plugins/djvu/docdjvuplugin.h
new file mode 100644
index 00000000..79bbf0ab
--- /dev/null
+++ b/parts/documentation/plugins/djvu/docdjvuplugin.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Mathieu Chouinard *
+ * mathieu.chouinard@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCDJVUPLUGIN_H
+#define DOCDVJUPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+
+class DocDjvuPlugin : public DocumentationPlugin {
+public:
+ DocDjvuPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocDjvuPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+
+ virtual void createTOC(DocumentationCatalogItem* item);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual QString catalogTitle(const QString& url);
+
+ virtual void autoSetupPlugin();
+
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type);
+};
+
+#endif
diff --git a/parts/documentation/plugins/doxygen/Makefile.am b/parts/documentation/plugins/doxygen/Makefile.am
new file mode 100644
index 00000000..eb6e2648
--- /dev/null
+++ b/parts/documentation/plugins/doxygen/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libdocdoxygenplugin.la
+
+kde_services_DATA = docdoxygenplugin.desktop
+libdocdoxygenplugin_la_SOURCES = docdoxygenplugin.cpp
+noinst_HEADERS = docdoxygenplugin.h
+
+
+libdocdoxygenplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+libdocdoxygenplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la
diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp
new file mode 100644
index 00000000..ddea5219
--- /dev/null
+++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp
@@ -0,0 +1,529 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docdoxygenplugin.h"
+
+#include <unistd.h>
+
+#include <qdom.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qdialog.h>
+#include <qregexp.h>
+#include <qvaluestack.h>
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+
+#include <urlutil.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include "../../../../config.h"
+
+class DoxyDocumentationCatalogItem: public DocumentationCatalogItem
+{
+public:
+ DoxyDocumentationCatalogItem(const QString &origUrl, DocumentationPlugin* plugin,
+ KListView *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_origUrl(origUrl)
+ {
+ }
+ DoxyDocumentationCatalogItem(const QString &origUrl, DocumentationPlugin* plugin,
+ DocumentationItem *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_origUrl(origUrl)
+ {
+ }
+ QString origUrl() const { return m_origUrl; }
+
+private:
+ QString m_origUrl;
+};
+
+
+static const KDevPluginInfo data("docdoxygenplugin");
+typedef KDevGenericFactory<DocDoxygenPlugin> DocDoxygenPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocdoxygenplugin, DocDoxygenPluginFactory(data) )
+
+DocDoxygenPlugin::DocDoxygenPlugin(QObject* parent, const char* name, const QStringList)
+ :DocumentationPlugin(DocDoxygenPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(Index | FullTextSearch | ProjectDocumentation | CustomDocumentationTitles );
+ autoSetup();
+}
+
+DocDoxygenPlugin::~DocDoxygenPlugin()
+{
+}
+
+QPair<KFile::Mode, QString> DocDoxygenPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "index.html *.tag");
+}
+
+QString DocDoxygenPlugin::catalogTitle(const QString& url)
+{
+ QFileInfo fi(url);
+ if (!fi.exists())
+ return QString::null;
+
+ if (fi.extension(false) == "html")
+ {
+ QFile f(url);
+ if (!f.open(IO_ReadOnly))
+ return QString::null;
+
+ QTextStream ts(&f);
+ QString contents = ts.read();
+ QRegExp re(".*<title>(.*)</title>.*");
+ re.setCaseSensitive(false);
+ re.search(contents);
+ return re.cap(1);
+ }
+ else if (fi.extension(false) == "tag")
+ {
+ QFile *f = 0;
+ QFile f1(fi.dirPath(true) + "/html/index.html");
+ if (f1.open(IO_ReadOnly))
+ f = &f1;
+ QFile f2(fi.dirPath(true) + "/index.html");
+ if (f2.open(IO_ReadOnly))
+ f = &f2;
+ if (f != 0)
+ {
+ QTextStream ts(f);
+ QString contents = ts.read();
+ QRegExp re(".*<title>(.*)</title>.*");
+ re.setCaseSensitive(false);
+ re.search(contents);
+ return re.cap(1);
+ }
+ }
+ return QString::null;
+}
+
+QString DocDoxygenPlugin::pluginName() const
+{
+ return i18n("Doxygen Documentation Collection");
+}
+
+QStringList DocDoxygenPlugin::fullTextSearchLocations()
+{
+ QStringList locs;
+
+ QMap<QString, QString> entryMap = config->entryMap("Locations");
+
+ for (QMap<QString, QString>::const_iterator it = entryMap.begin();
+ it != entryMap.end(); ++it)
+ {
+ config->setGroup("Search Settings");
+ if (config->readBoolEntry(it.key(), false))
+ {
+ config->setGroup("Locations");
+ QFileInfo fi(config->readPathEntry(it.key()));
+ locs << fi.dirPath(true);
+ }
+ }
+
+ return locs;
+}
+
+void DocDoxygenPlugin::setCatalogURL(DocumentationCatalogItem* item)
+{
+ if (item->url().url().endsWith("tag"))
+ {
+ QFileInfo fi(item->url().directory(false) + "html/index.html");
+ if (fi.exists())
+ {
+ item->setURL(KURL::fromPathOrURL(fi.absFilePath()));
+ return;
+ }
+ QFileInfo fi2(item->url().directory(false) + "index.html");
+ if (fi2.exists())
+ {
+ item->setURL(KURL::fromPathOrURL(fi2.absFilePath()));
+ return;
+ }
+ item->setURL(KURL());
+ }
+}
+
+bool DocDoxygenPlugin::needRefreshIndex(DocumentationCatalogItem* item)
+{
+ DoxyDocumentationCatalogItem *doxyItem = dynamic_cast<DoxyDocumentationCatalogItem*>(item);
+ if (!doxyItem)
+ return false;
+
+ QFileInfo fi(doxyItem->origUrl());
+ config->setGroup("Index");
+ if (fi.lastModified() > config->readDateTimeEntry(item->text(0), new QDateTime()))
+ {
+ kdDebug() << "need rebuild index for " << item->text(0) << endl;
+ config->writeEntry(item->text(0), fi.lastModified());
+ return true;
+ }
+ else
+ return false;
+}
+
+void DocDoxygenPlugin::autoSetupPlugin()
+{
+ autoSetupDocs(KDELIBS_DOXYDIR, "en/kdelibs-apidocs", "The KDE API Reference (The KDE API Reference)");
+ autoSetupDocs("", "en/kdevelop-apidocs", "The KDevelop Platform API Documentation (KDevelop)");
+
+}
+
+void DocDoxygenPlugin::autoSetupDocs(const QString &defaultDir, const QString &searchDir,
+ const QString &name)
+{
+ QString doxyDocDir(defaultDir);
+ doxyDocDir = URLUtil::envExpand(doxyDocDir);
+ if (doxyDocDir.isEmpty())
+ {
+ QStringList apiDirs = DocDoxygenPluginFactory::instance()->dirs()->findDirs("html", searchDir);
+ for (QStringList::const_iterator it = apiDirs.begin(); it != apiDirs.end(); ++it )
+ {
+ doxyDocDir = *it;
+ QString indexFile = doxyDocDir + "index.html";
+ if (QFile::exists(indexFile))
+ {
+ doxyDocDir = doxyDocDir + "/" + searchDir;
+ break;
+ }
+ doxyDocDir = "";
+ }
+ }
+ if (!doxyDocDir.isEmpty())
+ {
+ config->setGroup("Search Settings");
+ config->writeEntry(name, true);
+ config->setGroup("Index Settings");
+ config->writeEntry(name, true);
+ config->setGroup("Locations");
+ config->writePathEntry(name, doxyDocDir + QString("/index.html"));
+ }
+}
+
+void DocDoxygenPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item)
+{
+ QFileInfo fi(item->url().path());
+ if (!fi.exists())
+ return;
+
+ DoxyDocumentationCatalogItem *doxyItem = dynamic_cast<DoxyDocumentationCatalogItem*>(item);
+ if (!doxyItem)
+ return;
+
+ //doxygen documentation mode (if catalog points to a .tag)
+ if (doxyItem->origUrl().endsWith("tag"))
+ {
+ QString htmlUrl;
+ QFileInfo fi2(item->url().directory(false) + "index.html");
+ if (fi2.exists())
+ htmlUrl = fi2.dirPath(true) + "/";
+ QFileInfo fi(item->url().directory(false) + "html/index.html");
+ if (fi.exists())
+ htmlUrl = fi.dirPath(true) + "/";
+
+ createBookIndex(doxyItem->origUrl(), index, item, htmlUrl);
+ }
+
+ //KDE doxygen documentation mode (if catalog points to a index.html)
+ QDir d;
+ QValueStack<QString> dirStack;
+ dirStack.push(fi.dirPath(true));
+ do {
+ d.setPath(dirStack.pop());
+ if (!d.exists())
+ continue;
+
+ const QFileInfoList *dirEntries = d.entryInfoList();
+ if (!dirEntries) continue;
+ QPtrListIterator<QFileInfo> it(*dirEntries);
+ for (; it.current(); ++it)
+ {
+ QString fileName = it.current()->fileName();
+ if (fileName == "." || fileName == ".." || fileName == "common" || fileName == "html")
+ continue;
+ if (it.current()->isDir())
+ dirStack.push(it.current()->absFilePath());
+ }
+
+ if (QFile::exists(d.absPath() + "/html/index.html"))
+ createBookIndex(d.absPath() + "/" + d.dirName() + ".tag", index, item);
+ } while (!dirStack.isEmpty());
+}
+
+void DocDoxygenPlugin::createTOC(DocumentationCatalogItem* item)
+{
+ QFileInfo fi(item->url().path());
+ if (!fi.exists())
+ return;
+
+ DoxyDocumentationCatalogItem *doxyItem = dynamic_cast<DoxyDocumentationCatalogItem*>(item);
+ if (!doxyItem)
+ return;
+
+ //doxygen documentation mode (if catalog points to a .tag)
+ if (doxyItem->origUrl().endsWith("tag"))
+ {
+ QString htmlUrl;
+ QFileInfo fi2(item->url().directory(false) + "index.html");
+ if (fi2.exists())
+ htmlUrl = fi2.dirPath(true) + "/";
+ QFileInfo fi(item->url().directory(false) + "html/index.html");
+ if (fi.exists())
+ htmlUrl = fi.dirPath(true) + "/";
+ if (!htmlUrl.isEmpty())
+ createBookTOC(item, doxyItem->origUrl(), htmlUrl);
+ }
+
+ //KDE doxygen documentation mode (if catalog points to a index.html)
+ QDir d;
+ QValueStack<QString> dirStack;
+ dirStack.push(fi.dirPath(true));
+ do {
+ d.setPath(dirStack.pop());
+ if (!d.exists())
+ continue;
+
+ const QFileInfoList *dirEntries = d.entryInfoList();
+ if (!dirEntries) continue;
+ QPtrListIterator<QFileInfo> it(*dirEntries);
+ for (; it.current(); ++it)
+ {
+ QString fileName = it.current()->fileName();
+ if (fileName == "." || fileName == ".." || fileName == "common" || fileName == "html")
+ continue;
+ if (it.current()->isDir())
+ dirStack.push(it.current()->absFilePath());
+ }
+
+ if (QFile::exists(d.absPath() + "/html/index.html"))
+ {
+ DocumentationItem *docItem = new DocumentationItem(DocumentationItem::Book, item, d.dirName());
+ docItem->setURL(KURL(d.absPath() + "/html/index.html"));
+ docItem->setExpandable(true);
+ createBookTOC(docItem);
+ }
+ } while (!dirStack.isEmpty());
+}
+
+DocumentationCatalogItem *DocDoxygenPlugin::createCatalog(KListView *contents, const QString &title, const QString &url)
+{
+ kdDebug() << "DocDoxygenPlugin::createCatalog: url=" << url << endl;
+ DocumentationCatalogItem *item = new DoxyDocumentationCatalogItem(url, this, contents, title);
+ item->setURL(url);
+ return item;
+}
+
+void DocDoxygenPlugin::createBookTOC(DocumentationItem *item, const QString &tagUrl, const QString &baseHtmlUrl)
+{
+ QString tagName;
+ if (tagUrl.isEmpty())
+ tagName = item->url().upURL().directory(false) + item->text(0) + ".tag";
+ else
+ tagName = tagUrl;
+
+ QString baseUrl;
+ if (baseHtmlUrl.isEmpty())
+ baseUrl = item->url().directory(false);
+ else
+ baseUrl = baseHtmlUrl;
+
+ //@todo list html files in the directory if tag was not found
+ if (!QFile::exists(tagName))
+ return;
+
+ QStringList tagFileList;
+ if (tagName.endsWith(".tag"))
+ tagFileList = tagFiles(QFileInfo(tagName).dirPath() + "/");
+ else
+ tagFileList += tagName;
+
+ QStringList::ConstIterator end = tagFileList.constEnd();
+ for (QStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it)
+ {
+ QFile f(*it);
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not open tag file: " << f.name() << endl;
+ return;
+ }
+
+ QDomDocument dom;
+ if (!dom.setContent(&f) || dom.documentElement().nodeName() != "tagfile")
+ {
+ kdDebug(9002) << "No valid tag file" << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = dom.documentElement();
+
+ QDomElement childEl = docEl.lastChild().toElement();
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == "compound" && childEl.attribute("kind") == "class")
+ {
+ QString classname = childEl.namedItem("name").firstChild().toText().data();
+ QString filename = childEl.namedItem("filename").firstChild().toText().data();
+
+ if (QFile::exists(baseUrl + filename))
+ {
+ DocumentationItem *docItem = new DocumentationItem(DocumentationItem::Document,
+ item, classname);
+ docItem->setURL(KURL(baseUrl + filename));
+ }
+ }
+ childEl = childEl.previousSibling().toElement();
+ }
+ }
+}
+
+void DocDoxygenPlugin::createBookIndex(const QString &tagfile, IndexBox* index, DocumentationCatalogItem* item, const QString &baseHtmlUrl)
+{
+ QString tagName = tagfile;
+ kdDebug() << tagfile << endl;
+ if (!QFile::exists(tagName))
+ return;
+ QString prefix = baseHtmlUrl.isEmpty() ? KURL(tagfile).directory(false) + "html/" : baseHtmlUrl;
+
+ QStringList tagFileList = tagFiles(QFileInfo(tagName).dirPath() + "/");
+
+ QStringList::ConstIterator end = tagFileList.constEnd();
+ for (QStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it)
+ {
+ QFile f(*it);
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not open tag file: " << f.name() << endl;
+ return;
+ }
+
+ QDomDocument dom;
+ if (!dom.setContent(&f) || dom.documentElement().nodeName() != "tagfile")
+ {
+ kdDebug(9002) << "No valid tag file" << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = dom.documentElement();
+ createIndexFromTag(dom, index, item, docEl, prefix);
+ }
+}
+
+void DocDoxygenPlugin::createIndexFromTag(QDomDocument &dom, IndexBox *index,
+ DocumentationCatalogItem *item, QDomElement &parentEl, const QString &prefix)
+{
+ QDomElement docEl = parentEl;
+
+ QDomElement childEl = docEl.firstChild().toElement();
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == "compound" &&
+ ((childEl.attribute("kind") == "class")
+ || (childEl.attribute("kind") == "struct")
+ || (childEl.attribute("kind") == "namespace") ))
+ {
+ QString classname = childEl.namedItem("name").firstChild().toText().data();
+ QString filename = childEl.namedItem("filename").firstChild().toText().data();
+
+ IndexItemProto *indexItem = new IndexItemProto(this, item, index, classname,
+ i18n("%1 Class Reference").arg(classname));
+ indexItem->addURL(KURL(prefix + filename));
+
+ createIndexFromTag(dom, index, item, childEl, prefix + filename);
+ }
+ else if ((childEl.tagName() == "member") &&
+ ((childEl.attribute("kind") == "function")
+ || (childEl.attribute("kind") == "slot")
+ || (childEl.attribute("kind") == "signal") ))
+ {
+ QString classname = parentEl.namedItem("name").firstChild().toText().data();
+ QString membername = childEl.namedItem("name").firstChild().toText().data();
+ QString anchor = childEl.namedItem("anchor").firstChild().toText().data();
+ QString arglist = childEl.namedItem("arglist").firstChild().toText().data();
+
+ if (classname != membername)
+ {
+ IndexItemProto *indexItem = new IndexItemProto(this, item, index, membername,i18n("%1::%2%3 Member Reference").arg(classname).arg(membername).arg(arglist));
+ indexItem->addURL(KURL(prefix + "#" + anchor));
+ }
+ }
+ childEl = childEl.nextSibling().toElement();
+ }
+}
+
+ProjectDocumentationPlugin *DocDoxygenPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == APIDocs)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
+
+QStringList DocDoxygenPlugin::tagFiles(const QString& path, int level)
+{
+ QStringList r;
+ QDir dir(path);
+ if (level > 10) return r;
+ if (!dir.isReadable()) return r;
+ if (!dir.exists()) return r;
+
+ QStringList dirList;
+ QStringList fileList;
+ QStringList::Iterator it;
+
+ dir.setFilter ( QDir::Dirs);
+ dirList = dir.entryList();
+
+ dirList.remove(".");
+ dirList.remove("..");
+
+ dir.setFilter(QDir::Files | QDir::Hidden | QDir::System);
+ fileList = dir.entryList();
+ QStringList::Iterator end = dirList.end();
+ for ( it = dirList.begin(); it != end; ++it )
+ {
+ QString name = *it;
+ if (QFileInfo( dir, *it ).isSymLink())
+ continue;
+ r += tagFiles(path + name + "/", level + 1 );
+ }
+
+ QStringList::Iterator fend = fileList.end();
+ for ( it = fileList.begin(); it != fend; ++it )
+ {
+ QString name = *it;
+ QFileInfo fi( dir, *it );
+ if (fi.isSymLink() || !fi.isFile())
+ continue;
+
+ if (QDir::match(QString("*.tag"), name))
+ r += (path+name);
+ }
+
+ return r;
+}
+
+#include "docdoxygenplugin.moc"
diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.desktop b/parts/documentation/plugins/doxygen/docdoxygenplugin.desktop
new file mode 100644
index 00000000..57bb4262
--- /dev/null
+++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.desktop
@@ -0,0 +1,45 @@
+[Desktop Entry]
+Type=Service
+Name=DocDoxygenPlugin
+Name[da]=DocDoxygen-plugin
+Name[ms]=PluginDocDoxygen
+Name[sk]=Doc Doxygen modul
+Name[sv]=Doxygen-dokumentationsinsticksmodul
+Name[ta]=DocDoxygen சொருகு
+Name[zh_TW]=Doxygen 文件外掛程式
+Exec=blubb
+Comment=Documentation plugin for Doxygen documentation
+Comment[ca]=Connector de documentació per a documentació Doxygen
+Comment[da]=Dokumentations-plugin for Doxygen-dokumentation
+Comment[de]=Komponente für Doxygen-Dokumentation
+Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση τύπου Doxygen
+Comment[es]=Complemento de documentación para Doxygen
+Comment[et]=Doxygeni dokumentatsiooni plugin
+Comment[eu]=Doxygen dokumentaziorako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای مستندات Doxygen
+Comment[fr]=Module externe de documentation pour la documentation Doxygen
+Comment[gl]=Extensión de documentación para documentación Doxygen
+Comment[hu]=Dokumentációmodul Doxygen-dokumentációhoz
+Comment[it]=Plugin di documentazione per file di Doxygen
+Comment[ja]=Doxygen ドキュメンテーションのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk dokumentasi Doxygen
+Comment[nds]=Dokmentatschoon-Moduul för Doxygen-Dokmentatschoon
+Comment[ne]=Doxygen मिसिलीकरणका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor Doxygen documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie Doxygen
+Comment[pt]='Plugin' para documentação Doxygen
+Comment[pt_BR]=Plug-in de documentação para documento Doxygen
+Comment[ru]=Модуль для просмотра документации Doxygen
+Comment[sk]=Dokumentačný modul pre Doxygen dokumentáciu
+Comment[sl]=Dokumentacijski vstavek za dokumentacijo Doxygen
+Comment[sr]=Документациони прикључак за Doxygen документацију
+Comment[sr@Latn]=Dokumentacioni priključak za Doxygen dokumentaciju
+Comment[sv]=Dokumentationsinsticksmodul för Doxygen-dokumentation
+Comment[ta]= Doxygen ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиш намудани ҳуҷҷатҳо дар Doxygen
+Comment[tr]=Doxygen belgelendirmesi için belgelendirme eklentisi
+Comment[zh_CN]=Doxygen 文档的文档插件
+Comment[zh_TW]=Doxygen 文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=5
+X-KDE-Library=libdocdoxygenplugin
diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.h b/parts/documentation/plugins/doxygen/docdoxygenplugin.h
new file mode 100644
index 00000000..fbd7e56f
--- /dev/null
+++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCDOXYGENPLUGIN_H
+#define DOCDOXYGENPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+
+class QDomDocument;
+class QDomElement;
+
+class DocDoxygenPlugin: public DocumentationPlugin
+{
+ Q_OBJECT
+public:
+ DocDoxygenPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocDoxygenPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual DocumentationCatalogItem *createCatalog(KListView *contents, const QString &title, const QString &url);
+
+ virtual void createTOC(DocumentationCatalogItem* item);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual QString catalogTitle(const QString& url);
+
+ virtual void autoSetupPlugin();
+
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type);
+
+protected:
+ void createBookTOC(DocumentationItem* item, const QString &tagUrl = QString::null,
+ const QString &baseHtmlUrl = QString::null);
+ void createBookIndex(const QString &tagfile, IndexBox* index, DocumentationCatalogItem* item, const QString &baseHtmlUrl = QString::null);
+
+ void createIndexFromTag(QDomDocument &dom, IndexBox* index, DocumentationCatalogItem* item,
+ QDomElement &parentEl, const QString &prefix);
+
+ void autoSetupDocs(const QString &defaultDir, const QString &searchDir,
+ const QString &name);
+
+ /**
+ * Returns all the tag files from a directory and its subdirectories.
+ * @param startDir the directory to start with
+ * @param level the depth of the current search
+ * @return a list with the absolute path to the ".tag" files in startDir
+ */
+ QStringList tagFiles(const QString &startDir, int level = 0);
+};
+
+
+#endif
diff --git a/parts/documentation/plugins/kdevtoc/Makefile.am b/parts/documentation/plugins/kdevtoc/Makefile.am
new file mode 100644
index 00000000..a40dd995
--- /dev/null
+++ b/parts/documentation/plugins/kdevtoc/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libdockdevtocplugin.la
+libdockdevtocplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+kde_services_DATA = dockdevtocplugin.desktop
+noinst_HEADERS = dockdevtocplugin.h
+libdockdevtocplugin_la_SOURCES = dockdevtocplugin.cpp
+libdockdevtocplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la
diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp
new file mode 100644
index 00000000..65ebf35f
--- /dev/null
+++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp
@@ -0,0 +1,277 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "dockdevtocplugin.h"
+
+#include <unistd.h>
+
+#include <qdom.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qdialog.h>
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+#include <kstandarddirs.h>
+
+#include <urlutil.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include "../../../../config.h"
+
+class TOCDocumentationCatalogItem: public DocumentationCatalogItem
+{
+public:
+ TOCDocumentationCatalogItem(const QString &tocFile, DocumentationPlugin* plugin,
+ KListView *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_tocFile(tocFile)
+ {
+ }
+ TOCDocumentationCatalogItem(const QString &tocFile, DocumentationPlugin* plugin,
+ DocumentationItem *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_tocFile(tocFile)
+ {
+ }
+ QString tocFile() const { return m_tocFile; }
+
+private:
+ QString m_tocFile;
+};
+
+
+static const KDevPluginInfo data("dockdevtocplugin");
+typedef KDevGenericFactory<DocKDevTOCPlugin> DocKDevTOCPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdockdevtocplugin, DocKDevTOCPluginFactory(data) )
+
+DocKDevTOCPlugin::DocKDevTOCPlugin(QObject* parent, const char* name,
+ const QStringList /*args*/)
+ :DocumentationPlugin(DocKDevTOCPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(Index);
+ autoSetup();
+}
+
+DocKDevTOCPlugin::~DocKDevTOCPlugin()
+{
+}
+
+QString DocKDevTOCPlugin::pluginName() const
+{
+ return i18n("KDevelopTOC Documentation Collection");
+}
+
+DocumentationCatalogItem* DocKDevTOCPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ return new TOCDocumentationCatalogItem(url, this, contents, title);
+}
+
+QPair<KFile::Mode, QString> DocKDevTOCPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "*.toc");
+}
+
+QString DocKDevTOCPlugin::catalogTitle(const QString& url)
+{
+ QFileInfo fi(url);
+ if (!fi.exists())
+ return QString::null;
+
+ QFile f(url);
+ if (!f.open(IO_ReadOnly))
+ return QString::null;
+
+ QDomDocument doc;
+ if (!doc.setContent(&f) || (doc.doctype().name() != "kdeveloptoc"))
+ return QString::null;
+ f.close();
+
+ QDomElement titleEl = doc.documentElement().namedItem("title").toElement();
+
+ return titleEl.firstChild().toText().data();
+}
+
+
+QStringList DocKDevTOCPlugin::fullTextSearchLocations()
+{
+ return QStringList();
+}
+
+bool DocKDevTOCPlugin::needRefreshIndex(DocumentationCatalogItem* /*item*/)
+{
+ return false;
+}
+
+void DocKDevTOCPlugin::autoSetupPlugin()
+{
+ QStringList tocsDir = DocKDevTOCPluginFactory::instance()->dirs()->findAllResources("data", "kdevdocumentation/tocs/*.toc");
+
+ for (QStringList::const_iterator it = tocsDir.begin(); it != tocsDir.end(); ++it)
+ {
+ config->setGroup("Locations");
+ config->writePathEntry(catalogTitle(*it), *it);
+ }
+}
+
+void DocKDevTOCPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item)
+{
+ TOCDocumentationCatalogItem *tocItem = dynamic_cast<TOCDocumentationCatalogItem *>(item);
+ if (!tocItem)
+ return;
+
+ QFileInfo fi(tocItem->tocFile());
+
+ QFile f(tocItem->tocFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << tocItem->tocFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f) || doc.doctype().name() != "kdeveloptoc")
+ {
+ kdDebug(9002) << "Not a valid kdeveloptoc file: " << tocItem->tocFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement baseEl = docEl.namedItem("base").toElement();
+
+ QString base;
+ if (!baseEl.isNull())
+ base = baseEl.attribute("href", QString::null);
+
+ QDomElement indexEl = docEl.namedItem("index").toElement();
+ QDomElement childEl = indexEl.firstChild().toElement();
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == "entry")
+ {
+ QString name = childEl.attribute("name");
+ QString url = childEl.attribute("url");
+
+ IndexItemProto *ii = new IndexItemProto(this, item, index, name, item->text(0));
+ ii->addURL(KURL(constructURL(base, url)));
+ }
+ childEl = childEl.nextSibling().toElement();
+ }
+}
+
+void DocKDevTOCPlugin::createTOC(DocumentationCatalogItem* item)
+{
+ TOCDocumentationCatalogItem *tocItem = dynamic_cast<TOCDocumentationCatalogItem *>(item);
+ if (!tocItem)
+ return;
+
+ QFileInfo fi(tocItem->tocFile());
+
+ QFile f(tocItem->tocFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << tocItem->tocFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f) || doc.doctype().name() != "kdeveloptoc")
+ {
+ kdDebug(9002) << "Not a valid kdeveloptoc file: " << tocItem->tocFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement baseEl = docEl.namedItem("base").toElement();
+
+ QString base;
+ if (!baseEl.isNull())
+ base = baseEl.attribute("href", QString::null);
+
+ QDomElement childEl = docEl.lastChild().toElement();
+ addTocSect(tocItem, childEl, base, 1);
+}
+
+void DocKDevTOCPlugin::addTocSect(DocumentationItem *parent, QDomElement childEl, const QString &base, uint level)
+{
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == QString("tocsect%1").arg(level))
+ {
+ QString name = childEl.attribute("name");
+ QString url = childEl.attribute("url");
+
+ DocumentationItem *item = new DocumentationItem(level == 1 ? DocumentationItem::Book : DocumentationItem::Document, parent, name);
+ item->setURL(KURL(constructURL(base, url)));
+
+ QDomElement grandchildEl = childEl.lastChild().toElement();
+ addTocSect(item, grandchildEl, base, level+1);
+ }
+ childEl = childEl.previousSibling().toElement();
+ }
+}
+
+void DocKDevTOCPlugin::setCatalogURL(DocumentationCatalogItem* item)
+{
+ TOCDocumentationCatalogItem *tocItem = dynamic_cast<TOCDocumentationCatalogItem *>(item);
+ if (!tocItem)
+ return;
+
+ QFileInfo fi(tocItem->tocFile());
+
+ QFile f(tocItem->tocFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << tocItem->tocFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f) || doc.doctype().name() != "kdeveloptoc")
+ {
+ kdDebug(9002) << "Not a valid kdeveloptoc file: " << tocItem->tocFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement baseEl = docEl.namedItem("base").toElement();
+
+ if (item->url().isEmpty())
+ {
+ if (baseEl.isNull())
+ item->setURL(KURL());
+ else
+ item->setURL(KURL(constructURL(baseEl.attribute("href", QString::null),
+ baseEl.attribute("url", QString::null))));
+ }
+}
+
+QString DocKDevTOCPlugin::constructURL(const QString &base, const QString &url)
+{
+ if (base.isEmpty() && !url.isEmpty())
+ return url;
+ if (!url.isEmpty())
+ return base.endsWith("/") ? base + url : base + "/" + url;
+ else
+ return base;
+}
+
+#include "dockdevtocplugin.moc"
diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop
new file mode 100644
index 00000000..d665e9af
--- /dev/null
+++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop
@@ -0,0 +1,43 @@
+[Desktop Entry]
+Type=Service
+Name=DocKDevTOCPlugin
+Name[da]=DocKDevTOC-plugin
+Name[sk]=Doc KDevTOC modul
+Name[sv]=KDevelop innehållsförteckning-dokumentationsinsticksmodul
+Name[ta]=DocKDevTOC சொருகு
+Name[zh_TW]=KDevelop 目錄文件外掛程式
+Exec=blubb
+Comment=Documentation plugin for KDevelopTOC documentation
+Comment[ca]=Connector de documentació per a documentació KDevelopTOC
+Comment[da]=Dokumentations-plugin for KDevelopTOC-dokumentation
+Comment[de]=Komponente für KDevelopTOC-Dokumentation
+Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση τύπου KDevelopTOC
+Comment[es]=Complemento de documentación para KDevelopTOC
+Comment[et]=KDevelopTOC dokumentatsiooni plugin
+Comment[eu]=KDevelopTOC dokumentaziorako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای مستندات KDevelopTOC
+Comment[fr]=Module externe de documentation pour la documentation KDevelopTOC
+Comment[gl]=Extensión de documentación para documentación KDevelopTOC
+Comment[hu]=Dokumentációmodul KDevelopTOC-dokumentációhoz
+Comment[it]=Plugin di documentazione per file di KDevelopTOC
+Comment[ja]=KDevelopTOC ドキュメンテーションのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk dokumentasi KDevelopTOC
+Comment[nds]=Dokmentatschoon-Moduul för KDevelopTOC-Dokmentatschoon
+Comment[ne]=KDevelopTOC मिसिलीकरणका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin for KDevelopTOC documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie KDevelopTOC
+Comment[pt]='Plugin' para documentação KDevelopTOC
+Comment[pt_BR]=Plug-in de documentação para document TOC do KDevelop
+Comment[ru]=Модуль для просмотра KDevelopTOC
+Comment[sk]=Dokumentačný modul pre KDevelopTOC dokumentáciu
+Comment[sr]=Документациони прикључак за KDevelopTOC документацију
+Comment[sr@Latn]=Dokumentacioni priključak za KDevelopTOC dokumentaciju
+Comment[sv]=Dokumentationsinsticksmodul för KDevelop innehållsförteckningsdokumentation
+Comment[ta]= KDevelopTOC ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиши KDevelopTOC
+Comment[tr]=KDevelopTOC belgelendirmesi için belgelendirme eklentisi
+Comment[zh_CN]=KDevelopTOC 文档的文档插件
+Comment[zh_TW]=KDevelop 目錄文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=5
+X-KDE-Library=libdockdevtocplugin
diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.h b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.h
new file mode 100644
index 00000000..4a958473
--- /dev/null
+++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCKDEVTOCPLUGIN_H
+#define DOCKDEVTOCPLUGIN_H
+
+#include <qdom.h>
+
+#include <kdevdocumentationplugin.h>
+
+class DocKDevTOCPlugin : public DocumentationPlugin
+{
+ Q_OBJECT
+public:
+ DocKDevTOCPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocKDevTOCPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual QString catalogTitle(const QString& url);
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+ virtual void createTOC(DocumentationCatalogItem* item);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString > catalogLocatorProps();
+ virtual void autoSetupPlugin();
+
+protected:
+ void addTocSect(DocumentationItem *parent, QDomElement childEl, const QString &base, uint level);
+ static QString constructURL(const QString &base, const QString &url) ;
+};
+
+#endif
diff --git a/parts/documentation/plugins/pdb/Makefile.am b/parts/documentation/plugins/pdb/Makefile.am
new file mode 100644
index 00000000..4d015e3c
--- /dev/null
+++ b/parts/documentation/plugins/pdb/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libdocpdbplugin.la
+libdocpdbplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+libdocpdbplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+noinst_HEADERS = docpdbplugin.h
+libdocpdbplugin_la_SOURCES = docpdbplugin.cpp
+kde_services_DATA = docpdbplugin.desktop
diff --git a/parts/documentation/plugins/pdb/docpdbplugin.cpp b/parts/documentation/plugins/pdb/docpdbplugin.cpp
new file mode 100644
index 00000000..5c2f68c7
--- /dev/null
+++ b/parts/documentation/plugins/pdb/docpdbplugin.cpp
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Mathieu Chouinard *
+ * mathieu.chouinard@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docpdbplugin.h"
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+
+#include <kdevgenericfactory.h>
+
+static const KAboutData data("docpdbplugin", I18N_NOOP("PalmDoc documentation plugin"), "1.0");
+typedef KDevGenericFactory<DocPDBPlugin> DocPDBPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocpdbplugin, DocPDBPluginFactory(&data) )
+
+DocPDBPlugin::DocPDBPlugin(QObject* parent, const char* name, const QStringList args)
+ :DocumentationPlugin(DocPDBPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(CustomDocumentationTitles | ProjectUserManual);
+ autoSetup();
+}
+
+DocPDBPlugin::~DocPDBPlugin()
+{
+}
+
+bool DocPDBPlugin::needRefreshIndex(DocumentationCatalogItem* item)
+{
+ return false;
+}
+
+QString DocPDBPlugin::pluginName() const
+{
+ return i18n("PalmDoc Documentation Collection");
+}
+
+DocumentationCatalogItem* DocPDBPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title);
+ item->setURL(KURL(url));
+ return item;
+}
+
+QPair<KFile::Mode, QString> DocPDBPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "all/allfiles");
+}
+
+QString DocPDBPlugin::catalogTitle(const QString& /*url*/)
+{
+ return QString::null;
+}
+
+QStringList DocPDBPlugin::fullTextSearchLocations()
+{
+ return QStringList();
+}
+
+
+void DocPDBPlugin::autoSetupPlugin()
+{
+ return;
+}
+
+void DocPDBPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocPDBPlugin::createTOC(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocPDBPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+ProjectDocumentationPlugin *DocPDBPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == UserManual)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
diff --git a/parts/documentation/plugins/pdb/docpdbplugin.desktop b/parts/documentation/plugins/pdb/docpdbplugin.desktop
new file mode 100644
index 00000000..76630793
--- /dev/null
+++ b/parts/documentation/plugins/pdb/docpdbplugin.desktop
@@ -0,0 +1,43 @@
+[Desktop Entry]
+Type=Service
+Name=DocPDBPlugin
+Name[da]=DocPDB-plugin
+Name[sk]=Doc PDB modul
+Name[sv]=DocPDB-insticksmodul
+Name[ta]=DocQt சொருகு
+Name[zh_TW]=PDB 文件外掛程式
+Exec=blubb
+Comment=Documentation plugin for Palmdoc format
+Comment[ca]=Connector de documentació per al format Palmdoc
+Comment[da]=Dokumentations-plugin for Palmdoc-format
+Comment[de]=Komponente für das Palmdoc-Dokumentationsformat
+Comment[el]=Πρόσθετο τεκμηρίωσης για τη μορφή Palmdoc
+Comment[es]=Complemento de documentación para el formato Palmdoc
+Comment[et]=PalmDOC-vormingus dokumentatsiooni plugin
+Comment[eu]=Palmdoc formaturako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای قالب Palmdoc
+Comment[fr]=Module externe de documentation pour le format Palmdoc
+Comment[gl]=Extensión de documentación para o formato Palmdoc
+Comment[hu]=Dokumentációmodul Palmdoc formátumú dokumentációhoz
+Comment[it]=Plugin di documentazione per il formato Palmdoc
+Comment[ja]=Palmdoc フォーマットのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk format Palmdoc
+Comment[nds]=Komponente för dat Palmdoc-Dokmentatschoonformaat
+Comment[ne]=Palmdoc ढाँचाका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor Palmdoc documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie Palmdoc
+Comment[pt]='Plugin' para documentação no formato Palmdoc
+Comment[pt_BR]=Plug-in de documentação para o formato Palmdoc
+Comment[ru]=Модуль для просмотра документации в формате Palmdoc
+Comment[sk]=Dokumentačný modul pre Palmdoc formát
+Comment[sr]=Документациони прикључак за Palmdoc формат
+Comment[sr@Latn]=Dokumentacioni priključak za Palmdoc format
+Comment[sv]=Dokumentationsinsticksmodul för Palmdoc-format
+Comment[ta]= CHM ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиш намудани ҳуҷҷатҳо дар формати Palmdoc
+Comment[tr]=Palmdoc biçimi için belgelendirme eklentisi
+Comment[zh_CN]=Palmdoc 格式的文档插件
+Comment[zh_TW]=Palmdoc 格式文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=1
+X-KDE-Library=libdocpdbplugin
diff --git a/parts/documentation/plugins/pdb/docpdbplugin.h b/parts/documentation/plugins/pdb/docpdbplugin.h
new file mode 100644
index 00000000..cdb9e90f
--- /dev/null
+++ b/parts/documentation/plugins/pdb/docpdbplugin.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Mathieu Chouinard *
+ * mathieu.chouinard@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCPDBPLUGIN_H
+#define DOCPDBPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+
+class DocPDBPlugin : public DocumentationPlugin {
+public:
+ DocPDBPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocPDBPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+
+ virtual void createTOC(DocumentationCatalogItem* item);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual QString catalogTitle(const QString& url);
+
+ virtual void autoSetupPlugin();
+
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type);
+};
+
+#endif
diff --git a/parts/documentation/plugins/pdf/Makefile.am b/parts/documentation/plugins/pdf/Makefile.am
new file mode 100644
index 00000000..8d9617d2
--- /dev/null
+++ b/parts/documentation/plugins/pdf/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+METASOURCES = AUTO
+kde_module_LTLIBRARIES = libdocpdfplugin.la
+libdocpdfplugin_la_LDFLAGS = $(all_libraries)
+libdocpdfplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+noinst_HEADERS = docpdfplugin.h
+libdocpdfplugin_la_SOURCES = docpdfplugin.cpp
+kde_services_DATA = docpdfplugin.desktop
diff --git a/parts/documentation/plugins/pdf/docpdfplugin.cpp b/parts/documentation/plugins/pdf/docpdfplugin.cpp
new file mode 100644
index 00000000..02bac373
--- /dev/null
+++ b/parts/documentation/plugins/pdf/docpdfplugin.cpp
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Mathieu Chouinard *
+ * mathieu.chouinard@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docpdfplugin.h"
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+
+#include <kdevgenericfactory.h>
+
+static const KAboutData data("docpdfplugin", I18N_NOOP("PDF documentation plugin"), "1.0");
+typedef KDevGenericFactory<DocPDFPlugin> DocPDFPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocpdfplugin, DocPDFPluginFactory(&data) )
+
+DocPDFPlugin::DocPDFPlugin(QObject* parent, const char* name, const QStringList args)
+ :DocumentationPlugin(DocPDFPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(CustomDocumentationTitles | ProjectUserManual);
+ autoSetup();
+}
+
+DocPDFPlugin::~DocPDFPlugin()
+{
+}
+
+bool DocPDFPlugin::needRefreshIndex(DocumentationCatalogItem* item)
+{
+ return false;
+}
+
+QString DocPDFPlugin::pluginName() const
+{
+ return i18n("PDF Documentation Collection");
+}
+
+DocumentationCatalogItem* DocPDFPlugin::createCatalog(KListView* contents, const QString& title, const QString& url)
+{
+ DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title);
+ item->setURL(KURL(url));
+ return item;
+}
+
+QPair<KFile::Mode, QString> DocPDFPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "*.pdf");
+}
+
+QString DocPDFPlugin::catalogTitle(const QString& /*url*/)
+{
+ return QString::null;
+}
+
+QStringList DocPDFPlugin::fullTextSearchLocations()
+{
+ return QStringList();
+}
+
+
+void DocPDFPlugin::autoSetupPlugin()
+{
+ return;
+}
+
+void DocPDFPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocPDFPlugin::createTOC(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+void DocPDFPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/)
+{
+ return;
+}
+
+ProjectDocumentationPlugin *DocPDFPlugin::projectDocumentationPlugin(ProjectDocType type)
+{
+ if (type == UserManual)
+ return new ProjectDocumentationPlugin(this, type);
+ return DocumentationPlugin::projectDocumentationPlugin(type);
+}
diff --git a/parts/documentation/plugins/pdf/docpdfplugin.desktop b/parts/documentation/plugins/pdf/docpdfplugin.desktop
new file mode 100644
index 00000000..f42429ff
--- /dev/null
+++ b/parts/documentation/plugins/pdf/docpdfplugin.desktop
@@ -0,0 +1,43 @@
+[Desktop Entry]
+Type=Service
+Name=DocPDFPlugin
+Name[da]=DocPDF-plugin
+Name[sk]=Doc PDF modul
+Name[sv]=DocPDF-insticksmodul
+Name[ta]=DocQt சொருகுபொருள்
+Name[zh_TW]=PDF 文件外掛程式
+Exec=blubb
+Comment=Documentation plugin for PDF format
+Comment[ca]=Connector de documentació per al format PDF
+Comment[da]=Dokumentations-plugin for PDF-format
+Comment[de]=Komponente für das PDF-Dokumentationsformat
+Comment[el]=Πρόσθετο τεκμηρίωσης για τη μορφή PDF
+Comment[es]=Complemento de documentación para el formato PDF
+Comment[et]=PDF-vormingus dokumentatsiooni plugin
+Comment[eu]=PDF formaturako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای قالب PDF
+Comment[fr]=Module externe de documentation pour le format PDF
+Comment[gl]=Extensión de documentación para o formato PDF
+Comment[hu]=Dokumentációmodul PDF formátumú dokumentációhoz
+Comment[it]=Plugin di documentazione per formato PDF
+Comment[ja]=PDF フォーマットのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk format PDF
+Comment[nds]=Komponente för dat PDF-Dokmentatschoonformaat
+Comment[ne]=PDF ढाँचाका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor PDF documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie PDF
+Comment[pt]='Plugin' para documentação no formato PDF
+Comment[pt_BR]=Plug-in de documentação para o formato PDF
+Comment[ru]=Модуль для просмотра PDF
+Comment[sk]=Dokumentačný modul pre PDF formát
+Comment[sr]=Документациони прикључак за PDF формат
+Comment[sr@Latn]=Dokumentacioni priključak za PDF format
+Comment[sv]=Dokumentationsinsticksmodul för PDF-format
+Comment[ta]= Qt DCF ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиши PDF
+Comment[tr]=PDF biçimi için belgelendirme eklentisi
+Comment[zh_CN]=PDF 格式的文档插件
+Comment[zh_TW]=PDF 格式文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=1
+X-KDE-Library=libdocpdfplugin
diff --git a/parts/documentation/plugins/pdf/docpdfplugin.h b/parts/documentation/plugins/pdf/docpdfplugin.h
new file mode 100644
index 00000000..4148454a
--- /dev/null
+++ b/parts/documentation/plugins/pdf/docpdfplugin.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Mathieu Chouinard *
+ * mathieu.chouinard@kdemail.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCPDFPLUGIN_H
+#define DOCPDFPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+
+class DocPDFPlugin : public DocumentationPlugin {
+public:
+ DocPDFPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocPDFPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url);
+
+ virtual void createTOC(DocumentationCatalogItem* item);
+ virtual void setCatalogURL(DocumentationCatalogItem* item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem* item);
+ virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual QString catalogTitle(const QString& url);
+
+ virtual void autoSetupPlugin();
+
+ virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type);
+};
+
+#endif
diff --git a/parts/documentation/plugins/qt/Makefile.am b/parts/documentation/plugins/qt/Makefile.am
new file mode 100644
index 00000000..a25419e7
--- /dev/null
+++ b/parts/documentation/plugins/qt/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/parts/documentation/interfaces $(all_includes)
+
+METASOURCES = AUTO
+
+kde_module_LTLIBRARIES = libdocqtplugin.la
+
+noinst_HEADERS = docqtplugin.h
+kde_services_DATA = docqtplugin.desktop
+
+libdocqtplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+libdocqtplugin_la_SOURCES = docqtplugin.cpp
+libdocqtplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la
diff --git a/parts/documentation/plugins/qt/docqtplugin.cpp b/parts/documentation/plugins/qt/docqtplugin.cpp
new file mode 100644
index 00000000..ffbce63a
--- /dev/null
+++ b/parts/documentation/plugins/qt/docqtplugin.cpp
@@ -0,0 +1,339 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "docqtplugin.h"
+
+#include <unistd.h>
+
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qdialog.h>
+
+#include <kurl.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <klistview.h>
+
+#include <urlutil.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include "../../../../config.h"
+
+class QtDocumentationCatalogItem: public DocumentationCatalogItem
+{
+public:
+ QtDocumentationCatalogItem(const QString &dcfFile, DocumentationPlugin* plugin,
+ KListView *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_dcfFile(dcfFile)
+ {
+ }
+ QtDocumentationCatalogItem(const QString &dcfFile, DocumentationPlugin* plugin,
+ DocumentationItem *parent, const QString &name)
+ :DocumentationCatalogItem(plugin, parent, name), m_dcfFile(dcfFile)
+ {
+ }
+ QString dcfFile() const { return m_dcfFile; }
+
+private:
+ QString m_dcfFile;
+};
+
+static const KDevPluginInfo data("docqtplugin");
+typedef KDevGenericFactory<DocQtPlugin> DocQtPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libdocqtplugin, DocQtPluginFactory(data) )
+
+DocQtPlugin::DocQtPlugin(QObject* parent, const char* name, const QStringList)
+ :DocumentationPlugin(DocQtPluginFactory::instance()->config(), parent, name)
+{
+ setCapabilities(Index | FullTextSearch | CustomDocumentationTitles);
+ autoSetup();
+}
+
+DocQtPlugin::~DocQtPlugin()
+{
+}
+
+void DocQtPlugin::createTOC(DocumentationCatalogItem *item)
+{
+ QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item);
+ if (!qtItem)
+ return;
+
+ QFileInfo fi(qtItem->dcfFile());
+
+ QFile f(qtItem->dcfFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f) || doc.doctype().name() != "DCF")
+ {
+ kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement titleEl = docEl.namedItem("DCF").toElement();
+
+ QDomElement childEl = docEl.lastChild().toElement();
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == "section")
+ {
+ QString ref = childEl.attribute("ref");
+ QString title = childEl.attribute("title");
+
+ DocumentationItem *sectionItem = new DocumentationItem(DocumentationItem::Book, item, title);
+ KURL sectionUrl(fi.dirPath(true) + "/" + ref);
+ sectionItem->setURL(sectionUrl);
+
+ QDomElement grandChild = childEl.lastChild().toElement();
+ while(!grandChild.isNull())
+ {
+ if (grandChild.tagName() == "keyword")
+ {
+ QString keyRef = grandChild.attribute("ref");
+ QString keyTitle = grandChild.text();
+
+ DocumentationItem *keyItem = new DocumentationItem(DocumentationItem::Document, sectionItem, keyTitle);
+ KURL keyUrl(fi.dirPath(true) + "/" + keyRef);
+ keyItem->setURL(keyUrl);
+ }
+ if (grandChild.tagName() == "section")
+ {
+ QString keyRef = grandChild.attribute("ref");
+ QString keyTitle = grandChild.attribute("title");
+ DocumentationItem *keyItem = new DocumentationItem(DocumentationItem::Book, sectionItem, keyTitle);
+ KURL keyUrl(fi.dirPath(true) + "/" + keyRef);
+ keyItem->setURL(keyUrl);
+ }
+ grandChild = grandChild.previousSibling().toElement();
+ }
+ }
+ childEl = childEl.previousSibling().toElement();
+ }
+}
+
+void DocQtPlugin::autoSetupPlugin()
+{
+ QString qtDocDir(QT_DOCDIR);
+ qtDocDir = URLUtil::envExpand(qtDocDir);
+ if (qtDocDir.isEmpty())
+ {
+ qtDocDir = getenv("QTDIR");
+ }
+ if (!qtDocDir.isEmpty())
+ {
+ config->setGroup("Search Settings");
+ config->writeEntry("Qt Reference Documentation", true);
+ config->setGroup("Index Settings");
+ config->writeEntry("Qt Reference Documentation", true);
+ config->setGroup("Locations");
+ config->writePathEntry("Qt Reference Documentation", qtDocDir + QString("/qt.dcf"));
+ config->writePathEntry("Qt Assistant Manual", qtDocDir + QString("/assistant.dcf"));
+ config->writePathEntry("Qt Designer Manual", qtDocDir + QString("/designer.dcf"));
+ config->writePathEntry("Guide to the Qt Translation Tools", qtDocDir + QString("/linguist.dcf"));
+ config->writePathEntry("qmake User Guide", qtDocDir + QString("/qmake.dcf"));
+ }
+}
+
+void DocQtPlugin::setCatalogURL(DocumentationCatalogItem *item)
+{
+ QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item);
+ if (!qtItem)
+ return;
+
+ QFileInfo fi(qtItem->dcfFile());
+
+ QFile f(qtItem->dcfFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f) || doc.doctype().name() != "DCF")
+ {
+ kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement titleEl = docEl.namedItem("DCF").toElement();
+
+ if (item->url().isEmpty())
+ {
+ KURL url(fi.dirPath(true) + "/" + docEl.attribute("ref", QString::null));
+ item->setURL(url);
+ }
+}
+
+QString DocQtPlugin::pluginName() const
+{
+ return i18n("Qt Documentation Collection");
+}
+
+bool DocQtPlugin::needRefreshIndex(DocumentationCatalogItem *item)
+{
+ QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item);
+ if (!qtItem)
+ return false;
+
+ QFileInfo fi(qtItem->dcfFile());
+ config->setGroup("Index");
+ if (fi.lastModified() > config->readDateTimeEntry(qtItem->text(0), new QDateTime()))
+ {
+ kdDebug() << "need rebuild index for " << qtItem->text(0) << endl;
+ config->writeEntry(item->text(0), fi.lastModified());
+ return true;
+ }
+ else
+ return false;
+}
+
+void DocQtPlugin::createIndex(IndexBox *index, DocumentationCatalogItem *item)
+{
+ QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item);
+ if (!qtItem)
+ return;
+
+ QFileInfo fi(qtItem->dcfFile());
+
+ QFile f(qtItem->dcfFile());
+ if (!f.open(IO_ReadOnly))
+ {
+ kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl;
+ return;
+ }
+ QDomDocument doc;
+ if (!doc.setContent(&f) || doc.doctype().name() != "DCF")
+ {
+ kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl;
+ return;
+ }
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+ QDomElement titleEl = docEl.namedItem("DCF").toElement();
+
+ QDomElement childEl = docEl.firstChild().toElement();
+ while (!childEl.isNull())
+ {
+ if (childEl.tagName() == "section")
+ {
+ createSectionIndex(fi, index, item, childEl);
+ }
+ childEl = childEl.nextSibling().toElement();
+ }
+}
+
+void DocQtPlugin::createSectionIndex(QFileInfo &fi, IndexBox *index, DocumentationCatalogItem *item,
+ QDomElement section)
+{
+ //adymo: do not load section to index for Qt reference documentation
+ QString title = section.attribute("title");
+ if (fi.fileName() != "qt.dcf")
+ {
+ QString ref = section.attribute("ref");
+
+ IndexItemProto *ii = new IndexItemProto(this, item, index, title, item->text(0));
+ ii->addURL(KURL(fi.dirPath(true) + "/" + ref));
+ }
+
+ QDomElement grandChild = section.firstChild().toElement();
+ while(!grandChild.isNull())
+ {
+ if (grandChild.tagName() == "keyword")
+ {
+ QString keyRef = grandChild.attribute("ref");
+ QString keyTitle = grandChild.text();
+
+ //adymo: a little hack to avoid unwanted elements
+ if (keyRef != "qdir-example.html")
+ {
+ IndexItemProto *ii = new IndexItemProto(this, item, index, keyTitle, title);
+ ii->addURL(KURL(fi.dirPath(true) + "/" + keyRef));
+ }
+ }
+ if (grandChild.tagName() == "section")
+ {
+ createSectionIndex(fi, index, item, grandChild);
+ }
+ grandChild = grandChild.nextSibling().toElement();
+ }
+}
+
+QStringList DocQtPlugin::fullTextSearchLocations()
+{
+ QStringList locs;
+
+ QMap<QString, QString> entryMap = config->entryMap("Locations");
+
+ for (QMap<QString, QString>::const_iterator it = entryMap.begin();
+ it != entryMap.end(); ++it)
+ {
+ config->setGroup("Search Settings");
+ if (config->readBoolEntry(it.key(), false))
+ {
+ config->setGroup("Locations");
+ QFileInfo fi(config->readPathEntry(it.key()));
+ locs << fi.dirPath(true);
+ }
+ }
+
+ return locs;
+}
+
+QPair<KFile::Mode, QString> DocQtPlugin::catalogLocatorProps()
+{
+ return QPair<KFile::Mode, QString>(KFile::File, "*.xml *.dcf");
+}
+
+QString DocQtPlugin::catalogTitle(const QString &url)
+{
+ QFileInfo fi(url);
+ if (!fi.exists())
+ return QString::null;
+
+ QFile f(url);
+ if (!f.open(IO_ReadOnly))
+ return QString::null;
+
+ QDomDocument doc;
+ if (!doc.setContent(&f) || (doc.doctype().name() != "DCF"))
+ return QString::null;
+ f.close();
+
+ QDomElement docEl = doc.documentElement();
+
+ return docEl.attribute("title", QString::null);
+}
+
+DocumentationCatalogItem *DocQtPlugin::createCatalog(KListView *contents, const QString &title, const QString &url)
+{
+ return new QtDocumentationCatalogItem(url, this, contents, title);
+}
+
+#include "docqtplugin.moc"
diff --git a/parts/documentation/plugins/qt/docqtplugin.desktop b/parts/documentation/plugins/qt/docqtplugin.desktop
new file mode 100644
index 00000000..1e96eacf
--- /dev/null
+++ b/parts/documentation/plugins/qt/docqtplugin.desktop
@@ -0,0 +1,44 @@
+[Desktop Entry]
+Type=Service
+Name=DocQtPlugin
+Name[da]=DocQt-plugin
+Name[sk]=Doc Qt modul
+Name[sv]=Qt-dokumentationsinsticksmodul
+Name[ta]=DocQt சொருகு
+Name[zh_TW]=Qt 文件外掛程式
+Exec=blubb
+Comment=Documentation plugin for Qt DCF documentation
+Comment[ca]=Connector de documentació per a documentació Qt DCF
+Comment[da]=Dokumentations-plugin for Qt DCF dokumentation
+Comment[de]=Komponente für Qt-DCF-Dokumentation
+Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση τύπου Qt DCF
+Comment[es]=Complemento de documentación para Qt DCF
+Comment[et]=Qt DCF dokumentatsiooni plugin
+Comment[eu]=Qt DCF dokumentaziorako dokumentazio plugin-a
+Comment[fa]=وصلۀ مستندسازی برای مستندات Qt DCF
+Comment[fr]=Module externe de documentation pour la documentation Qt DCF
+Comment[gl]=Extensión de documentación para documentación Qt DCF
+Comment[hu]=Dokumentációmodul Qt DCF-dokumentációhoz
+Comment[it]=Plugin di documentazione per file di Qt DCF
+Comment[ja]=Qt DCF ドキュメンテーションのためのドキュメンテーションプラグイン
+Comment[ms]=Plugin dokumentasi untuk dokumentasi Qt DCF
+Comment[nds]=Dokmentatschoon-Moduul för Qt-DCF-Dokmentatschoon
+Comment[ne]=Qt DCF मिसिलीकरणका लागि मिसिलीकरण प्लगइन
+Comment[nl]=Documentatie plugin voor Qt DCF documentatie
+Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie Qt DCF
+Comment[pt]='Plugin' para documentação Qt DCF
+Comment[pt_BR]=Plug-in de documentação para documento DCF do Qt
+Comment[ru]=Модуль для просмотра Qt DCF
+Comment[sk]=Dokumentačný modul pre Qt DCF dokumentáciu
+Comment[sl]=Vstavek dokumentacije za Qt DCF
+Comment[sr]=Документациони прикључак за Qt DCF документацију
+Comment[sr@Latn]=Dokumentacioni priključak za Qt DCF dokumentaciju
+Comment[sv]=Dokumentationsinsticksmodul för Qt DCF-dokumentation
+Comment[ta]= Qt DCF ஆவணத்திற்கான ஆவணச் சொருகு
+Comment[tg]=Модул барои наоиши QT DCF
+Comment[tr]=Qt DCF Belgelendirmesi için belgelendirme eklentisi
+Comment[zh_CN]=Qt DCF 文档的文档插件
+Comment[zh_TW]=Qt DCF 文件外掛程式
+ServiceTypes=KDevelop/DocumentationPlugins
+X-KDevelop-Version=5
+X-KDE-Library=libdocqtplugin
diff --git a/parts/documentation/plugins/qt/docqtplugin.h b/parts/documentation/plugins/qt/docqtplugin.h
new file mode 100644
index 00000000..802dd98a
--- /dev/null
+++ b/parts/documentation/plugins/qt/docqtplugin.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef DOCQTPLUGIN_H
+#define DOCQTPLUGIN_H
+
+#include <kdevdocumentationplugin.h>
+#include <qdom.h>
+
+class KConfig;
+
+class DocQtPlugin : public DocumentationPlugin
+{
+ Q_OBJECT
+public:
+ DocQtPlugin(QObject* parent, const char* name, const QStringList args = QStringList());
+ ~DocQtPlugin();
+
+ virtual QString pluginName() const;
+
+ virtual DocumentationCatalogItem *createCatalog(KListView *contents, const QString &title, const QString &url);
+
+ virtual void createTOC(DocumentationCatalogItem *item);
+ virtual void setCatalogURL(DocumentationCatalogItem *item);
+
+ virtual bool needRefreshIndex(DocumentationCatalogItem *item);
+ virtual void createIndex(IndexBox *index, DocumentationCatalogItem *item);
+ virtual void createSectionIndex(QFileInfo &fi, IndexBox *index, DocumentationCatalogItem *item,
+ QDomElement section);
+
+ virtual QStringList fullTextSearchLocations();
+
+ virtual QPair<KFile::Mode, QString> catalogLocatorProps();
+ virtual QString catalogTitle(const QString &url);
+
+ virtual void autoSetupPlugin();
+
+};
+
+#endif
diff --git a/parts/documentation/protocols/Makefile.am b/parts/documentation/protocols/Makefile.am
new file mode 100644
index 00000000..ef837725
--- /dev/null
+++ b/parts/documentation/protocols/Makefile.am
@@ -0,0 +1,4 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+METASOURCES = AUTO
+
+SUBDIRS = chm
diff --git a/parts/documentation/protocols/chm/Makefile.am b/parts/documentation/protocols/chm/Makefile.am
new file mode 100644
index 00000000..59d02cfd
--- /dev/null
+++ b/parts/documentation/protocols/chm/Makefile.am
@@ -0,0 +1,21 @@
+## Makefile.am of kdebase/kioslave/chm
+
+INCLUDES = -I$(top_srcdir)/lib/widgets $(all_includes)
+
+kde_module_LTLIBRARIES = kio_chm.la libkchmpart.la
+
+kio_chm_la_SOURCES = decompress.cpp chmfile.cpp chm.cpp
+kio_chm_la_LIBADD = $(LIB_KIO)
+kio_chm_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+
+libkchmpart_la_SOURCES = kchmpart.cpp
+libkchmpart_la_LIBADD = -lkhtml $(LIB_KPARTS) $(top_builddir)/lib/widgets/libkdevwidgets.la
+libkchmpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+
+noinst_HEADERS = chm.h chmfile.h decompress.h kchmpart.h
+
+kdelnk_DATA = chm.protocol kchmpart.desktop
+kdelnkdir = $(kde_servicesdir)
+
+METASOURCES = AUTO
+
diff --git a/parts/documentation/protocols/chm/chm.cpp b/parts/documentation/protocols/chm/chm.cpp
new file mode 100644
index 00000000..1383d2b6
--- /dev/null
+++ b/parts/documentation/protocols/chm/chm.cpp
@@ -0,0 +1,362 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qcstring.h>
+#include <qbitarray.h>
+#include <qfile.h>
+#include <qregexp.h>
+#include <stack>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kinstance.h>
+#include <kglobal.h>
+#include <kurl.h>
+#include <kmimemagic.h>
+#include <ktempfile.h>
+
+#include "chm.h"
+
+
+using namespace KIO;
+
+extern "C"
+{
+ int kdemain( int argc, char **argv )
+ {
+ KInstance instance( "kio_chm" );
+
+ kdDebug() << "*** Starting kio_chm " << endl;
+
+ if (argc != 4) {
+ kdDebug() << "Usage: kio_chm protocol domain-socket1 domain-socket2" << endl;
+ exit(-1);
+ }
+
+ ChmProtocol slave(argv[2], argv[3]);
+ slave.dispatchLoop();
+
+ kdDebug() << "*** kio_chm Done" << endl;
+ return 0;
+ }
+}
+
+ChmProtocol::ChmProtocol(const QCString &pool_socket, const QCString &app_socket)
+: SlaveBase("kio_chm", pool_socket, app_socket)
+{
+ kdDebug() << "ChmProtocol::ChmProtocol()" << endl;
+}
+/* ---------------------------------------------------------------------------------- */
+
+
+ChmProtocol::~ChmProtocol()
+{
+ kdDebug() << "ChmProtocol::~ChmProtocol()" << endl;
+}
+
+
+/* ---------------------------------------------------------------------------------- */
+void ChmProtocol::get( const KURL& url )
+{
+ /** When :catalog is appended to the end, a plain-text representation of the catalog
+ * is given out where each entry consists of four lines, an integer representing the parent
+ * of the node, an integer representing a node's ID, the Title of the Node, and it's hyperlink.
+ * When :contents is appended, all contained htm- and html-files will be printed, each in a line.
+ */
+ kdDebug() << "kio_chm::get(const KURL& url) " << url.path() << endl;
+
+ bool catalog = false;
+ bool contents = false;
+ QString bigpath = url.path();
+
+ if(bigpath.endsWith(":catalog")) {
+ catalog = true;
+ int len = QString(":catalog").length();
+ bigpath.remove(bigpath.length() - len, len); ///strip :catalog from the end
+ }
+
+ if(bigpath.endsWith(":contents")) {
+ contents = true;
+ int len = QString(":contents").length();
+ bigpath.remove(bigpath.length() - len, len); ///strip :catalog from the end
+ }
+
+ QString path;
+ if ( !checkNewFile( bigpath, path ) ) {
+ error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL() );
+ return;
+ }
+
+
+ if (m_dirMap.find(path) == m_dirMap.end()) {
+ error( KIO::ERR_DOES_NOT_EXIST, url.prettyURL() );
+ return;
+ }
+
+ QByteArray theData;
+
+ //init..
+ //added by lucida lucida@users.sf.net
+ QString fname = QString();
+ QString chmpath = QString();
+ KTempFile f("",".html");
+ fname = f.name();
+ QTextStream *t = f.textStream();
+ QString firstPage = QString("");
+ QString m_strIndex = QString("");
+ QString tmpstr = QString("");
+ bool m_bIndex = 0;
+
+
+ if(contents) {
+ QString output;
+ KURL u = url;
+
+ ChmDirectoryMap::Iterator it;
+ for ( it = m_dirMap.begin(); it != m_dirMap.end(); ++it) {
+ u.setPath(bigpath);
+ u.addPath(it.key());
+ output += u.prettyURL() + "\n";
+ }
+
+ data(output.local8Bit());
+ processedSize(output.length());
+ finished();
+ return;
+ }
+
+
+ //try get some page to display, if the chm missing index
+ ChmDirectoryMap::Iterator it;
+ for ( it = m_dirMap.begin(); it != m_dirMap.end(); ++it) {
+ tmpstr.sprintf("%s", it.key().latin1());
+ if ((m_strIndex == "") &&
+ (tmpstr.endsWith(".htm") || tmpstr.endsWith(".html")))
+ m_strIndex = tmpstr;
+ if ((tmpstr == "/index.htm") || (tmpstr == "/index.html")) {
+ m_strIndex = tmpstr;
+ break;
+ }
+ }
+ m_strIndex.remove(0,1);
+
+
+ if (path == "/" || catalog) {
+ bool htmlOutput = !catalog;
+ int offset = m_dirMap["/@contents"].offset;
+ int length = m_dirMap["/@contents"].length;
+ theData.setRawData(&m_contents[offset], length);
+ QString s(theData);
+ QString output;
+
+ QRegExp object("<OBJECT type=\"text/sitemap\">(.*)</OBJECT>", false);
+ object.setMinimal(true);
+
+ QRegExp nameParam("<param name=\"Name\" value=\"(.*)\">", false);
+ nameParam.setMinimal(true);
+
+ QRegExp localParam("<param name=\"Local\" value=\"(.*)\">", false);
+ localParam.setMinimal(true);
+
+ QRegExp mergeParam("<param name=\"Merge\" value=\"(.*)\">", false);
+ mergeParam.setMinimal(true);
+
+ std::stack<int> parents;
+ int counter = 1;
+ int current = 0;
+ int old = 0, pos = 0;
+ parents.push(0);
+ while ((pos = s.find(object, pos)) != -1) {
+ if(htmlOutput) output += s.mid(old, pos - old);
+ if(catalog) {
+ QRegExp ex("<UL>|</UL>", false); ex.setMinimal(true);
+ QString ms = s.mid(old, pos - old);
+ int pos = 0;
+ while( (pos = ms.find(ex, pos)) != -1) {
+ if(ms.mid(pos, 4) == "<UL>") {
+ parents.push(current);
+ } else{
+ if(parents.empty()){
+ }else{
+ current = parents.top();
+ parents.pop();
+ }
+ }
+ pos++;
+ }
+ }
+ pos += object.matchedLength();
+ old = pos;
+ QString obj = object.cap(1);
+ QString name, local;
+ if (obj.find(nameParam) != -1) {
+ name = nameParam.cap(1);
+ if (obj.find(localParam) != -1) {
+ local = localParam.cap(1);
+ //output += "<a href=\"" + local + "\">" + name + "</a>";
+ //added by lucida lucida@users.sf.net
+ if (local != "" && local != "/") {
+ if(!catalog) {
+ output += "<a target=\"browse\" href=\"" + url.url() + local + "\">" + name + "</a>";
+ }else{
+ current = counter;
+ ++counter;
+ KURL u = url;
+ u.setPath(bigpath + local);
+ QString str;
+ output += str.sprintf("%i\n%i\n", parents.top(), current);
+ output += name + "\n" + u.prettyURL() + "\n";
+ }
+ m_bIndex = 1;
+ if (firstPage == "") firstPage = url.url()+QString::fromLocal8Bit(local.latin1());
+ }
+ else
+ if(htmlOutput) output += name;
+ } else {
+ if(htmlOutput) output += name;
+ }
+ }
+ if (obj.find(mergeParam) != -1 && htmlOutput) {
+ QString link = mergeParam.cap(1);
+ QString href = link.left(link.find("::"));
+ QString path = m_chmFile.left(m_chmFile.findRev("/") + 1);
+ //output += " (<a href=\"" + path + href + "\">link</a>)";
+ m_bIndex = 1;
+ output += " (<a target=\"browse\" href=\"" + url.url() + path + href + "\">link</a>)";
+ if (firstPage == "") firstPage = url.url()+QString::fromLocal8Bit(local.latin1());
+ }
+ }
+ if(htmlOutput) output += s.mid(old);
+
+ //set left pane
+ //added by lucida, lucida@users.sf.net
+ QString lframe = QString("</HEAD><FRAMESET COLS=\"25%,*\">\n");
+ lframe += "<FRAME NAME=\"index\" src=\"file:"+ fname+"\"" + " marginwidth=\"0\"></FRAME>\n";
+ if (!m_bIndex) {
+ lframe = "</HEAD><FRAMESET>";
+ firstPage = url.url() + QString::fromLocal8Bit(m_strIndex.latin1());
+ }
+ theData.resetRawData(&m_contents[offset], length);
+ //KMimeMagicResult * result = KMimeMagic::self()->findBufferFileType( output, path );
+ //kdDebug() << "Emitting mimetype " << result->mimeType() << endl;
+ //mimeType( result->mimeType() );
+/* QCString output1 = (QCString)(output.latin1());
+ data(output1);
+ processedSize(output1.length());*/
+
+ //construct the frame
+ //added by lucida lucida@users.sf.net
+ QString framestr = QString("<HTML><HEAD>\n");
+ framestr += lframe;
+ framestr += "<FRAME NAME=\"browse\" src=\"" + firstPage + "\">\n";
+ framestr += "</FRAME>\n";
+ framestr += "</FRAMESET></HTML>";
+ //write index file
+ //added by lucida lucida@users.sf.net
+ *t << QString::fromLocal8Bit(output.latin1()) << endl;
+
+ if(catalog) {
+ data(output.local8Bit());
+ processedSize(output.length());
+ }else{
+ data(framestr.local8Bit());
+ processedSize(framestr.length());
+ }
+ } else {
+ int offset = m_dirMap[path].offset;
+ int length = m_dirMap[path].length;
+ totalSize(length);
+ theData.setRawData(&m_contents[offset], length);
+
+ KMimeMagicResult * result = KMimeMagic::self()->findBufferFileType( theData, path );
+ kdDebug() << "Emitting mimetype " << result->mimeType() << endl;
+ mimeType( result->mimeType() );
+ data(theData);
+ theData.resetRawData(&m_contents[offset], length);
+ processedSize(length);
+ }
+
+ finished();
+}
+
+/* --------------------------------------------------------------------------- */
+bool ChmProtocol::checkNewFile( QString fullPath, QString& path )
+{
+ //kdDebug() << "ChmProtocol::checkNewFile " << fullPath << endl;
+
+ fullPath = fullPath.replace(QRegExp("::"), "");
+
+ // Are we already looking at that file ?
+ if ( !m_chmFile.isEmpty() && fullPath.startsWith(m_chmFile) )
+ {
+ path = fullPath.mid(m_chmFile.length()).lower();
+ return true;
+ }
+
+ kdDebug() << "Need to open a new file" << endl;
+
+ m_chmFile = "";
+
+ // Find where the chm file is in the full path
+ int pos = 0;
+ QString chmFile;
+ path = "";
+
+ int len = fullPath.length();
+ if ( len != 0 && fullPath[ len - 1 ] != '/' )
+ fullPath += '/';
+
+ //kdDebug() << "the full path is " << fullPath << endl;
+ while ( (pos=fullPath.find( '/', pos+1 )) != -1 )
+ {
+ QString tryPath = fullPath.left( pos );
+ //kdDebug() << fullPath << " trying " << tryPath << endl;
+ struct stat statbuf;
+ if ( ::stat( QFile::encodeName(tryPath), &statbuf ) == 0 && !S_ISDIR(statbuf.st_mode) )
+ {
+ chmFile = tryPath;
+ path = fullPath.mid( pos ).lower();
+ kdDebug() << "fullPath=" << fullPath << " path=" << path << endl;
+ len = path.length();
+ if ( len > 2 )
+ {
+ if ( path[ len - 1 ] == '/' )
+ path.truncate( len - 1 );
+ }
+ else
+ {
+ path = QString::fromLatin1("/");
+ }
+ kdDebug() << "Found. chmFile=" << chmFile << " path=" << path << endl;
+ break;
+ }
+ }
+ if ( chmFile.isEmpty() )
+ {
+ kdDebug() << "ChmProtocol::checkNewFile: not found" << endl;
+ return false;
+ }
+
+ m_chmFile = chmFile;
+
+ // Open new file
+ //kdDebug() << "Opening Chm file on " << chmFile << endl;
+ return m_chm.read(chmFile, m_dirMap, m_contents);
+}
diff --git a/parts/documentation/protocols/chm/chm.h b/parts/documentation/protocols/chm/chm.h
new file mode 100644
index 00000000..92044173
--- /dev/null
+++ b/parts/documentation/protocols/chm/chm.h
@@ -0,0 +1,47 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __chm_h__
+#define __chm_h__
+
+#include <qstring.h>
+#include <qcstring.h>
+#include <kurl.h>
+#include <kio/global.h>
+#include <kio/slavebase.h>
+#include "chmfile.h"
+
+class QCString;
+
+class ChmProtocol : public KIO::SlaveBase
+{
+public:
+ ChmProtocol( const QCString&, const QCString& );
+ ~ChmProtocol();
+
+ void get( const KURL& );
+
+private:
+ bool checkNewFile( QString, QString& );
+ ChmDirectoryMap m_dirMap;
+ QByteArray m_contents;
+ QString m_chmFile;
+ Chm m_chm;
+};
+
+
+#endif // __chm_h__
+
diff --git a/parts/documentation/protocols/chm/chm.protocol b/parts/documentation/protocols/chm/chm.protocol
new file mode 100644
index 00000000..90daa4c5
--- /dev/null
+++ b/parts/documentation/protocols/chm/chm.protocol
@@ -0,0 +1,36 @@
+[Protocol]
+exec=kio_chm
+protocol=ms-its
+input=none
+output=filesystem
+reading=true
+defaultMimetype=text/html
+Description=A kioslave for displaying WinHelp files
+Description[ca]=Un kioslave per a mostrar fitxers WinHelp
+Description[da]=En kioslave til visning af Windows hjælpefiler
+Description[de]=Ein Ein-/Ausgabemodul zur Anzeige von WinHelp-Dateien
+Description[el]=Ένας υπηρέτης kio για εμφάνιση αρχείων WinHelp
+Description[es]=Un kioslave para mostrar archivos WinHelp
+Description[et]=WinHelp-failide kuvamise IO-moodul
+Description[eu]=WinHelp fitxategiak bistaratzeko kioslave bat
+Description[fa]=یک kioslave برای نمایش پرونده‌های WinHelp
+Description[fr]=Un esclave d'E/S (kioslave) pour l'affichage des fichiers WinHelp
+Description[gl]=Un kioslave para mostrar ficheiros WinHelp
+Description[hu]=KDE-protokoll WinHelp-fájlok megjelenítéséhez
+Description[it]=Un kioslave per mostrare i file WinHelp
+Description[ja]=WinHelp を表示するための kioslave
+Description[nds]=En In-/Utgaavmoduul för't Wiesen vun "WinHelp"-Dateien
+Description[ne]=WinHelp फाइलहरूका लागि किवस्लेभ
+Description[nl]=Een kioslave voor het weergeven van WinHelp-bestanden
+Description[pl]=kioslave do pokazywania plików WinHelp
+Description[pt]=A 'kioslave' para mostrar ficheiros WinHelp
+Description[pt_BR]=Um kioslave para exibir arquivos WinHelp
+Description[ru]=Обработчик ввода-вывода для файлов WinHelp
+Description[sk]=kioslave pre zobrazenie WinHelp súborov
+Description[sr]=KIOSlave за приказ WinHelp фајлова
+Description[sr@Latn]=KIOSlave za prikaz WinHelp fajlova
+Description[sv]=En I/O-slav för att visa WinHelp-filer
+Description[tr]=WinHelp dosyalarını görüntülemek için bir kioslave
+Description[zh_CN]=显示 WinHelp 文件的 kioslave
+Description[zh_TW]=顯示 WinHelp 檔案的 kioslave
+Icon=help
diff --git a/parts/documentation/protocols/chm/chmfile.cpp b/parts/documentation/protocols/chm/chmfile.cpp
new file mode 100644
index 00000000..f69d354a
--- /dev/null
+++ b/parts/documentation/protocols/chm/chmfile.cpp
@@ -0,0 +1,197 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qfile.h>
+#include "chmfile.h"
+#include "decompress.h"
+
+uint Chm::getEncInt(QFile& f, uint &value) const
+{
+ int c;
+ uint result = 0;
+ ulong count = 0;
+
+ do
+ {
+ c = f.getch();
+ result <<= 7;
+ result |= (c & 0x7F);
+ count++;
+ } while (c & 0x80);
+
+ value = result;
+ return count;
+}
+
+uint Chm::getName(QFile& f, QString& name) const
+{
+ int len = f.getch();
+ char *buf = new char[len];
+ f.readBlock(buf, len);
+ name = QString::fromUtf8(buf, len);
+ if (name.startsWith("/"))
+ name = name.lower();
+ delete [] buf;
+ return len + 1;
+}
+
+uint Chm::getIntel32(QFile& f) const
+{
+ uint value = f.getch() | f.getch() << 8 | f.getch() << 16 | f.getch() << 24;
+ return value;
+}
+
+uint Chm::getIntel64(QFile& f) const
+{
+ uint value = getIntel32(f);
+ f.at(f.at() + 4);
+ return value;
+}
+
+bool Chm::getChunk(QFile& f, uint chunkSize, ChmDirectoryMap& directoryMap) const
+{
+ char tag[4];
+ if (f.readBlock(tag, 4) != 4) return false;
+
+ if (!qstrncmp(tag, "PMGL", 4))
+ {
+ uint quickref_length = getIntel32(f);
+ f.at(f.at() + 12);
+
+ uint pos = 20;
+ while (pos < chunkSize - quickref_length)
+ {
+ uint section, offset, length;
+ QString name;
+ pos += getName(f, name);
+ pos += getEncInt(f, section);
+ pos += getEncInt(f, offset);
+ pos += getEncInt(f, length);
+ directoryMap[name] = ChmDirTableEntry(section, offset, length);
+ if (name.endsWith(".hhc"))
+ directoryMap["/@contents"] = ChmDirTableEntry(section, offset, length);
+ }
+
+ return (f.at(f.at() + quickref_length));
+ }
+ else if (!qstrncmp(tag, "PMGI", 4))
+ {
+ // evaluation of the index chunk is not yet implemented => skip it
+ return f.at(f.at() + chunkSize - 4);
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool Chm::read(const QString& fileSpec, ChmDirectoryMap& dirMap, QByteArray& contents) const
+{
+ QFile f(fileSpec);
+ if (!f.open(IO_ReadOnly)) return false;
+
+ // read CHM file header
+ char tag[4];
+ if (f.readBlock(tag, 4) != 4 || qstrncmp(tag, "ITSF", 4)) return false;
+ uint chm_version = getIntel32(f);
+ if (!f.at(f.at() + 0x30)) return false;
+
+ // read header section table
+ uint section_0_offset = getIntel64(f);
+ uint section_0_length = getIntel64(f);
+ uint section_1_offset = getIntel64(f);
+ uint section_1_length = getIntel64(f);
+
+ uint contentStart = 0;
+ if (chm_version >= 3) contentStart = getIntel32(f);
+
+ // read directory header
+ if (!f.at(section_1_offset)) return false;
+ if (f.readBlock(tag, 4) != 4 || qstrncmp(tag, "ITSP", 4)) return false;
+ if (!f.at(f.at() + 12)) return false;
+ uint directory_chunk_size = getIntel32(f);
+ if (!f.at(f.at() + 24)) return false;
+ uint num_directory_chunks = getIntel32(f);
+ if (!f.at(f.at() + 36)) return false;
+
+ // read directory table
+ for (uint i = 0; i < num_directory_chunks; i++)
+ if (!getChunk(f, directory_chunk_size, dirMap)) return false;
+
+ // current position is start of content area
+ if (chm_version < 3) contentStart = f.at();
+
+ // read reset table
+ if (!f.at(contentStart)) return false;
+ uint resetTableOffset =
+ dirMap["::DataSpace/Storage/MSCompressed/Transform/{7FC28940-9D31-11D0-9B27-00A0C91E9C7C}/InstanceData/ResetTable"].offset;
+ if (!f.at(f.at() + resetTableOffset + 4)) return false;
+ uint numResetTableEntries = getIntel32(f);
+ if (!f.at(f.at() + 8)) return false;
+ uint uncompressedLength = getIntel64(f);
+ uint compressedLength = getIntel64(f);
+ uint blockSize = getIntel64(f);
+ uint *resetTable = new uint[numResetTableEntries + 1];
+
+ for (uint i = 0; i < numResetTableEntries; i++)
+ resetTable[i] = getIntel64(f);
+
+ resetTable[numResetTableEntries] = compressedLength;
+
+ // read compressed contents
+ if (!f.at(contentStart)) return false;
+ uint contentsOffset = dirMap["::DataSpace/Storage/MSCompressed/Content"].offset;
+ if (!f.at(f.at() + contentsOffset)) return false;
+ char *compressedContents = new char[compressedLength];
+ if ((uint)f.readBlock(compressedContents, compressedLength) != compressedLength) return false;
+
+ f.close();
+
+ // allocate buffer for uncompressed contents
+ char *uncompressedContents = new char[uncompressedLength];
+
+ // get window size
+ uint window = 1;
+ uint tmp = blockSize;
+ while (tmp >>= 1) window++;
+
+ // decompress
+ uint outlen = uncompressedLength;
+ int res = 1;
+
+ for (uint i = 0; i < numResetTableEntries; i++)
+ {
+ if (!(i & 1)) LZXinit(window);
+
+ uint inlen = resetTable[i+1] - resetTable[i];
+ res = LZXdecompress((uchar*)&compressedContents[resetTable[i]],
+ inlen,
+ (uchar*)uncompressedContents + i * blockSize,
+ (outlen < blockSize) ? outlen : blockSize);
+ if (res) break;
+ outlen -= blockSize;
+ }
+
+ delete [] resetTable;
+ delete [] compressedContents;
+
+ if (res == 0)
+ contents.duplicate(uncompressedContents, uncompressedLength);
+
+ delete [] uncompressedContents;
+
+ return (res == 0);
+}
diff --git a/parts/documentation/protocols/chm/chmfile.h b/parts/documentation/protocols/chm/chmfile.h
new file mode 100644
index 00000000..0040c135
--- /dev/null
+++ b/parts/documentation/protocols/chm/chmfile.h
@@ -0,0 +1,53 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __chmfile_h__
+#define __chmfile_h__
+
+#include <cstdio>
+#include <qmap.h>
+#include <qstring.h>
+
+class QFile;
+
+struct ChmDirTableEntry
+{
+ ChmDirTableEntry() : section(0), offset(0), length(0) {}
+ ChmDirTableEntry( uint s, uint o, uint l )
+ : section(s), offset(o), length(l) {}
+
+ uint section;
+ uint offset;
+ uint length;
+};
+
+typedef QMap<QString, ChmDirTableEntry> ChmDirectoryMap;
+
+class Chm
+{
+public:
+ bool read( const QString&, ChmDirectoryMap&, QByteArray& ) const;
+
+private:
+ bool getChunk( QFile&, uint, ChmDirectoryMap& ) const;
+ uint getEncInt( QFile&, uint& ) const;
+ uint getName( QFile&, QString& ) const;
+ uint getIntel32( QFile& ) const;
+ uint getIntel64( QFile& ) const;
+};
+
+#endif // __chmfile_h__
+
diff --git a/parts/documentation/protocols/chm/decompress.cpp b/parts/documentation/protocols/chm/decompress.cpp
new file mode 100644
index 00000000..0356d86e
--- /dev/null
+++ b/parts/documentation/protocols/chm/decompress.cpp
@@ -0,0 +1,796 @@
+/* Most of this file is taken from:
+ cabextract 0.5 - a program to extract Microsoft Cabinet files
+ (C) 2000-2001 Stuart Caie <kyzer@4u.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "decompress.h"
+
+int make_decode_table(ULONG nsyms, ULONG nbits, UBYTE *length, UWORD *table);
+int lzx_read_lens(UBYTE *lens, ULONG first, ULONG last, lzx_bits *lb);
+
+
+/*--------------------------------------------------------------------------*/
+/* our archiver information / state */
+
+/* LZX stuff */
+
+/* some constants defined by the LZX specification */
+#define LZX_MIN_MATCH (2)
+#define LZX_MAX_MATCH (257)
+#define LZX_NUM_CHARS (256)
+#define LZX_BLOCKTYPE_INVALID (0) /* also blocktypes 4-7 invalid */
+#define LZX_BLOCKTYPE_VERBATIM (1)
+#define LZX_BLOCKTYPE_ALIGNED (2)
+#define LZX_BLOCKTYPE_UNCOMPRESSED (3)
+#define LZX_PRETREE_NUM_ELEMENTS (20)
+#define LZX_ALIGNED_NUM_ELEMENTS (8) /* aligned offset tree #elements */
+#define LZX_NUM_PRIMARY_LENGTHS (7) /* this one missing from spec! */
+#define LZX_NUM_SECONDARY_LENGTHS (249) /* length tree #elements */
+
+/* LZX huffman defines: tweak tablebits as desired */
+#define LZX_PRETREE_MAXSYMBOLS (LZX_PRETREE_NUM_ELEMENTS)
+#define LZX_PRETREE_TABLEBITS (6)
+#define LZX_MAINTREE_MAXSYMBOLS (LZX_NUM_CHARS + 50*8)
+#define LZX_MAINTREE_TABLEBITS (12)
+#define LZX_LENGTH_MAXSYMBOLS (LZX_NUM_SECONDARY_LENGTHS+1)
+#define LZX_LENGTH_TABLEBITS (12)
+#define LZX_ALIGNED_MAXSYMBOLS (LZX_ALIGNED_NUM_ELEMENTS)
+#define LZX_ALIGNED_TABLEBITS (7)
+
+#define LZX_LENTABLE_SAFETY (64) /* we allow length table decoding overruns */
+
+#define LZX_DECLARE_TABLE(tbl) \
+ UWORD tbl##_table[(1<<LZX_##tbl##_TABLEBITS) + (LZX_##tbl##_MAXSYMBOLS<<1)];\
+ UBYTE tbl##_len [LZX_##tbl##_MAXSYMBOLS + LZX_LENTABLE_SAFETY]
+
+struct LZXstate
+{
+ UBYTE *window; /* the actual decoding window */
+ ULONG window_size; /* window size (32Kb through 2Mb) */
+ ULONG actual_size; /* window size when it was first allocated */
+ ULONG window_posn; /* current offset within the window */
+ ULONG R0, R1, R2; /* for the LRU offset system */
+ UWORD main_elements; /* number of main tree elements */
+ int header_read; /* have we started decoding at all yet? */
+ UWORD block_type; /* type of this block */
+ ULONG block_length; /* uncompressed length of this block */
+ ULONG block_remaining; /* uncompressed bytes still left to decode */
+ ULONG frames_read; /* the number of CFDATA blocks processed */
+ LONG intel_filesize; /* magic header value used for transform */
+ LONG intel_curpos; /* current offset in transform space */
+ int intel_started; /* have we seen any translatable data yet? */
+
+ LZX_DECLARE_TABLE(PRETREE);
+ LZX_DECLARE_TABLE(MAINTREE);
+ LZX_DECLARE_TABLE(LENGTH);
+ LZX_DECLARE_TABLE(ALIGNED);
+};
+
+
+/* generic stuff */
+#define CAB(x) (decomp_state.x)
+#define LZX(x) (decomp_state.lzx.x)
+#define DECR_OK (0)
+#define DECR_DATAFORMAT (1)
+#define DECR_ILLEGALDATA (2)
+#define DECR_NOMEMORY (3)
+#define DECR_CHECKSUM (4)
+#define DECR_INPUT (5)
+#define DECR_OUTPUT (6)
+
+struct
+{
+ struct LZXstate lzx;
+} decomp_state;
+
+
+/* LZX decruncher */
+
+/* Microsoft's LZX document and their implementation of the
+ * com.ms.util.cab Java package do not concur.
+ *
+ * In the LZX document, there is a table showing the correlation between
+ * window size and the number of position slots. It states that the 1MB
+ * window = 40 slots and the 2MB window = 42 slots. In the implementation,
+ * 1MB = 42 slots, 2MB = 50 slots. The actual calculation is 'find the
+ * first slot whose position base is equal to or more than the required
+ * window size'. This would explain why other tables in the document refer
+ * to 50 slots rather than 42.
+ *
+ * The constant NUM_PRIMARY_LENGTHS used in the decompression pseudocode
+ * is not defined in the specification.
+ *
+ * The LZX document does not state the uncompressed block has an
+ * uncompressed length field. Where does this length field come from, so
+ * we can know how large the block is? The implementation has it as the 24
+ * bits following after the 3 blocktype bits, before the alignment
+ * padding.
+ *
+ * The LZX document states that aligned offset blocks have their aligned
+ * offset huffman tree AFTER the main and length trees. The implementation
+ * suggests that the aligned offset tree is BEFORE the main and length
+ * trees.
+ *
+ * The LZX document decoding algorithm states that, in an aligned offset
+ * block, if an extra_bits value is 1, 2 or 3, then that number of bits
+ * should be read and the result added to the match offset. This is
+ * correct for 1 and 2, but not 3, where just a huffman symbol (using the
+ * aligned tree) should be read.
+ *
+ * Regarding the E8 preprocessing, the LZX document states 'No translation
+ * may be performed on the last 6 bytes of the input block'. This is
+ * correct. However, the pseudocode provided checks for the *E8 leader*
+ * up to the last 6 bytes. If the leader appears between -10 and -7 bytes
+ * from the end, this would cause the next four bytes to be modified, at
+ * least one of which would be in the last 6 bytes, which is not allowed
+ * according to the spec.
+ *
+ * The specification states that the huffman trees must always contain at
+ * least one element. However, many CAB files contain blocks where the
+ * length tree is completely empty (because there are no matches), and
+ * this is expected to succeed.
+ */
+
+
+/* LZX uses what it calls 'position slots' to represent match offsets.
+ * What this means is that a small 'position slot' number and a small
+ * offset from that slot are encoded instead of one large offset for
+ * every match.
+ * - position_base is an index to the position slot bases
+ * - extra_bits states how many bits of offset-from-base data is needed.
+ */
+static ULONG position_base[51];
+static UBYTE extra_bits[51];
+
+
+int LZXinit(int window) {
+ ULONG wndsize = 1 << window;
+ int i, j, posn_slots;
+
+ /* LZX supports window sizes of 2^15 (32Kb) through 2^21 (2Mb) */
+ /* if a previously allocated window is big enough, keep it */
+ if (window < 15 || window > 21) return DECR_DATAFORMAT;
+ if (LZX(actual_size) < wndsize)
+ {
+ if (LZX(window)) free(LZX(window));
+ LZX(window) = NULL;
+ }
+ if (!LZX(window))
+ {
+ if (!(LZX(window) = (UBYTE*)malloc(wndsize))) return DECR_NOMEMORY;
+ LZX(actual_size) = wndsize;
+ }
+ LZX(window_size) = wndsize;
+
+ /* initialise static tables */
+ for (i=0, j=0; i <= 49; i += 2)
+ {
+ extra_bits[i] = extra_bits[i+1] = j; /* 0,0,0,0,1,1,2,2,3,3... */
+ if ((i != 0) && (j < 17)) j++; /* 0,0,1,2,3,4...15,16,17,17,17,17... */
+ }
+ for (i=0, j=0; i <= 50; i++)
+ {
+ position_base[i] = j; /* 0,1,2,3,4,6,8,12,16,24,32,... */
+ j += 1 << extra_bits[i]; /* 1,1,1,1,2,2,4,4,8,8,16,16,32,32,... */
+ }
+
+ /* calculate required position slots */
+ if (window == 20) posn_slots = 42;
+ else if (window == 21) posn_slots = 50;
+ else posn_slots = window << 1;
+
+ /*posn_slots=i=0; while (i < wndsize) i += 1 << extra_bits[posn_slots++]; */
+
+
+ LZX(R0) = LZX(R1) = LZX(R2) = 1;
+ LZX(main_elements) = LZX_NUM_CHARS + (posn_slots << 3);
+ LZX(header_read) = 0;
+ LZX(frames_read) = 0;
+ LZX(block_remaining) = 0;
+ LZX(block_type) = LZX_BLOCKTYPE_INVALID;
+ LZX(intel_curpos) = 0;
+ LZX(intel_started) = 0;
+ LZX(window_posn) = 0;
+
+ /* initialise tables to 0 (because deltas will be applied to them) */
+ for (i = 0; i < LZX_MAINTREE_MAXSYMBOLS; i++) LZX(MAINTREE_len)[i] = 0;
+ for (i = 0; i < LZX_LENGTH_MAXSYMBOLS; i++) LZX(LENGTH_len)[i] = 0;
+
+ return DECR_OK;
+}
+
+
+/* Bitstream reading macros:
+ *
+ * INIT_BITSTREAM should be used first to set up the system
+ * READ_BITS(var,n) takes N bits from the buffer and puts them in var
+ *
+ * ENSURE_BITS(n) ensures there are at least N bits in the bit buffer
+ * PEEK_BITS(n) extracts (without removing) N bits from the bit buffer
+ * REMOVE_BITS(n) removes N bits from the bit buffer
+ *
+ * These bit access routines work by using the area beyond the MSB and the
+ * LSB as a free source of zeroes. This avoids having to mask any bits.
+ * So we have to know the bit width of the bitbuffer variable. This is
+ * sizeof(ULONG) * 8, also defined as ULONG_BITS
+ */
+
+/* number of bits in ULONG. Note: This must be at multiple of 16, and at
+ * least 32 for the bitbuffer code to work (ie, it must be able to ensure
+ * up to 17 bits - that's adding 16 bits when there's one bit left, or
+ * adding 32 bits when there are no bits left. The code should work fine
+ * for machines where ULONG >= 32 bits.
+ */
+#define ULONG_BITS (sizeof(ULONG)<<3)
+
+#define INIT_BITSTREAM do { bitsleft = 0; bitbuf = 0; } while (0)
+
+#define ENSURE_BITS(n) \
+ while (bitsleft < (n)) { \
+ bitbuf |= ((inpos[1]<<8)|inpos[0]) << (ULONG_BITS-16 - bitsleft); \
+ bitsleft += 16; inpos+=2; \
+ }
+
+#define PEEK_BITS(n) (bitbuf >> (ULONG_BITS - (n)))
+#define REMOVE_BITS(n) ((bitbuf <<= (n)), (bitsleft -= (n)))
+
+#define READ_BITS(v,n) do { \
+ ENSURE_BITS(n); \
+ (v) = PEEK_BITS(n); \
+ REMOVE_BITS(n); \
+} while (0)
+
+
+/* Huffman macros */
+
+#define TABLEBITS(tbl) (LZX_##tbl##_TABLEBITS)
+#define MAXSYMBOLS(tbl) (LZX_##tbl##_MAXSYMBOLS)
+#define SYMTABLE(tbl) (LZX(tbl##_table))
+#define LENTABLE(tbl) (LZX(tbl##_len))
+
+/* BUILD_TABLE(tablename) builds a huffman lookup table from code lengths.
+ * In reality, it just calls make_decode_table() with the appropriate
+ * values - they're all fixed by some #defines anyway, so there's no point
+ * writing each call out in full by hand.
+ */
+#define BUILD_TABLE(tbl) \
+ if (make_decode_table( \
+ MAXSYMBOLS(tbl), TABLEBITS(tbl), LENTABLE(tbl), SYMTABLE(tbl) \
+ )) { return DECR_ILLEGALDATA; }
+
+
+/* READ_HUFFSYM(tablename, var) decodes one huffman symbol from the
+ * bitstream using the stated table and puts it in var.
+ */
+#define READ_HUFFSYM(tbl,var) do { \
+ ENSURE_BITS(16); \
+ hufftbl = SYMTABLE(tbl); \
+ if ((i = hufftbl[PEEK_BITS(TABLEBITS(tbl))]) >= MAXSYMBOLS(tbl)) { \
+ j = 1 << (ULONG_BITS - TABLEBITS(tbl)); \
+ do { \
+ j >>= 1; i <<= 1; i |= (bitbuf & j) ? 1 : 0; \
+ if (!j) { return DECR_ILLEGALDATA; } \
+ } while ((i = hufftbl[i]) >= MAXSYMBOLS(tbl)); \
+ } \
+ j = LENTABLE(tbl)[(var) = i]; \
+ REMOVE_BITS(j); \
+} while (0)
+
+
+/* READ_LENGTHS(tablename, first, last) reads in code lengths for symbols
+ * first to last in the given table. The code lengths are stored in their
+ * own special LZX way.
+ */
+#define READ_LENGTHS(tbl,first,last) do { \
+ lb.bb = bitbuf; lb.bl = bitsleft; lb.ip = inpos; \
+ if (lzx_read_lens(LENTABLE(tbl),(first),(last),&lb)) { \
+ return DECR_ILLEGALDATA; \
+ } \
+ bitbuf = lb.bb; bitsleft = lb.bl; inpos = lb.ip; \
+} while (0)
+
+
+/* make_decode_table(nsyms, nbits, length[], table[])
+ *
+ * This function was coded by David Tritscher. It builds a fast huffman
+ * decoding table out of just a canonical huffman code lengths table.
+ *
+ * nsyms = total number of symbols in this huffman tree.
+ * nbits = any symbols with a code length of nbits or less can be decoded
+ * in one lookup of the table.
+ * length = A table to get code lengths from [0 to syms-1]
+ * table = The table to fill up with decoded symbols and pointers.
+ *
+ * Returns 0 for OK or 1 for error
+ */
+
+int make_decode_table(ULONG nsyms, ULONG nbits, UBYTE *length, UWORD *table) {
+ register UWORD sym;
+ register ULONG leaf;
+ register UBYTE bit_num = 1;
+ ULONG fill;
+ ULONG pos = 0; /* the current position in the decode table */
+ ULONG table_mask = 1 << nbits;
+ ULONG bit_mask = table_mask >> 1; /* don't do 0 length codes */
+ ULONG next_symbol = bit_mask; /* base of allocation for long codes */
+
+ /* fill entries for codes short enough for a direct mapping */
+ while (bit_num <= nbits)
+ {
+ for (sym = 0; sym < nsyms; sym++)
+ {
+ if (length[sym] == bit_num)
+ {
+ leaf = pos;
+
+ if ((pos += bit_mask) > table_mask) return 1; /* table overrun */
+
+ /* fill all possible lookups of this symbol with the symbol itself */
+ fill = bit_mask;
+ while (fill-- > 0) table[leaf++] = sym;
+ }
+ }
+ bit_mask >>= 1;
+ bit_num++;
+ }
+
+ /* if there are any codes longer than nbits */
+ if (pos != table_mask)
+ {
+ /* clear the remainder of the table */
+ for (sym = pos; sym < table_mask; sym++) table[sym] = 0;
+
+ /* give ourselves room for codes to grow by up to 16 more bits */
+ pos <<= 16;
+ table_mask <<= 16;
+ bit_mask = 1 << 15;
+
+ while (bit_num <= 16)
+ {
+ for (sym = 0; sym < nsyms; sym++)
+ {
+ if (length[sym] == bit_num)
+ {
+ leaf = pos >> 16;
+ for (fill = 0; fill < bit_num - nbits; fill++)
+ {
+ /* if this path hasn't been taken yet, 'allocate' two entries */
+ if (table[leaf] == 0)
+ {
+ table[(next_symbol << 1)] = 0;
+ table[(next_symbol << 1) + 1] = 0;
+ table[leaf] = next_symbol++;
+ }
+ /* follow the path and select either left or right for next bit */
+ leaf = table[leaf] << 1;
+ if ((pos >> (15-fill)) & 1) leaf++;
+ }
+ table[leaf] = sym;
+
+ if ((pos += bit_mask) > table_mask) return 1; /* table overflow */
+ }
+ }
+ bit_mask >>= 1;
+ bit_num++;
+ }
+ }
+
+ /* full table? */
+ if (pos == table_mask) return 0;
+
+ /* either erroneous table, or all elements are 0 - let's find out. */
+ for (sym = 0; sym < nsyms; sym++) if (length[sym]) return 1;
+ return 0;
+}
+
+int lzx_read_lens(UBYTE *lens, ULONG first, ULONG last, lzx_bits *lb) {
+ ULONG i,j, x,y;
+ int z;
+
+ register ULONG bitbuf = lb->bb;
+ register int bitsleft = lb->bl;
+ UBYTE *inpos = lb->ip;
+ UWORD *hufftbl;
+
+ for (x = 0; x < 20; x++)
+ {
+ READ_BITS(y, 4);
+ LENTABLE(PRETREE)[x] = y;
+ }
+ BUILD_TABLE(PRETREE);
+
+ for (x = first; x < last;)
+ {
+ READ_HUFFSYM(PRETREE, z);
+ if (z == 17)
+ {
+ READ_BITS(y, 4); y += 4;
+ while (y--) lens[x++] = 0;
+ }
+ else if (z == 18)
+ {
+ READ_BITS(y, 5); y += 20;
+ while (y--) lens[x++] = 0;
+ }
+ else if (z == 19)
+ {
+ READ_BITS(y, 1); y += 4;
+ READ_HUFFSYM(PRETREE, z);
+ z = lens[x] - z; if (z < 0) z += 17;
+ while (y--) lens[x++] = z;
+ }
+ else
+ {
+ z = lens[x] - z; if (z < 0) z += 17;
+ lens[x++] = z;
+ }
+ }
+
+ lb->bb = bitbuf;
+ lb->bl = bitsleft;
+ lb->ip = inpos;
+ return 0;
+}
+
+int LZXdecompress(UBYTE* inpos, int inlen, UBYTE* outpos, int outlen) {
+ UBYTE *endinp = inpos + inlen;
+ UBYTE *window = LZX(window);
+ UBYTE *runsrc, *rundest;
+ UWORD *hufftbl; /* used in READ_HUFFSYM macro as chosen decoding table */
+
+ ULONG window_posn = LZX(window_posn);
+ ULONG window_size = LZX(window_size);
+ ULONG R0 = LZX(R0);
+ ULONG R1 = LZX(R1);
+ ULONG R2 = LZX(R2);
+
+ register ULONG bitbuf;
+ register int bitsleft;
+ ULONG match_offset, i,j,k; /* ijk used in READ_HUFFSYM macro */
+ lzx_bits lb; /* used in READ_LENGTHS macro */
+
+ int togo = outlen, this_run, main_element, aligned_bits;
+ int match_length, length_footer, extra, verbatim_bits;
+
+ INIT_BITSTREAM;
+
+ /* read header if necessary */
+ if (!LZX(header_read))
+ {
+ i = j = 0;
+ READ_BITS(k, 1); if (k)
+ {
+ READ_BITS(i,16); READ_BITS(j,16);
+ }
+ LZX(intel_filesize) = (i << 16) | j; /* or 0 if not encoded */
+ LZX(header_read) = 1;
+ }
+
+ /* main decoding loop */
+ while (togo > 0)
+ {
+ /* last block finished, new block expected */
+ if (LZX(block_remaining) == 0)
+ {
+ if (LZX(block_type) == LZX_BLOCKTYPE_UNCOMPRESSED)
+ {
+ if (LZX(block_length) & 1) inpos++; /* realign bitstream to word */
+ INIT_BITSTREAM;
+ }
+
+ READ_BITS(LZX(block_type), 3);
+ READ_BITS(i, 16);
+ READ_BITS(j, 8);
+ LZX(block_remaining) = LZX(block_length) = (i << 8) | j;
+
+ switch (LZX(block_type))
+ {
+ case LZX_BLOCKTYPE_ALIGNED:
+ for (i = 0; i < 8; i++)
+ {
+ READ_BITS(j, 3); LENTABLE(ALIGNED)[i] = j;
+ }
+ BUILD_TABLE(ALIGNED);
+ /* rest of aligned header is same as verbatim */
+
+ case LZX_BLOCKTYPE_VERBATIM:
+ READ_LENGTHS(MAINTREE, 0, 256);
+ READ_LENGTHS(MAINTREE, 256, LZX(main_elements));
+ BUILD_TABLE(MAINTREE);
+ if (LENTABLE(MAINTREE)[0xE8] != 0) LZX(intel_started) = 1;
+
+ READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS);
+ BUILD_TABLE(LENGTH);
+ break;
+
+ case LZX_BLOCKTYPE_UNCOMPRESSED:
+ LZX(intel_started) = 1; /* because we can't assume otherwise */
+ ENSURE_BITS(16); /* get up to 16 pad bits into the buffer */
+ if (bitsleft > 16) inpos -= 2; /* and align the bitstream! */
+ R0 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
+ R1 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
+ R2 = inpos[0]|(inpos[1]<<8)|(inpos[2]<<16)|(inpos[3]<<24);inpos+=4;
+ break;
+
+ default:
+ return DECR_ILLEGALDATA;
+ }
+ }
+
+ /* buffer exhaustion check */
+ if (inpos > endinp)
+ {
+ /* it's possible to have a file where the next run is less than
+ * 16 bits in size. In this case, the READ_HUFFSYM() macro used
+ * in building the tables will exhaust the buffer, so we should
+ * allow for this, but not allow those accidentally read bits to
+ * be used (so we check that there are at least 16 bits
+ * remaining - in this boundary case they aren't really part of
+ * the compressed data)
+ */
+ if (inpos > (endinp+2) || bitsleft < 16) return DECR_ILLEGALDATA;
+ }
+
+ while ((this_run = LZX(block_remaining)) > 0 && togo > 0)
+ {
+ if (this_run > togo) this_run = togo;
+ togo -= this_run;
+ LZX(block_remaining) -= this_run;
+
+ /* apply 2^x-1 mask */
+ window_posn &= window_size - 1;
+ /* runs can't straddle the window wraparound */
+ if ((window_posn + this_run) > window_size)
+ return DECR_DATAFORMAT;
+
+ switch (LZX(block_type))
+ {
+
+ case LZX_BLOCKTYPE_VERBATIM:
+ while (this_run > 0)
+ {
+ READ_HUFFSYM(MAINTREE, main_element);
+
+ if (main_element < LZX_NUM_CHARS)
+ {
+ /* literal: 0 to LZX_NUM_CHARS-1 */
+ window[window_posn++] = main_element;
+ this_run--;
+ }
+ else
+ {
+ /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
+ main_element -= LZX_NUM_CHARS;
+
+ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
+ if (match_length == LZX_NUM_PRIMARY_LENGTHS)
+ {
+ READ_HUFFSYM(LENGTH, length_footer);
+ match_length += length_footer;
+ }
+ match_length += LZX_MIN_MATCH;
+
+ match_offset = main_element >> 3;
+
+ if (match_offset > 2)
+ {
+ /* not repeated offset */
+ if (match_offset != 3)
+ {
+ extra = extra_bits[match_offset];
+ READ_BITS(verbatim_bits, extra);
+ match_offset = position_base[match_offset] - 2 + verbatim_bits;
+ }
+ else
+ {
+ match_offset = 1;
+ }
+
+ /* update repeated offset LRU queue */
+ R2 = R1; R1 = R0; R0 = match_offset;
+ }
+ else if (match_offset == 0)
+ {
+ match_offset = R0;
+ }
+ else if (match_offset == 1)
+ {
+ match_offset = R1;
+ R1 = R0; R0 = match_offset;
+ }
+ else /* match_offset == 2 */
+ {
+ match_offset = R2;
+ R2 = R0; R0 = match_offset;
+ }
+
+ rundest = window + window_posn;
+ runsrc = rundest - match_offset;
+ window_posn += match_length;
+ this_run -= match_length;
+
+ /* copy any wrapped around source data */
+ while ((runsrc < window) && (match_length-- > 0))
+ {
+ *rundest++ = *(runsrc + window_size); runsrc++;
+ }
+ /* copy match data - no worries about destination wraps */
+ while (match_length-- > 0) *rundest++ = *runsrc++;
+
+ }
+ }
+ break;
+
+ case LZX_BLOCKTYPE_ALIGNED:
+ while (this_run > 0)
+ {
+ READ_HUFFSYM(MAINTREE, main_element);
+
+ if (main_element < LZX_NUM_CHARS)
+ {
+ /* literal: 0 to LZX_NUM_CHARS-1 */
+ window[window_posn++] = main_element;
+ this_run--;
+ }
+ else
+ {
+ /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */
+ main_element -= LZX_NUM_CHARS;
+
+ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS;
+ if (match_length == LZX_NUM_PRIMARY_LENGTHS)
+ {
+ READ_HUFFSYM(LENGTH, length_footer);
+ match_length += length_footer;
+ }
+ match_length += LZX_MIN_MATCH;
+
+ match_offset = main_element >> 3;
+
+ if (match_offset > 2)
+ {
+ /* not repeated offset */
+ extra = extra_bits[match_offset];
+ match_offset = position_base[match_offset] - 2;
+ if (extra > 3)
+ {
+ /* verbatim and aligned bits */
+ extra -= 3;
+ READ_BITS(verbatim_bits, extra);
+ match_offset += (verbatim_bits << 3);
+ READ_HUFFSYM(ALIGNED, aligned_bits);
+ match_offset += aligned_bits;
+ }
+ else if (extra == 3)
+ {
+ /* aligned bits only */
+ READ_HUFFSYM(ALIGNED, aligned_bits);
+ match_offset += aligned_bits;
+ }
+ else if (extra > 0)
+ { /* extra==1, extra==2 */
+ /* verbatim bits only */
+ READ_BITS(verbatim_bits, extra);
+ match_offset += verbatim_bits;
+ }
+ else /* extra == 0 */
+ {
+ /* ??? */
+ match_offset = 1;
+ }
+
+ /* update repeated offset LRU queue */
+ R2 = R1; R1 = R0; R0 = match_offset;
+ }
+ else if (match_offset == 0)
+ {
+ match_offset = R0;
+ }
+ else if (match_offset == 1)
+ {
+ match_offset = R1;
+ R1 = R0; R0 = match_offset;
+ }
+ else /* match_offset == 2 */
+ {
+ match_offset = R2;
+ R2 = R0; R0 = match_offset;
+ }
+
+ rundest = window + window_posn;
+ runsrc = rundest - match_offset;
+ window_posn += match_length;
+ this_run -= match_length;
+
+ /* copy any wrapped around source data */
+ while ((runsrc < window) && (match_length-- > 0))
+ {
+ *rundest++ = *(runsrc + window_size); runsrc++;
+ }
+ /* copy match data - no worries about destination wraps */
+ while (match_length-- > 0) *rundest++ = *runsrc++;
+
+ }
+ }
+ break;
+
+ case LZX_BLOCKTYPE_UNCOMPRESSED:
+ if ((inpos + this_run) > endinp) return DECR_ILLEGALDATA;
+ memcpy(window + window_posn, inpos, (size_t) this_run);
+ inpos += this_run; window_posn += this_run;
+ break;
+
+ default:
+ return DECR_ILLEGALDATA; /* might as well */
+ }
+
+ }
+ }
+
+ if (togo != 0) return DECR_ILLEGALDATA;
+ memcpy(outpos, window + ((!window_posn) ? window_size : window_posn) -
+ outlen, (size_t) outlen);
+
+ LZX(window_posn) = window_posn;
+ LZX(R0) = R0;
+ LZX(R1) = R1;
+ LZX(R2) = R2;
+
+ /* intel E8 decoding */
+ if ((LZX(frames_read)++ < 32768) && LZX(intel_filesize) != 0)
+ {
+ if (outlen <= 6 || !LZX(intel_started))
+ {
+ LZX(intel_curpos) += outlen;
+ }
+ else
+ {
+ UBYTE *data = outpos;
+ UBYTE *dataend = data + outlen - 10;
+ LONG curpos = LZX(intel_curpos);
+ LONG filesize = LZX(intel_filesize);
+ LONG abs_off, rel_off;
+
+ LZX(intel_curpos) = curpos + outlen;
+
+ while (data < dataend)
+ {
+ if (*data++ != 0xE8)
+ {
+ curpos++; continue;
+ }
+ abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24);
+ if ((abs_off >= -curpos) && (abs_off < filesize))
+ {
+ rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize;
+ data[0] = (UBYTE) rel_off;
+ data[1] = (UBYTE) (rel_off >> 8);
+ data[2] = (UBYTE) (rel_off >> 16);
+ data[3] = (UBYTE) (rel_off >> 24);
+ }
+ data += 4;
+ curpos += 5;
+ }
+ }
+ }
+ return DECR_OK;
+}
+
diff --git a/parts/documentation/protocols/chm/decompress.h b/parts/documentation/protocols/chm/decompress.h
new file mode 100644
index 00000000..4fa42615
--- /dev/null
+++ b/parts/documentation/protocols/chm/decompress.h
@@ -0,0 +1,43 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __decompress_h__
+#define __decompress_h__
+
+#ifdef __cplusplus__
+extern "C" {
+#endif
+
+typedef unsigned char UBYTE; /* 8 bits exactly */
+typedef unsigned short UWORD; /* 16 bits (or more) */
+typedef unsigned int ULONG; /* 32 bits (or more) */
+typedef signed int LONG; /* 32 bits (or more) */
+
+typedef struct lzx_bits
+{
+ ULONG bb;
+ int bl;
+ UBYTE *ip;
+} lzx_bits;
+
+int LZXinit( int window );
+int LZXdecompress( UBYTE *inpos, int inlen, UBYTE *outpos, int outlen );
+
+#ifdef __cplusplus__
+}
+#endif
+
+#endif // __decompress_h__
diff --git a/parts/documentation/protocols/chm/kchmpart.cpp b/parts/documentation/protocols/chm/kchmpart.cpp
new file mode 100644
index 00000000..b72602c3
--- /dev/null
+++ b/parts/documentation/protocols/chm/kchmpart.cpp
@@ -0,0 +1,123 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include "kchmpart.h"
+#include <qstring.h>
+
+#include <kinstance.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kaboutdata.h>
+
+extern "C"
+{
+ void* init_libkchmpart()
+ {
+ return new KChmPartFactory;
+ }
+}
+
+KInstance* KChmPartFactory::s_instance = 0L;
+KAboutData* KChmPartFactory::s_about = 0L;
+
+KChmPartFactory::KChmPartFactory( QObject* parent, const char* name )
+ : KParts::Factory( parent, name )
+{
+}
+
+KChmPartFactory::~KChmPartFactory()
+{
+ delete s_instance;
+ s_instance = 0L;
+ delete s_about;
+}
+
+KParts::Part* KChmPartFactory::createPartObject( QWidget *parentWidget, const char *, QObject *,
+ const char *name, const char *, const QStringList & )
+{
+ KChmPart* part = new KChmPart( parentWidget, name );
+ return part;
+}
+
+KInstance* KChmPartFactory::instance()
+{
+ if( !s_instance )
+ {
+ s_about = new KAboutData( "kchmpart",
+ I18N_NOOP( "KChm" ), "1.0pre" );
+ s_instance = new KInstance( s_about );
+ }
+ return s_instance;
+}
+
+
+KChmPart::KChmPart( QWidget * parent, const char * name )
+ : KDevHTMLPart( ), m_job(0)
+{
+ KInstance * instance = new KInstance( "kchmpart" );
+ setInstance( instance );
+ m_extension=new KParts::BrowserExtension(this);
+ setOptions(-1);
+}
+
+bool KChmPart::openURL( const KURL &url )
+{
+ KURL chmURL = url;
+ chmURL.setProtocol("ms-its");
+ chmURL.addPath("/");
+ return KDevHTMLPart::openURL(chmURL);
+}
+
+void KChmPart::slotDuplicate()
+{
+}
+
+void KChmPart::slotOpenInNewWindow(const KURL &url)
+{
+}
+
+
+/*
+bool KChmPart::openFile()
+{
+ if (m_job!=0)
+ m_job->kill();
+
+ m_htmlData.truncate(0);
+
+ m_job = KIO::get( QString("chm:")+m_file+"/", true, false );
+ connect( m_job, SIGNAL( data( KIO::Job *, const QByteArray &) ), SLOT( readData( KIO::Job *, const QByteArray &) ) );
+ connect( m_job, SIGNAL( result( KIO::Job * ) ), SLOT( jobDone( KIO::Job * ) ) );
+ return true;
+}
+
+void KChmPart::readData(KIO::Job * , const QByteArray & data)
+{
+ m_htmlData += data;
+}
+
+void KChmPart::jobDone( KIO::Job *)
+{
+ m_job=0;
+ begin();
+ write(QString::fromLocal8Bit(m_htmlData));
+ end();
+}
+*/
+#include "kchmpart.moc"
+
diff --git a/parts/documentation/protocols/chm/kchmpart.desktop b/parts/documentation/protocols/chm/kchmpart.desktop
new file mode 100644
index 00000000..1ddefe13
--- /dev/null
+++ b/parts/documentation/protocols/chm/kchmpart.desktop
@@ -0,0 +1,46 @@
+[Desktop Entry]
+Type=Service
+Exec=foobar
+Comment=Embeddable HTMLHelp Viewer
+Comment[ca]=Visor encastat de l'ajuda HTML
+Comment[da]=Indlejrbar HTMLHjælp-fremviser
+Comment[de]=Eingebetteter Betrachter für HTMLHelp
+Comment[el]=Ενσωματωμένος προβολέας HTMLHelp
+Comment[es]=Visor de ayuda HTML empotrable
+Comment[et]=Põimitav HTML-abifailide näitaja
+Comment[eu]=HTMLHelp ikustaile kapsulagarria
+Comment[fa]=مشاهده‌گر کمک قابل نهفتۀ زنگام
+Comment[fr]=Afficheur HTMLHelp intégrable
+Comment[ga]=Comhpháirt inleabaithe amharctha HTML
+Comment[gl]=Visor de HTMLHelp incrustable
+Comment[hi]=अंतर्निर्मित योग्य एचटीएमएल मदद प्रदर्शक
+Comment[hu]=Beágyazható HTML-es dokumentációnézegető
+Comment[it]=Visualizzatore integrabile per la guida HTML
+Comment[ja]=埋め込み可能な HTMLHelp ビューア
+Comment[ms]=Pelihat HTMLHelp Terbinadalam
+Comment[nds]=Inbettbor Kieker för HTMLHelp
+Comment[ne]=सम्मिलित गर्न मिल्ने HTMLHelp दृश्यकर्ता
+Comment[nl]=Ingebedde HTML Helpweergave
+Comment[pl]=Wbudowywalna przeglądarka pomocy w formacie HTML
+Comment[pt]=Visualizador de HTMLHelp Incorporado
+Comment[pt_BR]=Visualizador de Ajuda HTML Embutido
+Comment[ru]=Встроенный просмотр HTMLHelp
+Comment[sk]=Vložiteľný HTMLHelp prezerač
+Comment[sr]=Уградиви приказивач HTMLHelp-а
+Comment[sr@Latn]=Ugradivi prikazivač HTMLHelp-a
+Comment[sv]=Inbäddningsbar HTML-hjälpvisning
+Comment[ta]=HTML உதவி பார்வையாளரை உட்பொதி
+Comment[tg]=Намоиши ҳамвори HTMLHelp
+Comment[tr]=Gömülebilir HTMLHelp Görüntüleyicisi
+Comment[zh_CN]=嵌入的 HTML 帮助查看器
+Comment[zh_TW]=可嵌入 HTMLHelp 檢視器
+MimeType=application/chm
+Name=KChmPart
+Name[de]=CHM-Betrachter (KDevelop)
+Name[hi]=के-सीएचएम-पार्ट
+Name[nds]=Chm-Kieker (KDevelop)
+Name[pl]=Program KChm
+Name[sv]=Kchm-del
+ServiceTypes=KParts/ReadOnlyPart,Browser/View
+X-KDE-Library=libkchmpart
+X-KDevelop-Version=5
diff --git a/parts/documentation/protocols/chm/kchmpart.h b/parts/documentation/protocols/chm/kchmpart.h
new file mode 100644
index 00000000..03a12738
--- /dev/null
+++ b/parts/documentation/protocols/chm/kchmpart.h
@@ -0,0 +1,82 @@
+/* This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __kchmpart_h__
+#define __kchmpart_h__
+
+#include <kparts/factory.h>
+#include <kparts/part.h>
+#include <kparts/browserextension.h>
+#include <khtml_part.h>
+#include <kio/job.h>
+#include <kio/jobclasses.h>
+#include <kdevhtmlpart.h>
+
+#include <qcstring.h>
+
+class KInstance;
+class KAboutData;
+
+class KChmPartFactory: public KParts::Factory
+{
+ Q_OBJECT
+ public:
+ KChmPartFactory( QObject *parent = 0, const char *name = 0 );
+ virtual ~KChmPartFactory();
+
+ virtual KParts::Part* createPartObject(
+ QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name,
+ const char *classname, const QStringList &args );
+
+ static KInstance *instance();
+
+ private:
+ static KInstance *s_instance;
+ static KAboutData *s_about;
+
+};
+
+
+class KChmPart : public KDevHTMLPart
+{
+ Q_OBJECT
+ public:
+ KChmPart( QWidget *, const char * = 0 );
+ KParts::BrowserExtension * extension() { return m_extension; }
+
+ public slots:
+ virtual bool openURL( const KURL & );
+/*
+ protected slots:
+ void readData(KIO::Job * , const QByteArray & data);
+ void jobDone( KIO::Job *);
+*/
+ protected:
+ //virtual bool openFile();
+ KInstance *m_instance;
+ KParts::BrowserExtension *m_extension;
+ KIO::TransferJob *m_job;
+ QCString m_htmlData;
+
+ protected slots:
+ virtual void slotDuplicate();
+ virtual void slotOpenInNewWindow(const KURL &url);
+
+};
+
+#endif // __kchmpart_h__
+
diff --git a/parts/documentation/searchview.cpp b/parts/documentation/searchview.cpp
new file mode 100644
index 00000000..253e9f10
--- /dev/null
+++ b/parts/documentation/searchview.cpp
@@ -0,0 +1,330 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Matthias Hoelzer-Kluepfel *
+ * hoelzer@kde.org *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "searchview.h"
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qdir.h>
+#include <qregexp.h>
+
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+#include <klocale.h>
+#include <kdialog.h>
+#include <kprocess.h>
+#include <kapplication.h>
+#include <kstandarddirs.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+
+#include <kdevpartcontroller.h>
+#include <kdevdocumentationplugin.h>
+
+#include "documentation_part.h"
+#include "docutils.h"
+
+SearchView::SearchView(DocumentationPart *part, QWidget *parent, const char *name)
+ :QWidget(parent, name), m_part(part)
+{
+ QVBoxLayout *l = new QVBoxLayout(this, 0, KDialog::spacingHint());
+
+ QVBoxLayout *l2 = new QVBoxLayout(l, 0);
+ QLabel *editLabel = new QLabel(i18n("Wor&ds to search:"), this);
+ l2->addWidget(editLabel);
+ QHBoxLayout *l21 = new QHBoxLayout(l2, 0);
+ m_edit = new KLineEdit(this);
+ editLabel->setBuddy(m_edit);
+ m_goSearchButton = new KPushButton(i18n("Se&arch"), this);
+ l21->addWidget(m_edit);
+ l21->addWidget(m_goSearchButton);
+
+ QGridLayout *l3 = new QGridLayout(l, 2, 2, 0);
+ m_searchMethodBox = new KComboBox(this);
+ m_searchMethodBox->insertItem(i18n("and"));
+ m_searchMethodBox->insertItem(i18n("or"));
+ QLabel *smLabel = new QLabel(m_searchMethodBox, i18n("&Method:"), this);
+ m_sortMethodBox = new KComboBox(this);
+ m_sortMethodBox->insertItem(i18n("Score"));
+ m_sortMethodBox->insertItem(i18n("Title"));
+ m_sortMethodBox->insertItem(i18n("Date"));
+ QLabel *rmLabel = new QLabel(m_sortMethodBox, i18n("S&ort by:"), this);
+ l3->addWidget(smLabel, 0, 0);
+ l3->addWidget(m_searchMethodBox, 0, 1);
+ l3->addWidget(rmLabel, 1, 0);
+ l3->addWidget(m_sortMethodBox, 1, 1);
+
+ QVBoxLayout *l4 = new QVBoxLayout(l, 0);
+ m_view = new KListView(this);
+ QLabel *vLabel = new QLabel(m_view, i18n("Search &results:"), this);
+ l4->addWidget(vLabel);
+ l4->addWidget(m_view);
+
+ QHBoxLayout *l5 = new QHBoxLayout(l, KDialog::spacingHint());
+ m_configButton = new KPushButton(i18n("Update Config"), this);
+ m_indexButton = new KPushButton(i18n("Update Index"), this);
+ l5->addWidget(m_configButton);
+ l5->addWidget(m_indexButton);
+ l5->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Fixed));
+
+ l->addSpacing(2);
+
+ m_view->setSorting(-1);
+ m_view->addColumn(i18n("Relevance"));
+ m_view->addColumn(i18n("Title"));
+ m_view->setColumnWidthMode(0, QListView::Maximum);
+ m_view->setColumnWidthMode(1, QListView::Maximum);
+ m_view->setAllColumnsShowFocus(true);
+ m_view->setResizeMode( QListView::LastColumn );
+
+ connect(m_configButton, SIGNAL(clicked()), this, SLOT(updateConfig()));
+ connect(m_indexButton, SIGNAL(clicked()), this, SLOT(updateIndex()));
+ connect(m_edit, SIGNAL(returnPressed()), this, SLOT(search()));
+ connect(m_goSearchButton, SIGNAL(clicked()), this, SLOT(search()));
+ connect(m_view, SIGNAL(executed(QListViewItem*)), this, SLOT(executed(QListViewItem*)));
+ connect(m_view, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int )),
+ this, SLOT(itemMouseButtonPressed(int, QListViewItem*, const QPoint&, int )));
+}
+
+SearchView::~SearchView()
+{
+}
+
+void SearchView::updateConfig()
+{
+ runHtdig("-c");
+}
+
+void SearchView::updateIndex()
+{
+ runHtdig("-i");
+ KConfig *config = m_part->config();
+ config->setGroup("htdig");
+ config->writeEntry("IsSetup", true);
+ config->sync();
+}
+
+void SearchView::runHtdig(const QString &arg)
+{
+ KProcess proc;
+ proc << "kdevelop-htdig" << arg;
+ proc.start(KProcess::DontCare);
+}
+
+void qt_enter_modal(QWidget *widget);
+void qt_leave_modal(QWidget *widget);
+
+void SearchView::search()
+{
+ KConfig *config = m_part->config();
+ config->setGroup("htdig");
+ if (config->readBoolEntry("IsSetup", false) == false)
+ {
+ KMessageBox::information(this, i18n("Full text search has to be set up before usage."));
+ if (!m_part->configure(1))
+ return;
+ KMessageBox::information(this, i18n("Now the full text search database will be created.\nWait for database creation to finish and then repeat search."));
+ updateIndex();
+ return;
+ }
+ QString exe = config->readPathEntry("htsearchbin", kapp->dirs()->findExe("htsearch"));
+ if (exe.isEmpty())
+ {
+ KMessageBox::error(this, i18n("Cannot find the htsearch executable.\nIt is part of the ht://Dig package that is used by KDevelop to perform full text search. Please install ht://Dig and use Documentation page in Configure KDevelop dialog to set the htsearch location."));
+ kdDebug() << "Can not find htsearch" << endl;
+ return;
+ }
+
+ QString indexdir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
+ QDir d;
+ if (indexdir.isEmpty() || !QFile::exists(indexdir + "/htdig.conf"))
+ {
+ if (QFile::exists("/var/lib/kdevelop3/helpindex/htdig.conf"))
+ indexdir = "/var/lib/kdevelop3/helpindex";
+ else if (QFile::exists("/var/lib/kdevelop/helpindex/htdig.conf"))
+ indexdir = "/var/lib/kdevelop/helpindex";
+
+ if (!QFile::exists(indexdir + "/htdig.conf"))
+ {
+ KMessageBox::error(this, i18n("Cannot find the htdig configuration file."));
+ kdDebug() << "Cannot find the htdig configuration file" << endl;
+ return;
+ }
+ }
+
+ QString savedir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
+ if (!d.exists(savedir))
+ d.mkdir(savedir);
+
+ QString query = QString("words=%1;method=%2;matchesperpage=%3;format=%4;sort=%5")
+ .arg(m_edit->text())
+ .arg(m_searchMethodBox->currentItem()==1? "or" : "and")
+ .arg(50)
+ .arg("builtin-short")
+ .arg(m_sortMethodBox->currentItem()==2? "date" : m_sortMethodBox->currentItem()==1? "title" : "score");
+
+ kdDebug(9002) << "starting kprocess" << endl;
+ kdDebug(9002) << "htdig line:" << exe << " -c " << (indexdir + "/htdig.conf ") << query << endl;
+ KProcess *proc = new KProcess;
+ QString picdir = kapp->dirs()->findResourceDir("data", "kdevdocumentation/pics/htdig.png");
+ proc->setEnvironment("PICDIR", picdir);
+ *proc << exe << "-c" << (indexdir + "/htdig.conf") << query;
+
+ connect( proc, SIGNAL(receivedStdout(KProcess *,char*,int)),
+ this, SLOT(htsearchStdout(KProcess *,char*,int)) );
+ connect( proc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(htsearchExited(KProcess *)) );
+
+ searchResult = "";
+
+ if (!proc->start(KProcess::NotifyOnExit, KProcess::Stdout))
+ {
+ KMessageBox::error(this, i18n("Cannot start the htsearch executable."));
+ kdDebug() << "process start failed" << endl;
+ delete proc;
+ return;
+ }
+
+ // While receiving data from the subprocess, we want
+ // to block the user interface, but still get repaint
+ // events. Hack taken from NetAccess...
+ kapp->setOverrideCursor(waitCursor);
+ QWidget blocker(0, 0, WType_Dialog | WShowModal);
+ qt_enter_modal(&blocker);
+ kapp->enter_loop();
+ qt_leave_modal(&blocker);
+ kapp->restoreOverrideCursor();
+
+ if (!proc->normalExit() || proc->exitStatus() != 0)
+ {
+ kdDebug() << "Error running htsearch... returning now" << endl;
+ delete proc;
+ return;
+ }
+
+ delete proc;
+
+ // modify the search result
+ searchResult = searchResult.replace(QRegExp("http://localhost/"), "file:/");
+ searchResult = searchResult.replace(QRegExp("Content-type: text/html"), "");
+
+ // dump the search result
+ QFile f(savedir + "/results.html");
+ if (f.open(IO_WriteOnly))
+ {
+ QTextStream ts(&f);
+ ts << searchResult << endl;
+ f.close();
+ }
+
+ //show results
+ analyseSearchResults();
+// m_part->partController()->showDocument(KURL("file://" + indexdir + "/results.html"));
+}
+
+void SearchView::htsearchStdout(KProcess *, char *buffer, int len)
+{
+ searchResult += QString::fromLocal8Bit(buffer, len);
+}
+
+void SearchView::htsearchExited(KProcess *)
+{
+ kapp->exit_loop();
+}
+
+void SearchView::analyseSearchResults()
+{
+ m_view->clear();
+ QTextStream str(searchResult, IO_ReadOnly);
+ DocumentationItem *former = 0;
+ while (!str.eof())
+ {
+ QString line = str.readLine();
+
+ QRegExp starsExp("alt=\"\\*\"");
+ starsExp.setMinimal(true);
+ int stars = line.contains(starsExp);
+
+ QRegExp urlExp("<strong><a href=\"(.*)\">(.*)</a></strong>");
+ if (urlExp.search(line)==-1)
+ continue;
+ QString url = urlExp.cap(1);
+ QString title = urlExp.cap(2);
+
+ QString starsStr;
+ for (int i = 0; i < stars; ++i)
+ starsStr += "*";
+
+ if (former)
+ former = new DocumentationItem(DocumentationItem::Document, m_view, former, starsStr);
+ else
+ former = new DocumentationItem(DocumentationItem::Document, m_view, starsStr);
+ former->setText(1, title);
+ former->setURL(KURL(url));
+ }
+
+ executed( m_view->firstChild() );
+}
+
+void SearchView::executed(QListViewItem *item)
+{
+ DocumentationItem *d = dynamic_cast<DocumentationItem*>(item);
+ if (!d)
+ return;
+
+ m_part->partController()->showDocument(d->url());
+}
+
+void SearchView::itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int // c
+ )
+{
+ if ((button != Qt::RightButton) || (!item))
+ return;
+ DocumentationItem *docItem = dynamic_cast<DocumentationItem*>(item);
+ if (!docItem)
+ return;
+
+ DocUtils::docItemPopup(m_part, docItem, pos, true, false, 1);
+}
+
+void SearchView::setSearchTerm(const QString &term)
+{
+ m_edit->setText(term);
+}
+
+void SearchView::askSearchTerm()
+{
+ m_edit->setFocus();
+}
+
+void SearchView::focusInEvent(QFocusEvent */*e*/)
+{
+ m_edit->setFocus();
+}
+
+#include "searchview.moc"
diff --git a/parts/documentation/searchview.h b/parts/documentation/searchview.h
new file mode 100644
index 00000000..3d37fdfe
--- /dev/null
+++ b/parts/documentation/searchview.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef SEARCHVIEW_H
+#define SEARCHVIEW_H
+
+#include <qwidget.h>
+
+class DocumentationPart;
+class KLineEdit;
+class KComboBox;
+class KListView;
+class KPushButton;
+class KProcess;
+class QListViewItem;
+
+class SearchView: public QWidget
+{
+ Q_OBJECT
+public:
+ SearchView(DocumentationPart *part, QWidget *parent = 0, const char *name = 0);
+ ~SearchView();
+
+public slots:
+ void search();
+ void setSearchTerm(const QString &term);
+ void askSearchTerm();
+
+protected slots:
+ void updateConfig();
+ void updateIndex();
+
+ void htsearchStdout(KProcess *, char *buffer, int len);
+ void htsearchExited(KProcess *);
+ void executed(QListViewItem *item);
+
+ void itemMouseButtonPressed(int button, QListViewItem *item, const QPoint &pos, int c);
+
+protected:
+ virtual void focusInEvent(QFocusEvent *e);
+
+ void runHtdig(const QString &arg);
+ void analyseSearchResults();
+
+private:
+ DocumentationPart *m_part;
+
+ KLineEdit *m_edit;
+ KComboBox *m_searchMethodBox;
+ KComboBox *m_sortMethodBox;
+ KListView *m_view;
+ KPushButton *m_configButton;
+ KPushButton *m_indexButton;
+ KPushButton *m_goSearchButton;
+
+ QString searchResult;
+};
+
+#endif
diff --git a/parts/documentation/selecttopic.cpp b/parts/documentation/selecttopic.cpp
new file mode 100644
index 00000000..b0e64f4c
--- /dev/null
+++ b/parts/documentation/selecttopic.cpp
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "selecttopic.h"
+
+SelectTopic::SelectTopic(IndexItem::List &urls, QWidget *parent, const char *name)
+ :SelectTopicBase(parent, name), m_urls(urls)
+{
+ for (IndexItem::List::const_iterator it = m_urls.begin(); it != m_urls.end(); ++it)
+ topicBox->insertItem((*it).first);
+ if (topicBox->item(0))
+ {
+ topicBox->setCurrentItem(0);
+ topicBox->setSelected(topicBox->item(0), true);
+ }
+}
+
+void SelectTopic::accept()
+{
+ if (topicBox->currentItem() == -1)
+ return;
+ else
+ return QDialog::accept();
+}
+
+KURL SelectTopic::selectedURL()
+{
+ if (topicBox->currentItem() != -1)
+ return m_urls[topicBox->currentItem()].second;
+ return KURL();
+}
+
+#include "selecttopic.moc"
diff --git a/parts/documentation/selecttopic.h b/parts/documentation/selecttopic.h
new file mode 100644
index 00000000..1321bf99
--- /dev/null
+++ b/parts/documentation/selecttopic.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Alexander Dymo *
+ * adymo@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef SELECT_TOPIC_H
+#define SELECT_TOPIC_H
+
+#include "selecttopicbase.h"
+
+#include "kdevdocumentationplugin.h"
+
+class SelectTopic: public SelectTopicBase{
+Q_OBJECT
+public:
+ SelectTopic(IndexItem::List &urls, QWidget *parent = 0, const char *name = 0);
+ KURL selectedURL();
+
+public slots:
+ virtual void accept();
+
+private:
+ IndexItem::List m_urls;
+};
+
+#endif
diff --git a/parts/documentation/selecttopicbase.ui b/parts/documentation/selecttopicbase.ui
new file mode 100644
index 00000000..b363be2a
--- /dev/null
+++ b/parts/documentation/selecttopicbase.ui
@@ -0,0 +1,142 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>SelectTopicBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SelectTopicBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>429</width>
+ <height>211</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Choose Topic</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="2" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>topicLabel</cstring>
+ </property>
+ <property name="text">
+ <string>Choose a topic for &lt;b&gt;%1&lt;/b&gt;:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>listBox1</cstring>
+ </property>
+ </widget>
+ <widget class="QListBox" row="1" column="0">
+ <property name="name">
+ <cstring>topicBox</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>SelectTopicBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>SelectTopicBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>topicBox</sender>
+ <signal>doubleClicked(QListBoxItem*)</signal>
+ <receiver>SelectTopicBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>topicBox</sender>
+ <signal>returnPressed(QListBoxItem*)</signal>
+ <receiver>SelectTopicBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>topicBox</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<slots>
+ <slot>newSlot()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/documentation/tools/Makefile.am b/parts/documentation/tools/Makefile.am
new file mode 100644
index 00000000..c2344983
--- /dev/null
+++ b/parts/documentation/tools/Makefile.am
@@ -0,0 +1,3 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+METASOURCES = AUTO
+SUBDIRS = htdig
diff --git a/parts/documentation/tools/htdig/Makefile.am b/parts/documentation/tools/htdig/Makefile.am
new file mode 100644
index 00000000..8f38a799
--- /dev/null
+++ b/parts/documentation/tools/htdig/Makefile.am
@@ -0,0 +1,6 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+METASOURCES = AUTO
+bin_PROGRAMS = kdevelop-htdig
+kdevelop_htdig_LDFLAGS = $(all_libraries) $(LIB_KIO) $(LIB_KDEUI)
+kdevelop_htdig_SOURCES = htdigindex.cpp
+noinst_HEADERS = htdigindex.h
diff --git a/parts/documentation/tools/htdig/htdigindex.cpp b/parts/documentation/tools/htdig/htdigindex.cpp
new file mode 100644
index 00000000..80161301
--- /dev/null
+++ b/parts/documentation/tools/htdig/htdigindex.cpp
@@ -0,0 +1,491 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Matthias Hoelzer-Kluepfel *
+ * hoelzer@kde.org *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "htdigindex.h"
+
+#include <iostream>
+
+#include <qapplication.h>
+#include <qdir.h>
+#include <qfile.h>
+#include <qlayout.h>
+#include <qtextstream.h>
+#include <qtimer.h>
+#include <qlabel.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <kprocess.h>
+#include <kdeversion.h>
+#include <kprogress.h>
+
+#define INDEXER
+
+ProgressDialog::ProgressDialog(bool index, QWidget *parent, const char *name)
+ :KDialogBase(KDialogBase::Plain, i18n("Generating Search Index"), Cancel | Ok, Close,
+ parent, name, false)
+{
+ proc = 0;
+
+ indexdir = kapp->dirs()->saveLocation("data", "kdevdocumentation/search");
+ QDir d; d.mkdir(indexdir);
+
+ KConfig config("kdevdocumentation", true);
+ config.setGroup("htdig");
+ databaseDir = config.readPathEntry("databaseDir", indexdir);
+
+ if (!index)
+ return;
+
+ d.mkdir( databaseDir );
+
+ showButtonOK( false );
+ QGridLayout *grid = new QGridLayout(plainPage(), 5,3, spacingHint());
+
+ QLabel *l = new QLabel(i18n("Scanning for files"), plainPage());
+ grid->addMultiCellWidget(l, 0, 0, 1, 2);
+
+ filesLabel = new QLabel(plainPage());
+ grid->addWidget(filesLabel, 1, 2);
+ setFilesScanned(0);
+
+ check1 = new QLabel(plainPage());
+ grid->addWidget(check1, 0, 0);
+
+ l = new QLabel(i18n("Extracting search terms"), plainPage());
+ grid->addMultiCellWidget(l, 2,2, 1,2);
+
+ bar = new KProgress(plainPage());
+ grid->addWidget(bar, 3,2);
+
+ check2 = new QLabel(plainPage());
+ grid->addWidget(check2, 2,0);
+
+ l = new QLabel(i18n("Generating index..."), plainPage());
+ grid->addMultiCellWidget(l, 4,4, 1,2);
+
+ check3 = new QLabel(plainPage());
+ grid->addWidget(check3, 4,0);
+
+ setState(0);
+
+ setMinimumWidth(300);
+ connect(this, SIGNAL(cancelClicked()), this, SLOT(cancelClicked()));
+ connect(this, SIGNAL(okClicked()), this, SLOT(okClicked()));
+ QTimer::singleShot(0, this, SLOT(slotDelayedStart()));
+}
+
+ProgressDialog::~ProgressDialog()
+{
+}
+
+void ProgressDialog::slotDelayedStart()
+{
+ procdone = false;
+ scanDirectories();
+ if (!createConfig())
+ {
+ done(1);
+ return;
+ }
+ generateIndex();
+}
+
+void ProgressDialog::done(int r)
+{
+ if (!r)
+ {
+ showButtonCancel( false );
+ showButtonOK( true );
+ }
+ else
+ KDialogBase::done(r);
+}
+
+void ProgressDialog::setFilesScanned(int n)
+{
+ filesLabel->setText(i18n("Files processed: %1").arg(n));
+}
+
+void ProgressDialog::setFilesToDig(int n)
+{
+ bar->setTotalSteps(n);
+}
+
+void ProgressDialog::setFilesDigged(int n)
+{
+ bar->setValue(n);
+}
+
+void ProgressDialog::setState(int n)
+{
+ QPixmap unchecked = QPixmap(locate("data", "kdevdocumentation/pics/unchecked.xpm"));
+ QPixmap checked = QPixmap(locate("data", "kdevdocumentation/pics/checked.xpm"));
+
+ check1->setPixmap( n > 0 ? checked : unchecked);
+ check2->setPixmap( n > 1 ? checked : unchecked);
+ check3->setPixmap( n > 2 ? checked : unchecked);
+}
+
+
+void ProgressDialog::addDir(const QString &dir)
+{
+ kdDebug(9002) << "Add dir : " << dir << endl;
+ QDir d(dir, "*.html", QDir::Name|QDir::IgnoreCase, QDir::Files | QDir::Readable);
+ QStringList list = d.entryList();
+
+ QStringList::ConstIterator it;
+ for ( it=list.begin(); it!=list.end(); ++it )
+ {
+ if( (*it).right( 12 ).lower( ) == "-source.html" )
+ continue;
+
+ files.append(dir + "/" + *it);
+ setFilesScanned(++filesScanned);
+ }
+
+ QDir d2(dir, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Dirs);
+ QStringList dlist = d2.entryList();
+
+ for ( it=dlist.begin(); it != dlist.end(); ++it )
+ {
+ if (*it != "." && *it != "..")
+ {
+ addDir(dir + "/" + *it);
+ kapp->processEvents();
+ }
+ if (procdone)
+ {
+ return;
+ }
+ }
+ kapp->processEvents();
+}
+
+void ProgressDialog::scanDirectories()
+{
+ QString ftsLocationsFile = locateLocal("data", "kdevdocumentation/search/locations.txt");
+
+ QFile f(ftsLocationsFile);
+ if (!f.open(IO_ReadOnly))
+ return;
+ QTextStream str(&f);
+
+ filesScanned = 0;
+
+ while (!str.eof())
+ {
+ QString loc = str.readLine();
+ if (loc.isEmpty())
+ continue;
+ QFileInfo fi(loc);
+ if (fi.isDir())
+ addDir(loc);
+ else if (fi.isFile())
+ {
+ files.append(loc);
+ setFilesScanned(++filesScanned);
+ }
+ }
+}
+
+bool ProgressDialog::createConfig()
+{
+ // locate the common dir
+ QString language = KGlobal::locale()->language();
+ if (language == "C")
+ language = "en";
+
+ QString wrapper = locate("data", QString("kdevdocumentation/%1/wrapper.html").arg(language));
+ if (wrapper.isEmpty())
+ wrapper = locate("data", QString("kdevdocumentation/en/wrapper.html"));
+ if (wrapper.isEmpty())
+ return false;
+ wrapper = wrapper.left(wrapper.length()-12);
+
+ // locate the image dir
+ QString images = locate("data", "kdevdocumentation/pics/star.png");
+ if (images.isEmpty())
+ return false;
+ images = images.left(images.length()-8);
+
+ QFile f(indexdir + "/htdig.conf");
+ if (f.open(IO_WriteOnly))
+ {
+ QTextStream ts(&f);
+
+ ts << "database_dir:\t\t" << databaseDir << endl;
+ ts << "start_url:\t\t`" << indexdir << "/files`" << endl;
+ ts << "local_urls:\t\thttp://localhost/=/" << endl;
+// ts << "local_urls:\t\tfile://=" << endl;
+ ts << "local_urls_only:\ttrue" << endl;
+ ts << "limit_urls_to:\t\tfile:// http://localhost/" << endl;
+ ts << "maximum_pages:\t\t1" << endl;
+ ts << "image_url_prefix:\t" << images << endl;
+ ts << "star_image:\t\t" << images << "star.png" << endl;
+ ts << "star_blank:\t\t" << images << "star_blank.png" << endl;
+ ts << "compression_level:\t6" << endl;
+ ts << "max_hop_count:\t\t0" << endl;
+
+ ts << "search_results_wrapper:\t" << wrapper << "wrapper.html" << endl;
+ ts << "nothing_found_file:\t" << wrapper << "nomatch.html" << endl;
+ ts << "syntax_error_file:\t" << wrapper << "syntax.html" << endl;
+ ts << "bad_word_list:\t\t" << wrapper << "bad_words" << endl;
+
+ f.close();
+ return true;
+ }
+
+ return false;
+}
+
+#define CHUNK_SIZE 100
+
+void ProgressDialog::startHtdigProcess(bool initial)
+{
+ kdDebug(9002) << "htdig started" << endl;
+ delete proc;
+ proc = new KProcess();
+ *proc << exe << "-c" << (indexdir + "/htdig.conf");
+ if (initial) {
+ *proc << "-i";
+ }
+ connect(proc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(htdigExited(KProcess *)));
+
+ htdigRunning = true;
+
+ // write out file
+ QFile f(indexdir+"/files");
+ if (!f.open(IO_WriteOnly)) {
+ kdDebug(9002) << "Could not open `files` for writing" << endl;
+ done(1);
+ return;
+ }
+ QTextStream ts(&f);
+ for (int i=0; i<CHUNK_SIZE; ++i, ++count) {
+ if (count >= filesToDig) {
+ procdone = true;
+ break;
+ }
+ // ts << "file://localhost/" + files[count] << endl;
+ ts << "http://localhost/" + files[count] << endl;
+ }
+ f.close();
+
+ // execute htdig
+ proc->start(KProcess::NotifyOnExit, KProcess::Stdout);
+}
+
+bool ProgressDialog::generateIndex()
+{
+ setState(1);
+ procdone = false;
+ // run htdig
+ KConfig config("kdevdocumentation", true);
+ config.setGroup("htdig");
+ exe = config.readPathEntry("htdigbin", kapp->dirs()->findExe("htdig"));
+ if (exe.isEmpty())
+ {
+ done(1);
+ return true;
+ }
+ filesToDig = files.count();
+ count = 0;
+ setFilesToDig(filesToDig);
+ filesDigged = 0;
+
+ // QDir d; d.mkdir(indexdir);
+ startHtdigProcess(true);
+ return true;
+}
+
+void ProgressDialog::htdigStdout(KProcess *, char *buffer, int len)
+{
+ QString line = QString(buffer).left(len);
+
+ int cnt=0, index=-1;
+ while ( (index = line.find("http://", index+1)) > 0)
+ cnt++;
+ filesDigged += cnt;
+
+ cnt=0, index=-1;
+ while ( (index = line.find("not changed", index+1)) > 0)
+ cnt++;
+ filesDigged -= cnt;
+
+ setFilesDigged(filesDigged);
+}
+
+void ProgressDialog::htdigExited(KProcess *proc)
+{
+ kdDebug(9002) << "htdig terminated" << endl;
+ if (!proc->normalExit())
+ {
+ delete proc;
+ proc = 0L;
+ done(1);
+ return;
+ }
+ if (proc && proc->exitStatus() != 0)
+ {
+ KMessageBox::sorry(0, i18n("Running htdig failed"));
+ delete proc;
+ proc = 0L;
+ done(1);
+ return;
+ }
+ htdigRunning = false;
+ filesDigged += CHUNK_SIZE;
+ setFilesDigged(filesDigged);
+ if (!procdone)
+ {
+ startHtdigProcess(false);
+ }
+ else
+ {
+ setFilesDigged(filesToDig);
+ setState(2);
+
+ KConfig config("kdevdocumentation", true);
+ config.setGroup("htdig");
+ // run htmerge -----------------------------------------------------
+ exe = config.readPathEntry("htmergebin", kapp->dirs()->findExe("htmerge"));
+ if (exe.isEmpty())
+ {
+ done(1);
+ return;
+ }
+ startHtmergeProcess();
+ }
+}
+
+void ProgressDialog::startHtmergeProcess()
+{
+ kdDebug(9002) << "htmerge started" << endl;
+ delete proc;
+ proc = new KProcess();
+ *proc << exe << "-c" << (indexdir + "/htdig.conf");
+
+ kdDebug(9002) << "Running htmerge" << endl;
+
+ connect(proc, SIGNAL(processExited(KProcess *)),
+ this, SLOT(htmergeExited(KProcess *)));
+
+ htmergeRunning = true;
+
+ proc->start(KProcess::NotifyOnExit, KProcess::Stdout);
+}
+
+void ProgressDialog::htmergeExited(KProcess *proc)
+{
+ kdDebug(9002) << "htmerge terminated" << endl;
+ htmergeRunning = false;
+ if (!proc->normalExit())
+ {
+ delete proc;
+ proc = 0L;
+ done(1);
+ return;
+ }
+ if (proc && proc->exitStatus() != 0)
+ {
+ KMessageBox::sorry(0, i18n("Running htmerge failed"));
+ delete proc;
+ proc = 0L;
+ done(1);
+ return;
+ }
+ setState(3);
+ done(0);
+}
+
+void ProgressDialog::cancelClicked()
+{
+ if ((htdigRunning || htmergeRunning) && proc && proc->isRunning())
+ {
+ kdDebug(9002) << "Killing " << (htdigRunning ? "htdig" : "htmerge") << "daemon with Sig. 9" << endl;
+ proc->kill(9);
+ htdigRunning = htmergeRunning = false;
+ }
+ else
+ {
+ procdone = true;
+ done(2);
+ }
+}
+
+void ProgressDialog::okClicked()
+{
+ if (proc)
+ proc->kill();
+
+ KDialogBase::done(0);
+}
+
+int main(int argc, char *argv[])
+{
+ static const KCmdLineOptions options[] =
+ {
+ { "c", I18N_NOOP( "Update user's htdig configuration file only" ), 0 },
+ { "i", I18N_NOOP( "-c and generate index" ), 0 },
+ KCmdLineLastOption
+ };
+
+ KAboutData aboutData("kdevelop-htdig", I18N_NOOP("KDevelop ht://Dig Indexer"),
+ "0.2", I18N_NOOP("KDE Index generator for documentation files."));
+
+ KCmdLineArgs::init(argc, argv, &aboutData);
+ KCmdLineArgs::addCmdLineOptions(options);
+
+ KApplication app;
+
+ KGlobal::locale()->setMainCatalogue("kdevelop");
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ if (args->isSet("c"))
+ {
+ ProgressDialog *search = new ProgressDialog( false, 0, "progress dialog");
+
+ if (search->createConfig())
+ KMessageBox::information(0, i18n("Configuration file updated."));
+ else
+ KMessageBox::error(0, i18n("Configuration file update failed."));
+ }
+ else
+ if (args->isSet("i"))
+ {
+ ProgressDialog *search = new ProgressDialog(true, 0, "progress dialog");
+ app.setMainWidget(search);
+ search->show();
+ app.exec();
+ }
+ else
+ {
+ std::cerr << "Internal error generating index - unknown argument\n" << std::endl;
+ return 1;
+ }
+
+ return 0;
+}
+
+#include "htdigindex.moc"
diff --git a/parts/documentation/tools/htdig/htdigindex.h b/parts/documentation/tools/htdig/htdigindex.h
new file mode 100644
index 00000000..eec8b595
--- /dev/null
+++ b/parts/documentation/tools/htdig/htdigindex.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Matthias Hoelzer-Kluepfel *
+ * hoelzer@kde.org *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2004 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#ifndef _HTDIGINDEX_H_
+#define _HTDIGINDEX_H_
+
+#include <kdialogbase.h>
+
+class QTimer;
+class QLabel;
+class KProcess;
+class KProgress;
+
+class ProgressDialog : public KDialogBase
+{
+ Q_OBJECT
+public:
+ ProgressDialog(bool index, QWidget *parent=0, const char *name=0);
+ ~ProgressDialog();
+
+ void addDir(const QString &dir);
+ void scanDirectories();
+ bool createConfig();
+ bool generateIndex();
+
+private slots:
+ void htdigStdout(KProcess *proc, char *buffer, int buflen);
+ void htdigExited(KProcess *proc);
+ void htmergeExited(KProcess *proc);
+ void cancelClicked();
+ void okClicked();
+ void slotDelayedStart();
+
+private:
+ void setFilesScanned(int s);
+ void setFilesToDig(int d);
+ void setFilesDigged(int d);
+ void setState(int n);
+ void done(int r);
+ void startHtdigProcess(bool initial);
+ void startHtmergeProcess();
+
+ QLabel *filesLabel, *check1, *check2, *check3;
+ KProgress *bar;
+
+ int count;
+ bool procdone;
+ QString databaseDir;
+ QString indexdir;
+ QString exe;
+ QStringList files;
+ KProcess *proc;
+ volatile int filesToDig, filesDigged, filesScanned;
+ bool htdigRunning, htmergeRunning;
+};
+
+#endif
diff --git a/parts/doxygen/Makefile.am b/parts/doxygen/Makefile.am
new file mode 100644
index 00000000..8682a63d
--- /dev/null
+++ b/parts/doxygen/Makefile.am
@@ -0,0 +1,19 @@
+# Here resides the doxygen part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/src -DDOXYWIZARD \
+ $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevdoxygen.la
+libkdevdoxygen_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevdoxygen_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevdoxygen_la_SOURCES = doxygenpart.cpp doxygenconfigwidget.cpp input.cpp config.cpp version.cpp messages.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevdoxygen.desktop
+
+rcdir = $(kde_datadir)/kdevdoxygen
+rc_DATA = kdevdoxygen.rc
diff --git a/parts/doxygen/README b/parts/doxygen/README
new file mode 100644
index 00000000..335789a8
--- /dev/null
+++ b/parts/doxygen/README
@@ -0,0 +1 @@
+Please read the README.dox file
diff --git a/parts/doxygen/README.dox b/parts/doxygen/README.dox
new file mode 100644
index 00000000..df791085
--- /dev/null
+++ b/parts/doxygen/README.dox
@@ -0,0 +1,75 @@
+/**
+\class DoxygenPart
+Integrates Doxygen - http://www.doxygen.org into KDevelop.
+It allows you to call the Doxygen executable from a KDevelop menu.
+It integrates a GUI into the "KDevelop Project Configuration dialog" to
+configure Doxygen (it reads and writes Doxygen Compatible configuration files).
+
+<b>To update to a newer doxygen version:</b>
+
+ -# Merge over the config.h and config.cpp files from the addon/doxywizard/
+ directory in the doxygen sources.
+ You'll need:
+ - GNU bison v1.34 or better
+ - GNU flex v2.5.4 or better
+ - Kompare from KDEsdk or kdiff3
+ .
+ You'll have to issue:
+ <code>\verbatim$ ./configure --with-doxywizard && make\endverbatim</code>
+ to get the config.h and config.cpp files on this directory.
+ You should also copy config.l if you'd like to do some debugging.
+ <br>
+ -# To do the merge on config.cpp you should use:
+ <code>\verbatim$ kdiff3 doxygen-location/src/config.cpp kdevelop-location/parts/doxygen/config.cpp\endverbatim</code>
+ - Be careful because doxygen uses the deprecated QList class while KDevelop
+ uses the new QPtrList so you should not merge certain lines of code!!!
+ - Be careful because doxygen uses the deprecated QRegExp::match() method while
+ KDevelop uses the new QRegExp::search() and QRegExp::matchedLength() mehtods
+ instead so you should not merge certain lines of code!!!
+ - Be careful because KDevlop uses the QFile::encodeName() function and the
+ original doxygen code doesn't. So do NOT delete the QFile::encodeName() calls.
+ .
+ <br>
+ -# To do the merge on config.h you should use:
+ <code>\verbatim$ kdiff3 doxygen-location/src/config.h kdevelop-location/parts/doxygen/config.h\endverbatim</code>
+ - Again, be careful because doxygen uses the deprecated QList class while KDevelop
+ uses the new QPtrList so you should not merge certain lines of code!!!
+ .
+ <br>
+ .
+ -# Copy over the file <code>doxygen-location/src/lang_cfg.h</code> to the <code>kdevelop-location/parts/doxygen/</code> directory.
+ -# Add the new i18n strings to messages.cpp.
+ To do so, run KDevelop and go to Project-> Project Options... -> Doxygen.
+ Take a look at KDevelop' console output, it will warn you about the missing
+ messages. Add them to messages.cpp file.
+ -# Update version.cpp
+ -# Add anything else you needed to do, to get it to compile, to the parts/doxygen/README.dox file.
+
+Everything else we can customize for our look & feel.
+
+\authors <a href="mailto:dimitri AT stack.nl">Dimitri van Heesch</a>
+
+\maintainer <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+\maintainer <a href="mailto:a.lucas at tu-bs dot de">Amilcar Lucas</a>
+
+
+\feature Call Doxygen executable from a KDevelop menu.
+\feature Configure Doxygen inside KDevelop.
+\feature Create a configuration file with correct ProjectName, Author, Version and
+ location of source files whenever a new KDevelop project is created.
+\feature Automaticaly generate a Doxygen search database whenever the "search engine" option in Doxygen configuration is activated and you "Run Doxygen".
+
+
+\requirement You need to install the <a href="http://www.doxygen.org">Doxygen</a> binaries in your machine. This part supports
+all versions up to the version stated on the version.cpp file. As usual it is
+recomended to use the latest version or at least >= 1.3.4.
+\requirement It is recomended that you also install <a href="http://www.graphviz.org">dot</a> >= 1.8.7 (tool to generate graphical
+dependencies).
+
+
+\bug doesn't resize the configuration GUI properly.
+
+
+\faq <b>Do I need to install Doxygen?</b>
+ Yes
+*/
diff --git a/parts/doxygen/config.cpp b/parts/doxygen/config.cpp
new file mode 100644
index 00000000..a36cf682
--- /dev/null
+++ b/parts/doxygen/config.cpp
@@ -0,0 +1,5166 @@
+const char *portable_commandExtension()
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ return ".exe";
+#else
+ return "";
+#endif
+}
+
+bool portable_fileSystemIsCaseSensitive()
+{
+#if defined(_WIN32) || defined(macintosh) || defined(__MACOSX__) || defined(__APPLE__)
+ return false;
+#else
+ return true;
+#endif
+}
+
+#define yy_create_buffer configYY_create_buffer
+#define yy_delete_buffer configYY_delete_buffer
+#define yy_scan_buffer configYY_scan_buffer
+#define yy_scan_string configYY_scan_string
+#define yy_scan_bytes configYY_scan_bytes
+#define yy_flex_debug configYY_flex_debug
+#define yy_init_buffer configYY_init_buffer
+#define yy_flush_buffer configYY_flush_buffer
+#define yy_load_buffer_state configYY_load_buffer_state
+#define yy_switch_to_buffer configYY_switch_to_buffer
+#define yyin configYYin
+#define yyleng configYYleng
+#define yylex configYYlex
+#define yyout configYYout
+#define yyrestart configYYrestart
+#define yytext configYYtext
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ *yy_cp = yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+
+#define yywrap() 1
+#define YY_SKIP_YYWRAP
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 24
+#define YY_END_OF_BUFFER 25
+static yyconst short int yy_accept[100] =
+ { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 25, 22, 23, 22, 22, 2, 8, 22, 8, 19,
+ 22, 9, 13, 12, 2, 12, 12, 17, 18, 11,
+ 10, 18, 18, 16, 14, 14, 16, 16, 7, 22,
+ 7, 7, 0, 21, 0, 8, 0, 0, 0, 8,
+ 3, 0, 20, 12, 12, 17, 18, 11, 18, 15,
+ 7, 0, 7, 0, 0, 4, 12, 18, 7, 7,
+ 1, 0, 1, 1, 1, 0, 0, 0, 0, 0,
+ 6, 0, 0, 0, 0, 0, 0, 5, 0
+
+ } ;
+
+static yyconst int yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 5, 6, 1, 1, 1, 1, 1,
+ 1, 1, 7, 1, 1, 1, 1, 8, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 1, 1, 1,
+ 10, 1, 1, 11, 12, 13, 14, 15, 16, 13,
+ 13, 17, 18, 13, 13, 19, 13, 20, 13, 21,
+ 13, 13, 13, 22, 23, 13, 13, 13, 13, 13,
+ 1, 24, 1, 1, 25, 1, 13, 13, 13, 26,
+
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 27,
+ 13, 13, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst int yy_meta[29] =
+ { 0,
+ 1, 2, 3, 4, 3, 5, 6, 7, 7, 6,
+ 1, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 1, 7, 8, 8, 1
+ } ;
+
+static yyconst short int yy_base[112] =
+ { 0,
+ 0, 1, 29, 0, 55, 56, 82, 108, 135, 162,
+ 190, 0, 217, 244, 58, 65, 66, 68, 271, 298,
+ 145, 408, 408, 3, 117, 408, 0, 125, 6, 408,
+ 7, 408, 408, 0, 0, 15, 115, 0, 0, 133,
+ 408, 18, 107, 408, 408, 408, 62, 106, 0, 0,
+ 70, 104, 73, 408, 122, 0, 109, 93, 118, 95,
+ 408, 105, 408, 0, 118, 0, 0, 123, 116, 408,
+ 0, 117, 113, 94, 105, 408, 92, 91, 408, 90,
+ 408, 82, 0, 0, 0, 75, 66, 62, 102, 13,
+ 408, 41, 48, 5, 9, 89, 113, 408, 408, 326,
+
+ 334, 342, 350, 358, 360, 367, 375, 4, 383, 391,
+ 399
+ } ;
+
+static yyconst short int yy_def[112] =
+ { 0,
+ 100, 100, 99, 3, 100, 100, 100, 100, 101, 101,
+ 99, 11, 102, 102, 103, 103, 100, 100, 104, 104,
+ 99, 99, 99, 99, 99, 99, 105, 99, 106, 99,
+ 99, 99, 99, 107, 107, 107, 107, 108, 109, 99,
+ 99, 109, 109, 99, 99, 99, 99, 99, 110, 111,
+ 110, 110, 99, 99, 99, 105, 99, 99, 99, 106,
+ 99, 99, 99, 107, 107, 108, 109, 99, 109, 99,
+ 110, 111, 110, 99, 99, 99, 107, 109, 99, 110,
+ 99, 99, 107, 109, 110, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 0, 99,
+
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99
+ } ;
+
+static yyconst short int yy_nxt[437] =
+ { 0,
+ 99, 99, 23, 23, 53, 54, 53, 58, 62, 63,
+ 62, 66, 59, 99, 90, 61, 53, 54, 53, 53,
+ 54, 53, 91, 24, 24, 96, 95, 25, 25, 22,
+ 22, 23, 22, 22, 26, 22, 27, 27, 22, 28,
+ 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 24, 29, 29, 29, 25, 30, 30, 94,
+ 45, 93, 46, 53, 54, 53, 70, 45, 23, 46,
+ 23, 53, 54, 53, 53, 54, 53, 89, 31, 31,
+ 88, 47, 25, 25, 32, 48, 33, 26, 47, 24,
+ 97, 24, 48, 25, 58, 25, 58, 87, 98, 59,
+
+ 86, 59, 61, 90, 61, 24, 62, 63, 62, 25,
+ 32, 91, 33, 26, 97, 85, 84, 83, 82, 81,
+ 80, 79, 98, 78, 68, 77, 92, 76, 75, 74,
+ 73, 24, 55, 69, 68, 25, 22, 32, 22, 33,
+ 35, 65, 57, 55, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 36, 99,
+ 99, 99, 37, 22, 32, 22, 33, 35, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 36, 99, 99, 99, 37,
+ 22, 22, 32, 22, 22, 26, 22, 22, 22, 22,
+
+ 22, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+ 38, 38, 38, 24, 22, 38, 38, 25, 40, 41,
+ 22, 33, 26, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 42, 99, 99, 99, 43, 40, 41, 22, 33, 26,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 42, 99, 99,
+ 99, 43, 22, 23, 22, 50, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 51, 99, 99, 99, 52, 22,
+
+ 23, 22, 50, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 51, 99, 99, 99, 52, 22, 22, 22, 22,
+ 22, 22, 22, 22, 34, 34, 34, 34, 34, 34,
+ 34, 34, 39, 39, 39, 39, 39, 39, 39, 39,
+ 44, 44, 44, 44, 44, 44, 44, 44, 49, 49,
+ 49, 49, 49, 49, 49, 49, 56, 56, 60, 99,
+ 99, 99, 60, 60, 60, 64, 99, 99, 99, 64,
+ 64, 64, 64, 67, 99, 99, 99, 99, 67, 67,
+ 67, 71, 99, 99, 99, 71, 71, 71, 71, 72,
+
+ 72, 99, 72, 72, 72, 72, 72, 21, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99
+ } ;
+
+static yyconst short int yy_chk[437] =
+ { 0,
+ 0, 0, 1, 2, 24, 24, 24, 29, 31, 31,
+ 31, 108, 29, 0, 90, 29, 36, 36, 36, 42,
+ 42, 42, 90, 1, 2, 95, 94, 1, 2, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 5, 6, 93,
+ 15, 92, 15, 47, 47, 47, 47, 16, 17, 16,
+ 18, 51, 51, 51, 53, 53, 53, 88, 5, 6,
+ 87, 15, 5, 6, 7, 15, 7, 7, 16, 17,
+ 96, 18, 16, 17, 58, 18, 60, 86, 96, 58,
+
+ 82, 60, 58, 89, 60, 7, 62, 62, 62, 7,
+ 8, 89, 8, 8, 97, 80, 78, 77, 75, 74,
+ 73, 72, 97, 69, 68, 65, 89, 59, 57, 55,
+ 52, 8, 48, 43, 40, 8, 9, 9, 9, 9,
+ 9, 37, 28, 25, 21, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 9, 0,
+ 0, 0, 9, 10, 10, 10, 10, 10, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 10, 0, 0, 0, 10,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 13, 13,
+ 13, 13, 13, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 13, 0, 0, 0, 13, 14, 14, 14, 14, 14,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 14, 0, 0,
+ 0, 14, 19, 19, 19, 19, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 19, 0, 0, 0, 19, 20,
+
+ 20, 20, 20, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 20, 0, 0, 0, 20, 100, 100, 100, 100,
+ 100, 100, 100, 100, 101, 101, 101, 101, 101, 101,
+ 101, 101, 102, 102, 102, 102, 102, 102, 102, 102,
+ 103, 103, 103, 103, 103, 103, 103, 103, 104, 104,
+ 104, 104, 104, 104, 104, 104, 105, 105, 106, 0,
+ 0, 0, 106, 106, 106, 107, 0, 0, 0, 107,
+ 107, 107, 107, 109, 0, 0, 0, 0, 109, 109,
+ 109, 110, 0, 0, 0, 110, 110, 110, 110, 111,
+
+ 111, 0, 111, 111, 111, 111, 111, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "config.l"
+#define INITIAL 0
+/******************************************************************************
+ *
+ *
+ *
+ * Copyright (C) 1997-2006 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+#line 16 "config.l"
+
+/*
+ * includes
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <qfileinfo.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qtextstream.h>
+#include <qregexp.h>
+#include <qptrstack.h>
+
+#include "config.h"
+#include "version.h"
+
+#include "lang_cfg.h"
+
+#undef Config_getString
+#undef Config_getInt
+#undef Config_getList
+#undef Config_getEnum
+#undef Config_getBool
+
+// use in-class definitions
+#define Config_getString(val) getString(__FILE__,__LINE__,val)
+#define Config_getInt(val) getInt(__FILE__,__LINE__,val)
+#define Config_getList(val) getList(__FILE__,__LINE__,val)
+#define Config_getEnum(val) getEnum(__FILE__,__LINE__,val)
+#define Config_getBool(val) getBool(__FILE__,__LINE__,val)
+
+void config_err(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+void config_warn(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+}
+
+#define MAX_INCLUDE_DEPTH 10
+#define YY_NEVER_INTERACTIVE 1
+
+/* -----------------------------------------------------------------
+ */
+
+QCString ConfigOption::convertToComment(const QCString &s)
+{
+ QCString result;
+ if (s.isEmpty()) return result;
+ else
+ {
+ result+="# ";
+ QCString tmp=s.stripWhiteSpace();
+ char *p=tmp.data();
+ char c;
+ while ((c=*p++))
+ {
+ if (c=='\n') result+="\n# ";
+ else result+=c;
+ }
+ result+='\n';
+ }
+ return result;
+}
+
+void ConfigOption::writeBoolValue(QTextStream &t,bool v)
+{
+ if (v) t << "YES"; else t << "NO";
+}
+
+void ConfigOption::writeIntValue(QTextStream &t,int i)
+{
+ t << i;
+}
+
+void ConfigOption::writeStringValue(QTextStream &t,QCString &s)
+{
+ const char *p=s.data();
+ char c;
+ bool needsEscaping=FALSE;
+ if (p)
+ {
+ while ((c=*p++)!=0 && !needsEscaping)
+ needsEscaping = (c==' ' || c=='\n' || c=='\t' || c=='"' || c=='#');
+ if (needsEscaping)
+ {
+ t << "\"";
+ p=s.data();
+ while (*p)
+ {
+ if (*p=='"') t << "\\"; // escape quotes
+ t << *p++;
+ }
+ t << "\"";
+ }
+ else
+ {
+ t << s;
+ }
+ }
+}
+
+void ConfigOption::writeStringList(QTextStream &t,QStrList &l)
+{
+ const char *p = l.first();
+ bool first=TRUE;
+ while (p)
+ {
+ QCString s=p;
+ if (!first) t << " ";
+ first=FALSE;
+ writeStringValue(t,s);
+ p = l.next();
+ if (p) t << " \\" << endl;
+ }
+}
+
+/* -----------------------------------------------------------------
+ */
+
+Config *Config::m_instance = 0;
+
+void ConfigInt::convertStrToVal()
+{
+ if (!m_valueString.isEmpty())
+ {
+ bool ok;
+ int val = m_valueString.toInt(&ok);
+ if (!ok || val<m_minVal || val>m_maxVal)
+ {
+ config_warn("Warning: argument `%s' for option %s is not a valid number in the range [%d..%d]!\n"
+ "Using the default: %d!\n",m_valueString.data(),m_name.data(),m_minVal,m_maxVal,m_value);
+ }
+ m_value=val;
+ }
+}
+
+void ConfigBool::convertStrToVal()
+{
+ QCString val = m_valueString.stripWhiteSpace().lower();
+ if (!val.isEmpty())
+ {
+ if (val=="yes" || val=="true" || val=="1")
+ {
+ m_value=TRUE;
+ }
+ else if (val=="no" || val=="false" || val=="0")
+ {
+ m_value=FALSE;
+ }
+ else
+ {
+ config_warn("Warning: argument `%s' for option %s is not a valid boolean value\n"
+ "Using the default: %s!\n",m_valueString.data(),m_name.data(),m_value?"YES":"NO");
+ }
+ }
+}
+
+QCString &Config::getString(const char *fileName,int num,const char *name) const
+{
+ ConfigOption *opt = m_dict->find(name);
+ if (opt==0)
+ {
+ config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name);
+ exit(1);
+ }
+ else if (opt->kind()!=ConfigOption::O_String)
+ {
+ config_err("%s<%d>: Internal error: Requested option %s not of string type!\n",fileName,num,name);
+ exit(1);
+ }
+ return *((ConfigString *)opt)->valueRef();
+}
+
+QStrList &Config::getList(const char *fileName,int num,const char *name) const
+{
+ ConfigOption *opt = m_dict->find(name);
+ if (opt==0)
+ {
+ config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name);
+ exit(1);
+ }
+ else if (opt->kind()!=ConfigOption::O_List)
+ {
+ config_err("%d<%d>: Internal error: Requested option %s not of list type!\n",fileName,num,name);
+ exit(1);
+ }
+ return *((ConfigList *)opt)->valueRef();
+}
+
+QCString &Config::getEnum(const char *fileName,int num,const char *name) const
+{
+ ConfigOption *opt = m_dict->find(name);
+ if (opt==0)
+ {
+ config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name);
+ exit(1);
+ }
+ else if (opt->kind()!=ConfigOption::O_Enum)
+ {
+ config_err("%s<%d>: Internal error: Requested option %s not of enum type!\n",fileName,num,name);
+ exit(1);
+ }
+ return *((ConfigEnum *)opt)->valueRef();
+}
+
+int &Config::getInt(const char *fileName,int num,const char *name) const
+{
+ ConfigOption *opt = m_dict->find(name);
+ if (opt==0)
+ {
+ config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name);
+ exit(1);
+ }
+ else if (opt->kind()!=ConfigOption::O_Int)
+ {
+ config_err("%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name);
+ exit(1);
+ }
+ return *((ConfigInt *)opt)->valueRef();
+}
+
+bool &Config::getBool(const char *fileName,int num,const char *name) const
+{
+ ConfigOption *opt = m_dict->find(name);
+ if (opt==0)
+ {
+ config_err("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name);
+ exit(1);
+ }
+ else if (opt->kind()!=ConfigOption::O_Bool)
+ {
+ config_err("%s<%d>: Internal error: Requested option %s not of integer type!\n",fileName,num,name);
+ exit(1);
+ }
+ return *((ConfigBool *)opt)->valueRef();
+}
+
+/* -----------------------------------------------------------------
+ *
+ * static variables
+ */
+
+struct ConfigFileState
+{
+ int lineNr;
+ FILE *filePtr;
+ YY_BUFFER_STATE oldState;
+ YY_BUFFER_STATE newState;
+ QCString fileName;
+};
+
+static const char *inputString;
+static int inputPosition;
+static int yyLineNr;
+static QCString yyFileName;
+static QCString tmpString;
+static QCString *s=0;
+static bool *b=0;
+static QStrList *l=0;
+static int lastState;
+static QCString elemStr;
+static QCString includeName;
+static QStrList includePathList;
+static QPtrStack<ConfigFileState> includeStack;
+static int includeDepth;
+
+static QCString tabSizeString;
+static QCString maxInitLinesString;
+static QCString colsInAlphaIndexString;
+static QCString enumValuesPerLineString;
+static QCString treeViewWidthString;
+static QCString maxDotGraphWidthString;
+static QCString maxDotGraphHeightString;
+
+static Config *config;
+
+/* -----------------------------------------------------------------
+ */
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
+
+static int yyread(char *buf,int max_size)
+{
+ // no file included
+ if (includeStack.isEmpty())
+ {
+ int c=0;
+ if (inputString==0) return c;
+ while( c < max_size && inputString[inputPosition] )
+ {
+ *buf = inputString[inputPosition++] ;
+ c++; buf++;
+ }
+ return c;
+ }
+ else
+ {
+ //assert(includeStack.current()->newState==YY_CURRENT_BUFFER);
+ return (int)fread(buf,1,max_size,includeStack.current()->filePtr);
+ }
+}
+
+
+static FILE *tryPath(const char *path,const char *fileName)
+{
+ QCString absName=(path ? (QCString)path+"/"+fileName : (QCString)fileName);
+ QFileInfo fi(absName);
+ if (fi.exists() && fi.isFile())
+ {
+ FILE *f=fopen(absName,"r");
+ if (!f) config_err("Error: could not open file %s for reading\n",absName.data());
+ return f;
+ }
+ return 0;
+}
+
+static void substEnvVarsInStrList(QStrList &sl);
+static void substEnvVarsInString(QCString &s);
+
+static bool isAbsolute(const char * fileName)
+{
+# ifdef _WIN32
+ if (isalpha (fileName [0]) && fileName[1] == ':')
+ fileName += 2;
+# endif
+ char const fst = fileName [0];
+ if (fst == '/') {
+ return true;
+ }
+# ifdef _WIN32
+ if (fst == '\\')
+ return true;
+# endif
+ return false;
+}
+
+static FILE *findFile(const char *fileName)
+{
+ if(isAbsolute(fileName))
+ return tryPath(NULL, fileName);
+ substEnvVarsInStrList(includePathList);
+ char *s=includePathList.first();
+ while (s) // try each of the include paths
+ {
+ FILE *f = tryPath(s,fileName);
+ if (f) return f;
+ s=includePathList.next();
+ }
+ // try cwd if includePathList fails
+ return tryPath(".",fileName);
+}
+
+static void readIncludeFile(const char *incName)
+{
+ if (includeDepth==MAX_INCLUDE_DEPTH) {
+ config_err("Error: maximum include depth (%d) reached, %s is not included. Aborting...\n",
+ MAX_INCLUDE_DEPTH,incName);
+ exit(1);
+ }
+
+ QCString inc = incName;
+ substEnvVarsInString(inc);
+ inc = inc.stripWhiteSpace();
+ uint incLen = inc.length();
+ if (inc.at(0)=='"' && inc.at(incLen-1)=='"') // strip quotes
+ {
+ inc=inc.mid(1,incLen-2);
+ }
+
+ FILE *f;
+
+ if ((f=findFile(inc))) // see if the include file can be found
+ {
+ // For debugging
+#if SHOW_INCLUDES
+ for (i=0;i<includeStack.count();i++) msg(" ");
+ msg("@INCLUDE = %s: parsing...\n",inc.data());
+#endif
+
+ // store the state of the old file
+ ConfigFileState *fs=new ConfigFileState;
+ fs->oldState=YY_CURRENT_BUFFER;
+ fs->lineNr=yyLineNr;
+ fs->fileName=yyFileName;
+ fs->filePtr=f;
+ // push the state on the stack
+ includeStack.push(fs);
+ // set the scanner to the include file
+ yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
+ fs->newState=YY_CURRENT_BUFFER;
+ yyFileName=inc;
+ includeDepth++;
+ }
+ else
+ {
+ config_err("Error: @INCLUDE = %s: not found!\n",inc.data());
+ exit(1);
+ }
+}
+
+
+#define YY_NO_UNPUT 1
+#define Start 1
+
+#define SkipComment 2
+
+#define SkipInvalid 3
+
+#define GetString 4
+
+#define GetBool 5
+
+#define GetStrList 6
+
+#define GetQuotedString 7
+
+#define GetEnvVar 8
+
+#define Include 9
+
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( yy_current_buffer->yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 425 "config.l"
+
+
+
+ if ( yy_init )
+ {
+ yy_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yy_start;
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 100 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 408 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = yy_hold_char;
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 427 "config.l"
+
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 428 "config.l"
+{ BEGIN(SkipComment); }
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 429 "config.l"
+{ QCString cmd=yytext;
+ cmd=cmd.left(cmd.length()-1).stripWhiteSpace();
+ ConfigOption *option = config->get(cmd);
+ if (option==0) // oops not known
+ {
+ config_err("Warning: ignoring unsupported tag `%s' at line %d, file %s\n",
+ yytext,yyLineNr,yyFileName.data());
+ BEGIN(SkipInvalid);
+ }
+ else // known tag
+ {
+ switch(option->kind())
+ {
+ case ConfigOption::O_Info:
+ // shouldn't get here!
+ BEGIN(SkipInvalid);
+ break;
+ case ConfigOption::O_List:
+ l = ((ConfigList *)option)->valueRef();
+ l->clear();
+ elemStr="";
+ BEGIN(GetStrList);
+ break;
+ case ConfigOption::O_Enum:
+ s = ((ConfigEnum *)option)->valueRef();
+ s->resize(0);
+ BEGIN(GetString);
+ break;
+ case ConfigOption::O_String:
+ s = ((ConfigString *)option)->valueRef();
+ s->resize(0);
+ BEGIN(GetString);
+ break;
+ case ConfigOption::O_Int:
+ s = ((ConfigInt *)option)->valueStringRef();
+ s->resize(0);
+ BEGIN(GetString);
+ break;
+ case ConfigOption::O_Bool:
+ s = ((ConfigBool *)option)->valueStringRef();
+ s->resize(0);
+ BEGIN(GetString);
+ break;
+ case ConfigOption::O_Obsolete:
+ config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n"
+ "To avoid this warning please update your configuration "
+ "file using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data());
+ BEGIN(SkipInvalid);
+ break;
+ }
+ }
+ }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 481 "config.l"
+{ QCString cmd=yytext;
+ cmd=cmd.left(cmd.length()-2).stripWhiteSpace();
+ ConfigOption *option = config->get(cmd);
+ if (option==0) // oops not known
+ {
+ config_err("Warning: ignoring unsupported tag `%s' at line %d, file %s\n",
+ yytext,yyLineNr,yyFileName.data());
+ BEGIN(SkipInvalid);
+ }
+ else // known tag
+ {
+ switch(option->kind())
+ {
+ case ConfigOption::O_Info:
+ // shouldn't get here!
+ BEGIN(SkipInvalid);
+ break;
+ case ConfigOption::O_List:
+ l = ((ConfigList *)option)->valueRef();
+ elemStr="";
+ BEGIN(GetStrList);
+ break;
+ case ConfigOption::O_Enum:
+ case ConfigOption::O_String:
+ case ConfigOption::O_Int:
+ case ConfigOption::O_Bool:
+ config_err("Warning: operator += not supported for `%s'. Ignoring line at line %d, file %s\n",
+ yytext,yyLineNr,yyFileName.data());
+ BEGIN(SkipInvalid);
+ break;
+ case ConfigOption::O_Obsolete:
+ config_err("Warning: Tag `%s' at line %d of file %s has become obsolete.\n"
+ "To avoid this warning please update your configuration "
+ "file using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data());
+ BEGIN(SkipInvalid);
+ break;
+ }
+ }
+ }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 520 "config.l"
+{ BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; }
+ YY_BREAK
+/* include a config file */
+case 6:
+YY_RULE_SETUP
+#line 522 "config.l"
+{ BEGIN(Include);}
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 523 "config.l"
+{
+ readIncludeFile(yytext);
+ BEGIN(Start);
+ }
+ YY_BREAK
+case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(Start):
+case YY_STATE_EOF(SkipComment):
+case YY_STATE_EOF(SkipInvalid):
+case YY_STATE_EOF(GetString):
+case YY_STATE_EOF(GetBool):
+case YY_STATE_EOF(GetStrList):
+case YY_STATE_EOF(GetQuotedString):
+case YY_STATE_EOF(GetEnvVar):
+case YY_STATE_EOF(Include):
+#line 527 "config.l"
+{
+ //printf("End of include file\n");
+ //printf("Include stack depth=%d\n",g_includeStack.count());
+ if (includeStack.isEmpty())
+ {
+ //printf("Terminating scanner!\n");
+ yyterminate();
+ }
+ else
+ {
+ ConfigFileState *fs=includeStack.pop();
+ fclose(fs->filePtr);
+ YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
+ yy_switch_to_buffer( fs->oldState );
+ yy_delete_buffer( oldBuf );
+ yyLineNr=fs->lineNr;
+ yyFileName=fs->fileName;
+ delete fs; fs=0;
+ includeDepth--;
+ }
+ }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 549 "config.l"
+{ config_err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 550 "config.l"
+{ yyLineNr++; BEGIN(Start); }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 551 "config.l"
+{
+ yyLineNr++;
+ if (!elemStr.isEmpty())
+ {
+ //printf("elemStr1=`%s'\n",elemStr.data());
+ l->append(elemStr);
+ }
+ BEGIN(Start);
+ }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 560 "config.l"
+{
+ if (!elemStr.isEmpty())
+ {
+ //printf("elemStr2=`%s'\n",elemStr.data());
+ l->append(elemStr);
+ }
+ elemStr.resize(0);
+ }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 568 "config.l"
+{ (*s)+=yytext; }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 569 "config.l"
+{ lastState=YY_START;
+ BEGIN(GetQuotedString);
+ tmpString.resize(0);
+ }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 573 "config.l"
+{
+ //printf("Quoted String = `%s'\n",tmpString.data());
+ if (lastState==GetString)
+ (*s)+=tmpString;
+ else
+ elemStr+=tmpString;
+ if (*yytext=='\n')
+ {
+ config_err("Warning: Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data());
+ yyLineNr++;
+ }
+ BEGIN(lastState);
+ }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 586 "config.l"
+{
+ tmpString+='"';
+ }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 589 "config.l"
+{ tmpString+=*yytext; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 590 "config.l"
+{
+ QCString bs=yytext;
+ bs=bs.upper();
+ if (bs=="YES" || bs=="1")
+ *b=TRUE;
+ else if (bs=="NO" || bs=="0")
+ *b=FALSE;
+ else
+ {
+ *b=FALSE;
+ config_warn("Warning: Invalid value `%s' for "
+ "boolean tag in line %d, file %s; use YES or NO\n",
+ bs.data(),yyLineNr,yyFileName.data());
+ }
+ }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 605 "config.l"
+{
+ elemStr+=yytext;
+ }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 608 "config.l"
+{ yyLineNr++; BEGIN(Start); }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 609 "config.l"
+{ yyLineNr++; BEGIN(Start); }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 610 "config.l"
+{ yyLineNr++; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 611 "config.l"
+
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 612 "config.l"
+{ yyLineNr++ ; }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 614 "config.l"
+ECHO;
+ YY_BREAK
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yy_c_buf_p;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap() )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = yy_current_buffer;
+
+ int yy_c_buf_p_offset =
+ (int) (yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = yy_current_buffer->yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
+
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ if ( yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ yy_current_buffer->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = yy_start;
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 28);
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 100 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+ }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
+ register int yy_is_jam;
+ register char *yy_cp = yy_c_buf_p;
+
+ register YY_CHAR yy_c = 28;
+ if ( yy_accept[yy_current_state] )
+ {
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 100 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 99);
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+ {
+ register char *yy_cp = yy_c_buf_p;
+
+ /* undo effects of setting up yytext */
+ *yy_cp = yy_hold_char;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = yy_n_chars + 2;
+ register char *dest = &yy_current_buffer->yy_ch_buf[
+ yy_current_buffer->yy_buf_size + 2];
+ register char *source =
+ &yy_current_buffer->yy_ch_buf[number_to_move];
+
+ while ( source > yy_current_buffer->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ yy_current_buffer->yy_n_chars =
+ yy_n_chars = yy_current_buffer->yy_buf_size;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+
+ yytext_ptr = yy_bp;
+ yy_hold_char = *yy_cp;
+ yy_c_buf_p = yy_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ /* This was really a NUL. */
+ *yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
+
+ switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap() )
+ return EOF;
+
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p = yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
+
+ return c;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
+ return;
+
+ if ( yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yy_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yy_flex_free( (void *) b->yy_ch_buf );
+
+ yy_flex_free( (void *) b );
+ }
+
+
+#ifndef YY_ALWAYS_INTERACTIVE
+#ifndef YY_NEVER_INTERACTIVE
+extern int isatty YY_PROTO(( int ));
+#endif
+#endif
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
+
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
+
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 614 "config.l"
+
+
+/*@ ----------------------------------------------------------------------------
+ */
+
+#if 0
+static void writeBoolValue(QTextStream &t,bool v)
+{
+ if (v) t << "YES"; else t << "NO";
+}
+
+static void writeIntValue(QTextStream &t,int i)
+{
+ t << i;
+}
+
+static void writeStringValue(QTextStream &t,QCString &s)
+{
+ const char *p=s.data();
+ char c;
+ bool hasBlanks=FALSE;
+ if (p)
+ {
+ while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
+ if (hasBlanks)
+ t << "\"" << s << "\"";
+ else
+ t << s;
+ }
+}
+
+static void writeStringList(QTextStream &t,QStrList &l)
+{
+ const char *p = l.first();
+ bool first=TRUE;
+ while (p)
+ {
+ char c;
+ const char *s=p;
+ bool hasBlanks=FALSE;
+ while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
+ if (!first) t << " ";
+ first=FALSE;
+ if (hasBlanks) t << "\"" << s << "\""; else t << s;
+ p = l.next();
+ if (p) t << " \\" << endl;
+ }
+}
+#endif
+
+void Config::writeTemplate(QTextStream &t,bool sl,bool upd)
+{
+ t << "# Doxyfile " << versionString << endl << endl;
+ if (!sl)
+ {
+ t << "# This file describes the settings to be used by the documentation system\n";
+ t << "# doxygen (www.doxygen.org) for a project\n";
+ t << "#\n";
+ t << "# All text after a hash (#) is considered a comment and will be ignored\n";
+ t << "# The format is:\n";
+ t << "# TAG = value [value, ...]\n";
+ t << "# For lists items can also be appended using:\n";
+ t << "# TAG += value [value, ...]\n";
+ t << "# Values that contain spaces should be placed between quotes (\" \")\n";
+ }
+ ConfigOption *option = m_options->first();
+ while (option)
+ {
+ option->writeTemplate(t,sl,upd);
+ option = m_options->next();
+ }
+}
+
+void Config::convertStrToVal()
+{
+ ConfigOption *option = m_options->first();
+ while (option)
+ {
+ option->convertStrToVal();
+ option = m_options->next();
+ }
+}
+
+static void substEnvVarsInString(QCString &s)
+{
+ static QRegExp re("\\$\\([a-z_A-Z0-9]+\\)");
+ if (s.isEmpty()) return;
+ int p=0;
+ int i,l;
+ //printf("substEnvVarInString(%s) start\n",s.data());
+ while ((i=re.search(s,p))!=-1)
+ {
+ l = re.matchedLength();
+ //printf("Found environment var s.mid(%d,%d)=`%s'\n",i+2,l-3,s.mid(i+2,l-3).data());
+ QCString env=getenv(s.mid(i+2,l-3));
+ substEnvVarsInString(env); // recursively expand variables if needed.
+ s = s.left(i)+env+s.right(s.length()-i-l);
+ p=i+env.length(); // next time start at the end of the expanded string
+ }
+ s=s.stripWhiteSpace(); // to strip the bogus space that was added when an argument
+ // has quotes
+ //printf("substEnvVarInString(%s) end\n",s.data());
+}
+
+static void substEnvVarsInStrList(QStrList &sl)
+{
+ char *s = sl.first();
+ while (s)
+ {
+ QCString result(s);
+ // an argument with quotes will have an extra space at the end, so wasQuoted will be TRUE.
+ bool wasQuoted = (result.find(' ')!=-1) || (result.find('\t')!=-1);
+ // here we strip the quote again
+ substEnvVarsInString(result);
+
+ //printf("Result %s was quoted=%d\n",result.data(),wasQuoted);
+
+ if (!wasQuoted) /* as a result of the expansion, a single string
+ may have expanded into a list, which we'll
+ add to sl. If the orginal string already
+ contained multiple elements no further
+ splitting is done to allow quoted items with spaces! */
+ {
+ int l=result.length();
+ int i,p=0;
+ // skip spaces
+ // search for a "word"
+ for (i=0;i<l;i++)
+ {
+ char c=0;
+ // skip until start of new word
+ while (i<l && ((c=result.at(i))==' ' || c=='\t')) i++;
+ p=i; // p marks the start index of the word
+ // skip until end of a word
+ while (i<l && ((c=result.at(i))!=' ' && c!='\t' && c!='"')) i++;
+ if (i<l) // not at the end of the string
+ {
+ if (c=='"') // word within quotes
+ {
+ p=i+1;
+ for (i++;i<l;i++)
+ {
+ c=result.at(i);
+ if (c=='"') // end quote
+ {
+ // replace the string in the list and go to the next item.
+ sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item.
+ sl.next(); // current item is now the old item
+ p=i+1;
+ break;
+ }
+ else if (c=='\\') // skip escaped stuff
+ {
+ i++;
+ }
+ }
+ }
+ else if (c==' ' || c=='\t') // separator
+ {
+ // replace the string in the list and go to the next item.
+ sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item.
+ sl.next(); // current item is now the old item
+ p=i+1;
+ }
+ }
+ }
+ if (p!=l) // add the leftover as a string
+ {
+ // replace the string in the list and go to the next item.
+ sl.insert(sl.at(),result.right(l-p)); // insert new item before current item.
+ sl.next(); // current item is now the old item
+ }
+ }
+ else // just goto the next element in the list
+ {
+ sl.insert(sl.at(),result);
+ sl.next();
+ }
+ // remove the old unexpanded string from the list
+ int i=sl.at();
+ sl.remove(); // current item index changes if the last element is removed.
+ if (sl.at()==i) // not last item
+ s = sl.current();
+ else // just removed last item
+ s = 0;
+ }
+}
+
+void ConfigString::substEnvVars()
+{
+ substEnvVarsInString(m_value);
+}
+
+void ConfigList::substEnvVars()
+{
+ substEnvVarsInStrList(m_value);
+}
+
+void ConfigBool::substEnvVars()
+{
+ substEnvVarsInString(m_valueString);
+}
+
+void ConfigInt::substEnvVars()
+{
+ substEnvVarsInString(m_valueString);
+}
+
+void ConfigEnum::substEnvVars()
+{
+ substEnvVarsInString(m_value);
+}
+
+void Config::substituteEnvironmentVars()
+{
+ ConfigOption *option = m_options->first();
+ while (option)
+ {
+ option->substEnvVars();
+ option = m_options->next();
+ }
+}
+
+static void cleanUpPaths(QStrList &str)
+{
+ char *sfp = str.first();
+ while (sfp)
+ {
+ register char *p = sfp;
+ if (p)
+ {
+ char c;
+ while ((c=*p))
+ {
+ if (c=='\\') *p='/';
+ p++;
+ }
+ }
+ QCString path = sfp;
+ if ((path.at(0)!='/' && (path.length()<=2 || path.at(1)!=':')) ||
+ path.at(path.length()-1)!='/'
+ )
+ {
+ QFileInfo fi(path);
+ if (fi.exists() && fi.isDir())
+ {
+ int i = str.at();
+ str.remove();
+ if (str.at()==i) // did not remove last item
+ str.insert(i,QFile::encodeName(fi.absFilePath()+"/"));
+ else
+ str.append(QFile::encodeName(fi.absFilePath()+"/"));
+ }
+ }
+ sfp = str.next();
+ }
+}
+
+void Config::check()
+{
+ //if (!projectName.isEmpty())
+ //{
+ // projectName[0]=toupper(projectName[0]);
+ //}
+
+ QCString &warnFormat = Config_getString("WARN_FORMAT");
+ if (warnFormat.stripWhiteSpace().isEmpty())
+ {
+ warnFormat="$file:$line $text";
+ }
+ else
+ {
+ if (warnFormat.find("$file")==-1)
+ {
+ config_err("Warning: warning format does not contain a $file tag!\n");
+ }
+ if (warnFormat.find("$line")==-1)
+ {
+ config_err("Warning: warning format does not contain a $line tag!\n");
+ }
+ if (warnFormat.find("$text")==-1)
+ {
+ config_err("Warning: warning format foes not contain a $text tag!\n");
+ }
+ }
+
+ QCString &manExtension = Config_getString("MAN_EXTENSION");
+
+ // set default man page extension if non is given by the user
+ if (manExtension.isEmpty())
+ {
+ manExtension=".3";
+ }
+
+ QCString &paperType = Config_getEnum("PAPER_TYPE");
+ paperType=paperType.lower().stripWhiteSpace();
+ if (paperType.isEmpty())
+ {
+ paperType = "a4wide";
+ }
+ if (paperType!="a4" && paperType!="a4wide" && paperType!="letter" &&
+ paperType!="legal" && paperType!="executive")
+ {
+ config_err("Error: Unknown page type specified");
+ }
+
+ QCString &outputLanguage=Config_getEnum("OUTPUT_LANGUAGE");
+ outputLanguage=outputLanguage.stripWhiteSpace();
+ if (outputLanguage.isEmpty())
+ {
+ outputLanguage = "English";
+ }
+
+ QCString &htmlFileExtension=Config_getString("HTML_FILE_EXTENSION");
+ htmlFileExtension=htmlFileExtension.stripWhiteSpace();
+ if (htmlFileExtension.isEmpty())
+ {
+ htmlFileExtension = ".html";
+ }
+
+ // expand the relative stripFromPath values
+ QStrList &stripFromPath = Config_getList("STRIP_FROM_PATH");
+ char *sfp = stripFromPath.first();
+ if (sfp==0) // by default use the current path
+ {
+ stripFromPath.append(QFile::encodeName(QDir::currentDirPath()+"/"));
+ }
+ else
+ {
+ cleanUpPaths(stripFromPath);
+ }
+
+ // expand the relative stripFromPath values
+ QStrList &stripFromIncPath = Config_getList("STRIP_FROM_INC_PATH");
+ cleanUpPaths(stripFromIncPath);
+
+ // Test to see if HTML header is valid
+ QCString &headerFile = Config_getString("HTML_HEADER");
+ if (!headerFile.isEmpty())
+ {
+ QFileInfo fi(headerFile);
+ if (!fi.exists())
+ {
+ config_err("Error: tag HTML_HEADER: header file `%s' "
+ "does not exist\n",headerFile.data());
+ exit(1);
+ }
+ }
+ // Test to see if HTML footer is valid
+ QCString &footerFile = Config_getString("HTML_FOOTER");
+ if (!footerFile.isEmpty())
+ {
+ QFileInfo fi(footerFile);
+ if (!fi.exists())
+ {
+ config_err("Error: tag HTML_FOOTER: footer file `%s' "
+ "does not exist\n",footerFile.data());
+ exit(1);
+ }
+ }
+ // Test to see if LaTeX header is valid
+ QCString &latexHeaderFile = Config_getString("LATEX_HEADER");
+ if (!latexHeaderFile.isEmpty())
+ {
+ QFileInfo fi(latexHeaderFile);
+ if (!fi.exists())
+ {
+ config_err("Error: tag LATEX_HEADER: header file `%s' "
+ "does not exist\n",latexHeaderFile.data());
+ exit(1);
+ }
+ }
+ // check include path
+ QStrList &includePath = Config_getList("INCLUDE_PATH");
+ char *s=includePath.first();
+ while (s)
+ {
+ QFileInfo fi(s);
+ if (!fi.exists()) config_err("Warning: tag INCLUDE_PATH: include path `%s' "
+ "does not exist\n",s);
+ s=includePath.next();
+ }
+
+ // check aliases
+ QStrList &aliasList = Config_getList("ALIASES");
+ s=aliasList.first();
+ while (s)
+ {
+ QRegExp re1("[a-z_A-Z][a-z_A-Z0-9]*[ \t]*="); // alias without argument
+ QRegExp re2("[a-z_A-Z][a-z_A-Z0-9]*{[0-9]*}[ \t]*="); // alias with argument
+ QCString alias=s;
+ alias=alias.stripWhiteSpace();
+ if (alias.find(re1)!=0 && alias.find(re2)!=0)
+ {
+ config_err("Illegal alias format `%s'. Use \"name=value\" or \"name(n)=value\", where n is the number of arguments\n",
+ alias.data());
+ }
+ s=aliasList.next();
+ }
+
+ // check dot image format
+ QCString &dotImageFormat=Config_getEnum("DOT_IMAGE_FORMAT");
+ dotImageFormat=dotImageFormat.stripWhiteSpace();
+ if (dotImageFormat.isEmpty())
+ {
+ dotImageFormat = "png";
+ }
+ else if (dotImageFormat!="gif" && dotImageFormat!="png" && dotImageFormat!="jpg")
+ {
+ config_err("Invalid value for DOT_IMAGE_FORMAT: `%s'. Using the default.\n",dotImageFormat.data());
+ dotImageFormat = "png";
+ }
+
+
+ // check dot path
+ QCString &dotPath = Config_getString("DOT_PATH");
+ if (!dotPath.isEmpty())
+ {
+ QFileInfo dp(dotPath+"/dot"+portable_commandExtension());
+ if (!dp.exists() || !dp.isFile())
+ {
+ config_err("Warning: the dot tool could not be found at %s\n",dotPath.data());
+ dotPath="";
+ }
+ else
+ {
+ dotPath=QFile::encodeName( dp.dirPath(TRUE)+"/" );
+#if defined(_WIN32) // convert slashes
+ uint i=0,l=dotPath.length();
+ for (i=0;i<l;i++) if (dotPath.at(i)=='/') dotPath.at(i)='\\';
+#endif
+ }
+ }
+ else // make sure the string is empty but not null!
+ {
+ dotPath="";
+ }
+
+ // check mscgen path
+ QCString &mscgenPath = Config_getString("MSCGEN_PATH");
+ if (!mscgenPath.isEmpty())
+ {
+ QFileInfo dp(mscgenPath+"/mscgen"+portable_commandExtension());
+ if (!dp.exists() || !dp.isFile())
+ {
+ config_err("Warning: the mscgen tool could not be found at %s\n",mscgenPath.data());
+ mscgenPath="";
+ }
+ else
+ {
+ mscgenPath=QFile::encodeName( dp.dirPath(TRUE)+"/" );
+#if defined(_WIN32) // convert slashes
+ uint i=0,l=mscgenPath.length();
+ for (i=0;i<l;i++) if (mscgenPath.at(i)=='/') mscgenPath.at(i)='\\';
+#endif
+ }
+ }
+ else // make sure the string is empty but not null!
+ {
+ mscgenPath="";
+ }
+
+
+ // check input
+ QStrList &inputSources=Config_getList("INPUT");
+ if (inputSources.count()==0)
+ {
+ // use current dir as the default
+ inputSources.append(QFile::encodeName( QDir::currentDirPath() ));
+ }
+ else
+ {
+ s=inputSources.first();
+ while (s)
+ {
+ QFileInfo fi(s);
+ if (!fi.exists())
+ {
+ config_err("Warning: tag INPUT: input source `%s' does not exist\n",s);
+ }
+ s=inputSources.next();
+ }
+ }
+
+ // add default pattern if needed
+ QStrList &filePatternList = Config_getList("FILE_PATTERNS");
+ if (filePatternList.isEmpty())
+ {
+ filePatternList.append("*.c");
+ filePatternList.append("*.cc");
+ filePatternList.append("*.cxx");
+ filePatternList.append("*.cpp");
+ filePatternList.append("*.c++");
+ filePatternList.append("*.d");
+ filePatternList.append("*.java");
+ filePatternList.append("*.ii");
+ filePatternList.append("*.ixx");
+ filePatternList.append("*.ipp");
+ filePatternList.append("*.i++");
+ filePatternList.append("*.inl");
+ filePatternList.append("*.h");
+ filePatternList.append("*.hh");
+ filePatternList.append("*.hxx");
+ filePatternList.append("*.hpp");
+ filePatternList.append("*.h++");
+ filePatternList.append("*.idl");
+ filePatternList.append("*.odl");
+ filePatternList.append("*.cs");
+ filePatternList.append("*.php");
+ filePatternList.append("*.php3");
+ filePatternList.append("*.inc");
+ filePatternList.append("*.m");
+ filePatternList.append("*.mm");
+ filePatternList.append("*.dox");
+ filePatternList.append("*.py");
+ filePatternList.append("*.f90");
+ filePatternList.append("*.f");
+ filePatternList.append("*.vhd");
+ filePatternList.append("*.vhdl");
+ if (portable_fileSystemIsCaseSensitive())
+ {
+ // unix => case sensitive match => also include useful uppercase versions
+ filePatternList.append("*.C");
+ filePatternList.append("*.CC");
+ filePatternList.append("*.C++");
+ filePatternList.append("*.II");
+ filePatternList.append("*.I++");
+ filePatternList.append("*.H");
+ filePatternList.append("*.HH");
+ filePatternList.append("*.H++");
+ filePatternList.append("*.CS");
+ filePatternList.append("*.PHP");
+ filePatternList.append("*.PHP3");
+ filePatternList.append("*.M");
+ filePatternList.append("*.MM");
+ filePatternList.append("*.PY");
+ filePatternList.append("*.F90");
+ filePatternList.append("*.F");
+ filePatternList.append("*.VHD");
+ filePatternList.append("*.VHDL");
+ }
+ }
+
+ // add default pattern if needed
+ QStrList &examplePatternList = Config_getList("EXAMPLE_PATTERNS");
+ if (examplePatternList.isEmpty())
+ {
+ examplePatternList.append("*");
+ }
+
+ // if no output format is enabled, warn the user
+ if (!Config_getBool("GENERATE_HTML") &&
+ !Config_getBool("GENERATE_LATEX") &&
+ !Config_getBool("GENERATE_MAN") &&
+ !Config_getBool("GENERATE_RTF") &&
+ !Config_getBool("GENERATE_XML") &&
+ !Config_getBool("GENERATE_PERLMOD") &&
+ !Config_getBool("GENERATE_RTF") &&
+ !Config_getBool("GENERATE_AUTOGEN_DEF") &&
+ Config_getString("GENERATE_TAGFILE").isEmpty()
+ )
+ {
+ config_err("Warning: No output formats selected! Set at least one of the main GENERATE_* options to YES.\n");
+ }
+
+ // check HTMLHELP creation requirements
+ if (!Config_getBool("GENERATE_HTML") &&
+ Config_getBool("GENERATE_HTMLHELP"))
+ {
+ config_err("Warning: GENERATE_HTMLHELP=YES requires GENERATE_HTML=YES.\n");
+ }
+
+#undef PUTENV
+#undef SEP
+#if defined(_WIN32) && (__BORLANDC__ < 0x0550)
+#define PUTENV _putenv
+#define SEP ";"
+#else
+#define PUTENV putenv
+#define SEP ":"
+#endif
+ // check QHP creation requirements
+ if (Config_getBool("GENERATE_QHP"))
+ {
+ bool quit = false;
+ if (!Config_getBool("GENERATE_HTML"))
+ {
+ config_err("Warning: GENERATE_QHP=YES requires GENERATE_HTML=YES.\n");
+ quit = true;
+ }
+
+ if (Config_getString("QHP_NAMESPACE").isEmpty())
+ {
+ config_err("Warning: GENERATE_QHP=YES requires QHP_NAMESPACE to be set.\n");
+ quit = true;
+ }
+
+ if (Config_getString("QHP_VIRTUAL_FOLDER").isEmpty())
+ {
+ config_err("Warning: GENERATE_QHP=YES requires QHP_VIRTUAL_FOLDER to be set.\n");
+ quit = true;
+ }
+
+ if (quit)
+ {
+ exit(1);
+ }
+ }
+
+ // check QCH creation requirements
+ if (!Config_getString("QHG_LOCATION").isEmpty() &&
+ !Config_getBool("GENERATE_QHP"))
+ {
+ config_err("Warning: Specifying QHG_LOCATION requires GENERATE_QHP=YES.\n");
+ }
+ if (!Config_getString("QCH_FILE").isEmpty() &&
+ Config_getString("QHG_LOCATION").isEmpty())
+ {
+ config_err("Warning: Specifying QCH_FILE requires QHG_LOCATION to be set.\n");
+ }
+
+ if (Config_getBool("HAVE_DOT"))
+ {
+ char *curFontPath = getenv("DOTFONTPATH");
+ int l=curFontPath ? strlen(curFontPath)+1 : 0;
+ static char *buf = 0;
+ buf = (char *)realloc(buf,strlen("DOTFONTPATH=.")+l+1);
+ strcpy(buf,"DOTFONTPATH=.");
+ if (l>0)
+ {
+ strcat(buf,SEP);
+ strcat(buf,curFontPath);
+ }
+ PUTENV(buf);
+ }
+
+ if (Config_getBool("OPTIMIZE_OUTPUT_JAVA") && Config_getBool("INLINE_INFO"))
+ {
+ // don't show inline info for Java output, since Java has no inline
+ // concept.
+ Config_getBool("INLINE_INFO")=FALSE;
+ }
+
+ int &depth = Config_getInt("MAX_DOT_GRAPH_DEPTH");
+ if (depth==0)
+ {
+ depth=1000;
+ }
+
+
+ // add default words if needed
+ QStrList &annotationFromBrief = Config_getList("ABBREVIATE_BRIEF");
+ if (annotationFromBrief.isEmpty())
+ {
+ annotationFromBrief.append("The $name class");
+ annotationFromBrief.append("The $name widget");
+ annotationFromBrief.append("The $name file");
+ annotationFromBrief.append("is");
+ annotationFromBrief.append("provides");
+ annotationFromBrief.append("specifies");
+ annotationFromBrief.append("contains");
+ annotationFromBrief.append("represents");
+ annotationFromBrief.append("a");
+ annotationFromBrief.append("an");
+ annotationFromBrief.append("the");
+ }
+
+ // some default settings for vhdl
+ if (Config_getBool("OPTIMIZE_OUTPUT_VHDL") &&
+ (Config_getBool("INLINE_INHERITED_MEMB") ||
+ Config_getBool("INHERIT_DOCS") ||
+ !Config_getBool("HIDE_SCOPE_NAMES") ||
+ !Config_getBool("EXTRACT_PRIVATE")
+ )
+ )
+ {
+ bool b1 = Config_getBool("INLINE_INHERITED_MEMB");
+ bool b2 = Config_getBool("INHERIT_DOCS");
+ bool b3 = Config_getBool("HIDE_SCOPE_NAMES");
+ bool b4 = Config_getBool("EXTRACT_PRIVATE");
+ const char *s1,*s2,*s3,*s4;
+ if (b1) s1=" INLINDE_INHERITED_MEMB = NO (was YES)\n"; else s1="";
+ if (b2) s2=" INHERIT_DOCS = NO (was YES)\n"; else s2="";
+ if (!b3) s3=" HIDE_SCOPE_NAMES = YES (was NO)\n"; else s3="";
+ if (!b4) s4=" EXTRACT_PRIVATE = YES (was NO)\n"; else s4="";
+
+ config_err("Warning: enabling OPTIMIZE_OUTPUT_VHDL assumes the following settings:\n"
+ "%s%s%s%s",s1,s2,s3,s4
+ );
+
+ Config_getBool("INLINE_INHERITED_MEMB") = FALSE;
+ Config_getBool("INHERIT_DOCS") = FALSE;
+ Config_getBool("HIDE_SCOPE_NAMES") = TRUE;
+ Config_getBool("EXTRACT_PRIVATE") = TRUE;
+ }
+
+}
+
+void Config::init()
+{
+ ConfigOption *option = m_options->first();
+ while (option)
+ {
+ option->init();
+ option = m_options->next();
+ }
+}
+
+void Config::create()
+{
+ if (m_initialized) return;
+ m_initialized = TRUE;
+
+ ConfigString *cs;
+ ConfigEnum *ce;
+ ConfigList *cl;
+ ConfigInt *ci;
+ ConfigBool *cb;
+
+ // option definitions
+ //-----------------------------------------------------------------------------------------------
+ addInfo("Project","Project related configuration options");
+ //-----------------------------------------------------------------------------------------------
+
+ cs = addString(
+ "DOXYFILE_ENCODING",
+ "This tag specifies the encoding used for all characters in the config file \n"
+ "that follow. The default is UTF-8 which is also the encoding used for all \n"
+ "text before the first occurrence of this tag. Doxygen uses libiconv (or the \n"
+ "iconv built into libc) for the transcoding. See \n"
+ "http://www.gnu.org/software/libiconv for the list of possible encodings.\n"
+ );
+ cs->setDefaultValue("UTF-8");
+ cs = addString(
+ "PROJECT_NAME",
+ "The PROJECT_NAME tag is a single word (or a sequence of words surrounded \n"
+ "by quotes) that should identify the project. "
+ );
+ cs = addString(
+ "PROJECT_NUMBER",
+ "The PROJECT_NUMBER tag can be used to enter a project or revision number. \n"
+ "This could be handy for archiving the generated documentation or \n"
+ "if some version control system is used.\n"
+ );
+ cs = addString(
+ "OUTPUT_DIRECTORY",
+ "The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) \n"
+ "base path where the generated documentation will be put. \n"
+ "If a relative path is entered, it will be relative to the location \n"
+ "where doxygen was started. If left blank the current directory will be used.\n"
+ );
+ cs->setWidgetType(ConfigString::Dir);
+ cb = addBool(
+ "CREATE_SUBDIRS",
+ "If the CREATE_SUBDIRS tag is set to YES, then doxygen will create \n"
+ "4096 sub-directories (in 2 levels) under the output directory of each output \n"
+ "format and will distribute the generated files over these directories. \n"
+ "Enabling this option can be useful when feeding doxygen a huge amount of \n"
+ "source files, where putting all generated files in the same directory would \n"
+ "otherwise cause performance problems for the file system. \n",
+ FALSE
+ );
+ ce = addEnum(
+ "OUTPUT_LANGUAGE",
+ "The OUTPUT_LANGUAGE tag is used to specify the language in which all \n"
+ "documentation generated by doxygen is written. Doxygen will use this \n"
+ "information to generate all constant output in the proper language. \n"
+ "The default language is English, other supported languages are: \n"
+ "Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, \n"
+ "Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, \n"
+ "Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), \n"
+ "Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, \n"
+ "Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, \n"
+ "Spanish, Swedish, and Ukrainian.\n",
+ "English"
+ );
+#ifdef LANG_ZA
+ ce->addValue("Afrikaans");
+#endif
+#ifdef LANG_AR
+ ce->addValue("Arabic");
+#endif
+#ifdef LANG_BR
+ ce->addValue("Brazilian");
+#endif
+#ifdef LANG_CA
+ ce->addValue("Catalan");
+#endif
+#ifdef LANG_CN
+ ce->addValue("Chinese");
+#endif
+#ifdef LANG_TW
+ ce->addValue("Chinese-Traditional");
+#endif
+#ifdef LANG_HR
+ ce->addValue("Croatian");
+#endif
+#ifdef LANG_CZ
+ ce->addValue("Czech");
+#endif
+#ifdef LANG_DK
+ ce->addValue("Danish");
+#endif
+#ifdef LANG_NL
+ ce->addValue("Dutch");
+#endif
+ ce->addValue("English");
+#ifdef LANG_FI
+ ce->addValue("Finnish");
+#endif
+#ifdef LANG_FR
+ ce->addValue("French");
+#endif
+#ifdef LANG_DE
+ ce->addValue("German");
+#endif
+#ifdef LANG_GR
+ ce->addValue("Greek");
+#endif
+#ifdef LANG_HU
+ ce->addValue("Hungarian");
+#endif
+#ifdef LANG_IT
+ ce->addValue("Italian");
+#endif
+#ifdef LANG_JP
+ ce->addValue("Japanese");
+ ce->addValue("Japanese-en");
+#endif
+#ifdef LANG_KR
+ ce->addValue("Korean");
+ ce->addValue("Korean-en");
+#endif
+#ifdef LANG_LI
+ ce->addValue("Lithuanian");
+#endif
+#ifdef LANG_NO
+ ce->addValue("Norwegian");
+#endif
+#ifdef LANG_MK
+ ce->addValue("Macedonian");
+#endif
+#ifdef LANG_FA
+ ce->addValue("Farsi");
+ ce->addValue("Persian");
+#endif
+#ifdef LANG_PL
+ ce->addValue("Polish");
+#endif
+#ifdef LANG_PT
+ ce->addValue("Portuguese");
+#endif
+#ifdef LANG_RO
+ ce->addValue("Romanian");
+#endif
+#ifdef LANG_RU
+ ce->addValue("Russian");
+#endif
+#ifdef LANG_SR
+ ce->addValue("Serbian");
+#endif
+#ifdef LANG_SC
+ ce->addValue("Serbian-Cyrilic");
+#endif
+#ifdef LANG_SK
+ ce->addValue("Slovak");
+#endif
+#ifdef LANG_SI
+ ce->addValue("Slovene");
+#endif
+#ifdef LANG_ES
+ ce->addValue("Spanish");
+#endif
+#ifdef LANG_SE
+ ce->addValue("Swedish");
+#endif
+#ifdef LANG_UA
+ ce->addValue("Ukrainian");
+#endif
+
+#if 0
+ cb = addBool(
+ "USE_WINDOWS_ENCODING",
+ "This tag can be used to specify the encoding used in the generated output. \n"
+ "The encoding is not always determined by the language that is chosen, \n"
+ "but also whether or not the output is meant for Windows or non-Windows users. \n"
+ "In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES \n"
+ "forces the Windows encoding (this is the default for the Windows binary), \n"
+ "whereas setting the tag to NO uses a Unix-style encoding (the default for \n"
+ "all platforms other than Windows).\n",
+#if defined(_WIN32) || defined(__CYGWIN__)
+ TRUE
+#else
+ FALSE
+#endif
+ );
+#endif
+ addObsolete("USE_WINDOWS_ENCODING");
+
+ cb = addBool(
+ "BRIEF_MEMBER_DESC",
+ "If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will \n"
+ "include brief member descriptions after the members that are listed in \n"
+ "the file and class documentation (similar to JavaDoc). \n"
+ "Set to NO to disable this. \n",
+ TRUE
+ );
+ cb = addBool(
+ "REPEAT_BRIEF",
+ "If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend \n"
+ "the brief description of a member or function before the detailed description. \n"
+ "Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the \n"
+ "brief descriptions will be completely suppressed. \n",
+ TRUE
+ );
+ cl = addList(
+ "ABBREVIATE_BRIEF",
+ "This tag implements a quasi-intelligent brief description abbreviator \n"
+ "that is used to form the text in various listings. Each string \n"
+ "in this list, if found as the leading text of the brief description, will be \n"
+ "stripped from the text and the result after processing the whole list, is \n"
+ "used as the annotated text. Otherwise, the brief description is used as-is. \n"
+ "If left blank, the following values are used (\"$name\" is automatically \n"
+ "replaced with the name of the entity): \"The $name class\" \"The $name widget\" \n"
+ "\"The $name file\" \"is\" \"provides\" \"specifies\" \"contains\" \n"
+ "\"represents\" \"a\" \"an\" \"the\"\n"
+ );
+ cb = addBool(
+ "ALWAYS_DETAILED_SEC",
+ "If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then \n"
+ "Doxygen will generate a detailed section even if there is only a brief \n"
+ "description. \n",
+ FALSE
+ );
+ cb = addBool(
+ "INLINE_INHERITED_MEMB",
+ "If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all \n"
+ "inherited members of a class in the documentation of that class as if those \n"
+ "members were ordinary class members. Constructors, destructors and assignment \n"
+ "operators of the base classes will not be shown. \n",
+ FALSE
+ );
+ cb = addBool(
+ "FULL_PATH_NAMES",
+ "If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full \n"
+ "path before files name in the file list and in the header files. If set \n"
+ "to NO the shortest path that makes the file name unique will be used. \n",
+ TRUE
+ );
+ cl = addList(
+ "STRIP_FROM_PATH",
+ "If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag \n"
+ "can be used to strip a user-defined part of the path. Stripping is \n"
+ "only done if one of the specified strings matches the left-hand part of \n"
+ "the path. The tag can be used to show relative paths in the file list. \n"
+ "If left blank the directory from which doxygen is run is used as the \n"
+ "path to strip. \n"
+ );
+ cl->addDependency("FULL_PATH_NAMES");
+ cl = addList(
+ "STRIP_FROM_INC_PATH",
+ "The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of \n"
+ "the path mentioned in the documentation of a class, which tells \n"
+ "the reader which header file to include in order to use a class. \n"
+ "If left blank only the name of the header file containing the class \n"
+ "definition is used. Otherwise one should specify the include paths that \n"
+ "are normally passed to the compiler using the -I flag.\n"
+ );
+ cb = addBool(
+ "SHORT_NAMES",
+ "If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter \n"
+ "(but less readable) file names. This can be useful is your file systems \n"
+ "doesn't support long names like on DOS, Mac, or CD-ROM. \n",
+ FALSE
+ );
+ cb = addBool(
+ "JAVADOC_AUTOBRIEF",
+ "If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen \n"
+ "will interpret the first line (until the first dot) of a JavaDoc-style \n"
+ "comment as the brief description. If set to NO, the JavaDoc \n"
+ "comments will behave just like regular Qt-style comments \n"
+ "(thus requiring an explicit @brief command for a brief description.) \n",
+ FALSE
+ );
+ cb = addBool(
+ "QT_AUTOBRIEF",
+ "If the QT_AUTOBRIEF tag is set to YES then Doxygen will \n"
+ "interpret the first line (until the first dot) of a Qt-style \n"
+ "comment as the brief description. If set to NO, the comments \n"
+ "will behave just like regular Qt-style comments (thus requiring \n"
+ "an explicit \\brief command for a brief description.) \n",
+ FALSE
+ );
+ cb = addBool(
+ "MULTILINE_CPP_IS_BRIEF",
+ "The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen \n"
+ "treat a multi-line C++ special comment block (i.e. a block of //! or /// \n"
+ "comments) as a brief description. This used to be the default behaviour. \n"
+ "The new default is to treat a multi-line C++ comment block as a detailed \n"
+ "description. Set this tag to YES if you prefer the old behaviour instead. \n",
+ FALSE
+ );
+ //cb = addBool(
+ // "DETAILS_AT_TOP",
+ // "If the DETAILS_AT_TOP tag is set to YES then Doxygen \n"
+ // "will output the detailed description near the top, like JavaDoc.\n"
+ // "If set to NO, the detailed description appears after the member \n"
+ // "documentation. \n",
+ // FALSE
+ // );
+ cb = addBool(
+ "INHERIT_DOCS",
+ "If the INHERIT_DOCS tag is set to YES (the default) then an undocumented \n"
+ "member inherits the documentation from any documented member that it \n"
+ "re-implements. \n",
+ TRUE
+ );
+ cb = addBool(
+ "SEPARATE_MEMBER_PAGES",
+ "If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce \n"
+ "a new page for each member. If set to NO, the documentation of a member will \n"
+ "be part of the file/class/namespace that contains it.\n",
+ FALSE
+ );
+ ci = addInt(
+ "TAB_SIZE",
+ "The TAB_SIZE tag can be used to set the number of spaces in a tab. \n"
+ "Doxygen uses this value to replace tabs by spaces in code fragments. \n",
+ 1,16,8
+ );
+ cl = addList(
+ "ALIASES",
+ "This tag can be used to specify a number of aliases that acts \n"
+ "as commands in the documentation. An alias has the form \"name=value\". \n"
+ "For example adding \"sideeffect=\\par Side Effects:\\n\" will allow you to \n"
+ "put the command \\sideeffect (or @sideeffect) in the documentation, which \n"
+ "will result in a user-defined paragraph with heading \"Side Effects:\". \n"
+ "You can put \\n's in the value part of an alias to insert newlines. \n"
+ );
+ cb = addBool(
+ "OPTIMIZE_OUTPUT_FOR_C",
+ "Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C \n"
+ "sources only. Doxygen will then generate output that is more tailored for C. \n"
+ "For instance, some of the names that are used will be different. The list \n"
+ "of all members will be omitted, etc. \n",
+ FALSE
+ );
+ cb = addBool(
+ "OPTIMIZE_OUTPUT_JAVA",
+ "Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java \n"
+ "sources only. Doxygen will then generate output that is more tailored for \n"
+ "Java. For instance, namespaces will be presented as packages, qualified \n"
+ "scopes will look different, etc. \n",
+ FALSE
+ );
+ cb = addBool(
+ "OPTIMIZE_FOR_FORTRAN",
+ "Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran \n"
+ "sources only. Doxygen will then generate output that is more tailored for \n"
+ "Fortran. \n",
+ FALSE
+ );
+ cb = addBool(
+ "OPTIMIZE_OUTPUT_VHDL",
+ "Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL \n"
+ "sources. Doxygen will then generate output that is tailored for \n"
+ "VHDL. \n",
+ FALSE
+ );
+ cl = addList( "EXTENSION_MAPPING",
+ "Doxygen selects the parser to use depending on the extension of the files it parses. \n"
+ "With this tag you can assign which parser to use for a given extension. \n"
+ "Doxygen has a built-in mapping, but you can override or extend it using this tag. \n"
+ "The format is ext=language, where ext is a file extension, and language is one of \n"
+ "the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, \n"
+ "Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat \n"
+ ".inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), \n"
+ "use: inc=Fortran f=C\n"
+ );
+ cb = addBool(
+ "BUILTIN_STL_SUPPORT",
+ "If you use STL classes (i.e. std::string, std::vector, etc.) but do not want \n"
+ "to include (a tag file for) the STL sources as input, then you should \n"
+ "set this tag to YES in order to let doxygen match functions declarations and \n"
+ "definitions whose arguments contain STL classes (e.g. func(std::string); v.s. \n"
+ "func(std::string) {}). This also make the inheritance and collaboration \n"
+ "diagrams that involve STL classes more complete and accurate. \n",
+ FALSE
+ );
+ cb = addBool(
+ "CPP_CLI_SUPPORT",
+ "If you use Microsoft's C++/CLI language, you should set this option to YES to\n"
+ "enable parsing support.\n",
+ FALSE
+ );
+ cb = addBool(
+ "SIP_SUPPORT",
+ "Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. \n"
+ "Doxygen will parse them like normal C++ but will assume all classes use public \n"
+ "instead of private inheritance when no explicit protection keyword is present. \n",
+ FALSE
+ );
+ cb = addBool( "IDL_PROPERTY_SUPPORT",
+ "For Microsoft's IDL there are propget and propput attributes to indicate getter \n"
+ "and setter methods for a property. Setting this option to YES (the default) \n"
+ "will make doxygen to replace the get and set methods by a property in the \n"
+ "documentation. This will only work if the methods are indeed getting or \n"
+ "setting a simple type. If this is not the case, or you want to show the \n"
+ "methods anyway, you should set this option to NO. \n",
+ TRUE
+ );
+ cb = addBool(
+ "DISTRIBUTE_GROUP_DOC",
+ "If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC \n"
+ "tag is set to YES, then doxygen will reuse the documentation of the first \n"
+ "member in the group (if any) for the other members of the group. By default \n"
+ "all members of a group must be documented explicitly.\n",
+ FALSE
+ );
+ cb = addBool(
+ "SUBGROUPING",
+ "Set the SUBGROUPING tag to YES (the default) to allow class member groups of \n"
+ "the same type (for instance a group of public functions) to be put as a \n"
+ "subgroup of that type (e.g. under the Public Functions section). Set it to \n"
+ "NO to prevent subgrouping. Alternatively, this can be done per class using \n"
+ "the \\nosubgrouping command. \n",
+ TRUE
+ );
+ cb = addBool( "TYPEDEF_HIDES_STRUCT",
+ "When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum \n"
+ "is documented as struct, union, or enum with the name of the typedef. So \n"
+ "typedef struct TypeS {} TypeT, will appear in the documentation as a struct \n"
+ "with name TypeT. When disabled the typedef will appear as a member of a file, \n"
+ "namespace, or class. And the struct will be named TypeS. This can typically \n"
+ "be useful for C code in case the coding convention dictates that all compound \n"
+ "types are typedef'ed and only the typedef is referenced, never the tag name.\n",
+ FALSE
+ );
+ ci = addInt(
+ "SYMBOL_CACHE_SIZE",
+ "The SYMBOL_CACHE_SIZE determines the size of the internal cache use to \n"
+ "determine which symbols to keep in memory and which to flush to disk.\n"
+ "When the cache is full, less often used symbols will be written to disk.\n"
+ "For small to medium size projects (<1000 input files) the default value is \n"
+ "probably good enough. For larger projects a too small cache size can cause \n"
+ "doxygen to be busy swapping symbols to and from disk most of the time \n"
+ "causing a significant performance penality. \n"
+ "If the system has enough physical memory increasing the cache will improve the \n"
+ "performance by keeping more symbols in memory. Note that the value works on \n"
+ "a logarithmic scale so increasing the size by one will rougly double the \n"
+ "memory usage. The cache size is given by this formula: \n"
+ "2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, \n"
+ "corresponding to a cache size of 2^16 = 65536 symbols\n",
+ 0,9,0
+ );
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo("Build","Build related configuration options");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "EXTRACT_ALL",
+ "If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in \n"
+ "documentation are documented, even if no documentation was available. \n"
+ "Private class members and static file members will be hidden unless \n"
+ "the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES \n",
+ FALSE
+ );
+ cb = addBool(
+ "EXTRACT_PRIVATE",
+ "If the EXTRACT_PRIVATE tag is set to YES all private members of a class \n"
+ "will be included in the documentation. \n",
+ FALSE
+ );
+ cb = addBool(
+ "EXTRACT_STATIC",
+ "If the EXTRACT_STATIC tag is set to YES all static members of a file \n"
+ "will be included in the documentation. \n",
+ FALSE
+ );
+ cb = addBool(
+ "EXTRACT_LOCAL_CLASSES",
+ "If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) \n"
+ "defined locally in source files will be included in the documentation. \n"
+ "If set to NO only classes defined in header files are included. \n",
+ TRUE
+ );
+ cb = addBool(
+ "EXTRACT_LOCAL_METHODS",
+ "This flag is only useful for Objective-C code. When set to YES local \n"
+ "methods, which are defined in the implementation section but not in \n"
+ "the interface are included in the documentation. \n"
+ "If set to NO (the default) only methods in the interface are included. \n",
+ FALSE
+ );
+ cb = addBool(
+ "EXTRACT_ANON_NSPACES",
+ "If this flag is set to YES, the members of anonymous namespaces will be \n"
+ "extracted and appear in the documentation as a namespace called \n"
+ "'anonymous_namespace{file}', where file will be replaced with the base \n"
+ "name of the file that contains the anonymous namespace. By default \n"
+ "anonymous namespace are hidden. \n",
+ FALSE
+ );
+ cb = addBool(
+ "HIDE_UNDOC_MEMBERS",
+ "If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all \n"
+ "undocumented members of documented classes, files or namespaces. \n"
+ "If set to NO (the default) these members will be included in the \n"
+ "various overviews, but no documentation section is generated. \n"
+ "This option has no effect if EXTRACT_ALL is enabled. \n",
+ FALSE
+ );
+ cb = addBool(
+ "HIDE_UNDOC_CLASSES",
+ "If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all \n"
+ "undocumented classes that are normally visible in the class hierarchy. \n"
+ "If set to NO (the default) these classes will be included in the various \n"
+ "overviews. This option has no effect if EXTRACT_ALL is enabled. \n",
+ FALSE
+ );
+ cb = addBool(
+ "HIDE_FRIEND_COMPOUNDS",
+ "If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all \n"
+ "friend (class|struct|union) declarations. \n"
+ "If set to NO (the default) these declarations will be included in the \n"
+ "documentation. \n",
+ FALSE
+ );
+ cb = addBool(
+ "HIDE_IN_BODY_DOCS",
+ "If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any \n"
+ "documentation blocks found inside the body of a function. \n"
+ "If set to NO (the default) these blocks will be appended to the \n"
+ "function's detailed documentation block. \n",
+ FALSE
+ );
+ cb = addBool(
+ "INTERNAL_DOCS",
+ "The INTERNAL_DOCS tag determines if documentation \n"
+ "that is typed after a \\internal command is included. If the tag is set \n"
+ "to NO (the default) then the documentation will be excluded. \n"
+ "Set it to YES to include the internal documentation. \n",
+ FALSE
+ );
+ cb = addBool(
+ "CASE_SENSE_NAMES",
+ "If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate \n"
+ "file names in lower-case letters. If set to YES upper-case letters are also \n"
+ "allowed. This is useful if you have classes or files whose names only differ \n"
+ "in case and if your file system supports case sensitive file names. Windows \n"
+ "and Mac users are advised to set this option to NO.\n",
+ portable_fileSystemIsCaseSensitive()
+ );
+ cb = addBool(
+ "HIDE_SCOPE_NAMES",
+ "If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen \n"
+ "will show members with their full class and namespace scopes in the \n"
+ "documentation. If set to YES the scope will be hidden. \n",
+ FALSE
+ );
+ cb = addBool(
+ "SHOW_INCLUDE_FILES",
+ "If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen \n"
+ "will put a list of the files that are included by a file in the documentation \n"
+ "of that file. \n",
+ TRUE
+ );
+ cb = addBool(
+ "INLINE_INFO",
+ "If the INLINE_INFO tag is set to YES (the default) then a tag [inline] \n"
+ "is inserted in the documentation for inline members. \n",
+ TRUE
+ );
+ cb = addBool(
+ "SORT_MEMBER_DOCS",
+ "If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen \n"
+ "will sort the (detailed) documentation of file and class members \n"
+ "alphabetically by member name. If set to NO the members will appear in \n"
+ "declaration order. \n",
+ TRUE
+ );
+ cb = addBool(
+ "SORT_BRIEF_DOCS",
+ "If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the \n"
+ "brief documentation of file, namespace and class members alphabetically \n"
+ "by member name. If set to NO (the default) the members will appear in \n"
+ "declaration order. \n",
+ FALSE
+ );
+ cb = addBool(
+ "SORT_GROUP_NAMES",
+ "If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the \n"
+ "hierarchy of group names into alphabetical order. If set to NO (the default) \n"
+ "the group names will appear in their defined order. \n",
+ FALSE
+ );
+ cb = addBool(
+ "SORT_BY_SCOPE_NAME",
+ "If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be \n"
+ "sorted by fully-qualified names, including namespaces. If set to \n"
+ "NO (the default), the class list will be sorted only by class name, \n"
+ "not including the namespace part. \n"
+ "Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.\n"
+ "Note: This option applies only to the class list, not to the \n"
+ "alphabetical list.\n",
+ FALSE
+ );
+
+ cb = addBool(
+ "GENERATE_TODOLIST",
+ "The GENERATE_TODOLIST tag can be used to enable (YES) or \n"
+ "disable (NO) the todo list. This list is created by putting \\todo \n"
+ "commands in the documentation.\n",
+ TRUE
+ );
+ cb = addBool(
+ "GENERATE_TESTLIST",
+ "The GENERATE_TESTLIST tag can be used to enable (YES) or \n"
+ "disable (NO) the test list. This list is created by putting \\test \n"
+ "commands in the documentation.\n",
+ TRUE
+ );
+ cb = addBool(
+ "GENERATE_BUGLIST",
+ "The GENERATE_BUGLIST tag can be used to enable (YES) or \n"
+ "disable (NO) the bug list. This list is created by putting \\bug \n"
+ "commands in the documentation.\n",
+ TRUE
+ );
+ cb = addBool(
+ "GENERATE_DEPRECATEDLIST",
+ "The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or \n"
+ "disable (NO) the deprecated list. This list is created by putting \n"
+ "\\deprecated commands in the documentation.\n",
+ TRUE
+ );
+ cl = addList(
+ "ENABLED_SECTIONS",
+ "The ENABLED_SECTIONS tag can be used to enable conditional \n"
+ "documentation sections, marked by \\if sectionname ... \\endif. \n"
+ );
+ ci = addInt(
+ "MAX_INITIALIZER_LINES",
+ "The MAX_INITIALIZER_LINES tag determines the maximum number of lines \n"
+ "the initial value of a variable or define consists of for it to appear in \n"
+ "the documentation. If the initializer consists of more lines than specified \n"
+ "here it will be hidden. Use a value of 0 to hide initializers completely. \n"
+ "The appearance of the initializer of individual variables and defines in the \n"
+ "documentation can be controlled using \\showinitializer or \\hideinitializer \n"
+ "command in the documentation regardless of this setting. \n",
+ 0,10000,30
+ );
+ cb = addBool(
+ "SHOW_USED_FILES",
+ "Set the SHOW_USED_FILES tag to NO to disable the list of files generated \n"
+ "at the bottom of the documentation of classes and structs. If set to YES the \n"
+ "list will mention the files that were used to generate the documentation. \n",
+ TRUE
+ );
+ cb = addBool(
+ "SHOW_DIRECTORIES",
+ "If the sources in your project are distributed over multiple directories \n"
+ "then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy \n"
+ "in the documentation. The default is NO.\n",
+ FALSE
+ );
+ cb = addBool(
+ "SHOW_FILES",
+ "Set the SHOW_FILES tag to NO to disable the generation of the Files page.\n"
+ "This will remove the Files entry from the Quick Index and from the \n"
+ "Folder Tree View (if specified). The default is YES.\n",
+ TRUE
+ );
+ cb = addBool(
+ "SHOW_NAMESPACES",
+ "Set the SHOW_NAMESPACES tag to NO to disable the generation of the \n"
+ "Namespaces page. This will remove the Namespaces entry from the Quick Index\n"
+ "and from the Folder Tree View (if specified). The default is YES.\n",
+ TRUE
+ );
+ cs = addString( "FILE_VERSION_FILTER",
+ "The FILE_VERSION_FILTER tag can be used to specify a program or script that \n"
+ "doxygen should invoke to get the current version for each file (typically from \n"
+ "the version control system). Doxygen will invoke the program by executing (via \n"
+ "popen()) the command <command> <input-file>, where <command> is the value of \n"
+ "the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file \n"
+ "provided by doxygen. Whatever the program writes to standard output \n"
+ "is used as the file version. See the manual for examples. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs = addString( "LAYOUT_FILE",
+ "The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by \n"
+ "doxygen. The layout file controls the global structure of the generated output files \n"
+ "in an output format independent way. The create the layout file that represents \n"
+ "doxygen's defaults, run doxygen with the -l option. You can optionally specify a \n"
+ "file name after the option, if omitted DoxygenLayout.xml will be used as the name \n"
+ "of the layout file.\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ addObsolete("DETAILS_AT_TOP");
+
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Messages","configuration options related to warning and progress messages");
+ //-----------------------------------------------------------------------------------------------
+
+ cb = addBool(
+ "QUIET",
+ "The QUIET tag can be used to turn on/off the messages that are generated \n"
+ "by doxygen. Possible values are YES and NO. If left blank NO is used. \n",
+ FALSE
+ );
+ cb = addBool(
+ "WARNINGS",
+ "The WARNINGS tag can be used to turn on/off the warning messages that are \n"
+ "generated by doxygen. Possible values are YES and NO. If left blank \n"
+ "NO is used. \n",
+ TRUE
+ );
+ cb = addBool(
+ "WARN_IF_UNDOCUMENTED",
+ "If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings \n"
+ "for undocumented members. If EXTRACT_ALL is set to YES then this flag will \n"
+ "automatically be disabled. \n",
+ TRUE
+ );
+ cb = addBool(
+ "WARN_IF_DOC_ERROR",
+ "If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for \n"
+ "potential errors in the documentation, such as not documenting some \n"
+ "parameters in a documented function, or documenting parameters that \n"
+ "don't exist or using markup commands wrongly. \n",
+ TRUE
+ );
+ cb = addBool( "WARN_NO_PARAMDOC",
+ "This WARN_NO_PARAMDOC option can be abled to get warnings for \n"
+ "functions that are documented, but have no documentation for their parameters \n"
+ "or return value. If set to NO (the default) doxygen will only warn about \n"
+ "wrong or incomplete parameter documentation, but not about the absence of \n"
+ "documentation.\n",
+ FALSE
+ );
+ cs = addString(
+ "WARN_FORMAT",
+ "The WARN_FORMAT tag determines the format of the warning messages that \n"
+ "doxygen can produce. The string should contain the $file, $line, and $text \n"
+ "tags, which will be replaced by the file and line number from which the \n"
+ "warning originated and the warning text. Optionally the format may contain \n"
+ "$version, which will be replaced by the version of the file (if it could \n"
+ "be obtained via FILE_VERSION_FILTER)\n"
+ );
+ cs->setDefaultValue("$file:$line: $text");
+ cs = addString(
+ "WARN_LOGFILE",
+ "The WARN_LOGFILE tag can be used to specify a file to which warning \n"
+ "and error messages should be written. If left blank the output is written \n"
+ "to stderr. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Input","configuration options related to the input files");
+ //-----------------------------------------------------------------------------------------------
+ cl = addList(
+ "INPUT",
+ "The INPUT tag can be used to specify the files and/or directories that contain \n"
+ "documented source files. You may enter file names like \"myfile.cpp\" or \n"
+ "directories like \"/usr/src/myproject\". Separate the files or directories \n"
+ "with spaces. \n"
+ );
+ cl->setWidgetType(ConfigList::FileAndDir);
+ cs = addString( "INPUT_ENCODING",
+ "This tag can be used to specify the character encoding of the source files \n"
+ "that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is \n"
+ "also the default input encoding. Doxygen uses libiconv (or the iconv built \n"
+ "into libc) for the transcoding. See http://www.gnu.org/software/libiconv for \n"
+ "the list of possible encodings.\n"
+ );
+ cs->setDefaultValue("UTF-8");
+ cl = addList(
+ "FILE_PATTERNS",
+ "If the value of the INPUT tag contains directories, you can use the \n"
+ "FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp \n"
+ "and *.h) to filter out the source-files in the directories. If left \n"
+ "blank the following patterns are tested: \n"
+ "*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx \n"
+ "*.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90\n"
+ );
+ cb = addBool(
+ "RECURSIVE",
+ "The RECURSIVE tag can be used to turn specify whether or not subdirectories \n"
+ "should be searched for input files as well. Possible values are YES and NO. \n"
+ "If left blank NO is used. \n",
+ FALSE
+ );
+ cl = addList(
+ "EXCLUDE",
+ "The EXCLUDE tag can be used to specify files and/or directories that should \n"
+ "excluded from the INPUT source files. This way you can easily exclude a \n"
+ "subdirectory from a directory tree whose root is specified with the INPUT tag. \n"
+ );
+ cb = addBool(
+ "EXCLUDE_SYMLINKS",
+ "The EXCLUDE_SYMLINKS tag can be used select whether or not files or \n"
+ "directories that are symbolic links (a Unix filesystem feature) are excluded \n"
+ "from the input. \n",
+ FALSE
+ );
+ cl->setWidgetType(ConfigList::FileAndDir);
+ cl = addList(
+ "EXCLUDE_PATTERNS",
+ "If the value of the INPUT tag contains directories, you can use the \n"
+ "EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude \n"
+ "certain files from those directories. Note that the wildcards are matched \n"
+ "against the file with absolute path, so to exclude all test directories \n"
+ "for example use the pattern */test/* \n"
+ );
+ cl = addList(
+ "EXCLUDE_SYMBOLS",
+ "The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names \n"
+ "(namespaces, classes, functions, etc.) that should be excluded from the \n"
+ "output. The symbol name can be a fully qualified name, a word, or if the \n"
+ "wildcard * is used, a substring. Examples: ANamespace, AClass, \n"
+ "AClass::ANamespace, ANamespace::*Test \n"
+ );
+ cl = addList(
+ "EXAMPLE_PATH",
+ "The EXAMPLE_PATH tag can be used to specify one or more files or \n"
+ "directories that contain example code fragments that are included (see \n"
+ "the \\include command). \n"
+ );
+ cl->setWidgetType(ConfigList::Dir);
+ cl = addList(
+ "EXAMPLE_PATTERNS",
+ "If the value of the EXAMPLE_PATH tag contains directories, you can use the \n"
+ "EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp \n"
+ "and *.h) to filter out the source-files in the directories. If left \n"
+ "blank all files are included. \n"
+ );
+ cb = addBool(
+ "EXAMPLE_RECURSIVE",
+ "If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be \n"
+ "searched for input files to be used with the \\include or \\dontinclude \n"
+ "commands irrespective of the value of the RECURSIVE tag. \n"
+ "Possible values are YES and NO. If left blank NO is used. \n",
+ FALSE
+ );
+ cl = addList(
+ "IMAGE_PATH",
+ "The IMAGE_PATH tag can be used to specify one or more files or \n"
+ "directories that contain image that are included in the documentation (see \n"
+ "the \\image command). \n"
+ );
+ cl->setWidgetType(ConfigList::Dir);
+ cs = addString(
+ "INPUT_FILTER",
+ "The INPUT_FILTER tag can be used to specify a program that doxygen should \n"
+ "invoke to filter for each input file. Doxygen will invoke the filter program \n"
+ "by executing (via popen()) the command <filter> <input-file>, where <filter> \n"
+ "is the value of the INPUT_FILTER tag, and <input-file> is the name of an \n"
+ "input file. Doxygen will then use the output that the filter program writes \n"
+ "to standard output. If FILTER_PATTERNS is specified, this tag will be \n"
+ "ignored. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cl = addList(
+ "FILTER_PATTERNS",
+ "The FILTER_PATTERNS tag can be used to specify filters on a per file pattern \n"
+ "basis. Doxygen will compare the file name with each pattern and apply the \n"
+ "filter if there is a match. The filters are a list of the form: \n"
+ "pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further \n"
+ "info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER \n"
+ "is applied to all files. \n"
+ );
+ cl->setWidgetType(ConfigList::File);
+ cb = addBool(
+ "FILTER_SOURCE_FILES",
+ "If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using \n"
+ "INPUT_FILTER) will be used to filter the input files when producing source \n"
+ "files to browse (i.e. when SOURCE_BROWSER is set to YES). \n",
+ FALSE
+ );
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Source Browser","configuration options related to source browsing");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "SOURCE_BROWSER",
+ "If the SOURCE_BROWSER tag is set to YES then a list of source files will \n"
+ "be generated. Documented entities will be cross-referenced with these sources. \n"
+ "Note: To get rid of all source code in the generated output, make sure also \n"
+ "VERBATIM_HEADERS is set to NO. \n",
+ FALSE
+ );
+ cb = addBool(
+ "INLINE_SOURCES",
+ "Setting the INLINE_SOURCES tag to YES will include the body \n"
+ "of functions and classes directly in the documentation. \n",
+ FALSE
+ );
+ cb = addBool(
+ "STRIP_CODE_COMMENTS",
+ "Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct \n"
+ "doxygen to hide any special comment blocks from generated source code \n"
+ "fragments. Normal C and C++ comments will always remain visible. \n",
+ TRUE
+ );
+ cb = addBool( "REFERENCED_BY_RELATION",
+ "If the REFERENCED_BY_RELATION tag is set to YES \n"
+ "then for each documented function all documented \n"
+ "functions referencing it will be listed. \n",
+ FALSE
+ );
+ cb = addBool( "REFERENCES_RELATION",
+ "If the REFERENCES_RELATION tag is set to YES \n"
+ "then for each documented function all documented entities \n"
+ "called/used by that function will be listed. \n",
+ FALSE
+ );
+ cb = addBool( "REFERENCES_LINK_SOURCE",
+ "If the REFERENCES_LINK_SOURCE tag is set to YES (the default)\n"
+ "and SOURCE_BROWSER tag is set to YES, then the hyperlinks from\n"
+ "functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will\n"
+ "link to the source code. Otherwise they will link to the documentstion.\n",
+ TRUE
+ );
+ cb = addBool(
+ "USE_HTAGS",
+ "If the USE_HTAGS tag is set to YES then the references to source code \n"
+ "will point to the HTML generated by the htags(1) tool instead of doxygen \n"
+ "built-in source browser. The htags tool is part of GNU's global source \n"
+ "tagging system (see http://www.gnu.org/software/global/global.html). You \n"
+ "will need version 4.8.6 or higher. \n",
+ FALSE
+ );
+ cb->addDependency("SOURCE_BROWSER");
+ cb = addBool(
+ "VERBATIM_HEADERS",
+ "If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen \n"
+ "will generate a verbatim copy of the header file for each class for \n"
+ "which an include is specified. Set to NO to disable this. \n",
+ TRUE
+ );
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Index","configuration options related to the alphabetical class index");
+ //-----------------------------------------------------------------------------------------------
+
+ cb = addBool(
+ "ALPHABETICAL_INDEX",
+ "If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index \n"
+ "of all compounds will be generated. Enable this if the project \n"
+ "contains a lot of classes, structs, unions or interfaces. \n",
+ FALSE
+ );
+ ci = addInt(
+ "COLS_IN_ALPHA_INDEX",
+ "If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then \n"
+ "the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns \n"
+ "in which this list will be split (can be a number in the range [1..20]) \n",
+ 1,20,5
+ );
+ cl = addList(
+ "IGNORE_PREFIX",
+ "In case all classes in a project start with a common prefix, all \n"
+ "classes will be put under the same header in the alphabetical index. \n"
+ "The IGNORE_PREFIX tag can be used to specify one or more prefixes that \n"
+ "should be ignored while generating the index headers. \n"
+ );
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "HTML","configuration options related to the HTML output");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "GENERATE_HTML",
+ "If the GENERATE_HTML tag is set to YES (the default) Doxygen will \n"
+ "generate HTML output. \n",
+ TRUE
+ );
+ cs = addString(
+ "HTML_OUTPUT",
+ "The HTML_OUTPUT tag is used to specify where the HTML docs will be put. \n"
+ "If a relative path is entered the value of OUTPUT_DIRECTORY will be \n"
+ "put in front of it. If left blank `html' will be used as the default path. \n"
+ );
+ cs->setDefaultValue("html");
+ cs->setWidgetType(ConfigString::Dir);
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "HTML_FILE_EXTENSION",
+ "The HTML_FILE_EXTENSION tag can be used to specify the file extension for \n"
+ "each generated HTML page (for example: .htm,.php,.asp). If it is left blank \n"
+ "doxygen will generate files with .html extension.\n"
+ );
+ cs->setDefaultValue(".html");
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "HTML_HEADER",
+ "The HTML_HEADER tag can be used to specify a personal HTML header for \n"
+ "each generated HTML page. If it is left blank doxygen will generate a \n"
+ "standard header.\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "HTML_FOOTER",
+ "The HTML_FOOTER tag can be used to specify a personal HTML footer for \n"
+ "each generated HTML page. If it is left blank doxygen will generate a \n"
+ "standard footer.\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "HTML_STYLESHEET",
+ "The HTML_STYLESHEET tag can be used to specify a user-defined cascading \n"
+ "style sheet that is used by each HTML page. It can be used to \n"
+ "fine-tune the look of the HTML output. If the tag is left blank doxygen \n"
+ "will generate a default style sheet. Note that doxygen will try to copy \n"
+ "the style sheet file to the HTML output directory, so don't put your own \n"
+ "stylesheet in the HTML output directory as well, or it will be erased! \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+ cb = addBool(
+ "HTML_ALIGN_MEMBERS",
+ "If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, \n"
+ "files or namespaces will be aligned in HTML using tables. If set to \n"
+ "NO a bullet list will be used. \n",
+ TRUE
+ );
+ cb->addDependency("GENERATE_HTML");
+ cb = addBool(
+ "HTML_DYNAMIC_SECTIONS",
+ "If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML \n"
+ "documentation will contain sections that can be hidden and shown after the \n"
+ "page has loaded. For this to work a browser that supports \n"
+ "JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox \n"
+ "Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+
+ /////////////////////////////////////////////////////////
+ // Docsets //////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
+
+ cb = addBool( "GENERATE_DOCSET",
+ "If the GENERATE_DOCSET tag is set to YES, additional index files \n"
+ "will be generated that can be used as input for Apple's Xcode 3 \n"
+ "integrated development environment, introduced with OSX 10.5 (Leopard). \n"
+ "To create a documentation set, doxygen will generate a Makefile in the \n"
+ "HTML output directory. Running make will produce the docset in that \n"
+ "directory and running \"make install\" will install the docset in \n"
+ "~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find \n"
+ "it at startup. \n"
+ "See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html "
+ "for more information. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+ cs = addString(
+ "DOCSET_FEEDNAME",
+ "When GENERATE_DOCSET tag is set to YES, this tag determines the name of the \n"
+ "feed. A documentation feed provides an umbrella under which multiple \n"
+ "documentation sets from a single provider (such as a company or product suite) \n"
+ "can be grouped. \n"
+ );
+ cs->setDefaultValue("Doxygen generated docs");
+ cs->addDependency("GENERATE_DOCSET");
+ cs = addString(
+ "DOCSET_BUNDLE_ID",
+ "When GENERATE_DOCSET tag is set to YES, this tag specifies a string that \n"
+ "should uniquely identify the documentation set bundle. This should be a \n"
+ "reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen \n"
+ "will append .docset to the name. \n"
+ );
+ cs->setDefaultValue("org.doxygen.Project");
+ cs->addDependency("GENERATE_DOCSET");
+
+ /////////////////////////////////////////////////////////
+ // HTMLHELP /////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
+
+ cb = addBool(
+ "GENERATE_HTMLHELP",
+ "If the GENERATE_HTMLHELP tag is set to YES, additional index files \n"
+ "will be generated that can be used as input for tools like the \n"
+ "Microsoft HTML help workshop to generate a compiled HTML help file (.chm) \n"
+ "of the generated HTML documentation. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+ cs = addString(
+ "CHM_FILE",
+ "If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can \n"
+ "be used to specify the file name of the resulting .chm file. You \n"
+ "can add a path in front of the file if the result should not be \n"
+ "written to the html output directory. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "HHC_LOCATION",
+ "If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can \n"
+ "be used to specify the location (absolute path including file name) of \n"
+ "the HTML help compiler (hhc.exe). If non-empty doxygen will try to run \n"
+ "the HTML help compiler on the generated index.hhp.\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+#if 0
+ cs = addString(
+ "QTHELP_FILE",
+ "If the GENERATE_HTMLHELP tag is set to YES, the QTHELP_FILE tag can \n"
+ "be used to specify the file name of the resulting .(qch|qhp) file. \n"
+ "You can add a path in front of the file if the result should not be \n"
+ "written to the html output directory. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "QTHELP_CONFIG",
+ "If DOXYGEN2QTHELP_LOC is set, QTHELP_CONFIG must specify the file name \n"
+ "of a config file to pass to doxygen2qthelp. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+ cs = addString(
+ "DOXYGEN2QTHELP_LOC",
+ "If the GENERATE_HTMLHELP tag is set to YES, the DOXYGEN2QTHELP_LOC tag \n"
+ "can be used to specify the location (absolute path including file name) of \n"
+ "the doxygen2qthelp tool. If non-empty doxygen will try to run doxygen2qthelp \n"
+ "on the generated index.hhp.\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_HTML");
+#endif
+ addObsolete("QTHELP_FILE");
+ addObsolete("QTHELP_CONFIG");
+ addObsolete("DOXYGEN2QTHELP_LOC");
+ cb = addBool(
+ "GENERATE_CHI",
+ "If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag \n"
+ "controls if a separate .chi index file is generated (YES) or that \n"
+ "it should be included in the master .chm file (NO).\n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+ cs = addString(
+ "CHM_INDEX_ENCODING",
+ "If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING\n"
+ "is used to encode HtmlHelp index (hhk), content (hhc) and project file\n"
+ "content.\n"
+ );
+ cs->addDependency("GENERATE_HTML");
+ cb = addBool(
+ "BINARY_TOC",
+ "If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag \n"
+ "controls whether a binary table of contents is generated (YES) or a \n"
+ "normal table of contents (NO) in the .chm file.\n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+ cb = addBool(
+ "TOC_EXPAND",
+ "The TOC_EXPAND flag can be set to YES to add extra items for group members \n"
+ "to the contents of the HTML help documentation and to the tree view. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+
+ /////////////////////////////////////////////////////////
+ // QT HELP //////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
+
+ cb = addBool(
+ "GENERATE_QHP",
+ "If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER \n"
+ "are set, an additional index file will be generated that can be used as input for \n"
+ "Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated \n"
+ "HTML documentation. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+ cs = addString(
+ "QCH_FILE",
+ "If the QHG_LOCATION tag is specified, the QCH_FILE tag can \n"
+ "be used to specify the file name of the resulting .qch file. \n"
+ "The path specified is relative to the HTML output folder. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_QHP");
+ cs = addString(
+ "QHP_NAMESPACE",
+ "The QHP_NAMESPACE tag specifies the namespace to use when generating \n"
+ "Qt Help Project output. For more information please see \n"
+ "http://doc.trolltech.com/qthelpproject.html#namespace \n"
+ );
+ cs->addDependency("GENERATE_QHP");
+ cs = addString(
+ "QHP_VIRTUAL_FOLDER",
+ "The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating \n"
+ "Qt Help Project output. For more information please see \n"
+ "http://doc.trolltech.com/qthelpproject.html#virtual-folders \n"
+ );
+ cs->setDefaultValue("doc");
+ cs->addDependency("GENERATE_QHP");
+
+ cs = addString(
+ "QHP_CUSTOM_FILTER_NAME",
+ "If QHP_CUSTOM_FILTER_NAME is set, it specifies the name of a custom filter to add. \n"
+ "For more information please see \n"
+ "http://doc.trolltech.com/qthelpproject.html#custom-filters \n"
+ );
+ cs->addDependency("GENERATE_QHP");
+
+ cs = addString(
+ "QHP_CUST_FILTER_ATTRS",
+ "The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add."
+ "For more information please see \n"
+ "<a href=\"http://doc.trolltech.com/qthelpproject.html#custom-filters\">Qt Help Project / Custom Filters</a>. \n"
+ );
+ cs->addDependency("GENERATE_QHP");
+
+ cs = addString(
+ "QHP_SECT_FILTER_ATTRS",
+ "The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's \n"
+ "filter section matches. \n"
+ "<a href=\"http://doc.trolltech.com/qthelpproject.html#filter-attributes\">Qt Help Project / Filter Attributes</a>. \n"
+ );
+ cs->addDependency("GENERATE_QHP");
+
+ cs = addString(
+ "QHG_LOCATION",
+ "If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can \n"
+ "be used to specify the location of Qt's qhelpgenerator. \n"
+ "If non-empty doxygen will try to run qhelpgenerator on the generated \n"
+ ".qhp file .\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_QHP");
+
+ /////////////////////////////////////////////////////////
+ // MISC /////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////
+
+ cb = addBool(
+ "DISABLE_INDEX",
+ "The DISABLE_INDEX tag can be used to turn on/off the condensed index at \n"
+ "top of each HTML page. The value NO (the default) enables the index and \n"
+ "the value YES disables it. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_HTML");
+ ci = addInt(
+ "ENUM_VALUES_PER_LINE",
+ "This tag can be used to set the number of enum values (range [1..20]) \n"
+ "that doxygen will group on one line in the generated HTML documentation. \n",
+ 1,20,4
+ );
+ ci->addDependency("GENERATE_HTML");
+ ce = addEnum(
+ "GENERATE_TREEVIEW",
+ "The GENERATE_TREEVIEW tag is used to specify whether a tree-like index\n"
+ "structure should be generated to display hierarchical information.\n"
+ "If the tag value is set to FRAME, a side panel will be generated\n"
+ "containing a tree-like index structure (just like the one that \n"
+ "is generated for HTML Help). For this to work a browser that supports \n"
+ "JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, \n"
+ "Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are \n"
+ "probably better off using the HTML help feature. Other possible values \n"
+ "for this tag are: HIERARCHIES, which will generate the Groups, Directories,\n"
+ "and Class Hierarchy pages using a tree view instead of an ordered list;\n"
+ "ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which\n"
+ "disables this behavior completely. For backwards compatibility with previous\n"
+ "releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE\n"
+ "respectively.\n",
+ "NONE"
+ );
+ ce->addValue("NONE");
+ ce->addValue("FRAME");
+ ce->addValue("HIERARCHIES");
+ ce->addValue("ALL");
+ cb->addDependency("GENERATE_HTML");
+ ci = addInt(
+ "TREEVIEW_WIDTH",
+ "If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be \n"
+ "used to set the initial width (in pixels) of the frame in which the tree \n"
+ "is shown. \n",
+ 0,1500,250
+ );
+ ci->addDependency("GENERATE_HTML");
+ ci = addInt(
+ "FORMULA_FONTSIZE",
+ "Use this tag to change the font size of Latex formulas included \n"
+ "as images in the HTML documentation. The default is 10. Note that \n"
+ "when you change the font size after a successful doxygen run you need \n"
+ "to manually remove any form_*.png images from the HTML output directory \n"
+ "to force them to be regenerated. \n",
+ 8,50,10
+ );
+ ci->addDependency("GENERATE_HTML");
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "LaTeX","configuration options related to the LaTeX output");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "GENERATE_LATEX",
+ "If the GENERATE_LATEX tag is set to YES (the default) Doxygen will \n"
+ "generate Latex output. \n",
+ TRUE
+ );
+ cs = addString(
+ "LATEX_OUTPUT",
+ "The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. \n"
+ "If a relative path is entered the value of OUTPUT_DIRECTORY will be \n"
+ "put in front of it. If left blank `latex' will be used as the default path. \n"
+ );
+ cs->setDefaultValue("latex");
+ cs->setWidgetType(ConfigString::Dir);
+ cs->addDependency("GENERATE_LATEX");
+#if 0
+ cs = addString( "LATEX_OUTPUT_ENCODING",
+ "The LATEX_OUTPUT_ENCODING specifies the character encoding of the LaTeX output.\n"
+ "produced by doxygen. If left blank ISO-8859-1 will be used. Doxygen uses \n"
+ "libiconv for the transcoding. See http://www.gnu.org/software/libiconv for \n"
+ "the list of possible encodings.\n"
+ );
+ cs->setDefaultValue("ISO-8859-1");
+ cs->addDependency("GENERATE_LATEX");
+#endif
+ cs = addString(
+ "LATEX_CMD_NAME",
+ "The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be \n"
+ "invoked. If left blank `latex' will be used as the default command name. \n"
+ );
+ cs->setDefaultValue("latex");
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_LATEX");
+ cs = addString(
+ "MAKEINDEX_CMD_NAME",
+ "The MAKEINDEX_CMD_NAME tag can be used to specify the command name to \n"
+ "generate index for LaTeX. If left blank `makeindex' will be used as the \n"
+ "default command name. \n"
+ );
+ cs->setDefaultValue("makeindex");
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_LATEX");
+ cb = addBool(
+ "COMPACT_LATEX",
+ "If the COMPACT_LATEX tag is set to YES Doxygen generates more compact \n"
+ "LaTeX documents. This may be useful for small projects and may help to \n"
+ "save some trees in general. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_LATEX");
+ ce = addEnum(
+ "PAPER_TYPE",
+ "The PAPER_TYPE tag can be used to set the paper type that is used \n"
+ "by the printer. Possible values are: a4, a4wide, letter, legal and \n"
+ "executive. If left blank a4wide will be used. \n",
+ "a4wide"
+ );
+ ce->addValue("a4");
+ ce->addValue("a4wide");
+ ce->addValue("letter");
+ ce->addValue("legal");
+ ce->addValue("executive");
+ ce->addDependency("GENERATE_LATEX");
+ cl = addList(
+ "EXTRA_PACKAGES",
+ "The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX \n"
+ "packages that should be included in the LaTeX output. \n"
+ );
+ cl->addDependency("GENERATE_LATEX");
+ cs = addString(
+ "LATEX_HEADER",
+ "The LATEX_HEADER tag can be used to specify a personal LaTeX header for \n"
+ "the generated latex document. The header should contain everything until \n"
+ "the first chapter. If it is left blank doxygen will generate a \n"
+ "standard header. Notice: only use this tag if you know what you are doing! \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_LATEX");
+ cb = addBool(
+ "PDF_HYPERLINKS",
+ "If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated \n"
+ "is prepared for conversion to pdf (using ps2pdf). The pdf file will \n"
+ "contain links (just like the HTML output) instead of page references \n"
+ "This makes the output suitable for online browsing using a pdf viewer. \n",
+ TRUE
+ );
+ cb->addDependency("GENERATE_LATEX");
+ cb = addBool(
+ "USE_PDFLATEX",
+ "If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of \n"
+ "plain latex in the generated Makefile. Set this option to YES to get a \n"
+ "higher quality PDF documentation. \n",
+ TRUE
+ );
+ cb->addDependency("GENERATE_LATEX");
+ cb = addBool(
+ "LATEX_BATCHMODE",
+ "If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\\\batchmode. \n"
+ "command to the generated LaTeX files. This will instruct LaTeX to keep \n"
+ "running if errors occur, instead of asking the user for help. \n"
+ "This option is also used when generating formulas in HTML. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_LATEX");
+ cb = addBool(
+ "LATEX_HIDE_INDICES",
+ "If LATEX_HIDE_INDICES is set to YES then doxygen will not \n"
+ "include the index chapters (such as File Index, Compound Index, etc.) \n"
+ "in the output. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_LATEX");
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "RTF","configuration options related to the RTF output");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "GENERATE_RTF",
+ "If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output \n"
+ "The RTF output is optimized for Word 97 and may not look very pretty with \n"
+ "other RTF readers or editors.\n",
+ FALSE
+ );
+ cs = addString(
+ "RTF_OUTPUT",
+ "The RTF_OUTPUT tag is used to specify where the RTF docs will be put. \n"
+ "If a relative path is entered the value of OUTPUT_DIRECTORY will be \n"
+ "put in front of it. If left blank `rtf' will be used as the default path. \n"
+ );
+ cs->setDefaultValue("rtf");
+ cs->setWidgetType(ConfigString::Dir);
+ cs->addDependency("GENERATE_RTF");
+#if 0
+ cs = addString( "RTF_OUTPUT_ENCODING",
+ "The RTF_OUTPUT_ENCODING specifies the character encoding of the RTF output.\n"
+ "produced by doxygen. If left blank ISO-8859-1 will be used. Doxygen uses \n"
+ "libiconv for the transcoding. See http://www.gnu.org/software/libiconv for \n"
+ "the list of possible encodings.\n"
+ );
+ cs->setDefaultValue("ISO-8859-1");
+ cs->addDependency("GENERATE_RTF");
+#endif
+ cb = addBool(
+ "COMPACT_RTF",
+ "If the COMPACT_RTF tag is set to YES Doxygen generates more compact \n"
+ "RTF documents. This may be useful for small projects and may help to \n"
+ "save some trees in general. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_RTF");
+ cb = addBool(
+ "RTF_HYPERLINKS",
+ "If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated \n"
+ "will contain hyperlink fields. The RTF file will \n"
+ "contain links (just like the HTML output) instead of page references. \n"
+ "This makes the output suitable for online browsing using WORD or other \n"
+ "programs which support those fields. \n"
+ "Note: wordpad (write) and others do not support links. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_RTF");
+ cs = addString(
+ "RTF_STYLESHEET_FILE",
+ "Load stylesheet definitions from file. Syntax is similar to doxygen's \n"
+ "config file, i.e. a series of assignments. You only have to provide \n"
+ "replacements, missing definitions are set to their default value. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_RTF");
+ cs = addString(
+ "RTF_EXTENSIONS_FILE",
+ "Set optional variables used in the generation of an rtf document. \n"
+ "Syntax is similar to doxygen's config file.\n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cs->addDependency("GENERATE_RTF");
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Man","configuration options related to the man page output");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "GENERATE_MAN",
+ "If the GENERATE_MAN tag is set to YES (the default) Doxygen will \n"
+ "generate man pages \n",
+ FALSE
+ );
+ cs = addString(
+ "MAN_OUTPUT",
+ "The MAN_OUTPUT tag is used to specify where the man pages will be put. \n"
+ "If a relative path is entered the value of OUTPUT_DIRECTORY will be \n"
+ "put in front of it. If left blank `man' will be used as the default path. \n"
+ );
+ cs->setDefaultValue("man");
+ cs->setWidgetType(ConfigString::Dir);
+ cs->addDependency("GENERATE_MAN");
+ cs = addString(
+ "MAN_EXTENSION",
+ "The MAN_EXTENSION tag determines the extension that is added to \n"
+ "the generated man pages (default is the subroutine's section .3) \n"
+ );
+ cs->setDefaultValue(".3");
+ cs->addDependency("GENERATE_MAN");
+ cb = addBool(
+ "MAN_LINKS",
+ "If the MAN_LINKS tag is set to YES and Doxygen generates man output, \n"
+ "then it will generate one additional man file for each entity \n"
+ "documented in the real man page(s). These additional files \n"
+ "only source the real man page, but without them the man command \n"
+ "would be unable to find the correct page. The default is NO. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_MAN");
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "XML","configuration options related to the XML output");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "GENERATE_XML",
+ "If the GENERATE_XML tag is set to YES Doxygen will \n"
+ "generate an XML file that captures the structure of \n"
+ "the code including all documentation. \n",
+ FALSE
+ );
+ cs = addString(
+ "XML_OUTPUT",
+ "The XML_OUTPUT tag is used to specify where the XML pages will be put. \n"
+ "If a relative path is entered the value of OUTPUT_DIRECTORY will be \n"
+ "put in front of it. If left blank `xml' will be used as the default path. \n"
+ );
+ cs->setDefaultValue("xml");
+ cs->setWidgetType(ConfigString::Dir);
+ cs->addDependency("GENERATE_XML");
+ cs = addString(
+ "XML_SCHEMA",
+ "The XML_SCHEMA tag can be used to specify an XML schema, \n"
+ "which can be used by a validating XML parser to check the \n"
+ "syntax of the XML files. \n"
+ );
+ cs->addDependency("GENERATE_XML");
+ cs = addString(
+ "XML_DTD",
+ "The XML_DTD tag can be used to specify an XML DTD, \n"
+ "which can be used by a validating XML parser to check the \n"
+ "syntax of the XML files. \n"
+ );
+ cs->addDependency("GENERATE_XML");
+ cb = addBool(
+ "XML_PROGRAMLISTING",
+ "If the XML_PROGRAMLISTING tag is set to YES Doxygen will \n"
+ "dump the program listings (including syntax highlighting \n"
+ "and cross-referencing information) to the XML output. Note that \n"
+ "enabling this will significantly increase the size of the XML output. \n",
+ TRUE
+ );
+ cb->addDependency("GENERATE_XML");
+
+ //--------------------------------------------------------------------------
+ addInfo( "DEF","configuration options for the AutoGen Definitions output");
+ //--------------------------------------------------------------------------
+ cb = addBool("GENERATE_AUTOGEN_DEF",
+
+ "If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will \n"
+ "generate an AutoGen Definitions (see autogen.sf.net) file \n"
+ "that captures the structure of the code including all \n"
+ "documentation. Note that this feature is still experimental \n"
+ "and incomplete at the moment. \n",
+
+ FALSE );
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "PerlMod","configuration options related to the Perl module output");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "GENERATE_PERLMOD",
+ "If the GENERATE_PERLMOD tag is set to YES Doxygen will \n"
+ "generate a Perl module file that captures the structure of \n"
+ "the code including all documentation. Note that this \n"
+ "feature is still experimental and incomplete at the \n"
+ "moment. \n",
+ FALSE
+ );
+ cb = addBool(
+ "PERLMOD_LATEX",
+ "If the PERLMOD_LATEX tag is set to YES Doxygen will generate \n"
+ "the necessary Makefile rules, Perl scripts and LaTeX code to be able \n"
+ "to generate PDF and DVI output from the Perl module output. \n",
+ FALSE
+ );
+ cb->addDependency("GENERATE_PERLMOD");
+ cb = addBool(
+ "PERLMOD_PRETTY",
+ "If the PERLMOD_PRETTY tag is set to YES the Perl module output will be \n"
+ "nicely formatted so it can be parsed by a human reader. This is useful \n"
+ "if you want to understand what is going on. On the other hand, if this \n"
+ "tag is set to NO the size of the Perl module output will be much smaller \n"
+ "and Perl will parse it just the same. \n",
+ TRUE
+ );
+ cb->addDependency("GENERATE_PERLMOD");
+ cs = addString(
+ "PERLMOD_MAKEVAR_PREFIX",
+ "The names of the make variables in the generated doxyrules.make file \n"
+ "are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. \n"
+ "This is useful so different doxyrules.make files included by the same \n"
+ "Makefile don't overwrite each other's variables."
+ );
+ cs->addDependency("GENERATE_PERLMOD");
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Preprocessor","Configuration options related to the preprocessor ");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "ENABLE_PREPROCESSING",
+ "If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will \n"
+ "evaluate all C-preprocessor directives found in the sources and include \n"
+ "files. \n",
+ TRUE
+ );
+ cb = addBool(
+ "MACRO_EXPANSION",
+ "If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro \n"
+ "names in the source code. If set to NO (the default) only conditional \n"
+ "compilation will be performed. Macro expansion can be done in a controlled \n"
+ "way by setting EXPAND_ONLY_PREDEF to YES. \n",
+ FALSE
+ );
+ cb->addDependency("ENABLE_PREPROCESSING");
+ cb = addBool(
+ "EXPAND_ONLY_PREDEF",
+ "If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES \n"
+ "then the macro expansion is limited to the macros specified with the \n"
+ "PREDEFINED and EXPAND_AS_DEFINED tags. \n",
+ FALSE
+ );
+ cb->addDependency("ENABLE_PREPROCESSING");
+ cb = addBool(
+ "SEARCH_INCLUDES",
+ "If the SEARCH_INCLUDES tag is set to YES (the default) the includes files \n"
+ "in the INCLUDE_PATH (see below) will be search if a #include is found. \n",
+ TRUE
+ );
+ cb->addDependency("ENABLE_PREPROCESSING");
+ cl = addList(
+ "INCLUDE_PATH",
+ "The INCLUDE_PATH tag can be used to specify one or more directories that \n"
+ "contain include files that are not input files but should be processed by \n"
+ "the preprocessor.\n"
+ );
+ cl->setWidgetType(ConfigList::Dir);
+ cl->addDependency("ENABLE_PREPROCESSING");
+ cl = addList(
+ "INCLUDE_FILE_PATTERNS",
+ "You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard \n"
+ "patterns (like *.h and *.hpp) to filter out the header-files in the \n"
+ "directories. If left blank, the patterns specified with FILE_PATTERNS will \n"
+ "be used. \n"
+ );
+ cl->addDependency("ENABLE_PREPROCESSING");
+ cl = addList(
+ "PREDEFINED",
+ "The PREDEFINED tag can be used to specify one or more macro names that \n"
+ "are defined before the preprocessor is started (similar to the -D option of \n"
+ "gcc). The argument of the tag is a list of macros of the form: name \n"
+ "or name=definition (no spaces). If the definition and the = are \n"
+ "omitted =1 is assumed. To prevent a macro definition from being \n"
+ "undefined via #undef or recursively expanded use the := operator \n"
+ "instead of the = operator.\n"
+ );
+ cl->addDependency("ENABLE_PREPROCESSING");
+ cl = addList(
+ "EXPAND_AS_DEFINED",
+ "If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then \n"
+ "this tag can be used to specify a list of macro names that should be expanded. \n"
+ "The macro definition that is found in the sources will be used. \n"
+ "Use the PREDEFINED tag if you want to use a different macro definition. \n"
+ );
+ cl->addDependency("ENABLE_PREPROCESSING");
+ cb = addBool(
+ "SKIP_FUNCTION_MACROS",
+ "If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then \n"
+ "doxygen's preprocessor will remove all function-like macros that are alone \n"
+ "on a line, have an all uppercase name, and do not end with a semicolon. Such \n"
+ "function macros are typically used for boiler-plate code, and will confuse \n"
+ "the parser if not removed. \n",
+ TRUE
+ );
+ cb->addDependency("ENABLE_PREPROCESSING");
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "External","Configuration::additions related to external references ");
+ //-----------------------------------------------------------------------------------------------
+ cl = addList(
+ "TAGFILES",
+ "The TAGFILES option can be used to specify one or more tagfiles. \n"
+ "Optionally an initial location of the external documentation \n"
+ "can be added for each tagfile. The format of a tag file without \n"
+ "this location is as follows: \n"
+ " TAGFILES = file1 file2 ... \n"
+ "Adding location for the tag files is done as follows: \n"
+ " TAGFILES = file1=loc1 \"file2 = loc2\" ... \n"
+ "where \"loc1\" and \"loc2\" can be relative or absolute paths or \n"
+ "URLs. If a location is present for each tag, the installdox tool \n"
+ "does not have to be run to correct the links.\n"
+ "Note that each tag file must have a unique name\n"
+ "(where the name does NOT include the path)\n"
+ "If a tag file is not located in the directory in which doxygen \n"
+ "is run, you must also specify the path to the tagfile here. \n"
+ );
+ cl->setWidgetType(ConfigList::File);
+ cs = addString(
+ "GENERATE_TAGFILE",
+ "When a file name is specified after GENERATE_TAGFILE, doxygen will create \n"
+ "a tag file that is based on the input files it reads. \n"
+ );
+ cs->setWidgetType(ConfigString::File);
+ cb = addBool(
+ "ALLEXTERNALS",
+ "If the ALLEXTERNALS tag is set to YES all external classes will be listed \n"
+ "in the class index. If set to NO only the inherited external classes \n"
+ "will be listed. \n",
+ FALSE
+ );
+ cb = addBool(
+ "EXTERNAL_GROUPS",
+ "If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed \n"
+ "in the modules index. If set to NO, only the current project's groups will \n"
+ "be listed. \n",
+ TRUE
+ );
+ cs = addString(
+ "PERL_PATH",
+ "The PERL_PATH should be the absolute path and name of the perl script \n"
+ "interpreter (i.e. the result of `which perl'). \n"
+ );
+ cs->setDefaultValue("/usr/bin/perl");
+ cs->setWidgetType(ConfigString::Dir);
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Dot","Configuration options related to the dot tool ");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "CLASS_DIAGRAMS",
+ "If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will \n"
+ "generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base \n"
+ "or super classes. Setting the tag to NO turns the diagrams off. Note that \n"
+ "this option is superseded by the HAVE_DOT option below. This is only a \n"
+ "fallback. It is recommended to install and use dot, since it yields more \n"
+ "powerful graphs. \n",
+ TRUE
+ );
+ cs = addString( "MSCGEN_PATH",
+ "You can define message sequence charts within doxygen comments using the \\msc \n"
+ "command. Doxygen will then run the mscgen tool (see \n"
+ "http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the \n"
+ "documentation. The MSCGEN_PATH tag allows you to specify the directory where \n"
+ "the mscgen tool resides. If left empty the tool is assumed to be found in the \n"
+ "default search path. \n"
+ );
+ cb = addBool(
+ "HIDE_UNDOC_RELATIONS",
+ "If set to YES, the inheritance and collaboration graphs will hide \n"
+ "inheritance and usage relations if the target is undocumented \n"
+ "or is not a class. \n",
+ TRUE
+ );
+ cb = addBool(
+ "HAVE_DOT",
+ "If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is \n"
+ "available from the path. This tool is part of Graphviz, a graph visualization \n"
+ "toolkit from AT&T and Lucent Bell Labs. The other options in this section \n"
+ "have no effect if this option is set to NO (the default) \n",
+ FALSE
+ );
+ cs = addString( "DOT_FONTNAME",
+ "By default doxygen will write a font called FreeSans.ttf to the output \n"
+ "directory and reference it in all dot files that doxygen generates. This \n"
+ "font does not include all possible unicode characters however, so when you need \n"
+ "these (or just want a differently looking font) you can specify the font name \n"
+ "using DOT_FONTNAME. You need need to make sure dot is able to find the font, \n"
+ "which can be done by putting it in a standard location or by setting the \n"
+ "DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory \n"
+ "containing the font. \n"
+ );
+ cs->setDefaultValue("FreeSans");
+ cb->addDependency("HAVE_DOT");
+ ci = addInt( "DOT_FONTSIZE",
+ "The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. \n"
+ "The default size is 10pt. \n",
+ 4,24,10
+ );
+ ci->addDependency("HAVE_DOT");
+ cs = addString( "DOT_FONTPATH",
+ "By default doxygen will tell dot to use the output directory to look for the \n"
+ "FreeSans.ttf font (which doxygen will put there itself). If you specify a \n"
+ "different font using DOT_FONTNAME you can set the path where dot \n"
+ "can find it using this tag. \n"
+ );
+ cs->addDependency("HAVE_DOT");
+ cb = addBool(
+ "CLASS_GRAPH",
+ "If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen \n"
+ "will generate a graph for each documented class showing the direct and \n"
+ "indirect inheritance relations. Setting this tag to YES will force the \n"
+ "the CLASS_DIAGRAMS tag to NO.\n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "COLLABORATION_GRAPH",
+ "If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen \n"
+ "will generate a graph for each documented class showing the direct and \n"
+ "indirect implementation dependencies (inheritance, containment, and \n"
+ "class references variables) of the class with other documented classes. \n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "GROUP_GRAPHS",
+ "If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen \n"
+ "will generate a graph for groups, showing the direct groups dependencies\n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "UML_LOOK",
+ "If the UML_LOOK tag is set to YES doxygen will generate inheritance and \n"
+ "collaboration diagrams in a style similar to the OMG's Unified Modeling \n"
+ "Language. \n",
+ FALSE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "TEMPLATE_RELATIONS",
+ "If set to YES, the inheritance and collaboration graphs will show the \n"
+ "relations between templates and their instances. \n",
+ FALSE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "INCLUDE_GRAPH",
+ "If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT \n"
+ "tags are set to YES then doxygen will generate a graph for each documented \n"
+ "file showing the direct and indirect include dependencies of the file with \n"
+ "other documented files. \n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "INCLUDED_BY_GRAPH",
+ "If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and \n"
+ "HAVE_DOT tags are set to YES then doxygen will generate a graph for each \n"
+ "documented header file showing the documented files that directly or \n"
+ "indirectly include this file. \n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "CALL_GRAPH",
+ "If the CALL_GRAPH and HAVE_DOT options are set to YES then \n"
+ "doxygen will generate a call dependency graph for every global function \n"
+ "or class method. Note that enabling this option will significantly increase \n"
+ "the time of a run. So in most cases it will be better to enable call graphs \n"
+ "for selected functions only using the \\callgraph command.\n",
+ FALSE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "CALLER_GRAPH",
+ "If the CALLER_GRAPH and HAVE_DOT tags are set to YES then \n"
+ "doxygen will generate a caller dependency graph for every global function \n"
+ "or class method. Note that enabling this option will significantly increase \n"
+ "the time of a run. So in most cases it will be better to enable caller \n"
+ "graphs for selected functions only using the \\callergraph command.\n",
+ FALSE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "GRAPHICAL_HIERARCHY",
+ "If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen \n"
+ "will graphical hierarchy of all classes instead of a textual one. \n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "DIRECTORY_GRAPH",
+ "If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES \n"
+ "then doxygen will show the dependencies a directory has on other directories \n"
+ "in a graphical way. The dependency relations are determined by the #include\n"
+ "relations between the files in the directories.\n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ ce = addEnum(
+ "DOT_IMAGE_FORMAT",
+ "The DOT_IMAGE_FORMAT tag can be used to set the image format of the images \n"
+ "generated by dot. Possible values are png, jpg, or gif\n"
+ "If left blank png will be used. \n",
+ "png"
+ );
+ ce->addValue("png");
+ ce->addValue("jpg");
+ ce->addValue("gif");
+ ce->addDependency("HAVE_DOT");
+ cs = addString(
+ "DOT_PATH",
+ "The tag DOT_PATH can be used to specify the path where the dot tool can be \n"
+ "found. If left blank, it is assumed the dot tool can be found in the path. \n"
+ );
+ cs->setWidgetType(ConfigString::Dir);
+ cs->addDependency("HAVE_DOT");
+ cl = addList(
+ "DOTFILE_DIRS",
+ "The DOTFILE_DIRS tag can be used to specify one or more directories that \n"
+ "contain dot files that are included in the documentation (see the \n"
+ "\\dotfile command). \n"
+ );
+ cl->setWidgetType(ConfigList::Dir);
+ cl->addDependency("HAVE_DOT");
+ ci = addInt(
+ "DOT_GRAPH_MAX_NODES",
+ "The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of \n"
+ "nodes that will be shown in the graph. If the number of nodes in a graph \n"
+ "becomes larger than this value, doxygen will truncate the graph, which is \n"
+ "visualized by representing a node as a red box. Note that doxygen if the \n"
+ "number of direct children of the root node in a graph is already larger than \n"
+ "DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note \n"
+ "that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. \n",
+ 0,10000, 50
+ );
+ ci->addDependency("HAVE_DOT");
+ ci = addInt(
+ "MAX_DOT_GRAPH_DEPTH",
+ "The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the \n"
+ "graphs generated by dot. A depth value of 3 means that only nodes reachable \n"
+ "from the root by following a path via at most 3 edges will be shown. Nodes \n"
+ "that lay further from the root node will be omitted. Note that setting this \n"
+ "option to 1 or 2 may greatly reduce the computation time needed for large \n"
+ "code bases. Also note that the size of a graph can be further restricted by \n"
+ "DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.\n",
+ 0,1000,0
+ );
+ ci->addDependency("HAVE_DOT");
+ addObsolete("MAX_DOT_GRAPH_WIDTH");
+ addObsolete("MAX_DOT_GRAPH_HEIGHT");
+ cb = addBool(
+ "DOT_TRANSPARENT",
+ "Set the DOT_TRANSPARENT tag to YES to generate images with a transparent \n"
+ "background. This is disabled by default, because dot on Windows does not \n"
+ "seem to support this out of the box. Warning: Depending on the platform used, \n"
+ "enabling this option may lead to badly anti-aliased labels on the edges of \n"
+ "a graph (i.e. they become hard to read). \n",
+ FALSE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "DOT_MULTI_TARGETS",
+ "Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output \n"
+ "files in one run (i.e. multiple -o and -T options on the command line). This \n"
+ "makes dot run faster, but since only newer versions of dot (>1.8.10) \n"
+ "support this, this feature is disabled by default. \n",
+ FALSE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "GENERATE_LEGEND",
+ "If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will \n"
+ "generate a legend page explaining the meaning of the various boxes and \n"
+ "arrows in the dot generated graphs. \n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+ cb = addBool(
+ "DOT_CLEANUP",
+ "If the DOT_CLEANUP tag is set to YES (the default) Doxygen will \n"
+ "remove the intermediate dot files that are used to generate \n"
+ "the various graphs. \n",
+ TRUE
+ );
+ cb->addDependency("HAVE_DOT");
+
+ //-----------------------------------------------------------------------------------------------
+ addInfo( "Search","Configuration::additions related to the search engine ");
+ //-----------------------------------------------------------------------------------------------
+ cb = addBool(
+ "SEARCHENGINE",
+ "The SEARCHENGINE tag specifies whether or not a search engine should be \n"
+ "used. If set to NO the values of all tags below this one will be ignored. \n",
+ FALSE
+ );
+ addObsolete("CGI_NAME");
+ addObsolete("CGI_URL");
+ addObsolete("DOC_URL");
+ addObsolete("DOC_ABSPATH");
+ addObsolete("BIN_ABSPATH");
+ addObsolete("EXT_DOC_PATHS");
+
+ // The IMAGE_PATTERNS tag is now officially obsolete.
+}
+
+static QCString configFileToString(const char *name)
+{
+ if (name==0 || name[0]==0) return 0;
+ QFile f;
+
+ bool fileOpened=FALSE;
+ if (name[0]=='-' && name[1]==0) // read from stdin
+ {
+ fileOpened=f.open(IO_ReadOnly,stdin);
+ if (fileOpened)
+ {
+ const int bSize=4096;
+ QCString contents(bSize);
+ int totalSize=0;
+ int size;
+ while ((size=f.readBlock(contents.data()+totalSize,bSize))==bSize)
+ {
+ totalSize+=bSize;
+ contents.resize(totalSize+bSize);
+ }
+ totalSize+=size+2;
+ contents.resize(totalSize);
+ contents.at(totalSize-2)='\n'; // to help the scanner
+ contents.at(totalSize-1)='\0';
+ return contents;
+ }
+ }
+ else // read from file
+ {
+ QFileInfo fi(name);
+ if (!fi.exists() || !fi.isFile())
+ {
+ config_err("Error: file `%s' not found\n",name);
+ return "";
+ }
+ f.setName(name);
+ fileOpened=f.open(IO_ReadOnly);
+ if (fileOpened)
+ {
+ int fsize=f.size();
+ QCString contents(fsize+2);
+ f.readBlock(contents.data(),fsize);
+ f.close();
+ if (fsize==0 || contents[fsize-1]=='\n')
+ contents[fsize]='\0';
+ else
+ contents[fsize]='\n'; // to help the scanner
+ contents[fsize+1]='\0';
+ return contents;
+ }
+ }
+ if (!fileOpened)
+ {
+ config_err("Error: cannot open file `%s' for reading\n",name);
+ }
+ return "";
+}
+
+bool Config::parseString(const char *fn,const char *str)
+{
+ config = Config::instance();
+ inputString = str;
+ inputPosition = 0;
+ yyFileName = fn;
+ yyLineNr = 1;
+ includeStack.setAutoDelete(TRUE);
+ includeStack.clear();
+ includeDepth = 0;
+ configYYrestart( configYYin );
+ BEGIN( Start );
+ configYYlex();
+ inputString = 0;
+ return TRUE;
+}
+
+bool Config::parse(const char *fn)
+{
+ return parseString(fn,configFileToString(fn));
+}
+
+extern "C" { // some bogus code to keep the compiler happy
+ //int configYYwrap() { return 1 ; }
+}
+
diff --git a/parts/doxygen/config.h b/parts/doxygen/config.h
new file mode 100644
index 00000000..a72002c1
--- /dev/null
+++ b/parts/doxygen/config.h
@@ -0,0 +1,579 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include <qstrlist.h>
+#include <qfile.h>
+#include <qdict.h>
+#include <qptrlist.h>
+#include <qtextstream.h>
+
+/*! \brief Abstract base class for any configuration option.
+ *
+ */
+class ConfigOption
+{
+ friend class Config;
+
+ public:
+
+ /*! The type of option */
+ enum OptionType
+ {
+ O_Info, //<! A section header
+ O_List, //<! A list of items
+ O_Enum, //<! A fixed set of items
+ O_String, //<! A single item
+ O_Int, //<! An integer value
+ O_Bool, //<! A boolean value
+ O_Obsolete //<! An obsolete option
+ };
+ enum
+ {
+ /*! Maximum length of an option in the config file. Used for
+ * alignment purposes.
+ */
+ MAX_OPTION_LENGTH = 23
+ };
+ ConfigOption(OptionType t) : m_kind(t)
+ {
+ m_spaces.fill(' ',40);
+ }
+ virtual ~ConfigOption()
+ {
+ }
+
+ /*! returns the kind of option this is. */
+ OptionType kind() const { return m_kind; }
+ QCString name() const { return m_name; }
+ QCString docs() const { return m_doc; }
+
+ QCString dependsOn() const { return m_dependency; }
+ void addDependency(const char *dep) { m_dependency = dep; }
+ void setEncoding(const QCString &e) { m_encoding = e; }
+
+ protected:
+ virtual void writeTemplate(QTextStream &t,bool sl,bool upd) = 0;
+ virtual void convertStrToVal() {}
+ virtual void substEnvVars() = 0;
+ virtual void init() {}
+
+ QCString convertToComment(const QCString &s);
+ void writeBoolValue(QTextStream &t,bool v);
+ void writeIntValue(QTextStream &t,int i);
+ void writeStringValue(QTextStream &t,QCString &s);
+ void writeStringList(QTextStream &t,QStrList &l);
+
+ QCString m_spaces;
+ QCString m_name;
+ QCString m_doc;
+ QCString m_dependency;
+ QCString m_encoding;
+ OptionType m_kind;
+};
+
+/*! \brief Section marker for grouping the configuration options
+ *
+ */
+class ConfigInfo : public ConfigOption
+{
+ public:
+ ConfigInfo(const char *name,const char *doc)
+ : ConfigOption(O_Info)
+ {
+ m_name = name;
+ m_doc = doc;
+ }
+ void writeTemplate(QTextStream &t, bool sl,bool)
+ {
+ if (!sl)
+ {
+ t << "\n";
+ }
+ t << "#---------------------------------------------------------------------------\n";
+ t << "# " << m_doc << endl;
+ t << "#---------------------------------------------------------------------------\n";
+ }
+ void substEnvVars() {}
+};
+
+/*! \brief Option of the list type.
+ *
+ */
+class ConfigList : public ConfigOption
+{
+ public:
+ enum WidgetType { String, File, Dir, FileAndDir };
+ ConfigList(const char *name,const char *doc)
+ : ConfigOption(O_List)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_widgetType = String;
+ }
+ void addValue(const char *v) { m_value.append(v); }
+ void setWidgetType(WidgetType w) { m_widgetType = w; }
+ WidgetType widgetType() const { return m_widgetType; }
+ QStrList *valueRef() { return &m_value; }
+ void writeTemplate(QTextStream &t,bool sl,bool)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeStringList(t,m_value);
+ t << "\n";
+ }
+ void substEnvVars();
+ void init() { m_value.clear(); }
+ private:
+ QStrList m_value;
+ WidgetType m_widgetType;
+};
+
+/*! \brief Option of the enum type.
+ *
+ */
+class ConfigEnum : public ConfigOption
+{
+ public:
+ ConfigEnum(const char *name,const char *doc,const char *defVal)
+ : ConfigOption(O_Enum)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_value = defVal;
+ m_defValue = defVal;
+ }
+ void addValue(const char *v) { m_valueRange.append(v); }
+ QStrListIterator iterator()
+ {
+ return QStrListIterator(m_valueRange);
+ }
+ QCString *valueRef() { return &m_value; }
+ void substEnvVars();
+ void writeTemplate(QTextStream &t,bool sl,bool)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeStringValue(t,m_value);
+ t << "\n";
+ }
+ void init() { m_value = m_defValue.copy(); }
+
+ private:
+ QStrList m_valueRange;
+ QCString m_value;
+ QCString m_defValue;
+};
+
+/*! \brief Option of the string type.
+ *
+ */
+class ConfigString : public ConfigOption
+{
+ public:
+ enum WidgetType { String, File, Dir };
+ ConfigString(const char *name,const char *doc)
+ : ConfigOption(O_String)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_widgetType = String;
+ }
+ ~ConfigString()
+ {
+ }
+ void setWidgetType(WidgetType w) { m_widgetType = w; }
+ WidgetType widgetType() const { return m_widgetType; }
+ void setDefaultValue(const char *v) { m_defValue = v; }
+ QCString *valueRef() { return &m_value; }
+ void writeTemplate(QTextStream &t,bool sl,bool)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeStringValue(t,m_value);
+ t << "\n";
+ }
+ void substEnvVars();
+ void init() { m_value = m_defValue.copy(); }
+
+ private:
+ QCString m_value;
+ QCString m_defValue;
+ WidgetType m_widgetType;
+};
+
+/*! \brief Option of the integer type.
+ *
+ */
+class ConfigInt : public ConfigOption
+{
+ public:
+ ConfigInt(const char *name,const char *doc,int minVal,int maxVal,int defVal)
+ : ConfigOption(O_Int)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_value = defVal;
+ m_defValue = defVal;
+ m_minVal = minVal;
+ m_maxVal = maxVal;
+ }
+ QCString *valueStringRef() { return &m_valueString; }
+ int *valueRef() { return &m_value; }
+ int minVal() const { return m_minVal; }
+ int maxVal() const { return m_maxVal; }
+ void convertStrToVal();
+ void substEnvVars();
+ void writeTemplate(QTextStream &t,bool sl,bool upd)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ if (upd && !m_valueString.isEmpty())
+ {
+ writeStringValue(t,m_valueString);
+ }
+ else
+ {
+ writeIntValue(t,m_value);
+ }
+ t << "\n";
+ }
+ void init() { m_value = m_defValue; }
+ private:
+ int m_value;
+ int m_defValue;
+ int m_minVal;
+ int m_maxVal;
+ QCString m_valueString;
+};
+
+/*! \brief Option of the boolean type.
+ *
+ */
+class ConfigBool : public ConfigOption
+{
+ public:
+ ConfigBool(const char *name,const char *doc,bool defVal)
+ : ConfigOption(O_Bool)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_value = defVal;
+ m_defValue = defVal;
+ }
+ QCString *valueStringRef() { return &m_valueString; }
+ bool *valueRef() { return &m_value; }
+ void convertStrToVal();
+ void substEnvVars();
+ void setValueString(const QCString &v) { m_valueString = v; }
+ void writeTemplate(QTextStream &t,bool sl,bool upd)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ if (upd && !m_valueString.isEmpty())
+ {
+ writeStringValue(t,m_valueString);
+ }
+ else
+ {
+ writeBoolValue(t,m_value);
+ }
+ t << "\n";
+ }
+ void init() { m_value = m_defValue; }
+ private:
+ bool m_value;
+ bool m_defValue;
+ QCString m_valueString;
+};
+
+/*! \brief Section marker for obsolete options
+ *
+ */
+class ConfigObsolete : public ConfigOption
+{
+ public:
+ ConfigObsolete(OptionType t) : ConfigOption(t) {}
+ void writeTemplate(QTextStream &,bool,bool) {}
+ void substEnvVars() {}
+};
+
+
+// some convenience macros
+#define Config_getString(val) Config::instance()->getString(__FILE__,__LINE__,val)
+#define Config_getInt(val) Config::instance()->getInt(__FILE__,__LINE__,val)
+#define Config_getList(val) Config::instance()->getList(__FILE__,__LINE__,val)
+#define Config_getEnum(val) Config::instance()->getEnum(__FILE__,__LINE__,val)
+#define Config_getBool(val) Config::instance()->getBool(__FILE__,__LINE__,val)
+
+/*! \brief Singleton for configuration variables.
+ *
+ * This object holds the global static variables
+ * read from a user-supplied configuration file.
+ * The static member instance() can be used to get
+ * a pointer to the one and only instance.
+ *
+ * Set all variables to their default values by
+ * calling Config::instance()->init()
+ *
+ */
+class Config
+{
+ public:
+ /////////////////////////////
+ // public API
+ /////////////////////////////
+
+ /*! Returns the one and only instance of this class */
+ static Config *instance()
+ {
+ if (m_instance==0) m_instance = new Config;
+ return m_instance;
+ }
+ /*! Delete the instance */
+ static void deleteInstance()
+ {
+ delete m_instance;
+ m_instance=0;
+ }
+
+ /*! Returns an iterator that can by used to iterate over the
+ * configuration options.
+ */
+ QPtrListIterator<ConfigOption> iterator()
+ {
+ return QPtrListIterator<ConfigOption>(*m_options);
+ }
+
+ /*!
+ * @name Getting configuration values.
+ * @{
+ */
+
+ /*! Returns the value of the string option with name \a fileName.
+ * The arguments \a num and \a name are for debugging purposes only.
+ * There is a convenience function Config_getString() for this.
+ */
+ QCString &getString(const char *fileName,int num,const char *name) const;
+
+ /*! Returns the value of the list option with name \a fileName.
+ * The arguments \a num and \a name are for debugging purposes only.
+ * There is a convenience function Config_getList() for this.
+ */
+ QStrList &getList(const char *fileName,int num,const char *name) const;
+
+ /*! Returns the value of the enum option with name \a fileName.
+ * The arguments \a num and \a name are for debugging purposes only.
+ * There is a convenience function Config_getEnum() for this.
+ */
+ QCString &getEnum(const char *fileName,int num,const char *name) const;
+
+ /*! Returns the value of the integer option with name \a fileName.
+ * The arguments \a num and \a name are for debugging purposes only.
+ * There is a convenience function Config_getInt() for this.
+ */
+ int &getInt(const char *fileName,int num,const char *name) const;
+
+ /*! Returns the value of the boolean option with name \a fileName.
+ * The arguments \a num and \a name are for debugging purposes only.
+ * There is a convenience function Config_getBool() for this.
+ */
+ bool &getBool(const char *fileName,int num,const char *name) const;
+
+ /*! Returns the ConfigOption corresponding with \a name or 0 if
+ * the option is not supported.
+ */
+ ConfigOption *get(const char *name) const
+ {
+ return m_dict->find(name);
+ }
+ /* @} */
+
+ /*!
+ * @name Adding configuration options.
+ * @{
+ */
+
+ /*! Starts a new configuration section with \a name and description \a doc.
+ * \returns An object representing the option.
+ */
+ ConfigInfo *addInfo(const char *name,const char *doc)
+ {
+ ConfigInfo *result = new ConfigInfo(name,doc);
+ m_options->append(result);
+ return result;
+ }
+
+ /*! Adds a new string option with \a name and documentation \a doc.
+ * \returns An object representing the option.
+ */
+ ConfigString *addString(const char *name,
+ const char *doc)
+ {
+ ConfigString *result = new ConfigString(name,doc);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+
+ /*! Adds a new enumeration option with \a name and documentation \a doc
+ * and initial value \a defVal.
+ * \returns An object representing the option.
+ */
+ ConfigEnum *addEnum(const char *name,
+ const char *doc,
+ const char *defVal)
+ {
+ ConfigEnum *result = new ConfigEnum(name,doc,defVal);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+
+ /*! Adds a new string option with \a name and documentation \a doc.
+ * \returns An object representing the option.
+ */
+ ConfigList *addList(const char *name,
+ const char *doc)
+ {
+ ConfigList *result = new ConfigList(name,doc);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+
+ /*! Adds a new integer option with \a name and documentation \a doc.
+ * The integer has a range between \a minVal and \a maxVal and a
+ * default value of \a defVal.
+ * \returns An object representing the option.
+ */
+ ConfigInt *addInt(const char *name,
+ const char *doc,
+ int minVal,int maxVal,int defVal)
+ {
+ ConfigInt *result = new ConfigInt(name,doc,minVal,maxVal,defVal);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+
+ /*! Adds a new boolean option with \a name and documentation \a doc.
+ * The boolean has a default value of \a defVal.
+ * \returns An object representing the option.
+ */
+ ConfigBool *addBool(const char *name,
+ const char *doc,
+ bool defVal)
+ {
+ ConfigBool *result = new ConfigBool(name,doc,defVal);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+ /*! Adds an option that has become obsolete. */
+ ConfigOption *addObsolete(const char *name)
+ {
+ ConfigObsolete *option = new ConfigObsolete(ConfigOption::O_Obsolete);
+ m_dict->insert(name,option);
+ m_obsolete->append(option);
+ return option;
+ }
+ /*! @} */
+
+ /*! Writes a template configuration to stream \a t. If \a shortIndex
+ * is \c TRUE the description of each configuration option will
+ * be omitted.
+ */
+ void writeTemplate(QTextStream &t,bool shortIndex,bool updateOnly);
+
+ /////////////////////////////
+ // internal API
+ /////////////////////////////
+
+ /*! Converts the string values read from the configuration file
+ * to real values for non-string type options (like int, and bools)
+ */
+ void convertStrToVal();
+
+ /*! Replaces references to environment variable by the actual value
+ * of the environment variable.
+ */
+ void substituteEnvironmentVars();
+
+ /*! Checks if the values of the variable are correct, adjusts them
+ * if needed, and report any errors.
+ */
+ void check();
+
+ /*! Initialize config variables to their default value */
+ void init();
+
+ /*! Parse a configuration data in string \a str.
+ * \returns TRUE if successful, or FALSE if the string could not be
+ * parsed.
+ */
+ bool parseString(const char *fn,const char *str);
+
+ /*! Parse a configuration file with name \a fn.
+ * \returns TRUE if successful, FALSE if the file could not be
+ * opened or read.
+ */
+ bool parse(const char *fn);
+
+ /*! Called from the constructor, will add doxygen's default options
+ * to the configuration object
+ */
+ void create();
+
+ protected:
+
+ Config()
+ {
+ m_options = new QPtrList<ConfigOption>;
+ m_obsolete = new QPtrList<ConfigOption>;
+ m_dict = new QDict<ConfigOption>(257);
+ m_options->setAutoDelete(TRUE);
+ m_obsolete->setAutoDelete(TRUE);
+ m_initialized = FALSE;
+ create();
+ }
+ ~Config()
+ {
+ delete m_options;
+ delete m_obsolete;
+ delete m_dict;
+ }
+
+ private:
+ QPtrList<ConfigOption> *m_options;
+ QPtrList<ConfigOption> *m_obsolete;
+ QDict<ConfigOption> *m_dict;
+ static Config *m_instance;
+ bool m_initialized;
+};
+
+#endif
diff --git a/parts/doxygen/doxygenconfigwidget.cpp b/parts/doxygen/doxygenconfigwidget.cpp
new file mode 100644
index 00000000..27f39863
--- /dev/null
+++ b/parts/doxygen/doxygenconfigwidget.cpp
@@ -0,0 +1,275 @@
+/***************************************************************************
+ * Copyright (C) 2000 by Dimitri van Heesch *
+ * dimitri@stack.nl *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+***************************************************************************/
+
+#include "doxygenconfigwidget.h"
+
+#include <qscrollview.h>
+#include <qvbox.h>
+#include <qwhatsthis.h>
+#include <qtextstream.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+
+#include "config.h"
+#include "input.h"
+#include "messages.h"
+
+
+DoxygenConfigWidget::DoxygenConfigWidget(const QString &fileName, QWidget *parent, const char *name)
+ : QTabWidget(parent, name)
+{
+ m_hasChanged = false;
+ m_dependencies = new QDict< QPtrList<IInput> >(257);
+ m_dependencies->setAutoDelete(true);
+ m_inputWidgets = new QDict< IInput >;
+ m_switches = new QDict< QObject >;
+
+ QPtrListIterator<ConfigOption> options = Config::instance()->iterator();
+ QScrollView *page = 0;
+ QVBox *pagebox = 0;
+ ConfigOption *option = 0;
+ for (options.toFirst(); (option=options.current()); ++options) {
+ switch(option->kind())
+ {
+ case ConfigOption::O_Info:
+ page = new QScrollView(this, option->name());
+ page->viewport()->setBackgroundMode(PaletteBackground);
+ pagebox = new QVBox(0);
+ Q_ASSERT(pagebox!=0);
+ page->addChild(pagebox);
+ addTab(page, message(option->name()));
+ QWhatsThis::add(page, option->docs().simplifyWhiteSpace() );
+ break;
+ case ConfigOption::O_String:
+ {
+ Q_ASSERT(pagebox!=0);
+ InputString::StringMode sm = InputString::StringFree;
+ switch (((ConfigString *)option)->widgetType()) {
+ case ConfigString::String: sm = InputString::StringFree; break;
+ case ConfigString::File: sm = InputString::StringFile; break;
+ case ConfigString::Dir: sm = InputString::StringDir; break;
+ }
+ InputString *inputString = new InputString
+ ( message(option->name()), // name
+ pagebox, // widget
+ *((ConfigString *)option)->valueRef(), // variable
+ sm // type
+ );
+ QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace());
+ connect(inputString, SIGNAL(changed()), this, SLOT(changed()));
+ m_inputWidgets->insert(option->name(), inputString);
+ addDependency(m_switches, option->dependsOn(), option->name());
+ }
+ break;
+ case ConfigOption::O_Enum:
+ {
+ Q_ASSERT(pagebox!=0);
+ InputString *inputString = new InputString
+ ( message(option->name()), // name
+ pagebox, // widget
+ *((ConfigEnum *)option)->valueRef(), // variable
+ InputString::StringFixed // type
+ );
+ QStrListIterator sli=((ConfigEnum *)option)->iterator();
+ for (sli.toFirst(); sli.current(); ++sli)
+ inputString->addValue(sli.current());
+ QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace());
+ connect(inputString, SIGNAL(changed()), this, SLOT(changed()));
+ m_inputWidgets->insert(option->name(),inputString);
+ addDependency(m_switches, option->dependsOn(), option->name());
+ }
+ break;
+ case ConfigOption::O_List:
+ {
+ Q_ASSERT(pagebox!=0);
+ InputStrList::ListMode lm = InputStrList::ListString;
+ switch(((ConfigList *)option)->widgetType())
+ {
+ case ConfigList::String: lm=InputStrList::ListString; break;
+ case ConfigList::File: lm=InputStrList::ListFile; break;
+ case ConfigList::Dir: lm=InputStrList::ListDir; break;
+ case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break;
+ }
+ InputStrList *inputStrList = new InputStrList
+ ( message(option->name()), // name
+ pagebox, // widget
+ *((ConfigList *)option)->valueRef(), // variable
+ lm // type
+ );
+ QWhatsThis::add(inputStrList, option->docs().simplifyWhiteSpace());
+ connect(inputStrList, SIGNAL(changed()), this, SLOT(changed()));
+ m_inputWidgets->insert(option->name(),inputStrList);
+ addDependency(m_switches, option->dependsOn(), option->name());
+ }
+ break;
+ case ConfigOption::O_Bool:
+ {
+ Q_ASSERT(pagebox!=0);
+ InputBool *inputBool = new InputBool
+ ( option->name(), // key
+ message(option->name()), // name
+ pagebox, // widget
+ *((ConfigBool *)option)->valueRef() // variable
+ );
+ QWhatsThis::add(inputBool, option->docs().simplifyWhiteSpace());
+ connect(inputBool, SIGNAL(changed()), this, SLOT(changed()));
+ m_inputWidgets->insert(option->name(), inputBool);
+ addDependency(m_switches, option->dependsOn(), option->name());
+ }
+ break;
+ case ConfigOption::O_Int:
+ {
+ Q_ASSERT(pagebox!=0);
+ InputInt *inputInt = new InputInt
+ ( message(option->name()), // name
+ pagebox, // widget
+ *((ConfigInt *)option)->valueRef(), // variable
+ ((ConfigInt *)option)->minVal(), // min value
+ ((ConfigInt *)option)->maxVal() // max value
+ );
+ QWhatsThis::add(inputInt, option->docs().simplifyWhiteSpace());
+ connect(inputInt, SIGNAL(changed()), this, SLOT(changed()));
+ m_inputWidgets->insert(option->name(), inputInt);
+ addDependency(m_switches, option->dependsOn(), option->name());
+ }
+ break;
+ case ConfigOption::O_Obsolete:
+ break;
+ }
+ }
+
+ QDictIterator<QObject> di(*m_switches);
+ for (; di.current(); ++di) {
+ QObject *obj = di.current();
+ connect(obj, SIGNAL(toggle(const QString&, bool)), this, SLOT(toggle(const QString&, bool)));
+ // UGLY HACK: assumes each item depends on a boolean without checking!
+ emit toggle(di.currentKey(), ((InputBool *)obj)->getState());
+ }
+
+ m_fileName = fileName;
+ loadFile();
+}
+
+
+DoxygenConfigWidget::~DoxygenConfigWidget()
+{
+ delete m_dependencies;
+ delete m_inputWidgets;
+ delete m_switches;
+}
+
+
+QSize DoxygenConfigWidget::sizeHint() const
+{
+ // without this the whole dialog becomes much too large
+ return QSize(QTabWidget::sizeHint().width(), 1);
+}
+
+
+void DoxygenConfigWidget::addDependency(QDict<QObject> *switches,
+ const QCString &dep, const QCString &name)
+{
+ if (dep.isEmpty())
+ return;
+
+ IInput *parent = m_inputWidgets->find(dep);
+ Q_ASSERT(parent!=0);
+ IInput *child = m_inputWidgets->find(name);
+ Q_ASSERT(child!=0);
+ if (!switches->find(dep))
+ switches->insert(dep, parent->qobject());
+ QPtrList<IInput> *list = m_dependencies->find(dep);
+ if (!list) {
+ list = new QPtrList<IInput>;
+ m_dependencies->insert(dep, list);
+ }
+ list->append(child);
+}
+
+
+void DoxygenConfigWidget::toggle(const QString &name, bool state)
+{
+ QPtrList<IInput> *inputs = m_dependencies->find(name);
+ Q_ASSERT(inputs!=0);
+ IInput *input = inputs->first();
+ while (input) {
+ input->setEnabled(state);
+ input = inputs->next();
+ }
+}
+
+
+void DoxygenConfigWidget::changed()
+{
+ m_hasChanged = true;
+}
+
+
+void DoxygenConfigWidget::init()
+{
+ QDictIterator<IInput> di(*m_inputWidgets);
+ for (; di.current(); ++di)
+ di.current()->init();
+
+ QDictIterator<QObject> dio(*m_switches);
+ for (; dio.current(); ++dio) {
+ QObject *obj = dio.current();
+ connect(obj, SIGNAL(toggle(const QString&, bool)), this, SLOT(toggle(const QString&, bool)));
+ // UGLY HACK: assumes each item depends on a boolean without checking!
+ emit toggle(dio.currentKey(), ((InputBool *)obj)->getState());
+ }
+}
+
+
+void DoxygenConfigWidget::loadFile()
+{
+ Config::instance()->init();
+
+ QFile f(m_fileName);
+ if (f.open(IO_ReadOnly)) {
+ QTextStream is(&f);
+
+ Config::instance()->parse(QFile::encodeName(m_fileName));
+ Config::instance()->convertStrToVal();
+
+ f.close();
+ }
+
+ init();
+}
+
+
+void DoxygenConfigWidget::saveFile()
+{
+ QFile f(m_fileName);
+ if (!f.open(IO_WriteOnly)) {
+ KMessageBox::information(0, i18n("Cannot write Doxyfile."));
+ } else {
+ QTextStream t(&f);
+
+ Config::instance()->writeTemplate(t, true, false);
+
+ f.close();
+ }
+}
+
+
+void DoxygenConfigWidget::accept()
+{
+ if (m_hasChanged)
+ saveFile();
+}
+
+#include "doxygenconfigwidget.moc"
diff --git a/parts/doxygen/doxygenconfigwidget.h b/parts/doxygen/doxygenconfigwidget.h
new file mode 100644
index 00000000..be75e203
--- /dev/null
+++ b/parts/doxygen/doxygenconfigwidget.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2000 by Dimitri van Heesch *
+ * dimitri@stack.nl *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DOXYGENCONFIGWIDGET_H_
+#define _DOXYGENCONFIGWIDGET_H_
+
+#include <qtabwidget.h>
+#include <qdict.h>
+#include <qptrlist.h>
+
+class IInput;
+
+
+class DoxygenConfigWidget : public QTabWidget
+{
+ Q_OBJECT
+
+public:
+ DoxygenConfigWidget( const QString &fileName, QWidget *parent=0, const char *name=0 );
+ ~DoxygenConfigWidget();
+
+public slots:
+ void accept();
+
+private slots:
+ void toggle(const QString&, bool);
+ void changed();
+
+private:
+ QSize sizeHint() const;
+ void loadFile();
+ void saveFile();
+ void init();
+ void addDependency(QDict<QObject> *switches,
+ const QCString &dep, const QCString &name);
+
+ QString m_fileName;
+ bool m_hasChanged;
+ QDict<IInput> *m_inputWidgets;
+ QDict< QPtrList<IInput> > *m_dependencies;
+ QDict<QObject> *m_switches;
+};
+
+#endif
diff --git a/parts/doxygen/doxygenpart.cpp b/parts/doxygen/doxygenpart.cpp
new file mode 100644
index 00000000..5582371b
--- /dev/null
+++ b/parts/doxygen/doxygenpart.cpp
@@ -0,0 +1,564 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2004 by Jonas Jacobi *
+ * jonas.jacobi@web.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "doxygenpart.h"
+#include "doxygenconfigwidget.h"
+#include "configwidgetproxy.h"
+#include "config.h"
+#include "kdevappfrontend.h"
+
+#include <kdevmainwindow.h>
+#include <kdevproject.h>
+#include <kdevmakefrontend.h>
+#include <kdevcore.h>
+#include <codemodel.h>
+#include <codemodel_utils.h>
+#include <domutil.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kaction.h>
+#include <kmessagebox.h>
+#include <kmainwindow.h>
+#include <kparts/part.h>
+#include <ktexteditor/document.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/editinterface.h>
+#include <partcontroller.h>
+#include <kdialogbase.h>
+#include <kdevplugininfo.h>
+
+#include <qvbox.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qpopupmenu.h>
+#include <qfileinfo.h>
+
+#define PROJECTOPTIONS 1
+
+typedef KDevGenericFactory<DoxygenPart> DoxygenFactory;
+static const KDevPluginInfo data("kdevdoxygen");
+K_EXPORT_COMPONENT_FACTORY( libkdevdoxygen, DoxygenFactory( data ) )
+
+DoxygenPart::DoxygenPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "DoxygenPart"), m_activeEditor(0), m_cursor(0)
+{
+ setInstance(DoxygenFactory::instance());
+ setXMLFile("kdevdoxygen.rc");
+
+ KAction *action;
+ action = new KAction( i18n("Build API Documentation"), 0,
+ this, SLOT(slotDoxygen()),
+ actionCollection(), "build_doxygen" );
+ action->setToolTip(i18n("Build API documentation"));
+ action->setWhatsThis(i18n("<b>Build API documentation</b><p>Runs doxygen on a project Doxyfile to generate API documentation. "
+ "If the search engine is enabled in Doxyfile, this also runs doxytag to create it."));
+
+ action = new KAction( i18n("Clean API Documentation"), 0,
+ this, SLOT(slotDoxClean()),
+ actionCollection(), "clean_doxygen" );
+ action->setToolTip(i18n("Clean API documentation"));
+ action->setWhatsThis(i18n("<b>Clean API documentation</b><p>Removes all generated by doxygen files."));
+
+// connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*)) );
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("Doxygen"), PROJECTOPTIONS, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+ m_actionDocumentFunction = new KAction(i18n("Document Current Function"), 0, CTRL+SHIFT+Key_S, this, SLOT(slotDocumentFunction()), actionCollection(), "edit_document_function");
+ m_actionDocumentFunction->setToolTip( i18n("Create a documentation template above a function"));
+ m_actionDocumentFunction->setWhatsThis(i18n("<b>Document Current Function</b><p>Creates a documentation template according to a function's signature above a function definition/declaration."));
+
+ m_tmpDir.setAutoDelete(true);
+ connect( partController(), SIGNAL(activePartChanged(KParts::Part*)), this, SLOT(slotActivePartChanged(KParts::Part* )));
+ m_actionPreview = new KAction(i18n("Preview Doxygen Output"), 0, CTRL+ALT+Key_P, this, SLOT(slotRunPreview()), actionCollection(), "show_preview_doxygen_output");
+ m_actionPreview->setToolTip( i18n("Show a preview of the Doxygen output of this file") );
+ m_actionPreview->setWhatsThis( i18n("<b>Preview Doxygen output</b><p>Runs Doxygen over the current file and shows the created index.html.") );
+
+ //read Doxygen configuration, if none exists yet, create it with some defaults
+ adjustDoxyfile();
+ QString fileName = project()->projectDirectory() + "/Doxyfile";
+
+ QFile file(fileName);
+ if (file.open(IO_ReadOnly)) {
+ QTextStream is(&file);
+
+ Config::instance()->parse(QFile::encodeName(fileName));
+ Config::instance()->convertStrToVal();
+
+ file.close();
+ }
+}
+
+
+DoxygenPart::~DoxygenPart()
+{
+ delete _configProxy;
+}
+
+void DoxygenPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ if ( pagenumber == PROJECTOPTIONS )
+ {
+ adjustDoxyfile();
+
+ DoxygenConfigWidget *w = new DoxygenConfigWidget(project()->projectDirectory() + "/Doxyfile", page );
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
+ }
+}
+
+/** If a Doxygen configuration file doesn't exist, create one.
+ * And copy some of the project settings to it.
+ */
+void DoxygenPart::adjustDoxyfile()
+{
+ QString fileName = project()->projectDirectory() + "/Doxyfile";
+ if (QFile::exists(fileName))
+ return;
+
+ // Initialize configuration
+ Config::instance()->init();
+
+ // Do some checks and improve the configuration a bit
+ Config::instance()->check();
+
+ // set "General/PROJECT_NAME"
+ ConfigString *name = dynamic_cast<ConfigString*>(Config::instance()->get("PROJECT_NAME"));
+ if (name)
+ {
+ name->setDefaultValue(project()->projectName().latin1());
+ name->init();
+ }
+
+ // set "General/PROJECT_NUMBER"
+ ConfigString *version = dynamic_cast<ConfigString*>(Config::instance()->get("PROJECT_NUMBER"));
+ if (version)
+ {
+ version->setDefaultValue(DomUtil::readEntry(*projectDom(), "/general/version").latin1());
+ version->init();
+ }
+
+ // insert input files into "Input/INPUT"
+ ConfigList *input_files = dynamic_cast<ConfigList*>(Config::instance()->get("INPUT"));
+ if (input_files)
+ {
+ input_files->init();
+ input_files->addValue(QFile::encodeName(project()->projectDirectory()));
+ }
+
+ // insert file patterns into "Input/FILE_PATTERNS"
+ ConfigList *patterns = dynamic_cast<ConfigList*>(Config::instance()->get("FILE_PATTERNS"));
+ if (patterns)
+ {
+ // Remove Doxygen's default patterns
+// patterns->init();
+
+ // Add this ones:
+ patterns->addValue("*.C");
+ patterns->addValue("*.H");
+ patterns->addValue("*.tlh");
+ patterns->addValue("*.diff");
+ patterns->addValue("*.patch");
+ patterns->addValue("*.moc");
+ patterns->addValue("*.xpm");
+ patterns->addValue("*.dox");
+ }
+
+ // set "Input/RECURSIVE" to recurse into subdirectories
+ ConfigBool *recursive = dynamic_cast<ConfigBool*>(Config::instance()->get("RECURSIVE"));
+ if (recursive)
+ {
+ recursive->setValueString("yes");
+ }
+
+ // set "XML/GENERATE_XML" to generate XML information to be used with code hinting
+ ConfigBool *gen_xml = dynamic_cast<ConfigBool*>(Config::instance()->get("GENERATE_XML"));
+ if (gen_xml)
+ {
+ gen_xml->setValueString("yes");
+ }
+
+ // set "Enternal/GENERATE_TAGFILE" to generate tag file for documentation browser
+ ConfigString *gen_tag = dynamic_cast<ConfigString*>(Config::instance()->get("GENERATE_TAGFILE"));
+ if (gen_tag)
+ {
+ gen_tag->setDefaultValue(QString(project()->projectName()+".tag").latin1());
+ gen_tag->init();
+ }
+
+ // write doxy file
+ QFile f2(fileName);
+ if (!f2.open(IO_WriteOnly))
+ KMessageBox::information(mainWindow()->main(), i18n("Cannot write Doxyfile."));
+ else
+ {
+ QTextStream ts_file(&f2);
+
+ Config::instance()->writeTemplate(ts_file, true, true);
+
+ f2.close();
+ }
+}
+
+
+void DoxygenPart::slotDoxygen()
+{
+ if ( !partController()->saveAllFiles() ) return;
+
+ bool searchDatabase = false;
+ QString outputDirectory;
+ QString htmlDirectory;
+
+ adjustDoxyfile();
+
+ QString fileName = project()->projectDirectory() + "/Doxyfile";
+
+ Config::instance()->init();
+
+ QFile f(fileName);
+ if (f.open(IO_ReadOnly))
+ {
+ QTextStream is(&f);
+
+ Config::instance()->parse(QFile::encodeName(fileName));
+ Config::instance()->convertStrToVal();
+
+ f.close();
+ }
+
+ // search engine
+ ConfigBool *search = dynamic_cast<ConfigBool*>(Config::instance()->get("SEARCHENGINE"));
+ if (search)
+ {
+ searchDatabase = Config_getBool("SEARCHENGINE");
+
+ if (searchDatabase)
+ {
+ // get input files
+ outputDirectory = Config_getString("OUTPUT_DIRECTORY");
+ if ( outputDirectory.isEmpty() == false )
+ outputDirectory += "/";
+ htmlDirectory = Config_getString("HTML_OUTPUT");
+ if ( htmlDirectory.isEmpty() == true )
+ htmlDirectory = "html";
+ htmlDirectory.prepend(outputDirectory);
+ }
+ }
+
+ QString dir = project()->projectDirectory();
+ QString cmdline = "cd ";
+ cmdline += KShellProcess::quote( dir );
+ cmdline += " && doxygen Doxyfile";
+ if (searchDatabase)
+ {
+ // create search database in the same directory where the html docs are
+ if ( htmlDirectory.length() > 0 )
+ cmdline += " && cd " + KShellProcess::quote( htmlDirectory );
+ cmdline += " && doxytag -s search.idx ";
+ }
+
+ kdDebug(9026) << "Doxygen command line: " << cmdline << endl;
+
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(dir, cmdline);
+}
+
+
+void DoxygenPart::slotDoxClean()
+{
+ bool could_be_dirty = false;
+
+ QString outputDirectory = Config_getString("OUTPUT_DIRECTORY");
+ if ( outputDirectory.isEmpty() )
+ outputDirectory = project()->projectDirectory();
+ if ( outputDirectory.right(1) != "/" )
+ outputDirectory += "/";
+ QString cmdline = "cd " + KShellProcess::quote( outputDirectory );
+
+ if ( Config_getBool("GENERATE_HTML") ) {
+ QString htmlDirectory = Config_getString("HTML_OUTPUT");
+ if ( htmlDirectory.isEmpty() )
+ htmlDirectory = "html";
+ if ( htmlDirectory.right(1) != "/" )
+ htmlDirectory += "/";
+ cmdline += " && rm -f " + KShellProcess::quote( htmlDirectory ) + "*";
+ could_be_dirty= true;
+ }
+
+ if ( Config_getBool("GENERATE_LATEX") ) {
+ QString latexDirectory = Config_getString("LATEX_OUTPUT");
+ if ( latexDirectory.isEmpty() )
+ latexDirectory = "latex";
+ if ( latexDirectory.right(1) != "/" )
+ latexDirectory += "/";
+ cmdline += " && rm -f " + KShellProcess::quote( latexDirectory ) + "*";
+ could_be_dirty= true;
+ }
+
+ if ( Config_getBool("GENERATE_RTF") ) {
+ QString rtfDirectory = Config_getString("RTF_OUTPUT");
+ if ( rtfDirectory.isEmpty() )
+ rtfDirectory = "rtf";
+ if ( rtfDirectory.right(1) != "/" )
+ rtfDirectory += "/";
+ cmdline += " && rm -f " + KShellProcess::quote( rtfDirectory ) + "*";
+ could_be_dirty= true;
+ }
+
+ if ( Config_getBool("GENERATE_MAN") ) {
+ QString manDirectory = Config_getString("MAN_OUTPUT");
+ if ( manDirectory.isEmpty() )
+ manDirectory = "man";
+ if ( manDirectory.right(1) != "/" )
+ manDirectory += "/";
+ cmdline += " && rm -f " + KShellProcess::quote( manDirectory ) + "*";
+ could_be_dirty= true;
+ }
+
+ if ( Config_getBool("GENERATE_XML") ) {
+ QString xmlDirectory = Config_getString("XML_OUTPUT");
+ if ( xmlDirectory.isEmpty() )
+ xmlDirectory = "xml";
+ if ( xmlDirectory.right(1) != "/" )
+ xmlDirectory += "/";
+ cmdline += " && rm -f " + KShellProcess::quote( xmlDirectory ) + "*";
+ could_be_dirty= true;
+ }
+
+ if (could_be_dirty) {
+ kdDebug(9026) << "Cleaning Doxygen generated API documentation using: " << cmdline << endl;
+ if (KDevMakeFrontend *makeFrontend = extension<KDevMakeFrontend>("KDevelop/MakeFrontend"))
+ makeFrontend->queueCommand(KShellProcess::quote(project()->projectDirectory()), cmdline);
+ }
+ else
+ kdDebug(9026) << "No Doxygen generated API documentation exists. There's nothing to clean!" << endl;
+
+}
+
+void DoxygenPart::slotPreviewProcessExited( )
+{
+ KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend");
+ if ( appFrontend != 0 )
+ disconnect(appFrontend, 0, this, 0);
+ partController()->showDocument(KURL(m_tmpDir.name()+"html/index.html"));
+}
+
+void DoxygenPart::slotRunPreview( )
+{
+ if (m_file.isNull())
+ return;
+
+ KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend");
+ if ( appFrontend == 0 )
+ return;
+
+ if ( appFrontend->isRunning() ) {
+ KMessageBox::information( mainWindow()->main(),
+ i18n("Another process is still running. Please wait until it's finished."));
+ return;
+ }
+
+ m_tmpDir.unlink();
+ m_tmpDir = KTempDir();
+ m_tmpDir.setAutoDelete(true);
+
+ Config* config = Config::instance();
+
+ ConfigString* poDir = dynamic_cast<ConfigString*>(config->get("OUTPUT_DIRECTORY"));
+ ConfigList* pInput = dynamic_cast<ConfigList*>(config->get("INPUT"));
+ ConfigString* pHeader = dynamic_cast<ConfigString*>(config->get("HTML_HEADER"));
+ ConfigString* pFooter = dynamic_cast<ConfigString*>(config->get("HTML_FOOTER"));
+ ConfigString* pStyle = dynamic_cast<ConfigString*>(config->get("HTML_STYLESHEET"));
+
+ //store config values to restore them later | override config values to get only the current file processed
+ QCString dirVal;
+ if (poDir != 0) {
+ dirVal = *poDir->valueRef();
+ *poDir->valueRef() = m_tmpDir.name().ascii();
+ }
+
+ QStrList inputVal;
+ if (pInput != 0) {
+ inputVal = *pInput->valueRef();
+ QStrList xl;
+ xl.append(m_file.ascii());
+ *pInput->valueRef() = xl;
+ } else {
+ config->addList("INPUT", "# The INPUT tag can be used to specify the files and/or directories that contain\n"
+ "# documented source files. You may enter file names like \"myfile.cpp\" or\n"
+ "# directories like \"/usr/src/myproject\". Separate the files or directories\n"
+ "# with spaces.");
+ pInput = dynamic_cast<ConfigList*>(config->get("INPUT")); //pinput now has to be != 0
+ QStrList xl;
+ xl.append(m_file.ascii());
+ *pInput->valueRef() = xl;
+ }
+
+ QCString header;
+ QCString footer;
+ QCString stylesheet;
+ //if header/footer/stylesheets are set, make sure they get found in the doxygen run
+ QString projectDir = project()->projectDirectory();
+ if (pHeader != 0 && !pHeader->valueRef()->isEmpty()){
+ header = *pHeader->valueRef();
+ QFileInfo info (header);
+ if (info.isRelative())
+ *pHeader->valueRef() = QString(projectDir + "/" + QString(header)).ascii();
+ else
+ header = 0;
+ }
+
+ if (pFooter != 0 && !pFooter->valueRef()->isEmpty()){
+ footer = *pFooter->valueRef();
+ QFileInfo info (footer);
+ if (info.isRelative())
+ *pFooter->valueRef() = QString(projectDir + "/" + QString(footer)).ascii();
+ else
+ footer = 0;
+ }
+
+ if (pStyle != 0 && !pStyle->valueRef()->isEmpty()){
+ stylesheet = *pStyle->valueRef();
+ QFileInfo info (stylesheet);
+ if (info.isRelative())
+ *pStyle->valueRef() = QString(projectDir +"/" + QString(stylesheet)).ascii();
+ else
+ stylesheet = 0;
+ }
+
+ QFile file(m_tmpDir.name() +"PreviewDoxyfile"); //file gets deleted automatically 'cause of tempdir
+ if (!file.open(IO_WriteOnly)){
+ //restore config values
+ if (pInput != 0)
+ *pInput->valueRef() = inputVal;
+
+ if (poDir != 0)
+ *poDir->valueRef() = dirVal;
+
+ KMessageBox::error(mainWindow()->main(), i18n("Cannot create temporary file '%1'").arg(file.name()));
+ return;
+ }
+
+ QTextStream ts_file(&file);
+
+ config->writeTemplate(ts_file, false, false);
+ file.close();
+
+ if (inputVal.count() == 0) //pInput is always != 0
+ *pInput->valueRef() = QStrList();
+ else
+ *pInput->valueRef() = inputVal;
+
+ if (poDir != 0)
+ *poDir->valueRef() = dirVal;
+
+ if (pHeader != 0 && !header.isNull())
+ *pHeader->valueRef() = header;
+
+ if (pFooter != 0 && !footer.isNull())
+ *pFooter->valueRef() = footer;
+
+ if (pStyle != 0 && !stylesheet.isNull())
+ *pStyle->valueRef() = stylesheet;
+
+ connect(appFrontend, SIGNAL(processExited()), this, SLOT(slotPreviewProcessExited()));
+ appFrontend->startAppCommand("", "doxygen \"" + file.name() + "\"", false);
+}
+
+void DoxygenPart::slotActivePartChanged( KParts::Part * part )
+{
+ // -> idea from cppsupportpart.cpp
+ KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>(part);
+ if (doc != 0)
+ m_file = doc->url().path();
+ else
+ m_file = QString::null;
+ // <-
+ m_activeEditor = dynamic_cast<KTextEditor::EditInterface*>(part);
+ m_cursor = part ? dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget()) : 0;
+}
+
+void DoxygenPart::slotDocumentFunction(){
+ if (m_activeEditor != 0 && m_cursor != 0){
+ if ( codeModel()->hasFile( m_file ) ) {
+ unsigned int cursorLine, cursorCol;
+ m_cursor->cursorPosition(&cursorLine, &cursorCol);
+
+ FunctionDom function = 0;
+ FunctionDefinitionDom functionDef = 0;
+
+ FileDom file = codeModel()->fileByName( m_file );
+
+ FunctionList functionList = CodeModelUtils::allFunctions(file);
+ FunctionList::ConstIterator theend = functionList.end();
+ for( FunctionList::ConstIterator ci = functionList.begin(); ci!= theend; ++ci ){
+ int sline, scol;
+ int eline, ecol;
+ (*ci)->getStartPosition(&sline, &scol);
+ (*ci)->getEndPosition(&eline, &ecol);
+ if(cursorLine >= sline && cursorLine <= eline )
+ function = *ci;
+ }
+ if (function == 0){
+ FunctionDefinitionList functionDefList = CodeModelUtils::allFunctionDefinitionsDetailed(file).functionList;
+ FunctionDefinitionList::ConstIterator theend = functionDefList.end();
+ for( FunctionDefinitionList::ConstIterator ci = functionDefList.begin(); ci!= theend; ++ci ){
+ int sline, scol;
+ int eline, ecol;
+ (*ci)->getStartPosition(&sline, &scol);
+ (*ci)->getEndPosition(&eline, &ecol);
+ if(cursorLine >= sline && cursorLine <= eline)
+ functionDef = *ci;
+ }
+ }
+
+ int line, col;
+ if (function != 0)
+ function->getStartPosition(&line, &col);
+ else if (functionDef != 0)
+ functionDef->getStartPosition(&line, &col);
+ else
+ return;
+ QString funcLine = m_activeEditor->textLine(line);
+ unsigned int pos = 0;
+ unsigned int length = funcLine.length();
+ while (pos < length && funcLine.at(pos).isSpace())
+ ++pos;
+ //store chars used for indenting the line and put it in front of every created doc line
+ QString indentChars = funcLine.left(pos);
+ QString text = indentChars + "/**\n" + indentChars + " * \n";
+ ArgumentList args;
+ QString resultType;
+ if (function != 0) {
+ args = function->argumentList();
+ resultType = function->resultType();
+ } else {
+ args = functionDef->argumentList();
+ resultType = functionDef->resultType();
+ }
+ for( ArgumentList::ConstIterator ci = args.begin(); ci != args.end(); ++ci)
+ text += indentChars + " * @param " + (*ci)->name() +" \n";
+ if (resultType != "void" && !resultType.isEmpty())
+ text += indentChars + " * @return \n";
+ text += indentChars + " */\n";
+ m_activeEditor->insertText(line, 0, text);
+ m_cursor->setCursorPosition( line + 1, indentChars.length() + 3);
+ }
+ }
+}
+
+
+#include "doxygenpart.moc"
diff --git a/parts/doxygen/doxygenpart.h b/parts/doxygen/doxygenpart.h
new file mode 100644
index 00000000..49fb87e8
--- /dev/null
+++ b/parts/doxygen/doxygenpart.h
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2004 by Jonas Jacobi *
+ * jonas.jacobi@web.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _DOXYGENPART_H_
+#define _DOXYGENPART_H_
+
+#include <qguardedptr.h>
+#include <kdialogbase.h>
+#include <kprocess.h>
+#include <ktempdir.h>
+#include <qstring.h>
+
+#include "kdevplugin.h"
+
+class DoxygenDialog;
+class QPopupMenu;
+class Context;
+class KAction;
+class KDialogBase;
+class ConfigWidgetProxy;
+
+namespace KParts{
+ class Part;
+}
+namespace KTextEditor{
+ class ViewCursorInterface;
+ class EditInterface;
+}
+
+class DoxygenPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ DoxygenPart( QObject *parent, const char *name, const QStringList & );
+ ~DoxygenPart();
+
+private slots:
+ /**
+ * Configuration dialog under "Project Options..." that alows
+ * to specify doxygen configuration options and store them to
+ * a configuration file. The file name is "Doxyfile" and it's stored
+ * in the project root.
+ */
+// void projectConfigWidget(KDialogBase *dlg);
+ void insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int );
+
+ /** run doxygen to generate API documentation */
+ void slotDoxygen();
+
+ /** clean the html API docs (delete the generated html files) */
+ void slotDoxClean();
+
+ /**
+ * Gets called, when the Doxygen process for previewing is finished
+ * and shows its output then.
+ */
+ void slotPreviewProcessExited();
+
+ /**
+ * If the current part is KTextEditor::Document, run Doxygen over it.
+ * When the process exited slotPreviewProcessExited gets called.
+ */
+ void slotRunPreview();
+
+ /**
+ * Gets called when the currently active part changed.
+ * When the new part is a KTextEditor::Document the filepath gets
+ * internally stored and gets processed if slotRunPreview() is called.
+ * @see KTextEditor::Document
+ */
+ void slotActivePartChanged(KParts::Part*);
+
+ /**
+ * Inserts a documentation template above a function declaration/definition.
+ */
+ void slotDocumentFunction();
+
+
+private:
+
+ /**
+ * If a Doxygen configuration file doesn't exist, create one.
+ * And copy some of the project settings to it.
+ */
+ void adjustDoxyfile();
+
+ DoxygenDialog *m_dialog;
+ ConfigWidgetProxy * _configProxy;
+
+ //needed for doxygen preview
+ QString m_file;
+ KTempDir m_tmpDir;
+ KAction* m_action;
+
+ //needed for documentFunction
+ KAction* m_actionDocumentFunction;
+ KAction* m_actionPreview;
+ KTextEditor::EditInterface* m_activeEditor;
+ KTextEditor::ViewCursorInterface* m_cursor;
+};
+
+#endif
diff --git a/parts/doxygen/input.cpp b/parts/doxygen/input.cpp
new file mode 100644
index 00000000..d5745bad
--- /dev/null
+++ b/parts/doxygen/input.cpp
@@ -0,0 +1,499 @@
+/***************************************************************************
+ * Copyright (C) 1997-2000 by Dimitri van Heesch *
+ * dimitri@stack.nl *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qcombobox.h>
+#include <klineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qtooltip.h>
+#include <klocale.h>
+#include <kfiledialog.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#include "input.h"
+
+
+static const char * const add_xpm_data[] =
+{
+ "16 16 5 1",
+ ". c None",
+ "* c #0328f9",
+ "# c #354396",
+ "a c #353740",
+ "c c #999999",
+ "................",
+ "......###.......",
+ "......#*ac......",
+ "......#*ac......",
+ "......#*ac......",
+ "......#*ac......",
+ ".######*a#####..",
+ ".#***********ac.",
+ ".#aaaaa*aaaaaac.",
+ "..cccc#*acccccc.",
+ "......#*ac......",
+ "......#*ac......",
+ "......#*ac......",
+ "......#aac......",
+ ".......ccc......",
+ "................"
+};
+const char **add_xpm = (const char **)add_xpm_data;
+
+static const char * const del_xpm_data[] =
+{
+ "16 16 5 1",
+ ". c None",
+ "* c #0328f9",
+ "# c #354396",
+ "a c #353740",
+ "c c #999999",
+ "................",
+ "................",
+ "................",
+ "................",
+ "................",
+ "................",
+ ".#############..",
+ ".#***********ac.",
+ ".aaaaaaaaaaaaac.",
+ "..ccccccccccccc.",
+ "................",
+ "................",
+ "................",
+ "................",
+ "................",
+ "................"
+};
+const char **del_xpm = (const char **)del_xpm_data;
+
+static const char* const update_xpm_data[] =
+{
+ "16 16 5 1",
+ /* colors */
+ ". c #0328f9",
+ "# c #354396",
+ "a c #353740",
+ "b c None",
+ "c c #999999",
+ /* pixels */
+ "bbbbbbbbbbbbbbbb",
+ "bbbbbbbb#####acb",
+ "bbbbbbbb#....abb",
+ "bbc##cbb#...acbb",
+ "bb#..abb#....abb",
+ "bc#..abb#.a..acb",
+ "b#..acbbaac#..ab",
+ "b#..abbbcbb#..ab",
+ "b#..abbbbbb#..ab",
+ "b#..acbbbbc#..ab",
+ "bc#..#cbbc#..acb",
+ "bb#...####...acb",
+ "bbca........acbb",
+ "bbbbaa....aaccbb",
+ "bbbbbcaaaaccbbbb",
+ "bbbbbbbbbbbbbbbb"
+};
+const char **update_xpm = (const char **)update_xpm_data;
+
+
+InputBool::InputBool(const QCString &k, const QString &text, QWidget * parent, bool &flag)
+ : QWidget(parent), state(flag), key(k)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+ cb = new QCheckBox(text,this);
+
+ init();
+
+ layout->addWidget(cb);
+ layout->addStretch(1);
+
+ connect( cb, SIGNAL(toggled(bool)), this, SLOT(valueChanged(bool)));
+}
+
+
+InputBool::~InputBool()
+{}
+
+
+void InputBool::init()
+{
+ cb->setChecked(state);
+}
+
+
+void InputBool::valueChanged(bool s)
+{
+ if (s != state) {
+ emit changed();
+ emit toggle(key, s);
+ }
+ state = s;
+}
+
+
+void InputBool::setEnabled(bool b)
+{
+ cb->setEnabled(b);
+}
+
+
+InputInt::InputInt(const QString &label, QWidget *parent, int &val, int minVal, int maxVal)
+ : QWidget(parent), m_val(val), m_minVal(minVal), m_maxVal(maxVal)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this, 5);
+
+ sp = new QSpinBox(minVal, maxVal, 1, this);
+ lab = new QLabel(sp, label+":", this);
+
+ init();
+
+ layout->addWidget(lab);
+ layout->addWidget(sp);
+ layout->addStretch(1);
+
+ connect(sp, SIGNAL(valueChanged(int)), this, SLOT(valueChanged(int)));
+}
+
+
+InputInt::~InputInt()
+{}
+
+
+void InputInt::init()
+{
+ m_val = QMAX(m_minVal, m_val);
+ m_val = QMIN(m_maxVal, m_val);
+ sp->setValue(m_val);
+}
+
+
+void InputInt::valueChanged(int val)
+{
+ if (val != m_val)
+ emit changed();
+ m_val = val;
+}
+
+
+void InputInt::setEnabled(bool state)
+{
+ lab->setEnabled(state);
+ sp->setEnabled(state);
+}
+
+
+InputString::InputString(const QString & label,
+ QWidget *parent, QCString &s, StringMode m)
+ : QWidget(parent), str(s), sm(m), m_values(0), m_index(0)
+{
+ le = 0; br = 0; com = 0;
+
+ if (m == StringFixed) {
+ QHBoxLayout *layout = new QHBoxLayout(this, 5);
+ com = new QComboBox(this);
+ lab = new QLabel(com,label+":", this);
+ layout->addWidget(lab);
+ layout->addWidget(com);
+ layout->addStretch(1);
+ } else {
+ QGridLayout *layout = new QGridLayout(this, 1, m==StringFree? 1 : 3, 5);
+ le = new KLineEdit(this);
+ lab = new QLabel(le,label+":", this);
+ layout->addWidget(lab, 0, 0);
+ le->setText(s);
+ layout->addWidget(le, 0, 1);
+
+ if (m == StringFile || m == StringDir) {
+ br = new QPushButton(this);
+ br->setPixmap(SmallIcon(m==StringFile? "document" : "folder"));
+ QToolTip::add(br, m==StringFile? i18n("Browse to a file") : i18n("Browse to a folder"));
+ layout->addWidget(br, 0, 2);
+ }
+ }
+
+ if (le)
+ connect( le, SIGNAL(textChanged(const QString&)),
+ this, SLOT(textChanged(const QString&)) );
+ if (br)
+ connect( br, SIGNAL(clicked()), this, SLOT(browse()) );
+ if (com)
+ connect( com, SIGNAL(activated(const QString &)),
+ this, SLOT(textChanged(const QString &)) );
+}
+
+InputString::~InputString()
+{
+ if (m_values)
+ delete m_values;
+}
+
+
+void InputString::init()
+{
+ if (sm == StringFixed) {
+ int *itemIndex = m_values->find(str);
+ if (itemIndex)
+ com->setCurrentItem(*itemIndex);
+ else
+ com->setCurrentItem(0);
+ } else
+ le->setText(str);
+}
+
+
+void InputString::addValue(const char *s)
+{
+ if (sm == StringFixed) {
+ if (!m_values)
+ m_values = new QDict<int>;
+ m_values->setAutoDelete(true);
+ m_values->insert(s, new int(m_index++));
+ com->insertItem(s);
+ }
+}
+
+
+void InputString::clear()
+{
+ le->setText("");
+ if (!str.isEmpty()) {
+ emit changed();
+ str = "";
+ }
+}
+
+
+void InputString::textChanged(const QString &s)
+{
+ if (str!=s.latin1()) {
+ str = s.latin1();
+ emit changed();
+ }
+}
+
+void InputString::setEnabled(bool state)
+{
+ lab->setEnabled(state);
+ if (le)
+ le->setEnabled(state);
+ if (br)
+ br->setEnabled(state);
+ if (com)
+ com->setEnabled(state);
+}
+
+
+void InputString::browse()
+{
+ if (sm == StringFile) {
+ QString fileName = KFileDialog::getOpenFileName();
+
+ if (!fileName.isNull()) {
+ le->setText(fileName);
+ if (str != le->text().latin1()) {
+ str = le->text().latin1();
+ emit changed();
+ }
+ }
+ } else { // sm==StringDir
+ QString dirName = KFileDialog::getExistingDirectory();
+
+ if (!dirName.isNull()) {
+ le->setText( dirName );
+ if (str != le->text().latin1()) {
+ str = le->text().latin1();
+ emit changed();
+ }
+ }
+ }
+}
+
+
+InputStrList::InputStrList(const QString & label,
+ QWidget *parent, QStrList &sl, ListMode lm)
+ : QWidget(parent), strList(sl)
+{
+ QGridLayout *layout = new QGridLayout(this, 2, 2, 5);
+
+ QWidget *dw = new QWidget(this); /* dummy widget used for layouting */
+ QHBoxLayout *boxlayout = new QHBoxLayout(dw, 0, 5);
+ le = new KLineEdit(dw);
+ lab = new QLabel(le,label+":", this );
+ layout->addWidget(lab, 0, 0);
+ boxlayout->addWidget(le, 1);
+
+ add = new QPushButton(dw);
+ add->setPixmap(QPixmap( add_xpm ));
+ QToolTip::add(add, i18n("Add item"));
+ boxlayout->addWidget(add);
+
+ del = new QPushButton(dw);
+ del->setPixmap(QPixmap( del_xpm ));
+ QToolTip::add(del, i18n("Delete selected item"));
+ boxlayout->addWidget(del);
+
+ upd = new QPushButton(dw);
+ upd->setPixmap(QPixmap( update_xpm ));
+ QToolTip::add(upd, i18n("Update selected item"));
+ boxlayout->addWidget(upd);
+
+ lb = new QListBox(this);
+ lb->setMinimumSize(400, 100);
+ init();
+ lb->setVScrollBarMode(QScrollView::Auto);
+ lb->setHScrollBarMode(QScrollView::Auto);
+
+ brFile = 0;
+ brDir = 0;
+ if (lm != ListString) {
+ if (lm & ListFile) {
+ brFile = new QPushButton(dw);
+ brFile->setPixmap(SmallIcon("document"));
+ QToolTip::add(brFile, i18n("Browse to a file"));
+ boxlayout->addWidget(brFile);
+ }
+ if (lm & ListDir) {
+ brDir = new QPushButton(dw);
+ brDir->setPixmap(SmallIcon("folder"));
+ QToolTip::add(brDir, i18n("Browse to a folder"));
+ boxlayout->addWidget(brDir);
+ }
+ }
+ layout->addWidget(dw, 0, 1);
+ layout->addWidget(lb, 1, 1);
+
+ connect( le, SIGNAL(returnPressed()),
+ this, SLOT(addString()) );
+ connect( add, SIGNAL(clicked()),
+ this, SLOT(addString()) );
+ connect( del, SIGNAL(clicked()),
+ this, SLOT(delString()) );
+ connect( upd, SIGNAL(clicked()),
+ this, SLOT(updateString()) );
+ if (brFile)
+ connect( brFile, SIGNAL(clicked()),
+ this, SLOT(browseFiles()) );
+ if (brDir)
+ connect( brDir, SIGNAL(clicked()),
+ this, SLOT(browseDir()) );
+ connect( lb, SIGNAL(selected(const QString &)),
+ this, SLOT(selectText(const QString &)) );
+
+ strList = sl;
+}
+
+
+InputStrList::~InputStrList()
+{}
+
+
+void InputStrList::init()
+{
+ le->clear();
+ lb->clear();
+ char *s = strList.first();
+ while (s) {
+ lb->insertItem(s);
+ s = strList.next();
+ }
+}
+
+
+void InputStrList::addString()
+{
+ if (!le->text().isEmpty()) {
+ lb->insertItem(le->text());
+ strList.append(le->text().latin1());
+ emit changed();
+ le->clear();
+ }
+}
+
+
+void InputStrList::delString()
+{
+ if (lb->currentItem() != -1) {
+ int itemIndex = lb->currentItem();
+ lb->removeItem(itemIndex);
+ strList.remove(itemIndex);
+ emit changed();
+ }
+}
+
+
+void InputStrList::updateString()
+{
+ if (lb->currentItem() != -1 && !le->text().isEmpty()) {
+ lb->changeItem(le->text(),lb->currentItem());
+ strList.insert(lb->currentItem(),le->text().latin1());
+ strList.remove(lb->currentItem()+1);
+ emit changed();
+ }
+}
+
+
+void InputStrList::selectText(const QString &s)
+{
+ le->setText(s);
+}
+
+
+void InputStrList::setEnabled(bool state)
+{
+ lab->setEnabled(state);
+ le->setEnabled(state);
+ add->setEnabled(state);
+ del->setEnabled(state);
+ upd->setEnabled(state);
+ lb->setEnabled(state);
+ if (brFile)
+ brFile->setEnabled(state);
+ if (brDir)
+ brDir->setEnabled(state);
+}
+
+
+void InputStrList::browseFiles()
+{
+ QStringList fileNames = KFileDialog::getOpenFileNames();
+
+ if (!fileNames.isEmpty()) {
+ QStringList::Iterator it;
+ for (it = fileNames.begin(); it != fileNames.end(); ++it) {
+ lb->insertItem(*it);
+ strList.append(( *it ).latin1());
+ emit changed();
+ }
+ le->setText(*fileNames.begin());
+ }
+}
+
+
+void InputStrList::browseDir()
+{
+ QString dirName = KFileDialog::getExistingDirectory();
+
+ if (!dirName.isNull()) {
+ lb->insertItem(dirName);
+ strList.append(dirName.latin1());
+ emit changed();
+ le->setText(dirName);
+ }
+}
+
+
+#include "input.moc"
diff --git a/parts/doxygen/input.h b/parts/doxygen/input.h
new file mode 100644
index 00000000..15c3a263
--- /dev/null
+++ b/parts/doxygen/input.h
@@ -0,0 +1,173 @@
+/***************************************************************************
+ * Copyright (C) 1997-2000 by Dimitri van Heesch *
+ * dimitri@stack.nl *
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _INPUT_H
+#define _INPUT_H
+
+#include <qcheckbox.h>
+#include <qdict.h>
+
+class QComboBox;
+class QLabel;
+class KLineEdit;
+class QListBox;
+class QPushButton;
+class QSpinBox;
+
+class IInput
+{
+ public:
+ virtual void init() = 0;
+ virtual void setEnabled(bool) = 0;
+ virtual QObject *qobject() = 0;
+};
+
+
+class InputBool : public QWidget, public IInput
+{
+ Q_OBJECT
+
+public:
+ InputBool(const QCString &key, const QString &text, QWidget *parent, bool &flag);
+ ~InputBool();
+
+ void init();
+ virtual void setEnabled(bool b);
+ virtual QObject *qobject() { return this; }
+ virtual bool getState() const { return state; }
+
+signals:
+ void changed();
+ void toggle(const QString &, bool);
+
+private slots:
+ void valueChanged(bool);
+
+private:
+ bool &state;
+ QCString key;
+ QCheckBox *cb;
+};
+
+
+class InputInt : public QWidget, public IInput
+{
+ Q_OBJECT
+
+public:
+ InputInt(const QString &text, QWidget *parent,
+ int &val, int minVal, int maxVal);
+ ~InputInt();
+
+ void init();
+ virtual void setEnabled(bool);
+ QObject *qobject() { return this; }
+
+signals:
+ void changed();
+
+private slots:
+ void valueChanged(int val);
+
+private:
+ QLabel *lab;
+ QSpinBox *sp;
+ int &m_val;
+ int m_minVal;
+ int m_maxVal;
+};
+
+
+class InputString : public QWidget, public IInput
+{
+ Q_OBJECT
+
+public:
+ enum StringMode { StringFree=0,
+ StringFile=1,
+ StringDir=2,
+ StringFixed=3
+ };
+
+ InputString(const QString &text, QWidget *parent,
+ QCString &s, StringMode m=StringFree);
+ ~InputString();
+
+ void init();
+ void addValue(const char *s);
+ void setEnabled(bool);
+ QObject *qobject() { return this; }
+
+signals:
+ void changed();
+
+private slots:
+ void textChanged(const QString&);
+ void browse();
+ void clear();
+
+private:
+ QLabel *lab;
+ KLineEdit *le;
+ QPushButton *br;
+ QComboBox *com;
+ QCString &str;
+ StringMode sm;
+ QDict<int> *m_values;
+ int m_index;
+};
+
+
+class InputStrList : public QWidget, public IInput
+{
+ Q_OBJECT
+
+public:
+ enum ListMode { ListString=0,
+ ListFile=1,
+ ListDir=2,
+ ListFileDir=ListFile|ListDir
+ };
+
+ InputStrList(const QString &text, QWidget *parent,
+ QStrList &sl, ListMode v=ListString);
+ ~InputStrList();
+
+ void init();
+ void setEnabled(bool);
+ QObject *qobject() { return this; }
+
+signals:
+ void changed();
+
+private slots:
+ void addString();
+ void delString();
+ void updateString();
+ void selectText(const QString &s);
+ void browseFiles();
+ void browseDir();
+
+private:
+ QLabel *lab;
+ KLineEdit *le;
+ QPushButton *add;
+ QPushButton *del;
+ QPushButton *upd;
+ QPushButton *brFile;
+ QPushButton *brDir;
+ QListBox *lb;
+ QStrList &strList;
+};
+
+#endif
diff --git a/parts/doxygen/kdevdoxygen.desktop b/parts/doxygen/kdevdoxygen.desktop
new file mode 100644
index 00000000..d8c05362
--- /dev/null
+++ b/parts/doxygen/kdevdoxygen.desktop
@@ -0,0 +1,81 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=The doxygen plugin provides a way to specify and control generation of documentation for a project, based on source code content. You need to have doxygen installed to be able to use this. For more info goto http://www.doxygen.org
+Comment[ca]=El connector doxygen proporciona una forma d'especificar i controlar la generació de documentació d'un projecte, basant-se en el contingut del codi font. Necessitareu tenir instal·lat doxygen. Per a més informació visiteu http://www.doxygen.org
+Comment[da]=Doxygen-plugin sørger for en måde at angive og kontrollere generering af dokumentation for et projekt, baseret på kildekodens indhold. Du skal have doxygen installeret for at kunne bruge dette. For mere info gå til http://www.doxygen.org
+Comment[de]=Diese Komponente bietet Unterstützung bei der Erstellung von Projektdokumentation, die auf den Quelltexten basiert. Um diese Funktionalität zu nutzen, muss Doxygen installiert sein. Weitere Informationen finden sie auf http://www.doxygen.org.
+Comment[el]=Το πρόσθετο doxygen προσφέρει μια μέθοδο ορισμού και ελέγχου της δημιουργίας της τεκμηρίωσης για ένα έργο, βασισμένο στον πηγαίο κώδικα. Πρέπει να έχετε το doxygen εγκατεστημένο για να το χρησιμοποιήσετε. Για περισσότερες πληροφορίες πηγαίνετε στο http://www.doxygen.org
+Comment[es]=El complemento doxygen proporciona una forma de especificar y controlar la generación de documentación de un proyecto, basándose en el contenido del código fuente. Necesita tener instalado doxygen. Para más información visite http://www.doxygen.org
+Comment[et]=Doxygeni plugin võimaldab määrata ja kontrollida projekti dokumentatsiooni loomist vastavalt lähtekoodi sisule. Selleks peab olema paigaldatud ka programm 'doxygen'. Vaata täpsemalt http://www.doxygen.org
+Comment[eu]=Doxygen plugin-ak, iturburu kodean oinarrituta, proiektu baterako dokumentazio sorkuntza eta kontrola zehazteko aukera ematen dizu. Doxygen instalatuta eduki behar duzu hau erabiltzeko. Informazio gehiagorako joan hona:http://www.doxygen.org
+Comment[fa]=وصلۀ doxygen راهی برای مشخص کردن و کنترل تولید مستندات پروژه بر اساس متن کد منبع فراهم می‌کند. شما برای توانایی در استفاده از این، نیاز به نصب doxygen دارید. برای اطلاعات بیشتر به http://www.doxygen.org بروید
+Comment[fr]=Le module externe « doxygen » fournit un moyen de spécifier et de contrôler la génération de la documentation pour un projet, en se basant sur le contenu du code source. Pour pouvoir l'utiliser, vous devez avoir installé « doxygen ». Pour plus d'informations, allez sur le site http://www.doxygen.org
+Comment[gl]=A extensión doxigen proporciona unha maneira de especificar e controlar a xeración da documentación dun proxecto, basada nos contidos do código fonte. Necesitará ter doxigen instalado para poder usar isto. Para máis información visite http://www.doxygen.org
+Comment[hu]=A Doxygen bővítőmodullal a projekt teljes dokumentációjának készítése elvégezhető, közvetlenül a forráskódból. Használatához előbb telepíteni kell a Doxygen programcsomagot. Részletes információ itt található: http://www.doxygen.org
+Comment[it]=Il plugin doxygen offre un modo per specificare e controllare la generazione della documentazione di un progetto, basato sul contenuto del codice sorgente. Devi avere doxygen installato per utilizzarlo. Per maggiori informazioni vai su http://www.doxygen.org
+Comment[ja]=doxygen プラグインは、ソースコード内容に基づいて、プロジェクトのためのドキュメンテーションの生成を指定しコントロールする方法を提供します。これを使用するには doxygen をインストールする必要があります。より多くの情報は http://www.doxygen.org にあります。
+Comment[ms]=Plugin doxygen menyediakan cara untuk menyatakan dan mengawal penjanaan dokumentasi untuk projek, berdasarkan pada kandungan kod sumber. Anda perlu mempunyai doxygen dipasang untuk boleh menggunakannya. Untuk lebih maklumat lawat http://www.doxygen.org
+Comment[nds]=Dat Doxygen-Moduul stellt en op den Borntextinholt opbuut Ünnerstütten bi't Opstellen vun Projektdokmentatschonen praat. Dormit Du dat bruken kannst, mutt "doxygen" installeert wesen. Mehr Informatschonen laat sik op http://www.doxygen.org finnen.
+Comment[ne]=डक्सिजन प्लगइनले स्रोत सङ्केत प्रसङ्गमा आधारित, परियोजनाका लागि मिसिलीकरणको उत्पादन नियन्त्रण र निर्दिष्ट गर्ने तरिका प्रदान गर्दछ । यसलाई प्रयोग गर्न सक्षम हुनका लागि तपाईँले डक्सिजन स्थापना गर्नु पर्दछ । बढी जानकारीका लागि http://www.doxygen.org मा जानुहोस् ।
+Comment[nl]=De doxygen-plugin biedt hulp bij het vervaardigen van documentatie voor een project, gebaseerd op documentatie in de broncode. Om deze functie te kunnen gebruiken dient u doxygen te hebben geïnstalleerd. Meer info: http://www.doxygen.org/
+Comment[pl]=Wtyczka doxygena pozwala kontrolować generację dokumentacji projektu, bazując na zawartości kodu źródłowego. Aby użyć tej opcji trzeba mieć zainstalowany doxygen. Więcej informacji można uzyskać na http://www.doxygen.org
+Comment[pt]=O 'plugin' do doxygen oferece uma forma de especificar e controlar a geração de documentação de um projecto, baseada no conteúdo do código-fonte. Você necessita de ter o 'doxygen' instalado para poder usar isto. Para obter mais informações vá a http://www.doxygen.org
+Comment[pt_BR]=O plug-in do doxygen fornece uma maneira de especificar e controlar a geração de documentação para um projeto, baseado no conteúdo do código fonte. Você precisa ter o doxygen instalado para poder usar isto. Para mais informações vá em http://www.doxygen.org
+Comment[ru]=Модуль поддержки doxygen предоставляет возможности контроля генерации проектной документации на основе содержимого исходных файлов. Для использования необходим doxygen. Подробнее об этом смотрите на http://www.doxygen.org.
+Comment[sk]=Doxygen modul proskytuje spôsob ako špecifikovať a generovať projektovú dokumentáciu na základe obsahu zdrojového kódu. Potrebujete mať nainštalovaný doxygen. Pre viac informácií pozrite http://www.doxygen.org
+Comment[sr]=Doxygen прикључак обезбеђује начин да се прецизира и контролише документација за пројекат, на основу садржаја изворног кôда. Потребно је да имате инсталиран doxygen да бисте били у могућности да користите ово. За више информација идите на http://www.doxygen.org
+Comment[sr@Latn]=Doxygen priključak obezbeđuje način da se precizira i kontroliše dokumentacija za projekat, na osnovu sadržaja izvornog kôda. Potrebno je da imate instaliran doxygen da biste bili u mogućnosti da koristite ovo. Za više informacija idite na http://www.doxygen.org
+Comment[sv]=Doxygen-insticksprogrammet tillhandahåller ett sätt att ange och styra hur dokument skapas för ett projekt, baserat på källkodens innehåll. Du måste ha installerat Doxygen för att kunna använda det. För mer information besök http://www.doxygen.org.
+Comment[ta]=டிஆக்சிஜன் சொருகி உங்கள் திட்டப்பணிக்கு குறிப்பிட்ட வழி மற்றும் ஆவணத்தின் கட்டுபாட்டு உற்பத்திக்கு இது உதவும். இதை உபயோகிக்க முதலில் நீங்கள் டிஆக்சிஜன் நிறுவ வேண்டும். மேலும் விவரங்களுக்கு http://www.doxygen.org
+Comment[tg]=Модули тарафдорбудаи doxygen барои идора намудани генератсияи ҳуҷҷатҳо дар асоси файлҳои берунӣ буда имконият медиҳад.Барои истифодаи doxygen-и лозимӣ.Барои пурратар гирифтани маълумот ба http://www.doxygen.org назар намоед
+Comment[tr]=Doxygen eklentisi, kaynak kod içeriğine göre bir projenin belgelerinin yaratılmasının belirtilmesi ve kontrolü için bir yol sağlar. Bunu kullanabilmek için doxygen'ın kurulu olması lazımdır. Daha fazla bilgi için http://www.doxygen.org adresine gidin.
+Comment[zh_CN]=doxygen 是基于源文件产生文档的控制插件。必须安装 doxygen 才能使用。更多信息参考 http://www.doxygen.org
+Comment[zh_TW]=Doxygen 外掛程式提供依據程式源碼內容產生並控制專案文件的方式。您需要安裝 doxygen 才能使用。詳情請參考 http://www.doxygen.org
+Name=KDevDoxygen
+Name[da]=KDevelop Doxygen
+Name[de]=Unterstützung für Doxygen (KDevelop)
+Name[hi]=के-डेव-डॉक्सीज़ेन
+Name[nds]=Doxygen-Ünnerstütten för KDevelop
+Name[sk]=KDev Doxygen
+Name[sv]=KDevelop Doxygen
+Name[zh_TW]=KDevelop Doxygen
+GenericName=Doxygen Support
+GenericName[ca]=Suport per a doxygen
+GenericName[da]=Doxygen understøttelse
+GenericName[de]=Unterstützung für Doxygen
+GenericName[el]=Υποστήριξη Doxygen
+GenericName[es]=Soporte para Doxygen
+GenericName[et]=Doxygeni toetus
+GenericName[eu]=Doxygen euskarria
+GenericName[fa]=پشتیبانی Doxygen
+GenericName[fr]=Prise en charge de Doxygen
+GenericName[ga]=Tacaíocht Doxygen
+GenericName[gl]=Soporte para Doxygen
+GenericName[hu]=Doxygen-támogatás
+GenericName[it]=Supporto Doxygen
+GenericName[ja]=Doxygen サポート
+GenericName[ms]=Sokongan Doxygen
+GenericName[nds]=Ünnerstütten för Doxygen
+GenericName[ne]=डक्सिजन समर्थन
+GenericName[nl]=Doxygen ondersteuning
+GenericName[pl]=Obsług Doxygena
+GenericName[pt]=Suporte a Doxygen
+GenericName[pt_BR]=Suporte ao Doxygen
+GenericName[ru]=Поддержка Doxygen
+GenericName[sk]=Doxygen podpora
+GenericName[sl]=Podpora za Doxygen
+GenericName[sr]=Doxygen подршка
+GenericName[sr@Latn]=Doxygen podrška
+GenericName[sv]=Doxygen-stöd
+GenericName[ta]=Doxygen ஆதரவு
+GenericName[tg]=Тарафдори намудани Doxygen
+GenericName[tr]=Doxygen Desteği
+GenericName[zh_CN]=Doxygen 支持
+GenericName[zh_TW]=Doxygen 支援
+ServiceTypes=KDevelop/Plugin
+Icon=kdevelop
+X-KDE-Library=libkdevdoxygen
+X-KDevelop-Version=5
+X-KDevelop-Scope=Project
+X-KDevelop-Properties=CProjectDocumentation,CPPProjectDocumentation,JavaProjectDocumentation,PHPProjectDocumentation
diff --git a/parts/doxygen/kdevdoxygen.rc b/parts/doxygen/kdevdoxygen.rc
new file mode 100644
index 00000000..9faa6cd5
--- /dev/null
+++ b/parts/doxygen/kdevdoxygen.rc
@@ -0,0 +1,14 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevDoxygen" version="4">
+<MenuBar>
+ <Menu name="build" >
+ <Action name="build_doxygen"/>
+ <Action name="clean_doxygen"/>
+ </Menu>
+ <Menu name="tools" >
+ <Action name="show_preview_doxygen_output"/>
+ <Action name="edit_document_function"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/doxygen/lang_cfg.h b/parts/doxygen/lang_cfg.h
new file mode 100644
index 00000000..8b6efc62
--- /dev/null
+++ b/parts/doxygen/lang_cfg.h
@@ -0,0 +1,34 @@
+#define LANG_NL
+#define LANG_SE
+#define LANG_CZ
+#define LANG_FR
+#define LANG_ID
+#define LANG_IT
+#define LANG_DE
+#define LANG_JP
+#define LANG_JE
+#define LANG_ES
+#define LANG_FI
+#define LANG_RU
+#define LANG_HR
+#define LANG_PL
+#define LANG_PT
+#define LANG_HU
+#define LANG_KR
+#define LANG_KE
+#define LANG_RO
+#define LANG_SI
+#define LANG_CN
+#define LANG_NO
+#define LANG_BR
+#define LANG_DK
+#define LANG_SK
+#define LANG_UA
+#define LANG_GR
+#define LANG_TW
+#define LANG_SR
+#define LANG_CA
+#define LANG_LT
+#define LANG_ZA
+#define LANG_AR
+#define LANG_FA
diff --git a/parts/doxygen/messages.cpp b/parts/doxygen/messages.cpp
new file mode 100644
index 00000000..050e1ba6
--- /dev/null
+++ b/parts/doxygen/messages.cpp
@@ -0,0 +1,301 @@
+#include <qmap.h>
+
+
+#include <kdebug.h>
+#include <klocale.h>
+
+
+static QMap<QCString,QString> sMessages;
+
+
+// Note: this function seems to be completely unnecessary, but messages.insert
+// is a template function, so doing the template expansion just once reduced
+// the compile time of this trivial file from >5m to <30s on my machine. mhk.
+static void addMessage(const QCString key, const QString &message)
+{
+ sMessages.insert(key, message);
+}
+
+
+QString message(const QCString &key)
+{
+ static bool initialized = false;
+
+ if (!initialized)
+ {
+ //---------------------------------------------------------------------------
+ // Project related configuration options
+ //---------------------------------------------------------------------------
+ addMessage("Project", i18n("Project"));
+ addMessage("PROJECT_NAME", i18n("Project name"));
+ addMessage("PROJECT_NUMBER", i18n("Project version"));
+ addMessage("OUTPUT_DIRECTORY", i18n("Output path"));
+ addMessage("CREATE_SUBDIRS", i18n("Distribute the generated docs in 10 subdirectories"));
+ addMessage("OUTPUT_LANGUAGE", i18n("Output language"));
+ addMessage("USE_WINDOWS_ENCODING", i18n("Use MS Windows(tm) font encoding"));
+ addMessage("BRIEF_MEMBER_DESC", i18n("Include brief member descriptions"));
+ addMessage("REPEAT_BRIEF", i18n("Repeat brief member descriptions"));
+ addMessage("ABBREVIATE_BRIEF", i18n("Strip words in brief description"));
+ addMessage("ALWAYS_DETAILED_SEC", i18n("Always include detailed section"));
+ addMessage("INLINE_INHERITED_MEMB", i18n("Inline inherited members"));
+ addMessage("FULL_PATH_NAMES", i18n("Always use full path names"));
+ addMessage("STRIP_FROM_PATH", i18n("Prefix to strip from path names"));
+ addMessage("STRIP_FROM_INC_PATH", i18n("Strip from include path"));
+ addMessage("SHORT_NAMES", i18n("Generate short file names"));
+ addMessage("JAVADOC_AUTOBRIEF", i18n("Use JavaDoc-style brief descriptions"));
+ addMessage("MULTILINE_CPP_IS_BRIEF", i18n("Multiline cpp is brief"));
+ addMessage("DETAILS_AT_TOP", i18n("Details at top"));
+ addMessage("INHERIT_DOCS", i18n("Inherit documentation"));
+ addMessage("SEPARATE_MEMBER_PAGES", i18n("Produce a new page for each member"));
+ addMessage("TAB_SIZE", i18n("Tab size"));
+ addMessage("ALIASES", i18n("Aliases"));
+ addMessage("OPTIMIZE_OUTPUT_FOR_C", i18n("Optimize output for C"));
+ addMessage("OPTIMIZE_OUTPUT_JAVA", i18n("Optimize output for Java"));
+ addMessage("BUILTIN_STL_SUPPORT", i18n("Use built-in STL classes support"));
+ addMessage("DISTRIBUTE_GROUP_DOC", i18n("Use group documentation on undocumented members"));
+ addMessage("SUBGROUPING", i18n("Class members type subgrouping"));
+
+ //---------------------------------------------------------------------------
+ // Build related configuration options
+ //---------------------------------------------------------------------------
+ addMessage("Build", i18n("Build"));
+ addMessage("EXTRACT_ALL", i18n("Extract undocumented entities"));
+ addMessage("EXTRACT_PRIVATE", i18n("Extract private entities"));
+ addMessage("EXTRACT_STATIC", i18n("Extract static entities"));
+ addMessage("EXTRACT_LOCAL_CLASSES", i18n("Extract local classes"));
+ addMessage("EXTRACT_LOCAL_METHODS", i18n("Extract local methods"));
+ addMessage("HIDE_UNDOC_MEMBERS", i18n("Hide undocumented members"));
+ addMessage("HIDE_UNDOC_CLASSES", i18n("Hide undocumented classes"));
+ addMessage("HIDE_FRIEND_COMPOUNDS", i18n("Hide friend compounds"));
+ addMessage("HIDE_IN_BODY_DOCS", i18n("Hide in body docs"));
+ addMessage("INTERNAL_DOCS", i18n("Document internal entities"));
+ addMessage("CASE_SENSE_NAMES", i18n("Use case-sensitive file names"));
+ addMessage("HIDE_SCOPE_NAMES", i18n("Hide name scopes"));
+ addMessage("SHOW_INCLUDE_FILES", i18n("Show included files"));
+ addMessage("INLINE_INFO", i18n("Make inline functions"));
+ addMessage("SORT_MEMBER_DOCS", i18n("Sort member documentation alphabetically"));
+ addMessage("SORT_BY_SCOPE_NAME", i18n("Sort the class list by fully-qualified names"));
+ addMessage("SORT_BRIEF_DOCS", i18n("Sort brief documentation alphabetically"));
+ addMessage("ENABLED_SECTIONS", i18n("Enable conditional sections"));
+ addMessage("GENERATE_TODOLIST", i18n("Generate TODO-list"));
+ addMessage("GENERATE_TESTLIST", i18n("Generate Test-list"));
+ addMessage("GENERATE_BUGLIST", i18n("Generate Bug-list"));
+ addMessage("GENERATE_DEPRECATEDLIST", i18n("Generate Deprecated-list"));
+ addMessage("MAX_INITIALIZER_LINES", i18n("Maximum lines shown for initializers"));
+ addMessage("SHOW_USED_FILES", i18n("Show used files"));
+ addMessage("SHOW_DIRECTORIES", i18n("Show the directory hierarchy"));
+ addMessage("FILE_VERSION_FILTER", i18n("Script to invoke to get the current version for each file"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to warning and progress messages
+ //---------------------------------------------------------------------------
+ addMessage("Messages", i18n("Messages"));
+ addMessage("QUIET", i18n("Suppress output"));
+ addMessage("WARNINGS", i18n("Show warnings"));
+ addMessage("WARN_IF_UNDOCUMENTED", i18n("Warn about undocumented entities"));
+ addMessage("WARN_IF_DOC_ERROR", i18n("Warn if error in documents"));
+ addMessage("WARN_NO_PARAMDOC", i18n("Warn if function parameters are not documented"));
+ addMessage("WARN_FORMAT", i18n("Warnings format"));
+ addMessage("WARN_LOGFILE", i18n("Write warnings to"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the input files
+ //---------------------------------------------------------------------------
+ addMessage("Input", i18n("Input"));
+ addMessage("INPUT", i18n("Input files and directories"));
+ addMessage("FILE_PATTERNS", i18n("Input patterns"));
+ addMessage("RECURSIVE", i18n("Recurse into subdirectories"));
+ addMessage("EXCLUDE", i18n("Exclude from input"));
+ addMessage("EXCLUDE_SYMLINKS", i18n("Exclude symlinks"));
+ addMessage("EXCLUDE_PATTERNS", i18n("Exclude patterns"));
+ addMessage("EXAMPLE_PATH", i18n("Path to examples"));
+ addMessage("EXAMPLE_PATTERNS", i18n("Example patterns"));
+ addMessage("EXAMPLE_RECURSIVE", i18n("Example recursive"));
+ addMessage("IMAGE_PATH", i18n("Path to images"));
+ addMessage("INPUT_FILTER", i18n("Input filter"));
+ addMessage("FILTER_SOURCE_FILES", i18n("Filter input files"));
+ addMessage("FILTER_PATTERNS", i18n("Apply filters on file patterns"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to source browsing
+ //---------------------------------------------------------------------------
+ addMessage("Source Browser", i18n("Source Browser"));
+ addMessage("SOURCE_BROWSER", i18n("Cross-reference with source files"));
+ addMessage("REFERENCES_LINK_SOURCE", i18n("References will link to source code"));
+ addMessage("USE_HTAGS", i18n("Use links to HTAGS"));
+ addMessage("INLINE_SOURCES", i18n("Inline sources"));
+ addMessage("STRIP_CODE_COMMENTS", i18n("Hide special comment blocks"));
+ addMessage("REFERENCED_BY_RELATION", i18n("Referenced by relation"));
+ addMessage("REFERENCES_RELATION", i18n("References relation"));
+ addMessage("VERBATIM_HEADERS", i18n("Include headers verbatim"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the alphabetical class index
+ //---------------------------------------------------------------------------
+ addMessage("Index", i18n("Index"));
+ addMessage("ALPHABETICAL_INDEX", i18n("Generate alphabetical index"));
+ addMessage("COLS_IN_ALPHA_INDEX", i18n("Columns in index"));
+ addMessage("IGNORE_PREFIX", i18n("Prefix to ignore"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the HTML output
+ //---------------------------------------------------------------------------
+ addMessage("HTML", i18n("HTML"));
+ addMessage("GENERATE_HTML", i18n("Generate HTML"));
+ addMessage("HTML_OUTPUT", i18n("HTML output directory"));
+ addMessage("HTML_FILE_EXTENSION", i18n("HTML file extension"));
+ addMessage("HTML_HEADER", i18n("Header file"));
+ addMessage("HTML_FOOTER", i18n("Footer file"));
+ addMessage("HTML_STYLESHEET", i18n("Stylesheet"));
+ addMessage("HTML_ALIGN_MEMBERS", i18n("Align members"));
+ addMessage("GENERATE_HTMLHELP", i18n("Generate HTML-help"));
+ addMessage("CHM_FILE", i18n("CHM file"));
+ addMessage("HHC_LOCATION", i18n("HHC location"));
+ addMessage("GENERATE_CHI", i18n("Generate .chi file"));
+ addMessage("BINARY_TOC", i18n("Generate binary TOC"));
+ addMessage("TOC_EXPAND", i18n("Expand TOC"));
+ addMessage("DISABLE_INDEX", i18n("Disable index"));
+ addMessage("ENUM_VALUES_PER_LINE", i18n("Number of enum values per line"));
+ addMessage("GENERATE_TREEVIEW", i18n("Generate treeview"));
+ addMessage("TREEVIEW_WIDTH", i18n("Treeview width"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the LaTeX output
+ //---------------------------------------------------------------------------
+ addMessage("LaTeX", i18n("LaTeX"));
+ addMessage("GENERATE_LATEX", i18n("Generate LaTeX"));
+ addMessage("LATEX_OUTPUT", i18n("LaTeX output directory"));
+ addMessage("LATEX_CMD_NAME", i18n("LaTeX command name"));
+ addMessage("MAKEINDEX_CMD_NAME", i18n("MakeIndex command name"));
+ addMessage("COMPACT_LATEX", i18n("Generate compact output"));
+ addMessage("PAPER_TYPE", i18n("Paper type"));
+ addMessage("EXTRA_PACKAGES", i18n("Include extra packages"));
+ addMessage("LATEX_HEADER", i18n("LaTeX Header file"));
+ addMessage("PDF_HYPERLINKS", i18n("Generate PDF hyperlinks"));
+ addMessage("USE_PDFLATEX", i18n("Use pdflatex"));
+ addMessage("LATEX_BATCHMODE", i18n("Use batch mode"));
+ addMessage("LATEX_HIDE_INDICES", i18n("Do not include index chapters"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the RTF output
+ //---------------------------------------------------------------------------
+ addMessage("RTF", i18n("RTF"));
+ addMessage("GENERATE_RTF", i18n("Generate RTF"));
+ addMessage("RTF_OUTPUT", i18n("RTF output directory"));
+ addMessage("COMPACT_RTF", i18n("Generate compact output"));
+ addMessage("RTF_HYPERLINKS", i18n("Generate hyperlinks"));
+ addMessage("RTF_STYLESHEET_FILE", i18n("Stylesheet"));
+ addMessage("RTF_EXTENSIONS_FILE", i18n("Extensions file"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the man page output
+ //---------------------------------------------------------------------------
+ addMessage("Man", i18n("Man"));
+ addMessage("GENERATE_MAN", i18n("Generate man pages"));
+ addMessage("MAN_OUTPUT", i18n("Man output directory"));
+ addMessage("MAN_EXTENSION", i18n("Man extension"));
+ addMessage("MAN_LINKS", i18n("Generate links"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the XML output
+ //---------------------------------------------------------------------------
+ addMessage("XML", i18n("XML"));
+ addMessage("GENERATE_XML", i18n("Generate XML"));
+ addMessage("XML_OUTPUT", i18n("XML output directory"));
+ addMessage("XML_SCHEMA", i18n("XML schema"));
+ addMessage("XML_DTD", i18n("XML DTD file"));
+ addMessage("XML_PROGRAMLISTING", i18n("Dump program listings to the XML output"));
+
+ //---------------------------------------------------------------------------
+ // configuration options for the AutoGen Definitions output
+ //---------------------------------------------------------------------------
+ addMessage("DEF", i18n("DEF"));
+ addMessage("GENERATE_AUTOGEN_DEF", i18n("Generate Autogen DEF"));
+
+ //---------------------------------------------------------------------------
+ // configuration options related to the Perl module output
+ //---------------------------------------------------------------------------
+ addMessage("PerlMod", i18n("Perl"));
+ addMessage("GENERATE_PERLMOD", i18n("Generate Perl module"));
+ addMessage("PERLMOD_LATEX", i18n("Generate PDF and DVI using LaTeX"));
+ addMessage("PERLMOD_PRETTY", i18n("Make the Perl module output human readable"));
+ addMessage("PERLMOD_MAKEVAR_PREFIX", i18n("Perl module variable prefix in the makefiles"));
+
+ //---------------------------------------------------------------------------
+ // Configuration options related to the preprocessor
+ //---------------------------------------------------------------------------
+ addMessage("Preprocessor", i18n("Preprocessor"));
+ addMessage("ENABLE_PREPROCESSING", i18n("Enable preprocessing"));
+ addMessage("MACRO_EXPANSION", i18n("Expand macros"));
+ addMessage("EXPAND_ONLY_PREDEF", i18n("Expand only predefined macros"));
+ addMessage("SEARCH_INCLUDES", i18n("Search for includes"));
+ addMessage("INCLUDE_PATH", i18n("Include path"));
+ addMessage("INCLUDE_FILE_PATTERNS", i18n("Include file patterns"));
+ addMessage("PREDEFINED", i18n("Predefined macros"));
+ addMessage("EXPAND_AS_DEFINED", i18n("Expand as defined"));
+ addMessage("SKIP_FUNCTION_MACROS", i18n("Skip function macros"));
+
+ //---------------------------------------------------------------------------
+ // Configuration::addtions related to external references
+ //---------------------------------------------------------------------------
+ addMessage("External", i18n("External"));
+ addMessage("TAGFILES", i18n("Tagfiles"));
+ addMessage("GENERATE_TAGFILE", i18n("Generate tagfile"));
+ addMessage("ALLEXTERNALS", i18n("List all externals"));
+ addMessage("EXTERNAL_GROUPS", i18n("External groups"));
+ addMessage("PERL_PATH", i18n("Path to Perl"));
+
+ //---------------------------------------------------------------------------
+ // Configuration options related to the dot tool
+ //---------------------------------------------------------------------------
+ addMessage("Dot", i18n("Dot"));
+ addMessage("CLASS_DIAGRAMS", i18n("Generate class diagrams"));
+ addMessage("HIDE_UNDOC_RELATIONS", i18n("Hide undocumented relations"));
+ addMessage("HAVE_DOT", i18n("Use dot"));
+ addMessage("CALLER_GRAPH", i18n("Generate a caller dependency graph"));
+ addMessage("CLASS_GRAPH", i18n("Generate class graphs"));
+ addMessage("COLLABORATION_GRAPH", i18n("Generate collaboration graphs"));
+ addMessage("GROUP_GRAPHS", i18n("Generate a graph showing the direct groups dependencies"));
+ addMessage("UML_LOOK", i18n("Generate UML looking inheritance and colloboration diagrams"));
+ addMessage("TEMPLATE_RELATIONS", i18n("Show relations between templates and their instances"));
+ addMessage("INCLUDE_GRAPH", i18n("Generate include graphs"));
+ addMessage("INCLUDED_BY_GRAPH", i18n("Generate included-by graphs"));
+ addMessage("CALL_GRAPH", i18n("Generate a call dependency graph for every global function or class method"));
+ addMessage("GRAPHICAL_HIERARCHY", i18n("Generate graphical hierarchy"));
+ addMessage("DIRECTORY_GRAPH", i18n("Show the dependencies a directory has on other directories"));
+ addMessage("DOT_IMAGE_FORMAT", i18n("Dot image format"));
+ addMessage("DOT_PATH", i18n("Path to dot"));
+ addMessage("DOTFILE_DIRS", i18n("Directories with extra dot files"));
+ addMessage("MAX_DOT_GRAPH_WIDTH", i18n("Maximum graph width"));
+ addMessage("MAX_DOT_GRAPH_HEIGHT", i18n("Maximum graph height"));
+ addMessage("MAX_DOT_GRAPH_DEPTH", i18n("Maximum graph depth"));
+ addMessage("DOT_TRANSPARENT", i18n("Generate images with a transparent background"));
+ addMessage("DOT_MULTI_TARGETS", i18n("Generate multiple output files in one run"));
+ addMessage("GENERATE_LEGEND", i18n("Generate legend"));
+ addMessage("DOT_CLEANUP", i18n("Remove intermediate files"));
+ addMessage("Search", i18n("Search"));
+
+ //---------------------------------------------------------------------------
+ // Configuration::addtions related to the search engine
+ //---------------------------------------------------------------------------
+ addMessage("SEARCHENGINE", i18n("Search engine"));
+ addMessage("CGI_NAME", i18n("CGI name"));
+ addMessage("CGI_URL", i18n("CGI URL"));
+ addMessage("DOC_URL", i18n("Documentation URL"));
+ addMessage("DOC_ABSPATH", i18n("Absolute path to documentation"));
+ addMessage("BIN_ABSPATH", i18n("Absolute path to doxysearch binary"));
+ addMessage("EXT_DOC_PATHS", i18n("Paths to external documentation"));
+
+ initialized = true;
+ }
+
+ if (!sMessages.contains(key))
+ {
+ kdDebug() << "Unhandled message: " << key << endl;
+
+ return key;
+ }
+
+ return sMessages[key];
+}
+
diff --git a/parts/doxygen/messages.h b/parts/doxygen/messages.h
new file mode 100644
index 00000000..38ad6b84
--- /dev/null
+++ b/parts/doxygen/messages.h
@@ -0,0 +1,11 @@
+#ifndef __DOXYGEN_MESSAGES_H__
+#define __DOXYGEN_MESSAGES_H__
+
+
+#include <qstring.h>
+
+
+QString message(const QCString &key);
+
+
+#endif
diff --git a/parts/doxygen/version.cpp b/parts/doxygen/version.cpp
new file mode 100644
index 00000000..f8371250
--- /dev/null
+++ b/parts/doxygen/version.cpp
@@ -0,0 +1 @@
+char versionString[]="1.5.7.1-KDevelop";
diff --git a/parts/doxygen/version.h b/parts/doxygen/version.h
new file mode 100644
index 00000000..e3369300
--- /dev/null
+++ b/parts/doxygen/version.h
@@ -0,0 +1,23 @@
+/******************************************************************************
+ *
+ *
+ *
+ * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#ifndef VERSION_H
+#define VERSION_H
+
+extern char versionString[];
+
+#endif
diff --git a/parts/filecreate/Makefile.am b/parts/filecreate/Makefile.am
new file mode 100644
index 00000000..462a8543
--- /dev/null
+++ b/parts/filecreate/Makefile.am
@@ -0,0 +1,23 @@
+#
+
+SUBDIRS = file-templates
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfilecreate.la
+libkdevfilecreate_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfilecreate_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfilecreate_la_SOURCES = filecreate_part.cpp filecreate_listitem.cpp \
+ filecreate_filetype.cpp filecreate_filedialog.cpp fcconfigwidgetbase.ui fcconfigwidget.cpp \
+ fctypeeditbase.ui fctypeedit.cpp fctemplateeditbase.ui fctemplateedit.cpp \
+ filecreate_newfile.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfilecreate.desktop
+
+rcdir = $(kde_datadir)/kdevfilecreate
+rc_DATA = kdevpart_filecreate.rc template-info.xml
diff --git a/parts/filecreate/README b/parts/filecreate/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/filecreate/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/filecreate/README.dox b/parts/filecreate/README.dox
new file mode 100644
index 00000000..50e267e8
--- /dev/null
+++ b/parts/filecreate/README.dox
@@ -0,0 +1,76 @@
+/** \class FileCreatePart
+FileCreatePart is a template manager and wizard system to assist with creation of new files.
+
+Assists with creation of new files.
+
+For those who want to look beyond the GUI, the following illustrates the XML to configure the FileCreate part for a project. It simply consists of a list of filetypes that the user may wish to create for a particular project. At present, the "create" attribute is ignored.
+
+The file create part looks for a file template called \@ext (i.e. the value of the ext attribute) in the *project's* templates directory (see the PyQT appwizard template for an example).
+
+For subtypes, it looks for a template called \@ext-\@ref, so in the example below the following files would need to be present in the project's templates directory:
+
+<code>
+py
+ui
+ui-dialog
+ui-mainwin
+</code>
+
+Example XML:
+
+<code>
+\verbatim
+ <kdevfilecreate>
+ <filetypes>
+ <type ext="py" name="Python" create="template"/>
+ <type ext="ui" name="QT Designer" create="template">
+ <subtype ref="dialog" name="Dialog"/>
+ <subtype ref="mainwin" name="Main window"/>
+ </type>
+ </filetypes>
+ </kdevfilecreate>
+\endverbatim
+</code>
+
+You can also use global template definitions supplied with the FileCreate part:
+
+<code>
+\verbatim
+ <kdevfilecreate>
+ <useglobaltypes>
+ <type ext="ui" />
+ </useglobaltypes>
+ <filetypes>
+ <type ext="py" name="Python" create="template"/>
+ </filetypes>
+ </kdevfilecreate>
+\endverbatim
+</code>
+
+If a type has subtypes, and no subtypes are specified, then all subtypes are assumed to be required (as in the example above). Otherwise, specific subtypes should be specified:
+
+<code>
+\verbatim
+<useglobaltypes>
+ <type ext="ui">
+ <subtype ref="dialog"/>
+ </type>
+</useglobaltypes>
+\endverbatim
+</code>
+
+Usually, this XML forms part of the base .kdevelop file created by the appwizard.
+
+\authors <a href="mailto:kde AT jrockey.com">Julian Rockey</a>
+\authors <a href="mailto:cloudtemple AT mksat.net">Alexander Dymo</a>
+
+\maintainer <a href="mailto:kde AT jrockey.com">Julian Rockey</a>
+
+\feature friendly sidebar listing the types of new file that can be created for your project
+\feature configurable per-project file types and global file types
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=file+create&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">file create component at Bugzilla database</a>
+\bug Arrangement of text in sidebar is not always perfect
+
+
+*/
diff --git a/parts/filecreate/addglobaldlg.cpp b/parts/filecreate/addglobaldlg.cpp
new file mode 100644
index 00000000..0757d220
--- /dev/null
+++ b/parts/filecreate/addglobaldlg.cpp
@@ -0,0 +1,106 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './addglobaldlg.ui'
+**
+** Created: Сбт Лют 8 20:51:03 2003
+** by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#include "addglobaldlg.h"
+
+#include <qvariant.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <klocale.h>
+
+/*
+ * Constructs a AddGlobalDlg as a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+AddGlobalDlg::AddGlobalDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+
+{
+ if ( !name )
+ setName( "AddGlobalDlg" );
+ setSizeGripEnabled( TRUE );
+ AddGlobalDlgLayout = new QGridLayout( this, 1, 1, 11, 6, "AddGlobalDlgLayout");
+
+ Layout1 = new QHBoxLayout( 0, 0, 6, "Layout1");
+
+ buttonHelp = new KPushButton( this, "buttonHelp" );
+ buttonHelp->setAutoDefault( TRUE );
+ Layout1->addWidget( buttonHelp );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout1->addItem( spacer );
+
+ buttonOk = new KPushButton( this, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ Layout1->addWidget( buttonOk );
+
+ buttonCancel = new KPushButton( this, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ Layout1->addWidget( buttonCancel );
+
+ AddGlobalDlgLayout->addLayout( Layout1, 1, 0 );
+
+ fcglobal_view = new QListView( this, "fcglobal_view" );
+ fcglobal_view->addColumn( i18n( "Type Extension" ) );
+ fcglobal_view->addColumn( i18n( "Type Name" ) );
+ fcglobal_view->addColumn( i18n( "Template Location" ) );
+ fcglobal_view->addColumn( i18n( "Icon" ) );
+ fcglobal_view->addColumn( i18n( "Description" ) );
+ fcglobal_view->setResizePolicy( QListView::AutoOne );
+ fcglobal_view->setAllColumnsShowFocus( TRUE );
+ fcglobal_view->setRootIsDecorated( TRUE );
+ fcglobal_view->setResizeMode( QListView::AllColumns );
+
+ AddGlobalDlgLayout->addWidget( fcglobal_view, 0, 0 );
+ languageChange();
+ resize( QSize(511, 282).expandedTo(minimumSizeHint()) );
+
+ // signals and slots connections
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+AddGlobalDlg::~AddGlobalDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Sets the strings of the subwidgets using the current
+ * language.
+ */
+void AddGlobalDlg::languageChange()
+{
+ setCaption( i18n( "Select Global File Types" ) );
+ buttonHelp->setGuiItem( KStdGuiItem::help() );
+ buttonHelp->setAccel( QKeySequence( tr2i18n( "F1" ) ) );
+ buttonOk->setGuiItem( KStdGuiItem::ok() );
+ buttonOk->setAccel( QKeySequence( QString::null ) );
+ buttonCancel->setGuiItem( KStdGuiItem::cancel() );
+ buttonCancel->setAccel( QKeySequence( QString::null ) );
+ fcglobal_view->header()->setLabel( 0, i18n( "Type extension:" ) );
+ fcglobal_view->header()->setLabel( 1, i18n( "Type name:" ) );
+ fcglobal_view->header()->setLabel( 2, i18n( "Template location:" ) );
+ fcglobal_view->header()->setLabel( 3, i18n( "Icon:" ) );
+ fcglobal_view->header()->setLabel( 4, i18n( "Description:" ) );
+}
+
+#include "addglobaldlg.moc"
diff --git a/parts/filecreate/addglobaldlg.h b/parts/filecreate/addglobaldlg.h
new file mode 100644
index 00000000..0ec8e588
--- /dev/null
+++ b/parts/filecreate/addglobaldlg.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+** Form interface generated from reading ui file './addglobaldlg.ui'
+**
+** Created: Сбт Лют 8 20:48:22 2003
+** by: The User Interface Compiler ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef ADDGLOBALDLG_H
+#define ADDGLOBALDLG_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QListView;
+class QListViewItem;
+class QPushButton;
+
+class AddGlobalDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddGlobalDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~AddGlobalDlg();
+
+ QPushButton* buttonHelp;
+ QPushButton* buttonOk;
+ QPushButton* buttonCancel;
+ QListView* fcglobal_view;
+
+protected:
+ QGridLayout* AddGlobalDlgLayout;
+ QHBoxLayout* Layout1;
+
+protected slots:
+ virtual void languageChange();
+};
+
+#endif // ADDGLOBALDLG_H
diff --git a/parts/filecreate/fcconfigwidget.cpp b/parts/filecreate/fcconfigwidget.cpp
new file mode 100644
index 00000000..480d38e0
--- /dev/null
+++ b/parts/filecreate/fcconfigwidget.cpp
@@ -0,0 +1,709 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qtabwidget.h>
+#include <qdom.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qcheckbox.h>
+#include <klineedit.h>
+#include <qlabel.h>
+
+#include <kstandarddirs.h>
+#include <kio/netaccess.h>
+#include <kurlrequester.h>
+#include <kicondialog.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kiconloader.h>
+#include <kdeversion.h>
+
+#include "fctypeedit.h"
+#include "fctemplateedit.h"
+#include "domutil.h"
+#include "fcconfigwidget.h"
+#include "filecreate_part.h"
+#include "filecreate_filetype.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+
+
+FCConfigWidget::FCConfigWidget(FileCreatePart * part, bool global, QWidget *parent, const char *name):
+ FCConfigWidgetBase(parent, name), m_part(part), m_global(global)
+{
+ fc_view->setSorting(-1, FALSE);
+ fcglobal_view->setSorting(-1, FALSE);
+
+ if (m_global)
+ {
+ loadGlobalConfig(fc_view);
+ fc_tabs->setTabLabel(tab1, i18n("Global Types") );
+ fc_tabs->setTabEnabled(tab2, false);
+ fc_tabs->setTabEnabled(tab3, false);
+ delete tab2;
+ delete tab3;
+ }
+ else
+ {
+ loadGlobalConfig(fcglobal_view, true);
+ loadProjectConfig(fc_view);
+ loadProjectTemplates(fctemplates_view);
+ templatesDir_label->setText(i18n("Project templates in ") + m_part->project()->projectDirectory() + "/templates");
+ }
+
+ m_globalfiletypes.setAutoDelete(true);
+ m_projectfiletypes.setAutoDelete(true);
+ m_projectfiletemplates.setAutoDelete(true);
+}
+
+FCConfigWidget::~FCConfigWidget()
+{
+}
+
+void FCConfigWidget::accept()
+{
+ if (m_global) {
+ saveGlobalConfig();
+ }
+ else
+ saveProjectConfig();
+
+ m_part->m_filetypes.clear();
+ m_part->slotProjectOpened();
+
+ for (QValueList<KURL>::iterator it = urlsToEdit.begin(); it != urlsToEdit.end(); ++it )
+ {
+ m_part->partController()->editDocument(*it);
+ }
+}
+
+void FCConfigWidget::loadGlobalConfig(QListView *view, bool checkmarks)
+{
+ QString globalXMLFile = ::locate("data", "kdevfilecreate/template-info.xml");
+ QDomDocument globalDom;
+ if (!globalXMLFile.isNull() &&
+ DomUtil::openDOMFile(globalDom,globalXMLFile)) {
+ m_part->readTypes(globalDom, m_globalfiletypes, false);
+ }
+
+
+ loadFileTypes(m_globalfiletypes, view, checkmarks);
+
+ if (checkmarks)
+ {
+ QDomElement useGlobalTypes =
+ DomUtil::elementByPath(*(m_part->projectDom()),"/kdevfilecreate/useglobaltypes");
+ for(QDomNode node = useGlobalTypes.firstChild(); !node.isNull();node=node.nextSibling())
+ {
+ if (node.isElement() && node.nodeName()=="type")
+ {
+ QDomElement element = node.toElement();
+ QString ext = element.attribute("ext");
+ QString subtyperef = element.attribute("subtyperef");
+ if (subtyperef.isNull())
+ {
+ QListViewItem *it = view->findItem(ext, 0);
+ if (it)
+ {
+ ((QCheckListItem*)it)->setOn(true);
+
+ QListViewItem *lastChild = it->firstChild();
+ while ( lastChild )
+ {
+ ((QCheckListItem*)lastChild)->setOn(true);
+ lastChild = lastChild->nextSibling();
+ }
+ }
+ }
+ else
+ {
+ QListViewItem *it = view->findItem(subtyperef, 0);
+ if (it)
+ ((QCheckListItem*)it)->setOn(true);
+ }
+ }
+ }
+ }
+}
+
+void FCConfigWidget::loadProjectConfig(QListView *view)
+{
+ m_part->readTypes( *(m_part->projectDom()), m_projectfiletypes, false );
+ loadFileTypes(m_projectfiletypes, view, false);
+}
+
+void FCConfigWidget::loadProjectTemplates(QListView *view)
+{
+ QDir templDir( m_part->project()->projectDirectory() + "/templates/" );
+ templDir.setFilter( QDir::Files );
+ const QFileInfoList * list = templDir.entryInfoList();
+ if( list ){
+ QFileInfoListIterator it( *list );
+ QFileInfo *fi;
+ while ( (fi = it.current()) != 0 ) {
+ FileType * filetype;
+ filetype = new FileType;
+ //name shall be "" for proper configuration
+ filetype->setName( "" );
+ filetype->setExt( fi->fileName() );
+ m_projectfiletemplates.append(filetype);
+ filetype->setEnabled(false);
+ ++it;
+ }
+ }
+ loadFileTypes(m_projectfiletemplates, view, false);
+}
+
+
+void FCConfigWidget::saveGlobalConfig()
+{
+ QDomDocument globalDom;
+ QDomElement element = globalDom.createElement("kdevelop" );
+ globalDom.appendChild(element);
+ QDomElement apPart = globalDom.createElement("kdevfilecreate");
+ element.appendChild(apPart);
+ QDomElement fileTypes = globalDom.createElement( "filetypes" );
+ apPart.appendChild( fileTypes );
+
+ saveConfiguration(globalDom, fileTypes, true);
+
+ QFile config( KGlobal::dirs()->saveLocation("data", "kdevfilecreate/", true) + "template-info.xml" );
+ config.open(IO_WriteOnly | IO_Truncate);
+ QTextStream stream(&config);
+ stream << "<?xml version = '1.0'?>";
+ stream << globalDom.toString();
+ config.close();
+}
+
+void FCConfigWidget::saveProjectConfig()
+{
+ QDomDocument dom = *m_part->projectDom( );
+ QDomElement element = dom.documentElement( );
+ QDomElement apPart = element.namedItem( "kdevfilecreate" ).toElement( );
+ if( apPart.isNull( ) )
+ {
+ apPart = dom.createElement( "kdevfilecreate" );
+ element.appendChild( apPart );
+ }
+
+
+ // project template configuration
+
+ QDomElement projectTypes = apPart.namedItem( "filetypes" ).toElement( );
+ apPart.removeChild(projectTypes);
+ projectTypes = dom.createElement( "filetypes" );
+ apPart.appendChild( projectTypes );
+
+ saveConfiguration(dom, projectTypes, false);
+
+
+ // global template usage
+
+ QDomElement globalTypes = apPart.namedItem( "useglobaltypes" ).toElement( );
+ apPart.removeChild(globalTypes);
+ globalTypes = dom.createElement( "useglobaltypes" );
+ apPart.appendChild( globalTypes );
+
+ QListViewItemIterator it( fcglobal_view );
+ for( ; it.current( ); ++it ){
+ if (!it.current()->parent())
+ {
+ QCheckListItem *chit = dynamic_cast<QCheckListItem*>(it.current());
+ if ( !chit ) continue;
+ if (chit->isOn())
+ {
+ QDomElement type = dom.createElement( "type" );
+ type.setAttribute( "ext", chit->text(0) );
+ globalTypes.appendChild( type );
+ }
+ else
+ {
+ QListViewItem *lastChild = chit->firstChild();
+ while ( lastChild )
+ {
+ QCheckListItem *chsit = dynamic_cast<QCheckListItem*>(lastChild);
+ if ( (chsit) && (chsit->isOn()))
+ {
+ QDomElement type = dom.createElement( "type" );
+ type.setAttribute( "ext", chit->text(0) );
+ type.setAttribute( "subtyperef", chsit->text(0) );
+ globalTypes.appendChild( type );
+ }
+
+ lastChild = lastChild->nextSibling();
+ }
+ }
+ }
+ }
+
+
+ // project template files
+
+ //check for new templates and those with location changed
+ QListViewItemIterator it2(fctemplates_view);
+ while (it2.current())
+ {
+ if (!it2.current()->text(1).isEmpty())
+ {
+ QString dest;
+ dest = m_part->project()->projectDirectory() + "/templates/";
+ if (it2.current()->text(1) == "create")
+ copyTemplate(QString::null, dest, it2.current()->text(0));
+ else
+ copyTemplate(it2.current()->text(1), dest, it2.current()->text(0));
+ }
+ ++it2;
+ }
+}
+
+void FCConfigWidget::saveConfiguration(QDomDocument &dom, QDomElement &element, bool global)
+{
+ QListViewItemIterator it( fc_view );
+ for( ; it.current( ); ++it ){
+ if (!it.current()->parent())
+ {
+ QDomElement type = dom.createElement( "type" );
+ type.setAttribute( "ext", it.current()->text(0) );
+ type.setAttribute( "name", it.current()->text(1) );
+ if (it.current()->childCount() > 0)
+ type.setAttribute( "create", "no");
+ else
+ type.setAttribute( "create", "template");
+ type.setAttribute( "icon", it.current()->text(2) );
+
+ QDomElement edescr = dom.createElement("descr");
+ type.appendChild(edescr);
+ QDomText descr = dom.createTextNode( it.current()->text(3) );
+ edescr.appendChild(descr);
+
+ if (!it.current()->text(4).isEmpty())
+ {
+ QString dest;
+ if (global)
+ dest = KGlobal::dirs()->saveLocation("data", "/kdevfilecreate/file-templates/", true);
+ else
+ dest = m_part->project()->projectDirectory() + "/templates/";
+ if (it.current()->text(4) == "create")
+ copyTemplate(QString::null, dest, it.current()->text(0));
+ else
+ copyTemplate(it.current()->text(4), dest, it.current()->text(0));
+ }
+
+
+ QListViewItem *lastChild = it.current()->firstChild();
+ while ( lastChild )
+ {
+ QDomElement subtype = dom.createElement( "subtype" );
+ subtype.setAttribute( "ref", lastChild->text(0) );
+ subtype.setAttribute( "name", lastChild->text(1) );
+ subtype.setAttribute( "icon", lastChild->text(2) );
+
+ QDomElement edescr = dom.createElement("descr");
+ subtype.appendChild(edescr);
+ QDomText descr = dom.createTextNode( lastChild->text(3) );
+ edescr.appendChild(descr);
+
+ if (!lastChild->text(4).isEmpty())
+ {
+ QString dest;
+ if (global)
+ dest = KGlobal::dirs()->saveLocation("data", "/kdevfilecreate/file-templates/", true);
+ else
+ dest = m_part->project()->projectDirectory() + "/templates/";
+ if (lastChild->text(4) == "create")
+ copyTemplate(QString::null, dest, it.current()->text(0) + "-" + lastChild->text(0));
+ else
+ copyTemplate(lastChild->text(4), dest, it.current()->text(0) + "-" + lastChild->text(0));
+ }
+
+ type.appendChild( subtype );
+ lastChild = lastChild->nextSibling();
+ }
+
+ element.appendChild( type );
+ }
+ }
+}
+
+void FCConfigWidget::copyTemplate(QString templateUrl, QString dest, QString destName)
+{
+ if (templateUrl.isEmpty())
+ {
+ QDir d(dest);
+ if (!d.exists())
+ d.mkdir(dest);
+
+ QFile f(dest + destName);
+ f.open(IO_WriteOnly);
+ f.close();
+ }
+ else
+ {
+ KURL destDir;
+ destDir.setPath(dest);
+ if (!KIO::NetAccess::exists(destDir, false, 0 ))
+ KIO::NetAccess::mkdir(destDir);
+
+ KURL destination;
+ destination.setPath(dest + destName);
+
+ KIO::NetAccess::upload(templateUrl, destination);
+ }
+}
+
+void FCConfigWidget::loadFileTypes(QPtrList<FileCreate::FileType> list, QListView *view, bool checkmarks)
+{
+ FileType *ft;
+
+ for( ft = list.last(); ft; ft = list.prev())
+ for( int i = list.count() - 1; i >= 0; --i)
+ {
+ if ( (ft = list.at(i)) )
+ {
+ QListViewItem *it;
+ if (!checkmarks)
+ it = new QListViewItem(view);
+ else
+ it = new QCheckListItem(view, "", QCheckListItem::CheckBox);
+
+ it->setText(0, ft->ext());
+ it->setText(1, ft->name());
+ it->setText(2, ft->icon());
+ it->setText(3, ft->descr());
+ it->setText(4, "");
+
+ FileType *sft;
+ for( int j = ft->subtypes().count() - 1; j >= 0; --j)
+ {
+ if ( (sft = ft->subtypes().at(j)) )
+ {
+ QListViewItem *sit;
+ if (!checkmarks)
+ sit = new QListViewItem(it);
+ else
+ sit = new QCheckListItem(it, "", QCheckListItem::CheckBox);
+
+ sit->setText(0, sft->subtypeRef());
+ sit->setText(1, sft->name());
+ sit->setText(2, sft->icon());
+ sit->setText(3, sft->descr());
+ sit->setText(4, "");
+ }
+ }
+ }
+ }
+}
+
+void FCConfigWidget::removetemplate_button_clicked( )
+{
+ if (fctemplates_view->currentItem())
+ {
+ KURL removedTemplate;
+ removedTemplate.setPath(m_part->project()->projectDirectory() + "/templates/" + fctemplates_view->currentItem()->text(0));
+ KIO::NetAccess::del(removedTemplate);
+ QListViewItem *it = fctemplates_view->currentItem();
+ if (it->itemBelow())
+ {
+ fc_view->setSelected(it->itemBelow(), true);
+ fc_view->setCurrentItem(it->itemBelow());
+ }
+ else if (it->itemAbove())
+ {
+ fc_view->setSelected(it->itemAbove(), true);
+ fc_view->setCurrentItem(it->itemAbove());
+ }
+ delete it;
+ }
+}
+
+void FCConfigWidget::copyToProject_button_clicked()
+{
+ QListViewItem *it = fcglobal_view->currentItem();
+ if (it)
+ {
+ QListViewItem *it_copy_parent = 0;
+ QString destParent;
+ if (it->parent())
+ {
+ it_copy_parent = new QListViewItem(fc_view, it->parent()->text(0),
+ it->parent()->text(1),
+ it->parent()->text(2),
+ it->parent()->text(3),
+ locate("data", "kdevfilecreate/file-templates/"+ it->parent()->text(0)));
+ destParent += it->parent()->text(0) + "-";
+ QCheckListItem *chk = dynamic_cast<QCheckListItem*>(it->parent());
+ if (chk)
+ chk->setOn(false);
+ }
+ QListViewItem *it_copy = 0;
+ if (it_copy_parent)
+ it_copy = new QListViewItem(it_copy_parent, it->text(0),
+ it->text(1),
+ it->text(2),
+ it->text(3),
+ locate("data", "kdevfilecreate/file-templates/"+destParent + it->text(0)));
+ else
+ it_copy = new QListViewItem(fc_view, it->text(0),
+ it->text(1),
+ it->text(2),
+ it->text(3),
+ locate("data", "kdevfilecreate/file-templates/" +destParent+ it->text(0)));
+ QCheckListItem *chk = dynamic_cast<QCheckListItem*>(it);
+ if (chk)
+ chk->setOn(false);
+ fc_view->setSelected(it_copy, true);
+ fc_view->setCurrentItem(it_copy);
+ QListViewItem * it_child = it->firstChild();
+ while( it_child ) {
+ new QListViewItem(it_copy, it_child->text(0),
+ it_child->text(1),
+ it_child->text(2),
+ it_child->text(3),
+ locate("data", "kdevfilecreate/file-templates/"+ it_copy->text(0) + "-" + it_child->text(0)));
+ QCheckListItem *chk_child = dynamic_cast<QCheckListItem*>(it_child);
+ if (chk_child)
+ chk_child->setOn(false);
+ it_child = it_child->nextSibling();
+ }
+ }
+}
+
+void FCConfigWidget::newtype_button_clicked()
+{
+ FCTypeEdit *te = new FCTypeEdit();
+ if (te->exec() == QDialog::Accepted )
+ {
+ QListViewItem *it = new QListViewItem(fc_view, te->typeext_edit->text(),
+ te->typename_edit->text(),
+ te->icon_url->icon(),
+ te->typedescr_edit->text(),
+ te->template_url->url().isEmpty() ? QString("create") : te->template_url->url());
+ fc_view->setSelected(it, true);
+ fc_view->setCurrentItem(it);
+ }
+ delete te;
+}
+
+void FCConfigWidget::newsubtype_button_clicked()
+{
+ if (fc_view->currentItem() && (!fc_view->currentItem()->parent()))
+ {
+ FCTypeEdit *te = new FCTypeEdit(this);
+ if (te->exec() == QDialog::Accepted )
+ {
+ /*QListViewItem *it =*/(void) new QListViewItem(fc_view->currentItem(),
+ te->typeext_edit->text(),
+ te->typename_edit->text(),
+ te->icon_url->icon(),
+ te->typedescr_edit->text(),
+ te->template_url->url().isEmpty() ? QString("create") : te->template_url->url());
+ fc_view->currentItem()->setOpen(true);
+ }
+ delete te;
+ }
+}
+
+void FCConfigWidget::remove_button_clicked()
+{
+ if (fc_view->currentItem())
+ {
+ QListViewItem *it = fc_view->currentItem();
+ if (it->itemBelow())
+ {
+ fc_view->setSelected(it->itemBelow(), true);
+ fc_view->setCurrentItem(it->itemBelow());
+ }
+ else if (it->itemAbove())
+ {
+ fc_view->setSelected(it->itemAbove(), true);
+ fc_view->setCurrentItem(it->itemAbove());
+ }
+ delete it;
+ }
+}
+
+
+void FCConfigWidget::moveup_button_clicked()
+{
+ QListViewItem *i = fc_view->currentItem();
+ if ( !i )
+ return;
+
+ QListViewItemIterator it( i );
+ QListViewItem *parent = i->parent();
+ --it;
+ while ( it.current() ) {
+ if ( it.current()->parent() == parent )
+ break;
+ --it;
+ }
+
+ if ( !it.current() )
+ return;
+ QListViewItem *other = it.current();
+
+ other->moveItem( i );
+}
+
+
+void FCConfigWidget::movedown_button_clicked()
+{
+ QListViewItem *i = fc_view->currentItem();
+ if ( !i )
+ return;
+
+ QListViewItemIterator it( i );
+ QListViewItem *parent = i->parent();
+ it++;
+ while ( it.current() ) {
+ if ( it.current()->parent() == parent )
+ break;
+ it++;
+ }
+
+ if ( !it.current() )
+ return;
+ QListViewItem *other = it.current();
+
+ i->moveItem( other );
+}
+
+
+void FCConfigWidget::edittype_button_clicked()
+{
+ QListViewItem *it = fc_view->currentItem();
+ if ( it )
+ {
+ FCTypeEdit *te = new FCTypeEdit(this);
+
+ te->typeext_edit->setText(it->text(0));
+ te->typename_edit->setText(it->text(1));
+ te->icon_url->setIcon(it->text(2));
+ te->typedescr_edit->setText(it->text(3));
+ if (it->text(4) != "create")
+ te->template_url->setURL(it->text(4));
+
+ if (te->exec() == QDialog::Accepted )
+ {
+ it->setText(0, te->typeext_edit->text());
+ it->setText(1, te->typename_edit->text());
+ it->setText(2, te->icon_url->icon());
+ it->setText(3, te->typedescr_edit->text());
+ if ((te->template_url->url() == "") && ((it->text(4) == "create")))
+ it->setText(4, "create");
+ else
+ it->setText(4, te->template_url->url());
+ }
+ }
+}
+
+
+void FCConfigWidget::newtemplate_button_clicked()
+{
+ FCTemplateEdit *te = new FCTemplateEdit;
+ if (te->exec() == QDialog::Accepted)
+ {
+ /*QListViewItem *it =*/(void) new QListViewItem(fctemplates_view, te->templatename_edit->text(),
+ te->template_url->url().isEmpty() ? QString("create") : te->template_url->url());
+ }
+}
+
+
+void FCConfigWidget::edittemplate_button_clicked()
+{
+ QListViewItem *it;
+ if ( (it = fctemplates_view->currentItem()) )
+ {
+ FCTemplateEdit *te = new FCTemplateEdit;
+ te->templatename_edit->setText(it->text(0));
+ te->templatename_edit->setEnabled(false);
+ if (te->exec() == QDialog::Accepted)
+ {
+ if ((te->template_url->url() == "") && ((it->text(1) == "create")))
+ it->setText(1, "create");
+ else
+ it->setText(1, te->template_url->url());
+ }
+ }
+}
+
+void FCConfigWidget::edit_template_content_button_clicked( )
+{
+ if (fctemplates_view->currentItem())
+ {
+ QFileInfo fi(m_part->project()->projectDirectory() + "/templates/" + fctemplates_view->currentItem()->text(0));
+ KURL content;
+ content.setPath(m_part->project()->projectDirectory() + "/templates/" + fctemplates_view->currentItem()->text(0));
+ if (fi.exists())
+ m_part->partController()->editDocument(content);
+ else
+ {
+ KMessageBox::information(this, i18n("Requested template does not exist yet.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit template content warning");
+ fctemplates_view->currentItem()->setPixmap(0, SmallIcon("edit"));
+ urlsToEdit.append(content);
+ }
+ }
+}
+
+void FCConfigWidget::edit_type_content_button_clicked( )
+{
+ if (!fc_view->currentItem())
+ return;
+ QListViewItem *it = fc_view->currentItem();
+ QString type_name = it->text(0);
+ if (it->parent())
+ type_name.prepend(it->parent()->text(0) + "-");
+ if (!m_global)
+ {
+ QString typePath = m_part->project()->projectDirectory() + "/templates/" + type_name;
+ KURL content;
+ content.setPath(typePath);
+ if (it->text(4).isEmpty())
+ m_part->partController()->editDocument(content);
+ else
+ {
+ if (it->text(4) == "create")
+ KMessageBox::information(this, i18n("Template for the selected file type does not exist yet.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit type template content warning");
+ else
+ KMessageBox::information(this, i18n("Template for the selected file type has been changed.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit type template content warning");
+ fc_view->currentItem()->setPixmap(0, SmallIcon("edit"));
+ urlsToEdit.append(content);
+ }
+ }
+ else
+ {
+ QString dest = KGlobal::dirs()->saveLocation("data", "/kdevfilecreate/file-templates/", true);
+ QString typePath = dest + type_name;
+ KURL content;
+ content.setPath(typePath);
+ if (it->text(4).isEmpty())
+ {
+ QFileInfo fi(dest+type_name);
+ if (!fi.exists())
+ copyTemplate(locate("data", "kdevfilecreate/file-templates/" + type_name), dest, type_name);
+ m_part->partController()->editDocument(content);
+ }
+ else
+ {
+ if (it->text(4) == "create")
+ KMessageBox::information(this, i18n("Template for the selected file type does not exist yet.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit global type template content warning");
+ else
+ KMessageBox::information(this, i18n("Template for the selected file type has been changed.\nIt will be opened immediately after accepting the configuration dialog."), QString::null, "Edit global type template content warning");
+ fc_view->currentItem()->setPixmap(0, SmallIcon("edit"));
+ urlsToEdit.append(content);
+ }
+ }
+}
+
+#include "fcconfigwidget.moc"
diff --git a/parts/filecreate/fcconfigwidget.h b/parts/filecreate/fcconfigwidget.h
new file mode 100644
index 00000000..52acd29c
--- /dev/null
+++ b/parts/filecreate/fcconfigwidget.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef FCCONFIGWIDGET_H
+#define FCCONFIGWIDGET_H
+
+#include <qwidget.h>
+#include <qvaluelist.h>
+#include <kurl.h>
+
+#include "fcconfigwidgetbase.h"
+
+class FileCreatePart;
+class QListView;
+class QDomDocument;
+class QDomElement;
+
+namespace FileCreate{
+class FileType;
+}
+
+class FCConfigWidget : public FCConfigWidgetBase
+{
+Q_OBJECT
+public:
+ FCConfigWidget(FileCreatePart * part, bool global, QWidget *parent, const char *name);
+
+ ~FCConfigWidget();
+
+public slots:
+ void accept();
+ void removetemplate_button_clicked();
+ void copyToProject_button_clicked();
+ void newtype_button_clicked();
+ void newsubtype_button_clicked();
+ void remove_button_clicked();
+ void moveup_button_clicked();
+ void movedown_button_clicked();
+ void edittype_button_clicked();
+ void newtemplate_button_clicked();
+ void edittemplate_button_clicked();
+ void edit_template_content_button_clicked();
+ void edit_type_content_button_clicked();
+
+protected:
+ void loadGlobalConfig(QListView *view, bool checkmarks = false);
+ void loadProjectConfig(QListView *view);
+ void loadProjectTemplates(QListView *view);
+ void saveGlobalConfig();
+ void saveProjectConfig();
+ void loadFileTypes(QPtrList<FileCreate::FileType> list, QListView *view, bool checkmarks = false);
+ void copyTemplate(QString templateUrl, QString dest, QString destName);
+ void saveConfiguration(QDomDocument &dom, QDomElement &element, bool global);
+
+private:
+ FileCreatePart * m_part;
+ QPtrList<FileCreate::FileType> m_globalfiletypes;
+ QPtrList<FileCreate::FileType> m_projectfiletypes;
+ QPtrList<FileCreate::FileType> m_projectfiletemplates;
+ bool m_global;
+
+ QValueList<KURL> urlsToEdit;
+};
+
+#endif
diff --git a/parts/filecreate/fcconfigwidgetbase.ui b/parts/filecreate/fcconfigwidgetbase.ui
new file mode 100644
index 00000000..72f62260
--- /dev/null
+++ b/parts/filecreate/fcconfigwidgetbase.ui
@@ -0,0 +1,540 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>FCConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>FCConfigWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>505</width>
+ <height>388</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>New File Wizard Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>fc_tabs</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab1</cstring>
+ </property>
+ <attribute name="title">
+ <string>Pro&amp;ject Types</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>remove_button</cstring>
+ </property>
+ <property name="text">
+ <string>Re&amp;move Type</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>edittype_button</cstring>
+ </property>
+ <property name="text">
+ <string>Edit T&amp;ype...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>newsubtype_button</cstring>
+ </property>
+ <property name="text">
+ <string>New &amp;Subtype...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="0" column="1">
+ <property name="name">
+ <cstring>newtype_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New Type...</string>
+ </property>
+ </widget>
+ <widget class="QListView" row="0" column="0" rowspan="11" colspan="1">
+ <column>
+ <property name="text">
+ <string>Type Extension</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Icon</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>fc_view</cstring>
+ </property>
+ <property name="resizePolicy">
+ <enum>Manual</enum>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <spacer row="9" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="7" column="1">
+ <property name="name">
+ <cstring>moveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="8" column="1">
+ <property name="name">
+ <cstring>movedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer row="6" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer1_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>edit_type_content_button</cstring>
+ </property>
+ <property name="text">
+ <string>Ed&amp;it Template</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab2</cstring>
+ </property>
+ <attribute name="title">
+ <string>Used &amp;Global Types</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="0" column="0" rowspan="1" colspan="2">
+ <column>
+ <property name="text">
+ <string>Type Extension</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Type Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Icon</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Description</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>fcglobal_view</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>330</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>copyToProject_button</cstring>
+ </property>
+ <property name="text">
+ <string>Copy to Pro&amp;ject Types</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab3</cstring>
+ </property>
+ <attribute name="title">
+ <string>Proje&amp;ct Templates</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListView" row="1" column="0" rowspan="6" colspan="1">
+ <column>
+ <property name="text">
+ <string>Template Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>fctemplates_view</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>edittemplate_button</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;hange Content...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="1" column="1">
+ <property name="name">
+ <cstring>newtemplate_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;New Template...</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>templatesDir_label</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="3" column="1">
+ <property name="name">
+ <cstring>removetemplate_button</cstring>
+ </property>
+ <property name="text">
+ <string>Re&amp;move Template</string>
+ </property>
+ </widget>
+ <spacer row="6" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>150</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton" row="5" column="1">
+ <property name="name">
+ <cstring>edit_template_content_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Template</string>
+ </property>
+ </widget>
+ <spacer row="4" column="1">
+ <property name="name">
+ <cstring>spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>newtype_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>newtype_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>newsubtype_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>newsubtype_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>remove_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>remove_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>moveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>moveup_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>movedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>movedown_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edittype_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edittype_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>newtemplate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>newtemplate_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edittemplate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edittemplate_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>removetemplate_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>removetemplate_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>copyToProject_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>copyToProject_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edit_template_content_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edit_template_content_button_clicked()</slot>
+ </connection>
+ <connection>
+ <sender>edit_type_content_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCConfigWidgetBase</receiver>
+ <slot>edit_type_content_button_clicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>fc_view</tabstop>
+ <tabstop>newtype_button</tabstop>
+ <tabstop>newsubtype_button</tabstop>
+ <tabstop>edittype_button</tabstop>
+ <tabstop>remove_button</tabstop>
+ <tabstop>edit_type_content_button</tabstop>
+ <tabstop>moveup_button</tabstop>
+ <tabstop>movedown_button</tabstop>
+ <tabstop>fc_tabs</tabstop>
+ <tabstop>fcglobal_view</tabstop>
+ <tabstop>copyToProject_button</tabstop>
+ <tabstop>fctemplates_view</tabstop>
+ <tabstop>newtemplate_button</tabstop>
+ <tabstop>edittemplate_button</tabstop>
+ <tabstop>removetemplate_button</tabstop>
+ <tabstop>edit_template_content_button</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">addglobaldlg.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<forwards>
+ <forward>class AddGlobalDlg;</forward>
+</forwards>
+<variables>
+ <variable>AddGlobalDlg *global_dlg;</variable>
+</variables>
+<slots>
+ <slot>removetemplate_button_clicked()</slot>
+ <slot>copyToProject_button_clicked()</slot>
+ <slot>newtype_button_clicked()</slot>
+ <slot>newsubtype_button_clicked()</slot>
+ <slot>remove_button_clicked()</slot>
+ <slot>moveup_button_clicked()</slot>
+ <slot>movedown_button_clicked()</slot>
+ <slot>edittype_button_clicked()</slot>
+ <slot>newtemplate_button_clicked()</slot>
+ <slot>edittemplate_button_clicked()</slot>
+ <slot>edit_template_contents_button_clicked()</slot>
+ <slot>edit_template_content_button_clicked()</slot>
+ <slot>edit_type_content_button_clicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/filecreate/fctemplateedit.cpp b/parts/filecreate/fctemplateedit.cpp
new file mode 100644
index 00000000..fc495fd5
--- /dev/null
+++ b/parts/filecreate/fctemplateedit.cpp
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#include <klineedit.h>
+#include "fctemplateedit.h"
+#include <qpushbutton.h>
+
+FCTemplateEdit::FCTemplateEdit(QWidget *parent, const char *name):
+ FCTemplateEditBase(parent, name)
+{
+ connect( templatename_edit, SIGNAL(textChanged ( const QString & )),
+ this, SLOT( slotTemplateNameChanged( )));
+ slotTemplateNameChanged();
+}
+
+FCTemplateEdit::~FCTemplateEdit()
+{
+}
+
+void FCTemplateEdit::slotTemplateNameChanged( )
+{
+ ok_button->setEnabled( !templatename_edit->text().isEmpty() );
+}
+
+void FCTemplateEdit::accept()
+{
+ if ( !templatename_edit->text().isEmpty() )
+ FCTemplateEditBase::accept();
+}
+#include "fctemplateedit.moc"
diff --git a/parts/filecreate/fctemplateedit.h b/parts/filecreate/fctemplateedit.h
new file mode 100644
index 00000000..0209c3b0
--- /dev/null
+++ b/parts/filecreate/fctemplateedit.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef FCTEMPLATEEDIT_H
+#define FCTEMPLATEEDIT_H
+
+#include <qwidget.h>
+#include "fctemplateeditbase.h"
+
+class FCTemplateEdit : public FCTemplateEditBase
+{
+Q_OBJECT
+public:
+ FCTemplateEdit(QWidget *parent=0, const char *name=0);
+
+ ~FCTemplateEdit();
+
+protected slots:
+ virtual void accept();
+ void slotTemplateNameChanged( );
+};
+
+#endif
diff --git a/parts/filecreate/fctemplateeditbase.ui b/parts/filecreate/fctemplateeditbase.ui
new file mode 100644
index 00000000..976bff33
--- /dev/null
+++ b/parts/filecreate/fctemplateeditbase.ui
@@ -0,0 +1,193 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FCTemplateEditBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FCTemplateEditBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>467</width>
+ <height>149</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File Template</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Template &amp;name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>templatename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>templatename_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Set template content from &amp;file:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>template_url</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>template_url</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ok_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancel_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>ok_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTemplateEditBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancel_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTemplateEditBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>templatename_edit</tabstop>
+ <tabstop>template_url</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="local" impldecl="in implementation">fctemplateeditbase.ui.h</include>
+</includes>
+<slots>
+ <slot>init()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/filecreate/fctemplateeditbase.ui.h b/parts/filecreate/fctemplateeditbase.ui.h
new file mode 100644
index 00000000..6f2b9223
--- /dev/null
+++ b/parts/filecreate/fctemplateeditbase.ui.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+#include <qvalidator.h>
+#include <qregexp.h>
+
+void FCTemplateEditBase::init()
+{
+ templatename_edit->setValidator(new QRegExpValidator(QRegExp("^\\S*$"), this));
+}
diff --git a/parts/filecreate/fctypeedit.cpp b/parts/filecreate/fctypeedit.cpp
new file mode 100644
index 00000000..310453ea
--- /dev/null
+++ b/parts/filecreate/fctypeedit.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <klineedit.h>
+#include <qpushbutton.h>
+#include "fctypeedit.h"
+
+
+FCTypeEdit::FCTypeEdit(QWidget *parent, char *name)
+ : FCTypeEditBase(parent, name)
+{
+ connect( typeext_edit, SIGNAL( textChanged ( const QString & )),this, SLOT( slotTypeEditTextChanged()));
+ connect( typename_edit, SIGNAL( textChanged ( const QString & )),this, SLOT( slotTypeEditTextChanged( )));
+ slotTypeEditTextChanged( );
+}
+
+FCTypeEdit::~FCTypeEdit()
+{
+}
+
+void FCTypeEdit::slotTypeEditTextChanged( )
+{
+ ok_button->setEnabled( !typeext_edit->text().isEmpty() &&
+ !typename_edit->text().isEmpty());
+}
+
+void FCTypeEdit::accept()
+{
+ if ( !typeext_edit->text().isEmpty() &&
+ !typename_edit->text().isEmpty() )
+ FCTypeEditBase::accept();
+}
+#include "fctypeedit.moc"
diff --git a/parts/filecreate/fctypeedit.h b/parts/filecreate/fctypeedit.h
new file mode 100644
index 00000000..92c34e3f
--- /dev/null
+++ b/parts/filecreate/fctypeedit.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef FCTYPEEDIT_H
+#define FCTYPEEDIT_H
+
+
+#include "fctypeeditbase.h"
+
+class FCTypeEdit : public FCTypeEditBase
+{
+Q_OBJECT
+public:
+ FCTypeEdit(QWidget *parent = 0, char *name = 0);
+
+ ~FCTypeEdit();
+
+protected slots:
+ virtual void accept();
+ void slotTypeEditTextChanged( );
+};
+
+#endif
diff --git a/parts/filecreate/fctypeeditbase.ui b/parts/filecreate/fctypeeditbase.ui
new file mode 100644
index 00000000..8bc06f87
--- /dev/null
+++ b/parts/filecreate/fctypeeditbase.ui
@@ -0,0 +1,282 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FCTypeEditBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FCTypeEditBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>476</width>
+ <height>194</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File Type</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Type &amp;extension:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typename_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>typeext_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Type &amp;name:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typedescr_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>typename_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>layout3_2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="text">
+ <string>Type &amp;description:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typedescr_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>typedescr_edit</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="KIconButton" row="0" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>icon_url</cstring>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>80</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Set template content from &amp;file:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignBottom</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>template_url</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>template_url</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>26</height>
+ </size>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>ok_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancel_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>ok_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTypeEditBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancel_button</sender>
+ <signal>clicked()</signal>
+ <receiver>FCTypeEditBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>typeext_edit</tabstop>
+ <tabstop>typename_edit</tabstop>
+ <tabstop>typedescr_edit</tabstop>
+ <tabstop>icon_url</tabstop>
+ <tabstop>template_url</tabstop>
+ <tabstop>ok_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">kicondialog.h</include>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="local" impldecl="in implementation">fctypeeditbase.ui.h</include>
+</includes>
+<slots>
+ <slot>init()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kicondialog.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/filecreate/fctypeeditbase.ui.h b/parts/filecreate/fctypeeditbase.ui.h
new file mode 100644
index 00000000..e65a2ba7
--- /dev/null
+++ b/parts/filecreate/fctypeeditbase.ui.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Alexander Dymo *
+ * cloudtemple@mksat.net *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+#include <qvalidator.h>
+#include <qregexp.h>
+
+void FCTypeEditBase::init()
+{
+ typeext_edit->setValidator(new QRegExpValidator(QRegExp("^\\S*$"), this));
+}
diff --git a/parts/filecreate/file-templates/Makefile.am b/parts/filecreate/file-templates/Makefile.am
new file mode 100644
index 00000000..672a1cfa
--- /dev/null
+++ b/parts/filecreate/file-templates/Makefile.am
@@ -0,0 +1,2 @@
+rcdir = $(kde_datadir)/kdevfilecreate/file-templates
+rc_DATA = ui ui-dialog ui-mainwin ui-confdialog ui-dialogb ui-widget ui-dialogr ui-tabdialog ui-wizard dox ts ui-mainwin-qt4 ui-widget-qt4 ui-dialogb-qt4 ui-dialogr-qt4 ui-dialog-qt4 qrc
diff --git a/parts/filecreate/file-templates/dox b/parts/filecreate/file-templates/dox
new file mode 100644
index 00000000..fda0e141
--- /dev/null
+++ b/parts/filecreate/file-templates/dox
@@ -0,0 +1,22 @@
+/** \file $MODULE$.dox
+ * \brief put an explanation here
+ */
+
+/** \page $MODULE$ put the page title here
+
+\section put_sectionLabelName_here put section name here
+
+Here comes the text <code>this is code</code>, the text is continued.
+
+ - This is a item list
+ - This is the second item!
+ .
+
+Here comes the text <code>this is code</code>, the text is continued.
+
+\subsection put_subSectionLabelName_here put subsection name here
+
+Subsection text.
+
+*/
+
diff --git a/parts/filecreate/file-templates/qrc b/parts/filecreate/file-templates/qrc
new file mode 100644
index 00000000..4a4d7e46
--- /dev/null
+++ b/parts/filecreate/file-templates/qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/" >
+ <file></file>
+ </qresource>
+</RCC>
diff --git a/parts/filecreate/file-templates/ts b/parts/filecreate/file-templates/ts
new file mode 100644
index 00000000..4eb9e187
--- /dev/null
+++ b/parts/filecreate/file-templates/ts
@@ -0,0 +1,2 @@
+<!DOCTYPE TS><TS>
+</TS>
diff --git a/parts/filecreate/file-templates/ui b/parts/filecreate/file-templates/ui
new file mode 100644
index 00000000..858b4678
--- /dev/null
+++ b/parts/filecreate/file-templates/ui
@@ -0,0 +1,20 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-confdialog b/parts/filecreate/file-templates/ui-confdialog
new file mode 100644
index 00000000..975ba4d4
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-confdialog
@@ -0,0 +1,165 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>597</width>
+ <height>364</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QListBox" row="0" column="0">
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>listBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QTabWidget" row="0" column="1">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget2</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget3</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialog b/parts/filecreate/file-templates/ui-dialog
new file mode 100644
index 00000000..fc2aefce
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialog
@@ -0,0 +1,20 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialog-qt4 b/parts/filecreate/file-templates/ui-dialog-qt4
new file mode 100644
index 00000000..d35cb285
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialog-qt4
@@ -0,0 +1,22 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-dialogb b/parts/filecreate/file-templates/ui-dialogb
new file mode 100644
index 00000000..7ccbfb94
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogb
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>511</width>
+ <height>282</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>240</y>
+ <width>476</width>
+ <height>33</height>
+ </rect>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialogb-qt4 b/parts/filecreate/file-templates/ui-dialogb-qt4
new file mode 100644
index 00000000..2413393e
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogb-qt4
@@ -0,0 +1,100 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>20</x>
+ <y>250</y>
+ <width>351</width>
+ <height>33</height>
+ </rect>
+ </property>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>131</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>278</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>96</x>
+ <y>254</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>369</x>
+ <y>253</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>179</x>
+ <y>282</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-dialogr b/parts/filecreate/file-templates/ui-dialogr
new file mode 100644
index 00000000..8cf208ec
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogr
@@ -0,0 +1,123 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>592</width>
+ <height>470</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout5</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>500</x>
+ <y>30</y>
+ <width>82</width>
+ <height>410</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-dialogr-qt4 b/parts/filecreate/file-templates/ui-dialogr-qt4
new file mode 100644
index 00000000..57d81913
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-dialogr-qt4
@@ -0,0 +1,100 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>300</x>
+ <y>20</y>
+ <width>77</width>
+ <height>106</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>351</x>
+ <y>38</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>233</x>
+ <y>29</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>330</x>
+ <y>66</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>197</x>
+ <y>125</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-mainwin b/parts/filecreate/file-templates/ui-mainwin
new file mode 100644
index 00000000..854da009
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-mainwin
@@ -0,0 +1,436 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QMainWindow">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<menubar>
+ <property name="name">
+ <cstring>menubar</cstring>
+ </property>
+ <item text="&amp;File" name="fileMenu">
+ <action name="fileNewAction"/>
+ <action name="fileOpenAction"/>
+ <action name="fileSaveAction"/>
+ <action name="fileSaveAsAction"/>
+ <separator/>
+ <action name="filePrintAction"/>
+ <separator/>
+ <action name="fileExitAction"/>
+ </item>
+ <item text="&amp;Edit" name="editMenu">
+ <action name="editUndoAction"/>
+ <action name="editRedoAction"/>
+ <separator/>
+ <action name="editCutAction"/>
+ <action name="editCopyAction"/>
+ <action name="editPasteAction"/>
+ <separator/>
+ <action name="editFindAction"/>
+ </item>
+ <item text="&amp;Help" name="helpMenu">
+ <action name="helpContentsAction"/>
+ <action name="helpIndexAction"/>
+ <separator/>
+ <action name="helpAboutAction"/>
+ </item>
+</menubar>
+<toolbars>
+</toolbars>
+<actions>
+ <action>
+ <property name="name">
+ <cstring>fileNewAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image0</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;New</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+N</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileOpenAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image1</iconset>
+ </property>
+ <property name="text">
+ <string>Open</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Open...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+O</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image2</iconset>
+ </property>
+ <property name="text">
+ <string>Save</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Save</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+S</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileSaveAsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Save As</string>
+ </property>
+ <property name="menuText">
+ <string>Save &amp;As...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>filePrintAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image3</iconset>
+ </property>
+ <property name="text">
+ <string>Print</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Print...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+P</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="menuText">
+ <string>E&amp;xit</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editUndoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image4</iconset>
+ </property>
+ <property name="text">
+ <string>Undo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Undo</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+Z</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editRedoAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image5</iconset>
+ </property>
+ <property name="text">
+ <string>Redo</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Redo</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+Y</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCutAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image6</iconset>
+ </property>
+ <property name="text">
+ <string>Cut</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Cut</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+X</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editCopyAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image7</iconset>
+ </property>
+ <property name="text">
+ <string>Copy</string>
+ </property>
+ <property name="menuText">
+ <string>C&amp;opy</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+C</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editPasteAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image8</iconset>
+ </property>
+ <property name="text">
+ <string>Paste</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Paste</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+V</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>editFindAction</cstring>
+ </property>
+ <property name="iconSet">
+ <iconset>image9</iconset>
+ </property>
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Find...</string>
+ </property>
+ <property name="accel">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpContentsAction</cstring>
+ </property>
+ <property name="text">
+ <string>Contents</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Contents...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpIndexAction</cstring>
+ </property>
+ <property name="text">
+ <string>Index</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;Index...</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+ <action>
+ <property name="name">
+ <cstring>helpAboutAction</cstring>
+ </property>
+ <property name="text">
+ <string>About</string>
+ </property>
+ <property name="menuText">
+ <string>&amp;About</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ </action>
+</actions>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="721">789cedd2b10ac2301405d03d5ff148b62056035241fc04c5511087f425a2432b681d44fc777ba329d6b47fe07d19dee50cc9904cd376b3229d896b6deb13131fed85b4bb95e57db75f3e8434869a93d3548e841c13d3fa5c79ecaad9d52404b540351e83caa833c6a03ad4798e41f5a86c30a816f510126ee94d14d52611fb8e2ad49070a4445ca4447ca4446ca444da07fecac7ffd2956ebe64f81ff4c873215e0583a9b0</data>
+ </image>
+ <image name="image1">
+ <data format="XPM.GZ" length="691">789cad914d0ac2301085f739c5d0d915b11a140ae211149782b898448b2e5a41eb42c4bb9b9fa6a67644045f0299978f37134896c27ab5803413979aeaa3067da033a4bb6b59de36dbf95d245282d953182703910c41c3f254ed6d8da6c69193b5dada7c924b6fc9dac2c85b156c51b83eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31134fa13797a8</data>
+ </image>
+ <image name="image2">
+ <data format="XPM.GZ" length="691">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b13082709340dc644310047193c1dcc424d314883958015846190b80ca24262a2721012087349964a030ba69c9c9303d403e9132087b68279388ecff4414193440948c32aa71d86470bb80863258a21b9a0eb0a7905a6b2e006d59a436</data>
+ </image>
+ <image name="image3">
+ <data format="XPM.GZ" length="2509">789c7d944973db461085effa152cf54d956a932089a55239c896572d96bcc4b253390033186ea2488aa416a7f2dfd3db0cbd44e6d340f8f8def43406209e1c742ecf4f3b074ff6d69b7a33711d37ae6f3a077e3b9f3ffcf5f71fffeced675987fecab293edffb6b77fb1e9b8ced9e2ba65c08c00baf2117e2f5c86d02d99e196b9d7ed963df53f2ab3c47789258fa7c26564688d4bf30f23673de113e6ac1719ae9459e27f4d5c893f17ae126f8d2be3ebc87d9dff4e3904f317ccfd5ef23f28b3c45f26963c7e510ec1fc9570157dd81857967f883c90cd8635f3208b8c0b6596f863e17a500fd597fe8744c35afc1be33aef8bff5ad9b5e637cc7993f7f346fca571637c1fb9d0f99f9543b07ab2df453ff9723d0551a1f3d791cb8170573904f3a5bf725034e66f133be96fa44c1246799e4a573495e461a29cfcbbc8e64f8d9df96564f5519e876a1019668975fda05c593d5c25d67a6f945d6ef3bdb08b3ed491eba1e467c6561fcf229bff4ad9b5c6c7ccf530fa8089bdf8136596703fb1f800c23ee5ff548e3e7a636f3c8ddc68bd8ab91926066596b05c5fe359c285b2cf8de5f7ed7296f050b825d6f74763dc1a0f227bcdbf60f679e29789353f5666093f4facfe857208e63f156e93df8bdc16c223e358ff28b2f939735b240eca2ce1678983f0a57208e6bf150ec96f8d83f127e650b084cf85e5a32fdf9d10b0c6c6e44835c9631dfd9ff235b618925ad1e89779278af5750df7681ea40316d8111eef876a79ad977ae773d8257ec8efead629fdeb3ca4ba9ae6e11fcdbbef6aa72b7934ef695702eddf4e631a13d2f4c73cd599e115f533a639bbc173e6788d0b5cf23a314fe915dee01a37df698bb77887f7f8805ff190e64c342fb59fe2333ca2e373d30b7c89aff035bec1634a9e904ef1417faf78866ff1fc275de03b7c4fa3a1553e50fd8f78a2ef0bfcf43fe973bcc4cff805bb74d6a3de0e31b37c9f561fe090c6583a19612e9d1dd179417db1575237191eeafb172b9cd22a7d409a7bcc8f0c4e68f01900ef44090db8547f4ee9a966456732445083078f779a8756dfdf52f19b1cd59c699254e31c46d0703f30b6fa5239a5d27faabc22b78409de838316bdd51fd1377730a531a12bd363c949aa3d936f1a6821e8fda566aef8fe011d612eba860569495a9196721ebe7d7ed0c30dac491b58d2bd21c116b634bf25ddd2fd9dd9f3f6efef7bff0111915e41</data>
+ </image>
+ <image name="image4">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b13103711c4b530b1308270f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020011bc73cc</data>
+ </image>
+ <image name="image5">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b13105719c4b530b1308270f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700f7fd8672</data>
+ </image>
+ <image name="image6">
+ <data format="XPM.GZ" length="661">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53002abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fbd07ccb</data>
+ </image>
+ <image name="image7">
+ <data format="XPM.GZ" length="706">789c9d92cb0ac2301045f7f98aa1d915b1da8214c44f505c0ae26226b1e8a20a5a1722febb9924a5af58c19b40e77238a1842431ecb66b881371afb03a2b5027bc41ac1f65f9dc1f562f11a52998bd80793411d114146cae9723cfd2cc7266c395ea9aa75c15d74c65aad05c35d79c727215b91636f6d860c689f40910b4e92147d840b3be39d8416d877c860eb9af478d23919c4b8a7a0ed68eb628e4a04521c7fd46c07138e47448dbf1f32fc767e8d43735741af287d3ced83b782fc5075b18a5a5</data>
+ </image>
+ <image name="image8">
+ <data format="XPM.GZ" length="736">789c7d92d10a82301486eff714c3dd49649984103d42d165105dcce3465d58507611d1bbb773d674aed93f85fd7efb183ab394ef771b9e66ecdecaf60c1c4ef2c6d3fad134cfc371fd62499e7373957c9e4c5832e5c0b7d78bc2b9307331a36055ae960556c05a16656e69e5aaa5355658c202965825566d62176b57b5a64da3f188c084841e0a29a5e831910ef8885e4854501922e8a6b923586a176a8e40051ec1e63b7d0267387c6738424775091d653f98565a858e26c110447107d1886350d4a1c41c3dea7864e87c37f3ce47fc3aee7cd5207ffe90f78a7d0007c6c175</data>
+ </image>
+ <image name="image9">
+ <data format="XPM.GZ" length="2798">789cb5d5594f1b491007f0773e8545bda1d53ff81a7bb4da07830103b603b92059edc34cf78c0ff0812f3051befb5677554f56c24428d2aa78e0a7aeaeea6be0dd41e9f6aa573a78b7b75c25ab91299961b2281dd8f564b2fdfb9fbfbeefed572a25fe291f46a5cafe1f7bfbd7ab9229f567d3cc81fa0caa945d785f78c72ebc2f9dabb10bef9e73ade2c21913e77ae2c28f2fc48d6a947ab7c4b169d6bc8f9ca3aa0b3fbfaf4e35ff4c5cccdf8813db34de1def34e4c3881b3cc38fb7d5a918f78525ff46dcaca9576a23a627715cd3f53e8a131b7b63edecba69fd8d3af41b1496fa6d7153f78f86b8a86f0bcbfe9ec5493d16cfc5695dfad34c6d651ca9f7cffdbd173743fd441cd64f0f85a5fe489c6a3fd4d5613c0d4eeade43b189747c1b2ce3683abbeebadf5a702ae343716c743d53313f1febc7bfa843bf1371581f9d06ebf8581df257e2b01eba57675a5fea19177e7c109cfa712271aceba58938b13a6ec4a13fba62ee27f53fa9b51fe5c1ba7f7f1f71cd85f7545cdcf73ad8f8ef137762de9fd4ef898b7e51b0d63f52877e65b10de3c785657eacced4fe7b77b763236fab36fa3e1ec5a9d5f341b0e4d3526c42bd4ab0eee7505cf4fb28ce1aea6fc146fa7f76e6d3e115fafa5d7112cebf254eeb328e6a70967b9f8b437fba13db4ceb2fc5453f7f5ffcfac2795f046bbd0fe2a2df486c42bd2bb18dd46375e89f89b99fccf7ef2dadbbf0eea8add6bf16db4cbd1067b9de8fafc7b7a1ef13cf6213e50defadd846b9acff569c3574fe833ad7fa5fc57943cfdb9f9f894cd8cf93982748fdb9386f64dee4df97c978ff52ef4c9d69ff9938cff53cfdf7ec5627f5ae576f8fdfcf0721410ac391c222fb753e720c30c408638e3bdcf31c7a3d9fb3279862c631c70316586285f5ae1e727fd8e091f3e678c216cf68e108c768e3e4957ccb2b39e5fc337470ce71814b74d143ffe59ae4ff01ae7825d7f8c0753fe213d7ff8c2ffcfb0deccefc016ef115df380e51460555d4504784069aafe48f798f87885126a04a4409a564c8be92bfc115655cb94c395a34409d8634a231afe7c58ee5ef35d7bae3dc2eddd384a634a339c7032d90efcce7bba225ad38525aa3461b7ae478da75037a5f2758d196525ec93359aedde23882a563ae95edc8cf90529b4ee894c6bcf2844f66e2ce1239cf9afc7755c5fbc9b8479fdabcc71b3aa38ee4d039d7b9a04b1ecb5ebe677ea1964712ead2f9cf8aac1ecfd10a6f79ffdc7b4d7dee92bcfd7be1bd5ff29ccedbbf2f90dbfbfffefdfef873ef5fce01d04a</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>fileNewAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileNew()</slot>
+ </connection>
+ <connection>
+ <sender>fileOpenAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileOpen()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileSave()</slot>
+ </connection>
+ <connection>
+ <sender>fileSaveAsAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileSaveAs()</slot>
+ </connection>
+ <connection>
+ <sender>filePrintAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>filePrint()</slot>
+ </connection>
+ <connection>
+ <sender>fileExitAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>fileExit()</slot>
+ </connection>
+ <connection>
+ <sender>editUndoAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editUndo()</slot>
+ </connection>
+ <connection>
+ <sender>editRedoAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editRedo()</slot>
+ </connection>
+ <connection>
+ <sender>editCutAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editCut()</slot>
+ </connection>
+ <connection>
+ <sender>editCopyAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editCopy()</slot>
+ </connection>
+ <connection>
+ <sender>editPasteAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editPaste()</slot>
+ </connection>
+ <connection>
+ <sender>editFindAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>editFind()</slot>
+ </connection>
+ <connection>
+ <sender>helpIndexAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpIndex()</slot>
+ </connection>
+ <connection>
+ <sender>helpContentsAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpContents()</slot>
+ </connection>
+ <connection>
+ <sender>helpAboutAction</sender>
+ <signal>activated()</signal>
+ <receiver>Form1</receiver>
+ <slot>helpAbout()</slot>
+ </connection>
+</connections>
+<slots>
+ <slot>fileNew()</slot>
+ <slot>fileOpen()</slot>
+ <slot>fileSave()</slot>
+ <slot>fileSaveAs()</slot>
+ <slot>filePrint()</slot>
+ <slot>fileExit()</slot>
+ <slot>editUndo()</slot>
+ <slot>editRedo()</slot>
+ <slot>editCut()</slot>
+ <slot>editCopy()</slot>
+ <slot>editPaste()</slot>
+ <slot>editFind()</slot>
+ <slot>helpIndex()</slot>
+ <slot>helpContents()</slot>
+ <slot>helpAbout()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-mainwin-qt4 b/parts/filecreate/file-templates/ui-mainwin-qt4
new file mode 100644
index 00000000..814096cc
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-mainwin-qt4
@@ -0,0 +1,34 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" />
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>33</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-tabdialog b/parts/filecreate/file-templates/ui-tabdialog
new file mode 100644
index 00000000..a28ae7c7
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-tabdialog
@@ -0,0 +1,147 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyDialog1</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>MyDialog1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>528</width>
+ <height>368</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>MyDialog1</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget8</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>Widget9</cstring>
+ </property>
+ <attribute name="title">
+ <string>Tab</string>
+ </attribute>
+ </widget>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonHelp</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Help</string>
+ </property>
+ <property name="accel">
+ <string>F1</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>MyDialog1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-widget b/parts/filecreate/file-templates/ui-widget
new file mode 100644
index 00000000..858b4678
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-widget
@@ -0,0 +1,20 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/file-templates/ui-widget-qt4 b/parts/filecreate/file-templates/ui-widget-qt4
new file mode 100644
index 00000000..2aecd3c9
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-widget-qt4
@@ -0,0 +1,22 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>Form</class>
+ <widget class="QWidget" name="Form" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/parts/filecreate/file-templates/ui-wizard b/parts/filecreate/file-templates/ui-wizard
new file mode 100644
index 00000000..7c68689b
--- /dev/null
+++ b/parts/filecreate/file-templates/ui-wizard
@@ -0,0 +1,28 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>Form1</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>Form1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Form1</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>page</cstring>
+ </property>
+ <attribute name="title">
+ <string>Page</string>
+ </attribute>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filecreate/filecreate_filedialog.cpp b/parts/filecreate/filecreate_filedialog.cpp
new file mode 100644
index 00000000..81d711cf
--- /dev/null
+++ b/parts/filecreate/filecreate_filedialog.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "filecreate_filedialog.h"
+
+#include <qfileinfo.h>
+#include <kdeversion.h>
+#include <kurlcombobox.h>
+#include <kdebug.h>
+
+#include "filecreate_part.h"
+#include "filecreate_filetype.h"
+
+namespace FileCreate {
+
+ FileDialog::FileDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name,
+ bool modal, QWidget * extraWidget) :
+ KFileDialog(startDir, filter, parent, name, modal, extraWidget) {
+
+ setOperationMode(Saving);
+
+ m_extraWidget = extraWidget;
+ m_typeChooser = dynamic_cast<TypeChooser*>(extraWidget);
+
+ connect(this, SIGNAL(filterChanged(const QString &)), this, SLOT(slotActionFilterChanged(const QString &)) );
+ connect(locationEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotActionTextChanged(const QString &)) );
+
+ }
+
+ FileDialog::~FileDialog() { }
+
+
+ void FileDialog::initGUI()
+ {
+ KFileDialog::initGUI();
+ }
+
+ void FileDialog::slotActionFilterChanged(const QString & /*filter*/) {
+ }
+
+ void FileDialog::slotActionTextChanged(const QString & text) {
+ kdDebug(9034) << "slotActionTextChanged - " << text << endl;
+ if (!m_typeChooser) return;
+ QString ext = QFileInfo(text).extension();
+ kdDebug(9034) << "Extension is: " << ext << endl;
+ FileType * filetype = m_typeChooser->part()->getType(ext);
+ if (!filetype) return;
+ kdDebug(9034) << "found matching extension: " << ext << endl;
+ kdDebug(9034) << "Description: " << filetype->descr() << endl;
+ m_typeChooser->setCurrent(filetype);
+ }
+
+
+
+}
+
+#include "filecreate_filedialog.moc"
diff --git a/parts/filecreate/filecreate_filedialog.h b/parts/filecreate/filecreate_filedialog.h
new file mode 100644
index 00000000..04e40111
--- /dev/null
+++ b/parts/filecreate/filecreate_filedialog.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+
+#ifndef __KDEVPART_FILECREATE_FILEDIALOG_H__
+#define __KDEVPART_FILECREATE_FILEDIALOG_H__
+
+#include <kfiledialog.h>
+
+#include "filecreate_typechooser.h"
+
+namespace FileCreate {
+
+ class FileDialog : public KFileDialog {
+ Q_OBJECT
+
+ public:
+ FileDialog(const QString& startDir, const QString& filter,
+ QWidget *parent, const char *name,
+ bool modal, QWidget * extraWidget);
+ virtual ~FileDialog();
+
+ virtual void initGUI();
+
+ protected:
+ QWidget * m_extraWidget;
+ TypeChooser * m_typeChooser;
+
+ protected slots:
+ void slotActionFilterChanged(const QString & filter);
+ void slotActionTextChanged(const QString & text);
+
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_filetype.cpp b/parts/filecreate/filecreate_filetype.cpp
new file mode 100644
index 00000000..ca786565
--- /dev/null
+++ b/parts/filecreate/filecreate_filetype.cpp
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "filecreate_filetype.h"
+
+namespace FileCreate {
+
+void FileType::setSubtypesEnabled(bool enabled) {
+ for(FileType * subtype = m_subtypes.first();
+ subtype;subtype=m_subtypes.next())
+ subtype->setEnabled(enabled);
+}
+
+}
diff --git a/parts/filecreate/filecreate_filetype.h b/parts/filecreate/filecreate_filetype.h
new file mode 100644
index 00000000..9b8e039c
--- /dev/null
+++ b/parts/filecreate/filecreate_filetype.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_FILETYPE_H__
+#define __FILECREATE_FILETYPE_H__
+
+#include <qstring.h>
+#include <qptrlist.h>
+
+namespace FileCreate {
+
+class FileType {
+
+public:
+
+ FileType() : m_enabled(false) {
+ m_subtypes.setAutoDelete(true);
+ }
+
+ void setName(const QString & name) { m_name = name; }
+ QString name() const { return m_name; }
+ void setExt(const QString & ext) { m_ext = ext; }
+ QString ext() const { return m_ext; }
+ void setCreateMethod(const QString & createMethod) { m_createMethod = createMethod; }
+ QString createMethod() const { return m_createMethod; }
+ void setSubtypeRef(const QString & subtypeRef) { m_subtypeRef = subtypeRef; }
+ QString subtypeRef() const { return m_subtypeRef; }
+ void setIcon(const QString & iconName) { m_iconName = iconName; }
+ QString icon() const { return m_iconName; }
+ void setDescr(const QString & descr) { m_descr = descr; }
+ QString descr() const { return m_descr; }
+ void setEnabled(bool on) { m_enabled = on; }
+ bool enabled() const { return m_enabled; }
+
+ void setSubtypesEnabled(bool enabled = true);
+
+ void addSubtype(const FileType * subtype) { m_subtypes.append(subtype); }
+ QPtrList<FileType> subtypes() const { return m_subtypes; }
+
+private:
+ QString m_name;
+ QString m_ext;
+ QString m_createMethod;
+ QString m_subtypeRef;
+ QString m_iconName;
+ QString m_descr;
+
+ bool m_enabled;
+
+ QPtrList<FileType> m_subtypes;
+
+};
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_listitem.cpp b/parts/filecreate/filecreate_listitem.cpp
new file mode 100644
index 00000000..4b33514f
--- /dev/null
+++ b/parts/filecreate/filecreate_listitem.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * thanks: Roberto Raggi for QSimpleRichText stuff *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+#include "filecreate_listitem.h"
+
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#include <qsimplerichtext.h>
+#include <qpixmap.h>
+
+namespace FileCreate {
+
+ ListItem::ListItem(QListView * listview, const FileType * filetype) :
+ KListViewItem(listview), m_filetype(filetype),
+ m_filetypeRenderer(NULL)
+ {
+ init();
+ }
+
+
+ ListItem::ListItem(ListItem * listitem, const FileType * filetype) :
+ KListViewItem(listitem), m_filetype(filetype),
+ m_filetypeRenderer(NULL)
+ {
+ init();
+ }
+
+ ListItem::~ListItem()
+ {
+ if (m_filetypeRenderer) delete m_filetypeRenderer;
+ }
+
+ void ListItem::setup()
+ {
+ if (m_filetypeRenderer) delete m_filetypeRenderer;
+ m_filetypeRenderer = new QSimpleRichText( text(1), listView()->font() );
+ m_filetypeRenderer->setWidth(listView()->columnWidth(1));
+ setHeight(m_filetypeRenderer->height());
+ KListViewItem::setup();
+ }
+
+ void ListItem::setHeight( int height )
+ {
+ KListViewItem::setHeight( QMAX(QMAX(height,m_iconHeight), m_filetypeRenderer->height() ) );
+ }
+
+ void ListItem::prepareResize() {
+ if (m_filetypeRenderer) {
+ m_filetypeRenderer->setWidth(listView()->columnWidth(1));
+ setHeight(m_filetypeRenderer->height());
+ }
+ }
+
+ void ListItem::paintCell( QPainter* p, const QColorGroup& cg, int column, int width, int align )
+ {
+
+ QBrush brush( isSelected() ? cg.highlight() : backgroundColor() );
+
+ if( column == 1 ){
+// m_filetypeRenderer->setWidth(width);
+// setHeight(m_filetypeRenderer->height());
+ m_filetypeRenderer->draw( p, 0, 0, QRect(0, 0, width, height()), cg, &brush );
+ return;
+ }
+
+ KListViewItem::paintCell( p, cg, column, width, align );
+ }
+
+ void ListItem::init()
+ {
+ m_iconHeight = 0;
+ setText(0, m_filetype->ext()!="" ? QString("." + m_filetype->ext()) : QString("") );
+ setText(1, "<qt><b>"+m_filetype->name()+"</b>. " + m_filetype->descr() );
+
+ KIconLoader * loader = KGlobal::iconLoader();
+ QPixmap iconPix = loader->loadIcon(m_filetype->icon(), KIcon::Desktop,
+ KIcon::SizeMedium,
+ KIcon::DefaultState, NULL,
+ true);
+ if (!iconPix.isNull()) {
+ setPixmap(0, iconPix);
+ m_iconHeight = iconPix.height();
+ }
+
+ }
+
+
+
+}
+
+
diff --git a/parts/filecreate/filecreate_listitem.h b/parts/filecreate/filecreate_listitem.h
new file mode 100644
index 00000000..3b2702d3
--- /dev/null
+++ b/parts/filecreate/filecreate_listitem.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * thanks: Roberto Raggi for QSimpleRichText stuff *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_LISTITEM_H__
+#define __FILECREATE_LISTITEM_H__
+
+#include <klistview.h>
+#include <qobject.h>
+
+#include "filecreate_filetype.h"
+
+class QSimpleRichText;
+
+namespace FileCreate {
+
+class ListItem : public KListViewItem {
+
+public:
+ ListItem(QListView *listview, const FileType *filetype);
+ ListItem(ListItem *listitem, const FileType *filetype);
+ virtual ~ListItem();
+
+ const FileType *filetype() const { return m_filetype; }
+
+ virtual void setup();
+ virtual void setHeight( int height );
+ virtual void paintCell( QPainter* p, const QColorGroup& gc, int column, int width, int align );
+ virtual void prepareResize();
+
+private:
+ const FileType *m_filetype;
+ int m_iconHeight;
+ void init();
+ QSimpleRichText *m_filetypeRenderer;
+
+};
+
+}
+
+#endif
+
diff --git a/parts/filecreate/filecreate_newfile.cpp b/parts/filecreate/filecreate_newfile.cpp
new file mode 100644
index 00000000..2077556c
--- /dev/null
+++ b/parts/filecreate/filecreate_newfile.cpp
@@ -0,0 +1,162 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include "filecreate_newfile.h"
+
+#include "filecreate_newfile.moc"
+
+#include <qvbox.h>
+#include <qgrid.h>
+
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
+#include <kcombobox.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kmessagebox.h>
+
+
+namespace FileCreate {
+
+ NewFileChooser::NewFileChooser(QWidget * parent) :
+ KDialogBase(KDialogBase::Plain, i18n("New file dialog (title)", "New File"), KDialogBase::Ok|KDialogBase::Cancel,
+ KDialogBase::Ok, parent, "New file", true)
+ {
+ QVBoxLayout* lay = new QVBoxLayout( plainPage(), 5, 5 );
+
+ lay->addWidget( new QLabel( i18n("<b>New File Creation</b>"), plainPage() ) );
+
+ QGridLayout* grid = new QGridLayout(lay, 2, 2, 5 );
+ QLabel * l = new QLabel(i18n("&Directory:"), plainPage() );
+ grid->addWidget(l, 0, 0);
+ m_urlreq = new KURLRequester( plainPage(), "url request" );
+ grid->addWidget(m_urlreq, 0, 1);
+ l->setBuddy(m_urlreq);
+ l = new QLabel(i18n("&File name:"), plainPage() );
+ grid->addWidget(l, 1, 0);
+ m_filename = new KLineEdit( plainPage() );
+ grid->addWidget(m_filename, 1, 1);
+ l->setBuddy(m_filename);
+// lay->addWidget( grid );
+
+ QHBoxLayout* hbox = new QHBoxLayout( lay, 5 );
+ m_filetypes = new KComboBox( plainPage(), "combo" );
+ hbox->addWidget(m_filetypes);
+ m_addToProject = new QCheckBox( i18n("Add to project (on checkbox)", "&Add to project"), plainPage(), "addproject" );
+ hbox->addWidget(m_addToProject);
+
+ lay->addStretch(20);
+
+ m_filename->setFocus();
+ m_addToProject->setChecked( true );
+
+ m_urlreq->setMode((int) KFile::Directory);
+ connect( m_filename, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotFileNameChanged(const QString & ) ) );
+ slotFileNameChanged( m_filename->text() );
+ }
+
+ NewFileChooser::~NewFileChooser() {
+ }
+
+ void NewFileChooser::slotFileNameChanged(const QString & _text)
+ {
+ enableButtonOK( !_text.isEmpty() );
+ }
+
+ void NewFileChooser::setFileTypes(QPtrList<FileType> filetypes) {
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+
+ if (filetype->enabled()) {
+
+ if (filetype->subtypes().count()==0)
+ addType(filetype);
+
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if (subtype->enabled())
+ addType(subtype);
+
+ }
+
+ }
+
+ }
+
+ }
+
+ KURL NewFileChooser::url() const {
+
+ KURL result ( m_urlreq->url() );
+ result.cd( m_filename->text() );
+ return result;
+ }
+
+ bool NewFileChooser::addToProject() const {
+ return m_addToProject->isChecked();
+ }
+
+ const FileType *NewFileChooser::selectedType() const {
+ if (!m_filetypes->count()) return NULL;
+ return m_typeInCombo[m_filetypes->currentItem()];
+ }
+
+ void NewFileChooser::addType(const FileType * filetype) {
+ m_typeInCombo[m_filetypes->count()]=filetype;
+ m_filetypes->insertItem( filetype->name() +
+ (filetype->ext()!="" ? QString(" (." + filetype->ext() + ")") : QString("") ) );
+ }
+
+ void NewFileChooser::setCurrent(const FileType *filetype) {
+ int changeToRow = -1;
+ QMap<int,const FileType*>::Iterator it;
+ for ( it = m_typeInCombo.begin(); it != m_typeInCombo.end() && changeToRow==-1; ++it ) {
+ if (it.data()==filetype)
+ changeToRow=it.key();
+ }
+ if (changeToRow>-1) m_filetypes->setCurrentItem(changeToRow);
+ }
+
+ void NewFileChooser::setDirectory(const QString & url) {
+ m_urlreq->setURL(url);
+ }
+
+ void NewFileChooser::setName(const QString & name) {
+ m_filename->setText(name);
+ }
+
+ void NewFileChooser::setInProjectMode( bool m )
+ {
+ m_addToProject->setEnabled(m);
+ m_addToProject->setChecked(m);
+ }
+
+ void NewFileChooser::accept()
+ {
+ QString fullPath = url().path();
+ if ( !selectedType()->ext().isEmpty() && !fullPath.endsWith("." + selectedType()->ext())) fullPath+="." + selectedType()->ext();
+ QFileInfo file( fullPath );
+ if ( file.exists() )
+ {
+ KMessageBox::sorry( this, i18n("A file with this name already exists"), i18n("File Exists") );
+ return;
+ }
+ KDialogBase::accept();
+ }
+
+}
+
diff --git a/parts/filecreate/filecreate_newfile.h b/parts/filecreate/filecreate_newfile.h
new file mode 100644
index 00000000..5123c7d9
--- /dev/null
+++ b/parts/filecreate/filecreate_newfile.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#ifndef FILECREATE_NEWFILE_H
+#define FILECREATE_NEWFILE_H
+
+#include <qptrlist.h>
+#include <qmap.h>
+#include <kurl.h>
+#include <kdialogbase.h>
+
+#include "filecreate_filetype.h"
+
+class KURLRequester;
+class QGridLayout;
+class KComboBox;
+class QCheckBox;
+class KLineEdit;
+
+namespace FileCreate {
+ class NewFileChooser : public KDialogBase {
+ Q_OBJECT
+ public:
+ NewFileChooser(QWidget *parent=0);
+ virtual ~NewFileChooser();
+ void setFileTypes(QPtrList<FileType> typelist);
+ KURL url() const;
+ bool addToProject() const;
+ const FileType *selectedType() const;
+ void setCurrent(const FileType *filetype);
+ void setDirectory(const QString & url);
+ void setName(const QString & name);
+
+ void setInProjectMode(bool m);
+ private slots:
+ void slotFileNameChanged(const QString &);
+ protected:
+ void addType(const FileType * filetype);
+ void accept();
+
+ QGridLayout *m_grid;
+ KURLRequester *m_urlreq;
+ KComboBox *m_filetypes;
+ QCheckBox *m_addToProject;
+ KLineEdit *m_filename;
+
+ QMap<int,const FileType*> m_typeInCombo;
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_part.cpp b/parts/filecreate/filecreate_part.cpp
new file mode 100644
index 00000000..3733753a
--- /dev/null
+++ b/parts/filecreate/filecreate_part.cpp
@@ -0,0 +1,562 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+#include "filecreate_part.h"
+
+#include <qwhatsthis.h>
+#include <qdom.h>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qvbox.h>
+#include <qtimer.h>
+
+#include <kdeversion.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kfiledialog.h>
+#include <kdebug.h>
+#include <kstandarddirs.h>
+#include <kstdaction.h>
+#include <kaction.h>
+#include <kapplication.h>
+#include <kactionclasses.h>
+#include <kpopupmenu.h>
+#include <kmessagebox.h>
+
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+#include "configwidgetproxy.h"
+
+#include "filetemplate.h"
+#include "domutil.h"
+#include "urlutil.h"
+
+#include "filecreate_widget2.h"
+#include "filecreate_widget3.h"
+#include "filecreate_filetype.h"
+#include "filecreate_filedialog.h"
+#include "filecreate_newfile.h"
+#include "fcconfigwidget.h"
+
+#define PROJECTSETTINGSPAGE 1
+#define GLOBALSETTINGSPAGE 2
+
+#include "kdevplugininfo.h"
+
+#include "config.h"
+
+static const KDevPluginInfo data("kdevfilecreate");
+
+typedef KDevGenericFactory<FileCreatePart> FileCreateFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevfilecreate, FileCreateFactory( data ) )
+
+using namespace FileCreate;
+
+FileCreatePart::FileCreatePart(QObject *parent, const char *name, const QStringList & )
+// : KDevCreateFile(&data, parent, name ? name : "FileCreatePart"), m_selectedWidget(-1), m_useSideTab(true), m_subPopups(0)
+ : KDevCreateFile(&data, parent, name ? name : "FileCreatePart"), m_subPopups(0)
+{
+ setInstance(FileCreateFactory::instance());
+ setXMLFile("kdevpart_filecreate.rc");
+
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) );
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("File Templates"), PROJECTSETTINGSPAGE, info()->icon() );
+ _configProxy->createGlobalConfigPage( i18n("File Templates"), GLOBALSETTINGSPAGE, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+
+ KToolBarPopupAction * newAction = new KToolBarPopupAction( i18n("&New"), "filenew", CTRL+Qt::Key_N, this, SLOT(slotNewFile()), actionCollection(), "file_new");
+ newAction->setWhatsThis( i18n("<b>New file</b><p>Creates a new file. Also adds it the project if the <b>Add to project</b> checkbox is turned on.") );
+ newAction->setToolTip( i18n("Create a new file") );
+ m_newPopupMenu = newAction->popupMenu();
+ connect(m_newPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowNewPopupMenu()));
+
+ QTimer::singleShot( 0, this, SLOT(slotGlobalInitialize()) );
+}
+
+
+FileCreatePart::~FileCreatePart()
+{
+ delete _configProxy;
+
+ m_newPopupMenu->clear();
+ delete m_subPopups;
+}
+
+void FileCreatePart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ kdDebug() << k_funcinfo << endl;
+
+ switch( pagenumber )
+ {
+ case PROJECTSETTINGSPAGE:
+ {
+ FCConfigWidget* w = new FCConfigWidget( this, false, page, "filecreate config widget" );
+ connect( dlg, SIGNAL( okClicked( ) ), w, SLOT( accept( ) ) );
+ }
+ break;
+
+ case GLOBALSETTINGSPAGE:
+ {
+ FCConfigWidget *w = new FCConfigWidget( this, true, page, "filecreate config widget" );
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ }
+ break;
+ }
+}
+
+void FileCreatePart::slotAboutToShowNewPopupMenu()
+{
+ KIconLoader * m_iconLoader = KGlobal::iconLoader();
+ m_newPopupMenu->clear();
+ delete m_subPopups;
+ m_subPopups = NULL;
+ int id = 0;
+ FileType * filetype = m_filetypes.first();
+ for(; filetype; filetype=m_filetypes.next())
+ {
+ if (filetype->enabled())
+ {
+ if (filetype->subtypes().count()==0)
+ {
+ QPixmap iconPix = m_iconLoader->loadIcon(
+ filetype->icon(), KIcon::Desktop, KIcon::SizeSmall,
+ KIcon::DefaultState, NULL, true);
+ m_newPopupMenu->insertItem(iconPix, filetype->name(), this,
+ SLOT(slotNewFilePopup(int)), 0, ++id );
+ m_newPopupMenu->setItemParameter( id, (long)filetype );
+ } else
+ {
+ KPopupMenu* subMenu = NULL;
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first(); subtype; subtype=subtypes.next())
+ {
+ if (subtype->enabled()){
+ if( !subMenu )
+ subMenu = new KPopupMenu(0,0);
+ QPixmap iconPix = m_iconLoader->loadIcon(
+ subtype->icon(), KIcon::Desktop, KIcon::SizeSmall,
+ KIcon::DefaultState, NULL, true);
+ subMenu->insertItem(iconPix, subtype->name(), this,
+ SLOT(slotNewFilePopup(int)), 0, ++id );
+ subMenu->setItemParameter( id, (long)subtype );
+ }
+ }
+ if( subMenu )
+ {
+ if( !m_subPopups )
+ {
+ m_subPopups = new QPtrList<KPopupMenu>;
+ m_subPopups->setAutoDelete(true);
+ }
+ m_subPopups->append( subMenu );
+ m_newPopupMenu->insertItem( filetype->name(), subMenu );
+ }
+ }
+
+ }
+
+ }
+}
+
+void FileCreatePart::slotNewFilePopup( int pFileType )
+{
+ const FileType* filetype = (const FileType*) pFileType;
+ slotFiletypeSelected( filetype );
+}
+
+void FileCreatePart::slotNewFile() {
+ KDevCreateFile::CreatedFile createdFile = createNewFile();
+ if (createdFile.status == KDevCreateFile::CreatedFile::STATUS_NOTCREATED)
+ KMessageBox::error(0, i18n("Cannot create file. Check whether the directory and filename are valid."));
+ else if (createdFile.status != KDevCreateFile::CreatedFile::STATUS_CANCELED)
+ openCreatedFile(createdFile);
+}
+
+void FileCreatePart::slotProjectOpened() {
+ QTimer::singleShot( 0, this, SLOT(slotInitialize()) );
+}
+
+void FileCreatePart::addFileType(const QString & filename) {
+ FileType * filetype = getType(filename);
+ if (!filetype) {
+ filetype = new FileType;
+ filetype->setName( filename + " files" );
+ filetype->setExt( filename );
+ filetype->setCreateMethod("template");
+ m_filetypes.append(filetype);
+ }
+ filetype->setEnabled(true);
+}
+
+void FileCreatePart::slotProjectClosed() {
+ m_filetypes.clear();
+ QTimer::singleShot( 0, this, SLOT(slotGlobalInitialize()) );
+}
+
+void FileCreatePart::slotFiletypeSelected(const FileType * filetype) {
+
+ KDevCreateFile::CreatedFile createdFile = createNewFile(filetype->ext(),
+ QString::null,
+ QString::null,
+ filetype->subtypeRef());
+
+ openCreatedFile(createdFile);
+}
+
+void FileCreatePart::openCreatedFile(const KDevCreateFile::CreatedFile & createdFile)
+{
+ if ( createdFile.status == KDevCreateFile::CreatedFile::STATUS_OK )
+ {
+ KURL uu( createdFile.dir + "/" + createdFile.filename );
+ partController()->editDocument ( uu );
+ }
+}
+
+int FileCreatePart::readTypes(const QDomDocument & dom, QPtrList<FileType> &m_filetypes, bool enable) {
+ int numRead = 0;
+ QDomElement fileTypes = DomUtil::elementByPath(dom,"/kdevfilecreate/filetypes");
+ if (!fileTypes.isNull()) {
+ for(QDomNode node = fileTypes.firstChild();!node.isNull();node=node.nextSibling()) {
+
+ if (node.isElement() && node.nodeName()=="type") {
+ QDomElement element = node.toElement();
+ FileType * filetype = new FileType;
+ filetype->setName( element.attribute("name") );
+ filetype->setExt( element.attribute("ext") );
+ filetype->setCreateMethod( element.attribute("create") );
+
+ filetype->setIcon( element.attribute("icon") );
+ filetype->setDescr( (DomUtil::namedChildElement(element, "descr")).text() );
+ filetype->setEnabled(enable || (filetype->ext()==""));
+ m_filetypes.append(filetype);
+ numRead++;
+
+ kdDebug(9034) << "node: " << filetype->name().latin1() << endl;
+
+ if (node.hasChildNodes()) {
+ for(QDomNode subnode = node.firstChild();!subnode.isNull();subnode=subnode.nextSibling()) {
+ kdDebug(9034) << "subnode: " << subnode.nodeName().latin1() << endl;
+ if (subnode.isElement() && subnode.nodeName()=="subtype") {
+ QDomElement subelement = subnode.toElement();
+ FileType * subtype = new FileType;
+ subtype->setExt( filetype->ext() );
+ subtype->setCreateMethod( filetype->createMethod() );
+ subtype->setSubtypeRef( subelement.attribute("ref") );
+ subtype->setIcon( subelement.attribute("icon") );
+ subtype->setName( subelement.attribute("name") );
+ subtype->setDescr( (DomUtil::namedChildElement(subelement, "descr")).text() );
+ subtype->setEnabled(enable);
+ filetype->addSubtype(subtype);
+ }
+ }
+ }
+ }
+ }
+ }
+ return numRead;
+}
+
+FileType * FileCreatePart::getType(const QString & ex, const QString subtRef) {
+
+ QString subtypeRef = subtRef;
+ QString ext = ex;
+ int dashPos = ext.find('-');
+ if (dashPos>-1 && subtRef.isNull()) {
+ ext = ex.left(dashPos);
+ subtypeRef = ex.mid(dashPos+1);
+ }
+
+ QPtrList<FileType> filetypes = getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+ if (filetype->ext()==ext) {
+ if (subtypeRef.isNull()) return filetype;
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if (subtypeRef==subtype->subtypeRef()) return subtype;
+ }
+ }
+ }
+ return NULL;
+}
+
+FileType * FileCreatePart::getEnabledType(const QString & ex, const QString subtRef) {
+
+ QString subtypeRef = subtRef;
+ QString ext = ex;
+ int dashPos = ext.find('-');
+ if (dashPos>-1 && subtRef.isNull()) {
+ ext = ex.left(dashPos);
+ subtypeRef = ex.mid(dashPos+1);
+ }
+
+ QPtrList<FileType> filetypes = getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+ if (filetype->ext()==ext) {
+ if ( (subtypeRef.isNull()) && (filetype->enabled()) ) return filetype;
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if ( (subtypeRef==subtype->subtypeRef()) && (filetype->enabled()) ) return subtype;
+ }
+ }
+ }
+ return NULL;
+}
+
+// KDevFileCreate interface
+
+KDevCreateFile::CreatedFile FileCreatePart::createNewFile(QString ext, QString dir, QString name, QString subtype)
+{
+ KDevCreateFile::CreatedFile result;
+
+ KURL projectURL;
+ if ( !project() )
+ {
+ //result.status = KDevCreateFile::CreatedFile::STATUS_NOTCREATED;
+ //return result;
+ }
+ else
+ {
+ projectURL = project()->projectDirectory();
+ }
+
+ KURL selectedURL;
+
+ NewFileChooser dialog;
+ dialog.setFileTypes(m_filetypes);
+ const FileType *filetype = getEnabledType(ext,subtype);
+ kdDebug(9034) << "Looking for filetype pointer for " << ext << "/" << subtype << endl;
+ if (filetype) {
+ kdDebug(9034) << "found filetype" << endl;
+ } else {
+ kdDebug(9034) << "could not find filetype" << endl;
+ }
+ if (!project())
+ dialog.setInProjectMode(false);
+
+ if (!dir.isNull())
+ dialog.setDirectory(dir);
+ else if (!project())
+ dialog.setDirectory(QDir::currentDirPath());
+ else
+ {
+ QString activeDir = project()->activeDirectory();
+ dialog.setDirectory( project()->projectDirectory() +
+ ( activeDir[0] == '/' ? "" : "/" )
+ + activeDir );
+ }
+ if (!name.isNull()) dialog.setName(name);
+ if (filetype) dialog.setCurrent(filetype);
+
+ dialog.setInitialSize(QSize(500, 200));
+ int dialogResult = dialog.exec();
+
+ if (dialogResult == KDialogBase::Rejected) {
+ result.status = KDevCreateFile::CreatedFile::STATUS_CANCELED;
+ return result;
+ }
+
+ // OK was pressed
+
+ result.addToProject = dialog.addToProject();
+ selectedURL = dialog.url();
+ const FileType *selectedFileType = dialog.selectedType();
+
+ if (dialog.addToProject() && !projectURL.isParentOf(selectedURL) && !(project()->options() & KDevProject::UsesQMakeBuildSystem) ) {
+ result.status = KDevCreateFile::CreatedFile::STATUS_NOTWITHINPROJECT;
+ return result;
+ }
+
+ if (selectedFileType) {
+ ext = selectedFileType->ext();
+ subtype = selectedFileType->subtypeRef();
+ }
+
+ QString fullPath = selectedURL.path();
+ // add appropriate extension, if not already there
+ if ( !ext.isEmpty() && !fullPath.endsWith("." + ext)) fullPath+="." + ext;
+
+ QString filename = URLUtil::filename(fullPath);
+ kdDebug(9034) << "full path = " << fullPath << endl;
+
+ // add in subtype, if specified
+ if (!subtype.isEmpty())
+ ext += "-" + subtype;
+
+ // create file from template
+ bool created = false;
+ if (FileTemplate::exists(this, ext))
+ created = FileTemplate::copy(this, ext, fullPath);
+ else {
+ // no template, create a blank file instead
+ QFile f(fullPath);
+ created = f.open( IO_WriteOnly );
+ f.close();
+ }
+ if (!created)
+ {
+ result.status = KDevCreateFile::CreatedFile::STATUS_NOTCREATED;
+ return result;
+ }
+
+ if (dialog.addToProject())
+ {
+ // work out the path relative to the project directory
+// QString relToProj = URLUtil::relativePath(projectURL, selectedURL, URLUtil::SLASH_PREFIX );
+ QString relToProj;
+ if( project()->options() & KDevProject::UsesQMakeBuildSystem )
+ {
+ relToProj = URLUtil::relativePathToFile( project()->projectDirectory(), fullPath );
+ project()->addFile(relToProj);
+ }else
+ {
+ relToProj = URLUtil::relativePath(projectURL.path(), fullPath, URLUtil::SLASH_PREFIX );
+ project()->addFile(relToProj.mid(1));
+ }
+ }
+
+ KURL url;
+ url.setPath(fullPath);
+ partController()->editDocument(url);
+
+ QString fileName = URLUtil::filename(fullPath);
+ kdDebug(9034) << "file name = " << filename << endl;
+
+ result.filename = fileName;
+ result.dir = URLUtil::directory(fullPath);
+ result.status = KDevCreateFile::CreatedFile::STATUS_OK;
+
+ return result;
+}
+
+void FileCreatePart::slotNoteFiletype(const FileType * filetype) {
+ kdDebug(9034) << "Noting file type: " << (filetype ? filetype->ext() : QString::fromLatin1("Null") ) << endl;
+ m_filedialogFiletype = filetype;
+}
+
+void FileCreatePart::slotInitialize( )
+{
+ m_filetypes.clear();
+
+ //read global configuration
+ slotGlobalInitialize();
+
+ // read in which global templates are to be used for this project
+ QDomElement useGlobalTypes =
+ DomUtil::elementByPath(*projectDom(),"/kdevfilecreate/useglobaltypes");
+ for(QDomNode node = useGlobalTypes.firstChild();
+ !node.isNull();node=node.nextSibling()) {
+
+ if (node.isElement() && node.nodeName()=="type") {
+ QDomElement element = node.toElement();
+ QString ext = element.attribute("ext");
+ QString subtyperef = element.attribute("subtyperef");
+ // if an extension has been specified as enabled, ensure it
+ // and all its subtypes are enabled
+ if (subtyperef.isNull()) {
+ FileType * filetype = getType(ext);
+ if (filetype) {
+ filetype->setEnabled(true);
+ if (filetype->subtypes().count())
+ filetype->setSubtypesEnabled(true);
+ }
+ } else {
+ // if an extension + subtype have been specified, enable
+ // the subtype and the extension (the 'parent')
+ FileType * filetype = getType(ext);
+ FileType * subtype = getType(ext,subtyperef);
+ if (filetype && subtype) {
+ filetype->setEnabled(true);
+ subtype->setEnabled(true);
+ }
+ }
+ }
+ }
+
+ // read in the list of file types for this project
+ if ( project() && readTypes( *projectDom(), m_filetypes, true )==0 ) {
+ // default by scanning the templates directory if no template info
+ // found in project file
+ QDir templDir( project()->projectDirectory() + "/templates/" );
+ if (templDir.exists()) {
+ templDir.setFilter( QDir::Files );
+ const QFileInfoList * list = templDir.entryInfoList();
+ if( list ){
+ QFileInfoListIterator it( *list );
+ QFileInfo *fi;
+ while ( (fi = it.current()) != 0 ) {
+ addFileType(fi->fileName());
+ ++it;
+ }
+ }
+ }
+/* else { // it was probably an imported project
+ // KLUDGE: we need a better way to determine file types
+ // the current method looks a bit too restrictive
+ addFileType( "cpp" );
+ addFileType( "h" );
+ }*/
+ }
+}
+
+QString FileCreatePart::findGlobalXMLFile() const
+{
+ int version = 0;
+ QString filename;
+ QStringList filenames = KGlobal::instance()->dirs()->findAllResources("data", "kdevfilecreate/template-info.xml");
+ for( QStringList::const_iterator it = filenames.begin(); it != filenames.end(); ++it )
+ {
+ QDomDocument globalDom;
+ DomUtil::openDOMFile(globalDom,*it);
+ QDomElement e = globalDom.documentElement();
+ if( !e.hasAttribute( "version" ) && e.attribute( "version" ).toInt() < version )
+ {
+ continue;
+ }else
+ {
+ version = e.attribute( "version" ).toInt();
+ filename = *it;
+ }
+ }
+ return filename;
+}
+
+void FileCreatePart::slotGlobalInitialize( )
+{
+ // read in global template information
+ QString globalXMLFile = findGlobalXMLFile();
+ kdDebug(9034) << "Found global template info info " << globalXMLFile << endl;
+ QDomDocument globalDom;
+ if (!globalXMLFile.isNull() && DomUtil::openDOMFile(globalDom,globalXMLFile))
+ {
+ kdDebug(9034) << "Reading global template info..." << endl;
+
+ readTypes(globalDom, m_filetypes, false);
+
+ }
+}
+
+#include "filecreate_part.moc"
+
+// kate: indent-width 2; replace-tabs on; tab-width 4; space-indent on;
diff --git a/parts/filecreate/filecreate_part.h b/parts/filecreate/filecreate_part.h
new file mode 100644
index 00000000..3cbc9909
--- /dev/null
+++ b/parts/filecreate/filecreate_part.h
@@ -0,0 +1,144 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+
+#ifndef __KDEVPART_FILECREATE_H__
+#define __KDEVPART_FILECREATE_H__
+
+
+#include <qguardedptr.h>
+#include <qptrlist.h>
+
+#include <qwidget.h>
+#include <kdevplugin.h>
+#include <kdevcreatefile.h>
+
+#include "filecreate_typechooser.h"
+
+class KPopupMenu;
+
+namespace FileCreate {
+ class Widget;
+ class FileType;
+}
+
+class KDialogBase;
+class FCConfigWidget;
+class ConfigWidgetProxy;
+
+using namespace FileCreate;
+
+class FileCreatePart : public KDevCreateFile
+{
+ Q_OBJECT
+
+ friend class FCConfigWidget;
+public:
+ FileCreatePart(QObject *parent, const char *name, const QStringList &);
+ virtual ~FileCreatePart();
+
+ /**
+ * Returns the list of available file types.
+ */
+ QPtrList<FileType> getFileTypes() const { return m_filetypes; }
+
+ /**
+ * Call this method to create a new file, within or without the project. Supply as
+ * much information as you know. Leave what you don't know as QString::null.
+ * The user will be prompted as necessary for the missing information, and the
+ * file created, and added to the project as necessary.
+ */
+ virtual KDevCreateFile::CreatedFile createNewFile(QString ext = QString::null,
+ QString dir = QString::null,
+ QString name = QString::null,
+ QString subtype = QString::null);
+
+ /**
+ * Finds the file type object for a given extension and optionally subtype.
+ * You can omit the subtype and specify the extension as ext-subtype if you wish.
+ */
+ FileType * getType(const QString & ext, const QString subtype = QString::null);
+ /**
+ * Finds the file type object for a given extension and optionally subtype.
+ * You can omit the subtype and specify the extension as ext-subtype if you wish.
+ * Returns only enabled type (i.e. used in the project).
+ */
+ FileType * getEnabledType(const QString & ext, const QString subtype = QString::null);
+
+public slots:
+
+ void slotProjectOpened();
+ void slotProjectClosed();
+ void slotInitialize();
+ void slotGlobalInitialize();
+
+ /**
+ * Called when a file type is selected from the docked widget.
+ */
+ void slotFiletypeSelected(const FileType *);
+
+ /**
+ * Called when a new file is required - for example, from the "New.." menu action.
+ */
+ void slotNewFile();
+
+ /**
+ * Called from KToolBarPopupMenu to request a new file action
+ * @param pFileType is acutally a pointer to FileType
+ */
+ void slotNewFilePopup(int pFileType);
+
+protected slots:
+ void slotNoteFiletype(const FileType * filetype);
+ void slotAboutToShowNewPopupMenu();
+ void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
+
+private:
+ /**
+ * If a file has been successfully created, open it
+ */
+ void openCreatedFile(const KDevCreateFile::CreatedFile & createdFile);
+
+ /**
+ * Reads in file type definitions from a config DOM and adds them
+ * to the file type list. If enable is true, sets them all to
+ * enabled=true by default.
+ */
+ int readTypes(const QDomDocument & dom, QPtrList<FileType> &m_filetypes, bool enable);
+
+ /**
+ * Add a file type
+ */
+ void addFileType(const QString & filename);
+
+ /**
+ * Finds the global XML file that has the same version as KDevelop
+ */
+ QString findGlobalXMLFile() const;
+
+ /**
+ * List of file types from which the user can choose
+ */
+ QPtrList<FileType> m_filetypes;
+
+ /**
+ * The file type selected by the new file dialog, if appropriate.
+ */
+ const FileType * m_filedialogFiletype;
+
+ ConfigWidgetProxy * _configProxy;
+
+ KPopupMenu* m_newPopupMenu;
+ QPtrList<KPopupMenu>* m_subPopups;
+};
+
+
+#endif
diff --git a/parts/filecreate/filecreate_typechooser.h b/parts/filecreate/filecreate_typechooser.h
new file mode 100644
index 00000000..8e1e37e8
--- /dev/null
+++ b/parts/filecreate/filecreate_typechooser.h
@@ -0,0 +1,47 @@
+#ifndef __FILECREATE_TYPECHOOSER_H__
+#define __FILECREATE_TYPECHOOSER_H__
+
+#include "filecreate_typechoosersig.h"
+
+#include <kdebug.h>
+
+class FileCreatePart;
+
+namespace FileCreate {
+
+class FileType;
+
+class TypeChooser {
+
+public:
+
+ TypeChooser(FileCreatePart * part) : m_part(part), m_current(NULL) {
+ m_signaller = new Signaller;
+ }
+ virtual ~TypeChooser() { delete m_signaller; }
+
+ virtual void setPart(FileCreatePart * part) { m_part = part; }
+ virtual FileCreatePart * part() const { return m_part; }
+ virtual void refresh() = 0;
+ virtual void setCurrent(const FileType * current) = 0;
+ virtual const FileType * current() const { return m_current; }
+
+ virtual void filetypeSelected(const FileType * filetype) {
+ m_current = filetype;
+ kdDebug(9034) << "type selected: about to signal" << endl;
+ if (filetype) m_signaller->signal(filetype);
+ kdDebug(9034) << "type selected: done signal" << endl;
+ }
+
+ const Signaller * signaller() const { return m_signaller; }
+
+protected:
+ FileCreatePart * m_part;
+ Signaller * m_signaller;
+ const FileType * m_current;
+
+};
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_typechoosersig.h b/parts/filecreate/filecreate_typechoosersig.h
new file mode 100644
index 00000000..7f16208a
--- /dev/null
+++ b/parts/filecreate/filecreate_typechoosersig.h
@@ -0,0 +1,28 @@
+#ifndef __FILECREATE_TYPECHOOSERSIG_H__
+#define __FILECREATE_TYPECHOOSERSIG_H__
+
+#include <qobject.h>
+
+namespace FileCreate {
+
+class FileType;
+
+class Signaller : public QObject {
+ Q_OBJECT
+
+public:
+ Signaller() : QObject() { }
+ virtual ~Signaller() { }
+
+ virtual void signal(const FileType * filetype ) {
+ emit filetypeSelected(filetype);
+ }
+
+
+signals:
+ void filetypeSelected(const FileType * filetype);
+};
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_widget2.cpp b/parts/filecreate/filecreate_widget2.cpp
new file mode 100644
index 00000000..c8e6d051
--- /dev/null
+++ b/parts/filecreate/filecreate_widget2.cpp
@@ -0,0 +1,228 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <qptrlist.h>
+#include <qtimer.h>
+#include <qwhatsthis.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include <kdevcore.h>
+
+#include "kdevproject.h"
+#include "filecreate_part.h"
+#include "filecreate_widget2.h"
+#include "filecreate_filetype.h"
+#include "filecreate_listitem.h"
+
+namespace FileCreate {
+
+ FriendlyWidget::FriendlyWidget(FileCreatePart *part)
+ : QTable(0,4,0), TypeChooser(part), m_selected(NULL)
+ {
+
+ setReadOnly(true);
+ setShowGrid(false);
+ horizontalHeader()->hide();
+ setTopMargin(0);
+ verticalHeader()->hide();
+ setLeftMargin(0);
+ setSelectionMode(SingleRow);
+ setFocusStyle(FollowStyle);
+ setColumnStretchable(3, true);
+
+ m_iconLoader = KGlobal::iconLoader();
+
+ QWhatsThis::add(this, i18n("Use this to create new files within your project."));
+
+ setDefaultColumnWidths();
+
+ }
+
+
+ FriendlyWidget::~FriendlyWidget()
+ {
+ }
+
+ void FriendlyWidget::setCurrent(const FileType * current) {
+ int changeToRow = -1;
+ QMap<int,FileType*>::Iterator it;
+ kdDebug(9034) << "Checking " << current->descr() << " for matches in row..." << endl;
+ for ( it = typeForRow.begin(); it != typeForRow.end() && changeToRow==-1; ++it ) {
+ kdDebug(9034) << "Checking: " << it.data()->descr() << endl;
+ if (it.data()==current)
+ changeToRow=it.key();
+ else kdDebug(9034) << "No match!" << endl;
+ }
+
+ // If an exact match is not found (e.g. current points to a 'parent' type) then
+ // look instead for an extension match
+ if (changeToRow==-1) {
+ for(it = typeForRow.begin(); it!= typeForRow.end() && changeToRow==-1; ++it) {
+ if (it.data()->ext() == current->ext() )
+ changeToRow = it.key();
+ }
+ }
+
+ if (changeToRow!=-1) {
+ m_current = current;
+ kdDebug(9034) << "Found row, setting current to row " << changeToRow << endl;
+ slotCellSelected(changeToRow,0);
+ clearSelection();
+ selectRow(changeToRow);
+ }
+
+ }
+
+ void FriendlyWidget::refresh() {
+
+ disconnect( this, SIGNAL(currentChanged(int,int)), this, SLOT(slotCellSelected(int,int)) );
+
+ empty();
+
+ int row = 0;
+ QPtrList<FileType> filetypes = m_part->getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype;
+ filetype=filetypes.next()) {
+
+ if (filetype->enabled()) {
+
+ if (filetype->subtypes().count()==0)
+ setRow(row++, filetype);
+
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ for(FileType * subtype = subtypes.first();
+ subtype;
+ subtype=subtypes.next()) {
+ if (subtype->enabled())
+ setRow(row++, subtype);
+ }
+
+ }
+
+ }
+ resizeCells();
+ if (currentSelection()>-1) removeSelection(currentSelection());
+
+ connect( this, SIGNAL(currentChanged(int,int)), this, SLOT(slotCellSelected(int,int)) );
+
+
+ }
+
+ void FriendlyWidget::setRow(int row, FileType * filetype) {
+ if (row+1>numRows()) setNumRows(row+1);
+ setText(row, 1, filetype->name() );
+ setText(row, 2, filetype->ext() );
+ setText(row, 3, filetype->descr() );
+ item(row,1)->setWordWrap(true);
+ item(row,3)->setWordWrap(true);
+ //setRowStretchable(row,true);
+ QPixmap iconPix = m_iconLoader->loadIcon(filetype->icon(), KIcon::Desktop, KIcon::SizeMedium,
+ KIcon::DefaultState, NULL,
+ true);
+ if (!iconPix.isNull()) {
+ setPixmap(row, 0, iconPix);
+ setRowHeight(row, iconPix.height()+4 );
+ if (iconPix.width()+4>columnWidth(0))
+ setColumnWidth(0, iconPix.width()+4 );
+ }
+
+ typeForRow[row]=filetype;
+
+ }
+
+ void FriendlyWidget::empty() {
+ typeForRow.clear();
+ while(numRows()) removeRow(0);
+ }
+
+ void FriendlyWidget::setDefaultColumnWidths() {
+ // set some defaults - resizeCells will later ensure that column widths
+ // and row heights are set big enough for the cell contents
+ setColumnWidth(0,1);
+ setColumnWidth(1,60);
+ setColumnWidth(2,30);
+ setColumnWidth(3,150);
+ }
+
+ void FriendlyWidget::slotCellSelected(int row, int col) {
+ if (col!=0) {
+ setCurrentCell(row, 0);
+ return;
+ }
+
+ m_selected = typeForRow.contains(row) ? typeForRow[row] : NULL;
+ QTimer::singleShot(0, this, SLOT(slotDoSelection()) );
+
+ }
+
+ void FriendlyWidget::slotDoSelection() {
+ kdDebug(9034) << "widget2: slotDoSelection" << endl;
+ if (m_selected) filetypeSelected(m_selected);
+ kdDebug(9034) << "widget2: slotDoSelection middle" << endl;
+ if (currentSelection()>-1) removeSelection(currentSelection());
+ kdDebug(9034) << "widget2: slotDoSelection ending" << endl;
+ }
+
+ void FriendlyWidget::resizeCells() {
+ for(int r=0;r<numRows();r++) resizeRow(r);
+ for(int c=0;c<numCols();c++) resizeColumn(c);
+ }
+
+ void FriendlyWidget::resizeRow(int row) {
+ if (row>=numRows() || row<0) return;
+ int maxHeight = 0;
+
+ for(int c=0;c<numCols();c++) {
+ QTableItem* i = item( row, c );
+ if( !i )
+ continue;
+
+ QSize size = i->sizeHint();
+ maxHeight = size.height()>maxHeight ? size.height() : maxHeight;
+ }
+ setRowHeight(row,maxHeight+2); // bit of extra room
+ }
+
+ void FriendlyWidget::resizeColumn(int col) {
+ if (col>=numCols() || col<0) return;
+ int maxWidth = 0;
+ for(int r=0;r<numRows();r++) {
+
+ QTableItem* i = item( r, col );
+ if( !i )
+ continue;
+
+ QSize size = item(r,col)->sizeHint();
+ maxWidth = size.width()>maxWidth ? size.width() : maxWidth;
+ }
+ setColumnWidth(col,maxWidth+2); // bit of extra room
+ }
+
+#if QT_VERSION < 0x030100
+ void FriendlyWidget::selectRow(int row) {
+ if (numCols()>0 && row<numRows()) {
+ QTableSelection sel;
+ sel.init(row,0);
+ sel.expandTo(row,numCols());
+ addSelection(sel);
+ }
+ }
+#endif
+
+}
+
+#include "filecreate_widget2.moc"
diff --git a/parts/filecreate/filecreate_widget2.h b/parts/filecreate/filecreate_widget2.h
new file mode 100644
index 00000000..8b3d14e8
--- /dev/null
+++ b/parts/filecreate/filecreate_widget2.h
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_WIDGET2_H__
+#define __FILECREATE_WIDGET2_H__
+
+#include <kdeversion.h>
+#include <qtable.h>
+#include <qstring.h>
+#include <qmap.h>
+
+//#include <klistview.h>
+
+#include "filecreate_typechooser.h"
+
+class KIconLoader;
+class KDevProject;
+class FileCreatePart;
+
+namespace FileCreate {
+
+ class FileType;
+
+ class FriendlyWidget : public QTable, public TypeChooser
+ {
+ Q_OBJECT
+
+ public:
+
+ FriendlyWidget(FileCreatePart *part);
+ virtual ~FriendlyWidget();
+
+ /**
+ * Refreshes the widget with the part's file type list.
+ */
+ virtual void refresh();
+ /**
+ * Sets the currently highlighted file type.
+ */
+ virtual void setCurrent(const FileType * current);
+
+#if QT_VERSION < 0x030100
+ void selectRow(int row);
+#endif
+
+ protected:
+ /**
+ * Sets row <i>row</i> to filetype <i>filetype</i>.
+ */
+ virtual void setRow(int row, FileType * filetype);
+ /**
+ * Clears the table.
+ */
+ virtual void empty();
+ /**
+ * Sets some default column widths.
+ */
+ virtual void setDefaultColumnWidths();
+ /**
+ * Scans the cells in the table and adjusts their size based
+ * on their contents.
+ */
+ virtual void resizeCells();
+ /**
+ * Sets the height of a row to the highest
+ * cell in the row.
+ */
+ virtual void resizeRow(int row);
+ /**
+ * Sets the width of a column to the widest
+ * cell in the column.
+ */
+ virtual void resizeColumn(int col);
+
+ /**
+ * The default icon loader, here for convenience.
+ */
+ KIconLoader * m_iconLoader;
+ /**
+ * A mapping of each row number to a file type.
+ */
+ QMap<int,FileType*> typeForRow;
+ /**
+ * The currently selected file type, or null if none.
+ */
+ FileType * m_selected;
+
+ protected slots:
+ /**
+ * When a cell is selected by the user.
+ */
+ virtual void slotCellSelected(int row, int col);
+ /**
+ * Invoked as a single shot after slotCellSelected, with m_selected
+ * set to the selected file type, so that
+ * the GUI will be updated before the selection event
+ * takes place.
+ */
+ virtual void slotDoSelection();
+
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/filecreate_widget3.cpp b/parts/filecreate/filecreate_widget3.cpp
new file mode 100644
index 00000000..f766cbcf
--- /dev/null
+++ b/parts/filecreate/filecreate_widget3.cpp
@@ -0,0 +1,119 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * thanks: Roberto Raggi for QSimpleRichText stuff *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#include <qptrlist.h>
+#include <qwhatsthis.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kdevcore.h>
+
+#include "filecreate_widget3.h"
+
+#include "kdevproject.h"
+#include "filecreate_part.h"
+#include "filecreate_filetype.h"
+#include "filecreate_listitem.h"
+
+namespace FileCreate {
+
+ ListWidget::ListWidget(FileCreatePart *part)
+ : KListView(0, "KDevFileCreate"), TypeChooser(part)
+ {
+ setIcon( SmallIcon("filenew2") );
+ setCaption(i18n("File Create"));
+ setResizeMode( AllColumns );
+ setAllColumnsShowFocus(true);
+ setRootIsDecorated(true);
+
+ addColumn("");
+ addColumn("");
+
+ QWhatsThis::add(this, i18n("<b>New file</b><p>This part makes the creation of new files easier. Select a type in the list to create a file. "
+ "The list of project file types can be configured in project settings dialog, <b>New File Wizard</b> tab. "
+ "Globally available file types are listed and can be configured in KDevelop settings dialog, <b>New File Wizard</b> tab."));
+
+
+ connect( this, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotTypeSelected(QListViewItem*)) );
+ }
+
+
+ ListWidget::~ListWidget()
+ {
+ }
+
+ void ListWidget::setCurrent(const FileType * current) {
+
+ bool found = false;
+ QListViewItem * lvi = firstChild();
+ while(lvi && !found) {
+ ListItem * li = dynamic_cast<ListItem*>(lvi);
+ if (li) {
+ if (li->filetype()==current) {
+ found=true;
+ setSelected(li,true);
+ }
+ }
+ if (lvi->nextSibling())
+ lvi = lvi->nextSibling();
+ else {
+ while (lvi && !lvi->nextSibling())
+ lvi = lvi->parent();
+ }
+ }
+
+ }
+
+ void ListWidget::resizeEvent(QResizeEvent *event) {
+ ListItem *li = dynamic_cast<ListItem*>(firstChild());
+ while(li) {
+ li->prepareResize();
+ li = dynamic_cast<ListItem*>(li->nextSibling());
+ }
+ KListView::resizeEvent(event);
+ }
+
+ void ListWidget::refresh() {
+ clear();
+ QPtrList<FileType> filetypes = m_part->getFileTypes();
+ for(FileType * filetype = filetypes.first();
+ filetype!=NULL;
+ filetype=filetypes.next()) {
+ if (filetype->enabled()) {
+ QPtrList<FileType> subtypes = filetype->subtypes();
+ if (subtypes.count()==0)
+ new ListItem( this, filetype );
+ for(FileType * subtype = subtypes.first();
+ subtype!=NULL;
+ subtype=subtypes.next()) {
+ if (subtype->enabled())
+ new ListItem( this, subtype );
+ }
+ }
+ }
+ }
+
+ void ListWidget::slotTypeSelected(QListViewItem * item) {
+ ListItem * fileitem = dynamic_cast<ListItem*>(item);
+ if (!fileitem) return;
+
+ const FileType * filetype = fileitem->filetype();
+
+ TypeChooser::filetypeSelected(filetype);
+ }
+
+
+}
+#include "filecreate_widget3.moc"
diff --git a/parts/filecreate/filecreate_widget3.h b/parts/filecreate/filecreate_widget3.h
new file mode 100644
index 00000000..58fc5129
--- /dev/null
+++ b/parts/filecreate/filecreate_widget3.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Julian Rockey *
+ * linux@jrockey.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef __FILECREATE_WIDGET3_H__
+#define __FILECREATE_WIDGET3_H__
+
+
+#include <qwidget.h>
+#include <qstring.h>
+
+#include <klistview.h>
+
+#include "filecreate_typechooser.h"
+
+class KDevProject;
+class FileCreatePart;
+class QResizeEvent;
+
+namespace FileCreate {
+
+ class FileType;
+
+ class ListWidget : public KListView, public TypeChooser
+ {
+ Q_OBJECT
+
+ public:
+
+ ListWidget(FileCreatePart *part);
+ virtual ~ListWidget();
+
+ virtual void refresh();
+ virtual void setCurrent(const FileType * current);
+ virtual void resizeEvent(QResizeEvent *event);
+
+ public slots:
+ void slotTypeSelected(QListViewItem * item);
+
+ };
+
+}
+
+#endif
diff --git a/parts/filecreate/kdevfilecreate.desktop b/parts/filecreate/kdevfilecreate.desktop
new file mode 100644
index 00000000..82adbb30
--- /dev/null
+++ b/parts/filecreate/kdevfilecreate.desktop
@@ -0,0 +1,77 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=FileCreate
+Comment[ca]=Creació de fitxers
+Comment[da]=Filoprettelse
+Comment[de]=Eine Komponente, die Unterstützung bei der Erstellung von Dateien bietet
+Comment[el]=ΔημιουργίαΑρχείου
+Comment[es]=Creación de archivos
+Comment[eu]=Fitxategi sorkuntza
+Comment[fa]=ایجاد پرونده
+Comment[fr]=Création de fichiers
+Comment[hi]=फ़ाइल-क्रिएट
+Comment[hu]=Fájl létrehozása
+Comment[it]=Crea file
+Comment[ja]=ファイル作成
+Comment[ms]=CiptaFail
+Comment[nds]=Dateiopstellen
+Comment[ne]=फाइल सिर्जना
+Comment[nl]=Bestand aanmaken
+Comment[pl]=Tworzenie pliku
+Comment[pt]=Criação de Ficheiros
+Comment[ru]=Мастер создания файлов
+Comment[sk]=Vytvoriť súbor
+Comment[sl]=Ustvarjanje datotek
+Comment[sr]=Направи фајл
+Comment[sr@Latn]=Napravi fajl
+Comment[sv]=Skapa filer
+Comment[ta]= கோப்பு உருவாக்கப்பட்டது
+Comment[tg]=Устои бунёд кардани файлҳо
+Comment[zh_CN]=文件创建
+Comment[zh_TW]=檔案建立
+Name=KDevFileCreate
+Name[da]=KDevelop filoprettelse
+Name[de]=Dateierstellungs-Komponente (KDevelop)
+Name[hi]=के-डेव-फ़ाइल-क्रिएट
+Name[nds]=KDevelop-Dateiopstellen
+Name[pl]=KDevTworzeniePliku
+Name[sk]=KDev vytvoriť súbor
+Name[sv]=KDevelop skapa filer
+Name[ta]=KDev உருவாக்கப்பட்ட கோப்பு
+Name[tg]=Сохткунандаи KDev
+Name[zh_TW]=KDevelop 檔案建立
+GenericName=FileCreate
+GenericName[ca]=Creació de fitxers
+GenericName[da]=Filoprettelse
+GenericName[de]=Dateierstellungs-Komponente
+GenericName[el]=ΔημιουργίαΑρχείου
+GenericName[es]=Creación de archivos
+GenericName[eu]=Fitxategi sorkuntza
+GenericName[fa]=ایجاد پرونده
+GenericName[hi]=फ़ाइल-क्रिएट
+GenericName[hu]=Fájl létrehozása
+GenericName[it]=Crea file
+GenericName[ja]=ファイル作成
+GenericName[ms]=CiptaFail
+GenericName[nds]=Dateiopstellen
+GenericName[ne]=फाइल सिर्जना
+GenericName[nl]=Bestand aanmaken
+GenericName[pl]=Tworzenie pliku
+GenericName[pt]=Criação de Ficheiros
+GenericName[ru]=Мастер создания файлов
+GenericName[sk]=Vytvoriť súbor
+GenericName[sl]=Ustvarjanje datotek
+GenericName[sr]=Направи фајл
+GenericName[sr@Latn]=Napravi fajl
+GenericName[sv]=Skapa filer
+GenericName[ta]=கோப்பு உருவாக்கம்
+GenericName[tg]=Устои бунёд кардани файлҳо
+GenericName[zh_CN]=文件创建
+GenericName[zh_TW]=檔案建立
+Icon=wizard
+ServiceTypes=KDevelop/CreateFile
+X-KDE-Library=libkdevfilecreate
+X-KDevelop-Version=5
+X-KDevelop-Properties=FileCreation
+X-KDevelop-Scope=Core
diff --git a/parts/filecreate/kdevpart_filecreate.rc b/parts/filecreate/kdevpart_filecreate.rc
new file mode 100644
index 00000000..401a1378
--- /dev/null
+++ b/parts/filecreate/kdevpart_filecreate.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="KDevFileCreate" library="libfilecreateplugin" version="3">
+<MenuBar>
+ <Menu name="file">
+ <Action name="file_new" group="new_merge" />
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="file_new" group="file_operations" />
+</ToolBar>
+</kpartplugin>
diff --git a/parts/filecreate/template-info.xml b/parts/filecreate/template-info.xml
new file mode 100644
index 00000000..bddd5d65
--- /dev/null
+++ b/parts/filecreate/template-info.xml
@@ -0,0 +1,181 @@
+<?xml version = '1.0'?>
+<kdevelop version="1">
+ <kdevfilecreate>
+ <sidetab active="no">
+ </sidetab>
+ <filetypes>
+ <type ext="" name="Blank File" create="template">
+ <descr>A new blank file.</descr>
+ </type>
+ <type ext="py" name="Python" create="template" icon="source_py">
+ <descr>A new empty Python source file.</descr>
+ </type>
+ <type ext="rb" name="Ruby" create="template" icon="template_source">
+ <descr>A new empty Ruby source file.</descr>
+ </type>
+ <type ext="rhtml" name="RHTML Source" create="template" icon="template_source">
+ <descr>A new empty rhtml source file.</descr>
+ </type>
+ <type ext="html.erb" name="HTML/ERB Source" create="template" icon="template_source">
+ <descr>A new empty html.erb source file.</descr>
+ </type>
+ <type ext="rxml" name="RXML Builder Template" create="template" icon="template_source">
+ <descr>A new empty rxml builder template source file.</descr>
+ </type>
+ <type ext="xml.builder" name="XML/Builder Template" create="template" icon="template_source">
+ <descr>A new empty rxml builder template source file.</descr>
+ </type>
+ <type ext="rjs" name="Ruby JavaScript" create="template" icon="template_source">
+ <descr>A new empty Ruby JavaScript template source file.</descr>
+ </type>
+ <type ext="js.rjs" name="Ruby/JavaScript" create="template" icon="template_source">
+ <descr>A new empty Ruby JavaScript template source file.</descr>
+ </type>
+ <type ext="css" name="Cascading Style Sheet" create="template" icon="template_source">
+ <descr>A new empty cascading style sheet source file.</descr>
+ </type>
+ <type ext="js" name="JavaScript" create="template" icon="template_source">
+ <descr>A new empty JavaScript source file.</descr>
+ </type>
+ <type ext="ui" name="Qt Designer" create="no" icon="widget_doc">
+ <descr>
+ </descr>
+ <subtype ref="widget" name="Qt3 Widget" icon="widget_doc">
+ <descr>A new widget.</descr>
+ </subtype>
+ <subtype ref="dialog" name="Qt3 Dialog" icon="widget_doc">
+ <descr>A new empty Dialog box.</descr>
+ </subtype>
+ <subtype ref="tabdialog" name="Qt3 Tab Dialog" icon="widget_doc">
+ <descr>A new empty Tab Dialog box.</descr>
+ </subtype>
+ <subtype ref="dialogr" name="Qt3 Dialog with Buttons (right)" icon="widget_doc">
+ <descr>A new Dialog box with buttons on the right.</descr>
+ </subtype>
+ <subtype ref="dialogb" name="Qt3 Dialog with Buttons (bottom)" icon="widget_doc">
+ <descr>A new Dialog box with buttons on the bottom.</descr>
+ </subtype>
+ <subtype ref="confdialog" name="Qt3 Configuration Dialog" icon="widget_doc">
+ <descr>A new Configuration Dialog box.</descr>
+ </subtype>
+ <subtype ref="wizard" name="Qt3 Wizard" icon="widget_doc">
+ <descr>A new empty Wizard dialog.</descr>
+ </subtype>
+ <subtype ref="mainwin" name="Qt3 Main Window" icon="widget_doc">
+ <descr>A new empty main window.</descr>
+ </subtype>
+ <subtype ref="widget-qt4" name="Qt4 Widget" icon="widget_doc">
+ <descr>A new Qt4 widget.</descr>
+ </subtype>
+ <subtype ref="dialog-qt4" name="Qt4 Dialog" icon="widget_doc">
+ <descr>A new empty Qt4 Dialog box.</descr>
+ </subtype>
+ <subtype ref="mainwin-qt4" name="Qt4 Main Window" icon="widget_doc">
+ <descr>A new empty Qt4 main window.</descr>
+ </subtype>
+ <subtype ref="dialogr-qt4" name="Qt4 Dialog with Buttons (right)" icon="widget_doc">
+ <descr>A new Qt4 Dialog box with buttons on the right.</descr>
+ </subtype>
+ <subtype ref="dialogb-qt4" name="Qt4 Dialog with Buttons (bottom)" icon="widget_doc">
+ <descr>A new Qt4 Dialog box with buttons on the bottom.</descr>
+ </subtype>
+ </type>
+ <type ext="qrc" name="Qt4 Resource" create="template" icon="template_source">
+ <descr>A new Qt4 Resource file.</descr>
+ </type>
+ <type ext="cpp" name="C++ Source" create="template" icon="source_cpp">
+ <descr>A new empty C++ file.</descr>
+ </type>
+ <type ext="c" name="C Source" create="template" icon="source_c">
+ <descr>A new empty C file.</descr>
+ </type>
+ <type ext="h" name="C/C++ Header" create="template" icon="source_h">
+ <descr>A new empty header file for C or C++.</descr>
+ </type>
+ <type ext="php" name="PHP" create="template" icon="php">
+ <descr>A new empty PHP source file.</descr>
+ </type>
+ <type ext="java" name="Java Source" create="template" icon="source_java">
+ <descr>A new empty Java source file.</descr>
+ </type>
+ <type ext="ads" name="Ada Spec" create="template" icon="source_ads">
+ <descr>A new empty Ada spec file.</descr>
+ </type>
+ <type ext="adb" name="Ada Body" create="template" icon="source_adb">
+ <descr>A new empty Ada body file.</descr>
+ </type>
+ <type ext="F" name="Fortran Source" create="template" icon="source_f">
+ <descr>A new empty Fortran source file.</descr>
+ </type>
+ <type ext="f" name="Preprocessed Fortran" create="template" icon="source_f">
+ <descr>A new empty preprocessed Fortran file.</descr>
+ </type>
+ <type ext="f77" name="Fortran77 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran77 source file.</descr>
+ </type>
+ <type ext="f90" name="Fortran90 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran90 source file.</descr>
+ </type>
+ <type ext="f95" name="Fortran95 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran95 source file.</descr>
+ </type>
+ <type ext="for" name="Preprocessed Fortran" create="template" icon="source_f">
+ <descr>A new empty preprocessed Fortran file.</descr>
+ </type>
+ <type ext="ftn" name="Fortran77 Source" create="template" icon="source_f">
+ <descr>A new empty Fortran77 source file.</descr>
+ </type>
+ <type ext="fpp" name="Fortran Source" create="template" icon="source_f">
+ <descr>A new empty Fortran source file.</descr>
+ </type>
+ <type ext="pl" name="Perl Script" create="template" icon="template_source">
+ <descr>A new Perl script.</descr>
+ </type>
+ <type ext="pm" name="Perl Module" create="template" icon="template_source">
+ <descr>A new perl module.</descr>
+ </type>
+ <type ext="pp" name="Pascal Source" create="no" icon="source_p">
+ <descr/>
+ <subtype ref="program" name="Pascal Program" icon="source_p">
+ <descr>A new pascal program.</descr>
+ </subtype>
+ <subtype ref="unit" name="Pascal Unit" icon="source_p">
+ <descr>A new pascal unit.</descr>
+ </subtype>
+ </type>
+ <type ext="pas" name="Pascal Source" create="no" icon="source_p">
+ <descr/>
+ <subtype ref="program" name="Pascal Program" icon="source_p">
+ <descr>A new pascal program.</descr>
+ </subtype>
+ <subtype ref="unit" name="Pascal Unit" icon="source_p">
+ <descr>A new pascal unit.</descr>
+ </subtype>
+ </type>
+ <type ext="dpr" name="Delphi Project" create="template" icon="source_p">
+ <descr>A new Delphi project.</descr>
+ </type>
+ <type ext="l" name="flex C Source" create="template" icon="source_l">
+ <descr>A new empty flex C source source file.</descr>
+ </type>
+ <type ext="ll" name="flex C++ Source" create="template" icon="source_l">
+ <descr>A new empty flex C++ source source file.</descr>
+ </type>
+ <type ext="y" name="bison C Source" create="template" icon="source_y">
+ <descr>A new empty bison C source source file.</descr>
+ </type>
+ <type ext="yy" name="bison C++ Source" create="template" icon="source_y">
+ <descr>A new empty bison C++ source source file.</descr>
+ </type>
+ <type ext="dox" name="Doxygen Documentation Page" create="template" icon="document">
+ <descr>A new empty Doxygen documentation page.</descr>
+ </type>
+ <type ext="hs" name="Haskell Source" create="template" icon="source_hs">
+ <descr>A new empty Haskell source file.</descr>
+ </type>
+ <type ext="ts" name="Qt Linguist Translation" create="template" icon="template_source">
+ <descr>A new empty Qt Linguist translation source file.</descr>
+ </type>
+ </filetypes>
+ </kdevfilecreate>
+</kdevelop>
diff --git a/parts/filelist/Makefile.am b/parts/filelist/Makefile.am
new file mode 100644
index 00000000..0d75e942
--- /dev/null
+++ b/parts/filelist/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfilelist.la
+libkdevfilelist_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfilelist_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfilelist_la_SOURCES = filelist_widget.cpp filelist_item.cpp \
+ projectviewprojectconfigbase.ui projectviewprojectconfig.cpp projectviewpart.cpp toolbarguibuilder.cpp \
+ projectviewconfigbase.ui projectviewconfig.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfilelist.desktop
+
+rcdir = $(kde_datadir)/kdevfilelist
+
+noinst_HEADERS = filelist_item.h filelist_widget.h projectviewprojectconfig.h \
+ projectviewpart.h toolbarguibuilder.h projectviewconfig.h fileinfo.h
+rc_DATA = kdevfilelist.rc
diff --git a/parts/filelist/README.dox b/parts/filelist/README.dox
new file mode 100644
index 00000000..cc2090a0
--- /dev/null
+++ b/parts/filelist/README.dox
@@ -0,0 +1,13 @@
+/** \class filelist
+This plugin provides a filelist selectview of the currently open files. This is quite handy
+when the tabbar isn't wide enough to show all open files.
+
+\feature Provides filestate feedback
+\feature Provides context menu for file operations
+
+\authors <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a>
+
+\maintainer <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a>
+
+
+*/
diff --git a/parts/filelist/fileinfo.h b/parts/filelist/fileinfo.h
new file mode 100644
index 00000000..0d4cb89f
--- /dev/null
+++ b/parts/filelist/fileinfo.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <kurl.h>
+
+struct FileInfo
+{
+ FileInfo() {url = KURL(); line = -1; col = -1; encoding = "";};
+ FileInfo(const KURL & _url, int _line = -1, int _col = -1, QString _encoding = "")
+ {url = _url; line = _line; col = _col; encoding = _encoding;};
+
+ bool operator==(const FileInfo & f) const {return (f.url == url) /*&& (f.line == line) && (f.col ==col)*/;};
+
+ KURL url;
+ int line;
+ int col;
+ QString encoding;
+};
+
+typedef QValueList<FileInfo> FileInfoList;
diff --git a/parts/filelist/filelist_item.cpp b/parts/filelist/filelist_item.cpp
new file mode 100644
index 00000000..d528cc2c
--- /dev/null
+++ b/parts/filelist/filelist_item.cpp
@@ -0,0 +1,104 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kiconloader.h>
+#include <qfontmetrics.h>
+#include <qfileinfo.h>
+
+#include "filelist_item.h"
+
+#include <kiconloader.h>
+#include <kfileitem.h>
+
+FileListItem * FileListItem::s_activeItem = 0;
+
+FileListItem::FileListItem( QListView * parent, KURL const & url, DocumentState state )
+ : QListViewItem( parent, url.fileName() ),
+ _url( url )
+
+{
+ KFileItem fileItem( KFileItem::Unknown, KFileItem::Unknown, _url );
+ _icon = fileItem.pixmap(KIcon::SizeSmall);
+ setState( state );
+}
+
+KURL FileListItem::url()
+{
+ return _url;
+}
+
+DocumentState FileListItem::state( )
+{
+ return _state;
+}
+
+void FileListItem::setState( DocumentState state )
+{
+ _state = state;
+
+ switch( state )
+ {
+ case Clean:
+ setPixmap( 0, _icon);
+// setPixmap( 0, 0L );
+ break;
+ case Modified:
+ setPixmap( 0, SmallIcon("filesave") );
+ break;
+ case Dirty:
+ setPixmap( 0, SmallIcon("revert") );
+ break;
+ case DirtyAndModified:
+ setPixmap( 0, SmallIcon("stop") );
+ break;
+ }
+}
+
+void FileListItem::setHeight( int )
+{
+ QListViewItem::setHeight( KIcon::SizeSmall > listView()->fontMetrics().height() ? KIcon::SizeSmall : listView()->fontMetrics().height() );
+}
+
+void FileListItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
+{
+ QColorGroup mcg = cg;
+
+ if ( isActive() )
+ {
+ mcg.setColor( QColorGroup::Base, Qt::yellow );
+ }
+
+ QListViewItem::paintCell( p, mcg, column, width, align );
+}
+
+bool FileListItem::isActive( )
+{
+ return ( s_activeItem == this );
+}
+
+//static
+void FileListItem::setActive( FileListItem * item )
+{
+ s_activeItem = item;
+}
+
+int FileListItem::compare( QListViewItem * i, int col, bool ascending ) const
+{
+ QFileInfo info1( key( col, ascending ) ); //this
+ QFileInfo info2( i->key( col, ascending ) ); //that
+ int fileComp = info1.fileName().compare( info2.fileName() );
+ if ( fileComp != 0 )
+ return fileComp;
+ else
+ return info1.extension().compare( info2.extension() );
+}
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/filelist/filelist_item.h b/parts/filelist/filelist_item.h
new file mode 100644
index 00000000..2b4019b8
--- /dev/null
+++ b/parts/filelist/filelist_item.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __FILELIST_ITEM_H__
+#define __FILELIST_ITEM_H__
+
+
+#include <qlistview.h>
+#include <qpixmap.h>
+
+#include <kurl.h>
+
+#include <kdevpartcontroller.h>
+
+class FileListItem : public QListViewItem
+{
+public:
+ FileListItem( QListView * parent, KURL const & url, DocumentState = Clean );
+
+ KURL url();
+
+ DocumentState state();
+ void setState( DocumentState );
+
+ bool isActive();
+ static void setActive( FileListItem * item );
+
+ virtual int compare( QListViewItem * i, int col, bool ascending ) const;
+private:
+ virtual void setHeight( int ); // override of QListViewItem::setHeight()
+ virtual void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align ); // override of QListViewItem::paintCell()
+
+ KURL _url;
+ DocumentState _state;
+ QPixmap _icon;
+
+ static FileListItem * s_activeItem;
+
+};
+
+
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/filelist/filelist_widget.cpp b/parts/filelist/filelist_widget.cpp
new file mode 100644
index 00000000..2ef03968
--- /dev/null
+++ b/parts/filelist/filelist_widget.cpp
@@ -0,0 +1,300 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qheader.h>
+#include <qpixmap.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kpopupmenu.h>
+
+#include <kdevcore.h>
+#include <kdevpartcontroller.h>
+
+#include "projectviewpart.h"
+#include "filelist_widget.h"
+#include "filelist_item.h"
+
+
+/**
+ *
+ * @param part
+ * @return
+ */
+FileListWidget::FileListWidget(ProjectviewPart *part, QWidget *parent)
+ : KListView(parent), QToolTip( viewport() ), _part( part )
+{
+ addColumn( "" );
+ header()->hide();
+ setRootIsDecorated( false );
+ setResizeMode( QListView::LastColumn );
+ setAllColumnsShowFocus( true );
+
+ setSelectionMode( QListView::Extended );
+
+// connect( _part->partController(), SIGNAL( partAdded(KParts::Part*) ), this, SLOT(partAdded(KParts::Part*)) );
+// connect( _part->partController(), SIGNAL( partRemoved(KParts::Part*) ), this, SLOT(partRemoved()) );
+ connect( _part->partController(), SIGNAL( partAdded(KParts::Part*) ), this, SLOT(startRefreshTimer()) );
+ connect( _part->partController(), SIGNAL( partRemoved(KParts::Part*) ), this, SLOT(startRefreshTimer()) );
+ connect( _part->partController(), SIGNAL( activePartChanged(KParts::Part*) ), this, SLOT( activePartChanged(KParts::Part* )) );
+
+ connect( this, SIGNAL( executed( QListViewItem * ) ), this, SLOT( itemClicked( QListViewItem * ) ) );
+ connect( this, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( itemClicked( QListViewItem * ) ) );
+
+ connect( this, SIGNAL( contextMenuRequested ( QListViewItem *, const QPoint & , int ) ),
+ this, SLOT( popupMenu(QListViewItem *, const QPoint & , int ) ) );
+
+ connect( _part->partController(), SIGNAL(documentChangedState(const KURL &, DocumentState)),
+ this, SLOT(documentChangedState(const KURL&, DocumentState )) );
+
+ connect( _part->partController(), SIGNAL(partURLChanged(KParts::ReadOnlyPart * )), this, SLOT(refreshFileList()) );
+
+ setItemMargin(10);
+
+ connect( &m_refreshTimer, SIGNAL(timeout()), this, SLOT(refreshFileList()) );
+
+ startRefreshTimer();
+}
+
+
+FileListWidget::~FileListWidget()
+{}
+
+void FileListWidget::startRefreshTimer( )
+{
+ m_refreshTimer.start( 100, true );
+}
+
+void FileListWidget::maybeTip( QPoint const & p )
+{
+ FileListItem * item = static_cast<FileListItem*>( itemAt( p ) );
+ QRect r = itemRect( item );
+
+ if ( item && r.isValid() )
+ {
+ const QPixmap * pixmap = item->pixmap(0);
+ if ( pixmap && ( p.x() <= pixmap->width() ) )
+ {
+ QString message;
+ switch( item->state() )
+ {
+ case Modified:
+ message = i18n("This file has unsaved changes.");
+ break;
+ case Dirty:
+ message = i18n("This file has changed on disk since it was last saved.");
+ break;
+ case DirtyAndModified:
+ message = i18n("Conflict: this file has changed on disk and has unsaved changes.");
+ break;
+ default:
+ message = item->url().prettyURL();
+ }
+
+ tip( r, message );
+ }
+ else
+ {
+ tip( r, item->url().prettyURL() );
+ }
+ }
+}
+
+FileListItem * FileListWidget::itemForURL( KURL const & url )
+{
+ FileListItem * item = static_cast<FileListItem*>( firstChild() );
+ while ( item )
+ {
+ if ( item->url() == url )
+ {
+ return item;
+ }
+ item = static_cast<FileListItem*>( item->nextSibling() );
+ }
+ return 0L;
+}
+
+void FileListWidget::refreshFileList( )
+{
+ QStringList selections = storeSelections();
+ int scrollbarPos = verticalScrollBar()->value();
+
+ KListView::clear();
+
+ KURL::List list = _part->partController()->openURLs();
+ QValueListIterator<KURL> it = list.begin();
+ while ( it != list.end() )
+ {
+ FileListItem * item = new FileListItem( this, *it );
+ item->setState( _part->partController()->documentState( *it ) );
+ ++it;
+ }
+
+ restoreSelections( selections );
+
+ if ( selections.isEmpty() && firstChild() )
+ {
+ firstChild()->setSelected( true );
+ }
+
+ verticalScrollBar()->setValue( scrollbarPos );
+
+ activePartChanged( _part->partController()->activePart() );
+}
+
+/*
+void FileListWidget::partAdded( KParts::Part * part )
+{
+ KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart*>( part );
+ if ( ro_part )
+ {
+ new FileListItem( this, ro_part->url() );
+ }
+
+ activePartChanged( _part->partController()->activePart() );
+}
+
+void FileListWidget::partRemoved()
+{
+ FileListItem * item = static_cast<FileListItem*>( firstChild() );
+ while ( item )
+ {
+ if ( ! _part->partController()->partForURL( item->url() ) )
+ {
+ delete item;
+ break;
+ }
+ item = static_cast<FileListItem*>( item->nextSibling() );
+ }
+
+ activePartChanged( _part->partController()->activePart() );
+}
+*/
+
+void FileListWidget::itemClicked( QListViewItem * item )
+{
+ if ( !item ) return;
+
+ FileListItem * listItem = static_cast<FileListItem*>( item );
+ _part->partController()->editDocument( listItem->url() );
+}
+
+void FileListWidget::activePartChanged( KParts::Part * part )
+{
+ KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart*>( part );
+ if ( ro_part )
+ {
+ FileListItem * item = static_cast<FileListItem*>( firstChild() );
+ while ( item )
+ {
+ if ( item->url() == ro_part->url() )
+ {
+ FileListItem::setActive( item );
+ break;
+ }
+ item = static_cast<FileListItem*>( item->nextSibling() );
+ }
+ }
+ repaintContents();
+}
+
+void FileListWidget::documentChangedState( const KURL & url, DocumentState state )
+{
+ FileListItem * item = itemForURL( url );
+ if ( item )
+ {
+ item->setState( state );
+ }
+}
+
+void FileListWidget::popupMenu( QListViewItem * item, const QPoint & p, int )
+{
+ if ( item )
+ {
+ KPopupMenu popup;
+ popup.insertTitle( i18n("File List") );
+ popup.insertItem( i18n("Close Selected"), this, SLOT(closeSelectedFiles()) );
+ popup.insertItem( i18n("Save Selected"), this, SLOT(saveSelectedFiles()) );
+ popup.insertItem( i18n("Reload Selected"), this, SLOT(reloadSelectedFiles()) );
+
+ FileContext context( getSelectedURLs() );
+ _part->core()->fillContextMenu( &popup, &context );
+
+ popup.exec(p);
+ }
+}
+
+KURL::List FileListWidget::getSelectedURLs( )
+{
+ KURL::List list;
+ FileListItem * item = static_cast<FileListItem*>( firstChild() );
+ while ( item )
+ {
+ if ( item->isSelected() )
+ {
+ list << item->url();
+ }
+ item = static_cast<FileListItem*>( item->nextSibling() );
+ }
+ return list;
+}
+
+void FileListWidget::closeSelectedFiles( )
+{
+ _part->partController()->closeFiles( getSelectedURLs() );
+}
+
+void FileListWidget::saveSelectedFiles( )
+{
+ _part->partController()->saveFiles( getSelectedURLs() );
+}
+
+void FileListWidget::reloadSelectedFiles( )
+{
+ _part->partController()->revertFiles( getSelectedURLs() );
+}
+
+QStringList FileListWidget::storeSelections()
+{
+ QStringList list;
+ QListViewItem * item = firstChild();
+ while ( item )
+ {
+ if ( item->isSelected() )
+ {
+ list << item->text(0);
+ }
+ item = item->nextSibling();
+ }
+ return list;
+}
+
+void FileListWidget::restoreSelections(const QStringList & list)
+{
+ QListViewItem * item = firstChild();
+ while ( item )
+ {
+ if ( list.contains( item->text(0) ) )
+ {
+ item->setSelected( true );
+ }
+ item = item->nextSibling();
+ }
+}
+
+#include "filelist_widget.moc"
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/filelist/filelist_widget.h b/parts/filelist/filelist_widget.h
new file mode 100644
index 00000000..5895103b
--- /dev/null
+++ b/parts/filelist/filelist_widget.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2004 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __FILELIST_WIDGET_H__
+#define __FILELIST_WIDGET_H__
+
+
+#include <klistview.h>
+#include <kurl.h>
+#include <kdevpartcontroller.h> // for DocumentState
+
+#include <qstring.h>
+#include <qtooltip.h>
+#include <qtimer.h>
+
+#include "projectviewpart.h"
+
+class KDevProject;
+class FileListItem;
+
+namespace KParts { class Part; }
+
+class FileListWidget : public KListView, public QToolTip
+{
+ Q_OBJECT
+
+public:
+
+ FileListWidget(ProjectviewPart *part, QWidget *parent=0);
+ ~FileListWidget();
+
+protected:
+ void maybeTip( QPoint const & );
+
+private slots:
+// void partAdded(KParts::Part*);
+// void partRemoved();
+ void activePartChanged(KParts::Part*);
+ void itemClicked( QListViewItem * );
+ void popupMenu( QListViewItem * , const QPoint & , int );
+ void closeSelectedFiles();
+ void saveSelectedFiles();
+ void reloadSelectedFiles();
+ void documentChangedState( const KURL &, DocumentState );
+ void refreshFileList();
+ void startRefreshTimer();
+ QStringList storeSelections();
+ void restoreSelections( const QStringList & list );
+
+private:
+ KURL::List getSelectedURLs();
+ FileListItem * itemForURL( KURL const & url );
+
+ QTimer m_refreshTimer;
+ ProjectviewPart * _part;
+
+};
+
+
+#endif
+
+// kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
diff --git a/parts/filelist/kdevfilelist.desktop b/parts/filelist/kdevfilelist.desktop
new file mode 100644
index 00000000..c3d097e4
--- /dev/null
+++ b/parts/filelist/kdevfilelist.desktop
@@ -0,0 +1,76 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides a list of all currently open files. (Handy when the tab bar is not quite wide enough.)
+Comment[ca]=Proporciona una llista de tots els fitxers oberts actualment. (Útil quan la barra de pestanyes no és suficientment ample)
+Comment[da]=Sørger for en liste over alle filer der er åbne. (Praktisk når tab-linjen ikke er helt bred nok.)
+Comment[de]=Stellt eine Liste aller offenen Dateien bereit.
+Comment[el]=Προσφέρει μια λίστα των τρέχων ανοιγμένων αρχείων. (Χρήσιμο όταν η γραμμή καρτελών δεν είναι αρκετά πλατιά.)
+Comment[es]=Proporciona una lista de los archivos abiertos actualmente (útil cuando la barra de pestañas no es lo suficientemente ancha).
+Comment[et]=Näitab kõiki parajasti avatud faile (mugav, kui kaardiriba ei ole piisavalt lai).
+Comment[eu]=Uneko irekitako fitxategien zerrenda eskeintzen du. (Erabilgarria fitxa-barra behar den bezain zabala ez bada)
+Comment[fa]=فهرستی از همۀ پرونده‌های باز جاری را فراهم می‌کند. )دستی هنگامی که میله ابزار پهنای کافی نداشته باشد.(
+Comment[fr]=Fournit une liste de tous les fichiers actuellement ouverts. (Pratique lorsque la barre d'onglets n'est plus assez large.)
+Comment[gl]=Proporciona unha lista de tódolos ficheiros abertos actualmente. (Útil cando a barra de pestañas non é suficientemente ancha.)
+Comment[hu]=Kilistázza a nyitott fájlokat. (Jól jöhet, ha a lapozósáv nem elég széles.)
+Comment[it]=Fornisce una lista di tutti i file aperti correntemente. (Utile quando la barra delle schede non è sufficientemente larga.)
+Comment[ja]=現在開かれているファイルのリストを提供します。(タブバーが十分広くない場合に便利です)
+Comment[ms]=Menyediakan senarai semua fail yang sedang dibuka. (Berguna apabila bar tab tidak cukup lebar.)
+Comment[nds]=Stellt en List vun all apen Dateien praat. (Goot, wenn de Paneelbalken nich wiet noog is.)
+Comment[ne]=हालै खुला फाइलको सूची प्रदान गर्दछ (ट्याब बार पर्याप्त चौडा नहुदा सजिलो हुन्छ)
+Comment[nl]=Geeft een lijst van alle open bestanden. (Handig als de tabbalk niet breed genoeg is.)
+Comment[pl]=Pokazuje listę obecnie otwartych plików (przydaje się, gdy pasek kart nie mieści wszystkich)
+Comment[pt]=Fornece uma lista de todos os ficheiros actualmente aberto. (Útil quando a barra de página não é suficientemente larga.)
+Comment[pt_BR]=Fornece uma lista de todos os arquivos atualmente abertos (acessível quando a barra de abas não for larga o suficiente).
+Comment[ru]=Список открытых в данных момент файлов (полезно, когда они не помещаются на панели вкладок).
+Comment[sk]=Poskytne zoznam všetkých aktuálne otvorených súborov. (Užitočné keď panel kariet nie je dostatočne široký.)
+Comment[sr]=Даје листу свих отворених фајлова. (Згодно кад трака са језичцима није довољно дугачка.)
+Comment[sr@Latn]=Daje listu svih otvorenih fajlova. (Zgodno kad traka sa jezičcima nije dovoljno dugačka.)
+Comment[sv]=Tillhandahåller en lista av alla för närvarande öppna filer. (Praktiskt när flikraden inte är riktigt bred nog.)
+Comment[ta]=தற்போது திறக்கப்பட்ட கோப்புகளின் பட்டியலை வழங்குகிறது. (தத்தல் போதுமான வசதியை வழங்க இயலாத பொழுது)
+Comment[tg]=Рӯйхати кушодашудагиҳои ҳозир будаи файлҳо (вақте ки онҳо дар панелмонӣ омехта намешаванд, фоидаовар аст.)
+Comment[tr]=Bütün açık dosyaların bir listesini sunar. (Sekme çubuğu yeteri kadar geniş olmadığında işe yarar)
+Comment[zh_CN]=提供目前已打开全部文件的列表。(当标签栏不够宽时非常实用。)
+Comment[zh_TW]=提供目前開啟檔案的列表。
+Name=KDevfilelist
+Name[da]=KDevelop filliste
+Name[nds]=KDevelop-Dateilist
+Name[pt_BR]=Lista de arq. do KDev
+Name[sk]=KDev zoznam súborov
+Name[sv]=KDevelop fillista
+Name[ta]=KDev கோப்புக்காட்சி
+Name[tg]=Рӯйхати файли KDev
+Name[zh_TW]=KDevelop 檔案列表
+GenericName=FileList
+GenericName[br]=Roll restr
+GenericName[da]=Filliste
+GenericName[de]=Dateiliste
+GenericName[el]=ΛίσταΑρχείων
+GenericName[eu]=Fitxategi zerrenda
+GenericName[fa]=فهرست پرونده
+GenericName[hu]=Fájllista
+GenericName[it]=ListaFile
+GenericName[ja]=ファイルリスト
+GenericName[ms]=SenaraiFail
+GenericName[nds]=Dateilist
+GenericName[ne]=फाइल सूची
+GenericName[nl]=Bestandenlijst
+GenericName[pl]=Lista plików
+GenericName[pt]=Lista de Ficheiros
+GenericName[pt_BR]=Lista de Arquivos
+GenericName[ru]=Список файлов
+GenericName[sk]=Zoznam súborov
+GenericName[sl]=Seznam datotek
+GenericName[sr]=Листа фајлова
+GenericName[sr@Latn]=Lista fajlova
+GenericName[sv]=Fillista
+GenericName[ta]=கோப்புப் பட்டியல்
+GenericName[tg]=Рӯйхати файлҳо
+GenericName[zh_CN]=文件列表
+GenericName[zh_TW]=檔案列表
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Global
+X-KDE-Library=libkdevfilelist
+X-KDevelop-Version=5
+X-KDevelop-Properties=OpenFileNavigation
diff --git a/parts/filelist/kdevfilelist.rc b/parts/filelist/kdevfilelist.rc
new file mode 100644
index 00000000..5ab5de7c
--- /dev/null
+++ b/parts/filelist/kdevfilelist.rc
@@ -0,0 +1,24 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="filelist" version="3">
+<MenuBar>
+ <Menu name="view" >
+ <text>View</text>
+ <Separator/>
+ <Menu name="viewsession" >
+ <text>View Sessions</text>
+ <Action name="viewsession_new" />
+ <Action name="viewsession_open" />
+ <Action name="viewsession_save" />
+ <Action name="viewsession_delete" />
+ </Menu>
+ <Separator/>
+ </Menu>
+</MenuBar>
+<ToolBar name="viewsession_toolbar" >
+ <text>View Sessions Toolbar</text>
+ <Action name="viewsession_new" />
+ <Action name="viewsession_open" />
+ <Action name="viewsession_save" />
+ <Action name="viewsession_deletecurrent" />
+</ToolBar>
+</kpartplugin>
diff --git a/parts/filelist/projectviewconfig.cpp b/parts/filelist/projectviewconfig.cpp
new file mode 100644
index 00000000..fba2c6ca
--- /dev/null
+++ b/parts/filelist/projectviewconfig.cpp
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens.herden@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include "projectviewconfig.h"
+
+#include <qcheckbox.h>
+
+#include <kconfig.h>
+#include <kapplication.h>
+
+
+ProjectviewConfig::ProjectviewConfig(QWidget *parent, const char *name)
+ : ProjectviewConfigBase(parent, name)
+{
+ KConfig * config = kapp->config();
+ config->setGroup("File List Plugin");
+ inToolview->setChecked(config->readBoolEntry("ToolbarInToolview", true));
+ onlyProject->setChecked(config->readBoolEntry("OnlyProjectFiles", false));
+ closeOpenFiles->setChecked(config->readBoolEntry("CloseOpenFiles", true));
+}
+
+void ProjectviewConfig::accept()
+{
+ KConfig * config = kapp->config();
+ config->setGroup("File List Plugin");
+ config->writeEntry("ToolbarInToolview", inToolview->isChecked());
+ config->writeEntry("OnlyProjectFiles", onlyProject->isChecked());
+ config->writeEntry("CloseOpenFiles", closeOpenFiles->isChecked());
+}
+
+#include "projectviewconfig.moc"
diff --git a/parts/filelist/projectviewconfig.h b/parts/filelist/projectviewconfig.h
new file mode 100644
index 00000000..64cffd10
--- /dev/null
+++ b/parts/filelist/projectviewconfig.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens.herden@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef PROJECTVIEW_CONFIG_H
+#define PROJECTVIEW_CONFIG_H
+
+#include "projectviewconfigbase.h"
+
+
+class ProjectviewConfig: public ProjectviewConfigBase
+{
+ Q_OBJECT
+public:
+ ProjectviewConfig(QWidget *parent = 0, const char *name = 0);
+
+public slots:
+ void accept();
+
+};
+
+#endif
diff --git a/parts/filelist/projectviewconfigbase.ui b/parts/filelist/projectviewconfigbase.ui
new file mode 100644
index 00000000..7a0241db
--- /dev/null
+++ b/parts/filelist/projectviewconfigbase.ui
@@ -0,0 +1,93 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ProjectviewConfigBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ProjectviewConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File List</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>inToolview</cstring>
+ </property>
+ <property name="text">
+ <string>Display toolbar in toolview (note: change needs a restart)</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Uncheck this if you want the toolbar together with all other toolbars. You can disable it then</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Uncheck this if you want the toolbar together with all other toolbars. You can disable it then</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>onlyProject</cstring>
+ </property>
+ <property name="text">
+ <string>Only save project files in a session</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Check this if you want to ignore files that are not part of the project</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Check this if you want to ignore files that are not part of the project</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>closeOpenFiles</cstring>
+ </property>
+ <property name="text">
+ <string>Close all open files before opening a session</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Check this if you want the currently open files closed before opening a session</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Check this if you want the currently open files closed before opening a session</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>61</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/filelist/projectviewpart.cpp b/parts/filelist/projectviewpart.cpp
new file mode 100644
index 00000000..56fc02c3
--- /dev/null
+++ b/parts/filelist/projectviewpart.cpp
@@ -0,0 +1,585 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "projectviewprojectconfig.h"
+#include "projectviewconfig.h"
+#include "projectviewpart.h"
+#include "filelist_widget.h"
+#include "toolbarguibuilder.h"
+
+#include <qtimer.h>
+#include <qpopupmenu.h>
+#include <qwhatsthis.h>
+#include <qvaluelist.h>
+#include <qmap.h>
+#include <qdir.h>
+#include <qdom.h>
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qpoint.h>
+#include <qlayout.h>
+
+#include <kmainwindow.h>
+#include <kinputdialog.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/encodinginterface.h>
+#include <kparts/part.h>
+#include <kxmlguibuilder.h>
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kapplication.h>
+
+#include <kdevplugininfo.h>
+#include <kdevgenericfactory.h>
+#include <kdevpartcontroller.h>
+#include <kdevproject.h>
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <configwidgetproxy.h>
+
+
+
+typedef KDevGenericFactory<ProjectviewPart> projectviewFactory;
+KDevPluginInfo data("kdevfilelist");
+K_EXPORT_COMPONENT_FACTORY(libkdevfilelist, projectviewFactory(data))
+
+#define GLOBALDOC_OPTIONS 1
+#define PROJECTDOC_OPTIONS 2
+
+ProjectviewPart::ProjectviewPart(QObject *parent, const char *name, const QStringList &/*args*/)
+ : KDevPlugin(&data, parent, name ? name : "FileListPart")
+{
+ setInstance(projectviewFactory::instance());
+ setXMLFile("kdevfilelist.rc");
+ setupActions();
+
+ m_configProxy = new ConfigWidgetProxy(core());
+ m_configProxy->createGlobalConfigPage(i18n("File List"), GLOBALDOC_OPTIONS, info()->icon());
+ m_configProxy->createProjectConfigPage(i18n("File List"), PROJECTDOC_OPTIONS, info()->icon());
+
+ connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int)),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int)));
+
+ connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)));
+
+ connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()));
+ connect(core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()));
+
+ KConfig * config = kapp->config();
+ config->setGroup("File List Plugin");
+ if (config->readBoolEntry("ToolbarInToolview", true))
+ {
+ m_toolbarWidget = new QVBox(0, "toolbarContainer");
+ m_toolbarWidget->setHidden(true);
+ m_guibuilder = new ToolbarGUIBuilder(m_toolbarWidget, mainWindow()->main());
+ setClientBuilder(m_guibuilder);
+ }
+ m_restored = false;
+ QTimer::singleShot(0, this, SLOT(init()));
+}
+
+ProjectviewPart::~ProjectviewPart()
+{
+ delete m_configProxy;
+ delete m_guibuilder;
+ if ( m_widget ) {
+ mainWindow()->removeView( m_widget );
+ delete m_widget; // deletes the children as well
+ }
+}
+
+void ProjectviewPart::restorePartialProjectSession(const QDomElement * el)
+{
+ m_projectViews.clear(); // remove the global views
+ m_restored = true;
+ if (!el)
+ {
+ return;
+ }
+ // get the base of the project
+ QString urlStr = project()->projectDirectory();
+ if (KURL::isRelativeURL(urlStr))
+ {
+ m_projectBase.setProtocol("file");
+ m_projectBase.setPath(urlStr);
+ } else
+ {
+ m_projectBase = KURL::fromPathOrURL(urlStr);
+ }
+ m_projectBase.adjustPath(+1); // just in case
+
+ // read all the views
+ QDomNodeList domList = el->elementsByTagName("projectview");
+
+ uint len = domList.length();
+ for (uint i = 0; i < len; ++i)
+ {
+ const QDomElement viewEl = domList.item(i).toElement();
+ if (viewEl.isNull())
+ {
+ continue;
+ }
+ FileInfoList urlList;
+ QDomNodeList fileList = viewEl.elementsByTagName("file");
+
+ uint len2 = fileList.length();
+ for (uint i2 = 0; i2 < len2; ++i2)
+ {
+ const QDomElement fileEl = fileList.item(i2).toElement();
+ if (!fileEl.isNull())
+ {
+ bool ok;
+ int line = -1;
+ QString attr = fileEl.attribute("line");
+ if (! attr.isNull())
+ {
+ line = attr.toInt(&ok);
+ if (!ok)
+ line = -1;
+ }
+ int col = -1;
+ attr = fileEl.attribute("col");
+ if (! attr.isNull())
+ {
+ col = attr.toInt(&ok);
+ if (!ok)
+ col = -1;
+ }
+ QString encoding = "";
+ attr = fileEl.attribute("encoding");
+ if (! attr.isNull())
+ {
+ encoding = attr;
+ }
+ QString urlStr = fileEl.attribute("url");
+ if (KURL::isRelativeURL(urlStr))
+ {
+ KURL url = m_projectBase;
+ url.addPath(urlStr);
+ urlList.append(FileInfo(url, line, col, encoding));
+ } else
+ urlList.append(FileInfo(KURL::fromPathOrURL(urlStr), line, col, encoding));
+ }
+ }
+ m_projectViews.insert(viewEl.attribute("name"), urlList);
+ }
+ // read default view
+ domList = el->elementsByTagName("defaultview");
+ if (domList.length() > 0)
+ {
+ m_defaultProjectView = domList.item(0).toElement().attribute("name");
+ if (!m_defaultProjectView.isEmpty())
+ {
+ slotOpenProjectView(m_defaultProjectView);
+ }
+ } else
+ {
+ m_defaultProjectView = "";
+ }
+}
+
+void ProjectviewPart::savePartialProjectSession(QDomElement * el)
+{
+ if (!el || m_projectViews.empty())
+ {
+ return;
+ }
+ QDomDocument domDoc = el->ownerDocument();
+ if (domDoc.isNull())
+ {
+ return;
+ }
+ // write all views
+ ViewMap::ConstIterator it;
+ for (it = m_projectViews.constBegin(); it != m_projectViews.constEnd(); ++it)
+ {
+ // we create the view even if there is no file inside, might be wanted by the user
+ QDomElement viewEl = domDoc.createElement("projectview");
+ viewEl.setAttribute("name", it.key());
+ el->appendChild(viewEl);
+ for (FileInfoList::ConstIterator it2 = it.data().constBegin(); it2 != it.data().constEnd(); ++it2)
+ {
+ QDomElement urlEl = domDoc.createElement("file");
+
+ if (m_projectBase.isParentOf((*it2).url))
+ urlEl.setAttribute("url", KURL::relativeURL(m_projectBase, (*it2).url));
+ else
+ urlEl.setAttribute("url", (*it2).url.url());
+ urlEl.setAttribute("line", (*it2).line);
+ urlEl.setAttribute("col", (*it2).col);
+ urlEl.setAttribute("encoding", (*it2).encoding);
+ viewEl.appendChild(urlEl);
+ }
+ }
+ // write the default view
+ QDomElement defaultEl = domDoc.createElement("defaultview");
+ defaultEl.setAttribute("name", m_defaultProjectView);
+ el->appendChild(defaultEl);
+}
+
+
+void ProjectviewPart::init()
+{
+ // delayed initialization stuff goes here
+
+ // create the toolview
+ m_widget = new QWidget(0, "filelist widget");
+ m_widget->setIcon( SmallIcon(info()->icon()) );
+ m_widget->setCaption(i18n("File List"));
+
+ QBoxLayout * l = new QVBoxLayout(m_widget);
+
+ // create the toolbar if needed
+ if (m_guibuilder)
+ {
+ m_toolbarWidget->reparent(m_widget, QPoint(0, 0), true);
+ l->addWidget(m_toolbarWidget);
+ QWhatsThis::add(m_toolbarWidget, i18n("<b>View Session Toolbar</b><p>This allows to create and work with view sessions. A view session is a set of open documents.</p>"));
+ }
+
+ // create the listview
+ QWidget * fileListWidget = new FileListWidget(this, m_widget);
+ fileListWidget->setCaption(i18n("File List"));
+ QWhatsThis::add(fileListWidget, i18n("<b>File List</b><p>This is the list of opened files.</p>"));
+ l->addWidget(fileListWidget);
+ m_widget->setFocusProxy(fileListWidget);
+
+ mainWindow()->embedSelectView(m_widget, i18n("File List"), i18n("Open files"));
+
+ if (!project())
+ readConfig();
+}
+
+void ProjectviewPart::setupActions()
+{
+ m_openPrjViewAction = new KSelectAction(i18n("Open Session..."), 0, actionCollection(), "viewsession_open");
+
+ connect(m_openPrjViewAction, SIGNAL(activated(const QString &)), this, SLOT(slotOpenProjectView(const QString &)));
+
+ m_openPrjViewAction->setToolTip(i18n("Open Session"));
+
+ m_savePrjViewAction = new KAction(i18n("Save Session"), "filesave", 0, this, SLOT(slotSaveProjectView()), actionCollection(), "viewsession_save");
+
+ m_newPrjViewAction = new KAction(i18n("New Session..."), "filenew", 0, this, SLOT(slotSaveAsProjectView()), actionCollection(), "viewsession_new");
+
+ m_deletePrjViewAction = new KSelectAction(i18n("Delete Session"), "editdelete", 0, actionCollection(), "viewsession_delete");
+
+ connect(m_deletePrjViewAction, SIGNAL(activated(const QString &)), this, SLOT(slotDeleteProjectView(const QString &)));
+
+ m_deletePrjViewAction->setToolTip(i18n("Delete Session"));
+
+ m_deleteCurrentPrjViewAction = new KAction(i18n("Delete Session"), "editdelete", 0, this, SLOT(slotDeleteProjectViewCurent()), actionCollection(), "viewsession_deletecurrent");
+
+ m_deleteCurrentPrjViewAction->setToolTip(i18n("Delete Session"));
+
+ adjustViewActions();
+}
+
+void ProjectviewPart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo)
+{
+// create configuraton dialogs here
+ switch (pageNo)
+ {
+ case PROJECTDOC_OPTIONS:
+ {
+ ProjectviewProjectConfig *w = new ProjectviewProjectConfig(this, page, "project config");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ break;
+ }
+ case GLOBALDOC_OPTIONS:
+ {
+ ProjectviewConfig *w = new ProjectviewConfig(page, "global config");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ break;
+ }
+ }
+}
+
+void ProjectviewPart::contextMenu(QPopupMenu */*popup*/, const Context */*context*/)
+{
+// put actions into the context menu here
+// if (context->hasType(Context::EditorContext))
+// {
+// // editor context menu
+// const EditorContext *econtext = static_cast<const EditorContext*>(context);
+//
+// // use context and plug actions here
+// // action->plug(popup);
+//
+// // or create menu items on the fly
+// // int id = -1;
+// // id = popup->insertItem(i18n("Do Something Here"),
+// // this, SLOT(doSomething()));
+// // popup->setWhatsThis(id, i18n("<b>Do something here</b><p>Describe here what does this action do."
+// }
+// else if (context->hasType(Context::FileContext))
+// {
+// // file context menu
+// const FileContext *fcontext = static_cast<const FileContext*>(context);
+//
+// //use context and plug actions here
+// }
+// else if (context->hasType(Context::ProjectModelItemContext))
+// {
+// // project tree context menu
+// const ProjectModelItemContext *pcontext = static_cast<const ProjectModelItemContext*>(context);
+//
+// // use context and plug actions here
+// }
+// else if (context->hasType(Context::CodeModelItemContext))
+// {
+// // class tree context menu
+// const CodeModelItemContext *mcontext = static_cast<const CodeModelItemContext*>(context);
+//
+// // use context and plug actions here
+// }
+// else if (context->hasType(Context::DocumentationContext))
+// {
+// // documentation viewer context menu
+// const DocumentationContext *dcontext = static_cast<const DocumentationContext*>(context);
+//
+// // use context and plug actions here
+// }
+}
+
+void ProjectviewPart::projectOpened()
+{
+ if ( !m_restored )
+ m_projectViews.clear(); // remove the global views
+ adjustViewActions();
+ m_restored = false;
+}
+
+void ProjectviewPart::projectClosed()
+{
+ m_projectBase = KURL();
+ m_defaultProjectView = "";
+ readConfig(); // read the global project views
+}
+
+void ProjectviewPart::slotOpenProjectView(const QString &view)
+{
+ KConfig * config = kapp->config();
+ config->setGroup("File List Plugin");
+ bool onlyProject = config->readBoolEntry("OnlyProjectFiles", false);
+ bool closeOpenFiles = config->readBoolEntry("CloseOpenFiles", true);
+
+ m_currentProjectView = view;
+
+ if (m_projectViews.contains(view) > 0)
+ {
+ FileInfoList viewUrls = m_projectViews[view];
+
+ if (closeOpenFiles)
+ {
+ // we close everything that is not part of the project view
+ KURL::List urlsToClose = partController()->openURLs();
+ for (KURL::List::Iterator it = urlsToClose.begin(); it != urlsToClose.end(); ++it)
+ {
+ // it is in the list of wanted files and do we want it at all
+ if ((viewUrls.contains(*it) > 0) && (!onlyProject || !project() || project()->isProjectFile((*it).path()) ))
+ {
+ viewUrls.remove(*it); // don't open if it is open already
+ it = urlsToClose.remove(it);
+ --it; // do not skip one
+ }
+ }
+ if (!urlsToClose.empty())
+ {
+ partController()->closeFiles(urlsToClose);
+ }
+ }
+ // we open what still needs to get opened
+ FileInfoList::const_iterator viewIt;
+ for (viewIt = viewUrls.begin(); viewIt != viewUrls.end(); ++viewIt)
+ {
+ if (!onlyProject || !project() || project()->isProjectFile((*viewIt).url.path()))
+ {
+ partController()->setEncoding( (*viewIt).encoding );
+ partController()->editDocument((*viewIt).url, (*viewIt).line, (*viewIt).col);
+ }
+ }
+ }
+ adjustViewActions();
+}
+
+
+void ProjectviewPart::slotSaveProjectView()
+{
+ slotSaveAsProjectView(m_currentProjectView.isEmpty());
+}
+
+
+void ProjectviewPart::adjustViewActions()
+{
+ QStringList viewList = getViewList();
+
+ m_openPrjViewAction->clear();
+ m_openPrjViewAction->setItems(viewList);
+ int i = viewList.findIndex(m_currentProjectView);
+ if (i > -1)
+ {
+ m_openPrjViewAction->setCurrentItem(i);
+ }
+ m_deletePrjViewAction->clear();
+ m_deletePrjViewAction->setItems(viewList);
+ m_currentProjectView = m_openPrjViewAction->currentText();
+ if (m_currentProjectView.isEmpty() && !viewList.empty())
+ {
+ m_currentProjectView = viewList.front();
+ }
+ bool haveView = !m_currentProjectView.isEmpty();
+ m_savePrjViewAction->setEnabled(haveView);
+ m_deleteCurrentPrjViewAction->setEnabled(haveView);
+}
+
+
+void ProjectviewPart::slotDeleteProjectViewCurent()
+{
+ slotDeleteProjectView(m_currentProjectView);
+}
+
+void ProjectviewPart::slotDeleteProjectView(const QString& view)
+{
+ m_projectViews.remove(view);
+
+ if (m_currentProjectView == view)
+ m_currentProjectView = "";
+
+ if (m_defaultProjectView == view)
+ m_defaultProjectView = "";
+
+ if (! project())
+ writeConfig();
+
+ adjustViewActions();
+}
+
+
+void ProjectviewPart::slotSaveAsProjectView(bool askForName)
+{
+ if (askForName)
+ {
+ bool ok;
+ QString newProjectView = KInputDialog::getText(i18n("Save View Session As"), i18n("Enter the name of the session:"), "", &ok, mainWindow()->main());
+ if (!ok)
+ {
+ return;
+ }
+ newProjectView = newProjectView.remove("="); // we use this string in config files and = would confuse it
+ if (m_projectViews.contains(newProjectView) > 0 &&
+ KMessageBox::warningContinueCancel(mainWindow()->main(), i18n("<qt>A view session named <b>%1</b> already exists.<br>Do you want to overwrite it?</qt>").arg(newProjectView), QString::null, i18n("Overwrite")) != KMessageBox::Continue)
+ {
+ return;
+ }
+ m_currentProjectView = newProjectView;
+ }
+
+ FileInfoList viewUrls;
+ KURL::List openURLs = partController()->openURLs();
+
+ for (KURL::List::Iterator it = openURLs.begin(); it != openURLs.end(); ++it)
+ {
+ // test if we have an editor
+ // FIXME this can fail if there are two parts with the same URL
+ KParts::ReadOnlyPart *ro_part = partController()->partForURL(*it);
+ KTextEditor::ViewCursorInterface* cursorIf = dynamic_cast<KTextEditor::ViewCursorInterface*>(ro_part->widget());
+ if (cursorIf)
+ {
+ QString encoding;
+ if ( KTextEditor::EncodingInterface * ei = dynamic_cast<KTextEditor::EncodingInterface*>( ro_part ) )
+ {
+ QString temp = ei->encoding();
+ if ( !temp.isNull() )
+ {
+ encoding = temp;
+ }
+ }
+
+ unsigned int line, col;
+ cursorIf->cursorPositionReal(&line, &col);
+ viewUrls.append(FileInfo(*it, line, col, encoding));
+ }
+ }
+ // add or overwrite the values
+ m_projectViews.insert(m_currentProjectView, viewUrls, true);
+ if (! project())
+ writeConfig();
+
+ adjustViewActions();
+}
+
+
+void ProjectviewPart::writeConfig()
+{
+ KConfig * config = kapp->config();
+ config->deleteGroup("ProjectViews", true);
+ config->setGroup("ProjectViews");
+
+ // write all views
+ ViewMap::ConstIterator it;
+ for (it = m_projectViews.constBegin(); it != m_projectViews.constEnd(); ++it)
+ {
+ // we create the view even if there is no file inside, might be wanted by the user
+ QStringList urls;
+ for (FileInfoList::ConstIterator it2 = it.data().constBegin(); it2 != it.data().constEnd(); ++it2)
+ {
+ if ((*it2).encoding.isEmpty())
+ urls.append((*it2).url.url());
+ else
+ urls.append((*it2).url.url() + ";" + (*it2).encoding);
+ }
+ config->writeEntry(it.key(), urls);
+ }
+}
+
+
+void ProjectviewPart::readConfig()
+{
+ KConfig * config = kapp->config();
+ QMap<QString, QString> entries = config->entryMap("ProjectViews");
+
+ m_projectViews.clear();
+ QMap<QString, QString>::ConstIterator it;
+ for (it = entries.constBegin(); it != entries.constEnd(); ++it)
+ {
+ FileInfoList urlList;
+ QStringList urls = QStringList::split(",", it.data());
+ for (QStringList::Iterator it2 = urls.begin(); it2 != urls.end(); ++it2 )
+ {
+ // search the encoding. The entry can be like: fileURL;encoding
+ QStringList file = QStringList::split(";", *it2);
+ if (file.count() == 1)
+ urlList.append(FileInfo(KURL::fromPathOrURL(*it2)));
+ else
+ urlList.append(FileInfo(KURL::fromPathOrURL(file.first()), -1, -1, file.last()));
+ }
+ m_projectViews.insert(it.key(), urlList);
+ }
+ adjustViewActions();
+}
+
+#include "projectviewpart.moc"
diff --git a/parts/filelist/projectviewpart.h b/parts/filelist/projectviewpart.h
new file mode 100644
index 00000000..50cd5391
--- /dev/null
+++ b/parts/filelist/projectviewpart.h
@@ -0,0 +1,169 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef KDEVPROJECTVIEW_H
+#define KDEVPROJECTVIEW_H
+
+#include "fileinfo.h"
+
+#include <qvaluelist.h>
+#include <qmap.h>
+#include <qguardedptr.h>
+
+#include <kdevplugin.h>
+#include <kurl.h>
+
+
+class QPopupMenu;
+class KAction;
+class KSelectAction;
+class KDialogBase;
+class Context;
+class ConfigWidgetProxy;
+class FileListWidget;
+class KToolBar;
+class QVBox;
+class ToolbarGUIBuilder;
+
+
+
+/**
+Please read the README.dox file for more info about this part
+
+this is a reimplementation of the project views in Quanta
+
+@TODO find a way to control the toolbar again
+@TODO save html parts too
+FIXME at project open I get the default view and the open files at last close
+*/
+class ProjectviewPart: public KDevPlugin
+{
+ Q_OBJECT
+public:
+
+ typedef QMap<QString, FileInfoList> ViewMap;
+// typedef QMap<KURL, FileInfo> FileInfoMap;
+
+
+ ProjectviewPart(QObject *parent, const char *name, const QStringList &args);
+ ~ProjectviewPart();
+
+ // reimplemented from KDevPlugin
+ void restorePartialProjectSession(const QDomElement * el);
+ void savePartialProjectSession(QDomElement * el);
+
+ /**
+ *
+ * @return the current defaut view
+ */
+ inline QString getDefaultView() const {return m_defaultProjectView;};
+
+ /**
+ *
+ * @param view new default view
+ */
+ inline void setDefaultView(const QString& view) {m_defaultProjectView = view;};
+
+ /**
+ * get all current views
+ * @return QStringList of defined views
+ */
+ inline QStringList getViewList() const {return m_projectViews.keys();};
+
+private slots:
+ void init();
+
+ void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo);
+ void contextMenu(QPopupMenu *popup, const Context *context);
+ void projectOpened();
+ void projectClosed();
+
+ /** Deletes a project view
+ *
+ * @param view name of the project view
+ */
+ void slotDeleteProjectView(const QString &view);
+
+ /**
+ * Deletes the current project view
+ */
+ void slotDeleteProjectViewCurent();
+
+ /**
+ * Saves a project view
+ *
+ * @param askForName true = show a dialog for the name
+ */
+ void slotSaveAsProjectView(bool askForName = true);
+
+ /** Saves the current project view
+ */
+ void slotSaveProjectView();
+
+ /** Opens a project view
+ *
+ * @param view name of the project view
+ */
+ void slotOpenProjectView(const QString &view);
+
+private:
+ /**
+ * create and initialize the actions
+ */
+ void setupActions();
+
+ /**
+ * Change the actions according to the current available views
+ */
+ void adjustViewActions();
+
+ /**
+ * write the views to the plugin config file
+ */
+ void writeConfig();
+
+ /**
+ * read the views from the plugin config file
+ */
+ void readConfig();
+
+ ViewMap m_projectViews; //container for the views
+
+ KAction *m_savePrjViewAction;
+ KAction *m_newPrjViewAction;
+ KAction *m_deleteCurrentPrjViewAction;
+ KSelectAction *m_openPrjViewAction;
+ KSelectAction *m_deletePrjViewAction;
+
+ QString m_currentProjectView;
+ QString m_defaultProjectView; // load this after project loaded
+
+ KURL m_projectBase; // project base folder
+ ConfigWidgetProxy *m_configProxy;
+
+ QGuardedPtr<QWidget> m_widget;
+ QGuardedPtr<ToolbarGUIBuilder> m_guibuilder;
+ QWidget * m_toolbarWidget;
+
+ bool m_restored;
+};
+
+
+#endif
diff --git a/parts/filelist/projectviewprojectconfig.cpp b/parts/filelist/projectviewprojectconfig.cpp
new file mode 100644
index 00000000..eb2d1b49
--- /dev/null
+++ b/parts/filelist/projectviewprojectconfig.cpp
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens.herden@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include <kcombobox.h>
+
+#include "projectviewprojectconfig.h"
+
+#include "projectviewpart.h"
+
+ProjectviewProjectConfig::ProjectviewProjectConfig(ProjectviewPart *part, QWidget *parent, const char *name)
+ : ProjectviewProjectConfigBase(parent, name), m_part(part)
+{
+ kComboDefault->clear();
+ kComboDefault->insertItem("");
+ kComboDefault->insertStringList( m_part->getViewList() );
+ kComboDefault->setCurrentItem( m_part->getDefaultView() );
+}
+
+void ProjectviewProjectConfig::accept()
+{
+ m_part->setDefaultView( kComboDefault->currentText() );
+}
+
+#include "projectviewprojectconfig.moc"
diff --git a/parts/filelist/projectviewprojectconfig.h b/parts/filelist/projectviewprojectconfig.h
new file mode 100644
index 00000000..03928642
--- /dev/null
+++ b/parts/filelist/projectviewprojectconfig.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens.herden@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef PROJECTVIEW_PROJECT_CONFIG_H
+#define PROJECTVIEW_PROJECT_CONFIG_H
+
+#include "projectviewprojectconfigbase.h"
+
+class ProjectviewPart;
+
+class ProjectviewProjectConfig: public ProjectviewProjectConfigBase
+{
+ Q_OBJECT
+public:
+ ProjectviewProjectConfig(ProjectviewPart *part, QWidget *parent = 0, const char *name = 0);
+
+public slots:
+ void accept();
+
+private:
+ ProjectviewPart *m_part;
+};
+
+#endif
diff --git a/parts/filelist/projectviewprojectconfigbase.ui b/parts/filelist/projectviewprojectconfigbase.ui
new file mode 100644
index 00000000..7ff9a0b0
--- /dev/null
+++ b/parts/filelist/projectviewprojectconfigbase.ui
@@ -0,0 +1,94 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ProjectviewProjectConfigBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>ProjectviewProjectConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Projectviews</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Open this session after project load:</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="0" column="1">
+ <property name="name">
+ <cstring>kComboDefault</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>select a session</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>265</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>71</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/filelist/toolbarguibuilder.cpp b/parts/filelist/toolbarguibuilder.cpp
new file mode 100644
index 00000000..2e82691b
--- /dev/null
+++ b/parts/filelist/toolbarguibuilder.cpp
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "toolbarguibuilder.h"
+
+#include <ktoolbar.h>
+
+ToolbarGUIBuilder::ToolbarGUIBuilder(QWidget *parent, QWidget *widget)
+ : KXMLGUIBuilder(widget), KToolBar(parent, "ToolbarGUIbuilder"), m_parent(parent)
+{
+// setHidden(true);
+ setFrameStyle(0);
+}
+
+
+ToolbarGUIBuilder::~ToolbarGUIBuilder()
+{
+}
+
+QWidget * ToolbarGUIBuilder::createContainer(QWidget *parent, int index, const QDomElement &element, int &id)
+{
+ if (element.tagName().lower() == "toolbar")
+ {
+ reparent(m_parent, QPoint(0, 0), true);
+ return this;
+ } else
+ {
+ return KXMLGUIBuilder::createContainer(parent, index, element, id);
+ }
+}
+
+void ToolbarGUIBuilder::removeContainer(QWidget *container, QWidget *parent, QDomElement &element, int id)
+{
+ if (container == this)
+ {
+ // i need to reparent to prevent a crash
+ reparent(0, QPoint(0, 0));
+ }
+ else
+ KXMLGUIBuilder::removeContainer(container, parent, element, id);
+}
+
diff --git a/parts/filelist/toolbarguibuilder.h b/parts/filelist/toolbarguibuilder.h
new file mode 100644
index 00000000..1f92b922
--- /dev/null
+++ b/parts/filelist/toolbarguibuilder.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Herden *
+ * jens@kdewebdev.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef TOOLBARGUIBUILDER_H
+#define TOOLBARGUIBUILDER_H
+
+#include <kxmlguibuilder.h>
+#include <kdebug.h>
+#include <ktoolbar.h>
+
+
+/**
+* Reimplemented the KXMLGUIBuilder in order use our toolbar in the
+* toolview
+* @author Jens Herden
+*/
+class ToolbarGUIBuilder : public KXMLGUIBuilder, public KToolBar
+{
+public:
+ ToolbarGUIBuilder(QWidget *parent, QWidget *widget);
+
+ virtual ~ToolbarGUIBuilder();
+
+ /**
+ * Called when a new XML gui client is added to the gui factory.
+ */
+ virtual QWidget *createContainer(QWidget *parent, int index, const QDomElement &element, int &id);
+
+ /**
+ * Called when a XML gui client is removed the gui factory.
+ * Reimplemented from KXMLGUIBuilder in order to remove our custom toolbar.
+ */
+ virtual void removeContainer(QWidget *container, QWidget *parent, QDomElement &element, int id);
+
+private:
+ QWidget * m_parent;
+};
+
+
+
+#endif
diff --git a/parts/fileselector/Makefile.am b/parts/fileselector/Makefile.am
new file mode 100644
index 00000000..f459fa79
--- /dev/null
+++ b/parts/fileselector/Makefile.am
@@ -0,0 +1,18 @@
+# Here resides the file selector part.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/sourceinfo $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfileselector.la
+libkdevfileselector_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfileselector_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfileselector_la_SOURCES = fileselector_part.cpp fileselector_widget.cpp kactionselector.cpp kbookmarkhandler.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfileselector.desktop
+
+# not used currently
+#rcdir = $(kde_datadir)/kdevfileselector
+#rc_DATA = kdevfileselector.rc
diff --git a/parts/fileselector/README.dox b/parts/fileselector/README.dox
new file mode 100644
index 00000000..61a0047a
--- /dev/null
+++ b/parts/fileselector/README.dox
@@ -0,0 +1,13 @@
+/** \class FileSelectorPart
+Powerful network transparent file browser utility
+
+\authors <a href="mailto:anders.lund AT lund.tdcadsl.dk">Anders Lund</a> Copyright (C) 2001
+
+\maintainer <a href="mailto:jowenn AT kde.org">Joseph Wenninger</a> Copyright (C) 2001
+\maintainer <a href="mailto:cullmann AT kde.org">Christoph Cullmann</a> Copyright (C) 2001
+\maintainer <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a> Copyright (C) 2003
+\maintainer <a href="mailto:cloudtemple AT mksat.net">Alexander Dymo</a> Copyright (C) 2003
+
+\feature Powerful network transparent file browser utility
+
+*/
diff --git a/parts/fileselector/fileselector_part.cpp b/parts/fileselector/fileselector_part.cpp
new file mode 100644
index 00000000..20a3d27a
--- /dev/null
+++ b/parts/fileselector/fileselector_part.cpp
@@ -0,0 +1,108 @@
+#include "fileselector_part.h"
+
+#include <qwhatsthis.h>
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qslider.h>
+#include <qvbox.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kapplication.h>
+#include <kstandarddirs.h>
+#include <ktextbrowser.h>
+#include <kconfig.h>
+#include <kfileitem.h>
+#include <kdevgenericfactory.h>
+#include <kdiroperator.h>
+#include <kdialogbase.h>
+#include <kmessagebox.h>
+
+#include <kdevapi.h>
+#include <kdevcore.h>
+#include <kdevproject.h>
+#include <kdevmainwindow.h>
+#include <kdevpartcontroller.h>
+#include <kdevplugininfo.h>
+#include <kdevcreatefile.h>
+
+#include <ktip.h>
+
+#include "fileselector_widget.h"
+
+typedef KDevGenericFactory<FileSelectorPart> FileSelectorFactory;
+static const KDevPluginInfo data("kdevfileselector");
+K_EXPORT_COMPONENT_FACTORY( libkdevfileselector, FileSelectorFactory( data ) )
+
+FileSelectorPart::FileSelectorPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "FileSelectorPart")
+{
+ setInstance(FileSelectorFactory::instance());
+
+ m_filetree = new KDevFileSelector( this, mainWindow(), partController(), 0, "fileselectorwidget" );
+
+ connect( m_filetree->dirOperator(), SIGNAL(fileSelected(const KFileItem*)),
+ this, SLOT(fileSelected(const KFileItem*)));
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
+
+ connect( core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget(KDialogBase*)) );
+
+ m_filetree->setCaption( i18n("File Selector") );
+ m_filetree->setIcon( SmallIcon( info()->icon() ) );
+ mainWindow()->embedSelectView( m_filetree, i18n("File Selector"), i18n("File selector") );
+ QWhatsThis::add(m_filetree, i18n("<b>File selector</b><p>This file selector lists directory contents and provides some file management functions."));
+
+ m_filetree->readConfig( instance()->config(), "fileselector" );
+
+ m_newFileAction = new KAction(i18n("New File..."), CTRL+ALT+SHIFT+Key_N, this, SLOT(newFile()), this);
+}
+
+FileSelectorPart::~FileSelectorPart()
+{
+ if (m_filetree){
+ mainWindow()->removeView( m_filetree );
+ }
+
+ delete (KDevFileSelector*) m_filetree;
+}
+
+void FileSelectorPart::fileSelected( const KFileItem * file )
+{
+ KURL u(file->url());
+
+ partController()->editDocument( u );
+}
+
+void FileSelectorPart::slotProjectOpened()
+{
+ KURL u;
+ u.setPath( project()->projectDirectory() );
+ m_filetree->setDir( u );
+}
+
+void FileSelectorPart::slotConfigWidget( KDialogBase * dlg )
+{
+ QVBox* vbox = dlg->addVBoxPage( i18n("File Selector"), i18n("File Selector"), BarIcon( info()->icon(), KIcon::SizeMedium) );
+ KFSConfigPage* page = new KFSConfigPage( vbox, 0, m_filetree );
+ connect( dlg, SIGNAL( okClicked( ) ), page, SLOT( apply( ) ) );
+ // ### implement reload
+}
+
+void FileSelectorPart::newFile()
+{
+ KDevCreateFile *creator = extension<KDevCreateFile>("KDevelop/CreateFile");
+ if (creator)
+ {
+ KDevCreateFile::CreatedFile file = creator->createNewFile("",
+ m_filetree->dirOperator()->url().path());
+ if (file.status == KDevCreateFile::CreatedFile::STATUS_NOTCREATED)
+ KMessageBox::error(0, i18n("Cannot create file. Check whether the directory and filename are valid."));
+ else if (file.status != KDevCreateFile::CreatedFile::STATUS_CANCELED)
+ {
+ partController()->editDocument(KURL::fromPathOrURL(
+ file.dir + "/" + file.filename));
+ }
+ }
+}
+
+#include "fileselector_part.moc"
diff --git a/parts/fileselector/fileselector_part.h b/parts/fileselector/fileselector_part.h
new file mode 100644
index 00000000..d12befb2
--- /dev/null
+++ b/parts/fileselector/fileselector_part.h
@@ -0,0 +1,40 @@
+#ifndef __KDEVPART_FILESELECTOR_H__
+#define __KDEVPART_FILESELECTOR_H__
+
+#include <kdevplugin.h>
+
+#include <kdialogbase.h>
+#include <kfileitem.h>
+
+#include <qguardedptr.h>
+
+class KDevFileSelector;
+class KDialogBase;
+
+class FileSelectorPart : public KDevPlugin
+{
+ Q_OBJECT
+public:
+ FileSelectorPart(QObject *parent, const char *name, const QStringList &);
+ virtual ~FileSelectorPart();
+
+ KAction *newFileAction() const { return m_newFileAction; }
+
+public slots:
+// void showTip();
+// void showOnStart();
+// void refresh();
+ void newFile();
+ void fileSelected(const KFileItem *file);
+
+private slots:
+ void slotProjectOpened();
+ void slotConfigWidget( KDialogBase * );
+
+private:
+ QGuardedPtr<KDevFileSelector> m_filetree;
+ KAction *m_newFileAction;
+};
+
+
+#endif
diff --git a/parts/fileselector/fileselector_widget.cpp b/parts/fileselector/fileselector_widget.cpp
new file mode 100644
index 00000000..41fab166
--- /dev/null
+++ b/parts/fileselector/fileselector_widget.cpp
@@ -0,0 +1,821 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
+ Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
+ Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+//BEGIN Includes
+#include "fileselector_part.h"
+#include "fileselector_widget.h"
+#include "kactionselector.h"
+#include "kbookmarkhandler.h"
+
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <kdevpartcontroller.h>
+
+#include <qlayout.h>
+#include <qtoolbutton.h>
+#include <qhbox.h>
+#include <qvbox.h>
+#include <qlabel.h>
+#include <qstrlist.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qapplication.h>
+#include <qlistbox.h>
+#include <qscrollbar.h>
+#include <qspinbox.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+#include <qdockarea.h>
+#include <qtimer.h>
+
+#include <ktexteditor/document.h>
+
+#include <kmainwindow.h>
+#include <kapplication.h>
+#include <kiconloader.h>
+#include <kurlcombobox.h>
+#include <kurlcompletion.h>
+#include <kprotocolinfo.h>
+#include <kconfig.h>
+#include <klocale.h>
+#include <kcombobox.h>
+#include <kaction.h>
+#include <kmessagebox.h>
+#include <ktoolbarbutton.h>
+#include <qtoolbar.h>
+#include <kpopupmenu.h>
+#include <kdialog.h>
+#include <kio/netaccess.h>
+
+#include <kdebug.h>
+//END Includes
+
+
+// from kfiledialog.cpp - avoid qt warning in STDERR (~/.xsessionerrors)
+static void silenceQToolBar(QtMsgType, const char *)
+{}
+
+
+KDevFileSelectorToolBar::KDevFileSelectorToolBar(QWidget *parent)
+ : KToolBar( parent, "KDev FileSelector Toolbar", true )
+{
+ setMinimumWidth(10);
+}
+
+KDevFileSelectorToolBar::~KDevFileSelectorToolBar()
+{}
+
+void KDevFileSelectorToolBar::setMovingEnabled( bool)
+{
+ KToolBar::setMovingEnabled(false);
+}
+
+
+KDevFileSelectorToolBarParent::KDevFileSelectorToolBarParent(QWidget *parent)
+ :QFrame(parent),m_tb(0)
+{}
+KDevFileSelectorToolBarParent::~KDevFileSelectorToolBarParent()
+{}
+void KDevFileSelectorToolBarParent::setToolBar(KDevFileSelectorToolBar *tb)
+{
+ m_tb=tb;
+}
+
+void KDevFileSelectorToolBarParent::resizeEvent ( QResizeEvent * )
+{
+ if (m_tb)
+ {
+ setMinimumHeight(m_tb->sizeHint().height());
+ m_tb->resize(width(),height());
+ }
+}
+
+
+//BEGIN Constructor/destructor
+
+KDevFileSelector::KDevFileSelector( FileSelectorPart *part, KDevMainWindow *mainWindow,
+ KDevPartController *partController,
+ QWidget * parent, const char * name )
+ : QWidget(parent, name),
+ m_part(part),
+ mainwin(mainWindow),
+ partController(partController)
+{
+ mActionCollection = new KActionCollection( this );
+
+ QVBoxLayout* lo = new QVBoxLayout(this);
+
+ QtMsgHandler oldHandler = qInstallMsgHandler( silenceQToolBar );
+
+ KDevFileSelectorToolBarParent *tbp=new KDevFileSelectorToolBarParent(this);
+ toolbar = new KDevFileSelectorToolBar(tbp);
+ tbp->setToolBar(toolbar);
+ lo->addWidget(tbp);
+ toolbar->setMovingEnabled(false);
+ toolbar->setFlat(true);
+ qInstallMsgHandler( oldHandler );
+
+ cmbPath = new KURLComboBox( KURLComboBox::Directories, true, this, "path combo" );
+ cmbPath->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
+ KURLCompletion* cmpl = new KURLCompletion(KURLCompletion::DirCompletion);
+ cmbPath->setCompletionObject( cmpl );
+ lo->addWidget(cmbPath);
+ cmbPath->listBox()->installEventFilter( this );
+
+ dir = new KDevDirOperator(m_part, KURL(), this, "operator");
+ dir->setView(KFile::/*Simple*/Detail);
+
+ KActionCollection *coll = dir->actionCollection();
+ // some shortcuts of diroperator that clashes with KDev
+ coll->action( "delete" )->setShortcut( KShortcut( ALT + Key_Delete ) );
+ coll->action( "reload" )->setShortcut( KShortcut( ALT + Key_F5 ) );
+ coll->action( "back" )->setShortcut( KShortcut( ALT + SHIFT + Key_Left ) );
+ coll->action( "forward" )->setShortcut( KShortcut( ALT + SHIFT + Key_Right ) );
+ // some consistency - reset up for dir too
+ coll->action( "up" )->setShortcut( KShortcut( ALT + SHIFT + Key_Up ) );
+ coll->action( "home" )->setShortcut( KShortcut( CTRL + ALT + Key_Home ) );
+
+ lo->addWidget(dir);
+ lo->setStretchFactor(dir, 2);
+
+ // bookmarks action!
+ KActionMenu *acmBookmarks = new KActionMenu( i18n("Bookmarks"), "bookmark",
+ mActionCollection, "bookmarks" );
+ acmBookmarks->setDelayed( false );
+
+ bookmarkHandler = new KBookmarkHandler( this, acmBookmarks->popupMenu() );
+
+ QHBox* filterBox = new QHBox(this);
+
+ btnFilter = new QToolButton( filterBox );
+ btnFilter->setIconSet( SmallIconSet("filter" ) );
+ btnFilter->setToggleButton( true );
+ filter = new KHistoryCombo( true, filterBox, "filter");
+ filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
+ filterBox->setStretchFactor(filter, 2);
+ connect( btnFilter, SIGNAL( clicked() ), this, SLOT( btnFilterClick() ) );
+ lo->addWidget(filterBox);
+
+ connect( filter, SIGNAL( activated(const QString&) ),
+ SLOT( slotFilterChange(const QString&) ) );
+
+ connect( filter, SIGNAL( textChanged(const QString&) ),
+ SLOT( slotFilterChange(const QString&) ) );
+ connect( filter, SIGNAL( returnPressed(const QString&) ),
+ filter, SLOT( addToHistory(const QString&) ) );
+
+ // kaction for the dir sync method
+ acSyncDir = new KAction( i18n("Current Document Directory"), "dirsynch", 0,
+ this, SLOT( setActiveDocumentDir() ), mActionCollection, "sync_dir" );
+ toolbar->setIconText( KToolBar::IconOnly );
+ toolbar->setIconSize( 16 );
+ toolbar->setEnableContextMenu( false );
+
+ connect( cmbPath, SIGNAL( urlActivated( const KURL& )),
+ this, SLOT( cmbPathActivated( const KURL& ) ));
+ connect( cmbPath, SIGNAL( returnPressed( const QString& )),
+ this, SLOT( cmbPathReturnPressed( const QString& ) ));
+ connect(dir, SIGNAL(urlEntered(const KURL&)),
+ this, SLOT(dirUrlEntered(const KURL&)) );
+
+ connect(dir, SIGNAL(finishedLoading()),
+ this, SLOT(dirFinishedLoading()) );
+
+ // enable dir sync button if current doc has a valid URL
+ connect ( partController, SIGNAL(activePartChanged(KParts::Part*) ),
+ this, SLOT(viewChanged() ) );
+
+ // Connect the bookmark handler
+ connect( bookmarkHandler, SIGNAL( openURL( const QString& )),
+ this, SLOT( setDir( const QString& ) ) );
+
+ waitingUrl = QString::null;
+
+ // whatsthis help
+ QWhatsThis::add
+ ( cmbPath,
+ i18n("<p>Here you can enter a path for a directory to display."
+ "<p>To go to a directory previously entered, press the arrow on "
+ "the right and choose one. <p>The entry has directory "
+ "completion. Right-click to choose how completion should behave.") );
+ QWhatsThis::add
+ ( filter,
+ i18n("<p>Here you can enter a name filter to limit which files are displayed."
+ "<p>To clear the filter, toggle off the filter button to the left."
+ "<p>To reapply the last filter used, toggle on the filter button." ) );
+ QWhatsThis::add
+ ( btnFilter,
+ i18n("<p>This button clears the name filter when toggled off, or "
+ "reapplies the last filter used when toggled on.") );
+}
+
+KDevFileSelector::~KDevFileSelector()
+{
+ writeConfig( m_part->instance()->config(), "fileselector" );
+}
+//END Constroctor/Destrctor
+
+//BEGIN Public Methods
+
+void KDevFileSelector::readConfig(KConfig *config, const QString & name)
+{
+ dir->readConfig(config, name + ":dir");
+ dir->setView( KFile::Default );
+
+ config->setGroup( name );
+
+ // set up the toolbar
+ setupToolbar( config );
+
+ cmbPath->setMaxItems( config->readNumEntry( "pathcombo history len", 9 ) );
+ cmbPath->setURLs( config->readPathListEntry("dir history") );
+ // if we restore history
+ if ( config->readBoolEntry( "restore location", true ) || kapp->isRestored() )
+ {
+ QString loc( config->readPathEntry( "location" ) );
+ if ( ! loc.isEmpty() )
+ {
+ waitingDir = loc;
+ QTimer::singleShot(0, this, SLOT(initialDirChangeHack()));
+ }
+ }
+
+ // else is automatic, as cmpPath->setURL is called when a location is entered.
+
+ filter->setMaxCount( config->readNumEntry( "filter history len", 9 ) );
+ filter->setHistoryItems( config->readListEntry("filter history"), true );
+ lastFilter = config->readEntry( "last filter" );
+ QString flt("");
+ if ( config->readBoolEntry( "restore last filter", true ) || kapp->isRestored() )
+ flt = config->readEntry("current filter");
+ filter->lineEdit()->setText( flt );
+ slotFilterChange( flt );
+
+ autoSyncEvents = config->readNumEntry( "AutoSyncEvents", 0 );
+ // connect events as needed
+ /// @todo - solve startup problem: no need to set location for each doc opened!
+ if ( autoSyncEvents & DocumentChanged )
+ connect( partController, SIGNAL( viewChanged() ), this, SLOT( autoSync() ) );
+
+ if ( autoSyncEvents & DocumentOpened )
+ connect( partController, SIGNAL( partAdded(KParts::Part*) ),
+ this, SLOT( autoSync(KParts::Part*) ) );
+
+}
+
+void KDevFileSelector::initialDirChangeHack()
+{
+ setDir( waitingDir );
+}
+
+void KDevFileSelector::setupToolbar( KConfig *config )
+{
+ toolbar->clear();
+ QStringList tbactions = config->readListEntry( "toolbar actions", ',' );
+ if ( tbactions.isEmpty() )
+ {
+ // resonable collection for default toolbar
+ tbactions << "up" << "back" << "forward" << "home" <<
+ "short view" << "detailed view" <<
+ "bookmarks" << "sync_dir";
+ }
+ KAction *ac;
+ for ( QStringList::Iterator it=tbactions.begin(); it != tbactions.end(); ++it )
+ {
+ if ( *it == "bookmarks" || *it == "sync_dir" )
+ ac = mActionCollection->action( (*it).latin1() );
+ else
+ ac = dir->actionCollection()->action( (*it).latin1() );
+ if ( ac )
+ ac->plug( toolbar );
+ }
+}
+
+void KDevFileSelector::writeConfig(KConfig *config, const QString & name)
+{
+ dir->writeConfig(config,name + ":dir");
+
+ config->setGroup( name );
+ config->writeEntry( "pathcombo history len", cmbPath->maxItems() );
+ QStringList l;
+ for (int i = 0; i < cmbPath->count(); i++)
+ {
+ l.append( cmbPath->text( i ) );
+ }
+ config->writePathEntry( "dir history", l );
+ config->writePathEntry( "location", cmbPath->currentText() );
+
+ config->writeEntry( "filter history len", filter->maxCount() );
+ config->writeEntry( "filter history", filter->historyItems() );
+ config->writeEntry( "current filter", filter->currentText() );
+ config->writeEntry( "last filter", lastFilter );
+ config->writeEntry( "AutoSyncEvents", autoSyncEvents );
+}
+
+void KDevFileSelector::setView(KFile::FileView view)
+{
+ dir->setView(view);
+}
+
+//END Public Methods
+
+//BEGIN Public Slots
+
+void KDevFileSelector::slotFilterChange( const QString & nf )
+{
+ QToolTip::remove( btnFilter );
+ QString f = nf.stripWhiteSpace();
+ bool empty = f.isEmpty() || f == "*";
+ if ( empty )
+ {
+ dir->clearFilter();
+ filter->lineEdit()->setText( QString::null );
+ QToolTip::add
+ ( btnFilter,
+ QString( i18n("Apply last filter (\"%1\")") ).arg( lastFilter ) );
+ }
+ else
+ {
+ if ( !f.startsWith( "*" ) )
+ f.prepend( '*' );
+ if ( !f.endsWith( "*" ) )
+ f.append( '*' );
+ dir->setNameFilter( f );
+ lastFilter = f;
+ QToolTip::add
+ ( btnFilter, i18n("Clear filter") );
+ }
+ btnFilter->setOn( !empty );
+ dir->updateDir();
+ // this will be never true after the filter has been used;)
+ btnFilter->setEnabled( !( empty && lastFilter.isEmpty() ) );
+
+}
+void KDevFileSelector::setDir( KURL u )
+{
+ dir->setURL(u, true);
+}
+
+//END Public Slots
+
+//BEGIN Private Slots
+
+void KDevFileSelector::cmbPathActivated( const KURL& u )
+{
+ cmbPathReturnPressed( u.url() );
+}
+
+void KDevFileSelector::cmbPathReturnPressed( const QString& u )
+{
+ QStringList urls = cmbPath->urls();
+ urls.remove( u );
+ urls.prepend( u );
+ cmbPath->setURLs( urls, KURLComboBox::RemoveBottom );
+ dir->setFocus();
+ dir->setURL( KURL(u), true );
+}
+
+void KDevFileSelector::dirUrlEntered( const KURL& u )
+{
+ cmbPath->setURL( u );
+}
+
+void KDevFileSelector::dirFinishedLoading()
+{}
+
+
+/*
+ When the button in the filter box toggles:
+ If off:
+ If the name filer is anything but "" or "*", reset it.
+ If on:
+ Set last filter.
+*/
+void KDevFileSelector::btnFilterClick()
+{
+ if ( !btnFilter->isOn() )
+ {
+ slotFilterChange( QString::null );
+ }
+ else
+ {
+ filter->lineEdit()->setText( lastFilter );
+ slotFilterChange( lastFilter );
+ }
+}
+
+
+void KDevFileSelector::autoSync()
+{
+ kdDebug()<<"KDevFileSelector::autoSync()"<<endl;
+ // if visible, sync
+ if ( isVisible() )
+ {
+ setActiveDocumentDir();
+ waitingUrl = QString::null;
+ }
+ // else set waiting url
+ else
+ {
+ KURL u = activeDocumentUrl();
+ if (!u.isEmpty())
+ waitingUrl = u.directory();
+ }
+}
+
+void KDevFileSelector::autoSync( KParts::Part *part )
+{
+ KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( part );
+ if( !doc )
+ return;
+
+ // as above, but using document url.
+ kdDebug()<<"KDevFileSelector::autoSync( KTextEditor::Document )"<<endl;
+ KURL u ( doc->url() );
+ if ( u.isEmpty() )
+ {
+ waitingUrl = QString::null;
+ return;
+ }
+ if ( isVisible() )
+ {
+ setDir( u.directory() );
+ waitingUrl = QString::null;
+ }
+ else
+ {
+ waitingUrl = u.directory();
+ }
+}
+/// \FIXME crash on shutdown
+void KDevFileSelector::setActiveDocumentDir()
+{
+ //kdDebug()<<"KDevFileSelector::setActiveDocumentDir()"<<endl;
+ KURL u = activeDocumentUrl();
+ if (!u.isEmpty())
+ setDir( u.upURL() );
+}
+
+void KDevFileSelector::viewChanged()
+{
+ /// @todo make sure the button is disabled if the directory is unreadable, eg
+ /// the document URL has protocol http
+ acSyncDir->setEnabled( ! activeDocumentUrl().directory().isEmpty() );
+}
+
+//END Private Slots
+
+//BEGIN Protected
+
+void KDevFileSelector::focusInEvent( QFocusEvent * )
+{
+ dir->setFocus();
+}
+
+void KDevFileSelector::showEvent( QShowEvent * )
+{
+ // sync if we should
+ if ( autoSyncEvents & GotVisible )
+ {
+ kdDebug()<<"syncing fs on show"<<endl;
+ setActiveDocumentDir();
+ waitingUrl = QString::null;
+ }
+ // else, if we have a waiting URL set it
+ else if ( ! waitingUrl.isEmpty() )
+ {
+ setDir( waitingUrl );
+ waitingUrl = QString::null;
+ }
+}
+
+bool KDevFileSelector::eventFilter( QObject* o, QEvent *e )
+{
+ /*
+ This is rather unfortunate, but:
+ QComboBox does not support setting the size of the listbox to something
+ resonable. Even using listbox->setVariableWidth() does not yeld a
+ satisfying result, something is wrong with the handling of the sizehint.
+ And the popup is rather useless, if the paths are only partly visible.
+ */
+ QListBox *lb = cmbPath->listBox();
+ if ( o == lb && e->type() == QEvent::Show )
+ {
+ int add
+ = lb->height() < lb->contentsHeight() ? lb->verticalScrollBar()->width() : 0;
+ int w = QMIN( mainwin->main()->width(), lb->contentsWidth() + add );
+ lb->resize( w, lb->height() );
+ /// @todo - move the listbox to a suitable place if nessecary
+ /// @todo - decide if it is worth caching the size while untill the contents
+ /// are changed.
+ }
+ /// @todo - same thing for the completion popup?
+ return QWidget::eventFilter( o, e );
+}
+
+//END Protected
+
+//BEGIN ACtionLBItem
+/*
+ QListboxItem that can store and return a string,
+ used for the toolbar action selector.
+*/
+class ActionLBItem : public QListBoxPixmap
+{
+public:
+ ActionLBItem( QListBox *lb=0,
+ const QPixmap &pm = QPixmap(),
+ const QString &text=QString::null,
+ const QString &str=QString::null ) :
+ QListBoxPixmap( lb, pm, text ),
+ _str(str)
+ {}
+ ;
+ QString idstring()
+ {
+ return _str;
+ };
+private:
+ QString _str;
+};
+
+KURL KDevFileSelector::activeDocumentUrl( )
+{
+ KParts::ReadOnlyPart * part = dynamic_cast<KParts::ReadOnlyPart*>( partController->activePart() );
+ if ( part )
+ {
+ return part->url();
+ }
+
+ return KURL();
+}
+//END ActionLBItem
+
+//BEGIN KFSConfigPage
+////////////////////////////////////////////////////////////////////////////////
+// KFSConfigPage implementation
+////////////////////////////////////////////////////////////////////////////////
+KFSConfigPage::KFSConfigPage( QWidget *parent, const char *name, KDevFileSelector *kfs )
+ : QWidget( parent, name ),
+ fileSelector( kfs ),
+ bDirty( false )
+{
+ QVBoxLayout *lo = new QVBoxLayout( this );
+ int spacing = KDialog::spacingHint();
+ lo->setSpacing( spacing );
+
+ // Toolbar - a lot for a little...
+ QGroupBox *gbToolbar = new QGroupBox( 1, Qt::Vertical, i18n("Toolbar"), this );
+ acSel = new KActionSelector( gbToolbar );
+ acSel->setAvailableLabel( i18n("A&vailable actions:") );
+ acSel->setSelectedLabel( i18n("S&elected actions:") );
+ lo->addWidget( gbToolbar );
+ connect( acSel, SIGNAL( added( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
+ connect( acSel, SIGNAL( removed( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
+ connect( acSel, SIGNAL( movedUp( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
+ connect( acSel, SIGNAL( movedDown( QListBoxItem * ) ), this, SLOT( slotChanged() ) );
+
+ // Sync
+ QGroupBox *gbSync = new QGroupBox( 1, Qt::Horizontal, i18n("Auto Synchronization"), this );
+ cbSyncActive = new QCheckBox( i18n("When a docu&ment becomes active"), gbSync );
+ cbSyncOpen = new QCheckBox( i18n("When a document is o&pened"), gbSync );
+ cbSyncShow = new QCheckBox( i18n("When the file selector becomes visible"), gbSync );
+ lo->addWidget( gbSync );
+ connect( cbSyncActive, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
+ connect( cbSyncOpen, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
+ connect( cbSyncShow, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
+
+ // Histories
+ QHBox *hbPathHist = new QHBox ( this );
+ QLabel *lbPathHist = new QLabel( i18n("Remember &locations:"), hbPathHist );
+ sbPathHistLength = new QSpinBox( hbPathHist );
+ lbPathHist->setBuddy( sbPathHistLength );
+ lo->addWidget( hbPathHist );
+ connect( sbPathHistLength, SIGNAL( valueChanged ( int ) ), this, SLOT( slotChanged() ) );
+
+ QHBox *hbFilterHist = new QHBox ( this );
+ QLabel *lbFilterHist = new QLabel( i18n("Remember &filters:"), hbFilterHist );
+ sbFilterHistLength = new QSpinBox( hbFilterHist );
+ lbFilterHist->setBuddy( sbFilterHistLength );
+ lo->addWidget( hbFilterHist );
+ connect( sbFilterHistLength, SIGNAL( valueChanged ( int ) ), this, SLOT( slotChanged() ) );
+
+ // Session
+ QGroupBox *gbSession = new QGroupBox( 1, Qt::Horizontal, i18n("Session"), this );
+ cbSesLocation = new QCheckBox( i18n("Restore loca&tion"), gbSession );
+ cbSesFilter = new QCheckBox( i18n("Restore last f&ilter"), gbSession );
+ lo->addWidget( gbSession );
+ connect( cbSesLocation, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
+ connect( cbSesFilter, SIGNAL( toggled( bool ) ), this, SLOT( slotChanged() ) );
+
+ // make it look nice
+ lo->addStretch( 1 );
+
+ // be helpfull
+ /*
+ QWhatsThis::add( lbAvailableActions, i18n(
+ "<p>Available actions for the toolbar. To add an action, select it here "
+ "and press the add (<strong>-&gt;</strong>) button" ) );
+ QWhatsThis::add( lbUsedActions, i18n(
+ "<p>Actions used in the toolbar. To remove an action, select it and "
+ "press the remove (<strong>&lt;-</strong>) button."
+ "<p>To change the order of the actions, use the Up and Down buttons to "
+ "move the selected action.") );
+ */
+ QString lhwt( i18n(
+ "<p>Decides how many locations to keep in the history of the location "
+ "combo box") );
+ QWhatsThis::add
+ ( lbPathHist, lhwt );
+ QWhatsThis::add
+ ( sbPathHistLength, lhwt );
+ QString fhwt( i18n(
+ "<p>Decides how many filters to keep in the history of the filter "
+ "combo box") );
+ QWhatsThis::add
+ ( lbFilterHist, fhwt );
+ QWhatsThis::add
+ ( sbFilterHistLength, fhwt );
+ QString synwt( i18n(
+ "<p>These options allow you to have the File Selector automatically "
+ "change location to the directory of the active document on certain "
+ "events."
+ "<p>Auto synchronization is <em>lazy</em>, meaning it will not take "
+ "effect until the file selector is visible."
+ "<p>None of these are enabled by default, but you can always sync the "
+ "location by pressing the sync button in the toolbar.") );
+ QWhatsThis::add
+ ( gbSync, synwt );
+ QWhatsThis::add
+ ( cbSesLocation, i18n(
+ "<p>If this option is enabled (default), the location will be restored "
+ "when you start KDev.<p><strong>Note</strong> that if the session is "
+ "handled by the KDE session manager, the location is always restored.") );
+ QWhatsThis::add
+ ( cbSesFilter, i18n(
+ "<p>If this option is enabled (default), the current filter will be "
+ "restored when you start KDev.<p><strong>Note</strong> that if the "
+ "session is handled by the KDE session manager, the filter is always "
+ "restored."
+ "<p><strong>Note</strong> that some of the autosync settings may "
+ "override the restored location if on.") );
+
+ init();
+
+}
+
+void KFSConfigPage::apply()
+{
+ KConfig *config = fileSelector->m_part->instance()->config();
+ config->setGroup( "fileselector" );
+ // toolbar
+ QStringList l;
+ QListBoxItem *item = acSel->selectedListBox()->firstItem();
+ ActionLBItem *aItem;
+ while ( item )
+ {
+ aItem = (ActionLBItem*)item;
+ if ( aItem )
+ {
+ l << aItem->idstring();
+ }
+ item = item->next();
+ }
+ config->writeEntry( "toolbar actions", l );
+ fileSelector->setupToolbar( config );
+ // sync
+ int s = 0;
+ if ( cbSyncActive->isChecked() )
+ s |= KDevFileSelector::DocumentChanged;
+ if ( cbSyncOpen->isChecked() )
+ s |= KDevFileSelector::DocumentOpened;
+ if ( cbSyncShow->isChecked() )
+ s |= KDevFileSelector::GotVisible;
+ fileSelector->autoSyncEvents = s;
+ // reset connections
+ disconnect( fileSelector->partController, 0, fileSelector, SLOT( autoSync() ) );
+ disconnect( fileSelector->partController, 0,
+ fileSelector, SLOT( autoSync( KParts::Part *) ) );
+ if ( s & KDevFileSelector::DocumentChanged )
+ connect( fileSelector->partController, SIGNAL( viewChanged() ),
+ fileSelector, SLOT( autoSync() ) );
+ if ( s & KDevFileSelector::DocumentOpened )
+ connect( fileSelector->partController,
+ SIGNAL( partAdded(KParts::Part *) ),
+ fileSelector, SLOT( autoSync(KParts::Part *) ) );
+
+ // histories
+ fileSelector->cmbPath->setMaxItems( sbPathHistLength->value() );
+ fileSelector->filter->setMaxCount( sbFilterHistLength->value() );
+ // session - theese are read/written directly to the app config,
+ // as they are not needed during operation.
+ config->writeEntry( "restore location", cbSesLocation->isChecked() );
+ config->writeEntry( "restore last filter", cbSesFilter->isChecked() );
+}
+
+void KFSConfigPage::reload()
+{
+ // hmm, what is this supposed to do, actually??
+ init();
+}
+
+void KFSConfigPage::init()
+{
+ KConfig *config = fileSelector->m_part->instance()->config();
+ config->setGroup( "fileselector" );
+ // toolbar
+ QStringList l = config->readListEntry( "toolbar actions", ',' );
+ if ( l.isEmpty() ) // default toolbar
+ l << "up" << "back" << "forward" << "home" <<
+ "short view" << "detailed view" <<
+ "bookmarks" << "sync_dir";
+
+ // actions from diroperator + two of our own
+ QStringList allActions;
+ allActions << "up" << "back" << "forward" << "home" <<
+ "reload" << "mkdir" << "delete" <<
+ "short view" << "detailed view" /*<< "view menu" <<
+ "show hidden" << "properties"*/ <<
+ "bookmarks" << "sync_dir";
+ QRegExp re("&(?=[^&])");
+ KAction *ac;
+ QListBox *lb;
+ for ( QStringList::Iterator it=allActions.begin(); it != allActions.end(); ++it )
+ {
+ lb = l.contains( *it ) ? acSel->selectedListBox() : acSel->availableListBox();
+ if ( *it == "bookmarks" || *it == "sync_dir" )
+ ac = fileSelector->actionCollection()->action( (*it).latin1() );
+ else
+ ac = fileSelector->dirOperator()->actionCollection()->action( (*it).latin1() );
+ if ( ac )
+ new ActionLBItem( lb, SmallIcon( ac->icon() ), ac->text().replace( re, "" ), *it );
+ }
+
+ // sync
+ int s = fileSelector->autoSyncEvents;
+ cbSyncActive->setChecked( s & KDevFileSelector::DocumentChanged );
+ cbSyncOpen->setChecked( s & KDevFileSelector::DocumentOpened );
+ cbSyncShow->setChecked( s & KDevFileSelector::GotVisible );
+ // histories
+ sbPathHistLength->setValue( fileSelector->cmbPath->maxItems() );
+ sbFilterHistLength->setValue( fileSelector->filter->maxCount() );
+ // session
+ cbSesLocation->setChecked( config->readBoolEntry( "restore location", true ) );
+ cbSesFilter->setChecked( config->readBoolEntry( "restore last filter", true ) );
+}
+
+void KFSConfigPage::slotChanged()
+{
+}
+
+//END KFSConfigPage
+
+
+//BEGIN KDevDirOperator
+
+void KDevDirOperator::activatedMenu( const KFileItem *fi, const QPoint & pos )
+{
+ setupMenu();
+ updateSelectionDependentActions();
+
+ KActionMenu * am = dynamic_cast<KActionMenu*>(actionCollection()->action("popupMenu"));
+ if (!am)
+ return;
+ KPopupMenu *popup = am->popupMenu();
+
+ popup->insertSeparator();
+ m_part->newFileAction()->plug(popup);
+
+ if (fi)
+ {
+ FileContext context( KURL::List(fi->url()));
+ if ( (m_part) && (m_part->core()))
+ m_part->core()->fillContextMenu(popup, &context);
+ }
+
+ popup->popup(pos);
+}
+
+//END KDevDirOperator
+
+#include "fileselector_widget.moc"
diff --git a/parts/fileselector/fileselector_widget.h b/parts/fileselector/fileselector_widget.h
new file mode 100644
index 00000000..cb194760
--- /dev/null
+++ b/parts/fileselector/fileselector_widget.h
@@ -0,0 +1,203 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
+ Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
+ Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
+ Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef FILESELECTOR_WIDGET_H
+#define FILESELECTOR_WIDGET_H
+
+#include <qwidget.h>
+#include <kfile.h>
+#include <kurl.h>
+#include <ktoolbar.h>
+#include <qframe.h>
+#include <kdiroperator.h>
+
+class KDevMainWindow;
+class KDevPartController;
+class FileSelectorPart;
+class KActionCollection;
+class KActionSelector;
+class KDirOperator;
+class KURLComboBox;
+class KHistoryCombo;
+
+namespace KParts
+{
+ class Part;
+}
+
+namespace KTextEditor
+{
+ class Document;
+}
+
+/*
+ The KDev file selector presents a directory view, in which the default action is
+ to open the activated file.
+ Additinally, a toolbar for managing the kdiroperator widget + sync that to
+ the directory of the current file is available, as well as a filter widget
+ allowing to filter the displayed files using a name filter.
+*/
+
+/* I think this fix for not moving toolbars is better */
+class KDevFileSelectorToolBar: public KToolBar
+{
+ Q_OBJECT
+public:
+ KDevFileSelectorToolBar(QWidget *parent);
+ virtual ~KDevFileSelectorToolBar();
+
+ virtual void setMovingEnabled( bool b );
+};
+
+class KDevFileSelectorToolBarParent: public QFrame
+{
+ Q_OBJECT
+public:
+ KDevFileSelectorToolBarParent(QWidget *parent);
+ ~KDevFileSelectorToolBarParent();
+ void setToolBar(KDevFileSelectorToolBar *tb);
+
+private:
+ KDevFileSelectorToolBar *m_tb;
+
+protected:
+ virtual void resizeEvent ( QResizeEvent * );
+};
+
+class KDevDirOperator: public KDirOperator
+{
+ Q_OBJECT
+public:
+ KDevDirOperator(FileSelectorPart *part, const KURL &urlName=KURL(), QWidget *parent=0, const char *name=0)
+ :KDirOperator(urlName, parent, name), m_part(part)
+ {
+ }
+
+protected slots:
+ virtual void activatedMenu (const KFileItem *fi, const QPoint &pos);
+
+private:
+ FileSelectorPart *m_part;
+};
+
+class KDevFileSelector : public QWidget
+{
+ Q_OBJECT
+
+ friend class KFSConfigPage;
+
+public:
+ /* When to sync to current document directory */
+ enum AutoSyncEvent { DocumentChanged=1, DocumentOpened=2, GotVisible=4 };
+
+ KDevFileSelector( FileSelectorPart *part, KDevMainWindow *mainWindow=0, KDevPartController *partController=0,
+ QWidget * parent = 0, const char * name = 0 );
+ ~KDevFileSelector();
+
+ void readConfig( KConfig *, const QString & );
+ void writeConfig( KConfig *, const QString & );
+ void setupToolbar( KConfig * );
+ void setView( KFile::FileView );
+ KDevDirOperator *dirOperator(){ return dir; }
+ KActionCollection *actionCollection() { return mActionCollection; };
+
+public slots:
+ void slotFilterChange(const QString&);
+ void setDir(KURL);
+ void setDir( const QString& url ) { setDir( KURL( url ) ); };
+
+private slots:
+ void cmbPathActivated( const KURL& u );
+ void cmbPathReturnPressed( const QString& u );
+ void dirUrlEntered( const KURL& u );
+ void dirFinishedLoading();
+ void setActiveDocumentDir();
+ void viewChanged();
+ void btnFilterClick();
+ void autoSync();
+ void autoSync( KParts::Part * );
+ void initialDirChangeHack();
+protected:
+ void focusInEvent( QFocusEvent * );
+ void showEvent( QShowEvent * );
+ bool eventFilter( QObject *, QEvent * );
+ KURL activeDocumentUrl();
+
+private:
+ class KDevFileSelectorToolBar *toolbar;
+ KActionCollection *mActionCollection;
+ class KBookmarkHandler *bookmarkHandler;
+ KURLComboBox *cmbPath;
+ KDevDirOperator * dir;
+ class KAction *acSyncDir;
+ KHistoryCombo * filter;
+ class QToolButton *btnFilter;
+
+ FileSelectorPart *m_part;
+ KDevMainWindow *mainwin;
+ KDevPartController *partController;
+
+ QString lastFilter;
+ int autoSyncEvents; // enabled autosync events
+ QString waitingUrl; // maybe display when we gets visible
+ QString waitingDir;
+};
+
+/* @todo anders
+ KFSFilterHelper
+ A popup widget presenting a listbox with checkable items
+ representing the mime types available in the current directory, and
+ providing a name filter based on those.
+*/
+
+/*
+ Config page for file selector.
+ Allows for configuring the toolbar, the history length
+ of the path and file filter combos, and how to handle
+ user closed session.
+*/
+class KFSConfigPage : public QWidget
+{
+ Q_OBJECT
+public:
+ KFSConfigPage( QWidget* parent=0, const char *name=0, KDevFileSelector *kfs=0);
+ virtual ~KFSConfigPage() {};
+
+public slots:
+ virtual void apply();
+ virtual void reload();
+ virtual void slotChanged();
+
+private:
+ void init();
+
+ KDevFileSelector *fileSelector;
+ bool bDirty;
+ //class QListBox *lbAvailableActions, *lbUsedActions;
+ KActionSelector *acSel;
+ class QSpinBox *sbPathHistLength, *sbFilterHistLength;
+ class QCheckBox *cbSyncOpen, *cbSyncActive, *cbSyncShow;
+ class QCheckBox *cbSesLocation, *cbSesFilter;
+};
+
+
+#endif
+
diff --git a/parts/fileselector/kactionselector.cpp b/parts/fileselector/kactionselector.cpp
new file mode 100644
index 00000000..5bf234a8
--- /dev/null
+++ b/parts/fileselector/kactionselector.cpp
@@ -0,0 +1,537 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+
+#include "kactionselector.h"
+
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kdialog.h> // for spacingHint()
+#include <kdebug.h>
+#include <qapplication.h>
+
+#include <qlistbox.h>
+#include <qtoolbutton.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qevent.h>
+#include <qwhatsthis.h>
+
+class KActionSelectorPrivate {
+ public:
+ QListBox *availableListBox, *selectedListBox;
+ QToolButton *btnAdd, *btnRemove, *btnUp, *btnDown;
+ QLabel *lAvailable, *lSelected;
+ bool moveOnDoubleClick, keyboardEnabled;
+ KActionSelector::ButtonIconSize iconSize;
+ QString addIcon, removeIcon, upIcon, downIcon;
+ KActionSelector::InsertionPolicy availableInsertionPolicy, selectedInsertionPolicy;
+ bool showUpDownButtons;
+};
+
+//BEGIN Constructor/destructor
+
+KActionSelector::KActionSelector( QWidget *parent, const char *name )
+ : QWidget( parent, name )
+{
+ d = new KActionSelectorPrivate();
+ d->moveOnDoubleClick = true;
+ d->keyboardEnabled = true;
+ d->iconSize = SmallIcon;
+ d->addIcon = QApplication::reverseLayout() ? "back" : "forward";
+ d->removeIcon = QApplication::reverseLayout() ? "forward" : "back";
+ d->upIcon = "up";
+ d->downIcon = "down";
+ d->availableInsertionPolicy = Sorted;
+ d->selectedInsertionPolicy = BelowCurrent;
+ d->showUpDownButtons = true;
+
+ //int isz = IconSize( KIcon::Small );
+
+ QHBoxLayout *lo = new QHBoxLayout( this );
+ lo->setSpacing( KDialog::spacingHint() );
+
+ QVBoxLayout *loAv = new QVBoxLayout( lo );
+ d->lAvailable = new QLabel( i18n("&Available:"), this );
+ loAv->addWidget( d->lAvailable );
+ d->availableListBox = new QListBox( this );
+ loAv->addWidget( d->availableListBox );
+ d->lAvailable->setBuddy( d->availableListBox );
+
+ QVBoxLayout *loHBtns = new QVBoxLayout( lo );
+ loHBtns->addStretch( 1 );
+ d->btnAdd = new QToolButton( this );
+ loHBtns->addWidget( d->btnAdd );
+ d->btnRemove = new QToolButton( this );
+ loHBtns->addWidget( d->btnRemove );
+ loHBtns->addStretch( 1 );
+
+ QVBoxLayout *loS = new QVBoxLayout( lo );
+ d->lSelected = new QLabel( i18n("&Selected:"), this );
+ loS->addWidget( d->lSelected );
+ d->selectedListBox = new QListBox( this );
+ loS->addWidget( d->selectedListBox );
+ d->lSelected->setBuddy( d->selectedListBox );
+
+ QVBoxLayout *loVBtns = new QVBoxLayout( lo );
+ loVBtns->addStretch( 1 );
+ d->btnUp = new QToolButton( this );
+ loVBtns->addWidget( d->btnUp );
+ d->btnDown = new QToolButton( this );
+ loVBtns->addWidget( d->btnDown );
+ loVBtns->addStretch( 1 );
+
+ loadIcons();
+
+ connect( d->btnAdd, SIGNAL(clicked()), this, SLOT(buttonAddClicked()) );
+ connect( d->btnRemove, SIGNAL(clicked()), this, SLOT(buttonRemoveClicked()) );
+ connect( d->btnUp, SIGNAL(clicked()), this, SLOT(buttonUpClicked()) );
+ connect( d->btnDown, SIGNAL(clicked()), this, SLOT(buttonDownClicked()) );
+ connect( d->availableListBox, SIGNAL(doubleClicked(QListBoxItem*)),
+ this, SLOT(itemDoubleClicked(QListBoxItem*)) );
+ connect( d->selectedListBox, SIGNAL(doubleClicked(QListBoxItem*)),
+ this, SLOT(itemDoubleClicked(QListBoxItem*)) );
+ connect( d->availableListBox, SIGNAL(currentChanged(QListBoxItem*)),
+ this, SLOT(slotCurrentChanged(QListBoxItem *)) );
+ connect( d->selectedListBox, SIGNAL(currentChanged(QListBoxItem*)),
+ this, SLOT(slotCurrentChanged(QListBoxItem *)) );
+
+ d->availableListBox->installEventFilter( this );
+ d->selectedListBox->installEventFilter( this );
+}
+
+KActionSelector::~KActionSelector()
+{
+ delete d;
+}
+
+//END Constructor/destroctor
+
+//BEGIN Public Methods
+
+QListBox *KActionSelector::availableListBox()
+{
+ return d->availableListBox;
+}
+
+QListBox *KActionSelector::selectedListBox()
+{
+ return d->selectedListBox;
+}
+
+void KActionSelector::setButtonIcon( const QString &icon, MoveButton button )
+{
+ switch ( button )
+ {
+ case ButtonAdd:
+ d->addIcon = icon;
+ d->btnAdd->setIconSet( SmallIconSet( icon, d->iconSize ) );
+ break;
+ case ButtonRemove:
+ d->removeIcon = icon;
+ d->btnRemove->setIconSet( SmallIconSet( icon, d->iconSize ) );
+ break;
+ case ButtonUp:
+ d->upIcon = icon;
+ d->btnUp->setIconSet( SmallIconSet( icon, d->iconSize ) );
+ break;
+ case ButtonDown:
+ d->downIcon = icon;
+ d->btnDown->setIconSet( SmallIconSet( icon, d->iconSize ) );
+ break;
+ default:
+ kdDebug()<<"KActionSelector::setButtonIcon: DAINBREAD!"<<endl;
+ }
+}
+
+void KActionSelector::setButtonIconSet( const QIconSet &iconset, MoveButton button )
+{
+ switch ( button )
+ {
+ case ButtonAdd:
+ d->btnAdd->setIconSet( iconset );
+ break;
+ case ButtonRemove:
+ d->btnRemove->setIconSet( iconset );
+ break;
+ case ButtonUp:
+ d->btnUp->setIconSet( iconset );
+ break;
+ case ButtonDown:
+ d->btnDown->setIconSet( iconset );
+ break;
+ default:
+ kdDebug()<<"KActionSelector::setButtonIconSet: DAINBREAD!"<<endl;
+ }
+}
+
+void KActionSelector::setButtonTooltip( const QString &tip, MoveButton button )
+{
+ switch ( button )
+ {
+ case ButtonAdd:
+ d->btnAdd->setTextLabel( tip );
+ break;
+ case ButtonRemove:
+ d->btnRemove->setTextLabel( tip );
+ break;
+ case ButtonUp:
+ d->btnUp->setTextLabel( tip );
+ break;
+ case ButtonDown:
+ d->btnDown->setTextLabel( tip );
+ break;
+ default:
+ kdDebug()<<"KActionSelector::setButtonToolTip: DAINBREAD!"<<endl;
+ }
+}
+
+void KActionSelector::setButtonWhatsThis( const QString &text, MoveButton button )
+{
+ switch ( button )
+ {
+ case ButtonAdd:
+ QWhatsThis::add( d->btnAdd, text );
+ break;
+ case ButtonRemove:
+ QWhatsThis::add( d->btnRemove, text );
+ break;
+ case ButtonUp:
+ QWhatsThis::add( d->btnUp, text );
+ break;
+ case ButtonDown:
+ QWhatsThis::add( d->btnDown, text );
+ break;
+ default:
+ kdDebug()<<"KActionSelector::setButtonWhatsThis: DAINBREAD!"<<endl;
+ }
+}
+
+void KActionSelector::setButtonsEnabled()
+{
+ d->btnAdd->setEnabled( d->availableListBox->currentItem() > -1 );
+ d->btnRemove->setEnabled( d->selectedListBox->currentItem() > -1 );
+ d->btnUp->setEnabled( d->selectedListBox->currentItem() > 0 );
+ d->btnDown->setEnabled( d->selectedListBox->currentItem() > -1 &&
+ d->selectedListBox->currentItem() < (int)d->selectedListBox->count() - 1 );
+}
+
+//END Public Methods
+
+//BEGIN Properties
+
+bool KActionSelector::moveOnDoubleClick() const
+{
+ return d->moveOnDoubleClick;
+}
+
+void KActionSelector::setMoveOnDoubleClick( bool b )
+{
+ d->moveOnDoubleClick = b;
+}
+
+bool KActionSelector::keyboardEnabled() const
+{
+ return d->keyboardEnabled;
+}
+
+void KActionSelector::setKeyboardEnabled( bool b )
+{
+ d->keyboardEnabled = b;
+}
+
+QString KActionSelector::availableLabel() const
+{
+ return d->lAvailable->text();
+}
+
+void KActionSelector::setAvailableLabel( const QString &text )
+{
+ d->lAvailable->setText( text );
+}
+
+QString KActionSelector::selectedLabel() const
+{
+ return d->lSelected->text();
+}
+
+void KActionSelector::setSelectedLabel( const QString &text )
+{
+ d->lSelected->setText( text );
+}
+
+KActionSelector::ButtonIconSize KActionSelector::buttonIconSize() const
+{
+ return d->iconSize;
+}
+
+void KActionSelector::setButtonIconSize( ButtonIconSize size )
+{
+ d->iconSize = size;
+ // reload icons
+ loadIcons();
+}
+
+KActionSelector::InsertionPolicy KActionSelector::availableInsertionPolicy() const
+{
+ return d->availableInsertionPolicy;
+}
+
+void KActionSelector::setAvailableInsertionPolicy( InsertionPolicy p )
+{
+ d->availableInsertionPolicy = p;
+}
+
+KActionSelector::InsertionPolicy KActionSelector::selectedInsertionPolicy() const
+{
+ return d->selectedInsertionPolicy;
+}
+
+void KActionSelector::setSelectedInsertionPolicy( InsertionPolicy p )
+{
+ d->selectedInsertionPolicy = p;
+}
+
+bool KActionSelector::showUpDownButtons() const
+{
+ return d->showUpDownButtons;
+}
+
+void KActionSelector::setShowUpDownButtons( bool show )
+{
+ d->showUpDownButtons = show;
+ if ( show )
+ {
+ d->btnUp->show();
+ d->btnDown->show();
+ }
+ else
+ {
+ d->btnUp->hide();
+ d->btnDown->hide();
+ }
+}
+
+//END Properties
+
+//BEGIN Public Slots
+
+void KActionSelector::polish()
+{
+ setButtonsEnabled();
+}
+
+//END Public Slots
+
+//BEGIN Protected
+void KActionSelector::keyPressEvent( QKeyEvent *e )
+{
+ if ( ! d->keyboardEnabled ) return;
+ if ( (e->state() & Qt::ControlButton) )
+ {
+ switch ( e->key() )
+ {
+ case Key_Right:
+ buttonAddClicked();
+ break;
+ case Key_Left:
+ buttonRemoveClicked();
+ break;
+ case Key_Up:
+ buttonUpClicked();
+ break;
+ case Key_Down:
+ buttonDownClicked();
+ break;
+ default:
+ e->ignore();
+ return;
+ }
+ }
+}
+
+bool KActionSelector::eventFilter( QObject *o, QEvent *e )
+{
+ if ( d->keyboardEnabled && e->type() == QEvent::KeyPress )
+ {
+ if ( (((QKeyEvent*)e)->state() & Qt::ControlButton) )
+ {
+ switch ( ((QKeyEvent*)e)->key() )
+ {
+ case Key_Right:
+ buttonAddClicked();
+ break;
+ case Key_Left:
+ buttonRemoveClicked();
+ break;
+ case Key_Up:
+ buttonUpClicked();
+ break;
+ case Key_Down:
+ buttonDownClicked();
+ break;
+ default:
+ return QWidget::eventFilter( o, e );
+ break;
+ }
+ return true;
+ }
+ else if ( o->inherits( "QListBox" ) )
+ {
+ switch ( ((QKeyEvent*)e)->key() )
+ {
+ case Key_Return:
+ case Key_Enter:
+ QListBox *lb = (QListBox*)o;
+ int index = lb->currentItem();
+ if ( index < 0 ) break;
+ moveItem( lb->item( index ) );
+ return true;
+ }
+ }
+ }
+ return QWidget::eventFilter( o, e );
+}
+
+//END Protected
+
+//BEGIN Private Slots
+
+void KActionSelector::buttonAddClicked()
+{
+ // move all selected items from available to selected listbox
+ QListBoxItem *item = d->availableListBox->firstItem();
+ while ( item ) {
+ if ( item->isSelected() ) {
+ d->availableListBox->takeItem( item );
+ d->selectedListBox->insertItem( item, insertionIndex( d->selectedListBox, d->selectedInsertionPolicy ) );
+ d->selectedListBox->setCurrentItem( item );
+ emit added( item );
+ }
+ item = item->next();
+ }
+ if ( d->selectedInsertionPolicy == Sorted )
+ d->selectedListBox->sort();
+ d->selectedListBox->setFocus();
+}
+
+void KActionSelector::buttonRemoveClicked()
+{
+ // move all selected items from selected to available listbox
+ QListBoxItem *item = d->selectedListBox->firstItem();
+ while ( item ) {
+ if ( item->isSelected() ) {
+ d->selectedListBox->takeItem( item );
+ d->availableListBox->insertItem( item, insertionIndex( d->availableListBox, d->availableInsertionPolicy ) );
+ d->availableListBox->setCurrentItem( item );
+ emit removed( item );
+ }
+ item = item->next();
+ }
+ if ( d->availableInsertionPolicy == Sorted )
+ d->availableListBox->sort();
+ d->availableListBox->setFocus();
+}
+
+void KActionSelector::buttonUpClicked()
+{
+ int c = d->selectedListBox->currentItem();
+ if ( c < 0 ) return;
+ QListBoxItem *item = d->selectedListBox->item( c );
+ d->selectedListBox->takeItem( item );
+ d->selectedListBox->insertItem( item, c-1 );
+ d->selectedListBox->setCurrentItem( item );
+ emit movedUp( item );
+}
+
+void KActionSelector::buttonDownClicked()
+{
+ int c = d->selectedListBox->currentItem();
+ if ( c < 0 ) return;
+ QListBoxItem *item = d->selectedListBox->item( c );
+ d->selectedListBox->takeItem( item );
+ d->selectedListBox->insertItem( item, c+1 );
+ d->selectedListBox->setCurrentItem( item );
+ emit movedDown( item );
+}
+
+void KActionSelector::itemDoubleClicked( QListBoxItem *item )
+{
+ if ( d->moveOnDoubleClick )
+ moveItem( item );
+}
+
+//END Private Slots
+
+//BEGIN Private Methods
+
+void KActionSelector::loadIcons()
+{
+ d->btnAdd->setIconSet( SmallIconSet( d->addIcon, d->iconSize ) );
+ d->btnRemove->setIconSet( SmallIconSet( d->removeIcon, d->iconSize ) );
+ d->btnUp->setIconSet( SmallIconSet( d->upIcon, d->iconSize ) );
+ d->btnDown->setIconSet( SmallIconSet( d->downIcon, d->iconSize ) );
+}
+
+void KActionSelector::moveItem( QListBoxItem *item )
+{
+ QListBox *lbFrom = item->listBox();
+ QListBox *lbTo;
+ if ( lbFrom == d->availableListBox )
+ lbTo = d->selectedListBox;
+ else if ( lbFrom == d->selectedListBox )
+ lbTo = d->availableListBox;
+ else //?! somewhat unlikely...
+ return;
+
+ InsertionPolicy p = ( lbTo == d->availableListBox ) ?
+ d->availableInsertionPolicy : d->selectedInsertionPolicy;
+
+ lbFrom->takeItem( item );
+ lbTo->insertItem( item, insertionIndex( lbTo, p ) );
+ lbTo->setFocus();
+ lbTo->setCurrentItem( item );
+
+ if ( p == Sorted )
+ lbTo->sort();
+ if ( lbTo == d->selectedListBox )
+ emit added( item );
+ else
+ emit removed( item );
+}
+
+int KActionSelector::insertionIndex( QListBox *lb, InsertionPolicy policy )
+{
+ int index;
+ switch ( policy )
+ {
+ case BelowCurrent:
+ index = lb->currentItem();
+ if ( index > -1 ) index += 1;
+ break;
+ case AtTop:
+ index = 0;
+ break;
+ default:
+ index = -1;
+ }
+ return index;
+}
+
+//END Private Methods
+#include "kactionselector.moc"
diff --git a/parts/fileselector/kactionselector.h b/parts/fileselector/kactionselector.h
new file mode 100644
index 00000000..bc82e21b
--- /dev/null
+++ b/parts/fileselector/kactionselector.h
@@ -0,0 +1,399 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _KACTION_SELECTOR_H_
+#define _KACTION_SELECTOR_H_
+
+#include <qwidget.h>
+
+class QListBox;
+class QListBoxItem;
+class QKeyEvent;
+class QEvent;
+class QIconSet;
+
+class KActionSelectorPrivate;
+
+/**
+ @short A widget for selecting and arranging actions/objects
+ This widget allows the user to select from a set of objects and arrange
+ the order of the selected ones using two list boxes labeled "Available"
+ and "Used" with horizontal arrows in between to move selected objects between
+ the two, and vertical arrows on the right to arrange the order of the selected
+ objects.
+
+ The widget moves objects to the other listbox when doubleclicked if
+ the property moveOnDoubleClick is set to true (default). See moveOnDoubleClick()
+ and setMoveOnDoubleClick().
+
+ The user control the widget using the keyboard if enabled (default),
+ see keyboardEnabled.
+
+ Note that this may conflist with keyboard selection in the selected list box,
+ if you set that to anything else than QListBox::Single (which is the default).
+
+ To use it, simply construct an instance and then add items to the two listboxes,
+ available through lbAvailable() and lbSelected(). Whenever you want, you can retrieve
+ the selected options using QListBox methods on lbSelected().
+
+ This way, you can use your own QListBoxItem class, allowing you to easily
+ store object data in those.
+
+ When an item is moved to a listbox, it is placed below the current item
+ of that listbox.
+
+ Standard arrow icons are used, but you can use icons of your own choice if desired,
+ see setButtonIcon(). It is also possible to set tooltips and whatsthis help
+ for the buttons. See setButtonTooltip() and setButtonWhatsThis().
+
+ To set whatsthis or tooltips for the listboxes, access them through
+ availableListbox() and selectedListBox().
+
+ All the moving buttons are automatically set enabled as expected.
+
+ Signals are sent each time an item is moved, allowing you to follow the
+ users actions if you need to. See addedToSelection(), removedFromSelection(),
+ movedUp() and movedDown()
+
+ @author Anders Lund <anders@alweb.dk>
+*/
+
+class KActionSelector : public QWidget {
+ Q_OBJECT
+ Q_ENUMS( ButtonIconSize InsertionPolicy )
+ Q_PROPERTY( bool moveOnDoubleClick READ moveOnDoubleClick WRITE setMoveOnDoubleClick )
+ Q_PROPERTY( bool keyboardEnabled READ keyboardEnabled WRITE setKeyboardEnabled )
+ Q_PROPERTY( QString availableLabel READ availableLabel WRITE setAvailableLabel )
+ Q_PROPERTY( QString selectedLabel READ selectedLabel WRITE setSelectedLabel )
+ Q_PROPERTY( ButtonIconSize buttonIconSize READ buttonIconSize WRITE setButtonIconSize )
+ Q_PROPERTY( InsertionPolicy availableInsertionPolicy READ availableInsertionPolicy WRITE setAvailableInsertionPolicy )
+ Q_PROPERTY( InsertionPolicy selectedInsertionPolicy READ selectedInsertionPolicy WRITE setSelectedInsertionPolicy )
+ Q_PROPERTY( bool showUpDownButtons READ showUpDownButtons WRITE setShowUpDownButtons )
+
+public:
+ KActionSelector( QWidget *parent=0, const char *name=0 );
+ ~KActionSelector();
+
+ /**
+ @return The QListBox holding the available actions
+ */
+ QListBox *availableListBox();
+
+ /**
+ @return The QListBox holding the selected actions
+ */
+ QListBox *selectedListBox();
+
+ /**
+ This enum indentifies the moving buttons
+ */
+ enum MoveButton {
+ ButtonAdd,
+ ButtonRemove,
+ ButtonUp,
+ ButtonDown
+ };
+
+ /**
+ This enum identifies the icon sizes, used for the move buttons.
+ The values correspond to the following pixel sizes:
+ @li SmallIcon - the return value of IconSize( KIcon::Small ), the user defined size
+ of a small icon in KDE. This is the default setting.
+ @li Small - 16px
+ @li Medium - 22px
+ @li Large - 32px
+ @li XLarge - 48px
+ */
+ enum ButtonIconSize {
+ SmallIcon,
+ Small,
+ Medium,
+ Large,
+ XLarge
+ };
+
+ /**
+ This enum defines policies for where to insert moved items in a listbox.
+ The following policies are currently defined:
+ @li BelowCurrent - The item is inserted below the listbox'
+ currentItem() or at the end if there is no curent item.
+ @li Sorted - The listbox is sort()ed after one or more items are inserted.
+ @li AtTop - The item is inserted at index 0 in the listbox.
+ @li AtBottom - The item is inserted at the end of the listbox.
+
+ @sa availableInsertionPolicy(), setAvailableInsertionPolicy(),
+ selectedInsertionPolicy(), setSelectedInsertionPolicy().
+ */
+ enum InsertionPolicy {
+ BelowCurrent,
+ Sorted,
+ AtTop,
+ AtBottom
+ };
+
+ /**
+ @return Wheather moveOnDoubleClcik is enabled.
+
+ If enabled, an item in any listbox will be moved to the other one whenever
+ doubleclicked.
+ @sa setMoveOnDoubleClick()
+ */
+ bool moveOnDoubleClick() const;
+
+ /**
+ Sets moveOnDoubleClick to @p enable
+ @sa moveOnDoubleClick()
+ */
+ void setMoveOnDoubleClick( bool enable );
+
+ /**
+ @return Weather keyboard control is enabled.
+
+ When Keyboard control is enabled, the widget will react to
+ the following keyboard actions:
+ @li CTRL + Right - simulate clicking the add button
+ @li CTRL + Left - simulate clicking the remove button
+ @li CTRL + Up - simulate clicking the up button
+ @li CTRL + Down - simulate clicking the down button
+
+ Additionally, pressing RETURN or ENTER on one of the list boxes
+ will cause the current item of that listbox to be moved to the other
+ listbox.
+
+ The keyboard actions are enabled by default.
+
+ @sa setKeyboardEnabled()
+ */
+ bool keyboardEnabled() const;
+
+ /**
+ Sets the keyboard enabled depending on @p enable.
+ @sa keyboardEnabled()
+ */
+ void setKeyboardEnabled( bool enable );
+
+ /**
+ @return The text of the label for the available items listbox.
+ */
+ QString availableLabel() const;
+
+ /**
+ Sets the label for the available items listbox to @p text.
+ Note that this label has the listbox as its @e buddy, so that
+ if you have a single ampersand in the text, the following character
+ will become the accellerator to focus te listbox.
+ */
+ void setAvailableLabel( const QString & text );
+
+ /**
+ @return the label of the selected items listbox.
+ */
+ QString selectedLabel() const;
+
+ /**
+ Sets the label for the selected items listbox to @p text.
+ Note that this label has the listbox as its @e buddy, so that
+ if you have a single ampersand in the text, the following character
+ will become the accellerator to focus te listbox.
+ */
+ void setSelectedLabel( const QString & text );
+
+ /**
+ @return the current ButtonIconSize.
+ */
+ ButtonIconSize buttonIconSize() const;
+
+ /**
+ Sets the button icon size.
+ See ButtonIconSize for the possible values and their pixel meaning.
+ */
+ void setButtonIconSize( ButtonIconSize size );
+
+ /**
+ @return The current insertion policy for the available listbox.
+ The default policy for the available listbox is Sorted.
+ See also InsertionPolicy, setAvailableInsertionPolicy().
+ */
+ InsertionPolicy availableInsertionPolicy() const;
+
+ /**
+ Sets the insertion policy for the available listbox.
+ See also InsertionPolicy, availableInsertionPolicy().
+ */
+ void setAvailableInsertionPolicy( InsertionPolicy policy );
+
+ /**
+ @return The current insertion policy for the selected listbox.
+ The default policy for the selected listbox is BelowCurrent.
+ See also InsertionPolicy, setSelectedInsertionPolicy().
+ */
+ InsertionPolicy selectedInsertionPolicy() const;
+
+ /**
+ Sets the insertion policy for the selected listbox.
+ See also InsertionPolicy, selectedInsertionPolicy().
+ */
+ void setSelectedInsertionPolicy( InsertionPolicy policy );
+
+ /**
+ @return wheather the Up and Down buttons should be displayed.
+ */
+ bool showUpDownButtons() const;
+
+ /**
+ Sets wheather the Up and Down buttons should be displayed
+ according to @p show
+ */
+ void setShowUpDownButtons( bool show );
+
+ /**
+ Sets the pixmap of the button @p button to @p icon.
+ It calls SmallIconSet(pm) to generate the icon set.
+ */
+ void setButtonIcon( const QString &icon, MoveButton button );
+
+ /**
+ Sets the iconset for button @p button to @p iconset.
+ You can use this method to et a costum icon set. Either
+ created by @ref QIconSet, or use the application instance of
+ @ref KIconLoader (recommended).
+ */
+ void setButtonIconSet( const QIconSet &iconset, MoveButton button );
+
+ /**
+ Sets the tooltip for the button @p button to @p tip.
+ */
+ void setButtonTooltip( const QString &tip, MoveButton button );
+
+ /**
+ Sets the whatsthis help for button @p button to @p text.
+ */
+ void setButtonWhatsThis( const QString &text, MoveButton button );
+
+ /**
+ Sets the enabled state of all moving buttons to reflect the current
+ options.
+
+ Be sure to call this if you add or removes items to either listbox after the
+ widget is show()n
+ */
+ void setButtonsEnabled();
+
+signals:
+ /**
+ Emitted when an item is moved to the "selected" listbox.
+ */
+ void added( QListBoxItem *item );
+
+ /**
+ Emitted when an item is moved out of the "selected" listbox.
+ */
+ void removed( QListBoxItem *item );
+
+ /**
+ Emitted when an item is moved upwards in the "selected" listbox.
+ */
+ void movedUp( QListBoxItem *item );
+
+ /**
+ Emitted when an item is moved downwards in the "selected" listbox.
+ */
+ void movedDown( QListBoxItem *item );
+
+ /**
+ Emitted when an item is moved to the "selected" listbox.
+ */
+// void addedToSelection( QListBoxItem *item );
+
+public slots:
+ /**
+ Reimplemented for internal reasons.
+ (calls setButtonsEnabled())
+ */
+ void polish();
+
+protected:
+ /**
+ Reimplamented for internal reasons.
+ */
+ void keyPressEvent( QKeyEvent * );
+
+ /**
+ Reimplemented for internal reasons.
+ */
+ bool eventFilter( QObject *, QEvent * );
+
+private slots:
+ /**
+ Move selected item from available box to the selected box
+ */
+ void buttonAddClicked();
+
+ /**
+ Move selected item from selected box to available box
+ */
+ void buttonRemoveClicked();
+
+ /**
+ Move selected item in selected box upwards
+ */
+ void buttonUpClicked();
+
+ /**
+ Move seleted item in selected box downwards
+ */
+ void buttonDownClicked();
+
+ /**
+ Moves the item @p item to the other listbox if moveOnDoubleClick is enabled.
+ */
+ void itemDoubleClicked( QListBoxItem *item );
+
+ /**
+ connected to both list boxes to set the buttons enabled
+ */
+ void slotCurrentChanged( QListBoxItem * ) { setButtonsEnabled(); };
+
+private:
+
+ /**
+ Move item @p item to the other listbox
+ */
+ void moveItem( QListBoxItem *item );
+
+ /**
+ loads the icons for the move buttons.
+ */
+ void loadIcons();
+
+ /**
+ @return the index to insert an item into listbox @p lb,
+ given InsertionPolicy @p policy.
+
+ Note that if policy is Sorted, this will return -1.
+ Sort the listbox after inserting the item in that case.
+ */
+ int insertionIndex( QListBox *lb, InsertionPolicy policy );
+
+ /**
+ Private data storage
+ */
+ KActionSelectorPrivate *d;
+};
+
+#endif // _KACTION_SELECTOR_H_
diff --git a/parts/fileselector/kbookmarkhandler.cpp b/parts/fileselector/kbookmarkhandler.cpp
new file mode 100644
index 00000000..b1854f1a
--- /dev/null
+++ b/parts/fileselector/kbookmarkhandler.cpp
@@ -0,0 +1,99 @@
+/* This file is part of the KDE project
+ Copyright (C) xxxx KFile Authors
+ Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <qtextstream.h>
+
+#include <kxmlguiclient.h>
+#include <kbookmarkimporter.h>
+#include <kpopupmenu.h>
+#include <ksavefile.h>
+#include <kstandarddirs.h>
+#include <kdiroperator.h>
+#include <kaction.h>
+
+#include "kbookmarkhandler.h"
+#include "kbookmarkhandler.moc"
+
+
+KBookmarkHandler::KBookmarkHandler( KDevFileSelector *parent, KPopupMenu* kpopupmenu )
+ : QObject( parent, "KBookmarkHandler" ),
+ KBookmarkOwner(),
+ mParent( parent ),
+ m_menu( kpopupmenu ),
+ m_importStream( 0L )
+{
+ if (!m_menu)
+ m_menu = new KPopupMenu( parent, "bookmark menu" );
+
+ QString file = locate( "data", "kdevfileselector/fsbookmarks.xml" );
+ if ( file.isEmpty() )
+ file = locateLocal( "data", "kdevfileselector/fsbookmarks.xml" );
+
+ KBookmarkManager *manager = KBookmarkManager::managerForFile( file, false);
+ manager->setUpdate( true );
+ manager->setShowNSBookmarks( false );
+
+ m_bookmarkMenu = new KBookmarkMenu( manager, this, m_menu, 0, true );
+}
+
+KBookmarkHandler::~KBookmarkHandler()
+{
+ // delete m_bookmarkMenu; ###
+}
+
+QString KBookmarkHandler::currentURL() const
+{
+ return mParent->dirOperator()->url().url();
+}
+
+
+void KBookmarkHandler::slotNewBookmark( const QString& text,
+ const QCString& url,
+ const QString& additionalInfo )
+{
+ Q_UNUSED( text );
+ *m_importStream << "<bookmark icon=\"" << KMimeType::iconForURL( KURL( url ) );
+ *m_importStream << "\" href=\"" << QString::fromUtf8(url) << "\">\n";
+ *m_importStream << "<title>" << (additionalInfo.isEmpty() ? QString::fromUtf8(url) : additionalInfo) << "</title>\n</bookmark>\n";
+}
+
+void KBookmarkHandler::slotNewFolder( const QString& text, bool /*open*/,
+ const QString& /*additionalInfo*/ )
+{
+ *m_importStream << "<folder icon=\"bookmark_folder\">\n<title=\"";
+ *m_importStream << text << "\">\n";
+}
+
+void KBookmarkHandler::newSeparator()
+{
+ *m_importStream << "<separator/>\n";
+}
+
+void KBookmarkHandler::endFolder()
+{
+ *m_importStream << "</folder>\n";
+}
+
+void KBookmarkHandler::virtual_hook( int id, void* data )
+{ KBookmarkOwner::virtual_hook( id, data ); }
+
diff --git a/parts/fileselector/kbookmarkhandler.h b/parts/fileselector/kbookmarkhandler.h
new file mode 100644
index 00000000..9849443d
--- /dev/null
+++ b/parts/fileselector/kbookmarkhandler.h
@@ -0,0 +1,70 @@
+/* This file is part of the KDE project
+ Copyright (C) xxxx KFile Authors
+ Copyright (C) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef _KBOOKMARKHANDLER_H_
+#define _KBOOKMARKHANDLER_H_
+
+#include <kbookmarkmanager.h>
+#include <kbookmarkmenu.h>
+#include "fileselector_widget.h"
+
+class QTextStream;
+class KPopupMenu;
+class KActionMenu;
+
+class KBookmarkHandler : public QObject, public KBookmarkOwner
+{
+ Q_OBJECT
+
+public:
+ KBookmarkHandler( KDevFileSelector *parent, KPopupMenu *kpopupmenu=0 );
+ ~KBookmarkHandler();
+
+ // KBookmarkOwner interface:
+ virtual void openBookmarkURL( const QString& url ) { emit openURL( url ); }
+ virtual QString currentURL() const;
+
+ KPopupMenu *menu() const { return m_menu; }
+
+signals:
+ void openURL( const QString& url );
+
+private slots:
+ void slotNewBookmark( const QString& text, const QCString& url,
+ const QString& additionalInfo );
+ void slotNewFolder( const QString& text, bool open,
+ const QString& additionalInfo );
+ void newSeparator();
+ void endFolder();
+
+protected:
+ virtual void virtual_hook( int id, void* data );
+
+private:
+ KDevFileSelector *mParent;
+ KPopupMenu *m_menu;
+ KBookmarkMenu *m_bookmarkMenu;
+
+ QTextStream *m_importStream;
+
+ //class KBookmarkHandlerPrivate *d;
+};
+
+
+#endif // _KBOOKMARKHANDLER_H_
diff --git a/parts/fileselector/kdevfileselector.desktop b/parts/fileselector/kdevfileselector.desktop
new file mode 100644
index 00000000..611da8d0
--- /dev/null
+++ b/parts/fileselector/kdevfileselector.desktop
@@ -0,0 +1,89 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Powerful network transparent file browser utility.
+Comment[ca]=Potent utilitat per a la navegació entre fitxers, transparent a la xarxa.
+Comment[da]=Stærkt netværkstransparent filsøgerredskab.
+Comment[de]=Ein mächtiges, netzwerktransparentes Dateiverwaltungswerkzeug.
+Comment[el]=Ισχυρό εργαλείο περιηγητή αρχείων με δικτυακή υποστήριξη.
+Comment[es]=Potente utilidad de navegación de archivos transparente a la red.
+Comment[et]=Võimas failide lehitsemise rakendus.
+Comment[eu]=Fitxategiak arakatzeko sare gardeneko tresna ahaltsua.
+Comment[fa]=برنامۀ سودمند مرورگر پروندۀ شفاف شبکۀ قوی
+Comment[fr]=Puissant utilitaire de navigateur de fichiers transparent vis-à-vis du réseau.
+Comment[gl]=Potente utilidade de navegación de ficheiros con soporte para navegación da rede de forma transparente.
+Comment[hi]=शक्तिशाली नेटवर्क ट्रांसपेरेन्ट फ़ाइल ब्राउज़र यूटिलिटी
+Comment[hu]=Fájlböngésző program (hálózatkezeléssel)
+Comment[it]=Utilità per la navigazione trasparente dei file in rete.
+Comment[ja]=強力なネットワーク透過ファイルブラウザユーティリティ
+Comment[ms]=Utiliti pelayar fail telus rangkaian yang berkuasa
+Comment[nds]=En mächtig, nettwarktransparent Dateigrieper.
+Comment[ne]=शक्तिशाली सञ्जाल पारदर्शी फाइल ब्राउजर युटिलिटी
+Comment[nl]=Krachtige, netwerktransparante bestandsbrowser.
+Comment[pl]=Potężne narzędzie do przeglądania plików z obsługą sieci.
+Comment[pt]=Utilitário de navegação de ficheiros poderoso.
+Comment[pt_BR]=Poderoso utilitário de navegação de arquivos transparente à rede.
+Comment[ru]=Средство просмотра списка файлов с поддержкой работы по сети.
+Comment[sk]=Výkonný sieťovo-transparentný nástroj na prezeranie súborov.
+Comment[sr]=Моћан програмчић за претраживање фајлова који је независтан од мреже.
+Comment[sr@Latn]=Moćan programčić za pretraživanje fajlova koji je nezavistan od mreže.
+Comment[sv]=Kraftfullt nätverkstransparent filbläddringsverktyg
+Comment[ta]=வலிமையுள்ள வலை பின்னல் ஊடக கோப்பினை தேடும் வசதி.
+Comment[tg]=Воситаи намоиши файлҳо бо тарафдории корҳо бо шабака.
+Comment[tr]=Güçlü, ağdan saydam, dosya gözatma yardımcı programı
+Comment[zh_CN]=强有力的网络文件浏览工具。
+Comment[zh_TW]=強大的網路檔案瀏覽工具。
+Name=KDevFileSelector
+Name[da]=KDevelop filvælger
+Name[de]=Datei-Selektor (KDevelop)
+Name[hi]=के-डेव-फ़ाइल-चयनक
+Name[nds]=KDevelop-Dateigrieper
+Name[pl]=KDevWybórPliku
+Name[sk]=KDev voľba súboru
+Name[sv]=KDevelop filväljare
+Name[ta]=KDev கோப்பு தேர்வாளன்
+Name[tg]=Ҷудосози файли KDev
+Name[zh_TW]=KDevelop 檔案選擇器
+GenericName=File Selector
+GenericName[br]=Dibaber ar restr
+GenericName[ca]=Selector de fitxers
+GenericName[cy]=Dewisydd Ffeiliau
+GenericName[da]=Filvælger
+GenericName[de]=Datei-Selektor
+GenericName[el]=Επιλογέας αρχείων
+GenericName[es]=Selector de archivos
+GenericName[et]=Failide valija
+GenericName[eu]=Fitxategi hautatzailea
+GenericName[fa]=گزینندۀ پرونده
+GenericName[fr]=Sélecteur de fichiers
+GenericName[ga]=Roghnóir na gComhad
+GenericName[gl]=Selector de ficheiros
+GenericName[hi]=फ़ाइल चयनक
+GenericName[hu]=Fájlválasztó
+GenericName[it]=Selettore file
+GenericName[ja]=ファイル選択
+GenericName[ms]=Pemilih Fail
+GenericName[nds]=Dateigrieper
+GenericName[ne]=फाइल चयनकर्ता
+GenericName[nl]=Bestandsselector
+GenericName[pl]=Wybór plików
+GenericName[pt]=Selector de Ficheiros
+GenericName[pt_BR]=Seletor de Arquivo
+GenericName[ru]=Выбор файлов
+GenericName[sk]=Voľba súboru
+GenericName[sl]=Izbirnik datotek
+GenericName[sr]=Бирач фајлова
+GenericName[sr@Latn]=Birač fajlova
+GenericName[sv]=Filväljare
+GenericName[ta]=கோப்பு தேர்வாளர்
+GenericName[tg]=Селектори файлҳо
+GenericName[tr]=Dosya Seçici
+GenericName[zh_CN]=文件选择器
+GenericName[zh_TW]=檔案選擇器
+Icon=fileopen
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevfileselector
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Mode=AssistantMode
+X-KDevelop-Properties=GlobalFileManagement
diff --git a/parts/fileselector/kdevpart_fileselector.rc b/parts/fileselector/kdevpart_fileselector.rc
new file mode 100644
index 00000000..940e2ab2
--- /dev/null
+++ b/parts/fileselector/kdevpart_fileselector.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="fileselector" library="libfileselectorplugin" version="1">
+<MenuBar>
+ <Menu name="help"><Text>&amp;Help</Text>
+ <Action name="help_fileselector"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/fileview/Makefile.am b/parts/fileview/Makefile.am
new file mode 100644
index 00000000..7cc33aa6
--- /dev/null
+++ b/parts/fileview/Makefile.am
@@ -0,0 +1,26 @@
+# Here resides the file view part.
+
+INCLUDES = -I$(top_srcdir)/lib/compat -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfileview.la libkdevfilegroups.la
+
+libkdevfileview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfileview_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfilegroups_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfilegroups_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfileview_la_SOURCES = fileviewpart.cpp filetreewidget.cpp partwidget.cpp vcscolorsconfigwidgetbase.ui vcscolorsconfigwidget.cpp stdfiletreewidgetimpl.cpp filetreeviewwidgetimpl.cpp vcsfiletreewidgetimpl.cpp fileitemfactory.cpp
+
+libkdevfilegroups_la_SOURCES = filegroupswidget.cpp addfilegroupdlg.cpp filegroupsconfigwidget.cpp filegroupsconfigwidgetbase.ui filegroupspart.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfileview.desktop kdevfilegroups.desktop
+
+# not used currently
+#rcdir = $(kde_datadir)/kdevfileview
+#rc_DATA = kdevfileview.rc
+noinst_HEADERS = vcscolorsconfigwidget.h stdfiletreewidgetimpl.h filetreeviewwidgetimpl.h vcsfiletreewidgetimpl.h fileitemfactory.h
diff --git a/parts/fileview/README.dox b/parts/fileview/README.dox
new file mode 100644
index 00000000..d8143dd1
--- /dev/null
+++ b/parts/fileview/README.dox
@@ -0,0 +1,53 @@
+/** \class FileViewPart
+The file tree list view for displaying files within project dir.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:mario.scalas AT libero.it">Mario Scalas</a>
+
+\feature Provides a way of navigating and interacting with the source files of the current project.
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=file+tree&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">file tree component at Bugzilla database</a>
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
+
+/** \class FileGroupsPart
+Allows grouping of project files according to filename patterns.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:mario.scalas AT libero.it">Mario Scalas</a>
+
+\feature Provides a way of navigating and interacting with the source files (grouped by extension type) of the current project.
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=File+Groups&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">file groups component at Bugzilla database</a>
+
+*/
diff --git a/parts/fileview/addfilegroupdlg.cpp b/parts/fileview/addfilegroupdlg.cpp
new file mode 100644
index 00000000..ef194da1
--- /dev/null
+++ b/parts/fileview/addfilegroupdlg.cpp
@@ -0,0 +1,73 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <kbuttonbox.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+#include <kdeversion.h>
+
+#include "addfilegroupdlg.h"
+
+
+AddFileGroupDialog::AddFileGroupDialog(const QString& old_title, const QString& old_pattern, QWidget *parent, const char *name)
+ : QDialog(parent, name, true)
+{
+ QLabel *title_label = new QLabel(i18n("&Title:"), this);
+ title_edit = new KLineEdit(old_title, this);
+ title_edit->setFocus();
+ title_label->setBuddy(title_edit);
+ connect( title_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) );
+
+ QLabel *pattern_label = new QLabel(i18n("&Pattern:"), this);
+ pattern_edit = new KLineEdit(old_pattern, this);
+ pattern_label->setBuddy(pattern_edit);
+ QFontMetrics fm(pattern_edit->fontMetrics());
+ pattern_edit->setMinimumWidth(fm.width('X')*35);
+ connect( pattern_edit, SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotTextChanged() ) );
+ QVBoxLayout *layout = new QVBoxLayout(this, 10);
+
+ QGridLayout *grid = new QGridLayout(2, 2);
+ layout->addLayout(grid);
+ grid->addWidget(title_label, 0, 0);
+ grid->addWidget(title_edit, 0, 1);
+ grid->addWidget(pattern_label, 1, 0);
+ grid->addWidget(pattern_edit, 1, 1);
+
+ QFrame *frame = new QFrame(this);
+ frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
+ layout->addWidget(frame, 0);
+
+ KButtonBox *buttonbox = new KButtonBox(this);
+ buttonbox->addStretch();
+ m_pOk = buttonbox->addButton(KStdGuiItem::ok());
+ QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel());
+
+ m_pOk->setDefault(true);
+ connect( m_pOk, SIGNAL(clicked()), this, SLOT(accept()) );
+ connect( cancel, SIGNAL(clicked()), this, SLOT(reject()) );
+ buttonbox->layout();
+ layout->addWidget(buttonbox, 0);
+ slotTextChanged();
+}
+
+
+AddFileGroupDialog::~AddFileGroupDialog()
+{}
+
+void AddFileGroupDialog::slotTextChanged()
+{
+ m_pOk->setEnabled( !title_edit->text().isEmpty() && !pattern_edit->text().isEmpty() );
+}
+
+#include "addfilegroupdlg.moc"
diff --git a/parts/fileview/addfilegroupdlg.h b/parts/fileview/addfilegroupdlg.h
new file mode 100644
index 00000000..f72a2007
--- /dev/null
+++ b/parts/fileview/addfilegroupdlg.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _ADDFILEGROUPDLG_H_
+#define _ADDFILEGROUPDLG_H_
+
+#include <qdialog.h>
+#include <klineedit.h>
+class QPushButton;
+
+class AddFileGroupDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddFileGroupDialog( const QString& old_title="", const QString& old_pattern="", QWidget *parent=0, const char *name=0 );
+ ~AddFileGroupDialog();
+
+ QString title() const
+ { return title_edit->text(); }
+ QString pattern() const
+ { return pattern_edit->text(); }
+ private slots:
+ void slotTextChanged();
+private:
+ KLineEdit *title_edit;
+ KLineEdit *pattern_edit;
+ QPushButton *m_pOk;
+};
+
+#endif
diff --git a/parts/fileview/filegroupsconfigwidget.cpp b/parts/fileview/filegroupsconfigwidget.cpp
new file mode 100644
index 00000000..28a0441b
--- /dev/null
+++ b/parts/fileview/filegroupsconfigwidget.cpp
@@ -0,0 +1,133 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filegroupsconfigwidget.h"
+
+#include <qlistview.h>
+#include <knotifyclient.h>
+#include <klocale.h>
+
+#include "domutil.h"
+#include "addfilegroupdlg.h"
+#include "filegroupspart.h"
+
+
+FileGroupsConfigWidget::FileGroupsConfigWidget(FileGroupsPart *part,
+ QWidget *parent, const char *name)
+ : FileGroupsConfigWidgetBase(parent, name)
+{
+ m_part = part;
+
+ listview->setSorting(-1);
+
+ readConfig();
+}
+
+
+FileGroupsConfigWidget::~FileGroupsConfigWidget()
+{}
+
+
+void FileGroupsConfigWidget::readConfig()
+{
+ QDomDocument &dom = *m_part->projectDom();
+ DomUtil::PairList list = DomUtil::readPairListEntry(dom, "/kdevfileview/groups",
+ "group", "name", "pattern");
+
+ QListViewItem *lastItem = 0;
+
+ DomUtil::PairList::ConstIterator it;
+ for (it = list.begin(); it != list.end(); ++it) {
+ QListViewItem *newItem = new QListViewItem(listview, (*it).first, (*it).second);
+ if (lastItem)
+ newItem->moveItem(lastItem);
+ lastItem = newItem;
+ }
+}
+
+
+void FileGroupsConfigWidget::storeConfig()
+{
+ DomUtil::PairList list;
+
+ QListViewItem *item = listview->firstChild();
+ while (item) {
+ list << DomUtil::Pair(item->text(0), item->text(1));
+ item = item->nextSibling();
+ }
+
+ DomUtil::writePairListEntry(*m_part->projectDom(), "/kdevfileview/groups",
+ "group", "name", "pattern", list);
+}
+
+
+void FileGroupsConfigWidget::addGroup()
+{
+ AddFileGroupDialog dlg;
+ dlg.setCaption(i18n("Add File Group"));
+ if (!dlg.exec())
+ return;
+
+ (void) new QListViewItem(listview, dlg.title(), dlg.pattern());
+}
+
+
+void FileGroupsConfigWidget::editGroup()
+{
+ if (listview->childCount()==0 || listview->currentItem()==0)
+ return;
+ AddFileGroupDialog dlg(listview->currentItem()->text(0),listview->currentItem()->text(1));
+ dlg.setCaption(i18n("Edit File Group"));
+ if (!dlg.exec() || dlg.title().isEmpty() || dlg.pattern().isEmpty())
+ return;
+ listview->currentItem()->setText(0,dlg.title());
+ listview->currentItem()->setText(1,dlg.pattern());
+}
+
+
+void FileGroupsConfigWidget::removeGroup()
+{
+ delete listview->currentItem();
+}
+
+
+void FileGroupsConfigWidget::moveUp()
+{
+ if (listview->currentItem() == listview->firstChild()) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ QListViewItem *item = listview->firstChild();
+ while (item->nextSibling() != listview->currentItem())
+ item = item->nextSibling();
+ item->moveItem(listview->currentItem());
+}
+
+
+void FileGroupsConfigWidget::moveDown()
+{
+ if (listview->currentItem()->nextSibling() == 0) {
+ KNotifyClient::beep();
+ return;
+ }
+
+ listview->currentItem()->moveItem(listview->currentItem()->nextSibling());
+}
+
+
+void FileGroupsConfigWidget::accept()
+{
+ storeConfig();
+ m_part->refresh();
+}
+
+#include "filegroupsconfigwidget.moc"
diff --git a/parts/fileview/filegroupsconfigwidget.h b/parts/fileview/filegroupsconfigwidget.h
new file mode 100644
index 00000000..b9b5c574
--- /dev/null
+++ b/parts/fileview/filegroupsconfigwidget.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILEGROUPSCONFIGWIDGET_H_
+#define _FILEGROUPSCONFIGWIDGET_H_
+
+#include "filegroupsconfigwidgetbase.h"
+
+class FileGroupsPart;
+
+
+class FileGroupsConfigWidget : public FileGroupsConfigWidgetBase
+{
+ Q_OBJECT
+
+public:
+ FileGroupsConfigWidget( FileGroupsPart *widget, QWidget *parent, const char *name=0 );
+ ~FileGroupsConfigWidget();
+
+public slots:
+ void accept();
+
+private:
+ virtual void addGroup();
+ virtual void editGroup();
+ virtual void removeGroup();
+ virtual void moveUp();
+ virtual void moveDown();
+
+ void readConfig();
+ void storeConfig();
+
+ FileGroupsPart *m_part;
+};
+
+#endif
diff --git a/parts/fileview/filegroupsconfigwidgetbase.ui b/parts/fileview/filegroupsconfigwidgetbase.ui
new file mode 100644
index 00000000..3b548458
--- /dev/null
+++ b/parts/fileview/filegroupsconfigwidgetbase.ui
@@ -0,0 +1,229 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>FileGroupsConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>filegroups_config_widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>599</width>
+ <height>496</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>File Group View</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>title_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Groups in the file view and their corresponding patterns:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>listview</cstring>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Pattern</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>listview</cstring>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>Layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer6</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>addgroup_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add Group...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>editgroup_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit Group...</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>deletegroup_button</cstring>
+ </property>
+ <property name="text">
+ <string>De&amp;lete Group</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>moveup_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Up</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>movedown_button</cstring>
+ </property>
+ <property name="text">
+ <string>Move &amp;Down</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </hbox>
+</widget>
+<connections>
+ <connection>
+ <sender>moveup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>filegroups_config_widget</receiver>
+ <slot>moveUp()</slot>
+ </connection>
+ <connection>
+ <sender>deletegroup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>filegroups_config_widget</receiver>
+ <slot>removeGroup()</slot>
+ </connection>
+ <connection>
+ <sender>addgroup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>filegroups_config_widget</receiver>
+ <slot>addGroup()</slot>
+ </connection>
+ <connection>
+ <sender>editgroup_button</sender>
+ <signal>clicked()</signal>
+ <receiver>filegroups_config_widget</receiver>
+ <slot>editGroup()</slot>
+ </connection>
+ <connection>
+ <sender>movedown_button</sender>
+ <signal>clicked()</signal>
+ <receiver>filegroups_config_widget</receiver>
+ <slot>moveDown()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">addGroup()</slot>
+ <slot access="protected">editGroup()</slot>
+ <slot access="protected">removeGroup()</slot>
+ <slot access="protected">moveUp()</slot>
+ <slot access="protected">moveDown()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/fileview/filegroupspart.cpp b/parts/fileview/filegroupspart.cpp
new file mode 100644
index 00000000..1c6a5abf
--- /dev/null
+++ b/parts/fileview/filegroupspart.cpp
@@ -0,0 +1,97 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filegroupspart.h"
+#include "filegroupspart.moc"
+
+#include <qwhatsthis.h>
+#include <qvbox.h>
+#include <qtimer.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdialogbase.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+#include "kdevplugininfo.h"
+
+#include "filegroupswidget.h"
+#include "filegroupsconfigwidget.h"
+
+#define FILEGROUPS_OPTIONS 1
+
+typedef KDevGenericFactory<FileGroupsPart> FileGroupsFactory;
+static const KDevPluginInfo data("kdevfilegroups");
+K_EXPORT_COMPONENT_FACTORY( libkdevfilegroups, FileGroupsFactory( data ) )
+
+FileGroupsPart::FileGroupsPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "FileGroupsPart")
+{
+ deleteRequested = false;
+ setInstance(FileGroupsFactory::instance());
+
+ m_filegroups = new FileGroupsWidget(this);
+ m_filegroups->setCaption(i18n("File Group View"));
+ m_filegroups->setIcon(SmallIcon( info()->icon() ) );
+ QWhatsThis::add(m_filegroups, i18n("<b>File group view</b><p>"
+ "The file group viewer shows all files of the project, "
+ "in groups which can be configured in project settings dialog, <b>File Groups</b> tab."));
+ mainWindow()->embedSelectView(m_filegroups, i18n("File Groups"), i18n("File groups in the project directory"));
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("File Groups"), FILEGROUPS_OPTIONS, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+
+ // File groups
+ connect( project(), SIGNAL(addedFilesToProject(const QStringList&)),
+ m_filegroups, SLOT(addFiles(const QStringList&)) );
+ connect( project(), SIGNAL(removedFilesFromProject(const QStringList&)),
+ m_filegroups, SLOT(removeFiles(const QStringList&)) );
+/* connect( project(), SIGNAL(addedFileToProject(const QString&)),
+ m_filegroups, SLOT(addFile(const QString&)) );
+ connect( project(), SIGNAL(removedFileFromProject(const QString&)),
+ m_filegroups, SLOT(removeFile(const QString&)) );*/
+ m_filegroups->refresh();
+}
+
+FileGroupsPart::~FileGroupsPart()
+{
+ deleteRequested = true;
+ if (m_filegroups)
+ mainWindow()->removeView(m_filegroups);
+ delete m_filegroups;
+ delete _configProxy;
+}
+
+void FileGroupsPart::refresh()
+{
+ if (deleteRequested)
+ return;
+ // This method may be called from m_filetree's slot,
+ // so we make sure not to modify the list view during
+ // the execution of the slot
+ QTimer::singleShot(0, m_filegroups, SLOT(refresh()));
+}
+
+void FileGroupsPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ if ( pagenumber == FILEGROUPS_OPTIONS )
+ {
+ FileGroupsConfigWidget *w = new FileGroupsConfigWidget(this, page, "file groups config widget");
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
+ }
+}
diff --git a/parts/fileview/filegroupspart.h b/parts/fileview/filegroupspart.h
new file mode 100644
index 00000000..8e712b4b
--- /dev/null
+++ b/parts/fileview/filegroupspart.h
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILEGROUPSPART_H_
+#define _FILEGROUPSPART_H_
+
+#include <qguardedptr.h>
+//#include <kdialogbase.h>
+#include <configwidgetproxy.h>
+#include "kdevplugin.h"
+
+class FileGroupsWidget;
+class KDialogBase;
+
+class FileGroupsPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ FileGroupsPart( QObject *parent, const char *name, const QStringList & );
+ ~FileGroupsPart();
+
+public slots:
+ void refresh();
+
+private slots:
+ void insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int );
+
+private:
+ QGuardedPtr<FileGroupsWidget> m_filegroups;
+ bool deleteRequested;
+ ConfigWidgetProxy * _configProxy;
+};
+
+#endif
diff --git a/parts/fileview/filegroupswidget.cpp b/parts/fileview/filegroupswidget.cpp
new file mode 100644
index 00000000..9f32460d
--- /dev/null
+++ b/parts/fileview/filegroupswidget.cpp
@@ -0,0 +1,442 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filegroupswidget.h"
+
+#include <qfileinfo.h>
+#include <qdir.h>
+#include <qheader.h>
+#include <qtimer.h>
+#include <qvbox.h>
+#include <qregexp.h>
+
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kpopupmenu.h>
+#include <kxmlguiclient.h>
+#include <kaction.h>
+#include <kdeversion.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+#include "kdevpartcontroller.h"
+#include "domutil.h"
+
+#include "filegroupspart.h"
+#include "filegroupsconfigwidget.h"
+
+
+// Translations for strings in the project file
+static const char *translations[] = {
+ I18N_NOOP("Sources"),
+ I18N_NOOP("Translations"),
+ I18N_NOOP("User Interface"),
+ I18N_NOOP("Others")
+};
+
+class FileComparator {
+public:
+ virtual ~FileComparator(){
+ };
+ virtual bool matches(const QString& name) const = 0;
+};
+
+class RegExpComparator : public FileComparator {
+public:
+ RegExpComparator(const QString& pattern) : m_exp(pattern, true, true){
+ }
+ bool matches(const QString& name) const{
+ return m_exp.exactMatch(name);
+ }
+private:
+ const QRegExp m_exp;
+};
+
+class EndingComparator : public FileComparator {
+public:
+ EndingComparator(const QString& pattern) : m_pattern ( pattern){
+ }
+ bool matches(const QString& name) const{
+ return name.endsWith(m_pattern);
+ }
+private:
+ const QString m_pattern;
+};
+
+class FileViewFolderItem : public QListViewItem
+{
+public:
+ FileViewFolderItem(QListView *parent, const QString &name, const QString &pattern);
+ bool matches(const QString &fileName);
+
+private:
+ QPtrList<FileComparator> m_patterns;
+};
+
+
+FileViewFolderItem::FileViewFolderItem(QListView *parent, const QString &name, const QString &pattern)
+ : QListViewItem(parent, name)
+{
+ setPixmap(0, SmallIcon("folder"));
+ m_patterns.setAutoDelete(true);
+ QStringList patternstring = QStringList::split(';', pattern);
+ QStringList::ConstIterator theend = patternstring.end();
+ for (QStringList::ConstIterator ci = patternstring.begin(); ci != theend; ++ci)
+ {
+ QString pattern = *ci;
+ QString tail = pattern.right( pattern.length() - 1 );
+
+ if ( (tail).contains('*') || pattern.contains('?') || pattern.contains('[') || pattern.contains(']') )
+ {
+ m_patterns.append( new RegExpComparator( pattern ) );
+ }
+ else
+ {
+ if ( pattern.startsWith("*") )
+ {
+ m_patterns.append( new EndingComparator( tail ) );
+ }
+ else
+ {
+ m_patterns.append( new EndingComparator( pattern ) );
+ }
+ }
+ }
+}
+
+
+bool FileViewFolderItem::matches(const QString &fileName)
+{
+ // Test with the file path, so that "*ClientServer/*.h" patterns work
+ QString fName = QFileInfo(fileName).filePath();
+
+ QPtrList<FileComparator>::ConstIterator theend = m_patterns.end();
+ for (QPtrList<FileComparator>::ConstIterator ci = m_patterns.begin(); ci != theend; ++ci)
+ if ((*ci)->matches(fName))
+ return true;
+
+ return false;
+}
+
+
+class FileGroupsFileItem : public QListViewItem
+{
+public:
+ FileGroupsFileItem(QListViewItem *parent, const QString &fileName);
+ QString fileName() const
+ { return fullname; }
+
+private:
+ QString fullname;
+};
+
+
+FileGroupsFileItem::FileGroupsFileItem(QListViewItem *parent, const QString &fileName)
+ : QListViewItem(parent), fullname(fileName)
+{
+ setPixmap(0, SmallIcon("document"));
+ QFileInfo fi(fileName);
+ setText(0, fi.fileName());
+ setText(1, "./" + fi.dirPath());
+}
+
+FileGroupsWidget::FileGroupsWidget(FileGroupsPart *part)
+ : KListView(0, "file view widget"),
+ m_actionToggleShowNonProjectFiles( 0 ), m_actionToggleDisplayLocation( 0 )
+{
+ /*
+ Setting Location ID to -1 so I can check if it has been loaded later.
+ If I dont, it will remove the name column and this is not too good :-)
+ Is there any better way to do this?
+ */
+ LocationID=-1;
+
+ setFocusPolicy(ClickFocus);
+ setRootIsDecorated(true);
+ setResizeMode(QListView::LastColumn);
+ setSorting(-1);
+ addColumn(i18n("Name"));
+ setAllColumnsShowFocus( true );
+
+// addColumn(i18n("Location"));
+
+ connect( this, SIGNAL(executed(QListViewItem*)),
+ this, SLOT(slotItemExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(returnPressed(QListViewItem*)),
+ this, SLOT(slotItemExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
+ this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
+
+ m_actionToggleShowNonProjectFiles = new KToggleAction( i18n("Show Non Project Files"), KShortcut(),
+ this, SLOT(slotToggleShowNonProjectFiles()), this, "actiontoggleshowshownonprojectfiles" );
+ m_actionToggleShowNonProjectFiles->setCheckedState(i18n("Hide Non Project Files"));
+ m_actionToggleShowNonProjectFiles->setWhatsThis(i18n("<b>Show non project files</b><p>Shows files that do not belong to a project in a file tree."));
+
+ m_actionToggleDisplayLocation = new KToggleAction( i18n("Display Location Column"), KShortcut(),
+ this, SLOT(slotToggleDisplayLocation()), this, "actiontoggleshowlocation" );
+ m_actionToggleDisplayLocation->setWhatsThis(i18n("<b>Display the Location Column</b><p>Displays a column with the location of the files."));
+
+ m_part = part;
+ (void) translations; // supress compiler warning
+
+ QDomDocument &dom = *m_part->projectDom();
+ m_actionToggleShowNonProjectFiles->setChecked( !DomUtil::readBoolEntry(dom, "/kdevfileview/groups/hidenonprojectfiles") );
+ m_actionToggleDisplayLocation->setChecked( !DomUtil::readBoolEntry(dom, "/kdevfileview/groups/hidenonlocation") );
+}
+
+
+FileGroupsWidget::~FileGroupsWidget()
+{
+ QDomDocument &dom = *m_part->projectDom();
+ DomUtil::writeBoolEntry( dom, "/kdevfileview/groups/hidenonprojectfiles", !m_actionToggleShowNonProjectFiles->isChecked() );
+ DomUtil::writeBoolEntry( dom, "/kdevfileview/groups/hidenonlocation", !m_actionToggleDisplayLocation->isChecked() );
+}
+
+
+void FileGroupsWidget::slotItemExecuted(QListViewItem *item)
+{
+ if (!item)
+ return;
+
+ // toggle open state for parents
+ if (item->childCount() > 0)
+ setOpen(item, !isOpen(item));
+
+ // Is it a group item?
+ if (!item->parent())
+ return;
+
+ FileGroupsFileItem *fgfitem = static_cast<FileGroupsFileItem*>(item);
+ m_part->partController()->editDocument(KURL::fromPathOrURL( m_part->project()->projectDirectory() + "/" + fgfitem->fileName() ));
+}
+
+
+void FileGroupsWidget::slotContextMenu(KListView *, QListViewItem *item, const QPoint &p)
+{
+ KPopupMenu popup(i18n("File Groups"), this);
+ /// @todo Add, remove groups
+ int customizeId = popup.insertItem(i18n("Customize..."));
+ popup.setWhatsThis(customizeId, i18n("<b>Customize</b><p>Opens <b>Customize File Groups</b> dialog where the groups can be managed."));
+ if (item) {
+ if (item->parent()) {
+ // Not for group items
+ FileGroupsFileItem *fvfitem = static_cast<FileGroupsFileItem*>(item);
+ QString pathName = m_part->project()->projectDirectory() + QDir::separator() + fvfitem->fileName();
+ KURL::List urls;
+ urls.append(pathName);
+ FileContext context(urls);
+ m_part->core()->fillContextMenu(&popup, &context);
+ }
+ else{
+ QStringList file_list;
+ QListViewItem* i = item->firstChild();
+ while(i){
+ FileGroupsFileItem *fvgitem = static_cast<FileGroupsFileItem*>(i);
+ file_list << fvgitem->fileName();
+ i = i->nextSibling();
+ }
+ FileContext context(file_list);
+ m_part->core()->fillContextMenu(&popup, &context);
+ }
+ }
+ m_actionToggleShowNonProjectFiles->plug( &popup );
+ m_actionToggleDisplayLocation->plug( &popup );
+
+ int res = popup.exec(p);
+ if (res == customizeId) {
+ KDialogBase dlg(KDialogBase::TreeList, i18n("Customize File Groups"),
+ KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, this,
+ "customization dialog");
+ QVBox *vbox = dlg.addVBoxPage(i18n("File Groups"));
+ FileGroupsConfigWidget *w = new FileGroupsConfigWidget(m_part, vbox, "file groups config widget");
+ connect(&dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ dlg.exec();
+ }
+}
+
+QStringList FileGroupsWidget::allFilesRecursively( QString const & dir )
+{
+ QStringList filelist;
+ QString reldir = dir.mid( m_part->project()->projectDirectory().length() +1 );
+
+ // recursively fetch all files in subdirectories
+ QStringList subdirs = QDir( dir ).entryList( QDir::Dirs );
+ QValueListIterator<QString> it = subdirs.begin();
+ while ( it != subdirs.end() )
+ {
+ if ( *it != "." && *it != ".." )
+ {
+ filelist += allFilesRecursively( dir + "/"+ *it );
+ }
+ ++it;
+ }
+
+ // append the project relative directory path to all files in the current directory
+ QStringList dirlist = QDir( dir ).entryList( QDir::Files );
+ QValueListIterator<QString> itt = dirlist.begin();
+ while ( itt != dirlist.end() )
+ {
+ if ( reldir.isEmpty() )
+ {
+ filelist << *itt;
+ }
+ else
+ {
+ filelist << reldir + "/" + *itt;
+ }
+ ++itt;
+ }
+
+ return filelist;
+}
+
+void FileGroupsWidget::refresh()
+{
+ while (firstChild())
+ delete firstChild();
+
+ if (m_actionToggleDisplayLocation->isChecked()) {
+ // Display the Location column
+ LocationID=addColumn(i18n("Location"));
+ }
+ else {
+ // Remove the Location column
+ //Need to check if the ID exists, if not do nothing!!
+ if (LocationID!=-1)
+ removeColumn(LocationID);
+ }
+ QDomDocument &dom = *m_part->projectDom();
+ DomUtil::PairList list =
+ DomUtil::readPairListEntry(dom, "/kdevfileview/groups", "group", "name", "pattern");
+
+ FileViewFolderItem *lastGroup = 0;
+
+ DomUtil::PairList::ConstIterator git;
+ for (git = list.begin(); git != list.end(); ++git) {
+ FileViewFolderItem *newItem = new FileViewFolderItem(this, (*git).first, (*git).second);
+ if (lastGroup)
+ newItem->moveItem(lastGroup);
+ lastGroup = newItem;
+ }
+
+ QStringList allFiles;
+ if (m_actionToggleShowNonProjectFiles->isChecked()) {
+ // get all files in the project directory
+ allFiles = allFilesRecursively( m_part->project()->projectDirectory() );
+ }
+ else {
+ // get all project files
+ allFiles = m_part->project()->allFiles();
+ }
+ QStringList::ConstIterator fit;
+ for (fit = allFiles.begin(); fit != allFiles.end(); ++fit) {
+ QListViewItem *item = firstChild();
+ while (item) {
+ FileViewFolderItem *fvgitem = static_cast<FileViewFolderItem*>(item);
+ if (fvgitem->matches(*fit)) {
+ (void) new FileGroupsFileItem(fvgitem, *fit);
+ break;
+ }
+ item = item->nextSibling();
+ }
+ }
+
+ QListViewItem *item = firstChild();
+ while (item) {
+ item->sortChildItems(0, true);
+ item = item->nextSibling();
+ }
+}
+
+
+void FileGroupsWidget::addFile(const QString &fileName)
+{
+ kdDebug(9017) << "FileView add " << fileName << endl;
+
+ QListViewItem *item = firstChild();
+ while (item) {
+ FileViewFolderItem *fvgitem = static_cast<FileViewFolderItem*>(item);
+ if (fvgitem->matches(fileName))
+ {
+ QString f = fileName;
+ if (fileName.contains(m_part->project()->projectDirectory()))
+ f = fileName.mid(m_part->project()->projectDirectory().length()+1);
+ (void) new FileGroupsFileItem(fvgitem, f);
+// fvgitem->sortChildItems(0, true);
+ break;
+ }
+ item = item->nextSibling();
+ }
+}
+
+void FileGroupsWidget::addFiles ( const QStringList& fileList )
+{
+ QStringList::ConstIterator it;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ this->addFile ( *it );
+ }
+ sort();
+}
+
+void FileGroupsWidget::removeFile(const QString &fileName)
+{
+ kdDebug(9017) << "FileView remove " << fileName << endl;
+
+ QListViewItem *item = firstChild();
+ while (item)
+ {
+ FileViewFolderItem *fvgitem = static_cast<FileViewFolderItem*>(item);
+ QListViewItem *childItem = fvgitem->firstChild();
+ while (childItem)
+ {
+ FileGroupsFileItem *fgfitem = static_cast<FileGroupsFileItem*>(childItem);
+ kdDebug ( 9017 ) << "fvfitem->fileName() is " << fgfitem->fileName() << endl;
+ if (fgfitem->fileName() == fileName )
+ {
+ kdDebug ( 9017 ) << "Deleting: " << fgfitem->fileName() << endl;
+
+ delete fgfitem;
+ return;
+ }
+ childItem = childItem->nextSibling();
+ }
+ item = item->nextSibling();
+ }
+}
+
+void FileGroupsWidget::removeFiles ( const QStringList& fileList )
+{
+ QStringList::ConstIterator it;
+
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ removeFile ( *it );
+ }
+}
+
+void FileGroupsWidget::slotToggleShowNonProjectFiles()
+{
+ refresh();
+}
+
+void FileGroupsWidget::slotToggleDisplayLocation()
+{
+ refresh();
+}
+
+
+#include "filegroupswidget.moc"
+
diff --git a/parts/fileview/filegroupswidget.h b/parts/fileview/filegroupswidget.h
new file mode 100644
index 00000000..7bdbf78b
--- /dev/null
+++ b/parts/fileview/filegroupswidget.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILEGROUPSWIDGET_H_
+#define _FILEGROUPSWIDGET_H_
+
+#include <klistview.h>
+
+class FileGroupsPart;
+class KDevProject;
+
+
+class FileGroupsWidget : public KListView
+{
+ Q_OBJECT
+
+public:
+ FileGroupsWidget(FileGroupsPart *part);
+ ~FileGroupsWidget();
+
+public slots:
+ void refresh();
+ void addFiles ( const QStringList& fileList );
+ void removeFiles ( const QStringList& fileList );
+
+private slots:
+ void slotItemExecuted(QListViewItem *item);
+ void slotContextMenu(KListView *, QListViewItem *item, const QPoint &p);
+ void slotToggleShowNonProjectFiles();
+ void slotToggleDisplayLocation();
+
+protected:
+ void addFile(const QString &fileName);
+ void removeFile(const QString &fileName);
+
+private:
+ QStringList allFilesRecursively( QString const & );
+ FileGroupsPart *m_part;
+
+ class KToggleAction *m_actionToggleShowNonProjectFiles;
+ class KToggleAction *m_actionToggleDisplayLocation;
+ int LocationID;
+};
+
+#endif
+
diff --git a/parts/fileview/fileitemfactory.cpp b/parts/fileview/fileitemfactory.cpp
new file mode 100644
index 00000000..614f535c
--- /dev/null
+++ b/parts/fileview/fileitemfactory.cpp
@@ -0,0 +1,145 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qpainter.h>
+#include <kdebug.h>
+
+#include "filetreewidget.h"
+#include "fileitemfactory.h"
+
+using namespace filetreeview;
+
+///////////////////////////////////////////////////////////////////////////////
+// class FileTreeViewItem
+///////////////////////////////////////////////////////////////////////////////
+
+FileTreeWidget* FileTreeViewItem::listView() const
+{
+ return static_cast<FileTreeWidget*>( QListViewItem::listView() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeViewItem::hideOrShow()
+{
+ kdDebug( 9017 ) << "MyFileTreeViewItem::hideOrShow(): " + path() << endl;
+ setVisible( listView()->shouldBeShown( this ) );
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>( firstChild() );
+ while (item)
+ {
+ //kdDebug( 9017 ) << "MyFileTreeViewItem::hideOrShow(): " + item->path() << endl;
+ item->hideOrShow();
+ item = static_cast<FileTreeViewItem*>( item->nextSibling() );
+ }
+}
+
+bool FileTreeViewItem::changeActiveDir( const QString& olddir, const QString& newdir, bool foundolddir, bool foundnewdir )
+{
+ kdDebug( 9017 ) << "FileTreeViewItem::changeActiveDir(): " + olddir << " new: " << newdir << " for: " << path() << endl;
+
+ if ( this->path() == olddir && isDir() && m_isActiveDir )
+ {
+ m_isActiveDir = false;
+ setVisible( listView()->shouldBeShown( this ) );
+ foundolddir = true;
+ repaint();
+ }
+
+ if ( this->path() == newdir && isDir() && !m_isActiveDir )
+ {
+ m_isActiveDir = true;
+ setVisible( listView()->shouldBeShown( this ) );
+ foundnewdir = true;
+ repaint();
+ }
+
+ if( foundnewdir && foundolddir )
+ return true;
+
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>( firstChild() );
+ while( item )
+ {
+ if ( item->changeActiveDir( olddir, newdir, foundnewdir, foundolddir ) )
+ return true;
+ else
+ item = static_cast<FileTreeViewItem*>(item->nextSibling());
+ }
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool FileTreeViewItem::setProjectFile( QString const & path, bool pf )
+{
+
+ if ( this->path() == path && isProjectFile() != pf )
+ {
+ kdDebug( 9017 ) << "FileTreeViewItem::setProjectFile(): " + path << " projectfile: " << pf << endl;
+ m_isProjectFile = pf;
+ setVisible( listView()->shouldBeShown( this ) );
+ repaint();
+ return true;
+ }
+
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>( firstChild() );
+ while( item )
+ {
+ if ( item->setProjectFile( path, pf ) )
+ return true;
+ else
+ item = static_cast<FileTreeViewItem*>(item->nextSibling());
+ }
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeViewItem::paintCell(QPainter *p, const QColorGroup &cg,
+ int column, int width, int alignment)
+{
+ if ( listView()->showNonProjectFiles() && isProjectFile() )
+ {
+ QFont font( p->font() );
+ font.setBold( true );
+ p->setFont( font );
+ }
+
+ if( isActiveDir() )
+ {
+ QFont font( p->font() );
+ font.setItalic( true );
+ p->setFont( font );
+ }
+
+ QListViewItem::paintCell( p, cg, column, width, alignment );
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+int FileTreeViewItem::compare( QListViewItem *i, int col, bool ascending ) const
+{
+ KFileTreeViewItem* rhs = dynamic_cast<KFileTreeViewItem*>( i );
+ if (rhs)
+ {
+ if (rhs->isDir() && !isDir())
+ return (ascending) ? 1 : -1;
+ else
+ if (!rhs->isDir() && isDir())
+ return (ascending) ? -1 : 1;
+ }
+
+ return QListViewItem::compare( i, col, ascending );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class BranchItemFactory
+///////////////////////////////////////////////////////////////////////////////
diff --git a/parts/fileview/fileitemfactory.h b/parts/fileview/fileitemfactory.h
new file mode 100644
index 00000000..f87ae39a
--- /dev/null
+++ b/parts/fileview/fileitemfactory.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FILEITEMFACTORY_H
+#define FILEITEMFACTORY_H
+
+#include <kfiletreeview.h>
+
+class FileTreeWidget;
+
+/**
+@author KDevelop Authors
+*/
+namespace filetreeview
+{
+ /**
+ @author KDevelop Authors
+ */
+ class FileTreeViewItem : public KFileTreeViewItem
+ {
+ friend class FileTreeBranchItem;
+ protected:
+ FileTreeViewItem( KFileTreeViewItem* parent, KFileItem* item, KFileTreeBranch* branch, bool pf )
+ : KFileTreeViewItem( parent, item, branch ), m_isProjectFile( pf ), m_isActiveDir( false )
+ {
+ hideOrShow();
+ }
+ FileTreeViewItem( KFileTreeView* parent, KFileItem* item, KFileTreeBranch* branch )
+ : KFileTreeViewItem( parent, item, branch ), m_isProjectFile( false )
+ {
+ hideOrShow();
+ }
+ virtual ~FileTreeViewItem() {}
+
+ public:
+ virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment );
+ FileTreeWidget* listView() const;
+ void hideOrShow();
+ bool isProjectFile() const { return m_isProjectFile; }
+ bool setProjectFile( QString const &path, bool pf );
+ bool isActiveDir() const { return m_isActiveDir; }
+ bool changeActiveDir( const QString &, const QString&, bool foundolddir = false, bool foundnewdir = false );
+
+ protected:
+ virtual int compare( QListViewItem *i, int col, bool ascending ) const;
+
+ private:
+ bool m_isProjectFile;
+ bool m_isActiveDir;
+ };
+
+ /**
+ @author KDevelop Authors
+ */
+ class FileTreeBranchItem : public KFileTreeBranch
+ {
+ protected:
+ FileTreeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix )
+ : KFileTreeBranch( view, url, name, pix, false,
+ new FileTreeViewItem( view, new KFileItem( url, "inode/directory", S_IFDIR ), this ) )
+ {
+ }
+ virtual ~FileTreeBranchItem()
+ {
+// if (root())
+// delete root()->fileItem();
+ }
+
+ };
+
+ /**
+ @author KDevelop Authors
+ */
+ class BranchItemFactory
+ {
+ public:
+ virtual FileTreeBranchItem *makeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix ) = 0;
+ };
+}
+
+#endif
diff --git a/parts/fileview/filetreeviewwidgetimpl.cpp b/parts/fileview/filetreeviewwidgetimpl.cpp
new file mode 100644
index 00000000..9e40a3bb
--- /dev/null
+++ b/parts/fileview/filetreeviewwidgetimpl.cpp
@@ -0,0 +1,169 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qpopupmenu.h>
+#include <kxmlguiclient.h>
+#include <kdebug.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <kdeversion.h>
+
+#include <kdevproject.h>
+
+#include "fileviewpart.h"
+#include "filetreewidget.h"
+#include "fileitemfactory.h"
+
+#include "filetreeviewwidgetimpl.h"
+
+using namespace filetreeview;
+
+///////////////////////////////////////////////////////////////////////////////
+// class FileTreeViewWidgetImpl
+///////////////////////////////////////////////////////////////////////////////
+
+FileTreeViewWidgetImpl::FileTreeViewWidgetImpl( FileTreeWidget *parent, const char *name )
+ : QObject( parent, name ), m_branchItemFactory( 0 ),
+ m_part( parent->part() ), m_isReloadingTree( false )
+{
+ kdDebug(9017) << "FileTreeViewWidgetImpl::FileTreeViewWidgetImpl()" << endl;
+
+ // Actions
+ m_actionToggleShowNonProjectFiles = new KToggleAction( i18n("Show Non Project Files"), KShortcut(),
+ this, SLOT(slotToggleShowNonProjectFiles()), this, "actiontoggleshowshownonprojectfiles" );
+ m_actionToggleShowNonProjectFiles->setCheckedState(i18n("Hide Non Project Files"));
+ m_actionToggleShowNonProjectFiles->setWhatsThis(i18n("<b>Show non project files</b><p>Shows files that do not belong to a project in a file tree."));
+
+ // Reload good ol' settings
+ QDomDocument &dom = *m_part->projectDom();
+ m_actionToggleShowNonProjectFiles->setChecked( !DomUtil::readBoolEntry(dom, "/kdevfileview/tree/hidenonprojectfiles") );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+FileTreeViewWidgetImpl::~FileTreeViewWidgetImpl()
+{
+ kdDebug(9017) << "FileTreeViewWidgetImpl::~FileTreeViewWidgetImpl()" << endl;
+
+ delete m_branchItemFactory;
+
+ QDomDocument &dom = *m_part->projectDom();
+ DomUtil::writeBoolEntry( dom, "/kdevfileview/tree/hidenonprojectfiles", !showNonProjectFiles() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+FileTreeWidget *FileTreeViewWidgetImpl::fileTree() const
+{
+ return static_cast<FileTreeWidget *>( parent() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+QDomDocument &FileTreeViewWidgetImpl::projectDom() const
+{
+ return *part()->projectDom();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+QString FileTreeViewWidgetImpl::projectDirectory() const
+{
+ return part()->project()->projectDirectory();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool FileTreeViewWidgetImpl::showNonProjectFiles() const
+{
+ return m_actionToggleShowNonProjectFiles->isChecked();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeViewWidgetImpl::fillPopupMenu( QPopupMenu *popupMenu, QListViewItem *item ) const
+{
+ // Show the "reload tree" menu-item only if it is requested for the root object
+ // and we don't have a sync-with-repository operation pending (which otherwise will
+ // kill the call-back's from working)
+ if (item == fileTree()->firstChild() && canReloadTree())
+ {
+ int id = popupMenu->insertItem( i18n( "Reload Tree"), this, SLOT( slotReloadTree() ) );
+ popupMenu->setWhatsThis( id, i18n("<b>Reload tree</b><p>Reloads the project files tree.") );
+ }
+
+ m_actionToggleShowNonProjectFiles->plug( popupMenu );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+KURL::List FileTreeViewWidgetImpl::selectedPathUrls()
+{
+ kdDebug(9017) << "FileTreeViewWidgetImpl::selectedPathUrls()" << endl;
+
+ KURL::List urlList;
+
+ QValueList<QListViewItem*> list = allSelectedItems( fileTree()->firstChild() );
+ QValueList<QListViewItem*>::Iterator it = list.begin();
+ while( it != list.end() )
+ {
+ FileTreeViewItem * item = static_cast<FileTreeViewItem*>( *it );
+ if ( fileTree()->shouldBeShown( item ) )
+ {
+ KURL url;
+ url.setPath( item->path() );
+ urlList << url;
+ }
+ ++it;
+ }
+
+ return urlList;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+QValueList<QListViewItem*> FileTreeViewWidgetImpl::allSelectedItems( QListViewItem * item ) const
+{
+ QValueList<QListViewItem*> list;
+
+ if ( item )
+ {
+ if ( item->isSelected() )
+ {
+ list << item;
+ }
+
+ QListViewItem * it = item->firstChild();
+ while( it )
+ {
+ list += allSelectedItems( it );
+ it = it->nextSibling();
+ }
+ }
+
+ return list;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeViewWidgetImpl::slotReloadTree()
+{
+ fileTree()->openDirectory( projectDirectory() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeViewWidgetImpl::slotToggleShowNonProjectFiles()
+{
+ fileTree()->hideOrShow();
+}
+
+#include "filetreeviewwidgetimpl.moc"
diff --git a/parts/fileview/filetreeviewwidgetimpl.h b/parts/fileview/filetreeviewwidgetimpl.h
new file mode 100644
index 00000000..fae4b248
--- /dev/null
+++ b/parts/fileview/filetreeviewwidgetimpl.h
@@ -0,0 +1,105 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef FILETREEVIEWWIDGETIMPL_H
+#define FILETREEVIEWWIDGETIMPL_H
+
+#include <qobject.h>
+#include <qvaluelist.h>
+#include <kfiletreeview.h>
+#include <qdom.h>
+
+#include "fileitemfactory.h"
+
+class FileTreeWidget;
+namespace filetreeview
+{
+ class FileTreeViewItem;
+ class FileTreeBranchItem;
+ class BranchItemFactory;
+}
+class FileViewPart;
+class QHeader;
+class KToggleAction;
+class QPopupMenu;
+
+/**
+* @author Mario Scalas
+* A base class for providing additional features to the standard KFileTreeViewItem-based widget we
+* use for listing files in project directory.
+*/
+class FileTreeViewWidgetImpl : public QObject
+{
+ Q_OBJECT
+public:
+ FileTreeViewWidgetImpl( FileTreeWidget *parent, const char *name );
+ virtual ~FileTreeViewWidgetImpl();
+
+ //! return a list containing the filenames of the currently selected items.
+ KURL::List selectedPathUrls();
+ // shortcuts
+ FileTreeWidget *fileTree() const;
+ QDomDocument &projectDom() const;
+ QHeader *header() const { return fileTree()->header(); }
+ void setColumnWidth( int column, int w ) { fileTree()->setColumnWidth( column, w ); }
+ int contentsWidth() const { return fileTree()->contentsWidth(); }
+ void triggerUpdate() { fileTree()->triggerUpdate(); }
+ FileViewPart *part() const { return m_part; }
+ filetreeview::FileTreeViewItem *currentItem() const { return static_cast<filetreeview::FileTreeViewItem*>( fileTree()->currentItem() ); }
+ /**
+ * @return a reference to a new filetreeview::BranchItemFactory object which can be used for filling
+ * the tree view.
+ */
+ filetreeview::BranchItemFactory *branchItemFactory() const { return m_branchItemFactory; }
+ /**
+ * Costraints that must be satisfied to start a reload of the the tree.
+ * @return
+ */
+ virtual bool canReloadTree() const = 0;
+ /**
+ * Here the popup menu is filled: by standard only the "reload tree" (only if the above function
+ * returns true) and "show project files" options are added
+ * @param popupMenu the menu to fill
+ * @param item the QListViewItem which this menu has been requested upon
+ */
+ virtual void fillPopupMenu( QPopupMenu *popupMenu, QListViewItem *item ) const;
+ /**
+ * @return true if non project files are to be shown, false otherwise
+ */
+ bool showNonProjectFiles() const;
+
+signals:
+ /**
+ * Emitted when the current implementation "recognizes" it cannot work anymore: for example the VCS impl.
+ * can ask to be relieved from work when the VCS plug-in it uses has been unloaded!
+ */
+ void implementationInvalidated();
+
+private slots:
+ void slotReloadTree();
+ void slotToggleShowNonProjectFiles();
+
+protected:
+ void setBranchItemFactory( filetreeview::BranchItemFactory *aFactory ) { m_branchItemFactory = aFactory; }
+ QString projectDirectory() const;
+
+private:
+ QValueList<QListViewItem*> allSelectedItems( QListViewItem * item ) const;
+ filetreeview::BranchItemFactory *m_branchItemFactory;
+
+ FileViewPart *m_part;
+
+ bool m_isReloadingTree;
+
+ KToggleAction *m_actionToggleShowNonProjectFiles;
+};
+
+#endif
diff --git a/parts/fileview/filetreewidget.cpp b/parts/fileview/filetreewidget.cpp
new file mode 100644
index 00000000..e0d7538b
--- /dev/null
+++ b/parts/fileview/filetreewidget.cpp
@@ -0,0 +1,387 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Mario Scalas (VCS Support) *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filetreewidget.h"
+
+#include <qheader.h>
+#include <qpainter.h>
+#include <qregexp.h>
+#include <qstringlist.h>
+#include <qcolor.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <kpopupmenu.h>
+#include <kfileitem.h>
+#include <kurl.h>
+#include <kaction.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+#include "kdevmainwindow.h"
+#include "kdevversioncontrol.h"
+#include "domutil.h"
+#include "urlutil.h"
+
+#include "fileviewpart.h"
+#include "fileitemfactory.h"
+#include "vcsfiletreewidgetimpl.h"
+#include "stdfiletreewidgetimpl.h"
+
+using namespace filetreeview;
+
+///////////////////////////////////////////////////////////////////////////////
+// class FileTreeViewItem
+///////////////////////////////////////////////////////////////////////////////
+
+#include <kdeversion.h>
+
+///////////////////////////////////////////////////////////////////////////////
+// class FileTreeWidget
+///////////////////////////////////////////////////////////////////////////////
+
+FileTreeWidget::FileTreeWidget( FileViewPart *part, QWidget *parent, KDevVCSFileInfoProvider *infoProvider )
+ : KFileTreeView( parent, "filetreewidget" ), m_part( part ), m_rootBranch( 0 )
+{
+ kdDebug(9017) << "Requested FileTree for: " << projectDirectory() << endl;
+ if (versionControl() && infoProvider)
+ kdDebug(9017) << "Valid VCS directory: " << versionControl()->isValidDirectory( projectDirectory() ) << endl;
+
+ if (infoProvider && versionControl() && versionControl()->isValidDirectory( projectDirectory() ))
+ m_impl = new VCSFileTreeWidgetImpl( this, infoProvider );
+ else
+ m_impl = new StdFileTreeWidgetImpl( this );
+
+ //setResizeMode( QListView::LastColumn );
+ setSorting( 0 );
+ setAllColumnsShowFocus( true );
+ setSelectionMode( QListView::Extended ); // Enable multiple items selection by use of Ctrl/Shift
+ setDragEnabled( false );
+
+ // Slot connections
+ connect( this, SIGNAL(executed(QListViewItem*)), this, SLOT(slotItemExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(slotItemExecuted(QListViewItem*)) );
+ connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
+ this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
+ // Intercepts KDevelop core signals and VCS notifications (if available)
+ connect( m_part->project(), SIGNAL( activeDirectoryChanged( const QString&, const QString& ) ),
+ this, SLOT( changeActiveDirectory( const QString&, const QString& ) ) );
+ connect( m_part->project(), SIGNAL( addedFilesToProject( const QStringList & ) ),
+ this, SLOT( addProjectFiles( const QStringList & ) ) );
+ connect( m_part->project(), SIGNAL( removedFilesFromProject( const QStringList & ) ),
+ this, SLOT( removeProjectFiles( const QStringList & ) ) );
+ // Safeguard against VCS plug-in unloading at run-time
+ connect( m_impl, SIGNAL(implementationInvalidated()), this, SLOT(slotImplementationInvalidated()) );
+
+ // Hide pattern for files
+ QDomDocument &dom = *m_part->projectDom();
+ QString defaultHidePattern = "*.o,*.lo,CVS";
+ QString hidePattern = DomUtil::readEntry( dom, "/kdevfileview/tree/hidepatterns", defaultHidePattern );
+ m_hidePatterns = QStringList::split( ",", hidePattern );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+FileTreeWidget::~FileTreeWidget()
+{
+ kdDebug(9017) << "FileTreeWidget::~FileTreeWidget()" << endl;
+
+ QDomDocument &dom = *m_part->projectDom();
+ DomUtil::writeEntry( dom, "/kdevfileview/tree/hidepatterns", hidePatterns() );
+
+// delete m_impl;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::openDirectory( const QString& dirName )
+{
+ kdDebug(9017) << "FileTreeWidget::openDirectory(): " + dirName << endl;
+
+ // if we're reloading
+ if (m_rootBranch)
+ {
+ disconnect( m_rootBranch, SIGNAL(populateFinished(KFileTreeViewItem*)), this, SLOT(finishPopulate(KFileTreeViewItem*)) );
+ removeBranch( m_rootBranch );
+ m_projectFiles.clear();
+ }
+
+ addProjectFiles( m_part->project()->allFiles(), true );
+
+ KURL url = KURL::fromPathOrURL( dirName );
+ const QPixmap& pix = KMimeType::mimeType("inode/directory")->pixmap( KIcon::Small );
+
+ // this is a bit odd, but the order of these calls seems to be important
+ //FileTreeBranch *b = new FileTreeBranch( this, url, url.prettyURL(), pix );
+ FileTreeBranchItem *b = m_impl->branchItemFactory()->makeBranchItem( this, url, url.prettyURL(), pix );
+ b->setChildRecurse( false );
+ m_rootBranch = addBranch( b );
+ m_rootBranch->setOpen( true );
+ connect( m_rootBranch, SIGNAL(populateFinished(KFileTreeViewItem*)), this, SLOT(finishPopulate(KFileTreeViewItem*)) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool FileTreeWidget::shouldBeShown( KFileTreeViewItem* item )
+{
+ FileTreeViewItem * i = static_cast<FileTreeViewItem *>( item );
+ return ( i->isDir() || ( (m_impl->showNonProjectFiles() || i->isProjectFile() )
+ && !matchesHidePattern( i->url().fileName() ) ) ) ;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool FileTreeWidget::matchesHidePattern(const QString &fileName)
+{
+ QStringList::ConstIterator it;
+ for (it = m_hidePatterns.begin(); it != m_hidePatterns.end(); ++it) {
+ QRegExp re(*it, true, true);
+ if (re.search(fileName) == 0 && (uint)re.matchedLength() == fileName.length())
+ return true;
+ }
+
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::hideOrShow()
+{
+ // This is called the first time the tree branch is expanded
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>(firstChild());
+ if( !item )
+ return;
+
+ // Need to skip the root item (which is the sub-directory)
+ // i.e. "/home/devmario/src/kdevelop/parts/cvsservice"
+ item = static_cast<FileTreeViewItem*>( item->firstChild() );
+ // Now fill the sub-tree
+ while (item)
+ {
+ item->hideOrShow();
+ item = static_cast<FileTreeViewItem*>(item->nextSibling());
+ }
+}
+
+void FileTreeWidget::finishPopulate(KFileTreeViewItem* item)
+{
+ if( item == firstChild() )
+ {
+ changeActiveDirectory( "", m_part->project()->activeDirectory() );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::slotItemExecuted( QListViewItem* item )
+{
+ if (!item)
+ return;
+
+ KFileTreeViewItem* ftitem = static_cast<KFileTreeViewItem*>(item);
+
+ if (ftitem->isDir())
+ return;
+
+ m_part->partController()->editDocument( ftitem->url() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::slotContextMenu( KListView *, QListViewItem* item, const QPoint &p )
+{
+ kdDebug(9017) << "FileTreeWidget::slotContextMenu(...)" << endl;
+
+ KPopupMenu popup( i18n("File Tree"), this );
+
+ // If an item is selected, fill the file context with selected files' list
+ if (item)
+ {
+ m_impl->fillPopupMenu( &popup, item );
+ FileContext context( m_impl->selectedPathUrls() );
+ m_part->core()->fillContextMenu( &popup, &context );
+ }
+
+
+ popup.exec( p );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+QString FileTreeWidget::projectDirectory()
+{
+ return m_part->project()->projectDirectory();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @brief Test whether given file (or a directory) is part of this project.
+ *
+ * @param fileName or directory to test for presence.
+ */
+bool FileTreeWidget::isInProject(const QString &fileName) const
+{
+ return m_projectFiles.contains(fileName);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @brief Add a bunch of files to this project.
+ *
+ * Whenever we load a project or user chooses to add a bunch of files using UI,
+ * we end in this method.
+ * We merge the list of files already in the project (if any) with the incoming set.
+ *
+ * @param fileList
+ * @param constructing
+ *
+ * @see m_projectFiles
+ */
+void FileTreeWidget::addProjectFiles( QStringList const & fileList, bool constructing )
+{
+ kdDebug(9017) << "files added to project: " << fileList << endl;
+
+ QStringList::ConstIterator it;
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ if( (*it).isEmpty() )
+ continue;
+ kdDebug(9017) << "adding file: " << *it << endl;
+ const QString file = projectDirectory() + "/" + ( *it );
+ if ( !m_projectFiles.contains( file ) )
+ {
+ // We got a new file to add to this project.
+ // Ensure all the parent directories are part of the project set, too.
+ QStringList paths = QStringList::split( "/", *it);
+ paths.pop_back();
+ while( !paths.isEmpty() )
+ {
+ // We are adding the directories from longest (the one containing our file),
+ // to the shortest, measured from root directory of our project.
+ // Whenever we find out that a directory is already recorded as part of our project,
+ // we may stop adding, because its parent directories were already added -
+ // in some previous addition.
+ QString joinedPaths = paths.join("/");
+ if( m_projectFiles.contains( joinedPaths ) )
+ break;
+ m_projectFiles.insert( projectDirectory() + "/" + joinedPaths, true );
+ paths.pop_back();
+ }
+ m_projectFiles.insert( file, false );
+// kdDebug(9017) << "file added: " << file << endl;
+ }
+
+ if ( !constructing )
+ {
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>(firstChild());
+ if( item )
+ {
+ item->setProjectFile( file, true );
+ }
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::removeProjectFiles( QStringList const & fileList )
+{
+ kdDebug(9017) << "files removed from project: " << fileList.count() << endl;
+
+ QStringList::ConstIterator it;
+ for ( it = fileList.begin(); it != fileList.end(); ++it )
+ {
+ QString file = m_part->project()->projectDirectory() + "/" + ( *it );
+ m_projectFiles.remove( file );
+ kdDebug(9017) << "file removed: " << file << endl;
+
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>(firstChild());
+ if( item )
+ {
+ item->setProjectFile( file, false );
+ }
+ }
+}
+
+void FileTreeWidget::changeActiveDirectory( const QString& olddir, const QString& newdir )
+{
+ FileTreeViewItem* item = static_cast<FileTreeViewItem*>(firstChild());
+ if( item )
+ {
+ item->changeActiveDir( projectDirectory() + "/" + olddir, projectDirectory() + "/" + newdir );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::applyHidePatterns( const QString &hidePatterns )
+{
+ m_hidePatterns = QStringList::split( ",", hidePatterns );
+ hideOrShow();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+QString FileTreeWidget::hidePatterns() const
+{
+ return m_hidePatterns.join( "," );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+KDevVersionControl *FileTreeWidget::versionControl() const
+{
+ if (part() && part()->versionControl())
+ return part()->versionControl();
+ else
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool FileTreeWidget::showNonProjectFiles() const
+{
+ return m_impl->showNonProjectFiles();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileTreeWidget::slotImplementationInvalidated()
+{
+ kdDebug(9017) << "FileTreeWidget::slotImplementationInvalidated()" << endl;
+
+ // Destroy old implementation, create the simpler default impl. and
+ // reload list view
+ // remove old branch
+ removeBranch( m_rootBranch );
+ m_rootBranch = 0; // avoid openDirectory() trying to release the branch
+
+ // Restore a clean situation for an eventual new & different implementation
+ /** \FIXME this for-loop should really go in ~FileTreeViewWidgetImpl() but
+ * it crashes there: here it works :-/
+ */
+ for (int i=columns()-1; i>=0; --i)
+ {
+ kdDebug(9017) << "Removing column: " << i << endl;
+ removeColumn( i );
+ }
+
+ delete m_impl;
+ m_impl = new StdFileTreeWidgetImpl( this );
+ openDirectory( projectDirectory() );
+}
+
+#include "filetreewidget.moc"
diff --git a/parts/fileview/filetreewidget.h b/parts/fileview/filetreewidget.h
new file mode 100644
index 00000000..53dc77d3
--- /dev/null
+++ b/parts/fileview/filetreewidget.h
@@ -0,0 +1,111 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Mario Scalas (VCS Support) *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILETREEWIDGET_H_
+#define _FILETREEWIDGET_H_
+
+#include <qguardedptr.h>
+#include <kfiletreeview.h>
+
+#include <kdevversioncontrol.h>
+
+class FileViewPart;
+class FileTreeViewWidgetImpl;
+class KDevVersionControl;
+
+/**
+* This is FileTree widget for listing files belonging to the project. It does feature:
+* - dynamic updates reflecting the state of the project dir and subdirs
+* - VCS support for showing VCS fields like state, working and repository revisions
+* - bolding the filenames belonging to project to distinguish them from the others
+* - dynamic filtering so the user has not to care about temporary files eating screen space ;-)
+*
+* Design notes
+* The class uses two different implementations (referred by m_impl data member):
+* - @see VCSFileTreeWidgetImpl for VCS support
+* VCS support is detencted by the constructor looking for the @see KDevPlugin::versionControl() member:
+* if the current VCS plug-in does offer a @see KDevVCSFileInfoProvider object than this will be used for
+* querying about files' data. If neither VCS plugin nor valid info provider is found then the filetreeview
+* will fallback to the standard implementation
+* - @see StdFileTreeWidgetImpl for standard visualization, just like the KFileTreeView
+*
+* Each implementation must provide a branch item factory which the file filetree will delegate the creation
+* of specific KFileTreeViewItem-derived objects: currently they are both defined in the same .h/.cpp files
+* of the implementations listed above.
+*
+*/
+class FileTreeWidget : public KFileTreeView
+{
+ Q_OBJECT
+public:
+ FileTreeWidget( FileViewPart *part, QWidget *parent, KDevVCSFileInfoProvider *infoProvider );
+ virtual ~FileTreeWidget();
+
+ void openDirectory(const QString &dirName);
+ bool shouldBeShown( KFileTreeViewItem* item );
+
+ QString projectDirectory();
+ bool isInProject(const QString &fileName) const;
+
+ FileViewPart *part() const { return m_part; }
+
+ //KDevVCSFileInfoProvider *vcsFileInfoProvider() const;
+ void applyHidePatterns( const QString &hidePatterns );
+ QString hidePatterns() const;
+
+ bool showNonProjectFiles() const;
+
+public slots:
+ void hideOrShow();
+
+
+private slots:
+ void slotItemExecuted(QListViewItem *item);
+ void slotContextMenu(KListView *, QListViewItem *item, const QPoint &p);
+
+ void changeActiveDirectory( const QString&, const QString& );
+ void finishPopulate(KFileTreeViewItem* item);
+
+ void addProjectFiles( QStringList const & fileList, bool constructing = false );
+ void removeProjectFiles( QStringList const & fileList );
+ //! We must guard against unloading the used VCS plug-in when using it: we
+ //! fall back to the implementation (a file view without VCS fields, only filenames)
+ void slotImplementationInvalidated();
+
+private:
+ bool matchesHidePattern(const QString &fileName);
+ KDevVersionControl *versionControl() const;
+
+ QStringList m_hidePatterns;
+ /**
+ * @brief Set of all the files in this project.
+ *
+ * In addition to all the project files,
+ * we also keep a list of all directories containing any project files -
+ * effectively holding the whole project tree.
+ *
+ * @bug
+ * Well, it is not just a plain set,
+ * but rather a map with next-to-useless element value,
+ * keyed by names of files.
+ * QT3 does not seem to have a set datatype,
+ * thus we use the QMap type instead.
+ */
+ QMap<QString, bool> m_projectFiles;
+
+ FileViewPart *m_part;
+ KFileTreeBranch *m_rootBranch;
+ QGuardedPtr<FileTreeViewWidgetImpl> m_impl;
+};
+
+#endif
diff --git a/parts/fileview/fileviewpart.cpp b/parts/fileview/fileviewpart.cpp
new file mode 100644
index 00000000..d6d6691d
--- /dev/null
+++ b/parts/fileview/fileviewpart.cpp
@@ -0,0 +1,161 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "fileviewpart.h"
+
+#include <qwhatsthis.h>
+#include <qvbox.h>
+#include <qtoolbutton.h>
+#include <qdom.h>
+#include <kcombobox.h>
+#include <qtimer.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdialogbase.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+
+#include "partwidget.h"
+#include "domutil.h"
+#include "filetreewidget.h"
+#include "vcscolorsconfigwidget.h"
+#include "kdevversioncontrol.h"
+#include "kdevplugininfo.h"
+
+#define FILETREE_OPTIONS 1
+
+///////////////////////////////////////////////////////////////////////////////
+// static members
+///////////////////////////////////////////////////////////////////////////////
+
+VCSColors FileViewPart::vcsColors;
+
+///////////////////////////////////////////////////////////////////////////////
+// class factory
+///////////////////////////////////////////////////////////////////////////////
+
+typedef KDevGenericFactory<FileViewPart> FileViewFactory;
+static const KDevPluginInfo data("kdevfileview");
+K_EXPORT_COMPONENT_FACTORY( libkdevfileview, FileViewFactory( data ) )
+
+///////////////////////////////////////////////////////////////////////////////
+// class FileTreeWidget
+///////////////////////////////////////////////////////////////////////////////
+
+FileViewPart::FileViewPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "FileViewPart"),
+ m_widget( 0 )
+{
+ setInstance( FileViewFactory::instance() );
+ // setXMLFile("kdevfileview.rc");
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createProjectConfigPage( i18n("File Tree"), FILETREE_OPTIONS, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+ QTimer::singleShot( 1000, this, SLOT(init()) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileViewPart::init( )
+{
+ m_widget = new PartWidget( this );
+ m_widget->setIcon( SmallIcon( info()->icon() ) );
+ mainWindow()->embedSelectView( m_widget, i18n("File Tree"), i18n("File tree view in the project directory") );
+
+ loadSettings();
+
+ m_widget->showProjectFiles();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+FileViewPart::~FileViewPart()
+{
+ if (m_widget)
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+
+ storeSettings();
+
+ delete _configProxy;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileViewPart::loadSettings()
+{
+ const QColor added = QColor( "#CCFF99" ),
+ updated = QColor( "#FFFFCC" ),
+ modified = QColor( "#CCCCFF" ),
+ conflict = QColor( "#FF6666" ),
+ sticky = QColor( "#FFCCCC" ),
+ needsPatch = QColor( "#FFCCFF" ),
+ needsCheckout = QColor( "#FFCCFF" ),
+ unknown = QColor( white ),
+ defaultColor = QColor( white );
+
+ KConfig *cfg = instance()->config();
+
+ KConfigGroupSaver gs( cfg, "VCS Colors" );
+ vcsColors.added = cfg->readColorEntry( "FileAddedColor", &added );
+ vcsColors.updated = cfg->readColorEntry( "FileUpdatedColor", &updated );
+ vcsColors.sticky = cfg->readColorEntry( "FileStickyColor", &sticky );
+ vcsColors.modified = cfg->readColorEntry( "FileModifiedColor", &modified );
+ vcsColors.conflict = cfg->readColorEntry( "FileConflictColor", &conflict );
+ vcsColors.needsPatch = cfg->readColorEntry( "FileNeedsPatchColor", &needsPatch );
+ vcsColors.needsCheckout = cfg->readColorEntry( "FileNeedsCheckoutColor", &needsCheckout );
+ vcsColors.unknown = cfg->readColorEntry( "FileUnknownColor", &unknown );
+ vcsColors.defaultColor = cfg->readColorEntry( "DefaultColor", &defaultColor );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void FileViewPart::storeSettings()
+{
+ KConfig *cfg = instance()->config();
+ // VCS colors
+ KConfigGroupSaver gs( cfg, "VCS Colors" );
+ cfg->writeEntry( "FileAddedColor", vcsColors.added );
+ cfg->writeEntry( "FileUpdatedColor", vcsColors.updated );
+ cfg->writeEntry( "FileStickyColor", vcsColors.sticky );
+ cfg->writeEntry( "FileModifiedColor", vcsColors.modified );
+ cfg->writeEntry( "FileConflictColor", vcsColors.conflict );
+ cfg->writeEntry( "FileNeedsPatchColor", vcsColors.needsPatch );
+ cfg->writeEntry( "FileNeedsCheckoutColor", vcsColors.needsCheckout );
+ cfg->writeEntry( "FileUnknownColor", vcsColors.unknown );
+ cfg->writeEntry( "DefaultColor", vcsColors.defaultColor );
+}
+
+void FileViewPart::insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int pagenumber )
+{
+ if ( pagenumber == FILETREE_OPTIONS )
+ {
+ VCSColorsConfigWidget *w = new VCSColorsConfigWidget( this, vcsColors, page, "vcscolorsconfigwidget" );
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) );
+ }
+}
+
+KDevVersionControl *FileViewPart::versionControl()
+{
+ return extension<KDevVersionControl>("KDevelop/VersionControl");
+}
+
+#include "fileviewpart.moc"
diff --git a/parts/fileview/fileviewpart.h b/parts/fileview/fileviewpart.h
new file mode 100644
index 00000000..9c9a03da
--- /dev/null
+++ b/parts/fileview/fileviewpart.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2001-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILEVIEWPART_H_
+#define _FILEVIEWPART_H_
+
+#include <qguardedptr.h>
+#include <configwidgetproxy.h>
+#include "kdevplugin.h"
+#include "vcscolorsconfigwidget.h"
+
+class PartWidget;
+class KDialogBase;
+class KDevVersionControl;
+
+class FileViewPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ FileViewPart( QObject *parent, const char *name, const QStringList & );
+ virtual ~FileViewPart();
+
+ //! Colors to use for VCS visual feed-back
+ static VCSColors vcsColors;
+
+ KDevVersionControl *versionControl();
+
+private slots:
+ void insertConfigWidget( const KDialogBase* dlg, QWidget * page, unsigned int );
+ void init();
+
+private:
+ void loadSettings();
+ void storeSettings();
+
+ QGuardedPtr<PartWidget> m_widget;
+ ConfigWidgetProxy * _configProxy;
+};
+
+#endif
diff --git a/parts/fileview/kdevfilegroups.desktop b/parts/fileview/kdevfilegroups.desktop
new file mode 100644
index 00000000..41b63d2a
--- /dev/null
+++ b/parts/fileview/kdevfilegroups.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Allows for grouping of project files according to filename patterns.
+Comment[ca]=Permet l'agrupació de fitxers del projecte d'acord als patrons dels noms de fitxer.
+Comment[da]=Tillader gruppering af projektfiler efter filnavnemønstre.
+Comment[de]=Erlaubt die Gruppierung von Projektdateien nach Dateimustern.
+Comment[el]=Επιτρέπει την ομαδοποίηση των αρχείων του έργου σύμφωνα με διάφορα μοτίβα.
+Comment[es]=Permite la agrupación de archivos del proyecto de acuerdo a patrones en sus nombres.
+Comment[et]=Võimaldab rühmitada projekti faile vastavalt failinimede mustritele.
+Comment[eu]=Proiektu fitxategiak fitxategi-izen ereduen arabera taldekatzeko aukera ematen du.
+Comment[fa]=اجازۀ گروه کردن پرونده‌های پروژه را طبق الگوهای نام پرونده می‌دهد.
+Comment[fr]=Permet de grouper des fichiers projet en fonction des motifs de noms de fichier.
+Comment[gl]=Permite o agrupamento dos arquivos do proxecto seguindo patróns nos seus nomes.
+Comment[hi]=फ़ाइल-नाम पैटर्न के आधार पर परियोजना फ़ाइलों का समूह बनाना स्वीकारता है.
+Comment[hu]=Lehetővé teszi projektfájlok csoportosítását fájlnévminta alapján
+Comment[it]=Permette il raggruppamento dei file di progetto per schemi del nome file.
+Comment[ja]=ファイル名のパターンによりプロジェクトファイルのグルーピングを可能にします。
+Comment[ms]=Membenarkan pengumpulan bagi fail projek mengikut corak namafail.
+Comment[nds]=Maakt dat Sorteren vun Projektdateien na Dateinaam-Mustern mööglich.
+Comment[ne]=फाइल नाम बाँन्की अनुसार परियोजना फाइलहरू समूहबद्ध गर्न अनुमति दिन्छ ।
+Comment[nl]=Groepeert projectbestanden op grond van patronen in bestandsnamen.
+Comment[pl]=Umożliwia grupowanie plików projektu zgodnie z wzorcami nazw plików.
+Comment[pt]=Permite o agrupamento de ficheiros de projecto, de acordo com padrões de nomes de ficheiros.
+Comment[pt_BR]=Permite agrupar arquivos de projetos de acordo com padrões de nome de arquivo.
+Comment[ru]=Позволяет группировать файлы в проекте согласно шаблонам имён.
+Comment[sk]=Umožní zoskupenie projektových súborov podľa vzoru mien súborov.
+Comment[sr]=Дозвољава груписање пројектних фајлова према облицима имена фајлова.
+Comment[sr@Latn]=Dozvoljava grupisanje projektnih fajlova prema oblicima imena fajlova.
+Comment[sv]=Tillåter att projektfiler grupperas enligt filnamnsmönster.
+Comment[ta]=திட்ட பணிகோப்புகளை கோப்பின் பெயர் அடிப்படையில் அதனை குழுவாக பிரிக்கும்.
+Comment[tg]=Барои файлҳои дар номҳои қолиб имкон медиҳад.
+Comment[tr]=Dosya adı desenlerine göre proje dosyalarının gruplanmasını sağlar.
+Comment[zh_CN]=允许你根据文件名模式规类工程文件。
+Comment[zh_TW]=允許專案檔案根據檔名樣式來分群組。
+Name=KDevFileGroups
+Name[da]=KDevelop filgrupper
+Name[de]=Dateigruppen-Komponente (KDevelop)
+Name[hi]=के-डेव-फ़ाइल-ग्रुप्स
+Name[nds]=KDevelop-Dateikoppeln
+Name[pl]=KDevGrupyPlików
+Name[sk]=KDev zoskupenie súborov
+Name[sv]=KDevelop filgrupper
+Name[ta]=KDev கோப்பு குழுக்கள்
+Name[tg]=Гурӯҳҳои файли KDev
+Name[zh_TW]=KDevelop 檔案群組
+GenericName=File Groups
+GenericName[br]=Strolladoù a restroù
+GenericName[ca]=Grups de fitxers
+GenericName[da]=Filgrupper
+GenericName[de]=Dateigruppen
+GenericName[el]=Ομάδες αρχείων
+GenericName[es]=Grupos de archivos
+GenericName[et]=Failigrupid
+GenericName[eu]=Fitxategi taldeak
+GenericName[fa]=گروههای پرونده
+GenericName[fr]=Groupes de fichiers
+GenericName[gl]=Grupos de arquivos
+GenericName[hi]=फ़ाइल समूह
+GenericName[hu]=Fájlcsoportok
+GenericName[it]=Gruppi file
+GenericName[ja]=ファイルグループ
+GenericName[ms]=Kumpulan Fail
+GenericName[nds]=Dateikoppeln
+GenericName[ne]=फाइल समूह
+GenericName[nl]=Bestandsgroepen
+GenericName[pl]=Grupy plików
+GenericName[pt]=Grupos de Ficheiros
+GenericName[pt_BR]=Grupos de Arquivo
+GenericName[ru]=Группы файлов
+GenericName[sk]=Zoskupenie súborov
+GenericName[sl]=Skupine datotek
+GenericName[sr]=Групе фајлова
+GenericName[sr@Latn]=Grupe fajlova
+GenericName[sv]=Filgrupper
+GenericName[ta]=கோப்புக்குழுக்கள்
+GenericName[tg]=Гурӯҳи файлҳо
+GenericName[tr]=Dosya Grupları
+GenericName[zh_CN]=文件分组
+GenericName[zh_TW]=檔案群組
+ServiceTypes=KDevelop/Plugin
+Icon=attach
+X-KDE-Library=libkdevfilegroups
+X-KDevelop-Version=5
+X-KDevelop-Scope=Project
+X-KDevelop-Properties=ProjectFileGroupsManagement
diff --git a/parts/fileview/kdevfileview.desktop b/parts/fileview/kdevfileview.desktop
new file mode 100644
index 00000000..cbdd269c
--- /dev/null
+++ b/parts/fileview/kdevfileview.desktop
@@ -0,0 +1,85 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides a way of navigating and interacting with the source files of the current project.
+Comment[ca]=Proporciona un mètode de navegació i interacció amb els fitxers de codi font del projecte actual.
+Comment[da]=Sørger for en måde at navigere og interagere med kildefiler for dette projekt.
+Comment[de]=Bietet Funktionalität zur Navigation und zum Umgang mit den Quelltexten des aktuellen Projektes.
+Comment[el]=Προσφέρει μια μέθοδο πλοήγησης και αλληλεπίδρασης με τα αρχεία πηγαίου κώδικα του τρέχοντος έργου.
+Comment[es]=Proporciona un método de navegación e interacción con los archivos de código fuente del proyecto actual.
+Comment[et]=Võimaldab aktiivse projekti lähtekoodifailide vahel liikuda ja neis üht-teist ette võtta.
+Comment[eu]=Uneko proiektuko itruburu fitxategiekin lan egiteko eta hauen artean nabigatzeko aukera ematen du.
+Comment[fa]=راهی برای ناوش و تعامل با پرونده‌های منبع پروژۀ جاری را فراهم می‌کند.
+Comment[fr]=Fournit un moyen de naviguer et d'interagir avec les fichiers source du projet actuel.
+Comment[gl]=Proporciona unha maneira de navegar e interactuar cos ficheiros fonte do proxecto actual.
+Comment[hu]=Lehetővé teszi az aktuális projekthez tartozó forrásfájlok áttekintését, kezelését
+Comment[it]=Offre un modo per navigare e interagire con il file sorgente del progetto attuale.
+Comment[ja]=現在のプロジェクトのソースファイルでナビゲーションおよび対話する方法を提供します。
+Comment[ms]=Menyediakan cara untuk pandu arah dan berinteraksi dengan fail sumber bagi projek semasa.
+Comment[nds]=Stellt Ünnerstütten bi't Stüern binnen un för't Hanteren vun de Borndateien vun't aktuelle Projekt praat.
+Comment[ne]=हालको परियोजनाको स्रोत फाइलसँग नेभिगेटिङ र अन्तरक्रिया गर्ने तरिका प्रदान गर्दछ ।
+Comment[nl]=Handig bladeren en zoeken in de broncode-bestanden van het huidige project.
+Comment[pl]=Umożliwia metodę nawigacji i interacji z plikami źródłowymi bieżącego projektu.
+Comment[pt]=Oferece uma forma de navegar e de interagir com os ficheiros de código do projecto actual.
+Comment[pt_BR]=Fornece uma maneira de navegar e interagir com arquivos fonte do projeto atual.
+Comment[ru]=Предоставляет способ навигации и взаимодействия с исходными файлами в каталоге текущего проекта.
+Comment[sk]=Umožní navigáciu a interakciu so zdrojovými súbormi v aktálnom projekte.
+Comment[sr]=Обезбеђује начин навигације и рада са фајловима изворног кôда текућег пројекта.
+Comment[sr@Latn]=Obezbeđuje način navigacije i rada sa fajlovima izvornog kôda tekućeg projekta.
+Comment[sv]=Erbjuder ett sätt att navigera och arbeta med källkodsfilerna i det aktuella projektet.
+Comment[ta]=நடப்பு திட்ட பணியில் உள்ள மூல கோப்பிற்கு வழி செலுத்த மற்றும் உறையாட இது வழி செலுத்தும்.
+Comment[tg]=Тариқи навигатсияро ва ҳангоми ҳамкорӣ намудан бо файлҳои берунии дар каталоги лоиҳаи ҷорӣ имкон медиҳад.
+Comment[tr]=Geçerli projenin kaynak dosyalarında gezinme ve onlarla etkileşime geçme yolu sunar.
+Comment[zh_CN]=提供当前工程源文件的浏览和相互关系。
+Comment[zh_TW]=提供目前專案的程式源碼檔的導覽與互動。
+Name=KDevFileView
+Name[da]=KDevelop filvisning
+Name[de]=Dateibaum (KDevelop)
+Name[hi]=के-डेव-फ़ाइल-व्यू
+Name[nds]=KDevelop-Dateiboom
+Name[pl]=KDevWidokPliku
+Name[sk]=KDev pohľad na súbor
+Name[sv]=KDevelop filvisning
+Name[ta]=KDev கோப்பு காட்சி
+Name[tg]=Намоиши файл KDev
+Name[zh_TW]=KDevelop 檔案檢視
+GenericName=File Tree
+GenericName[br]=Gwezenn restr
+GenericName[ca]=Arbre de fitxers
+GenericName[da]=Filtræ
+GenericName[de]=Dateibaum
+GenericName[el]=Δέντρο αρχείων
+GenericName[es]=Árbol de archivos
+GenericName[et]=Failipuu
+GenericName[eu]=Fitxategi zuhaitza
+GenericName[fa]=درخت پرونده
+GenericName[fr]=Arborescence de fichiers
+GenericName[gl]=Árbore de arquivos
+GenericName[hi]=फ़ाइल ट्री
+GenericName[hu]=Fájl-fa
+GenericName[it]=Albero file
+GenericName[ja]=ファイルツリー
+GenericName[ms]=Pepohon Fail
+GenericName[nds]=Dateiboom
+GenericName[ne]=फाइल ट्रि
+GenericName[nl]=Bestandsboomstructuur
+GenericName[pl]=Drzewo plików
+GenericName[pt]=Árvore de Ficheiros
+GenericName[pt_BR]=Árvore de Arquivo
+GenericName[ru]=Дерево файлов
+GenericName[sk]=Strom súborov
+GenericName[sl]=Datotečno drevo
+GenericName[sr]=Дрво фајлова
+GenericName[sr@Latn]=Drvo fajlova
+GenericName[sv]=Filträd
+GenericName[ta]=கோப்பு மரம்
+GenericName[tg]=Дарахти файлҳо
+GenericName[tr]=Dosya Ağacı
+GenericName[zh_CN]=文件树
+GenericName[zh_TW]=檔案樹
+ServiceTypes=KDevelop/Plugin
+Icon=folder
+X-KDE-Library=libkdevfileview
+X-KDevelop-Version=5
+X-KDevelop-Scope=Project
+X-KDevelop-Properties=ProjectFileManagement
diff --git a/parts/fileview/partwidget.cpp b/parts/fileview/partwidget.cpp
new file mode 100644
index 00000000..b3f9baf0
--- /dev/null
+++ b/parts/fileview/partwidget.cpp
@@ -0,0 +1,144 @@
+/***************************************************************************
+ * Copyright (C) 2003 by KDevelop authors *
+ * kdevelop-devel@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "partwidget.h"
+
+#include <qwhatsthis.h>
+#include <qvbox.h>
+#include <qlayout.h>
+#include <qtoolbutton.h>
+#include <qdom.h>
+#include <kxmlguiclient.h>
+#include <kcombobox.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include "kdevversioncontrol.h"
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+
+#include "fileviewpart.h"
+#include "filetreewidget.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// class PartWidget
+///////////////////////////////////////////////////////////////////////////////
+
+PartWidget::PartWidget( FileViewPart *part, QWidget *parent )
+ : QVBox( parent, "fileviewpartwidget" ), m_filetree( 0 ),
+ m_filter( 0 ), m_btnFilter( 0 ), m_part( part )
+{
+ Q_ASSERT( part && parent );
+
+ KDevVCSFileInfoProvider *infoProvider = 0;
+ if (part && part->versionControl() && part->versionControl()->fileInfoProvider())
+ infoProvider = part->versionControl()->fileInfoProvider();
+
+ m_filetree = new FileTreeWidget( m_part, this, infoProvider );
+ setCaption(i18n("File Tree"));
+ m_filetree->setCaption(i18n("File Tree"));
+ m_filetree->setIcon(SmallIcon("folder"));
+ QWhatsThis::add(m_filetree, i18n("<b>File tree</b><p>"
+ "The file viewer shows all files of the project "
+ "in a tree layout."));
+
+ QHBox* filterBox = new QHBox( this );
+ m_btnFilter = new QToolButton( filterBox );
+ m_btnFilter->setIconSet( SmallIconSet("filter" ) );
+ m_btnFilter->setToggleButton( true );
+ m_filter = new KHistoryCombo( true, filterBox, "filter");
+ m_filter->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
+ filterBox->setStretchFactor(m_filter, 2);
+
+ connect( m_btnFilter, SIGNAL( clicked() ), this, SLOT( slotBtnFilterClick() ) );
+ connect( m_filter, SIGNAL( activated(const QString&) ), this, SLOT( slotFilterChange(const QString&) ) );
+ connect( m_filter, SIGNAL( returnPressed(const QString&) ),
+ m_filter, SLOT( addToHistory(const QString&) ) );
+
+ QWhatsThis::add
+ ( m_filter,
+ i18n("<p>Here you can enter a name filter to limit which files are <b>not displayed</b>."
+ "<p>To clear the filter, toggle off the filter button to the left."
+ "<p>To reapply the last filter used, toggle on the filter button." ) );
+ QWhatsThis::add
+ ( m_btnFilter,
+ i18n("<p>This button clears the name filter when toggled off, or "
+ "reapplies the last filter used when toggled on.") );
+
+ m_filter->insertItem( m_filetree->hidePatterns() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+PartWidget::~PartWidget()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void PartWidget::showProjectFiles()
+{
+ m_filetree->openDirectory( m_part->project()->projectDirectory() );
+ m_filetree->applyHidePatterns( m_filetree->hidePatterns() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void PartWidget::slotFilterChange( const QString & nf )
+{
+ QString f = nf.stripWhiteSpace();
+ bool empty = f.isEmpty() || f == "*";
+ if ( empty )
+ {
+ m_filter->lineEdit()->setText( QString::null );
+ QToolTip::add( m_btnFilter, i18n("Apply last filter (\"%1\")").arg( m_lastFilter ) );
+ }
+ else
+ {
+ m_lastFilter = f;
+ QToolTip::add( m_btnFilter, i18n("Clear filter") );
+ }
+ m_btnFilter->setOn( !empty );
+ // this will be never true after the m_filter has been used;)
+ m_btnFilter->setEnabled( !( empty && m_lastFilter.isEmpty() ) );
+
+ m_filetree->applyHidePatterns( f );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/*
+ When the button in the filter box toggles:
+ If off:
+ If the name filer is anything but "" or "*", reset it.
+ If on:
+ Set last filter.
+*/
+void PartWidget::slotBtnFilterClick()
+{
+ if ( !m_btnFilter->isOn() )
+ {
+ slotFilterChange( QString::null );
+ }
+ else
+ {
+ m_filter->lineEdit()->setText( m_lastFilter );
+ slotFilterChange( m_lastFilter );
+ }
+}
+
+void PartWidget::focusInEvent( QFocusEvent * )
+{
+ m_filetree->setFocus();
+}
+
+#include "partwidget.moc"
diff --git a/parts/fileview/partwidget.h b/parts/fileview/partwidget.h
new file mode 100644
index 00000000..e9d62665
--- /dev/null
+++ b/parts/fileview/partwidget.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+ * Copyright (C) 2003 by KDevelop authors *
+ * kdevelop-devel@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILEVIEWPARTWIDGET_H_
+#define _FILEVIEWPARTWIDGET_H_
+
+#include <qvbox.h>
+
+class FileViewPart;
+
+class PartWidget : public QVBox
+{
+ Q_OBJECT
+public:
+ PartWidget( FileViewPart *part, QWidget *parent = 0 );
+ virtual ~PartWidget();
+
+ class FileTreeWidget *m_filetree;
+ // Support for filters
+ class KHistoryCombo *m_filter;
+ class QToolButton *m_btnFilter;
+
+ void showProjectFiles();
+
+protected:
+ virtual void focusInEvent( QFocusEvent * );
+
+private slots:
+ void slotFilterChange( const QString & nf );
+ void slotBtnFilterClick();
+
+private:
+ FileViewPart *m_part;
+ QString m_lastFilter;
+};
+
+#endif
diff --git a/parts/fileview/stdfiletreewidgetimpl.cpp b/parts/fileview/stdfiletreewidgetimpl.cpp
new file mode 100644
index 00000000..b680f2a8
--- /dev/null
+++ b/parts/fileview/stdfiletreewidgetimpl.cpp
@@ -0,0 +1,95 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+ #include <qheader.h>
+ #include <kdebug.h>
+
+#include "fileitemfactory.h"
+#include "filetreewidget.h"
+#include "stdfiletreewidgetimpl.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// class StdFileTreeViewItem
+///////////////////////////////////////////////////////////////////////////////
+
+class StdFileTreeViewItem : public filetreeview::FileTreeViewItem
+{
+public:
+ StdFileTreeViewItem( KFileTreeViewItem* parent, KFileItem* item, KFileTreeBranch* branch, bool pf )
+ : FileTreeViewItem( parent, item, branch, pf ) {}
+ StdFileTreeViewItem( KFileTreeView* parent, KFileItem* item, KFileTreeBranch* branch )
+ : FileTreeViewItem( parent, item, branch ) {}
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// class StdFileTreeBranchItem
+///////////////////////////////////////////////////////////////////////////////
+
+class StdFileTreeBranchItem : public filetreeview::FileTreeBranchItem
+{
+public:
+ StdFileTreeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix )
+ : FileTreeBranchItem( view, url, name, pix ) {}
+ virtual ~StdFileTreeBranchItem() {}
+ virtual KFileTreeViewItem* createTreeViewItem( KFileTreeViewItem* parent, KFileItem* fileItem );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+KFileTreeViewItem* StdFileTreeBranchItem::createTreeViewItem( KFileTreeViewItem* parent, KFileItem* fileItem )
+{
+ if (!parent || !fileItem)
+ return 0;
+
+ FileTreeWidget *lv = static_cast<StdFileTreeViewItem*>( parent )->listView();
+ const KURL fileURL = fileItem->url();
+
+ const bool isDirectory = lv->isInProject( fileURL.path() );
+
+ return new StdFileTreeViewItem( parent, fileItem, this, isDirectory );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class StdFileItemFactory
+///////////////////////////////////////////////////////////////////////////////
+
+class StdBranchItemFactory : public filetreeview::BranchItemFactory
+{
+public:
+ virtual filetreeview::FileTreeBranchItem *makeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix )
+ {
+ return new StdFileTreeBranchItem( view, url, name, pix );
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// class StdFileTreeWidgetImpl
+///////////////////////////////////////////////////////////////////////////////
+
+StdFileTreeWidgetImpl::StdFileTreeWidgetImpl( FileTreeWidget *parent )
+ : FileTreeViewWidgetImpl( parent, "stdfiletreewidgetimpl" )
+{
+ kdDebug(9017) << "StdFileTreeWidgetImpl::StdFileTreeWidgetImpl()" << endl;
+
+ setBranchItemFactory( new StdBranchItemFactory );
+
+ parent->addColumn( QString::null );
+ header()->hide();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+StdFileTreeWidgetImpl::~StdFileTreeWidgetImpl()
+{
+ kdDebug(9017) << "StdFileTreeWidgetImpl::~StdFileTreeWidgetImpl()" << endl;
+}
+
+#include "stdfiletreewidgetimpl.moc"
diff --git a/parts/fileview/stdfiletreewidgetimpl.h b/parts/fileview/stdfiletreewidgetimpl.h
new file mode 100644
index 00000000..a9ba7159
--- /dev/null
+++ b/parts/fileview/stdfiletreewidgetimpl.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef STDFILETREEWIDGETIMPL_H
+#define STDFILETREEWIDGETIMPL_H
+
+#include "filetreeviewwidgetimpl.h"
+
+/**
+* @author Mario Scalas
+* Provides the usual feedback of a KFileTreeView-widget (yeah, it does nothing other
+* than providing almost standard KFileTreeViewItems). Adds 1 (one) column to the
+* tree view and hides the header.
+*/
+class StdFileTreeWidgetImpl : public FileTreeViewWidgetImpl
+{
+ Q_OBJECT
+public:
+ StdFileTreeWidgetImpl( FileTreeWidget *parent );
+ virtual ~StdFileTreeWidgetImpl();
+
+ /*
+ * We have no reason not to allow it here
+ */
+ virtual bool canReloadTree() const { return true; }
+};
+
+#endif
diff --git a/parts/fileview/vcscolorsconfigwidget.cpp b/parts/fileview/vcscolorsconfigwidget.cpp
new file mode 100644
index 00000000..29de36fe
--- /dev/null
+++ b/parts/fileview/vcscolorsconfigwidget.cpp
@@ -0,0 +1,109 @@
+//
+// C++ Implementation:
+//
+// Description:
+//
+//
+// Author: KDevelop Authors <kdevelop-devel@kdevelop.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <kcolorcombo.h>
+
+#include "vcscolorsconfigwidget.h"
+#include "fileviewpart.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// struct VCSColors
+///////////////////////////////////////////////////////////////////////////////
+
+VCSColors::VCSColors()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+VCSColors::VCSColors( const VCSColors &others )
+{
+ *this = others;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+VCSColors &VCSColors::operator=( const VCSColors &others )
+{
+ added = others.added;
+ conflict = others.conflict;
+ modified = others.modified;
+ sticky = others.sticky;
+ needsPatch = others.needsPatch;
+ needsCheckout = others.needsCheckout;
+ unknown = others.unknown;
+ updated = others.updated;
+ defaultColor = others.defaultColor;
+ return *this;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class VCSColorsConfigWidget
+///////////////////////////////////////////////////////////////////////////////
+
+VCSColorsConfigWidget::VCSColorsConfigWidget(FileViewPart *part, const VCSColors &vcsColors,
+ QWidget* parent, const char* name, WFlags fl)
+ : VCSColorsConfigWidgetBase( parent, name, fl ), m_part( part )
+{
+ setColors( vcsColors );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+VCSColorsConfigWidget::~VCSColorsConfigWidget()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSColorsConfigWidget::getColors( VCSColors &vcsColors ) const
+{
+ vcsColors.added = fileAddedColorCombo->color();
+ vcsColors.conflict = fileConflictColorCombo->color();
+ vcsColors.modified = fileModifiedColorCombo->color();
+ vcsColors.sticky = fileStickyColorCombo->color();
+ vcsColors.needsPatch = fileNeedsPatchColorCombo->color();
+ vcsColors.needsCheckout = fileNeedsCheckoutColorCombo->color();
+ vcsColors.unknown = fileUnknownColorCombo->color();
+ vcsColors.updated = fileUpdatedColorCombo->color();
+ vcsColors.defaultColor = defaultColorCombo->color();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSColorsConfigWidget::setColors( const VCSColors &vcsColors )
+{
+ fileAddedColorCombo->setColor( vcsColors.added );
+ fileConflictColorCombo->setColor( vcsColors.conflict );
+ fileModifiedColorCombo->setColor( vcsColors.modified );
+ fileStickyColorCombo->setColor( vcsColors.sticky );
+ fileNeedsPatchColorCombo->setColor( vcsColors.needsPatch );
+ fileNeedsCheckoutColorCombo->setColor( vcsColors.needsCheckout );
+ fileUnknownColorCombo->setColor( vcsColors.unknown );
+ fileUpdatedColorCombo->setColor( vcsColors.updated );
+ defaultColorCombo->setColor( vcsColors.defaultColor );
+}
+
+/*$SPECIALIZATION$*/
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSColorsConfigWidget::slotAccept()
+{
+ VCSColors selectedColors;
+ getColors( selectedColors );
+
+ m_part->vcsColors = selectedColors;
+}
+
+#include "vcscolorsconfigwidget.moc"
+
diff --git a/parts/fileview/vcscolorsconfigwidget.h b/parts/fileview/vcscolorsconfigwidget.h
new file mode 100644
index 00000000..60cd4f52
--- /dev/null
+++ b/parts/fileview/vcscolorsconfigwidget.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef VCSCOLORSCONFIGWIDGET_H
+#define VCSCOLORSCONFIGWIDGET_H
+
+#include <qcolor.h>
+#include "vcscolorsconfigwidgetbase.h"
+
+class FileViewPart;
+
+struct VCSColors
+{
+ VCSColors();
+ VCSColors( const VCSColors &others );
+ VCSColors &operator=( const VCSColors &others );
+
+ QColor modified;
+ QColor added;
+ QColor updated;
+ QColor sticky;
+ QColor conflict;
+ QColor needsPatch;
+ QColor needsCheckout;
+ QColor unknown;
+ QColor defaultColor;
+};
+
+class VCSColorsConfigWidget : public VCSColorsConfigWidgetBase
+{
+ Q_OBJECT
+
+public:
+ VCSColorsConfigWidget( FileViewPart *part, const VCSColors &vcsColors,
+ QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ virtual ~VCSColorsConfigWidget();
+ /*$PUBLIC_FUNCTIONS$*/
+
+ void getColors( VCSColors &vcsColors ) const;
+ void setColors( const VCSColors &colors );
+
+public slots:
+ /*$PUBLIC_SLOTS$*/
+ // Store settings if the user gives the ok
+ void slotAccept();
+
+
+protected:
+ /*$PROTECTED_FUNCTIONS$*/
+
+protected slots:
+ /*$PROTECTED_SLOTS$*/
+
+
+private:
+ FileViewPart *m_part;
+};
+
+#endif
+
diff --git a/parts/fileview/vcscolorsconfigwidgetbase.ui b/parts/fileview/vcscolorsconfigwidgetbase.ui
new file mode 100644
index 00000000..7e7998ce
--- /dev/null
+++ b/parts/fileview/vcscolorsconfigwidgetbase.ui
@@ -0,0 +1,267 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>VCSColorsConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>VCSColorsConfigWidgetBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>410</width>
+ <height>324</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Colors for VCS Visual Feedback</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Colors to Use for Version Control Feedback</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Updated:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileUpdatedColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Modified:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileModifiedColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Co&amp;nflict:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileConflictColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Added:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileAddedColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Sticky:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileStickyColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="6" column="0">
+ <property name="name">
+ <cstring>textLabel5_3</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Needs checkout:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileStickyColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="5" column="0">
+ <property name="name">
+ <cstring>textLabel5_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Needs patch:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileStickyColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="7" column="0">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Un&amp;known:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>fileUnknownColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="8" column="0">
+ <property name="name">
+ <cstring>textLabel6_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Default:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>defaultColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="2" column="1">
+ <property name="name">
+ <cstring>fileModifiedColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="3" column="1">
+ <property name="name">
+ <cstring>fileConflictColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="7" column="1">
+ <property name="name">
+ <cstring>fileUnknownColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="6" column="1">
+ <property name="name">
+ <cstring>fileNeedsCheckoutColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="8" column="1">
+ <property name="name">
+ <cstring>defaultColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="4" column="1">
+ <property name="name">
+ <cstring>fileStickyColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="5" column="1">
+ <property name="name">
+ <cstring>fileNeedsPatchColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="0" column="1">
+ <property name="name">
+ <cstring>fileAddedColorCombo</cstring>
+ </property>
+ </widget>
+ <widget class="KColorCombo" row="1" column="1">
+ <property name="name">
+ <cstring>fileUpdatedColorCombo</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+ <includehint>kcolorcombo.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/fileview/vcsfiletreewidgetimpl.cpp b/parts/fileview/vcsfiletreewidgetimpl.cpp
new file mode 100644
index 00000000..1db873ed
--- /dev/null
+++ b/parts/fileview/vcsfiletreewidgetimpl.cpp
@@ -0,0 +1,353 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qpainter.h>
+#include <qheader.h>
+#include <qpopupmenu.h>
+#include <kxmlguiclient.h>
+#include <kaction.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kdeversion.h>
+
+//#include <kdevproject.h>
+#include <urlutil.h>
+#include <domutil.h>
+
+#include "fileviewpart.h"
+#include "filetreewidget.h"
+#include "fileitemfactory.h"
+#include "vcsfiletreewidgetimpl.h"
+#include "vcscolorsconfigwidget.h"
+
+using namespace filetreeview;
+
+///////////////////////////////////////////////////////////////////////////////
+// class VCSFileTreeViewItem
+///////////////////////////////////////////////////////////////////////////////
+
+#define FILENAME_COLUMN 0
+#define STATUS_COLUMN 1
+#define WORKREVISION_COLUMN 2
+#define REPOREVISION_COLUMN 3
+
+class VCSFileTreeViewItem : public filetreeview::FileTreeViewItem
+{
+public:
+ VCSFileTreeViewItem( KFileTreeViewItem* parent, KFileItem* item, KFileTreeBranch* branch, bool pf )
+ : FileTreeViewItem( parent, item, branch, pf ), m_statusColor( &FileViewPart::vcsColors.unknown ) {}
+ VCSFileTreeViewItem( KFileTreeView* parent, KFileItem* item, KFileTreeBranch* branch )
+ : FileTreeViewItem( parent, item, branch ), m_statusColor( &FileViewPart::vcsColors.unknown ) {}
+ virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment )
+ {
+ // paint cell in a different color depending on VCS state
+ QColorGroup mycg( cg );
+ mycg.setColor( QColorGroup::Base, *m_statusColor );
+ FileTreeViewItem::paintCell( p, mycg, column, width, alignment );
+ }
+ void setVCSInfo( const VCSFileInfo &info );
+
+ QString fileName() const { return text( FILENAME_COLUMN ); }
+ QString workingRev() const { return text( WORKREVISION_COLUMN ); }
+ QString repositoryRev() const { return text( REPOREVISION_COLUMN ); }
+ QString status() const { return text( STATUS_COLUMN ); }
+ void setFileName( const QString &p ) { setText( FILENAME_COLUMN, p ); }
+ void setWorkingRev( const QString &p ) { setText( WORKREVISION_COLUMN, p ); }
+ void setRepositoryRev( const QString &p ) { setText( REPOREVISION_COLUMN, p ); }
+ void setStatus( const VCSFileInfo::FileState status );
+
+private:
+ QColor *m_statusColor; // cached
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeViewItem::setVCSInfo( const VCSFileInfo &info )
+{
+ //setFileName( info.fileName );
+ setRepositoryRev( info.repoRevision );
+ setWorkingRev( info.workRevision );
+ setStatus( info.state );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeViewItem::setStatus( const VCSFileInfo::FileState status )
+{
+ setText( STATUS_COLUMN, VCSFileInfo::state2String( status ) );
+ // Update color too
+ switch (status)
+ {
+ case VCSFileInfo::Added:
+ m_statusColor = &FileViewPart::vcsColors.added;
+ break;
+ case VCSFileInfo::Uptodate:
+ m_statusColor = &FileViewPart::vcsColors.updated;
+ break;
+ case VCSFileInfo::Modified:
+ m_statusColor = &FileViewPart::vcsColors.modified;
+ break;
+ case VCSFileInfo::Conflict:
+ m_statusColor = &FileViewPart::vcsColors.conflict;
+ break;
+ case VCSFileInfo::Sticky:
+ m_statusColor = &FileViewPart::vcsColors.sticky;
+ break;
+ case VCSFileInfo::NeedsCheckout:
+ m_statusColor = &FileViewPart::vcsColors.needsCheckout;
+ break;
+ case VCSFileInfo::NeedsPatch:
+ m_statusColor = &FileViewPart::vcsColors.needsPatch;
+ break;
+ case VCSFileInfo::Unknown:
+ m_statusColor = &FileViewPart::vcsColors.unknown;
+ break;
+ case VCSFileInfo::Directory:
+ default:
+ // No color change
+ m_statusColor = &FileViewPart::vcsColors.defaultColor;
+ //kdDebug() << "MyFileTreeViewItem::paintCell(): Unknown color!" << endl;
+ break;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class VCSFileTreeBranchItem
+///////////////////////////////////////////////////////////////////////////////
+
+class VCSFileTreeBranchItem : public filetreeview::FileTreeBranchItem
+{
+public:
+ VCSFileTreeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix,
+ KDevVCSFileInfoProvider *vcsInfoProvider )
+ : FileTreeBranchItem( view, url, name, pix ), m_vcsInfoProvider( vcsInfoProvider ) {}
+// virtual ~VCSFileTreeBranchItem() {}
+ virtual KFileTreeViewItem* createTreeViewItem( KFileTreeViewItem* parent, KFileItem* fileItem );
+
+private:
+ KDevVCSFileInfoProvider *m_vcsInfoProvider;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+KFileTreeViewItem* VCSFileTreeBranchItem::createTreeViewItem( KFileTreeViewItem* parent, KFileItem* fileItem )
+{
+// kdDebug(9017) << "MyFileTreeBranch::createTreeViewItem(): " + fileItem->url().path() << endl;
+ if (!parent || !fileItem)
+ return 0;
+
+ FileTreeWidget *lv = static_cast<filetreeview::FileTreeViewItem*>( parent )->listView();
+ const KURL fileURL = fileItem->url();
+ const bool isDirectory = lv->isInProject( fileURL.path() );
+
+ VCSFileTreeViewItem *newItem = new VCSFileTreeViewItem( parent, fileItem, this, isDirectory );
+
+// QString fileName = fileURL.fileName();
+// QString dirName = URLUtil::extractPathNameRelative( lv->projectDirectory(), fileURL.directory() );
+
+// const VCSFileInfoMap &vcsFiles = *m_vcsInfoProvider->status( dirName );
+// kdDebug(9017) << "Dir has " << vcsFiles.count() << " registered files!" << endl;
+// if (vcsFiles.contains( fileName ))
+// newItem->setVCSInfo( vcsFiles[ fileName ] );
+// else
+// kdDebug(9017) << "!!!No VCS info for this file!!!" << endl;
+ return newItem;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class VCSFileItemFactory
+///////////////////////////////////////////////////////////////////////////////
+
+class VCSBranchItemFactory : public filetreeview::BranchItemFactory
+{
+public:
+ VCSBranchItemFactory( KDevVCSFileInfoProvider *vcsInfoProvider ) : m_vcsInfoProvider( vcsInfoProvider ) {}
+ virtual filetreeview::FileTreeBranchItem *makeBranchItem( KFileTreeView* view, const KURL& url, const QString& name, const QPixmap& pix )
+ {
+ return new VCSFileTreeBranchItem( view, url, name, pix, m_vcsInfoProvider );
+ }
+private:
+ KDevVCSFileInfoProvider *m_vcsInfoProvider;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// class VCSFileTreeWidgetImpl
+///////////////////////////////////////////////////////////////////////////////
+
+VCSFileTreeWidgetImpl::VCSFileTreeWidgetImpl( FileTreeWidget *parent, KDevVCSFileInfoProvider *infoProvider )
+ : FileTreeViewWidgetImpl( parent, "vcsfiletreewidgetimpl" ),
+ m_actionToggleShowVCSFields( 0 ), m_actionSyncWithRepository( 0 ), m_vcsInfoProvider( infoProvider ),
+ m_isSyncingWithRepository( false ), m_vcsStatusRequestedItem( 0 )
+{
+ kdDebug(9017) << "VCSFileTreeWidgetImpl::VCSFileTreeWidgetImpl()" << endl;
+
+ Q_ASSERT( m_vcsInfoProvider );
+ setBranchItemFactory( new VCSBranchItemFactory( m_vcsInfoProvider ) );
+
+ // Update the #define order on top if you change this order!
+ parent->addColumn( "Filename" );
+ parent->addColumn( "Status" );
+ parent->addColumn( "Work" );
+ parent->addColumn( "Repo" );
+
+ connect( m_vcsInfoProvider, SIGNAL(statusReady(const VCSFileInfoMap&, void *)),
+ this, SLOT(vcsDirStatusReady(const VCSFileInfoMap&, void*)) );
+ // Harakiri itself if the infoProvider object is destroyed since we cannot work anymore :-(
+ connect( m_vcsInfoProvider, SIGNAL(destroyed()), SIGNAL(implementationInvalidated()) );
+
+ m_actionToggleShowVCSFields = new KToggleAction( i18n("Show VCS Fields"), KShortcut(),
+ this, "actiontoggleshowvcsfieldstoggleaction" );
+ m_actionToggleShowVCSFields->setCheckedState(i18n("Hide VCS Fields"));
+ QString aboutAction = i18n("<b>Show VCS fields</b><p>Shows <b>Revision</b> and <b>Timestamp</b> for each file contained in VCS repository.");
+ m_actionToggleShowVCSFields->setWhatsThis( aboutAction );
+ connect( m_actionToggleShowVCSFields, SIGNAL(toggled(bool)), this, SLOT(slotToggleShowVCSFields(bool)) );
+
+ m_actionSyncWithRepository = new KAction( i18n( "Sync with Repository"), KShortcut(),
+ this, SLOT(slotSyncWithRepository()), this, "actionsyncwithrepository" );
+ aboutAction = i18n("<b>Sync with repository</b><p>Synchronize file status with remote repository.");
+ m_actionSyncWithRepository->setWhatsThis( aboutAction );
+
+ QDomDocument &dom = projectDom();
+ m_actionToggleShowVCSFields->setChecked( DomUtil::readBoolEntry(dom, "/kdevfileview/tree/showvcsfields") );
+ slotToggleShowVCSFields( showVCSFields() ); // show or hide fields depending on read settings
+ connect( parent, SIGNAL(expanded(QListViewItem*)), this, SLOT(slotDirectoryExpanded(QListViewItem*)));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+VCSFileTreeWidgetImpl::~VCSFileTreeWidgetImpl()
+{
+ kdDebug(9017) << "VCSFileTreeWidgetImpl::~VCSFileTreeWidgetImpl()" << endl;
+
+ QDomDocument &dom = projectDom();
+ DomUtil::writeBoolEntry( dom, "/kdevfileview/tree/showvcsfields", showVCSFields() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool VCSFileTreeWidgetImpl::canReloadTree() const
+{
+ return !m_isSyncingWithRepository;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeWidgetImpl::fillPopupMenu( QPopupMenu *popupMenu, QListViewItem *item ) const
+{
+ FileTreeViewWidgetImpl::fillPopupMenu( popupMenu, item );
+
+ // Submenu for visualization options
+ m_actionToggleShowVCSFields->plug( popupMenu );
+ // Give a change for syncing status with remote repository: a file info provider must
+ // be available and the item must be a project directory
+ FileTreeViewItem *fileItem = static_cast<FileTreeViewItem *>( item );
+ if (fileItem->isDir())
+ {
+ m_vcsStatusRequestedItem = fileItem;
+ popupMenu->insertSeparator();
+ m_actionSyncWithRepository->plug( popupMenu );
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeWidgetImpl::slotToggleShowVCSFields( bool checked )
+{
+ kdDebug(9017) << "VCSFileTreeWidgetImpl::slotToggleShowVCSFields()" << endl;
+
+ if (checked)
+ {
+ setColumnWidth( 0, contentsWidth() / 2 ); // "Filename"
+ setColumnWidth( 1, contentsWidth() / 4 ); // "status"
+ setColumnWidth( 2, contentsWidth() / 5 ); // "work revision"
+ setColumnWidth( 3, contentsWidth() / 5 ); // "repository revision"
+ header()->show();
+ }
+ else
+ {
+ setColumnWidth( 3 ,0 ); // Hide columns
+ setColumnWidth( 2 ,0 );
+ setColumnWidth( 1, 0 );
+ setColumnWidth( 0, contentsWidth() ); // Make the "Filename" column to occupy all the row
+ header()->hide();
+ }
+
+ triggerUpdate();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool VCSFileTreeWidgetImpl::showVCSFields() const
+{
+ return m_actionToggleShowVCSFields->isChecked();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeWidgetImpl::vcsDirStatusReady( const VCSFileInfoMap &modifiedFiles, void *callerData )
+{
+ kdDebug(9017) << "VCSFileTreeWidgetImpl::vcsDirStatusReady(const VCSFileInfoMap &, void*)" << endl;
+
+ VCSFileTreeViewItem *item = static_cast<VCSFileTreeViewItem*>( callerData );
+// Q_ASSERT( item ); // this must _not_ fail!
+ if( !item ){
+ kdDebug(9017) << "static_cast<VCSFileTreeViewItem*>( callerData ) failed" << endl;
+ return;
+ }
+ // Update vcs file info for all childs in this tree folder ...
+ item = static_cast<VCSFileTreeViewItem*>( item->firstChild() );
+ while (item)
+ {
+ const QString fileName = item->fileName();
+ kdDebug(9017) << "Widget item filename is: " << fileName << endl;
+ if (modifiedFiles.contains( fileName ))
+ {
+ const VCSFileInfo &vcsInfo = modifiedFiles[ fileName ];
+ kdDebug(9017) << "Nice! Found info for this file: " << vcsInfo.toString() << endl;
+ item->setVCSInfo( modifiedFiles[ fileName ] );
+ }
+ else
+ kdDebug(9017) << "Map does not contain anything useful about this file ;-( " << fileName << endl;
+ item = static_cast<VCSFileTreeViewItem*>( item->nextSibling() );
+ }
+ triggerUpdate();
+
+ m_isSyncingWithRepository = false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeWidgetImpl::slotSyncWithRepository()
+{
+ kdDebug(9017) << "VCSFileTreeWidgetImpl::slotSyncWithRepository()" << endl;
+ const VCSFileTreeViewItem *myFileItem = static_cast<VCSFileTreeViewItem *>( m_vcsStatusRequestedItem );
+ const QString relDirPath = URLUtil::extractPathNameRelative( projectDirectory(), myFileItem->fileItem()->url().path() );
+ kdDebug(9017) << "VCS Info requested for: " << relDirPath << endl;
+ m_vcsInfoProvider->requestStatus( relDirPath, m_vcsStatusRequestedItem );
+ m_isSyncingWithRepository = true;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void VCSFileTreeWidgetImpl::slotDirectoryExpanded( QListViewItem* aItem )
+{
+ VCSFileTreeViewItem *item = static_cast<VCSFileTreeViewItem *>( aItem );
+ if( !item ) return;
+
+ const QString relDirPath = URLUtil::extractPathNameRelative( projectDirectory(), item->fileItem()->url().path() );
+ kdDebug(9017) << "ASync VCS Info requested for: " << relDirPath << endl;
+ m_vcsInfoProvider->requestStatus( relDirPath, item, false, false );
+
+// m_isSyncingWithRepository = true;
+
+}
+
+#include "vcsfiletreewidgetimpl.moc"
diff --git a/parts/fileview/vcsfiletreewidgetimpl.h b/parts/fileview/vcsfiletreewidgetimpl.h
new file mode 100644
index 00000000..de4dc8c1
--- /dev/null
+++ b/parts/fileview/vcsfiletreewidgetimpl.h
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef VCSFILETREEWIDGETIMPL_H
+#define VCSFILETREEWIDGETIMPL_H
+
+#include "filetreeviewwidgetimpl.h"
+
+class KDevVCSFileInfoProvider;
+class KAction;
+class KToggleAction;
+
+/**
+* @author Mario Scalas
+* Provides VCS feedback to the standard features.
+*/
+class VCSFileTreeWidgetImpl : public FileTreeViewWidgetImpl
+{
+ Q_OBJECT
+public:
+ VCSFileTreeWidgetImpl( FileTreeWidget *parent, KDevVCSFileInfoProvider *infoProvider );
+ virtual ~VCSFileTreeWidgetImpl();
+
+ /*
+ * We must avoid a reload operation while we syncing with the repository since this
+ * will break our job.
+ */
+ virtual bool canReloadTree() const;
+ /*
+ * Add "sync with repository" and "show VCS fields" options to the context menu.
+ */
+ virtual void fillPopupMenu( QPopupMenu *popupMenu, QListViewItem *item ) const;
+
+private slots:
+ //! show/hide the header and the additional fields (status and versions)
+ void slotToggleShowVCSFields( bool checked );
+ //! start a sync operation with the remote repository: this may take a while so we use
+ //! the async interface provided by the KDevVCSFileInfoProvider interface
+ void slotSyncWithRepository();
+ //! when the requested info are ready the infoProvider object will be so kind the
+ //! to give them to us in a ready-to-use format: we'll use that info to update all
+ //! the items which are childs of the @see filetreeview::FileTreeViewItem stored in
+ //! @p callerData.
+ void vcsDirStatusReady( const VCSFileInfoMap &modifiedFiles, void *callerData );
+ void slotDirectoryExpanded( QListViewItem* );
+
+private:
+ bool showVCSFields() const;
+
+ KToggleAction *m_actionToggleShowVCSFields;
+ KAction *m_actionSyncWithRepository;
+ KDevVCSFileInfoProvider *m_vcsInfoProvider;
+ //! We use this guard to avoid enabling the "reload tree" action when performing
+ //! syncing with remote repositories.
+ bool m_isSyncingWithRepository;
+ mutable KFileTreeViewItem *m_vcsStatusRequestedItem;
+};
+
+#endif
diff --git a/parts/filter/Makefile.am b/parts/filter/Makefile.am
new file mode 100644
index 00000000..5a447405
--- /dev/null
+++ b/parts/filter/Makefile.am
@@ -0,0 +1,17 @@
+# Here resides the filter part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfilter.la
+libkdevfilter_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfilter_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfilter_la_SOURCES = filterpart.cpp shellfilterdlg.cpp shellinsertdlg.cpp kdevfilterIface.cpp kdevfilterIface.skel
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfilter.desktop
+
+rcdir = $(kde_datadir)/kdevfilter
+rc_DATA = kdevfilter.rc
diff --git a/parts/filter/README.dox b/parts/filter/README.dox
new file mode 100644
index 00000000..452db8ca
--- /dev/null
+++ b/parts/filter/README.dox
@@ -0,0 +1,52 @@
+/** \class FilterPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a>
+...
+\authors <a href="mailto:nth author AT provider.com">nth author full name</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/filter/filterpart.cpp b/parts/filter/filterpart.cpp
new file mode 100644
index 00000000..8804e701
--- /dev/null
+++ b/parts/filter/filterpart.cpp
@@ -0,0 +1,160 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "filterpart.h"
+
+#include <kaction.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/selectioninterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+
+#include "kdevcore.h"
+#include "kdevpartcontroller.h"
+#include "kdevplugininfo.h"
+#include "shellfilterdlg.h"
+#include "shellinsertdlg.h"
+#include "kdevfilterIface.h"
+
+static const KDevPluginInfo data("kdevfilter");
+K_EXPORT_COMPONENT_FACTORY( libkdevfilter, FilterFactory( data ) )
+
+FilterPart::FilterPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "FilterPart")
+{
+ setInstance(FilterFactory::instance());
+ setXMLFile("kdevfilter.rc");
+
+ KAction *action;
+
+ action = new KAction( i18n("Execute Command..."), 0,
+ this, SLOT(slotShellInsert()),
+ actionCollection(), "tools_insertshell" );
+ action->setToolTip(i18n("Execute shell command"));
+ action->setWhatsThis(i18n("<b>Execute shell command</b><p>Executes a shell command and outputs its result into the current document."));
+
+ action = new KAction( i18n("Filter Selection Through Command..."), 0,
+ this, SLOT(slotShellFilter()),
+ actionCollection(), "tools_filtershell" );
+ action->setToolTip(i18n("Filter selection through a shell command"));
+ action->setWhatsThis(i18n("<b>Filter selection through shell command</b><p>Filters selection through a shell command and outputs its result into the current document."));
+
+ m_insertDialog = 0;
+ m_filterDialog = 0;
+
+ new KDevFilterIface( this );
+ // (void) dcopClient();
+}
+
+
+FilterPart::~FilterPart()
+{
+ delete m_insertDialog;
+ delete m_filterDialog;
+}
+
+
+void FilterPart::slotShellInsert()
+{
+ /// @todo Disable menu item if no active part
+
+ KParts::ReadWritePart *part
+ = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
+ QWidget *view = partController()->activeWidget();
+ if (!part || !view) {
+ kdDebug(9029) << "no rw part" << endl;
+ return;
+ }
+
+ KTextEditor::EditInterface *editiface
+ = dynamic_cast<KTextEditor::EditInterface*>(part);
+ if (!editiface) {
+ kdDebug(9029) << "no edit" << endl;
+ return;
+ }
+
+ KTextEditor::ViewCursorInterface *cursoriface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(view);
+ if (!cursoriface) {
+ kdDebug(9029) << "no viewcursor" << endl;
+ return;
+ }
+
+ if (!m_insertDialog)
+ {
+ m_insertDialog = new ShellInsertDialog();
+ m_insertDialog->setCaption(i18n("Execute Command"));
+ }
+ if (m_insertDialog->exec()) {
+ uint line, col;
+ cursoriface->cursorPositionReal(&line, &col);
+ editiface->insertText(line, col, m_insertDialog->text());
+ }
+}
+
+
+void FilterPart::slotShellFilter()
+{
+ /// @todo Disable menu item if no active part
+
+ KParts::ReadWritePart *part
+ = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart());
+ QWidget *view = partController()->activeWidget();
+ if (!part || !view) {
+ kdDebug(9029) << "no rw part" << endl;
+ return;
+ }
+
+ KTextEditor::EditInterface *editiface
+ = dynamic_cast<KTextEditor::EditInterface*>(part);
+ if (!editiface) {
+ kdDebug(9029) << "no edit" << endl;
+ return;
+ }
+
+ KTextEditor::ViewCursorInterface *cursoriface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(view);
+ if (!cursoriface) {
+ kdDebug(9029) << "no viewcursor" << endl;
+ return;
+ }
+
+ KTextEditor::SelectionInterface *selectioniface
+ = dynamic_cast<KTextEditor::SelectionInterface*>(part);
+ if (!selectioniface) {
+ kdDebug(9029) << "no selection" << endl;
+ return;
+ }
+
+ if (!m_filterDialog)
+ {
+ m_filterDialog = new ShellFilterDialog();
+ m_filterDialog->setCaption(i18n("Filter Selection Through Command"));
+ }
+
+ kdDebug(9029) << "Old text: " << selectioniface->selection()<< endl;
+
+ m_filterDialog->setText(selectioniface->selection());
+
+ if (m_filterDialog->exec()) {
+ uint line, col;
+ // OUCH: KTextEditor doesn't allow to find out
+ // where the selection is
+ selectioniface->removeSelectedText();
+ cursoriface->cursorPositionReal(&line, &col);
+ kdDebug(9029) << "New text: " << m_filterDialog->text() << endl;
+ editiface->insertText(line, col, m_filterDialog->text());
+ }
+}
+
+#include "filterpart.moc"
diff --git a/parts/filter/filterpart.h b/parts/filter/filterpart.h
new file mode 100644
index 00000000..ec731f12
--- /dev/null
+++ b/parts/filter/filterpart.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _FILTERPART_H_
+#define _FILTERPART_H_
+
+#include <kdevgenericfactory.h>
+#include "kdevplugin.h"
+
+class ShellInsertDialog;
+class ShellFilterDialog;
+
+
+class FilterPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ FilterPart( QObject *parent, const char *name, const QStringList & );
+ ~FilterPart();
+
+public slots:
+ void slotShellInsert();
+ void slotShellFilter();
+
+private:
+ ShellInsertDialog *m_insertDialog;
+ ShellFilterDialog *m_filterDialog;
+};
+
+typedef KDevGenericFactory<FilterPart> FilterFactory;
+
+#endif
diff --git a/parts/filter/kdevfilter.desktop b/parts/filter/kdevfilter.desktop
new file mode 100644
index 00000000..294ae55e
--- /dev/null
+++ b/parts/filter/kdevfilter.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides a way of manipulating editor text using commandline tools. Appears in the Tools menu.
+Comment[ca]=Proporciona un mètode per a manipular text a l'editor emprant eines de la línia de comandaments. Apareix al menú Eines.
+Comment[da]=Sørger for en måde at manipulere editortekst ved brug af kommandolinje værktøjer. Viser sig i værktøjsmenuen.
+Comment[de]=Ermöglicht die Bearbeitung von Editorinhalten mit Konsolenanwendungen. Erscheint im Menü Werkzeuge.
+Comment[el]=Προσφέρει μια μέθοδο διαχείρισης κειμένου επεξεργαστή χρησιμοποιώντας εργαλεία γραμμής εντολών. Εμφανίζεται στο μενού εργαλείων.
+Comment[es]=Proporciona un método para manipular texto del editor utilizando herramientas de la línea de órdenes. Aparece en el menú Herramientas.
+Comment[et]=Võimaldab käsureavahendite abil käsitleda redaktoris olevat teksti. Kättesaadav tööriistade menüüst.
+Comment[eu]=Komando-lerro tresnak erabiliz editore testua manipulatzeko aukera ematen dizu. Tresnak menuan dago.
+Comment[fa]=راهی برای دستکاری متن ویرایشگر، با استفاده از ابزار خط فرمان فراهم می‌کند. در گزینگان ابزار ظاهر می‌شود.
+Comment[fr]=Fournit un moyen de manipuler le texte de l'éditeur à l'aide d'outils en ligne de commande. Cette fonction apparaît dans le menu « Outils ».
+Comment[gl]=Proporciona unha maneira para manipular o texto do editor usando ferramentas da liña de comandos. Aparece no menú Ferramentas.
+Comment[hu]=Lehetővé teszi a szerkesztett szövegek kezelését parancssoros programokból (az Eszközök menüből érhető el)
+Comment[it]=Offre un modo per manipolare il testo utilizzando strumenti a riga di comando. Appare nel menu degli strumenti.
+Comment[ja]=コマンドラインツールを使用して、エディタテキストを操作する方法を提供します。ツールメニューに現れます。
+Comment[ms]=Menyediakan cara untuk memanipulasi teks penyunting menggunakan alatan arahan baris. Muncul didalam menu Alatan.
+Comment[nds]=Stellt dat Ännern vun Editorinholden mit Befehlsreeg-Warktüüch praat. Dukt in't Menü "Warktüüch" op.
+Comment[ne]=आदेशरेखा उपकरण प्रयोग गरेर सम्पादक चलाउने तरिका प्रदान गर्दछ ।
+Comment[nl]=Maakt het mogelijk de tekstinhoud van de editor met externe commandoregeltools te bewerken. Verschijnt in het menu Gereedschap.
+Comment[pl]=Umożliwia manipulowanie tekstem w edytorze za pomocą narzędzi linii komend. Pojawia się w menu Narzędzia.
+Comment[pt]=Oferece uma forma de manipular o texto do edito com as ferramentas da linha de comandos. Aparece no menu de Ferramentas.
+Comment[pt_BR]=Fornece uma maneira de manipular o editor de texto usando ferramentas de linha de comando. Aparece no menu Ferramentas.
+Comment[ru]=Предоставляет функции работы с текстом в редакторе с использованием утилит командной строки.
+Comment[sk]=Umožní manipuláciu s textom editora s použitím nástrojov príkazového riadku. Objaví sa v menu Nástroje.
+Comment[sr]=Обезбеђује начин манипулисања текстом уређивача коришћењем алата командне линије. Појављује се у менију „Алати“.
+Comment[sr@Latn]=Obezbeđuje način manipulisanja tekstom uređivača korišćenjem alata komandne linije. Pojavljuje se u meniju „Alati“.
+Comment[sv]=Erbjuder ett sätt att behandla editortext med kommandoradsverktyg. Finns i verktygsmenyn.
+Comment[ta]=கட்டளை கருவி உபயோகித்து தொகுப்பான் உறைகளை கையாள இது வழி அளிக்கும். கருவிப்பட்டியலில் இது தோன்றும்
+Comment[tg]=Вазифаи корҳо бо матнҳои дар муҳаррир буда бо истифодаи фармони сатр гузориш менамояд.
+Comment[tr]=Komut satırı araçlarını kullanarak düzenleyici metni işlemek için bir yol sunar. Araçlar menüsünde durur.
+Comment[zh_CN]=使用命令行工具操作编辑器文字。显示在工具菜单中。
+Comment[zh_TW]=提供使用命令列工具操作編輯器文字的方法。會出現在工具選單中。
+Name=KDevFilter
+Name[da]=KDevelop filter
+Name[de]=Filter (KDevelop)
+Name[hi]=के-डेव-फ़िल्टर
+Name[nds]=KDevelop-Filter
+Name[pl]=KDevFiltr
+Name[sk]=KDev filter
+Name[sv]=KDevelop filter
+Name[ta]=KDev வடிகட்டல்
+Name[tg]=Филтри KDev
+Name[zh_TW]=KDevelop 過濾器
+GenericName=Shell Filtering and Insertion
+GenericName[ca]=Inserció i filtrat de la línia de comandaments
+GenericName[da]=Skal-filtrering og indsætning
+GenericName[de]=Filtern und Einfügen über Shell-Befehle
+GenericName[el]=Εισαγωγή και φιλτράρισμα κελύφους
+GenericName[es]=Inserción y filtrado en línea de órdenes
+GenericName[et]=Shellifiltrid ja lisamine
+GenericName[eu]=Shell iragazte eta txertatzea
+GenericName[fa]=پالایش و درج پوسته
+GenericName[fr]=Filtrage et insertion dans le shell
+GenericName[gl]=Inserción e filtrado shell
+GenericName[hi]=शेल फ़िल्टरिंग तथा प्रविष्टि
+GenericName[hu]=Szűrés és beszúrás
+GenericName[it]=Inserimento e filtraggio da shell
+GenericName[ja]=シェルフィルタリングと挿入
+GenericName[nds]=Filtern un Infögen mit Konsool-Befehlen
+GenericName[ne]=शेल फिल्टरिङ र घुसाइ
+GenericName[nl]=Filteren en invoegen met shellcommando's
+GenericName[pl]=Filtrowanie i wstawianie za pomocą powłoki
+GenericName[pt]=Filtragem e Inserção por 'Shell'
+GenericName[pt_BR]=Shell de Filtro e Inserção
+GenericName[ru]=Фильтрация и вставка с помощью команд оболочки
+GenericName[sk]=Shell filtrovanie a vkladanie
+GenericName[sl]=Filtriranje lupine in vstavljanje
+GenericName[sr]=Филтрирање и убацивање шкољке
+GenericName[sr@Latn]=Filtriranje i ubacivanje školjke
+GenericName[sv]=Skalfiltrering och infogning
+GenericName[ta]=உறையகத்தை வடிகட்ட மற்றும் சேர்க்க
+GenericName[tg]=Бо пӯсти фармон филтр ва мондан
+GenericName[tr]=Kabuk filtreleme ve Ekleme
+GenericName[zh_CN]=Shell 过滤和插入
+GenericName[zh_TW]=Shell 過濾與插入
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevfilter
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=OptionalCodeEditing
diff --git a/parts/filter/kdevfilter.rc b/parts/filter/kdevfilter.rc
new file mode 100644
index 00000000..6f7f9053
--- /dev/null
+++ b/parts/filter/kdevfilter.rc
@@ -0,0 +1,10 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevFilter" version="1">
+<MenuBar>
+ <Menu name="tools" >
+ <Action name="tools_insertshell" group="tools_file_operations"/>
+ <Action name="tools_filtershell" group="tools_file_operations"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/filter/kdevfilterIface.cpp b/parts/filter/kdevfilterIface.cpp
new file mode 100644
index 00000000..55a0421a
--- /dev/null
+++ b/parts/filter/kdevfilterIface.cpp
@@ -0,0 +1,35 @@
+//
+//
+// C++ Implementation: cpp
+//
+// Description:
+//
+//
+// Author: KDevelop Authors <kdevelop-devel@kdevelop.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "kdevfilterIface.h"
+#include "filterpart.h"
+
+KDevFilterIface::KDevFilterIface( FilterPart* part )
+ : QObject( part ), DCOPObject( "KDevFilter" ), m_part( part )
+{
+}
+
+KDevFilterIface::~KDevFilterIface()
+{
+}
+
+void KDevFilterIface::shellInsert()
+{
+ m_part->slotShellInsert();
+}
+
+void KDevFilterIface::shellFilter()
+{
+ m_part->slotShellFilter();
+}
+
+#include "kdevfilterIface.moc"
diff --git a/parts/filter/kdevfilterIface.h b/parts/filter/kdevfilterIface.h
new file mode 100644
index 00000000..46a14277
--- /dev/null
+++ b/parts/filter/kdevfilterIface.h
@@ -0,0 +1,26 @@
+
+#ifndef KDEVFILTERIFACE_H
+#define KDEVFILTERIFACE_H
+
+#include <qobject.h>
+#include <dcopobject.h>
+
+class FilterPart;
+
+class KDevFilterIface : public QObject, public DCOPObject
+{
+ Q_OBJECT
+ K_DCOP
+public:
+ KDevFilterIface( FilterPart* part );
+ ~KDevFilterIface();
+
+k_dcop:
+ void shellInsert();
+ void shellFilter();
+
+private:
+ FilterPart* m_part;
+};
+
+#endif
diff --git a/parts/filter/shellfilterdlg.cpp b/parts/filter/shellfilterdlg.cpp
new file mode 100644
index 00000000..7e967cda
--- /dev/null
+++ b/parts/filter/shellfilterdlg.cpp
@@ -0,0 +1,128 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "shellfilterdlg.h"
+
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <kbuttonbox.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <kstdguiitem.h>
+#include <kdeversion.h>
+
+#include "kdevplugin.h"
+#include "domutil.h"
+#include "filterpart.h"
+
+
+ShellFilterDialog::ShellFilterDialog()
+ : QDialog(0, "shell filter dialog", true)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this, 10, 4);
+
+ combo = new QComboBox(true, this);
+ combo->setDuplicatesEnabled(false);
+ layout->addWidget(combo);
+
+ KButtonBox *buttonbox = new KButtonBox(this);
+ start_button = buttonbox->addButton(i18n("&Start"));
+ start_button->setDefault(true);
+ cancel_button = buttonbox->addButton(KStdGuiItem::cancel());
+ buttonbox->layout();
+ layout->addWidget(buttonbox);
+
+ connect( start_button, SIGNAL(clicked()),
+ this, SLOT(slotStartClicked()) );
+ connect( cancel_button, SIGNAL(clicked()),
+ this, SLOT(reject()) );
+
+ m_proc = 0;
+
+ KConfig *config = FilterFactory::instance()->config();
+ config->setGroup("General");
+ combo->insertStringList(config->readListEntry("filteritems"));
+}
+
+
+ShellFilterDialog::~ShellFilterDialog()
+{
+ kdDebug(9029) << "~ShellFilterDialog" << endl;
+ delete m_proc;
+
+ // QComboBox API is a bit incomplete :-(
+ QStringList list;
+ for (int i=0; i < combo->count(); ++i)
+ list << combo->text(i);
+
+ KConfig *config = FilterFactory::instance()->config();
+ config->setGroup("General");
+ config->writeEntry("filteritems", list);
+}
+
+
+void ShellFilterDialog::slotStartClicked()
+{
+ start_button->setEnabled(false);
+ m_outstr = QCString();
+
+ delete m_proc;
+ m_proc = new KShellProcess("/bin/sh");
+ (*m_proc) << combo->currentText();
+ connect( m_proc, SIGNAL(receivedStdout(KProcess*, char *, int)),
+ this, SLOT(slotReceivedStdout(KProcess*, char *, int)) );
+ connect( m_proc, SIGNAL(wroteStdin(KProcess*)),
+ this, SLOT(slotWroteStdin(KProcess*)) );
+ connect( m_proc, SIGNAL(processExited(KProcess*)),
+ this, SLOT(slotProcessExited(KProcess*)) );
+ m_proc->start(KProcess::NotifyOnExit, KProcess::All);
+ m_proc->writeStdin(m_instr, m_instr.length());
+}
+
+
+int ShellFilterDialog::exec()
+{
+ start_button->setEnabled(true);
+ return QDialog::exec();
+}
+
+
+void ShellFilterDialog::slotReceivedStdout(KProcess *, char *text, int len)
+{
+ m_outstr += QString::fromLocal8Bit(text, len+1);
+ kdDebug(9029) << "outstr " << m_outstr << endl;
+}
+
+
+void ShellFilterDialog::slotWroteStdin(KProcess *)
+{
+ m_proc->closeStdin();
+ kdDebug(9029) << "close stdin " << m_outstr << endl;
+}
+
+
+void ShellFilterDialog::slotProcessExited(KProcess *)
+{
+ kdDebug(9029) << "process exit " << m_proc->normalExit() << endl;
+ if (m_proc->normalExit()) {
+ accept();
+ } else {
+ KMessageBox::error(this, i18n("Process exited with status %1")
+ .arg(m_proc->exitStatus()));
+ reject();
+ }
+}
+
+#include "shellfilterdlg.moc"
diff --git a/parts/filter/shellfilterdlg.h b/parts/filter/shellfilterdlg.h
new file mode 100644
index 00000000..3307c060
--- /dev/null
+++ b/parts/filter/shellfilterdlg.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _SHELLFILTERDLG_H_
+#define _SHELLFILTERDLG_H_
+
+#include <qdialog.h>
+
+class QComboBox;
+class QPushButton;
+class KDevPlugin;
+class KProcess;
+
+
+class ShellFilterDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ShellFilterDialog();
+ ~ShellFilterDialog();
+
+ virtual int exec();
+
+ void setText(const QString &str)
+ { m_instr = str.local8Bit(); }
+ QString text() const
+ { return m_outstr; }
+
+private slots:
+ void slotStartClicked();
+ void slotReceivedStdout(KProcess *, char *text, int len);
+ void slotWroteStdin(KProcess *);
+ void slotProcessExited(KProcess *);
+
+private:
+ QPushButton *start_button, *cancel_button;
+ QComboBox *combo;
+ KProcess *m_proc;
+ QCString m_instr;
+ QString m_outstr;
+};
+
+#endif
diff --git a/parts/filter/shellinsertdlg.cpp b/parts/filter/shellinsertdlg.cpp
new file mode 100644
index 00000000..a1474ed2
--- /dev/null
+++ b/parts/filter/shellinsertdlg.cpp
@@ -0,0 +1,125 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "shellinsertdlg.h"
+
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <kconfig.h>
+#include <kbuttonbox.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <klineedit.h>
+#include <kstdguiitem.h>
+#include <kdeversion.h>
+
+#include "kdevplugin.h"
+#include "domutil.h"
+#include "filterpart.h"
+
+
+ShellInsertDialog::ShellInsertDialog()
+ : QDialog(0, "shell filter dialog", true)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this, 10, 4);
+
+ combo = new QComboBox(true, this);
+ combo->setDuplicatesEnabled(false);
+ layout->addWidget(combo);
+
+ KButtonBox *buttonbox = new KButtonBox(this);
+ start_button = buttonbox->addButton(i18n("&Start"));
+ start_button->setDefault(true);
+ cancel_button = buttonbox->addButton(KStdGuiItem::cancel());
+ buttonbox->layout();
+ layout->addWidget(buttonbox);
+
+ connect( start_button, SIGNAL(clicked()),
+ this, SLOT(slotStartClicked()) );
+ connect( cancel_button, SIGNAL(clicked()),
+ this, SLOT(reject()) );
+ connect( combo->lineEdit(), SIGNAL(textChanged( const QString &)), this, SLOT(executeTextChanged( const QString &)));
+ m_proc = 0;
+
+ KConfig *config = FilterFactory::instance()->config();
+ config->setGroup("General");
+ QStringList items = config->readListEntry("InsertItems");
+ combo->insertStringList(items);
+ executeTextChanged( combo->lineEdit()->text());
+
+}
+
+
+ShellInsertDialog::~ShellInsertDialog()
+{
+ kdDebug(9029) << "~ShellInsertDialog" << endl;
+ delete m_proc;
+
+ // QComboBox API is a bit incomplete :-(
+ QStringList list;
+ for (int i=0; i < combo->count(); ++i)
+ list << combo->text(i);
+
+ KConfig *config = FilterFactory::instance()->config();
+ config->setGroup("General");
+ config->writeEntry("InsertItems", list);
+}
+
+
+void ShellInsertDialog::executeTextChanged( const QString &text)
+{
+ start_button->setEnabled(!text.isEmpty());
+}
+
+int ShellInsertDialog::exec()
+{
+ start_button->setEnabled(true);
+ return QDialog::exec();
+}
+
+
+void ShellInsertDialog::slotStartClicked()
+{
+ start_button->setEnabled(false);
+ m_str = QCString();
+
+ delete m_proc;
+ m_proc = new KShellProcess("/bin/sh");
+ (*m_proc) << combo->currentText();
+ connect( m_proc, SIGNAL(receivedStdout(KProcess*, char *, int)),
+ this, SLOT(slotReceivedStdout(KProcess*, char *, int)) );
+ connect( m_proc, SIGNAL(processExited(KProcess*)),
+ this, SLOT(slotProcessExited(KProcess*)) );
+ m_proc->start(KProcess::NotifyOnExit, KProcess::AllOutput);
+}
+
+
+void ShellInsertDialog::slotReceivedStdout(KProcess *, char *text, int len)
+{
+ m_str += QCString(text, len+1);
+}
+
+
+void ShellInsertDialog::slotProcessExited(KProcess *)
+{
+ if (m_proc->normalExit()) {
+ accept();
+ } else {
+ KMessageBox::error(this, i18n("Process exited with status %1")
+ .arg(m_proc->exitStatus()));
+ reject();
+ }
+}
+
+#include "shellinsertdlg.moc"
diff --git a/parts/filter/shellinsertdlg.h b/parts/filter/shellinsertdlg.h
new file mode 100644
index 00000000..c6f0696b
--- /dev/null
+++ b/parts/filter/shellinsertdlg.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _SHELLINSERTDLG_H_
+#define _SHELLINSERTDLG_H_
+
+#include <qdialog.h>
+
+class QComboBox;
+class QPushButton;
+class KDevPlugin;
+class KProcess;
+
+
+class ShellInsertDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ShellInsertDialog();
+ ~ShellInsertDialog();
+
+ virtual int exec();
+
+ QString text() const
+ { return QString::fromLocal8Bit(m_str); }
+
+private slots:
+ void slotStartClicked();
+ void slotReceivedStdout(KProcess *, char *text, int len);
+ void slotProcessExited(KProcess *);
+ void executeTextChanged( const QString &text);
+
+private:
+ QPushButton *start_button, *cancel_button;
+ QComboBox *combo;
+ KProcess *m_proc;
+ QCString m_str;
+};
+
+#endif
diff --git a/parts/fullscreen/Makefile.am b/parts/fullscreen/Makefile.am
new file mode 100644
index 00000000..3fecf8e5
--- /dev/null
+++ b/parts/fullscreen/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevfullscreen.la
+libkdevfullscreen_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevfullscreen_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevfullscreen_la_SOURCES = fullscreen_part.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevfullscreen.desktop
+
+rcdir = $(kde_datadir)/kdevfullscreen
+rc_DATA = kdevpart_fullscreen.rc
diff --git a/parts/fullscreen/README.dox b/parts/fullscreen/README.dox
new file mode 100644
index 00000000..10f74509
--- /dev/null
+++ b/parts/fullscreen/README.dox
@@ -0,0 +1,10 @@
+/** \class FullScreenPart
+Displays KDevelop in full screen
+
+\authors <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a>
+
+\maintainer <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a>
+
+\feature Displays KDevelop in full screen
+
+*/
diff --git a/parts/fullscreen/fullscreen_part.cpp b/parts/fullscreen/fullscreen_part.cpp
new file mode 100644
index 00000000..20e046f1
--- /dev/null
+++ b/parts/fullscreen/fullscreen_part.cpp
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kstdaction.h>
+#include <kmainwindow.h>
+#include <kmenubar.h>
+
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <kdevplugininfo.h>
+
+#include "fullscreen_part.h"
+
+static const KDevPluginInfo data("kdevfullscreen");
+
+typedef KDevGenericFactory<FullScreenPart> FullScreenFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevfullscreen, FullScreenFactory( data ) )
+
+FullScreenPart::FullScreenPart(QObject *parent, const char *name, const QStringList& )
+ : KDevPlugin(&data, parent, name ? name : "FullScreenPart" )
+{
+ setInstance(FullScreenFactory::instance());
+// const KAboutData &abdata1 = *(info());
+// kdDebug() << abdata1.appName() << endl;
+ const KDevPluginInfo &_info = *info();
+ const KAboutData *abdata = _info;
+ kdDebug() << abdata->appName() << endl;
+ setXMLFile("kdevpart_fullscreen.rc");
+
+ m_bFullScreen = false;
+
+ m_pFullScreen = KStdAction::fullScreen(this, SLOT(slotToggleFullScreen()), actionCollection(), mainWindow()->main());
+}
+
+FullScreenPart::~FullScreenPart()
+{
+}
+
+void FullScreenPart::slotToggleFullScreen( )
+{
+ m_bFullScreen = !m_bFullScreen;
+ if( m_bFullScreen ){
+ //mw->menuBar()->hide();
+ mainWindow()->main()->showFullScreen();
+
+ /*m_pFullScreen->setText( i18n( "Exit Full-Screen Mode" ) );
+ m_pFullScreen->setToolTip( i18n( "Exit full-screen mode" ) );
+ m_pFullScreen->setIcon( "window_nofullscreen" );*/
+ } else {
+ //mw->menuBar()->show();
+
+ mainWindow()->main()->showNormal();
+
+ /*m_pFullScreen->setText( i18n( "&Full-Screen Mode" ) );
+ m_pFullScreen->setToolTip(i18n("Full-screen mode"));
+ m_pFullScreen->setIcon( "window_fullscreen" );*/
+ }
+}
+
+
+#include "fullscreen_part.moc"
diff --git a/parts/fullscreen/fullscreen_part.h b/parts/fullscreen/fullscreen_part.h
new file mode 100644
index 00000000..a7ce3c0a
--- /dev/null
+++ b/parts/fullscreen/fullscreen_part.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Roberto Raggi *
+ * roberto@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __KDEVPART_FULLSCREEN_H__
+#define __KDEVPART_FULLSCREEN_H__
+
+#include <qguardedptr.h>
+#include <kdevplugin.h>
+
+class KAction;
+
+class FullScreenPart : public KDevPlugin
+{
+ Q_OBJECT
+public:
+ FullScreenPart(QObject *parent, const char *name, const QStringList &);
+ virtual ~FullScreenPart();
+
+public slots:
+ void slotToggleFullScreen();
+
+private:
+ KToggleFullScreenAction* m_pFullScreen;
+ bool m_bFullScreen;
+};
+
+
+#endif
diff --git a/parts/fullscreen/kdevfullscreen.desktop b/parts/fullscreen/kdevfullscreen.desktop
new file mode 100644
index 00000000..e9cf55f0
--- /dev/null
+++ b/parts/fullscreen/kdevfullscreen.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=FullScreen
+Comment[br]=Skramm leun
+Comment[ca]=Pantalla completa
+Comment[da]=Fuldskærm
+Comment[de]=Vollbild
+Comment[el]=ΠλήρηςΟθόνη
+Comment[es]=Pantalla completa
+Comment[eu]=Pantaila osoa
+Comment[fa]=تمام ‌صفحه
+Comment[fr]=Plein écran
+Comment[ga]=Lánscáileán
+Comment[hi]=फुल-स्क्रीन
+Comment[hu]=Teljes képernyő
+Comment[it]=Schermo pieno
+Comment[ja]=フルスクリーン
+Comment[ms]=SkrinPenuh
+Comment[nds]=Heel Schirm
+Comment[ne]=पूरा पर्दा
+Comment[nl]=Volledig scherm
+Comment[pl]=Pełny ekran
+Comment[pt]=Todo o Ecrã
+Comment[pt_BR]=Tela Cheia
+Comment[ru]=Полноэкранный режим
+Comment[sk]=Celá obrazovka
+Comment[sl]=Celozaslonski način
+Comment[sr]=Преко целог екрана
+Comment[sr@Latn]=Preko celog ekrana
+Comment[sv]=Fullskärm
+Comment[ta]=முழுத்திரை
+Comment[tg]=Тартиботи экрани пурра
+Comment[tr]=Tam Ekran
+Comment[zh_CN]=全屏
+Comment[zh_TW]=全螢幕
+Name=KDevFullScreen
+Name[da]=KDevelop fuldskærm
+Name[de]=Vollbild (KDevelop)
+Name[hi]=के-डेव-फुलस्क्रीन
+Name[nds]=KDevelop-Heelschirm
+Name[pl]=KDevPełnyEkran
+Name[sk]=KDev celá obrazovka
+Name[sv]=KDevelop fullskärm
+Name[ta]=KDev முழுத்திரை
+Name[tg]=Васеъкуниии KDev
+Name[zh_TW]=KDevelop 全螢幕
+GenericName=FullScreen
+GenericName[br]=Skramm leun
+GenericName[ca]=Pantalla completa
+GenericName[da]=Fuldskærm
+GenericName[de]=Vollbild
+GenericName[el]=ΠλήρηςΟθόνη
+GenericName[es]=Pantalla completa
+GenericName[et]=Täisekraan
+GenericName[eu]=Pantaila osoa
+GenericName[fa]=تمام‌ صفحه
+GenericName[fr]=Plein écran
+GenericName[ga]=Lánscáileán
+GenericName[hi]=फुल-स्क्रीन
+GenericName[hu]=Teljes képernyő
+GenericName[it]=Schermo pieno
+GenericName[ja]=フルスクリーン
+GenericName[nds]=Heel Schirm
+GenericName[ne]=पूरा पर्दा
+GenericName[nl]=Volledig scherm
+GenericName[pl]=Pełny ekran
+GenericName[pt]=Todo o Ecrã
+GenericName[pt_BR]=Tela Cheia
+GenericName[ru]=Полноэкранный режим
+GenericName[sk]=Celá obrazovka
+GenericName[sl]=Celozaslonski način
+GenericName[sr]=Преко целог екрана
+GenericName[sr@Latn]=Preko celog ekrana
+GenericName[sv]=Fullskärm
+GenericName[ta]=முழுத்திரை
+GenericName[tg]=Тартиботи экрани пурра
+GenericName[tr]=Tam Ekran
+GenericName[zh_CN]=全屏
+GenericName[zh_TW]=全螢幕
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Core
+X-KDE-Library=libkdevfullscreen
+X-KDevelop-Version=5
+X-KDevelop-Properties=ViewManagement
diff --git a/parts/fullscreen/kdevpart_fullscreen.rc b/parts/fullscreen/kdevpart_fullscreen.rc
new file mode 100644
index 00000000..3bd67c9d
--- /dev/null
+++ b/parts/fullscreen/kdevpart_fullscreen.rc
@@ -0,0 +1,12 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="fullscreen" library="libfullscreenplugin" version="3">
+<MenuBar>
+ <Menu name="settings">
+ <Text>&amp;Settings</Text>
+ <Action name="fullscreen" group="show_merge"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="fullscreen" group="screenmode_operations"/>
+</ToolBar>
+</kpartplugin>
diff --git a/parts/grepview/Makefile.am b/parts/grepview/Makefile.am
new file mode 100644
index 00000000..49f3c202
--- /dev/null
+++ b/parts/grepview/Makefile.am
@@ -0,0 +1,19 @@
+# Here resides the grep view part.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/lib/widgets $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevgrepview.la
+libkdevgrepview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevgrepview_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/lib/widgets/libkdevwidgets.la $(LIB_KHTML)
+
+libkdevgrepview_la_SOURCES = grepviewpart.cpp grepviewwidget.cpp grepdlg.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevgrepview.desktop
+
+rcdir = $(kde_datadir)/kdevgrepview
+rc_DATA = kdevgrepview.rc
diff --git a/parts/grepview/README.dox b/parts/grepview/README.dox
new file mode 100644
index 00000000..d5e9130a
--- /dev/null
+++ b/parts/grepview/README.dox
@@ -0,0 +1,12 @@
+/** \class GrepViewPart
+Integrates "find|grep" in KDevelop - allows fast searching of multiple files using patterns or regular expressions.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a> aka teatime
+
+\feature grep works on editor context menu
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=grep%20frontend&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">Grep Frontend component at Bugzilla database</a>
+
+*/
diff --git a/parts/grepview/grepdlg.cpp b/parts/grepview/grepdlg.cpp
new file mode 100644
index 00000000..9c62510e
--- /dev/null
+++ b/parts/grepview/grepdlg.cpp
@@ -0,0 +1,381 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "grepdlg.h"
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+#include <qhbox.h>
+#include <qwhatsthis.h>
+#include <qtooltip.h>
+#include <qstringlist.h>
+#include <kfiledialog.h>
+#include <kbuttonbox.h>
+#include <kpushbutton.h>
+#include <kapplication.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <kdeversion.h>
+#include <qlabel.h>
+#include <kcombobox.h>
+#include <kurlcompletion.h>
+#include <kurlrequester.h>
+#include <kstdguiitem.h>
+#include <kparts/part.h>
+#include <kdevpartcontroller.h>
+#include <klineedit.h>
+
+#include "grepviewpart.h"
+
+
+const char *template_desc[] = {
+ "verbatim",
+ "assignment",
+ "->MEMBER(",
+ "class::MEMBER(",
+ "OBJECT->member(",
+ 0
+};
+
+const char *template_str[] = {
+ "%s",
+ "\\<%s\\>[\\t ]*=[^=]",
+ "\\->[\\t ]*\\<%s\\>[\\t ]*\\(",
+ "[a-z0-9_$]+[\\t ]*::[\\t ]*\\<%s\\>[\\t ]*\\(",
+ "\\<%s\\>[\\t ]*\\->[\\t ]*[a-z0-9_$]+[\\t ]*\\(",
+ 0
+};
+
+const char *filepatterns[] = {
+ "*.h,*.hxx,*.hpp,*.hh,*.h++,*.H,*.tlh,*.cpp,*.cc,*.C,*.c++,*.cxx,*.ocl,*.inl,*.idl,*.c,*.m,*.mm,*.M",
+ "*.cpp,*.cc,*.C,*.c++,*.cxx,*.ocl,*.inl,*.c,*.m,*.mm,*.M",
+ "*.h,*.hxx,*.hpp,*.hh,*.h++,*.H,*.tlh,*.idl",
+ "*.adb",
+ "*.cs",
+ "*.f",
+ "*.html,*.htm",
+ "*.hs",
+ "*.java",
+ "*.js",
+ "*.php,*.php3,*.php4",
+ "*.pl",
+ "*.pp,*.pas",
+ "*.py",
+ "*.js,*.css,*.yml,*.rb,*.rhtml,*.html.erb,*.rjs,*.js.rjs,*.rxml,*.xml.builder",
+ "CMakeLists.txt,*.cmake",
+ "*",
+ 0
+};
+
+
+GrepDialog::GrepDialog( GrepViewPart * part, QWidget *parent, const char *name )
+ : QDialog(parent, name, false), m_part( part )
+{
+ setCaption(i18n("Find in Files"));
+
+ config = GrepViewFactory::instance()->config();
+ config->setGroup("GrepDialog");
+
+ QGridLayout *layout = new QGridLayout(this, 9, 2, 10, 4);
+ layout->setColStretch(0, 0);
+ layout->setColStretch(1, 20);
+
+ QLabel *pattern_label = new QLabel(i18n("&Pattern:"), this);
+ layout->addWidget(pattern_label, 0, 0, AlignRight | AlignVCenter);
+
+ pattern_combo = new KHistoryCombo(true, this);
+ pattern_label->setBuddy(pattern_combo);
+ pattern_combo->setFocus();
+ pattern_combo->setHistoryItems(config->readListEntry("LastSearchItems"), true);
+ pattern_combo->setInsertionPolicy(QComboBox::NoInsertion);
+ layout->addWidget(pattern_combo, 0, 1);
+
+ QLabel *template_label = new QLabel(i18n("&Template:"), this);
+ layout->addWidget(template_label, 1, 0, AlignRight | AlignVCenter);
+
+ QBoxLayout *template_layout = new QHBoxLayout(4);
+ layout->addLayout(template_layout, 1, 1);
+
+ template_edit = new KLineEdit(this);
+ template_label->setBuddy(template_edit);
+ template_edit->setText(template_str[0]);
+ template_layout->addWidget(template_edit, 1);
+
+ KComboBox *template_combo = new KComboBox(false, this);
+ template_combo->insertStrList(template_desc);
+ template_layout->addWidget(template_combo, 0);
+
+ QBoxLayout *search_opts_layout = new QHBoxLayout(15);
+ layout->addLayout(search_opts_layout, 2, 1);
+
+ regexp_box = new QCheckBox(i18n("&Regular Expression"), this);
+ regexp_box->setChecked(config->readBoolEntry("regexp", false ));
+ search_opts_layout->addWidget(regexp_box);
+
+ case_sens_box = new QCheckBox(i18n("C&ase sensitive"), this);
+ case_sens_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ case_sens_box->setChecked(config->readBoolEntry("case_sens", true));
+ search_opts_layout->addWidget(case_sens_box);
+
+ QLabel *dir_label = new QLabel(i18n("&Directory:"), this);
+ layout->addWidget(dir_label, 3, 0, AlignRight | AlignVCenter);
+
+ QBoxLayout *dir_layout = new QHBoxLayout(4);
+ layout->addLayout(dir_layout, 3, 1);
+
+ dir_combo = new KComboBox( true, this );
+ dir_combo->insertStringList(config->readPathListEntry("LastSearchPaths"));
+ dir_combo->setInsertionPolicy(QComboBox::NoInsertion);
+ dir_combo->setEditText(QDir::homeDirPath());
+
+ url_requester = new KURLRequester( dir_combo, this );
+ url_requester->completionObject()->setMode(KURLCompletion::DirCompletion);
+ url_requester->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+
+ dir_label->setBuddy( url_requester );
+ dir_combo->setMinimumWidth(dir_combo->fontMetrics().maxWidth()*25);
+ dir_layout->addWidget( url_requester, 10 );
+
+ synch_button = new KPushButton( this );
+ QIconSet set = SmallIconSet( "dirsynch" );
+ QPixmap pix = set.pixmap( QIconSet::Small, QIconSet::Normal );
+ synch_button->setFixedSize( pix.width()+8, pix.height()+8 );
+ synch_button->setIconSet( set );
+ synch_button->setAccel( QKeySequence( "Alt+y") );
+ QToolTip::add( synch_button, i18n("Set directory to that of the current file (Alt+Y)") );
+ dir_layout->addWidget( synch_button );
+
+ QBoxLayout *dir_opts_layout = new QHBoxLayout(15);
+ layout->addLayout(dir_opts_layout, 4, 1);
+
+ recursive_box = new QCheckBox(i18n("Rec&ursive"), this);
+ recursive_box->setChecked(config->readBoolEntry("recursive", true));
+ dir_opts_layout->addWidget(recursive_box);
+
+ use_project_box = new QCheckBox(i18n("Limit search to &project files"), this);
+ use_project_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ use_project_box->setChecked(config->readBoolEntry("search_project_files", true));
+ dir_opts_layout->addWidget(use_project_box);
+
+ QLabel *files_label = new QLabel(i18n("&Files:"), this);
+ layout->addWidget(files_label, 5, 0, AlignRight | AlignVCenter);
+
+ files_combo = new KComboBox(true, this);
+ files_label->setBuddy(files_combo->focusProxy());
+ files_combo->insertStrList(filepatterns);
+ layout->addWidget(files_combo, 5, 1);
+
+ QLabel *exclude_label = new QLabel(i18n("&Exclude:"), this);
+ layout->addWidget(exclude_label, 6, 0, AlignRight | AlignVCenter);
+
+ QStringList exclude_list = config->readListEntry("exclude_patterns");
+ exclude_combo = new KComboBox(true, this);
+ exclude_label->setBuddy(files_combo->focusProxy());
+ if (exclude_list.count()) {
+ exclude_combo->insertStringList(exclude_list);
+ }
+ else
+ {
+ exclude_combo->insertItem("/CVS/,/SCCS/,/\\.svn/,/_darcs/");
+ exclude_combo->insertItem("");
+ }
+ layout->addWidget(exclude_combo, 6, 1);
+
+ QBoxLayout *other_opts_layout = new QHBoxLayout(15);
+ layout->addLayout(other_opts_layout, 7, 1);
+
+ keep_output_box = new QCheckBox(i18n("New view"), this);
+ keep_output_box->setChecked(config->readBoolEntry("new_view", true));
+ other_opts_layout->addWidget(keep_output_box);
+
+ no_find_err_box = new QCheckBox(i18n("&Suppress find errors"), this);
+ no_find_err_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ no_find_err_box->setChecked(config->readBoolEntry("no_find_errs", true));
+ other_opts_layout->addWidget(no_find_err_box);
+
+ QBoxLayout *button_layout = new QHBoxLayout(4);
+ layout->addLayout(button_layout, 8, 1);
+ search_button = new KPushButton(KGuiItem(i18n("Sea&rch"),"grep"), this);
+ search_button->setDefault(true);
+ KPushButton *done_button = new KPushButton(KStdGuiItem::cancel(), this);
+ button_layout->addStretch();
+ button_layout->addWidget(search_button);
+ button_layout->addWidget(done_button);
+
+ resize(sizeHint());
+
+ QWhatsThis::add(pattern_combo,
+ i18n("<qt>Enter the regular expression you want to search for here.<p>"
+ "Possible meta characters are:"
+ "<ul>"
+ "<li><b>.</b> - Matches any character"
+ "<li><b>^</b> - Matches the beginning of a line"
+ "<li><b>$</b> - Matches the end of a line"
+ "<li><b>\\&lt;</b> - Matches the beginning of a word"
+ "<li><b>\\&gt;</b> - Matches the end of a word"
+ "</ul>"
+ "The following repetition operators exist:"
+ "<ul>"
+ "<li><b>?</b> - The preceding item is matched at most once"
+ "<li><b>*</b> - The preceding item is matched zero or more times"
+ "<li><b>+</b> - The preceding item is matched one or more times"
+ "<li><b>{<i>n</i>}</b> - The preceding item is matched exactly <i>n</i> times"
+ "<li><b>{<i>n</i>,}</b> - The preceding item is matched <i>n</i> or more times"
+ "<li><b>{,<i>n</i>}</b> - The preceding item is matched at most <i>n</i> times"
+ "<li><b>{<i>n</i>,<i>m</i>}</b> - The preceding item is matched at least <i>n</i>, "
+ "but at most <i>m</i> times."
+ "</ul>"
+ "Furthermore, backreferences to bracketed subexpressions are "
+ "available via the notation \\<i>n</i>.</qt>"
+ ));
+ QWhatsThis::add(files_combo,
+ i18n("Enter the file name pattern of the files to search here. "
+ "You may give several patterns separated by commas"));
+ QWhatsThis::add(template_edit,
+ i18n("You can choose a template for the pattern from the combo box "
+ "and edit it here. The string %s in the template is replaced "
+ "by the pattern input field, resulting in the regular expression "
+ "to search for."));
+
+ connect( template_combo, SIGNAL(activated(int)),
+ SLOT(templateActivated(int)) );
+ connect( search_button, SIGNAL(clicked()),
+ SLOT(slotSearchClicked()) );
+ connect( done_button, SIGNAL(clicked()),
+ SLOT(hide()) );
+ connect( pattern_combo->lineEdit(), SIGNAL( textChanged ( const QString & ) ),
+ SLOT( slotPatternChanged( const QString & ) ) );
+ connect( synch_button, SIGNAL(clicked()), this, SLOT(slotSynchDirectory()) );
+ slotPatternChanged( pattern_combo->currentText() );
+}
+
+// Returns the contents of a QComboBox as a QStringList
+static QStringList qCombo2StringList( QComboBox* combo )
+{
+ QStringList list;
+ if (!combo)
+ return list;
+ for (int i = 0; i < combo->count(); ++i ) {
+ list << combo->text(i);
+ }
+ return list;
+}
+
+GrepDialog::~GrepDialog()
+{
+ config->setGroup("GrepDialog");
+ // memorize the last patterns and paths
+ config->writeEntry("LastSearchItems", qCombo2StringList(pattern_combo));
+ config->writePathEntry("LastSearchPaths", qCombo2StringList(dir_combo));
+ config->writeEntry("regexp", regexp_box->isChecked());
+ config->writeEntry("recursive", recursive_box->isChecked());
+ config->writeEntry("search_project_files", use_project_box->isChecked());
+ config->writeEntry("case_sens", case_sens_box->isChecked());
+ config->writeEntry("new_view", keep_output_box->isChecked());
+ config->writeEntry("no_find_errs", no_find_err_box->isChecked());
+ config->writeEntry("exclude_patterns", qCombo2StringList(exclude_combo));
+}
+
+void GrepDialog::slotPatternChanged( const QString & _text )
+{
+ search_button->setEnabled( !_text.isEmpty() );
+}
+
+void GrepDialog::templateActivated(int index)
+{
+ template_edit->setText(template_str[index]);
+}
+
+// Find out whether the string s is already contained in combo
+static bool qComboContains( const QString& s, QComboBox* combo )
+{
+ if (!combo)
+ return false;
+ for (int i = 0; i < combo->count(); ++i ) {
+ if (combo->text(i) == s) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void GrepDialog::slotSearchClicked()
+{
+ if (pattern_combo->currentText().isEmpty()) {
+ KMessageBox::sorry(this, i18n("Please enter a search pattern"));
+ pattern_combo->setFocus();
+ return;
+ }
+ // add the last patterns and paths to the combo
+ if (!qComboContains(pattern_combo->currentText(), pattern_combo)) {
+ pattern_combo->addToHistory(pattern_combo->currentText());
+ }
+ if (pattern_combo->count() > 15) {
+ pattern_combo->removeFromHistory(pattern_combo->text(15));
+ }
+ if (!qComboContains(exclude_combo->currentText(), exclude_combo)) {
+ exclude_combo->insertItem(exclude_combo->currentText(), 0);
+ }
+ if (exclude_combo->count() > 15) {
+ exclude_combo->removeItem(15);
+ }
+ if (!qComboContains(dir_combo->currentText(), dir_combo)) {
+ dir_combo->insertItem(dir_combo->currentText(), 0);
+ }
+ if (dir_combo->count() > 15) {
+ dir_combo->removeItem(15);
+ }
+
+ emit searchClicked();
+ hide();
+}
+
+void GrepDialog::show()
+{
+ // not beautiful, but works with all window
+ // managers and Qt versions
+ if (isVisible())
+ hide();
+// QDialog::hide();
+ QDialog::show();
+ pattern_combo->setFocus();
+}
+
+void GrepDialog::hide()
+{
+ pattern_combo->setFocus();
+ QDialog::hide();
+}
+
+void GrepDialog::slotSynchDirectory( )
+{
+ KParts::ReadOnlyPart * part = dynamic_cast<KParts::ReadOnlyPart*>( m_part->partController()->activePart() );
+ if ( part )
+ {
+ KURL url = part->url();
+ if ( url.isLocalFile() )
+ {
+ dir_combo->setEditText( url.upURL().path( +1 ) );
+ }
+ }
+}
+
+void GrepDialog::setEnableProjectBox(bool enable)
+{
+ use_project_box->setEnabled(enable);
+ if (!enable) use_project_box->setChecked(false);
+}
+
+#include "grepdlg.moc"
diff --git a/parts/grepview/grepdlg.h b/parts/grepview/grepdlg.h
new file mode 100644
index 00000000..c24332bd
--- /dev/null
+++ b/parts/grepview/grepdlg.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _GREPDLG_H_
+#define _GREPDLG_H_
+
+#include <qdialog.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <kcombobox.h>
+#include <klineedit.h>
+
+
+class KConfig;
+class KURLRequester;
+class QPushButton;
+class GrepViewPart;
+class KLineEdit;
+
+class GrepDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ GrepDialog( GrepViewPart * part, QWidget *parent=0, const char *name=0 );
+ ~GrepDialog();
+
+ void setPattern(const QString &pattern)
+ { pattern_combo->setEditText(pattern); }
+ void setDirectory(const QString &dir)
+ { dir_combo->setEditText(dir); }
+ void setEnableProjectBox(bool enable);
+
+ QString patternString() const
+ { return pattern_combo->currentText(); }
+ QString templateString() const
+ { return template_edit->text(); }
+ QString filesString() const
+ { return files_combo->currentText(); }
+ QString excludeString() const
+ { return exclude_combo->currentText(); }
+ QString directoryString() const
+ { return dir_combo->currentText(); }
+
+ bool useProjectFilesFlag() const
+ { return use_project_box->isChecked(); }
+ bool regexpFlag() const
+ { return regexp_box->isChecked(); }
+ bool recursiveFlag() const
+ { return recursive_box->isChecked(); }
+ bool noFindErrorsFlag() const
+ { return no_find_err_box->isChecked(); }
+ bool caseSensitiveFlag() const
+ { return case_sens_box->isChecked(); }
+ bool keepOutputFlag() const
+ { return keep_output_box->isChecked(); }
+
+ void show();
+ void hide();
+
+signals:
+ void searchClicked();
+
+private slots:
+ void templateActivated(int index);
+ void slotSearchClicked();
+ void slotPatternChanged( const QString &);
+ void slotSynchDirectory();
+
+private:
+ KLineEdit *template_edit;
+ KHistoryCombo *pattern_combo;
+ KComboBox *files_combo;
+ KComboBox *exclude_combo;
+ KComboBox * dir_combo;
+ KURLRequester * url_requester;
+
+ QCheckBox *regexp_box;
+ QCheckBox *recursive_box;
+ QCheckBox *use_project_box;
+ QCheckBox *no_find_err_box;
+ QCheckBox *case_sens_box;
+ QCheckBox *keep_output_box;
+ KConfig* config;
+ QPushButton *search_button;
+ QPushButton *synch_button;
+ GrepViewPart * m_part;
+};
+
+
+#endif
+
+
+
+
+
diff --git a/parts/grepview/grepviewpart.cpp b/parts/grepview/grepviewpart.cpp
new file mode 100644
index 00000000..7b1f75d9
--- /dev/null
+++ b/parts/grepview/grepviewpart.cpp
@@ -0,0 +1,150 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "grepviewpart.h"
+
+#include <qpopupmenu.h>
+#include <qvbox.h>
+#include <qwhatsthis.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <kprocess.h>
+#include <kstringhandler.h>
+#include <ktexteditor/document.h>
+
+#include "kdevcore.h"
+#include "kdevpartcontroller.h"
+#include "kdevmainwindow.h"
+#include "kdevplugininfo.h"
+#include "kdeveditorutil.h"
+#include "grepviewwidget.h"
+
+static const KDevPluginInfo data("kdevgrepview");
+
+K_EXPORT_COMPONENT_FACTORY(libkdevgrepview, GrepViewFactory(data))
+
+GrepViewPart::GrepViewPart( QObject *parent, const char *name, const QStringList & )
+ : KDevPlugin( &data, parent, name ? name : "GrepViewPart" )
+{
+ setInstance(GrepViewFactory::instance());
+
+ setXMLFile("kdevgrepview.rc");
+
+ connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)),
+ this, SLOT(stopButtonClicked(KDevPlugin*)) );
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) );
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) );
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+
+ m_widget = new GrepViewWidget(this);
+ m_widget->setIcon(SmallIcon("grep"));
+ m_widget->setCaption(i18n("Grep Output"));
+ QWhatsThis::add(m_widget, i18n("<b>Find in files</b><p>"
+ "This window contains the output of a grep "
+ "command. Clicking on an item in the list "
+ "will automatically open the corresponding "
+ "source file and set the cursor to the line "
+ "with the match."));
+
+ mainWindow()->embedOutputView(m_widget, i18n("Find in Files"), i18n("Output of the grep command"));
+
+ KAction *action;
+
+ action = new KAction(i18n("Find in Fi&les..."), "grep", CTRL+ALT+Key_F,
+ this, SLOT(slotGrep()),
+ actionCollection(), "edit_grep");
+ action->setToolTip( i18n("Search for expressions over several files") );
+ action->setWhatsThis( i18n("<b>Find in files</b><p>"
+ "Opens the 'Find in files' dialog. There you "
+ "can enter a regular expression which is then "
+ "searched for within all files in the directories "
+ "you specify. Matches will be displayed, you "
+ "can switch to a match directly.") );
+}
+
+
+GrepViewPart::~GrepViewPart()
+{
+ if ( m_widget )
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+}
+
+
+void GrepViewPart::stopButtonClicked(KDevPlugin* which)
+{
+ if ( which != 0 && which != this )
+ return;
+ kdDebug(9001) << "GrepViewPart::stopButtonClicked()" << endl;
+ m_widget->killJob( SIGHUP );
+}
+
+
+void GrepViewPart::projectOpened()
+{
+ kdDebug(9001) << "GrepViewPart::projectOpened()" << endl;
+ m_widget->projectChanged(project());
+}
+
+
+void GrepViewPart::projectClosed()
+{
+ m_widget->projectChanged(0);
+}
+
+
+void GrepViewPart::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ kdDebug(9001) << "context in grepview" << endl;
+ if (!context->hasType( Context::EditorContext ))
+ return;
+
+ const EditorContext *econtext = static_cast<const EditorContext*>(context);
+ QString ident = econtext->currentWord();
+ if (!ident.isEmpty()) {
+ m_popupstr = ident;
+ QString squeezed = KStringHandler::csqueeze(ident, 30);
+ int id = popup->insertItem( i18n("Grep: %1").arg(squeezed),
+ this, SLOT(slotContextGrep()) );
+ popup->setWhatsThis(id, i18n("<b>Grep</b><p>Opens the find in files dialog "
+ "and sets the pattern to the text under the cursor."));
+ popup->insertSeparator();
+ }
+}
+
+
+void GrepViewPart::slotGrep()
+{
+ if ( !m_widget->isRunning() )
+ {
+ QString contextString = KDevEditorUtil::currentSelection( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+ if ( contextString.isEmpty() )
+ {
+ contextString = KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) );
+ }
+ m_widget->showDialogWithPattern( contextString );
+ }
+}
+
+
+void GrepViewPart::slotContextGrep()
+{
+ if ( !m_widget->isRunning() )
+ {
+ m_widget->showDialogWithPattern(m_popupstr);
+ }
+}
+
+#include "grepviewpart.moc"
diff --git a/parts/grepview/grepviewpart.h b/parts/grepview/grepviewpart.h
new file mode 100644
index 00000000..c6031a3b
--- /dev/null
+++ b/parts/grepview/grepviewpart.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _GREPVIEWPART_H_
+#define _GREPVIEWPART_H_
+
+#include <qguardedptr.h>
+#include <kdevgenericfactory.h>
+#include "kdevplugin.h"
+
+class KDialogBase;
+class QPopupMenu;
+class Context;
+class GrepViewWidget;
+
+
+class GrepViewPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ GrepViewPart( QObject *parent, const char *name, const QStringList & );
+ ~GrepViewPart();
+
+private slots:
+ void stopButtonClicked(KDevPlugin *which);
+ void projectOpened();
+ void projectClosed();
+ void contextMenu(QPopupMenu *popup, const Context *context);
+
+ void slotGrep();
+ void slotContextGrep();
+
+private:
+ QGuardedPtr<GrepViewWidget> m_widget;
+ QString m_popupstr;
+ friend class GrepViewWidget;
+};
+
+typedef KDevGenericFactory<GrepViewPart> GrepViewFactory;
+
+#endif
diff --git a/parts/grepview/grepviewwidget.cpp b/parts/grepview/grepviewwidget.cpp
new file mode 100644
index 00000000..326e2897
--- /dev/null
+++ b/parts/grepview/grepviewwidget.cpp
@@ -0,0 +1,535 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qdir.h>
+#include <qlayout.h>
+#include <qregexp.h>
+#include <qpainter.h>
+#include <qtoolbutton.h>
+#include <kdialogbase.h>
+#include <klocale.h>
+#include <kprocess.h>
+#include <kparts/part.h>
+#include <ktexteditor/selectioninterface.h>
+#include <kaction.h>
+#include <kpopupmenu.h>
+#include <ktabwidget.h>
+#include <kpushbutton.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+using namespace KTextEditor;
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+#include "kdevpartcontroller.h"
+
+#include "grepdlg.h"
+#include "grepviewpart.h"
+#include "grepviewwidget.h"
+
+
+class GrepListBoxItem : public ProcessListBoxItem
+{
+public:
+ GrepListBoxItem(const QString &fileName, const QString &lineNumber, const QString &text, bool showFilename);
+ QString filename()
+ { return fileName; }
+ int linenumber()
+ { return lineNumber.toInt(); }
+ virtual bool isCustomItem();
+
+private:
+ virtual void paint(QPainter *p);
+ QString fileName, lineNumber, text;
+ bool show;
+};
+
+
+GrepListBoxItem::GrepListBoxItem(const QString &fileName, const QString &lineNumber, const QString &text, bool showFilename)
+ : ProcessListBoxItem( QString::null, Normal),
+ fileName(fileName), lineNumber(lineNumber), text(text.stripWhiteSpace()),
+ show(showFilename)
+{
+ this->text.replace( QChar('\t'), QString(" ") );
+}
+
+
+bool GrepListBoxItem::isCustomItem()
+{
+ return true;
+}
+
+
+void GrepListBoxItem::paint(QPainter *p)
+{
+ QColor base, dim, result, bkground;
+ if (listBox()) {
+ const QColorGroup& group = listBox()->palette().active();
+ if (isSelected()) {
+ bkground = group.button();
+ base = group.buttonText();
+ }
+ else
+ {
+ bkground = group.base();
+ base = group.text();
+ }
+ dim = blend(base, bkground);
+ result = group.link();
+ }
+ else
+ {
+ base = Qt::black;
+ dim = Qt::darkGreen;
+ result = Qt::blue;
+ if (isSelected())
+ bkground = Qt::lightGray;
+ else
+ bkground = Qt::white;
+ }
+ QFontMetrics fm = p->fontMetrics();
+ QString stx = lineNumber + ": ";
+ int y = fm.ascent()+fm.leading()/2;
+ int x = 3;
+ p->fillRect(p->window(), QBrush(bkground));
+ if (show)
+ {
+ p->setPen(dim);
+ p->drawText(x, y, fileName);
+ x += fm.width(fileName);
+ }
+ else
+ {
+ p->setPen(base);
+ QFont font1(p->font());
+ QFont font2(font1);
+ font2.setBold(true);
+ p->setFont(font2);
+ p->drawText(x, y, stx);
+ p->setFont(font1);
+ x += fm.width(stx);
+
+ p->setPen(result);
+ p->drawText(x, y, text);
+ }
+}
+
+
+GrepViewWidget::GrepViewWidget(GrepViewPart *part) : QWidget(0, "grepview widget")
+{
+ m_layout = new QHBoxLayout(this, 0, -1, "greplayout");
+
+ m_tabWidget = new KTabWidget(this);
+
+ m_layout->add(m_tabWidget);
+
+ m_curOutput = new GrepViewProcessWidget(m_tabWidget);
+
+ m_tabWidget->addTab(m_curOutput, i18n("Search Results"));
+
+ grepdlg = new GrepDialog( part, this, "grep widget");
+ connect( grepdlg, SIGNAL(searchClicked()), this, SLOT(searchActivated()) );
+ connect( m_curOutput, SIGNAL(processExited(KProcess* )), this, SLOT(slotSearchProcessExited()) );
+
+ connect( m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(slotOutputTabChanged()) );
+
+ connect( m_curOutput, SIGNAL(clicked(QListBoxItem*)),
+ this, SLOT(slotExecuted(QListBoxItem*)) );
+ connect( m_curOutput, SIGNAL(returnPressed(QListBoxItem*)),
+ this, SLOT(slotExecuted(QListBoxItem*)) );
+
+
+ connect( m_curOutput, SIGNAL(contextMenuRequested( QListBoxItem*, const QPoint&)), this, SLOT(popupMenu(QListBoxItem*, const QPoint&)));
+ m_part = part;
+
+ m_closeButton = new QToolButton(m_tabWidget);//@todo change text/icon
+ m_closeButton->setIconSet(SmallIconSet("tab_remove"));
+ m_closeButton->setEnabled(false);
+
+ connect (m_closeButton, SIGNAL(clicked()), this, SLOT(slotCloseCurrentOutput()));
+ m_tabWidget->setCornerWidget(m_closeButton);
+}
+
+
+GrepViewWidget::~GrepViewWidget()
+{}
+
+
+void GrepViewWidget::showDialog()
+{
+ // Get the selected text if there is any
+ KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(m_part->partController()->activePart());
+ if (ro_part)
+ {
+ SelectionInterface *selectIface = dynamic_cast<SelectionInterface*>(ro_part);
+ if(selectIface && selectIface->hasSelection())
+ {
+ QString selText = selectIface->selection();
+ if(!selText.contains('\n'))
+ {
+ grepdlg->setPattern(selText);
+ }
+ }
+ }
+ // Determine if we have a list of project files
+ KDevProject *openProject = m_part->project();
+ if (openProject)
+ {
+ grepdlg->setEnableProjectBox(!openProject->allFiles().isEmpty());
+ }
+ else
+ {
+ grepdlg->setEnableProjectBox(false);
+ }
+ grepdlg->show();
+}
+
+// @todo - put this somewhere common - or just use Qt if possible
+static QString escape(const QString &str)
+{
+ QString escaped("[]{}()\\^$?.+-*|");
+ QString res;
+
+ for (uint i=0; i < str.length(); ++i)
+ {
+ if (escaped.find(str[i]) != -1)
+ res += "\\";
+ res += str[i];
+ }
+
+ return res;
+}
+
+
+void GrepViewWidget::showDialogWithPattern(QString pattern)
+{
+ // Before anything, this removes line feeds from the
+ // beginning and the end.
+ int len = pattern.length();
+ if (len > 0 && pattern[0] == '\n')
+ {
+ pattern.remove(0, 1);
+ len--;
+ }
+ if (len > 0 && pattern[len-1] == '\n')
+ pattern.truncate(len-1);
+ grepdlg->setPattern( pattern );
+
+ // Determine if we have a list of project files
+ KDevProject *openProject = m_part->project();
+ if (openProject)
+ {
+ grepdlg->setEnableProjectBox(!openProject->allFiles().isEmpty());
+ }
+ else
+ {
+ grepdlg->setEnableProjectBox(false);
+ }
+ grepdlg->show();
+}
+
+
+void GrepViewWidget::searchActivated()
+{
+ if ( grepdlg->keepOutputFlag() )
+ slotKeepOutput();
+
+ m_tabWidget->showPage( m_curOutput );
+
+ m_curOutput->setLastFileName("");
+ m_curOutput->setMatchCount( 0 );
+
+ QString command, files;
+
+ // waba: code below breaks on filenames containing a ',' !!!
+ QStringList filelist = QStringList::split(",", grepdlg->filesString());
+
+ if (grepdlg->useProjectFilesFlag())
+ {
+ KDevProject *openProject = m_part->project();
+ if (openProject)
+ {
+ QString tmpFilePath;
+ QStringList projectFiles = openProject->allFiles();
+ if (!projectFiles.isEmpty())
+ {
+ tmpFilePath = openProject->projectDirectory() + QChar(QDir::separator()) + ".grep.tmp";
+ QString dir = grepdlg->directoryString(), file;
+ QValueList<QRegExp> regExpList;
+
+ if (dir.endsWith(QChar(QDir::separator())))
+ dir.truncate(dir.length() - 1);
+
+ if (!filelist.isEmpty())
+ {
+ for (QStringList::Iterator it = filelist.begin(); it != filelist.end(); ++it)
+ regExpList.append(QRegExp(*it, true, true));
+ }
+
+ m_tempFile.setName(tmpFilePath);
+ if (m_tempFile.open(IO_WriteOnly))
+ {
+ QTextStream out(&m_tempFile);
+ for (QStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it)
+ {
+ file = QDir::cleanDirPath(openProject->projectDirectory() + QChar(QDir::separator()) + *it);
+
+ QFileInfo info(file);
+ if (grepdlg->recursiveFlag() && !info.dirPath(true).startsWith(dir)) continue;
+ if (!grepdlg->recursiveFlag() && info.dirPath(true) != dir) continue;
+
+ bool matchOne = regExpList.count() == 0;
+ for (QValueList<QRegExp>::Iterator it2 = regExpList.begin(); it2 != regExpList.end() && !matchOne; ++it2)
+ matchOne = (*it2).exactMatch(file);
+
+ if (matchOne)
+ out << KShellProcess::quote(file) + "\n";
+ }
+
+ m_tempFile.close();
+ }
+ else
+ {
+ KMessageBox::error(this, i18n("Unable to create a temporary file for search."));
+ return;
+ }
+ }
+
+ command = "cat ";
+ command += tmpFilePath.replace(' ', "\\ ");
+ }
+ }
+ else
+ {
+ if (!filelist.isEmpty())
+ {
+ QStringList::Iterator it(filelist.begin());
+ files = KShellProcess::quote(*it);
+ ++it;
+ for (; it != filelist.end(); ++it)
+ files += " -o -name " + KShellProcess::quote(*it);
+ }
+
+ QString filepattern = "find ";
+ filepattern += KShellProcess::quote(grepdlg->directoryString());
+ if (!grepdlg->recursiveFlag())
+ filepattern += " -maxdepth 1";
+ filepattern += " \\( -name ";
+ filepattern += files;
+ filepattern += " \\) -print -follow";
+ if (grepdlg->noFindErrorsFlag())
+ filepattern += " 2>/dev/null";
+
+ command = filepattern + " " ;
+ }
+
+ QStringList excludelist = QStringList::split(",", grepdlg->excludeString());
+ if (!excludelist.isEmpty())
+ {
+ QStringList::Iterator it(excludelist.begin());
+ command += "| grep -v ";
+ for (; it != excludelist.end(); ++it)
+ command += "-e " + KShellProcess::quote(*it) + " ";
+ }
+
+ if (!grepdlg->useProjectFilesFlag())
+ {
+ // quote spaces in filenames going to xargs
+ command += "| sed \"s/ /\\\\\\ /g\" ";
+ }
+
+ command += "| xargs " ;
+
+#ifndef USE_SOLARIS
+ command += "egrep -H -n -s ";
+#else
+ // -H reported as not being available on Solaris,
+ // but we're buggy without it on Linux.
+ command += "egrep -n ";
+#endif
+
+ if (!grepdlg->caseSensitiveFlag())
+ {
+ command += "-i ";
+ }
+ command += "-e ";
+
+ m_lastPattern = grepdlg->patternString();
+ QString pattern = grepdlg->templateString();
+ if (grepdlg->regexpFlag())
+ pattern.replace(QRegExp("%s"), grepdlg->patternString());
+ else
+ pattern.replace(QRegExp("%s"), escape( grepdlg->patternString() ) );
+ command += KShellProcess::quote(pattern);
+ m_curOutput->startJob("", command);
+
+ m_part->mainWindow()->raiseView(this);
+ m_part->core()->running(m_part, true);
+}
+
+
+void GrepViewWidget::slotExecuted(QListBoxItem* item)
+{
+ ProcessListBoxItem *i = static_cast<ProcessListBoxItem*>(item);
+ if (!i || !i->isCustomItem())
+ return;
+
+ GrepListBoxItem *gi = static_cast<GrepListBoxItem*>(i);
+ m_part->partController()->editDocument( KURL( gi->filename() ), gi->linenumber()-1 );
+}
+
+
+void GrepViewProcessWidget::insertStdoutLine(const QCString &line)
+{
+ int pos;
+ QString filename, linenumber, rest;
+
+ QString str;
+ if( !grepbuf.isEmpty() )
+ {
+ str = QString::fromLocal8Bit( grepbuf+line );
+ grepbuf.truncate( 0 );
+ }else
+ {
+ str = QString::fromLocal8Bit( line );
+ }
+ if ( (pos = str.find(':')) != -1)
+ {
+ filename = str.left(pos);
+ str.remove( 0, pos+1 );
+ if ( ( pos = str.find(':') ) != -1)
+ {
+ linenumber = str.left(pos);
+ str.remove( 0, pos+1 );
+ // filename will be displayed only once
+ // selecting filename will display line 1 of file,
+ // otherwise, line of requested search
+ if ( _lastfilename != filename )
+ {
+ _lastfilename = filename;
+ insertItem(new GrepListBoxItem(filename, "0", str, true));
+ insertItem(new GrepListBoxItem(filename, linenumber, str, false));
+ }
+ else
+ {
+ insertItem(new GrepListBoxItem(filename, linenumber, str, false));
+ }
+ maybeScrollToBottom();
+ }
+ m_matchCount++;
+ }
+}
+
+
+void GrepViewWidget::projectChanged(KDevProject *project)
+{
+ QString dir = project? project->projectDirectory() : QDir::homeDirPath();
+ grepdlg->setDirectory(dir);
+}
+
+void GrepViewWidget::popupMenu(QListBoxItem*, const QPoint& p)
+{
+ if(m_curOutput->isRunning()) return;
+
+ KPopupMenu rmbMenu;
+
+ if(KAction *findAction = m_part->actionCollection()->action("edit_grep"))
+ {
+ rmbMenu.insertTitle(i18n("Find in Files"));
+ findAction->plug(&rmbMenu);
+ rmbMenu.exec(p);
+ }
+}
+
+void GrepViewWidget::slotKeepOutput( )
+{
+ if ( m_lastPattern == QString::null ) return;
+
+ m_tabWidget->changeTab(m_curOutput, m_lastPattern);
+
+ m_curOutput = new GrepViewProcessWidget(m_tabWidget);
+ m_tabWidget->insertTab(m_curOutput, i18n("Search Results"), 0);
+
+ connect( m_curOutput, SIGNAL(clicked(QListBoxItem*)), this, SLOT(slotExecuted(QListBoxItem*)) );
+ connect( m_curOutput, SIGNAL(returnPressed(QListBoxItem*)), this, SLOT(slotExecuted(QListBoxItem*)) );
+ connect( m_curOutput, SIGNAL(processExited(KProcess* )), this, SLOT(slotSearchProcessExited()) );
+ connect( m_curOutput, SIGNAL(contextMenuRequested( QListBoxItem*, const QPoint&)), this, SLOT(popupMenu(QListBoxItem*, const QPoint&)));
+}
+
+void GrepViewWidget::slotCloseCurrentOutput( )
+{
+ ProcessWidget* pw = static_cast<ProcessWidget*>(m_tabWidget->currentPage());
+ if (pw == m_curOutput)
+ return;
+
+ m_tabWidget->removePage(pw);
+ delete pw;
+
+ if (m_tabWidget->count() == 1)
+ m_closeButton->setEnabled( false );
+}
+
+void GrepViewWidget::killJob( int signo )
+{
+ m_curOutput->killJob( signo );
+
+ if (!m_tempFile.name().isEmpty() && m_tempFile.exists())
+ m_tempFile.remove();
+}
+
+bool GrepViewWidget::isRunning( ) const
+{
+ return m_curOutput->isRunning();
+}
+
+void GrepViewWidget::slotOutputTabChanged( )
+{
+ ProcessWidget* pw = static_cast<ProcessWidget*>(m_tabWidget->currentPage());
+ if (pw == m_curOutput)
+ m_closeButton->setEnabled( false );
+ else
+ m_closeButton->setEnabled( true );
+}
+
+void GrepViewWidget::slotSearchProcessExited( )
+{
+ m_part->core()->running(m_part, false);
+
+ if (!m_tempFile.name().isEmpty() && m_tempFile.exists())
+ m_tempFile.remove();
+}
+
+void GrepViewProcessWidget::childFinished( bool normal, int status )
+{
+ // When xargs executes grep several times (because the command line
+ // generated would be too large for a single grep) and one of those
+ // sets of files passed to grep does not contain a match, then an
+ // error status of 123 is set by xargs, even if there is a match in
+ // another set of files.
+ // Reset this false status here.
+
+ if (status == 123 && numRows() > 1)
+ status = 0;
+
+ insertItem(new ProcessListBoxItem(i18n("*** %n match found. ***", "*** %n matches found. ***", m_matchCount), ProcessListBoxItem::Diagnostic));
+ maybeScrollToBottom();
+
+ ProcessWidget::childFinished(normal, status);
+}
+
+void GrepViewProcessWidget::addPartialStdoutLine(const QCString & line)
+{
+ grepbuf += line;
+}
+
+
+#include "grepviewwidget.moc"
diff --git a/parts/grepview/grepviewwidget.h b/parts/grepview/grepviewwidget.h
new file mode 100644
index 00000000..bf3fca4b
--- /dev/null
+++ b/parts/grepview/grepviewwidget.h
@@ -0,0 +1,111 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _GREPVIEWWIDGET_H_
+#define _GREPVIEWWIDGET_H_
+
+#include "processwidget.h"
+#include <qwidget.h>
+#include <qfile.h>
+
+class GrepDialog;
+class GrepViewPart;
+class KDevProject;
+class KTabWidget;
+class QHBoxLayout;
+class QToolButton;
+class GrepViewProcessWidget : public ProcessWidget
+{
+ Q_OBJECT
+public:
+ GrepViewProcessWidget(QWidget* parent) : ProcessWidget(parent) {};
+ ~GrepViewProcessWidget(){};
+ void setMatchCount(int newCount)
+ {
+ m_matchCount = newCount;
+ }
+
+ void incrementMatchCount(uint amount = 1)
+ {
+ m_matchCount += amount;
+ }
+
+ void setLastFileName(const QString& lastFileName)
+ {
+ _lastfilename = lastFileName;
+ }
+
+public slots:
+ virtual void insertStdoutLine(const QCString &line);
+ virtual void addPartialStdoutLine( const QCString &line );
+
+protected:
+ virtual void childFinished(bool normal, int status);
+
+private:
+ int m_matchCount;
+ QString _lastfilename;
+ QCString grepbuf;
+};
+
+class GrepViewWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ GrepViewWidget(GrepViewPart *part);
+ ~GrepViewWidget();
+
+ void projectChanged(KDevProject *project);
+ void killJob( int signo = SIGTERM );
+ bool isRunning() const;
+
+public slots:
+ void showDialog();
+ void showDialogWithPattern(QString pattern);
+
+private slots:
+ void searchActivated();
+ /**
+ * If item is a valid result of a search run, it opens the file at the position, where the stuff was found.
+ * @param item item containing filename and linenumber of the file to open.
+ */
+ void slotExecuted(QListBoxItem *item);
+ void popupMenu(QListBoxItem*, const QPoint& p);
+ /**
+ * Creates a new tab containing the current output in the main tab and clears the main tab.
+ */
+ void slotKeepOutput();
+ /**
+ * Closes the currently active tab, if it is not the main output.
+ */
+ void slotCloseCurrentOutput();
+ /**
+ * Slot reacting on changes of the active tab, to activate/deactivate the close button,
+ * as the main output tab must not be closed.
+ */
+ void slotOutputTabChanged();
+
+ void slotSearchProcessExited();
+
+private:
+
+ QHBoxLayout* m_layout;
+ KTabWidget* m_tabWidget;
+ GrepViewProcessWidget* m_curOutput;
+ GrepDialog *grepdlg;
+ GrepViewPart *m_part;
+ QToolButton* m_closeButton;
+ QString m_lastPattern;
+ QFile m_tempFile;
+};
+
+#endif
diff --git a/parts/grepview/kdevgrepview.desktop b/parts/grepview/kdevgrepview.desktop
new file mode 100644
index 00000000..41661c73
--- /dev/null
+++ b/parts/grepview/kdevgrepview.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Integrates "find|grep" in KDevelop - allows fast searching of multiple files using patterns or regular expressions.
+Comment[ca]=Integra "find|grep" en el KDevelop, permetent la recerca ràpida de diversos fitxers emprant patrons o expressions regulars.
+Comment[da]=Integrerer "find|grep" i KDevelop - tillader hurtig søgning i flere filer ved brug af mønstre eller regulære udtryk.
+Comment[de]=Integration von "find|grep" in KDevelop. - Ermöglicht das schnelle Durchsuchen mehrere Dateien mit Hilfe von Suchmustern und regulären Ausdrücken.
+Comment[el]=Ενσωματώνει τα "find|grep" στο KDevelop - επιτρέπει τη γρήγορη αναζήτηση σε πολλά αρχεία χρησιμοποιώντας μοτίβα ή κανονικές εκφράσεις.
+Comment[es]=Integra «find|grep» en KDevelop, permitiendo la búsqueda rápida de varios archivos utilizando patrones o expresiones regulares.
+Comment[et]=Integreerib KDevelopi programmi "Find|grep", mis lubab mustreid või regulaaravaldisi kasutades kiiresti paljudes failides teksti otsida.
+Comment[eu]="find|grep" KDevelop-en txertatzen du - fitxategi anitzetan eredu edo espresio erregularrak erabiliz bilaketa azkarrak egiteko aukera ematen du.
+Comment[fa]=«find|grep» را در KDevelop مجتمع‌سازی می‌کند. اجازۀ جستجوی سریع پرونده‌های چندگانه را با استفاده از الگوها یا عبارتهای منظم می‌دهد.
+Comment[fr]=Intègre « find|grep » dans KDevelop - permet d'effectuer une recherche rapide dans des fichiers multiples en utilisant des motifs ou des expressions rationnelles.
+Comment[gl]=Integra "find|grep" en KDevelop - permite a procura rápida de varios ficheiros usando patróns ou expresións regulares.
+Comment[hu]=A "find|grep" programok integrálása a KDevelopba - lehetővé teszi szövegek fájlokban való gyors keresését minták és reguláris kifejezések felhasználásával
+Comment[it]=Integra "find|grep" in KDevelop - permette la ricerca rapida di file multipli utilizzando motivi o espressioni regolari.
+Comment[ja]="find|grep" を KDevelop 内に統合し、正規表現やパターンを用いて素早く複数のファイルを検索することを可能にします。
+Comment[ms]=Menggabungkan "find|grep" dalam KDevelop - membenarkan carian pantas beberapa fail menggunakan corak atau regular expression.
+Comment[nds]=Buut "find|grep" na KDevelop in. - Stellt gau Dörsöken vun mehr Dateien mit Söökmustern oder reguleer Utdrück praat.
+Comment[ne]=केडीई विकासमा "find|grep" एकीकरण गर्दछ - जसले नियमित अभिव्यक्ति वा बाँन्की प्रयोग गरेर बहुविध फाइलको छिटो खोजी गर्न अनुमति दिन्छ ।
+Comment[nl]=Integreert "find|grep" in KDevelop - snel zoeken door verschillende bestanden naar patronen of reguliere expressies.
+Comment[pl]=Integracja "find|grep" z KDevelop - pozwala na szybie wyszukiwanie wielu plików przy użyciu wzorców i wyrażeń regularnych.
+Comment[pt]=Integra o "find|grep" no KDevelop - permite a procura rápida em vários ficheiros usando padrões ou expressões regulares.
+Comment[pt_BR]=Integra o "find/grep" no KDevelop - permite busca rápida de múltiplos arquivos usando padrões e expressões regulares.
+Comment[ru]=Интегрирует "find|grep" в KDevelop - позволяет производить быстрый поиск по нескольким файлам с использованием шаблонов или регулярных выражений.
+Comment[sk]=Integruje "find|grep" do Kdevelop - umožní rýchle vyhľadávanie rôznych súborov pomocou vzorov alebo regulárnych výrazov.
+Comment[sr]=Интегрише „find|grep“ у KDevelop — омогућава брзо претраживање више фајлова коришћењем облика имена или регуларних израза.
+Comment[sr@Latn]=Integriše „find|grep“ u KDevelop — omogućava brzo pretraživanje više fajlova korišćenjem oblika imena ili regularnih izraza.
+Comment[sv]=Integrerar "find | grep" med KDevelop - tillåter snabb sökning i flera filer med mönster eller reguljära uttryck.
+Comment[ta]=KDevelopபில் "find|grep" ஒருங்கினை-வடிவங்கள் அல்லது வழக்கமான தொடர்களை பயன்படுத்தி பல்வகை கோப்பினை மிக வேகமாய் தேடலாம்.
+Comment[tg]=Интегралёбии "find|grep" дар KDevelop - бо истифодаи қолиб ё инки баёни ботартиб имкон медиҳад бо якчанд файлҳо ковтуковро барпо намоед.
+Comment[tr]=KDevelop'a "find|grep"i yerleştirir - desen veya düzenli ifadeler kullanılara çoklu dosyalarda hızlı arama sağlar.
+Comment[zh_CN]=在 KDevelop 中集成“查找|grep” - 可以使用模式或正则表达式在多个文件中快速查找。
+Comment[zh_TW]=在 KDevelop 中整合 "find|grep" - 允許使用特定樣式或正規表式示來快速搜尋多個檔案內容。
+Name=KDevGrepView
+Name[da]=KDevelop Grep-visning
+Name[de]=Grep-Ansicht (KDevelop)
+Name[hi]=के-डेव-ग्रेप-व्यू
+Name[nds]=KDevelop-Grepkieker
+Name[pl]=KDevWidokGrep
+Name[sk]=KDev pohľad na grep
+Name[sv]=KDevelop grep-visning
+Name[ta]=KDevGrep காட்சி
+Name[tg]=Намоиши KDevGrep
+Name[tr]=KDevGrepView
+Name[zh_TW]=KDevelop Grep 檢視
+GenericName=Grep Frontend
+GenericName[ca]=Entorn per a grep
+GenericName[da]=Grep-grænseflade
+GenericName[de]=Grep-Ansicht
+GenericName[el]=Πρόγραμμα Grep
+GenericName[es]=Entorno para grep
+GenericName[et]=Programmi grep kasutajaliides
+GenericName[eu]=Grep interfazea
+GenericName[fa]=پایانۀ Grep
+GenericName[fr]=Interface pour Grep
+GenericName[ga]=Comhéadan Grep
+GenericName[gl]=Frontal para Grep
+GenericName[hi]=ग्रेप फ्रन्टएण्ड
+GenericName[hu]=Grafikus felület a Grep-hez
+GenericName[it]=Interfaccia a "grep"
+GenericName[ja]=Grep フロントエンド
+GenericName[ms]=Frontend Grep
+GenericName[nds]=Grep-Böversiet
+GenericName[ne]=ग्रिप फ्रन्टइन्ड
+GenericName[nl]=Grep-frontend
+GenericName[pl]=Interfejs do grepa
+GenericName[pt]=Interface do Grep
+GenericName[pt_BR]=Frontend do Grep
+GenericName[ru]=Интеграция Grep
+GenericName[sk]=Grep rozhranie
+GenericName[sl]=Vmesnik za Grep
+GenericName[sr]=Кориснички интерфејс за grep
+GenericName[sr@Latn]=Korisnički interfejs za grep
+GenericName[sv]=Gränssnitt till grep
+GenericName[ta]=Grep முன் பகுதி
+GenericName[tg]=Интегратсияи Grep
+GenericName[tr]=Grep Önucu
+GenericName[zh_CN]=Grep 前端
+GenericName[zh_TW]=Grep 前端介面
+Icon=find
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevgrepview
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=FileSearch
diff --git a/parts/grepview/kdevgrepview.rc b/parts/grepview/kdevgrepview.rc
new file mode 100644
index 00000000..80b20389
--- /dev/null
+++ b/parts/grepview/kdevgrepview.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevGrepView" version="1">
+<MenuBar>
+ <Menu name="edit">
+ <Action name="edit_grep" group="kdev_edit_find_merge"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/konsole/Makefile.am b/parts/konsole/Makefile.am
new file mode 100644
index 00000000..b0faabf9
--- /dev/null
+++ b/parts/konsole/Makefile.am
@@ -0,0 +1,16 @@
+# Here resides the konsole view part.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevkonsoleview.la
+libkdevkonsoleview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevkonsoleview_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \
+ $(top_builddir)/lib/util/libkdevutil.la
+
+libkdevkonsoleview_la_SOURCES = konsoleviewpart.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevkonsoleview.desktop
+
diff --git a/parts/konsole/README.dox b/parts/konsole/README.dox
new file mode 100644
index 00000000..67641ebb
--- /dev/null
+++ b/parts/konsole/README.dox
@@ -0,0 +1,49 @@
+/** \class KonsoleViewPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/konsole/kdevkonsoleview.desktop b/parts/konsole/kdevkonsoleview.desktop
new file mode 100644
index 00000000..789f76a6
--- /dev/null
+++ b/parts/konsole/kdevkonsoleview.desktop
@@ -0,0 +1,86 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=This plugin gives KDevelop an embedded konsole for quick and easy command line access.
+Comment[ca]=Aquest connector ofereix a KDevelop una konsola encastada per a facilitar l'accés a la línia de comandaments.
+Comment[da]=Dette plugin giver KDevelop en indlejret terminal for hurtig og nem kommandolinjeadgang.
+Comment[de]=Dieses Modul stellt eine eingebettete Konsole für den schnellen und einfachen Zugriff auf die Kommandozeile zur Verfügung.
+Comment[el]=Αυτό το πρόσθετο προσφέρει στο KDevelop μια ενσωματωμένη konsole για γρήγορη και εύκολη πρόσβαση σε γραμμή εντολών.
+Comment[es]=Este complemento proporciona a KDevelop una consola empotrada para facilitar el acceso a la línea de órdenes.
+Comment[et]=See plugin lisab KDevelopile võimaluse põimitult kasutada konsooli käsurea võimaluste kiireks ja hõlpsaks pruukimiseks.
+Comment[eu]=Plugin honek KDevelop-i komando-lerroak azkar eta erraz sartzeko kapsultatutako kontsola bat eskeintzen dio.
+Comment[fa]=این وصله برای دستیابی سریع و آسان به خط فرمان، به KDevelop یک konsole نهفته می‌دهد.
+Comment[fr]=Ce module externe offre à KDevelop une Konsole intégrée permettant un accès à la ligne de commande rapide et facile.
+Comment[gl]=Esta extensión engade a KDevelop unha konsole incrustada para un rápido e sinxelo acceso a liña de comandos.
+Comment[hu]=Ez a bővítőmodul egy könnyen elérhető, beágyazott parancssort hoz létre a KDevelopon belül.
+Comment[it]=Questo plugin offre una console integrata per KDevelop per l'accesso rapido e semplice alla linea di comando.
+Comment[ja]=このプラグインは、KDevelop に迅速で容易なコマンドラインアクセス用の埋め込まれた konsole を与えます。
+Comment[ms]=Plugin ini memberikan KDevelop konsol embedded untuk akses arahan baris yang cepat dan mudah.
+Comment[nds]=Dit Moduul stellt för't gaue un eenfache Togriepen op de Befehlsreeg en inbett Konsole för KDevelop praat.
+Comment[ne]=यो प्लगइनले छिटो र सजिलो आदेशरेखा पहुँचका लागि केडीई विकासमा सम्मिलित कन्सोल प्रदान गर्दछ ।
+Comment[nl]=Deze plugin geeft KDevelop een ingebedde Konsole voor snelle toegang tot de commandoregel.
+Comment[pl]=Ta wtyczka dodaje do KDevelopa wbudowaną konsolę umożliwiając szybki i łatwy dostęp do linii komend.
+Comment[pt]=Este 'plugin' dá ao KDevelop um Konsole incorporado para um acesso rápido e simples à linha de comandos.
+Comment[pt_BR]=Este plug-in fornece ao KDevelop um konsole embutido para acesso rápido e fácil à linha de comando.
+Comment[ru]=Предоставляет встроенную консоль для быстрого вызова командной строки.
+Comment[sk]=Modul vložiteľnej konzoly do Kdevelop pre rýchly a jednoduchý prístup k príkazovému riadku.
+Comment[sr]=Овај прикључак даје KDevelop-у уграђену конзолу за брз и лак приступ командној линији.
+Comment[sr@Latn]=Ovaj priključak daje KDevelop-u ugrađenu konzolu za brz i lak pristup komandnoj liniji.
+Comment[sv]=Insticksprogrammet ger KDevelop en inbyggd terminal för snabb och enkel åtkomst av kommandoraden.
+Comment[ta]=இந்த சொருகி உங்களுக்கு Kஉருவாக்கத்திற்கு கன்சோல் உட்பொதியின் மூலம் விரைவு மற்றும் எளிய கட்டளை வரி அனுமதி தரும்.
+Comment[tg]=Барои тез фарёд намудани фармони сатр рафаки бино карда шударо имкон медиҳад.
+Comment[tr]=Bu eklenti, KDevelop'a hızlı komut satırı erişimi için gömülü bir terminal verir.
+Comment[zh_CN]=这个插件为 KDevelop 提供KDE终端来快速和方便使用命令行。
+Comment[zh_TW]=此外掛程式提供 KDevelop 嵌入式的主控台,可以快速使用命令列。
+Name=KDevKonsoleView
+Name[da]=KDevelop Konsole-visning
+Name[de]=Unterstützung für Konsole (KDevelop)
+Name[hi]=के-डेव-कंसोल-व्यू
+Name[nds]=KDevelop-Konsoleünnerstütten
+Name[pl]=KDevWidokKonsoli
+Name[sk]=KDev pohľad na konzolu
+Name[sv]=KDevelop terminalvy
+Name[ta]=KDevKonsole காட்சி
+Name[tg]=Намоиши KDevKonsole
+Name[zh_TW]=KDevelop 主控台檢視
+GenericName=Embedded Konsole
+GenericName[br]=Konsole enframmet
+GenericName[ca]=Konsola encastada
+GenericName[da]=Indlejret konsole
+GenericName[de]=Eingebettete Konsole
+GenericName[el]=Ενσωματωμένη Konsole
+GenericName[es]=Consola empotrada
+GenericName[et]=Põimitud Konsool
+GenericName[eu]=Konsole kapsulatua
+GenericName[fa]=Konsole نهفته
+GenericName[fr]=Konsole intégrée
+GenericName[ga]=Konsole Leabaithe
+GenericName[gl]=Konsole incrustada
+GenericName[hi]=अंतर्निर्मित कंसोल
+GenericName[hu]=Beágyazott Konsole
+GenericName[it]=Konsole integrata
+GenericName[ja]=埋め込まれた Konsole
+GenericName[ms]=Konsol Embedded
+GenericName[nds]=Inbett Konsole
+GenericName[ne]=सम्मिलित कन्सोल
+GenericName[nl]=Ingebedde Konsole
+GenericName[pl]=Wbudowana konsola
+GenericName[pt]=Konsole Embebida
+GenericName[pt_BR]=Konsole Embutido
+GenericName[ru]=Встроенная консоль
+GenericName[sk]=Vložiteľná konzola
+GenericName[sl]=Vključena Konzola
+GenericName[sr]=Уграђена конзола
+GenericName[sr@Latn]=Ugrađena konzola
+GenericName[sv]=Inbäddad terminal
+GenericName[ta]=கன்சோல் உட்பொதி
+GenericName[tg]=Бино намудани Embedded
+GenericName[tr]=Gömülü Terminal
+GenericName[zh_CN]=嵌入的 Konsole
+GenericName[zh_TW]=嵌入式主控台
+Icon=konsole
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevkonsoleview
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=Console
diff --git a/parts/konsole/konsoleviewpart.cpp b/parts/konsole/konsoleviewpart.cpp
new file mode 100644
index 00000000..8d7892a5
--- /dev/null
+++ b/parts/konsole/konsoleviewpart.cpp
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2003 by KDevelop Authors *
+ * kdevelop-devel@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "konsoleviewpart.h"
+
+#include <qwhatsthis.h>
+
+#include <kdevgenericfactory.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevmainwindow.h"
+#include "kdevplugininfo.h"
+#include "kdevshellwidget.h"
+
+
+typedef KDevGenericFactory<KonsoleViewPart> KonsoleViewFactory;
+static const KDevPluginInfo data("kdevkonsoleview");
+K_EXPORT_COMPONENT_FACTORY(libkdevkonsoleview, KonsoleViewFactory(data))
+
+KonsoleViewPart::KonsoleViewPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "KonsoleViewPart")
+{
+ setInstance( KonsoleViewFactory::instance() );
+
+ m_widget = new KDevShellWidget( 0, "konsole widget" );
+
+ QWhatsThis::add(m_widget, i18n("<b>Konsole</b><p>"
+ "This window contains an embedded konsole window. It will try to follow you when "
+ "you navigate in the source directories")
+ );
+
+ m_widget->setIcon( SmallIcon("konsole") );
+ m_widget->setCaption(i18n("Konsole"));
+
+ m_widget->activate();
+ m_widget->setAutoReactivateOnClose( true );
+
+ mainWindow()->embedOutputView(m_widget, i18n("Konsole"), i18n("Embedded console window"));
+
+ connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()));
+}
+
+
+KonsoleViewPart::~KonsoleViewPart()
+{
+ if ( m_widget )
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+}
+
+void KonsoleViewPart::projectOpened()
+{
+ QString cd_projectdir = QString("cd ") + project()->projectDirectory() + "\n";
+ m_widget->sendInput( cd_projectdir );
+}
+
+
+#include "konsoleviewpart.moc"
diff --git a/parts/konsole/konsoleviewpart.h b/parts/konsole/konsoleviewpart.h
new file mode 100644
index 00000000..b7cea9d8
--- /dev/null
+++ b/parts/konsole/konsoleviewpart.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2003 by KDevelop Authors *
+ * kdevelop-devel@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __KONSOLEVIEWPART_H__
+#define __KONSOLEVIEWPART_H__
+
+
+#include <qguardedptr.h>
+#include "kdevplugin.h"
+
+
+class KDevShellWidget;
+
+class KonsoleViewPart : public KDevPlugin
+{
+ Q_OBJECT
+public:
+ KonsoleViewPart(QObject *parent, const char *name, const QStringList &);
+ virtual ~KonsoleViewPart();
+
+private slots:
+ void projectOpened();
+
+private:
+ QGuardedPtr<KDevShellWidget> m_widget;
+};
+
+#endif
diff --git a/parts/konsole/konsoleviewwidget.cpp b/parts/konsole/konsoleviewwidget.cpp
new file mode 100644
index 00000000..e7a84d94
--- /dev/null
+++ b/parts/konsole/konsoleviewwidget.cpp
@@ -0,0 +1,124 @@
+/***************************************************************************
+ * Copyright (C) 2003 by KDevelop Authors *
+ * kdevelop-devel@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlayout.h>
+#include <qframe.h>
+#include <qdir.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kapplication.h>
+#include <kconfig.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "konsoleviewpart.h"
+#include "kdevpartcontroller.h"
+
+#include "konsoleviewwidget.h"
+
+KonsoleViewWidget::KonsoleViewWidget(KonsoleViewPart *part)
+ : QWidget(0, "konsole widget"), part(0), owner( part )
+{
+ connect(part->partController(), SIGNAL(activePartChanged(KParts::Part*)), this, SLOT(activePartChanged(KParts::Part*)));
+ vbox = new QVBoxLayout(this);
+}
+
+KonsoleViewWidget::~KonsoleViewWidget()
+{
+}
+
+void KonsoleViewWidget::show()
+{
+ activate();
+ QWidget::show();
+}
+
+void KonsoleViewWidget::activate()
+{
+ kdDebug(9035) << k_funcinfo << endl;
+ if (part)
+ return;
+
+ KLibFactory *factory = KLibLoader::self()->factory("libkonsolepart");
+ if (!factory)
+ return;
+
+ part = (KParts::ReadOnlyPart *) factory->create(this);
+ if (!part)
+ return;
+
+ part->widget()->setFocusPolicy(QWidget::WheelFocus);
+ setFocusProxy(part->widget());
+ part->widget()->setFocus();
+
+ if (part->widget()->inherits("QFrame"))
+ ((QFrame*)part->widget())->setFrameStyle(QFrame::Panel|QFrame::Sunken);
+
+ vbox->addWidget(part->widget());
+
+// this->activePartChanged( owner->partController()->activePart() );
+ part->widget()->show();
+
+ connect(part, SIGNAL(destroyed()), this, SLOT(partDestroyed()));
+}
+
+
+void KonsoleViewWidget::activePartChanged(KParts::Part *activatedPart)
+{
+ kdDebug(9035) << k_funcinfo << endl;
+ KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(activatedPart);
+
+ if (ro_part && !ro_part->url().isLocalFile())
+ {
+ kdDebug(9035) << k_funcinfo << "part is null or not local" << endl;
+ return;
+ }
+ QString dir;
+ if (ro_part)
+ dir = ro_part->url().directory();
+ else if (owner->project())
+ dir = owner->project()->projectDirectory();
+
+ kdDebug(9035) << k_funcinfo "Changing dir to " << dir << endl;
+ if (dir.isEmpty())
+ return;
+ setDirectory( KURL(dir) );
+}
+
+void KonsoleViewWidget::setDirectory(const KURL &dirUrl)
+{
+ kdDebug(9035) << k_funcinfo << "part is " << (long)part << endl;
+
+ if (part && dirUrl != part->url())
+ {
+ kdDebug(9035) << k_funcinfo << "Changing dirUrl.path() == " << dirUrl.path() << endl;
+ kdDebug(9035) << k_funcinfo << "Changing part->url.path() == " << part->url().path() << endl;
+ KConfig* config = kapp->config();
+
+ kdDebug(9035) << k_funcinfo << "SyncTerminalEmulator: " << config->readBoolEntry("SyncTerminalEmulator") << endl;
+
+ if (config->readBoolEntry("SyncTerminalEmulator")) {
+ part->openURL( dirUrl );
+ }
+ }
+}
+
+void KonsoleViewWidget::partDestroyed()
+{
+ part = 0;
+ activate();
+}
+
+
+#include "konsoleviewwidget.moc"
diff --git a/parts/konsole/konsoleviewwidget.h b/parts/konsole/konsoleviewwidget.h
new file mode 100644
index 00000000..0236dee4
--- /dev/null
+++ b/parts/konsole/konsoleviewwidget.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * Copyright (C) 2003 by KDevelop Authors *
+ * kdevelop-devel@kde.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __KONSOLEVIEWWIDGET_H__
+#define __KONSOLEVIEWWIDGET_H__
+
+
+#include <qwidget.h>
+#include <qstring.h>
+
+
+class KDevProject;
+class KonsoleWidgetPrivate;
+class KonsoleViewPart;
+namespace KParts {
+ class ReadOnlyPart;
+ class Part;
+}
+class QVBoxLayout;
+
+
+class KonsoleViewWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ KonsoleViewWidget(KonsoleViewPart *part);
+ virtual ~KonsoleViewWidget();
+
+ virtual void show();
+
+public slots:
+ void setDirectory(const KURL &dirUrl);
+
+private slots:
+ void activePartChanged(KParts::Part *activatedPart);
+ void partDestroyed();
+
+private:
+ void activate();
+
+ KParts::ReadOnlyPart *part;
+ QVBoxLayout *vbox;
+ KonsoleViewPart *owner;
+};
+
+
+#endif
diff --git a/parts/openwith/Makefile.am b/parts/openwith/Makefile.am
new file mode 100644
index 00000000..59bf6185
--- /dev/null
+++ b/parts/openwith/Makefile.am
@@ -0,0 +1,15 @@
+# Here resides the openwith part.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevopenwith.la
+libkdevopenwith_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevopenwith_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevopenwith_la_SOURCES = openwithpart.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevopenwith.desktop
+
diff --git a/parts/openwith/README.dox b/parts/openwith/README.dox
new file mode 100644
index 00000000..c729ad92
--- /dev/null
+++ b/parts/openwith/README.dox
@@ -0,0 +1,52 @@
+/** \class OpenWithPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a>
+...
+\authors <a href="mailto:nth author AT provider.com">nth author full name</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/openwith/kdevopenwith.desktop b/parts/openwith/kdevopenwith.desktop
new file mode 100644
index 00000000..fcc7134c
--- /dev/null
+++ b/parts/openwith/kdevopenwith.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=This plugin provides additional "open" alternatives for various context menus in KDevelop.
+Comment[ca]=Aquest connector proporciona alternatives "open" addicionals per a diversos menús de context a KDevelop.
+Comment[da]=Dette plugin sørger for yderligere "åbne" alternativer for forskellige sammenhængsmenuer i KDevelop.
+Comment[de]=Dieses Modul stellt in vielen Kontextmenüs Alternativen für den Menüpunkt "Öffnen" zur Verfügung.
+Comment[el]=Αυτό το πρόσθετο προσφέρει εναλλακτικές επιλογές "ανοίγματος" για διάφορα σχετικά μενού στο KDevelop.
+Comment[es]=Este complemento proporciona alternativas de «abrir» adicionales en varios menús contextuales de KDevelop.
+Comment[et]=See plugin lisab KDevelopi erinevatele kontekstimenüüdele täiendavaid faili avamise võimalusi.
+Comment[eu]=Plugin honek KDevelop-eko testuinguru menu hainbatentzat beste "ireki" aukera eskeintzen dizkie.
+Comment[fa]=این وصله، انتخابهای »باز کردن« اضافی را برای گزینگان متن مختلف در KDevelop فراهم می‌کند.
+Comment[fr]=Ce module externe fournit des alternatives « ouvertes » supplémentaires pour divers menus contextuels dans KDevelop.
+Comment[gl]=Esta extensión proporciona alternativas "abrir" adicionais a varios menús de contexto de KDevelop.
+Comment[hu]=Ez a bővítőmodul további megnyitási lehetőségeket hoz létre a KDevelop felbukkanó menüiben.
+Comment[it]=Questo plugin offre alternative aggiuntive per "Apri" per i vari menu contestuali di KDevelop.
+Comment[ja]=このプラグインは、KDevelop の中のさまざまなコンテキストメニューに追加の「開く」選択肢を供給します。
+Comment[ms]=Plugin ini menyediakan alternatif "buka" tambahan untuk pelbagai menu konteks dalam KDevelop.
+Comment[nds]=Dit Moduul stellt för en Reeg Rechtsklickmenüs in KDevelop mehr Mööglichkeiten för "Opmaken" praat.
+Comment[ne]=यो प्लगइनले केडीई विकासमा विविध प्रसङ्ग मेनुका लागि अतिरिक्त "खोल्नुहोस्" विकल्प प्रदान गर्दछ ।
+Comment[nl]=Deze plugin biedt extra "open"-alternatieven in verschillende contextmenus in KDevelop.
+Comment[pl]=Ta wtyczka umożliwia dodanie dodatkowych możliwości otwierania plików w menu kontekstowych KDevelopa.
+Comment[pt]=Este 'plugin' oferece várias alternativas adicionais e "abertas" para vários menus de contexto no KDevelop.
+Comment[pt_BR]=Este plug-in fornece alternativas adicionais de "abrir" para vários menus de contetxo do KDevelop.
+Comment[ru]=Этот модуль предоставляет различные возможности открытия файлов, используя контекстные меню KDevelop.
+Comment[sk]=Modul poskytuje dodatočné "Otvoriť pomocou" alternatívy pre rôzne kontextové menu v KDevelop.
+Comment[sr]=Овај прикључак обезбеђује додатне алтернативе за „отвори“ за различите контекстне меније у kdevelop-у.
+Comment[sr@Latn]=Ovaj priključak obezbeđuje dodatne alternative za „otvori“ za različite kontekstne menije u kdevelop-u.
+Comment[sv]=Insticksprogrammet tillhandahåller ytterligare "öppna" alternativ i diverse sammanhangsberoende menyer i KDevelop.
+Comment[ta]=இந்த சொருகி Kஉருவாக்கியில் உள்ள வெவ்வேறு சூழுல் பட்டியலிற்கு பதில் "open" என்ற கூடுதல் வசதி தரும்.
+Comment[tg]=Ин модул як чанд хел кушодани файлҳоро имкон медиҳад, ҳангоми истифода намудани KDevelop.
+Comment[tr]=Bu eklenti, KDevelop'taki bir çok bağlam menüleri için fazladan "aç" alternatifleri sunar.
+Comment[zh_CN]=这个插件在 KDevelop 多个上下文菜单中提供“打开”菜单项。
+Comment[zh_TW]=此外掛程式提供 KDevelop 額外的「開啟方式」選單。
+Name=KDevOpenWith
+Name[da]=KDevelop Åbn med
+Name[de]="Öffnen mit"-Menüerweiterung (KDevelop)
+Name[hi]=के-डेव-ओपन-विथ
+Name[nds]=KDevelop-"Opmaken mit"-Menüverwiedern
+Name[pl]=KDevOtwórzW
+Name[sk]=KDev otvoriť pomocou
+Name[sv]=KDevelop öppna med
+Name[ta]=KDev வைத்து திற
+Name[tg]=Кушодани аз рӯи KDev
+Name[zh_TW]=KDevelop 開啟方式
+GenericName="Open with" Menu Addon
+GenericName[ca]=Afegit de menú "Obre amb"
+GenericName[da]="Åbn med" menu-tilføjelse
+GenericName[de]=Menüerweiterung "Öffnen mit"
+GenericName[el]=Πρόσθετο μενού "Άνοιγμα με"
+GenericName[es]=Extensión de menú «Abrir con»
+GenericName[et]=Menüü "Ava kasutades" lisamine
+GenericName[eu]="Ireki honekin" menu gehigarria
+GenericName[fa]=»باز کردن با« افزودن گزینگان
+GenericName[fr]=Extension de menu « Ouvrir avec... »
+GenericName[gl]=Engadido "Abrir con" para menús
+GenericName[hu]="Megnyitás ezzel" menübővítés
+GenericName[it]=Aggiunta al menu della voce "Apri con"
+GenericName[ja]=「アプリケーションで開く」メニューアドオン
+GenericName[nds]=Menüverwiedern "Opmaken mit"
+GenericName[ne]="यससँग खोल्नुहोस्" मेनु एडअन
+GenericName[nl]="Openen met" menutoevoeging
+GenericName[pl]=Dodatek do menu "Otwórz za pomocą"
+GenericName[pt]=Extra do Menu "Abrir com"
+GenericName[pt_BR]=Addon de Menu "Abrir com"
+GenericName[ru]=Дополнение меню "Открыть с помощью"
+GenericName[sk]="Otvoriť pomocou" prídavok k menu
+GenericName[sl]=Menijski dodatek »Odpri z«
+GenericName[sr]=Додатак за мени „Отвори помоћу“
+GenericName[sr@Latn]=Dodatak za meni „Otvori pomoću“
+GenericName[sv]=Menytillägg till "Öppna med"
+GenericName[ta]="Open with" பட்டியல் அடான்
+GenericName[tg]=Менюи иловагӣ "Кушодан бо фармони Ёрӣ"
+GenericName[tr]="Birlikte Aç" Menü Eki
+GenericName[zh_CN]=“打开方式”菜单项
+GenericName[zh_TW]="開啟方式"選單
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevopenwith
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=GlobalFileManagement,FileOpenWith
diff --git a/parts/openwith/openwithpart.cpp b/parts/openwith/openwithpart.cpp
new file mode 100644
index 00000000..4ff33ffb
--- /dev/null
+++ b/parts/openwith/openwithpart.cpp
@@ -0,0 +1,138 @@
+#include "openwithpart.h"
+
+#include <qfile.h>
+
+#include <kpopupmenu.h>
+#include <kdevgenericfactory.h>
+#include <kdebug.h>
+#include <kmimetype.h>
+#include <ktrader.h>
+#include <krun.h>
+#include <kaction.h>
+#include <kcharsets.h>
+
+#include "kdevpartcontroller.h"
+#include "kdevcore.h"
+#include "kdevplugininfo.h"
+#include "urlutil.h"
+
+typedef KDevGenericFactory<OpenWithPart> OpenWithFactory;
+
+static const KDevPluginInfo data("kdevopenwith");
+K_EXPORT_COMPONENT_FACTORY(libkdevopenwith, OpenWithFactory(data))
+
+OpenWithPart::OpenWithPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "OpenWithPart")
+{
+ setInstance( OpenWithFactory::instance() );
+
+ connect(core(), SIGNAL(contextMenu(QPopupMenu*,const Context *)),
+ this, SLOT(fillContextMenu(QPopupMenu*,const Context *)));
+}
+
+
+OpenWithPart::~OpenWithPart()
+{
+}
+
+
+void OpenWithPart::fillContextMenu(QPopupMenu *popup, const Context *context)
+{
+ if ( !context->hasType( Context::FileContext ) ) return;
+
+ const FileContext *ctx = static_cast<const FileContext*>(context);
+ m_urls = ctx->urls();
+
+ popup->insertSeparator();
+
+ popup->insertItem( i18n("Open as UTF-8"), this, SLOT(openAsUtf8()) );
+
+ KPopupMenu * openAsPopup = new KPopupMenu( popup );
+
+ int id = popup->insertItem( i18n("Open As"), openAsPopup );
+ popup->setWhatsThis(id, i18n("<b>Open As</b><p>Lists all encodings that can be used to open the selected file."));
+
+ QStringList encodings = KGlobal::charsets()->descriptiveEncodingNames();
+
+ int i = 0;
+ QStringList::const_iterator it = encodings.constBegin();
+ while ( it != encodings.constEnd() )
+ {
+ openAsPopup->insertItem( *it, this, SLOT(openAsEncoding(int)), 0, i );
+ ++it;
+ i++;
+ }
+
+ KPopupMenu * openWithPopup = new KPopupMenu( popup );
+
+ // hmmm.. what to do here? open every different mimetype seperately? Just go with the first for now..
+ QString mimeType = KMimeType::findByURL(m_urls.first(), 0, true, true)->name();
+ KTrader::OfferList offers = KTrader::self()->query(mimeType, "Type == 'Application'");
+ if (offers.count() > 0)
+ {
+ KTrader::OfferList::Iterator it;
+ for (it = offers.begin(); it != offers.end(); ++it)
+ {
+ KAction *action = new KAction((*it)->name(), (*it)->icon(), 0, 0, QFile::encodeName( (*it)->desktopEntryPath() ).data());
+ connect(action, SIGNAL(activated()), this, SLOT(openWithService()));
+ action->plug( openWithPopup );
+ }
+ }
+
+ id = popup->insertItem( i18n("Open With"), openWithPopup );
+ popup->setWhatsThis(id, i18n("<b>Open With</b><p>Lists all applications that can be used to open the selected file."));
+
+ openWithPopup->insertSeparator();
+
+ // make sure the generic "Open with ..." entry gets appended to the submenu
+ id = openWithPopup->insertItem(i18n("Open With..."), this, SLOT(openWithDialog()));
+ openWithPopup->setWhatsThis(id, i18n("<b>Open With...</b><p>Provides a dialog to choose the application to open the selected file."));
+}
+
+
+void OpenWithPart::openWithService()
+{
+ KService::Ptr ptr = KService::serviceByDesktopPath(sender()->name());
+ if (ptr)
+ {
+ KRun::run(*ptr, m_urls);
+ }
+}
+
+
+void OpenWithPart::openWithDialog()
+{
+ KRun::displayOpenWithDialog( m_urls );
+}
+
+
+void OpenWithPart::openAsEncoding( int id )
+{
+ QStringList encodings = KGlobal::charsets()->descriptiveEncodingNames();
+ QString encoding;
+ if ( id <= encodings.count() && id >= 0 )
+ {
+ encoding = KGlobal::charsets()->encodingForName( encodings[ id ] );
+ }
+
+ KURL::List::iterator it = m_urls.begin();
+ while ( it != m_urls.end() )
+ {
+ partController()->setEncoding( encoding );
+ partController()->editDocument( *it );
+ ++it;
+ }
+}
+
+void OpenWithPart::openAsUtf8( )
+{
+ KURL::List::iterator it = m_urls.begin();
+ while ( it != m_urls.end() )
+ {
+ partController()->setEncoding( "utf8" );
+ partController()->editDocument( *it );
+ ++it;
+ }
+}
+
+#include "openwithpart.moc"
diff --git a/parts/openwith/openwithpart.h b/parts/openwith/openwithpart.h
new file mode 100644
index 00000000..c79ad164
--- /dev/null
+++ b/parts/openwith/openwithpart.h
@@ -0,0 +1,36 @@
+#ifndef __OPENWITHPART_H__
+#define __OPENWITHPART_H__
+
+#include <kurl.h>
+
+#include "kdevplugin.h"
+
+class QPopupMenu;
+class Context;
+
+
+class OpenWithPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ OpenWithPart(QObject *parent, const char *name, const QStringList &);
+ ~OpenWithPart();
+
+
+private slots:
+
+ void fillContextMenu(QPopupMenu *popup, const Context *context);
+
+ void openWithService();
+ void openWithDialog();
+ void openAsEncoding(int id);
+ void openAsUtf8();
+
+private:
+
+ KURL::List m_urls;
+};
+
+#endif
diff --git a/parts/outputviews/Makefile.am b/parts/outputviews/Makefile.am
new file mode 100644
index 00000000..81b7ca4e
--- /dev/null
+++ b/parts/outputviews/Makefile.am
@@ -0,0 +1,35 @@
+# Here reside the output view and make view parts.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/extensions/dcop -I$(top_srcdir)/lib/util \
+ -I$(top_srcdir)/lib/widgets $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevmakeview.la libkdevappview.la
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevappoutputview.desktop kdevmakeview.desktop
+
+rc1dir = $(kde_datadir)/kdevappoutputview
+rc1_DATA = kdevmakeview.rc
+
+rc2dir = $(kde_datadir)/kdevmakeview
+rc2_DATA = kdevmakeview.rc
+
+noinst_HEADERS = filterdlg.h
+
+libkdevmakeview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevmakeview_la_LIBADD = $(top_builddir)/lib/widgets/libkdevwidgets.la \
+ $(top_builddir)/lib/interfaces/extensions/dcop/libkdevdcopextensions.la $(top_builddir)/lib/libkdevelop.la \
+ $(LIB_KHTML) $(top_builddir)/lib/interfaces/extensions/libkdevextensions.la
+libkdevmakeview_la_SOURCES = makeviewpart.cpp makewidget.cpp \
+ directorystatusmessagefilter.cpp outputfilter.cpp compileerrorfilter.cpp commandcontinuationfilter.cpp \
+ makeitem.cpp makeactionfilter.cpp otherfilter.cpp
+
+libkdevappview_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevappview_la_LIBADD = $(top_builddir)/lib/widgets/libkdevwidgets.la \
+ $(top_builddir)/lib/interfaces/extensions/dcop/libkdevdcopextensions.la $(top_builddir)/lib/libkdevelop.la \
+ $(LIB_KHTML) $(top_builddir)/lib/interfaces/extensions/libkdevextensions.la
+libkdevappview_la_SOURCES = appoutputviewpart.cpp appoutputwidget.cpp \
+ filterdlg.ui
diff --git a/parts/outputviews/README.dox b/parts/outputviews/README.dox
new file mode 100644
index 00000000..6e17bea3
--- /dev/null
+++ b/parts/outputviews/README.dox
@@ -0,0 +1,16 @@
+/** \class MakeViewPart
+Two output views: one displays compiler output, the other displays the application output.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\feature Auto scroll down
+\feature Auto hide when it's not needed
+\feature Jump to error when clicked
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=outputviews&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">outputviews component at Bugzilla database</a>
+
+\todo Make the contents of the application output copyable.
+
+\faq <b>How does the auto-hide feature work?</b> If there are no compilation errors the output view hides itself (if it was hidden before compilation start) or switches to the previously selected view.
+
+*/
diff --git a/parts/outputviews/appoutputviewpart.cpp b/parts/outputviews/appoutputviewpart.cpp
new file mode 100644
index 00000000..79a62471
--- /dev/null
+++ b/parts/outputviews/appoutputviewpart.cpp
@@ -0,0 +1,178 @@
+/***************************************************************************
+ * Copyright (C) 1999-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "appoutputviewpart.h"
+
+#include <qwhatsthis.h>
+#include <qdir.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kiconloader.h>
+#include <kparts/part.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <kapplication.h>
+
+#include "kdevproject.h"
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "appoutputwidget.h"
+#include "kdevpartcontroller.h"
+#include "settings.h"
+
+static const KDevPluginInfo data("kdevappoutputview");
+typedef KDevGenericFactory< AppOutputViewPart > AppViewFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevappview, AppViewFactory( data ) )
+
+AppOutputViewPart::AppOutputViewPart(QObject *parent, const char *name, const QStringList &)
+ : KDevAppFrontend(&data, parent, name ? name : "AppOutputViewPart")
+{
+ setInstance(AppViewFactory::instance());
+
+ m_dcop = new KDevAppFrontendIface(this);
+
+ m_widget = new AppOutputWidget(this);
+ m_widget->setIcon( SmallIcon("openterm") );
+ m_widget->setCaption(i18n("Application Output"));
+ QWhatsThis::add(m_widget, i18n("<b>Application output</b><p>"
+ "The stdout/stderr output window is a replacement for "
+ "terminal-based application communication. Running terminal "
+ "applications use this instead of a terminal window."));
+
+ mainWindow()->embedOutputView(m_widget, i18n("Application"), i18n("Output of the executed user program"));
+ hideView();
+
+ connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)),
+ this, SLOT(slotStopButtonClicked(KDevPlugin*)) );
+ connect(m_widget, SIGNAL(processExited(KProcess*)), this, SLOT(slotProcessExited()));
+ connect(m_widget, SIGNAL(processExited(KProcess*)), SIGNAL(processExited()));
+}
+
+
+AppOutputViewPart::~AppOutputViewPart()
+{
+ if ( m_widget )
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+ delete m_dcop;
+}
+
+void AppOutputViewPart::slotStopButtonClicked( KDevPlugin* which )
+{
+ if ( which != 0 && which != this )
+ return;
+ stopApplication();
+}
+
+void AppOutputViewPart::stopApplication()
+{
+ m_widget->killJob();
+
+ core()->running( this, false );
+}
+
+void AppOutputViewPart::slotProcessExited()
+{
+ core()->running( this, false );
+ if ( partController()->activePart() && partController()->activePart()->widget() )
+ partController()->activePart()->widget()->setFocus();
+}
+
+/**
+ * If directory is empty it will use the user's home directory.
+ * If inTerminal is true, the program is started in an external
+ * konsole.
+ */
+void AppOutputViewPart::startAppCommand(const QString &directory, const QString &program, bool inTerminal)
+{
+ QString cmd;
+
+ if (inTerminal) {
+ cmd = Settings::terminalEmulatorName( *kapp->config() );
+ if ( cmd == "konsole" && !directory.isNull() ) { // isn't setting the working directory below enough?
+ // If a directory was specified, use it
+ cmd += QString(" --workdir '%1'").arg(directory);
+ }
+ cmd += " -e /bin/sh -c '";
+ cmd += program;
+ cmd += "; echo \"";
+ cmd += i18n("Press Enter to continue!");
+ cmd += "\";read dummy'";
+ } else
+ cmd = program;
+
+ m_widget->clearViewAndContents();
+
+ if ( directory.isNull() )
+ // use the user's home directory
+ m_widget->startJob(QDir::homeDirPath(), cmd);
+ else
+ // use the supplied directory
+ m_widget->startJob(directory, cmd);
+
+ core()->running( this, true );
+
+ showView();
+ mainWindow()->raiseView(m_widget);
+}
+
+
+bool AppOutputViewPart::isRunning()
+{
+ return m_widget->isRunning();
+}
+
+
+void AppOutputViewPart::insertStdoutLine(const QCString &line)
+{
+ m_widget->insertStdoutLine(line);
+}
+
+
+void AppOutputViewPart::insertStderrLine(const QCString &line)
+{
+ m_widget->insertStderrLine(line);
+}
+
+void AppOutputViewPart::clearView()
+{
+ m_widget->clearViewAndContents();
+}
+
+void AppOutputViewPart::hideView()
+{
+ m_viewIsVisible = false;
+ mainWindow()->setViewAvailable( m_widget, m_viewIsVisible );
+}
+
+void AppOutputViewPart::showView()
+{
+ m_viewIsVisible = true;
+ mainWindow()->setViewAvailable( m_widget, m_viewIsVisible );
+}
+
+bool AppOutputViewPart::isViewVisible()
+{
+ return m_viewIsVisible;
+}
+
+void AppOutputViewPart::addPartialStderrLine(const QCString & line)
+{
+ m_widget->addPartialStderrLine(line);
+}
+
+void AppOutputViewPart::addPartialStdoutLine(const QCString & line)
+{
+ m_widget->addPartialStdoutLine(line);
+}
+
+#include "appoutputviewpart.moc"
diff --git a/parts/outputviews/appoutputviewpart.h b/parts/outputviews/appoutputviewpart.h
new file mode 100644
index 00000000..76d708f9
--- /dev/null
+++ b/parts/outputviews/appoutputviewpart.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ * Copyright (C) 1999-2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _APPOUTPUTVIEWSPART_H_
+#define _APPOUTPUTVIEWSPART_H_
+
+#include <qguardedptr.h>
+
+#include "kdevappfrontend.h"
+#include "KDevAppFrontendIface.h"
+
+
+class AppOutputWidget;
+
+class AppOutputViewPart : public KDevAppFrontend
+{
+ Q_OBJECT
+
+public:
+ AppOutputViewPart( QObject *parent, const char *name, const QStringList & );
+ ~AppOutputViewPart();
+
+ virtual void startAppCommand(const QString &directory, const QString &command, bool inTerminal);
+ virtual void stopApplication();
+ virtual bool isRunning();
+ virtual void insertStdoutLine(const QCString &line);
+ virtual void insertStderrLine(const QCString &line);
+ virtual void addPartialStdoutLine(const QCString &line);
+ virtual void addPartialStderrLine(const QCString &line);
+ virtual void clearView();
+ void hideView();
+ void showView();
+ bool isViewVisible();
+
+signals:
+ void processExited();
+
+private slots:
+ void slotStopButtonClicked(KDevPlugin*);
+ void slotProcessExited();
+
+private:
+ QGuardedPtr<AppOutputWidget> m_widget;
+ KDevAppFrontendIface *m_dcop;
+ bool m_viewIsVisible;
+};
+
+#endif
diff --git a/parts/outputviews/appoutputwidget.cpp b/parts/outputviews/appoutputwidget.cpp
new file mode 100644
index 00000000..e3c3810a
--- /dev/null
+++ b/parts/outputviews/appoutputwidget.cpp
@@ -0,0 +1,355 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * Copyright (C) 2003 by Hamish Rodda *
+ * meddie@yoyo.its.monash.edu.au *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "appoutputwidget.h"
+
+#include <qregexp.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qclipboard.h>
+
+#include <klocale.h>
+#include <kdebug.h>
+#include <kstatusbar.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kpopupmenu.h>
+#include <klineedit.h>
+#include <kfiledialog.h>
+
+#include "appoutputviewpart.h"
+#include "filterdlg.h"
+#include "kdevpartcontroller.h"
+#include "kdevmainwindow.h"
+#include "kdevproject.h"
+
+AppOutputWidget::AppOutputWidget(AppOutputViewPart* part)
+ : ProcessWidget(0, "app output widget"), m_part(part)
+{
+ connect(this, SIGNAL(executed(QListBoxItem*)), SLOT(slotRowSelected(QListBoxItem*)));
+ connect(this, SIGNAL(rightButtonClicked( QListBoxItem *, const QPoint & )),
+ SLOT(slotContextMenu( QListBoxItem *, const QPoint & )));
+ KConfig *config = kapp->config();
+ config->setGroup("General Options");
+ setFont(config->readFontEntry("OutputViewFont"));
+ setSelectionMode(QListBox::Extended);
+}
+
+void AppOutputWidget::clearViewAndContents()
+{
+ m_contentList.clear();
+ clear();
+}
+
+AppOutputWidget::~AppOutputWidget()
+{}
+
+
+void AppOutputWidget::childFinished(bool normal, int status)
+{
+ if( !stdoutbuf.isEmpty() )
+ insertStdoutLine("");
+ if( !stderrbuf.isEmpty() )
+ insertStderrLine("");
+
+ ProcessWidget::childFinished(normal, status);
+}
+
+
+void AppOutputWidget::slotRowSelected(QListBoxItem* row)
+{
+ static QRegExp assertMatch("ASSERT: \\\"([^\\\"]+)\\\" in ([^\\( ]+) \\(([\\d]+)\\)");
+ static QRegExp lineInfoMatch("\\[([^:]+):([\\d]+)\\]");
+ static QRegExp rubyErrorMatch("([^:\\s]+\\.rb):([\\d]+):?.*$");
+
+ if (row) {
+ if (assertMatch.exactMatch(row->text())) {
+ m_part->partController()->editDocument(KURL( assertMatch.cap(2) ), assertMatch.cap(3).toInt() - 1);
+ m_part->mainWindow()->statusBar()->message(i18n("Assertion failed: %1").arg(assertMatch.cap(1)), 10000);
+ m_part->mainWindow()->lowerView(this);
+
+ } else if (lineInfoMatch.search(row->text()) != -1) {
+ m_part->partController()->editDocument(KURL( lineInfoMatch.cap(1) ), lineInfoMatch.cap(2).toInt() - 1);
+ m_part->mainWindow()->statusBar()->message(row->text(), 10000);
+ m_part->mainWindow()->lowerView(this);
+ } else if (rubyErrorMatch.search(row->text()) != -1) {
+ QString file;
+ if (rubyErrorMatch.cap(1).startsWith("/")) {
+ file = rubyErrorMatch.cap(1);
+ } else {
+ file = m_part->project()->projectDirectory() + "/" + rubyErrorMatch.cap(1);
+ }
+ m_part->partController()->editDocument(KURL(rubyErrorMatch.cap(1)), rubyErrorMatch.cap(2).toInt() - 1);
+ m_part->mainWindow()->statusBar()->message(row->text(), 10000);
+ m_part->mainWindow()->lowerView(this);
+ }
+ }
+}
+
+
+void AppOutputWidget::insertStdoutLine(const QCString &line)
+{
+// kdDebug(9004) << k_funcinfo << line << endl;
+
+ if ( !m_part->isViewVisible() )
+ {
+ m_part->showView();
+ }
+
+ QString sline;
+ if( !stdoutbuf.isEmpty() )
+ {
+ sline = QString::fromLocal8Bit( stdoutbuf+line );
+ stdoutbuf.truncate( 0 );
+ }else
+ {
+ sline = QString::fromLocal8Bit( line );
+ }
+
+ m_contentList.append(QString("o-")+sline);
+ if ( filterSingleLine( sline ) )
+ {
+ ProcessWidget::insertStdoutLine( sline.local8Bit() );
+ }
+}
+
+
+void AppOutputWidget::insertStderrLine(const QCString &line)
+{
+// kdDebug(9004) << k_funcinfo << line << endl;
+
+ if ( !m_part->isViewVisible() )
+ {
+ m_part->showView();
+ }
+
+
+ QString sline;
+ if( !stderrbuf.isEmpty() )
+ {
+ sline = QString::fromLocal8Bit( stderrbuf+line );
+ stderrbuf.truncate( 0 );
+ }else
+ {
+ sline = QString::fromLocal8Bit( line );
+ }
+
+ m_contentList.append(QString("e-")+sline);
+ if ( filterSingleLine( sline ) )
+ {
+ ProcessWidget::insertStderrLine( sline.local8Bit() );
+ }
+}
+
+void AppOutputWidget::editFilter()
+{
+ FilterDlg dlg( this );
+ dlg.caseSensitive->setChecked( m_filter.m_caseSensitive );
+ dlg.regularExpression->setChecked( m_filter.m_isRegExp );
+ dlg.filterString->setText( m_filter.m_filterString );
+
+ if ( dlg.exec() == QDialog::Accepted )
+ {
+ m_filter.m_caseSensitive = dlg.caseSensitive->isChecked();
+ m_filter.m_isRegExp = dlg.regularExpression->isChecked();
+ m_filter.m_filterString = dlg.filterString->text();
+
+ m_filter.m_isActive = !m_filter.m_filterString.isEmpty();
+
+ reinsertAndFilter();
+ }
+
+}
+bool AppOutputWidget::filterSingleLine(const QString & line)
+{
+ if ( !m_filter.m_isActive ) return true;
+
+ if ( m_filter.m_isRegExp )
+ {
+ return ( line.find( QRegExp( m_filter.m_filterString, m_filter.m_caseSensitive, false ) ) != -1 );
+ }
+ else
+ {
+ return ( line.find( m_filter.m_filterString, 0, m_filter.m_caseSensitive ) != -1 );
+ }
+}
+
+void AppOutputWidget::reinsertAndFilter()
+{
+ //copy the first item from the listbox
+ //if a programm was started, this contains the issued command
+ QString issuedCommand;
+ if ( count() > 0 )
+ {
+ setTopItem(0);
+ issuedCommand = item(topItem())->text();
+ }
+
+ clear();
+
+ //write back the issued command
+ if ( !issuedCommand.isEmpty() )
+ {
+ insertItem( new ProcessListBoxItem( issuedCommand, ProcessListBoxItem::Diagnostic ) );
+ }
+
+ //grep through the list for items matching the filter...
+ QStringList strListFound;
+ if ( m_filter.m_isActive )
+ {
+ if ( m_filter.m_isRegExp )
+ {
+ strListFound = m_contentList.grep( QRegExp(m_filter.m_filterString, m_filter.m_caseSensitive, false ) );
+ }
+ else
+ {
+ strListFound = m_contentList.grep( m_filter.m_filterString, m_filter.m_caseSensitive );
+ }
+ }
+ else
+ {
+ strListFound = m_contentList;
+ }
+
+ //... and reinsert the found items into the listbox
+ for ( QStringList::Iterator it = strListFound.begin(); it != strListFound.end(); ++it )
+ {
+ if ((*it).startsWith("o-"))
+ {
+ (*it).remove(0,2);
+ insertItem(new ProcessListBoxItem(*it, ProcessListBoxItem::Normal));
+ }
+ else if ((*it).startsWith("e-"))
+ {
+ (*it).remove(0,2);
+ insertItem(new ProcessListBoxItem(*it, ProcessListBoxItem::Error));
+ }
+ }
+}
+
+void AppOutputWidget::clearFilter()
+{
+ m_filter.m_isActive = false;
+ reinsertAndFilter();
+}
+
+void AppOutputWidget::slotContextMenu( QListBoxItem *, const QPoint &p )
+{
+ KPopupMenu popup(this, "filter output");
+
+ int id = popup.insertItem( i18n("Clear output"), this, SLOT(clearViewAndContents()) );
+ popup.setItemEnabled( id, m_contentList.size() > 0 );
+
+ popup.insertItem( i18n("Copy selected lines"), this, SLOT(copySelected()) );
+ popup.insertSeparator();
+
+ popup.insertItem( i18n("Save unfiltered"), this, SLOT(saveAll()) );
+ id = popup.insertItem( i18n("Save filtered output"), this, SLOT(saveFiltered()) );
+ popup.setItemEnabled( id, m_filter.m_isActive );
+ popup.insertSeparator();
+
+ id = popup.insertItem( i18n("Clear filter"), this, SLOT(clearFilter()) );
+ popup.setItemEnabled( id, m_filter.m_isActive );
+
+ popup.insertItem( i18n("Edit filter"), this, SLOT(editFilter() ) );
+
+ popup.insertSeparator();
+ popup.insertItem( i18n("Hide view"), this, SLOT(hideView()) );
+
+ popup.exec(p);
+}
+
+void AppOutputWidget::hideView()
+{
+ m_part->hideView();
+}
+
+void AppOutputWidget::saveAll()
+{
+ saveOutputToFile( false );
+}
+
+void AppOutputWidget::saveFiltered()
+{
+ saveOutputToFile( true );
+}
+
+void AppOutputWidget::saveOutputToFile(bool useFilter)
+{
+ QString filename = KFileDialog::getSaveFileName();
+
+ if ( filename.isEmpty() ) return;
+
+ QStringList contents;
+ if ( useFilter && m_filter.m_isActive )
+ {
+ if ( m_filter.m_isRegExp )
+ {
+ contents = m_contentList.grep( QRegExp(m_filter.m_filterString, m_filter.m_caseSensitive, false ) );
+ }
+ else
+ {
+ contents = m_contentList.grep( m_filter.m_filterString, m_filter.m_caseSensitive );
+ }
+ }
+ else
+ {
+ contents = m_contentList;
+ }
+
+ QFile file( filename );
+ if ( file.open( IO_WriteOnly ) )
+ {
+ QTextStream ostream( &file );
+ QStringList::ConstIterator it = contents.begin();
+ while( it != contents.end() )
+ {
+ QString line = *it;
+ if ( line.startsWith("o-") || line.startsWith("e-") )
+ {
+ line.remove( 0, 2 );
+ }
+ ostream << line << endl;
+ ++it;
+ }
+ file.close();
+ }
+}
+
+void AppOutputWidget::copySelected()
+{
+ uint n = count();
+ QString buffer;
+ for (uint i = 0; i < n; i++)
+ {
+ if (isSelected(i))
+ buffer += item(i)->text() + "\n";
+ }
+ kapp->clipboard()->setText(buffer, QClipboard::Clipboard);
+}
+
+void AppOutputWidget::addPartialStderrLine(const QCString & line)
+{
+ stderrbuf += line;
+}
+
+void AppOutputWidget::addPartialStdoutLine(const QCString & line)
+{
+ stdoutbuf += line;
+}
+
+#include "appoutputwidget.moc"
diff --git a/parts/outputviews/appoutputwidget.h b/parts/outputviews/appoutputwidget.h
new file mode 100644
index 00000000..9a0d1e71
--- /dev/null
+++ b/parts/outputviews/appoutputwidget.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _APPOUTPUTWIDGET_H_
+#define _APPOUTPUTWIDGET_H_
+
+#include <qstringlist.h>
+#include <kregexp.h>
+
+#include "processwidget.h"
+
+class AppOutputViewPart;
+
+class AppOutputWidget : public ProcessWidget
+{
+ Q_OBJECT
+friend class AppOutputViewPart;
+public:
+ AppOutputWidget(AppOutputViewPart* part);
+ ~AppOutputWidget();
+ // clears our own store and the one of our base ProcessWidget
+
+public slots:
+ void slotRowSelected(QListBoxItem* row);
+ void insertStdoutLine(const QCString &line);
+ void insertStderrLine(const QCString &line);
+ void addPartialStdoutLine(const QCString &line);
+ void addPartialStderrLine(const QCString &line);
+ void slotContextMenu(QListBoxItem *, const QPoint &);
+ void hideView();
+ void clearViewAndContents();
+ void clearFilter();
+ void editFilter();
+ void saveAll();
+ void saveFiltered();
+ void copySelected();
+
+private:
+ virtual void childFinished(bool normal, int status);
+ void saveOutputToFile( bool useFilter );
+ void reinsertAndFilter();
+ bool filterSingleLine( const QString & line );
+
+ QStringList m_contentList;
+
+ struct OutputFilter
+ {
+ OutputFilter() : m_isActive(false), m_isRegExp(false), m_caseSensitive(false) {}
+ bool m_isActive;
+ bool m_isRegExp;
+ bool m_caseSensitive;
+ QString m_filterString;
+ };
+
+ AppOutputViewPart* m_part;
+ OutputFilter m_filter;
+ QCString stdoutbuf;
+ QCString stderrbuf;
+};
+
+#endif
diff --git a/parts/outputviews/commandcontinuationfilter.cpp b/parts/outputviews/commandcontinuationfilter.cpp
new file mode 100644
index 00000000..474cec15
--- /dev/null
+++ b/parts/outputviews/commandcontinuationfilter.cpp
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "commandcontinuationfilter.h"
+#include <qregexp.h>
+#include <kdebug.h>
+
+CommandContinuationFilter::CommandContinuationFilter( OutputFilter& next )
+ : OutputFilter( next )
+{
+}
+
+void CommandContinuationFilter::processLine( const QString& line )
+{
+ int index=line.length()-1;
+ while (index>=0)
+ {
+ if (line[index]=='\\')
+ {
+ m_text += line.left(index);
+ return;
+ }
+
+ if (!line[index].isSpace())
+ break;
+ index--;
+ }
+
+ m_text+=line;
+ OutputFilter::processLine( m_text );
+ m_text = "";
+}
diff --git a/parts/outputviews/commandcontinuationfilter.h b/parts/outputviews/commandcontinuationfilter.h
new file mode 100644
index 00000000..d0239caf
--- /dev/null
+++ b/parts/outputviews/commandcontinuationfilter.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CommandContinuationFilter_h
+#define CommandContinuationFilter_h
+
+#include "outputfilter.h"
+#include <qstring.h>
+
+class CommandContinuationFilter : public OutputFilter
+{
+public:
+ CommandContinuationFilter( OutputFilter& );
+
+ void processLine( const QString& line );
+
+private:
+ QString m_text;
+};
+
+#endif
diff --git a/parts/outputviews/compileerrorfilter.cpp b/parts/outputviews/compileerrorfilter.cpp
new file mode 100644
index 00000000..f8246346
--- /dev/null
+++ b/parts/outputviews/compileerrorfilter.cpp
@@ -0,0 +1,128 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "compileerrorfilter.h"
+#include "compileerrorfilter.moc"
+#include "makeitem.h"
+
+#include <kdebug.h>
+
+CompileErrorFilter::ErrorFormat::ErrorFormat( const char * regExp, int file, int line, int text )
+ : expression( regExp )
+ , fileGroup( file )
+ , lineGroup( line )
+ , textGroup( text )
+{
+}
+
+CompileErrorFilter::ErrorFormat::ErrorFormat( const char * regExp, int file, int line, int text, QString comp )
+ : expression( regExp )
+ , fileGroup( file )
+ , lineGroup( line )
+ , textGroup( text )
+ , compiler( comp )
+{
+}
+
+
+CompileErrorFilter::CompileErrorFilter( OutputFilter& next )
+ : OutputFilter( next )
+{
+}
+
+CompileErrorFilter::ErrorFormat* CompileErrorFilter::errorFormats()
+{
+ /// @todo could get these from emacs compile.el
+ static ErrorFormat formats[] = {
+ // GCC - another case, eg. for #include "pixmap.xpm" which does not exists
+ ErrorFormat( "^([^:\t]{1,1024}):([0-9]{1,10}):(?:[0-9]+):([^0-9]+)", 1, 2, 3 ),
+ // GCC
+ ErrorFormat( "^([^:\t]{1,1024}):([0-9]{1,10}):([^0-9]+)", 1, 2, 3 ),
+ // ICC
+ ErrorFormat( "^([^:\\t]{1,1024})\\(([0-9]{1,10})\\):([^0-9]+)", 1, 2, 3, "intel" ),
+ //libtool link
+ ErrorFormat( "(libtool):( link):( warning): ", 0, 0, 0 ),
+ // ld
+ ErrorFormat( "undefined reference", 0, 0, 0 ),
+ ErrorFormat( "undefined symbol", 0, 0, 0 ),
+ ErrorFormat( "ld: cannot find", 0, 0, 0 ),
+ ErrorFormat( "No such file", 0, 0, 0 ),
+ // make
+ ErrorFormat( "No rule to make target", 0, 0, 0 ),
+ // Fortran
+ ErrorFormat( "\"(.*)\", line ([0-9]+):(.*)", 1, 2, 3 ),
+ // Jade
+ ErrorFormat( "[a-zA-Z]+:([^: \t]+):([0-9]+):[0-9]+:[a-zA-Z]:(.*)", 1, 2, 3 ),
+ // ifort
+ ErrorFormat( "fortcom: Error: (.*), line ([0-9]+):(.*)", 1, 2, 3, "intel" ),
+ // PGI
+ ErrorFormat( "PGF9(.*)-(.*)-(.*)-(.*) \\((.*): ([0-9]+)\\)", 5, 6, 4, "pgi" ),
+ // PGI (2)
+ ErrorFormat( "PGF9(.*)-(.*)-(.*)-Symbol, (.*) \\((.*)\\)", 5, 5, 4, "pgi" ),
+
+ ErrorFormat( 0, 0, 0, 0 ) // this one last
+ };
+
+ return formats;
+
+}
+
+void CompileErrorFilter::processLine( const QString& line )
+{
+ bool hasmatch = false;
+ QString file;
+ int lineNum = 0;
+ QString text;
+ QString compiler;
+ int i = 0;
+ bool isWarning = false;
+ bool isInstantiationInfo = false;
+ ErrorFormat* const errFormats = errorFormats();
+ ErrorFormat* format = &errFormats[i];
+ while( !format->expression.isEmpty() )
+ {
+ QRegExp& regExp = format->expression;
+
+ if ( regExp.search( line ) != -1 ) {
+ hasmatch = true;
+ file = regExp.cap( format->fileGroup );
+ lineNum = regExp.cap( format->lineGroup ).toInt() - 1;
+ text = regExp.cap( format->textGroup );
+ compiler = format->compiler;
+ QString cap = regExp.cap(3);
+ if (cap.contains("warning:", false) || cap.contains("Warnung:", false))
+ isWarning = true;
+ if (regExp.cap(3).contains("instantiated from", false)) {
+ isInstantiationInfo = true;
+ }
+ break;
+ }
+
+ format = &errFormats[++i];
+ }
+
+ if( hasmatch )
+ {
+ // Add hacks for error strings you want excluded here
+ if( text.find( QString::fromLatin1("(Each undeclared identifier is reported only once") ) >= 0
+ || text.find( QString::fromLatin1("for each function it appears in.)") ) >= 0 )
+ hasmatch = false;
+ }
+
+ if ( hasmatch )
+ {
+ emit item( new ErrorItem( file, lineNum, text, line, isWarning, isInstantiationInfo, compiler ) );
+ }
+ else
+ {
+ OutputFilter::processLine( line );
+ }
+}
diff --git a/parts/outputviews/compileerrorfilter.h b/parts/outputviews/compileerrorfilter.h
new file mode 100644
index 00000000..d07495cf
--- /dev/null
+++ b/parts/outputviews/compileerrorfilter.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CompileErrorFilter_h
+#define CompileErrorFilter_h
+
+#include <qobject.h>
+#include <qregexp.h>
+#include <qvaluelist.h>
+#include "outputfilter.h"
+
+class MakeItem;
+
+class CompileErrorFilter : public QObject, public OutputFilter
+{
+Q_OBJECT
+
+public:
+ CompileErrorFilter( OutputFilter& );
+
+ struct ErrorFormat
+ {
+ ErrorFormat() {}
+ ErrorFormat( const char *, int, int, int );
+ ErrorFormat( const char *, int, int, int, QString );
+ QRegExp expression;
+ int fileGroup;
+ int lineGroup;
+ int textGroup;
+ QString compiler;
+ };
+ static ErrorFormat* errorFormats();
+
+ void processLine( const QString& line );
+
+signals:
+ void item( MakeItem* );
+};
+
+#endif
diff --git a/parts/outputviews/directorystatusmessagefilter.cpp b/parts/outputviews/directorystatusmessagefilter.cpp
new file mode 100644
index 00000000..5738f41d
--- /dev/null
+++ b/parts/outputviews/directorystatusmessagefilter.cpp
@@ -0,0 +1,187 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "directorystatusmessagefilter.h"
+#include "directorystatusmessagefilter.moc"
+#include "makeitem.h"
+
+#include <qregexp.h>
+#include <kdebug.h>
+
+DirectoryStatusMessageFilter::DirectoryStatusMessageFilter( OutputFilter& next )
+ : OutputFilter( next )
+{
+}
+
+void DirectoryStatusMessageFilter::processLine( const QString& line )
+{
+ QString dir;
+ if ( matchEnterDir( line, dir ) )
+ {
+ emit item( new EnteringDirectoryItem( dir, line ) );
+ }
+ else if ( matchLeaveDir( line, dir ) )
+ {
+ emit item( new ExitingDirectoryItem( dir, line ) );
+ }
+ else
+ {
+ OutputFilter::processLine( line );
+ }
+}
+
+// simple helper function - checks whether we entered a new directory
+// (locale and Utf8 aware)
+bool DirectoryStatusMessageFilter::matchEnterDir( const QString& line, QString& dir )
+{
+ // make outputs localised strings in Utf8 for entering/leaving directories...
+ static const unsigned short fr_enter[] =
+ {'E','n','t','r','e',' ','d','a','n','s',' ','l','e',' ','r',0xe9,'p','e','r','t','o','i','r','e'
+ };
+ static const unsigned short pl_enter[] =
+ {'W','c','h','o','d','z',0x119,' ','k','a','t','a','l','o','g'
+ };
+ static const unsigned short ja_enter[] =
+ {
+ 0x5165,0x308a,0x307e,0x3059,0x20,0x30c7,0x30a3,0x30ec,0x30af,0x30c8,0x30ea
+ };
+ static const unsigned short ko_enter[] =
+ {
+ 0xb4e4,0xc5b4,0xac10
+ };
+ static const unsigned short ko_behind[] =
+ {
+ 0x20,0xb514,0xb809,0xd1a0,0xb9ac
+ };
+ static const unsigned short pt_br_enter[] =
+ {
+ 0x45,0x6e,0x74,0x72,0x61,0x6e,0x64,0x6f,0x20,0x6e,0x6f,0x20,0x64,0x69,0x72,0x65,0x74,0xf3,0x72,0x69,0x6f
+ };
+ static const unsigned short ru_enter[] =
+ {
+ 0x412,0x445,0x43e,0x434,0x20,0x432,0x20,0x43a,0x430,0x442,0x430,0x43b,0x43e,0x433
+ };
+
+ static const QString fr_e( (const QChar*)fr_enter, sizeof(fr_enter) / 2 );
+ static const QString pl_e( (const QChar*)pl_enter, sizeof(pl_enter) / 2 );
+ static const QString ja_e( (const QChar*)ja_enter, sizeof(ja_enter) / 2 );
+ static const QString ko_e( (const QChar*)ko_enter, sizeof(ko_enter) / 2 );
+ static const QString ko_b( (const QChar*)ko_behind, sizeof(ko_behind) / 2 );
+ static const QString pt_br_e( (const QChar*)pt_br_enter, sizeof(pt_br_enter) / 2 );
+ static const QString ru_e( (const QChar*)ru_enter, sizeof(ru_enter) / 2 );
+ static const QString en_e("Entering directory");
+ static const QString de_e1("Wechsel in das Verzeichnis Verzeichnis");
+ static const QString de_e2("Wechsel in das Verzeichnis");
+ static const QString es_e("Cambiando a directorio");
+ static const QString nl_e("Binnengaan van directory");
+ //@todo: other translations!
+
+ // we need a QRegExp because KRegExp is not Utf8 aware.
+ // 0x00AB is LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ // 0X00BB is RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ static QRegExp dirChange(QString::fromLatin1(".*: (.+) (`|") + QChar(0x00BB) + QString::fromLatin1(")(.*)('|") + QChar(0x00AB) + QString::fromLatin1(")(.*)"));
+ static QRegExp enEnter(QString::fromLatin1(".*: Entering directory"));
+ kdDebug(9004) << "Directory filter line " << line << endl;
+
+ // avoid QRegExp if possible. This regex performs VERY badly with large inputs,
+ // and the input required is very short if these strings match.
+ if(line.find(en_e) > -1 ||
+ line.find(fr_e) > -1 ||
+ line.find(pl_e) > -1 ||
+ line.find(ja_e) > -1 ||
+ line.find(ko_e) > -1 ||
+ line.find(ko_b) > -1 ||
+ line.find(pt_br_e) > -1 ||
+ line.find(ru_e) > -1 ||
+ line.find(de_e1) > -1 ||
+ line.find(de_e2) > -1 ||
+ line.find(es_e) > -1 ||
+ line.find(nl_e) > -1)
+ {
+ // grab the directory name
+ if(dirChange.search(line) > -1)
+ {
+ dir = dirChange.cap(3);
+ return true;
+ }
+ }
+ return false;
+}
+
+// simple helper function - checks whether we left a directory
+// (locale and Utf8 aware).
+bool DirectoryStatusMessageFilter::matchLeaveDir( const QString& line, QString& dir )
+{
+ static const unsigned short fr_leave[] =
+ { 'Q','u','i','t','t','e',' ','l','e',' ','r',0xe9,'p','e','r','t','o','i','r','e'
+ };
+ static const unsigned short ja_leave[] =
+ {
+ 0x51fa,0x307e,0x3059,0x20,0x30c7,0x30a3,0x30ec,0x30af,0x30c8,0x30ea
+ };
+ static const unsigned short pt_br_leave[] =
+ {'S','a','i','n','d','o',' ','d','o',' ','d','i','r','e','t',0xf3,'r','i','o'
+ };
+ static const unsigned short ru_leave[] =
+ {
+ 0x412,0x44b,0x445,0x43e,0x434,0x20,0x438,0x437,0x20,0x43a,0x430,0x442,0x430,0x43b,0x43e,0x433
+ };
+ static const unsigned short ko_leave[] =
+ {
+ 0xb098,0xac10
+ };
+ static const unsigned short ko_behind[] =
+ {
+ 0x20,0xb514,0xb809,0xd1a0,0xb9ac
+ };
+
+ static const QString fr_l( (const QChar*)fr_leave, sizeof(fr_leave) / 2 );
+ static const QString ja_l( (const QChar*)ja_leave, sizeof(ja_leave) / 2 );
+ static const QString ko_l( (const QChar*)ko_leave, sizeof(ko_leave) / 2 );
+ static const QString ko_b( (const QChar*)ko_behind, sizeof(ko_behind) / 2 );
+ static const QString pt_br_l( (const QChar*)pt_br_leave, sizeof(pt_br_leave) / 2 );
+ static const QString ru_l( (const QChar*)ru_leave, sizeof(ru_leave) / 2 );
+ static const QString en_l("Leaving directory");
+ static const QString de_l1("Verlassen des Verzeichnisses Verzeichnis");
+ static const QString de_l2("Verlassen des Verzeichnisses");
+ static const QString es_l("Saliendo directorio");
+ static const QString nl_l("Verdwijnen uit directory");
+ static const QString po_l("Opuszczam katalog");
+
+ // we need a QRegExp because KRegExp is not Utf8 aware.
+ // 0x00AB is LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ // 0X00BB is RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+
+ static QRegExp dirChange(QString::fromLatin1(".*: (.+) (`|") + QChar(0x00BB) + QString::fromLatin1(")(.*)('|") + QChar(0x00AB) + QString::fromLatin1(")(.*)"));
+
+ // avoid QRegExp if possible. This regex performs VERY badly with large inputs,
+ // and the input required is very short if these strings match.
+ if(line.find(en_l) > -1 ||
+ line.find(fr_l) > -1 ||
+ line.find(ja_l) > -1 ||
+ (line.find(ko_l) > -1 && line.find(ko_b) > -1) ||
+ line.find(pt_br_l) > -1 ||
+ line.find(ru_l) > -1 ||
+ line.find(de_l1) > -1 ||
+ line.find(de_l2) > -1 ||
+ line.find(es_l) > -1 ||
+ line.find(nl_l) > -1 ||
+ line.find(po_l) > -1)
+ {
+ // grab the directory name
+ if(dirChange.search(line) > -1 )
+ {
+ dir = dirChange.cap(3);
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/parts/outputviews/directorystatusmessagefilter.h b/parts/outputviews/directorystatusmessagefilter.h
new file mode 100644
index 00000000..18972487
--- /dev/null
+++ b/parts/outputviews/directorystatusmessagefilter.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef DirectoryStatusMessageFilter_h
+#define DirectoryStatusMessageFilter_h
+
+#include <qobject.h>
+#include "outputfilter.h"
+
+class EnteringDirectoryItem;
+class ExitingDirectoryItem;
+
+class DirectoryStatusMessageFilter : public QObject, public OutputFilter
+{
+Q_OBJECT
+
+public:
+ DirectoryStatusMessageFilter( OutputFilter& );
+
+ void processLine( const QString& line );
+
+signals:
+ void item( EnteringDirectoryItem* );
+ void item( ExitingDirectoryItem* );
+
+private:
+ bool matchEnterDir( const QString& line, QString& dir );
+ bool matchLeaveDir( const QString& line, QString& dir );
+};
+
+#endif
diff --git a/parts/outputviews/filterdlg.ui b/parts/outputviews/filterdlg.ui
new file mode 100644
index 00000000..729af672
--- /dev/null
+++ b/parts/outputviews/filterdlg.ui
@@ -0,0 +1,164 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>FilterDlg</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>FilterDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>326</width>
+ <height>200</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Output Filter Settings</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup" row="0" column="0">
+ <property name="name">
+ <cstring>filtergroup</cstring>
+ </property>
+ <property name="title">
+ <string>Filter</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <property name="selectedId" stdset="0">
+ <number>-1</number>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Only show lines matching:</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>filterString</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>caseSensitive</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;ase sensitive</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>regularExpression</cstring>
+ </property>
+ <property name="text">
+ <string>Re&amp;gular expression</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>FilterDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>FilterDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>filterString</tabstop>
+ <tabstop>caseSensitive</tabstop>
+ <tabstop>regularExpression</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/parts/outputviews/kdevappoutputview.desktop b/parts/outputviews/kdevappoutputview.desktop
new file mode 100644
index 00000000..2460ad6d
--- /dev/null
+++ b/parts/outputviews/kdevappoutputview.desktop
@@ -0,0 +1,84 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Application Output View
+Comment[ca]=Visor de l'eixida de les aplicacions
+Comment[da]=Program-uddata fremvisning
+Comment[de]=Anwendungsausgabe für KDevelop
+Comment[el]=Προβολή εξόδου εφαρμογής
+Comment[es]=Visor de la salida de las aplicaciones
+Comment[et]=Rakenduse väljundi vaade
+Comment[eu]=Aplikazioen irteera ikustailua
+Comment[fa]=نمای خروجی کاربرد
+Comment[fr]=Fenêtre de sortie d'une application
+Comment[gl]=Vista da saída da aplicación
+Comment[hi]=अनुप्रयोग आउटपुट व्यू
+Comment[hu]=Alkalmazáskimenet-megjelenítő
+Comment[it]=Vista dell'output dell'applicazione
+Comment[ja]=アプリケーション出力ビュー
+Comment[ms]=Lihat Keluaran Aplikasi
+Comment[nds]=Programmutgaav-Kieker
+Comment[ne]=अनुप्रयोग निर्गत दृश्य
+Comment[nl]=Weergave van toepassingsuitvoer
+Comment[pl]=Widok wyjścia programu
+Comment[pt]=Vista do Resultado da Aplicação
+Comment[pt_BR]=Visão da Saída do Aplicativo
+Comment[ru]=Окно вывода приложения
+Comment[sk]=Pohľad na výstup aplikácie
+Comment[sl]=Prikaz programskega izhoda
+Comment[sr]=Приказ излаза апликације
+Comment[sr@Latn]=Prikaz izlaza aplikacije
+Comment[sv]=Programutmatningsvy
+Comment[ta]=பயன்பாட்டு வெளியீட்டுக் காட்சி
+Comment[tg]=Тирезаи хориҷ кардани гузориш
+Comment[tr]=Uygulama Çıktı Görünümü
+Comment[zh_CN]=应用程序输出查看器
+Comment[zh_TW]=應用程式輸出檢視
+Name=KDevAppOutputView
+Name[da]=KDevelop Program-uddata fremvisning
+Name[de]=Anwendungsausgabe (KDevelop)
+Name[hi]=के-डेव-एप्प-आउटपुट-व्यू
+Name[nds]=Programmutgaav-Kieker (KDevelop)
+Name[pl]=KDevAppWidokWyjścia
+Name[sk]=KDev pohľad na výstup aplikácie
+Name[sv]=KDevelop programutmatningsvy
+Name[ta]=KDevApp வெளியீட்டுக் காட்சி
+Name[zh_TW]=KDevelop 應用程式輸出檢視
+GenericName=Application Output View
+GenericName[ca]=Visor de l'eixida de les aplicacions
+GenericName[da]=Program-uddata fremvisning
+GenericName[de]=Anwendungsausgabe
+GenericName[el]=Προβολή εξόδου εφαρμογής
+GenericName[es]=Visor de la salida de las aplicaciones
+GenericName[et]=Rakenduse väljundi vaade
+GenericName[eu]=Aplikazioen irteera ikustailua
+GenericName[fa]=نمای خروجی کاربرد
+GenericName[fr]=Fenêtre de sortie d'une application
+GenericName[gl]=Vista da saída da aplicación
+GenericName[hi]=अनुप्रयोग आउटपुट व्यू
+GenericName[hu]=Alkalmazáskimenet-megjelenítő
+GenericName[it]=Visualizza l'output dell'applicazione
+GenericName[ja]=アプリケーション出力ビュー
+GenericName[nds]=Programmutgaav-Kieker
+GenericName[ne]=अनुप्रयोग निर्गत दृश्य
+GenericName[nl]=Weergave van toepassingsuitvoer
+GenericName[pl]=Widok wyjścia programu
+GenericName[pt]=Vista do Resultado da Aplicação
+GenericName[pt_BR]=Visão da Saída do Aplicativo
+GenericName[ru]=Окно вывода приложения
+GenericName[sk]=Pohľad na výstup aplikácie
+GenericName[sl]=Prikaz programskega izhoda
+GenericName[sr]=Приказ излаза апликације
+GenericName[sr@Latn]=Prikaz izlaza aplikacije
+GenericName[sv]=Programutmatningsvy
+GenericName[ta]=பயன்பாட்டு வெளியீட்டுக் காட்சி
+GenericName[tg]=Тирезаи хориҷ кардани гузориш
+GenericName[tr]=Uygulama Çıktı Görünümü
+GenericName[zh_CN]=应用程序输出查看器
+GenericName[zh_TW]=應用程式輸出檢視
+Icon=exec
+ServiceTypes=KDevelop/AppFrontend
+X-KDE-Library=libkdevappview
+X-KDevelop-Version=5
+X-KDevelop-Scope=Core
+X-KDevelop-Properties=OutputTool
diff --git a/parts/outputviews/kdevmakeview.desktop b/parts/outputviews/kdevmakeview.desktop
new file mode 100644
index 00000000..e4498d0a
--- /dev/null
+++ b/parts/outputviews/kdevmakeview.desktop
@@ -0,0 +1,87 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Compiler Frontend
+Comment[ca]=Entorn per al compilador
+Comment[da]=Grænseflade til oversætter
+Comment[de]=Make-Ausgabe für KDevelop
+Comment[el]=Πρόγραμμα μεταγλωττιστή
+Comment[es]=Entorno para el compilador
+Comment[et]=Kompilaatori kasutajaliides
+Comment[eu]=Konpiladore interfazea
+Comment[fa]=پایانۀ مترجم
+Comment[fr]=Interface pour le compilateur
+Comment[ga]=Comhéadan Tiomsaitheora
+Comment[gl]=Frontal para o compilador
+Comment[hi]=कम्पायलर फ्रन्टएण्ड
+Comment[hu]=Grafikus felület fordítóprogramokhoz
+Comment[it]=Interfaccia al compilatore
+Comment[ja]=コンパイラフロントエンド
+Comment[ms]=Frontend Penghimpun
+Comment[nds]=Kompilerer-Böversiet
+Comment[ne]=कम्पाइलर फ्रन्टइन्ड
+Comment[nl]=Compiler-frontend
+Comment[pl]=Interfejs do kompilatora
+Comment[pt]=Interface de Compilador
+Comment[pt_BR]=Frontend do Compilador
+Comment[ru]=Интерфейс к компилятору
+Comment[sk]=Rozhranie kompilátora
+Comment[sl]=Vmesnik prevajalnika
+Comment[sr]=Кориснички интерфејс за преводилац
+Comment[sr@Latn]=Korisnički interfejs za prevodilac
+Comment[sv]=Kompilatorgränssnitt
+Comment[ta]=முன்பகுதி தொகுப்பான்
+Comment[tg]=Интерфейс ба талфифгар
+Comment[tr]=Derleyici Önucu
+Comment[zh_CN]=编译器前端
+Comment[zh_TW]=編譯器前端介面
+Name=KDevMakeView
+Name[da]=KDevelop Make-visning
+Name[de]=Make-Ausgabe (KDevelop)
+Name[hi]=के-डेव-मेक-व्यू
+Name[nds]=Make-Kieker (KDevelop)
+Name[pl]=KDevWIdokMake
+Name[sk]=KDev pohľad na make
+Name[sv]=KDevelop byggvy
+Name[ta]=KDev காட்சியாக்கு
+Name[zh_TW]=KDevelop Make 檢視
+GenericName=Compiler Frontend
+GenericName[ca]=Entorn per al compilador
+GenericName[da]=Grænseflade til oversætter
+GenericName[de]=Make-Ausgabe
+GenericName[el]=Πρόγραμμα μεταγλωττιστή
+GenericName[es]=Entorno para el compilador
+GenericName[et]=Kompilaatori kasutajaliides
+GenericName[eu]=Konpiladore interfazea
+GenericName[fa]=پایانۀ مترجم
+GenericName[fr]=Interface pour le compilateur
+GenericName[ga]=Comhéadan Tiomsaitheora
+GenericName[gl]=Frontal para o compilador
+GenericName[hi]=कम्पायलर फ्रन्टएण्ड
+GenericName[hu]=Grafikus felület fordítóprogramokhoz
+GenericName[it]=Interfaccia al compilatore
+GenericName[ja]=コンパイラフロントエンド
+GenericName[ms]=Frontend Penghimpun
+GenericName[nds]=Kompilerer-Böversiet
+GenericName[ne]=कम्पाइलर फ्रन्टइन्ड
+GenericName[nl]=Compiler-frontend
+GenericName[pl]=Interfejs do kompilatora
+GenericName[pt]=Interface de Compilador
+GenericName[pt_BR]=Frontend do Compilador
+GenericName[ru]=Интерфейс к компилятору
+GenericName[sk]=Rozhranie kompilátor
+GenericName[sl]=Vmesnik prevajalnika
+GenericName[sr]=Кориснички интерфејс преводиоца
+GenericName[sr@Latn]=Korisnički interfejs prevodioca
+GenericName[sv]=Kompilatorgränssnitt
+GenericName[ta]=முன் பகுதி தொகுப்பான்
+GenericName[tg]=Интерфейс ба талфифгар
+GenericName[tr]=Derleyici Önucu
+GenericName[zh_CN]=编译器前端
+GenericName[zh_TW]=編譯器前端介面
+Icon=konsole
+ServiceTypes=KDevelop/MakeFrontend
+X-KDE-Library=libkdevmakeview
+X-KDevelop-Version=5
+X-KDevelop-Scope=Core
+X-KDevelop-Properties=OutputTool
diff --git a/parts/outputviews/kdevmakeview.rc b/parts/outputviews/kdevmakeview.rc
new file mode 100644
index 00000000..fc8c82f6
--- /dev/null
+++ b/parts/outputviews/kdevmakeview.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevMakeView" version="1">
+<MenuBar>
+ <Menu name="view">
+ <Action name="view_next_error" group="error_operations"/>
+ <Action name="view_previous_error" group="error_operations"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/parts/outputviews/makeactionfilter.cpp b/parts/outputviews/makeactionfilter.cpp
new file mode 100644
index 00000000..bbcc61fb
--- /dev/null
+++ b/parts/outputviews/makeactionfilter.cpp
@@ -0,0 +1,319 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qdatetime.h>
+#include <kdebug.h>
+
+#include "makeactionfilter.h"
+#include "makeactionfilter.moc"
+#include "makeitem.h"
+
+#include <klocale.h>
+
+//#define DEBUG
+
+MakeActionFilter::ActionFormat::ActionFormat( const QString& _action, const QString& _tool, const char * regExp, int file )
+ : m_action( _action )
+ , m_expression( regExp )
+ , m_tool( _tool )
+ , m_toolGroup(-1)
+ , m_fileGroup( file )
+{
+}
+
+MakeActionFilter::ActionFormat::ActionFormat( const QString& _action, int tool, int file, const char * regExp)
+ : m_action( _action )
+ , m_expression( regExp )
+ , m_tool()
+ , m_toolGroup(tool)
+ , m_fileGroup( file )
+{
+}
+
+QString MakeActionFilter::ActionFormat::tool()
+{
+ if (m_toolGroup==-1)
+ return m_tool;
+ return m_expression.cap(m_toolGroup);
+}
+
+QString MakeActionFilter::ActionFormat::file()
+{
+ return m_expression.cap(m_fileGroup);
+}
+
+bool MakeActionFilter::ActionFormat::matches(const QString& line)
+{
+ return ( m_expression.search( line ) != -1 );
+}
+
+
+MakeActionFilter::MakeActionFilter( OutputFilter& next )
+ : OutputFilter( next )
+{
+
+#ifdef DEBUG
+ test();
+#endif
+}
+
+//NOTE: whenever you discover a case that is not correctly recognized by the filter, please add it as a test
+//item and be sure that your modifications don't break the already existing test cases.
+
+// returns an array of ActionFormat
+MakeActionFilter::ActionFormat* MakeActionFilter::actionFormats()
+{
+ static ActionFormat formats[] = {
+ ActionFormat( i18n("compiling"), 1, 2, "(?:^|[^=])\\b(gcc|CC|cc|distcc|c\\+\\+|g\\+\\+)\\s+.*-c.*[/ '\\\\]+(\\w+\\.(?:cpp|CPP|c|C|cxx|CXX|cs|java|hpf|f|F|f90|F90|f95|F95))"),
+ ActionFormat( i18n("compiling"), 1, 1, "^compiling (.*)" ), //unsermake
+ ActionFormat( i18n("compiling"), 1, 1, "\\[.+%\\] Building .* object (.*)" ), //cmake
+
+ ActionFormat( i18n("built"), 1, 1, "\\[.+%\\] Built target (.*)" ), //cmake
+ ActionFormat( i18n("generating"), 1, 1, "\\[.+%\\] Generating (.*)" ), //cmake
+
+ //moc and uic
+ ActionFormat( i18n("generating"), 1, 2, "/(moc|uic)\\b.*\\s-o\\s([^\\s;]+)"),
+ ActionFormat( i18n("generating"), 1, 2, "^generating (.*)" ), //unsermake
+
+ ActionFormat( i18n("linking"), "libtool", "/bin/sh\\s.*libtool.*--mode=link\\s.*\\s-o\\s([^\\s;]+)", 1 ),
+ //can distcc link too ?
+ ActionFormat( i18n("linking"), 1, 2, "(gcc|CC|cc|c\\+\\+|g\\+\\+)\\S* (?:\\S* )*-o ([^\\s;]+)"),
+ ActionFormat( i18n("linking"), 1, 2, "^linking (.*)" ), //unsermaker
+ ActionFormat( i18n("linking"), 1, 1, "^Linking .* module (.*)" ), //cmake
+ ActionFormat( i18n("linking"), 1, 1, "^Linking (.*)" ), //cmake
+
+ ActionFormat( i18n("creating"), "", "/(?:bin/sh\\s.*mkinstalldirs).*\\s([^\\s;]+)", 1 ),
+ ActionFormat( i18n("installing"), "", "/(?:usr/bin/install|bin/sh\\s.*mkinstalldirs|bin/sh\\s.*libtool.*--mode=install).*\\s([^\\s;]+)", 1 ),
+ ActionFormat( i18n("generating"), "dcopidl", "dcopidl .* > ([^\\s;]+)", 1 ),
+ ActionFormat( i18n("compiling"), "dcopidl2cpp", "dcopidl2cpp (?:\\S* )*([^\\s;]+)", 1 ),
+ ActionFormat( i18n("installing"), 1, 1, "-- Installing (.*)" ), //cmake
+
+ ActionFormat( QString::null, QString::null, 0, 0 )
+ };
+
+ return formats;
+}
+
+void MakeActionFilter::processLine( const QString& line )
+{
+ ActionItem* actionItem = matchLine( line );
+ if ( actionItem != NULL )
+ {
+ emit item( actionItem );
+ }
+ else
+ {
+ OutputFilter::processLine( line );
+ }
+}
+
+ActionItem* MakeActionFilter::matchLine( const QString& line )
+{
+#ifdef DEBUG
+ QTime t;
+ t.start();
+#endif
+ /// \FIXME This is very slow, possibly due to the regexr matching. It can take
+ //900-1000ms to execute on an Athlon XP 2000+, while the UI is completely blocked.
+ int i = 0;
+ ActionFormat* aFormats = actionFormats();
+ ActionFormat* format = &aFormats[i];
+
+ while ( !format->action().isNull() )
+ {
+// kdDebug(9004) << "Testing filter: " << format->action << ": " << format->tool << endl;
+ if ( format->matches( line ) )
+ {
+ ActionItem *actionItem = new ActionItem( format->action(), format->file(), format->tool(), line );
+ kdDebug( 9004 ) << "Found: " << actionItem->m_action << " " << actionItem->m_file << "(" << actionItem->m_tool << ")" << endl;
+ return actionItem;
+ }
+#ifdef DEBUG
+ if ( t.elapsed() > 100 )
+ kdDebug(9004) << "MakeActionFilter::processLine: SLOW regexp matching: " << t.elapsed() << " ms \n";
+#endif
+ format = &aFormats[++i];
+ }
+ return 0;
+}
+
+struct TestItem
+{
+ TestItem() {}
+ TestItem( const QString& _line, const QString& _action, const QString& _tool, const QString& _file )
+ : line( _line )
+ , action( _action )
+ , tool( _tool )
+ , file( _file )
+ {}
+ QString line;
+ QString action;
+ QString tool;
+ QString file;
+};
+
+#ifdef DEBUG
+
+void MakeActionFilter::test()
+{
+ static QValueList<TestItem> testItems = QValueList<TestItem>()
+
+ << TestItem( // simple qmake compile
+ "g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
+ "-I/home/john/src/kde/qt-copy/include -o test.o test.cpp",
+ "compiling", "g++", "test.cpp" )
+ << TestItem( // simple qmake compile different option order
+ "g++ -c -o test.o -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/home/john/src/kde/qt-copy/mkspecs/default -I. "
+ "-I/home/john/src/kde/qt-copy/include test.cpp",
+ "compiling", "g++", "test.cpp" )
+ << TestItem( // simple qmake link
+ "g++ -o ../bin/test test.o -Wl,-rpath,/home/john/src/kde/qt-copy/lib -L/home/john/src/kde/qt-copy/lib "
+ "-L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm",
+ "linking", "g++", "../bin/test" )
+ << TestItem( // automake 1.7, srcdir != builddir
+ "if /bin/sh ../../libtool --silent --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. "
+ "-I/home/john/src/kde/kdevelop/lib/interfaces -I../.. -I/usr/local/kde/include -I/home/john/src/kde/qt-copy/include "
+ "-I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic -W "
+ "-Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion "
+ "-Wchar-subscripts -fno-builtin -g3 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new "
+ "-fno-common -MT kdevcore.lo -MD -MP -MF \".deps/kdevcore.Tpo\" -c -o kdevcore.lo `test -f "
+ "'/home/john/src/kde/kdevelop/lib/interfaces/kdevcore.cpp' || echo "
+ "'/home/john/src/kde/kdevelop/lib/interfaces/'`/home/john/src/kde/kdevelop/lib/interfaces/kdevcore.cpp; then mv "
+ "\".deps/kdevcore.Tpo\" \".deps/kdevcore.Plo\"; else rm -f \".deps/kdevcore.Tpo\"; exit 1; fi",
+ "compiling", "g++", "kdevcore.cpp" )
+ << TestItem( // automake 1.7, srcdir != builddir
+ "if g++ -DHAVE_CONFIG_H -I. -I/home/john/src/kde/kdevelop/src -I.. -I/home/john/src/kde/kdevelop/lib/interfaces "
+ "-I/home/john/src/kde/kdevelop/lib/sourceinfo -I/home/john/src/kde/kdevelop/lib/util -I/home/john/src/kde/kdevelop/lib "
+ "-I/home/john/src/kde/kdevelop/lib/qextmdi/include -I/home/john/src/kde/kdevelop/lib/structure -I/usr/local/kde/include "
+ "-I/home/john/src/kde/qt-copy/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor "
+ "-Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi "
+ "-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -fno-builtin -g3 -Wformat-security "
+ "-Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -MT mainwindowideal.o -MD -MP -MF "
+ "\".deps/mainwindowideal.Tpo\" -c -o mainwindowideal.o `test -f '/home/john/src/kde/kdevelop/src/mainwindowideal.cpp' "
+ "|| echo '/home/john/src/kde/kdevelop/src/'`/home/john/src/kde/kdevelop/src/mainwindowideal.cpp; then mv "
+ "\".deps/mainwindowideal.Tpo\" \".deps/mainwindowideal.Po\"; else rm -f \".deps/mainwindowideal.Tpo\"; exit 1; fi",
+ "compiling", "g++", "mainwindowideal.cpp" )
+ << TestItem( // automake and libtool compiling *.c files
+ "if /bin/sh ../../libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../lib/interfaces"
+ "-I../../lib/util -I/opt/kde3/include -I/usr/lib/qt3/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT "
+ "-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings "
+ "-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -g3 -fno-inline -Wformat-security -Wmissing-format-attribute -MT readtags.lo "
+ "-MD -MP -MF \".deps/readtags.Tpo\" -c -o readtags.lo readtags.c; then mv -f \".deps/readtags.Tpo\" "
+ "\".deps/readtags.Plo\"; else rm -f \".deps/readtags.Tpo\"; exit 1; fi",
+ i18n("compiling"), "gcc", "readtags.c" )
+ << TestItem(
+ "source='makewidget.cpp' object='makewidget.lo' libtool=yes depfile='.deps/makewidget.Plo' "
+ "tmpdepfile='.deps/makewidget.TPlo' depmode=gcc3 /bin/sh ../../admin/depcomp /bin/sh ../../libtool --mode=compile "
+ "--tag=CXX g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../lib/interfaces -I../../lib/util -I/opt/kde3/include "
+ "-I/usr/lib/qt3/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -Wnon-virtual-dtor -Wno-long-long -Wundef "
+ "-Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE "
+ "-Wcast-align -Wconversion -fno-builtin -g -O2 -g3 -O0 -fno-exceptions -fno-check-new -c -o makewidget.lo `test -f "
+ "'makewidget.cpp' || echo './'`makewidget.cpp",
+ "compiling", "g++", "makewidget.cpp" )
+ << TestItem( // automake 1.7, srcdir != builddir
+ "/bin/sh ../../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic "
+ "-W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align "
+ "-Wconversion -Wchar-subscripts -fno-builtin -g3 -Wformat-security -Wmissing-format-attribute -fno-exceptions "
+ "-fno-check-new -fno-common -o libkdevoutputviews.la.closure libkdevoutputviews_la_closure.lo -L/usr/X11R6/lib "
+ "-L/home/john/src/kde/qt-copy/lib -L/usr/local/kde/lib -avoid-version -module -no-undefined -R /usr/local/kde/lib "
+ "-R /home/john/src/kde/qt-copy/lib -R /usr/X11R6/lib outputviewsfactory.lo makeviewpart.lo makewidget.lo "
+ "appoutputviewpart.lo appoutputwidget.lo directorystatusmessagefilter.lo outputfilter.lo compileerrorfilter.lo "
+ "commandcontinuationfilter.lo makeitem.lo makeactionfilter.lo otherfilter.lo ../../lib/libkdevelop.la",
+ "linking", "libtool", "libkdevoutputviews.la.closure" )
+ << TestItem( //libtool, linking 2
+ "/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic "
+ "-W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts "
+ "-fno-builtin -g3 -fno-exceptions -fno-check-new -fno-common -o libkfilereplacepart.la.closure libkfilereplacepart_la_closure.lo "
+ "-module -no-undefined -L/usr/X11R6/lib -L/usr/lib/qt3/lib -L/opt/kde3/lib -version-info 1:0:0 kfilereplacepart.lo kfilereplacedoc.lo "
+ "kfilereplaceview.lo kaboutkfilereplace.lo kaddstringdlg.lo kconfirmdlg.lo kernel.lo kexpression.lo kfilereplacepref.lo "
+ "klistviewstring.lo knewprojectdlg.lo koptionsdlg.lo kresultview.lo filelib.lo knewprojectdlgs.lo -lkio -lkparts -lkhtml",
+ "linking", "libtool", "libkfilereplacepart.la.closure")
+ << TestItem( //libtool, linking 3
+ "/bin/sh ../libtool --silent --mode=link --tag=CXX g++ -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -pedantic "
+ "-W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts "
+ "-fno-builtin -g3 -fno-exceptions -fno-check-new -fno-common -o libkfilereplacepart.la -rpath /opt/kde3/lib/kde3 "
+ "-module -no-undefined -L/usr/X11R6/lib -L/usr/lib/qt3/lib -L/opt/kde3/lib -version-info 1:0:0 kfilereplacepart.lo "
+ "kfilereplacedoc.lo kfilereplaceview.lo kaboutkfilereplace.lo kaddstringdlg.lo kconfirmdlg.lo kernel.lo kexpression.lo "
+ "kfilereplacepref.lo klistviewstring.lo knewprojectdlg.lo koptionsdlg.lo kresultview.lo filelib.lo knewprojectdlgs.lo -lkio -lkparts -lkhtml",
+ "linking", "libtool", "libkfilereplacepart.la")
+ << TestItem( //automake, builddir!=srcdir, libtool=no, compiling
+ " g++ -DHAVE_CONFIG_H -I. -I/home/andris/cvs-developement/head/quanta/quanta/project "
+ "-I../.. -I/home/andris/cvs-developement/head/quanta/quanta/dialogs -I/opt/kde3/include -I/usr/lib/qt3/include -I/usr/X11R6/include "
+ "-I../../quanta/dialogs -DQT_THREAD_SUPPORT -D_REENTRANT -DKOMMANDER -DDESIGNER -DQT_NO_SQL -DHAVE_KDE -Wnon-virtual-dtor "
+ "-Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE "
+ "-Wcast-align -Wconversion -Wchar-subscripts -fno-builtin -g3 -DKDE_NO_COMPAT -fno-exceptions -fno-check-new -fno-common -c -o project.o "
+ "`test -f '/home/andris/cvs-developement/head/quanta/quanta/project/project.cpp' || "
+ "echo '/home/andris/cvs-developement/head/quanta/quanta/project/'`/home/andris/cvs-developement/head/quanta/quanta/project/project.cpp ",
+ "compiling", "g++", "project.cpp")
+ << TestItem(
+ "/usr/local/kde/bin/dcopidl /home/john/src/kde/kdevelop/lib/interfaces/KDevAppFrontendIface.h > KDevAppFrontendIface.kidl "
+ "|| ( rm -f KDevAppFrontendIface.kidl ; /bin/false )",
+ "generating", "dcopidl", "KDevAppFrontendIface.kidl" )
+ << TestItem(
+ "/usr/local/kde/bin/dcopidl2cpp --c++-suffix cpp --no-signals --no-stub KDevAppFrontendIface.kidl",
+ "compiling", "dcopidl2cpp", "KDevAppFrontendIface.kidl" )
+ << TestItem( //install
+ "/usr/bin/install -c -p -m 644 /home/andris/development/quanta/quanta/kommander/editor/kmdr-editor.desktop "
+ "/opt/kde3/share/applnk/Editors/kmdr-editor.desktop", "installing", "", "/opt/kde3/share/applnk/Editors/kmdr-editor.desktop")
+ << TestItem( //libtool install
+ "/bin/sh ../../libtool --silent --mode=install /usr/bin/install -c -p libkommanderwidgets.la "
+ "/opt/kde3/lib/libkommanderwidgets.la", "installing", "", "/opt/kde3/lib/libkommanderwidgets.la")
+ << TestItem( //libtool, automake 1.8
+ "if g++ -DHAVE_CONFIG_H -I. -I/home/andris/ "
+ "-DBUILD_KAFKAPART -MT quanta_init.o -MD -MP -MF \".deps/quanta_init.Tpo\" -c -o quanta_init.o "
+ "quanta_init.cpp; "
+ "then mv -f \".deps/quanta_init.Tpo\" \".deps/quanta_init.Po\"; else rm -f \".deps/quanta_init.Tpo\"; "
+ "exit 1; fi",
+ "compiling", "g++", "quanta_init.cpp")
+ << TestItem( //libtool, automake 1.8, file with full path
+ "if g++ -DHAVE_CONFIG_H -I. -I/home/andris/ "
+ "-DBUILD_KAFKAPART -MT quanta_init.o -MD -MP -MF \".deps/quanta_init.Tpo\" -c -o quanta_init.o "
+ "/home/andris/quanta_init.cpp; "
+ "then mv -f \".deps/quanta_init.Tpo\" \".deps/quanta_init.Po\"; else rm -f \".deps/quanta_init.Tpo\"; "
+ "exit 1; fi",
+ "compiling", "g++", "quanta_init.cpp")
+ ;
+
+ QValueList<TestItem>::const_iterator it = testItems.begin();
+ for( ; it != testItems.end(); ++it )
+ {
+ ActionItem* actionItem = matchLine( (*it).line );
+ if ( actionItem == NULL )
+ {
+ kdError( 9004 ) << "MakeActionFilter::test(): match failed (no match):" << endl;
+ kdError( 9004 ) << (*it).line << endl;
+ }
+ else if ( actionItem->m_action != (*it).action )
+ {
+ kdError( 9004 ) << "MakeActionFilter::test(): match failed (expected action "
+ << (*it).action << ", got " << actionItem->m_action << endl;
+ kdError( 9004 ) << (*it).line << endl;
+ }
+ else if ( actionItem->m_tool != (*it).tool )
+ {
+ kdError( 9004 ) << "MakeActionFilter::test(): match failed (expected tool "
+ << (*it).tool << ", got " << actionItem->m_tool << endl;
+ kdError( 9004 ) << (*it).line << endl;
+ }
+ else if ( actionItem->m_file != (*it).file )
+ {
+ kdError( 9004 ) << "MakeActionFilter::test(): match failed (expected file "
+ << (*it).file << ", got " << actionItem->m_file << endl;
+ kdError( 9004 ) << (*it).line << endl;
+ } else
+ kdDebug( 9004 ) << "Test passed, " << actionItem->m_action << " " << actionItem->m_file << " (" << actionItem->m_tool << ") found." << endl;
+ if ( actionItem != NULL )
+ delete actionItem;
+ }
+
+}
+
+#endif
diff --git a/parts/outputviews/makeactionfilter.h b/parts/outputviews/makeactionfilter.h
new file mode 100644
index 00000000..66de7a3b
--- /dev/null
+++ b/parts/outputviews/makeactionfilter.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MakeActionFilter_h
+#define MakeActionFilter_h
+
+#include <qobject.h>
+#include <qregexp.h>
+#include <qvaluelist.h>
+#include "outputfilter.h"
+
+class MakeItem;
+class ActionItem;
+
+class MakeActionFilter : public QObject, public OutputFilter
+{
+Q_OBJECT
+
+public:
+#ifdef DEBUG
+ static void test();
+#endif
+
+ MakeActionFilter( OutputFilter& );
+
+ class ActionFormat
+ {
+ public:
+ ActionFormat():m_toolGroup(-1) {}
+ ActionFormat( const QString&, const QString&, const char * regExp, int file);
+ ActionFormat( const QString&, int tool, int file, const char * regExp);
+ QString tool();
+ QString file();
+ const QString& action() const {return m_action;}
+ bool matches(const QString& line);
+ private:
+ QString m_action;
+ QRegExp m_expression;
+ QString m_tool;
+ int m_toolGroup;
+ int m_fileGroup;
+ };
+ static ActionFormat* actionFormats();
+
+ void processLine( const QString& line );
+
+signals:
+ void item( MakeItem* );
+
+private:
+ static ActionItem* matchLine( const QString& line );
+};
+
+#endif
diff --git a/parts/outputviews/makeitem.cpp b/parts/outputviews/makeitem.cpp
new file mode 100644
index 00000000..c4d5a04c
--- /dev/null
+++ b/parts/outputviews/makeitem.cpp
@@ -0,0 +1,166 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "makeitem.h"
+
+#include <qstylesheet.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include "ktexteditor/cursorinterface.h"
+
+MakeItem::MakeItem()
+{
+}
+
+MakeItem::MakeItem( const QString& text )
+ : m_text( text )
+{
+}
+
+MakeItem::~MakeItem()
+{
+}
+
+QString MakeItem::color( bool bright_bg )
+{
+ switch ( type() )
+ {
+ case Error:
+ return bright_bg ? "maroon" : "red";
+ case Warning:
+ return bright_bg ? "#666" : "#999";
+ case Diagnostic:
+ return bright_bg ? "black" : "white";
+ default:
+ return bright_bg ? "navy" : "blue";
+ }
+}
+
+QString MakeItem::icon()
+{
+ switch ( type() )
+ {
+ case Error:
+ case Warning:
+ return "<img src=\"error\"></img><nobr> </nobr>";
+ case Diagnostic:
+ return "<img src=\"warning\"></img><nobr> </nobr>";
+ default:
+ return "<img src=\"message\"></img><nobr> </nobr>";
+ }
+}
+
+QString MakeItem::text( EOutputLevel )
+{
+ return QStyleSheet::escape( m_text );
+}
+
+QString MakeItem::formattedText( EOutputLevel level, bool bright_bg )
+{
+ QString txt = text(level);
+ if (txt.isEmpty())
+ return "<br>";
+ if ( level == eFull )
+ {
+ return txt;
+ }
+ else
+ {
+ return QString("<code>")
+ .append( icon() ).append("<font color=\"").append( color( bright_bg) ).append("\">")
+ .append( txt ).append("</font></code>").append( br() );
+ }
+}
+
+QString MakeItem::br()
+{
+ // Qt >= 3.1 doesn't need a <br>.
+#if QT_VERSION < 0x040000
+ static const QString br = QString::fromLatin1( qVersion() ).section( ".", 1, 1 ).toInt() > 0 ? "" : "<br>";
+#else
+ static const QString br;
+#endif
+ return br;
+}
+
+ErrorItem::ErrorItem( const QString& fn, int ln, const QString& tx, const QString& line, bool isWarning, bool isInstatiationInfo, const QString& compiler )
+ : MakeItem( line )
+ , fileName(fn)
+ , lineNum(ln)
+ , m_error(tx)
+ , m_isWarning(isWarning | isInstatiationInfo)
+ , m_isInstatiationInfo( isInstatiationInfo )
+ , m_compiler(compiler)
+{}
+
+ErrorItem::~ErrorItem()
+{
+}
+
+bool ErrorItem::append( const QString& text )
+{
+ if ( !text.startsWith(" ") )
+ return false;
+ if ( text.startsWith(" ") && (m_compiler == "intel") )
+ return false;
+ m_text += text;
+ m_error += text;
+ m_error = m_error.simplifyWhiteSpace();
+ m_text = m_text.simplifyWhiteSpace();
+ return true;
+}
+
+ExitStatusItem::ExitStatusItem( bool normalExit, int exitStatus )
+ : m_normalExit( normalExit )
+ , m_exitStatus( exitStatus )
+{
+// kdDebug() << "ExitStatusItem: normalExit=" << normalExit << "; exitStatus=" << exitStatus << endl;
+ m_text = i18n("*** Compilation aborted ***");
+ if ( m_normalExit )
+ if (m_exitStatus )
+ m_text = i18n("*** Exited with status: %1 ***").arg( m_exitStatus );
+ else
+ m_text = i18n("*** Success ***");
+}
+
+QString ExitStatusItem::text( EOutputLevel )
+{
+ return m_text;
+}
+
+bool DirectoryItem::m_showDirectoryMessages = true;
+
+QString EnteringDirectoryItem::text( EOutputLevel outputLevel )
+{
+ if ( outputLevel < eFull )
+ return i18n("Entering directory %1").arg( directory );
+ return m_text;
+}
+
+QString ExitingDirectoryItem::text( EOutputLevel outputLevel )
+{
+ if ( outputLevel < eFull )
+ return i18n("Leaving directory %1").arg( directory );
+ return m_text;
+}
+
+QString ActionItem::text( EOutputLevel outputLevel )
+{
+ if ( outputLevel < eFull )
+ {
+ if ( m_tool.isEmpty() )
+ return QString(m_action).append(" <b>").append(m_file).append("</b>");
+ return QString(m_action).append(" <b>").append(m_file).append("</b>").append(" (").append(m_tool).append(")");
+ }
+ return MakeItem::text( outputLevel );
+}
diff --git a/parts/outputviews/makeitem.h b/parts/outputviews/makeitem.h
new file mode 100644
index 00000000..e95dd4df
--- /dev/null
+++ b/parts/outputviews/makeitem.h
@@ -0,0 +1,164 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MakeItem_h
+#define MakeItem_h
+
+#include <qstring.h>
+
+enum EOutputLevel
+{
+ // appropriate to the ID's in the button group of settingswidget.ui
+ eVeryShort = 0
+ ,eShort
+ ,eFull
+};
+
+class MakeItem
+{
+public:
+ enum Type { Normal, Error, Warning, Diagnostic };
+ MakeItem();
+ MakeItem( const QString& text );
+ virtual ~MakeItem();
+
+ enum DisplayModes
+ {
+ DelayedDisplay = 0, // item can be displayed later
+ ImmDisplay = 1, // item has to be displayed ASAP
+ Append = 2 // item's text can be appended (append has been overloaded)
+ };
+ virtual int displayMode() const { return ImmDisplay; }
+ virtual bool append( const QString& ) { return false; }
+ virtual Type type() { return Diagnostic; }
+ virtual bool visible( EOutputLevel level ) { return level > eVeryShort; }
+ virtual QString text( EOutputLevel );
+ virtual QString formattedText( EOutputLevel, bool bright_bg );
+ QString icon();
+ QString color( bool bright_bg );
+
+ static QString br();
+
+ QString m_text;
+};
+
+class CommandItem : public MakeItem
+{
+public:
+ CommandItem(const QString command)
+ : MakeItem( command )
+ {}
+
+ Type type() { return Diagnostic; }
+ virtual bool visible( EOutputLevel ) { return true; }
+};
+
+class ExitStatusItem : public MakeItem
+{
+public:
+ ExitStatusItem( bool normalExit, int exitStatus );
+
+ Type type() { return m_normalExit && m_exitStatus == 0 ? Diagnostic : Error; }
+ virtual bool visible( EOutputLevel ) { return true; }
+ QString text( EOutputLevel level );
+
+private:
+ bool m_normalExit;
+ int m_exitStatus;
+};
+
+class DirectoryItem : public MakeItem
+{
+public:
+ DirectoryItem( const QString& dir, const QString& text )
+ : MakeItem( text )
+ , directory( dir )
+ {}
+
+ Type type() { return Diagnostic; }
+
+ static void setShowDirectoryMessages( bool show ) { m_showDirectoryMessages = show; }
+ static bool getShowDirectoryMessages() { return m_showDirectoryMessages; }
+
+ QString directory;
+
+protected:
+ static bool m_showDirectoryMessages;
+};
+
+class EnteringDirectoryItem : public DirectoryItem
+{
+public:
+ EnteringDirectoryItem( const QString& dir, const QString& text )
+ : DirectoryItem( dir, text )
+ {}
+ bool visible( EOutputLevel )
+ {
+ return m_showDirectoryMessages;
+ }
+
+ virtual QString text( EOutputLevel );
+};
+
+class ExitingDirectoryItem : public DirectoryItem
+{
+public:
+ ExitingDirectoryItem( const QString& dir, const QString& text )
+ : DirectoryItem( dir, text )
+ {}
+ bool visible( EOutputLevel level )
+ {
+ return m_showDirectoryMessages && level > eVeryShort;
+ }
+
+ virtual QString text( EOutputLevel );
+};
+
+namespace KTextEditor { class Cursor; class Document; }
+
+class ErrorItem : public MakeItem
+{
+public:
+ ErrorItem( const QString& fn, int ln, const QString& tx, const QString& line, bool isWarning, bool isInstatiationInfo, const QString& compiler );
+ virtual ~ErrorItem();
+
+ virtual bool append( const QString& text );
+ virtual int displayMode() const { return DelayedDisplay | Append; }
+ Type type() { return m_isInstatiationInfo ? Diagnostic : (m_isWarning ? Warning : Error); }
+ virtual bool visible( EOutputLevel ) { return true; }
+
+ QString fileName;
+ int lineNum;
+ QString m_error;
+ bool m_isWarning;
+ bool m_isInstatiationInfo; ///this also implies isWarning
+ QString m_compiler;
+};
+
+class ActionItem : public MakeItem
+{
+public:
+ ActionItem( const QString& action, const QString& file, const QString& tool, const QString& line )
+ : MakeItem( line )
+ , m_action( action )
+ , m_file( file )
+ , m_tool( tool )
+ {}
+
+ virtual bool visible( EOutputLevel ) { return true; }
+ virtual QString text( EOutputLevel level );
+
+ QString m_action;
+ QString m_file;
+ QString m_tool;
+};
+
+#endif
diff --git a/parts/outputviews/makeviewpart.cpp b/parts/outputviews/makeviewpart.cpp
new file mode 100644
index 00000000..3f2ebbd8
--- /dev/null
+++ b/parts/outputviews/makeviewpart.cpp
@@ -0,0 +1,105 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "makeviewpart.h"
+
+#include <qwhatsthis.h>
+#include <qdir.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kiconloader.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include "kdevproject.h"
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+
+#include "makewidget.h"
+
+static const KDevPluginInfo data("kdevmakeview");
+typedef KDevGenericFactory< MakeViewPart > MakeViewFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevmakeview, MakeViewFactory( data ) )
+
+MakeViewPart::MakeViewPart(QObject *parent, const char *name, const QStringList &)
+ : KDevMakeFrontend(&data, parent, name)
+{
+ setInstance(MakeViewFactory::instance());
+
+ setXMLFile("kdevmakeview.rc");
+
+ m_dcop = new KDevMakeFrontendIface(this);
+
+ m_widget = new MakeWidget(this);
+ m_widget->setIcon( SmallIcon("exec") );
+ m_widget->setCaption(i18n("Messages Output"));
+ QWhatsThis::add(m_widget, i18n("<b>Messages output</b><p>"
+ "The messages window shows the output of the compiler and "
+ "used build tools like make, ant, uic, dcopidl etc. "
+ "For compiler error messages, click on the error message. "
+ "This will automatically open the source file and set the "
+ "cursor to the line that caused the compiler error/warning."));
+
+ mainWindow()->embedOutputView(m_widget, i18n("Messages"), i18n("Compiler output messages"));
+
+ KAction *action;
+ action = new KAction( i18n("&Next Error"), Key_F4, m_widget, SLOT(nextError()),
+ actionCollection(), "view_next_error");
+ action->setToolTip( i18n("Go to the next error") );
+ action->setWhatsThis(i18n("<b>Next error</b><p>Switches to the file and line where the next error was reported from."));
+ action = new KAction( i18n("&Previous Error"), SHIFT+Key_F4, m_widget, SLOT(prevError()),
+ actionCollection(), "view_previous_error");
+ action->setToolTip( i18n("Go to the previous error") );
+ action->setWhatsThis(i18n("<b>Previous error</b><p>Switches to the file and line where the previous error was reported from."));
+
+ connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)),
+ this, SLOT(slotStopButtonClicked(KDevPlugin*)) );
+}
+
+
+MakeViewPart::~MakeViewPart()
+{
+ if ( m_widget )
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+ delete m_dcop;
+}
+
+void MakeViewPart::slotStopButtonClicked(KDevPlugin* which)
+{
+ if ( which != 0 && which != this )
+ return;
+ m_widget->killJob();
+}
+
+void MakeViewPart::queueCommand(const QString &dir, const QString &command)
+{
+ m_widget->queueJob(dir, command);
+}
+
+
+bool MakeViewPart::isRunning()
+{
+ return m_widget->isRunning();
+}
+
+QWidget* MakeViewPart::widget()
+{
+ return m_widget.operator->();
+}
+
+void MakeViewPart::updateSettingsFromConfig()
+{
+ m_widget->updateSettingsFromConfig();
+}
+
+#include "makeviewpart.moc"
diff --git a/parts/outputviews/makeviewpart.h b/parts/outputviews/makeviewpart.h
new file mode 100644
index 00000000..78f969ff
--- /dev/null
+++ b/parts/outputviews/makeviewpart.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _MAKEVIEWPART_H_
+#define _MAKEVIEWPART_H_
+
+#include <qguardedptr.h>
+
+#include "kdevmakefrontend.h"
+#include "KDevMakeFrontendIface.h"
+
+
+class MakeWidget;
+
+class MakeViewPart : public KDevMakeFrontend
+{
+ Q_OBJECT
+
+public:
+ MakeViewPart( QObject *parent, const char *name, const QStringList & );
+ ~MakeViewPart();
+ virtual QWidget* widget();
+ virtual void updateSettingsFromConfig();
+
+private slots:
+ void slotStopButtonClicked(KDevPlugin*);
+
+protected:
+ virtual void queueCommand(const QString &dir, const QString &command);
+ virtual bool isRunning();
+
+private:
+ QGuardedPtr<MakeWidget> m_widget;
+ KDevMakeFrontendIface *m_dcop;
+ friend class MakeWidget;
+};
+
+#endif
diff --git a/parts/outputviews/makewidget.cpp b/parts/outputviews/makewidget.cpp
new file mode 100644
index 00000000..554713c4
--- /dev/null
+++ b/parts/outputviews/makewidget.cpp
@@ -0,0 +1,847 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "makewidget.h"
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+#include "processlinemaker.h"
+#include "makeviewpart.h"
+#include "makeitem.h"
+#include "ktexteditor/document.h"
+#include "ktexteditor/cursorinterface.h"
+#include "ktexteditor/editinterface.h"
+#include "urlutil.h"
+
+#include <kdebug.h>
+#include <klocale.h>
+#include <knotifyclient.h>
+#include <kprocess.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <kinstance.h>
+#include <kstatusbar.h>
+#include <kapplication.h>
+#include <kconfig.h>
+
+#include <qmessagebox.h>
+#include <qapplication.h>
+#include <qdir.h>
+#include <qimage.h>
+#include <qstylesheet.h>
+#include <qtimer.h>
+#include <qfileinfo.h>
+#include <qclipboard.h>
+#include <qpopupmenu.h>
+#include <private/qrichtext_p.h>
+
+#include <stdlib.h>
+#include <limits.h>
+
+static const char *const error_xpm[] =
+ {
+ "11 11 5 1",
+ ". c None",
+ "# c #313062",
+ "a c #6261cd",
+ "b c #c50000",
+ "c c #ff8583",
+ "...........",
+ "...####....",
+ ".a#bbbb#a..",
+ ".#ccbbbb#..",
+ "#bccbbbbb#.",
+ "#bbbbbbbb#.",
+ "#bbbbbbcb#.",
+ "#bbbbbccb#.",
+ ".#bbbccb#..",
+ ".a#bbbb#a..",
+ "...####...."
+ };
+
+
+static const char *const warning_xpm[] =
+ {
+ "11 11 5 1",
+ ". c None",
+ "# c #313062",
+ "a c #6261cd",
+ "b c #c5c600",
+ "c c #ffff41",
+ "...........",
+ "...####....",
+ ".a#bbbb#a..",
+ ".#ccbbbb#..",
+ "#bccbbbbb#.",
+ "#bbbbbbbb#.",
+ "#bbbbbbcb#.",
+ "#bbbbbccb#.",
+ ".#bbbccb#..",
+ ".a#bbbb#a..",
+ "...####...."
+ };
+
+
+static const char *const message_xpm[] =
+ {
+ "11 11 5 1",
+ ". c None",
+ "b c #3100c5",
+ "# c #313062",
+ "c c #3189ff",
+ "a c #6265cd",
+ "...........",
+ "...####....",
+ ".a#bbbb#a..",
+ ".#ccbbbb#..",
+ "#bccbbbbb#.",
+ "#bbbbbbbb#.",
+ "#bbbbbbcb#.",
+ "#bbbbbccb#.",
+ ".#bbbccb#..",
+ ".a#bbbb#a..",
+ "...####...."
+ };
+
+
+class SelectionPreserver
+{
+public:
+ SelectionPreserver( QTextEdit& textEdit, bool stayAtEnd )
+ : m_textEdit( textEdit )
+ , m_atEnd( false )
+ {
+ int para, index;
+ m_textEdit.getCursorPosition( &para, &index );
+
+ m_atEnd = stayAtEnd
+ && para == m_textEdit.paragraphs() - 1
+ && index == m_textEdit.paragraphLength( para );
+
+ m_textEdit.getSelection(&paraFrom, &indexFrom, &paraTo, &indexTo, 0);
+ }
+
+ ~SelectionPreserver()
+ {
+ m_textEdit.setSelection(paraFrom, indexFrom, paraTo, indexTo, 0);
+
+ if ( m_atEnd )
+ {
+ m_textEdit.moveCursor(QTextEdit::MoveEnd, false);
+ m_textEdit.moveCursor(QTextEdit::MoveLineStart, false);//if linewrap is off we must avoid the jumping of the vertical scrollbar
+ }
+ }
+
+ QTextEdit& m_textEdit;
+ bool m_atEnd;
+ int paraFrom, indexFrom, paraTo, indexTo;
+};
+
+MakeWidget::MakeWidget(MakeViewPart *part)
+ : QTextEdit(0, "make widget")
+ , m_directoryStatusFilter( m_errorFilter )
+ , m_errorFilter( m_continuationFilter )
+ , m_continuationFilter( m_actionFilter )
+ , m_actionFilter( m_otherFilter )
+ , m_pendingItem(0)
+ , m_paragraphs(0)
+ , m_lastErrorSelected(-1)
+ , m_part(part)
+ , m_vertScrolling(false)
+ , m_horizScrolling(false)
+ , m_bCompiling(false)
+{
+ updateSettingsFromConfig();
+
+ setTextFormat( Qt::RichText );
+
+ if ( m_bLineWrapping )
+ setWordWrap(WidgetWidth);
+ else
+ setWordWrap(NoWrap);
+
+ setWrapPolicy(Anywhere);
+ setReadOnly(true);
+ setMimeSourceFactory(new QMimeSourceFactory);
+ mimeSourceFactory()->setImage("error", QImage((const char**)error_xpm));
+ mimeSourceFactory()->setImage("warning", QImage((const char**)warning_xpm));
+ mimeSourceFactory()->setImage("message", QImage((const char**)message_xpm));
+
+ dirstack.setAutoDelete(true);
+
+ childproc = new KProcess(this);
+ procLineMaker = new ProcessLineMaker( childproc );
+
+ connect( procLineMaker, SIGNAL(receivedStdoutLine(const QCString&)),
+ this, SLOT(insertStdoutLine(const QCString&) ));
+ connect( procLineMaker, SIGNAL(receivedStderrLine(const QCString&)),
+ this, SLOT(insertStderrLine(const QCString&) ));
+ connect( procLineMaker, SIGNAL(receivedPartialStdoutLine(const QCString&)),
+ this, SLOT(storePartialStdoutLine(const QCString&) ));
+ connect( procLineMaker, SIGNAL(receivedPartialStderrLine(const QCString&)),
+ this, SLOT(storePartialStderrLine(const QCString&) ));
+
+ connect( childproc, SIGNAL(processExited(KProcess*)),
+ this, SLOT(slotProcessExited(KProcess*) )) ;
+
+ connect( &m_directoryStatusFilter, SIGNAL(item(EnteringDirectoryItem*)),
+ this, SLOT(slotEnteredDirectory(EnteringDirectoryItem*)) );
+ connect( &m_directoryStatusFilter, SIGNAL(item(ExitingDirectoryItem*)),
+ this, SLOT(slotExitedDirectory(ExitingDirectoryItem*)) );
+ connect( &m_errorFilter, SIGNAL(item(MakeItem*)),
+ this, SLOT(insertItem(MakeItem*)) );
+ connect( &m_actionFilter, SIGNAL(item(MakeItem*)),
+ this, SLOT(insertItem(MakeItem*)) );
+ connect( &m_otherFilter, SIGNAL(item(MakeItem*)),
+ this, SLOT(insertItem(MakeItem*)) );
+
+ connect( verticalScrollBar(), SIGNAL(sliderPressed()),
+ this, SLOT(verticScrollingOn()) );
+ connect( verticalScrollBar(), SIGNAL(sliderReleased()),
+ this, SLOT(verticScrollingOff()) );
+ connect( horizontalScrollBar(), SIGNAL(sliderPressed()),
+ this, SLOT(horizScrollingOn()) );
+ connect( horizontalScrollBar(), SIGNAL(sliderReleased()),
+ this, SLOT(horizScrollingOff()) );
+
+// this slot doesn't exist anymore
+// connect( m_part->partController(), SIGNAL(loadedFile(const KURL&)),
+// this, SLOT(slotDocumentOpened(const KURL&)) );
+}
+
+MakeWidget::~MakeWidget()
+{
+ delete mimeSourceFactory();
+ delete childproc;
+ delete procLineMaker;
+}
+
+void MakeWidget::queueJob(const QString &dir, const QString &command)
+{
+ commandList.append(command);
+ dirList.append(dir);
+ if (!isRunning())
+ {
+ // Store the current output view so that it
+ // can be restored after a successful compilation
+// m_part->mainWindow()->storeOutputViewTab();
+ startNextJob();
+ }
+}
+
+void MakeWidget::startNextJob()
+{
+ QStringList::Iterator it = commandList.begin();
+ if ( it == commandList.end() )
+ return;
+
+ currentCommand = *it;
+ commandList.remove(it);
+
+ int i = currentCommand.findRev(" gmake");
+ if ( i == -1 )
+ i = currentCommand.findRev(" make");
+ if ( i == -1 )
+ m_bCompiling = false;
+ else
+ {
+ QString s = currentCommand.right(currentCommand.length() - i);
+ if ( s.contains("configure ") ||
+ s.contains(" Makefile.cvs") ||
+ s.contains(" clean") ||
+ s.contains(" distclean") ||
+ s.contains(" package-messages") ||
+ s.contains(" install") )
+ {
+ m_bCompiling = false;
+ }
+ else {
+ m_bCompiling = true;
+ }
+ }
+
+ it = dirList.begin();
+ QString dir = *it;
+ m_lastBuildDir = dir;
+ dirList.remove(it);
+
+ clear(); // clear the widget
+ for ( QValueVector<MakeItem*>::iterator it = m_items.begin(); it != m_items.end(); ++it )
+ delete *it;
+ m_items.clear();
+ m_paragraphToItem.clear();
+ m_paragraphs = 0;
+ m_lastErrorSelected = -1;
+
+ insertItem( new CommandItem( currentCommand ) );
+
+ childproc->clearArguments();
+ *childproc << currentCommand;
+ childproc->setUseShell(true);
+ childproc->start(KProcess::OwnGroup, KProcess::AllOutput);
+
+ dirstack.clear();
+ dirstack.push(new QString(dir));
+
+ m_part->mainWindow()->raiseView(this);
+ m_part->core()->running(m_part, true);
+}
+
+void MakeWidget::killJob()
+{
+ if (!childproc->kill(SIGINT))
+ childproc->kill();
+}
+
+bool MakeWidget::isRunning()
+{
+ return childproc->isRunning();
+}
+
+void MakeWidget::copy()
+{
+ int parafrom=0, indexfrom=0, parato=0, indexto=0;
+ getSelection(&parafrom, &indexfrom, &parato, &indexto);
+ if( parafrom < 0 || indexfrom < 0 || parato < 0 || indexto < 0
+ || ((parafrom == parato) && (indexfrom == indexto)) )
+ {
+ return;
+ }
+
+ QString selection;
+ for(int i = parafrom; i<=parato; i++)
+ selection += text(i) + "\n";
+
+
+ if(m_compilerOutputLevel == eShort ||
+ m_compilerOutputLevel == eVeryShort )
+ {
+ QRegExp regexp("<.*>");
+ regexp.setMinimal(true);
+ selection.remove(regexp);
+ }
+ else
+ { //FIXME: Selections should be precise in the eShort and eVeryShort modes, too.
+ selection.remove(0, indexfrom);
+ int removeend = text(parato).length() - indexto;
+
+ selection.remove((selection.length()-1) - removeend, removeend);
+ }
+
+ selection.replace("&lt;","<");
+ selection.replace("&gt;",">");
+ selection.replace("&quot;","\"");
+ selection.replace("&amp;","&");
+
+ kapp->clipboard()->setText(selection, QClipboard::Clipboard);
+}
+
+void MakeWidget::nextError()
+{
+ int parag;
+ if (m_lastErrorSelected != -1)
+ parag = m_lastErrorSelected;
+ else
+ parag = 0;
+
+ //if there are no errors after m_lastErrorSelected try again from the beginning
+ if (!scanErrorForward(parag))
+ if (m_lastErrorSelected != -1)
+ {
+ m_lastErrorSelected = -1;
+ if (!scanErrorForward(0))
+ KNotifyClient::beep();
+ }
+ else
+ KNotifyClient::beep();
+}
+
+void MakeWidget::prevError()
+{
+ int parag;
+ if (m_lastErrorSelected != -1)
+ parag = m_lastErrorSelected;
+ else
+ parag = 0;
+
+ //if there are no errors before m_lastErrorSelected try again from the end
+ if (!scanErrorBackward(parag))
+ if (m_lastErrorSelected != -1)
+ {
+ m_lastErrorSelected = -1;
+#if QT_VERSION >= 0x030100
+ parag = (int)m_items.count();
+#else
+ parag = m_items.size();
+#endif
+ if (!scanErrorBackward(parag))
+ KNotifyClient::beep();
+ }
+ else
+ KNotifyClient::beep();
+}
+
+void MakeWidget::contentsMouseReleaseEvent( QMouseEvent* e )
+{
+ QTextEdit::contentsMouseReleaseEvent(e);
+ if ( e->button() != LeftButton )
+ return;
+ searchItem(paragraphAt(e->pos()));
+}
+
+void MakeWidget::keyPressEvent(QKeyEvent *e)
+{
+ if (e->key() == Key_Return || e->key() == Key_Enter)
+ {
+ int parag, index;
+ getCursorPosition(&parag, &index);
+ searchItem(parag);
+ }
+ else
+ QTextEdit::keyPressEvent(e);
+}
+
+// returns the current directory for parag
+QString MakeWidget::directory(int parag) const
+{
+ QValueVector<MakeItem*>::const_iterator it = qFind( m_items.begin(), m_items.end(), m_paragraphToItem[parag] );
+ if ( it == m_items.end() )
+ return QString::null;
+ // run backwards over directories and figure out where we are
+ while ( it != m_items.begin() ) {
+ --it;
+ EnteringDirectoryItem* edi = dynamic_cast<EnteringDirectoryItem*>( *it );
+ if ( edi )
+ return edi->directory + "/";
+ }
+ return QString::null;
+}
+
+// hackish function that will return true and put string "file" in "fName" if the file
+// exists
+static bool checkFileExists( const QString& file, QString& fName )
+{
+ if ( QFile::exists( file ) ) {
+ fName = file;
+ return true;
+ }
+ return false;
+}
+
+void MakeWidget::specialCheck( const QString& file, QString& fName ) const
+{
+ QString firstLine = text(0);
+ QRegExp rx("cd \\'(.*)\\'.*");
+ if (rx.search(firstLine) != -1)
+ {
+ KURL url(rx.cap(1)+"/", file);
+ if (url.isValid())
+ {
+ kdDebug(9004) << "MakeWidget::specialCheck thinks that url is: " << url.url()
+ << " origin: " << file << endl;
+ fName = url.url();
+ return;
+ }
+ }
+ // Ok the "worst case", lets see if we can find a file in the project that has the same name
+ // obviously this will pick always the wrong file when you've got the same filename multiple times.
+ QStringList files = m_part->project()->allFiles();
+ for( QStringList::iterator it = files.begin() ; it != files.end(); ++it)
+ {
+ if( (*it).contains( file ) )
+ {
+ fName = URLUtil::canonicalPath( m_part->project()->projectDirectory() + "/" + *it );
+ }
+ }
+}
+
+QString MakeWidget::guessFileName( const QString& fName, int parag ) const
+{
+ // pathological case
+ if ( ! m_part->project() ) return fName;
+
+ QString name;
+ QString dir = directory( parag );
+
+ if ( fName.startsWith( "/" ) )
+ {
+ // absolute path given
+ name = fName;
+ }
+ else if ( !dir.isEmpty() )
+ {
+ name = dir + fName;
+ }
+ else
+ {
+ // now it gets tricky - no directory navigation messages,
+ // no absolute path - let's guess.
+ name = fName;
+ if ( !checkFileExists( m_lastBuildDir + "/" + fName, name) &&
+ !checkFileExists( m_part->project()->projectDirectory() + "/" + fName, name ) &&
+ !checkFileExists( m_part->project()->projectDirectory() + "/" + m_part->project()->activeDirectory() + "/" + fName, name ) &&
+ !checkFileExists( m_part->project()->buildDirectory() + "/" + fName, name ) )
+ specialCheck(fName, name);
+ }
+
+ kdDebug(9004) << "Opening file: " << name << endl;
+
+ // GNU make resolves symlinks. if "name" is a real path to a file the
+ // project know by symlink path, we need to return the symlink path
+// QStringList projectFiles = m_part->project()->allFiles();
+ QStringList projectFiles = m_part->project()->symlinkProjectFiles();
+ QStringList::iterator it = projectFiles.begin();
+ while ( it != projectFiles.end() )
+ {
+ QString file = m_part->project()->projectDirectory() + "/" + *it;
+ if ( name == URLUtil::canonicalPath( file ) )
+ {
+ kdDebug(9004) << "Found file in project - " << file << " == " << name << endl;
+ return file;
+ }
+ ++it;
+ }
+
+ // this should only happen if the file is not in the project
+ return name;
+}
+
+void MakeWidget::searchItem(int parag)
+{
+ ErrorItem* item = dynamic_cast<ErrorItem*>( m_paragraphToItem[parag] );
+ if ( item )
+ {
+ // open the file
+ kdDebug(9004) << "Opening file: " << guessFileName(item->fileName, parag) << endl;
+ m_part->partController()->editDocument(KURL( guessFileName(item->fileName, parag) ), item->lineNum);
+ m_part->mainWindow()->statusBar()->message( item->m_error, 10000 );
+ m_lastErrorSelected = parag;
+ }
+}
+
+void MakeWidget::insertStdoutLine( const QCString& line )
+{
+ QString sline;
+ bool forceCLocale = KConfigGroup( kapp->config(), "MakeOutputWidget" ).readBoolEntry( "ForceCLocale", true );
+
+ if( forceCLocale )
+ sline = QString::fromAscii( stdoutbuf+line );
+ else
+ sline = QString::fromLocal8Bit( stdoutbuf+line );
+
+ if ( !appendToLastLine( sline ) )
+ m_directoryStatusFilter.processLine( sline );
+ stdoutbuf.truncate(0);
+}
+
+void MakeWidget::insertStderrLine( const QCString& line )
+{
+ QString sline;
+ bool forceCLocale = KConfigGroup( kapp->config(), "MakeOutputWidget" ).readBoolEntry( "ForceCLocale", true );
+
+ if( forceCLocale ) {
+ sline = QString( stderrbuf+line );
+ }
+ else
+ sline = QString::fromLocal8Bit( stderrbuf+line );
+
+ if ( !appendToLastLine( sline ) )
+ m_errorFilter.processLine( sline );
+ stderrbuf.truncate(0);
+}
+
+void MakeWidget::slotProcessExited(KProcess *)
+{
+ procLineMaker->flush();
+ if( !stderrbuf.isEmpty() )
+ insertStderrLine("");
+ if( !stdoutbuf.isEmpty() )
+ insertStdoutLine("");
+ if (childproc->normalExit())
+ {
+ if (childproc->exitStatus())
+ {
+ KNotifyClient::event( topLevelWidget()->winId(), "ProcessError", i18n("The process has finished with errors"));
+ emit m_part->commandFailed(currentCommand);
+ }
+ else
+ {
+ KNotifyClient::event( topLevelWidget()->winId(), "ProcessSuccess", i18n("The process has finished successfully"));
+ emit m_part->commandFinished(currentCommand);
+ }
+ }
+
+ MakeItem* item = new ExitStatusItem( childproc->normalExit(), childproc->exitStatus() );
+ insertItem( item );
+ displayPendingItem();
+
+ m_part->mainWindow()->statusBar()->message( QString("%1: %2").arg(currentCommand).arg(item->m_text), 3000);
+ m_part->core()->running(m_part, false);
+
+ // Defensive programming: We emit this with a single shot timer so that we go once again
+ // through the event loop. After that, we can be sure that the process is really finished
+ // and its KProcess object can be reused.
+ if (childproc->normalExit() && !childproc->exitStatus())
+ {
+ QTimer::singleShot(0, this, SLOT(startNextJob()));
+// if (commandList.isEmpty())
+ // The last command on the list was successful so restore the
+ // output view to what it had before the compilation process started
+// m_part->mainWindow()->restoreOutputViewTab();
+ }
+ else
+ {
+ commandList.clear();
+ dirList.clear();
+ }
+}
+
+void MakeWidget::slotEnteredDirectory( EnteringDirectoryItem* item )
+{
+// kdDebug(9004) << "Entering dir: " << item->directory << endl;
+ QString* dir = new QString( item->directory );
+ dirstack.push( dir );
+ insertItem( item );
+}
+
+void MakeWidget::slotExitedDirectory( ExitingDirectoryItem* item )
+{
+ QString eDir = item->directory;
+// kdDebug(9004) << "Leaving dir: " << eDir << endl;
+ QString *dir = dirstack.pop();
+ if (!dir)
+ {
+ kdWarning(9004) << "Left more directories than entered: " << eDir;
+ }
+ else if (dir->compare(eDir) != 0)
+ {
+ kdWarning(9004) << "Expected directory: \"" << *dir << "\" but got \"" << eDir << "\"" << endl;
+ }
+ insertItem( item );
+ if (dirstack.top())
+ insertItem( new EnteringDirectoryItem( *dirstack.top(), "" ) );
+ delete dir;
+}
+
+void MakeWidget::displayPendingItem()
+{
+ if (!m_pendingItem) return;
+ // this handles the case of ImmDisplay|Append
+ // We call displayPendingItem once in insertItem
+ // and the appends are handled directly in
+ // appendToLastLine
+ if (!m_items.empty()
+ && m_items.last() == m_pendingItem) return;
+
+ m_items.push_back(m_pendingItem);
+
+ if ( m_bCompiling && !m_pendingItem->visible( m_compilerOutputLevel ) )
+ return;
+
+ SelectionPreserver preserveSelection( *this, !m_vertScrolling && !m_horizScrolling );
+ m_paragraphToItem.insert( m_paragraphs++, m_pendingItem );
+ append( m_pendingItem->formattedText( m_compilerOutputLevel, brightBg() ) );
+}
+
+bool MakeWidget::appendToLastLine( const QString& text )
+{
+ if ( !m_pendingItem ) return false;
+ if ( !m_pendingItem->append( text ) )
+ {
+ displayPendingItem();
+ m_pendingItem = 0;
+ return false;
+ }
+
+ int mode = m_pendingItem -> displayMode();
+ if ((mode & MakeItem::Append) && (mode & MakeItem::ImmDisplay))
+ {
+ removeParagraph(paragraphs() - 1);
+ SelectionPreserver preserveSelection( *this, !m_vertScrolling && !m_horizScrolling );
+ append( m_pendingItem->formattedText( m_compilerOutputLevel, brightBg() ) );
+ }
+
+ return true;
+}
+
+void MakeWidget::insertItem( MakeItem* new_item )
+{
+ displayPendingItem();
+ m_pendingItem = new_item;
+
+ if (!new_item) return;
+
+ int mode = new_item -> displayMode();
+ if (mode & MakeItem::ImmDisplay)
+ {
+ displayPendingItem();
+ if (!(mode & MakeItem::Append))
+ m_pendingItem = 0;
+ }
+}
+
+bool MakeWidget::brightBg()
+{
+ int h,s,v;
+ paletteBackgroundColor().hsv( &h, &s, &v );
+ return (v > 127);
+}
+
+QPopupMenu* MakeWidget::createPopupMenu( const QPoint& pos )
+{
+ QPopupMenu* pMenu = QTextEdit::createPopupMenu(pos);
+ pMenu->setCheckable(true);
+
+ pMenu->insertSeparator();
+ int id = pMenu->insertItem(i18n("Line Wrapping"), this, SLOT(toggleLineWrapping()) );
+ pMenu->setItemChecked(id, m_bLineWrapping);
+ pMenu->setWhatsThis(id, i18n("<b>Line wrapping</b><p>Enables or disables wrapping of command lines displayed."));
+
+ pMenu->insertSeparator();
+ id = pMenu->insertItem(i18n("Very Short Compiler Output"), this, SLOT(slotVeryShortCompilerOutput()) );
+ pMenu->setWhatsThis(id, i18n("<b>Very short compiler output</b><p>Displays only warnings, errors and the file names which are compiled."));
+ pMenu->setItemChecked(id, m_compilerOutputLevel == eVeryShort);
+ id = pMenu->insertItem(i18n("Short Compiler Output"), this, SLOT(slotShortCompilerOutput()) );
+ pMenu->setWhatsThis(id, i18n("<b>Short compiler output</b><p>Suppresses all the compiler flags and formats to something readable."));
+ pMenu->setItemChecked(id, m_compilerOutputLevel == eShort);
+ id = pMenu->insertItem(i18n("Full Compiler Output"), this, SLOT(slotFullCompilerOutput()) );
+ pMenu->setWhatsThis(id, i18n("<b>Full compiler output</b><p>Displays unmodified compiler output."));
+ pMenu->setItemChecked(id, m_compilerOutputLevel == eFull);
+
+ pMenu->insertSeparator();
+ id = pMenu->insertItem(i18n("Show Directory Navigation Messages"), this, SLOT(toggleShowDirNavigMessages()));
+ pMenu->setWhatsThis(id, i18n("<b>Show directory navigation messages</b><p>Shows <b>cd</b> commands that are executed while building."));
+ pMenu->setItemChecked(id, DirectoryItem::getShowDirectoryMessages());
+
+ return pMenu;
+}
+
+void MakeWidget::toggleLineWrapping()
+{
+ m_bLineWrapping = !m_bLineWrapping;
+ KConfig *pConfig = kapp->config();
+ pConfig->setGroup("MakeOutputView");
+ pConfig->writeEntry("LineWrapping", m_bLineWrapping);
+ pConfig->sync();
+ if (m_bLineWrapping) {
+ setWordWrap(WidgetWidth);
+ }
+ else
+ {
+ setWordWrap(NoWrap);
+ }
+}
+
+void MakeWidget::refill()
+{
+ clear();
+ m_paragraphToItem.clear();
+ m_paragraphs = 0;
+ for( uint i = 0; i < m_items.size(); i++ )
+ {
+ if ( m_bCompiling && !m_items[i]->visible( m_compilerOutputLevel ) )
+ continue;
+ m_paragraphToItem.insert( m_paragraphs++, m_items[i] );
+ append( m_items[i]->formattedText( m_compilerOutputLevel, brightBg() ) );
+ }
+
+}
+
+void MakeWidget::slotVeryShortCompilerOutput() { setTextFormat( Qt::RichText ); setCompilerOutputLevel(eVeryShort); }
+void MakeWidget::slotShortCompilerOutput() { setTextFormat( Qt::RichText ); setCompilerOutputLevel(eShort); }
+void MakeWidget::slotFullCompilerOutput() { setTextFormat( Qt::RichText ); setCompilerOutputLevel(eFull); }
+
+void MakeWidget::setCompilerOutputLevel(EOutputLevel level)
+{
+ m_compilerOutputLevel = level;
+ KConfig *pConfig = kapp->config();
+ pConfig->setGroup("MakeOutputView");
+ pConfig->writeEntry("CompilerOutputLevel", (int) level);
+ pConfig->sync();
+ refill();
+}
+
+void MakeWidget::toggleShowDirNavigMessages()
+{
+ DirectoryItem::setShowDirectoryMessages( !DirectoryItem::getShowDirectoryMessages() );
+ KConfig *pConfig = kapp->config();
+ pConfig->setGroup("MakeOutputView");
+ pConfig->writeEntry("ShowDirNavigMsg", DirectoryItem::getShowDirectoryMessages());
+ pConfig->sync();
+ refill();
+}
+
+void MakeWidget::updateSettingsFromConfig()
+{
+ KConfig *pConfig = kapp->config();
+ pConfig->setGroup("General Options");
+ QFont outputFont = pConfig->readFontEntry("OutputViewFont");
+ setFont(outputFont);
+ pConfig->setGroup("MakeOutputView");
+ m_bLineWrapping = pConfig->readBoolEntry("LineWrapping", true);
+ m_compilerOutputLevel = (EOutputLevel) pConfig->readNumEntry("CompilerOutputLevel", (int) eShort);
+ DirectoryItem::setShowDirectoryMessages( pConfig->readBoolEntry("ShowDirNavigMsg", false) );
+}
+
+bool MakeWidget::scanErrorForward( int parag )
+{
+ for ( int it = parag + 1;
+ it < (int)m_items.count();
+ ++it )
+ {
+ ErrorItem* item = dynamic_cast<ErrorItem*>( m_paragraphToItem[it] );
+ if ( !item )
+ continue;
+ if( item->m_isWarning )
+ continue;
+ parag = it;
+ document()->removeSelection(0);
+ setSelection(parag, 0, parag+1, 0, 0);
+ setCursorPosition(parag, 0);
+ ensureCursorVisible();
+ searchItem( it );
+ return true;
+ }
+ return false;
+}
+
+bool MakeWidget::scanErrorBackward( int parag )
+{
+ for ( int it = parag - 1; it >= 0; --it)
+ {
+ ErrorItem* item = dynamic_cast<ErrorItem*>( m_paragraphToItem[it] );
+ if ( !item )
+ continue;
+ if( item->m_isWarning )
+ continue;
+ parag = it;
+ document()->removeSelection(0);
+ setSelection(parag, 0, parag+1, 0, 0);
+ setCursorPosition(parag, 0);
+ ensureCursorVisible();
+ searchItem( it );
+ return true;
+ }
+ return false;
+}
+
+void MakeWidget::storePartialStderrLine(const QCString & line)
+{
+ stderrbuf += line;
+}
+
+void MakeWidget::storePartialStdoutLine(const QCString & line)
+{
+ stdoutbuf += line;
+}
+
+#include "makewidget.moc"
diff --git a/parts/outputviews/makewidget.h b/parts/outputviews/makewidget.h
new file mode 100644
index 00000000..ff65eb5e
--- /dev/null
+++ b/parts/outputviews/makewidget.h
@@ -0,0 +1,129 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _MAKEWIDGET_H_
+#define _MAKEWIDGET_H_
+
+#include <qptrstack.h>
+#include <qregexp.h>
+#include <qtextedit.h>
+#include <qvaluevector.h>
+#include <qintdict.h>
+
+#include "outputfilter.h"
+#include "directorystatusmessagefilter.h"
+#include "compileerrorfilter.h"
+#include "commandcontinuationfilter.h"
+#include "makeactionfilter.h"
+#include "otherfilter.h"
+#include "makeitem.h"
+
+class MakeViewPart;
+class MakeItem;
+class KProcess;
+class ProcessLineMaker;
+class KURL;
+
+namespace KTextEditor { class Document; }
+
+class MakeWidget : public QTextEdit
+{
+ Q_OBJECT
+
+public:
+ MakeWidget(MakeViewPart *part);
+ ~MakeWidget();
+
+ void queueJob(const QString &dir, const QString &command);
+ bool isRunning();
+ void updateSettingsFromConfig();
+ void processLine( const QString& line );
+
+public slots:
+ void startNextJob();
+ void killJob();
+ void nextError();
+ void prevError();
+ void copy();
+
+protected:
+ virtual QPopupMenu *createPopupMenu( const QPoint& pos );
+ virtual void contentsMouseReleaseEvent( QMouseEvent* e );
+
+private slots:
+ void insertStdoutLine(const QCString& line);
+ void insertStderrLine(const QCString& line);
+ void storePartialStdoutLine(const QCString& line);
+ void storePartialStderrLine(const QCString& line);
+ void slotProcessExited(KProcess *);
+ void verticScrollingOn() { m_vertScrolling = true; }
+ void verticScrollingOff() { m_vertScrolling = false; }
+ void horizScrollingOn() { m_horizScrolling = true; }
+ void horizScrollingOff() { m_horizScrolling = false; }
+ void toggleLineWrapping();
+ void slotVeryShortCompilerOutput();
+ void slotShortCompilerOutput();
+ void slotFullCompilerOutput();
+ void toggleShowDirNavigMessages();
+ void slotEnteredDirectory( EnteringDirectoryItem* );
+ void slotExitedDirectory( ExitingDirectoryItem* );
+ void insertItem( MakeItem* );
+
+private:
+ void specialCheck( const QString& file, QString& fName ) const;
+ virtual void keyPressEvent(QKeyEvent *e);
+ void searchItem(int parag);
+ QString guessFileName( const QString& fName, int parag ) const;
+ QString directory(int parag) const;
+ bool brightBg();
+ void refill();
+ void createCursor(ErrorItem* e, KTextEditor::Document* doc);
+
+ bool scanErrorForward(int parag);
+ bool scanErrorBackward(int parag);
+
+ DirectoryStatusMessageFilter m_directoryStatusFilter;
+ CompileErrorFilter m_errorFilter;
+ CommandContinuationFilter m_continuationFilter;
+ MakeActionFilter m_actionFilter;
+ OtherFilter m_otherFilter;
+
+ void setPendingItem(MakeItem* new_item);
+ void displayPendingItem();
+ bool appendToLastLine( const QString& text );
+ void setCompilerOutputLevel(EOutputLevel level);
+
+ QStringList commandList;
+ QStringList dirList;
+ QString m_lastBuildDir; //stores directory of last build, for the case we don't have proper path information
+ QString currentCommand;
+ KProcess *childproc;
+ ProcessLineMaker* procLineMaker;
+ QPtrStack<QString> dirstack;
+ MakeItem* m_pendingItem;
+ QValueVector<MakeItem*> m_items;
+ QIntDict<MakeItem> m_paragraphToItem;
+ long m_paragraphs;
+ int m_lastErrorSelected;
+
+ MakeViewPart *m_part;
+
+ bool m_vertScrolling, m_horizScrolling;
+ bool m_bCompiling;
+
+ QCString stderrbuf;
+ QCString stdoutbuf;
+
+ bool m_bLineWrapping;
+ EOutputLevel m_compilerOutputLevel;
+};
+
+#endif
diff --git a/parts/outputviews/otherfilter.cpp b/parts/outputviews/otherfilter.cpp
new file mode 100644
index 00000000..5f14937c
--- /dev/null
+++ b/parts/outputviews/otherfilter.cpp
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "otherfilter.h"
+#include "otherfilter.moc"
+#include "makeitem.h"
+
+#include <kdebug.h>
+
+OtherFilter::OtherFilter()
+ : OutputFilter( *this )
+{
+}
+
+void OtherFilter::processLine( const QString& line )
+{
+ emit item( new MakeItem( line ) );
+}
diff --git a/parts/outputviews/otherfilter.h b/parts/outputviews/otherfilter.h
new file mode 100644
index 00000000..9a2c6c17
--- /dev/null
+++ b/parts/outputviews/otherfilter.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef OtherFilter_h
+#define OtherFilter_h
+
+#include "outputfilter.h"
+
+#include <qobject.h>
+
+class MakeItem;
+
+class OtherFilter : public QObject, public OutputFilter
+{
+Q_OBJECT
+
+public:
+ OtherFilter();
+
+ virtual void processLine( const QString& line );
+
+signals:
+ void item( MakeItem* );
+};
+
+#endif
diff --git a/parts/outputviews/outputfilter.cpp b/parts/outputviews/outputfilter.cpp
new file mode 100644
index 00000000..5692efce
--- /dev/null
+++ b/parts/outputviews/outputfilter.cpp
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann and the KDevelop Team *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "outputfilter.h"
+
+#include <kdebug.h>
+
+OutputFilter::OutputFilter( OutputFilter& next )
+ : m_next( next )
+{
+}
+
+void OutputFilter::processLine( const QString& line )
+{
+ m_next.processLine( line );
+}
diff --git a/parts/outputviews/outputfilter.h b/parts/outputviews/outputfilter.h
new file mode 100644
index 00000000..dd84f7d7
--- /dev/null
+++ b/parts/outputviews/outputfilter.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (C) 1999-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef OutputFilter_h
+#define OutputFilter_h
+
+#include <qstring.h>
+
+class OutputFilter
+{
+public:
+ OutputFilter( OutputFilter& );
+ virtual ~OutputFilter() {}
+
+ virtual void processLine( const QString& line );
+
+private:
+ OutputFilter& m_next;
+};
+
+#endif
diff --git a/parts/outputviews/outputviewsfactory.cpp b/parts/outputviews/outputviewsfactory.cpp
new file mode 100644
index 00000000..55e5bf55
--- /dev/null
+++ b/parts/outputviews/outputviewsfactory.cpp
@@ -0,0 +1,21 @@
+/***************************************************************************
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "outputviewsfactory.h"
+
+static const KDevPluginInfo data("kdevoutputviews", I18N_NOOP("Messages Output"), "1.0");
+
+K_EXPORT_COMPONENT_FACTORY( libkdevoutputviews, OutputViewsFactory( &data ) )
+
+const KDevPluginInfo *outputViewsInfo()
+{
+ return data;
+}
diff --git a/parts/outputviews/outputviewsfactory.h b/parts/outputviews/outputviewsfactory.h
new file mode 100644
index 00000000..4bcba666
--- /dev/null
+++ b/parts/outputviews/outputviewsfactory.h
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (C) 2000-2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _OUTPUTVIEWSFACTORY_H_
+#define _OUTPUTVIEWSFACTORY_H_
+
+#include <kdevgenericfactory.h>
+
+#include "appoutputviewpart.h"
+#include "makeviewpart.h"
+
+class KDevPluginInfo;
+
+typedef K_TYPELIST_2( AppOutputViewPart, MakeViewPart ) OutputViews;
+typedef KDevGenericFactory< OutputViews > OutputViewsFactory;
+
+const KDevPluginInfo *outputViewsInfo();
+
+#endif
diff --git a/parts/partexplorer/Makefile.am b/parts/partexplorer/Makefile.am
new file mode 100644
index 00000000..459c6778
--- /dev/null
+++ b/parts/partexplorer/Makefile.am
@@ -0,0 +1,17 @@
+# Here resides the PartExplorer plugin
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevpartexplorer.la
+libkdevpartexplorer_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevpartexplorer_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevpartexplorer_la_SOURCES = partexplorerformbase.ui partexplorerform.cpp partexplorer_plugin.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevpartexplorer.desktop
+
+rcdir = $(kde_datadir)/kdevpartexplorer
+rc_DATA = kdevpartexplorer.rc
diff --git a/parts/partexplorer/README b/parts/partexplorer/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/partexplorer/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/partexplorer/README.dox b/parts/partexplorer/README.dox
new file mode 100644
index 00000000..08afdd92
--- /dev/null
+++ b/parts/partexplorer/README.dox
@@ -0,0 +1,24 @@
+/** \class PartExplorerPlugin
+A Graphical tool for performing KTrader-like queries about registered services
+
+PartExplorer is a frontend to KTrader class (http://developer.kde.org/documentation/library/3.1-api/kio/html/classKTrader.html)
+and uses its syntax, no more no less: so before saying "it really sucks", give a look at
+http://developer.kde.org/documentation/library/kdeqt/tradersyntax.html.
+
+The real job is done by the @see PartExplorerForm class which handles user input, query system
+configuration and (eventually) fills the property list.
+
+It has helped figuring out several problems when querying KParts (ok, mostly mispelled names ;-), and I
+hope that some other people will find it useful.
+
+Last updated on 28.07.2003 by Mario Scalas
+
+\authors <a href="mailto:mario.scalas AT libero.it">Mario Scalas</a>
+
+\maintainer <a href="mailto:mario.scalas AT libero.it">Mario Scalas</a>
+
+\feature Performs KTrader-like queries about registered services
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=partexplorer&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">partexplorer component at Bugzilla database</a>
+
+*/
diff --git a/parts/partexplorer/kdevpartexplorer.desktop b/parts/partexplorer/kdevpartexplorer.desktop
new file mode 100644
index 00000000..8b031c49
--- /dev/null
+++ b/parts/partexplorer/kdevpartexplorer.desktop
@@ -0,0 +1,76 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=A Graphical tool for performing KTrader-like queries about registered services
+Comment[ca]=Una eina gràfica per a realitzar consultes del tipus KTrader sobre els serveis registrats
+Comment[da]=Et grafisk værktøj til at udføre KTrader-lignende forespørgsler om registrerede tjenester
+Comment[de]=Ein grafisches Werkzeug, mit dem Abfragen nach im System verfügbaren Komponten durchgeführt werden können
+Comment[el]=Ένα γραφικό εργαλείο για την εκτέλεση ερωτήσεων όπως το KTrader σχετικά με καταχωρημένες υπηρεσίες
+Comment[es]=Una herramienta gráfica para realizar consultas del tipo KTrader sobre los servicios registrados
+Comment[et]=Graafiline vahend KTraderi-laadsete päringute sooritamiseks registreeritud teenuste kohta
+Comment[eu]=Erregistratutako zerbitzuei buruzko kontsultak egiteko, KTrader-en antzeko tresna grafikoa
+Comment[fa]=یک ابزار نگاره‌ای برای انجام KTrader- مثل پرس‌وجوهایی در مورد خدمات ثبت‌شده
+Comment[fr]=Un outil graphique pour effectuer des requêtes de type KTrader sur les services enregistrés
+Comment[gl]=Unha ferramente gráfica para realizar peticións tipo KTrader dos servizos rexistrados
+Comment[hu]=Grafikus felületű program a regisztrált szolgáltatások KTrader-szerű lekérdezéséhez
+Comment[it]=Uno strumento grafico per eseguire interrogazioni tipo KTrader sui servizi registrati
+Comment[ja]=登録されたサービスに関する KTrader のような質問を実行するための視覚化されたツール
+Comment[ms]=Alatan bergrafik untuk melaksanakan pertanyaan seperti-KTrader mengenai servis berdaftar
+Comment[nds]=En graafsch Warktüüch för KTrader-liek Anfragen över indragen Deensten.
+Comment[ne]=दर्ता गरेको सेवाका बारेमा क्वेरीहरू जस्तै-KTrader कार्यसम्पादन गर्नका लागि एउटा ग्राफिकल उपकरण
+Comment[nl]=Een grafische tool om naar geregistreerde diensten te zoeken
+Comment[pl]=Narzędzie graficzne do wykonywania zapytań na temat zarejestrowanych usług (jak KTrader)
+Comment[pt]=Uma ferramenta gráfica para efectuar pesquisas do tipo KTrader sobre os serviços registados
+Comment[pt_BR]=Uma ferramenta Gráfica para realizar consultas como KTrader sobre serviços registrados
+Comment[ru]=Графическое средство для выполнения запросов KTrader о зарегистрированных сервисах.
+Comment[sk]=Grafický nástroj pre vyhľadávanie KTraderregistrovaných služieb
+Comment[sr]=Графички алат за обављање упита налик KTrader-овим о регистрованим сервисима
+Comment[sr@Latn]=Grafički alat za obavljanje upita nalik KTrader-ovim o registrovanim servisima
+Comment[sv]=Ett grafiskt verktyg för att utföra KTrader-liknande förfrågningar om registrerade tjänster.
+Comment[ta]=வரைகலை கருவி மூலம் பதிப்பு சேவையில் இருந்து Kட்ரேடர் கேள்விகளை செயலாக்கலாம்.
+Comment[tg]=Воситаи графикӣ барои иҷро намудани дархостҳои KTrader дар бораи қайдкунии муҳаррирҳо
+Comment[tr]=Kayıtlı servisler için KTrader-benzeri sorgular yapmayı sağlayan bir grafiksel araç
+Comment[zh_CN]=调用KTrader的图形工具-就像查询已经注册的服务。
+Comment[zh_TW]=執行類似 KTrader 查詢註冊服務的圖形化工具
+Name=KDevPartExplorer
+Name[da]=KDevelop Part-søger
+Name[nds]=KDevelop-Komponentkieker
+Name[sk]=KDev Part prieskumník
+Name[sv]=KDevelop delutforskare
+Name[zh_TW]=KDevelop 元件探索
+GenericName=Part Explorer Tool
+GenericName[ca]=Eina Part per a explorar
+GenericName[da]=Partsøger værktøj
+GenericName[de]=Komponenten-Explorer
+GenericName[el]=Εργαλείο περιηγητή τμημάτων
+GenericName[es]=Herramienta de exploración de partes
+GenericName[et]=Komponentide näitaja
+GenericName[eu]=Parteen arakatzaile tresna
+GenericName[fa]=ابزار کاوشگر جزء
+GenericName[fr]=Outil d'exploration des composants
+GenericName[hu]=Objektumböngésző
+GenericName[it]=Strumento per l'esplorazione di componenti
+GenericName[ja]=部分調査ツール
+GenericName[ms]=Alat Penjelajah Bahagian
+GenericName[nds]=Kiekwarktüüch för Komponenten
+GenericName[ne]=भाग एक्सप्लोरर उपकरण
+GenericName[nl]=Part Explorer gereedschap
+GenericName[pl]=Przeglądarka elementów KPart
+GenericName[pt]=Ferramenta de Exploração de Partes
+GenericName[pt_BR]=Ferramenta de Explorador de Parte
+GenericName[ru]=Средство опроса компонентов
+GenericName[sk]=Part prieskumník
+GenericName[sl]=Orodje Part Explorer
+GenericName[sr]=Алат за истраживање делова
+GenericName[sr@Latn]=Alat za istraživanje delova
+GenericName[sv]=Delutforskningsverktyg
+GenericName[ta]=முழுவதும் தேடும் கருவியில் ஒரு பகுதி
+GenericName[tg]=Восиати дархости қисматҳо
+GenericName[tr]=Bileşen Gezinti Aracı
+GenericName[zh_CN]=模块浏览器工具
+GenericName[zh_TW]=元件探索工具
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevpartexplorer
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=KDEDevelopment
diff --git a/parts/partexplorer/kdevpartexplorer.rc b/parts/partexplorer/kdevpartexplorer.rc
new file mode 100644
index 00000000..9632115b
--- /dev/null
+++ b/parts/partexplorer/kdevpartexplorer.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevPartExplorer" version="4">
+<MenuBar>
+ <Menu name="tools" >
+ <Action name="show_partexplorerform"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/parts/partexplorer/partexplorer_plugin.cpp b/parts/partexplorer/partexplorer_plugin.cpp
new file mode 100644
index 00000000..92aaf696
--- /dev/null
+++ b/parts/partexplorer/partexplorer_plugin.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "partexplorer_plugin.h"
+
+#include <kinstance.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdebug.h>
+#include <kaction.h>
+#include <kmainwindow.h>
+
+#include <kdevplugininfo.h>
+#include <kdevmainwindow.h>
+
+#include "partexplorerform.h"
+
+static const KDevPluginInfo data("kdevpartexplorer");
+
+typedef KDevGenericFactory<PartExplorerPlugin> PartExplorerPluginFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevpartexplorer, PartExplorerPluginFactory( data ) )
+
+PartExplorerPlugin::PartExplorerPlugin( QObject *parent, const char *name, const QStringList & )
+ : KDevPlugin( &data, parent, name ? name : "PartExplorerPlugin" )
+{
+ // we need an instance
+ setInstance( PartExplorerPluginFactory::instance() );
+
+ setXMLFile( "kdevpartexplorer.rc" );
+
+ // this should be your custom internal widget
+ m_widget = new PartExplorerForm( mainWindow()->main() );
+// mainWindow()->embedSelectView( m_widget, i18n("PartExplorer"), i18n("Query system services"));
+
+ KAction *action = new KAction( i18n("&Part Explorer"), 0, this, SLOT(slotShowForm()),
+ actionCollection(), "show_partexplorerform" );
+ action->setToolTip(i18n("KTrader query execution"));
+ action->setWhatsThis(i18n("<b>Part explorer</b><p>Shows a dialog for KTrader query execution. Search your KDE documentation for more information about KDE services and KTrader."));
+}
+
+PartExplorerPlugin::~PartExplorerPlugin()
+{
+/*
+ if (m_widget)
+ {
+ mainWindow()->removeView( m_widget );
+ }
+*/
+ //delete m_widget;
+}
+
+void PartExplorerPlugin::slotShowForm()
+{
+ m_widget->show();
+}
+
+#include "partexplorer_plugin.moc"
diff --git a/parts/partexplorer/partexplorer_plugin.h b/parts/partexplorer/partexplorer_plugin.h
new file mode 100644
index 00000000..28f3cd95
--- /dev/null
+++ b/parts/partexplorer/partexplorer_plugin.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _PARTEXPLORERPLUGIN_H_
+#define _PARTEXPLORERPLUGIN_H_
+
+#include <qguardedptr.h>
+
+#include "kdevplugin.h"
+
+class QWidget;
+class QPainter;
+class KURL;
+class PartExplorerForm;
+
+class PartExplorerPlugin : public KDevPlugin
+{
+ Q_OBJECT
+public:
+ /**
+ * Default constructor
+ */
+ PartExplorerPlugin( QObject *parent, const char *name, const QStringList & );
+
+ /**
+ * Destructor
+ */
+ virtual ~PartExplorerPlugin();
+
+private slots:
+ void slotShowForm();
+
+private:
+ /**
+ * The dialog for user interaction, so the plugin is usable too ;)
+ */
+ QGuardedPtr<PartExplorerForm> m_widget;
+};
+
+#endif // _PARTEXPLORERPLUGIN_H_
diff --git a/parts/partexplorer/partexplorerform.cpp b/parts/partexplorer/partexplorerform.cpp
new file mode 100644
index 00000000..f3a1caad
--- /dev/null
+++ b/parts/partexplorer/partexplorerform.cpp
@@ -0,0 +1,231 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qlineedit.h>
+#include <qtextedit.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <qlayout.h>
+#include <qwhatsthis.h>
+#include <qlabel.h>
+
+#include <klistview.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kdebug.h>
+#include <kcombobox.h>
+#include <kservicetype.h>
+
+#include "partexplorerformbase.h"
+#include "partexplorerform.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// class PropertyItem
+///////////////////////////////////////////////////////////////////////////////
+namespace PartExplorer{
+
+class PropertyItem : public KListViewItem
+{
+public:
+ PropertyItem( KListViewItem *parent, const QString &propertyName,
+ const QString &propertyType, const QString &propertyValue )
+ : KListViewItem( parent )
+ {
+ setText( 0, propertyName );
+ setText( 1, propertyType );
+ setText( 2, propertyValue );
+ }
+
+ QString tipText() const
+ {
+ QString tip = i18n("Name: %1 | Type: %2 | Value: %3");
+ return tip.arg( text(0) ).arg( text(1) ).arg( text(2) );
+ }
+};
+
+}
+///////////////////////////////////////////////////////////////////////////////
+// class ResultsList
+///////////////////////////////////////////////////////////////////////////////
+
+class ResultList;
+
+class ResultsToolTip: public QToolTip
+{
+public:
+ ResultsToolTip( ResultsList* parent );
+ virtual void maybeTip( const QPoint& p );
+
+private:
+ ResultsList* m_resultsList;
+};
+
+class ResultsList : public KListView
+{
+public:
+ ResultsList( QWidget *parent )
+ : KListView( parent, "resultslist" )
+ {
+ this->setShowToolTips( false );
+ new ResultsToolTip( this );
+ }
+
+ virtual ~ResultsList() {}
+
+ void clear()
+ {
+ KListView::clear();
+ }
+};
+
+ResultsToolTip::ResultsToolTip( ResultsList* parent )
+ : QToolTip( parent->viewport() ), m_resultsList( parent )
+{
+}
+
+void ResultsToolTip::maybeTip( const QPoint& p )
+{
+ PartExplorer::PropertyItem *item = dynamic_cast<PartExplorer::PropertyItem*>( m_resultsList->itemAt( p ) );
+ if ( item )
+ {
+ QRect r = m_resultsList->itemRect( item );
+ if ( r.isValid() )
+ tip( r, item->tipText() );
+ }
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// class PartExplorerForm
+///////////////////////////////////////////////////////////////////////////////
+
+PartExplorerForm::PartExplorerForm( QWidget *parent )
+ : KDialogBase( parent, "parteplorerform", false,
+ i18n("Part Explorer - A Services Lister"), User1 | Close, User1, true )
+{
+ m_base = new PartExplorerFormBase( this, "partexplorerformbase", 0 );
+ m_resultsList = new ResultsList( m_base );
+ m_resultsList->addColumn( i18n( "Property" ) );
+ m_resultsList->addColumn( i18n( "Type" ) );
+ m_resultsList->addColumn( i18n( "Value" ) );
+ m_resultsList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3,
+ (QSizePolicy::SizeType)3, 0, 0,
+ m_resultsList->sizePolicy().hasHeightForWidth() ) );
+ QWhatsThis::add( m_resultsList, i18n("<b>Matching services</b><p>Results (if any) are shown grouped by matching service name.") );
+ m_base->resultsLabel->setBuddy(m_resultsList);
+ m_base->layout()->add( m_resultsList );
+ setMainWidget( m_base );
+ m_base->typeCombo->lineEdit()->setFocus();
+
+ // User1 button text
+ setButtonText( User1, i18n("&Search") );
+
+ // Resize dialog
+ resize( 480, 512 );
+
+// connect( m_base->typeCombo->lineEdit(), SIGNAL(returnPressed()), this, SLOT(slotSearchRequested()) );
+// connect( m_base->constraintsText, SIGNAL(returnPressed()), this, SLOT(slotSearchRequested()) );
+
+ connect( actionButton(User1), SIGNAL(clicked()), this, SLOT(slotSearchRequested()) );
+// connect( m_base->typeCombo->lineEdit(), SIGNAL( textChanged ( const QString & ) ), this, SLOT( slotServicetypeChanged( const QString& ) ) );
+// slotServicetypeChanged( m_base->typeCombo->lineEdit()->text() );
+
+ // populating with all known servicetypes
+ KServiceType::List serviceList = KServiceType::allServiceTypes();
+ QStringList list;
+ KServiceType::List::Iterator it = serviceList.begin();
+ while( it != serviceList.end() )
+ {
+ list << (*it)->name();
+ ++it;
+ }
+ list.sort();
+ m_base->typeCombo->insertStringList( list );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+PartExplorerForm::~PartExplorerForm()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void PartExplorerForm::slotSearchRequested()
+{
+ QString serviceType = m_base->typeCombo->lineEdit()->text();
+ QString constraints = m_base->constraintsText->text();
+
+ kdDebug(9000) << "===> PartExplorerForm::slotSearchRequested(): " <<
+ " serviceType = " << serviceType << ", constraints = " << constraints << endl;
+
+ // Query for requested services
+ KTrader::OfferList foundServices = KTrader::self()->query( serviceType, constraints );
+ fillServiceList( foundServices );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void PartExplorerForm::slotDisplayError( QString errorMessage )
+{
+ if (errorMessage.isEmpty())
+ {
+ errorMessage = i18n("Unknown error.");
+ }
+ KMessageBox::error( this, errorMessage );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void PartExplorerForm::fillServiceList( const KTrader::OfferList &services )
+{
+ this->m_resultsList->clear();
+
+ if ( services.isEmpty())
+ {
+ slotDisplayError( i18n("No service found matching the criteria.") );
+ return;
+ }
+
+ this->m_resultsList->setRootIsDecorated( true );
+
+ KListViewItem *rootItem = 0;
+
+ KTrader::OfferList::ConstIterator it = services.begin();
+ for ( ; it != services.end(); ++it )
+ {
+ KService::Ptr service = (*it);
+ KListViewItem *serviceItem = new KListViewItem( this->m_resultsList, rootItem, service->name() );
+
+ QStringList propertyNames = service->propertyNames();
+ for ( QStringList::const_iterator it = propertyNames.begin(); it != propertyNames.end(); ++it )
+ {
+ QString propertyName = (*it);
+ QVariant property = service->property( propertyName );
+ QString propertyType = property.typeName();
+ QString propertyValue;
+ if (propertyType == "QStringList") {
+ propertyValue = property.toStringList().join(", ");
+ }
+ else {
+ propertyValue = property.toString();
+ }
+
+ QString dProperty = " *** Found property < %1, %2, %3 >";
+ dProperty = dProperty.arg( propertyName ).arg( propertyType ).arg( propertyValue );
+ kdDebug( 9000 ) << dProperty << endl;
+
+ new PartExplorer::PropertyItem( serviceItem, propertyName, propertyType, propertyValue );
+ }
+ }
+}
+
+#include "partexplorerform.moc"
diff --git a/parts/partexplorer/partexplorerform.h b/parts/partexplorer/partexplorerform.h
new file mode 100644
index 00000000..21fe2fba
--- /dev/null
+++ b/parts/partexplorer/partexplorerform.h
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Mario Scalas *
+ * mario.scalas@libero.it *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PARTEXPLORERFORM_H
+#define PARTEXPLORERFORM_H
+
+#include <ktrader.h>
+#include <kdialogbase.h>
+
+class ResultsList;
+class PartExplorerFormBase;
+
+/**
+* The GUI for the PartExplorer.
+*
+* @author Mario Scalas
+*/
+class PartExplorerForm : public KDialogBase
+{
+ Q_OBJECT
+public:
+ PartExplorerForm( QWidget *parent = 0 );
+ virtual ~PartExplorerForm();
+
+ /**
+ * Fills the widget with data gathered for system's query.
+ */
+ void fillServiceList( const KTrader::OfferList &services );
+
+public slots:
+ void slotDisplayError( QString );
+
+protected slots:
+ void slotSearchRequested();
+
+private:
+ ResultsList *m_resultsList;
+ PartExplorerFormBase *m_base;
+};
+
+#endif
diff --git a/parts/partexplorer/partexplorerformbase.ui b/parts/partexplorer/partexplorerformbase.ui
new file mode 100644
index 00000000..dd9beeb3
--- /dev/null
+++ b/parts/partexplorer/partexplorerformbase.ui
@@ -0,0 +1,139 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>PartExplorerFormBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PartExplorerFormBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>335</width>
+ <height>241</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>PartExplorer</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>This is a front-end to KDE's KTrader: search your KDE documentation for more information about KDE services and KTrader</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>KDE service &amp;type:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>typeCombo</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="KComboBox">
+ <property name="name">
+ <cstring>typeCombo</cstring>
+ </property>
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ <property name="autoCompletion">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Additional constraints:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>constraintsText</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QTextEdit">
+ <property name="name">
+ <cstring>constraintsText</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;b&gt;Constraints&lt;/b&gt;Refine your query by writing additional constraints such as &lt;i&gt;([X-KDevelop-Scope]='Global')&lt;/i&gt;).</string>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>resultsLabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Results</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<tabstops>
+ <tabstop>constraintsText</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/quickopen/Makefile.am b/parts/quickopen/Makefile.am
new file mode 100644
index 00000000..be12b32f
--- /dev/null
+++ b/parts/quickopen/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions \
+ -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevquickopen.la
+libkdevquickopen_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevquickopen_la_LIBADD = $(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/widgets/libkdevwidgets.la $(LIB_KHTML)
+
+libkdevquickopen_la_SOURCES = quickopen_part.cpp quickopendialog.cpp quickopenclassdialog.cpp quickopenbase.ui quickopenfiledialog.cpp quickopenfunctiondialog.cpp quickopenfunctionchooseformbase.ui quickopenfunctionchooseform.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevquickopen.desktop
+
+rcdir = $(kde_datadir)/kdevquickopen
+rc_DATA = kdevpart_quickopen.rc
+noinst_HEADERS = quickopendialog.h quickopenclassdialog.h quickopenfiledialog.h quickopenfunctiondialog.h quickopenfunctionchooseform.h
diff --git a/parts/quickopen/README.dox b/parts/quickopen/README.dox
new file mode 100644
index 00000000..a4463178
--- /dev/null
+++ b/parts/quickopen/README.dox
@@ -0,0 +1,52 @@
+/** \class QuickOpenPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a>
+...
+\authors <a href="mailto:nth author AT provider.com">nth author full name</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/quickopen/kdevpart_quickopen.rc b/parts/quickopen/kdevpart_quickopen.rc
new file mode 100644
index 00000000..6a50fc22
--- /dev/null
+++ b/parts/quickopen/kdevpart_quickopen.rc
@@ -0,0 +1,15 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="quickopen" library="libquickopenplugin" version="4">
+<MenuBar>
+ <Menu name="file">
+ <Action name="quick_open" group="open_merge"/>
+ </Menu>
+ <Menu name="view">
+ <Action name="file_switchto"/>
+ </Menu>
+ <Menu name="tools">
+ <Action name="quick_open_class"/>
+ <Action name="quick_open_function"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/quickopen/kdevquickopen.desktop b/parts/quickopen/kdevquickopen.desktop
new file mode 100644
index 00000000..1f497292
--- /dev/null
+++ b/parts/quickopen/kdevquickopen.desktop
@@ -0,0 +1,80 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides an efficient way of finding/opening files, classes and methods in a large project. Appears in the File and Tools menus when loaded.
+Comment[ca]=Proporciona un mètode eficient per a cercar i obrir fitxers, classes i mètodes en un projecte gran. Quan està carregat apareix en el menú Fitxer i Eines.
+Comment[da]=Giver en effektiv måde at finde/åbne, filer, klasser og metoder i et stort projekt. Viser sig i Fil- og værktøjsmenuerne når den er indlæst.
+Comment[de]=Stellt eine effektive Möglichkeit zum Suchen und Öffnen von Dateien in einem großen Projekt zur Verfügung. Erscheint im Menü "Datei", wenn es geladen ist.
+Comment[el]=Προσφέρει μια εύχρηστη μέθοδο αναζήτησης/ανοίγματος αρχείων, κλάσεων και μεθόδων σε ένα μεγάλο έργο. Εμφανίζεται στα μενού αρχείων και εργαλείων όταν φορτωθεί.
+Comment[es]=Proporciona un método para para buscar/abrir archivos, clases y métodos de un proyecto grande. Aparece en los menús Archivo y Herramientas cuando está cargado.
+Comment[et]=Võimaldab hõlpsasti leida/avada faile, klasse ja meetodeid suures projektis. Laadimisel kättesaadav faili- ja tööriistade menüüs.
+Comment[eu]=Proiektu handi batean fitxategiak, klaseak eta metodoak aurkitzeko/irekitzeko aukera eskeintzen du. Fitxategia eta Tresnak menutan agertzen da kargatzean.
+Comment[fa]=راه مؤثری برای یافتن/باز کردن پرونده‌ها، رده‌ها و روشها در پروژه‌های بزرگ فراهم می‌کند. در هنگام بارگذاری در گزینگان ابزار و پرونده ظاهر می‌شود.
+Comment[fr]=Fournit une manière efficace pour chercher / ouvrir des fichiers, classes et méthodes dans des grands projets. Apparaît dans les menus « Fichier » et « Outils » lorsque chargé.
+Comment[gl]=Proporciona un método eficiente para atopar/abrir ficheiros, clases e métodos nun proxecto grande. Aparece nos menús Ficheiro e Ferramentas cando se carga.
+Comment[hu]=Segítséget nyújt nagy projekteknél fájlok, osztályok és tagfüggvények kereséséhez, megnyitásához. Betöltéskor a Fájl és Eszközök menübe kerül.
+Comment[it]=Offre un modo efficiente per trovare/aprire file, classi e metodi in un progetto di ampia dimensione. Appare nel menu File e Strumenti quando caricato.
+Comment[ja]=大規模なプロジェクトでのファイルやクラス、メソッドを検索したり開く効率的な方法を提供します。読み込まれると、ファイルとツールのメニューに現れます。
+Comment[ms]=Menyediakan cara efisien untuk mencari/membuka fail, kelas dan kaedah dalam projek besar. Muncul sebagai menu Fail dan Alatan apabila dimuatkan.
+Comment[nds]=Stellt en effektiv Metood för't Söken un Opmaken vun Dateien, Klassen un Metoden in grötter Projekten praat. Dukt in't Menü "Datei" un "Warktüüch" op, wenn laadt.
+Comment[ne]=ठूलो परियोजनामा फाइल फेला पार्ने/खोल्ने, कक्षहरू र विधिको उपयुक्त तरिका प्रदान गर्दछ । लोड भएको बेलामा फाइल र उपकरणमा देखा पर्दछ ।
+Comment[nl]=Biedt een snelle manier om bestanden te vinden/openen in een groot project. Verschijnt in menu Bestand en Gereedschap als het geladen is.
+Comment[pl]=Umożliwia wyszukiwanie/otwieranie plików, klas i metod w dużym projekcie. Po wczytaniu pojawia się w menu Plik i Narzędzia.
+Comment[pt]=Oferece uma forma eficiente de procurar/abrir ficheiros, classes e métodos num projecto grande. Aparece nos menus Ficheiro e Ferramentas quando é carregado.
+Comment[pt_BR]=Fornece uma maneira eficiente de procurar/abrir arquivos, classes e métodos em um grande projeto. Aparece nos menus Arquivo e Ferramentas quando carregado.
+Comment[ru]=Предоставляет эффективное средство нахождения и открытия файлов и классов в больших проектах.
+Comment[sk]=Poskytuje efektívny spôsob hľadania/otvárania súborov, tried a metód vo veľkom projekte. Po načítaní sa objaví v menu Súbor a Nástroje.
+Comment[sr]=Обезбеђује ефикасан начин проналажења/отварања фајлова, класа и метода у великом пројекту. Појављује се у менијима „Фајл“ и „Алати“ када је учитан.
+Comment[sr@Latn]=Obezbeđuje efikasan način pronalaženja/otvaranja fajlova, klasa i metoda u velikom projektu. Pojavljuje se u menijima „Fajl“ i „Alati“ kada je učitan.
+Comment[sv]=Erbjuder ett effektivt sätt att hitta och öppna filer, klasser och metoder i ett stort projekt. Finns i menyn Arkiv och Verktyg när det laddats.
+Comment[ta]=பெரிய திட்ட பணிகளில் உள்ள கோப்பினை திறக்க/தேட இது ஒரு நல்ல வழியை தரும். ஏற்றியபின் கோப்பு பட்டியலில் இது தோன்றும்.
+Comment[tg]=Воситаи зуд ёфтан, кушодани файлҳо ва синфҳо дар лоиҳаҳоро имкон медиҳад.
+Comment[tr]=Büyük bir projede dosyaları, sınıfları ve yöntemleri bulmak ve açmak için verimli bir yol sunar. Yüklendiğinde Dosya ve Araçlar menüsünde durur.
+Comment[zh_CN]=提供在大工程中查找/打开文件、类和方法的有效方法。启动后显示在文件菜单中。
+Comment[zh_TW]=在大型專案中有效率地尋找/開啟檔案、類別與方法。載入後可以在檔案與工具選單中找到。
+Name=KDevQuickOpen
+Name[da]=KDevelop hurtigåbner
+Name[de]=Schnellöffner-Komponente (KDevelop)
+Name[hi]=के-डेव-क्विक-ओपन
+Name[nds]=KDevelop-Fixopmaker
+Name[pl]=KDevSzybkieOtwarcie
+Name[sk]=KDev rýchle otvorenie
+Name[sv]=KDevelop snabböppna
+Name[ta]=KDev சீக்கிரம் திற
+Name[zh_TW]=KDevelop 快速開啟
+GenericName=QuickOpen
+GenericName[ca]=Obertura ràpida
+GenericName[da]=Hurtigåbner
+GenericName[de]=Schnellöffner
+GenericName[el]=ΓρήγοροΆνοιγμα
+GenericName[es]=Apertura rápida
+GenericName[et]=Kiiresti avamine
+GenericName[fa]=باز کردن سریع
+GenericName[fr]=Ouverture rapide
+GenericName[gl]=Apertura rápida
+GenericName[hi]=क्विक-ओपन
+GenericName[hu]=Gyors fájlmegnyitó
+GenericName[it]=Apertura rapida
+GenericName[ja]=簡易読み込み
+GenericName[nds]=Gau opmaken
+GenericName[ne]=शीघ्र खुला
+GenericName[nl]=Snel openen
+GenericName[pl]=Szybkie otwarcie
+GenericName[pt]=Abertura Rápida
+GenericName[ru]=Быстрое открытие
+GenericName[sk]=Rýchle otvorenie
+GenericName[sl]=Hitro odprtje
+GenericName[sr]=Брзо отварање
+GenericName[sr@Latn]=Brzo otvaranje
+GenericName[sv]=Snabböppna
+GenericName[ta]=சீக்கிரம் திற
+GenericName[tg]=Ба зуди кушодан
+GenericName[tr]=HızlıAç
+GenericName[zh_CN]=快速打开
+GenericName[zh_TW]=快速開啟
+Icon=kdevelop
+ServiceTypes=KDevelop/QuickOpen
+X-KDevelop-Scope=Project
+X-KDE-Library=libkdevquickopen
+X-KDevelop-Version=5
+X-KDevelop-Properties=CodeNavigation
diff --git a/parts/quickopen/quickopen_part.cpp b/parts/quickopen/quickopen_part.cpp
new file mode 100644
index 00000000..dbfab9e6
--- /dev/null
+++ b/parts/quickopen/quickopen_part.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "quickopen_part.h"
+#include "quickopenclassdialog.h"
+#include "quickopenfunctiondialog.h"
+#include "quickopenfiledialog.h"
+
+#include <kaction.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include <kmainwindow.h>
+
+#include <kparts/part.h>
+#include <ktexteditor/document.h>
+
+#include <kdevmainwindow.h>
+#include <kdevcore.h>
+#include <kdevpartcontroller.h>
+#include <kdevproject.h>
+#include <codebrowserfrontend.h>
+
+#include "kdeveditorutil.h"
+
+typedef KDevGenericFactory<QuickOpenPart> QuickOpenFactory;
+static const KDevPluginInfo data("kdevquickopen");
+K_EXPORT_COMPONENT_FACTORY( libkdevquickopen, QuickOpenFactory( data ) )
+
+using namespace KTextEditor;
+
+QuickOpenPart::QuickOpenPart(QObject *parent, const char *name, const QStringList& )
+ : KDevQuickOpen(&data, parent, name ? name : "QuickOpenPart" )
+{
+ setInstance(QuickOpenFactory::instance());
+ setXMLFile("kdevpart_quickopen.rc");
+
+ m_actionQuickOpen = new KAction( i18n("Quick Open File..."), CTRL + ALT + Key_O,
+ this, SLOT(slotQuickFileOpen()),
+ actionCollection(), "quick_open" );
+ m_actionQuickOpen->setToolTip(i18n("Quick open file in project"));
+ m_actionQuickOpen->setWhatsThis(i18n("<b>Quick open</b><p>Provides a file name input form with completion listbox to quickly open file in a project."));
+
+ m_actionQuickOpenClass = new KAction( i18n("Quick Open Class..."), CTRL + ALT + Key_C,
+ this, SLOT(slotQuickOpenClass()),
+ actionCollection(), "quick_open_class" );
+ m_actionQuickOpenClass->setToolTip(i18n("Find class in project"));
+ m_actionQuickOpenClass->setWhatsThis(i18n("<b>Find class</b><p>Provides a class name input form with completion listbox to quickly open a file where the class is defined."));
+
+ m_actionFunctionOpen = new KAction( i18n("Quick Open Method..."), CTRL + ALT + Key_M, this, SLOT(slotQuickOpenFunction()), actionCollection(), "quick_open_function" );
+ m_actionFunctionOpen->setToolTip(i18n("Quick open function in project"));
+
+ m_switchToAction = new KAction(i18n("Switch To..."), KShortcut("CTRL+/"), this, SLOT(slotSwitchTo()), actionCollection(), "file_switchto");
+ m_switchToAction->setToolTip(i18n("Switch to"));
+ m_switchToAction->setWhatsThis(i18n("<b>Switch to</b><p>Prompts to enter the name of previously opened file to switch to."));
+
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) );
+}
+
+
+QuickOpenPart::~QuickOpenPart()
+{
+}
+
+void QuickOpenPart::slotProjectOpened( )
+{
+}
+
+void QuickOpenPart::slotProjectClosed( )
+{
+}
+
+void QuickOpenPart::slotQuickFileOpen( )
+{
+ QuickOpenFileDialog dlg( this, mainWindow()->main() );
+ dlg.exec();
+}
+
+void QuickOpenPart::slotQuickOpenClass( )
+{
+ QuickOpenClassDialog dlg( this, mainWindow()->main() );
+ dlg.nameEdit->setText( KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ) );
+ dlg.exec();
+}
+
+void QuickOpenPart::slotQuickOpenFunction()
+{
+ QuickOpenFunctionDialog dlg( this, mainWindow()->main() );
+ dlg.nameEdit->setText( KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ) );
+ dlg.exec();
+}
+
+void QuickOpenPart::slotSwitchTo()
+{
+ QuickOpenFileDialog dlg( this, partController()->openURLs(), mainWindow()->main() );
+ dlg.exec();
+}
+
+void QuickOpenPart::selectItem( ItemDom item )
+{
+ Extensions::KDevCodeBrowserFrontend* f = extension< Extensions::KDevCodeBrowserFrontend > ( "KDevelop/CodeBrowserFrontend" );
+
+ if(f != 0) {
+ ItemDom itemDom( &(*item) );
+ f->jumpedToItem( itemDom );
+ } else {
+ kdDebug() << "could not find the proper extension\n";
+ }
+}
+
+void QuickOpenPart::quickOpenFile(const KURL::List urls)
+{
+ QuickOpenFileDialog dlg( this, urls, mainWindow()->main() );
+ dlg.exec();
+}
+
+
+#include "quickopen_part.moc"
diff --git a/parts/quickopen/quickopen_part.h b/parts/quickopen/quickopen_part.h
new file mode 100644
index 00000000..78ab3e45
--- /dev/null
+++ b/parts/quickopen/quickopen_part.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __KDEVPART_QUICKOPEN_H__
+#define __KDEVPART_QUICKOPEN_H__
+
+#include <qguardedptr.h>
+#include <kdevquickopen.h>
+#include <codemodel.h>
+
+class KAction;
+
+class QuickOpenPart : public KDevQuickOpen
+{
+ Q_OBJECT
+public:
+ QuickOpenPart(QObject *parent, const char *name, const QStringList &);
+ virtual ~QuickOpenPart();
+
+ void selectItem( ItemDom item );
+
+ virtual void quickOpenFile(const KURL::List urls);
+
+private slots:
+ void slotProjectOpened();
+ void slotProjectClosed();
+ void slotQuickFileOpen();
+ void slotQuickOpenClass();
+ void slotQuickOpenFunction();
+ void slotSwitchTo();
+
+private:
+ KAction* m_actionQuickOpen;
+ KAction* m_actionQuickOpenClass;
+ KAction* m_actionFunctionOpen;
+ KAction* m_switchToAction;
+};
+
+
+#endif
diff --git a/parts/quickopen/quickopenbase.ui b/parts/quickopen/quickopenbase.ui
new file mode 100644
index 00000000..38e0fcab
--- /dev/null
+++ b/parts/quickopen/quickopenbase.ui
@@ -0,0 +1,178 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>QuickOpenDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>QuickOpenDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>369</width>
+ <height>331</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Quick Open</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>nameLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[NAME]</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>nameEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>itemListLabel</cstring>
+ </property>
+ <property name="text">
+ <string>[ITEM LIST]</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>itemList</cstring>
+ </property>
+ </widget>
+ <widget class="KListBox" row="3" column="0">
+ <property name="name">
+ <cstring>itemList</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0">
+ <property name="name">
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonOk</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KLineEdit" row="1" column="0">
+ <property name="name">
+ <cstring>nameEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>QuickOpenDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>QuickOpenDialogBase</receiver>
+ <slot>slotReturnPressed()</slot>
+ </connection>
+ <connection>
+ <sender>itemList</sender>
+ <signal>doubleClicked(QListBoxItem*)</signal>
+ <receiver>QuickOpenDialogBase</receiver>
+ <slot>slotExecuted(QListBoxItem*)</slot>
+ </connection>
+ <connection>
+ <sender>nameEdit</sender>
+ <signal>returnPressed()</signal>
+ <receiver>QuickOpenDialogBase</receiver>
+ <slot>slotReturnPressed()</slot>
+ </connection>
+ <connection>
+ <sender>nameEdit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>QuickOpenDialogBase</receiver>
+ <slot>slotTextChanged(const QString&amp;)</slot>
+ </connection>
+ <connection>
+ <sender>itemList</sender>
+ <signal>returnPressed(QListBoxItem*)</signal>
+ <receiver>QuickOpenDialogBase</receiver>
+ <slot>slotReturnPressed()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>nameEdit</tabstop>
+ <tabstop>itemList</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+<slots>
+ <slot>slotTextChanged( const QString &amp; )</slot>
+ <slot>executed( QListBoxItem * )</slot>
+ <slot>slotExecuted( QListBoxItem * )</slot>
+ <slot>slotReturnPressed()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klistbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/quickopen/quickopenclassdialog.cpp b/parts/quickopen/quickopenclassdialog.cpp
new file mode 100644
index 00000000..9eec73a5
--- /dev/null
+++ b/parts/quickopen/quickopenclassdialog.cpp
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+#include <kdevlanguagesupport.h>
+
+#include <klistbox.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kcompletion.h>
+#include <klineedit.h>
+
+#include <qregexp.h>
+#include <qlabel.h>
+
+#include "quickopenclassdialog.h"
+#include "quickopen_part.h"
+#include "quickopenfunctionchooseform.h"
+
+QuickOpenClassDialog::QuickOpenClassDialog(QuickOpenPart* part, QWidget* parent, const char* name, bool modal, WFlags fl)
+ : QuickOpenDialog( part, parent, name, modal, fl )
+{
+ nameLabel->setText( i18n("Class &name:") );
+ itemListLabel->setText( i18n("Class &list:") );
+
+ findAllClasses( m_items );
+ QStringList_unique( m_items );
+
+ nameEdit->setFocus();
+
+ itemList->insertStringList( m_items );
+ itemList->setCurrentItem(0);
+}
+
+QuickOpenClassDialog::~QuickOpenClassDialog()
+{
+}
+
+void QuickOpenClassDialog::slotExecuted( QListBoxItem* /*item*/ )
+{
+ accept();
+}
+
+void QuickOpenClassDialog::accept()
+{
+ if( QListBoxItem* item = itemList->selectedItem() )
+ {
+ ClassList klasses = findClass( item->text() );
+ if( klasses.count() == 1 )
+ {
+ ClassDom klass = klasses.first();
+ int startLine, startColumn;
+ klass->getStartPosition( &startLine, &startColumn );
+ m_part->partController()->editDocument( KURL( klass->fileName() ), startLine );
+ selectClassViewItem( ItemDom(&(*klass)) );
+ }
+ else if (klasses.count() > 1 )
+ {
+ //several classes with the same name found
+ QString fileStr;
+
+ QuickOpenFunctionChooseForm fdlg( this, "" );
+ fdlg.setCaption(i18n("Select The Location of Class %1").arg(klasses.first()->name()));
+ fdlg.textLabel2->setText(i18n("Class name:"));
+
+ for( ClassList::const_iterator it = klasses.constBegin(); it != klasses.constEnd() ; ++it )
+ {
+ ClassDom klass = *it;
+ //assemble class name to display (maybe with scope info and specialization)
+ QString classStr = m_part->languageSupport()->formatModelItem(klass);
+ if(klass->hasSpecializationDeclaration())
+ classStr += klass->getSpecializationDeclaration();
+ if(!klass->scope().isEmpty())
+ classStr += " (in " + klass->scope().join("::") + ")";
+ fdlg.argBox->insertItem(classStr);
+
+ fileStr = KURL( klass->fileName() ).fileName();
+ KURL full_url( klass->fileName() );
+ KURL base_url( m_part->project()->projectDirectory()+"/" );
+ fdlg.fileBox->insertItem(fileStr);
+ fdlg.setRelativePath(fdlg.fileBox->count()-1,
+ KURL::relativeURL( base_url, full_url ));
+ }
+ if( fdlg.exec() ){
+ int id = fdlg.argBox->currentItem();
+ if( id>-1 && id < (int) klasses.count() ){
+ ClassDom model = klasses[id];
+ int line, col;
+ model->getStartPosition( &line, &col );
+ selectClassViewItem( ItemDom(&(*model)) );
+ QString fileNameStr = model->fileName();
+ m_part->partController()->editDocument( KURL(fileNameStr), line );
+ }
+ }
+ }
+ }
+
+ QDialog::accept();
+}
+
+void QuickOpenClassDialog::slotReturnPressed( )
+{
+ maybeUpdateSelection();
+ accept();
+}
+
+void QuickOpenClassDialog::findAllClasses( QStringList& lst )
+{
+ findAllClasses( lst, m_part->codeModel()->globalNamespace() );
+}
+
+void QuickOpenClassDialog::findAllClasses( QStringList& lst, const ClassDom klass )
+{
+ QStringList fullName = klass->scope();
+ fullName << klass->name();
+ lst << fullName.join( "::" );
+
+ const ClassList classList = klass->classList();
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ findAllClasses( lst, *it );
+}
+
+void QuickOpenClassDialog::findAllClasses( QStringList& lst, const NamespaceDom ns )
+{
+ const NamespaceList namespaceList = ns->namespaceList();
+ for( NamespaceList::ConstIterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
+ findAllClasses( lst, *it );
+
+ const ClassList classList = ns->classList();
+ for( ClassList::ConstIterator it=classList.begin(); it!=classList.end(); ++it )
+ findAllClasses( lst, *it );
+}
+
+ClassList QuickOpenClassDialog::findClass( const QString& name )
+{
+ QStringList path = QStringList::split( "::", name );
+ return findClass( path, m_part->codeModel()->globalNamespace() );
+}
+
+ClassList QuickOpenClassDialog::findClass( QStringList& path, const NamespaceDom ns )
+{
+ ClassList list;
+ if( path.isEmpty() )
+ return list;
+
+ QString current = path.front();
+ if( ns->hasNamespace(current) )
+ {
+ path.pop_front();
+ list += findClass( path, ns->namespaceByName(current) );
+ path.push_front( current );
+ }
+
+ if( ns->hasClass(current) )
+ {
+ path.pop_front();
+ list += findClass( path, ns->classByName(current) );
+ }
+
+ return list;
+}
+
+ClassList QuickOpenClassDialog::findClass( QStringList& path, const ClassList klasses )
+{
+ ClassList list;
+ if( path.isEmpty() )
+ {
+ list += klasses;
+ return list;
+ }
+
+ for (ClassList::const_iterator it = klasses.constBegin(); it != klasses.constEnd(); ++it)
+ {
+ list += findClass(path, *it);
+ }
+
+ return list;
+}
+
+ClassList QuickOpenClassDialog::findClass( QStringList &path, const ClassDom klass )
+{
+ ClassList list;
+ if( path.isEmpty() )
+ {
+ list << klass;
+ return list;
+ }
+
+ QString current = path.front();
+ if( klass->hasClass(current) )
+ {
+ path.pop_front();
+ list += findClass( path, klass->classByName(current) );
+ path.push_front(current);
+ }
+
+ return list;
+}
+
+#include "quickopenclassdialog.moc"
+
diff --git a/parts/quickopen/quickopenclassdialog.h b/parts/quickopen/quickopenclassdialog.h
new file mode 100644
index 00000000..afed19c8
--- /dev/null
+++ b/parts/quickopen/quickopenclassdialog.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef QUICKOPENCLASSDIALOG_H
+#define QUICKOPENCLASSDIALOG_H
+
+#include "quickopendialog.h"
+#include <codemodel.h>
+#include <qstringlist.h>
+
+class QuickOpenPart;
+
+class QuickOpenClassDialog : public QuickOpenDialog
+{
+ Q_OBJECT
+public:
+ QuickOpenClassDialog(QuickOpenPart* part, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 );
+ virtual ~QuickOpenClassDialog();
+
+public slots:
+ virtual void slotExecuted( QListBoxItem* );
+ virtual void slotReturnPressed();
+
+protected:
+ void findAllClasses( QStringList& classList );
+ void findAllClasses( QStringList& classList, const ClassDom klass );
+ void findAllClasses( QStringList& classList, const NamespaceDom ns );
+
+ ClassList findClass( const QString& name );
+ ClassList findClass( QStringList& path, const NamespaceDom ns );
+ ClassList findClass( QStringList& path, const ClassList klasses );
+ ClassList findClass( QStringList& path, const ClassDom klass );
+
+protected slots:
+ virtual void accept();
+};
+
+#endif
+
diff --git a/parts/quickopen/quickopendialog.cpp b/parts/quickopen/quickopendialog.cpp
new file mode 100644
index 00000000..d12c6f44
--- /dev/null
+++ b/parts/quickopen/quickopendialog.cpp
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) KDevelop Authors <kdevelop-devel@kdevelop.org>, (C) 2004
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <qapplication.h>
+#include <qregexp.h>
+
+#include <klistbox.h>
+#include <klineedit.h>
+#include <kdebug.h>
+
+#include "quickopendialog.h"
+#include "quickopen_part.h"
+
+QuickOpenDialog::QuickOpenDialog(QuickOpenPart* part, QWidget* parent, const char* name, bool modal, WFlags fl)
+ : QuickOpenDialogBase( parent, name, modal, fl ), m_part( part )
+{
+ nameEdit->installEventFilter(this);
+ connect( &m_typeTimeout, SIGNAL(timeout()), this, SLOT(slotTextChangedDelayed()) );
+}
+
+QuickOpenDialog::~QuickOpenDialog()
+{
+}
+
+void QuickOpenDialog::slotTextChanged(const QString &)
+{
+ m_typeTimeout.start( 100, true );
+}
+
+void QuickOpenDialog::maybeUpdateSelection() {
+ if( m_typeTimeout.isActive() )
+ {
+ m_typeTimeout.stop();
+ slotTextChangedDelayed();
+ }
+}
+
+void QuickOpenDialog::setFirstItemSelected()
+{
+ // Make sure the list has a current item or our event will not be handled properly.
+ itemList->setCurrentItem(0);
+ // We are doing this indirectly because the event handler does things for multiple
+ // selections we cannot do through the public interface.
+ QKeyEvent e(QEvent::KeyPress, Qt::Key_Home, 0, 0);
+ QApplication::sendEvent(itemList, &e);
+}
+
+void QuickOpenDialog::slotTextChangedDelayed()
+{
+ itemList->clear();
+ itemList->insertStringList( wildCardCompletion( nameEdit->text() ) );
+ setFirstItemSelected();
+}
+
+bool QuickOpenDialog::eventFilter( QObject * watched, QEvent * e )
+{
+ if (!watched || !e)
+ return true;
+
+ if ((watched == nameEdit) && (e->type() == QEvent::KeyPress))
+ {
+ QKeyEvent *ke = (QKeyEvent*)e;
+ if (ke->key() == Key_Up)
+ {
+ QApplication::sendEvent(itemList, e);
+ nameEdit->blockSignals(true);
+ itemSelectionChanged();
+ nameEdit->blockSignals(false);
+ return true;
+ } else if (ke->key() == Key_Down)
+ {
+ QApplication::sendEvent(itemList, e);
+ nameEdit->blockSignals(true);
+ itemSelectionChanged();
+ nameEdit->blockSignals(false);
+ return true;
+ } else if ((ke->key() == Key_Next) || (ke->key() == Key_Prior))
+ {
+ QApplication::sendEvent(itemList, e);
+ nameEdit->blockSignals(true);
+ itemSelectionChanged();
+ nameEdit->blockSignals(false);
+ }
+ }
+
+ return QWidget::eventFilter(watched, e);
+}
+
+void QuickOpenDialog::selectClassViewItem(ItemDom item)
+{
+ m_part->selectItem( item );
+}
+
+QStringList QuickOpenDialog::wildCardCompletion(const QString & text)
+{
+ if ( text.isEmpty() ) return m_items;
+
+ QRegExp re( text, false, true );
+ QStringList matches;
+ QStringList::const_iterator it = m_items.begin();
+ while( it != m_items.end() )
+ {
+ if ( (*it).find( re ) != -1 )
+ {
+ matches << *it;
+ }
+ ++it;
+ }
+
+ return matches;
+}
+
+void QuickOpenDialog::QStringList_unique( QStringList & list )
+{
+ if ( list.size() < 2 ) return;
+
+ list.sort();
+
+ QStringList::iterator it = list.begin();
+ QStringList::iterator it2 = it;
+ while ( it2 != list.end() )
+ {
+ ++it2;
+ while ( it2 != list.end() && *it2 == *it )
+ {
+ it2 = list.remove( it2 );
+ }
+ it = it2;
+ }
+}
+
+void QuickOpenDialog::itemSelectionChanged() {
+ nameEdit->setText(itemList->currentText());
+}
+
+#include "quickopendialog.moc"
+
+// kate: space-indent on; indent-width 4; tab-width 4; show-tabs on;
diff --git a/parts/quickopen/quickopendialog.h b/parts/quickopen/quickopendialog.h
new file mode 100644
index 00000000..7eb989c6
--- /dev/null
+++ b/parts/quickopen/quickopendialog.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) KDevelop Authors <kdevelop-devel@kdevelop.org>, (C) 2004
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef QUICKOPENDIALOG_H
+#define QUICKOPENDIALOG_H
+
+#include <qstringlist.h>
+#include <qtimer.h>
+
+#include <codemodel.h>
+
+#include "quickopenbase.h"
+
+class QuickOpenPart;
+class KCompletion;
+
+class QuickOpenDialog : public QuickOpenDialogBase
+{
+ Q_OBJECT
+
+public:
+ QuickOpenDialog(QuickOpenPart* part, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 );
+ virtual ~QuickOpenDialog();
+
+ virtual bool eventFilter(QObject *watched, QEvent *e);
+
+ void selectClassViewItem(ItemDom item);
+
+public slots:
+ virtual void slotTextChanged(const QString&);
+ virtual void slotTextChangedDelayed();
+
+protected:
+ void maybeUpdateSelection();
+ void setFirstItemSelected();
+ virtual void itemSelectionChanged();
+ void QStringList_unique( QStringList & list );
+ QStringList wildCardCompletion( const QString & text );
+ QStringList m_items;
+ QuickOpenPart* m_part;
+ QTimer m_typeTimeout;
+
+};
+
+#endif
+
diff --git a/parts/quickopen/quickopenfiledialog.cpp b/parts/quickopen/quickopenfiledialog.cpp
new file mode 100644
index 00000000..96474367
--- /dev/null
+++ b/parts/quickopen/quickopenfiledialog.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+
+
+#include <klistbox.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kcompletion.h>
+#include <klineedit.h>
+
+
+#include <qregexp.h>
+#include <qlabel.h>
+
+#include "quickopenfiledialog.h"
+#include "quickopen_part.h"
+
+QuickOpenFileDialog::QuickOpenFileDialog(QuickOpenPart* part, QWidget* parent, const char* name, bool modal, WFlags fl)
+ : QuickOpenDialog( part, parent, name, modal, fl ), m_hasFullPaths( false )
+{
+ nameLabel->setText( i18n("File &name:") );
+ itemListLabel->setText( i18n("File &list:") );
+
+ m_items = m_part->project()->allFiles();
+
+ nameEdit->setFocus();
+
+ itemList->setSelectionMode( QListBox::Extended );
+ itemList->insertStringList( m_items );
+ setFirstItemSelected();
+}
+
+QuickOpenFileDialog::QuickOpenFileDialog(QuickOpenPart* part, const KURL::List & urls, QWidget* parent, const char* name, bool modal, WFlags fl)
+ : QuickOpenDialog( part, parent, name, modal, fl ), m_hasFullPaths( true )
+{
+ nameLabel->setText( i18n("File &name:") );
+ itemListLabel->setText( i18n("File &list:") );
+
+ m_items = urls.toStringList();
+ QStringList_unique( m_items );
+
+ if (m_part->project())
+ {
+ for (unsigned int i = 0; i < m_items.count(); ++i)
+ {
+ QString url = m_items[i];
+ QString projectUrl = "file://" + m_part->project()->projectDirectory();
+ if (url.startsWith(projectUrl))
+ m_items[i] = url.mid(projectUrl.length() + 1);
+ }
+ }
+
+ nameEdit->setFocus();
+
+ itemList->setSelectionMode( QListBox::Extended );
+ itemList->insertStringList( m_items );
+ setFirstItemSelected();
+}
+
+QuickOpenFileDialog::~QuickOpenFileDialog()
+{
+}
+
+void QuickOpenFileDialog::slotExecuted( QListBoxItem* item )
+{
+ if ( !item ) return;
+
+ if ( m_hasFullPaths )
+ {
+ m_part->partController()->editDocument( KURL::fromPathOrURL( item->text() ) );
+ }
+ else
+ {
+ m_part->partController()->editDocument( KURL::fromPathOrURL( m_part->project()->projectDirectory() + "/" + item->text() ) );
+ }
+ accept();
+}
+
+void QuickOpenFileDialog::slotReturnPressed( )
+{
+ maybeUpdateSelection();
+
+ for (int i = 0; i < itemList->count(); ++i)
+ {
+ if (itemList->isSelected(i))
+ {
+ if (m_hasFullPaths)
+ {
+ m_part->partController()->editDocument(KURL::fromPathOrURL(itemList->item(i)->text()));
+ }
+ else
+ {
+ m_part->partController()->editDocument(KURL::fromPathOrURL(m_part->project()->projectDirectory() + "/" + itemList->item(i)->text()));
+ }
+ }
+ }
+ accept();
+}
+
+#include "quickopenfiledialog.moc"
+
diff --git a/parts/quickopen/quickopenfiledialog.h b/parts/quickopen/quickopenfiledialog.h
new file mode 100644
index 00000000..0f36f1f8
--- /dev/null
+++ b/parts/quickopen/quickopenfiledialog.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef QUICKOPENFILEDIALOG_H
+#define QUICKOPENFILEDIALOG_H
+
+#include "quickopendialog.h"
+#include <qstringlist.h>
+
+#include <kurl.h>
+
+class QuickOpenPart;
+class KCompletion;
+
+class QuickOpenFileDialog : public QuickOpenDialog
+{
+ Q_OBJECT
+public:
+ QuickOpenFileDialog(QuickOpenPart* part, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 );
+ QuickOpenFileDialog(QuickOpenPart* part, const KURL::List &, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 );
+ virtual ~QuickOpenFileDialog();
+
+public slots:
+ virtual void slotExecuted( QListBoxItem* );
+ virtual void slotReturnPressed();
+
+private:
+ bool m_hasFullPaths;
+};
+
+#endif
+
diff --git a/parts/quickopen/quickopenfunctionchooseform.cpp b/parts/quickopen/quickopenfunctionchooseform.cpp
new file mode 100644
index 00000000..c83a8765
--- /dev/null
+++ b/parts/quickopen/quickopenfunctionchooseform.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2004 Ahn, Duk J.(adjj22@kornet.net) (adjj1@hanmail.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <klistbox.h>
+#include <klocale.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <ksqueezedtextlabel.h>
+
+#include <codemodel.h>
+
+#include "quickopenfunctionchooseform.h"
+
+QuickOpenFunctionChooseForm::QuickOpenFunctionChooseForm(QWidget* parent, const char* name, bool modal, WFlags fl)
+: QuickOpenFunctionChooseFormBase(parent,name, modal,fl)
+{
+ setCaption( i18n("Select One Argument or File of Function %1").arg( name ) );
+ slotArgsChange( 0 );
+ slotFileChange( 0 );
+}
+
+QuickOpenFunctionChooseForm::~QuickOpenFunctionChooseForm()
+{
+}
+
+void QuickOpenFunctionChooseForm::slotArgsChange( int id )
+{
+ argBox->setCurrentItem( id );
+}
+
+void QuickOpenFunctionChooseForm::slotFileChange( int id )
+{
+ fileBox->setCurrentItem( id );
+ filepathlabel->setText( m_relPaths[id] );
+}
+
+
+#include "quickopenfunctionchooseform.moc"
+
diff --git a/parts/quickopen/quickopenfunctionchooseform.h b/parts/quickopen/quickopenfunctionchooseform.h
new file mode 100644
index 00000000..2529ed46
--- /dev/null
+++ b/parts/quickopen/quickopenfunctionchooseform.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2004 Ahn, Duk J.(adjj22@kornet.net) (adjj1@hanmail.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef QUICKOPENFUNCTIONCHOOSEFORM_H
+#define QUICKOPENFUNCTIONCHOOSEFORM_H
+
+#include "quickopenfunctionchooseformbase.h"
+
+#include <qmap.h>
+
+class QuickOpenFunctionChooseForm : public QuickOpenFunctionChooseFormBase
+{
+ Q_OBJECT
+
+public:
+ QuickOpenFunctionChooseForm(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~QuickOpenFunctionChooseForm();
+
+ void setRelativePath(int id, const QString &path) { m_relPaths[id] = path; }
+
+public slots:
+ virtual void slotArgsChange( int id );
+ virtual void slotFileChange( int id );
+
+private:
+ QMap<int, QString> m_relPaths;
+
+};
+
+#endif
+
diff --git a/parts/quickopen/quickopenfunctionchooseformbase.ui b/parts/quickopen/quickopenfunctionchooseformbase.ui
new file mode 100644
index 00000000..09c872d9
--- /dev/null
+++ b/parts/quickopen/quickopenfunctionchooseformbase.ui
@@ -0,0 +1,231 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>QuickOpenFunctionChooseFormBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>QuickOpenFunctionChooseFormBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>642</width>
+ <height>373</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KSqueezedTextLabel" row="1" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>filepathlabel</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="3">
+ <property name="name">
+ <cstring>cancelBtn</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>okBtn</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>File name:</string>
+ </property>
+ </widget>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>fileBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>261</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Function arguments list:</string>
+ </property>
+ </widget>
+ <widget class="KListBox">
+ <property name="name">
+ <cstring>argBox</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentItem">
+ <number>-1</number>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>okBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>argBox</sender>
+ <signal>highlighted(int)</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>slotFileChange(int)</slot>
+ </connection>
+ <connection>
+ <sender>fileBox</sender>
+ <signal>highlighted(int)</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>slotArgsChange(int)</slot>
+ </connection>
+ <connection>
+ <sender>argBox</sender>
+ <signal>returnPressed(QListBoxItem*)</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>argBox</sender>
+ <signal>clicked(QListBoxItem*)</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>fileBox</sender>
+ <signal>returnPressed(QListBoxItem*)</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>fileBox</sender>
+ <signal>clicked(QListBoxItem*)</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>QuickOpenFunctionChooseFormBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>fileBox</tabstop>
+ <tabstop>argBox</tabstop>
+ <tabstop>okBtn</tabstop>
+ <tabstop>cancelBtn</tabstop>
+</tabstops>
+<slots>
+ <slot specifier="pure virtual">slotFileChange( int id )</slot>
+ <slot specifier="pure virtual">slotArgsChange( int id )</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>ksqueezedtextlabel.h</includehint>
+ <includehint>klistbox.h</includehint>
+ <includehint>klistbox.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/quickopen/quickopenfunctiondialog.cpp b/parts/quickopen/quickopenfunctiondialog.cpp
new file mode 100644
index 00000000..ede3450b
--- /dev/null
+++ b/parts/quickopen/quickopenfunctiondialog.cpp
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2004 Ahn, Duk J.(adjj22@kornet.net) (adjj1@hanmail.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <klocale.h>
+#include <qlabel.h>
+#include <qvaluelist.h>
+
+#include <kcompletion.h>
+#include <kdebug.h>
+#include <klistbox.h>
+#include <kmessagebox.h>
+#include <klineedit.h>
+
+#include <kdevplugin.h>
+#include <codemodel_utils.h>
+#include <kdevpartcontroller.h>
+#include <kdevproject.h>
+#include <kdevlanguagesupport.h>
+#include <qregexp.h>
+
+
+#include "quickopenfunctionchooseform.h"
+#include "quickopenfunctiondialog.h"
+
+QuickOpenFunctionDialog::QuickOpenFunctionDialog( QuickOpenPart *part, QWidget* parent, const char* name, bool modal, WFlags fl)
+: QuickOpenDialog(part, parent, name, modal, fl)
+{
+ nameLabel->setText( i18n("Function &name:") );
+ itemListLabel->setText( i18n("Function &list:") );
+
+ fillItemList();
+
+ itemList->insertStringList( wildCardCompletion( "" ) );
+
+ nameEdit->setFocus();
+
+ itemList->setCurrentItem( 0 );
+}
+
+void QuickOpenFunctionDialog::fillItemList() {
+ m_items.clear();
+ m_functionDefList.clear();
+ FileList fileList = m_part->codeModel()->fileList();
+
+ // for each one file, get all functions
+ FileDom fileDom;
+ for( FileList::Iterator it = fileList.begin() ; it!=fileList.end() ; ++it ){
+ fileDom = *it;
+ FunctionDefinitionList defs = CodeModelUtils::allFunctionDefinitionsDetailed( fileDom ).functionList;
+ if( defs.isEmpty() ) {
+ m_functionDefList += CodeModelUtils::allFunctionsDetailed( fileDom ).functionList;
+ } else {
+ for( FunctionDefinitionList::iterator it = defs.begin(); it != defs.end(); ++it )
+ (m_functionDefList).append( (*it).data() );
+ }
+ }
+
+ for( FunctionList::const_iterator it = m_functionDefList.begin(); it != m_functionDefList.end(); ++it )
+ m_items << (*it)->name();
+ QStringList_unique( m_items );
+}
+
+QuickOpenFunctionDialog::~QuickOpenFunctionDialog()
+{
+}
+
+void QuickOpenFunctionDialog::gotoFile( QString name )
+{
+ FunctionModel *fmodel;
+ FunctionList funcList;
+ FunctionDom fdom;
+
+ for( FunctionList::ConstIterator it = m_functionDefList.begin() ; it!=m_functionDefList.end() ; ++it ){
+ fdom = *it;
+ fmodel = fdom.data();
+ if( fmodel->name() == name ){
+ funcList.append( fdom );
+ }
+ }
+ if( funcList.count() == 1 ){
+ fdom = funcList.first();
+ fmodel = fdom.data();
+ QString fileNameStr = fmodel->fileName();
+ int startline, startcol;
+ fmodel->getStartPosition( &startline, &startcol );
+ m_part->partController()->editDocument( KURL( fileNameStr), startline, startcol );
+ selectClassViewItem( ItemDom(&(*fmodel)) );
+
+ }else if( funcList.count() > 1 ){
+ QString fileStr;
+
+ QuickOpenFunctionChooseForm fdlg( this, name.ascii() );
+
+ for( FunctionList::Iterator it = funcList.begin() ; it!=funcList.end() ; ++it ){
+ fmodel = (*it).data();
+
+ fdlg.argBox->insertItem( m_part->languageSupport()->formatModelItem(fmodel) +
+ (fmodel->scope().isEmpty() ? "" : " (in " + fmodel->scope().join("::") + ")"));
+ fileStr = KURL( fmodel->fileName() ).fileName();
+ KURL full_url( fmodel->fileName() );
+ KURL base_url( part()->project()->projectDirectory()+"/" );
+ fdlg.setRelativePath(fdlg.fileBox->count(),
+ KURL::relativeURL( base_url, full_url ));
+ fdlg.fileBox->insertItem(fileStr);
+ }
+ if( fdlg.exec() ){
+ int id = fdlg.argBox->currentItem();
+ if( id>-1 && id < (int) funcList.count() ){
+ FunctionModel *model = funcList[id].data();
+ int line, col;
+ model->getStartPosition( &line, &col );
+ selectClassViewItem( ItemDom(&(*model)) );
+ QString fileNameStr = model->fileName();
+ m_part->partController()->editDocument( KURL(fileNameStr), line );
+ }
+ }
+ }
+ else{
+ KMessageBox::error( this, i18n("Error: cannot find matching name function.") );
+ }
+
+ accept();
+}
+
+void QuickOpenFunctionDialog::slotExecuted(QListBoxItem* item)
+{
+ if( item ){
+ gotoFile( item->text() );
+ }
+}
+
+void QuickOpenFunctionDialog::executed(QListBoxItem*)
+{
+}
+
+void QuickOpenFunctionDialog::itemSelectionChanged() {
+ QString text = nameEdit->text();
+ QString txt = text;
+ QStringList parts = QStringList::split("::", text);
+ if( !text.endsWith( "::" ) && !parts.isEmpty() )
+ parts.pop_back();
+ parts << itemList->currentText();
+ nameEdit->setText(parts.join("::"));
+}
+
+void QuickOpenFunctionDialog::slotTextChangedDelayed() {
+ QString text = nameEdit->text();
+ QString txt = text;
+ QStringList parts = QStringList::split("::", text);
+ if(text.endsWith("::") || parts.isEmpty()) {
+ txt = "";
+ }else{
+ txt = parts.back();
+ parts.pop_back();
+ }
+ QValueList<QRegExp> regExpParts;
+ for( QStringList::const_iterator it = parts.begin(); it != parts.end(); ++it ) {
+ regExpParts << QRegExp( *it, false, true );
+ }
+
+ QString scope = parts.join("::");
+
+ if( m_scope != scope ) {
+ if( !scope.startsWith(m_scope) ) { ///Not a specialization, so reload all function-definitions
+ fillItemList();
+ }
+
+ if(!parts.isEmpty()) {
+ FunctionList accepted;
+ QStringList acceptedItems;
+ FunctionList::iterator it = m_functionDefList.begin();
+ while(it != m_functionDefList.end()) {
+ QStringList scope = (*it)->scope();
+ QValueList<QRegExp>::iterator mit = regExpParts.begin();
+ QStringList::iterator sit = scope.begin();
+ bool fail = false;
+ while(mit != regExpParts.end()) {
+ while(sit != scope.end() && !(*mit).exactMatch( *sit ) ) ++sit;
+ if(sit == scope.end()) {
+ fail = true;
+ break;
+ }
+ ++mit;
+ }
+ if(!fail) {
+ accepted.append(*it);
+ acceptedItems << (*it)->name();
+ }
+ ++it;
+ }
+ m_functionDefList = accepted;
+ m_items = acceptedItems;
+ QStringList_unique( m_items );
+ }
+
+ m_scope = scope;
+ }
+
+ itemList->clear();
+ itemList->insertStringList( wildCardCompletion( txt ) );
+ itemList->setCurrentItem(0);
+}
+
+void QuickOpenFunctionDialog::slotReturnPressed()
+{
+ maybeUpdateSelection();
+ QListBoxItem *listboxItem = itemList->selectedItem();
+ slotExecuted( listboxItem );
+}
+
+#include "quickopenfunctiondialog.moc"
+
diff --git a/parts/quickopen/quickopenfunctiondialog.h b/parts/quickopen/quickopenfunctiondialog.h
new file mode 100644
index 00000000..14432b48
--- /dev/null
+++ b/parts/quickopen/quickopenfunctiondialog.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2004 Ahn, Duk J.(adjj22@kornet.net) (adjj1@hanmail.net)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef QUICKOPENFUNCTIONDLG_H
+#define QUICKOPENFUNCTIONDLG_H
+
+#include <codemodel.h>
+
+#include "quickopendialog.h"
+#include "quickopen_part.h"
+
+class KCompletion;
+class QuickOpenPart;
+
+class QuickOpenFunctionDialog : public QuickOpenDialog
+{
+ Q_OBJECT
+
+public:
+ QuickOpenFunctionDialog( QuickOpenPart* part, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~QuickOpenFunctionDialog();
+
+ void gotoFile( QString name );
+
+ QuickOpenPart* part(){ return m_part; };
+
+public slots:
+ virtual void slotExecuted(QListBoxItem*);//itemList executed, returnPressed
+ virtual void executed(QListBoxItem*); //
+ virtual void slotReturnPressed(); //buttonOk clicked, nameEdit returnPressed
+ virtual void slotTextChangedDelayed();
+ virtual void itemSelectionChanged();
+
+protected:
+ void fillItemList();
+ QString m_scope;
+ FunctionList m_functionDefList;
+ QStringList m_functionStrList;
+
+};
+
+#endif
+
diff --git a/parts/regexptest/Makefile.am b/parts/regexptest/Makefile.am
new file mode 100644
index 00000000..43edb690
--- /dev/null
+++ b/parts/regexptest/Makefile.am
@@ -0,0 +1,17 @@
+# Here resides the regexptest part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevregexptest.la
+libkdevregexptest_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevregexptest_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevregexptest_la_SOURCES = regexptestpart.cpp regexptestdlg.cpp regexptestdlgbase.ui
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevregexptest.desktop
+
+rcdir = $(kde_datadir)/kdevregexptest
+rc_DATA = kdevregexptest.rc
diff --git a/parts/regexptest/README.dox b/parts/regexptest/README.dox
new file mode 100644
index 00000000..d145ae76
--- /dev/null
+++ b/parts/regexptest/README.dox
@@ -0,0 +1,49 @@
+/** \class RegexpTestPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/regexptest/kdevregexptest.desktop b/parts/regexptest/kdevregexptest.desktop
new file mode 100644
index 00000000..85370fbf
--- /dev/null
+++ b/parts/regexptest/kdevregexptest.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Tool to design and test regular expressions against common regexp syntaxes.
+Comment[ca]=Eina per a dissenyar i provar expressions regulars amb sintaxis d'expressions regulars comuns.
+Comment[da]=Værktøj til at designe og teste regulære udtryk imod almindelige regexp syntakser.
+Comment[de]=Ein Werkzeug zum Erstellen und Testen regulärer Ausdrücke.
+Comment[el]=Εργαλείο για το σχεδιασμό και τη δοκιμή κανονικών εκφράσεων με κοινή σύνταξη κανονικών εκφράσεων.
+Comment[es]=Herramienta para diseñar y probar expresiones regulares con sintaxis comunes.
+Comment[et]=Vahend regulaaravaldiste loomiseks ja korrektsuse testimiseks.
+Comment[eu]=Ohizko regexp sintaxiaren arabera espresio erregularra diseinatu eta egiaztatzeko tresna.
+Comment[fa]=ابزاری برای طراحی و آزمودن عبارتهای منظم در برابر نحوهای مشترک عبارت منظم
+Comment[fr]=Outil pour créer et tester des expressions rationnelles par rapport aux syntaxes des expressions rationnnelles communes.
+Comment[gl]=Ferramenta para deseñar e probar expresións regulares con sintaxes típicas para expresións regulares
+Comment[hu]=Tervezőprogram reguláris kifejezések tervezéséhez és teszteléséhez, többféle szintaxis szerint
+Comment[it]=Strumento per progettare e verificare espressioni regolari con le sintassi comuni di regexp.
+Comment[ja]=共通の regexp 構文に対する正規表現を設計したりテストするツール
+Comment[ms]=Alatan untuk mereka dan menguji regular expressions berbanding sintaks biasa regexp.
+Comment[nds]=En Warktüüch för't Opstellen un Utproberen vun reguleer Utdrück in en Reeg "regexp"-Schriefwiesen.
+Comment[ne]=साझा रेगेक्प वाक्य संरचनाको बिरूद्ध नियमित अभिव्यक्ति डिजाइन र परीक्षण गर्ने उपकरण ।
+Comment[nl]=Gereedschap voor het ontwerpen en testen van reguliere expressies.
+Comment[pl]=Narzędzie do tworzenia i testowania wyrażeń regularnych.
+Comment[pt]=Uma ferramenta para desenhar e testar expressões regulares sobre várias sintaxes comuns de expressões.
+Comment[pt_BR]=Ferramenta para desenvolver e testar expressões regulares com base na sintaxe comum das regexp.
+Comment[ru]=Средство для определения и проверки регулярных выражений на предмет соответствия их наиболее распространённым вариантам синтаксиса.
+Comment[sk]=Nástroj pre dizajn a testovanie regulárnych výrazov.
+Comment[sr]=Алат за дизајн и тестирање регуларних израза насупрот уобичајеним рег.из. синтаксама.
+Comment[sr@Latn]=Alat za dizajn i testiranje regularnih izraza nasuprot uobičajenim reg.iz. sintaksama.
+Comment[sv]=Verktyg för att skapa och testa reguljära uttryck mot vanlig syntax för reguljära uttryck.
+Comment[ta]=ரேக்ஸ்ப் தொடரமைப்பதற்கு எதிராக கருவி உபயோகித்து வரைதல் மற்றும் வாடிக்கையான தொடர்களை பரிசோதிக்க.
+Comment[tg]=Восита барои муаян намудан ва тафтиш намудани баёни ботартиб дар асоси ҷорӣ шудаи вариантҳои синтаксисӣ менамояд.
+Comment[tr]=Genel regexp söz dizimlerine karşı düzenli ifadeleri düzenlemeye ve test etmeye yarayan araç.
+Comment[zh_CN]=依据通用正则表达式语法进行正则表达式设计和测试的工具。
+Comment[zh_TW]=設計、測試正規表示式語法的工具。
+Name=KDevRegexpTest
+Name[da]=KDevelop test af regulære udtryk
+Name[de]=RegExp-Überprüfung (KDevelop)
+Name[hi]=के-डेव-रेगएक्सपी-टेक्स्ट
+Name[nds]=RegExp-Prööv (KDevelop)
+Name[pl]=KDevTestWyrReg
+Name[sk]=KDev Regexp test
+Name[sv]=KDevelop test av reguljära uttryck
+Name[ta]=Kடேவ்ரெக்ஸ்ப் சோதனை
+Name[zh_TW]=KDevelop 正規表示式測試
+GenericName=Regular Expression Tester
+GenericName[ca]=Comprovador d'expressions regulars
+GenericName[da]=Test af regulære udtryk
+GenericName[de]=RegExp-Überprüfung
+GenericName[el]=Δοκιμαστής κανονικών εκφράσεων
+GenericName[es]=Comprobador de expresiones regulares
+GenericName[et]=Regulaaravaldiste testija
+GenericName[eu]=Espresio erregular egiaztatzailea
+GenericName[fa]=آزمایندۀ عبارت منظم
+GenericName[fr]=Testeur d'expressions rationnelles
+GenericName[gl]=Comprobador de expresións regulares
+GenericName[hi]=रेगुलर एक्सप्रेशन टेस्टर
+GenericName[hu]=Tesztprogram reguláris kifejezésekhez
+GenericName[it]=Verificatore per espressioni regolari
+GenericName[ja]=正規表現テスタ
+GenericName[ms]=Penguji Regular Expression
+GenericName[nds]=RegExp-Prööv
+GenericName[ne]=नियमित अभिव्यक्ति परीक्षक
+GenericName[nl]=Reguliere expressie-tester
+GenericName[pl]=Tester wyrażeń regularnych
+GenericName[pt]=Ferramenta de Teste de Expressões Regulares
+GenericName[pt_BR]=Testador de Expressão Regular
+GenericName[ru]=Проверка регулярных выражений
+GenericName[sk]=Tester pre regulárne výrazy
+GenericName[sl]=Preverjalnik regularnih izrazov
+GenericName[sr]=Тестер регуларних израза
+GenericName[sr@Latn]=Tester regularnih izraza
+GenericName[sv]=Test av reguljära uttryck
+GenericName[ta]=வாடிக்கையான தொடர்களை பரிசோதிப்பவர்.
+GenericName[tg]=Тафтиши баёни ботартиб
+GenericName[tr]=Düzenli İfade Test Edicisi
+GenericName[zh_CN]=正则表达式测试
+GenericName[zh_TW]=正規表示式測試器
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevregexptest
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=ScriptDevelopment,CDevelopment,CPPDevelopment
diff --git a/parts/regexptest/kdevregexptest.rc b/parts/regexptest/kdevregexptest.rc
new file mode 100644
index 00000000..99893d7f
--- /dev/null
+++ b/parts/regexptest/kdevregexptest.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevRegExpTest" version="1">
+<MenuBar>
+ <Menu name="tools" >
+ <Action name="tools_regexptest" group="tools_file_operations"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/regexptest/regexptestdlg.cpp b/parts/regexptest/regexptestdlg.cpp
new file mode 100644
index 00000000..a211a797
--- /dev/null
+++ b/parts/regexptest/regexptestdlg.cpp
@@ -0,0 +1,263 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "regexptestdlg.h"
+
+#include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
+#include <regex.h>
+#include <qlabel.h>
+#include <qlistview.h>
+#include <qradiobutton.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+#include <klineedit.h>
+#include <kdeversion.h>
+#include <kregexp.h>
+#include <kdebug.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/editinterface.h>
+#include <kparts/componentfactory.h>
+#include <kregexpeditorinterface.h>
+
+#include "kdevplugin.h"
+#include "kdevpartcontroller.h"
+
+
+RegexpTestDialog::RegexpTestDialog(KDevPlugin *part)
+ : RegexpTestDialogBase(0, "regexp test dialog", false), _regexp_dialog(0)
+{
+ pattern_edit->setFocus();
+ pattern_edit->setFont(KGlobalSettings::fixedFont());
+ teststring_edit->setFont(KGlobalSettings::fixedFont());
+ subgroups_listview->setSorting(0);
+
+ m_part = part;
+}
+
+
+RegexpTestDialog::~RegexpTestDialog()
+{}
+
+
+void RegexpTestDialog::showEvent(QShowEvent *)
+{
+ KParts::ReadWritePart *rwpart = dynamic_cast<KParts::ReadWritePart*>
+ (m_part->partController()->activePart());
+ insertbutton->setEnabled(rwpart);
+}
+
+
+void RegexpTestDialog::somethingChanged()
+{
+ success_label->clear();
+ subgroups_listview->clear();
+
+ if ( qregexp_button->isChecked() || qregexp_min_button->isChecked() )
+ checkQRegExp();
+ else if ( kregexp_button->isChecked() )
+ checkKRegExp();
+ else
+ checkPOSIX();
+}
+
+void RegexpTestDialog::checkQRegExp()
+{
+ QRegExp rx( pattern_edit->text() );
+ rx.setMinimal( qregexp_min_button->isChecked() );
+ if ( !rx.isValid() ) {
+#if QT_VERSION >= 0x030100
+ success_label->setText( rx.errorString() );
+#else
+ success_label->setText( i18n("Error compiling the regular expression.") );
+#endif
+ return;
+ }
+ if ( rx.search( teststring_edit->text() ) < 0 ) {
+ success_label->setText( i18n( "No match" ) );
+ return;
+ }
+ success_label->setText( i18n("Successfully matched") );
+#if QT_VERSION >= 0x030100
+ int numCaptures = rx.numCaptures() + 1;
+#else
+ int numCaptures = 10;
+#endif
+ for ( int i = 0; i < numCaptures; ++i ) {
+ new QListViewItem( subgroups_listview, QString::number( i ), rx.cap( i ) );
+ }
+}
+
+void RegexpTestDialog::checkKRegExp()
+{
+ KRegExp rx;
+ if ( !rx.compile( pattern_edit->text().latin1() ) ) {
+ success_label->setText( i18n( "Compile error, your regexp is invalid" ) );
+ return;
+ }
+ if ( !rx.match( teststring_edit->text().latin1() ) ) {
+ success_label->setText( i18n( "No match" ) );
+ return;
+ }
+ success_label->setText( i18n("Successfully matched") );
+ for ( int i = 0; i <= 9; ++i ) {
+ const char* grp = rx.group( i );
+ if ( grp )
+ new QListViewItem( subgroups_listview, QString::number( i ), QString( grp ) );
+ }
+}
+
+void RegexpTestDialog::checkPOSIX()
+{
+ regex_t compiledPattern;
+ regmatch_t matches[20];
+ int cflags = extendedposix_button->isChecked()? REG_EXTENDED : 0;
+ QCString regexp = pattern_edit->text().local8Bit();
+ int res = regcomp(&compiledPattern, regexp, cflags);
+ if (res != 0) {
+ QString regcompMessage;
+ switch (res)
+ {
+ case REG_BADRPT:
+ regcompMessage = i18n("Repetition operators must not appear as first character");
+ break;
+ case REG_BADBR:
+ regcompMessage = i18n("Invalid use of back reference operator");
+ break;
+ case REG_EBRACE:
+ regcompMessage = i18n("Unmatched brace interval operators");
+ break;
+ case REG_EBRACK:
+ regcompMessage = i18n("Unmatched bracket list operators");
+ break;
+ case REG_ERANGE:
+ regcompMessage = i18n("Invalid use of range operator");
+ break;
+ case REG_ECTYPE:
+ regcompMessage = i18n("Unknown character class");
+ break;
+ case REG_ECOLLATE:
+ regcompMessage = i18n("Invalid collating element");
+ break;
+ case REG_EPAREN:
+ regcompMessage = i18n("Unmatched parenthesis group operators");
+ break;
+ case REG_ESUBREG:
+ regcompMessage = i18n("Invalid back reference to subexpression");
+ break;
+ case REG_EESCAPE:
+ regcompMessage = i18n("Trailing backslash");
+ break;
+ case REG_BADPAT:
+ regcompMessage = i18n("Invalid use of pattern operators");
+ break;
+#ifdef REG_ESIZE
+ case REG_ESIZE:
+ regcompMessage = i18n("Regular expression too large");
+ break;
+#endif
+ default:
+ regcompMessage = i18n("Unknown error");
+ break;
+ }
+ success_label->setText(regcompMessage);
+ return;
+ }
+
+ for (int i = 0; i < 20; ++i) {
+ matches[i].rm_so = -1;
+ matches[i].rm_eo = -1;
+ }
+
+ QCString testString = teststring_edit->text().local8Bit();
+ res = regexec(&compiledPattern, testString, 20, matches, 0);
+ if (res != 0) {
+ success_label->setText(i18n("No match"));
+ return;
+ }
+
+ success_label->setText(i18n("Successfully matched"));
+ int len = testString.length();
+ for (int i = 0; i < 20; ++i) {
+ if (matches[i].rm_so >= 0 && matches[i].rm_so <= len &&
+ matches[i].rm_eo >= 0 && matches[i].rm_eo <= len &&
+ matches[i].rm_so <= matches[i].rm_eo) {
+ QCString subGroup = testString.mid(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so);
+ new QListViewItem(subgroups_listview, QString::number(i), subGroup);
+ }
+ }
+ regfree(&compiledPattern);
+}
+
+
+void RegexpTestDialog::insertQuoted()
+{
+ QString rawstr = pattern_edit->text();
+
+ QString str;
+
+ int len = rawstr.length();
+ for (int i=0; i < len; ++i) {
+ QChar ch = rawstr[i];
+ if (ch == '"')
+ str += "\\\"";
+ else if (ch == '\\')
+ str += "\\\\";
+ else
+ str += ch;
+ }
+
+ KParts::ReadWritePart *rwpart
+ = dynamic_cast<KParts::ReadWritePart*>(m_part->partController()->activePart());
+ QWidget *view = m_part->partController()->activeWidget();
+
+ KTextEditor::EditInterface *editiface
+ = dynamic_cast<KTextEditor::EditInterface*>(rwpart);
+ if (!editiface) {
+ kdDebug() << "no edit" << endl;
+ return;
+ }
+ KTextEditor::ViewCursorInterface *cursoriface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(view);
+ if (!cursoriface) {
+ kdDebug() << "no viewcursor" << endl;
+ return;
+ }
+
+ uint line, col;
+ cursoriface->cursorPositionReal(&line, &col);
+ editiface->insertText(line, col, str);
+ reject();
+}
+
+void RegexpTestDialog::showRegExpEditor( )
+{
+ _regexp_dialog = KParts::ComponentFactory::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor" );
+
+ if ( _regexp_dialog )
+ {
+ KRegExpEditorInterface *editor =
+ static_cast<KRegExpEditorInterface *>( _regexp_dialog->qt_cast( "KRegExpEditorInterface" ) );
+
+ editor->setRegExp( pattern_edit->text() );
+
+ if ( _regexp_dialog->exec() == QDialog::Accepted )
+ {
+ pattern_edit->setText( editor->regExp() );
+ }
+ }
+}
+
+#include "regexptestdlg.moc"
diff --git a/parts/regexptest/regexptestdlg.h b/parts/regexptest/regexptestdlg.h
new file mode 100644
index 00000000..e1c1a4e3
--- /dev/null
+++ b/parts/regexptest/regexptestdlg.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _REGEXPTESTDLG_H_
+#define _REGEXPTESTDLG_H_
+
+#include "regexptestdlgbase.h"
+
+class KDevPlugin;
+
+
+class RegexpTestDialog : public RegexpTestDialogBase
+{
+ Q_OBJECT
+
+public:
+ RegexpTestDialog( KDevPlugin *part );
+ ~RegexpTestDialog();
+
+protected:
+ virtual void showEvent(QShowEvent *e);
+
+protected slots:
+ void showRegExpEditor();
+
+private:
+ virtual void somethingChanged();
+ virtual void checkPOSIX();
+ virtual void checkQRegExp();
+ virtual void checkKRegExp();
+ virtual void insertQuoted();
+
+ KDevPlugin *m_part;
+
+ QDialog * _regexp_dialog;
+};
+
+#endif
diff --git a/parts/regexptest/regexptestdlgbase.ui b/parts/regexptest/regexptestdlgbase.ui
new file mode 100644
index 00000000..7b52620a
--- /dev/null
+++ b/parts/regexptest/regexptestdlgbase.ui
@@ -0,0 +1,352 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>RegexpTestDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>regexp_test_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>541</width>
+ <height>367</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Test Regular Expression</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>pattern_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Regular expression:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>pattern_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>teststring_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Test string:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>teststring_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>teststring_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter a string which will be matched against the regular expression</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>success_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>insertbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Insert Quoted</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Inserts the regular expression into the currently opened source code file. Escapes any special characters like backslash.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Closes the dialog</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>pattern_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>enter a regular expression, for example &lt;tt&gt;KD.*&lt;/tt&gt;, which matches all strings beginning with "KD"</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>flavor_group</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Regular Expression T&amp;ype</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>basicposix_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Basic POSIX syntax (used by grep)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the grep manpage</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>extendedposix_button</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;xtended POSIX syntax (used by egrep)</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the grep manpage</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>qregexp_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;QRegExp syntax</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the documentation of the QRegExp class</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>qregexp_min_button</cstring>
+ </property>
+ <property name="text">
+ <string>QRegExp syntax (&amp;minimal)</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Matches a QRegExp non-greedy. Please read the QRegExp::setMinimal documentation for more details.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>kregexp_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;KRegExp syntax</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the KDE API documentation.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>rxedit_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>subgroups_label</cstring>
+ </property>
+ <property name="text">
+ <string>Matched subgroups:</string>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>subgroups_listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Shows which groups were matched. See the corresponding documentation for how groups are matched.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>flavor_group</sender>
+ <signal>clicked(int)</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>pattern_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>teststring_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>insertbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>insertQuoted()</slot>
+ </connection>
+ <connection>
+ <sender>rxedit_button</sender>
+ <signal>clicked()</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>showRegExpEditor()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>pattern_edit</tabstop>
+ <tabstop>rxedit_button</tabstop>
+ <tabstop>basicposix_button</tabstop>
+ <tabstop>teststring_edit</tabstop>
+ <tabstop>subgroups_listview</tabstop>
+ <tabstop>insertbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+ <tabstop>extendedposix_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">insertQuoted()</slot>
+ <slot>somethingChanged()</slot>
+ <slot access="protected">showRegExpEditor()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/regexptest/regexptestpart.cpp b/parts/regexptest/regexptestpart.cpp
new file mode 100644
index 00000000..7b6b5193
--- /dev/null
+++ b/parts/regexptest/regexptestpart.cpp
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "regexptestpart.h"
+
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <kaction.h>
+
+#include "kdevcore.h"
+#include "regexptestdlg.h"
+
+static const KDevPluginInfo data("kdevregexptest");
+
+typedef KDevGenericFactory<RegexpTestPart> RegexpTestFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevregexptest, RegexpTestFactory( data ) )
+
+RegexpTestPart::RegexpTestPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "RegexpTestPart")
+{
+ setInstance(RegexpTestFactory::instance());
+ setXMLFile("kdevregexptest.rc");
+
+ KAction *action;
+
+ action = new KAction( i18n("Debug Regular Expression..."), 0,
+ this, SLOT(slotRegexpTest()),
+ actionCollection(), "tools_regexptest" );
+ action->setToolTip(i18n("Debug regular expression"));
+ action->setWhatsThis(i18n("<b>Debug regular expression</b><p>Allows to enter a regular expression "
+ "and validate it. It is possible to check syntax of basic POSIX, extended POSIX "
+ "regular expressions and also syntax allowed by QRegExp and KRegExp classes."));
+
+ m_dialog = 0;
+}
+
+
+RegexpTestPart::~RegexpTestPart()
+{
+ delete m_dialog;
+}
+
+
+void RegexpTestPart::slotRegexpTest()
+{
+ if (!m_dialog) {
+ m_dialog = new RegexpTestDialog(this);
+ }
+
+ m_dialog->show();
+}
+
+
+#include "regexptestpart.moc"
diff --git a/parts/regexptest/regexptestpart.h b/parts/regexptest/regexptestpart.h
new file mode 100644
index 00000000..7eabeffc
--- /dev/null
+++ b/parts/regexptest/regexptestpart.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _REGEXPTESTPART_H_
+#define _REGEXPTESTPART_H_
+
+#include <qguardedptr.h>
+#include <kdialogbase.h>
+#include "kdevplugin.h"
+
+class RegexpTestDialog;
+
+
+class RegexpTestPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ RegexpTestPart( QObject *parent, const char *name, const QStringList & );
+ ~RegexpTestPart();
+
+private slots:
+ void slotRegexpTest();
+
+private:
+ RegexpTestDialog *m_dialog;
+};
+
+#endif
diff --git a/parts/replace/Makefile.am b/parts/replace/Makefile.am
new file mode 100644
index 00000000..78a7ab4b
--- /dev/null
+++ b/parts/replace/Makefile.am
@@ -0,0 +1,16 @@
+# Here resides the replace part (search and replace in the entire project)
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevreplace.la
+libkdevreplace_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevreplace_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+libkdevreplace_la_SOURCES = replace_part.cpp replace_widget.cpp replacedlg.ui replaceitem.cpp replaceview.cpp replacedlgimpl.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevreplace.desktop
+
+rcdir = $(kde_datadir)/kdevreplace
+rc_DATA = kdevpart_replace.rc
diff --git a/parts/replace/README b/parts/replace/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/replace/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/replace/README.dox b/parts/replace/README.dox
new file mode 100644
index 00000000..c5953c8a
--- /dev/null
+++ b/parts/replace/README.dox
@@ -0,0 +1,24 @@
+/** \class ReplacePart
+This plugin replaces a search pattern with a specified string, after letting the
+user preview and choose which replacements should take place.
+
+The operation is only carried out on files that are part of the current project.
+
+\authors <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a> aka teatime
+
+\maintainer <a href="mailto:jens.dagerbo AT swipnet.se">Jens Dagerbo</a> aka teatime
+
+\feature Replaces a search pattern with a specified string, after letting the
+user preview and choose which replacements should take place.
+
+\todo Better user feedback
+\todo Better commenting (doxygen style comments).
+
+
+\warning The operation is only carried out on files that are part of the current project.
+
+\warning Search/Replace will work on all matches on a line.
+There is no (nor will there likely be) a way to limit matching to only some matches on the same line.
+In practice this is not a very big problem.
+
+*/
diff --git a/parts/replace/kdevpart_replace.rc b/parts/replace/kdevpart_replace.rc
new file mode 100644
index 00000000..e3818308
--- /dev/null
+++ b/parts/replace/kdevpart_replace.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="replace" library="libreplaceplugin" version="1">
+<MenuBar>
+ <Menu name="edit">
+ <Action name="edit_replace_across" group="kdev_edit_find_merge"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/replace/kdevreplace.desktop b/parts/replace/kdevreplace.desktop
new file mode 100644
index 00000000..13caf5b6
--- /dev/null
+++ b/parts/replace/kdevreplace.desktop
@@ -0,0 +1,80 @@
+[Desktop Entry]
+Type=Service
+Exec=
+Comment=This plugin is an interactive projectwide "Search and Replace" tool. Search using string or regexp matching, and select the replacements to be made from a preview before the action is finalized. When loaded it appears in the Edit menu.
+Comment[ca]=Aquest connector és una eina interactiva de "Recerca i substitució" a tot el projecte. Pot cercar mitjançant patrons o expressions regulars, i seleccionar les substitucions en una vista prèvia, abans de que finalitzi l'acció. Quan està carregat apareix en el menú Edita.
+Comment[da]=Dette plugin er et interaktivt projektomfattende "Søg og erstat" værktøj. Søg ved brug af streng eller regexp tilpasning, og vælg erstatninger lavet fra en forhåndsvisning før handlingen blive helt udført. Når det er indlæst er det i redigeringsmenuen.
+Comment[de]=Diese Komponente ist ein interaktives Werkzeug zum projektweiten "Suchen und Ersetzen" von Begriffen oder regulären Ausdrücken. Die zu ersetzenden Zeichenketten können in einer Vorschau ausgewählt werden. Erscheint im Menü "Bearbeiten", wenn es geladen ist.
+Comment[el]=Αυτό το πρόσθετο είναι ένα εργαλείο αλληλεπίδρασης "Αναζήτησης και αντικατάστασης" για όλο το έργο. Αναζητά χρησιμοποιώντας συμβολοσειρές ή κανονικές εκφράσεις, και επιλέγει τις αντικαταστάσεις από μια προεπισκόπηση πριν να εκτελεστεί η ενέργεια. Όταν φορτωθεί είναι διαθέσιμο από το μενού επεξεργασίας.
+Comment[en_GB]=This plugin is an interactive projectwide "Search and Replace" tool. Search using string or regexp matching, and select the replacements to be made from a preview before the action is finalised. When loaded it appears in the Edit menu.
+Comment[es]=Este complemento es una herramienta interactiva de «Búsqueda y sustitución» para todo el proyecto. Puede buscar mediante patrones o expresiones regulares, y seleccionar las sustituciones en una previsualización, antes de que finalice la acción. Cuando está cargado aparece en el menú Editar.
+Comment[et]=See plugin on kogu projekti hõlmav interaktiivne "otsi ja asenda" vahend. Otsida saab stringe või regulaaravaldiste sobivusi, asendusi saab valida eelvaatluse abil, enne kui need päriselt teoks teha. Kasutamisel kättesaadav redigeerimismenüüst.
+Comment[eu]=Plugin hau proiektu mailako "Bilatu eta ordeztu" tresna interaktiboa da. Bila ezazu kate edo regexp bat-egitea erabiliz, eta hautatu egin beharreko ordezkapenak aurrebista batetik ekintza amaitu aurretik. Kargatzean Editatu menuan agertzen da.
+Comment[fa]=این وصله یک ابزار گسترۀ پروژۀ تعاملی »جستجو و جایگزینی« می‌باشد. با استفاده از تطبیق رشته یا عبارت منظم جستجو می‌کند، و جایگزینهایی را گزینش می‌کند تا قبل از اتمام کنش، از یک پیش‌نمایش ایجاد شود. در هنگام بارگذاری در گزینگان ویرایش ظاهر می‌شود.
+Comment[fr]=Ce module externe est un outil de « Recherche et remplacement » à l'échelle du projet. Faites une recherche à l'aide de la correspondance de chaînes ou d'expressions rationnelles, et sélectionnez les remplacements à effectuer à partir d'un aperçu avant que l'action ne soit finalisée. Lorsqu'il est chargé, ce module externe apparaît dans le menu « Édition ».
+Comment[gl]=Esta extensión é unha ferramenta interactiva "Procurar e reemprazar" dispoñíbel en todo o proxecto. Busca usando coincidencias con strings ou expresións regulares, e selecciona os reemprazamentos a facer nunha previsualización antes de que as accións finalicen. Cando se carga aparece no menú Editar.
+Comment[hu]=Ezzel a bővítőmodullal az egész projektre kiterjedő keresést és cserét lehet végezni. Lehet sztringre és reg. kifejezésre keresni, az elvégzendő műveleteket egy előnézeti ablakban lehet kiválasztani. A modul betöltés után a Szerkesztés menübe kerül.
+Comment[it]=Questo plugin è uno strumento interattivo per "Cerca e sostituisci" sui progetti. Cerca tramite stringhe e confronto regexp e seleziona le sostituzioni da compiere da un'anteprima prima che le azioni siano finalizzate. Quando caricato apparirà nel menu Modifica.
+Comment[ja]=このプラグインは、プロジェクト規模で検索や置換を行う対話型のツールです。検索は文字列や正規表現の合致を使い、アクションが終了する前にプレビューで作られている置換を選択します。読み込まれると編集メニューに表示されます。
+Comment[ms]=Plugin ini adalah alatan "Cari dan Ganti" serata projek interaktif. Cari menggunakan padanan rentetan atau regexp, dan pilih gantian yang akan dibuat daripada pralihat sebelum tindakan diselesaikan. Apabila dimuatkan ia kelihatan didalam menu Sunting.
+Comment[nds]=Dit Moduul is en interaktiv projektwiet "Söken un Utwesseln"-Warktüüch. Du kannst na Tekenkeden oder mit reguleer Utdrück söken un de Ännern in en Vöransicht utsöken, ehr de Akschoon utföhrt warrt. Dukt in't Menü "Bewerken" op, wenn laadt.
+Comment[ne]=यो प्लगइन अन्तरक्रियात्मक परियोजनामा "खोजी गरेर प्रतिस्थापन गर्नुहोस्" उपकरण हो । स्ट्रिङ वा regexp मिल्दो प्रयोग गरेर खोजी गर्नुहोस् र कार्य समाप्त गर्नु पूर्व पूर्वावलोकनबाट प्रतिस्थापन गर्नेलाई चयन गर्नुहोस् । लोड भएपछि सम्पादन मेनुमा देखा पर्दछ ।
+Comment[nl]=Deze plugin biedt een interactieve, projectbrede "zoek en vervang"-tool. U kunt zoeken naar tekens of reguliere expressies en de vervanging kan in een dialoog worden bekeken voordat deze wordt uitgevoerd. Verschijnt in het menu Bewerken.
+Comment[pl]=Wtyczka działającego w całym projekcie narzędzia "Znajdź i zamień". Wyszukiwanie odbywa się za pomocą porównywania ciągów lub wyrażen regularnych, a wybór zamienników może być dokonywany przy włączonym podglądzie. Po wczytaniu pojawia się w menu Edycja.
+Comment[pt]=Este 'plugin' é uma ferramenta interactiva ao nível do projecto de "Procurar e Substituir". Pode procurar por texto ou por uma expressão regular e seleccionar as substituições a serem feitas, a partir de uma antevisão, antes de a acção terminar. Quando é carregado, aparece no menu Editar.
+Comment[pt_BR]=Este plug-in é uma ferramenta interativa de "Procurar e Substituir" por todo o projeto. Procura usando um string ou regexp correspondente, e seleciona as substituições a serem feitas de uma previsão antes da ação ser finalizada. Quando carregado ele aparece no menu Editar.
+Comment[ru]=Этот модуль предоставляет интерактивные возможности поиска и замены по файлам в проекте. Сначала проводится поиск по строке или регулярному выражению, далее выбор с предпросмотром и применение замен из списка доступных вариантов.
+Comment[sk]=Modul poskytuje interaktívny nástroj pre "Nájsť a Zameniť" v celom projekte.Vyhľadávanie pomocou regexp výrazov a výber nového reťazca z náhľadu pred samotnou zámenou. Po načítaní sa objaví v menu Edit.
+Comment[sr]=Овај прикључак је интерактивни „пронађи и замени“ алат широм пројекта. Тражите користећи знаковни низ или рег.из. поклапање, и из прегледа одаберите измене које ће бити извршене пре него што се акција заврши. Када је учитан појављује се у менију „Измени“.
+Comment[sr@Latn]=Ovaj priključak je interaktivni „pronađi i zameni“ alat širom projekta. Tražite koristeći znakovni niz ili reg.iz. poklapanje, i iz pregleda odaberite izmene koje će biti izvršene pre nego što se akcija završi. Kada je učitan pojavljuje se u meniju „Izmeni“.
+Comment[sv]=Insticksprogrammet är ett interaktivt verktyg för att "söka och ersätta" i hela projektet. Sök med en sträng eller reguljärt uttryck, och välj ersättningen som ska göras från en förhandsgranskning innan åtgärden slutförs. När det laddats visas det i redigeringsmenyn.
+Comment[ta]=இந்த சொருகி "Search and Replace" ஒரு சிறந்த திட்ட பணி கருவி. சரத்தை உபயோகித்து தேடுதல் அல்லது ரெக்ஸ்ப் பொருத்துதல், மற்றும் செயல்கள் தீர்மானிப்பதற்கு முன் முன்தோற்றத்தைப் பார்த்து மாற்ற வேண்டியதை தேர்வு செய்.
+Comment[tg]=Ин модул барои ковтукови интерактивӣ ва ҷой иваз намудан дар лоиҳаро имкон медиҳад.Аввал ковтуков дар сатр оғоз меёбад ва ё дар баёноти ботартиб, баъд аз он интихоби пеш аз намоиш ва истифода барии ҷой ивазкунӣ аз рӯйхати вариантҳои имконпазир гузаронида мешавад.
+Comment[tr]=Bu eklenti projenin tamamında "Ara ve Değiştir" aracıdır. Dizgi veya regexp eşleşmesi ara ve işlem sona ermeden bir önizlemeden yapılacak değişiklikleri seç. Yüklendiğinde Düzenle menüsünde durur.
+Comment[zh_CN]=这个插件是面向真个工程的“查找和替换”工具。 使用字符串或正则表达式匹配,并在操作完成前提供选择替换预览。启动后显示在编辑菜单中。
+Comment[zh_TW]=這個外掛程式是一個專案的「搜尋與取代」互動工具。使用字串或正規表示式來搜尋,並選擇是否要取代。載入後可以在「編輯」選單中找到。
+Name=KDevReplace
+Name[da]=KDevelop Erstat
+Name[nds]=KDevelop-Utwesseln
+Name[sk]=KDev zameniť
+Name[sv]=KDevelop ersätt
+Name[zh_TW]=KDevelop 取代
+GenericName=Replace Part
+GenericName[ca]=Part per a la substitució
+GenericName[da]=Erstatningspart
+GenericName[de]=Ersetzen-Komponente
+GenericName[el]=Τμήμα αντικατάστασης
+GenericName[es]=Servicio de sustitución
+GenericName[et]=Asendamise komponent
+GenericName[eu]=Ordeztu partea
+GenericName[fa]=جزء جایگزینی
+GenericName[fr]=Outil de remplacement
+GenericName[gl]='Part' reemprazar
+GenericName[hi]=रीप्लेस पार्ट
+GenericName[hu]=Cserélés
+GenericName[it]=Componente per sostituire
+GenericName[ja]=置換
+GenericName[ms]=Ganti Bahagian
+GenericName[nds]=Utwessel-Komponent
+GenericName[ne]=प्रतिस्थापन भाग
+GenericName[nl]=Zoeken en vervangen
+GenericName[pl]=Program do zastępowania
+GenericName[pt]=Parte de Substituição
+GenericName[pt_BR]=Parte Substituir
+GenericName[ru]=Замена по проекту
+GenericName[sk]=Part zameniť
+GenericName[sl]=Del za zamenjave
+GenericName[sr]=Део за замену
+GenericName[sr@Latn]=Deo za zamenu
+GenericName[sv]=Ersättning
+GenericName[ta]=மாற்றுப் பகுதி
+GenericName[tg]=Ҷой иваз намудан бо лоиҳа
+GenericName[tr]=Değiştirme Bileşeni
+GenericName[zh_CN]=替换模块
+GenericName[zh_TW]=取代元件
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Global
+X-KDE-Library=libkdevreplace
+X-KDevelop-Version=5
+X-KDevelop-Properties=FileReplace
diff --git a/parts/replace/replace_part.cpp b/parts/replace/replace_part.cpp
new file mode 100644
index 00000000..6e1312ed
--- /dev/null
+++ b/parts/replace/replace_part.cpp
@@ -0,0 +1,110 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include "replace_part.h"
+
+#include <qwhatsthis.h>
+
+#include <kaction.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <kdebug.h>
+#include <kstringhandler.h>
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+
+#include "replace_widget.h"
+
+static const KDevPluginInfo data("kdevreplace");
+
+typedef KDevGenericFactory<ReplacePart> ReplaceFactory;
+K_EXPORT_COMPONENT_FACTORY(libkdevreplace, ReplaceFactory(data))
+
+ReplacePart::ReplacePart(QObject *parent, const char *name, const QStringList& )
+ : KDevPlugin( &data, parent, name ? name : "ReplacePart" )
+{
+ setInstance(ReplaceFactory::instance());
+ setXMLFile("kdevpart_replace.rc");
+
+ m_widget = new ReplaceWidget(this);
+ m_widget->setIcon( SmallIcon("filefind") );
+ m_widget->setCaption(i18n("Replace"));
+
+ QWhatsThis::add
+ (m_widget, i18n("<b>Replace</b><p>"
+ "This window shows a preview of a string replace "
+ "operation. Uncheck a line to exclude that replacement. "
+ "Uncheck a file to exclude the whole file from the "
+ "operation. "
+ "Clicking on a line in the list will automatically "
+ "open the corresponding source file and set the "
+ "cursor to the line with the match." ));
+
+ mainWindow()->embedOutputView( m_widget, i18n("Replace"), i18n("Project wide string replacement") );
+ mainWindow()->setViewAvailable( m_widget, false );
+
+ action = new KAction(i18n("Find-Select-Replace..."), 0,
+ CTRL+SHIFT+Key_R, this, SLOT(slotReplace()), actionCollection(), "edit_replace_across");
+ action->setToolTip( i18n("Project wide string replacement") );
+ action->setWhatsThis( i18n("<b>Find-Select-Replace</b><p>"
+ "Opens the project wide string replacement dialog. There you "
+ "can enter a string or a regular expression which is then "
+ "searched for within all files in the locations "
+ "you specify. Matches will be displayed in the <b>Replace</b> window, you "
+ "can replace them with the specified string, exclude them from replace operation or cancel the whole replace.") );
+
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+ connect( core(), SIGNAL(projectOpened()), this, SLOT(enableAction()));
+ connect( core(), SIGNAL(projectClosed()), this, SLOT(disableAction()));
+}
+
+void ReplacePart::enableAction()
+{
+ action->setEnabled(true);
+}
+
+void ReplacePart::disableAction()
+{
+ action->setEnabled(false);
+}
+
+ReplacePart::~ReplacePart()
+{
+ if ( m_widget )
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+}
+
+void ReplacePart::slotReplace()
+{
+ m_widget->showDialog();
+}
+
+void ReplacePart::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ if (!context->hasType( Context::EditorContext ))
+ return;
+
+ const EditorContext *econtext = static_cast<const EditorContext*>(context);
+ QString ident = econtext->currentWord();
+ if (!ident.isEmpty()) {
+ m_popupstr = ident;
+ QString squeezed = KStringHandler::csqueeze(ident, 30);
+ int id = popup->insertItem( i18n("Replace Project Wide: %1").arg(squeezed),
+ this, SLOT(slotReplace()) );
+ popup->setWhatsThis(id, i18n("<b>Replace Project Wide</b><p>Opens the find in files dialog "
+ "and sets the pattern to the text under the cursor."));
+ popup->insertSeparator();
+ }
+}
+
+#include "replace_part.moc"
diff --git a/parts/replace/replace_part.h b/parts/replace/replace_part.h
new file mode 100644
index 00000000..35a293ab
--- /dev/null
+++ b/parts/replace/replace_part.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __KDEVPART_REPLACE_H__
+#define __KDEVPART_REPLACE_H__
+
+
+#include <qguardedptr.h>
+#include <kdevplugin.h>
+#include <qpopupmenu.h>
+
+
+class ReplaceWidget;
+class KAction;
+class Context;
+
+class ReplacePart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ ReplacePart(QObject *parent, const char *name, const QStringList &);
+ ~ReplacePart();
+
+public slots:
+ void slotReplace();
+ void contextMenu(QPopupMenu *popup, const Context *context);
+ void enableAction();
+ void disableAction();
+private:
+ QGuardedPtr<ReplaceWidget> m_widget;
+ QString m_popupstr;
+ KAction* action;
+
+};
+
+
+#endif
diff --git a/parts/replace/replace_widget.cpp b/parts/replace/replace_widget.cpp
new file mode 100644
index 00000000..24078943
--- /dev/null
+++ b/parts/replace/replace_widget.cpp
@@ -0,0 +1,486 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+//BEGIN Includes
+
+#include <dcopclient.h>
+#include <kapplication.h>
+#include <kparts/part.h>
+#include <kparts/componentfactory.h>
+#include <klibloader.h>
+#include <ktrader.h>
+#include <kurl.h>
+#include <kurlrequester.h>
+#include <klineedit.h>
+#include <kdebug.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/editor.h>
+#include <ktexteditor/document.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/selectioninterface.h>
+#include <kdevpartcontroller.h>
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+#include <kcombobox.h>
+#include <klocale.h>
+#include <kstdguiitem.h>
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qradiobutton.h>
+#include <qstringlist.h>
+#include <qptrlist.h>
+#include <qregexp.h>
+#include <qdialog.h>
+#include <qfile.h>
+#include <qdir.h>
+#include <qtextstream.h>
+#include <qdatastream.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "replace_part.h"
+#include "replace_widget.h"
+#include "replacedlgimpl.h"
+#include "replaceitem.h"
+#include "replaceview.h"
+
+//END Includes
+
+ReplaceWidget::ReplaceWidget(ReplacePart *part)
+ : QWidget(0, "replace widget"), m_part( part ),
+ m_dialog( new ReplaceDlgImpl( this, "replace widget" ) ),
+ _terminateOperation( false )
+{
+ // setup outputview
+ QVBoxLayout * layout = new QVBoxLayout( this );
+ QHBoxLayout * buttonlayout = new QHBoxLayout( layout );
+
+ _cancel = new KPushButton( KStdGuiItem::cancel(), this );
+ _replace = new KPushButton( KGuiItem(i18n("Replace"),"filefind"), this );
+
+ _cancel->setEnabled( false );
+ _replace->setEnabled( false );
+
+ buttonlayout->addWidget( _replace );
+ buttonlayout->addWidget( _cancel );
+
+ _listview = new ReplaceView( this );
+ layout->addWidget( _listview );
+
+ // setup signals
+ connect( m_dialog->find_button, SIGNAL( clicked() ), SLOT( find() ) );
+
+ connect( _replace, SIGNAL( clicked() ), SLOT( replace() ) );
+ connect( _cancel, SIGNAL( clicked() ), SLOT( clear() ) );
+ connect( _listview, SIGNAL( editDocument( const QString &, int ) ), SLOT( editDocument( const QString &, int ) ) );
+
+ connect( m_part->core(), SIGNAL( stopButtonClicked( KDevPlugin * ) ), SLOT( stopButtonClicked( KDevPlugin * ) ) );
+}
+
+//BEGIN Slots
+
+void ReplaceWidget::showDialog()
+{
+ if ( ! m_part->project() )
+ return; /// @todo feedback?
+
+ QString currentWord;
+ KParts::ReadOnlyPart *part = dynamic_cast<KParts::ReadOnlyPart*> ( m_part->partController()->activePart() );
+ if ( part )
+ {
+ if ( part->url().isLocalFile() )
+ {
+ calledUrl = part->url().path();
+ cursorPos ( part, &calledCol, &calledLine );
+
+ KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>( m_part->partController()->activePart() );
+ QString str = editIface->textLine ( calledCol );
+
+ int i;
+ uint start, end;
+ for (i =calledLine; i< str.length();i++){
+ if ( ! (str[i].isLetter() || str[i].isNumber() || str[i] == '_' ) ){
+ break;
+ }
+ }
+ end=i;
+ for ( i = calledLine; i >= 0; --i ){
+ if ( ! ( str[i].isLetter() ||str[i].isNumber()|| str[i] == '_' ) ){
+ i+=1;
+ break;
+ }
+ }
+ start = i < 0 ? 0 : i;
+ currentWord = str.mid ( start, end-start );
+ }
+ }
+ m_dialog->show ( m_part->project()->projectDirectory() + "/" + m_part->project()->activeDirectory() + "/" );
+
+ KTextEditor::SelectionInterface *sel_iface
+ = dynamic_cast<KTextEditor::SelectionInterface*> ( m_part->partController()->activePart() );
+ if ( sel_iface && sel_iface->hasSelection() )
+ {
+ m_dialog->find_combo->setCurrentText ( sel_iface->selection() );
+ }
+ else
+ {
+ m_dialog->find_combo->setCurrentText ( currentWord );
+ }
+}
+
+
+void ReplaceWidget::find()
+{
+ _listview->clear();
+ m_part->mainWindow()->raiseView( this );
+ m_part->mainWindow()->setViewAvailable( this, true );
+
+ _listview->setReplacementData( m_dialog->expressionPattern(), m_dialog->replacementString() );
+
+ if ( showReplacements() )
+ {
+ _cancel->setEnabled( true );
+ _replace->setEnabled( true );
+ }
+ else
+ {
+ clear();
+ m_part->mainWindow()->setViewAvailable( this, false );
+ }
+}
+
+void ReplaceWidget::replace()
+{
+ makeReplacements();
+ clear();
+ m_part->mainWindow()->setViewAvailable( this, false );
+}
+
+void ReplaceWidget::clear()
+{
+ _listview->clear();
+
+ _cancel->setEnabled( false );
+ _replace->setEnabled( false );
+
+ m_part->mainWindow()->setViewAvailable( this, false );
+}
+
+void ReplaceWidget::editDocument( QString const & file, int line )
+{
+ m_part->partController()->editDocument( KURL( file ), line );
+}
+
+void ReplaceWidget::stopButtonClicked( KDevPlugin * which )
+{
+ if ( which != 0 && which != m_part )
+ return;
+
+ _terminateOperation = true;
+}
+
+//END Slots
+
+bool ReplaceWidget::showReplacements()
+{
+ ReplaceItem::s_listview_done = false;
+
+ m_part->core()->running( m_part, true );
+
+ bool completed = true;
+ _terminateOperation = false;
+
+ QStringList files = workFiles();
+ QStringList openfiles = openProjectFiles();
+
+ QStringList::ConstIterator it = files.begin();
+ while ( it != files.end() )
+ {
+ if ( shouldTerminate() )
+ {
+ completed = false;
+ break;
+ }
+
+ if ( openfiles.contains( *it ) )
+ {
+ if ( KTextEditor::EditInterface * ei = getEditInterfaceForFile( *it ) )
+ {
+ QString buffer = ei->text();
+ QTextIStream stream( &buffer );
+ _listview->showReplacementsForFile( stream, *it );
+ }
+ }
+ else
+ {
+ QFile file( *it );
+ if ( file.open ( IO_ReadOnly ) )
+ {
+ QTextStream stream( &file );
+ _listview->showReplacementsForFile( stream, *it );
+ }
+ }
+ ++it;
+
+ kapp->processEvents( 100 );
+ }
+
+ m_part->core()->running( m_part, false );
+
+ ReplaceItem::s_listview_done = true;
+
+ return completed;
+}
+
+
+void ReplaceWidget::cursorPos( KParts::Part *part, uint * line, uint * col )
+{
+ if (!part || !part->inherits("KTextEditor::Document")) return;
+
+ KTextEditor::ViewCursorInterface *iface = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
+ if (iface)
+ {
+ iface->cursorPositionReal( line, col );
+ }
+}
+
+void ReplaceWidget::setCursorPos( KParts::Part *part, uint line, uint col )
+{
+ if (!part || !part->inherits("KTextEditor::Document")) return;
+
+ KTextEditor::ViewCursorInterface *iface = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
+ if (iface)
+ {
+ iface->setCursorPositionReal( line, col );
+ }
+}
+
+
+bool ReplaceWidget::makeReplacements()
+{
+ uint col=0;
+ uint line=0;
+ cursorPos( m_part->partController()->activePart(), &col, &line );
+
+ m_part->core()->running( m_part, true );
+
+ bool completed = true;
+ _terminateOperation = false;
+
+ QStringList openfiles = openProjectFiles();
+ QStringList changedFiles;
+
+ ReplaceItem const * fileitem = _listview->firstChild();
+ while ( fileitem )
+ {
+ if ( fileitem->isOn() )
+ {
+ QString currentfile = fileitem->file();
+
+ if ( openfiles.contains( currentfile ) )
+ {
+ if ( KTextEditor::EditInterface * ei = getEditInterfaceForFile( currentfile ) )
+ {
+ QString ibuffer = ei->text();
+ QString obuffer;
+ QTextStream istream( &ibuffer, IO_ReadOnly );
+ QTextStream ostream( &obuffer, IO_WriteOnly );
+
+ _listview->makeReplacementsForFile( istream, ostream, fileitem );
+
+ ei->setText( obuffer );
+ }
+ }
+ else
+ {
+ QFile file( currentfile );
+ QString buffer;
+
+ if ( file.open( IO_ReadOnly ) )
+ {
+ QTextStream istream( &file );
+ QTextStream buffer_stream( &buffer, IO_WriteOnly );
+
+ _listview->makeReplacementsForFile( istream, buffer_stream, fileitem );
+
+ file.close();
+
+ if ( file.open( IO_WriteOnly ) )
+ {
+ QTextStream ostream( &file );
+ ostream << buffer;
+ file.close();
+ }
+ }
+ }
+ changedFiles << relativeProjectPath( ( currentfile ) );
+ }
+ fileitem = fileitem->nextSibling();
+
+ kapp->processEvents( 100 );
+ }
+
+ // Telling the project about the edited files
+ if ( ! changedFiles.isEmpty() )
+ {
+ m_part->project()->changedFiles( changedFiles );
+ }
+
+ m_part->partController()->saveAllFiles();
+
+ m_part->core()->running( m_part, false );
+
+ if ( calledUrl != QString::null )
+ {
+ m_part->partController()->editDocument( calledUrl, calledLine );
+ setCursorPos( m_part->partController()->activePart(), calledCol, calledLine );
+ }
+ else{
+ setCursorPos( m_part->partController()->activePart(), col, line );
+ }
+
+ return completed;
+}
+
+//BEGIN Helpers
+
+QStringList ReplaceWidget::workFiles()
+{
+ if ( m_dialog->files_all_radio->isChecked() )
+ {
+ return allProjectFiles();
+ }
+ else if ( m_dialog->files_open_radio->isChecked() )
+ {
+ return openProjectFiles();
+ }
+ return subProjectFiles( m_dialog->path_urlreq->lineEdit()->text() );
+}
+
+QString ReplaceWidget::relativeProjectPath( QString path )
+{
+ QString project = m_part->project()->projectDirectory() + "/";
+ if ( path.left( project.length() ) == project )
+ {
+ path = path.mid( project.length() );
+ }
+ return path;
+}
+
+QString ReplaceWidget::fullProjectPath( QString path )
+{
+ QString project = m_part->project()->projectDirectory() + "/";
+ if ( path.left( project.length() ) != project )
+ {
+ path = project + path;
+ }
+ return path;
+}
+
+
+QStringList ReplaceWidget::allProjectFiles()
+{
+ QStringList allfiles = m_part->project()->allFiles();
+
+ QStringList::iterator it = allfiles.begin();
+ while ( it != allfiles.end() )
+ {
+ *it = fullProjectPath( *it );
+ ++it;
+ }
+ return allfiles;
+}
+
+QStringList ReplaceWidget::subProjectFiles( QString const & subpath )
+{
+ QStringList projectfiles = allProjectFiles();
+
+ QStringList::Iterator it = projectfiles.begin();
+ while ( it != projectfiles.end() )
+ {
+ if ( (*it).left( subpath.length() ) != subpath)
+ {
+ it = projectfiles.remove( it );
+ }
+ else
+ {
+ ++it;
+ }
+ }
+ return projectfiles;
+}
+
+QStringList ReplaceWidget::openProjectFiles()
+{
+ QStringList projectfiles = allProjectFiles();
+ QStringList openfiles;
+
+ if( const QPtrList<KParts::Part> * partlist = m_part->
+ partController()->parts() )
+ {
+ QPtrListIterator<KParts::Part> it( *partlist );
+ while ( KParts::Part* part = it.current() )
+ {
+ if ( KTextEditor::Editor * ed = dynamic_cast<KTextEditor::Editor *>( part ) )
+ {
+ QString editorpath = ed->url().path();
+ if ( projectfiles.contains( editorpath ) )
+ {
+ openfiles.append( editorpath );
+ }
+ }
+ ++it;
+ }
+ }
+ return openfiles;
+}
+
+KTextEditor::EditInterface * ReplaceWidget::getEditInterfaceForFile( QString const & file )
+{
+ if( const QPtrList<KParts::Part> * partlist = m_part->
+ partController()->parts() )
+ {
+ QPtrListIterator<KParts::Part> it( *partlist );
+ while ( KParts::Part* part = it.current() )
+ {
+ if ( KTextEditor::Editor * ed = dynamic_cast<KTextEditor::Editor *>( part ) )
+ {
+ if ( file == ed->url().path() )
+ {
+ return dynamic_cast<KTextEditor::EditInterface *>( part );
+ }
+ }
+ ++it;
+ }
+ }
+ return 0;
+}
+
+bool ReplaceWidget::shouldTerminate()
+{
+ bool b = _terminateOperation;
+ _terminateOperation = false;
+ return b;
+}
+
+void ReplaceWidget::focusInEvent( QFocusEvent * /* e*/ )
+{
+ _listview->setFocus();
+}
+
+//END Helpers
+
+#include "replace_widget.moc"
diff --git a/parts/replace/replace_widget.h b/parts/replace/replace_widget.h
new file mode 100644
index 00000000..fa5809d5
--- /dev/null
+++ b/parts/replace/replace_widget.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __REPLACE_WIDGET_H__
+#define __REPLACE_WIDGET_H__
+
+#include <ktexteditor/editinterface.h>
+
+#include <qwidget.h>
+#include <qstring.h>
+
+class QPushButton;
+class QListViewItem;
+class QDialog;
+
+class ReplacePart;
+class ReplaceDlgImpl;
+class ReplaceItem;
+class ReplaceView;
+
+class ReplaceWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ReplaceWidget(ReplacePart *part);
+
+public slots:
+ void showDialog();
+ void stopButtonClicked( KDevPlugin * );
+
+protected:
+ virtual void focusInEvent(QFocusEvent *e);
+
+private slots:
+ void find();
+ void replace();
+ void clear();
+ void editDocument( const QString & ,int );
+ void setCursorPos( KParts::Part *part, uint line, uint col );
+ void cursorPos( KParts::Part *part, uint * line, uint * col );
+
+private:
+ bool showReplacements();
+ bool makeReplacements();
+ bool shouldTerminate();
+
+ QString relativeProjectPath( QString );
+ QString fullProjectPath( QString );
+
+ QStringList workFiles();
+ QStringList allProjectFiles();
+ QStringList subProjectFiles( QString const & );
+ QStringList openProjectFiles();
+
+ KTextEditor::EditInterface * getEditInterfaceForFile( QString const & file );
+
+ ReplacePart * m_part;
+ ReplaceDlgImpl * m_dialog;
+
+ ReplaceView * _listview;
+ QPushButton * _cancel;
+ QPushButton * _replace;
+
+ uint calledCol;
+ uint calledLine;
+ QString calledUrl;
+
+ bool _terminateOperation;
+};
+
+
+#endif
diff --git a/parts/replace/replacedlg.ui b/parts/replace/replacedlg.ui
new file mode 100644
index 00000000..b1c7db92
--- /dev/null
+++ b/parts/replace/replacedlg.ui
@@ -0,0 +1,385 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ReplaceDlg</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>ReplaceDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>428</width>
+ <height>487</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>32767</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="caption">
+ <string>Project Wide String Replacement</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>case_box</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;ase sensitive</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup2</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="title">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>strings_all_radio</cstring>
+ </property>
+ <property name="text">
+ <string>All s&amp;ubstrings</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>strings_wholewords_radio</cstring>
+ </property>
+ <property name="text">
+ <string>Whole words onl&amp;y</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>strings_regexp_radio</cstring>
+ </property>
+ <property name="text">
+ <string>Regular e&amp;xpression:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Use regexp to specify target</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>regexp_button</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>E&amp;dit</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Opens the regexp editor. Only enabled if installed.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="KHistoryCombo">
+ <property name="name">
+ <cstring>regexp_combo</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Enter the regexp here</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup" row="2" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Target Files in Project</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>files_all_radio</cstring>
+ </property>
+ <property name="text">
+ <string>A&amp;ll files</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>All files in the project will be considered.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>files_open_radio</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Open files only</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Only open project files will be considered.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>files_path_radio</cstring>
+ </property>
+ <property name="text">
+ <string>Files under &amp;path:</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Only project files in this dir and its subdirs will be considered.</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester">
+ <property name="name">
+ <cstring>path_urlreq</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QLayoutWidget" row="3" column="0">
+ <property name="name">
+ <cstring>layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>expression_varning_label</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Expression is invalid.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>find_button</cstring>
+ </property>
+ <property name="text">
+ <string>Fi&amp;nd</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Start looking for possible replacement targets.</string>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancel_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Strings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Text to find:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>find_combo</cstring>
+ </property>
+ </widget>
+ <widget class="KHistoryCombo" row="1" column="0">
+ <property name="name">
+ <cstring>find_combo</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Target string</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Replacement text:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>replacement_combo</cstring>
+ </property>
+ </widget>
+ <widget class="KHistoryCombo" row="3" column="0">
+ <property name="name">
+ <cstring>replacement_combo</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>The replacement string</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>cancel_button</sender>
+ <signal>clicked()</signal>
+ <receiver>ReplaceDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>find_button</sender>
+ <signal>clicked()</signal>
+ <receiver>ReplaceDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>strings_regexp_radio</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>regexp_button</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>files_path_radio</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>path_urlreq</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>strings_regexp_radio</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>find_combo</receiver>
+ <slot>setDisabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>strings_regexp_radio</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>regexp_combo</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>find_combo</tabstop>
+ <tabstop>replacement_combo</tabstop>
+ <tabstop>case_box</tabstop>
+ <tabstop>strings_all_radio</tabstop>
+ <tabstop>strings_regexp_radio</tabstop>
+ <tabstop>regexp_button</tabstop>
+ <tabstop>regexp_combo</tabstop>
+ <tabstop>files_all_radio</tabstop>
+ <tabstop>path_urlreq</tabstop>
+ <tabstop>find_button</tabstop>
+ <tabstop>cancel_button</tabstop>
+ <tabstop>strings_wholewords_radio</tabstop>
+ <tabstop>files_path_radio</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/replace/replacedlgimpl.cpp b/parts/replace/replacedlgimpl.cpp
new file mode 100644
index 00000000..59eee128
--- /dev/null
+++ b/parts/replace/replacedlgimpl.cpp
@@ -0,0 +1,188 @@
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qstring.h>
+#include <qregexp.h>
+#include <qlabel.h>
+
+#include <ktrader.h>
+#include <kparts/componentfactory.h>
+#include <kregexpeditorinterface.h>
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+#include <kdebug.h>
+
+#include "replacedlgimpl.h"
+
+namespace
+{
+/// @todo This is the same function as in ../grepview/grepviewwidget.cpp and
+/// should probably be placed in a common place. For now it seemed like too
+/// little code to bother with.
+QString escape(const QString &str)
+{
+ QString escaped("[]{}()\\^$?.+-*");
+ QString res;
+
+ for (uint i=0; i < str.length(); ++i)
+ {
+ if (escaped.find(str[i]) != -1)
+ res += "\\";
+ res += str[i];
+ }
+
+ return res;
+}
+}
+
+
+ReplaceDlgImpl::ReplaceDlgImpl(QWidget* parent, const char* name, bool modal, WFlags fl)
+ : ReplaceDlg(parent,name, modal,fl), _regexp_dialog( 0 )
+
+{
+ connect( find_button, SIGNAL( clicked() ), SLOT( saveComboHistories() ) );
+ connect( regexp_button, SIGNAL( clicked() ), SLOT( showRegExpEditor() ) );
+ connect( find_combo, SIGNAL( textChanged( const QString & ) ),
+ SLOT( validateFind( const QString & ) ) );
+ connect( regexp_combo, SIGNAL( textChanged ( const QString & ) ),
+ SLOT( validateExpression( const QString & ) ) );
+ connect( strings_regexp_radio, SIGNAL( toggled( bool ) ), SLOT( toggleExpression( bool ) ) );
+
+ // disable the editor button if the regexp editor isn't installed
+ if ( KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty() )
+ {
+ strings_regexp_radio->disconnect( regexp_button );
+ }
+
+ path_urlreq->completionObject()->setMode(KURLCompletion::DirCompletion);
+ path_urlreq->setMode( KFile::Directory | KFile::LocalOnly );
+
+ expression_varning_label->hide();
+}
+
+ReplaceDlgImpl::~ReplaceDlgImpl()
+{}
+
+void ReplaceDlgImpl::show( QString const & path )
+{
+ path_urlreq->lineEdit()->setText( path );
+
+ find_combo->setCurrentText( "" );
+ replacement_combo->setCurrentText( "" );
+ regexp_combo->setCurrentText( "" );
+
+ strings_all_radio->setChecked( true );
+ find_combo->setFocus();
+
+ find_button->setEnabled( false );
+
+ QDialog::show();
+}
+
+
+void ReplaceDlgImpl::showRegExpEditor()
+{
+ _regexp_dialog = KParts::ComponentFactory::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor" );
+
+ if ( _regexp_dialog )
+ {
+ KRegExpEditorInterface *editor =
+ static_cast<KRegExpEditorInterface *>( _regexp_dialog->qt_cast( "KRegExpEditorInterface" ) );
+
+ editor->setRegExp( regexp_combo->currentText() );
+
+ if ( _regexp_dialog->exec() == QDialog::Accepted )
+ {
+ regexp_combo->setCurrentText( editor->regExp() );
+ }
+ }
+}
+
+void ReplaceDlgImpl::validateFind( const QString & )
+{
+ //kdDebug(0) << "ReplaceWidget::validateFind()" << endl;
+
+ bool x = find_combo->currentText().isEmpty() && ! strings_regexp_radio->isOn();
+ find_button->setEnabled( !x );
+}
+
+void ReplaceDlgImpl::validateExpression( const QString & )
+{
+ //kdDebug(0) << "ReplaceWidget::validateExpression()" << endl;
+
+ QString pattern = regexp_combo->currentText();
+ QRegExp re( pattern );
+
+ if ( pattern.isEmpty() || !re.isValid() )
+ {
+ expression_varning_label->show();
+ find_button->setEnabled( false );
+ }
+ else
+ {
+ expression_varning_label->hide();
+ find_button->setEnabled( true );
+ }
+}
+
+void ReplaceDlgImpl::toggleExpression( bool on )
+{
+ if ( on )
+ {
+ validateExpression( QString() );
+ }
+ else
+ {
+ expression_varning_label->hide();
+ find_button->setEnabled( true );
+ }
+}
+
+void ReplaceDlgImpl::saveComboHistories()
+{
+ if ( find_combo->isEnabled() && ! find_combo->currentText().isEmpty() )
+ {
+ find_combo->addToHistory( find_combo->currentText() );
+ }
+
+ if ( ! replacement_combo->currentText().isEmpty() )
+ {
+ replacement_combo->addToHistory( replacement_combo->currentText() );
+ }
+
+ if ( regexp_combo->isEnabled() && ! regexp_combo->currentText().isEmpty() )
+ {
+ regexp_combo->addToHistory( regexp_combo->currentText() );
+ }
+}
+
+QRegExp ReplaceDlgImpl::expressionPattern()
+{
+ QString pattern = escape( find_combo->currentText() );
+
+ QRegExp re;
+ re.setCaseSensitive( case_box->isChecked() );
+ re.setMinimal( true );
+
+ if ( strings_wholewords_radio->isChecked() )
+ {
+ pattern = "\\b" + pattern + "\\b";
+ }
+ else if ( strings_regexp_radio->isChecked() )
+ {
+ pattern = regexp_combo->currentText();
+ }
+
+ re.setPattern( pattern );
+
+ return re;
+}
+
+QString ReplaceDlgImpl::replacementString()
+{
+ return replacement_combo->currentText();
+}
+
+#include "replacedlgimpl.moc"
+
diff --git a/parts/replace/replacedlgimpl.h b/parts/replace/replacedlgimpl.h
new file mode 100644
index 00000000..38938bed
--- /dev/null
+++ b/parts/replace/replacedlgimpl.h
@@ -0,0 +1,38 @@
+
+#ifndef REPLACEDLGIMPL_H
+#define REPLACEDLGIMPL_H
+
+#include "replacedlg.h"
+
+class QDialog;
+
+class ReplaceDlgImpl : public ReplaceDlg
+{
+ Q_OBJECT
+
+public:
+ ReplaceDlgImpl(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~ReplaceDlgImpl();
+
+ QRegExp expressionPattern();
+ QString replacementString();
+
+public slots:
+ void show( QString const & path );
+
+protected:
+
+protected slots:
+ void showRegExpEditor();
+ void validateExpression( const QString & );
+ void validateFind( const QString & );
+ void toggleExpression( bool );
+ void saveComboHistories();
+
+private:
+ QDialog * _regexp_dialog;
+
+};
+
+#endif
+
diff --git a/parts/replace/replaceitem.cpp b/parts/replace/replaceitem.cpp
new file mode 100644
index 00000000..bc33211f
--- /dev/null
+++ b/parts/replace/replaceitem.cpp
@@ -0,0 +1,147 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qpainter.h>
+#include <qstyle.h>
+#include <qpalette.h>
+#include <qcheckbox.h>
+
+#include "replaceitem.h"
+
+bool ReplaceItem::s_listview_done = false;
+
+
+bool ReplaceItem::hasCheckedChildren() const
+{
+ ReplaceItem const * item = firstChild();
+ while ( item )
+ {
+ if ( item->isOn() )
+ {
+ return true;
+ }
+ item = item->nextSibling();
+ }
+ return false;
+}
+
+void ReplaceItem::stateChange( bool state )
+{
+ if ( s_listview_done && justClicked() )
+ {
+ setChecked( state );
+ }
+}
+
+void ReplaceItem::setChecked( bool checked )
+{
+ if ( !isFile() ) // this is a child item
+ {
+ if ( checked || !(parent()->hasCheckedChildren()))
+ {
+ if ( parent()->isOn() != checked )
+ {
+ parent()->_clicked = false;
+ parent()->setOn( checked );
+ }
+ }
+ return;
+ }
+
+ // this is a parent item, set self and children
+ ReplaceItem * item = firstChild();
+ while ( item )
+ {
+ if ( item->isOn() != checked )
+ {
+ item->_clicked = false;
+ item->setOn( checked );
+ }
+ item = item->nextSibling();
+ }
+}
+
+// code mostly lifted from QCheckListItem::paintCell()
+void ReplaceItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
+{
+ if ( !p )
+ return;
+
+ QListView *lvv = listView();
+ if ( !lvv )
+ return;
+
+ ReplaceView * lv = static_cast<ReplaceView*>(lvv);
+
+ const BackgroundMode bgmode = lv->viewport()->backgroundMode();
+ const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode );
+
+ if ( cg.brush( crole ) != lv->colorGroup().brush( crole ) )
+ p->fillRect( 0, 0, width, height(), cg.brush( crole ) );
+ else
+ lv->paintEmptyArea( p, QRect( 0, 0, width, height() ) );
+
+ QFontMetrics fm( lv->fontMetrics() );
+ int boxsize = lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv);
+ int marg = lv->itemMargin();
+ int r = marg;
+
+ // Draw controller / checkbox / radiobutton ---------------------
+ int styleflags = QStyle::Style_Default;
+ if ( isOn() )
+ styleflags |= QStyle::Style_On;
+ else
+ styleflags |= QStyle::Style_Off;
+ if ( isSelected() )
+ styleflags |= QStyle::Style_Selected;
+ if ( isEnabled() && lv->isEnabled() )
+ styleflags |= QStyle::Style_Enabled;
+
+ int x = 0;
+ int y = 0;
+
+ x += 3;
+
+ if ( align & AlignVCenter )
+ y = ( ( height() - boxsize ) / 2 ) + marg;
+
+ else
+ y = (fm.height() + 2 + marg - boxsize) / 2;
+
+ lv->style().drawPrimitive(QStyle::PE_CheckListIndicator, p,
+ QRect(x, y, boxsize,
+ fm.height() + 2 + marg),
+ cg, styleflags, QStyleOption(this));
+
+ r += boxsize + 4;
+
+ // Draw text ----------------------------------------------------
+ p->translate( r, 0 );
+ p->setPen( QPen( cg.text() ) );
+
+ QColorGroup mcg = cg;
+ mcg.setColor( QColorGroup::Text, ( isFile() ? Qt::darkGreen : Qt::blue ) );
+ mcg.setColor( QColorGroup::HighlightedText, ( isFile() ? Qt::darkGreen : Qt::blue ) );
+
+ QListViewItem::paintCell( p, mcg, column, width - r, align );
+}
+
+void ReplaceItem::activate( int, QPoint const & localPos )
+{
+ QListView * lv = listView();
+ QCheckBox cb(0);
+ int boxsize = cb.sizeHint().width();
+//that's KDE-3.1 only int boxsize = lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv);
+ int rightside = lv->itemMargin() + boxsize + ( isFile() ? 0 : lv->treeStepSize() );
+
+ // _lineclicked indicates if the click was on the line or in the checkbox
+ _lineclicked = rightside < localPos.x();
+}
diff --git a/parts/replace/replaceitem.h b/parts/replace/replaceitem.h
new file mode 100644
index 00000000..a6bc8ffb
--- /dev/null
+++ b/parts/replace/replaceitem.h
@@ -0,0 +1,113 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __REPLACEITEM_H__
+#define __REPLACEITEM_H__
+
+
+#include <kdeversion.h>
+#include <kdebug.h>
+
+#include "replaceview.h"
+
+class ReplaceItem : public QCheckListItem
+{
+public:
+ // the file item
+ ReplaceItem( ReplaceView * parent, ReplaceItem * after, QString file ) :
+ QCheckListItem( parent,
+ after,
+ file, QCheckListItem::CheckBox ),
+ _file( file ), _string( file ), _line( 0 ), _isfile( true ),
+ _lineclicked( false ), _clicked( true )
+ {
+ setOpen( true );
+ setOn( true );
+ }
+
+ // the line item
+ ReplaceItem( ReplaceItem * parent, ReplaceItem * after, QString file, QString string, int line ) :
+ QCheckListItem( parent,
+ after,
+ QString::number( line + 1 ) + ": " + string, QCheckListItem::CheckBox ),
+ _file( file ), _string( string ), _line( line ), _isfile( false ),
+ _lineclicked( false ), _clicked( true )
+ {
+ setOn( true );
+ }
+
+ QString const & file() const
+ {
+ return _file;
+ }
+
+ int line() const
+ {
+ return _line;
+ }
+
+ QString const & string() const
+ {
+ return _string;
+ }
+
+ bool isFile() const
+ {
+ return _isfile;
+ }
+
+ bool justClicked()
+ {
+ bool t = _clicked;
+ _clicked = true;
+ return t;
+ }
+
+ bool lineClicked()
+ {
+ return _lineclicked;
+ }
+
+ ReplaceItem * parent() const
+ {
+ return static_cast<ReplaceItem*>( QListViewItem::parent() );
+ }
+
+ ReplaceItem * firstChild() const
+ {
+ return static_cast<ReplaceItem*>( QListViewItem::firstChild() );
+ }
+
+ ReplaceItem * nextSibling() const
+ {
+ return static_cast<ReplaceItem*>( QListViewItem::nextSibling() );
+ }
+
+ void activate( int column, QPoint const & localPos );
+ bool hasCheckedChildren() const;
+ virtual void stateChange( bool state );
+
+ static bool s_listview_done;
+
+private:
+ void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );
+ void setChecked( bool checked );
+
+ QString _file;
+ QString _string;
+ int _line;
+ bool const _isfile;
+ bool _lineclicked;
+ bool _clicked;
+};
+
+#endif
+
diff --git a/parts/replace/replaceview.cpp b/parts/replace/replaceview.cpp
new file mode 100644
index 00000000..7a7505d7
--- /dev/null
+++ b/parts/replace/replaceview.cpp
@@ -0,0 +1,141 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qheader.h>
+#include <qtextstream.h>
+#include <qdir.h>
+#include <qstringlist.h>
+#include <qregexp.h>
+#include <qpalette.h>
+
+#include "replaceitem.h"
+#include "replaceview.h"
+
+
+
+ReplaceItem * ReplaceView::firstChild() const
+{
+ return static_cast<ReplaceItem*>( QListView::firstChild() );
+}
+
+
+ReplaceView::ReplaceView( QWidget * parent ) : KListView( parent ), _latestfile( 0 )
+{
+ setSorting( -1 );
+ addColumn( "" );
+ header()->hide();
+ setFullWidth(true);
+
+ QPalette pal = palette();
+ QColorGroup cg = pal.active();
+ cg.setColor( QColorGroup::Highlight, Qt::lightGray );
+ pal.setActive( cg );
+ setPalette( pal );
+
+ connect( this, SIGNAL( clicked( QListViewItem * ) ), SLOT( slotClicked( QListViewItem * ) ) );
+ connect( this, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint &, int) ),
+ SLOT( slotMousePressed(int, QListViewItem *, const QPoint &, int) ) );
+}
+
+void ReplaceView::makeReplacementsForFile( QTextStream & istream, QTextStream & ostream, ReplaceItem const * fileitem )
+{
+ int line = 0;
+
+ ReplaceItem const * lineitem = fileitem->firstChild();
+ while ( lineitem )
+ {
+ if ( lineitem->isOn() )
+ {
+ while ( line < lineitem->line() )
+ {
+ ostream << istream.readLine() << "\n";
+ line++;
+ }
+ // this is the hit
+ ostream << istream.readLine().replace( _regexp, _replacement ) << "\n";
+ line++;
+ }
+
+ lineitem = lineitem->nextSibling();
+ }
+
+ while ( !istream.atEnd() )
+ {
+ ostream << istream.readLine() << "\n";
+ }
+}
+
+void ReplaceView::showReplacementsForFile( QTextStream & stream, QString const & file )
+{
+ ReplaceItem * latestitem = 0;
+
+ int line = 0;
+ bool firstline = true;
+
+ while ( !stream.atEnd() )
+ {
+ QString s = stream.readLine();
+
+ if ( s.contains( _regexp ) > 0 )
+ {
+ s.replace( _regexp, _replacement );
+
+ if ( firstline )
+ {
+ _latestfile = new ReplaceItem( this, _latestfile, file );
+ firstline = false;
+ }
+ latestitem = new ReplaceItem( _latestfile, latestitem, file, s.stripWhiteSpace(), line );
+ _latestfile->insertItem( latestitem );
+ }
+ line++;
+ }
+}
+
+void ReplaceView::setReplacementData( QRegExp const & re, QString const & replacement )
+{
+ _regexp = re;
+ _replacement = replacement;
+}
+
+void ReplaceView::slotMousePressed(int btn, QListViewItem* i, const QPoint& pos, int col)
+{
+ kdDebug(0) << "ReplaceView::slotMousePressed()" << endl;
+
+ if ( ReplaceItem * item = dynamic_cast<ReplaceItem*>( i ) )
+ {
+ if ( btn == Qt::RightButton )
+ {
+ // popup menu?
+ }
+ else if ( btn == Qt::LeftButton )
+ {
+ // map pos to item/column and call ReplacetItem::activate(pos)
+ item->activate( col, viewport()->mapFromGlobal( pos ) - QPoint( 0, itemRect(item).top() ) );
+ }
+ }
+}
+
+void ReplaceView::slotClicked( QListViewItem * item )
+{
+ kdDebug(0) << "ReplaceView::slotClicked()" << endl;
+
+ if ( ReplaceItem * ri = dynamic_cast<ReplaceItem*>( item ) )
+ {
+ if ( ri->lineClicked() )
+ {
+ kdDebug(0) << "emitting editDocument" << endl;
+ emit editDocument( ri->file(), ri->line() );
+ }
+ }
+}
+
+#include "replaceview.moc"
diff --git a/parts/replace/replaceview.h b/parts/replace/replaceview.h
new file mode 100644
index 00000000..02ba60c9
--- /dev/null
+++ b/parts/replace/replaceview.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2003 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef __REPLACEVIEW_H__
+#define __REPLACEVIEW_H__
+
+#include <klistview.h>
+
+#include <qstring.h>
+#include <qregexp.h>
+
+class QTextStream;
+class QWidget;
+class ReplaceItem;
+
+class ReplaceView : public KListView
+{
+ Q_OBJECT
+
+signals:
+ void editDocument( const QString &, int );
+
+public:
+ ReplaceView( QWidget *);
+ ReplaceItem * firstChild() const;
+ void setReplacementData( QRegExp const &, QString const & );
+ void showReplacementsForFile( QTextStream &, QString const & );
+ void makeReplacementsForFile( QTextStream & istream, QTextStream & ostream, ReplaceItem const * fileitem );
+
+private slots:
+ void slotMousePressed(int, QListViewItem *, const QPoint &, int);
+ void slotClicked( QListViewItem * );
+
+private:
+ QRegExp _regexp;
+ QString _replacement;
+ ReplaceItem * _latestfile;
+
+friend class ReplaceItem;
+
+};
+
+
+
+
+#endif
diff --git a/parts/scripting/Makefile.am b/parts/scripting/Makefile.am
new file mode 100644
index 00000000..3613afd2
--- /dev/null
+++ b/parts/scripting/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevscripting.la
+libkdevscripting_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevscripting_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevscripting_la_SOURCES = scriptingpart.cpp scriptingglobalconfigbase.ui \
+ scriptingglobalconfig.cpp
+
+METASOURCES = AUTO
+
+appsharedir = $(kde_datadir)/kdevscripting
+appshare_DATA =
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevscripting.desktop
+
+rcdir = $(kde_datadir)/kdevscripting
+rc_DATA = kdevscripting.rc
+noinst_HEADERS = scriptingglobalconfig.h scriptingpart.h
diff --git a/parts/scripting/README b/parts/scripting/README
new file mode 100644
index 00000000..566feaa9
--- /dev/null
+++ b/parts/scripting/README
@@ -0,0 +1,18 @@
+KScript In KDevelop
+
+KScriptInterface allows us to have a generic way to add scripting languages to KDE applications. KScriptInterface is not really a scripting language per say, but an interface so that applications can embed scripting languages without explicitly linking to them. This allows all runtime linkage to the different interpreters. Currently the most effective way for scripts to communicate with applications is via DCOP. KScriptInterface script engines provide some convinences methods to access the dcop interfaces of the embedding application.
+
+In KDevelop we have the ability to use scripts written for Kate, since the KateText interface is fully exported to DCOP. By default KDevelop will import Kate scripts. Users can also add other search paths for loading scripts.
+
+To add a new script to KDevelop you need two parts. The first part is a simple desktop file that has the meta-information for the script. The basic format is like this:
+[Desktop Entry]
+Encoding=UTF-8
+Type=Service
+Name=Import Weather
+Comment=Import current weather icon graphic into an album.
+Type=ShellScript/bash
+X-KDE-ScriptName=importweather.sh
+
+The "Name" is the part that will appear in the KDevelop "Scripts" menu, and the "X-KDE-ScriptName" is the name of the script you wish to attach to that menu action. The last part the "Type" is the type of the script runner you wish to execute the script with.
+
+The second part is the actual script that has a script runner. Currently shell and KJSEmbed are supported, but Kommander support is rumored to be happening. There are also perl and python script runners in kdenonbeta.
diff --git a/parts/scripting/kdevscripting.desktop b/parts/scripting/kdevscripting.desktop
new file mode 100644
index 00000000..f2ba27ed
--- /dev/null
+++ b/parts/scripting/kdevscripting.desktop
@@ -0,0 +1,77 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Name=KDevscripting
+Name[da]=KDevelop scriptning
+Name[nds]=KDevelop-Skriptschrieven
+Name[sk]=KDev skriptovanie
+Name[sv]=KDevelop-skriptanvändning
+Name[zh_TW]=KDevelop 文稿
+GenericName=Scripting
+GenericName[ca]=Scripts
+GenericName[da]=Scriptning
+GenericName[de]=Skriptunterstützung
+GenericName[el]=Γραφή σεναρίων
+GenericName[es]=Guiones
+GenericName[et]=Skriptikeele plugin
+GenericName[eu]=Script-a
+GenericName[fa]=دست‌نوشته
+GenericName[fr]=Scriptage
+GenericName[ga]=Scriptiú
+GenericName[hu]=Szkriptszerkesztő
+GenericName[it]=Script
+GenericName[nds]=Skriptünnerstütten
+GenericName[ne]=स्क्रिप्टिङ
+GenericName[pl]=Skrypty
+GenericName[pt]='Scripting'
+GenericName[ru]=Сценарии
+GenericName[sk]=Skriptovanie
+GenericName[sl]=Skriptiranje
+GenericName[sr]=Скриптовање
+GenericName[sr@Latn]=Skriptovanje
+GenericName[sv]=Skriptanvändning
+GenericName[tr]=Betik Yazma
+GenericName[zh_CN]=脚本
+GenericName[zh_TW]=文稿
+Comment=The Scripting plugin offers KScript based scripting of the KDevelop application
+Comment[ca]=El connector per als scripts ofereix scripts basats en KScript de l'aplicació KDevelop
+Comment[da]=Scriptning-plugin stiller KScript-baseret scriptning til rådighed for KDevelop
+Comment[de]=Das "Skript"-Modul bietet KScript-basierte Automatisierung für KDevelop
+Comment[el]=Το πρόσθετο γραφής σεναρίων προσφέρει σενάρια της μορφής KScript της εφαρμογής KDevelop
+Comment[es]=El complemento de guiones ofrece guiones basados en KScript de la aplicación KDevelop
+Comment[et]=Skriptikeele plugin võimaldab KDevelopis kasutada skriptikeelt KScripti alusel
+Comment[eu]=Script-a pluginak KScript-en oinarritutako KDevelop aplikazioaren script zerbitzuak eskeintzen ditu
+Comment[fa]=وصلۀ دست‌نوشته، دست‌نوشتۀ کاربرد KDevelop بر مبنای KScript را ارائه می‌دهد.
+Comment[fr]=Le module externe Scriptage fournit le scriptage basé sur KScript de l'application KDevelop
+Comment[gl]=A extensión Scripting ofrece scripting baseado en KScript para a aplicación de KDevelop
+Comment[hu]=A Szkriptszerkesztő KScript-alapú szkriptkészítést tesz lehetővé a KDevelophoz
+Comment[it]=Il plugin di script offre lo script basato su KScript dell'applicazione KDevelop
+Comment[ms]=Plugin Scripting memberikan scripting berasaskan KScript pada aplikasi KDevelop
+Comment[nds]=Dat Skript-Moduul stellt en op KSkript opbuut Skriptbewerken för KDevelop praat.
+Comment[ne]=यो स्क्रिप्टिङ प्लगइनले केडीई विकास अनुप्रयोगको स्क्रिप्टिङमा आधारित केडीई स्क्रिप्टिङ प्रस्ताव गर्दछ
+Comment[nl]=De scripting-plugin maakt KScript gebaseerde scripting van de KDevelop-toepassing mogelijk.
+Comment[pl]=Wtyczka skrypty pozwala ja skrypty oparte o KScript w programie KDevelop
+Comment[pt]=O 'plugin' de 'scripting' oferece funcionalidade de 'scripting' da aplicação KDevelop baseados no KScript
+Comment[pt_BR]=O plug-in de scripting oferece scripts baseados no KScript do aplicativo KDevelop
+Comment[ru]=Модуль сценариев позволяет автоматизировать работу с помощью KScript
+Comment[sk]=Modul poskytuje KScript skriptovanie KDevelop aplikácie
+Comment[sr]=Прикључак за скриптовање нуди скриптовање помоћу KScript-а за KDevelop
+Comment[sr@Latn]=Priključak za skriptovanje nudi skriptovanje pomoću KScript-a za KDevelop
+Comment[sv]=Skriptinsticksprogrammet erbjuder KScript-baserad styrning av programmet KDevelop.
+Comment[tr]=Betik Yazma eklentisi KDevelop uygulamasına KScript tabanlı betik yazmayı sunar.
+Comment[zh_CN]=脚本插件可为 KDevelop 应用程序提供基于 KScript 的脚本。
+Comment[zh_TW]=文稿外掛程式提供 KDevelop 應用程式一個 KScript 基礎的文稿機制。
+Icon=shellscript
+ServiceTypes=KDevelop/Plugin
+
+X-KDevelop-Plugin-Version=1
+X-KDevelop-Plugin-Homepage=http://www.sourcextreme.com/projects/kdevelop
+X-KDevelop-Plugin-BugsEmailAddress=geiseri@sourcextreme.com
+X-KDevelop-Plugin-Copyright=(C) by ian reinhart geiser
+
+X-KDevelop-Args=
+
+X-KDevelop-Scope=Global
+X-KDE-Library=libkdevscripting
+X-KDevelop-Version=5
+X-KDevelop-Properties=CodeEditing
diff --git a/parts/scripting/kdevscripting.rc b/parts/scripting/kdevscripting.rc
new file mode 100644
index 00000000..217bece1
--- /dev/null
+++ b/parts/scripting/kdevscripting.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartplugin name="scripting" library="libscriptingplugin" version="1.0">
+<MenuBar>
+ <Menu name="scripts"><Text>S&amp;cripts</Text>
+ <ActionList name="script_actions"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/scripting/scriptingglobalconfig.cpp b/parts/scripting/scriptingglobalconfig.cpp
new file mode 100644
index 00000000..80d7a57f
--- /dev/null
+++ b/parts/scripting/scriptingglobalconfig.cpp
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2005 by ian reinhart geiser *
+ * ian@geiseri.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "scriptingglobalconfig.h"
+
+#include "scriptingpart.h"
+#include <keditlistbox.h>
+#include <kapplication.h>
+#include <kconfig.h>
+scriptingGlobalConfig::scriptingGlobalConfig(scriptingPart *part, QWidget *parent, const char *name)
+ : scriptingGlobalConfigBase(parent, name), m_part(part)
+{
+ // read kconfig and post list to the m_dirs
+ KConfig *cfg = kapp->config();
+ QStringList searchDirs = cfg->readListEntry("SearchDirs");
+ m_dirs->clear();
+ m_dirs->insertStringList(searchDirs);
+}
+
+void scriptingGlobalConfig::accept()
+{
+ // read mdirs and save to kconfig
+ KConfig *cfg = kapp->config();
+ if( !m_dirs->isEnabled() )
+ cfg->writeEntry("SearchDirs", QStringList() );
+ else
+ cfg->writeEntry("SearchDirs", m_dirs->items() );
+ m_part->setupActions();
+}
+
+#include "scriptingglobalconfig.moc"
diff --git a/parts/scripting/scriptingglobalconfig.h b/parts/scripting/scriptingglobalconfig.h
new file mode 100644
index 00000000..3dd89938
--- /dev/null
+++ b/parts/scripting/scriptingglobalconfig.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * Copyright (C) 2005 by ian reinhart geiser *
+ * ian@geiseri.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef SCRIPTING_GLOBAL_CONFIG_H
+#define SCRIPTING_GLOBAL_CONFIG_H
+
+#include "scriptingglobalconfigbase.h"
+
+class scriptingPart;
+
+class scriptingGlobalConfig: public scriptingGlobalConfigBase
+{
+ Q_OBJECT
+public:
+ scriptingGlobalConfig(scriptingPart *part, QWidget *parent = 0, const char *name = 0);
+
+public slots:
+ void accept();
+
+private:
+ scriptingPart *m_part;
+};
+
+#endif
diff --git a/parts/scripting/scriptingglobalconfigbase.ui b/parts/scripting/scriptingglobalconfigbase.ui
new file mode 100644
index 00000000..19647501
--- /dev/null
+++ b/parts/scripting/scriptingglobalconfigbase.ui
@@ -0,0 +1,51 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>scriptingGlobalConfigBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>scriptingGlobalConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Scripting</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KEditListBox">
+ <property name="name">
+ <cstring>m_dirs</cstring>
+ </property>
+ <property name="title">
+ <string>Search Custom Directories for Scripts</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;b&gt;NOTE&lt;/b&gt; These are directories to search in that are found in your KDE resource directories. So if you add the string "kate/scripts" to the list then KScript will look in "$KDEDIRS/data/kate/scripts" for scripts. This will allow you to get scripts in your home directory as well as system wide ones.</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>keditlistbox.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/scripting/scriptingpart.cpp b/parts/scripting/scriptingpart.cpp
new file mode 100644
index 00000000..803f2644
--- /dev/null
+++ b/parts/scripting/scriptingpart.cpp
@@ -0,0 +1,108 @@
+/***************************************************************************
+ * Copyright (C) 2005 by ian reinhart geiser *
+ * ian@geiseri.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "scriptingpart.h"
+
+#include <qtimer.h>
+#include <qpopupmenu.h>
+#include <qwhatsthis.h>
+
+#include <klocale.h>
+#include <kaction.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <kdevplugininfo.h>
+#include <kdevgenericfactory.h>
+
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <configwidgetproxy.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include "scriptingglobalconfig.h"
+#include "kscriptactionmanager.h"
+
+typedef KDevGenericFactory<scriptingPart> scriptingFactory;
+KDevPluginInfo data("kdevscripting");
+K_EXPORT_COMPONENT_FACTORY( libkdevscripting, scriptingFactory( data ) )
+
+#define GLOBALDOC_OPTIONS 1
+#define PROJECTDOC_OPTIONS 2
+
+scriptingPart::scriptingPart(QObject *parent, const char *name, const QStringList &/*args*/)
+ : KDevPlugin(&data, parent, name ? name : "scriptingPart"), m_scripts(0L)
+{
+ setInstance(scriptingFactory::instance());
+ setXMLFile("kdevscripting.rc");
+
+ m_configProxy = new ConfigWidgetProxy(core());
+ m_configProxy->createGlobalConfigPage(i18n("Scripting"), GLOBALDOC_OPTIONS, info()->icon());
+ connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int)));
+
+
+
+ QTimer::singleShot(0, this, SLOT(init()));
+}
+
+scriptingPart::~scriptingPart()
+{
+ delete m_configProxy;
+ delete m_scripts;
+}
+
+void scriptingPart::init()
+{
+// delayed initialization stuff goes here
+ m_scripts = new KScriptActionManager(this,actionCollection());
+ setupActions();
+}
+
+void scriptingPart::setupActions()
+{
+ kdDebug() << "Load plugins" << endl;
+ // Read KConfig and get the list of custom directories.
+ QStringList searchDirs;
+ searchDirs += "kate/scripts";
+
+ KConfig *cfg = kapp->config();
+ searchDirs += cfg->readListEntry("SearchDirs");
+
+ unplugActionList(QString::fromLatin1( "script_actions" ));
+ plugActionList( QString::fromLatin1( "script_actions" ), m_scripts->scripts(core(),searchDirs));
+}
+
+void scriptingPart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo)
+{
+// create configuraton dialogs here
+ switch (pageNo)
+ {
+ case GLOBALDOC_OPTIONS:
+ {
+ scriptingGlobalConfig *w = new scriptingGlobalConfig(this, page, "global config");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ break;
+ }
+ }
+}
+
+
+#include "scriptingpart.moc"
diff --git a/parts/scripting/scriptingpart.h b/parts/scripting/scriptingpart.h
new file mode 100644
index 00000000..7ebd08b7
--- /dev/null
+++ b/parts/scripting/scriptingpart.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * Copyright (C) 2005 by ian reinhart geiser *
+ * ian@geiseri.com *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef KDEVSCRIPTING_H
+#define KDEVSCRIPTING_H
+
+#include <kdevplugin.h>
+
+#include <qguardedptr.h>
+
+class QPopupMenu;
+class KAction;
+class KDialogBase;
+class Context;
+class ConfigWidgetProxy;
+class KScriptActionManager;
+/**
+Please read the README.dox file for more info about this part
+*/
+class scriptingPart: public KDevPlugin
+{
+ Q_OBJECT
+public:
+ scriptingPart(QObject *parent, const char *name, const QStringList &args);
+ ~scriptingPart();
+
+ public slots:
+ void setupActions();
+private slots:
+ void init();
+ void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo);
+
+
+
+private:
+ ConfigWidgetProxy *m_configProxy;
+ KScriptActionManager *m_scripts;
+};
+
+#endif
diff --git a/parts/snippet/COPYING b/parts/snippet/COPYING
new file mode 100644
index 00000000..5b6e7c66
--- /dev/null
+++ b/parts/snippet/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/parts/snippet/Makefile.am b/parts/snippet/Makefile.am
new file mode 100644
index 00000000..10ad8b0d
--- /dev/null
+++ b/parts/snippet/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevsnippet.la
+libkdevsnippet_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevsnippet_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevsnippet_la_SOURCES = snippet_part.cpp snippet_widget.cpp snippetdlg.ui snippetitem.cpp snippetsettingsbase.ui snippetsettings.cpp snippetconfig.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevsnippet.desktop
+
+rc_DATA = kdevpart_snippet.rc
+rcdir = $(kde_datadir)/kdevsnippet
+
+noinst_HEADERS = snippetdlg.h snippetitem.h snippetsettingsbase.h snippetsettings.h snippetconfig.h
diff --git a/parts/snippet/README b/parts/snippet/README
new file mode 100644
index 00000000..731741e1
--- /dev/null
+++ b/parts/snippet/README
@@ -0,0 +1,3 @@
+Please read the on-line, automaticaly updated KDevelop API documentation at:
+http://www.kdevelop.org
+or read the README.dox file.
diff --git a/parts/snippet/README.dox b/parts/snippet/README.dox
new file mode 100644
index 00000000..4d5d80de
--- /dev/null
+++ b/parts/snippet/README.dox
@@ -0,0 +1,16 @@
+/** \class SnippetPart
+This plugin provides a tool view for CodeSnippets which can be easily inserted into any KDevelop sourcecode file.
+
+\authors <a href="mailto:rgruber@users.sourceforge.net">Robert Gruber</a>
+
+\maintainer <a href="mailto:rgruber@users.sourceforge.net">Robert Gruber</a>
+
+\feature Provides a tooltree view for easy access to your CodeSnippets
+\feature You can use variables in Snippets
+\feature Tooltips show the content of the snippets
+\feature Snippets are saved based on the user who created them
+
+\requirement KDE >= 3.1.3
+
+\todo Add features
+*/
diff --git a/parts/snippet/kdevpart_snippet.rc b/parts/snippet/kdevpart_snippet.rc
new file mode 100644
index 00000000..4f34ec50
--- /dev/null
+++ b/parts/snippet/kdevpart_snippet.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="snippet" library="libkdevsnippet" version="3">
+ <MenuBar>
+ </MenuBar>
+ <Menu name="hidden">
+ <Action name="snippet_showview"/>
+ </Menu>
+</kpartplugin>
diff --git a/parts/snippet/kdevsnippet.desktop b/parts/snippet/kdevsnippet.desktop
new file mode 100644
index 00000000..481f4559
--- /dev/null
+++ b/parts/snippet/kdevsnippet.desktop
@@ -0,0 +1,102 @@
+[Desktop Entry]
+Type=Service
+Exec=
+Comment=This plugin allows you to store code snippets and add them to your code
+Comment[ca]=Aquest connector permet guardar trossos de codi i afegir-los més tard al vostre codi
+Comment[da]=Dette plugin tillader dig at opbevare kodestumper og tilføje dem til din kode
+Comment[de]=Dieses Modul erlaubt das Abspeichern und Wiederverwenden von Quelltext-Schnipseln
+Comment[el]=Αυτό το πρόσθετο σας επιτρέπει να αποθηκεύσετε δείγματα κώδικα και να τα προσθέσετε στον κώδικά σας
+Comment[es]=Este complemento permite almacenar trozos de código y añadirlos a su código fuente
+Comment[et]=See plugin võimaldab salvestada koodijuppe ja neid koodi lisada
+Comment[eu]=Plugin honek kode zatiak gordetzeo eta zure kodeari gehitzeko aukera eskeintzen dizu
+Comment[fa]=این وصله، اجازۀ ذخیرۀ تکه‌های کد و افزودن آنها را به کدتان می‌دهد
+Comment[fr]=Ce module externe permet de stocker des fragments de code et de les ajouter à votre code
+Comment[gl]=Esta extensión permite almacenar fragmentos de código e engadilos ao seu código
+Comment[hu]=Ez a modul kódrészletek eltárolását és programkódba való beillesztését teszi lehetővé
+Comment[it]=Questo plugin consente di memorizzare frammenti di codice e di aggiungerli al tuo codice
+Comment[ja]=このプラグインはコード断片を格納し、あなたのコードにそれらを加えることを可能にします。
+Comment[ms]=Plugin ini membenarkan anda untuk menyimpan petikan kod dan menambahkannya ke dalam kod anda
+Comment[nds]=Dit Moduul stellt dat Sekern un Tofögen vun Kode-Snippels praat.
+Comment[ne]=यो प्लगइनले तपाईँलाई सङ्केत स्निपेट्स भण्डारण गर्न र तपाईँको सङ्केतमा तिनीहरूलाई थप्न अनुमति दिन्छ
+Comment[nl]=Deze plugin staat u toe om tekstblokken op te slaan en deze toe te voegen aan uw code
+Comment[pl]=Wtyczka umożliwiająca zapisanie fragmentów kodu i wstawianie ich później do kodu
+Comment[pt]=Este 'plugin' permite-lhe guardar pedaços de códigos e adicioná-los ao seu código
+Comment[pt_BR]=Este plug-in permite a você armazenar os pedaços de código e adicioná-los em seu código
+Comment[ru]=Модуль сохранения часто используемых частей кода в одно место для быстрого доступа к ним
+Comment[sk]=Modul umožní uložiť si výňatky kódu a ich vkladať
+Comment[sr]=Овај прикључак вам омогућава да чувате исечке кôда и додајете их у сопствени кôд
+Comment[sr@Latn]=Ovaj priključak vam omogućava da čuvate isečke kôda i dodajete ih u sopstveni kôd
+Comment[sv]=Det här insticksprogrammet gör det möjligt att lagra kodsnuttar och lägga till dem i din kod
+Comment[ta]=இந்த உள்ளீடுகள் ஸ்னிப்பட் குறியீடுகளை சேமிக்கவும் மற்றும் அக்குறியீட்டை சேர்க்கவும் வழிவகுக்கிறது
+Comment[tg]=Нигоҳ дории модул баъзан истифодашавии як қисми код дар як ҷой барои зуд роҳ гирифтан ба он ҷо
+Comment[tr]=Bu eklenti kod parçalarını saklamanızı ve onları kodunuza eklemenizi sağlar
+Comment[zh_CN]=这个插件允许您保存代码片段并将这些片段插入到您的代码中
+Comment[zh_TW]=此外掛程式讓您儲存程式碼片段,並可以加入您的程式碼中
+Name=Code Snippets
+Name[ca]=Trossos de codi
+Name[da]=Kodestumper
+Name[de]=Quelltext-Schnipsel
+Name[el]=Δείγματα κώδικα
+Name[es]=Trozos de código
+Name[et]=Koodijupid
+Name[eu]=Kode zatiak
+Name[fa]=تکه‌های کد
+Name[fr]=Fragments de code
+Name[ga]=Blúirí Cóid
+Name[hu]=Kódrészletek
+Name[it]=Frammenti di codice
+Name[ja]=コード Snippet
+Name[ms]=Petikan Kod
+Name[nds]=Kode-Snippels
+Name[ne]=सङ्केत स्निपेट्स
+Name[pl]=Fragmenty kodu
+Name[pt]=Pedaços de Código
+Name[pt_BR]=Pedaços de Código
+Name[ru]=Заготовки кода
+Name[sk]=Výňatky kódu
+Name[sl]=Odseki kode
+Name[sv]=Kodsnuttar
+Name[ta]=ஸ்னிப்பட் குறியீடுகள்
+Name[tg]=Тайёр намудани код
+Name[tr]=Kod Parçacıkları
+Name[zh_CN]=代码片段
+Name[zh_TW]=程式碼片段
+GenericName=Code Snippets
+GenericName[ca]=Trossos de codi
+GenericName[da]=Kodestumper
+GenericName[de]=Quelltext-Schnipsel
+GenericName[el]=Δείγματα κώδικα
+GenericName[es]=Trozos de código
+GenericName[et]=Koodijupid
+GenericName[eu]=Kode zatiak
+GenericName[fa]=تکه‌های کد
+GenericName[fr]=Fragments de code
+GenericName[ga]=Blúirí Cóid
+GenericName[gl]=Fragmentos de código
+GenericName[hu]=Kódrészletek
+GenericName[it]=Frammenti di codice
+GenericName[ja]=コード Snippet
+GenericName[ms]=Petikan Kod
+GenericName[nds]=Kode-Snippels
+GenericName[ne]=सङ्केत स्निपेट्स
+GenericName[nl]=Tekstblokken
+GenericName[pl]=Fragmenty kodu
+GenericName[pt]=Pedaços de Código
+GenericName[pt_BR]=Pedaços de código
+GenericName[ru]=Заготовки кода
+GenericName[sk]=Výňatky kódu
+GenericName[sl]=Odseki kode
+GenericName[sr]=Исечци кôда
+GenericName[sr@Latn]=Isečci kôda
+GenericName[sv]=Kodsnuttar
+GenericName[ta]=ஸ்ப்பட் குறியீடு
+GenericName[tg]=Тайёр намудани кодҳо
+GenericName[tr]=Kod Parçacıkları
+GenericName[zh_CN]=代码片段
+GenericName[zh_TW]=程式碼片段
+Icon=editcut
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Global
+X-KDE-Library=libkdevsnippet
+X-KDevelop-Version=5
+X-KDevelop-Properties=CodeEditing
diff --git a/parts/snippet/snippet_part.cpp b/parts/snippet/snippet_part.cpp
new file mode 100644
index 00000000..f7564109
--- /dev/null
+++ b/parts/snippet/snippet_part.cpp
@@ -0,0 +1,155 @@
+/*
+ * File : snippet_part.cpp
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+#include "snippet_part.h"
+
+#include <qwhatsthis.h>
+
+#include <kaction.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kaboutdata.h>
+#include <qvbox.h>
+#include <kdialogbase.h>
+#include <klineedit.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+#include <ktrader.h>
+
+#include "kdevcore.h"
+#include <kdevproject.h>
+#include "kdevmainwindow.h"
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+
+#include <kdebug.h>
+
+#include "snippet_widget.h"
+#include "snippetitem.h"
+#include "snippetsettings.h"
+#include "snippetconfig.h"
+
+static const KDevPluginInfo data("kdevsnippet");
+typedef KDevGenericFactory<SnippetPart> snippetFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevsnippet, snippetFactory( data ) )
+
+SnippetPart::SnippetPart(QObject *parent, const char *name, const QStringList& )
+ : KDevPlugin(&data, parent, name ? name : "SnippetPart" )
+{
+ setInstance(snippetFactory::instance());
+ setXMLFile("kdevpart_snippet.rc");
+
+ m_widget = new SnippetWidget(this);
+ m_widget->setCaption(i18n("Code Snippets"));
+ m_widget->setIcon(SmallIcon( info()->icon() ));
+
+ QWhatsThis::add(m_widget, i18n("<b>Code Snippet</b><p>This is a list of available snippets."));
+
+ mainWindow()->embedSelectViewRight( m_widget, i18n("Code Snippets"), i18n("Insert a code snippet") );
+
+ connect( core(), SIGNAL( configWidget( KDialogBase * ) ), this, SLOT( slotConfigWidget( KDialogBase * ) ) );
+
+ /*The next two connects are used to check if certain SnippetGroups need to be opened
+ according to the languages supported by this project*/
+ connect( core(), SIGNAL( projectOpened() ), m_widget, SLOT( languageChanged() ) );
+ connect( core(), SIGNAL( languageChanged() ), m_widget, SLOT( languageChanged() ) );
+
+ setupActions();
+}
+
+SnippetPart::~SnippetPart()
+{
+ if ( m_widget )
+ {
+ mainWindow()->removeView( m_widget );
+ }
+
+ delete m_widget;
+}
+
+void SnippetPart::setupActions()
+{
+ new KAction( i18n("Show Snippet Tree"), CTRL+ALT+SHIFT+Key_S, this, SLOT(slotShowView()), actionCollection(), "snippet_showview");
+}
+
+/*!
+ \fn SnippetPart::aboutData()
+ */
+KAboutData* SnippetPart::aboutData()
+{
+ KAboutData *data = new KAboutData ("snippetpart", I18N_NOOP("SnippetPart"), "1.1",
+ I18N_NOOP( "SnippetPart for KDevelop" ),
+ KAboutData::License_LGPL_V2,
+ I18N_NOOP( "(c) 2003" ), 0, "http://www.kdevelop.org");
+ data->addAuthor ("Robert Gruber", I18N_NOOP("Author"), "rgruber@users.sourceforge.net", "http://kmp3indexer.sf.net");
+
+
+ return data;
+}
+
+
+/*!
+ \fn SnippetPart::slotConfigWidget( KDialogBase *dlg )
+ */
+void SnippetPart::slotConfigWidget( KDialogBase *dlg )
+{
+ QVBox *vbox = dlg->addVBoxPage( i18n("Code Snippets"), i18n("Code Snippets"), BarIcon( info()->icon(), KIcon::SizeMedium ) );
+
+ SnippetSettings * w = new SnippetSettings( m_widget, vbox );
+
+ w->btnGroup->setButton(m_widget->getSnippetConfig()->getInputMethod());
+ w->leDelimiter->setText(m_widget->getSnippetConfig()->getDelimiter());
+ w->cbToolTip->setChecked(m_widget->getSnippetConfig()->useToolTips());
+ w->btnGroupAutoOpen->setButton(m_widget->getSnippetConfig()->getAutoOpenGroups());
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(slotOKClicked()) );
+}
+
+
+QStringList SnippetPart::getAllLanguages()
+{
+ KTrader::OfferList languageSupportOffers =
+ KTrader::self()->query(QString::fromLatin1("KDevelop/LanguageSupport"),
+ QString::fromLatin1("[X-KDevelop-Version] == %1"
+ ).arg( KDEVELOP_PLUGIN_VERSION ));
+
+ QStringList languages;
+
+ for (KTrader::OfferList::ConstIterator it = languageSupportOffers.begin(); it != languageSupportOffers.end(); ++it)
+ {
+ QString language = (*it)->property("X-KDevelop-Language").toString();
+ languages.append(language);
+
+ kdDebug(9035) << "Found language: " << (*it)->property("X-KDevelop-Language").toString() << endl <<
+ "genericName(): " <<(*it)->genericName() << endl <<
+ "comment(): " <<(*it)->comment() << endl << endl;
+ }
+
+ return languages;
+}
+
+
+QStringList SnippetPart::getProjectLanguages()
+{
+ QStringList languages;
+ if (!projectDom())
+ return languages;
+
+ QDomDocument m_projectDom = *projectDom();
+
+ if (m_widget->getSnippetConfig()->getAutoOpenGroups() == 1)
+ languages = DomUtil::readListEntry(m_projectDom, "/general/secondaryLanguages", "language");
+ languages.prepend( DomUtil::readEntry(m_projectDom, "/general/primarylanguage") );
+ return languages;
+}
+
+void SnippetPart::slotShowView()
+{
+ mainWindow()->raiseView( m_widget );
+}
+
+
+#include "snippet_part.moc"
diff --git a/parts/snippet/snippet_part.h b/parts/snippet/snippet_part.h
new file mode 100644
index 00000000..98c3b252
--- /dev/null
+++ b/parts/snippet/snippet_part.h
@@ -0,0 +1,50 @@
+/*
+ * File : snippet_part.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+
+#ifndef __KDEVPART_SNIPPET_H__
+#define __KDEVPART_SNIPPET_H__
+
+
+#include <qguardedptr.h>
+#include <kdevplugin.h>
+
+
+class SnippetWidget;
+class KAboutData;
+class KDialogBase;
+
+/*
+This is the KDevPlugin for the CodeSnippet feature
+For more info read the README.dox file
+@author Robert Gruber
+*/
+class SnippetPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ SnippetPart(QObject *parent, const char *name, const QStringList &);
+ ~SnippetPart();
+ KAboutData * aboutData();
+ QStringList getAllLanguages();
+ QStringList getProjectLanguages();
+
+private:
+ void setupActions();
+
+ QGuardedPtr<SnippetWidget> m_widget;
+
+public slots:
+ void slotConfigWidget( KDialogBase *dlg );
+ void slotShowView();
+};
+
+
+#endif
diff --git a/parts/snippet/snippet_widget.cpp b/parts/snippet/snippet_widget.cpp
new file mode 100644
index 00000000..98d61505
--- /dev/null
+++ b/parts/snippet/snippet_widget.cpp
@@ -0,0 +1,970 @@
+/*
+ * File : snippet_widget.cpp
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <qlayout.h>
+#include <kpushbutton.h>
+#include <klistview.h>
+#include <qheader.h>
+#include <klineedit.h>
+#include <ktextedit.h>
+#include <kmessagebox.h>
+#include <qsplitter.h>
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/editor.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/document.h>
+#include <kconfig.h>
+#include <qtooltip.h>
+#include <kpopupmenu.h>
+#include <qregexp.h>
+#include <qinputdialog.h>
+#include <qlabel.h>
+#include <qcheckbox.h>
+#include <qwhatsthis.h>
+#include <qdragobject.h>
+#include <qtimer.h>
+#include <kcombobox.h>
+#include <kdeversion.h>
+
+#include <kdevcore.h>
+#include <kdevproject.h>
+#include <kdevpartcontroller.h>
+
+#include "snippetdlg.h"
+#include "snippetitem.h"
+
+#include "snippet_part.h"
+#include "snippet_widget.h"
+
+SnippetWidget::SnippetWidget(SnippetPart *part)
+ : KListView(0, "snippet widget"), QToolTip( viewport() ),
+ m_part( part )
+{
+ // init the QPtrList
+ _list.setAutoDelete(TRUE);
+
+ // init the KListView
+ setSorting( -1 );
+ addColumn( "" );
+ setFullWidth(true);
+ header()->hide();
+ setAcceptDrops(true);
+ setDragEnabled(false);
+ setDropVisualizer(false);
+ setRootIsDecorated(true);
+
+ //connect the signals
+ connect( this, SIGNAL( contextMenuRequested ( QListViewItem *, const QPoint & , int ) ),
+ this, SLOT( showPopupMenu(QListViewItem *, const QPoint & , int ) ) );
+
+ connect( this, SIGNAL( executed (QListViewItem *) ),
+ this, SLOT( slotExecuted( QListViewItem *) ) );
+ connect( this, SIGNAL( returnPressed (QListViewItem *) ),
+ this, SLOT( slotExecuted( QListViewItem *) ) );
+
+ connect( this, SIGNAL( dropped(QDropEvent *, QListViewItem *) ),
+ this, SLOT( slotDropped(QDropEvent *, QListViewItem *) ) );
+
+ _cfg = 0;
+
+ QTimer::singleShot(0, this, SLOT(initConfig()));
+}
+
+SnippetWidget::~SnippetWidget()
+{
+ writeConfig();
+ delete _cfg;
+
+ /* We need to delete the child items before the parent items
+ otherwise KDevelop would crash on exiting */
+ SnippetItem * item;
+ while (_list.count() > 0) {
+ for (item=_list.first(); item; item=_list.next()) {
+ if (item->childCount() == 0)
+ _list.remove(item);
+ }
+ }
+}
+
+
+/*!
+ \fn SnippetWidget::slotAdd()
+ Opens the didalog to add a snippet
+ */
+void SnippetWidget::slotAdd()
+{
+ kdDebug(9035) << "Ender slotAdd()" << endl;
+ SnippetDlg dlg(this, "SnippetDlg", true);
+
+ /*check if the user clicked a SnippetGroup
+ If not, we set the group variable to the SnippetGroup
+ which the selected item is a child of*/
+ SnippetGroup * group = dynamic_cast<SnippetGroup*>(selectedItem());
+ if (!group)
+ group = dynamic_cast<SnippetGroup*>(selectedItem()->parent());
+
+ /*fill the combobox with the names of all SnippetGroup entries*/
+ for (SnippetItem *it=_list.first(); it; it=_list.next()) {
+ if (dynamic_cast<SnippetGroup*>(it)) {
+ dlg.cbGroup->insertItem(it->getName());
+ }
+ }
+ dlg.cbGroup->setCurrentText(group->getName());
+
+ if (dlg.exec() == QDialog::Accepted) {
+ group = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list));
+ _list.append( new SnippetItem(group, dlg.snippetName->text(), dlg.snippetText->text()) );
+ }
+}
+
+
+/*!
+ \fn SnippetWidget::slotAddGroup()
+ Opens the didalog to add a snippet
+ */
+void SnippetWidget::slotAddGroup()
+{
+ kdDebug(9035) << "Ender slotAddGroup()" << endl;
+ SnippetDlg dlg(this, "SnippetDlg", true);
+ dlg.snippetText->setEnabled(false);
+ dlg.snippetText->setText("GROUP");
+ dlg.setCaption(i18n("Add Group"));
+ dlg.cbGroup->insertItem(i18n("All"));
+ dlg.cbGroup->insertStringList(m_part->getAllLanguages());
+ dlg.cbGroup->setCurrentText(i18n("All"));
+ dlg.textLabelGroup->setText(i18n("Language:"));
+
+ if (dlg.exec() == QDialog::Accepted) {
+ _list.append( new SnippetGroup(this, dlg.snippetName->text(), SnippetGroup::getMaxId(), dlg.cbGroup->currentText()) );
+ }
+}
+
+
+/*!
+ \fn SnippetWidget::slotRemove()
+ Removes the selected snippet
+ */
+void SnippetWidget::slotRemove()
+{
+ //get current data
+ QListViewItem * item = currentItem();
+ SnippetItem *snip = dynamic_cast<SnippetItem*>( item );
+ SnippetGroup *group = dynamic_cast<SnippetGroup*>( item );
+ if (!snip)
+ return;
+
+ if (group) {
+ if (group->childCount() > 0 &&
+ KMessageBox::warningContinueCancel(this, i18n("Do you really want to remove this group and all its snippets?"),QString::null,KStdGuiItem::del())
+ == KMessageBox::Cancel)
+ return;
+
+ for (SnippetItem *it=_list.first(); it; it=_list.next()) {
+ if (it->getParent() == group->getId()) {
+ kdDebug(9035) << "remove " << it->getName() << endl;
+ _list.remove(it);
+ }
+ }
+ }
+
+ kdDebug(9035) << "remove " << snip->getName() << endl;
+ _list.remove(snip);
+}
+
+
+
+/*!
+ \fn SnippetWidget::slotEdit()
+ Opens the dialog of editing the selected snippet
+ */
+void SnippetWidget::slotEdit()
+{
+ //get current data
+ QListViewItem * item = currentItem();
+
+ SnippetGroup *pGroup = dynamic_cast<SnippetGroup*>(item);
+ SnippetItem *pSnippet = dynamic_cast<SnippetItem*>( item );
+ if (!pSnippet || pGroup) /*selected item must be a SnippetItem but MUST not be a SnippetGroup*/
+ return;
+
+ //init the dialog
+ SnippetDlg dlg(this, "SnippetDlg", true);
+ dlg.snippetName->setText(pSnippet->getName());
+ dlg.snippetText->setText(pSnippet->getText());
+ dlg.btnAdd->setText(i18n("&Apply"));
+
+ dlg.setCaption(i18n("Edit Snippet"));
+ /*fill the combobox with the names of all SnippetGroup entries*/
+ for (SnippetItem *it=_list.first(); it; it=_list.next()) {
+ if (dynamic_cast<SnippetGroup*>(it)) {
+ dlg.cbGroup->insertItem(it->getName());
+ }
+ }
+ dlg.cbGroup->setCurrentText(SnippetItem::findGroupById(pSnippet->getParent(), _list)->getName());
+
+ if (dlg.exec() == QDialog::Accepted) {
+ //update the KListView and the SnippetItem
+ item->setText( 0, dlg.snippetName->text() );
+ pSnippet->setName( dlg.snippetName->text() );
+ pSnippet->setText( dlg.snippetText->text() );
+
+ /* if the user changed the parent we need to move the snippet */
+ if ( SnippetItem::findGroupById(pSnippet->getParent(), _list)->getName() != dlg.cbGroup->currentText() ) {
+ SnippetGroup * newGroup = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list));
+ pSnippet->parent()->takeItem(pSnippet);
+ newGroup->insertItem(pSnippet);
+ pSnippet->resetParent();
+ }
+
+ setSelected(item, TRUE);
+ }
+}
+
+/*!
+ \fn SnippetWidget::slotEditGroup()
+ Opens the dialog of editing the selected snippet-group
+ */
+void SnippetWidget::slotEditGroup()
+{
+ //get current data
+ QListViewItem * item = currentItem();
+
+ SnippetGroup *pGroup = dynamic_cast<SnippetGroup*>( item );
+ if (!pGroup) /*selected item MUST be a SnippetGroup*/
+ return;
+
+ //init the dialog
+ SnippetDlg dlg(this, "SnippetDlg", true);
+ dlg.snippetName->setText(pGroup->getName());
+ dlg.snippetText->setText(pGroup->getText());
+ dlg.btnAdd->setText(i18n("&Apply"));
+ dlg.snippetText->setEnabled(FALSE);
+ dlg.setCaption(i18n("Edit Group"));
+ dlg.cbGroup->insertItem(i18n("All"));
+ dlg.cbGroup->insertStringList(m_part->getAllLanguages());
+ dlg.cbGroup->setCurrentText(pGroup->getLanguage());
+ dlg.textLabelGroup->setText(i18n("Language:"));
+
+ if (dlg.exec() == QDialog::Accepted) {
+ //update the KListView and the SnippetGroup
+ item->setText( 0, dlg.snippetName->text() );
+ pGroup->setName( dlg.snippetName->text() );
+ pGroup->setLanguage(dlg.cbGroup->currentText());
+
+ setSelected(item, TRUE);
+ }
+}
+
+void SnippetWidget::slotExecuted(QListViewItem * item)
+{
+ SnippetItem *pSnippet = dynamic_cast<SnippetItem*>( item );
+ if (!pSnippet || dynamic_cast<SnippetGroup*>(item))
+ return;
+
+ //process variables if any, then insert into the active view
+ insertIntoActiveView( parseText(pSnippet->getText(), _SnippetConfig.getDelimiter()) );
+}
+
+
+/*!
+ \fn SnippetWidget::insertIntoActiveView(QString text)
+ Inserts the parameter text into the activ view
+ */
+void SnippetWidget::insertIntoActiveView(QString text)
+{
+ //get the interfaces for the KTexteditor parts
+ KTextEditor::ViewCursorInterface *cursorIface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(m_part->partController()->activeWidget());
+
+ if (!cursorIface)
+ return;
+
+ KTextEditor::EditInterface* editIface
+ = dynamic_cast<KTextEditor::EditInterface*>( m_part->partController()->activePart() );
+
+ if (!editIface)
+ return;
+
+ uint line, col;
+ cursorIface->cursorPositionReal(&line, &col);
+
+ editIface->insertText( line, col , text );
+}
+
+
+/*!
+ \fn SnippetWidget::writeConfig()
+ Write the cofig file
+ */
+void SnippetWidget::writeConfig()
+{
+ if( !_cfg )
+ return;
+ _cfg->deleteGroup("SnippetPart"); //this is neccessary otherwise delete entries will stay in list until
+ //they get overwritten by a more recent entry
+ _cfg->setGroup("SnippetPart");
+
+ SnippetItem *item;
+ QString strKeyName="";
+ QString strKeyText="";
+ QString strKeyId="";
+
+ int iSnipCount = 0;
+ int iGroupCount = 0;
+
+ for ( item = _list.first(); item; item = _list.next() ) { //write the snippet-list
+ kdDebug(9035) << "SnippetWidget::writeConfig() " << item->getName() << endl;
+ SnippetGroup * group = dynamic_cast<SnippetGroup*>(item);
+ if (group) {
+ kdDebug(9035) << "-->GROUP " << item->getName() << group->getId() << " " << iGroupCount<< endl;
+ strKeyName=QString("snippetGroupName_%1").arg(iGroupCount);
+ strKeyId=QString("snippetGroupId_%1").arg(iGroupCount);
+ strKeyText=QString("snippetGroupLang_%1").arg(iGroupCount);
+
+ _cfg->writeEntry(strKeyName, group->getName());
+ _cfg->writeEntry(strKeyId, group->getId());
+ _cfg->writeEntry(strKeyText, group->getLanguage());
+ iGroupCount++;
+ } else if (dynamic_cast<SnippetItem*>(item)) {
+ kdDebug(9035) << "-->ITEM " << item->getName() << item->getParent() << " " << iSnipCount << endl;
+ strKeyName=QString("snippetName_%1").arg(iSnipCount);
+ strKeyText=QString("snippetText_%1").arg(iSnipCount);
+ strKeyId=QString("snippetParent_%1").arg(iSnipCount);
+
+ _cfg->writeEntry(strKeyName, item->getName());
+ _cfg->writeEntry(strKeyText, item->getText());
+ _cfg->writeEntry(strKeyId, item->getParent());
+ iSnipCount++;
+ } else {
+ kdDebug(9035) << "-->ERROR " << item->getName() << endl;
+ }
+ }
+ _cfg->writeEntry("snippetCount", iSnipCount);
+ _cfg->writeEntry("snippetGroupCount", iGroupCount);
+
+ int iCount = 1;
+ QMap<QString, QString>::Iterator it;
+ for ( it = _mapSaved.begin(); it != _mapSaved.end(); ++it ) { //write the saved variable values
+ if (it.data().length()<=0) continue; //is the saved value has no length -> no need to save it
+
+ strKeyName=QString("snippetSavedName_%1").arg(iCount);
+ strKeyText=QString("snippetSavedVal_%1").arg(iCount);
+
+ _cfg->writeEntry(strKeyName, it.key());
+ _cfg->writeEntry(strKeyText, it.data());
+
+ iCount++;
+ }
+ _cfg->writeEntry("snippetSavedCount", iCount-1);
+
+
+ _cfg->writeEntry( "snippetDelimiter", _SnippetConfig.getDelimiter() );
+ _cfg->writeEntry( "snippetVarInput", _SnippetConfig.getInputMethod() );
+ _cfg->writeEntry( "snippetToolTips", _SnippetConfig.useToolTips() );
+ _cfg->writeEntry( "snippetGroupAutoOpen", _SnippetConfig.getAutoOpenGroups() );
+
+ _cfg->writeEntry("snippetSingleRect", _SnippetConfig.getSingleRect() );
+ _cfg->writeEntry("snippetMultiRect", _SnippetConfig.getMultiRect() );
+
+ _cfg->sync();
+}
+
+
+/*!
+ This function was introduced together with the grouping-feature.
+ As far as some guys might have some snippets stored in the "old" way
+ we need to create a "DEFAULT" group into which we can import all snippets
+ */
+void SnippetWidget::initConfigOldVersion(KConfig *cfg)
+{
+ SnippetGroup * group = new SnippetGroup(this, "DEFAULT", 1);
+ _list.append(group);
+
+ int iCount = cfg->readNumEntry("snippetCount", 0);
+ QString strKeyName="";
+ QString strKeyText="";
+ for ( int i=0; i<iCount; i++) { //read the snippet-list
+ strKeyName=QString("snippetName_%1").arg(i);
+ strKeyText=QString("snippetText_%1").arg(i);
+
+ QString strNameVal="";
+ QString strTextVal="";
+
+ strNameVal = cfg->readEntry(strKeyName, "");
+ strTextVal = cfg->readEntry(strKeyText, "");
+
+ if (strNameVal != "" && strTextVal != "") {
+ SnippetItem * item = new SnippetItem(group, strNameVal, strTextVal);
+ _list.append(item);
+ }
+ }
+}
+
+
+/*!
+ \fn SnippetWidget::initConfig()
+ Initial read the cofig file
+ */
+void SnippetWidget::initConfig()
+{
+ if (_cfg == NULL)
+ _cfg = new KConfig("kdevsnippetrc", false, false);
+
+ _cfg->setGroup("SnippetPart");
+
+ QString strKeyName="";
+ QString strKeyText="";
+ QString strKeyId="";
+ SnippetItem *item;
+ SnippetGroup *group;
+
+ kdDebug(9035) << "SnippetWidget::initConfig() " << endl;
+
+ //if entry doesn't get found, this will return -1 which we will need a bit later
+ int iCount = _cfg->readNumEntry("snippetGroupCount", -1);
+
+ for ( int i=0; i<iCount; i++) { //read the group-list
+ strKeyName=QString("snippetGroupName_%1").arg(i);
+ strKeyId=QString("snippetGroupId_%1").arg(i);
+ strKeyText=QString("snippetGroupLang_%1").arg(i);
+
+ QString strNameVal="";
+ int iIdVal=-1;
+ QString strLangVal="";
+
+ strNameVal = _cfg->readEntry(strKeyName, "");
+ iIdVal = _cfg->readNumEntry(strKeyId, -1);
+ strLangVal = _cfg->readEntry(strKeyText, i18n("All"));
+ kdDebug(9035) << "Read group " << strNameVal << " " << iIdVal << endl;
+
+ if (strNameVal != "" && iIdVal != -1 && strLangVal != "") {
+ group = new SnippetGroup(this, strNameVal, iIdVal, strLangVal);
+ kdDebug(9035) << "Created group " << group->getName() << " " << group->getId() << endl;
+ _list.append(group);
+ if (group->getLanguage() == i18n("All"))
+ group->setOpen(TRUE);
+ else
+ group->setOpen(FALSE); //groups assigned to certain languages get handled later
+ }
+ }
+
+ /* Check if the snippetGroupCount property has been found
+ if iCount is -1 this means, that the user has his snippets
+ stored without groups. Therefore we will call the
+ initConfigOldVersion() function below */
+ if (iCount != -1) {
+ iCount = _cfg->readNumEntry("snippetCount", 0);
+ for ( int i=0; i<iCount; i++) { //read the snippet-list
+ strKeyName=QString("snippetName_%1").arg(i);
+ strKeyText=QString("snippetText_%1").arg(i);
+ strKeyId=QString("snippetParent_%1").arg(i);
+
+ QString strNameVal="";
+ QString strTextVal="";
+ int iParentVal = -1;
+
+ strNameVal = _cfg->readEntry(strKeyName, "");
+ strTextVal = _cfg->readEntry(strKeyText, "");
+ iParentVal = _cfg->readNumEntry(strKeyId, -1);
+ kdDebug(9035) << "Read item " << strNameVal << " " << iParentVal << endl;
+
+ if (strNameVal != "" && strTextVal != "" && iParentVal != -1) {
+ item = new SnippetItem(SnippetItem::findGroupById(iParentVal, _list), strNameVal, strTextVal);
+ kdDebug(9035) << "Created item " << item->getName() << " " << item->getParent() << endl;
+ _list.append(item);
+ }
+ }
+ } else {
+ kdDebug(9035) << "found old version of snippet-configfile" << endl;
+ initConfigOldVersion(_cfg);
+ }
+
+ iCount = _cfg->readNumEntry("snippetSavedCount", 0);
+
+ for ( int i=1; i<=iCount; i++) { //read the saved-values and store in QMap
+ strKeyName=QString("snippetSavedName_%1").arg(i);
+ strKeyText=QString("snippetSavedVal_%1").arg(i);
+
+ QString strNameVal="";
+ QString strTextVal="";
+
+ strNameVal = _cfg->readEntry(strKeyName, "");
+ strTextVal = _cfg->readEntry(strKeyText, "");
+
+ if (strNameVal != "" && strTextVal != "") {
+ _mapSaved[strNameVal] = strTextVal;
+ }
+ }
+
+
+ _SnippetConfig.setDelimiter( _cfg->readEntry("snippetDelimiter", "$") );
+ _SnippetConfig.setInputMethod( _cfg->readNumEntry("snippetVarInput", 0) );
+ _SnippetConfig.setToolTips( _cfg->readBoolEntry("snippetToolTips", true) );
+ _SnippetConfig.setAutoOpenGroups( _cfg->readNumEntry("snippetGroupAutoOpen", 1) );
+
+ _SnippetConfig.setSingleRect( _cfg->readRectEntry("snippetSingleRect", 0L) );
+ _SnippetConfig.setMultiRect( _cfg->readRectEntry("snippetMultiRect", 0L) );
+}
+
+/*!
+ \fn SnippetWidget::maybeTip( const QPoint & p )
+ Shows the Snippet-Text as ToolTip
+ */
+void SnippetWidget::maybeTip( const QPoint & p )
+{
+ SnippetItem * item = dynamic_cast<SnippetItem*>( itemAt( p ) );
+ if (!item)
+ return;
+
+ QRect r = itemRect( item );
+
+ if (r.isValid() &&
+ _SnippetConfig.useToolTips() )
+ {
+ if (dynamic_cast<SnippetGroup*>(item)) {
+ tip( r, i18n("Language:")+((SnippetGroup*)item)->getLanguage() ); //show the group's language
+ } else {
+ tip( r, item->getText() ); //show the snippet's text
+ }
+ }
+}
+
+/*!
+ \fn SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
+ Shows the Popup-Menu depending item is a valid pointer
+*/
+void SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
+{
+ KPopupMenu popup;
+
+ SnippetItem * selectedItem = static_cast<SnippetItem *>(item);
+ if ( item ) {
+ popup.insertTitle( selectedItem->getName() );
+
+ popup.insertItem( i18n("Add Item..."), this, SLOT( slotAdd() ) );
+ popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
+ if (dynamic_cast<SnippetGroup*>(item)) {
+ popup.insertItem( i18n("Edit..."), this, SLOT( slotEditGroup() ) );
+ } else {
+ popup.insertItem( i18n("Edit..."), this, SLOT( slotEdit() ) );
+ }
+ popup.insertItem( i18n("Remove"), this, SLOT( slotRemove() ) );
+
+ } else {
+ popup.insertTitle(i18n("Code Snippets"));
+
+ popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
+ }
+
+ popup.exec(p);
+}
+
+
+// fn SnippetWidget::parseText(QString text, QString del)
+/*!
+ This function is used to parse the given QString for variables. If found the user will be prompted
+ for a replacement value. It returns the string text with all replacements made
+ */
+QString SnippetWidget::parseText(QString text, QString del)
+{
+ QString str = text;
+ QString strName = "";
+ QString strNew = "";
+ QString strMsg="";
+ int iFound = -1;
+ int iEnd = -1;
+ QMap<QString, QString> mapVar;
+ int iInMeth = _SnippetConfig.getInputMethod();
+ QRect rSingle = _SnippetConfig.getSingleRect();
+ QRect rMulti = _SnippetConfig.getMultiRect();
+
+ do {
+ iFound = text.find(QRegExp("\\"+del+"[A-Za-z-_0-9\\s]*\\"+del), iEnd+1); //find the next variable by this QRegExp
+ if (iFound >= 0) {
+ iEnd = text.find(del, iFound+1)+1;
+ strName = text.mid(iFound, iEnd-iFound);
+
+ if ( strName != del+del ) { //if not doubel-delimiter
+ if (iInMeth == 0) { //if input-method "single" is selected
+ if ( mapVar[strName].length() <= 0 ) { // and not already in map
+ strMsg=i18n("Please enter the value for <b>%1</b>:").arg(strName);
+ strNew = showSingleVarDialog( strName, &_mapSaved, rSingle );
+ if (strNew=="")
+ return ""; //user clicked Cancle
+ } else {
+ continue; //we have already handled this variable
+ }
+ } else {
+ strNew = ""; //for inputmode "multi" just reset new valaue
+ }
+ } else {
+ strNew = del; //if double-delimiter -> replace by single character
+ }
+
+ if (iInMeth == 0) { //if input-method "single" is selected
+ str.replace(strName, strNew);
+ }
+
+ mapVar[strName] = strNew;
+ }
+ } while (iFound != -1);
+
+ if (iInMeth == 1) { //check config, if input-method "multi" is selected
+ int w, bh, oh;
+ w = rMulti.width();
+ bh = rMulti.height();
+ oh = rMulti.top();
+ if (showMultiVarDialog( &mapVar, &_mapSaved, w, bh, oh )) { //generate and show the dialog
+ QMap<QString, QString>::Iterator it;
+ for ( it = mapVar.begin(); it != mapVar.end(); ++it ) { //walk through the map and do the replacement
+ str.replace(it.key(), it.data());
+ }
+ } else {
+ return "";
+ }
+
+ rMulti.setWidth(w); //this is a hack to save the dialog's dimensions in only one QRect
+ rMulti.setHeight(bh);
+ rMulti.setTop(oh);
+ rMulti.setLeft(0);
+ _SnippetConfig.setMultiRect(rMulti);
+ }
+
+ _SnippetConfig.setSingleRect(rSingle);
+
+ return str;
+}
+
+
+// fn SnippetWidget::showMultiVarDialog()
+/*!
+ This function constructs a dialog which contains a label and a linedit for every
+ variable that is stored in the given map except the double-delimiter entry
+ It return true if everything was ok and false if the user hit cancel
+ */
+bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
+ int & iWidth, int & iBasicHeight, int & iOneHeight)
+{
+ //if no var -> no need to show
+ if (map->count() == 0)
+ return true;
+
+ //if only var is the double-delimiter -> no need to show
+ QMap<QString, QString>::Iterator it = map->begin();
+ if ( map->count() == 1 && it.data()==_SnippetConfig.getDelimiter()+_SnippetConfig.getDelimiter() )
+ return true;
+
+ QMap<QString, KTextEdit *> mapVar2Te; //this map will help keeping track which TEXTEDIT goes with which variable
+ QMap<QString, QCheckBox *> mapVar2Cb; //this map will help keeping track which CHECKBOX goes with which variable
+
+ // --BEGIN-- building a dynamic dialog
+ QDialog dlg(this);
+ dlg.setCaption(i18n("Enter Values for Variables"));
+
+ QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
+ QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
+ QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
+ QGridLayout * layoutBtn = new QGridLayout( 0, 1, 1, 0, 6, "layoutBtn");
+
+ KTextEdit *te = NULL;
+ QLabel * labTop = NULL;
+ QCheckBox * cb = NULL;
+
+ labTop = new QLabel( &dlg, "label" );
+ labTop->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
+ labTop->sizePolicy().hasHeightForWidth() ) );
+ labTop->setText(i18n("Enter the replacement values for these variables:"));
+ layoutTop->addWidget(labTop, 0, 0);
+ layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 );
+
+
+ int i = 0; //walk through the variable map and add
+ for ( it = map->begin(); it != map->end(); ++it ) { //a checkbox, a lable and a lineedit to the main layout
+ if (it.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
+ continue;
+
+ cb = new QCheckBox( &dlg, "cbVar" );
+ cb->setChecked( FALSE );
+ cb->setText(it.key());
+ layoutVar->addWidget( cb, i ,0, Qt::AlignTop );
+
+ te = new KTextEdit( &dlg, "teVar" );
+ layoutVar->addWidget( te, i, 1, Qt::AlignTop );
+
+ if ((*mapSave)[it.key()].length() > 0) {
+ cb->setChecked( TRUE );
+ te->setText((*mapSave)[it.key()]);
+ }
+
+ mapVar2Te[it.key()] = te;
+ mapVar2Cb[it.key()] = cb;
+
+ QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
+ QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
+ "If you use the same variable later, even in another snippet, the value entered to the right "
+ "will be the default value for that variable.") );
+
+ i++;
+ }
+ layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 );
+
+ KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" );
+ btn1->setText(i18n("&Cancel"));
+ btn1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
+ btn1->sizePolicy().hasHeightForWidth() ) );
+ layoutBtn->addWidget( btn1, 0, 0 );
+
+ KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" );
+ btn2->setText(i18n("&Apply"));
+ btn2->setDefault( TRUE );
+ btn2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
+ btn2->sizePolicy().hasHeightForWidth() ) );
+ layoutBtn->addWidget( btn2, 0, 1 );
+
+ layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 );
+ // --END-- building a dynamic dialog
+
+ //connect the buttons to the QDialog default slots
+ connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
+ connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );
+
+ //prepare to execute the dialog
+ bool bReturn = false;
+ //resize the textedits
+ if (iWidth > 1) {
+ QRect r = dlg.geometry();
+ r.setHeight(iBasicHeight + iOneHeight*mapVar2Te.count());
+ r.setWidth(iWidth);
+ dlg.setGeometry(r);
+ }
+ if ( i > 0 && // only if there are any variables
+ dlg.exec() == QDialog::Accepted ) {
+
+ QMap<QString, KTextEdit *>::Iterator it2;
+ for ( it2 = mapVar2Te.begin(); it2 != mapVar2Te.end(); ++it2 ) {
+ if (it2.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
+ continue;
+ (*map)[it2.key()] = it2.data()->text(); //copy the entered values back to the given map
+
+ if (mapVar2Cb[it2.key()]->isChecked()) //if the checkbox is on; save the values for later
+ (*mapSave)[it2.key()] = it2.data()->text();
+ else
+ (*mapSave).erase(it2.key());
+ }
+ bReturn = true;
+
+ iBasicHeight = dlg.geometry().height() - layoutVar->geometry().height();
+ iOneHeight = layoutVar->geometry().height() / mapVar2Te.count();
+ iWidth = dlg.geometry().width();
+ }
+
+ //do some cleanup
+ QMap<QString, KTextEdit *>::Iterator it1;
+ for (it1 = mapVar2Te.begin(); it1 != mapVar2Te.end(); ++it1)
+ delete it1.data();
+ mapVar2Te.clear();
+ QMap<QString, QCheckBox *>::Iterator it2;
+ for (it2 = mapVar2Cb.begin(); it2 != mapVar2Cb.end(); ++it2)
+ delete it2.data();
+ mapVar2Cb.clear();
+ delete layoutTop;
+ delete layoutVar;
+ delete layoutBtn;
+ delete layout;
+
+ if (i==0) //if nothing happened this means, that there are no variables to translate
+ return true; //.. so just return OK
+
+ return bReturn;
+}
+
+
+// fn SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> * mapSave)
+/*!
+ This function constructs a dialog which contains a label and a linedit for the given variable
+ It return either the entered value or an empty string if the user hit cancel
+ */
+QString SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> * mapSave, QRect & dlgSize)
+{
+ // --BEGIN-- building a dynamic dialog
+ QDialog dlg(this);
+ dlg.setCaption(i18n("Enter Values for Variables"));
+
+ QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
+ QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
+ QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
+ QGridLayout * layoutBtn = new QGridLayout( 0, 2, 1, 0, 6, "layoutBtn");
+
+ KTextEdit *te = NULL;
+ QLabel * labTop = NULL;
+ QCheckBox * cb = NULL;
+
+ labTop = new QLabel( &dlg, "label" );
+ layoutTop->addWidget(labTop, 0, 0);
+ labTop->setText(i18n("Enter the replacement values for %1:").arg( var ));
+ layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 );
+
+
+ cb = new QCheckBox( &dlg, "cbVar" );
+ cb->setChecked( FALSE );
+ cb->setText(i18n( "Make value &default" ));
+
+ te = new KTextEdit( &dlg, "teVar" );
+ layoutVar->addWidget( te, 0, 1, Qt::AlignTop);
+ layoutVar->addWidget( cb, 1, 1, Qt::AlignTop);
+ if ((*mapSave)[var].length() > 0) {
+ cb->setChecked( TRUE );
+ te->setText((*mapSave)[var]);
+ }
+
+ QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
+ QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
+ "If you use the same variable later, even in another snippet, the value entered to the right "
+ "will be the default value for that variable.") );
+
+ layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 );
+
+ KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" );
+ btn1->setText(i18n("&Cancel"));
+ layoutBtn->addWidget( btn1, 0, 0 );
+
+ KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" );
+ btn2->setText(i18n("&Apply"));
+ btn2->setDefault( TRUE );
+ layoutBtn->addWidget( btn2, 0, 1 );
+
+ layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 );
+ te->setFocus();
+ // --END-- building a dynamic dialog
+
+ //connect the buttons to the QDialog default slots
+ connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
+ connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );
+
+ //execute the dialog
+ QString strReturn = "";
+ if (dlgSize.isValid())
+ dlg.setGeometry(dlgSize);
+ if ( dlg.exec() == QDialog::Accepted ) {
+ if (cb->isChecked()) //if the checkbox is on; save the values for later
+ (*mapSave)[var] = te->text();
+ else
+ (*mapSave).erase(var);
+
+ strReturn = te->text(); //copy the entered values back the the given map
+
+ dlgSize = dlg.geometry();
+ }
+
+ //do some cleanup
+ delete cb;
+ delete te;
+ delete labTop;
+ delete btn1;
+ delete btn2;
+ delete layoutTop;
+ delete layoutVar;
+ delete layoutBtn;
+ delete layout;
+
+ return strReturn;
+}
+
+// fn SnippetWidget::acceptDrag (QDropEvent *event) const
+/*!
+ Reimplementation from KListView.
+ Check here if the data the user is about to drop fits our restrictions.
+ We only accept dropps of plaintext, because from the dropped text
+ we will create a snippet.
+ */
+bool SnippetWidget::acceptDrag (QDropEvent *event) const
+{
+ kdDebug(9035) << "Format: " << event->format() << "" << event->pos() << endl;
+
+ QListViewItem * item = itemAt(event->pos());
+
+ if (item &&
+ QString(event->format()).startsWith("text/plain") &&
+ static_cast<SnippetWidget *>(event->source()) != this) {
+ kdDebug(9035) << "returning TRUE " << endl;
+ return TRUE;
+ } else {
+ kdDebug(9035) << "returning FALSE" << endl;
+ event->acceptAction(FALSE);
+ return FALSE;
+ }
+}
+
+// fn SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *after)
+/*!
+ This slot is connected to the dropped signal.
+ If it is emitted, we need to construct a new snippet entry with
+ the data given
+ */
+void SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *)
+{
+ QListViewItem * item2 = itemAt(e->pos());
+
+ SnippetGroup *group = dynamic_cast<SnippetGroup *>(item2);
+ if (!group)
+ group = dynamic_cast<SnippetGroup *>(item2->parent());
+
+ QCString dropped;
+ QByteArray data = e->encodedData("text/plain");
+ if ( e->provides("text/plain") && data.size()>0 ) {
+ //get the data from the event...
+ QString encData(data.data());
+ kdDebug(9035) << "encData: " << encData << endl;
+
+ //... then fill the dialog with the given data
+ SnippetDlg dlg(this, "SnippetDlg", true);
+ dlg.snippetName->clear();
+ dlg.snippetText->setText(encData);
+
+ /*fill the combobox with the names of all SnippetGroup entries*/
+ for (SnippetItem *it=_list.first(); it; it=_list.next()) {
+ if (dynamic_cast<SnippetGroup*>(it)) {
+ dlg.cbGroup->insertItem(it->getName());
+ }
+ }
+ dlg.cbGroup->setCurrentText(group->getName());
+
+ if (dlg.exec() == QDialog::Accepted) {
+ /* get the group that the user selected with the combobox */
+ group = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list));
+ _list.append( new SnippetItem(group, dlg.snippetName->text(), dlg.snippetText->text()) );
+ }
+ }
+}
+
+
+/*!
+ \fn SnippetWidget::languageChanged()
+ */
+void SnippetWidget::languageChanged()
+{
+ QStringList langs = m_part->getProjectLanguages();
+
+ for (SnippetItem *it=_list.first(); it; it=_list.next()) {
+ SnippetGroup * group = dynamic_cast<SnippetGroup*>(it);
+ if (group) {
+ if (group->getLanguage() == i18n("All") || langs.contains(group->getLanguage())) {
+ group->setOpen(TRUE);
+ } else {
+ group->setOpen(FALSE);
+ }
+ }
+ }
+}
+
+#include "snippet_widget.moc"
diff --git a/parts/snippet/snippet_widget.h b/parts/snippet/snippet_widget.h
new file mode 100644
index 00000000..84df7a6f
--- /dev/null
+++ b/parts/snippet/snippet_widget.h
@@ -0,0 +1,90 @@
+/*
+ * File : snippet_widget.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#ifndef __SNIPPET_WIDGET_H__
+#define __SNIPPET_WIDGET_H__
+
+#include <qwidget.h>
+#include <qstring.h>
+#include <klistview.h>
+#include <qtooltip.h>
+#include <qrect.h>
+
+#include <ktexteditor/editinterface.h>
+#include <ktexteditor/view.h>
+#include "snippetconfig.h"
+
+class KDevProject;
+class SnippetPart;
+class QPushButton;
+class KListView;
+class QListViewItem;
+class QPoint;
+class SnippetDlg;
+class SnippetItem;
+class KTextEdit;
+class KConfig;
+
+
+/**
+This is the widget which gets added to the right TreeToolView.
+It inherits KListView and QToolTip which is needed for showing the
+tooltips which contains the text of the snippet
+@author Robert Gruber
+*/
+class SnippetWidget : public KListView, public QToolTip
+{
+ Q_OBJECT
+
+ friend class SnippetSettings; //to allow SnippetSettings to call languageChanged()
+
+public:
+ SnippetWidget(SnippetPart *part);
+ ~SnippetWidget();
+ QPtrList<SnippetItem> * getList() { return (&_list); }
+ void writeConfig();
+ void initConfigOldVersion(KConfig *cfg);
+ SnippetConfig * getSnippetConfig() { return (&_SnippetConfig); }
+
+
+private slots:
+ void initConfig();
+ void languageChanged();
+
+protected:
+ SnippetPart * m_part;
+ void maybeTip( const QPoint & );
+ bool acceptDrag (QDropEvent *event) const;
+
+private:
+ void insertIntoActiveView(QString text);
+ QString parseText(QString text, QString del="$");
+ bool showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
+ int & iWidth, int & iBasicHeight, int & iOneHeight);
+ QString showSingleVarDialog(QString var, QMap<QString, QString> * mapSave, QRect & dlgSize);
+
+ QPtrList<SnippetItem> _list;
+ QMap<QString, QString> _mapSaved;
+ KConfig * _cfg;
+ SnippetConfig _SnippetConfig;
+
+public slots:
+ void slotRemove();
+ void slotEdit();
+ void slotEditGroup();
+ void slotAdd();
+ void slotAddGroup();
+
+protected slots:
+ void showPopupMenu( QListViewItem * item, const QPoint & p, int );
+ void slotExecuted(QListViewItem * item);
+ void slotDropped(QDropEvent *e, QListViewItem *after);
+};
+
+
+#endif
diff --git a/parts/snippet/snippetconfig.cpp b/parts/snippet/snippetconfig.cpp
new file mode 100644
index 00000000..23186d05
--- /dev/null
+++ b/parts/snippet/snippetconfig.cpp
@@ -0,0 +1,20 @@
+/*
+ * File : snippetconfig.cpp
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#include "snippetconfig.h"
+
+SnippetConfig::SnippetConfig()
+{
+}
+
+
+SnippetConfig::~SnippetConfig()
+{
+}
+
+
diff --git a/parts/snippet/snippetconfig.h b/parts/snippet/snippetconfig.h
new file mode 100644
index 00000000..89fe00e0
--- /dev/null
+++ b/parts/snippet/snippetconfig.h
@@ -0,0 +1,56 @@
+/*
+ * File : snippetconfig.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#ifndef SNIPPETCONFIG_H
+#define SNIPPETCONFIG_H
+
+#include <qstring.h>
+#include <qrect.h>
+
+
+/**
+This class stores the values that can be configured via the
+KDevelop settings dialog
+@author Robert Gruber
+*/
+class SnippetConfig{
+public:
+ SnippetConfig();
+
+ ~SnippetConfig();
+
+ bool useToolTips() { return (bToolTip); };
+ int getInputMethod() { return (iInputMethod); };
+ QString getDelimiter() { return (strDelimiter); };
+ QRect getSingleRect() { return (rSingle); };
+ QRect getMultiRect() { return (rMulti); };
+ int getAutoOpenGroups() { return iAutoOpenGroups; }
+
+ void setToolTips(bool b) { bToolTip=b; };
+ void setInputMethod(int i) { iInputMethod=i; };
+ void setDelimiter(QString s) { strDelimiter=s; };
+ void setSingleRect(QRect r) {
+ rSingle = (r.isValid())?r:QRect();
+ }
+ void setMultiRect(QRect r) {
+ rMulti = (r.isValid())?r:QRect();
+ }
+ void setAutoOpenGroups(int autoopen) { iAutoOpenGroups = autoopen; }
+
+protected:
+ bool bToolTip;
+ int iInputMethod;
+ QString strDelimiter;
+ QRect rSingle;
+ QRect rMulti;
+ int iMultiBasicHeight;
+ int iMultiCount;
+ int iAutoOpenGroups;
+};
+
+#endif
diff --git a/parts/snippet/snippetdlg.ui b/parts/snippet/snippetdlg.ui
new file mode 100644
index 00000000..a7d4530b
--- /dev/null
+++ b/parts/snippet/snippetdlg.ui
@@ -0,0 +1,214 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>SnippetDlg</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>SnippetDlg</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>344</width>
+ <height>289</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add Snippet</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout5</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnAdd</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>btnCancel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>snippetName</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Courier</family>
+ <pointsize>11</pointsize>
+ </font>
+ </property>
+ </widget>
+ <spacer row="4" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>80</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Name:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>snippetName</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Snippet:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignTop</set>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>snippetText</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabelGroup</cstring>
+ </property>
+ <property name="text">
+ <string>Group:</string>
+ </property>
+ </widget>
+ <widget class="QToolButton" row="3" column="0">
+ <property name="name">
+ <cstring>toolBtnHelp</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="iconSet">
+ <iconset>image0</iconset>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Click here to get to know how to use variables in a snippet</string>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="1" column="1">
+ <property name="name">
+ <cstring>cbGroup</cstring>
+ </property>
+ </widget>
+ <widget class="KTextEdit" row="2" column="1" rowspan="3" colspan="1">
+ <property name="name">
+ <cstring>snippetText</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Courier</family>
+ <pointsize>11</pointsize>
+ </font>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="720">789c85d0c94ec3301006e07b9ec24a6e15729bb5b12a1e01c4110971182f6dbaa43b07847877f27bec1424a43a87f8fb331edb994ec4ebcb93984c93cb95ae6b234c476731b11f7dfff9f6fef895a47923f25614b9c8d3872495c288e7c3de61ae877936f3032466d9d60466918de79e59cd98cbc879096e022ba663d6b35683a7c05a55a01d69c02e50310d58a8363735781969c15d60cd5c83a56a15b307ab5c85e243a4f5adb6605d28c55c810d1159ff378ee0bc24e71af00cb6da14ce7f95c3c8088fd67a98878c8c1d6c9d46cad972d541b4767873b6d96a3f68e7c62c33f82ef5b2bfd56972e827f7875b9d0e4b8f273d661cd2d9ef1433e9ab388ae7c311fd9e38f42dcb2e9dfe738fd812d19d4c1271f4bb9fbff3fdb5fff68b914cbf17c90f9b96abef</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>btnAdd</sender>
+ <signal>clicked()</signal>
+ <receiver>SnippetDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>btnCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>SnippetDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>toolBtnHelp</sender>
+ <signal>clicked()</signal>
+ <receiver>SnippetDlg</receiver>
+ <slot>slotHelp()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>snippetName</tabstop>
+ <tabstop>cbGroup</tabstop>
+ <tabstop>snippetText</tabstop>
+ <tabstop>btnAdd</tabstop>
+ <tabstop>btnCancel</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">snippetdlg.ui.h</include>
+</includes>
+<slots>
+ <slot>slotHelp()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>ktextedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/snippet/snippetdlg.ui.h b/parts/snippet/snippetdlg.ui.h
new file mode 100644
index 00000000..41ad9d8c
--- /dev/null
+++ b/parts/snippet/snippetdlg.ui.h
@@ -0,0 +1,21 @@
+/*
+ * File : snippetdlg.ui.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <kmessagebox.h>
+
+void SnippetDlg::slotHelp()
+{
+ KMessageBox::information(this, i18n("To use variables in a snippet, you just have to enclose the variablename with $-characters. When you use the snippet, you will then be asked for a value for this variable. \nExample snippet: This is a $VAR$\nWhen you use this snippet you will be prompted for a value for the variable $VAR$. Any occurrences of $VAR$ will then be replaced with whatever you have entered.\nIf you need a single $-character in a snippet, which is not used to enclose a variable, type $$ (two dollar characters) instead. They will automatically be replaced with a single $-character when you use the snippet.\nIf you want to change the default delimiter to anything different, please use the settings dialog to do so."), i18n("Snippet help"));
+}
diff --git a/parts/snippet/snippetitem.cpp b/parts/snippet/snippetitem.cpp
new file mode 100644
index 00000000..7548ad16
--- /dev/null
+++ b/parts/snippet/snippetitem.cpp
@@ -0,0 +1,127 @@
+/*
+ * File : snippetitem.cpp
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#include <qstring.h>
+
+
+#include "snippetitem.h"
+
+SnippetItem::SnippetItem(QListView * parent, QString name, QString text )
+ : QListViewItem( parent, name )
+{
+ strName = name;
+ strText = text;
+ iParent = -1;
+}
+
+SnippetItem::SnippetItem(QListViewItem * parent, QString name, QString text)
+ : QListViewItem( parent, name )
+{
+ strName = name;
+ strText = text;
+ iParent = ((SnippetGroup *)parent)->getId();
+}
+
+SnippetItem::~SnippetItem()
+{
+}
+
+
+/*!
+ \fn SnippetItem::getName()
+ */
+QString SnippetItem::getName()
+{
+ return strName;
+}
+
+
+/*!
+ \fn SnippetItem::getText
+ */
+QString SnippetItem::getText()
+{
+ return strText;
+}
+
+
+/*!
+ \fn SnippetItem::setText(QString text)
+ */
+void SnippetItem::setText(QString text)
+{
+ strText = text;
+}
+
+
+/*!
+ \fn SnippetItem::setName(QString name)
+ */
+void SnippetItem::setName(QString name)
+{
+ strName = name;
+}
+
+void SnippetItem::resetParent()
+{
+ SnippetGroup * group = dynamic_cast<SnippetGroup*>(parent());
+ if (group)
+ iParent = group->getId();
+}
+
+SnippetItem * SnippetItem::findItemByName(QString name, QPtrList<SnippetItem> &list)
+{
+ for ( SnippetItem * item = list.first(); item; item = list.next() ) { //write the snippet-list
+ if (item->getName() == name)
+ return item;
+ }
+ return NULL;
+}
+
+SnippetGroup * SnippetItem::findGroupById(int id, QPtrList<SnippetItem> &list)
+{
+ for ( SnippetItem * item = list.first(); item; item = list.next() ) { //write the snippet-list
+ SnippetGroup * group = dynamic_cast<SnippetGroup*>(item);
+ if (group && group->getId() == id)
+ return group;
+ }
+ return NULL;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * *
+Deklaration for class SnippetGroup
+* * * * * * * * * * * * * * * * * * * */
+
+int SnippetGroup::iMaxId = 1;
+
+SnippetGroup::SnippetGroup(QListView * parent, QString name, int id, QString lang)
+ : SnippetItem(parent, name, "GROUP")
+{
+ if (id > 0) {
+ iId = id;
+ if (id >= iMaxId)
+ iMaxId = id+1;
+ } else {
+ iId = iMaxId;
+ iMaxId++;
+ }
+
+ strLanguage = lang;
+}
+
+SnippetGroup::~SnippetGroup()
+{
+}
+
+void SnippetGroup::setId(int id)
+{
+ iId = id;
+ if (iId >= iMaxId)
+ iMaxId = iId+1;
+}
diff --git a/parts/snippet/snippetitem.h b/parts/snippet/snippetitem.h
new file mode 100644
index 00000000..ac6fb416
--- /dev/null
+++ b/parts/snippet/snippetitem.h
@@ -0,0 +1,70 @@
+/*
+ * File : snippetitem.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#ifndef SNIPPETITEM_H
+#define SNIPPETITEM_H
+
+#include <klistview.h>
+#include <klocale.h>
+
+class QString;
+
+class SnippetGroup;
+
+/**
+This class represents one CodeSnippet-Item in the listview.
+It also holds the needed data for one snippet.
+@author Robert Gruber
+*/
+class SnippetItem : public QListViewItem {
+friend class SnippetGroup;
+public:
+ SnippetItem(QListViewItem * parent, QString name, QString text);
+
+ ~SnippetItem();
+ QString getName();
+ QString getText();
+ int getParent() { return iParent; }
+ void resetParent();
+ void setText(QString text);
+ void setName(QString name);
+ static SnippetItem * findItemByName(QString name, QPtrList<SnippetItem> &list);
+ static SnippetGroup * findGroupById(int id, QPtrList<SnippetItem> &list);
+
+private:
+ SnippetItem(QListView * parent, QString name, QString text);
+ QString strName;
+ QString strText;
+ int iParent;
+};
+
+/**
+This class represents one group in the listview.
+It is derived from SnippetItem in order to allow storing
+it in the main QPtrList<SnippetItem>.
+@author Robert Gruber
+*/
+class SnippetGroup : public SnippetItem {
+public:
+ SnippetGroup(QListView * parent, QString name, int id, QString lang=i18n("All"));
+ ~SnippetGroup();
+
+ int getId() { return iId; }
+ static int getMaxId() { return iMaxId; }
+ QString getLanguage() { return strLanguage; }
+
+ void setId(int id);
+ void setLanguage(QString lang) { strLanguage = lang; }
+
+private:
+ static int iMaxId;
+ int iId;
+ QString strLanguage;
+};
+
+#endif
diff --git a/parts/snippet/snippetsettings.cpp b/parts/snippet/snippetsettings.cpp
new file mode 100644
index 00000000..f0f9348b
--- /dev/null
+++ b/parts/snippet/snippetsettings.cpp
@@ -0,0 +1,52 @@
+/*
+ * File : snippetsettings.cpp
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#include <qstring.h>
+#include <klineedit.h>
+#include <qcheckbox.h>
+#include <qbuttongroup.h>
+
+#include "snippetsettings.h"
+#include "snippet_widget.h"
+
+
+SnippetSettings::SnippetSettings(QWidget *parent, const char *name)
+ : SnippetSettingsBase(parent, name)
+{
+ _widget = NULL;
+}
+
+SnippetSettings::SnippetSettings(SnippetWidget * w, QWidget *parent, const char *name)
+ : SnippetSettingsBase(parent, name)
+{
+ _cfg = w->getSnippetConfig();
+ _widget = w;
+}
+
+
+SnippetSettings::~SnippetSettings()
+{
+}
+
+
+/*!
+ \fn SnippetSettings::slotOKClicked()
+ */
+void SnippetSettings::slotOKClicked()
+{
+ _cfg->setToolTips(cbToolTip->isChecked());
+ _cfg->setDelimiter(leDelimiter->text());
+ _cfg->setInputMethod(btnGroup->selectedId());
+ _cfg->setAutoOpenGroups(btnGroupAutoOpen->selectedId());
+
+ if (_widget)
+ _widget->languageChanged();
+}
+
+
+#include "snippetsettings.moc"
diff --git a/parts/snippet/snippetsettings.h b/parts/snippet/snippetsettings.h
new file mode 100644
index 00000000..ef4a019a
--- /dev/null
+++ b/parts/snippet/snippetsettings.h
@@ -0,0 +1,41 @@
+/*
+ * File : snippetsettings.h
+ *
+ * Author: Robert Gruber <rgruber@users.sourceforge.net>
+ *
+ * Copyright: See COPYING file that comes with this distribution
+ */
+
+#ifndef SNIPPETSETTINGS_H
+#define SNIPPETSETTINGS_H
+
+#include "snippetsettingsbase.h"
+
+class SnippetWidget;
+class SnippetConfig;
+
+/**
+This class is the widget that is showen in the
+KDevelop settings dialog. It inherits the
+class SnippetSettingsBase which is created by the
+same named .ui file
+@author Robert Gruber
+*/
+class SnippetSettings : public SnippetSettingsBase
+{
+Q_OBJECT
+public:
+ SnippetSettings(QWidget *parent = 0, const char *name = 0);
+ SnippetSettings(SnippetWidget * w, QWidget *parent = 0, const char *name = 0);
+
+ ~SnippetSettings();
+
+public slots:
+ void slotOKClicked();
+
+private:
+ SnippetConfig * _cfg;
+ SnippetWidget * _widget;
+};
+
+#endif
diff --git a/parts/snippet/snippetsettingsbase.ui b/parts/snippet/snippetsettingsbase.ui
new file mode 100644
index 00000000..54b8c325
--- /dev/null
+++ b/parts/snippet/snippetsettingsbase.ui
@@ -0,0 +1,228 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>SnippetSettingsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>SnippetSettingsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>574</width>
+ <height>398</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Snippet Settings</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Tooltips</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>cbToolTip</cstring>
+ </property>
+ <property name="text">
+ <string>Show snippet's text in &amp;tooltip</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Decides if a tooltip should be shown containing text from the bookmarked line</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>70</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Variables</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup" row="1" column="0">
+ <property name="name">
+ <cstring>btnGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Input Method for Variables</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>rbSingle</cstring>
+ </property>
+ <property name="text">
+ <string>Single dialog for each variable within a snippet</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>An input dialog will be displayed for every variable within a snippet</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>rbAll</cstring>
+ </property>
+ <property name="text">
+ <string>One dialog for all variables within a snippet</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>A single dialog will be displayed where you can enter the values for all variables within a snippet</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="0">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Delimiter:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kLineEdit1</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit">
+ <property name="name">
+ <cstring>leDelimiter</cstring>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>40</width>
+ <height>32767</height>
+ </size>
+ </property>
+ <property name="maxLength">
+ <number>1</number>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup" row="2" column="0">
+ <property name="name">
+ <cstring>btnGroupAutoOpen</cstring>
+ </property>
+ <property name="title">
+ <string>Automatically Open Groups</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton" row="0" column="0">
+ <property name="name">
+ <cstring>rbOpenOnActiv</cstring>
+ </property>
+ <property name="text">
+ <string>The group's language is the project's primary language</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>&lt;qt&gt;If the group's language is the same as the project's primary language, the group will be automatically opened.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton" row="1" column="0">
+ <property name="name">
+ <cstring>rbOpenOnSupported</cstring>
+ </property>
+ <property name="text">
+ <string>The group's language is supported by the project</string>
+ </property>
+ <property name="accel">
+ <string></string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>&lt;qt&gt;Groups having a language which is supported by the current project will be opened automatically. &lt;br&gt;Even if the group's language is not the same as the project's primary language.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/texttools/Makefile.am b/parts/texttools/Makefile.am
new file mode 100644
index 00000000..8ebbc6b5
--- /dev/null
+++ b/parts/texttools/Makefile.am
@@ -0,0 +1,18 @@
+# Here resides the text tools part.
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/sourceinfo -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevtexttools.la
+libkdevtexttools_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevtexttools_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevtexttools_la_SOURCES = texttoolspart.cpp texttoolswidget.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevtexttools.desktop
+
+# not used currently
+#rcdir = $(kde_datadir)/kdevtexttools
+#rc_DATA = kdevtexttools.rc
diff --git a/parts/texttools/README.dox b/parts/texttools/README.dox
new file mode 100644
index 00000000..3fd5180b
--- /dev/null
+++ b/parts/texttools/README.dox
@@ -0,0 +1,49 @@
+/** \class TextToolsPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/texttools/kdevtexttools.desktop b/parts/texttools/kdevtexttools.desktop
new file mode 100644
index 00000000..4af1638a
--- /dev/null
+++ b/parts/texttools/kdevtexttools.desktop
@@ -0,0 +1,84 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides a structure overview and navigation for HTML and TEX files
+Comment[ca]=Proporciona una vista de conjunt i navegació per a fitxers HTML i TEX
+Comment[da]=Giver et strukturoverblik og navigering for HTML- og TeX-filer
+Comment[de]=Stellt eine Strukturansicht für HTML- und TeX-Dateien zur Verfügung
+Comment[el]=Προσφέρει μια περίληψη δομής και πλοήγηση για αρχεία HTML και TEX
+Comment[es]=Proporciona una vista general y navegación para archivos HTML y TEX
+Comment[et]=Näitab HTML- ja TEX-failide struktuuri ning võimaldab neis liikuda
+Comment[eu]=HTML eta TEX fitxategien egituren laburpen eta nabigazioa eskeintzen du.
+Comment[fa]=خلاصۀ ساختار و ناوش را برای پرونده‌های زنگام و متن فراهم می‌کند
+Comment[fr]=Fournit une vue d'ensemble et une navigation pour les fichiers HTML et TEX
+Comment[gl]=Proporciona unha vista xeral e navegación da estructura de ficheiros HTML e TEX
+Comment[hu]=Lehetővé teszi a struktúra áttekintését, navigálását HTML és TEX fájloknál
+Comment[it]=Offre un'anteprima di struttura e navigazione per file HTML e TEX
+Comment[ja]=HTML や TeX ファイルの構造の概要やナビゲーションを提供します。
+Comment[ms]=Menyediakan struktur menyeluruh dan navigasi untuk HTML dan fail TEX
+Comment[nds]=Stellt en Struktuuröversicht un dat Stüern för HTML- un TeX-Dateien praat.
+Comment[ne]=HTML र TEX फाइलका लागि नेभिगेसन र बनावट समिक्षा प्रदान गर्दछ
+Comment[nl]=Biedt een overzicht van de structuur van HTML- en TeX-bestanden
+Comment[pl]=Widok struktury tekstu i nawigacja dla plików HTML i TEX
+Comment[pt]=Oferece uma vista geral estruturada e a navegação sobre os ficheiros de HTML e TEX
+Comment[pt_BR]=Fornece uma visão de estrutura e navegação para arquivos HTML e TEX
+Comment[ru]=Показывает структуру документов в формате HTML и TEX, а также предоставляет возможности навигации по ним.
+Comment[sk]=Poskytuje štruktúrovaný náhľad a navigáciu pre HTML a TEX súbory
+Comment[sr]=Обезбеђује преглед структуре и навигацију за HTML и TEX фајлове
+Comment[sr@Latn]=Obezbeđuje pregled strukture i navigaciju za HTML i TEX fajlove
+Comment[sv]=Tillhandahåller en strukturöversikt och navigering för HTML- och Tex-filer
+Comment[ta]=HTML மற்றும் TEX கோப்புகளின் அமைப்பை மேற்பார்வையிட மற்றும் வழி செலுத்த இது உதவும்.
+Comment[tg]=Ҳуҷҷатҳои структуриро дар формати HTML ва TEX тасвир менамояд ва боз ҳам имкони навигатсия намуданро иҷозат медиҳад
+Comment[tr]=HTML ve TEX dosyaları için yapı gözden geçirimi ve dolaşımı sağlar.
+Comment[zh_CN]=提供HTML和TEX文件的结构预览
+Comment[zh_TW]=提供 HTML 與 TEX 檔的結構化的概觀與導覽
+Name=KDevTextTools
+Name[da]=KDevelop tekstværktøjer
+Name[de]=Textstrukturansicht (KDevelop)
+Name[hi]=के-डेव-टेक्स्ट-टूल्स
+Name[nds]=KDevelop-TextWarktüüch
+Name[pl]=KDevNarzędziaTekstowe
+Name[sk]=KDev textové nástroje
+Name[sv]=KDevelop textverktyg
+Name[ta]=KDev உரைக்கருவி
+Name[tg]=Асбобҳои матни KDev
+Name[zh_TW]=KDevelop 文字工具
+GenericName=Text Structure
+GenericName[br]=Skeledenn ar skrid
+GenericName[ca]=Estructura del text
+GenericName[da]=Tekststruktur
+GenericName[de]=Textstruktur-Ansicht
+GenericName[el]=Δομή κειμένου
+GenericName[es]=Estructura de texto
+GenericName[et]=Tekstistruktuur
+GenericName[eu]=Testuaren egitura
+GenericName[fa]=ساختار متن
+GenericName[fr]=Structure du texte
+GenericName[gl]=Estructura do texto
+GenericName[hi]=टेक्स्ट स्ट्रक्चर
+GenericName[hu]=Szövegstruktúra
+GenericName[it]=Struttura testo
+GenericName[ja]=テキスト構造
+GenericName[ms]=Struktur Teks
+GenericName[nds]=Textstruktuur
+GenericName[ne]=पाठ बनावट
+GenericName[nl]=Tekststructuur
+GenericName[pl]=Struktura tekstu
+GenericName[pt]=Estrutura de Texto
+GenericName[pt_BR]=Estrutura de Texto
+GenericName[ru]=Показ структуры текста
+GenericName[sk]=Textové štruktúry
+GenericName[sl]=Besedilna struktura
+GenericName[sr]=Структура текста
+GenericName[sr@Latn]=Struktura teksta
+GenericName[sv]=Textstruktur
+GenericName[ta]=உரை வடிவம்
+GenericName[tg]=Тасвири матни структурӣ
+GenericName[tr]=Metin Yapısı
+GenericName[zh_CN]=文件结构
+GenericName[zh_TW]=文字結構
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevtexttools
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=CodeNavigation
diff --git a/parts/texttools/texttoolspart.cpp b/parts/texttools/texttoolspart.cpp
new file mode 100644
index 00000000..7eb439da
--- /dev/null
+++ b/parts/texttools/texttoolspart.cpp
@@ -0,0 +1,99 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "texttoolspart.h"
+
+#include <qwhatsthis.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <ktexteditor/editinterface.h>
+
+#include "kdevpartcontroller.h"
+#include "kdevmainwindow.h"
+
+#include "texttoolswidget.h"
+
+
+typedef KDevGenericFactory<TextToolsPart> TextToolsFactory;
+static const KDevPluginInfo data("kdevtexttools");
+K_EXPORT_COMPONENT_FACTORY( libkdevtexttools, TextToolsFactory( data ) )
+
+TextToolsPart::TextToolsPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "TextToolsPart")
+{
+ setInstance(TextToolsFactory::instance());
+ // setXMLFile("kdevfileview.rc");
+
+ m_widget = 0;
+
+ connect( partController(), SIGNAL(activePartChanged(KParts::Part*)),
+ this, SLOT(activePartChanged(KParts::Part*)) );
+}
+
+
+TextToolsPart::~TextToolsPart()
+{
+ if (m_widget)
+ mainWindow()->removeView(m_widget);
+ delete m_widget;
+}
+
+
+void TextToolsPart::createWidget()
+{
+ if (m_widget)
+ {
+// mainWindow()->embedSelectView(m_widget, i18n("Text Structure"), i18n("Text structure"));
+ return;
+ }
+
+ m_widget = new TextToolsWidget(this);
+ m_widget->setCaption(i18n("Text Structure"));
+ QWhatsThis::add(m_widget, i18n("<b>Text Structure</b><p>"
+ "This browser shows the structure of the text."));
+ mainWindow()->embedSelectView(m_widget, i18n("Text Structure"), i18n("Text structure"));
+}
+
+
+void TextToolsPart::activePartChanged(KParts::Part *part)
+{
+ if (m_widget)
+ m_widget->stop();
+
+ if (!part)
+ return;
+ KParts::ReadWritePart *rwpart = dynamic_cast<KParts::ReadWritePart*>(part);
+ if (!rwpart)
+ return;
+ QString url = rwpart->url().url();
+
+ if (url.endsWith(".html")) {
+ kdDebug(9030) << "set mode html" << endl;
+ createWidget();
+ m_widget->setMode(TextToolsWidget::HTML, rwpart);
+ } else if (url.endsWith(".docbook")) {
+ kdDebug(9030) << "set mode Docbook" << endl;
+ createWidget();
+ m_widget->setMode(TextToolsWidget::Docbook, rwpart);
+ } else if (url.endsWith(".tex")) {
+ kdDebug(9030) << "set mode LaTeX" << endl;
+ createWidget();
+ m_widget->setMode(TextToolsWidget::LaTeX, rwpart);
+ } else if (m_widget) {
+// kdDebug(9030) << "hide output view" << endl;
+// mainWindow()->removeView(m_widget);
+ m_widget->clear();
+ }
+}
+
+#include "texttoolspart.moc"
diff --git a/parts/texttools/texttoolspart.h b/parts/texttools/texttoolspart.h
new file mode 100644
index 00000000..7e7bf9c5
--- /dev/null
+++ b/parts/texttools/texttoolspart.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _TEXTTOOLSPART_H_
+#define _TEXTTOOLSPART_H_
+
+#include <qguardedptr.h>
+#include <kparts/part.h>
+#include "kdevplugin.h"
+
+class TextToolsWidget;
+
+
+class TextToolsPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ TextToolsPart( QObject *parent, const char *name, const QStringList & );
+ ~TextToolsPart();
+
+private slots:
+ void activePartChanged(KParts::Part *part);
+
+private:
+ void createWidget();
+
+ QGuardedPtr<TextToolsWidget> m_widget;
+};
+
+#endif
diff --git a/parts/texttools/texttoolswidget.cpp b/parts/texttools/texttoolswidget.cpp
new file mode 100644
index 00000000..ff85d0f0
--- /dev/null
+++ b/parts/texttools/texttoolswidget.cpp
@@ -0,0 +1,400 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "texttoolswidget.h"
+
+#include <qheader.h>
+#include <qregexp.h>
+#include <qtimer.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kpopupmenu.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/selectioninterface.h>
+#include <ktexteditor/editinterface.h>
+
+#include "kdevmainwindow.h"
+#include "kdevpartcontroller.h"
+#include "texttoolspart.h"
+
+
+class TextStructItem : public QListViewItem
+{
+public:
+ TextStructItem(QListView *parent)
+ : QListViewItem(parent)
+ {}
+ TextStructItem(QListViewItem *parent)
+ : QListViewItem(parent)
+ {
+ QListViewItem *item = this;
+ while (item->nextSibling())
+ item = item->nextSibling();
+ if (item != this)
+ moveItem(item);
+ }
+
+ QString text(int) const
+ {
+ return extra.isNull()? tag : QString("%1: %2").arg(tag).arg(extra);
+ }
+ TextStructItem *parentStructItem()
+ { return static_cast<TextStructItem*>(parent()); }
+
+ QString tag;
+ QString extra;
+ int pos;
+ int endpos;
+};
+
+
+TextToolsWidget::TextToolsWidget(TextToolsPart *part, QWidget *parent, const char *name)
+ : KListView(parent, name)
+{
+ setResizeMode(QListView::LastColumn);
+ setSorting(-1);
+ header()->hide();
+ addColumn(QString::null);
+
+ m_part = part;
+
+ m_timer = new QTimer(this);
+ connect( this, SIGNAL(mouseButtonPressed(int, QListViewItem*, const QPoint&, int)),
+ this, SLOT(slotItemPressed(int,QListViewItem*)) );
+ // connect( this, SIGNAL(doubleClicked(QListViewItem*)),
+ // this, SLOT(slotItemPressed(int,QListViewItem*)) );
+ connect( this, SIGNAL(returnPressed(QListViewItem*)),
+ this, SLOT(slotReturnPressed(QListViewItem*)) );
+ connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
+ this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
+}
+
+
+TextToolsWidget::~TextToolsWidget()
+{}
+
+
+void TextToolsWidget::slotItemPressed(int button, QListViewItem *item)
+{
+ if (!item)
+ return;
+
+ TextStructItem *tsitem = static_cast<TextStructItem*>(item);
+ int searchedPos = tsitem->pos;
+ int searchedEndpos = tsitem->endpos;
+ kdDebug(9030) << "Searched pos " << searchedPos << ", " << searchedEndpos << endl;
+
+ int endline = 0;
+ int endcol = 0;
+ int line = 0;
+ int col = 0;
+
+ int len = m_cachedText.length();
+ int pos = 0;
+ while (pos < len) {
+ if (pos == searchedPos) {
+ line = endline;
+ col = endcol;
+ }
+ if (pos == searchedEndpos)
+ break;
+ QChar ch = m_cachedText[pos];
+ if (ch == '\n') {
+ ++endline;
+ endcol = 0;
+ } else {
+ ++endcol;
+ }
+ ++pos;
+ }
+
+ KParts::Part *rwpart
+ = dynamic_cast<KParts::Part*>(m_part->partController()->activePart());
+ QWidget *view = m_part->partController()->activeWidget();
+
+ KTextEditor::ViewCursorInterface *cursorIface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(view);
+ if (cursorIface) {
+ kdDebug(9030) << "set cursor " << line << ", " << col << endl;
+ cursorIface->setCursorPosition(line, col);
+ }
+
+ if (button == MidButton) {
+ KTextEditor::SelectionInterface *selectionIface
+ = dynamic_cast<KTextEditor::SelectionInterface*>(rwpart);
+ if (selectionIface) {
+ kdDebug(9030) << "set selection " << line << ", " << col
+ << ", " << endline << ", " << endcol << endl;
+ selectionIface->setSelection((int)line, (int)col, (int)endline, (int)endcol+1);
+ }
+ }
+
+ m_part->mainWindow()->lowerView(this);
+}
+
+
+void TextToolsWidget::slotReturnPressed(QListViewItem *item)
+{
+ slotItemPressed(LeftButton, item);
+}
+
+
+void TextToolsWidget::slotContextMenu(KListView *, QListViewItem *item, const QPoint &)
+{
+ if (!item)
+ return;
+
+#if 0
+ KPopupMenu popup(i18n("Text Structure"), this);
+ popup.exec(p);
+#endif
+}
+
+
+void TextToolsWidget::stop()
+{
+ disconnect( m_timer );
+ m_relevantTags.clear();
+ m_emptyTags.clear();
+ m_cachedText = QString::null;
+}
+
+
+void TextToolsWidget::setMode(Mode mode, KParts::Part *part)
+{
+ connect( part, SIGNAL(textChanged()),
+ this, SLOT(startTimer()) );
+ m_editIface = dynamic_cast<KTextEditor::EditInterface*>(part);
+
+ switch (mode) {
+ case HTML:
+ m_relevantTags << "h1" << "h2" << "h3" << "h4"
+ << "table" << "tr";
+ m_emptyTags << "br" << "hr" << "img" << "input" << "p" << "meta";
+
+ connect( m_timer, SIGNAL(timeout()),
+ this, SLOT(parseXML()) );
+ break;
+ case Docbook:
+ m_relevantTags << "chapter" << "sect1" << "sect2"
+ << "para" << "formalpara";
+ connect( m_timer, SIGNAL(timeout()),
+ this, SLOT(parseXML()) );
+ break;
+ case LaTeX:
+ connect( m_timer, SIGNAL(timeout()),
+ this, SLOT(parseLaTeX()) );
+ break;
+ default: ;
+ }
+
+ m_timer->start(0, true);
+}
+
+
+void TextToolsWidget::startTimer()
+{
+ kdDebug(9030) << "Starting parse timer" << endl;
+ m_timer->start(1000, true);
+}
+
+
+void TextToolsWidget::parseXML()
+{
+ kdDebug(9030) << "Starting to parse XML" << endl;
+ clear();
+ QString text = m_editIface->text();
+ m_cachedText = text;
+
+ TextStructItem *currentItem = new TextStructItem(this);
+ currentItem->tag = "Root";
+ currentItem->pos = -1;
+ currentItem->endpos = -1;
+
+ int len = text.length();
+ for (int pos=0; pos+1 < len; ++pos) {
+ QChar ch1 = text[pos];
+ QChar ch2 = text[pos+1];
+
+ if (ch1 == '<' && ch2 == '?') {
+
+ // PHP and other similar stuff
+ QString tag;
+ int endpos = pos+2;
+ bool foundspace = false;
+ while (endpos+1 < len) {
+ QChar ch3 = text[endpos];
+ QChar ch4 = text[endpos+1];
+ if ((ch3 == ' ' || ch3 == '\t' || ch3 == '\n') && !foundspace) {
+ tag = text.mid(pos+2, endpos-pos-2).lower();
+ foundspace = true;
+ } else if (ch3 == '?' && ch4 == '>') {
+ if (!foundspace)
+ tag = text.mid(pos+2, endpos-pos-2).lower();
+ break;
+ }
+ ++endpos;
+ }
+
+ TextStructItem *item = new TextStructItem(currentItem);
+ item->tag = "<?" + tag + "?>";
+ item->pos = pos;
+ item->endpos = endpos+1;
+
+ pos = endpos+1;
+
+ } else if (ch1 == '<' && ch2 == '!') {
+
+ // Processing instructions like !DOCTYPE
+ QString tag;
+ int endpos = pos+2;
+ bool foundspace = false;
+ while (endpos+1 < len) {
+ QChar ch3 = text[endpos];
+ if ((ch3 == ' ' || ch3 == '\t' || ch3 == '\n') && !foundspace) {
+ tag = text.mid(pos+2, endpos-pos-2).lower();
+ foundspace = true;
+ } else if (ch3 == '>') {
+ if (!foundspace)
+ tag = text.mid(pos+2, endpos-pos-2).lower();
+ break;
+ }
+ ++endpos;
+ }
+
+ TextStructItem *item = new TextStructItem(currentItem);
+ item->tag = "<!" + tag + ">";
+ item->pos = pos;
+ item->endpos = endpos+1;
+
+ pos = endpos+1;
+
+ } else if (ch1 == '<' && ch2 == '/') {
+
+ QString tag;
+ int endpos = pos+2;
+ while (endpos < len) {
+ QChar ch3 = text[endpos];
+ if (ch3 == '>') {
+ tag = text.mid(pos+2, endpos-pos-2).lower();
+ break;
+ }
+ ++endpos;
+ }
+
+ if (!m_relevantTags.contains(tag)) {
+ pos = endpos;
+ continue;
+ }
+
+ TextStructItem *closingItem = currentItem;
+ while (closingItem->parent() && closingItem->tag != tag)
+ closingItem = closingItem->parentStructItem();
+ if (closingItem->parent()) {
+ closingItem->endpos = endpos;
+ currentItem = closingItem->parentStructItem();
+ } else {
+ kdDebug(9030) << "found no opening tag " << tag << "." << endl;
+ }
+
+ pos = endpos;
+
+ } else if (ch1 == '<') {
+
+ QString tag;
+ int endpos = pos+1;
+ bool foundspace = false;
+ while (endpos < len) {
+ QChar ch3 = text[endpos];
+ if ((ch3 == ' ' || ch3 == '\t' || ch3 == '\n') && !foundspace) {
+ tag = text.mid(pos+1, endpos-pos-1).lower();
+ foundspace = true;
+ } else if (ch3 == '>') {
+ if (!foundspace) {
+ tag = text.mid(pos+1, endpos-pos-1).lower();
+ }
+ break;
+ }
+ ++endpos;
+ }
+
+ if (!m_relevantTags.contains(tag)) {
+ pos = endpos;
+ continue;
+ }
+
+ TextStructItem *item = new TextStructItem(currentItem);
+ item->tag = tag;
+ item->pos = pos;
+ item->endpos = -1;
+
+ if (m_emptyTags.contains(tag))
+ item->endpos = endpos;
+ else
+ currentItem = item;
+ pos = endpos;
+
+ }
+ }
+
+ // firstChild()->setOpen(true);
+ QListViewItemIterator it(this);
+ for (; it.current(); ++it)
+ it.current()->setOpen(true);
+}
+
+
+void TextToolsWidget::parseLaTeX()
+{
+ kdDebug(9030) << "Starting to parse LaTeX" << endl;
+ clear();
+ QString text = m_editIface->text();
+ m_cachedText = text;
+
+ TextStructItem *currentItem = new TextStructItem(this);
+ currentItem->tag = "Root";
+ currentItem->pos = -1;
+ currentItem->endpos = -1;
+
+ QString hierarchyLevels = "Root,chapter,section,subsection,subsubsection";
+ QRegExp re("\n[ \t]*s*\\\\(chapter|section|subsection|subsubsection)\\{([^}]*)\\}");
+
+ int pos=0;
+ for (;;) {
+ pos = re.search(text, pos);
+ if (pos == -1)
+ break;
+ QString tag = re.cap(1);
+ QString title = re.cap(2);
+ kdDebug(9030) << "Match with " << tag << " and title " << title << endl;
+ int level = hierarchyLevels.find(tag);
+ while (currentItem->parent() && level <= hierarchyLevels.find(currentItem->tag))
+ currentItem = currentItem->parentStructItem();
+
+ TextStructItem *item = new TextStructItem(currentItem);
+ item->tag = tag;
+ item->extra = title;
+ item->pos = pos+1;
+ item->endpos = pos+re.matchedLength()-1; // lie
+
+ if (level > hierarchyLevels.find(currentItem->tag))
+ currentItem = item;
+
+ pos = pos+re.matchedLength();
+ }
+
+ QListViewItemIterator it(this);
+ for (; it.current(); ++it)
+ it.current()->setOpen(true);
+}
+
+#include "texttoolswidget.moc"
diff --git a/parts/texttools/texttoolswidget.h b/parts/texttools/texttoolswidget.h
new file mode 100644
index 00000000..680adb34
--- /dev/null
+++ b/parts/texttools/texttoolswidget.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _TEXTTOOLSWIDGET_H_
+#define _TEXTTOOLSWIDGET_H_
+
+#include <klistview.h>
+#include <qstringlist.h>
+
+class TextToolsPart;
+class QTimer;
+namespace KParts { class Part; }
+namespace KTextEditor { class EditInterface; }
+
+
+class TextToolsWidget : public KListView
+{
+ Q_OBJECT
+
+public:
+ enum Mode { HTML, Docbook, LaTeX };
+
+ TextToolsWidget( TextToolsPart *part, QWidget *parent=0, const char *name=0 );
+ ~TextToolsWidget();
+
+ void setMode(Mode mode, KParts::Part *part);
+ void stop();
+
+private slots:
+ void slotItemPressed(int button, QListViewItem *item);
+ void slotReturnPressed(QListViewItem *item);
+ void slotContextMenu(KListView *, QListViewItem *item, const QPoint &p);
+
+ void startTimer();
+ void parseXML();
+ void parseLaTeX();
+
+private:
+ TextToolsPart *m_part;
+ QTimer *m_timer;
+ QString m_cachedText;
+ KTextEditor::EditInterface *m_editIface;
+ QStringList m_relevantTags, m_emptyTags;
+};
+
+#endif
diff --git a/parts/tipofday/Makefile.am b/parts/tipofday/Makefile.am
new file mode 100644
index 00000000..14e3a349
--- /dev/null
+++ b/parts/tipofday/Makefile.am
@@ -0,0 +1,24 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevtipofday.la
+libkdevtipofday_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevtipofday_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevtipofday_la_SOURCES = tipofday_part.cpp
+
+METASOURCES = AUTO
+KDE_ICON = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevtipofday.desktop
+
+tip_DATA = tips
+tipdir = $(kde_datadir)/kdevtipofday
+
+rc_DATA = kdevpart_tipofday.rc
+rcdir = $(kde_datadir)/kdevtipofday
+
+messages: rc.cpp
+ $(PREPARETIPS) > tips.cc
+ $(XGETTEXT) *.cpp *.h tips.cc -o $(podir)/kdevtipofday.pot
+ rm -f tips.cc
diff --git a/parts/tipofday/README.dox b/parts/tipofday/README.dox
new file mode 100644
index 00000000..f953e258
--- /dev/null
+++ b/parts/tipofday/README.dox
@@ -0,0 +1,8 @@
+/** \class TipOfDayPart
+Shows a random "tip of the day" at KDevelop startup.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\feature Shows a random "tip of the day" at KDevelop startup
+
+*/
diff --git a/parts/tipofday/hi16-action-ktip.png b/parts/tipofday/hi16-action-ktip.png
new file mode 100644
index 00000000..1358de47
--- /dev/null
+++ b/parts/tipofday/hi16-action-ktip.png
Binary files differ
diff --git a/parts/tipofday/hi32-action-ktip.png b/parts/tipofday/hi32-action-ktip.png
new file mode 100644
index 00000000..4b38d5d6
--- /dev/null
+++ b/parts/tipofday/hi32-action-ktip.png
Binary files differ
diff --git a/parts/tipofday/hi48-action-ktip.png b/parts/tipofday/hi48-action-ktip.png
new file mode 100644
index 00000000..534eda5c
--- /dev/null
+++ b/parts/tipofday/hi48-action-ktip.png
Binary files differ
diff --git a/parts/tipofday/kdevpart_tipofday.rc b/parts/tipofday/kdevpart_tipofday.rc
new file mode 100644
index 00000000..43f7d1dc
--- /dev/null
+++ b/parts/tipofday/kdevpart_tipofday.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="tipofday" library="libtipofdayplugin" version="1">
+<MenuBar>
+ <Menu name="help"><Text>&amp;Help</Text>
+ <Action name="help_tipofday"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/tipofday/kdevtipofday.desktop b/parts/tipofday/kdevtipofday.desktop
new file mode 100644
index 00000000..4c4f9ba2
--- /dev/null
+++ b/parts/tipofday/kdevtipofday.desktop
@@ -0,0 +1,94 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Tip of the Day
+Comment[br]=Lagadenn an deiz
+Comment[ca]=Consell del dia
+Comment[cy]=Awgrymiad y Dydd
+Comment[da]=Dagens vink
+Comment[de]=Tipp des Tages
+Comment[el]=Συμβουλή της ημέρας
+Comment[es]=Consejo del día
+Comment[et]=Päeva nõuanne
+Comment[eu]=Eguneko aholkua
+Comment[fa]=نکتۀ روز
+Comment[fr]=Astuce du jour
+Comment[ga]=Leid an Lae
+Comment[gl]=Consello do día
+Comment[hi]=टिप ऑफ द डे
+Comment[hu]=A nap tippje
+Comment[it]=Suggerimento del giorno
+Comment[ja]=今日の一言
+Comment[ms]=Tip Hari Ini
+Comment[nds]=Tipp för Vundaag
+Comment[ne]=आजको टिप
+Comment[nl]=Tip van de dag
+Comment[pa]=ਅੱਜ ਦਾ ਇਸ਼ਾਰਾ
+Comment[pl]=Podpowiedź dnia
+Comment[pt]=Dica do Dia
+Comment[pt_BR]=Dica do Dia
+Comment[ru]=Полезный совет
+Comment[sk]=Tip dňa
+Comment[sl]=Namig dneva
+Comment[sr]=Савет дана
+Comment[sr@Latn]=Savet dana
+Comment[sv]=Dagens tips
+Comment[ta]=இந்த நாளுக்கான யோசனை
+Comment[tg]=Маслиҳати фоиданок
+Comment[tr]=Günün İpucu
+Comment[zh_CN]=日积月累
+Comment[zh_TW]=本日小提示
+Name=KDevTipOfDay
+Name[da]=KDevelop Dagens vink
+Name[de]="Tipp des Tages"-Modul (KDevelop)
+Name[hi]=के-डेव-टिप-ऑफ-डे
+Name[nds]=KDevelop-"Tipp för Vundaag"
+Name[pl]=KDevPodpowiedźDnia
+Name[sk]=KDev tip dňa
+Name[sv]=KDevelop dagens tips
+Name[ta]=KDevஇந்த நாளுக்கான யோசனை
+Name[tg]=KDevЛуқмаи рӯз
+Name[zh_TW]=KDevelop 本日小提示
+GenericName=Tip of the Day
+GenericName[br]=Lagadenn an deiz
+GenericName[ca]=Consell del dia
+GenericName[cy]=Awgrymiad y Dydd
+GenericName[da]=Dagens vink
+GenericName[de]=Tipp des Tages
+GenericName[el]=Συμβουλή της ημέρας
+GenericName[es]=Consejo del día
+GenericName[et]=Päeva nõuanne
+GenericName[eu]=Eguneko aholkua
+GenericName[fa]=نکتۀ روز
+GenericName[fr]=Astuce du jour
+GenericName[ga]=Leid an Lae
+GenericName[gl]=Consello do día
+GenericName[hi]=टिप ऑफ द डे
+GenericName[hu]=A nap tippje
+GenericName[it]=Suggerimento del giorno
+GenericName[ja]=今日の一言
+GenericName[ms]=Tip Hari Ini
+GenericName[nds]=Tipp för Vundaag
+GenericName[ne]=आजको टिप
+GenericName[nl]=Tip van de dag
+GenericName[pa]=ਅੱਜ ਦਾ ਇਸ਼ਾਰਾ
+GenericName[pl]=Podpowiedź dnia
+GenericName[pt]=Dica do Dia
+GenericName[pt_BR]=Dica do Dia
+GenericName[ru]=Полезный совет
+GenericName[sk]=Tip dňa
+GenericName[sl]=Namig dneva
+GenericName[sr]=Савет дана
+GenericName[sr@Latn]=Savet dana
+GenericName[sv]=Dagens tips
+GenericName[ta]=இந்த நாளுக்கான யோசனை
+GenericName[tg]=Маслиҳати фоиданок
+GenericName[tr]=Günün İpucu
+GenericName[zh_CN]=日积月累
+GenericName[zh_TW]=本日小提示
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevtipofday
+X-KDevelop-Version=5
+X-KDevelop-Scope=Core
+X-KDevelop-Properties=Documentation
diff --git a/parts/tipofday/lo16-action-kdevelop_tip.png b/parts/tipofday/lo16-action-kdevelop_tip.png
new file mode 100644
index 00000000..66c5766c
--- /dev/null
+++ b/parts/tipofday/lo16-action-kdevelop_tip.png
Binary files differ
diff --git a/parts/tipofday/lo32-action-kdevelop_tip.png b/parts/tipofday/lo32-action-kdevelop_tip.png
new file mode 100644
index 00000000..ea4a755a
--- /dev/null
+++ b/parts/tipofday/lo32-action-kdevelop_tip.png
Binary files differ
diff --git a/parts/tipofday/tipofday_part.cpp b/parts/tipofday/tipofday_part.cpp
new file mode 100644
index 00000000..fefdcd39
--- /dev/null
+++ b/parts/tipofday/tipofday_part.cpp
@@ -0,0 +1,67 @@
+#include "tipofday_part.h"
+
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+#include <qwhatsthis.h>
+
+#include <kaboutdata.h>
+#include <kaction.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <ktextbrowser.h>
+#include <ktip.h>
+
+#include "kdevapi.h"
+#include "kdevcore.h"
+
+static const KDevPluginInfo data("kdevtipofday");
+
+typedef KDevGenericFactory<TipOfDayPart> TipOfDayFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevtipofday, TipOfDayFactory( data ) )
+
+TipOfDayPart::TipOfDayPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "TipOfDayPart")
+{
+ setInstance(TipOfDayFactory::instance());
+
+ setXMLFile("kdevpart_tipofday.rc");
+
+ KAction *action;
+
+ action = new KAction(i18n("&Tip of the Day"), "idea", 0,
+ this, SLOT(showTip()), actionCollection(), "help_tipofday");
+ action->setToolTip(i18n("A tip how to use KDevelop"));
+ action->setWhatsThis(i18n("<b>Tip of the day</b><p>"
+ "Will display another good tip \n"
+ "contributed by KDevelop users."));
+
+ connect(core(), SIGNAL(coreInitialized()), this, SLOT(showOnStart()));
+}
+
+
+QString TipOfDayPart::getFilename()
+{
+ KConfig * config = KApplication::kApplication()->config();
+ config->setGroup("Tip of day plugin");
+ return config->readEntry("TipsFile", "kdevtipofday/tips");
+}
+
+void TipOfDayPart::showTip()
+{
+ KTipDialog::showTip(getFilename(), true);
+}
+
+
+void TipOfDayPart::showOnStart()
+{
+ KTipDialog::showTip(getFilename());
+}
+
+
+
+#include "tipofday_part.moc"
diff --git a/parts/tipofday/tipofday_part.h b/parts/tipofday/tipofday_part.h
new file mode 100644
index 00000000..50eedadd
--- /dev/null
+++ b/parts/tipofday/tipofday_part.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2001 Matthias H�zer-Klpfel <mhk@caldera.de>
+ */
+
+
+#ifndef __KDEVPART_TIPOFDAY_H__
+#define __KDEVPART_TIPOFDAY_H__
+
+
+#include <kdevplugin.h>
+
+
+class TipOfDayPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ TipOfDayPart(QObject *parent, const char *name, const QStringList &);
+
+
+public slots:
+
+ void showTip();
+ void showOnStart();
+
+private:
+ QString getFilename();
+
+};
+
+
+#endif
diff --git a/parts/tipofday/tips b/parts/tipofday/tips
new file mode 100644
index 00000000..ae79ae33
--- /dev/null
+++ b/parts/tipofday/tips
@@ -0,0 +1,203 @@
+<tip category="KDevelop|General">
+<html>
+<p>If you want to specify additional command-line options to your make program, you can set them in the <b>Project Options</b> dialog, <b>Make Options</b> tab.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you use functions of other libraries than the target is currently linked with, you can specify them in the <b>Target Options</b> dialog.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you want to change your application's version number, you can change it in the <b>Project Options</b> dialog, <b>General</b> tab, automatically updating your project.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you want to create a new project, choose "Project"->"New Project" from the menu.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you changed your applications' classes, you should update your API documentation by selecting "Build API Documentation" from the Build menu.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>You can save time if you select "Compile File" from the Build menu or the toolbar, to only compile your current implementation file.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you're searching for information on classes or classmembers, select "Search for Help on..." from the Help menu or use "Index" tab of the documentation tree.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you want to have info about something in the KDevelop window, select the "What's this?" button in the toolbar and click on the item you don't know about.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>Hint: You can search the documentation for a keyword by marking the word and select "Search in Documentation" in the right button popup menu.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>The KDevelop Team wishes you a nice day !
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you have found a bug in KDevelop, please let us know. Use KDE Bugzilla at http://bugs.kde.org/ or select "Help"->"Report Bug" from the menu.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you want to add your own documentation to the documentation tree use <b>Documentation Tree</b> tab in the <b>Configure KDevelop</b> dialog.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can create a new class with "New Class" from the "Project" menu?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>To open a project, select "Open Project" from the "Project" menu.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>If you compile your project and get an error, you can click on the error message to switch to the file and line where the error occurred.
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can debug your programs within KDevelop by selecting "Debug"->"Start" in the menu?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can switch between classes or namespaces by selecting the class or namespace combo in the toolbar?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can preview images and icons by selecting them in the file viewer's trees?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can set the compiler options in the <b>Project Options</b> dialog, <b>Configure Options</b> tab?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can copy text from the documentation browser to the clipboard and insert it into your sources?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you should keep your library documentation up to date after installing new libraries?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can configure the syntax-highlighting of the editor?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can access more internal debug functions selecting "Debug"->"Viewers"?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can move the cursor by words with Ctrl and left or right arrow?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that your source bookmarks are stored in the project?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that your documentation bookmarks are stored globally in KDevelop configuration?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can start grep search from inside editor with context menu?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can set the installation path in "Project"->"Project Options" "Configure Options" with just adding "--prefix=/install/path/" to the "Configure arguments"-list?
+</html>
+</tip>
+
+
+<tip category="KDevelop|General">
+<html>
+<p>...that you can compilie your project in "debug-mode" and "optimized-mode"?
+</html>
+</tip>
+
+
diff --git a/parts/tools/Makefile.am b/parts/tools/Makefile.am
new file mode 100644
index 00000000..887ccdd5
--- /dev/null
+++ b/parts/tools/Makefile.am
@@ -0,0 +1,16 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces \
+ -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevtools.la
+libkdevtools_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevtools_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevtools_la_SOURCES = tools_part.cpp toolsconfig.cpp toolsconfigwidgetbase.ui toolsconfigwidget.cpp kapplicationtree.cpp addtooldlg.ui
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevtools.desktop
+
+rc_DATA = kdevpart_tools.rc
+rcdir = $(kde_datadir)/kdevtools
diff --git a/parts/tools/README.dox b/parts/tools/README.dox
new file mode 100644
index 00000000..00eab3bf
--- /dev/null
+++ b/parts/tools/README.dox
@@ -0,0 +1,12 @@
+/** \class ToolsPart
+This plugin provides an easy way to add external applications to the Tools menu and toolbar.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\unmaintained This part is currently un-maintained.
+
+\feature Provides an easy way to add external applications to the Tools menu and toolbar.
+\feature Tool menu and the file and directory context menus can now be populated with any shell command.
+\feature Output can be sent to the app output part. %S, %D, %T and %W magic works.
+
+*/
diff --git a/parts/tools/addtooldlg.ui b/parts/tools/addtooldlg.ui
new file mode 100644
index 00000000..2ec5e8b4
--- /dev/null
+++ b/parts/tools/addtooldlg.ui
@@ -0,0 +1,245 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>AddToolDialog</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>add_tool_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>314</width>
+ <height>514</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Add Tool</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>cmdlineLabel_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Parameters:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>paramEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>capturedBox</cstring>
+ </property>
+ <property name="text">
+ <string>C&amp;apture output</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>If this is checked, the output of the application will be shown in the application output view; otherwise, all output will be ignored.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>cmdlineLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Executable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>execEdit</cstring>
+ </property>
+ </widget>
+ <widget class="Line" row="5" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Line1</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>HLine</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Sunken</enum>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>menutextLabel</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Menu text:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>menutextEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>paramEdit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;The following placeholders can be used:&lt;/p&gt;
+&lt;p&gt;
+&lt;b&gt;%D&lt;/b&gt; - The project directory&lt;br&gt;
+&lt;b&gt;%S&lt;/b&gt; - The current filename&lt;br&gt;
+&lt;b&gt;%T&lt;/b&gt; - The current selection&lt;br&gt;
+&lt;b&gt;%W&lt;/b&gt; - The current word under the cursor&lt;br&gt;
+&lt;/p&gt;
+&lt;p&gt;If any of the used placeholders cannot be evaluated (for example
+if you use %T but there is no current selection), the tool will not be
+executed.&lt;/p&gt;</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>menutextEdit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The text that appears in the Tools-Menu</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>okButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;OK</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>execEdit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The path and name of the application to execute</string>
+ </property>
+ </widget>
+ <widget class="KDevApplicationTree" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>tree</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="focusPolicy">
+ <enum>StrongFocus</enum>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+ <customwidget>
+ <class>KDevApplicationTree</class>
+ <header location="local">kapplicationtree.h</header>
+ <sizehint>
+ <width>-1</width>
+ <height>-1</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>5</hordata>
+ <verdata>5</verdata>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image name="image0">
+ <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data>
+ </image>
+</images>
+<connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_tool_dialog</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>add_tool_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>tree</tabstop>
+ <tabstop>menutextEdit</tabstop>
+ <tabstop>execEdit</tabstop>
+ <tabstop>paramEdit</tabstop>
+ <tabstop>capturedBox</tabstop>
+ <tabstop>okButton</tabstop>
+ <tabstop>cancelButton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+ <include location="local" impldecl="in implementation">addtooldlg.ui.h</include>
+</includes>
+<forwards>
+ <forward>class QListViewItem;</forward>
+</forwards>
+<slots>
+ <slot>init()</slot>
+ <slot returnType="QString">getApp()</slot>
+ <slot access="private">treeSelectionChanged( QListViewItem * lvi )</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/tools/addtooldlg.ui.h b/parts/tools/addtooldlg.ui.h
new file mode 100644
index 00000000..d01c4da7
--- /dev/null
+++ b/parts/tools/addtooldlg.ui.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename slots use Qt Designer which will
+** update this file, preserving your code. Create an init() slot in place of
+** a constructor, and a destroy() slot in place of a destructor.
+*****************************************************************************/
+
+#include <qheader.h>
+#include <kurlrequester.h>
+#include "kapplicationtree.h"
+
+void AddToolDialog::init()
+{
+ connect( tree, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(treeSelectionChanged(QListViewItem*)) );
+ tree->header()->hide();
+}
+
+QString AddToolDialog::getApp()
+{
+ return execEdit->url() + " " + paramEdit->text();
+}
+
+void AddToolDialog::treeSelectionChanged( QListViewItem * lvi )
+{
+ KDevAppTreeListItem* item = dynamic_cast<KDevAppTreeListItem*> ( lvi );
+ if ( !item || item->isDirectory() )
+ return;
+ execEdit->setURL( item->executable() );
+ menutextEdit->setText( item->text( 0 ) );
+}
diff --git a/parts/tools/kapplicationtree.cpp b/parts/tools/kapplicationtree.cpp
new file mode 100644
index 00000000..dd33e851
--- /dev/null
+++ b/parts/tools/kapplicationtree.cpp
@@ -0,0 +1,258 @@
+/* This file is part of the KDE libraries
+ Nicked from KDElibs since KDevApplicationTree is not a public class..
+
+ Copyright (C) 1997 Torben Weis <weis@stud.uni-frankfurt.de>
+ Copyright (C) 1999 Dirk A. Mueller <dmuell@gmx.net>
+ Portions copyright (C) 1999 Preston Brown <pbrown@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <qfile.h>
+#include <qdir.h>
+#include <qdialog.h>
+#include <qpixmap.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qtoolbutton.h>
+#include <qcheckbox.h>
+#include <qtooltip.h>
+#include <qstyle.h>
+
+#include <kapplication.h>
+#include <kbuttonbox.h>
+#include <kcombobox.h>
+#include <kdesktopfile.h>
+#include <kdialog.h>
+#include <kglobal.h>
+#include <klineedit.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <kmimemagic.h>
+#include <krun.h>
+#include <kstandarddirs.h>
+#include <kstringhandler.h>
+#include <kuserprofile.h>
+#include <kurlcompletion.h>
+#include <kurlrequester.h>
+#include <dcopclient.h>
+#include <kmimetype.h>
+#include <kservicegroup.h>
+#include <klistview.h>
+#include <ksycoca.h>
+#include <kdebug.h>
+
+#include "kapplicationtree.h"
+
+template class QPtrList<QString>;
+
+#define SORT_SPEC (QDir::DirsFirst | QDir::Name | QDir::IgnoreCase)
+
+
+// ----------------------------------------------------------------------
+
+KDevAppTreeListItem::KDevAppTreeListItem( KListView* parent, const QString & name,
+ const QPixmap& pixmap, bool parse, bool dir, const QString& p, const QString& c, const QString& dE )
+ : QListViewItem( parent, name )
+{
+ init(pixmap, parse, dir, p, c, dE);
+}
+
+
+// ----------------------------------------------------------------------
+
+KDevAppTreeListItem::KDevAppTreeListItem( QListViewItem* parent, const QString & name,
+ const QPixmap& pixmap, bool parse, bool dir, const QString& p, const QString& c, const QString& dE )
+ : QListViewItem( parent, name )
+{
+ init(pixmap, parse, dir, p, c, dE);
+}
+
+
+// ----------------------------------------------------------------------
+
+void KDevAppTreeListItem::init(const QPixmap& pixmap, bool parse, bool dir, const QString& _path, const QString& _exec, const QString& _dEntry)
+{
+ setPixmap(0, pixmap);
+ parsed = parse;
+ directory = dir;
+ path = _path; // relative path
+ exec = _exec;
+ dEntry = _dEntry;
+ exec.simplifyWhiteSpace();
+ exec.truncate(exec.find(' '));
+}
+
+
+// ----------------------------------------------------------------------
+// Ensure that dirs are sorted in front of files and case is ignored
+
+QString KDevAppTreeListItem::key(int column, bool /*ascending*/) const
+{
+ if (directory)
+ return QString::fromLatin1(" ") + text(column).upper();
+ else
+ return text(column).upper();
+}
+
+void KDevAppTreeListItem::activate()
+{
+ if ( directory )
+ setOpen(!isOpen());
+}
+
+void KDevAppTreeListItem::setOpen( bool o )
+{
+ if( o && !parsed ) { // fill the children before opening
+ ((KDevApplicationTree *) parent())->addDesktopGroup( path, this );
+ parsed = true;
+ }
+ QListViewItem::setOpen( o );
+}
+
+bool KDevAppTreeListItem::isDirectory()
+{
+ return directory;
+}
+
+// ----------------------------------------------------------------------
+
+KDevApplicationTree::KDevApplicationTree( QWidget *parent, const char* name )
+ : KListView( parent, name ), currentitem(0)
+{
+ addColumn( i18n("Known Applications") );
+ setRootIsDecorated( true );
+
+ addDesktopGroup( QString::null );
+
+ connect( this, SIGNAL( currentChanged(QListViewItem*) ), SLOT( slotItemHighlighted(QListViewItem*) ) );
+ connect( this, SIGNAL( selectionChanged(QListViewItem*) ), SLOT( slotSelectionChanged(QListViewItem*) ) );
+}
+
+// ----------------------------------------------------------------------
+
+bool KDevApplicationTree::isDirSel()
+{
+ if (!currentitem) return false; // if currentitem isn't set
+ return currentitem->isDirectory();
+}
+
+// ----------------------------------------------------------------------
+
+void KDevApplicationTree::addDesktopGroup( QString relPath, KDevAppTreeListItem *item)
+{
+ KServiceGroup::Ptr root = KServiceGroup::group(relPath);
+ KServiceGroup::List list = root->entries();
+
+ KDevAppTreeListItem * newItem;
+ for( KServiceGroup::List::ConstIterator it = list.begin();
+ it != list.end(); it++)
+ {
+ QString icon;
+ QString text;
+ QString relPath;
+ QString exec;
+ QString dEntry;
+ bool isDir = false;
+ KSycocaEntry *p = (*it);
+ if (p->isType(KST_KService))
+ {
+ KService *service = static_cast<KService *>(p);
+ icon = service->icon();
+ text = service->name();
+ exec = service->exec();
+ dEntry = service->desktopEntryPath();
+ }
+ else if (p->isType(KST_KServiceGroup))
+ {
+ KServiceGroup *serviceGroup = static_cast<KServiceGroup *>(p);
+ icon = serviceGroup->icon();
+ text = serviceGroup->caption();
+ relPath = serviceGroup->relPath();
+ isDir = true;
+ if ( text[0] == '.' ) // skip ".hidden" like kicker does
+ continue;
+ // avoid adding empty groups
+ KServiceGroup::Ptr subMenuRoot = KServiceGroup::group(relPath);
+ if (subMenuRoot->childCount() == 0)
+ continue;
+ }
+ else
+ {
+ kdWarning(250) << "KServiceGroup: Unexpected object in list!" << endl;
+ continue;
+ }
+
+ QPixmap pixmap = SmallIcon( icon );
+
+ if (item)
+ newItem = new KDevAppTreeListItem( item, text, pixmap, false, isDir,
+ relPath, exec, dEntry );
+ else
+ newItem = new KDevAppTreeListItem( this, text, pixmap, false, isDir,
+ relPath, exec, dEntry );
+ if (isDir)
+ newItem->setExpandable( true );
+ }
+}
+
+
+// ----------------------------------------------------------------------
+
+void KDevApplicationTree::slotItemHighlighted(QListViewItem* i)
+{
+ // i may be 0 (see documentation)
+ if(!i)
+ return;
+
+ KDevAppTreeListItem *item = (KDevAppTreeListItem *) i;
+
+ currentitem = item;
+
+ if( (!item->directory ) && (!item->exec.isEmpty()) )
+ emit highlighted( item->text(0), item->exec );
+}
+
+
+// ----------------------------------------------------------------------
+
+void KDevApplicationTree::slotSelectionChanged(QListViewItem* i)
+{
+ // i may be 0 (see documentation)
+ if(!i)
+ return;
+
+ KDevAppTreeListItem *item = (KDevAppTreeListItem *) i;
+
+ currentitem = item;
+
+ if( ( !item->directory ) && (!item->exec.isEmpty() ) )
+ emit selected( item->text(0), item->exec );
+}
+
+// ----------------------------------------------------------------------
+
+void KDevApplicationTree::resizeEvent( QResizeEvent * e)
+{
+ setColumnWidth(0, width()-QApplication::style().pixelMetric(QStyle::PM_ScrollBarExtent));
+ KListView::resizeEvent(e);
+}
+
+
+
+#include "kapplicationtree.moc"
+
diff --git a/parts/tools/kapplicationtree.h b/parts/tools/kapplicationtree.h
new file mode 100644
index 00000000..7c11870a
--- /dev/null
+++ b/parts/tools/kapplicationtree.h
@@ -0,0 +1,102 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2000 David Faure <faure@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+#ifndef __KDevApplicationTree_h__
+#define __KDevApplicationTree_h__
+
+#include <kurl.h>
+#include <klistview.h>
+
+class KURLRequester;
+
+class QWidget;
+class QCheckBox;
+class QPushButton;
+class QLabel;
+class QStringList;
+
+
+/* ------------------------------------------------------------------------- */
+
+/**
+ * @internal
+ */
+class KDevAppTreeListItem : public QListViewItem
+{
+ bool parsed;
+ bool directory;
+ QString path;
+ QString exec;
+ QString dEntry;
+
+protected:
+ QString key(int column, bool ascending) const;
+
+ void init(const QPixmap& pixmap, bool parse, bool dir, const QString& _path, const QString& _exec, const QString& _dEntry);
+
+public:
+ KDevAppTreeListItem( KListView* parent, const QString & name, const QPixmap& pixmap,
+ bool parse, bool dir, const QString& p, const QString& c, const QString& dE );
+ KDevAppTreeListItem( QListViewItem* parent, const QString & name, const QPixmap& pixmap,
+ bool parse, bool dir, const QString& p, const QString& c, const QString& dE );
+ bool isDirectory();
+
+ QString desktopEntryPath() const { return dEntry; }
+ QString executable() const { return exec; }
+
+protected:
+ virtual void activate();
+ virtual void setOpen( bool o );
+
+ friend class KDevApplicationTree;
+};
+
+/* ------------------------------------------------------------------------- */
+
+/**
+ * @internal
+ */
+class KDevApplicationTree : public KListView
+{
+ Q_OBJECT
+public:
+ KDevApplicationTree( QWidget *parent, const char* name = 0 );
+
+ /**
+ * Add a group of .desktop/.kdelnk entries
+ */
+ void addDesktopGroup( QString relPath, KDevAppTreeListItem *item = 0 );
+
+ bool isDirSel();
+
+protected:
+ void resizeEvent( QResizeEvent *_ev );
+ KDevAppTreeListItem* currentitem;
+
+public slots:
+ void slotItemHighlighted(QListViewItem* i);
+ void slotSelectionChanged(QListViewItem* i);
+
+signals:
+ void selected( const QString& _name, const QString& _exec );
+ void highlighted( const QString& _name, const QString& _exec );
+};
+
+/* ------------------------------------------------------------------------- */
+
+#endif
diff --git a/parts/tools/kdevpart_tools.rc b/parts/tools/kdevpart_tools.rc
new file mode 100644
index 00000000..ab8a6a98
--- /dev/null
+++ b/parts/tools/kdevpart_tools.rc
@@ -0,0 +1,14 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="tools" library="libtoolsplugin" version="1">
+<MenuBar>
+ <Menu name="tools">
+ <text>&amp;Tools</text>
+ <ActionList name="tools_list"/>
+ <ActionList name="tools2_list"/>
+ </Menu>
+</MenuBar>
+<ToolBar position="Top" iconText="IconOnly" noMerge="1" name="extraToolBar" fullWidth="false" hidden="true" >
+ <text>Tools Toolbar</text>
+ <ActionList name="tools_list"/>
+</ToolBar>
+</kpartplugin>
diff --git a/parts/tools/kdevtools.desktop b/parts/tools/kdevtools.desktop
new file mode 100644
index 00000000..5e245562
--- /dev/null
+++ b/parts/tools/kdevtools.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=This plugin provides an easy way to add external applications to the Tools menu and toolbar.
+Comment[ca]=Aquest connector proporciona un mètode fàcil per afegir aplicacions externes en el menú Eines i a la barra d'eines.
+Comment[da]=Dette plugin sørger for en nem måde at tilføje eksterne programmer til værktøjsmenuen og værktøjslinjen.
+Comment[de]=Dieses Modul erleichtert das Hinzufügen externer Anwendungen zum Menü "Werkzeuge" und in die Werkzeugleiste.
+Comment[el]=Αυτό το πρόσθετο προσφέρει μια εύκολη μέθοδο για τη προσθήκη εξωτερικών εφαρμογών στο μενού εργαλείων και τη γραμμή εργαλείων.
+Comment[es]=Este complemento proporciona un método sencillo para añadir aplicaciones externas en el menú de Herramientas y en la barra de herramientas.
+Comment[et]=See plugin võimaldab hõlpsasti lisada väliseid rakendusi tööriistade menüüsse ja tööriistaribale.
+Comment[eu]=Plugin honek kanpoko aplikazioak Tresnak menu eta tresna-barran erraz gehitzeko aukera eskeintzen du.
+Comment[fa]=این وصله، راه آسانی را برای افزودن کاربردهای خارجی به گزینگان ابزار و میله ابزار فراهم می‌کند.
+Comment[fr]=Ce module externe fournit un moyen facile d'ajouter des applications externes au menu « Outils » et à la barre d'outils.
+Comment[gl]=Esta extensión proporciona un método sinxelo para engadir aplicacións externas ao menú Ferramentas e á barra de ferramentas.
+Comment[hu]=Ez a bővítőmodul lehetővé teszi az Eszközök menü és az eszköztár egyszerű kibővítését
+Comment[it]=Questo plugin offre un modo per aggiungere applicazioni esterne al menu o alla barra degli strumenti.
+Comment[ja]=このプラグインはツールメニューやツールバーに外部のアプリケーションを追加する簡単な方法を提供します。
+Comment[ms]=Plugin ini menyediakan cara mudah untuk menambah aplikasi luaran ke menu Alatan dan bar alatan.
+Comment[nds]=Mit dit Moduul laat sik extern Programmen eenfach na dat "Warktüüch"-Menü un den Warktüüchbalken tofögen.
+Comment[ne]=यो प्लगइनले उपकरण मेनु र उपकरणपट्टीमा बाह्य अनुप्रयोग थप्न सजिलो तरिका प्रदान गर्दछ ।
+Comment[nl]=Met deze plugin kunt u op eenvoudige wijze externe toepassingen aan het menu Gereedschap en de werkbalk toevoegen.
+Comment[pl]=Ta wtyczka umożliwia łatwe dodawanie zewnętrznych programów do menu Narzędzia i do paska narzędzi.
+Comment[pt]=Este 'plugin' oferece uma forma simples de adicionar as aplicações externas ao menu Ferramentas e à barra de ferramentas.
+Comment[pt_BR]=Este plug-in fornece uma maneira fácil de adicionar aplicativos externos ao menu Ferramentas e barra de ferramentas.
+Comment[ru]=Предоставляет возможности добавления в меню пунктов вызова внешних приложений.
+Comment[sk]=Modul poskytuje jednoduchý spôsob ako pridať externú aplikáciu do menu Nástroje a do panelu nástrojov.
+Comment[sl]=Ta vstavek omogoča preprost način dodajanja zunanjih programov v meni Orodja in v orodjarno.
+Comment[sr]=Овај прикључак обезбеђује лак начин за додавање спољних програма у мени „Алати“ и у траку са алатом.
+Comment[sr@Latn]=Ovaj priključak obezbeđuje lak način za dodavanje spoljnih programa u meni „Alati“ i u traku sa alatom.
+Comment[sv]=Insticksprogrammet tillhandahåller ett enkelt sätt att lägga till yttre program i verktygsmenyn och verktygsraden.
+Comment[ta]=இந்த சொருகி கருவிப்பட்டியல் மற்றும் கருவிப்பட்டையில் வெளிபுற பயன்பாடு எளிய முறையில் சேர்க்கலாம்.
+Comment[tg]=Барои илова намудан дар меню нуқтаҳои ҷеғ задани гузоришҳои берунро имкон медиҳад.
+Comment[zh_CN]=这个插件提供向工具菜单和工具栏添加外部程序的方法。
+Comment[zh_TW]=此外掛程式提供一個簡單的方式,將外部應用程式新增到工具選單與工具列中。
+Name=KDevTools
+Name[da]=KDevelop Værktøjer
+Name[de]="Werkzeug"-Menüerweiterung (KDevelop)
+Name[hi]=के-डेव-टूल्स
+Name[nds]=Warktüüch-Menüverwiedern (KDevelop)
+Name[pl]=KDevNarzędzia
+Name[sk]=KDev nástroje
+Name[sv]=KDevelop verktyg
+Name[ta]=KDev கருவிகள்
+Name[tg]=Асбобҳои KDev
+Name[zh_TW]=KDevelop 工具
+GenericName=Tools Menu Addition
+GenericName[ca]=Afegiment al menú Eines
+GenericName[da]=Værktøjsmenu tilføjelse
+GenericName[de]="Werkzeuge"-Menüerweiterung
+GenericName[el]=Προσθήκη μενού εργαλείων
+GenericName[es]=Añadir al menú Herramientas
+GenericName[et]=Tööriistade menüü lisamine
+GenericName[eu]=Tresnak menuan gehitu
+GenericName[fa]=افزودن گزینگان ابزار
+GenericName[fr]=Ajout au menu « Outils »
+GenericName[gl]=Engadidos ao menú Ferramentas
+GenericName[hu]=Bővítés az Eszközök menühöz
+GenericName[it]=Aggiunte al menu Strumenti
+GenericName[ja]=ツールメニュー追加
+GenericName[nds]=Warktüüch-Menüverwiedern
+GenericName[ne]=उपकरण मेनु अतिरिक्त
+GenericName[nl]=Gereedschapsmenu-toevoeging
+GenericName[pl]=Dodatek do menu Narzędzia
+GenericName[pt]=Adicionar ao Menu de Ferramentas
+GenericName[pt_BR]=Adição ao Menu Ferramentas
+GenericName[ru]=Дополнение меню инструментов
+GenericName[sk]=Prídavky menu Nástroje
+GenericName[sl]=Dodatek menija orodij
+GenericName[sr]=Додаци менију „Алати“
+GenericName[sr@Latn]=Dodaci meniju „Alati“
+GenericName[sv]=Tillägg i verktygsmenyn
+GenericName[ta]=கருவிப்பட்டியல் சேர்ப்பு
+GenericName[tg]=Асбобҳои иловагии меню
+GenericName[tr]=Araçlar Menü Eklemesi
+GenericName[zh_CN]=工具菜单附加
+GenericName[zh_TW]=新增工具選單
+Icon=configure
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevtools
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=AdditionalTools
diff --git a/parts/tools/tools_part.cpp b/parts/tools/tools_part.cpp
new file mode 100644
index 00000000..f4285546
--- /dev/null
+++ b/parts/tools/tools_part.cpp
@@ -0,0 +1,272 @@
+#include "tools_part.h"
+
+#include <qfile.h>
+#include <qpopupmenu.h>
+#include <qregexp.h>
+#include <qtimer.h>
+#include <qvbox.h>
+#include <qwhatsthis.h>
+
+#include <kaction.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdesktopfile.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <kprocess.h>
+#include <ktexteditor/document.h>
+
+#include "kdevcore.h"
+#include "kdevproject.h"
+#include "kdevpartcontroller.h"
+#include "kdevappfrontend.h"
+#include "kdevplugininfo.h"
+#include "urlutil.h"
+#include "configwidgetproxy.h"
+#include "kdeveditorutil.h"
+
+#include "toolsconfig.h"
+#include "toolsconfigwidget.h"
+
+#define TOOLSSETTINGS 1
+#define EXTRATOOLSSETTINGS 2
+
+static const KDevPluginInfo data("kdevtools");
+K_EXPORT_COMPONENT_FACTORY( libkdevtools, ToolsFactory( data ) )
+
+QMap<int, QString> externalToolMenuEntries;
+
+ToolsPart::ToolsPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin( &data, parent, name ? name : "ToolsPart")
+{
+ setInstance(ToolsFactory::instance());
+
+ setXMLFile("kdevpart_tools.rc");
+
+ m_configProxy = new ConfigWidgetProxy( core() );
+ m_configProxy->createGlobalConfigPage( i18n("Tools Menu"), TOOLSSETTINGS, info()->icon() );
+ m_configProxy->createGlobalConfigPage( i18n("External Tools"), EXTRATOOLSSETTINGS, info()->icon() );
+ connect( m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+
+ connect(core(), SIGNAL(coreInitialized()), this, SLOT(updateMenu()));
+
+ connect( core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)),
+ this, SLOT(contextMenu(QPopupMenu *, const Context *)) );
+
+ // Apparently action lists can only be plugged after the
+ // xmlgui client has been registered
+ QTimer::singleShot(0, this, SLOT(updateToolsMenu()));
+}
+
+
+ToolsPart::~ToolsPart()
+{
+ delete m_configProxy;
+}
+
+void ToolsPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ if ( pagenumber == TOOLSSETTINGS )
+ {
+ ToolsConfig *w = new ToolsConfig( page, "tools config widget" );
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ connect(dlg, SIGNAL(destroyed()), this, SLOT(updateMenu()));
+ }
+ else if ( pagenumber == EXTRATOOLSSETTINGS )
+ {
+ ToolsConfigWidget *w2 = new ToolsConfigWidget( page, "tools config widget" );
+ connect(dlg, SIGNAL(okClicked()), w2, SLOT(accept()));
+ connect(dlg, SIGNAL(destroyed()), this, SLOT(updateToolsMenu()));
+ }
+}
+
+void ToolsPart::updateMenu()
+{
+ QPtrList<KAction> actions;
+
+ unplugActionList("tools_list");
+
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("Tools");
+
+ QStringList list = config->readListEntry("Tools");
+ for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
+ {
+ QString name = *it;
+
+ KDesktopFile df(name, true);
+ if (df.readName().isNull())
+ continue;
+
+ KAction *action = new KAction(df.readName(), df.readIcon(), 0,
+ this, SLOT(slotToolActivated()), (QObject*)0, name.latin1());
+ actions.append(action);
+ }
+
+ plugActionList("tools_list", actions);
+}
+
+
+void ToolsPart::slotToolActivated()
+{
+ QString df = sender()->name();
+ kapp->startServiceByDesktopPath(df);
+}
+
+void ToolsPart::startCommand(QString cmdline, bool captured, QString fileName)
+{
+ KTextEditor::Document * doc = dynamic_cast<KTextEditor::Document*>( partController()->activePart() );
+
+ if ( fileName.isNull() && doc )
+ fileName = doc->url().path();
+
+ QString projectDirectory;
+ if (project())
+ projectDirectory = project()->projectDirectory();
+
+ QString selection = KDevEditorUtil::currentSelection( doc );
+ if ( !selection.isEmpty() )
+ selection = KShellProcess::quote( selection );
+
+ QString word = KDevEditorUtil::currentWord( doc );
+
+ // This should really be checked before inserting into the popup
+ if (cmdline.contains("%D") && projectDirectory.isNull())
+ return;
+ cmdline.replace(QRegExp("%D"), projectDirectory);
+
+ if (cmdline.contains("%S") && fileName.isNull())
+ return;
+ cmdline.replace(QRegExp("%S"), fileName);
+
+ if (cmdline.contains("%T") && selection.isNull())
+ return;
+ cmdline.replace(QRegExp("%T"), selection);
+
+ if (cmdline.contains("%W") && word.isNull())
+ return;
+ cmdline.replace(QRegExp("%W"), word);
+
+ if (captured)
+ {
+ if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
+ appFrontend->startAppCommand(QString::QString(), cmdline, false);
+ }
+ else
+ {
+ KShellProcess proc;
+ proc << cmdline;
+ proc.start(KProcess::DontCare, KProcess::NoCommunication);
+ }
+}
+
+
+void ToolsPart::updateToolsMenu()
+{
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("External Tools");
+ QStringList l = config->readListEntry("Tool Menu");
+
+
+ QPtrList<KAction> actions;
+ QStringList::ConstIterator it;
+ for (it = l.begin(); it != l.end(); ++it) {
+ QString menutext = *it;
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("Tool Menu " + menutext);
+ bool isdesktopfile = config->readBoolEntry("DesktopFile");
+ KAction *action = new KAction(*it, 0,
+ this, SLOT(toolsMenuActivated()),
+ (QObject*) 0, menutext.utf8());
+ if (isdesktopfile) {
+ KDesktopFile df(config->readPathEntry("CommandLine"));
+ action->setIcon(df.readIcon());
+ }
+ actions.append(action);
+ }
+
+ unplugActionList("tools2_list");
+ plugActionList("tools2_list", actions);
+}
+
+
+void ToolsPart::contextMenu(QPopupMenu *popup, const Context *context)
+{
+ if (!context->hasType( Context::FileContext ))
+ return;
+
+ const FileContext *fcontext = static_cast<const FileContext*>(context);
+ m_contextPopup = popup;
+ m_contextFileName = fcontext->urls().first().path();
+ externalToolMenuEntries.clear();
+
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("External Tools");
+ QStringList filecontextList = config->readListEntry("File Context");
+
+ if (URLUtil::isDirectory(m_contextFileName)) {
+ QStringList l = config->readListEntry("Dir Context");
+ QStringList::ConstIterator it;
+ for (it = l.begin(); it != l.end(); ++it)
+ externalToolMenuEntries.insert( popup->insertItem( (*it), this, SLOT(dirContextActivated(int)) ), (*it) );
+ } else {
+ QStringList l = config->readListEntry("File Context");
+ QStringList::ConstIterator it;
+ for (it = l.begin(); it != l.end(); ++it)
+ externalToolMenuEntries.insert( popup->insertItem( (*it), this, SLOT(fileContextActivated(int)) ), (*it) );
+ }
+}
+
+
+void ToolsPart::toolsMenuActivated()
+{
+ QString menutext = sender()->name();
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("Tool Menu " + menutext);
+ QString cmdline = config->readPathEntry("CommandLine");
+ bool isdesktopfile = config->readBoolEntry("DesktopFile");
+ bool captured = config->readBoolEntry("Captured");
+ kdDebug() << "tools:" << "activating " << menutext
+ << "with cmdline " << cmdline
+ << "and desktopfile " << isdesktopfile << endl;
+ if (isdesktopfile)
+ kapp->startServiceByDesktopPath(cmdline);
+ else
+ startCommand(cmdline, captured, QString::null);
+}
+
+
+void ToolsPart::fileContextActivated(int id)
+{
+ QString menutext = externalToolMenuEntries[ id ];
+
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("File Context " + menutext);
+ QString cmdline = config->readPathEntry("CommandLine");
+ bool captured = config->readBoolEntry("Captured");
+ kdDebug() << "filecontext:" << "activating " << menutext
+ << " with cmdline " << cmdline
+ << " on file " << m_contextFileName << endl;
+ startCommand(cmdline, captured, m_contextFileName);
+}
+
+
+void ToolsPart::dirContextActivated(int id)
+{
+ QString menutext = externalToolMenuEntries[ id ];
+
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("Dir Context " + menutext);
+ QString cmdline = config->readPathEntry("CommandLine");
+ bool captured = config->readBoolEntry("Captured");
+ kdDebug() << "dircontext:" << "activating " << menutext
+ << "with cmdline " << cmdline
+ << " on directory " << m_contextFileName << endl;
+ startCommand(cmdline, captured, m_contextFileName);
+}
+
+#include "tools_part.moc"
diff --git a/parts/tools/tools_part.h b/parts/tools/tools_part.h
new file mode 100644
index 00000000..b0d82c99
--- /dev/null
+++ b/parts/tools/tools_part.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2001 Matthias Hoelzer-Kluepfel <mhk@caldera.de>
+ */
+
+
+#ifndef __KDEVPART_TOOLS_H__
+#define __KDEVPART_TOOLS_H__
+
+
+#include <qguardedptr.h>
+#include <kdevplugin.h>
+#include <kdevgenericfactory.h>
+
+
+class QPopupMenu;
+class KDialogBase;
+class Context;
+class ConfigWidgetProxy;
+
+class ToolsWidget;
+
+
+class ToolsPart : public KDevPlugin
+ {
+ Q_OBJECT
+
+public:
+
+ ToolsPart( QObject *parent, const char *name, const QStringList & );
+ ~ToolsPart();
+
+
+private slots:
+ void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber );
+ void updateMenu();
+
+ void slotToolActivated();
+
+ void contextMenu(QPopupMenu *popup, const Context *context);
+ void updateToolsMenu();
+ void toolsMenuActivated();
+ void fileContextActivated(int id);
+ void dirContextActivated(int id);
+
+private:
+ void startCommand(QString cmdline, bool captured, QString fileName);
+
+ QPopupMenu *m_contextPopup;
+ QString m_contextFileName;
+ ConfigWidgetProxy * m_configProxy;
+ };
+
+typedef KDevGenericFactory<ToolsPart> ToolsFactory;
+
+#endif
diff --git a/parts/tools/toolsconfig.cpp b/parts/tools/toolsconfig.cpp
new file mode 100644
index 00000000..523fe388
--- /dev/null
+++ b/parts/tools/toolsconfig.cpp
@@ -0,0 +1,169 @@
+#include "toolsconfig.h"
+
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qheader.h>
+
+#include <kapplication.h>
+#include <kdesktopfile.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klocale.h>
+
+#include "tools_part.h"
+#include "kapplicationtree.h"
+
+
+ToolsConfig::ToolsConfig(QWidget *parent, const char *name)
+ : QWidget(parent, name), _tree(0)
+{
+ _entries.setAutoDelete(true);
+}
+
+
+void ToolsConfig::showEvent(QShowEvent *e)
+{
+ QWidget::showEvent(e);
+
+ if (!_tree)
+ {
+ QApplication::setOverrideCursor(Qt::waitCursor);
+
+ QHBoxLayout *hbox = new QHBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint());
+
+ QVBoxLayout *vbox = new QVBoxLayout(hbox);
+ _tree = new KDevApplicationTree(this);
+ _tree->header()->hide();
+ QLabel *l = new QLabel(_tree, i18n("&Applications:"), this);
+ l->show();
+ _tree->show();
+
+ vbox->addWidget(l);
+ vbox->addWidget(_tree);
+
+ vbox = new QVBoxLayout(hbox);
+
+ _toList = new QPushButton(QApplication::reverseLayout() ? "<<" : ">>", this);
+ _toList->show();
+ vbox->addWidget(_toList);
+
+ connect(_toList, SIGNAL(clicked()), this, SLOT(toList()));
+
+ _toTree = new QPushButton(QApplication::reverseLayout() ? ">>" : "<<", this);
+ _toTree->show();
+ vbox->addWidget(_toTree);
+
+ connect(_toTree, SIGNAL(clicked()), this, SLOT(toTree()));
+
+ vbox = new QVBoxLayout(hbox);
+ _list = new QListBox(this);
+ l = new QLabel(_list, i18n("&Tools menu:"), this);
+ l->show();
+ _list->show();
+ vbox->addWidget(l);
+ vbox->addWidget(_list);
+
+ QApplication::restoreOverrideCursor();
+ }
+
+ fill();
+ checkButtons();
+
+ connect(_tree, SIGNAL(selectionChanged()), this, SLOT(checkButtons()));
+ connect(_list, SIGNAL(selectionChanged()), this, SLOT(checkButtons()));
+}
+
+
+void ToolsConfig::checkButtons()
+{
+ _toList->setEnabled(_tree->selectedItem() && !_tree->selectedItem()->firstChild());
+ _toTree->setEnabled(_list->currentItem() >= 0 && _list->currentItem() < (int)_list->count());
+}
+
+
+void ToolsConfig::fill()
+{
+ _entries.clear();
+
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("Tools");
+
+ QStringList list = config->readListEntry("Tools");
+
+ for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
+ add(*it);
+}
+
+
+void ToolsConfig::add(const QString &desktopFile)
+{
+ KDesktopFile df(desktopFile, true);
+ if (df.readName().isEmpty())
+ return;
+
+ Entry *entry = new Entry;
+
+ if (!df.readIcon().isEmpty())
+ entry->icon = BarIcon(df.readIcon());
+ entry->name = df.readName();
+ entry->desktopFile = desktopFile;
+
+ _entries.append(entry);
+
+ updateList();
+
+ checkButtons();
+}
+
+
+void ToolsConfig::toList()
+{
+ KDevAppTreeListItem *item = dynamic_cast<KDevAppTreeListItem*>(_tree->selectedItem());
+ if (item && !item->desktopEntryPath().isEmpty())
+ add(item->desktopEntryPath());
+ checkButtons();
+}
+
+
+void ToolsConfig::toTree()
+{
+ _entries.remove(_list->currentItem());
+ updateList();
+ checkButtons();
+}
+
+
+void ToolsConfig::accept()
+{
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("Tools");
+
+ QStringList l;
+ QPtrListIterator<Entry> it(_entries);
+ for ( ; it.current(); ++it)
+ l.append(it.current()->desktopFile);
+
+ config->writeEntry("Tools", l);
+ config->sync();
+}
+
+
+void ToolsConfig::updateList()
+{
+ _list->setUpdatesEnabled(false);
+
+ _list->clear();
+
+ QPtrListIterator<Entry> it(_entries);
+ for ( ; it.current(); ++it)
+ _list->insertItem(it.current()->icon, it.current()->name);
+
+ _list->setUpdatesEnabled(true);
+ _list->repaint();
+}
+
+
+#include "toolsconfig.moc"
diff --git a/parts/tools/toolsconfig.h b/parts/tools/toolsconfig.h
new file mode 100644
index 00000000..5dc87d70
--- /dev/null
+++ b/parts/tools/toolsconfig.h
@@ -0,0 +1,71 @@
+#ifndef __TOOLS_CONFIG_H__
+#define __TOOLS_CONFIG_H__
+
+
+#include <qwidget.h>
+#include <qptrlist.h>
+#include <qpixmap.h>
+
+
+class QListBox;
+class QPushButton;
+class KDevApplicationTree;
+
+class Entry
+{
+public:
+
+ Entry() {};
+
+ QString name;
+ QString desktopFile;
+ QPixmap icon;
+
+};
+
+
+class ToolsConfig : public QWidget
+ {
+ Q_OBJECT
+
+public:
+
+ ToolsConfig(QWidget *parent = 0, const char *name = 0);
+
+
+public slots:
+
+ void accept();
+
+
+protected:
+
+ void showEvent(QShowEvent *);
+
+ void fill();
+ void add(const QString &desktopFile);
+ void remove(const QString &desktopFile);
+
+
+private slots:
+
+ void checkButtons();
+
+ void toList();
+ void toTree();
+
+ void updateList();
+
+
+private:
+
+ KDevApplicationTree *_tree;
+ QListBox *_list;
+ QPushButton *_toList, *_toTree;
+
+ QPtrList<Entry> _entries;
+
+ };
+
+
+#endif
diff --git a/parts/tools/toolsconfigwidget.cpp b/parts/tools/toolsconfigwidget.cpp
new file mode 100644
index 00000000..72b102be
--- /dev/null
+++ b/parts/tools/toolsconfigwidget.cpp
@@ -0,0 +1,284 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "toolsconfigwidget.h"
+
+#include <qcheckbox.h>
+#include <qlistbox.h>
+#include <qtimer.h>
+
+#include <klineedit.h>
+#include <kconfig.h>
+#include <kdeversion.h>
+#include <kdebug.h>
+#include <kdesktopfile.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <kurl.h>
+#include <kurldrag.h>
+
+#include "addtooldlg.h"
+#include "kapplicationtree.h"
+
+
+struct ToolsConfigEntry
+{
+ QString menutext;
+ QString cmdline;
+ bool isdesktopfile;
+ bool captured;
+ bool isEmpty() const {
+ return ( menutext.isEmpty() && cmdline.isEmpty() );
+ }
+};
+
+
+ToolsConfigWidget::ToolsConfigWidget(QWidget *parent, const char *name)
+ : ToolsConfigWidgetBase(parent, name)
+{
+ m_toolsmenuEntries.setAutoDelete(true);
+ m_filecontextEntries.setAutoDelete(true);
+ m_dircontextEntries.setAutoDelete(true);
+
+ toolsmenuBox->setAcceptDrops(true);
+ toolsmenuBox->installEventFilter(this);
+ toolsmenuBox->viewport()->setAcceptDrops(true);
+ toolsmenuBox->viewport()->installEventFilter(this);
+
+ readConfig();
+}
+
+
+ToolsConfigWidget::~ToolsConfigWidget()
+{}
+
+
+void ToolsConfigWidget::readGroup(const QString &group, QDict<ToolsConfigEntry> *entryDict)
+{
+ KConfig *config = ToolsFactory::instance()->config();
+ config->setGroup("External Tools");
+ QStringList list = config->readListEntry(group);
+
+ QStringList::ConstIterator it;
+ for (it = list.begin(); it != list.end(); ++it) {
+ config->setGroup(group + " " + (*it));
+ QString cmdline = config->readPathEntry("CommandLine");
+ bool isdesktopfile = config->readBoolEntry("DesktopFile");
+ bool captured = config->readBoolEntry("Captured");
+ ToolsConfigEntry *entry = new ToolsConfigEntry;
+ entry->menutext = (*it);
+ entry->cmdline = cmdline;
+ entry->isdesktopfile = isdesktopfile;
+ entry->captured = captured;
+ entryDict->insert(*it, entry);
+ }
+}
+
+
+void ToolsConfigWidget::storeGroup(const QString &group, const QDict<ToolsConfigEntry> &entryDict)
+{
+ KConfig *config = ToolsFactory::instance()->config();
+
+ QStringList list;
+
+ QDictIterator<ToolsConfigEntry> it(entryDict);
+ for (; it.current(); ++it) {
+ ToolsConfigEntry *entry = it.current();
+ list << entry->menutext;
+ config->setGroup(group + " " + entry->menutext);
+ config->writePathEntry("CommandLine", entry->cmdline);
+ config->writeEntry("DesktopFile", entry->isdesktopfile);
+ config->writeEntry("Captured", entry->captured);
+ }
+
+ config->setGroup("External Tools");
+ config->writeEntry(group, list);
+}
+
+
+
+void ToolsConfigWidget::fillListBox(QListBox *lb, const QDict<ToolsConfigEntry> &entryDict)
+{
+ lb->clear();
+
+ QDictIterator<ToolsConfigEntry> it(entryDict);
+ for (; it.current(); ++it) {
+ ToolsConfigEntry *entry = it.current();
+ if (entry->isdesktopfile) {
+ KDesktopFile df(entry->cmdline);
+ lb->insertItem(SmallIcon(df.readIcon()), entry->menutext);
+ } else {
+ lb->insertItem(entry->menutext);
+ }
+ }
+}
+
+
+bool ToolsConfigWidget::addEntry(ToolsConfigEntry *entry, QDict<ToolsConfigEntry> *entryDict)
+{
+ QString menutext = entry->menutext;
+ if (entryDict->find(menutext)) {
+ delete entry;
+ KMessageBox::sorry(this, i18n("An entry with this title exists already."));
+ return false;
+ }
+
+ entryDict->insert(menutext, entry);
+
+ updateListBoxes();
+ return true;
+}
+
+
+void ToolsConfigWidget::readConfig()
+{
+ readGroup("Tool Menu", &m_toolsmenuEntries);
+ readGroup("File Context", &m_filecontextEntries);
+ readGroup("Dir Context", &m_dircontextEntries);
+
+ updateListBoxes();
+}
+
+
+void ToolsConfigWidget::storeConfig()
+{
+ storeGroup("Tool Menu", m_toolsmenuEntries);
+ storeGroup("File Context", m_filecontextEntries);
+ storeGroup("Dir Context", m_dircontextEntries);
+}
+
+
+void ToolsConfigWidget::updateListBoxes()
+{
+ fillListBox(toolsmenuBox, m_toolsmenuEntries);
+ fillListBox(filecontextBox, m_filecontextEntries);
+ fillListBox(dircontextBox, m_dircontextEntries);
+}
+
+
+void ToolsConfigWidget::toolsmenuaddClicked()
+{
+ AddToolDialog dlg(this);
+ dlg.setCaption(i18n("Add to Tools Menu"));
+ dlg.tree->setFocus();
+ while (dlg.exec()) {
+ ToolsConfigEntry *entry = new ToolsConfigEntry;
+ entry->menutext = dlg.menutextEdit->text();
+ entry->cmdline = dlg.getApp().stripWhiteSpace();
+ entry->isdesktopfile = false;
+ entry->captured = dlg.capturedBox->isChecked();
+ if ( entry->isEmpty() )
+ delete entry;
+ else if (addEntry(entry, &m_toolsmenuEntries))
+ return;
+ }
+}
+
+
+void ToolsConfigWidget::toolsmenuremoveClicked()
+{
+ QString menutext = toolsmenuBox->currentText();
+ m_toolsmenuEntries.remove(menutext);
+ updateListBoxes();
+}
+
+
+void ToolsConfigWidget::filecontextaddClicked()
+{
+ AddToolDialog dlg(this);
+ dlg.setCaption(i18n("Add to File Context Menus"));
+ dlg.tree->setFocus();
+ while (dlg.exec()) {
+ ToolsConfigEntry *entry = new ToolsConfigEntry;
+ entry->menutext = dlg.menutextEdit->text();
+ entry->cmdline = dlg.getApp().stripWhiteSpace();
+ entry->isdesktopfile = false;
+ entry->captured = dlg.capturedBox->isChecked();
+ if ( entry->isEmpty() )
+ delete entry;
+
+ else if (addEntry(entry, &m_filecontextEntries))
+ return;
+ }
+}
+
+
+void ToolsConfigWidget::filecontextremoveClicked()
+{
+ QString menutext = filecontextBox->currentText();
+ m_filecontextEntries.remove(menutext);
+ updateListBoxes();
+}
+
+
+void ToolsConfigWidget::dircontextaddClicked()
+{
+ AddToolDialog dlg(this);
+ dlg.setCaption(i18n("Add to Directory Context Menus"));
+ dlg.tree->setFocus();
+ if (dlg.exec()) {
+ ToolsConfigEntry *entry = new ToolsConfigEntry;
+ entry->menutext = dlg.menutextEdit->text();
+ entry->cmdline = dlg.getApp().stripWhiteSpace();
+ entry->isdesktopfile = false;
+ entry->captured = dlg.capturedBox->isChecked();
+ if ( entry->isEmpty() )
+ delete entry;
+ else if (addEntry(entry, &m_dircontextEntries))
+ return;
+ }
+}
+
+
+void ToolsConfigWidget::dircontextremoveClicked()
+{
+ QString menutext = dircontextBox->currentText();
+ m_dircontextEntries.remove(menutext);
+ updateListBoxes();
+}
+
+
+bool ToolsConfigWidget::eventFilter(QObject *o, QEvent *e)
+{
+ if (e->type() == QEvent::DragEnter || e->type() == QEvent::DragMove) {
+ QDragMoveEvent *dme = static_cast<QDragMoveEvent*>(e);
+ if (KURLDrag::canDecode(dme))
+ dme->accept();
+ return true;
+ } else if (e->type() == QEvent::Drop) {
+ QDropEvent *de = static_cast<QDropEvent*>(e);
+ KURL::List fileList;
+ if (KURLDrag::decode(de, fileList)) {
+ KURL::List::ConstIterator it;
+ for (it = fileList.begin(); it != fileList.end(); ++it) {
+ if ((*it).isLocalFile() && KDesktopFile::isDesktopFile((*it).path())) {
+ KDesktopFile df((*it).path());
+ ToolsConfigEntry *entry = new ToolsConfigEntry;
+ entry->menutext = df.readName();
+ entry->cmdline = (*it).path();
+ entry->isdesktopfile = true;
+ entry->captured = false;
+ addEntry(entry, &m_toolsmenuEntries);
+ }
+ }
+ }
+ return true;
+ }
+
+ return ToolsConfigWidgetBase::eventFilter(o, e);
+}
+
+
+void ToolsConfigWidget::accept()
+{
+ storeConfig();
+}
+#include "toolsconfigwidget.moc"
diff --git a/parts/tools/toolsconfigwidget.h b/parts/tools/toolsconfigwidget.h
new file mode 100644
index 00000000..51e1b005
--- /dev/null
+++ b/parts/tools/toolsconfigwidget.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * Copyright (C) 2002 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _TOOLSCONFIGWIDGET_H_
+#define _TOOLSCONFIGWIDGET_H_
+
+#include "toolsconfigwidgetbase.h"
+#include "tools_part.h"
+#include <qdict.h>
+
+
+struct ToolsConfigEntry;
+
+
+class ToolsConfigWidget : public ToolsConfigWidgetBase
+{
+ Q_OBJECT
+
+public:
+ ToolsConfigWidget(QWidget *parent=0, const char *name=0);
+ ~ToolsConfigWidget();
+
+public slots:
+ void accept();
+
+private:
+ virtual void toolsmenuaddClicked();
+ virtual void toolsmenuremoveClicked();
+ virtual void filecontextaddClicked();
+ virtual void filecontextremoveClicked();
+ virtual void dircontextaddClicked();
+ virtual void dircontextremoveClicked();
+
+ virtual bool eventFilter(QObject *o, QEvent *e);
+
+ void readGroup(const QString &group, QDict<ToolsConfigEntry> *entryDict);
+ void storeGroup(const QString &group, const QDict<ToolsConfigEntry> &entryDict);
+ void fillListBox(QListBox *lb, const QDict<ToolsConfigEntry> &entryDict);
+ bool addEntry(ToolsConfigEntry *entry, QDict<ToolsConfigEntry> *entryDict);
+
+ void readConfig();
+ void storeConfig();
+ void updateListBoxes();
+
+ QDict<ToolsConfigEntry> m_toolsmenuEntries;
+ QDict<ToolsConfigEntry> m_filecontextEntries;
+ QDict<ToolsConfigEntry> m_dircontextEntries;
+
+ ToolsPart *m_part;
+};
+
+#endif
diff --git a/parts/tools/toolsconfigwidgetbase.ui b/parts/tools/toolsconfigwidgetbase.ui
new file mode 100644
index 00000000..5b8baab0
--- /dev/null
+++ b/parts/tools/toolsconfigwidgetbase.ui
@@ -0,0 +1,410 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>ToolsConfigWidgetBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>tools_config_widget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>541</width>
+ <height>376</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>External Tools</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <widget class="QTabWidget">
+ <property name="name">
+ <cstring>tabwidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>toolmenuTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Tools Menu</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListBox" row="0" column="0">
+ <property name="name">
+ <cstring>toolsmenuBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>Layout4_3</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>toolsmenuaddButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>toolsmenuremoveButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer11_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>filecontextTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;File Context Menu</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListBox" row="0" column="0">
+ <property name="name">
+ <cstring>filecontextBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>Layout4_2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>filecontextaddButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>filecontextremoveButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer11_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>dircontextTab</cstring>
+ </property>
+ <attribute name="title">
+ <string>&amp;Directory Context Menu</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QListBox" row="0" column="0">
+ <property name="name">
+ <cstring>dircontextBox</cstring>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="0" column="1">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer9</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>dircontextaddButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Add...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>dircontextremoveButton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Remove</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Spacer10</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <spacer row="1" column="0">
+ <property name="name">
+ <cstring>Spacer11</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>filecontextaddButton</sender>
+ <signal>clicked()</signal>
+ <receiver>tools_config_widget</receiver>
+ <slot>filecontextaddClicked()</slot>
+ </connection>
+ <connection>
+ <sender>dircontextaddButton</sender>
+ <signal>clicked()</signal>
+ <receiver>tools_config_widget</receiver>
+ <slot>dircontextaddClicked()</slot>
+ </connection>
+ <connection>
+ <sender>dircontextremoveButton</sender>
+ <signal>clicked()</signal>
+ <receiver>tools_config_widget</receiver>
+ <slot>dircontextremoveClicked()</slot>
+ </connection>
+ <connection>
+ <sender>filecontextremoveButton</sender>
+ <signal>clicked()</signal>
+ <receiver>tools_config_widget</receiver>
+ <slot>filecontextremoveClicked()</slot>
+ </connection>
+ <connection>
+ <sender>toolsmenuaddButton</sender>
+ <signal>clicked()</signal>
+ <receiver>tools_config_widget</receiver>
+ <slot>toolsmenuaddClicked()</slot>
+ </connection>
+ <connection>
+ <sender>toolsmenuremoveButton</sender>
+ <signal>clicked()</signal>
+ <receiver>tools_config_widget</receiver>
+ <slot>toolsmenuremoveClicked()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>toolsmenuBox</tabstop>
+ <tabstop>toolsmenuaddButton</tabstop>
+ <tabstop>toolsmenuremoveButton</tabstop>
+ <tabstop>tabwidget</tabstop>
+ <tabstop>filecontextBox</tabstop>
+ <tabstop>filecontextaddButton</tabstop>
+ <tabstop>filecontextremoveButton</tabstop>
+ <tabstop>dircontextBox</tabstop>
+ <tabstop>dircontextaddButton</tabstop>
+ <tabstop>dircontextremoveButton</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">dircontextaddClicked()</slot>
+ <slot access="protected">filecontextaddClicked()</slot>
+ <slot access="protected">filecontextremoveClicked()</slot>
+ <slot access="protected">dircontextremoveClicked()</slot>
+ <slot access="protected">toolsmenuaddClicked()</slot>
+ <slot access="protected">toolsmenuremoveClicked()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/uimode/Makefile.am b/parts/uimode/Makefile.am
new file mode 100644
index 00000000..50fe5f5a
--- /dev/null
+++ b/parts/uimode/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevuichooser.la
+libkdevuichooser_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevuichooser_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevuichooser_la_SOURCES = uichooser_part.cpp uichooser.ui uichooser_widget.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevuichooser.desktop
+
diff --git a/parts/uimode/README.dox b/parts/uimode/README.dox
new file mode 100644
index 00000000..5836e21f
--- /dev/null
+++ b/parts/uimode/README.dox
@@ -0,0 +1,8 @@
+/** \class UIChooserPart
+Allows you to choose the KDevelop UImode (Graphical User Interface mode)
+
+\authors <a href="mailto:hoelzer AT physik.uni-wuerzburg.de">Matthias Hoelzer</a>
+
+\feature Allows you to choose the KDevelop UImode (Graphical User Interface mode)
+
+*/
diff --git a/parts/uimode/kdevuichooser.desktop b/parts/uimode/kdevuichooser.desktop
new file mode 100644
index 00000000..20f8510d
--- /dev/null
+++ b/parts/uimode/kdevuichooser.desktop
@@ -0,0 +1,87 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides a dialog for UI-mode selection.
+Comment[ca]=Proporciona un diàleg per a la selecció del mode de la interfície d'usuari.
+Comment[da]=Sørger for en dialog for valg af brugergrænsefladetilstand.
+Comment[de]=Stellt einen Dialog für die Auswahl des Fenstermodus zur Verfügung.
+Comment[el]=Προσφέρει ένα διάλογο για την επιλογή της λειτουργίας του περιβάλλοντος χρήστη.
+Comment[en_GB]=Provides a dialogue for UI-mode selection.
+Comment[es]=Proporciona un diálogo para la selección del modo de la interfaz de usuario.
+Comment[et]=Pakub dialoogi kasutajaliidese režiimi valikuks.
+Comment[eu]=UI-modu hautapenerako elkarrizketa-koadroa eskeintzen du.
+Comment[fa]=محاوره‌ای برای گزینش حالت UI فراهم‌ می‌کند.
+Comment[fr]=Fournit une boîte de dialogue pour la sélection du mode d'interface graphique.
+Comment[gl]=Proporciona un diálogo para a selección do modo da interface de usuario
+Comment[hi]=यूआई-मोड चयन के लिए एक संवाद प्रदान करता है.
+Comment[hu]=Párbeszédablak a grafikus felület kiválasztásához
+Comment[it]=Fornisce una maschera per scegliere la modalità UI.
+Comment[ja]=UI モード選択のためのダイアログを提供します。
+Comment[ms]=Menyediakan dialok untuk pemilihan mod-UI.
+Comment[nds]=Stellt en Dialoog för de Böversiedenutwahl praat.
+Comment[ne]=UI-मोड चयनका लागि संवाद प्रदान गर्दछ
+Comment[nl]=Biedt een dialoog voor het selecteren van een UI-modus.
+Comment[pl]=Udostępnienie okna dialogowego do wyboru trybu interfejsu.
+Comment[pt]=Oferece uma janela para a selecção do modo de UI.
+Comment[pt_BR]=Fornece um diálogo para seleção modo-UI.
+Comment[ru]=Предоставляет диалог выбора режима интерфейса пользователя.
+Comment[sk]=Poskytuje dialóg pre voľbu UI módu.
+Comment[sl]=Prikazuje okno za izbiro načina uporabniškega vmesnika.
+Comment[sr]=Обезбеђује прозор за избор UI режима.
+Comment[sr@Latn]=Obezbeđuje prozor za izbor UI režima.
+Comment[sv]=Tillhandahåller en dialogruta för att välja läge för det grafiska gränssnittet.
+Comment[ta]=UI-பாங்கு தேர்வுக்காக உரையாடல் பெட்டி வரும்.
+Comment[tg]=Барои интихоб намудани тартиботи истифодабарандаи интерфейс имкон медиҳад.
+Comment[tr]=Arayüz-modu seçim için bir pencere sunar.
+Comment[zh_CN]=提供用户界面模式选择对话框
+Comment[zh_TW]=提供使用者介面模式選擇對話框
+Name=KDevUIChooser
+Name[da]=KDevelop brugergrænsefladevælger
+Name[de]=Fenstermodusauswahl (KDevelop)
+Name[hi]=के-डेव-यूआई-चूज़र
+Name[nds]=KDevelop-Böversietutwahl
+Name[pl]=KDevWybórInterfUżytk
+Name[sk]=KDev voľba UI
+Name[sv]=KDevelop gränssnittsväljare
+Name[ta]=KDevUI தேர்வாளர்
+Name[tg]=KDevUIИнтихобкунанда
+Name[zh_TW]=KDevelop 使用者介面選擇器
+GenericName=User-Interface Selection
+GenericName[ca]=Selecció de la interfície d'usuari
+GenericName[da]=Valg af brugergrænseflade
+GenericName[de]=Fenstermodusauswahl
+GenericName[el]=Επιλογή περιβάλλοντος χρήστη
+GenericName[es]=Selección de la interfaz de usuario
+GenericName[et]=Kasutajaliidese valimine
+GenericName[eu]=Erabiltzaile-interfaze hautapena
+GenericName[fa]=گزینش واسط کاربر
+GenericName[fr]=Sélection de l'interface utilisateur
+GenericName[gl]=Selección da interface de usuario
+GenericName[hi]=उपयोक्ता-इंटरफ़ेस चयन
+GenericName[hu]=A felhasználói felület kiválasztása
+GenericName[it]=Selezione dell'interfaccia utente
+GenericName[ja]=ユーザインターフェース選択
+GenericName[nds]=Bruker-Koppelsteedutwahl
+GenericName[ne]=प्रयोगकर्ता-इन्टरफेस चयन
+GenericName[nl]=Gebruikersinterface selectie
+GenericName[pl]=Wybór interfejsu użytkownika
+GenericName[pt]=Selecção da Interface de Utilizador
+GenericName[pt_BR]=Seleção de Interface-Usuário
+GenericName[ru]=Выбор интерфейса пользователя
+GenericName[sk]=Voľba užívateľského rozhrania
+GenericName[sl]=Izbira uporabniškega vmesnika
+GenericName[sr]=Избор корисничког интерфејса
+GenericName[sr@Latn]=Izbor korisničkog interfejsa
+GenericName[sv]=Användargränssnittsval
+GenericName[ta]=பயனரின்-இடைமுக தேர்வு
+GenericName[tg]=Интихоби интерфейси истифодабаранда
+GenericName[tr]=Kullanıcı Arayüzü Seçimi
+GenericName[zh_CN]=用户界面选择
+GenericName[zh_TW]=使用者介面選擇器
+Icon=view_choose
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevuichooser
+X-KDevelop-Version=5
+X-KDevelop-Scope=Core
+X-KDevelop-Mode=AssistantMode
+X-KDevelop-Properties=UISwitching
diff --git a/parts/uimode/uichooser.ui b/parts/uimode/uichooser.ui
new file mode 100644
index 00000000..149a1db1
--- /dev/null
+++ b/parts/uimode/uichooser.ui
@@ -0,0 +1,250 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>UIChooser</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>UIChooser</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>540</width>
+ <height>529</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>UIChooser</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>TabModeGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Use Tabs</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Some prefer not to have a tab bar and switch between documents using other means. Kate is one example of this.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>AlwaysShowTabs</cstring>
+ </property>
+ <property name="text">
+ <string>Al&amp;ways</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>NeverShowTabs</cstring>
+ </property>
+ <property name="text">
+ <string>Ne&amp;ver</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>HoverCloseGroup</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="title">
+ <string>Use Close on Hover</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The document tab can optionally be used to close the document, by clicking on the tab icon.</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>DoNotCloseOnHover</cstring>
+ </property>
+ <property name="text">
+ <string>No</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>DoCloseOnHover</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Yes</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>IDEAlButtonGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Toolview Tab Layout</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Three different modes for the IDEAl toolview tabs. "Text and icons" is the most informative, but takes a lot of space. Those with a smaller screen will typically want "Icons".</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>IconsOnly</cstring>
+ </property>
+ <property name="text">
+ <string>Icons</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>TextOnly</cstring>
+ </property>
+ <property name="text">
+ <string>Te&amp;xt</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>TextAndIcons</cstring>
+ </property>
+ <property name="text">
+ <string>Text and icons</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>TabbedBrowsingGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Tabbed Browsing</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Some extra options for the document tabbar.</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>OpenNewTabAfterCurrent</cstring>
+ </property>
+ <property name="text">
+ <string>Open &amp;new tab after current tab</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>ShowTabIcons</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Show icons on document tabs</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>ShowCloseTabsButton</cstring>
+ </property>
+ <property name="text">
+ <string>Show close &amp;button in tab bar</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>3</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Note: Changes will take effect after KDevelop is restarted</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignCenter</set>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>AlwaysShowTabs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>UIChooser</receiver>
+ <slot>maybeEnableCloseOnHover(bool)</slot>
+ </connection>
+ <connection>
+ <sender>NeverShowTabs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>UIChooser</receiver>
+ <slot>maybeEnableCloseOnHover(bool)</slot>
+ </connection>
+ <connection>
+ <sender>ShowTabIcons</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>UIChooser</receiver>
+ <slot>maybeEnableCloseOnHover(bool)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">maybeEnableCloseOnHover(bool)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/parts/uimode/uichooser_part.cpp b/parts/uimode/uichooser_part.cpp
new file mode 100644
index 00000000..914c03ba
--- /dev/null
+++ b/parts/uimode/uichooser_part.cpp
@@ -0,0 +1,52 @@
+#include "uichooser_part.h"
+
+#include <qvbox.h>
+
+#include <kdialogbase.h>
+#include <kdevgenericfactory.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevcore.h>
+#include <configwidgetproxy.h>
+#include <kdevplugininfo.h>
+
+#include "uichooser_widget.h"
+
+#define UICHOOSERSETTINGSPAGE 1
+
+typedef KDevGenericFactory<UIChooserPart> UIChooserFactory;
+static const KDevPluginInfo data("kdevuichooser");
+K_EXPORT_COMPONENT_FACTORY( libkdevuichooser, UIChooserFactory( data ) )
+
+UIChooserPart::UIChooserPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin( &data, parent, name ? name : "UIChooserPart")
+{
+ setInstance(UIChooserFactory::instance());
+
+ _configProxy = new ConfigWidgetProxy( core() );
+ _configProxy->createGlobalConfigPage( i18n("User Interface"), UICHOOSERSETTINGSPAGE, info()->icon() );
+ connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
+}
+
+
+UIChooserPart::~UIChooserPart()
+{
+ delete _configProxy;
+}
+
+void UIChooserPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
+{
+ kdDebug() << k_funcinfo << endl;
+
+ if ( pagenumber == UICHOOSERSETTINGSPAGE )
+ {
+ UIChooserWidget * w = new UIChooserWidget( this, page, "UIChooser widget" );
+ connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
+ }
+}
+
+
+
+
+#include "uichooser_part.moc"
diff --git a/parts/uimode/uichooser_part.h b/parts/uimode/uichooser_part.h
new file mode 100644
index 00000000..e4633441
--- /dev/null
+++ b/parts/uimode/uichooser_part.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2001 Matthias Hoelzer-Kluepfel <mhk@caldera.de>
+ */
+
+
+#ifndef __KDEVPART_UICHOOSER_H__
+#define __KDEVPART_UICHOOSER_H__
+
+
+class KDialogBase;
+class ConfigWidgetProxy;
+
+#include <kdevplugin.h>
+
+class UIChooserPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ UIChooserPart(QObject *parent, const char *name, const QStringList &);
+ ~UIChooserPart();
+
+private slots:
+ void insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int );
+
+private:
+ ConfigWidgetProxy * _configProxy;
+
+};
+
+
+#endif
diff --git a/parts/uimode/uichooser_widget.cpp b/parts/uimode/uichooser_widget.cpp
new file mode 100644
index 00000000..5e6ffbf7
--- /dev/null
+++ b/parts/uimode/uichooser_widget.cpp
@@ -0,0 +1,153 @@
+/***************************************************************************
+ uichooser_widget.cpp - ?
+ -------------------
+ begin : ?
+ copyright : (C) 2003 by the KDevelop team
+ email : team@kdevelop.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qcheckbox.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdeversion.h>
+
+#include "uichooser_part.h"
+#include "kdevmainwindow.h"
+#include "uichooser_widget.h"
+
+UIChooserWidget::UIChooserWidget( UIChooserPart * part, QWidget *parent, const char *name)
+ : UIChooser(parent, name)
+ ,m_part(part), _lastMode(0L)
+{
+ load();
+}
+
+void UIChooserWidget::load()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("UI");
+
+ int mdistyle = config->readNumEntry( "MDIStyle", 1 );
+ switch( mdistyle )
+ {
+ case 0:
+ IconsOnly->setChecked( true );
+ break;
+ case 1:
+ TextOnly->setChecked( true );
+ break;
+ case 3:
+ TextAndIcons->setChecked( true );
+ break;
+ default:
+ TextOnly->setChecked( true );
+ }
+
+ int tabVisibility = config->readNumEntry( "TabWidgetVisibility", _AlwaysShowTabs );
+ switch( tabVisibility )
+ {
+ case _AlwaysShowTabs:
+ AlwaysShowTabs->setChecked( true );
+ break;
+ case _NeverShowTabs:
+ NeverShowTabs->setChecked( true );
+ break;
+ }
+
+ bool CloseOnHover = config->readBoolEntry( "CloseOnHover", false );
+
+ if ( CloseOnHover )
+ {
+ DoCloseOnHover->setChecked( true );
+ }
+ else
+ {
+ DoNotCloseOnHover->setChecked( true );
+ }
+ OpenNewTabAfterCurrent->setChecked(config->readBoolEntry( "OpenNewTabAfterCurrent", false ));
+ ShowTabIcons->setChecked(config->readBoolEntry( "ShowTabIcons", true ));
+ ShowCloseTabsButton->setChecked(config->readBoolEntry( "ShowCloseTabsButton", true ));
+
+ maybeEnableCloseOnHover(false);
+}
+
+
+void UIChooserWidget::save()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("UI");
+
+ if ( AlwaysShowTabs->isChecked() )
+ {
+ config->writeEntry( "TabWidgetVisibility", _AlwaysShowTabs );
+ }
+ else if ( NeverShowTabs->isChecked() )
+ {
+ config->writeEntry( "TabWidgetVisibility", _NeverShowTabs );
+ }
+
+ if ( DoNotCloseOnHover->isChecked() )
+ {
+ config->writeEntry( "CloseOnHover", false );
+ }
+ else if ( DoCloseOnHover->isChecked() )
+ {
+ config->writeEntry( "CloseOnHover", true );
+ }
+
+ // using magic numbers for now.. where are these values defined??
+ if ( IconsOnly->isChecked() )
+ {
+ config->writeEntry( "MDIStyle", 0 );
+ }
+ else if ( TextAndIcons->isChecked() )
+ {
+ config->writeEntry( "MDIStyle", 3 );
+ }
+ else // TextOnly
+ {
+ config->writeEntry( "MDIStyle", 1 );
+ }
+ config->writeEntry("OpenNewTabAfterCurrent", OpenNewTabAfterCurrent->isChecked());
+ config->writeEntry("ShowTabIcons", ShowTabIcons->isChecked());
+ config->writeEntry("ShowCloseTabsButton", ShowCloseTabsButton->isChecked());
+
+ config->sync();
+}
+
+
+void UIChooserWidget::accept()
+{
+ save();
+}
+
+void UIChooserWidget::maybeEnableCloseOnHover( bool )
+{
+ if ( !NeverShowTabs->isChecked() && !ShowTabIcons->isChecked())
+ {
+ HoverCloseGroup->setEnabled(false);
+ } else if ( NeverShowTabs->isChecked() )
+ {
+ HoverCloseGroup->setEnabled( false );
+ TabbedBrowsingGroup->setEnabled( false );
+ } else
+ {
+ HoverCloseGroup->setEnabled( true );
+ TabbedBrowsingGroup->setEnabled( true );
+ }
+}
+
+
+#include "uichooser_widget.moc"
diff --git a/parts/uimode/uichooser_widget.h b/parts/uimode/uichooser_widget.h
new file mode 100644
index 00000000..5faba3af
--- /dev/null
+++ b/parts/uimode/uichooser_widget.h
@@ -0,0 +1,42 @@
+#ifndef __UICHOOSER_WIDGET_H__
+#define __UICHOOSER_WIDGET_H__
+
+
+#include <qwidget.h>
+
+
+#include "uichooser.h"
+
+class UIChooserPart;
+
+class UIChooserWidget : public UIChooser
+{
+ Q_OBJECT
+
+public:
+
+ enum TabWidgetVisibility {
+ _AlwaysShowTabs = 0,
+ _NeverShowTabs = 2
+ };
+
+ UIChooserWidget( UIChooserPart * part, QWidget *parent=0, const char *name=0 );
+
+public slots:
+ void accept();
+
+protected slots:
+ void maybeEnableCloseOnHover( bool );
+
+private slots:
+
+ void load();
+ void save();
+
+private:
+ UIChooserPart* m_part;
+ QWidget * _lastMode;
+};
+
+
+#endif
diff --git a/parts/valgrind/Makefile.am b/parts/valgrind/Makefile.am
new file mode 100644
index 00000000..07550df6
--- /dev/null
+++ b/parts/valgrind/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevvalgrind.la
+libkdevvalgrind_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevvalgrind_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevvalgrind_la_SOURCES = dialog_widget.ui valgrind_part.cpp valgrind_widget.cpp valgrind_dialog.cpp valgrinditem.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevvalgrind.desktop
+
+rcdir = $(kde_datadir)/kdevvalgrind
+rc_DATA = kdevpart_valgrind.rc
diff --git a/parts/valgrind/README.dox b/parts/valgrind/README.dox
new file mode 100644
index 00000000..d5e79fd4
--- /dev/null
+++ b/parts/valgrind/README.dox
@@ -0,0 +1,45 @@
+/** \class ValgrindPart
+Valgrind is a tool that helps you find memory management problems in programs. http://developer.kde.org/~sewardj/
+
+\authors <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a>
+...
+\authors <a href="mailto:nth author AT provider.com">nth author full name</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Integrates Valgrind into KDevelop
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/valgrind/dialog_widget.ui b/parts/valgrind/dialog_widget.ui
new file mode 100644
index 00000000..35ded9c1
--- /dev/null
+++ b/parts/valgrind/dialog_widget.ui
@@ -0,0 +1,360 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>DialogWidget</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>DialogWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>322</width>
+ <height>306</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Application</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>executableEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Parameters:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>paramEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Executable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>executableEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>paramEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidgetStack" row="1" column="0">
+ <property name="name">
+ <cstring>stack</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>0</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox2</cstring>
+ </property>
+ <property name="title">
+ <string>Valgrind</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>memleakBox</cstring>
+ </property>
+ <property name="text">
+ <string>Memory &amp;leak check</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>reachableBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Show still reachable blocks</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>childrenBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Trace children</string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget">
+ <property name="name">
+ <cstring>layout3</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Additional p&amp;arameters:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>valParamEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>valParamEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>valExecutableEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;xecutable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>valExecutableEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WStackPage</cstring>
+ </property>
+ <attribute name="id">
+ <number>1</number>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QGroupBox" row="0" column="0">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>Valgrind</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLayoutWidget" row="1" column="0">
+ <property name="name">
+ <cstring>layout3_2</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel5_2</cstring>
+ </property>
+ <property name="text">
+ <string>Additional p&amp;arameters:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>valParamEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>ctParamEdit</cstring>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>ctExecutableEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel4_2</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;xecutable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>valExecutableEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>ctChildrenBox</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Trace children</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox" row="1" column="0">
+ <property name="name">
+ <cstring>groupBox4</cstring>
+ </property>
+ <property name="title">
+ <string>KCachegrind</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLRequester" row="0" column="1">
+ <property name="name">
+ <cstring>kcExecutableEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel4_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Exe&amp;cutable:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>valExecutableEdit</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>memleakBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>DialogWidget</receiver>
+ <slot>checkBoxToggled()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>executableEdit</tabstop>
+ <tabstop>paramEdit</tabstop>
+ <tabstop>memleakBox</tabstop>
+ <tabstop>reachableBox</tabstop>
+ <tabstop>childrenBox</tabstop>
+ <tabstop>valExecutableEdit</tabstop>
+ <tabstop>valParamEdit</tabstop>
+ <tabstop>ctChildrenBox</tabstop>
+ <tabstop>ctExecutableEdit</tabstop>
+ <tabstop>ctParamEdit</tabstop>
+ <tabstop>kcExecutableEdit</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="private" specifier="non virtual">checkBoxToggled()</slot>
+ <slot>init()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/valgrind/dialog_widget.ui.h b/parts/valgrind/dialog_widget.ui.h
new file mode 100644
index 00000000..9a2570ae
--- /dev/null
+++ b/parts/valgrind/dialog_widget.ui.h
@@ -0,0 +1,21 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+
+
+void DialogWidget::checkBoxToggled()
+{
+ reachableBox->setEnabled( memleakBox->isChecked() );
+}
+
+
+void DialogWidget::init()
+{
+ valParamEdit->setMinimumWidth( valParamEdit->fontMetrics().width( "0" ) * 30 );
+ checkBoxToggled();
+}
diff --git a/parts/valgrind/kdevpart_valgrind.rc b/parts/valgrind/kdevpart_valgrind.rc
new file mode 100644
index 00000000..440b62c2
--- /dev/null
+++ b/parts/valgrind/kdevpart_valgrind.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="valgrind" library="libvalgrindplugin" version="3">
+<MenuBar>
+ <Menu name="debug"><Text>&amp;Debug</Text>
+ <Action name="tools_valgrind" group="profile"/>
+ <Action name="tools_calltree" group="profile"/>
+ </Menu>
+</MenuBar>
+</kpartplugin>
diff --git a/parts/valgrind/kdevvalgrind.desktop b/parts/valgrind/kdevvalgrind.desktop
new file mode 100644
index 00000000..23b5cf4f
--- /dev/null
+++ b/parts/valgrind/kdevvalgrind.desktop
@@ -0,0 +1,74 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Valgrind is a tool that helps you find memory management problems in programs. http://valgrind.org/
+Comment[ca]=Valgrind és una eina que us ajuda a trobar problemes en la gestió de la memòria en els programes. http://valgrind.org/
+Comment[da]=Valgrind er et værktøj der hjælper dig med at finde hukommelseshåndteringsproblemer i programmer. http://valgrind.org/
+Comment[de]=Valgrind ist ein Werkzeug zum Auffinden von Speicherverwaltungsproblemen in Anwendungen. http://valgrind.org/
+Comment[el]=Το Valgrind είναι ένα εργαλείο που βοηθά στην εύρεση προβλημάτων διαχείρισης μνήμης στα προγράμματα. http://valgrind.org/
+Comment[es]=Valgrind es una herramienta que le ayuda a encontrar problemas de gestión de memoria en los programas. http://valgrind.org/
+Comment[et]=Valgrind aitab leida programmides mälulekkeid ja muid mäluga seotud asju. http://valgrind.org/
+Comment[fr]=Valgrind est un outil qui vous aide à trouver les problèmes de gestion de la mémoire dans les programmes. http://valgrind.org/
+Comment[hu]=A Valgrind memóriakezelési hibák keresésére alkalmas program - http://valgrind.org
+Comment[it]=Valgrind è uno strumento che ti aiuta a trovare problemi di gestione della memoria nei programmi. http://valgrind.org/
+Comment[ja]=Valgrind は、プログラム内のメモリ管理問題を発見することを手助けするツールです。http://valgrind.org/
+Comment[ms]=Valgrind adalah alatan yang membantu anda mencari masalah pengurusan memori dalam program. http://valgrind.org/
+Comment[nds]=Valgrind is en Warktüüch för't Finnen vun t Spiekerpleegproblemen in Programmen. http://valgrind.org/
+Comment[nl]=Valgrind is een hulpprogramma dat u helpt bij het opsporen van geheugenproblemen in programma's. http://valgrind.org/
+Comment[pl]=Valgrind jest narzędziem pomagającym znaleźć w programach problemy z zarządzaniem pamięcią. http://valgrind.org/
+Comment[pt]=O Valgrind é uma ferramenta que o ajuda a descobrir os problemas de gestão de memória nos programas. http://www.valgrind.org/
+Comment[pt_BR]=Valgrind é uma ferramenta ajuda você a encontrar problemas de gerenciamento de memória nos programas. http://www.valgrind.org/
+Comment[ru]=Valgrind - средство нахождения проблем управления памятью в программах. http://valgrind.org/
+Comment[sk]=Valgrind je nástroj, ktorý pomáha nájsť problémy so správou pamäte v programoch. http://valgrind.org/
+Comment[sr]=Valgrind је алат који вам помаже да нађете проблеме са употребом меморије у програмима. http://valgrind.org/
+Comment[sr@Latn]=Valgrind je alat koji vam pomaže da nađete probleme sa upotrebom memorije u programima. http://valgrind.org/
+Comment[sv]=Valgrind är ett verktyg som hjälper dig hitta minneshanteringsproblem i program. Se http://valgrind.org/.
+Comment[zh_TW]=Valgrind 能協助您找到程式中記憶體管理上的問題。http://valgrind.org/
+Name=KDevvalgrind
+Name[da]=KDevelop Valgrind
+Name[de]=Unterstützung für Valgrind (KDevelop)
+Name[hi]=के-डेववेलग्रिंड
+Name[nds]=Ünnerstütten för Valgrind (KDevelop)
+Name[sk]=KDev valgrind
+Name[sv]=KDevelop valgrind
+Name[zh_TW]=KDevelop Valgrind
+GenericName=Valgrind Frontend
+GenericName[ca]=Entorn per a Valgrind
+GenericName[da]=Valgrind-grænseflade
+GenericName[de]=Oberfläche für Valgrind
+GenericName[el]=Πρόγραμμα Valgrind
+GenericName[es]=Interfaz para Valgrind
+GenericName[et]=Valgrindi kasutajaliides
+GenericName[eu]=Valgrind interfazea
+GenericName[fa]=پایانۀ Valgrind
+GenericName[fr]=Interface de Valgrind
+GenericName[ga]=Comhéadan Valgrind
+GenericName[gl]=Frontal para Valgrind
+GenericName[hi]=वेलग्रिन्ड फ्रन्टएण्ड
+GenericName[hu]=Valgrind-kezelő
+GenericName[it]=Interfaccia a Valgrind
+GenericName[ja]=Valgrind フロントエンド
+GenericName[ms]=Frontend Valgrind
+GenericName[nds]=Valgrind-Böversiet
+GenericName[ne]=भलग्रिन्ड फ्रन्टइन्ड
+GenericName[nl]=Valgrind-frontend
+GenericName[pl]=Interfejs do Valgrinda
+GenericName[pt]=Interface para o Valgrind
+GenericName[pt_BR]=Frontend do Valgrind
+GenericName[ru]=Интерфейс к Valgrind
+GenericName[sk]=Valgrind rozhranie
+GenericName[sl]=VMesnik za Valgrind
+GenericName[sr]=Кориснички интерфејс за Valgrind
+GenericName[sr@Latn]=Korisnički interfejs za Valgrind
+GenericName[sv]=Valgrind-gränssnitt
+GenericName[ta]=Valgrind முன் பகுதி
+GenericName[tg]=Интерфейс дар Valgrind
+GenericName[tr]=Valgrind Önucu
+GenericName[zh_CN]=Valgrind 前端
+GenericName[zh_TW]=Valgrind 前端介面
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDevelop-Scope=Global
+X-KDE-Library=libkdevvalgrind
+X-KDevelop-Version=5
+X-KDevelop-Properties=CompiledDevelopment
diff --git a/parts/valgrind/valgrind_dialog.cpp b/parts/valgrind/valgrind_dialog.cpp
new file mode 100644
index 00000000..405d78dd
--- /dev/null
+++ b/parts/valgrind/valgrind_dialog.cpp
@@ -0,0 +1,206 @@
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qregexp.h>
+#include <qwidgetstack.h>
+
+#include <kprocess.h>
+#include <klocale.h>
+#include <kurlrequester.h>
+#include <klineedit.h>
+#include <kstandarddirs.h>
+#include <kmessagebox.h>
+
+#include "dialog_widget.h"
+#include "valgrind_dialog.h"
+
+#include "valgrind_dialog.moc"
+
+
+ValgrindDialog::ValgrindDialog( Type type, QWidget* parent )
+ : KDialogBase( parent, "valgrind dialog", true, i18n("Valgrind Memory Check"), Ok|Cancel ),
+ m_type(type)
+{
+ w = new DialogWidget( this );
+ w->valExecutableEdit->setURL( "valgrind" );
+ w->executableEdit->setFocus();
+ w->stack->raiseWidget(m_type);
+ setMainWidget( w );
+ connect( w->executableEdit->lineEdit(), SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
+ connect( w->valExecutableEdit->lineEdit(), SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
+ connect( w->ctExecutableEdit->lineEdit(), SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
+ connect( w->kcExecutableEdit->lineEdit(), SIGNAL( textChanged( const QString &)), this, SLOT( valgrindTextChanged()));
+ enableButtonOK( false );
+}
+
+
+ValgrindDialog::~ValgrindDialog()
+{
+}
+
+void ValgrindDialog::valgrindTextChanged()
+{
+ if (m_type == Memcheck)
+ enableButtonOK( !w->valExecutableEdit->lineEdit()->text().isEmpty() && !w->executableEdit->lineEdit()->text().isEmpty() );
+ else if (m_type == Calltree)
+ enableButtonOK( !w->executableEdit->lineEdit()->text().isEmpty() && !w->ctExecutableEdit->lineEdit()->text().isEmpty() && !w->kcExecutableEdit->lineEdit()->text().isEmpty() );
+}
+
+QString ValgrindDialog::executableName() const
+{
+ return w->executableEdit->url();
+}
+
+void ValgrindDialog::setExecutable( const QString& url )
+{
+ w->executableEdit->setURL( url );
+}
+
+QString ValgrindDialog::valExecutable() const
+{
+ return w->valExecutableEdit->url();
+}
+
+QString ValgrindDialog::parameters() const
+{
+ return w->paramEdit->text();
+}
+
+void ValgrindDialog::setParameters( const QString& params )
+{
+ w->paramEdit->setText( params );
+}
+
+void ValgrindDialog::setValExecutable( const QString& ve )
+{
+ QString vUrl = ve;
+ if ( vUrl.isEmpty() ) {
+ vUrl = KStandardDirs::findExe( "valgrind" );
+ }
+ if ( vUrl.isEmpty() ) {
+ KMessageBox::sorry( this, i18n( "Could not find valgrind in your $PATH. Please make "
+ "sure it is installed properly." ),
+ i18n( "Valgrind Not Found" ) );
+ w->valExecutableEdit->setURL( "valgrind" );
+ } else {
+ w->valExecutableEdit->setURL( vUrl );
+ }
+}
+
+static const QString memCheckParam( "--tool=memcheck" );
+static const QString leakCheckParam( "--leak-check=yes" );
+static const QString reachableParam( "--show-reachable=yes" );
+static const QString childrenParam( "--trace-children=yes" );
+
+QString ValgrindDialog::valParams() const
+{
+ QString params = w->valParamEdit->text();
+ if (isNewValgrindVersion())
+ params += " " + memCheckParam;
+ if ( w->memleakBox->isChecked() )
+ params += " " + leakCheckParam;
+ if ( w->reachableBox->isChecked() )
+ params += " " + reachableParam;
+ if ( w->childrenBox->isChecked() )
+ params += " " + childrenParam;
+
+ return params;
+}
+
+void ValgrindDialog::setValParams( const QString& params )
+{
+ QString myParams = params;
+ if ( myParams.contains( leakCheckParam ) )
+ w->memleakBox->setChecked( true );
+ if ( myParams.contains( reachableParam ) )
+ w->reachableBox->setChecked( true );
+ if ( myParams.contains( childrenParam ) )
+ w->childrenBox->setChecked( true );
+ w->init();
+
+ myParams = myParams.replace( QRegExp( memCheckParam ), "" );
+ myParams = myParams.replace( QRegExp( leakCheckParam ), "" );
+ myParams = myParams.replace( QRegExp( reachableParam ), "" );
+ myParams = myParams.replace( QRegExp( childrenParam ), "" );
+ myParams = myParams.stripWhiteSpace();
+ w->valParamEdit->setText( myParams );
+}
+
+QString ValgrindDialog::ctExecutable() const
+{
+ return w->ctExecutableEdit->url();
+}
+
+void ValgrindDialog::setCtExecutable( const QString& ce )
+{
+ QString vUrl = ce;
+ if ( vUrl.isEmpty() ) {
+ vUrl = KStandardDirs::findExe( "valgrind" );
+ }
+ if ( vUrl.isEmpty() ) {
+ KMessageBox::sorry( this, i18n( "Could not find valgrind in your $PATH. Please make "
+ "sure it is installed properly." ),
+ i18n( "Valgrind Not Found" ) );
+ w->ctExecutableEdit->setURL( "valgrind" );
+ } else {
+ w->ctExecutableEdit->setURL( vUrl );
+ }
+}
+
+QString ValgrindDialog::ctParams() const
+{
+ QString params = w->ctParamEdit->text();
+ if ( w->ctChildrenBox->isChecked() )
+ params += " " + childrenParam;
+
+ return params;
+}
+
+void ValgrindDialog::setCtParams( const QString& params )
+{
+ QString myParams = params;
+ //force --tool=callgrind if no params are given
+ if (myParams.isEmpty())
+ myParams = "--tool=callgrind";
+ if ( myParams.contains( childrenParam ) )
+ w->ctChildrenBox->setChecked( true );
+ w->init();
+
+ myParams = myParams.replace( QRegExp( childrenParam ), "" );
+ myParams = myParams.stripWhiteSpace();
+ w->ctParamEdit->setText( myParams );
+}
+
+QString ValgrindDialog::kcExecutable( ) const
+{
+ return w->kcExecutableEdit->url();
+}
+
+void ValgrindDialog::setKcExecutable( const QString& ke )
+{
+ QString vUrl = ke;
+ if ( vUrl.isEmpty() ) {
+ vUrl = KStandardDirs::findExe( "kcachegrind" );
+ }
+ if ( vUrl.isEmpty() ) {
+ KMessageBox::sorry( this, i18n( "Could not find kcachegrind in your $PATH. Please make "
+ "sure it is installed properly." ),
+ i18n( "KCachegrind Not Found" ) );
+ w->kcExecutableEdit->setURL( "kcachegrind" );
+ } else {
+ w->kcExecutableEdit->setURL( vUrl );
+ }
+}
+
+bool ValgrindDialog::isNewValgrindVersion( ) const
+{
+ KProcess *proc = new KProcess;
+ proc->setUseShell(true);
+ *proc << "test \"valgrind-20\" == `valgrind --version | awk -F \\. '{print $1$2}'`";
+ proc->start(KProcess::Block);
+ if (proc->normalExit())
+ return proc->exitStatus();
+ return true;
+}
+
+// kate: space-indent on; indent-width 2; tab-width 2; show-tabs on;
+
diff --git a/parts/valgrind/valgrind_dialog.h b/parts/valgrind/valgrind_dialog.h
new file mode 100644
index 00000000..41c25afc
--- /dev/null
+++ b/parts/valgrind/valgrind_dialog.h
@@ -0,0 +1,62 @@
+
+#ifndef _VALGRIND_DIALOG_H_
+#define _VALGRIND_DIALOG_H_
+
+#include <kdialogbase.h>
+
+class KURLRequester;
+class DialogWidget;
+
+/**
+ *
+ * Harald Fernengel
+ **/
+class ValgrindDialog : public KDialogBase
+{
+ Q_OBJECT
+public:
+ enum Type { Memcheck = 0, Calltree = 1 };
+
+ ValgrindDialog( Type type, QWidget* parent = 0 );
+ ~ValgrindDialog();
+
+ // the app to check
+ QString executableName() const;
+ void setExecutable( const QString& url );
+
+ // command line parameters for the app
+ QString parameters() const;
+ void setParameters( const QString& params );
+
+ // name and/or path to the valgrind executable
+ QString valExecutable() const;
+ void setValExecutable( const QString& ve );
+
+ // command line parameters for valgrind
+ QString valParams() const;
+ void setValParams( const QString& params );
+
+ // name and/or path to the calltree executable
+ QString ctExecutable() const;
+ void setCtExecutable( const QString& ce );
+
+ // command line parameters for calltree
+ QString ctParams() const;
+ void setCtParams( const QString& params );
+
+ // name and/or path to the kcachegrind executable
+ QString kcExecutable() const;
+ void setKcExecutable( const QString& ke );
+
+protected:
+ bool isNewValgrindVersion() const;
+
+private:
+ DialogWidget *w;
+ Type m_type;
+ private slots:
+ void valgrindTextChanged();
+
+};
+
+#endif
diff --git a/parts/valgrind/valgrind_part.cpp b/parts/valgrind/valgrind_part.cpp
new file mode 100644
index 00000000..868faf28
--- /dev/null
+++ b/parts/valgrind/valgrind_part.cpp
@@ -0,0 +1,366 @@
+#include "valgrind_part.h"
+
+#include <qwhatsthis.h>
+#include <qregexp.h>
+#include <qfile.h>
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kaction.h>
+#include <kprocess.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+#include <kdebug.h>
+
+#include "kdevcore.h"
+#include "kdevmainwindow.h"
+#include "kdevproject.h"
+#include "kdevplugininfo.h"
+
+#include "valgrind_widget.h"
+#include "valgrind_dialog.h"
+#include "valgrinditem.h"
+
+typedef KDevGenericFactory<ValgrindPart> ValgrindFactory;
+static const KDevPluginInfo data("kdevvalgrind");
+K_EXPORT_COMPONENT_FACTORY( libkdevvalgrind, ValgrindFactory( data ) )
+
+ValgrindPart::ValgrindPart( QObject *parent, const char *name, const QStringList& )
+ : KDevPlugin( &data, parent, name ? name : "ValgrindPart" )
+{
+ setInstance( ValgrindFactory::instance() );
+ setXMLFile( "kdevpart_valgrind.rc" );
+
+ proc = new KShellProcess();
+ connect( proc, SIGNAL(receivedStdout( KProcess*, char*, int )),
+ this, SLOT(receivedStdout( KProcess*, char*, int )) );
+ connect( proc, SIGNAL(receivedStderr( KProcess*, char*, int )),
+ this, SLOT(receivedStderr( KProcess*, char*, int )) );
+ connect( proc, SIGNAL(processExited( KProcess* )),
+ this, SLOT(processExited( KProcess* )) );
+ connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)),
+ this, SLOT(slotStopButtonClicked(KDevPlugin*)) );
+ connect( core(), SIGNAL(projectOpened()),
+ this, SLOT(projectOpened()) );
+
+ m_widget = new ValgrindWidget( this );
+ m_widget->setIcon( SmallIcon("fork") );
+ m_widget->setCaption(i18n("Valgrind Output"));
+
+ QWhatsThis::add( m_widget, i18n( "<b>Valgrind</b><p>Shows the output of the valgrind. Valgrind detects<br>"
+ "use of uninitialized memory<br>"
+ "reading/writing memory after it has been free'd<br>"
+ "reading/writing off the end of malloc'd blocks<br>"
+ "reading/writing inappropriate areas on the stack<br>"
+ "memory leaks -- where pointers to malloc'd blocks are lost forever<br>"
+ "passing of uninitialised and/or unaddressable memory to system calls<br>"
+ "mismatched use of malloc/new/new [] vs free/delete/delete []<br>"
+ "some abuses of the POSIX pthread API." ) );
+
+ KAction* action = new KAction( i18n("&Valgrind Memory Leak Check"), 0, this,
+ SLOT(slotExecValgrind()), actionCollection(), "tools_valgrind" );
+ action->setToolTip(i18n("Valgrind memory leak check"));
+ action->setWhatsThis(i18n("<b>Valgrind memory leak check</b><p>Runs Valgrind - a tool to help you find memory-management problems in your programs."));
+
+ action = new KAction( i18n("P&rofile with KCachegrind"), 0, this,
+ SLOT(slotExecCalltree()), actionCollection(), "tools_calltree" );
+ action->setToolTip(i18n("Profile with KCachegrind"));
+ action->setWhatsThis(i18n("<b>Profile with KCachegrind</b><p>Runs your program in calltree and then displays profiler information in KCachegrind."));
+
+ mainWindow()->embedOutputView( m_widget, "Valgrind", i18n("Valgrind memory leak check") );
+}
+
+
+ValgrindPart::~ValgrindPart()
+{
+ if ( m_widget )
+ mainWindow()->removeView( m_widget );
+ delete m_widget;
+ delete proc;
+}
+
+void ValgrindPart::projectOpened()
+{
+ _lastExec.truncate( 0 );
+}
+
+void ValgrindPart::loadOutput()
+{
+ QString fName = KFileDialog::getOpenFileName(QString::null, "*", 0, i18n("Open Valgrind Output"));
+ if ( fName.isEmpty() )
+ return;
+
+ QFile f( fName );
+ if ( !f.open( IO_ReadOnly ) ) {
+ KMessageBox::sorry( 0, i18n("Could not open valgrind output: %1").arg(fName) );
+ return;
+ }
+
+ clear();
+ getActiveFiles();
+
+ QTextStream stream( &f );
+ while ( !stream.atEnd() ) {
+ receivedString( stream.readLine() + "\n" );
+ }
+ f.close();
+}
+
+void ValgrindPart::getActiveFiles()
+{
+ activeFiles.clear();
+ if ( project() ) {
+ QStringList projectFiles = project()->allFiles();
+ QString projectDirectory = project()->projectDirectory();
+ KURL url;
+ for ( QStringList::Iterator it = projectFiles.begin(); it != projectFiles.end(); ++it ) {
+ KURL url( projectDirectory + "/" + (*it) );
+ url.cleanPath( true );
+ activeFiles += url.path();
+ kdDebug() << "set project file: " << url.path().latin1() << endl;
+ }
+ }
+}
+
+static void guessActiveItem( ValgrindItem& item, const QStringList activeFiles )
+{
+ if ( activeFiles.isEmpty() && item.backtrace().isEmpty() )
+ return;
+ for ( ValgrindItem::BacktraceList::Iterator it = item.backtrace().begin(); it != item.backtrace().end(); ++it ) {
+ // active: first line of backtrace that lies in project source file
+ for ( QStringList::ConstIterator it2 = activeFiles.begin(); it2 != activeFiles.end(); ++it2 ) {
+ if ( (*it).url() == (*it2) ) {
+ (*it).setHighlighted( true );
+ return;
+ }
+ }
+ }
+}
+
+void ValgrindPart::appendMessage( const QString& message )
+{
+ if ( message.isEmpty() )
+ return;
+
+ ValgrindItem item( message );
+ guessActiveItem( item, activeFiles );
+ m_widget->addMessage( item );
+}
+
+void ValgrindPart::slotExecValgrind()
+{
+ ValgrindDialog* dlg = new ValgrindDialog(ValgrindDialog::Memcheck);
+ if ( project() && _lastExec.isEmpty() ) {
+ dlg->setExecutable( project()->mainProgram() );
+ } else {
+ dlg->setExecutable( _lastExec );
+ }
+ dlg->setParameters( _lastParams );
+ dlg->setValExecutable( _lastValExec );
+ dlg->setValParams( _lastValParams );
+ kcInfo.runKc = false;
+ _lastValExec = dlg->valExecutable();
+ _lastValParams = dlg->valParams();
+ if ( dlg->exec() == QDialog::Accepted ) {
+ runValgrind( dlg->executableName(), dlg->parameters(), dlg->valExecutable(), dlg->valParams() );
+ }
+}
+
+void ValgrindPart::slotExecCalltree()
+{
+ ValgrindDialog* dlg = new ValgrindDialog(ValgrindDialog::Calltree);
+ if ( project() && _lastExec.isEmpty() ) {
+ dlg->setExecutable( project()->mainProgram() );
+ } else {
+ dlg->setExecutable( _lastExec );
+ }
+ dlg->setParameters( _lastParams );
+ dlg->setCtExecutable( _lastCtExec );
+ dlg->setKcExecutable( _lastKcExec );
+ dlg->setCtParams( _lastCtParams );
+ kcInfo.runKc = true;
+ kcInfo.kcPath = dlg->kcExecutable();
+// kcInfo.kcWorkDir = KURL(dlg->executableName()).directory();
+ if ( dlg->exec() == QDialog::Accepted ) {
+ runValgrind( dlg->executableName(), dlg->parameters(), dlg->ctExecutable(), dlg->ctParams() );
+ }
+ _lastKcExec = dlg->kcExecutable();
+ _lastCtExec = dlg->ctExecutable();
+ _lastCtParams = dlg->ctParams();
+}
+
+void ValgrindPart::slotKillValgrind()
+{
+ if ( proc )
+ proc->kill();
+}
+
+void ValgrindPart::slotStopButtonClicked( KDevPlugin* which )
+{
+ if ( which != 0 && which != this )
+ return;
+ slotKillValgrind();
+}
+
+void ValgrindPart::clear()
+{
+ m_widget->clear();
+ currentMessage = QString::null;
+ currentPid = -1;
+ lastPiece = QString::null;
+}
+
+void ValgrindPart::runValgrind( const QString& exec, const QString& params, const QString& valExec, const QString& valParams )
+{
+ if ( proc->isRunning() ) {
+ KMessageBox::sorry( 0, i18n( "There is already an instance of valgrind running." ) );
+ return;
+ /// @todo - ask for forced kill
+ }
+
+ clear();
+
+ getActiveFiles();
+
+// proc->setWorkingDirectory(KURL(exec).directory());
+ proc->clearArguments();
+
+ DomUtil::PairList run_envvars;
+ if (project())
+ run_envvars = project()->runEnvironmentVars();
+
+ QStringList envVarList;
+ DomUtil::PairList::ConstIterator it;
+ for (it = run_envvars.begin(); it != run_envvars.end(); ++it)
+ {
+ envVarList << QString("%1=\"%2\" ").arg((*it).first).arg((*it).second);
+ }
+
+ *proc << envVarList.join("") << valExec << valParams << exec << params;
+ proc->start( KProcess::NotifyOnExit, KProcess::AllOutput );
+ mainWindow()->raiseView( m_widget );
+ core()->running( this, true );
+
+ _lastExec = exec;
+ _lastParams = params;
+}
+
+void ValgrindPart::receivedStdout( KProcess*, char* /* msg */, int /* len */ )
+{
+ //kdDebug() << "got StdOut: " <<QString::fromLocal8Bit( msg, len ) << endl;
+}
+
+void ValgrindPart::receivedStderr( KProcess*, char* msg, int len )
+{
+ receivedString( QString::fromLocal8Bit( msg, len ) );
+}
+
+void ValgrindPart::receivedString( const QString& str )
+{
+ QString rmsg = lastPiece + str;
+ QStringList lines = QStringList::split( "\n", rmsg );
+
+// kdDebug() << "got: " << QString::fromLocal8Bit( msg, len ) << endl;
+
+ if ( !rmsg.endsWith( "\n" ) ) {
+ // the last message is trucated, we'll receive
+ // the rest in the next call
+ lastPiece = lines.back();
+ lines.pop_back();
+ } else {
+ lastPiece = QString::null;
+ }
+ appendMessages( lines );
+}
+
+void ValgrindPart::appendMessages( const QStringList& lines )
+{
+ QRegExp valRe( "==(\\d+)== (.*)" );
+
+ for ( QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it ) {
+ if ( valRe.search( *it ) < 0 )
+ continue;
+
+ int cPid = valRe.cap( 1 ).toInt();
+
+ if ( valRe.cap( 2 ).isEmpty() ) {
+ appendMessage( currentMessage );
+ currentMessage = QString::null;
+ } else if ( cPid != currentPid ) {
+ appendMessage( currentMessage );
+ currentMessage = *it;
+ currentPid = cPid;
+ } else {
+ if ( !currentMessage.isEmpty() )
+ currentMessage += "\n";
+ currentMessage += *it;
+ }
+ }
+}
+
+void ValgrindPart::processExited( KProcess* p )
+{
+ if ( p == proc ) {
+ appendMessage( currentMessage + lastPiece );
+ currentMessage = QString::null;
+ lastPiece = QString::null;
+ core()->running( this, false );
+
+ if (kcInfo.runKc)
+ {
+ KProcess *kcProc = new KProcess;
+// kcProc->setWorkingDirectory(kcInfo.kcWorkDir);
+ *kcProc << kcInfo.kcPath;
+ *kcProc << QString("callgrind.out.%1").arg(p->pid());
+ kcProc->start(KProcess::DontCare);
+ }
+ }
+}
+
+void ValgrindPart::restorePartialProjectSession( const QDomElement* el )
+{
+ QDomElement execElem = el->namedItem( "executable" ).toElement();
+ _lastExec = execElem.attribute( "path", "" );
+ _lastParams = execElem.attribute( "params", "" );
+
+ QDomElement valElem = el->namedItem( "valgrind" ).toElement();
+ _lastValExec = valElem.attribute( "path", "" );
+ _lastValParams = valElem.attribute( "params", "" );
+
+ QDomElement ctElem = el->namedItem( "calltree" ).toElement();
+ _lastCtExec = ctElem.attribute( "path", "" );
+ _lastCtParams = ctElem.attribute( "params", "" );
+
+ QDomElement kcElem = el->namedItem( "kcachegrind" ).toElement();
+ _lastKcExec = kcElem.attribute( "path", "" );
+}
+
+void ValgrindPart::savePartialProjectSession( QDomElement* el )
+{
+ QDomDocument domDoc = el->ownerDocument();
+ if ( domDoc.isNull() )
+ return;
+
+ QDomElement execElem = domDoc.createElement( "executable" );
+ execElem.setAttribute( "path", _lastExec );
+ execElem.setAttribute( "params", _lastParams );
+
+ QDomElement valElem = domDoc.createElement( "valgrind" );
+ valElem.setAttribute( "path", _lastValExec );
+ valElem.setAttribute( "params", _lastValParams );
+
+ QDomElement ctElem = domDoc.createElement( "calltree" );
+ ctElem.setAttribute( "path", _lastCtExec );
+ ctElem.setAttribute( "params", _lastCtParams );
+
+ QDomElement kcElem = domDoc.createElement( "kcachegrind" );
+ kcElem.setAttribute( "path", _lastKcExec );
+
+ el->appendChild( execElem );
+ el->appendChild( valElem );
+ el->appendChild( ctElem );
+ el->appendChild( kcElem );
+}
+
+#include "valgrind_part.moc"
diff --git a/parts/valgrind/valgrind_part.h b/parts/valgrind/valgrind_part.h
new file mode 100644
index 00000000..097eb8f8
--- /dev/null
+++ b/parts/valgrind/valgrind_part.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2002 Harald Fernengel <harry@kdevelop.org>
+ */
+
+#ifndef __KDEVPART_VALGRIND_H__
+#define __KDEVPART_VALGRIND_H__
+
+#include <qguardedptr.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <kdevplugin.h>
+
+class ValgrindWidget;
+class KProcess;
+
+class ValgrindPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ ValgrindPart( QObject *parent, const char *name, const QStringList & );
+ ~ValgrindPart();
+
+ void runValgrind( const QString& exec, const QString& parameters, const QString& valExec, const QString& valParameters );
+
+ void savePartialProjectSession( QDomElement* el );
+ void restorePartialProjectSession( const QDomElement* el );
+
+private slots:
+ void slotExecValgrind();
+ void slotExecCalltree();
+ void slotKillValgrind();
+ void slotStopButtonClicked( KDevPlugin* which );
+ void receivedStdout( KProcess*, char*, int );
+ void receivedStderr( KProcess*, char*, int );
+ void processExited( KProcess* );
+ void loadOutput();
+ void projectOpened();
+
+private:
+ void getActiveFiles();
+ void appendMessage( const QString& message );
+ void appendMessages( const QStringList& lines );
+ void receivedString( const QString& str );
+ void clear();
+ QString _lastExec, _lastParams, _lastValExec, _lastValParams,
+ _lastCtExec, _lastCtParams, _lastKcExec;
+ KProcess* proc;
+ QString currentMessage;
+ QString lastPiece;
+ QStringList activeFiles;
+ int currentPid;
+ QGuardedPtr<ValgrindWidget> m_widget;
+ struct {
+ bool runKc;
+ QString kcPath;
+// QString kcWorkDir;
+ } kcInfo;
+};
+
+
+#endif
diff --git a/parts/valgrind/valgrind_widget.cpp b/parts/valgrind/valgrind_widget.cpp
new file mode 100644
index 00000000..356d97bf
--- /dev/null
+++ b/parts/valgrind/valgrind_widget.cpp
@@ -0,0 +1,205 @@
+#include <qlayout.h>
+#include <qpainter.h>
+#include <qpopupmenu.h>
+
+#include <kparts/part.h>
+#include <klibloader.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <klistview.h>
+#include <klocale.h>
+#include <kstatusbar.h>
+
+#include <kdevcore.h>
+#include <kdevpartcontroller.h>
+#include <kdevmainwindow.h>
+#include <kdevproject.h>
+
+#include "valgrind_part.h"
+#include "valgrind_widget.h"
+
+#define VALLISTVIEWITEMRTTI 130977
+
+// helper class to sort the ListView by item number instead of the string representation of the item number
+class ValListViewItem: public QListViewItem
+{
+public:
+ ValListViewItem( QListView* parent, int key, int pid, const QString& message ):
+ QListViewItem( parent, QString::number( key ), QString::number( pid ), message ),
+ _key( key ), _pid ( pid ), backtrace( false ), _line( -1 ), _active( false ) {}
+
+ ValListViewItem( ValListViewItem* parent, int key, int pid, const QString& message, const QString& filename, int line, bool active ):
+ QListViewItem( parent, QString::number( key ), QString::null, message ),
+ _key( key ), _pid( pid ), backtrace( true ), _filename( filename ), _line( line ), _active( active )
+ {
+ if ( parent->_pid != _pid && _pid > 0 )
+ setText( 1, QString::number( _pid ) );
+ }
+
+ virtual ~ValListViewItem();
+
+ static int intCompare( int i1, int i2 )
+ {
+ if ( i1 > i2 )
+ return 1;
+ else if ( i1 < i2 )
+ return -1;
+ else
+ return 0;
+ }
+
+ int compare( QListViewItem* i, int col, bool ascending ) const
+ {
+ if ( !i || i->rtti() != VALLISTVIEWITEMRTTI )
+ return QListViewItem::compare( i, col, ascending );
+ switch ( col ) {
+ case 0 : return intCompare( ((ValListViewItem*)i)->_key, _key );
+ case 1 : return intCompare( ((ValListViewItem*)i)->_pid, _pid );
+ default: return QListViewItem::compare( i, col, ascending );
+ }
+ }
+
+ void paintCell( QPainter* p, const QColorGroup& cg, int column, int width, int align )
+ {
+ if ( _active ) {
+ QFont fnt = p->font();
+ fnt.setBold( true );
+ p->setFont( fnt );
+ }
+ QListViewItem::paintCell( p, cg, column, width, align );
+ }
+
+ int rtti() const { return VALLISTVIEWITEMRTTI; }
+
+ QString fileName() const { return _filename; }
+ int line() const { return _line; }
+ QString message() const { return text( 2 ); }
+ bool isHighlighted() const { return _active; }
+
+private:
+ int _key;
+ int _pid;
+ bool backtrace;
+ QString _filename;
+ int _line;
+ bool _active;
+};
+
+ValListViewItem::~ValListViewItem() {}
+
+ValgrindWidget::ValgrindWidget( ValgrindPart *part )
+ : QWidget(0, "valgrind widget"), _part( part )
+{
+ QVBoxLayout* vbl = new QVBoxLayout( this );
+ lv = new KListView( this );
+ lv->addColumn( i18n( "No." ) );
+ lv->addColumn( i18n( "Thread" ) );
+ lv->addColumn( i18n( "Message" ) );
+ lv->setSorting( 0, false );
+ lv->setRootIsDecorated( true );
+ lv->setAllColumnsShowFocus( true );
+ vbl->addWidget( lv );
+
+ popup = new QPopupMenu( lv, "valPopup" );
+ popup->insertItem( i18n( "&Open Valgrind Output..." ), _part, SLOT(loadOutput()), 0, 0 );
+ popup->insertSeparator();
+ popup->insertItem( i18n( "Expand All Items" ), this, SLOT(expandAll()), 0, 2 );
+ popup->insertItem( i18n( "Collapse All Items" ), this, SLOT(collapseAll()), 0, 3 );
+
+ connect( popup, SIGNAL(aboutToShow()),
+ this, SLOT(aboutToShowPopup()) );
+ connect( lv, SIGNAL(executed(QListViewItem*)),
+ this, SLOT(executed(QListViewItem*)) );
+ connect( lv, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
+ this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
+}
+
+
+ValgrindWidget::~ValgrindWidget()
+{
+}
+
+void ValgrindWidget::clear()
+{
+ lv->clear();
+ msgNumber = 1;
+}
+
+void ValgrindWidget::addMessage( const ValgrindItem& vi )
+{
+ QStringList projectFiles;
+ QString projectDirectory;
+
+ ValListViewItem* lvi = new ValListViewItem( lv, msgNumber++, vi.pid(), vi.message() );
+ lvi->setMultiLinesEnabled( true );
+ const ValgrindItem::BacktraceList backtrace = vi.backtrace();
+ if ( !backtrace.isEmpty() )
+ lvi->setExpandable( true );
+
+ int i = 0;
+ for ( ValgrindItem::BacktraceList::ConstIterator it = backtrace.begin(); it != backtrace.end(); ++it ) {
+ new ValListViewItem( lvi, ++i, (*it).pid(), (*it).message(), (*it).url(), (*it).line(), (*it).isHighlighted() );
+ }
+}
+
+void ValgrindWidget::executed( QListViewItem* lvi )
+{
+ Q_ASSERT( _part );
+ Q_ASSERT( _part->partController() );
+ Q_ASSERT( _part->mainWindow() );
+
+ if ( !lvi || lvi->rtti() != VALLISTVIEWITEMRTTI )
+ return;
+ ValListViewItem* vli = 0;
+ if ( !((ValListViewItem*)lvi)->fileName().isEmpty() ) {
+ vli = (ValListViewItem*)lvi;
+ } else if ( lvi->isExpandable() ) {
+ // find the memleak position
+ QListViewItemIterator it( lv );
+ while ( vli == 0 && it.current() ) {
+ if ( it.current()->rtti() == VALLISTVIEWITEMRTTI && ((ValListViewItem*)it.current())->isHighlighted() )
+ vli = (ValListViewItem*)it.current();
+ ++it;
+ }
+ }
+ if ( vli ) {
+ // display the file
+ _part->partController()->editDocument( KURL( vli->fileName() ), vli->line() - 1 );
+ _part->mainWindow()->statusBar()->message( vli->message(), 10000 );
+ }
+}
+
+void ValgrindWidget::expandAll()
+{
+ QListViewItem* child = lv->firstChild();
+ while ( child ) {
+ child->setOpen( true );
+ child = child->nextSibling();
+ }
+}
+
+void ValgrindWidget::collapseAll()
+{
+ QListViewItem* child = lv->firstChild();
+ while ( child ) {
+ child->setOpen( false );
+ child = child->nextSibling();
+ }
+}
+
+void ValgrindWidget::aboutToShowPopup()
+{
+ bool en = (lv->firstChild() != 0);
+ popup->setItemEnabled( 2, en );
+ popup->setItemEnabled( 3, en );
+}
+
+void ValgrindWidget::slotContextMenu( KListView* l, QListViewItem* /*i*/, const QPoint& p )
+{
+ if ( l != lv )
+ return;
+
+ popup->exec( p );
+}
+
+#include "valgrind_widget.moc"
diff --git a/parts/valgrind/valgrind_widget.h b/parts/valgrind/valgrind_widget.h
new file mode 100644
index 00000000..1777e183
--- /dev/null
+++ b/parts/valgrind/valgrind_widget.h
@@ -0,0 +1,44 @@
+#ifndef __VALGRIND_WIDGET_H__
+#define __VALGRIND_WIDGET_H__
+
+#include <qwidget.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+#include "valgrinditem.h"
+
+class ValgrindPart;
+class KListView;
+class QListViewItem;
+class QPopupMenu;
+
+class ValgrindWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ValgrindWidget( ValgrindPart *part );
+ ~ValgrindWidget();
+
+ void addMessage( const ValgrindItem& vi );
+ void clear();
+
+signals:
+ void jumpToFile( const QString& url, int line );
+
+private slots:
+ void executed( QListViewItem* item );
+ void slotContextMenu( KListView* l, QListViewItem* i, const QPoint& p );
+ void expandAll();
+ void collapseAll();
+ void aboutToShowPopup();
+
+private:
+ KListView* lv;
+ int msgNumber;
+ ValgrindPart* _part;
+ QPopupMenu* popup;
+};
+
+
+#endif
diff --git a/parts/valgrind/valgrinditem.cpp b/parts/valgrind/valgrinditem.cpp
new file mode 100644
index 00000000..318254d3
--- /dev/null
+++ b/parts/valgrind/valgrinditem.cpp
@@ -0,0 +1,71 @@
+#include "valgrinditem.h"
+
+#include <qregexp.h>
+#include <qstringlist.h>
+
+#include <kdebug.h>
+
+ValgrindBacktraceItem::ValgrindBacktraceItem( const QString& rawOutput ): _rawOutput( rawOutput ), _highlight( false )
+{
+ QRegExp re1( "^==(\\d+)==\\s+(by|at) (0x[\\dABCDEF]+): (.*) \\((.*):(\\d+)\\)$" );
+ QRegExp re2( "^==(\\d+)==\\s+(by|at) (0x[\\dABCDEF]+): (.*) \\(in (.*)\\)$" );
+ QRegExp valRe( "==(\\d+)== (.*)" );
+ if ( valRe.search( _rawOutput ) >= 0 )
+ _message = valRe.cap( 2 );
+ if ( re1.search( _rawOutput ) >= 0 ) {
+ _type = SourceCode;
+ _pid = re1.cap( 1 ).toInt();
+ _address = re1.cap( 3 );
+ _function = re1.cap( 4 );
+ _url = re1.cap( 5 );
+ _line = re1.cap( 6 ).toInt();
+ } else if ( re2.search( _rawOutput ) >= 0 ) {
+ _type = Library;
+ _pid = re2.cap( 1 ).toInt();
+ _address = re2.cap( 3 );
+ _function = re2.cap( 4 );
+ _url = re2.cap( 5 );
+ _line = -1;
+ } else {
+ _type = Unknown;
+ _line = -1;
+ _pid = -1;
+ }
+}
+
+ValgrindBacktraceItem::~ValgrindBacktraceItem()
+{
+}
+
+
+ValgrindItem::ValgrindItem( const QString& message ): _pid(-1)
+{
+ QRegExp valRe( "==(\\d+)== (.*)" );
+ QStringList lines = QStringList::split( "\n", message );
+ QString curMsg;
+
+ for ( QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it ) {
+ if ( valRe.search( *it ) < 0 ) {
+ kdDebug() << "ValgrindItem: got unrecognizable line '" << *it << "'" << endl;
+ continue; // not of interest
+ }
+ if ( _pid == -1 )
+ _pid = valRe.cap( 1 ).toInt();
+ curMsg = valRe.cap( 2 );
+
+ if ( curMsg.startsWith( " " ) ) {
+ _backtrace.append( ValgrindBacktraceItem( *it ) );
+ } else {
+ if ( !_message.isEmpty() )
+ _message += "\n";
+ _message += curMsg;
+ }
+ }
+// static int i = 0;
+// kdDebug() << "got: " << ++i << ": " << _message << endl << message << endl;
+}
+
+
+ValgrindItem::~ValgrindItem()
+{
+}
diff --git a/parts/valgrind/valgrinditem.h b/parts/valgrind/valgrinditem.h
new file mode 100644
index 00000000..12784c42
--- /dev/null
+++ b/parts/valgrind/valgrinditem.h
@@ -0,0 +1,50 @@
+#ifndef _VALGRINDITEM_H_
+#define _VALGRINDITEM_H_
+
+#include <qvaluelist.h>
+#include <qstring.h>
+
+class ValgrindBacktraceItem
+{
+public:
+ enum Type { Unknown, SourceCode, Library };
+ ValgrindBacktraceItem( const QString& rawOutput = QString::null );
+ ~ValgrindBacktraceItem();
+
+ QString message() const { return _message; }
+ QString address() const { return _address; }
+ QString url() const { return _url; }
+ QString function() const { return _function; }
+ int line() const { return _line; }
+ int pid() const { return _pid; }
+ Type type() const { return _type; }
+ bool isHighlighted() const { return _highlight; }
+ void setHighlighted( bool h ) { _highlight = h; }
+
+private:
+ QString _rawOutput, _address, _url, _function, _message;
+ int _line;
+ int _pid;
+ Type _type;
+ bool _highlight;
+};
+
+class ValgrindItem
+{
+public:
+ ValgrindItem( const QString& message );
+ ~ValgrindItem();
+
+ typedef QValueList<ValgrindBacktraceItem> BacktraceList;
+ BacktraceList& backtrace() { return _backtrace; }
+ const BacktraceList& backtrace() const { return _backtrace; }
+ QString message() const { return _message; }
+ int pid() const { return _pid; }
+
+private:
+ BacktraceList _backtrace;
+ QString _message;
+ int _pid;
+};
+
+#endif
diff --git a/parts/vcsmanager/Makefile.am b/parts/vcsmanager/Makefile.am
new file mode 100644
index 00000000..c3d19403
--- /dev/null
+++ b/parts/vcsmanager/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevvcsmanager.la
+libkdevvcsmanager_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevvcsmanager_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevvcsmanager_la_SOURCES = vcsmanagerpart.cpp \
+ vcsmanagerprojectconfigbase.ui vcsmanagerprojectconfig.cpp
+
+METASOURCES = AUTO
+
+appsharedir = $(kde_datadir)/kdevvcsmanager
+appshare_DATA =
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevvcsmanager.desktop
+
+rcdir = $(kde_datadir)/kdevvcsmanager
+
diff --git a/parts/vcsmanager/README.dox b/parts/vcsmanager/README.dox
new file mode 100644
index 00000000..1e6c6327
--- /dev/null
+++ b/parts/vcsmanager/README.dox
@@ -0,0 +1,55 @@
+/** \class VCSManager
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:jens.dagerbo@swipnet.se">Jens Dagerbo</a>
+\authors <a href="mailto:2nd author AT provider.com">2nd author full name</a>
+...
+\authors <a href="mailto:nth author AT provider.com">nth author full name</a>
+
+\maintainer <a href="mailto:jens.dagerbo@swipnet.se">Jens Dagerbo</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug bugs in <a href="http://bugs.kde.org/buglist.cgi?product=kdevelop&component=YOUR_COMPONENT_NAME&
+bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=Bug+Number">
+YOUR_COMPONENT_NAME at Bugzilla database</a>
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/vcsmanager/kdevvcsmanager.desktop b/parts/vcsmanager/kdevvcsmanager.desktop
new file mode 100644
index 00000000..ca647ba3
--- /dev/null
+++ b/parts/vcsmanager/kdevvcsmanager.desktop
@@ -0,0 +1,65 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Name=KDevVCSManager
+Name[da]=KDevelop VCS-håndtering
+Name[nds]=KDevelop-VKS-Pleger
+Name[sk]=KDev VCS manažér
+Name[sv]=KDevelop VCS-hantering
+Name[tg]=РоҳбариKDevVCS
+Name[zh_TW]=KDevelop VCS 管理器
+GenericName=VCSManager
+GenericName[da]=VCS-håndtering
+GenericName[fa]=مدیر VCS
+GenericName[nds]=VKS-Pleger
+GenericName[ru]=Управление системами контроля версий
+GenericName[sk]=VCS manažér
+GenericName[sl]=Upravitelj VCS
+GenericName[sr]=VCS менаџер
+GenericName[sr@Latn]=VCS menadžer
+GenericName[sv]=VCS-hantering
+GenericName[tg]=РоҳбариVCS
+GenericName[zh_TW]=VCS 管理員
+Comment=Version Control System Manager
+Comment[ca]=Gestor per al sistema de control de versions
+Comment[da]=Versionskontrolsystem-håndtering
+Comment[de]=Verwaltung für VCS
+Comment[el]=Διαχειριστής συστήματος ελέγχου εκδόσεων
+Comment[es]=Administrador de sistemas de control de versiones
+Comment[et]=Versioonikontrollisüsteemi haldur
+Comment[eu]=Version Control System (VCS) kudeatzailea
+Comment[fa]=مدیر سیستم کنترل نسخه
+Comment[fr]=Gestionnaire du système de contrôle de versions
+Comment[gl]=Xestor do Sistema de control de versións
+Comment[hu]=Kezelőfelület verziókövető rendszerekhez
+Comment[it]=Gestore Sistema Controllo Versione
+Comment[ms]=Pengurus Sistem Kawalan Versi
+Comment[nds]=VKS-Pleger
+Comment[ne]=संस्करण नियन्त्रण प्रणाली प्रबन्धक
+Comment[nl]=Versie Controle Systeem-beheerder
+Comment[pl]=Menedżer Systemu kontroli wersji
+Comment[pt]=Gestor de Sistema de Controlo de Versão
+Comment[pt_BR]=Gerenciador do Sistema de Controle de Versão
+Comment[ru]=Управление системами контроля версий
+Comment[sk]=Manažér systému riadenia verzií
+Comment[sl]=Upravitelj sistema za nadzor različic
+Comment[sr]=Менаџер система контроле верзија
+Comment[sr@Latn]=Menadžer sistema kontrole verzija
+Comment[sv]=Hantering av versionskontrollsystem
+Comment[tr]=Sürüm Kontrol Sistemi Yöneticisi
+Comment[zh_CN]=版本控制系统管理器
+Comment[zh_TW]=版本控制系統管理員
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+
+X-KDevelop-Plugin-Version=1
+X-KDevelop-Plugin-Homepage=
+X-KDevelop-Plugin-BugsEmailAddress=jens.dagerbo@swipnet.se
+X-KDevelop-Plugin-Copyright=(C) by Jens Dagerbo
+
+X-KDevelop-Args=
+
+X-KDevelop-Scope=Core
+X-KDE-Library=libkdevvcsmanager
+X-KDevelop-Version=5
+X-KDevelop-Properties=VCS
diff --git a/parts/vcsmanager/vcsmanagerpart.cpp b/parts/vcsmanager/vcsmanagerpart.cpp
new file mode 100644
index 00000000..1cafb8eb
--- /dev/null
+++ b/parts/vcsmanager/vcsmanagerpart.cpp
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "vcsmanagerpart.h"
+
+#include <qtimer.h>
+#include <qpopupmenu.h>
+#include <qwhatsthis.h>
+
+#include <klocale.h>
+#include <kaction.h>
+#include <kdialogbase.h>
+#include <kiconloader.h>
+#include <kmessagebox.h>
+#include <kdevplugininfo.h>
+#include <kdevgenericfactory.h>
+#include <kdebug.h>
+
+#include <kdevcore.h>
+#include <kdevmainwindow.h>
+#include <configwidgetproxy.h>
+#include <kdevplugincontroller.h>
+#include "domutil.h"
+
+#include "vcsmanagerprojectconfig.h"
+
+typedef KDevGenericFactory<VCSManagerPart> VCSManagerFactory;
+KDevPluginInfo data("kdevvcsmanager");
+K_EXPORT_COMPONENT_FACTORY( libkdevvcsmanager, VCSManagerFactory( data ) )
+
+#define GLOBALDOC_OPTIONS 1
+#define PROJECTDOC_OPTIONS 2
+
+VCSManagerPart::VCSManagerPart(QObject *parent, const char *name, const QStringList &/*args*/)
+ : KDevPlugin(&data, parent, name ? name : "VCSManagerPart")
+{
+ kdDebug() << " ********** VCSManagerPart::VCSManagerPart() ************** " << endl;
+
+ setInstance(VCSManagerFactory::instance());
+// setXMLFile("kdevvcsmanager.rc");
+
+ m_configProxy = new ConfigWidgetProxy(core());
+ m_configProxy->createProjectConfigPage(i18n("Version Control"), PROJECTDOC_OPTIONS, info()->icon());
+ connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
+ this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int)));
+
+ connect(core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()));
+}
+
+VCSManagerPart::~VCSManagerPart()
+{
+ delete m_configProxy;
+}
+
+void VCSManagerPart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo)
+{
+ switch (pageNo)
+ {
+ case PROJECTDOC_OPTIONS:
+ {
+ VCSManagerProjectConfig *w = new VCSManagerProjectConfig(this, page, "project config");
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+ break;
+ }
+ }
+}
+
+void VCSManagerPart::projectOpened()
+{
+ loadVCSPlugin();
+}
+
+void VCSManagerPart::loadVCSPlugin()
+{
+ unloadVCSPlugin();
+
+ QDomDocument & dom = *projectDom();
+ m_vcsPluginName = DomUtil::readEntry( dom, "/general/versioncontrol" ).stripWhiteSpace();
+ if ( m_vcsPluginName.isEmpty() ) return;
+
+ QString constraint = QString( "DesktopEntryName=='%1'" ).arg( m_vcsPluginName );
+ pluginController()->loadPlugin( "KDevelop/VersionControl", constraint );
+}
+
+void VCSManagerPart::unloadVCSPlugin()
+{
+ if ( !m_vcsPluginName.isEmpty() )
+ {
+ pluginController()->unloadPlugin( m_vcsPluginName );
+ }
+}
+
+QString VCSManagerPart::vcsPlugin()
+{
+ return m_vcsPluginName;
+}
+
+#include "vcsmanagerpart.moc"
diff --git a/parts/vcsmanager/vcsmanagerpart.h b/parts/vcsmanager/vcsmanagerpart.h
new file mode 100644
index 00000000..631373da
--- /dev/null
+++ b/parts/vcsmanager/vcsmanagerpart.h
@@ -0,0 +1,57 @@
+/***************************************************************************
+* Copyright (C) 2005 by Jens Dagerbo *
+* jens.dagerbo@swipnet.se *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
+
+#ifndef KDEVVCSMANAGER_H
+#define KDEVVCSMANAGER_H
+
+#include <kdevplugin.h>
+
+#include <qguardedptr.h>
+
+class QPopupMenu;
+class KAction;
+class KDialogBase;
+class Context;
+class ConfigWidgetProxy;
+class VCSManagerWidget;
+
+/**
+Please read the README.dox file for more info about this part
+*/
+class VCSManagerPart: public KDevPlugin
+{
+ Q_OBJECT
+public:
+ VCSManagerPart(QObject *parent, const char *name, const QStringList &args);
+ ~VCSManagerPart();
+ QString vcsPlugin();
+ void loadVCSPlugin();
+ void unloadVCSPlugin();
+
+private slots:
+ void insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo);
+ void projectOpened();
+
+private:
+ QString m_vcsPluginName;
+ ConfigWidgetProxy *m_configProxy;
+};
+
+#endif
diff --git a/parts/vcsmanager/vcsmanagerprojectconfig.cpp b/parts/vcsmanager/vcsmanagerprojectconfig.cpp
new file mode 100644
index 00000000..07986a88
--- /dev/null
+++ b/parts/vcsmanager/vcsmanagerprojectconfig.cpp
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Jens Dagerbo *
+ * jens.dagerbo@swipnet.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <qcombobox.h>
+#include <qstring.h>
+
+#include <ktrader.h>
+#include <klocale.h>
+
+#include "domutil.h"
+
+#include "vcsmanagerprojectconfig.h"
+#include "vcsmanagerpart.h"
+
+VCSManagerProjectConfig::VCSManagerProjectConfig( VCSManagerPart *part, QWidget *parent, const char *name )
+ : VCSManagerProjectConfigBase( parent, name ), m_part( part )
+{
+ setup();
+}
+
+void VCSManagerProjectConfig::accept()
+{
+ QString vcsPluginName = *m_vcsPluginNames.at( vcsCombo->currentItem() );
+
+ QDomDocument & dom = *m_part->projectDom();
+ DomUtil::writeEntry( dom, "/general/versioncontrol", vcsPluginName );
+
+ m_part->loadVCSPlugin();
+}
+
+void VCSManagerProjectConfig::setup( )
+{
+ vcsCombo->insertItem( i18n("No Version Control System", "None"), 0 );
+ m_vcsPluginNames << "";
+
+ int current = 0;
+
+ QString constraint = QString("[X-KDevelop-Version] == %1").arg(KDEVELOP_PLUGIN_VERSION);
+ KTrader::OfferList offers = KTrader::self()->query("KDevelop/VersionControl", constraint );
+ KTrader::OfferList::const_iterator it = offers.begin();
+ for ( int i = 1; it != offers.end(); ++it, ++i )
+ {
+ vcsCombo->insertItem( (*it)->genericName(), i );
+ m_vcsPluginNames << (*it)->desktopEntryName();
+ if ( (*it)->desktopEntryName() == m_part->vcsPlugin() )
+ {
+ current = i;
+ }
+ }
+ vcsCombo->setCurrentItem( current );
+}
+
+#include "vcsmanagerprojectconfig.moc"
diff --git a/parts/vcsmanager/vcsmanagerprojectconfig.h b/parts/vcsmanager/vcsmanagerprojectconfig.h
new file mode 100644
index 00000000..b1558008
--- /dev/null
+++ b/parts/vcsmanager/vcsmanagerprojectconfig.h
@@ -0,0 +1,45 @@
+/***************************************************************************
+* Copyright (C) 2005 by Jens Dagerbo *
+* jens.dagerbo@swipnet.se *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
+
+#ifndef VCSMANAGER_PROJECT_CONFIG_H
+#define VCSMANAGER_PROJECT_CONFIG_H
+
+#include <ktrader.h>
+#include "vcsmanagerprojectconfigbase.h"
+
+class VCSManagerPart;
+
+class VCSManagerProjectConfig: public VCSManagerProjectConfigBase
+{
+ Q_OBJECT
+public:
+ VCSManagerProjectConfig( VCSManagerPart *part, QWidget *parent = 0, const char *name = 0);
+
+public slots:
+ void accept();
+
+private:
+ void setup();
+
+ VCSManagerPart * m_part;
+ QStringList m_vcsPluginNames;
+};
+
+#endif
diff --git a/parts/vcsmanager/vcsmanagerprojectconfigbase.ui b/parts/vcsmanager/vcsmanagerprojectconfigbase.ui
new file mode 100644
index 00000000..735a018f
--- /dev/null
+++ b/parts/vcsmanager/vcsmanagerprojectconfigbase.ui
@@ -0,0 +1,58 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>VCSManagerProjectConfigBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>VCSManagerProjectConfigBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string></string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Version control system to use for this project:</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>vcsCombo</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>31</width>
+ <height>131</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>