From dfe289850f068f19ba4a83ab4e7e22a7e09c13c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:21 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdespell2/tests/test_dialog.cpp | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tdespell2/tests/test_dialog.cpp (limited to 'tdespell2/tests/test_dialog.cpp') diff --git a/tdespell2/tests/test_dialog.cpp b/tdespell2/tests/test_dialog.cpp new file mode 100644 index 000000000..19503e307 --- /dev/null +++ b/tdespell2/tests/test_dialog.cpp @@ -0,0 +1,65 @@ +/** + * test_dialog.cpp + * + * Copyright (C) 2004 Zack Rusin + * + * 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ +#include "test_dialog.h" +#include "test_dialog.moc" + +#include "backgroundchecker.h" +#include "dictionary.h" +#include "filter.h" + +#include +#include +using namespace KSpell2; + +TestDialog::TestDialog() + : TQObject( 0, "testdialog" ) +{ + +} + +void TestDialog::check( const TQString& buffer ) +{ + KSpell2::Dialog *dlg = new KSpell2::Dialog( + new BackgroundChecker( Broker::openBroker(), this, "checker" ), + 0, "my dialog" ); + connect( dlg, TQT_SIGNAL(done(const TQString&)), + TQT_SLOT(doneChecking(const TQString&)) ); + dlg->setBuffer( buffer ); + dlg->show(); +} + +void TestDialog::doneChecking( const TQString& buf ) +{ + kdDebug()<<"Done with :"<quit(); +} + +int main( int argc, char** argv ) +{ + TDEApplication app(argc, argv, "KSpell2Test"); + + TestDialog test; + test.check( "This is a sample buffer. Whih this thingg will " + "be checkin for misstakes. Whih, Enviroment, govermant. Whih." + ); + + return app.exec(); +} -- cgit v1.2.3 From 8bd62a3b0d3b362b783a273e2460811392485bbd Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 14 Feb 2013 17:17:18 -0600 Subject: Rename common header files for consistency with class renaming --- KDE2PORTING.html | 2 +- KDE3PORTING.html | 2 +- arts/kde/kaudioconverter.cc | 2 +- arts/kde/kconverttest.cc | 6 +- arts/kde/kioinputstream_impl.cpp | 2 +- arts/kde/kiotest.cc | 6 +- arts/kde/kiotestslow.cc | 6 +- arts/kde/mcop-dcop/kmcop.cpp | 4 +- arts/knotify/knotify.cpp | 4 +- arts/knotify/knotifytest.cpp | 2 +- arts/message/artsmessage.cc | 6 +- dcop/HOWTO | 2 +- dcop/dcop_deadlock_test.h | 2 +- dcop/tests/driver.cpp | 4 +- dcop/tests/test.cpp | 4 +- dnssd/domainbrowser.cpp | 2 +- interfaces/tdeimproxy/library/tdeimproxy.cpp | 2 +- interfaces/tdescript/sample/shellscript.cpp | 2 +- interfaces/tdescript/scriptloader.cpp | 2 +- interfaces/tdescript/scriptmanager.cpp | 2 +- interfaces/tdetexteditor/editorchooser.cpp | 2 +- interfaces/terminal/test/main.cc | 6 +- kab/addressbook.cc | 2 +- kabc/address.cpp | 2 +- kabc/addressbook.cpp | 2 +- kabc/key.cpp | 2 +- kabc/ldapclient.cpp | 2 +- kabc/lock.cpp | 2 +- kabc/phonenumber.cpp | 2 +- kabc/plugins/dir/resourcedir.cpp | 2 +- kabc/plugins/file/resourcefile.cpp | 2 +- kabc/scripts/addressee.src.cpp | 2 +- kabc/stdaddressbook.cpp | 2 +- kabc/tdeab2tdeabc.cpp | 6 +- kabc/tests/bigread.cpp | 6 +- kabc/tests/bigwrite.cpp | 6 +- kabc/tests/kabcargl.cpp | 6 +- kabc/tests/testaddressee.cpp | 6 +- kabc/tests/testaddresseelist.cpp | 6 +- kabc/tests/testaddressfmt.cpp | 6 +- kabc/tests/testaddresslineedit.cpp | 6 +- kabc/tests/testdb.cpp | 6 +- kabc/tests/testdistlist.cpp | 6 +- kabc/tests/testkabc.cpp | 6 +- kabc/tests/testkabcdlg.cpp | 6 +- kabc/tests/testldapclient.cpp | 4 +- kabc/tests/testlock.cpp | 6 +- kabc/vcard/testwrite.cpp | 6 +- kabc/vcardparser/testread.cpp | 6 +- kabc/vcardparser/testwrite.cpp | 6 +- kate/part/kateconfig.cpp | 2 +- kate/part/katedialogs.cpp | 2 +- kate/part/katedocument.cpp | 2 +- kate/part/katefactory.h | 2 +- kate/part/katehighlight.cpp | 2 +- kate/part/kateprinter.cpp | 2 +- kate/part/kateschema.cpp | 4 +- kate/part/kateview.cpp | 2 +- kate/part/kateviewhelpers.cpp | 2 +- kate/part/kateviewinternal.cpp | 2 +- kate/part/test_regression.cpp | 4 +- kate/plugins/autobookmarker/autobookmarker.cpp | 2 +- kate/plugins/wordcompletion/docwordcompletion.cpp | 2 +- kded/kded.cpp | 4 +- kded/khostname.cpp | 6 +- kded/tde-menu.cpp | 6 +- kded/tdebuildsycoca.cpp | 6 +- kded/tdemimelist.cpp | 2 +- kdewidgets/makekdewidgets.cpp | 4 +- kdoctools/meinproc.cpp | 4 +- kimgio/eps.cpp | 2 +- kinit/kinit.cpp | 2 +- kinit/tdelauncher_main.cpp | 4 +- kinit/tests/tdelaunchertest.cpp | 2 +- knewstuff/downloaddialog.cpp | 2 +- knewstuff/engine.cpp | 2 +- knewstuff/ghns.cpp | 6 +- knewstuff/ghns.h | 2 +- knewstuff/knewstuff.cpp | 2 +- knewstuff/tdehotnewstuff.cpp | 6 +- knewstuff/testnewstuff.cpp | 6 +- knewstuff/testnewstuff.h | 2 +- knewstuff/uploaddialog.cpp | 2 +- kstyles/asteroid/asteroid.h | 2 +- kstyles/highcolor/highcolor.h | 2 +- kstyles/highcontrast/highcontrast.cpp | 6 +- kstyles/highcontrast/highcontrast.h | 2 +- kstyles/keramik/keramik.h | 2 +- kstyles/klegacy/klegacystyle.h | 2 +- kstyles/kthemestyle/kthemebase.h | 2 +- kstyles/light/lightstyle-v2.h | 2 +- kstyles/light/lightstyle-v3.h | 2 +- kstyles/plastik/plastik.h | 2 +- kstyles/utils/installtheme/main.cpp | 4 +- kstyles/web/webstyle.cpp | 2 +- kstyles/web/webstyle.h | 2 +- libtdescreensaver/main.cpp | 4 +- libtdescreensaver/tdescreensaver.cpp | 2 +- networkstatus/connectionmanager.cpp | 2 +- networkstatus/networkstatus.cpp | 2 +- networkstatus/testservice.cpp | 2 +- tdecert/tdecertpart.cc | 2 +- tdecmshell/main.cpp | 6 +- tdecmshell/main.h | 2 +- tdeconf_update/tdeconf_update.cpp | 4 +- tdecore/CMakeLists.txt | 8 +- tdecore/MAINTAINERS | 6 +- tdecore/Makefile.am | 8 +- tdecore/kaboutdata.cpp | 512 --- tdecore/kaboutdata.h | 630 ---- tdecore/kapp.h | 6 +- tdecore/kappdcopiface.cpp | 2 +- tdecore/kapplication.cpp | 3638 -------------------- tdecore/kapplication.h | 1620 --------- tdecore/kapplication_win.cpp | 2 +- tdecore/kcharsets.cpp | 2 +- tdecore/kclipboard.cpp | 2 +- tdecore/kcmdlineargs.cpp | 1298 ------- tdecore/kcmdlineargs.h | 690 ---- tdecore/kcompletion.cpp | 2 +- tdecore/kcrash.cpp | 4 +- tdecore/kdebug.cpp | 2 +- tdecore/kdesktopfile.cpp | 2 +- tdecore/kdetcompmgr.cpp | 6 +- tdecore/kglobal.cpp | 4 +- tdecore/kglobalaccel_win.cpp | 2 +- tdecore/kglobalaccel_x11.cpp | 2 +- tdecore/kglobalsettings.cpp | 2 +- tdecore/kiconloader.cpp | 2 +- tdecore/kinstance.cpp | 2 +- tdecore/klibloader.cpp | 2 +- tdecore/klockfile.cpp | 4 +- tdecore/kmanagerselection.cpp | 2 +- tdecore/knotifyclient.cpp | 4 +- tdecore/kprotocolinfo_tdecore.cpp | 2 +- tdecore/kprotocolinfofactory.cpp | 2 +- tdecore/krandomsequence.cpp | 2 +- tdecore/krootprop.cpp | 2 +- tdecore/ksavefile.cpp | 2 +- tdecore/ksimpledirwatch.cpp | 2 +- tdecore/ksocks.cpp | 2 +- tdecore/kstartupinfo.cpp | 2 +- tdecore/ktempdir.cpp | 2 +- tdecore/ktempfile.cpp | 2 +- tdecore/kuniqueapplication.cpp | 4 +- tdecore/kuniqueapplication.h | 4 +- tdecore/kxmessages.cpp | 2 +- tdecore/network/kresolverstandardworkers.cpp | 2 +- tdecore/network/ksockssocketdevice.cpp | 2 +- tdecore/tde-config.cpp.cmake | 6 +- tdecore/tde-config.cpp.in | 6 +- tdecore/tdeaboutdata.cpp | 512 +++ tdecore/tdeaboutdata.h | 630 ++++ tdecore/tdeaccel.cpp | 2 +- tdecore/tdeapplication.cpp | 3638 ++++++++++++++++++++ tdecore/tdeapplication.h | 1620 +++++++++ tdecore/tdecmdlineargs.cpp | 1298 +++++++ tdecore/tdecmdlineargs.h | 690 ++++ tdecore/tdeconfig.cpp | 2 +- tdecore/tdeconfig_compiler/example/autoexample.cpp | 6 +- tdecore/tdeconfig_compiler/example/example.cpp | 6 +- tdecore/tdeconfig_compiler/tdeconfig_compiler.cpp | 6 +- tdecore/tdeconfigbackend.cpp | 2 +- tdecore/tdeconfigbase.cpp | 2 +- tdecore/tdeconfigdialogmanager.cpp | 2 +- tdecore/tdehardwaredevices.cpp | 2 +- tdecore/tdesycoca.cpp | 2 +- tdecore/tests/KIDLTest.cpp | 2 +- tdecore/tests/KIDLTestClient.cpp | 2 +- tdecore/tests/dcopkonqtest.cpp | 2 +- tdecore/tests/kapptest.cpp | 6 +- tdecore/tests/kcalendartest.cpp | 6 +- tdecore/tests/kcmdlineargstest.cpp | 4 +- tdecore/tests/kglobaltest.cpp | 4 +- tdecore/tests/kiconloadertest.cpp | 2 +- tdecore/tests/kipctest.cpp | 2 +- tdecore/tests/klocaletest.cpp | 2 +- tdecore/tests/kmacroexpandertest.cpp | 4 +- tdecore/tests/kmdcodectest.cpp | 4 +- tdecore/tests/kmemtest.cpp | 2 +- tdecore/tests/knotifytest.cpp | 2 +- tdecore/tests/kprocesstest.cpp | 2 +- tdecore/tests/kprociotest.cpp | 2 +- tdecore/tests/krandomsequencetest.cpp | 2 +- tdecore/tests/kresolvertest.cpp | 4 +- tdecore/tests/krfcdatetest.cpp | 2 +- tdecore/tests/ksimpleconfigtest.cpp | 2 +- tdecore/tests/ksocktest.cpp | 4 +- tdecore/tests/kstddirstest.cpp | 2 +- tdecore/tests/ktempfiletest.cpp | 2 +- tdecore/tests/ktimezonestest.cpp | 2 +- tdecore/tests/kuniqueapptest.cpp | 4 +- tdecore/tests/kurltest.cpp | 4 +- tdecore/tests/startserviceby.cpp | 6 +- tdecore/tests/tdeconfigtestgui.cpp | 2 +- tdecore/tests/tdeconfigtestgui.h | 2 +- tdecore/tests/tdestdacceltest.cpp | 2 +- tdecore/tests/testqtargs.cpp | 8 +- tdecore/twin.cpp | 2 +- tdecore/twinmodule.cpp | 2 +- tdefx/CMakeLists.txt | 4 +- tdefx/Makefile.am | 4 +- tdefx/kstyle.cpp | 2418 ------------- tdefx/kstyle.h | 383 --- tdefx/tdestylen.cpp | 2418 +++++++++++++ tdefx/tdestylen.h | 383 +++ tdehtml/ecma/kjs_debugwin.cpp | 2 +- tdehtml/html/html_documentimpl.cpp | 2 +- tdehtml/html/html_formimpl.cpp | 2 +- tdehtml/java/kjavaappletserver.cpp | 2 +- tdehtml/java/kjavaappletviewer.cpp | 4 +- tdehtml/java/tests/testkjavaappletserver.cpp | 4 +- tdehtml/misc/helper.cpp | 2 +- tdehtml/misc/loader.cpp | 2 +- tdehtml/rendering/render_frames.cpp | 2 +- tdehtml/rendering/render_image.cpp | 2 +- tdehtml/tdehtml_ext.cpp | 2 +- tdehtml/tdehtml_factory.cpp | 2 +- tdehtml/tdehtml_part.cpp | 2 +- tdehtml/tdehtmlview.cpp | 2 +- tdehtml/tdemultipart/tdemultipart.h | 2 +- tdehtml/test_regression.cpp | 4 +- tdehtml/test_regression_fontoverload.cpp | 2 +- tdehtml/testtdehtml.cpp | 4 +- tdehtml/xml/dom_docimpl.cpp | 2 +- tdeio/bookmarks/kbookmark.cc | 2 +- tdeio/bookmarks/kbookmarkimporter_crash.cc | 2 +- tdeio/bookmarks/kbookmarkmanager.cc | 2 +- tdeio/bookmarks/kbookmarkmenu.cc | 2 +- tdeio/kpasswdserver/kpasswdserver.cpp | 2 +- tdeio/kssl/ksslcertdlg.cc | 2 +- tdeio/kssl/ksslinfodlg.cc | 2 +- tdeio/kssl/ksslkeygen.cc | 2 +- tdeio/misc/kpac/proxyscout.cpp | 2 +- tdeio/misc/tdefile/fileprops.cpp | 6 +- tdeio/misc/tdemailservice.cpp | 4 +- tdeio/misc/tdentlm/tdentlm.cpp | 2 +- tdeio/misc/tdesendbugmail/main.cpp | 6 +- tdeio/misc/tdetelnetservice.cpp | 4 +- tdeio/misc/tdewalletd/tdewalletd.cpp | 2 +- tdeio/misc/uiserver.cpp | 4 +- tdeio/tdefile/kcombiview.cpp | 2 +- tdeio/tdefile/kdiroperator.cpp | 2 +- tdeio/tdefile/kdirselectdialog.cpp | 2 +- tdeio/tdefile/kicondialog.cpp | 2 +- tdeio/tdefile/kimagefilepreview.cpp | 2 +- tdeio/tdefile/knotifydialog.cpp | 4 +- tdeio/tdefile/kopenwith.cpp | 2 +- tdeio/tdefile/kpropertiesdialog.cpp | 2 +- tdeio/tdefile/kurlbar.cpp | 2 +- tdeio/tdefile/tdefiledetailview.cpp | 2 +- tdeio/tdefile/tdefiledialog.cpp | 4 +- tdeio/tdefile/tdefileiconview.cpp | 2 +- tdeio/tdefile/tdefilesharedlg.cpp | 2 +- tdeio/tdefile/tdefileview.cpp | 2 +- tdeio/tdefile/tderecentdocument.cpp | 2 +- tdeio/tdefile/tests/kcustommenueditortest.cpp | 2 +- tdeio/tdefile/tests/kdirselectdialogtest.cpp | 2 +- tdeio/tdefile/tests/kfdtest.cpp | 2 +- tdeio/tdefile/tests/kfstest.cpp | 2 +- tdeio/tdefile/tests/kicondialogtest.cpp | 2 +- tdeio/tdefile/tests/knotifytest.cpp | 2 +- tdeio/tdefile/tests/kopenwithtest.cpp | 2 +- tdeio/tdefile/tests/kurlrequestertest.cpp | 2 +- tdeio/tdefile/tests/tdefiletreeviewtest.cpp | 2 +- tdeio/tdeio/defaultprogress.cpp | 2 +- tdeio/tdeio/job.cpp | 2 +- tdeio/tdeio/kdcopservicestarter.cpp | 2 +- tdeio/tdeio/kdirlister.cpp | 2 +- tdeio/tdeio/kdirwatch.cpp | 2 +- tdeio/tdeio/kimageio.cpp | 2 +- tdeio/tdeio/kmessageboxwrapper.h | 2 +- tdeio/tdeio/kmimemagic.cpp | 2 +- tdeio/tdeio/kmimetype.cpp | 2 +- tdeio/tdeio/kprotocolmanager.h | 2 +- tdeio/tdeio/krun.cpp | 2 +- tdeio/tdeio/kservice.cpp | 2 +- tdeio/tdeio/kservicetypefactory.cpp | 2 +- tdeio/tdeio/kshred.cpp | 2 +- tdeio/tdeio/kurlcompletion.cpp | 2 +- tdeio/tdeio/kuserprofile.cpp | 2 +- tdeio/tdeio/netaccess.cpp | 2 +- tdeio/tdeio/observer.cpp | 2 +- tdeio/tdeio/previewjob.cpp | 2 +- tdeio/tdeio/renamedlg.cpp | 2 +- tdeio/tdeio/skipdlg.cpp | 2 +- tdeio/tdeio/slave.cpp | 2 +- tdeio/tdeio/slavebase.cpp | 2 +- tdeio/tdeio/slaveinterface.cpp | 2 +- tdeio/tdeio/statusbarprogress.cpp | 2 +- tdeio/tdeio/tcpslavebase.cpp | 2 +- tdeio/tdeioexec/main.cpp | 6 +- tdeio/tests/getalltest.cpp | 2 +- tdeio/tests/jobtest.cpp | 4 +- tdeio/tests/kacltest.cpp | 4 +- tdeio/tests/kdcopcheck.cpp | 2 +- tdeio/tests/kdefaultprogresstest.cpp | 2 +- tdeio/tests/kdirlistertest.cpp | 2 +- tdeio/tests/kdirwatchtest.cpp | 2 +- tdeio/tests/kdirwatchtest.h | 2 +- tdeio/tests/kdirwatchunittest.h | 2 +- tdeio/tests/kionetrctest.cpp | 6 +- tdeio/tests/kiopassdlgtest.cpp | 6 +- tdeio/tests/kmimefromext.cpp | 4 +- tdeio/tests/kpropsdlgtest.cpp | 6 +- tdeio/tests/kprotocolinfotest.cpp | 6 +- tdeio/tests/kruntest.cpp | 2 +- tdeio/tests/kscantest.cpp | 2 +- tdeio/tests/kurifiltertest.cpp | 6 +- tdeio/tests/kurlcompletiontest.cpp | 4 +- tdeio/tests/metatest.cpp | 4 +- tdeio/tests/netaccesstest.cpp | 2 +- tdeio/tests/previewtest.cpp | 2 +- tdeio/tests/speed.cpp | 4 +- tdeio/tests/tdeioslavetest.cpp | 4 +- tdeio/tests/tdesycocatest.cpp | 2 +- tdeio/tests/tdesycocaupdatetest.cpp | 2 +- tdeio/tests/tdetradertest.cpp | 4 +- tdeioslave/http/http.cc | 2 +- tdeioslave/http/http_cache_cleaner.cpp | 2 +- tdeioslave/http/kcookiejar/kcookieserver.cpp | 4 +- tdeioslave/http/kcookiejar/kcookiewin.cpp | 2 +- tdeioslave/http/kcookiejar/main.cpp | 4 +- .../http/kcookiejar/tests/kcookiejartest.cpp | 6 +- tdeioslave/metainfo/metainfo.cpp | 2 +- tdelfeditor/tdelfeditor.cpp | 6 +- tdemdi/tdemdi/dockcontainer.cpp | 2 +- tdemdi/tdemdi/guiclient.cpp | 2 +- tdemdi/tdemdi/mainwindow.cpp | 2 +- tdemdi/tdemdidockcontainer.cpp | 2 +- tdemdi/tdemdiguiclient.cpp | 2 +- tdemdi/tdemdimainfrm.cpp | 2 +- tdemdi/test/main.cpp | 2 +- tdeparts/genericfactory.h | 2 +- tdeparts/historyprovider.cpp | 2 +- tdeparts/tests/example.cpp | 2 +- tdeparts/tests/ghostview.cpp | 4 +- tdeparts/tests/normalktm.cpp | 2 +- tdeparts/tests/notepad.cpp | 4 +- tdeparts/tests/parts.cpp | 2 +- tdeprint/cups/cupsdconf2/main.cpp | 4 +- tdeprint/cups/cupsinfos.cpp | 2 +- tdeprint/cups/kmcupsmanager.cpp | 2 +- tdeprint/kmfactory.cpp | 2 +- tdeprint/kmmanager.cpp | 2 +- tdeprint/kpcopiespage.cpp | 2 +- tdeprint/kpfilterpage.cpp | 2 +- tdeprint/kprintdialog.cpp | 2 +- tdeprint/kprinter.cpp | 2 +- tdeprint/kprinterimpl.cpp | 2 +- tdeprint/kprintpreview.cpp | 2 +- tdeprint/kprintprocess.cpp | 2 +- tdeprint/lpr/matichandler.cpp | 2 +- tdeprint/management/kaddprinterwizard.cpp | 4 +- tdeprint/management/kmdbcreator.cpp | 2 +- tdeprint/management/kmdriverdb.cpp | 2 +- tdeprint/management/kmjobviewer.cpp | 2 +- tdeprint/management/kmmainview.cpp | 2 +- tdeprint/management/kmwdrivertest.cpp | 2 +- tdeprint/management/kmwizard.cpp | 2 +- tdeprint/management/kmwsocketutil.cpp | 2 +- tdeprint/management/kxmlcommanddlg.cpp | 2 +- tdeprint/messagewindow.cpp | 2 +- tdeprint/tdeprintd.cpp | 2 +- tdeprint/tests/drawdemo.cpp | 2 +- tdeprint/tests/main.cpp | 2 +- tderandr/libtderandr.cc | 2 +- tderandr/randr.cpp | 2 +- tderesources/configpage.cpp | 2 +- tderesources/kcmtderesources.cpp | 2 +- tderesources/managerimpl.cpp | 4 +- tderesources/resource.cpp | 2 +- tderesources/testresources.cpp | 6 +- tdersync/rsyncconfigdialog.cpp | 2 +- tdersync/tdersync.h | 2 +- tdespell2/tests/backgroundtest.cpp | 2 +- tdespell2/tests/test.cpp | 2 +- tdespell2/tests/test_config.cpp | 2 +- tdespell2/tests/test_configdialog.cpp | 2 +- tdespell2/tests/test_dialog.cpp | 2 +- tdespell2/tests/test_filter.cpp | 2 +- tdespell2/tests/test_highlighter.cpp | 2 +- tdesu/client.cpp | 2 +- tdesu/stub.cpp | 2 +- tdeui/CMakeLists.txt | 10 +- tdeui/MAINTAINERS | 6 +- tdeui/Makefile.am | 10 +- tdeui/kaboutapplication.cpp | 188 - tdeui/kaboutapplication.h | 94 - tdeui/kaboutdialog.cpp | 1797 ---------- tdeui/kaboutdialog.h | 633 ---- tdeui/kaboutkde.cpp | 87 - tdeui/kaboutkde.h | 62 - tdeui/kactivelabel.cpp | 2 +- tdeui/kbugreport.cpp | 4 +- tdeui/kcharselect.cpp | 2 +- tdeui/kcolorcombo.cpp | 2 +- tdeui/kcolordialog.cpp | 2 +- tdeui/kdatepicker.cpp | 2 +- tdeui/kdatetbl.cpp | 2 +- tdeui/kdcopactionproxy.cpp | 2 +- tdeui/kdetrayproxy/kdetrayproxy.cpp | 4 +- tdeui/kdialog.cpp | 2 +- tdeui/kdialogbase.cpp | 2 +- tdeui/keditcl1.cpp | 2 +- tdeui/keditcl2.cpp | 2 +- tdeui/keditlistbox.cpp | 2 +- tdeui/khelpmenu.cpp | 8 +- tdeui/kiconview.cpp | 2 +- tdeui/kjanuswidget.cpp | 2 +- tdeui/kkeybutton.cpp | 2 +- tdeui/kkeydialog.cpp | 4 +- tdeui/kled.cpp | 2 +- tdeui/klineedit.cpp | 2 +- tdeui/klineeditdlg.cpp | 2 +- tdeui/kmenubar.cpp | 2 +- tdeui/kmessagebox.cpp | 2 +- tdeui/kpanelapplet.cpp | 2 +- tdeui/kpanelappmenu.cpp | 2 +- tdeui/kpassdlg.cpp | 4 +- tdeui/kprogress.cpp | 2 +- tdeui/kprogressbox.cpp | 2 +- tdeui/kpushbutton.cpp | 2 +- tdeui/krootpixmap.cpp | 2 +- tdeui/ksconfig.cpp | 2 +- tdeui/kseparator.cpp | 2 +- tdeui/ksharedpixmap.cpp | 2 +- tdeui/kstdaction.cpp | 4 +- tdeui/kstdguiitem.cpp | 2 +- tdeui/ksyntaxhighlighter.cpp | 2 +- tdeui/ksystemtray.cpp | 4 +- tdeui/ktextbrowser.cpp | 2 +- tdeui/ktip.cpp | 4 +- tdeui/kwhatsthismanager.cpp | 2 +- tdeui/kxmlguibuilder.cpp | 2 +- tdeui/kxmlguiclient.cpp | 2 +- tdeui/tdeaboutapplication.cpp | 188 + tdeui/tdeaboutapplication.h | 94 + tdeui/tdeaboutdialog.cpp | 1797 ++++++++++ tdeui/tdeaboutdialog.h | 633 ++++ tdeui/tdeabouttde.cpp | 87 + tdeui/tdeabouttde.h | 62 + tdeui/tdeaction.cpp | 2 +- tdeui/tdeactionclasses.cpp | 2 +- tdeui/tdeactioncollection.cpp | 2 +- tdeui/tdecmodule.cpp | 2 +- tdeui/tdefontdialog.cpp | 2 +- tdeui/tdelistbox.cpp | 2 +- tdeui/tdelistview.cpp | 2 +- tdeui/tdemainwindow.cpp | 2 +- tdeui/tdemainwindowiface.cpp | 2 +- tdeui/tdepopupmenu.cpp | 2 +- tdeui/tdeshortcutdialog.cpp | 2 +- tdeui/tdespell.cpp | 2 +- tdeui/tdespelldlg.cpp | 2 +- tdeui/tdetoolbar.cpp | 2 +- tdeui/tdetoolbarbutton.cpp | 2 +- tdeui/tdetoolbarhandler.cpp | 2 +- tdeui/tests/itemcontainertest.cpp | 2 +- tdeui/tests/kaboutdialogtest.cpp | 4 +- tdeui/tests/kblendtest.cpp | 2 +- tdeui/tests/kbuttonboxtest.cpp | 2 +- tdeui/tests/kcharselecttest.cpp | 2 +- tdeui/tests/kcolordlgtest.cpp | 2 +- tdeui/tests/kcolortest.cpp | 2 +- tdeui/tests/kcomboboxtest.cpp | 2 +- tdeui/tests/kcompletiontest.cpp | 2 +- tdeui/tests/kdatepicktest.cpp | 2 +- tdeui/tests/kdatetimewidgettest.cpp | 2 +- tdeui/tests/kdatewidgettest.cpp | 2 +- tdeui/tests/kdesattest.cpp | 2 +- tdeui/tests/kdialogbasetest.cpp | 2 +- tdeui/tests/kdocktest.cpp | 2 +- tdeui/tests/kdockwidgetdemo.cpp | 2 +- tdeui/tests/kdockwidgettest.cpp | 2 +- tdeui/tests/kdualcolortest.cpp | 2 +- tdeui/tests/keditlistboxtest.cpp | 2 +- tdeui/tests/kedittest.cpp | 2 +- tdeui/tests/kgradienttest.cpp | 2 +- tdeui/tests/khashtest.cpp | 2 +- tdeui/tests/kinputdialogtest.cpp | 2 +- tdeui/tests/kjanuswidgettest.cpp | 2 +- tdeui/tests/kledtest.cpp | 2 +- tdeui/tests/klineeditdlgtest.cpp | 2 +- tdeui/tests/klineedittest.cpp | 6 +- tdeui/tests/kmessageboxtest.cpp | 2 +- tdeui/tests/knuminputtest.cpp | 2 +- tdeui/tests/kpalettetest.cpp | 2 +- tdeui/tests/kpanelmenutest.cpp | 2 +- tdeui/tests/kpixmapregionselectordialogtest.cpp | 4 +- tdeui/tests/kprogresstest.cpp | 2 +- tdeui/tests/krulertest.h | 2 +- tdeui/tests/kseparatortest.cpp | 2 +- tdeui/tests/ksqueezedtextlabeltest.cpp | 2 +- tdeui/tests/kstatusbartest.cpp | 2 +- tdeui/tests/ksystemtraytest.cpp | 2 +- tdeui/tests/ktabctltest.cpp | 2 +- tdeui/tests/ktabwidgettest.cpp | 4 +- tdeui/tests/ktextedittest.cpp | 2 +- tdeui/tests/ktimewidgettest.cpp | 2 +- tdeui/tests/kunbalancedgrdtest.cpp | 2 +- tdeui/tests/kwizardtest.cpp | 2 +- tdeui/tests/kwordwraptest.cpp | 2 +- tdeui/tests/kxmlguitest.cpp | 2 +- tdeui/tests/tdeactiontest.cpp | 2 +- tdeui/tests/tdefontdialogtest.cpp | 2 +- tdeui/tests/tdelistviewtest.cpp | 2 +- tdeui/tests/tdemainwindowrestoretest.cpp | 2 +- tdeui/tests/tdemainwindowtest.cpp | 2 +- tdeui/tests/tdepopuptest.cpp | 2 +- tdeui/tests/tdespelltest.cpp | 2 +- tdeui/tests/tdetoolbarlabelactiontest.cpp | 2 +- tdeui/tests/twindowtest.cpp | 4 +- tdeui/twindowlistmenu.cpp | 4 +- tdeunittest/modrunner.cpp | 4 +- tdeunittest/tester.h | 8 +- tdeutils/kcmultidialog.cpp | 4 +- tdeutils/kfind.cpp | 2 +- tdeutils/kreplace.cpp | 2 +- tdeutils/tdecmoduleloader.cpp | 2 +- tdeutils/tdecmoduleproxy.cpp | 4 +- tdeutils/tdecmoduleproxyIfaceImpl.cpp | 2 +- tdeutils/tests/kfindtest.cpp | 4 +- tdeutils/tests/kreplacetest.cpp | 4 +- tdewallet/backend/tests/backendtest.cpp | 2 +- tdewallet/tests/tdewalletasync.cpp | 6 +- tdewallet/tests/tdewalletboth.cpp | 6 +- tdewallet/tests/tdewalletsync.cpp | 6 +- .../thinkeramik/widget-engine/thinkeramik_rel.pro | 4 +- win/pro_files/tdecore/tdecore.pro | 6 +- win/pro_files/tdefx/tdefx.pro | 2 +- win/pro_files/tdefx/tdefx_rel.pro | 4 +- win/pro_files/tdeui/tdeui.pro | 6 +- 533 files changed, 14767 insertions(+), 14767 deletions(-) delete mode 100644 tdecore/kaboutdata.cpp delete mode 100644 tdecore/kaboutdata.h delete mode 100644 tdecore/kapplication.cpp delete mode 100644 tdecore/kapplication.h delete mode 100644 tdecore/kcmdlineargs.cpp delete mode 100644 tdecore/kcmdlineargs.h create mode 100644 tdecore/tdeaboutdata.cpp create mode 100644 tdecore/tdeaboutdata.h create mode 100644 tdecore/tdeapplication.cpp create mode 100644 tdecore/tdeapplication.h create mode 100644 tdecore/tdecmdlineargs.cpp create mode 100644 tdecore/tdecmdlineargs.h delete mode 100644 tdefx/kstyle.cpp delete mode 100644 tdefx/kstyle.h create mode 100644 tdefx/tdestylen.cpp create mode 100644 tdefx/tdestylen.h delete mode 100644 tdeui/kaboutapplication.cpp delete mode 100644 tdeui/kaboutapplication.h delete mode 100644 tdeui/kaboutdialog.cpp delete mode 100644 tdeui/kaboutdialog.h delete mode 100644 tdeui/kaboutkde.cpp delete mode 100644 tdeui/kaboutkde.h create mode 100644 tdeui/tdeaboutapplication.cpp create mode 100644 tdeui/tdeaboutapplication.h create mode 100644 tdeui/tdeaboutdialog.cpp create mode 100644 tdeui/tdeaboutdialog.h create mode 100644 tdeui/tdeabouttde.cpp create mode 100644 tdeui/tdeabouttde.h (limited to 'tdespell2/tests/test_dialog.cpp') diff --git a/KDE2PORTING.html b/KDE2PORTING.html index 1c8f95e38..b375854de 100644 --- a/KDE2PORTING.html +++ b/KDE2PORTING.html @@ -175,7 +175,7 @@ or this page online.

certain option was specified on the command line and your application now automatically supports --help and --version. It aborts with a useful error message when the command line contains a syntax error. - See tdelibs/tdecore/kcmdlineargs.h for more info.

+ See tdelibs/tdecore/tdecmdlineargs.h for more info.

Return to the Table of Contents

diff --git a/KDE3PORTING.html b/KDE3PORTING.html index edd317c11..47246adb8 100644 --- a/KDE3PORTING.html +++ b/KDE3PORTING.html @@ -73,7 +73,7 @@ instead, everything else is source compatible.

Header file names

    -
  • kapp.h is now kapplication.h
  • +
  • kapp.h is now tdeapplication.h
  • kuniqueapp.h is now kuniqueapplication.h
  • kstddirs.h is now kstandarddirs.h
  • kcolorbtn.h is now kcolorbutton.h
  • diff --git a/arts/kde/kaudioconverter.cc b/arts/kde/kaudioconverter.cc index c5a526db6..1eb8c20e5 100644 --- a/arts/kde/kaudioconverter.cc +++ b/arts/kde/kaudioconverter.cc @@ -37,7 +37,7 @@ #include #include #include -#include +#include using namespace std; diff --git a/arts/kde/kconverttest.cc b/arts/kde/kconverttest.cc index 42fd98072..70c4b7918 100644 --- a/arts/kde/kconverttest.cc +++ b/arts/kde/kconverttest.cc @@ -4,9 +4,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/arts/kde/kioinputstream_impl.cpp b/arts/kde/kioinputstream_impl.cpp index bf6b3654a..d893675cd 100644 --- a/arts/kde/kioinputstream_impl.cpp +++ b/arts/kde/kioinputstream_impl.cpp @@ -29,7 +29,7 @@ * until the buffer is small enough again. */ -#include +#include #include #include #include diff --git a/arts/kde/kiotest.cc b/arts/kde/kiotest.cc index cb26a649f..01ce8f3f1 100644 --- a/arts/kde/kiotest.cc +++ b/arts/kde/kiotest.cc @@ -1,10 +1,10 @@ #include #include -#include +#include #include #include -#include -#include +#include +#include #include "qiomanager.h" #include "artskde.h" diff --git a/arts/kde/kiotestslow.cc b/arts/kde/kiotestslow.cc index ffeceafd5..df6ed645f 100644 --- a/arts/kde/kiotestslow.cc +++ b/arts/kde/kiotestslow.cc @@ -1,10 +1,10 @@ #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include "qiomanager.h" #include "artskde.h" diff --git a/arts/kde/mcop-dcop/kmcop.cpp b/arts/kde/mcop-dcop/kmcop.cpp index 0ba9b48a4..d134aeca4 100644 --- a/arts/kde/mcop-dcop/kmcop.cpp +++ b/arts/kde/mcop-dcop/kmcop.cpp @@ -18,8 +18,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/arts/knotify/knotify.cpp b/arts/knotify/knotify.cpp index a5b736608..3d0e45d02 100644 --- a/arts/knotify/knotify.cpp +++ b/arts/knotify/knotify.cpp @@ -44,12 +44,12 @@ // KDE headers #include -#include +#include #ifndef WITHOUT_ARTS #include #include #endif -#include +#include #include #include #include diff --git a/arts/knotify/knotifytest.cpp b/arts/knotify/knotifytest.cpp index 232b1b8c7..0f370d80a 100644 --- a/arts/knotify/knotifytest.cpp +++ b/arts/knotify/knotifytest.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include int main(int argc, char **argv) diff --git a/arts/message/artsmessage.cc b/arts/message/artsmessage.cc index 389d09bf9..4eb62f1fb 100644 --- a/arts/message/artsmessage.cc +++ b/arts/message/artsmessage.cc @@ -33,10 +33,10 @@ Gnome, etc. and used instead. #include #include -#include -#include +#include +#include #include -#include +#include // command line options static TDECmdLineOptions options[] = diff --git a/dcop/HOWTO b/dcop/HOWTO index 7126d3c1d..4c98b6df2 100644 --- a/dcop/HOWTO +++ b/dcop/HOWTO @@ -491,7 +491,7 @@ A few back-of-the-napkin tests folks: Code: -#include +#include int main(int argc, char **argv) { diff --git a/dcop/dcop_deadlock_test.h b/dcop/dcop_deadlock_test.h index 0557e7062..461c53cba 100644 --- a/dcop/dcop_deadlock_test.h +++ b/dcop/dcop_deadlock_test.h @@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _TESTDCOP_H_ #define _TESTDCOP_H_ -#include +#include #include #include diff --git a/dcop/tests/driver.cpp b/dcop/tests/driver.cpp index eb953f1d7..18b983829 100644 --- a/dcop/tests/driver.cpp +++ b/dcop/tests/driver.cpp @@ -1,8 +1,8 @@ #include "driver.h" -#include +#include #include #include -#include +#include #include #include diff --git a/dcop/tests/test.cpp b/dcop/tests/test.cpp index 2be39f601..4a751c358 100644 --- a/dcop/tests/test.cpp +++ b/dcop/tests/test.cpp @@ -1,8 +1,8 @@ #include "test.h" -#include +#include #include #include -#include +#include diff --git a/dnssd/domainbrowser.cpp b/dnssd/domainbrowser.cpp index 2afadb769..229d56f7f 100644 --- a/dnssd/domainbrowser.cpp +++ b/dnssd/domainbrowser.cpp @@ -26,7 +26,7 @@ #include "remoteservice.h" #include "query.h" #include "servicebrowser.h" -#include +#include #ifdef HAVE_DNSSD #ifdef AVAHI_API_0_6 #include diff --git a/interfaces/tdeimproxy/library/tdeimproxy.cpp b/interfaces/tdeimproxy/library/tdeimproxy.cpp index a65388974..c4d77c61e 100644 --- a/interfaces/tdeimproxy/library/tdeimproxy.cpp +++ b/interfaces/tdeimproxy/library/tdeimproxy.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/interfaces/tdescript/sample/shellscript.cpp b/interfaces/tdescript/sample/shellscript.cpp index 9ec34f7a2..766613551 100644 --- a/interfaces/tdescript/sample/shellscript.cpp +++ b/interfaces/tdescript/sample/shellscript.cpp @@ -19,7 +19,7 @@ #include "shellscript.h" #include -#include +#include #include #include diff --git a/interfaces/tdescript/scriptloader.cpp b/interfaces/tdescript/scriptloader.cpp index 65b6604b5..ad6c8df20 100644 --- a/interfaces/tdescript/scriptloader.cpp +++ b/interfaces/tdescript/scriptloader.cpp @@ -18,7 +18,7 @@ */ #include "scriptloader.h" -#include +#include #include #include #include diff --git a/interfaces/tdescript/scriptmanager.cpp b/interfaces/tdescript/scriptmanager.cpp index cd20655d0..42e20cd5b 100644 --- a/interfaces/tdescript/scriptmanager.cpp +++ b/interfaces/tdescript/scriptmanager.cpp @@ -1,7 +1,7 @@ #include "scriptmanager.h" #include #include -#include +#include #include #include diff --git a/interfaces/tdetexteditor/editorchooser.cpp b/interfaces/tdetexteditor/editorchooser.cpp index 331e64bbb..aed904c54 100644 --- a/interfaces/tdetexteditor/editorchooser.cpp +++ b/interfaces/tdetexteditor/editorchooser.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include "editorchooser_ui.h" diff --git a/interfaces/terminal/test/main.cc b/interfaces/terminal/test/main.cc index 19b820056..bcce6fdbc 100644 --- a/interfaces/terminal/test/main.cc +++ b/interfaces/terminal/test/main.cc @@ -3,9 +3,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kab/addressbook.cc b/kab/addressbook.cc index 0408a4db7..ab73111be 100644 --- a/kab/addressbook.cc +++ b/kab/addressbook.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include #include diff --git a/kabc/address.cpp b/kabc/address.cpp index 2fce393e0..46b483b43 100644 --- a/kabc/address.cpp +++ b/kabc/address.cpp @@ -20,7 +20,7 @@ #include "address.h" -#include +#include #include #include #include diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index b31df2b73..8e1eca333 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/kabc/key.cpp b/kabc/key.cpp index fadc89dce..7c66579b3 100644 --- a/kabc/key.cpp +++ b/kabc/key.cpp @@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include "key.h" diff --git a/kabc/ldapclient.cpp b/kabc/ldapclient.cpp index f696ae915..1c2b2d833 100644 --- a/kabc/ldapclient.cpp +++ b/kabc/ldapclient.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/kabc/lock.cpp b/kabc/lock.cpp index 42c8c8580..8f64a3c23 100644 --- a/kabc/lock.cpp +++ b/kabc/lock.cpp @@ -20,7 +20,7 @@ #include "lock.h" -#include +#include #include #include #include diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 0a58eeec2..adf8566f1 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp @@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include "phonenumber.h" diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index 6b1759f1d..936eea6e4 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 2d2008c0d..7c99782c3 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/kabc/scripts/addressee.src.cpp b/kabc/scripts/addressee.src.cpp index b235a70ae..9aff3a708 100644 --- a/kabc/scripts/addressee.src.cpp +++ b/kabc/scripts/addressee.src.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include "addresseehelper.h" diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index f3c5b5c0e..c887fcb83 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include #include diff --git a/kabc/tdeab2tdeabc.cpp b/kabc/tdeab2tdeabc.cpp index 5472f3bc2..f03a80f45 100644 --- a/kabc/tdeab2tdeabc.cpp +++ b/kabc/tdeab2tdeabc.cpp @@ -22,9 +22,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kabc/tests/bigread.cpp b/kabc/tests/bigread.cpp index bb19379bb..5ea2393dc 100644 --- a/kabc/tests/bigread.cpp +++ b/kabc/tests/bigread.cpp @@ -1,10 +1,10 @@ #include -#include -#include +#include +#include #include #include -#include +#include #include "addressbook.h" #include "vcardformat.h" diff --git a/kabc/tests/bigwrite.cpp b/kabc/tests/bigwrite.cpp index b1f705eb9..167f5d44d 100644 --- a/kabc/tests/bigwrite.cpp +++ b/kabc/tests/bigwrite.cpp @@ -1,10 +1,10 @@ #include -#include -#include +#include +#include #include #include -#include +#include #include "addressbook.h" #include "vcardformat.h" diff --git a/kabc/tests/kabcargl.cpp b/kabc/tests/kabcargl.cpp index 62b1df25e..589c973f2 100644 --- a/kabc/tests/kabcargl.cpp +++ b/kabc/tests/kabcargl.cpp @@ -22,10 +22,10 @@ #include #include -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/kabc/tests/testaddressee.cpp b/kabc/tests/testaddressee.cpp index 956af2b75..09f95d29b 100644 --- a/kabc/tests/testaddressee.cpp +++ b/kabc/tests/testaddressee.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include #include "addressbook.h" diff --git a/kabc/tests/testaddresseelist.cpp b/kabc/tests/testaddresseelist.cpp index be14da540..10fa4aaef 100644 --- a/kabc/tests/testaddresseelist.cpp +++ b/kabc/tests/testaddresseelist.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include #include "addressbook.h" diff --git a/kabc/tests/testaddressfmt.cpp b/kabc/tests/testaddressfmt.cpp index 0c4ae1439..ca13a116c 100644 --- a/kabc/tests/testaddressfmt.cpp +++ b/kabc/tests/testaddressfmt.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include #include "addressbook.h" diff --git a/kabc/tests/testaddresslineedit.cpp b/kabc/tests/testaddresslineedit.cpp index 474b5fc7a..7315aef7e 100644 --- a/kabc/tests/testaddresslineedit.cpp +++ b/kabc/tests/testaddresslineedit.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include "addresslineedit.h" diff --git a/kabc/tests/testdb.cpp b/kabc/tests/testdb.cpp index 4759a4bd2..fd4e4f6c1 100644 --- a/kabc/tests/testdb.cpp +++ b/kabc/tests/testdb.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include "addressbook.h" #include "vcardformat.h" diff --git a/kabc/tests/testdistlist.cpp b/kabc/tests/testdistlist.cpp index 18e223e9a..0f0e90f90 100644 --- a/kabc/tests/testdistlist.cpp +++ b/kabc/tests/testdistlist.cpp @@ -1,10 +1,10 @@ #include -#include -#include +#include +#include #include #include -#include +#include #include "stdaddressbook.h" diff --git a/kabc/tests/testkabc.cpp b/kabc/tests/testkabc.cpp index b8b9fe3b5..3caea88f1 100644 --- a/kabc/tests/testkabc.cpp +++ b/kabc/tests/testkabc.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include #include diff --git a/kabc/tests/testkabcdlg.cpp b/kabc/tests/testkabcdlg.cpp index 183c6a19d..24225cc1b 100644 --- a/kabc/tests/testkabcdlg.cpp +++ b/kabc/tests/testkabcdlg.cpp @@ -1,10 +1,10 @@ #include -#include -#include +#include +#include #include #include -#include +#include #include "addresseedialog.h" diff --git a/kabc/tests/testldapclient.cpp b/kabc/tests/testldapclient.cpp index bb52afd1a..df9fd6226 100644 --- a/kabc/tests/testldapclient.cpp +++ b/kabc/tests/testldapclient.cpp @@ -18,9 +18,9 @@ #include "testldapclient.h" -#include +#include #include -#include +#include #include diff --git a/kabc/tests/testlock.cpp b/kabc/tests/testlock.cpp index 389819ea7..632c690a6 100644 --- a/kabc/tests/testlock.cpp +++ b/kabc/tests/testlock.cpp @@ -23,11 +23,11 @@ #include "stdaddressbook.h" -#include -#include +#include +#include #include #include -#include +#include #include #include diff --git a/kabc/vcard/testwrite.cpp b/kabc/vcard/testwrite.cpp index fe218c0b1..67f8eb20a 100644 --- a/kabc/vcard/testwrite.cpp +++ b/kabc/vcard/testwrite.cpp @@ -1,8 +1,8 @@ -#include -#include +#include +#include #include #include -#include +#include #include diff --git a/kabc/vcardparser/testread.cpp b/kabc/vcardparser/testread.cpp index ebe5f14b2..6c3405ef9 100644 --- a/kabc/vcardparser/testread.cpp +++ b/kabc/vcardparser/testread.cpp @@ -25,10 +25,10 @@ #include #include -#include -#include +#include +#include #include -#include +#include #include "vcardconverter.h" #include "vcard.h" diff --git a/kabc/vcardparser/testwrite.cpp b/kabc/vcardparser/testwrite.cpp index 73d462d4a..5a58bd8a8 100644 --- a/kabc/vcardparser/testwrite.cpp +++ b/kabc/vcardparser/testwrite.cpp @@ -24,9 +24,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/kate/part/kateconfig.cpp b/kate/part/kateconfig.cpp index d1c9fd1ee..9c8e0856f 100644 --- a/kate/part/kateconfig.cpp +++ b/kate/part/kateconfig.cpp @@ -27,7 +27,7 @@ #include -#include +#include #include #include #include diff --git a/kate/part/katedialogs.cpp b/kate/part/katedialogs.cpp index 35a836072..03257735c 100644 --- a/kate/part/katedialogs.cpp +++ b/kate/part/katedialogs.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include #include diff --git a/kate/part/katedocument.cpp b/kate/part/katedocument.cpp index 22a207fac..1928ec225 100644 --- a/kate/part/katedocument.cpp +++ b/kate/part/katedocument.cpp @@ -51,7 +51,7 @@ #include #include -#include +#include #include #include #include diff --git a/kate/part/katefactory.h b/kate/part/katefactory.h index bca0fe8a9..72fef8781 100644 --- a/kate/part/katefactory.h +++ b/kate/part/katefactory.h @@ -24,7 +24,7 @@ #include #include -#include +#include // katepart version must be a string in double quotes, format: "x.x" #define KATEPART_VERSION "2.5" diff --git a/kate/part/katehighlight.cpp b/kate/part/katehighlight.cpp index 3c84007eb..f6d5ae315 100644 --- a/kate/part/katehighlight.cpp +++ b/kate/part/katehighlight.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include diff --git a/kate/part/kateprinter.cpp b/kate/part/kateprinter.cpp index 77ed4dcca..6f22b2407 100644 --- a/kate/part/kateprinter.cpp +++ b/kate/part/kateprinter.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include // for spacingHint() diff --git a/kate/part/kateschema.cpp b/kate/part/kateschema.cpp index 8f4f03a10..388513f17 100644 --- a/kate/part/kateschema.cpp +++ b/kate/part/kateschema.cpp @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/kate/part/kateview.cpp b/kate/part/kateview.cpp index dc82922a3..92d1bb97e 100644 --- a/kate/part/kateview.cpp +++ b/kate/part/kateview.cpp @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kate/part/kateviewhelpers.cpp b/kate/part/kateviewhelpers.cpp index ef70e3449..e8df70aa8 100644 --- a/kate/part/kateviewhelpers.cpp +++ b/kate/part/kateviewhelpers.cpp @@ -32,7 +32,7 @@ #include "kateview.h" #include "kateviewinternal.h" -#include +#include #include #include #include diff --git a/kate/part/kateviewinternal.cpp b/kate/part/kateviewinternal.cpp index bea6ba3bc..a687c5523 100644 --- a/kate/part/kateviewinternal.cpp +++ b/kate/part/kateviewinternal.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include diff --git a/kate/part/test_regression.cpp b/kate/part/test_regression.cpp index 5c10143ea..a503020c3 100644 --- a/kate/part/test_regression.cpp +++ b/kate/part/test_regression.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -40,7 +40,7 @@ #include #include -#include +#include #include "katefactory.h" #include #include diff --git a/kate/plugins/autobookmarker/autobookmarker.cpp b/kate/plugins/autobookmarker/autobookmarker.cpp index 4e0d70b86..495233d40 100644 --- a/kate/plugins/autobookmarker/autobookmarker.cpp +++ b/kate/plugins/autobookmarker/autobookmarker.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/kate/plugins/wordcompletion/docwordcompletion.cpp b/kate/plugins/wordcompletion/docwordcompletion.cpp index 5041cc8ad..4a3d34207 100644 --- a/kate/plugins/wordcompletion/docwordcompletion.cpp +++ b/kate/plugins/wordcompletion/docwordcompletion.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include diff --git a/kded/kded.cpp b/kded/kded.cpp index 774712e0e..b6e6b523f 100644 --- a/kded/kded.cpp +++ b/kded/kded.cpp @@ -36,8 +36,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kded/khostname.cpp b/kded/khostname.cpp index 227106eea..7585e0ad0 100644 --- a/kded/khostname.cpp +++ b/kded/khostname.cpp @@ -28,10 +28,10 @@ #include -#include -#include +#include +#include #include -#include +#include #include #include #include diff --git a/kded/tde-menu.cpp b/kded/tde-menu.cpp index fa2d220af..4ad6bc3db 100644 --- a/kded/tde-menu.cpp +++ b/kded/tde-menu.cpp @@ -23,9 +23,9 @@ #include #include -#include "kaboutdata.h" -#include "kapplication.h" -#include "kcmdlineargs.h" +#include "tdeaboutdata.h" +#include "tdeapplication.h" +#include "tdecmdlineargs.h" #include "kglobal.h" #include "klocale.h" #include "kservice.h" diff --git a/kded/tdebuildsycoca.cpp b/kded/tdebuildsycoca.cpp index 74eba4a1b..aa03c2c94 100644 --- a/kded/tdebuildsycoca.cpp +++ b/kded/tdebuildsycoca.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include @@ -48,8 +48,8 @@ #include #include #include -#include -#include +#include +#include #include #ifdef KBUILDSYCOCA_GUI // KBUILDSYCOCA_GUI is used on win32 to build diff --git a/kded/tdemimelist.cpp b/kded/tdemimelist.cpp index c82f6d9f7..673520e52 100644 --- a/kded/tdemimelist.cpp +++ b/kded/tdemimelist.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include diff --git a/kdewidgets/makekdewidgets.cpp b/kdewidgets/makekdewidgets.cpp index e6208de0f..5e1338595 100644 --- a/kdewidgets/makekdewidgets.cpp +++ b/kdewidgets/makekdewidgets.cpp @@ -1,7 +1,7 @@ /* Copyright (C) 2004-2005 ian reinhart geiser */ -#include +#include #include -#include +#include #include #include #include diff --git a/kdoctools/meinproc.cpp b/kdoctools/meinproc.cpp index 730dd38d0..d0a1b7323 100644 --- a/kdoctools/meinproc.cpp +++ b/kdoctools/meinproc.cpp @@ -18,9 +18,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/kimgio/eps.cpp b/kimgio/eps.cpp index a323feace..d839ffe30 100644 --- a/kimgio/eps.cpp +++ b/kimgio/eps.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include "eps.h" diff --git a/kinit/kinit.cpp b/kinit/kinit.cpp index c1ba0920d..f6b4a3e59 100644 --- a/kinit/kinit.cpp +++ b/kinit/kinit.cpp @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #ifdef HAVE_SYS_PRCTL_H diff --git a/kinit/tdelauncher_main.cpp b/kinit/tdelauncher_main.cpp index 3ceadf84c..d59cfb86f 100644 --- a/kinit/tdelauncher_main.cpp +++ b/kinit/tdelauncher_main.cpp @@ -22,9 +22,9 @@ #include #include -#include "kapplication.h" +#include "tdeapplication.h" #include "tdelauncher.h" -#include "kcmdlineargs.h" +#include "tdecmdlineargs.h" #include "kcrash.h" #include "kdebug.h" #include diff --git a/kinit/tests/tdelaunchertest.cpp b/kinit/tests/tdelaunchertest.cpp index a8989870b..07eaf21f7 100644 --- a/kinit/tests/tdelaunchertest.cpp +++ b/kinit/tests/tdelaunchertest.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include #include diff --git a/knewstuff/downloaddialog.cpp b/knewstuff/downloaddialog.cpp index 4ca68fbcb..ccbde83d6 100644 --- a/knewstuff/downloaddialog.cpp +++ b/knewstuff/downloaddialog.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/knewstuff/engine.cpp b/knewstuff/engine.cpp index 063c2c7b9..a22750f8b 100644 --- a/knewstuff/engine.cpp +++ b/knewstuff/engine.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/knewstuff/ghns.cpp b/knewstuff/ghns.cpp index 6c0c2a9fc..dfe86a2a4 100644 --- a/knewstuff/ghns.cpp +++ b/knewstuff/ghns.cpp @@ -25,11 +25,11 @@ #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include diff --git a/knewstuff/ghns.h b/knewstuff/ghns.h index 727dc6a0f..74efc007e 100644 --- a/knewstuff/ghns.h +++ b/knewstuff/ghns.h @@ -25,7 +25,7 @@ #include -#include +#include #include #include "knewstuff.h" diff --git a/knewstuff/knewstuff.cpp b/knewstuff/knewstuff.cpp index 7727783bb..07034b454 100644 --- a/knewstuff/knewstuff.cpp +++ b/knewstuff/knewstuff.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include #include diff --git a/knewstuff/tdehotnewstuff.cpp b/knewstuff/tdehotnewstuff.cpp index 5a496328b..87d735330 100644 --- a/knewstuff/tdehotnewstuff.cpp +++ b/knewstuff/tdehotnewstuff.cpp @@ -18,11 +18,11 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include -#include -#include +#include +#include #include "downloaddialog.h" diff --git a/knewstuff/testnewstuff.cpp b/knewstuff/testnewstuff.cpp index db8e255ff..82b6d18f7 100644 --- a/knewstuff/testnewstuff.cpp +++ b/knewstuff/testnewstuff.cpp @@ -24,11 +24,11 @@ #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include diff --git a/knewstuff/testnewstuff.h b/knewstuff/testnewstuff.h index 3af0d68cc..a7bc5710f 100644 --- a/knewstuff/testnewstuff.h +++ b/knewstuff/testnewstuff.h @@ -25,7 +25,7 @@ #include -#include +#include #include #include "knewstuff.h" diff --git a/knewstuff/uploaddialog.cpp b/knewstuff/uploaddialog.cpp index 72ba4a2c4..98f8f60c7 100644 --- a/knewstuff/uploaddialog.cpp +++ b/knewstuff/uploaddialog.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include "engine.h" diff --git a/kstyles/asteroid/asteroid.h b/kstyles/asteroid/asteroid.h index 52d18291b..d6be130aa 100644 --- a/kstyles/asteroid/asteroid.h +++ b/kstyles/asteroid/asteroid.h @@ -7,7 +7,7 @@ #ifndef __ASTEROID_H #define __ASTEROID_H -#include +#include class AsteroidStyle : public TDEStyle { diff --git a/kstyles/highcolor/highcolor.h b/kstyles/highcolor/highcolor.h index 33ded2d17..7fa618a92 100644 --- a/kstyles/highcolor/highcolor.h +++ b/kstyles/highcolor/highcolor.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include enum GradientType{ VSmall=0, VMed, VLarge, HMed, HLarge, GradientCount }; diff --git a/kstyles/highcontrast/highcontrast.cpp b/kstyles/highcontrast/highcontrast.cpp index 0b2e677b1..af021a91a 100644 --- a/kstyles/highcontrast/highcontrast.cpp +++ b/kstyles/highcontrast/highcontrast.cpp @@ -776,7 +776,7 @@ void HighContrastStyle::drawTDEStylePrimitive (TDEStylePrimitive kpe, break; } case KPE_ListViewBranch: - // TODO Draw (thick) dotted line. Check kstyle.cpp + // TODO Draw (thick) dotted line. Check tdestyle.cpp // Fall down for now default: TDEStyle::drawTDEStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget); @@ -1194,7 +1194,7 @@ void HighContrastStyle::drawControlMask (TQ_ControlElement element, } // Helper to find the next sibling that's not hidden -// Lifted from kstyle.cpp +// Lifted from tdestyle.cpp static TQListViewItem* nextVisibleSibling(TQListViewItem* item) { TQListViewItem* sibling = item; @@ -1329,7 +1329,7 @@ void HighContrastStyle::drawComplexControl (TQ_ComplexControl control, // ------------------------------------------------------------------- case CC_ListView: { /* - * Sigh... Lifted and modified from kstyle.cpp + * Sigh... Lifted and modified from tdestyle.cpp */ /* * Many thanks to TrollTech AS for donating CC_ListView from TQWindowsStyle. diff --git a/kstyles/highcontrast/highcontrast.h b/kstyles/highcontrast/highcontrast.h index 1a721e8c6..552526254 100644 --- a/kstyles/highcontrast/highcontrast.h +++ b/kstyles/highcontrast/highcontrast.h @@ -41,7 +41,7 @@ #include #include #include -#include +#include class TQPopupMenu; diff --git a/kstyles/keramik/keramik.h b/kstyles/keramik/keramik.h index 02ec9499e..7bf8cd3d4 100644 --- a/kstyles/keramik/keramik.h +++ b/kstyles/keramik/keramik.h @@ -33,7 +33,7 @@ #define __keramik_h__ #include -#include +#include #include "pixmaploader.h" diff --git a/kstyles/klegacy/klegacystyle.h b/kstyles/klegacy/klegacystyle.h index ee3cecfe5..f82fd5d0a 100644 --- a/kstyles/klegacy/klegacystyle.h +++ b/kstyles/klegacy/klegacystyle.h @@ -25,7 +25,7 @@ #ifndef __KLegacyStyle_hh #define __KLegacyStyle_hh -#include +#include // forward declaration class KLegacyStylePrivate; diff --git a/kstyles/kthemestyle/kthemebase.h b/kstyles/kthemestyle/kthemebase.h index faef98dfd..1e16bcee7 100644 --- a/kstyles/kthemestyle/kthemebase.h +++ b/kstyles/kthemestyle/kthemebase.h @@ -34,7 +34,7 @@ Copyright (C) 1998, 1999, 2000 KDE Team #include #include #include -#include +#include #include #include // for QColorGroup #include "kstyledirs.h" diff --git a/kstyles/light/lightstyle-v2.h b/kstyles/light/lightstyle-v2.h index 75d096a4b..90b3e89c9 100644 --- a/kstyles/light/lightstyle-v2.h +++ b/kstyles/light/lightstyle-v2.h @@ -24,7 +24,7 @@ #define LIGHTSTYLE_V2_H -#include +#include #ifdef QT_PLUGIN diff --git a/kstyles/light/lightstyle-v3.h b/kstyles/light/lightstyle-v3.h index 7ce62c3a8..0330c8f87 100644 --- a/kstyles/light/lightstyle-v3.h +++ b/kstyles/light/lightstyle-v3.h @@ -28,7 +28,7 @@ #include #endif // QT_H -#include "kstyle.h" +#include "tdestyle.h" #ifdef QT_PLUGIN # define Q_EXPORT_STYLE_LIGHT_V3 diff --git a/kstyles/plastik/plastik.h b/kstyles/plastik/plastik.h index 7c3e0484b..68f707d79 100644 --- a/kstyles/plastik/plastik.h +++ b/kstyles/plastik/plastik.h @@ -39,7 +39,7 @@ #ifndef __PLASTIK_H #define __PLASTIK_H -#include +#include #include #include diff --git a/kstyles/utils/installtheme/main.cpp b/kstyles/utils/installtheme/main.cpp index 67e29f706..274c2d335 100644 --- a/kstyles/utils/installtheme/main.cpp +++ b/kstyles/utils/installtheme/main.cpp @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include #include #include #include diff --git a/kstyles/web/webstyle.cpp b/kstyles/web/webstyle.cpp index aca43fb74..d96688ee0 100644 --- a/kstyles/web/webstyle.cpp +++ b/kstyles/web/webstyle.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include diff --git a/kstyles/web/webstyle.h b/kstyles/web/webstyle.h index 68f83c99b..0e4c59dbd 100644 --- a/kstyles/web/webstyle.h +++ b/kstyles/web/webstyle.h @@ -20,7 +20,7 @@ #ifndef WEB_STYLE_H #define WEB_STYLE_H -#include +#include #include class TQPainter; diff --git a/libtdescreensaver/main.cpp b/libtdescreensaver/main.cpp index aa4fa8395..f9d8ccb17 100644 --- a/libtdescreensaver/main.cpp +++ b/libtdescreensaver/main.cpp @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include +#include #include #include "tdescreensaver.h" diff --git a/libtdescreensaver/tdescreensaver.cpp b/libtdescreensaver/tdescreensaver.cpp index 4474e5874..30120b164 100644 --- a/libtdescreensaver/tdescreensaver.cpp +++ b/libtdescreensaver/tdescreensaver.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include "tdescreensaver.h" #ifdef Q_WS_X11 #include diff --git a/networkstatus/connectionmanager.cpp b/networkstatus/connectionmanager.cpp index 29174e773..c37214ecd 100644 --- a/networkstatus/connectionmanager.cpp +++ b/networkstatus/connectionmanager.cpp @@ -19,7 +19,7 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include #include #include diff --git a/networkstatus/networkstatus.cpp b/networkstatus/networkstatus.cpp index ed7c402f3..41bff9edb 100644 --- a/networkstatus/networkstatus.cpp +++ b/networkstatus/networkstatus.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include "clientifaceimpl.h" diff --git a/networkstatus/testservice.cpp b/networkstatus/testservice.cpp index 1611721ba..809d9cd0b 100644 --- a/networkstatus/testservice.cpp +++ b/networkstatus/testservice.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "provideriface.h" #include "testservice.h" diff --git a/tdecert/tdecertpart.cc b/tdecert/tdecertpart.cc index b02981e44..7c84f31d1 100644 --- a/tdecert/tdecertpart.cc +++ b/tdecert/tdecertpart.cc @@ -22,7 +22,7 @@ #include "tdecertpart.h" #include #include -#include +#include #include #include #include diff --git a/tdecmshell/main.cpp b/tdecmshell/main.cpp index 2174dfc36..3d54abc45 100644 --- a/tdecmshell/main.cpp +++ b/tdecmshell/main.cpp @@ -27,9 +27,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/tdecmshell/main.h b/tdecmshell/main.h index f135c2a33..e97145a82 100644 --- a/tdecmshell/main.h +++ b/tdecmshell/main.h @@ -24,7 +24,7 @@ #include -#include +#include #include /** diff --git a/tdeconf_update/tdeconf_update.cpp b/tdeconf_update/tdeconf_update.cpp index 208faa503..458b3b523 100644 --- a/tdeconf_update/tdeconf_update.cpp +++ b/tdeconf_update/tdeconf_update.cpp @@ -31,10 +31,10 @@ #include #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index 871190eac..850bb10f2 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -71,8 +71,8 @@ link_directories( install( FILES tdeconfig.h tdeconfigskeleton.h tdeconfigdata.h ksimpleconfig.h tdeconfigdialogmanager.h tdeconfigbase.h kdesktopfile.h - kurl.h ksock.h kaboutdata.h kcmdlineargs.h tdeconfigbackend.h - kapp.h kapplication.h kuniqueapp.h kuniqueapplication.h + kurl.h ksock.h tdeaboutdata.h tdecmdlineargs.h tdeconfigbackend.h + kapp.h tdeapplication.h kuniqueapp.h kuniqueapplication.h kcharsets.h tdeversion.h kpty.h kprocess.h kprocctrl.h klocale.h kicontheme.h kiconloader.h kdebug.h twinmodule.h twin.h krootprop.h tdeshortcut.h kkeynative.h tdeaccel.h @@ -120,7 +120,7 @@ install( FILES eventsrc set( target tdecore ) set( ${target}_SRCS - libintl.cpp kapplication.cpp kdebug.cpp netwm.cpp + libintl.cpp tdeapplication.cpp kdebug.cpp netwm.cpp tdeconfigbase.cpp tdeconfig.cpp ksimpleconfig.cpp tdeconfigbackend.cpp kmanagerselection.cpp kdesktopfile.cpp kstandarddirs.cpp ksock.cpp kpty.cpp kprocess.cpp kprocctrl.cpp klocale.cpp @@ -134,7 +134,7 @@ set( ${target}_SRCS kinstance.cpp kpalette.cpp kipc.cpp klibloader.cpp ktempfile.cpp kuniqueapplication.cpp tdeaccelmanager.cpp ksavefile.cpp krandomsequence.cpp kstringhandler.cpp kcompletion.cpp - kcmdlineargs.cpp kaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp + tdecmdlineargs.cpp tdeaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp kaudioplayer.cpp kdcoppropertyproxy.cpp ksockaddr.cpp kextsock.cpp netsupp.cpp kprocio.cpp kbufferedio.cpp kpixmapprovider.cpp kurldrag.cpp kmdcodec.cpp ksocks.cpp diff --git a/tdecore/MAINTAINERS b/tdecore/MAINTAINERS index 2b171743c..e4a9ad80d 100644 --- a/tdecore/MAINTAINERS +++ b/tdecore/MAINTAINERS @@ -6,18 +6,18 @@ When adding yourself as a maintainer, don't be afraid to reorder the files to a more logical grouping. dmalloc.cpp -kaboutdata.cpp David Faure +tdeaboutdata.cpp David Faure tdeaccel.cpp Ellis Whitehead tdeaccelaction.cpp Ellis Whitehead tdeaccelbase.cpp Ellis Whitehead kallocator.cpp Waldo Bastian kappdcopiface.cpp -kapplication.cpp Waldo Bastian +tdeapplication.cpp Waldo Bastian kaudioplayer.cpp kcatalogue.cpp Hans Petter Bieker kcharsets.cpp Lars Knoll kckey.cpp -kcmdlineargs.cpp Waldo Bastian +tdecmdlineargs.cpp Waldo Bastian kcompletion.cpp Carsten Pfeiffer kcompletionbase.cpp tdeconfig.cpp Waldo Bastian diff --git a/tdecore/Makefile.am b/tdecore/Makefile.am index 332e178ea..ae5048ed9 100644 --- a/tdecore/Makefile.am +++ b/tdecore/Makefile.am @@ -38,8 +38,8 @@ lib_LIBRARIES = libtdefakes_nonpic.a libtdefakes_pic.a include_HEADERS = tdeconfig.h tdeconfigskeleton.h \ tdeconfigdata.h ksimpleconfig.h tdeconfigdialogmanager.h \ - tdeconfigbase.h kdesktopfile.h kurl.h ksock.h kaboutdata.h \ - kcmdlineargs.h tdeconfigbackend.h kapp.h kapplication.h kuniqueapp.h \ + tdeconfigbase.h kdesktopfile.h kurl.h ksock.h tdeaboutdata.h \ + tdecmdlineargs.h tdeconfigbackend.h kapp.h tdeapplication.h kuniqueapp.h \ kuniqueapplication.h kcharsets.h tdeversion.h kpty.h kprocess.h \ kprocctrl.h klocale.h kicontheme.h kiconloader.h kdebug.h \ twinmodule.h twin.h krootprop.h tdeshortcut.h kkeynative.h tdeaccel.h \ @@ -89,7 +89,7 @@ noinst_HEADERS = tdeaccelaction.h tdeaccelbase.h tdeaccelprivate.h kckey.h \ kcalendarsystemhijri.h kcalendarsystemhebrew.h kcalendarsystemjalali.h \ kprotocolinfofactory.h kqiodevicegzip_p.h kiconloader_p.h -libtdecore_la_SOURCES = libintl.cpp kapplication.cpp \ +libtdecore_la_SOURCES = libintl.cpp tdeapplication.cpp \ kdebug.cpp netwm.cpp tdeconfigbase.cpp tdeconfig.cpp ksimpleconfig.cpp \ tdeconfigbackend.cpp kmanagerselection.cpp kdesktopfile.cpp \ kstandarddirs.cpp ksock.cpp kpty.cpp kprocess.cpp kprocctrl.cpp \ @@ -103,7 +103,7 @@ libtdecore_la_SOURCES = libintl.cpp kapplication.cpp \ kinstance.cpp kpalette.cpp kipc.cpp klibloader.cpp ktempfile.cpp \ kuniqueapplication.cpp tdeaccelmanager.cpp \ ksavefile.cpp krandomsequence.cpp kstringhandler.cpp kcompletion.cpp \ - kcmdlineargs.cpp kaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp \ + tdecmdlineargs.cpp tdeaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp \ kaudioplayer.cpp kdcoppropertyproxy.cpp \ ksockaddr.cpp kextsock.cpp netsupp.cpp kprocio.cpp kbufferedio.cpp \ kpixmapprovider.cpp kurldrag.cpp \ diff --git a/tdecore/kaboutdata.cpp b/tdecore/kaboutdata.cpp deleted file mode 100644 index c5055e4dc..000000000 --- a/tdecore/kaboutdata.cpp +++ /dev/null @@ -1,512 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include - -TQString -TDEAboutPerson::name() const -{ - return TQString::fromUtf8(mName); -} - -TQString -TDEAboutPerson::task() const -{ - if (mTask && *mTask) - return i18n(mTask); - else - return TQString::null; -} - -TQString -TDEAboutPerson::emailAddress() const -{ - return TQString::fromUtf8(mEmailAddress); -} - - -TQString -TDEAboutPerson::webAddress() const -{ - return TQString::fromUtf8(mWebAddress); -} - - -TDEAboutTranslator::TDEAboutTranslator(const TQString & name, - const TQString & emailAddress) -{ - mName=name; - mEmail=emailAddress; -} - -TQString TDEAboutTranslator::name() const -{ - return mName; -} - -TQString TDEAboutTranslator::emailAddress() const -{ - return mEmail; -} - -class TDEAboutDataPrivate -{ -public: - TDEAboutDataPrivate() - : translatorName("_: NAME OF TRANSLATORS\nYour names") - , translatorEmail("_: EMAIL OF TRANSLATORS\nYour emails") - , productName(0) - , programLogo(0) - , customAuthorTextEnabled(false) - , mTranslatedProgramName( 0 ) - {} - ~TDEAboutDataPrivate() - { - delete programLogo; - delete[] mTranslatedProgramName; - } - const char *translatorName; - const char *translatorEmail; - const char *productName; - TQImage* programLogo; - TQString customAuthorPlainText, customAuthorRichText; - bool customAuthorTextEnabled; - const char *mTranslatedProgramName; -}; - -const char *TDEAboutData::defaultBugTracker = "http://bugs.trinitydesktop.org"; - -TDEAboutData::TDEAboutData( const char *appName, - const char *programName, - const char *version, - const char *shortDescription, - int licenseType, - const char *copyrightStatement, - const char *text, - const char *homePageAddress, - const char *bugsEmailAddress - ) : - mProgramName( programName ), - mVersion( version ), - mShortDescription( shortDescription ), - mLicenseKey( licenseType ), - mCopyrightStatement( copyrightStatement ), - mOtherText( text ), - mHomepageAddress( homePageAddress ), - mBugEmailAddress( (bugsEmailAddress!=0)?bugsEmailAddress:defaultBugTracker ), - mLicenseText (0) -{ - d = new TDEAboutDataPrivate; - - if( appName ) { - const char *p = strrchr(appName, '/'); - if( p ) - mAppName = p+1; - else - mAppName = appName; - } else - mAppName = 0; -} - -TDEAboutData::~TDEAboutData() -{ - if (mLicenseKey == License_File) - delete [] mLicenseText; - delete d; -} - -void -TDEAboutData::addAuthor( const char *name, const char *task, - const char *emailAddress, const char *webAddress ) -{ - mAuthorList.append(TDEAboutPerson(name,task,emailAddress,webAddress)); -} - -void -TDEAboutData::addCredit( const char *name, const char *task, - const char *emailAddress, const char *webAddress ) -{ - mCreditList.append(TDEAboutPerson(name,task,emailAddress,webAddress)); -} - -void -TDEAboutData::setTranslator( const char *name, const char *emailAddress) -{ - d->translatorName=name; - d->translatorEmail=emailAddress; -} - -void -TDEAboutData::setLicenseText( const char *licenseText ) -{ - mLicenseText = licenseText; - mLicenseKey = License_Custom; -} - -void -TDEAboutData::setLicenseTextFile( const TQString &file ) -{ - mLicenseText = tqstrdup(TQFile::encodeName(file)); - mLicenseKey = License_File; -} - -void -TDEAboutData::setAppName( const char *appName ) -{ - mAppName = appName; -} - -void -TDEAboutData::setProgramName( const char* programName ) -{ - mProgramName = programName; - translateInternalProgramName(); -} - -void -TDEAboutData::setVersion( const char* version ) -{ - mVersion = version; -} - -void -TDEAboutData::setShortDescription( const char *shortDescription ) -{ - mShortDescription = shortDescription; -} - -void -TDEAboutData::setLicense( LicenseKey licenseKey) -{ - mLicenseKey = licenseKey; -} - -void -TDEAboutData::setCopyrightStatement( const char *copyrightStatement ) -{ - mCopyrightStatement = copyrightStatement; -} - -void -TDEAboutData::setOtherText( const char *otherText ) -{ - mOtherText = otherText; -} - -void -TDEAboutData::setHomepage( const char *homepage ) -{ - mHomepageAddress = homepage; -} - -void -TDEAboutData::setBugAddress( const char *bugAddress ) -{ - mBugEmailAddress = bugAddress; -} - -void -TDEAboutData::setProductName( const char *productName ) -{ - d->productName = productName; -} - -const char * -TDEAboutData::appName() const -{ - return mAppName; -} - -const char * -TDEAboutData::productName() const -{ - if (d->productName) - return d->productName; - else - return appName(); -} - -TQString -TDEAboutData::programName() const -{ - if (mProgramName && *mProgramName) - return i18n(mProgramName); - else - return TQString::null; -} - -const char* -TDEAboutData::internalProgramName() const -{ - if (d->mTranslatedProgramName) - return d->mTranslatedProgramName; - else - return mProgramName; -} - -// TDECrash should call as few things as possible and should avoid e.g. malloc() -// because it may deadlock. Since i18n() needs it, when TDELocale is available -// the i18n() call will be done here in advance. -void -TDEAboutData::translateInternalProgramName() const -{ - delete[] d->mTranslatedProgramName; - d->mTranslatedProgramName = 0; - if( TDEGlobal::locale() ) - d->mTranslatedProgramName = tqstrdup( programName().utf8()); -} - -TQImage -TDEAboutData::programLogo() const -{ - return d->programLogo ? (*d->programLogo) : TQImage(); -} - -void -TDEAboutData::setProgramLogo(const TQImage& image) -{ - if (!d->programLogo) - d->programLogo = new TQImage( image ); - else - *d->programLogo = image; -} - -TQString -TDEAboutData::version() const -{ - return TQString::fromLatin1(mVersion); -} - -TQString -TDEAboutData::shortDescription() const -{ - if (mShortDescription && *mShortDescription) - return i18n(mShortDescription); - else - return TQString::null; -} - -TQString -TDEAboutData::homepage() const -{ - return TQString::fromLatin1(mHomepageAddress); -} - -TQString -TDEAboutData::bugAddress() const -{ - return TQString::fromLatin1(mBugEmailAddress); -} - -const TQValueList -TDEAboutData::authors() const -{ - return mAuthorList; -} - -const TQValueList -TDEAboutData::credits() const -{ - return mCreditList; -} - -const TQValueList -TDEAboutData::translators() const -{ - TQValueList personList; - - if(d->translatorName == 0) - return personList; - - TQStringList nameList; - TQStringList emailList; - - TQString names = i18n(d->translatorName); - if(names != TQString::fromUtf8(d->translatorName)) - { - nameList = TQStringList::split(',',names); - } - - - if(d->translatorEmail) - { - TQString emails = i18n(d->translatorEmail); - - if(emails != TQString::fromUtf8(d->translatorEmail)) - { - emailList = TQStringList::split(',',emails,true); - } - } - - - TQStringList::Iterator nit; - TQStringList::Iterator eit=emailList.begin(); - - for(nit = nameList.begin(); nit != nameList.end(); ++nit) - { - TQString email; - if(eit != emailList.end()) - { - email=*eit; - ++eit; - } - - TQString name=*nit; - - personList.append(TDEAboutTranslator(name.stripWhiteSpace(), email.stripWhiteSpace())); - } - - return personList; -} - -TQString -TDEAboutData::aboutTranslationTeam() -{ - return i18n("replace this with information about your translation team", - "

    KDE is translated into many languages thanks to the work " - "of the translation teams all over the world.

    " - "

    For more information on KDE internationalization " - "visit http://l10n.kde.org

    " - ); -} - -TQString -TDEAboutData::otherText() const -{ - if (mOtherText && *mOtherText) - return i18n(mOtherText); - else - return TQString::null; -} - - -TQString -TDEAboutData::license() const -{ - TQString result; - if (!copyrightStatement().isEmpty()) - result = copyrightStatement() + "\n\n"; - - TQString l; - TQString f; - switch ( mLicenseKey ) - { - case License_File: - f = TQFile::decodeName(mLicenseText); - break; - case License_GPL_V2: - l = "GPL v2"; - f = locate("data", "LICENSES/GPL_V2"); - break; - case License_LGPL_V2: - l = "LGPL v2"; - f = locate("data", "LICENSES/LGPL_V2"); - break; - case License_BSD: - l = "BSD License"; - f = locate("data", "LICENSES/BSD"); - break; - case License_Artistic: - l = "Artistic License"; - f = locate("data", "LICENSES/ARTISTIC"); - break; - case License_QPL_V1_0: - l = "QPL v1.0"; - f = locate("data", "LICENSES/QPL_V1.0"); - break; - case License_Custom: - if (mLicenseText && *mLicenseText) - return( i18n(mLicenseText) ); - // fall through - default: - result += i18n("No licensing terms for this program have been specified.\n" - "Please check the documentation or the source for any\n" - "licensing terms.\n"); - return result; - } - - if (!l.isEmpty()) - result += i18n("This program is distributed under the terms of the %1.").arg( l ); - - if (!f.isEmpty()) - { - TQFile file(f); - if (file.open(IO_ReadOnly)) - { - result += '\n'; - result += '\n'; - TQTextStream str(&file); - result += str.read(); - } - } - - return result; -} - -TQString -TDEAboutData::copyrightStatement() const -{ - if (mCopyrightStatement && *mCopyrightStatement) - return i18n(mCopyrightStatement); - else - return TQString::null; -} - -TQString -TDEAboutData::customAuthorPlainText() const -{ - return d->customAuthorPlainText; -} - -TQString -TDEAboutData::customAuthorRichText() const -{ - return d->customAuthorRichText; -} - -bool -TDEAboutData::customAuthorTextEnabled() const -{ - return d->customAuthorTextEnabled; -} - -void -TDEAboutData::setCustomAuthorText(const TQString &plainText, const TQString &richText) -{ - d->customAuthorPlainText = plainText; - d->customAuthorRichText = richText; - - d->customAuthorTextEnabled = true; -} - -void -TDEAboutData::unsetCustomAuthorText() -{ - d->customAuthorPlainText = TQString::null; - d->customAuthorRichText = TQString::null; - - d->customAuthorTextEnabled = false; -} - diff --git a/tdecore/kaboutdata.h b/tdecore/kaboutdata.h deleted file mode 100644 index d5addac0a..000000000 --- a/tdecore/kaboutdata.h +++ /dev/null @@ -1,630 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include - -#ifndef _KABOUTDATA_H_ -#define _KABOUTDATA_H_ - -class TDEAboutPersonPrivate; -class TDEAboutDataPrivate; - -/** - * This structure is used to store information about a person or developer. - * It can store the person's name, a task, an email address and a - * link to a home page. This class is intended for use in the - * TDEAboutData class, but it can be used elsewhere as well. - * Normally you should at least define the person's name. - * - * Example Usage within a main(): - * - * \code - * TDEAboutData about("khello", I18N_NOOP("KHello"), "0.1", - * I18N_NOOP("A TDE version of Hello, world!"), - * TDEAboutData::License_LGPL, - * I18N_NOOP("Copyright (c) 2003 Developer")); - * - * about.addAuthor("Joe Developer", I18N_NOOP("developer"), "joe@host.com", 0); - * about.addCredit("Joe User", I18N_NOOP("A lot of bug reports"), - * "joe.user@host.org", 0); - * TDECmdLineArgs::init(argc, argv, &about); - * \endcode - */ -class TDECORE_EXPORT TDEAboutPerson -{ -public: - /** - * Convenience constructor - * - * @param name The name of the person. - * - * @param task The task of this person. This string should be - * marked for translation, e.g. - * I18N_NOOP("Task description....") - * - * @param emailAddress The email address of the person. - * - * @param webAddress Home page of the person. - */ - TDEAboutPerson( const char *name, const char *task, - const char *emailAddress, const char *webAddress ) - { - mName = name; - mTask = task; - mEmailAddress = emailAddress; - mWebAddress = webAddress; - } - /** - * @internal - * Don't use. Required by QValueList - */ - TDEAboutPerson() {} - - /** - * The person's name - * @return the person's name (can be TQString::null, if it has been - * constructed with a null name) - */ - TQString name() const; - - /** - * The person's task - * @return the person's task (can be TQString::null, if it has been - * constructed with a null task) - */ - TQString task() const; - - /** - * The person's email address - * @return the person's email address (can be TQString::null, if it has been - * constructed with a null email) - */ - TQString emailAddress() const; - - /** - * The home page or a relevant link - * @return the persons home page (can be TQString::null, if it has been - * constructed with a null home page) - */ - TQString webAddress() const; - -private: - const char *mName; - const char *mTask; - const char *mEmailAddress; - const char *mWebAddress; - - TDEAboutPersonPrivate *d; -}; - -class TDEAboutTranslatorPrivate; -/** - * This structure is used to store information about a translator. - * It can store the translator's name and an email address. - * This class is intended for use in the TDEAboutData class, - * but it can be used elsewhere as well. - * Normally you should at least define the translator's name. - * - * It's not possible to use TDEAboutPerson for this, because - * TDEAboutPerson stores internally only const char* pointers, but the - * translator information is generated dynamically from the translation - * of a dummy string. -*/ -class TDECORE_EXPORT TDEAboutTranslator -{ -public: - /** - * Convenience constructor - * - * @param name The name of the person. - * - * @param emailAddress The email address of the person. - */ - TDEAboutTranslator(const TQString & name=TQString::null, - const TQString & emailAddress=TQString::null); - - /** - * The translator's name - * @return the translators's name (can be TQString::null, if it has been - * constructed with a null name) - */ - TQString name() const; - - /** - * The translator's email - * @return the translator's email address (can be TQString::null, if it has been - * constructed with a null email) - */ - TQString emailAddress() const; - -private: - TQString mName; - TQString mEmail; - TDEAboutTranslatorPrivate* d; -}; - - -/** - * This class is used to store information about a program. It can store - * such values as version number, program name, home page, email address - * for bug reporting, multiple authors and contributors - * (using TDEAboutPerson), license and copyright information. - * - * Currently, the values set here are shown by the "About" box - * (see TDEAboutDialog), used by the bug report dialog (see KBugReport), - * and by the help shown on command line (see TDECmdLineArgs). - * - * @short Holds information needed by the "About" box and other - * classes. - * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org) - */ -class TDECORE_EXPORT TDEAboutData -{ - public: - /** - * Descibes the license of the software. - */ - enum LicenseKey - { - License_Custom = -2, - License_File = -1, - License_Unknown = 0, - License_GPL = 1, - License_GPL_V2 = 1, - License_LGPL = 2, - License_LGPL_V2 = 2, - License_BSD = 3, - License_Artistic = 4, - License_QPL = 5, - License_QPL_V1_0 = 5 - }; - - public: - /** - * Constructor. - * - * @param appName The program name used internally. Example: "kedit" - * - * @param programName A displayable program name string. This string - * should be marked for translation. Example: I18N_NOOP("KEdit") - * - * @param version The program version string. - * - * @param shortDescription A short description of what the program does. - * This string should be marked for translation. - * Example: I18N_NOOP("A simple text editor.") - * - * @param licenseType The license identifier. Use setLicenseText if - * you use a license not predefined here. - * - * @param copyrightStatement A copyright statement, that can look like this: - * "(c) 1999-2000, Name". The string specified here is not modified - * in any manner. The author information from addAuthor is not - * used. - * - * @param text Some free form text, that can contain any kind of - * information. The text can contain newlines. This string - * should be marked for translation. - * - * @param homePageAddress The program homepage string. - * Start the address with "http://". "http://some.domain" is - * is correct, "some.domain" is not. - * - * @param bugsEmailAddress The bug report email address string. - * This defaults to the trinitydesktop.org bug system. - * - */ - TDEAboutData( const char *appName, - const char *programName, - const char *version, - const char *shortDescription = 0, - int licenseType = License_Unknown, - const char *copyrightStatement = 0, - const char *text = 0, - const char *homePageAddress = 0, - const char *bugsEmailAddress = 0 - ); - - ~TDEAboutData(); - - /** - * Defines an author. You can call this function as many times you - * need. Each entry is appended to a list. The person in the first entry - * is assumed to be the leader of the project. - * - * @param name The developer's name in UTF-8 encoding. - * - * @param task What the person is responsible for. This text can contain - * newlines. It should be marked for translation like this: - * I18N_NOOP("Task description..."). Can be 0. - * - * @param emailAddress An Email address where the person can be reached. - * Can be 0. - * - * @param webAddress The person's homepage or a relevant link. - * Start the address with "http://". "http://some.domain" is - * correct, "some.domain" is not. Can be 0. - * - */ - void addAuthor( const char *name, - const char *task=0, - const char *emailAddress=0, - const char *webAddress=0 ); - - /** - * Defines a person that deserves credit. You can call this function - * as many times you need. Each entry is appended to a list. - * - * @param name The person's name in UTF-8 encoding. - * - * @param task What the person has done to deserve the honor. The - * text can contain newlines. It should be marked for - * translation like this: I18N_NOOP("Task description...") - * Can be 0. - * - * @param emailAddress An Email address when the person can be reached. - * Can be 0. - * - * @param webAddress The person's homepage or a relevant link. - * Start the address with "http://". "http://some.domain" is - * is correct, "some.domain" is not. Can be 0. - * - */ - void addCredit( const char *name, - const char *task=0, - const char *emailAddress=0, - const char *webAddress=0 ); - - /** - * Sets the name of the translator of the gui. Since this depends - * on the language, just use a dummy text marked for translation. - * - * For example: - * \code - * setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\\nYour names") - * ,I18N_NOOP("_: EMAIL OF TRANSLATORS\\nYour emails")); - * \endcode - * - * The translator can then translate this dummy text with his name - * or with a list of names separated with ",". - * If there is no translation or the application is used with the - * default language, this function call is ignored. - * - * Note: If you are using the default KDE automake environment, - * there is no need to use this function, because the two - * default strings above are added to the applications po file - * automatically. - * - * @param name the name of the translator - * @param emailAddress the email address of the translator - * @see TDEAboutTranslator - */ - void setTranslator(const char* name, const char* emailAddress); - - /** - * Defines a license text. - * - * The text will be translated if it got marked for - * translations with the I18N_NOOP() macro. - * - * Example: - * \code - * setLicenseText( I18N_NOOP("This is my license")); - * \endcode - * - * NOTE: No copy of the text is made. - * - * @param license The license text in utf8 encoding. - */ - void setLicenseText( const char *license ); - - /** - * Defines a license text. - * - * @param file File containing the license text. - */ - void setLicenseTextFile( const TQString &file ); - - /** - * Defines the program name used internally. - * - * @param appName The application name. Example: "kate". - */ - void setAppName( const char *appName ); - - /** - * Defines the displayable program name string. - * - * @param programName The program name. This string should be - * marked for translation. - * Example: I18N_NOOP("Advanced Text Editor"). - * @since 3.2 - */ - void setProgramName( const char* programName ); - - /** - * Defines the program logo. - * Use this if you need to have application logo - * in AboutData other than application icon. - * - * @param image logo image. - * @see programLogo() - * @since 3.4 - */ - void setProgramLogo(const TQImage& image); - - /** - * Defines the program version string. - * - * @param version The program version. - */ - void setVersion( const char* version ); - - /** - * Defines a short description of what the program does. - * - * @param shortDescription The program description This string should be marked - * for translation. Example: I18N_NOOP("An advanced text editor - * with syntax highlithing support."). - */ - void setShortDescription( const char *shortDescription ); - - /** - * Defines the license identifier. - * - * @param licenseKey The license identifier. - */ - void setLicense( LicenseKey licenseKey); - - /** - * Defines the copyright statement to show when displaying the license. - * - * @param copyrightStatement A copyright statement, that can look like - * this: "(c) 1999-2000, Name". The string specified here is not - * modified in any manner. The author information from addAuthor - * is not used. - */ - void setCopyrightStatement( const char *copyrightStatement ); - - /** - * Defines the additional text to show in the about dialog. - * - * @param otherText Some free form text, that can contain any kind of - * information. The text can contain newlines. This string - * should be marked for translation. - */ - void setOtherText( const char *otherText ); - - /** - * Defines the program homepage. - * - * @param homepage The program homepage string. - * Start the address with "http://". "http://kate.kde.org" is - * is correct, "kde.kde.org" is not. - */ - void setHomepage( const char *homepage ); - - /** - * Defines the address where bug reports should be sent. - * - * @param bugAddress The bug report email address string. - * This defaults to the kde.org bug system. - */ - void setBugAddress( const char *bugAddress ); - - /** - * Defines the product name wich will be used in the KBugReport dialog. - * By default it's the appName, but you can overwrite it here to provide - * support for special components e.g. 'product/component' like - * 'kontact/summary'. - * - * @param name The name of product - */ - void setProductName( const char *name ); - - /** - * Returns the application's internal name. - * @return the internal program name. - */ - const char *appName() const; - - /** - * Returns the application's product name, which will be used in KBugReport - * dialog. By default it returns appName(), otherwise the one which is set - * with setProductName() - * - * @return the product name. - */ - const char *productName() const; - - /** - * Returns the translated program name. - * @return the program name (translated). - */ - TQString programName() const; - - /** - * @internal - */ - const char* internalProgramName() const; - /** - * @internal - */ - void translateInternalProgramName() const; - - /** - * Returns the program logo image. - * @return the program logo data or null image if there is - * no custom application logo defined. - * @since 3.4 - */ - TQImage programLogo() const; - - /** - * Returns the program's version. - * @return the version string. - */ - TQString version() const; - - /** - * @internal - */ - const char* internalVersion() const { return mVersion; } - - /** - * Returns a short, translated description. - * @return the short description (translated). Can be - * TQString::null if not set. - */ - TQString shortDescription() const; - - /** - * Returns the application homepage. - * @return the application homepage URL. Can be TQString::null if - * not set. - */ - TQString homepage() const; - - /** - * Returns the email address for bugs. - * @return the email address where to report bugs. - */ - TQString bugAddress() const; - - /** - * @internal - */ - const char* internalBugAddress() const { return mBugEmailAddress; } - - /** - * Returns a list of authors. - * @return author information (list of persons). - */ - const TQValueList authors() const; - - /** - * Returns a list of persons who contributed. - * @return credit information (list of persons). - */ - const TQValueList credits() const; - - /** - * Returns a list of translators. - * @return translators information (list of persons) - */ - const TQValueList translators() const; - - /** - * Returns a message about the translation team. - * @return a message about the translation team - */ - static TQString aboutTranslationTeam(); - - /** - * Returns a translated, free form text. - * @return the free form text (translated). Can be TQString::null if not set. - */ - TQString otherText() const; - - /** - * Returns the license. If the licenseType argument of the constructor has been - * used, any text defined by setLicenseText is ignored, - * and the standard text for the chosen license will be returned. - * - * @return The license text. - */ - TQString license() const; - - /** - * Returns the copyright statement. - * @return the copyright statement. Can be TQString::null if not set. - */ - TQString copyrightStatement() const; - - /** - * Returns the plain text displayed around the list of authors instead - * of the default message telling users to send bug reports to bugAddress(). - * - * @return the plain text displayed around the list of authors instead - * of the default message. Can be TQString::null. - */ - TQString customAuthorPlainText() const; - - /** - * Returns the rich text displayed around the list of authors instead - * of the default message telling users to send bug reports to bugAddress(). - * - * @return the rich text displayed around the list of authors instead - * of the default message. Can be TQString::null. - */ - TQString customAuthorRichText() const; - - /** - * Returns whether custom text should be displayed around the list of - * authors. - * - * @return whether custom text should be displayed around the list of - * authors. - */ - bool customAuthorTextEnabled() const; - - /** - * Sets the custom text displayed around the list of authors instead - * of the default message telling users to send bug reports to bugAddress(). - * - * @param plainText The plain text. - * @param richText The rich text. - * - * Both parameters can be TQString::null to not display any message at - * all. Call unsetCustomAuthorText() to revert to the default mesage. - */ - void setCustomAuthorText(const TQString &plainText, const TQString &richText); - - /** - * Clears any custom text displayed around the list of authors and falls - * back to the default message telling users to send bug reports to - * bugAddress(). - */ - void unsetCustomAuthorText(); - - private: - const char *mAppName; - const char *mProgramName; - const char *mVersion; - const char *mShortDescription; - int mLicenseKey; - const char *mCopyrightStatement; - const char *mOtherText; - const char *mHomepageAddress; - const char *mBugEmailAddress; - TQValueList mAuthorList; - TQValueList mCreditList; - const char *mLicenseText; - static const char *defaultBugTracker; - - TDEAboutDataPrivate *d; -}; - -#endif - diff --git a/tdecore/kapp.h b/tdecore/kapp.h index c51c463a0..5d48a852f 100644 --- a/tdecore/kapp.h +++ b/tdecore/kapp.h @@ -1,6 +1,6 @@ -// kapp.h is the old name. Use #include from now on +// kapp.h is the old name. Use #include from now on #ifdef KDE_NO_COMPAT -#error include instead of +#error include instead of #else -#include +#include #endif diff --git a/tdecore/kappdcopiface.cpp b/tdecore/kappdcopiface.cpp index 9f1148579..31bc8dd5b 100644 --- a/tdecore/kappdcopiface.cpp +++ b/tdecore/kappdcopiface.cpp @@ -18,7 +18,7 @@ */ #include "kappdcopiface.h" -#include +#include #include #include #include diff --git a/tdecore/kapplication.cpp b/tdecore/kapplication.cpp deleted file mode 100644 index 15c8a132b..000000000 --- a/tdecore/kapplication.cpp +++ /dev/null @@ -1,3638 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - Copyright (C) 1998, 1999, 2000 KDE Team - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#ifdef HAVE_XCOMPOSITE -#define COMPOSITE -#endif - -// #ifdef QTRANSLATOR_H -// #error qtranslator.h was already included -// #endif // QTRANSLATOR_H -// -// #ifdef TQTRANSLATOR_H -// #error tqtranslator.h was already included -// #endif // TQTRANSLATOR_H - -#undef QT_NO_TRANSLATION -#undef TQT_NO_TRANSLATION -#include -#include "kapplication.h" -#define QT_NO_TRANSLATION -#define TQT_NO_TRANSLATION -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_NO_SQL -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "kcheckaccelerators.h" -#include -#include -#include -#include -#include -#include -#include - -#if defined Q_WS_X11 -#include -#endif - -#include -#include - -#include -#ifdef HAVE_SYS_STAT_H -#include -#endif -#include -#include -#include - -#ifndef Q_WS_WIN -#include "twin.h" -#endif - -#include -#include // getenv(), srand(), rand() -#include -#include -#include -#include -#include -#include -#include -#if defined Q_WS_X11 -//#ifndef Q_WS_QWS //FIXME(E): NetWM should talk to QWS... -#include -#endif - -#include "kprocctrl.h" - -#ifdef HAVE_PATHS_H -#include -#endif - -#ifdef Q_WS_X11 -#include -#ifdef COMPOSITE -#include -#include -#include -#endif -#include -#include -#include -#include -#endif - -#include - -#ifndef Q_WS_WIN -#include -#else -typedef void* IceIOErrorHandler; -#include -//KDE4: remove -#define Button1Mask (1<<8) -#define Button2Mask (1<<9) -#define Button3Mask (1<<10) -#endif - -#ifdef Q_WS_X11 -#define DISPLAY "DISPLAY" -#elif defined(Q_WS_QWS) -#define DISPLAY "QWS_DISPLAY" -#endif - -#if defined Q_WS_X11 -#include -#endif - -#ifdef Q_WS_MACX -#include -#include -#endif - -#include "kappdcopiface.h" - -// exported for tdm kfrontend -KDE_EXPORT bool kde_have_kipc = true; // magic hook to disable kipc in tdm -bool kde_kiosk_exception = false; // flag to disable kiosk restrictions -bool kde_kiosk_admin = false; - -TDEApplication* TDEApplication::KApp = 0L; -bool TDEApplication::loadedByKdeinit = false; -DCOPClient *TDEApplication::s_DCOPClient = 0L; -bool TDEApplication::s_dcopClientNeedsPostInit = false; - -#ifdef Q_WS_X11 -static Atom atom_DesktopWindow; -static Atom atom_NetSupported; -static Atom kde_xdnd_drop; -#endif - -#ifdef Q_WS_X11 -static int composite_event, composite_error, composite_opcode; -static bool x11_composite_error_generated; -static int x11_error(Display *dpy, XErrorEvent *ev) { - if (ev->request_code == composite_opcode && ev->minor_code == X_CompositeRedirectSubwindows) - { - x11_composite_error_generated = true; - return 0; - } - return 1; -} -#endif - -// duplicated from patched Qt, so that there won't be unresolved symbols if Qt gets -// replaced by unpatched one -TDECORE_EXPORT bool tqt_qclipboard_bailout_hack = false; - -template class TQPtrList; - -#ifdef Q_WS_X11 -extern "C" { -static int kde_xio_errhandler( Display * dpy ) -{ - return kapp->xioErrhandler( dpy ); -} - -static int kde_x_errhandler( Display *dpy, XErrorEvent *err ) -{ - return kapp->xErrhandler( dpy, err ); -} - -} - -extern "C" { -static void kde_ice_ioerrorhandler( IceConn conn ) -{ - if(kapp) - kapp->iceIOErrorHandler( conn ); - // else ignore the error for now -} -} -#endif - -#ifdef Q_WS_WIN -void TDEApplication_init_windows(bool GUIenabled); - -class QAssistantClient; -#endif - -/* - Private data to make keeping binary compatibility easier - */ -class TDEApplicationPrivate -{ -public: - TDEApplicationPrivate() - : actionRestrictions( false ), - refCount( 1 ), - oldIceIOErrorHandler( 0 ), - checkAccelerators( 0 ), - overrideStyle( TQString::null ), - startup_id( "0" ), - app_started_timer( NULL ), - m_KAppDCOPInterface( 0L ), - session_save( false ) -#ifdef Q_WS_X11 - ,oldXErrorHandler( NULL ) - ,oldXIOErrorHandler( NULL ) -#elif defined Q_WS_WIN - ,qassistantclient( 0 ) -#endif - { - } - - ~TDEApplicationPrivate() - { -#ifdef Q_WS_WIN - delete qassistantclient; -#endif - } - - - bool actionRestrictions : 1; - bool guiEnabled : 1; - /** - * This counter indicates when to exit the application. - * It starts at 1, is decremented in TDEMainWindow when the last window is closed, but - * is incremented by operations that should outlive the last window closed - * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client). - */ - int refCount; - IceIOErrorHandler oldIceIOErrorHandler; - KCheckAccelerators* checkAccelerators; - TQString overrideStyle; - TQString geometry_arg; - TQCString startup_id; - TQTimer* app_started_timer; - KAppDCOPInterface *m_KAppDCOPInterface; - bool session_save; -#ifdef Q_WS_X11 - int (*oldXErrorHandler)(Display*,XErrorEvent*); - int (*oldXIOErrorHandler)(Display*); -#elif defined Q_WS_WIN - QAssistantClient* qassistantclient; -#endif - - class URLActionRule - { - public: -#define checkExactMatch(s, b) \ - if (s.isEmpty()) b = true; \ - else if (s[s.length()-1] == '!') \ - { b = false; s.truncate(s.length()-1); } \ - else b = true; -#define checkStartWildCard(s, b) \ - if (s.isEmpty()) b = true; \ - else if (s[0] == '*') \ - { b = true; s = s.mid(1); } \ - else b = false; -#define checkEqual(s, b) \ - b = (s == "="); - - URLActionRule(const TQString &act, - const TQString &bProt, const TQString &bHost, const TQString &bPath, - const TQString &dProt, const TQString &dHost, const TQString &dPath, - bool perm) - : action(act), - baseProt(bProt), baseHost(bHost), basePath(bPath), - destProt(dProt), destHost(dHost), destPath(dPath), - permission(perm) - { - checkExactMatch(baseProt, baseProtWildCard); - checkStartWildCard(baseHost, baseHostWildCard); - checkExactMatch(basePath, basePathWildCard); - checkExactMatch(destProt, destProtWildCard); - checkStartWildCard(destHost, destHostWildCard); - checkExactMatch(destPath, destPathWildCard); - checkEqual(destProt, destProtEqual); - checkEqual(destHost, destHostEqual); - } - - bool baseMatch(const KURL &url, const TQString &protClass) - { - if (baseProtWildCard) - { - if ( !baseProt.isEmpty() && !url.protocol().startsWith(baseProt) && - (protClass.isEmpty() || (protClass != baseProt)) ) - return false; - } - else - { - if ( (url.protocol() != baseProt) && - (protClass.isEmpty() || (protClass != baseProt)) ) - return false; - } - if (baseHostWildCard) - { - if (!baseHost.isEmpty() && !url.host().endsWith(baseHost)) - return false; - } - else - { - if (url.host() != baseHost) - return false; - } - if (basePathWildCard) - { - if (!basePath.isEmpty() && !url.path().startsWith(basePath)) - return false; - } - else - { - if (url.path() != basePath) - return false; - } - return true; - } - - bool destMatch(const KURL &url, const TQString &protClass, const KURL &base, const TQString &baseClass) - { - if (destProtEqual) - { - if ( (url.protocol() != base.protocol()) && - (protClass.isEmpty() || baseClass.isEmpty() || protClass != baseClass) ) - return false; - } - else if (destProtWildCard) - { - if ( !destProt.isEmpty() && !url.protocol().startsWith(destProt) && - (protClass.isEmpty() || (protClass != destProt)) ) - return false; - } - else - { - if ( (url.protocol() != destProt) && - (protClass.isEmpty() || (protClass != destProt)) ) - return false; - } - if (destHostWildCard) - { - if (!destHost.isEmpty() && !url.host().endsWith(destHost)) - return false; - } - else if (destHostEqual) - { - if (url.host() != base.host()) - return false; - } - else - { - if (url.host() != destHost) - return false; - } - if (destPathWildCard) - { - if (!destPath.isEmpty() && !url.path().startsWith(destPath)) - return false; - } - else - { - if (url.path() != destPath) - return false; - } - return true; - } - - TQString action; - TQString baseProt; - TQString baseHost; - TQString basePath; - TQString destProt; - TQString destHost; - TQString destPath; - bool baseProtWildCard : 1; - bool baseHostWildCard : 1; - bool basePathWildCard : 1; - bool destProtWildCard : 1; - bool destHostWildCard : 1; - bool destPathWildCard : 1; - bool destProtEqual : 1; - bool destHostEqual : 1; - bool permission; - }; - TQPtrList urlActionRestrictions; - - TQString sessionKey; - TQString pSessionConfigFile; -}; - - -static TQPtrList*x11Filter = 0; -static bool autoDcopRegistration = true; - -void TDEApplication::installX11EventFilter( TQWidget* filter ) -{ - if ( !filter ) - return; - if (!x11Filter) - x11Filter = new TQPtrList; - connect ( filter, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( x11FilterDestroyed() ) ); - x11Filter->append( filter ); -} - -void TDEApplication::x11FilterDestroyed() -{ - removeX11EventFilter( static_cast< const TQWidget* >( sender())); -} - -void TDEApplication::removeX11EventFilter( const TQWidget* filter ) -{ - if ( !x11Filter || !filter ) - return; - x11Filter->removeRef( filter ); - if ( x11Filter->isEmpty() ) { - delete x11Filter; - x11Filter = 0; - } -} - -// FIXME: remove this when we've get a better method of -// customizing accelerator handling -- hopefully in Qt. -// For now, this is set whenever an accelerator is overridden -// in TDEAccelEventHandler so that the AccelOverride isn't sent twice. -- ellis, 19/10/02 -extern bool kde_g_bKillAccelOverride; - -bool TDEApplication::notify(TQObject *receiver, TQEvent *event) -{ - TQEvent::Type t = event->type(); - if (kde_g_bKillAccelOverride) - { - kde_g_bKillAccelOverride = false; - // Indicate that the accelerator has been overridden. - if (t == TQEvent::AccelOverride) - { - TQT_TQKEYEVENT(event)->accept(); - return true; - } - else - kdWarning(125) << "kde_g_bKillAccelOverride set, but received an event other than AccelOverride." << endl; - } - - if ((t == TQEvent::AccelOverride) || (t == TQEvent::KeyPress)) - { - static const TDEShortcut& _selectAll = TDEStdAccel::selectAll(); - TQLineEdit *edit = ::tqqt_cast(receiver); - if (edit) - { - // We have a keypress for a lineedit... - TQKeyEvent *kevent = TQT_TQKEYEVENT(event); - KKey key(kevent); - if (_selectAll.contains(key)) - { - if (t == TQEvent::KeyPress) - { - edit->selectAll(); - return true; - } - else - { - kevent->accept(); - } - } - // Ctrl-U deletes from start of line. - if (key == KKey(Qt::CTRL + Qt::Key_U)) - { - if (t == TQEvent::KeyPress) - { - if (!edit->isReadOnly()) - { - TQString t(edit->text()); - t = t.mid(edit->cursorPosition()); - edit->validateAndSet(t, 0, 0, 0); - } - return true; - } - else - { - kevent->accept(); - } - - } - } - TQTextEdit *medit = ::tqqt_cast(receiver); - if (medit) - { - // We have a keypress for a multilineedit... - TQKeyEvent *kevent = TQT_TQKEYEVENT(event); - if (_selectAll.contains(KKey(kevent))) - { - if (t == TQEvent::KeyPress) - { - medit->selectAll(); - return true; - } - else - { - kevent->accept(); - } - } - } - } - if( t == TQEvent::Show && receiver->isWidgetType()) - { - TQWidget* w = TQT_TQWIDGET( receiver ); -#if defined Q_WS_X11 - if( w->isTopLevel() && !startupId().isEmpty() && !TQT_TQSHOWEVENT(event)->spontaneous()) // TODO better done using window group leader? - TDEStartupInfo::setWindowStartupId( w->winId(), startupId()); -#endif - if( w->isTopLevel() && !w->testWFlags( WX11BypassWM ) && !w->isPopup() && !event->spontaneous()) - { - if( d->app_started_timer == NULL ) - { - d->app_started_timer = new TQTimer( this, "app_started_timer" ); - connect( d->app_started_timer, TQT_SIGNAL( timeout()), TQT_SLOT( checkAppStartedSlot())); - } - if( !d->app_started_timer->isActive()) - d->app_started_timer->start( 0, true ); - } - if( w->isTopLevel() && ( w->icon() == NULL || w->icon()->isNull())) - { - // icon() cannot be null pixmap, it'll be the "unknown" icon - so check if there is this application icon - static TQPixmap* ic = NULL; - if( ic == NULL ) - ic = new TQPixmap( TDEGlobal::iconLoader()->loadIcon( iconName(), - TDEIcon::NoGroup, 0, TDEIcon::DefaultState, NULL, true )); - if( !ic->isNull()) - { - w->setIcon( *ic ); -#if defined Q_WS_X11 - KWin::setIcons( w->winId(), *ic, miniIcon()); -#endif - } - } - } - return TQApplication::notify(receiver, event); -} - -void TDEApplication::checkAppStartedSlot() -{ -#if defined Q_WS_X11 - TDEStartupInfo::handleAutoAppStartedSending(); -#endif -} - -// the help class for session management communication -static TQPtrList* sessionClients() -{ - static TQPtrList* session_clients = 0L; - if ( !session_clients ) - session_clients = new TQPtrList; - return session_clients; -} - -/* - Auxiliary function to calculate a a session config name used for the - instance specific config object. - Syntax: "session/_" - */ -TQString TDEApplication::sessionConfigName() const -{ - TQString sessKey = sessionKey(); - if ( sessKey.isEmpty() && !d->sessionKey.isEmpty() ) - sessKey = d->sessionKey; - return TQString("session/%1_%2_%3").arg(name()).arg(sessionId()).arg(sessKey); -} - -#ifdef Q_WS_X11 -static SmcConn mySmcConnection = 0; -static SmcConn tmpSmcConnection = 0; -#else -// FIXME(E): Implement for Qt Embedded -// Possibly "steal" XFree86's libSM? -#endif -static TQTime* smModificationTime = 0; - -TDEApplication::TDEApplication( int& argc, char** argv, const TQCString& rAppName, - bool allowStyles, bool GUIenabled ) : - TQApplication( argc, argv, GUIenabled ), TDEInstance(rAppName), -#ifdef Q_WS_X11 - display(0L), - argb_visual(false), -#endif - d (new TDEApplicationPrivate()) -{ - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - if (!GUIenabled) - allowStyles = false; - useStyles = allowStyles; - Q_ASSERT (!rAppName.isEmpty()); - setName(rAppName); - - installSigpipeHandler(); - TDECmdLineArgs::initIgnore(argc, argv, rAppName.data()); - parseCommandLine( ); - init(GUIenabled); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} - -TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled ) : -// TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), TRUE ), // Qt4 requires that there always be a GUI - TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), GUIenabled ), // We need to be able to run command line apps - TDEInstance( TDECmdLineArgs::about), -#ifdef Q_WS_X11 - display(0L), - argb_visual(false), -#endif - d (new TDEApplicationPrivate) -{ - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - if (!GUIenabled) - allowStyles = false; - useStyles = allowStyles; - setName( instanceName() ); - - installSigpipeHandler(); - parseCommandLine( ); - init(GUIenabled); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} - -#ifdef Q_WS_X11 -TDEApplication::TDEApplication( Display *dpy, bool allowStyles ) : - TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), - getX11RGBAVisual(dpy), getX11RGBAColormap(dpy) ), - TDEInstance( TDECmdLineArgs::about), display(0L), d (new TDEApplicationPrivate) -{ - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - useStyles = allowStyles; - setName( instanceName() ); - installSigpipeHandler(); - parseCommandLine( ); - init( true ); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} - -TDEApplication::TDEApplication( Display *dpy, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles ) : - TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), - disable_argb?visual:getX11RGBAVisual(dpy), disable_argb?colormap:getX11RGBAColormap(dpy) ), - TDEInstance( TDECmdLineArgs::about), display(0L), d (new TDEApplicationPrivate) -{ - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - useStyles = allowStyles; - if (disable_argb) argb_visual = false; - setName( instanceName() ); - installSigpipeHandler(); - parseCommandLine( ); - init( true ); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} - -TDEApplication::TDEApplication( Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap, - bool allowStyles ) : - TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), - visual?visual:getX11RGBAVisual(dpy), colormap?colormap:getX11RGBAColormap(dpy) ), - TDEInstance( TDECmdLineArgs::about), display(0L), d (new TDEApplicationPrivate) -{ - if ((visual) && (colormap)) - getX11RGBAInformation(dpy); - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - useStyles = allowStyles; - setName( instanceName() ); - installSigpipeHandler(); - parseCommandLine( ); - init( true ); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} - -TDEApplication::TDEApplication( Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap, - bool allowStyles, TDEInstance * _instance ) : - TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), - visual?visual:getX11RGBAVisual(dpy), colormap?colormap:getX11RGBAColormap(dpy) ), - TDEInstance( _instance ), display(0L), d (new TDEApplicationPrivate) -{ - if ((visual) && (colormap)) - getX11RGBAInformation(dpy); - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - useStyles = allowStyles; - setName( instanceName() ); - installSigpipeHandler(); - parseCommandLine( ); - init( true ); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} -#endif - -TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled, TDEInstance* _instance ) : - TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), - GUIenabled ), - TDEInstance( _instance ), -#ifdef Q_WS_X11 - display(0L), -#endif - argb_visual(false), - d (new TDEApplicationPrivate) -{ - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - if (!GUIenabled) - allowStyles = false; - useStyles = allowStyles; - setName( instanceName() ); - - installSigpipeHandler(); - parseCommandLine( ); - init(GUIenabled); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} - -#ifdef Q_WS_X11 -TDEApplication::TDEApplication(Display *display, int& argc, char** argv, const TQCString& rAppName, - bool allowStyles, bool GUIenabled ) : - TQApplication( display ), TDEInstance(rAppName), - display(0L), - argb_visual(false), - d (new TDEApplicationPrivate()) -{ - aIconPixmap.pm.icon = 0L; - aIconPixmap.pm.miniIcon = 0L; - read_app_startup_id(); - if (!GUIenabled) - allowStyles = false; - useStyles = allowStyles; - - Q_ASSERT (!rAppName.isEmpty()); - setName(rAppName); - - installSigpipeHandler(); - TDECmdLineArgs::initIgnore(argc, argv, rAppName.data()); - parseCommandLine( ); - init(GUIenabled); - d->m_KAppDCOPInterface = new KAppDCOPInterface(this); -} -#endif - -int TDEApplication::xioErrhandler( Display* dpy ) -{ - if(kapp) - { - emit shutDown(); -#ifdef Q_WS_X11 - d->oldXIOErrorHandler( dpy ); -#else - Q_UNUSED(dpy); -#endif - } - exit( 1 ); - return 0; -} - -int TDEApplication::xErrhandler( Display* dpy, void* err_ ) -{ // no idea how to make forward decl. for XErrorEvent -#ifdef Q_WS_X11 - XErrorEvent* err = static_cast< XErrorEvent* >( err_ ); - if(kapp) - { - // add KDE specific stuff here - d->oldXErrorHandler( dpy, err ); - } -#endif - return 0; -} - -void TDEApplication::iceIOErrorHandler( _IceConn *conn ) -{ - emit shutDown(); - -#ifdef Q_WS_X11 - if ( d->oldIceIOErrorHandler != NULL ) - (*d->oldIceIOErrorHandler)( conn ); -#endif - exit( 1 ); -} - -class KDETranslator : public TQTranslator -{ -public: - KDETranslator(TQObject *parent) : TQTranslator(parent, "kdetranslator") {} - virtual TQTranslatorMessage findMessage(const char* context, - const char *sourceText, - const char* message) const - { - TQTranslatorMessage res; - res.setTranslation(TDEGlobal::locale()->translateQt(context, sourceText, message)); - return res; - } -}; - -void TDEApplication::init(bool GUIenabled) -{ - d->guiEnabled = GUIenabled; - if ((getuid() != geteuid()) || - (getgid() != getegid()) ) - { - // man permissions are not exploitable and better than - // world writable directories - struct group *man = getgrnam("man"); - if ( !man || man->gr_gid != getegid() ){ - fprintf(stderr, "The TDE libraries are not designed to run with suid privileges.\n"); - ::exit(127); - } - } - - TDEProcessController::ref(); - - (void) TDEClipboardSynchronizer::self(); - - TQApplication::setDesktopSettingsAware( false ); - - KApp = this; - - -#ifdef Q_WS_X11 //FIXME(E) - // create all required atoms in _one_ roundtrip to the X server - if ( GUIenabled ) { - const int max = 20; - Atom* atoms[max]; - char* names[max]; - Atom atoms_return[max]; - int n = 0; - - atoms[n] = &kipcCommAtom; - names[n++] = (char *) "KIPC_COMM_ATOM"; - - atoms[n] = &atom_DesktopWindow; - names[n++] = (char *) "KDE_DESKTOP_WINDOW"; - - atoms[n] = &atom_NetSupported; - names[n++] = (char *) "_NET_SUPPORTED"; - - atoms[n] = &kde_xdnd_drop; - names[n++] = (char *) "XdndDrop"; - - XInternAtoms( tqt_xdisplay(), names, n, false, atoms_return ); - - for (int i = 0; i < n; i++ ) - *atoms[i] = atoms_return[i]; - } -#endif - - dcopAutoRegistration(); - dcopClientPostInit(); - - smw = 0; - - // Initial KIPC event mask. -#if defined Q_WS_X11 - kipcEventMask = (1 << KIPC::StyleChanged) | (1 << KIPC::PaletteChanged) | - (1 << KIPC::FontChanged) | (1 << KIPC::BackgroundChanged) | - (1 << KIPC::ToolbarStyleChanged) | (1 << KIPC::SettingsChanged) | - (1 << KIPC::ClipboardConfigChanged) | (1 << KIPC::BlockShortcuts); -#endif - - // Trigger creation of locale. - (void) TDEGlobal::locale(); - - TDEConfig* config = TDEGlobal::config(); - d->actionRestrictions = config->hasGroup("KDE Action Restrictions" ) && !kde_kiosk_exception; - // For brain-dead configurations where the user's local config file is not writable. - // * We use kdialog to warn the user, so we better not generate warnings from - // kdialog itself. - // * Don't warn if we run with a read-only $HOME - TQCString readOnly = getenv("TDE_HOME_READONLY"); - if (readOnly.isEmpty() && (tqstrcmp(name(), "kdialog") != 0)) - { - TDEConfigGroupSaver saver(config, "KDE Action Restrictions"); - if (config->readBoolEntry("warn_unwritable_config",true)) - config->checkConfigFilesWritable(true); - } - - if (GUIenabled) - { -#ifdef Q_WS_X11 - // this is important since we fork() to launch the help (Matthias) - fcntl(ConnectionNumber(tqt_xdisplay()), F_SETFD, FD_CLOEXEC); - // set up the fancy (=robust and error ignoring ) KDE xio error handlers (Matthias) - d->oldXErrorHandler = XSetErrorHandler( kde_x_errhandler ); - d->oldXIOErrorHandler = XSetIOErrorHandler( kde_xio_errhandler ); -#endif - - connect( this, TQT_SIGNAL( aboutToQuit() ), this, TQT_SIGNAL( shutDown() ) ); - -#ifdef Q_WS_X11 //FIXME(E) - display = desktop()->x11Display(); -#endif - - { - TQStringList plugins = TDEGlobal::dirs()->resourceDirs( "qtplugins" ); - TQStringList::Iterator it = plugins.begin(); - while (it != plugins.end()) { - addLibraryPath( *it ); - ++it; - } - - } - tdedisplaySetStyle(); - tdedisplaySetFont(); -// tdedisplaySetPalette(); done by tdedisplaySetStyle - propagateSettings(SETTINGS_QT); - - // Set default mime-source factory - // XXX: This is a hack. Make our factory the default factory, but add the - // previous default factory to the list of factories. Why? When the default - // factory can't resolve something, it iterates in the list of factories. - // But it TQWhatsThis only uses the default factory. So if there was already - // a default factory (which happens when using an image library using uic), - // we prefer KDE's factory and so we put that old default factory in the - // list and use KDE as the default. This may speed up things as well. - TQMimeSourceFactory* oldDefaultFactory = TQMimeSourceFactory::takeDefaultFactory(); - TQMimeSourceFactory::setDefaultFactory( mimeSourceFactory() ); - if ( oldDefaultFactory ) { - TQMimeSourceFactory::addFactory( oldDefaultFactory ); - } - - d->checkAccelerators = new KCheckAccelerators( TQT_TQOBJECT(this) ); - } - -#ifdef Q_WS_MACX - if (GUIenabled) { - TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon( TDECmdLineArgs::appName(), - TDEIcon::NoGroup, TDEIcon::SizeLarge, TDEIcon::DefaultState, 0L, false ); - if (!pixmap.isNull()) { - TQImage i = pixmap.convertToImage().convertDepth(32).smoothScale(40, 40); - for(int y = 0; y < i.height(); y++) { - uchar *l = i.scanLine(y); - for(int x = 0; x < i.width(); x+=4) - *(l+x) = 255; - } - CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); - CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, - i.bits(), i.numBytes(), NULL); - CGImageRef ir = CGImageCreate(i.width(), i.height(), 8, 32, i.bytesPerLine(), - cs, kCGImageAlphaNoneSkipFirst, dp, - 0, 0, kCGRenderingIntentDefault); - //cleanup - SetApplicationDockTileImage(ir); - CGImageRelease(ir); - CGColorSpaceRelease(cs); - CGDataProviderRelease(dp); - } - } -#endif - - - // save and restore the RTL setting, as installTranslator calls qt_detectRTLLanguage, - // which makes it impossible to use the -reverse cmdline switch with KDE apps - bool rtl = reverseLayout(); - installTranslator(new KDETranslator(TQT_TQOBJECT(this))); - setReverseLayout( rtl ); - if (i18n( "_: Dear Translator! Translate this string to the string 'LTR' in " - "left-to-right languages (as english) or to 'RTL' in right-to-left " - "languages (such as Hebrew and Arabic) to get proper widget layout." ) == "RTL") - setReverseLayout( !rtl ); - - // install appdata resource type - TDEGlobal::dirs()->addResourceType("appdata", TDEStandardDirs::kde_default("data") - + TQString::fromLatin1(name()) + '/'); - pSessionConfig = 0L; - bSessionManagement = true; - -#ifdef Q_WS_X11 - // register a communication window for desktop changes (Matthias) - if (GUIenabled && kde_have_kipc ) - { - smw = new TQWidget(0,0); - long data = 1; - XChangeProperty(tqt_xdisplay(), smw->winId(), - atom_DesktopWindow, atom_DesktopWindow, - 32, PropModeReplace, (unsigned char *)&data, 1); - } - d->oldIceIOErrorHandler = IceSetIOErrorHandler( kde_ice_ioerrorhandler ); -#elif defined(Q_WS_WIN) - TDEApplication_init_windows(GUIenabled); -#else - // FIXME(E): Implement for Qt Embedded -#endif -} - -static int my_system (const char *command) { - int pid, status; - - pid = fork(); - if (pid == -1) - return -1; - if (pid == 0) { - const char* shell = "/bin/sh"; - execl(shell, shell, "-c", command, (void *)0); - ::_exit(127); - } - do { - if (waitpid(pid, &status, 0) == -1) { - if (errno != EINTR) - return -1; - } else - return status; - } while(1); -} - - -DCOPClient *TDEApplication::dcopClient() -{ - if (s_DCOPClient) - return s_DCOPClient; - - s_DCOPClient = new DCOPClient(); - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs("tde"); - if (args && args->isSet("dcopserver")) - { - s_DCOPClient->setServerAddress( args->getOption("dcopserver")); - } - if( kapp ) { - connect(s_DCOPClient, TQT_SIGNAL(attachFailed(const TQString &)), - kapp, TQT_SLOT(dcopFailure(const TQString &))); - connect(s_DCOPClient, TQT_SIGNAL(blockUserInput(bool) ), - kapp, TQT_SLOT(dcopBlockUserInput(bool)) ); - } - else - s_dcopClientNeedsPostInit = true; - - DCOPClient::setMainClient( s_DCOPClient ); - return s_DCOPClient; -} - -void TDEApplication::dcopClientPostInit() -{ - if( s_dcopClientNeedsPostInit ) - { - s_dcopClientNeedsPostInit = false; - connect(s_DCOPClient, TQT_SIGNAL(blockUserInput(bool) ), - TQT_SLOT(dcopBlockUserInput(bool)) ); - s_DCOPClient->bindToApp(); // Make sure we get events from the DCOPClient. - } -} - -void TDEApplication::dcopAutoRegistration() -{ - if (autoDcopRegistration) - { - ( void ) dcopClient(); - if( dcopClient()->appId().isEmpty()) - dcopClient()->registerAs(name()); - } -} - -void TDEApplication::disableAutoDcopRegistration() -{ - autoDcopRegistration = false; -} - -TDEConfig* TDEApplication::sessionConfig() -{ - if (pSessionConfig) - return pSessionConfig; - - // create an instance specific config object - pSessionConfig = new TDEConfig( sessionConfigName(), false, false); - return pSessionConfig; -} - -void TDEApplication::ref() -{ - d->refCount++; - //kdDebug() << "TDEApplication::ref() : refCount = " << d->refCount << endl; -} - -void TDEApplication::deref() -{ - d->refCount--; - //kdDebug() << "TDEApplication::deref() : refCount = " << d->refCount << endl; - if ( d->refCount <= 0 ) - quit(); -} - -KSessionManaged::KSessionManaged() -{ - sessionClients()->remove( this ); - sessionClients()->append( this ); -} - -KSessionManaged::~KSessionManaged() -{ - sessionClients()->remove( this ); -} - -bool KSessionManaged::saveState(TQSessionManager&) -{ - return true; -} - -bool KSessionManaged::commitData(TQSessionManager&) -{ - return true; -} - - -void TDEApplication::disableSessionManagement() { - bSessionManagement = false; -} - -void TDEApplication::enableSessionManagement() { - bSessionManagement = true; -#ifdef Q_WS_X11 - // Session management support in Qt/TDE is awfully broken. - // If konqueror disables session management right after its startup, - // and enables it later (preloading stuff), it won't be properly - // saved on session shutdown. - // I'm not actually sure why it doesn't work, but saveState() - // doesn't seem to be called on session shutdown, possibly - // because disabling session management after konqueror startup - // disabled it somehow. Forcing saveState() here for this application - // seems to fix it. - if( mySmcConnection ) { - SmcRequestSaveYourself( mySmcConnection, SmSaveLocal, False, - SmInteractStyleAny, - False, False ); - - // flush the request - IceFlush(SmcGetIceConnection(mySmcConnection)); - } -#endif -} - - -bool TDEApplication::requestShutDown( - ShutdownConfirm confirm, ShutdownType sdtype, ShutdownMode sdmode ) -{ -#ifdef Q_WS_X11 - TQApplication::syncX(); - /* use ksmserver's dcop interface if necessary */ - if ( confirm == ShutdownConfirmYes || - sdtype != ShutdownTypeDefault || - sdmode != ShutdownModeDefault ) - { - TQByteArray data; - TQDataStream arg(data, IO_WriteOnly); - arg << (int)confirm << (int)sdtype << (int)sdmode; - return dcopClient()->send( "ksmserver", "ksmserver", - "logout(int,int,int)", data ); - } - - if ( mySmcConnection ) { - // we already have a connection to the session manager, use it. - SmcRequestSaveYourself( mySmcConnection, SmSaveBoth, True, - SmInteractStyleAny, - confirm == ShutdownConfirmNo, True ); - - // flush the request - IceFlush(SmcGetIceConnection(mySmcConnection)); - return true; - } - - // open a temporary connection, if possible - - propagateSessionManager(); - TQCString smEnv = ::getenv("SESSION_MANAGER"); - if (smEnv.isEmpty()) - return false; - - if (! tmpSmcConnection) { - char cerror[256]; - char* myId = 0; - char* prevId = 0; - SmcCallbacks cb; - tmpSmcConnection = SmcOpenConnection( 0, 0, 1, 0, - 0, &cb, - prevId, - &myId, - 255, - cerror ); - ::free( myId ); // it was allocated by C - if (!tmpSmcConnection ) - return false; - } - - SmcRequestSaveYourself( tmpSmcConnection, SmSaveBoth, True, - SmInteractStyleAny, False, True ); - - // flush the request - IceFlush(SmcGetIceConnection(tmpSmcConnection)); - return true; -#else - // FIXME(E): Implement for Qt Embedded - return false; -#endif -} - -void TDEApplication::propagateSessionManager() -{ -#ifdef Q_WS_X11 - TQCString fName = TQFile::encodeName(locateLocal("socket", "KSMserver")); - TQCString display = ::getenv(DISPLAY); - // strip the screen number from the display - display.replace(TQRegExp("\\.[0-9]+$"), ""); - int i; - while( (i = display.find(':')) >= 0) - display[i] = '_'; - - fName += "_"+display; - TQCString smEnv = ::getenv("SESSION_MANAGER"); - bool check = smEnv.isEmpty(); - if ( !check && smModificationTime ) { - TQFileInfo info( fName ); - TQTime current = TQT_TQTIME_OBJECT(info.lastModified().time()); - check = current > *smModificationTime; - } - if ( check ) { - delete smModificationTime; - TQFile f( fName ); - if ( !f.open( IO_ReadOnly ) ) - return; - TQFileInfo info ( f ); - smModificationTime = new TQTime( TQT_TQTIME_OBJECT(info.lastModified().time()) ); - TQTextStream t(&f); - t.setEncoding( TQTextStream::Latin1 ); - TQString s = t.readLine(); - f.close(); - ::setenv( "SESSION_MANAGER", s.latin1(), true ); - } -#endif -} - -void TDEApplication::commitData( TQSessionManager& sm ) -{ - d->session_save = true; - bool canceled = false; - for (KSessionManaged* it = sessionClients()->first(); - it && !canceled; - it = sessionClients()->next() ) { - canceled = !it->commitData( sm ); - } - if ( canceled ) - sm.cancel(); - - if ( sm.allowsInteraction() ) { - TQWidgetList done; - TQWidgetList *list = TQApplication::topLevelWidgets(); - bool canceled = false; - TQWidget* w = list->first(); - while ( !canceled && w ) { - if ( !w->testWState( WState_ForceHide ) && !w->inherits("TDEMainWindow") ) { - TQCloseEvent e; - sendEvent( w, &e ); - canceled = !e.isAccepted(); - if ( !canceled ) - done.append( w ); - delete list; // one never knows... - list = TQApplication::topLevelWidgets(); - w = list->first(); - } else { - w = list->next(); - } - while ( w && done.containsRef( w ) ) - w = list->next(); - } - delete list; - } - - - if ( !bSessionManagement ) - sm.setRestartHint( TQSessionManager::RestartNever ); - else - sm.setRestartHint( TQSessionManager::RestartIfRunning ); - d->session_save = false; -} - -static void checkRestartVersion( TQSessionManager& sm ) -{ - Display* dpy = tqt_xdisplay(); - Atom type; - int format; - unsigned long nitems, after; - unsigned char* data; - if( XGetWindowProperty( dpy, RootWindow( dpy, 0 ), XInternAtom( dpy, "TDE_FULL_SESSION", False ), - 0, 1, False, AnyPropertyType, &type, &format, &nitems, &after, &data ) == Success ) { - if( data != NULL ) - XFree( data ); - if( type == XA_STRING && format == 8 ) { // session set, check if TDE_SESSION_VERSION is not set (meaning KDE3) - if( XGetWindowProperty( dpy, RootWindow( dpy, 0 ), XInternAtom( dpy, "TDE_SESSION_VERSION", False ), - 0, 1, False, AnyPropertyType, &type, &format, &nitems, &after, &data ) == Success ) { - if( data != NULL ) - XFree( data ); // KDE4 or newer - if( type == None ) - return; // we run in our native session, no need to wrap - } else { - return; // we run in our native session, no need to wrap - } - } - } - TQString wrapper = TDEStandardDirs::findExe( "trinity" ); - TQStringList restartCommand = sm.restartCommand(); - restartCommand.prepend( wrapper ); - sm.setRestartCommand( restartCommand ); -} - -void TDEApplication::saveState( TQSessionManager& sm ) -{ - d->session_save = true; -#ifdef Q_WS_X11 - static bool firstTime = true; - mySmcConnection = (SmcConn) sm.handle(); - - if ( !bSessionManagement ) { - sm.setRestartHint( TQSessionManager::RestartNever ); - d->session_save = false; - return; - } - else - sm.setRestartHint( TQSessionManager::RestartIfRunning ); - - if ( firstTime ) { - firstTime = false; - d->session_save = false; - return; // no need to save the state. - } - - // remove former session config if still existing, we want a new - // and fresh one. Note that we do not delete the config file here, - // this is done by the session manager when it executes the - // discard commands. In fact it would be harmful to remove the - // file here, as the session might be stored under a different - // name, meaning the user still might need it eventually. - if ( pSessionConfig ) { - delete pSessionConfig; - pSessionConfig = 0; - } - - // tell the session manager about our new lifecycle - TQStringList restartCommand = sm.restartCommand(); - - TQCString multiHead = getenv("TDE_MULTIHEAD"); - if (multiHead.lower() == "true") { - // if multihead is enabled, we save our -display argument so that - // we are restored onto the correct head... one problem with this - // is that the display is hard coded, which means we cannot restore - // to a different display (ie. if we are in a university lab and try, - // try to restore a multihead session, our apps could be started on - // someone else's display instead of our own) - TQCString displayname = getenv(DISPLAY); - if (! displayname.isNull()) { - // only store the command if we actually have a DISPLAY - // environment variable - restartCommand.append("-display"); - restartCommand.append(displayname); - } - sm.setRestartCommand( restartCommand ); - } - - checkRestartVersion( sm ); - - // finally: do session management - emit saveYourself(); // for compatibility - bool canceled = false; - for (KSessionManaged* it = sessionClients()->first(); - it && !canceled; - it = sessionClients()->next() ) { - canceled = !it->saveState( sm ); - } - - // if we created a new session config object, register a proper discard command - if ( pSessionConfig ) { - pSessionConfig->sync(); - TQStringList discard; - discard << "rm" << locateLocal("config", sessionConfigName()); - sm.setDiscardCommand( discard ); - } else { - sm.setDiscardCommand( TQStringList("") ); - } - - if ( canceled ) - sm.cancel(); -#else - // FIXME(E): Implement for Qt Embedded -#endif - d->session_save = false; -} - -bool TDEApplication::sessionSaving() const -{ - return d->session_save; -} - -void TDEApplication::startKdeinit() -{ -#ifndef Q_WS_WIN //TODO - TDEInstance inst( "starttdeinitlock" ); - TDELockFile lock( locateLocal( "tmp", "starttdeinitlock", &inst )); - if( lock.lock( TDELockFile::LockNoBlock ) != TDELockFile::LockOK ) { - lock.lock(); - DCOPClient cl; - if( cl.attach()) - return; // whoever held the lock has already started dcopserver - } - // Try to launch tdeinit. - TQString srv = TDEStandardDirs::findExe(TQString::fromLatin1("tdeinit")); - if (srv.isEmpty()) - srv = TDEStandardDirs::findExe(TQString::fromLatin1("tdeinit"), TDEGlobal::dirs()->kfsstnd_defaultbindir()); - if (srv.isEmpty()) - return; - if (kapp && (Tty != kapp->type())) - setOverrideCursor( tqwaitCursor ); - my_system(TQFile::encodeName(srv)+" --suicide"+" --new-startup"); - if (kapp && (Tty != kapp->type())) - restoreOverrideCursor(); -#endif -} - -void TDEApplication::dcopFailure(const TQString &msg) -{ - static int failureCount = 0; - failureCount++; - if (failureCount == 1) - { - startKdeinit(); - return; - } - if (failureCount == 2) - { -#ifdef Q_WS_WIN - TDEGlobal::config()->setGroup("General"); - if (TDEGlobal::config()->readBoolEntry("ignoreDCOPFailures", false)) - return; -#endif - TQString msgStr(i18n("There was an error setting up inter-process " - "communications for TDE. The message returned " - "by the system was:\n\n")); - msgStr += msg; - msgStr += i18n("\n\nPlease check that the \"dcopserver\" program is running!"); - - if (Tty != kapp->type()) - { - TQMessageBox::critical - ( - kapp->mainWidget(), - i18n("DCOP communications error (%1)").arg(kapp->caption()), - msgStr, - i18n("&OK") - ); - } - else - { - fprintf(stderr, "%s\n", msgStr.local8Bit().data()); - } - - return; - } -} - -static const TDECmdLineOptions qt_options[] = -{ - //FIXME: Check if other options are specific to Qt/X11 -#ifdef Q_WS_X11 - { "display ", I18N_NOOP("Use the X-server display 'displayname'"), 0}, -#else - { "display ", I18N_NOOP("Use the QWS display 'displayname'"), 0}, -#endif - { "session ", I18N_NOOP("Restore the application for the given 'sessionId'"), 0}, - { "cmap", I18N_NOOP("Causes the application to install a private color\nmap on an 8-bit display"), 0}, - { "ncols ", I18N_NOOP("Limits the number of colors allocated in the color\ncube on an 8-bit display, if the application is\nusing the TQApplication::ManyColor color\nspecification"), 0}, - { "nograb", I18N_NOOP("tells Qt to never grab the mouse or the keyboard"), 0}, - { "dograb", I18N_NOOP("running under a debugger can cause an implicit\n-nograb, use -dograb to override"), 0}, - { "sync", I18N_NOOP("switches to synchronous mode for debugging"), 0}, - { "fn", 0, 0}, - { "font ", I18N_NOOP("defines the application font"), 0}, - { "bg", 0, 0}, - { "background ", I18N_NOOP("sets the default background color and an\napplication palette (light and dark shades are\ncalculated)"), 0}, - { "fg", 0, 0}, - { "foreground ", I18N_NOOP("sets the default foreground color"), 0}, - { "btn", 0, 0}, - { "button ", I18N_NOOP("sets the default button color"), 0}, - { "name ", I18N_NOOP("sets the application name"), 0}, - { "title ", I18N_NOOP("sets the application title (caption)"), 0}, -#ifdef Q_WS_X11 - { "visual TrueColor", I18N_NOOP("forces the application to use a TrueColor visual on\nan 8-bit display"), 0}, - { "inputstyle <inputstyle>", I18N_NOOP("sets XIM (X Input Method) input style. Possible\nvalues are onthespot, overthespot, offthespot and\nroot"), 0 }, - { "im <XIM server>", I18N_NOOP("set XIM server"),0}, - { "noxim", I18N_NOOP("disable XIM"), 0 }, -#endif -#ifdef Q_WS_QWS - { "qws", I18N_NOOP("forces the application to run as QWS Server"), 0}, -#endif - { "reverse", I18N_NOOP("mirrors the whole layout of widgets"), 0}, - TDECmdLineLastOption -}; - -static const TDECmdLineOptions kde_options[] = -{ - { "caption <caption>", I18N_NOOP("Use 'caption' as name in the titlebar"), 0}, - { "icon <icon>", I18N_NOOP("Use 'icon' as the application icon"), 0}, - { "miniicon <icon>", I18N_NOOP("Use 'icon' as the icon in the titlebar"), 0}, - { "config <filename>", I18N_NOOP("Use alternative configuration file"), 0}, - { "dcopserver <server>", I18N_NOOP("Use the DCOP Server specified by 'server'"), 0}, - { "nocrashhandler", I18N_NOOP("Disable crash handler, to get core dumps"), 0}, - { "waitforwm", I18N_NOOP("Waits for a WM_NET compatible windowmanager"), 0}, - { "style <style>", I18N_NOOP("sets the application GUI style"), 0}, - { "geometry <geometry>", I18N_NOOP("sets the client geometry of the main widget - see man X for the argument format"), 0}, - { "smkey <sessionKey>", 0, 0}, // this option is obsolete and exists only to allow smooth upgrades from sessions - // saved under Qt 3.0.x -- Qt 3.1.x includes the session key now automatically in - // the session id (Simon) - TDECmdLineLastOption -}; - -void -TDEApplication::addCmdLineOptions() -{ - TDECmdLineArgs::addCmdLineOptions(qt_options, "Qt", "qt"); - TDECmdLineArgs::addCmdLineOptions(kde_options, "TDE", "tde"); -} - -void TDEApplication::parseCommandLine( ) -{ - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs("tde"); - - if ( !args ) return; - - if (args->isSet("config")) - { - TQString config = TQString::fromLocal8Bit(args->getOption("config")); - setConfigName(config); - } - - if (args->isSet("style")) - { - - TQStringList plugins = TDEGlobal::dirs()->resourceDirs( "qtplugins" ); - TQStringList::Iterator itp = plugins.begin(); - while (itp != plugins.end()) { - addLibraryPath( *itp ); - ++itp; - } - - TQStringList styles = TQStyleFactory::keys(); - TQString reqStyle(args->getOption("style").lower()); - - TQStringList list = libraryPaths(); - TQStringList::Iterator it = list.begin(); - while( it != list.end() ) { - ++it; - } - - for (TQStringList::ConstIterator it = styles.begin(); it != styles.end(); ++it) { - if ((*it).lower() == reqStyle) - { - d->overrideStyle = *it; - break; - } - } - - if (d->overrideStyle.isEmpty()) - fprintf(stderr, "%s", TQString(i18n("The style %1 was not found\n").arg(reqStyle)).local8Bit().data()); - } - - if (args->isSet("caption")) - { - aCaption = TQString::fromLocal8Bit(args->getOption("caption")); - } - - if (args->isSet("miniicon")) - { - const char *tmp = args->getOption("miniicon"); - if (!aIconPixmap.pm.miniIcon) { - aIconPixmap.pm.miniIcon = new TQPixmap; - } - *aIconPixmap.pm.miniIcon = SmallIcon(tmp); - aMiniIconName = tmp; - } - - if (args->isSet("icon")) - { - const char *tmp = args->getOption("icon"); - if (!aIconPixmap.pm.icon) { - aIconPixmap.pm.icon = new TQPixmap; - } - *aIconPixmap.pm.icon = DesktopIcon( tmp ); - aIconName = tmp; - if (!aIconPixmap.pm.miniIcon) { - aIconPixmap.pm.miniIcon = new TQPixmap; - } - if (aIconPixmap.pm.miniIcon->isNull()) - { - *aIconPixmap.pm.miniIcon = SmallIcon( tmp ); - aMiniIconName = tmp; - } - } - - bool nocrashhandler = (getenv("TDE_DEBUG") != NULL); - if (!nocrashhandler && args->isSet("crashhandler")) - { - // set default crash handler / set emergency save function to nothing - TDECrash::setCrashHandler(TDECrash::defaultCrashHandler); - TDECrash::setEmergencySaveFunction(NULL); - - TDECrash::setApplicationName(TQString(args->appName())); - } - -#ifdef Q_WS_X11 - if ( args->isSet( "waitforwm" ) ) { - Atom type; - (void) desktop(); // trigger desktop creation, we need PropertyNotify events for the root window - int format; - unsigned long length, after; - unsigned char *data; - while ( XGetWindowProperty( tqt_xdisplay(), tqt_xrootwin(), atom_NetSupported, - 0, 1, false, AnyPropertyType, &type, &format, - &length, &after, &data ) != Success || !length ) { - if ( data ) - XFree( data ); - XEvent event; - XWindowEvent( tqt_xdisplay(), tqt_xrootwin(), PropertyChangeMask, &event ); - } - if ( data ) - XFree( data ); - } -#else - // FIXME(E): Implement for Qt Embedded -#endif - - if (args->isSet("geometry")) - { - d->geometry_arg = args->getOption("geometry"); - } - - if (args->isSet("smkey")) - { - d->sessionKey = args->getOption("smkey"); - } - -} - -TQString TDEApplication::geometryArgument() const -{ - return d->geometry_arg; -} - -TQPixmap TDEApplication::icon() const -{ - if( !aIconPixmap.pm.icon) { - aIconPixmap.pm.icon = new TQPixmap; - } - if( aIconPixmap.pm.icon->isNull()) { - *aIconPixmap.pm.icon = DesktopIcon( instanceName() ); - } - return *aIconPixmap.pm.icon; -} - -TQString TDEApplication::iconName() const -{ - return aIconName.isNull() ? (TQString)instanceName() : aIconName; -} - -TQPixmap TDEApplication::miniIcon() const -{ - if (!aIconPixmap.pm.miniIcon) { - aIconPixmap.pm.miniIcon = new TQPixmap; - } - if (aIconPixmap.pm.miniIcon->isNull()) { - *aIconPixmap.pm.miniIcon = SmallIcon( instanceName() ); - } - return *aIconPixmap.pm.miniIcon; -} - -TQString TDEApplication::miniIconName() const -{ - return aMiniIconName.isNull() ? (TQString)instanceName() : aMiniIconName; -} - -extern void kDebugCleanup(); - -TDEApplication::~TDEApplication() -{ - delete aIconPixmap.pm.miniIcon; - aIconPixmap.pm.miniIcon = 0L; - delete aIconPixmap.pm.icon; - aIconPixmap.pm.icon = 0L; - delete d->m_KAppDCOPInterface; - - // First call the static deleters and then call KLibLoader::cleanup() - // The static deleters may delete libraries for which they need KLibLoader. - // KLibLoader will take care of the remaining ones. - TDEGlobal::deleteStaticDeleters(); - KLibLoader::cleanUp(); - - delete smw; - - // close down IPC - delete s_DCOPClient; - s_DCOPClient = 0L; - - TDEProcessController::deref(); - -#ifdef Q_WS_X11 - if ( d->oldXErrorHandler != NULL ) - XSetErrorHandler( d->oldXErrorHandler ); - if ( d->oldXIOErrorHandler != NULL ) - XSetIOErrorHandler( d->oldXIOErrorHandler ); - if ( d->oldIceIOErrorHandler != NULL ) - IceSetIOErrorHandler( d->oldIceIOErrorHandler ); -#endif - - delete d; - KApp = 0; - -#ifdef Q_WS_X11 - mySmcConnection = 0; - delete smModificationTime; - smModificationTime = 0; - - // close the temporary smc connection - if (tmpSmcConnection) { - SmcCloseConnection( tmpSmcConnection, 0, 0 ); - tmpSmcConnection = 0; - } -#else - // FIXME(E): Implement for Qt Embedded -#endif -} - - -#ifdef Q_WS_X11 -class KAppX11HackWidget: public TQWidget -{ -public: - bool publicx11Event( XEvent * e) { return x11Event( e ); } -}; -#endif - -#if defined(Q_WS_X11) && defined(COMPOSITE) -bool TDEApplication::isCompositionManagerAvailable() { - bool have_manager = false; - const char *home; - struct passwd *p; - p = getpwuid(getuid()); - if (p) - home = p->pw_dir; - else - home = getenv("HOME"); - - char *filename; - const char *configfile = "/.kompmgr.available"; - int n = strlen(home)+strlen(configfile)+1; - filename = (char*)malloc(n*sizeof(char)); - memset(filename,0,n); - strcat(filename, home); - strcat(filename, configfile); - - // Now that we did all that by way of introduction...read the file! - FILE *pFile; - pFile = fopen(filename, "r"); - if (pFile) { - have_manager = true; - fclose(pFile); - } - - free(filename); - filename = NULL; - - return have_manager; -} - -bool TDEApplication::detectCompositionManagerAvailable(bool force_available, bool available) { - bool compositing_manager_available; - if (force_available) { - compositing_manager_available = available; - } - else { - // See if compositing has been enabled - TDECmdLineArgs *qtargs = TDECmdLineArgs::parsedArgs("qt"); - char *displayname = 0; - if ( qtargs->isSet("display")) - displayname = qtargs->getOption( "display" ).data(); - - Display *dpy = XOpenDisplay( displayname ); - - x11_composite_error_generated = false; - compositing_manager_available = false; - XSetErrorHandler(x11_error); - if (!XQueryExtension (dpy, COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error)) { - XSetErrorHandler(NULL); - compositing_manager_available = false; - } - else { - if (available) { // FIXME This variable does double duty to avoid breaking the ABI for R14.0. In reality it should be called perform_deep_check - Window root_window = XDefaultRootWindow(dpy); - XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual); - XSync(dpy, false); - if (x11_composite_error_generated == true) { - compositing_manager_available = true; - } - else { - XCompositeUnredirectSubwindows(dpy, root_window, CompositeRedirectManual); - compositing_manager_available = false; - } - XSetErrorHandler(NULL); - XCloseDisplay(dpy); - } - else { - compositing_manager_available = true; - } - } - } - - const char *home; - struct passwd *p; - p = getpwuid(getuid()); - if (p) - home = p->pw_dir; - else - home = getenv("HOME"); - - char *filename; - const char *configfile = "/.kompmgr.available"; - int n = strlen(home)+strlen(configfile)+1; - filename = (char*)malloc(n*sizeof(char)); - memset(filename,0,n); - strcat(filename, home); - strcat(filename, configfile); - - /* now that we did all that by way of introduction...create or remove the file! */ - if (compositing_manager_available) { - FILE *pFile; - char buffer[255]; - sprintf(buffer, "available"); - pFile = fopen(filename, "w"); - if (pFile) { - fwrite(buffer,1,strlen(buffer), pFile); - fclose(pFile); - } - } - else { - unlink(filename); - } - - free(filename); - filename = NULL; - - return compositing_manager_available; -} - -Display* TDEApplication::openX11RGBADisplay() { - TDECmdLineArgs *qtargs = TDECmdLineArgs::parsedArgs("qt"); - char *display = 0; - if ( qtargs->isSet("display")) - display = qtargs->getOption( "display" ).data(); - - Display *dpy = XOpenDisplay( display ); - if ( !dpy ) { - kdError() << "cannot connect to X server " << display << endl; - exit( 1 ); - } - - return dpy; -} - -Qt::HANDLE TDEApplication::getX11RGBAVisual(Display *dpy) { - getX11RGBAInformation(dpy); - if (TDEApplication::isCompositionManagerAvailable() == true) { - return argb_x11_visual; - } - else { - return (Qt::HANDLE)NULL; - } -} - -Qt::HANDLE TDEApplication::getX11RGBAColormap(Display *dpy) { - getX11RGBAInformation(dpy); - if (TDEApplication::isCompositionManagerAvailable() == true) { - return argb_x11_colormap; - } - else { - return (Qt::HANDLE)NULL; - } -} - -bool TDEApplication::isX11CompositionAvailable() { - return (argb_visual & isCompositionManagerAvailable()); -} - -void TDEApplication::getX11RGBAInformation(Display *dpy) { - if ( !dpy ) { - argb_visual = false; - return; - } - - int screen = DefaultScreen( dpy ); - Colormap colormap = 0; - Visual *visual = 0; - int event_base, error_base; - - if ( XRenderQueryExtension( dpy, &event_base, &error_base ) ) { - int nvi; - XVisualInfo templ; - templ.screen = screen; - templ.depth = 32; - templ.c_class = TrueColor; - XVisualInfo *xvi = XGetVisualInfo( dpy, VisualScreenMask | VisualDepthMask - | VisualClassMask, &templ, &nvi ); - - for ( int i = 0; i < nvi; i++ ) { - XRenderPictFormat *format = XRenderFindVisualFormat( dpy, xvi[i].visual ); - if ( format->type == PictTypeDirect && format->direct.alphaMask ) { - visual = xvi[i].visual; - colormap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, AllocNone ); - kdDebug() << "found visual with alpha support" << endl; - argb_visual = true; - break; - } - } - } - - if( argb_visual ) { - argb_x11_visual = Qt::HANDLE( visual ); - argb_x11_colormap = Qt::HANDLE( colormap ); - argb_visual = true; - return; - } - argb_visual = false; - return; -} -#else -void TDEApplication::getX11RGBAInformation(Display *dpy) { -} - -bool TDEApplication::isCompositionManagerAvailable() { - return false; -} - -bool TDEApplication::detectCompositionManagerAvailable(bool force_available) { - const char *home; - struct passwd *p; - p = getpwuid(getuid()); - if (p) - home = p->pw_dir; - else - home = getenv("HOME"); - - char *filename; - const char *configfile = "/.kompmgr.available"; - int n = strlen(home)+strlen(configfile)+1; - filename = (char*)malloc(n*sizeof(char)); - memset(filename,0,n); - strcat(filename, home); - strcat(filename, configfile); - - /* now that we did all that by way of introduction...create or remove the file! */ - if (force_available) { - FILE *pFile; - char buffer[255]; - sprintf(buffer, "available"); - pFile = fopen(filename, "w"); - if (pFile) { - fwrite(buffer,1,strlen(buffer), pFile); - fclose(pFile); - } - } - else { - unlink(filename); - } - - free(filename); - filename = NULL; - - return false; -} - -Display* TDEApplication::openX11RGBADisplay() { - return 0; -} - -Qt::HANDLE TDEApplication::getX11RGBAVisual(char *display) { - return 0; -} - -Qt::HANDLE TDEApplication::getX11RGBAColormap(char *display) { - return 0; -} - -bool TDEApplication::isX11CompositionAvailable() { - return false; -} - -TDEApplication TDEApplication::KARGBApplication( bool allowStyles ) { - return TDEApplication::TDEApplication(allowStyles, true); -} -#endif - -static bool kapp_block_user_input = false; - -void TDEApplication::dcopBlockUserInput( bool b ) -{ - kapp_block_user_input = b; -} - -#ifdef Q_WS_X11 -bool TDEApplication::x11EventFilter( XEvent *_event ) -{ - switch ( _event->type ) { - case ClientMessage: - { -#if KDE_IS_VERSION( 3, 90, 90 ) -#warning This should be already in Qt, check. -#endif - // Workaround for focus stealing prevention not working when dragging e.g. text from KWrite - // to KDesktop -> the dialog asking for filename doesn't get activated. This is because - // Qt-3.2.x doesn't have concept of tqt_x_user_time at all, and Qt-3.3.0b1 passes the timestamp - // in the XdndDrop message in incorrect field (and doesn't update tqt_x_user_time either). - // Patch already sent, future Qt version should have this fixed. - if( _event->xclient.message_type == kde_xdnd_drop ) - { // if the message is XdndDrop - if( _event->xclient.data.l[ 1 ] == 1 << 24 // and it's broken the way it's in Qt-3.2.x - && _event->xclient.data.l[ 2 ] == 0 - && _event->xclient.data.l[ 4 ] == 0 - && _event->xclient.data.l[ 3 ] != 0 ) - { - if( GET_QT_X_USER_TIME() == 0 - || NET::timestampCompare( _event->xclient.data.l[ 3 ], GET_QT_X_USER_TIME() ) > 0 ) - { // and the timestamp looks reasonable - SET_QT_X_USER_TIME(_event->xclient.data.l[ 3 ]); // update our tqt_x_user_time from it - } - } - else // normal DND, only needed until Qt updates tqt_x_user_time from XdndDrop - { - if( GET_QT_X_USER_TIME() == 0 - || NET::timestampCompare( _event->xclient.data.l[ 2 ], GET_QT_X_USER_TIME() ) > 0 ) - { // the timestamp looks reasonable - SET_QT_X_USER_TIME(_event->xclient.data.l[ 2 ]); // update our tqt_x_user_time from it - } - } - } - } - default: break; - } - - if ( kapp_block_user_input ) { - switch ( _event->type ) { - case ButtonPress: - case ButtonRelease: - case XKeyPress: - case XKeyRelease: - case MotionNotify: - case EnterNotify: - case LeaveNotify: - return true; - default: - break; - } - } - - if (x11Filter) { - for (TQWidget *w=x11Filter->first(); w; w=x11Filter->next()) { - if (((KAppX11HackWidget*) w)->publicx11Event(_event)) - return true; - } - } - - if ((_event->type == ClientMessage) && - (_event->xclient.message_type == kipcCommAtom)) - { - XClientMessageEvent *cme = (XClientMessageEvent *) _event; - - int id = cme->data.l[0]; - int arg = cme->data.l[1]; - if ((id < 32) && (kipcEventMask & (1 << id))) - { - switch (id) - { - case KIPC::StyleChanged: - TDEGlobal::config()->reparseConfiguration(); - tdedisplaySetStyle(); - break; - - case KIPC::ToolbarStyleChanged: - TDEGlobal::config()->reparseConfiguration(); - if (useStyles) - emit toolbarAppearanceChanged(arg); - break; - - case KIPC::PaletteChanged: - TDEGlobal::config()->reparseConfiguration(); - tdedisplaySetPalette(); - break; - - case KIPC::FontChanged: - TDEGlobal::config()->reparseConfiguration(); - TDEGlobalSettings::rereadFontSettings(); - tdedisplaySetFont(); - break; - - case KIPC::BackgroundChanged: - emit backgroundChanged(arg); - break; - - case KIPC::SettingsChanged: - TDEGlobal::config()->reparseConfiguration(); - if (arg == SETTINGS_PATHS) - TDEGlobalSettings::rereadPathSettings(); - else if (arg == SETTINGS_MOUSE) - TDEGlobalSettings::rereadMouseSettings(); - propagateSettings((SettingsCategory)arg); - break; - - case KIPC::IconChanged: - TQPixmapCache::clear(); - TDEGlobal::config()->reparseConfiguration(); - TDEGlobal::instance()->newIconLoader(); - emit updateIconLoaders(); - emit iconChanged(arg); - break; - - case KIPC::ClipboardConfigChanged: - TDEClipboardSynchronizer::newConfiguration(arg); - break; - - case KIPC::BlockShortcuts: - TDEGlobalAccel::blockShortcuts(arg); - emit kipcMessage(id, arg); // some apps may do additional things - break; - } - } - else if (id >= 32) - { - emit kipcMessage(id, arg); - } - return true; - } - return false; -} -#endif // Q_WS_X11 - -void TDEApplication::updateUserTimestamp( unsigned long time ) -{ -#if defined Q_WS_X11 - if( time == 0 ) - { // get current X timestamp - Window w = XCreateSimpleWindow( tqt_xdisplay(), tqt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 ); - XSelectInput( tqt_xdisplay(), w, PropertyChangeMask ); - unsigned char data[ 1 ]; - XChangeProperty( tqt_xdisplay(), w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 ); - XEvent ev; - XWindowEvent( tqt_xdisplay(), w, PropertyChangeMask, &ev ); - time = ev.xproperty.time; - XDestroyWindow( tqt_xdisplay(), w ); - } - if( GET_QT_X_USER_TIME() == 0 - || NET::timestampCompare( time, GET_QT_X_USER_TIME() ) > 0 ) // check time > tqt_x_user_time - SET_QT_X_USER_TIME(time); -#endif -} - -unsigned long TDEApplication::userTimestamp() const -{ -#if defined Q_WS_X11 - return GET_QT_X_USER_TIME(); -#else - return 0; -#endif -} - -void TDEApplication::updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time ) -{ -#if defined Q_WS_X11 - if( time == 0 ) - time = GET_QT_X_USER_TIME(); - DCOPRef( dcopId, "MainApplication-Interface" ).call( "updateUserTimestamp", time ); -#endif -} - -void TDEApplication::invokeEditSlot( const char *slot ) -{ - TQObject *object = TQT_TQOBJECT(focusWidget()); - if( !object ) - return; - - TQMetaObject *meta = object->metaObject(); - - int idx = meta->findSlot( slot + 1, true ); - if( idx < 0 ) - return; - - object->tqt_invoke( idx, 0 ); -} - -void TDEApplication::addKipcEventMask(int id) -{ - if (id >= 32) - { - kdDebug(101) << "Cannot use KIPC event mask for message IDs >= 32\n"; - return; - } - kipcEventMask |= (1 << id); -} - -void TDEApplication::removeKipcEventMask(int id) -{ - if (id >= 32) - { - kdDebug(101) << "Cannot use KIPC event mask for message IDs >= 32\n"; - return; - } - kipcEventMask &= ~(1 << id); -} - -void TDEApplication::enableStyles() -{ - if (!useStyles) - { - useStyles = true; - applyGUIStyle(); - } -} - -void TDEApplication::disableStyles() -{ - useStyles = false; -} - -void TDEApplication::applyGUIStyle() -{ - if ( !useStyles ) return; - - TDEConfigGroup pConfig (TDEGlobal::config(), "General"); - TQString defaultStyle = TDEStyle::defaultStyle(); - TQString styleStr = pConfig.readEntry("widgetStyle", defaultStyle); - - if (d->overrideStyle.isEmpty()) { - // ### add check whether we already use the correct style to return then - // (workaround for Qt misbehavior to avoid double style initialization) - - TQStyle* sp = TQStyleFactory::create( styleStr ); - - // If there is no default style available, try falling back any available style - if ( !sp && styleStr != defaultStyle) - sp = TQStyleFactory::create( defaultStyle ); - if ( !sp ) - sp = TQStyleFactory::create( *(TQStyleFactory::keys().begin()) ); - setStyle(sp); - } - else - setStyle(d->overrideStyle); - // Reread palette from config file. - tdedisplaySetPalette(); -} - -TQString TDEApplication::caption() const -{ - // Caption set from command line ? - if( !aCaption.isNull() ) - return aCaption; - else - // We have some about data ? - if ( TDEGlobal::instance()->aboutData() ) - return TDEGlobal::instance()->aboutData()->programName(); - else - // Last resort : application name - return name(); -} - - -// -// 1999-09-20: Espen Sand -// An attempt to simplify consistent captions. -// -TQString TDEApplication::makeStdCaption( const TQString &userCaption, - bool withAppName, bool modified ) const -{ - TQString s = userCaption.isEmpty() ? caption() : userCaption; - - // If the document is modified, add '[modified]'. - if (modified) - s += TQString::fromUtf8(" [") + i18n("modified") + TQString::fromUtf8("]"); - - if ( !userCaption.isEmpty() ) { - // Add the application name if: - // User asked for it, it's not a duplication and the app name (caption()) is not empty - if ( withAppName && !caption().isNull() && !userCaption.endsWith(caption()) ) - s += TQString::fromUtf8(" - ") + caption(); - } - - return s; -} - -TQPalette TDEApplication::createApplicationPalette() -{ - TDEConfig *config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "General" ); - return createApplicationPalette( config, TDEGlobalSettings::contrast() ); -} - -TQPalette TDEApplication::createApplicationPalette( TDEConfig *config, int contrast_ ) -{ - TQColor trinity4Background( 239, 239, 239 ); - TQColor trinity4Blue( 103,141,178 ); - - TQColor trinity4Button; - if ( TQPixmap::defaultDepth() > 8 ) - trinity4Button.setRgb( 221, 223, 228 ); - else - trinity4Button.setRgb( 220, 220, 220 ); - - TQColor trinity4Link( 0, 0, 238 ); - TQColor trinity4VisitedLink( 82, 24, 139 ); - - TQColor background = config->readColorEntry( "background", &trinity4Background ); - TQColor foreground = config->readColorEntry( "foreground", tqblackptr ); - TQColor button = config->readColorEntry( "buttonBackground", &trinity4Button ); - TQColor buttonText = config->readColorEntry( "buttonForeground", tqblackptr ); - TQColor highlight = config->readColorEntry( "selectBackground", &trinity4Blue ); - TQColor highlightedText = config->readColorEntry( "selectForeground", tqwhiteptr ); - TQColor base = config->readColorEntry( "windowBackground", tqwhiteptr ); - TQColor baseText = config->readColorEntry( "windowForeground", tqblackptr ); - TQColor link = config->readColorEntry( "linkColor", &trinity4Link ); - TQColor visitedLink = config->readColorEntry( "visitedLinkColor", &trinity4VisitedLink ); - - int highlightVal, lowlightVal; - highlightVal = 100 + (2*contrast_+4)*16/10; - lowlightVal = 100 + (2*contrast_+4)*10; - - TQColor disfg = foreground; - - int h, s, v; - disfg.hsv( &h, &s, &v ); - if (v > 128) - // dark bg, light fg - need a darker disabled fg - disfg = disfg.dark(lowlightVal); - else if (disfg != Qt::black) - // light bg, dark fg - need a lighter disabled fg - but only if !black - disfg = disfg.light(highlightVal); - else - // black fg - use darkgray disabled fg - disfg = Qt::darkGray; - - - TQColorGroup disabledgrp(disfg, background, - background.light(highlightVal), - background.dark(lowlightVal), - background.dark(120), - background.dark(120), base); - - TQColorGroup colgrp(foreground, background, background.light(highlightVal), - background.dark(lowlightVal), - background.dark(120), - baseText, base); - - int inlowlightVal = lowlightVal-25; - if(inlowlightVal < 120) - inlowlightVal = 120; - - colgrp.setColor(TQColorGroup::Highlight, highlight); - colgrp.setColor(TQColorGroup::HighlightedText, highlightedText); - colgrp.setColor(TQColorGroup::Button, button); - colgrp.setColor(TQColorGroup::ButtonText, buttonText); - colgrp.setColor(TQColorGroup::Midlight, background.light(110)); - colgrp.setColor(TQColorGroup::Link, link); - colgrp.setColor(TQColorGroup::LinkVisited, visitedLink); - - disabledgrp.setColor(TQColorGroup::Button, button); - - TQColor disbtntext = buttonText; - disbtntext.hsv( &h, &s, &v ); - if (v > 128) - // dark button, light buttonText - need a darker disabled buttonText - disbtntext = disbtntext.dark(lowlightVal); - else if (disbtntext != Qt::black) - // light buttonText, dark button - need a lighter disabled buttonText - but only if !black - disbtntext = disbtntext.light(highlightVal); - else - // black button - use darkgray disabled buttonText - disbtntext = Qt::darkGray; - - disabledgrp.setColor(TQColorGroup::ButtonText, disbtntext); - disabledgrp.setColor(TQColorGroup::Midlight, background.light(110)); - disabledgrp.setColor(TQColorGroup::Highlight, highlight.dark(120)); - disabledgrp.setColor(TQColorGroup::Link, link); - disabledgrp.setColor(TQColorGroup::LinkVisited, visitedLink); - - return TQPalette(colgrp, disabledgrp, colgrp); -} - - -void TDEApplication::tdedisplaySetPalette() -{ -#ifdef Q_WS_MACX - //Can I have this on other platforms, please!? --Sam - { - TDEConfig *config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "General" ); - bool do_not_set_palette = FALSE; - if(config->readBoolEntry("nopaletteChange", &do_not_set_palette)) - return; - } -#endif - TQApplication::setPalette( createApplicationPalette(), true); - emit tdedisplayPaletteChanged(); - emit appearanceChanged(); -} - - -void TDEApplication::tdedisplaySetFont() -{ - TQApplication::setFont(TDEGlobalSettings::generalFont(), true); - TQApplication::setFont(TDEGlobalSettings::menuFont(), true, TQMENUBAR_OBJECT_NAME_STRING); - TQApplication::setFont(TDEGlobalSettings::menuFont(), true, TQPOPUPMENU_OBJECT_NAME_STRING); - TQApplication::setFont(TDEGlobalSettings::menuFont(), true, "TDEPopupTitle"); - - // "patch" standard TQStyleSheet to follow our fonts - TQStyleSheet* sheet = TQStyleSheet::defaultSheet(); - sheet->item ("pre")->setFontFamily (TDEGlobalSettings::fixedFont().family()); - sheet->item ("code")->setFontFamily (TDEGlobalSettings::fixedFont().family()); - sheet->item ("tt")->setFontFamily (TDEGlobalSettings::fixedFont().family()); - - emit tdedisplayFontChanged(); - emit appearanceChanged(); -} - - -void TDEApplication::tdedisplaySetStyle() -{ - if (useStyles) - { - applyGUIStyle(); - emit tdedisplayStyleChanged(); - emit appearanceChanged(); - } -} - - -void TDEApplication::propagateSettings(SettingsCategory arg) -{ - TDEConfigBase* config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "KDE" ); - -#ifdef QT_HAVE_MAX_IMAGE_SIZE - TQSize maxImageSize(4096, 4096); - maxImageSize = config->readSizeEntry("MaxImageSize", &maxImageSize); - TQImage::setMaxImageSize(maxImageSize); -#endif - - int num = config->readNumEntry("CursorBlinkRate", TQApplication::cursorFlashTime()); - if ((num != 0) && (num < 200)) - num = 200; - if (num > 2000) - num = 2000; - TQApplication::setCursorFlashTime(num); - num = config->readNumEntry("DoubleClickInterval", TQApplication::doubleClickInterval()); - TQApplication::setDoubleClickInterval(num); - num = config->readNumEntry("StartDragTime", TQApplication::startDragTime()); - TQApplication::setStartDragTime(num); - num = config->readNumEntry("StartDragDist", TQApplication::startDragDistance()); - TQApplication::setStartDragDistance(num); - num = config->readNumEntry("WheelScrollLines", TQApplication::wheelScrollLines()); - TQApplication::setWheelScrollLines(num); - - bool b = config->readBoolEntry("EffectAnimateMenu", false); - TQApplication::setEffectEnabled( Qt::UI_AnimateMenu, b); - b = config->readBoolEntry("EffectFadeMenu", false); - TQApplication::setEffectEnabled( Qt::UI_FadeMenu, b); - b = config->readBoolEntry("EffectAnimateCombo", false); - TQApplication::setEffectEnabled( Qt::UI_AnimateCombo, b); - b = config->readBoolEntry("EffectAnimateTooltip", false); - TQApplication::setEffectEnabled( Qt::UI_AnimateTooltip, b); - b = config->readBoolEntry("EffectFadeTooltip", false); - TQApplication::setEffectEnabled( Qt::UI_FadeTooltip, b); - b = !config->readBoolEntry("EffectNoTooltip", false); - TQToolTip::setGloballyEnabled( b ); - - emit settingsChanged(arg); -} - -void TDEApplication::installKDEPropertyMap() -{ -#ifndef QT_NO_SQL - static bool installed = false; - if (installed) return; - installed = true; - /** - * If you are adding a widget that was missing please - * make sure to also add it to TDEConfigDialogManager's retrieveSettings() - * function. - * Thanks. - */ - // TQSqlPropertyMap takes ownership of the new default map. - TQSqlPropertyMap *kdeMap = new TQSqlPropertyMap; - kdeMap->insert( "KColorButton", "color" ); - kdeMap->insert( "KComboBox", "currentItem" ); - kdeMap->insert( "KDatePicker", "date" ); - kdeMap->insert( "KDateWidget", "date" ); - kdeMap->insert( "KDateTimeWidget", "dateTime" ); - kdeMap->insert( "KEditListBox", "items" ); - kdeMap->insert( "TDEFontCombo", "family" ); - kdeMap->insert( "TDEFontRequester", "font" ); - kdeMap->insert( "TDEFontChooser", "font" ); - kdeMap->insert( "KHistoryCombo", "currentItem" ); - kdeMap->insert( "TDEListBox", "currentItem" ); - kdeMap->insert( "KLineEdit", "text" ); - kdeMap->insert( "KRestrictedLine", "text" ); - kdeMap->insert( "KSqueezedTextLabel", "text" ); - kdeMap->insert( "KTextBrowser", "source" ); - kdeMap->insert( "KTextEdit", "text" ); - kdeMap->insert( "KURLRequester", "url" ); - kdeMap->insert( "KPasswordEdit", "password" ); - kdeMap->insert( "KIntNumInput", "value" ); - kdeMap->insert( "KIntSpinBox", "value" ); - kdeMap->insert( "KDoubleNumInput", "value" ); - // Temp til fixed in QT then enable ifdef with the correct version num - kdeMap->insert( TQGROUPBOX_OBJECT_NAME_STRING, "checked" ); - kdeMap->insert( TQTABWIDGET_OBJECT_NAME_STRING, "currentPage" ); - TQSqlPropertyMap::installDefaultMap( kdeMap ); -#endif -} - -void TDEApplication::invokeHelp( const TQString& anchor, - const TQString& _appname) const -{ - return invokeHelp( anchor, _appname, "" ); -} - -#ifndef Q_WS_WIN -// for win32 we're using simple help tools like Qt Assistant, -// see kapplication_win.cpp -void TDEApplication::invokeHelp( const TQString& anchor, - const TQString& _appname, - const TQCString& startup_id ) const -{ - TQString url; - TQString appname; - if (_appname.isEmpty()) - appname = name(); - else - appname = _appname; - - if (!anchor.isEmpty()) - url = TQString("help:/%1?anchor=%2").arg(appname).arg(anchor); - else - url = TQString("help:/%1/index.html").arg(appname); - - TQString error; - if ( !dcopClient()->isApplicationRegistered("khelpcenter") ) - { - if (startServiceByDesktopName("khelpcenter", url, &error, 0, 0, startup_id, false)) - { - if (Tty != kapp->type()) - TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Help Center"), - i18n("Could not launch the TDE Help Center:\n\n%1").arg(error), i18n("&OK")); - else - kdWarning() << "Could not launch help:\n" << error << endl; - return; - } - } - else - DCOPRef( "khelpcenter", "KHelpCenterIface" ).send( "openUrl", url, startup_id ); -} -#endif - -void TDEApplication::invokeHTMLHelp( const TQString& _filename, const TQString& topic ) const -{ - kdWarning() << "invoking HTML help is deprecated! use docbook and invokeHelp!\n"; - - TQString filename; - - if( _filename.isEmpty() ) - filename = TQString(name()) + "/index.html"; - else - filename = _filename; - - TQString url; - if (!topic.isEmpty()) - url = TQString("help:/%1#%2").arg(filename).arg(topic); - else - url = TQString("help:/%1").arg(filename); - - TQString error; - if ( !dcopClient()->isApplicationRegistered("khelpcenter") ) - { - if (startServiceByDesktopName("khelpcenter", url, &error, 0, 0, "", false)) - { - if (Tty != kapp->type()) - TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Help Center"), - i18n("Could not launch the TDE Help Center:\n\n%1").arg(error), i18n("&OK")); - else - kdWarning() << "Could not launch help:\n" << error << endl; - return; - } - } - else - DCOPRef( "khelpcenter", "KHelpCenterIface" ).send( "openUrl", url ); -} - - -void TDEApplication::invokeMailer(const TQString &address, const TQString &subject) -{ - return invokeMailer(address,subject,""); -} - -void TDEApplication::invokeMailer(const TQString &address, const TQString &subject, const TQCString& startup_id) -{ - invokeMailer(address, TQString::null, TQString::null, subject, TQString::null, TQString::null, - TQStringList(), startup_id ); -} - -void TDEApplication::invokeMailer(const KURL &mailtoURL) -{ - return invokeMailer( mailtoURL, "" ); -} - -void TDEApplication::invokeMailer(const KURL &mailtoURL, const TQCString& startup_id ) -{ - return invokeMailer( mailtoURL, startup_id, false); -} - -void TDEApplication::invokeMailer(const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments ) -{ - TQString address = KURL::decode_string(mailtoURL.path()), subject, cc, bcc, body; - TQStringList queries = TQStringList::split('&', mailtoURL.query().mid(1)); - TQStringList attachURLs; - for (TQStringList::Iterator it = queries.begin(); it != queries.end(); ++it) - { - TQString q = (*it).lower(); - if (q.startsWith("subject=")) - subject = KURL::decode_string((*it).mid(8)); - else - if (q.startsWith("cc=")) - cc = cc.isEmpty()? KURL::decode_string((*it).mid(3)): cc + ',' + KURL::decode_string((*it).mid(3)); - else - if (q.startsWith("bcc=")) - bcc = bcc.isEmpty()? KURL::decode_string((*it).mid(4)): bcc + ',' + KURL::decode_string((*it).mid(4)); - else - if (q.startsWith("body=")) - body = KURL::decode_string((*it).mid(5)); - else - if (allowAttachments && q.startsWith("attach=")) - attachURLs.push_back(KURL::decode_string((*it).mid(7))); - else - if (allowAttachments && q.startsWith("attachment=")) - attachURLs.push_back(KURL::decode_string((*it).mid(11))); - else - if (q.startsWith("to=")) - address = address.isEmpty()? KURL::decode_string((*it).mid(3)): address + ',' + KURL::decode_string((*it).mid(3)); - } - - invokeMailer( address, cc, bcc, subject, body, TQString::null, attachURLs, startup_id ); -} - -void TDEApplication::invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc, - const TQString &subject, const TQString &body, - const TQString & messageFile, const TQStringList &attachURLs) -{ - return invokeMailer(to,cc,bcc,subject,body,messageFile,attachURLs,""); -} - -#ifndef Q_WS_WIN -// on win32, for invoking browser we're using win32 API -// see kapplication_win.cpp - -static TQStringList splitEmailAddressList( const TQString & aStr ) -{ - // This is a copy of KPIM::splitEmailAddrList(). - // Features: - // - always ignores quoted characters - // - ignores everything (including parentheses and commas) - // inside quoted strings - // - supports nested comments - // - ignores everything (including double quotes and commas) - // inside comments - - TQStringList list; - - if (aStr.isEmpty()) - return list; - - TQString addr; - uint addrstart = 0; - int commentlevel = 0; - bool insidequote = false; - - for (uint index=0; index<aStr.length(); index++) { - // the following conversion to latin1 is o.k. because - // we can safely ignore all non-latin1 characters - switch (aStr[index].latin1()) { - case '"' : // start or end of quoted string - if (commentlevel == 0) - insidequote = !insidequote; - break; - case '(' : // start of comment - if (!insidequote) - commentlevel++; - break; - case ')' : // end of comment - if (!insidequote) { - if (commentlevel > 0) - commentlevel--; - else { - //kdDebug() << "Error in address splitting: Unmatched ')'" - // << endl; - return list; - } - } - break; - case '\\' : // quoted character - index++; // ignore the quoted character - break; - case ',' : - if (!insidequote && (commentlevel == 0)) { - addr = aStr.mid(addrstart, index-addrstart); - if (!addr.isEmpty()) - list += addr.simplifyWhiteSpace(); - addrstart = index+1; - } - break; - } - } - // append the last address to the list - if (!insidequote && (commentlevel == 0)) { - addr = aStr.mid(addrstart, aStr.length()-addrstart); - if (!addr.isEmpty()) - list += addr.simplifyWhiteSpace(); - } - //else - // kdDebug() << "Error in address splitting: " - // << "Unexpected end of address list" - // << endl; - - return list; -} - -void TDEApplication::invokeMailer(const TQString &_to, const TQString &_cc, const TQString &_bcc, - const TQString &subject, const TQString &body, - const TQString & /*messageFile TODO*/, const TQStringList &attachURLs, - const TQCString& startup_id ) -{ - TDEConfig config("emaildefaults"); - - config.setGroup("Defaults"); - TQString group = config.readEntry("Profile","Default"); - - config.setGroup( TQString("PROFILE_%1").arg(group) ); - TQString command = config.readPathEntry("EmailClient"); - - TQString to, cc, bcc; - if (command.isEmpty() || command == TQString::fromLatin1("kmail") - || command.endsWith("/kmail")) - { - command = TQString::fromLatin1("kmail --composer -s %s -c %c -b %b --body %B --attach %A -- %t"); - if ( !_to.isEmpty() ) - { - // put the whole address lists into RFC2047 encoded blobs; technically - // this isn't correct, but KMail understands it nonetheless - to = TQString( "=?utf8?b?%1?=" ) - .arg( TQString(KCodecs::base64Encode( _to.utf8(), false )) ); - } - if ( !_cc.isEmpty() ) - cc = TQString( "=?utf8?b?%1?=" ) - .arg( TQString(KCodecs::base64Encode( _cc.utf8(), false )) ); - if ( !_bcc.isEmpty() ) - bcc = TQString( "=?utf8?b?%1?=" ) - .arg( TQString(KCodecs::base64Encode( _bcc.utf8(), false )) ); - } else { - to = _to; - cc = _cc; - bcc = _bcc; - if( !command.contains( '%' )) - command += " %u"; - } - - if (config.readBoolEntry("TerminalClient", false)) - { - TDEConfigGroup confGroup( TDEGlobal::config(), "General" ); - TQString preferredTerminal = confGroup.readPathEntry("TerminalApplication", "konsole"); - command = preferredTerminal + " -e " + command; - } - - TQStringList cmdTokens = KShell::splitArgs(command); - TQString cmd = cmdTokens[0]; - cmdTokens.remove(cmdTokens.begin()); - - KURL url; - TQStringList qry; - if (!to.isEmpty()) - { - TQStringList tos = splitEmailAddressList( to ); - url.setPath( tos.first() ); - tos.remove( tos.begin() ); - for (TQStringList::ConstIterator it = tos.begin(); it != tos.end(); ++it) - qry.append( "to=" + KURL::encode_string( *it ) ); - } - const TQStringList ccs = splitEmailAddressList( cc ); - for (TQStringList::ConstIterator it = ccs.begin(); it != ccs.end(); ++it) - qry.append( "cc=" + KURL::encode_string( *it ) ); - const TQStringList bccs = splitEmailAddressList( bcc ); - for (TQStringList::ConstIterator it = bccs.begin(); it != bccs.end(); ++it) - qry.append( "bcc=" + KURL::encode_string( *it ) ); - for (TQStringList::ConstIterator it = attachURLs.begin(); it != attachURLs.end(); ++it) - qry.append( "attach=" + KURL::encode_string( *it ) ); - if (!subject.isEmpty()) - qry.append( "subject=" + KURL::encode_string( subject ) ); - if (!body.isEmpty()) - qry.append( "body=" + KURL::encode_string( body ) ); - url.setQuery( qry.join( "&" ) ); - if ( ! (to.isEmpty() && qry.isEmpty()) ) - url.setProtocol("mailto"); - - TQMap<TQChar, TQString> keyMap; - keyMap.insert('t', to); - keyMap.insert('s', subject); - keyMap.insert('c', cc); - keyMap.insert('b', bcc); - keyMap.insert('B', body); - keyMap.insert('u', url.url()); - - TQString attachlist = attachURLs.join(","); - attachlist.prepend('\''); - attachlist.append('\''); - keyMap.insert('A', attachlist); - - for (TQStringList::Iterator it = cmdTokens.begin(); it != cmdTokens.end(); ) - { - if (*it == "%A") - { - if (it == cmdTokens.begin()) // better safe than sorry ... - continue; - TQStringList::ConstIterator urlit = attachURLs.begin(); - TQStringList::ConstIterator urlend = attachURLs.end(); - if ( urlit != urlend ) - { - TQStringList::Iterator previt = it; - --previt; - *it = *urlit; - ++it; - while ( ++urlit != urlend ) - { - cmdTokens.insert( it, *previt ); - cmdTokens.insert( it, *urlit ); - } - } else { - --it; - it = cmdTokens.remove( cmdTokens.remove( it ) ); - } - } else { - *it = KMacroExpander::expandMacros(*it, keyMap); - ++it; - } - } - - TQString error; - // TODO this should check if cmd has a .desktop file, and use data from it, together - // with sending more ASN data - if (tdeinitExec(cmd, cmdTokens, &error, NULL, startup_id )) { - if (Tty != kapp->type()) { - TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Mail Client"), - i18n("Could not launch the mail client:\n\n%1").arg(error), i18n("&OK")); - } - else { - kdWarning() << "Could not launch mail client:\n" << error << endl; - } - } -} -#endif - -void TDEApplication::invokeBrowser( const TQString &url ) -{ - return invokeBrowser( url, "" ); -} - -#ifndef Q_WS_WIN -// on win32, for invoking browser we're using win32 API -// see kapplication_win.cpp -void TDEApplication::invokeBrowser( const TQString &url, const TQCString& startup_id ) -{ - TQString error; - - if (startServiceByDesktopName("kfmclient", url, &error, 0, 0, startup_id, false)) - { - if (Tty != kapp->type()) - TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Browser"), - i18n("Could not launch the browser:\n\n%1").arg(error), i18n("&OK")); - else - kdWarning() << "Could not launch browser:\n" << error << endl; - return; - } -} -#endif - -void TDEApplication::cut() -{ - invokeEditSlot( TQT_SLOT( cut() ) ); -} - -void TDEApplication::copy() -{ - invokeEditSlot( TQT_SLOT( copy() ) ); -} - -void TDEApplication::paste() -{ - invokeEditSlot( TQT_SLOT( paste() ) ); -} - -void TDEApplication::clear() -{ - invokeEditSlot( TQT_SLOT( clear() ) ); -} - -void TDEApplication::selectAll() -{ - invokeEditSlot( TQT_SLOT( selectAll() ) ); -} - -void TDEApplication::broadcastKeyCode(unsigned int keyCode) -{ - emit coreFakeKeyPress(keyCode); -} - -TQCString -TDEApplication::launcher() -{ - return "tdelauncher"; -} - -static int -startServiceInternal( const TQCString &function, - const TQString& _name, const TQStringList &URLs, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - struct serviceResult - { - int result; - TQCString dcopName; - TQString error; - pid_t pid; - }; - - // Register app as able to send DCOP messages - DCOPClient *dcopClient; - if (kapp) - dcopClient = kapp->dcopClient(); - else - dcopClient = new DCOPClient; - - if (!dcopClient->isAttached()) - { - if (!dcopClient->attach()) - { - if (error) - *error = i18n("Could not register with DCOP.\n"); - if (!kapp) - delete dcopClient; - - return -1; - } - } - TQByteArray params; - TQDataStream stream(params, IO_WriteOnly); - stream << _name << URLs; - TQCString replyType; - TQByteArray replyData; - TQCString _launcher = TDEApplication::launcher(); - TQValueList<TQCString> envs; -#ifdef Q_WS_X11 - if (tqt_xdisplay()) { - TQCString dpystring(XDisplayString(tqt_xdisplay())); - envs.append( TQCString("DISPLAY=") + dpystring ); - } else if( getenv( "DISPLAY" )) { - TQCString dpystring( getenv( "DISPLAY" )); - envs.append( TQCString("DISPLAY=") + dpystring ); - } -#endif - stream << envs; -#if defined Q_WS_X11 - // make sure there is id, so that user timestamp exists - stream << ( startup_id.isEmpty() ? TDEStartupInfo::createNewStartupId() : startup_id ); -#endif - if( function.left( 12 ) != "tdeinit_exec" ) - stream << noWait; - - if (!dcopClient->call(_launcher, _launcher, - function, params, replyType, replyData)) - { - if (error) - *error = i18n("TDELauncher could not be reached via DCOP.\n"); - if (!kapp) - delete dcopClient; - return -1; - } - if (!kapp) - delete dcopClient; - - if (noWait) - return 0; - - TQDataStream stream2(replyData, IO_ReadOnly); - serviceResult result; - stream2 >> result.result >> result.dcopName >> result.error >> result.pid; - if (dcopService) - *dcopService = result.dcopName; - if (error) - *error = result.error; - if (pid) - *pid = result.pid; - return result.result; -} - -int -TDEApplication::startServiceByName( const TQString& _name, const TQString &URL, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - TQStringList URLs; - if (!URL.isEmpty()) - URLs.append(URL); - return startServiceInternal( - "start_service_by_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", - _name, URLs, error, dcopService, pid, startup_id, noWait); -} - -int -TDEApplication::startServiceByName( const TQString& _name, const TQStringList &URLs, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - return startServiceInternal( - "start_service_by_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", - _name, URLs, error, dcopService, pid, startup_id, noWait); -} - -int -TDEApplication::startServiceByDesktopPath( const TQString& _name, const TQString &URL, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - TQStringList URLs; - if (!URL.isEmpty()) - URLs.append(URL); - return startServiceInternal( - "start_service_by_desktop_path(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", - _name, URLs, error, dcopService, pid, startup_id, noWait); -} - -int -TDEApplication::startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - return startServiceInternal( - "start_service_by_desktop_path(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", - _name, URLs, error, dcopService, pid, startup_id, noWait); -} - -int -TDEApplication::startServiceByDesktopName( const TQString& _name, const TQString &URL, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - TQStringList URLs; - if (!URL.isEmpty()) - URLs.append(URL); - return startServiceInternal( - "start_service_by_desktop_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", - _name, URLs, error, dcopService, pid, startup_id, noWait); -} - -int -TDEApplication::startServiceByDesktopName( const TQString& _name, const TQStringList &URLs, - TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) -{ - return startServiceInternal( - "start_service_by_desktop_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", - _name, URLs, error, dcopService, pid, startup_id, noWait); -} - -int -TDEApplication::tdeinitExec( const TQString& name, const TQStringList &args, - TQString *error, int *pid ) -{ - return tdeinitExec( name, args, error, pid, "" ); -} - -int -TDEApplication::tdeinitExec( const TQString& name, const TQStringList &args, - TQString *error, int *pid, const TQCString& startup_id ) -{ - return startServiceInternal("tdeinit_exec(TQString,TQStringList,TQValueList<TQCString>,TQCString)", - name, args, error, 0, pid, startup_id, false); -} - -int -TDEApplication::tdeinitExecWait( const TQString& name, const TQStringList &args, - TQString *error, int *pid ) -{ - return tdeinitExecWait( name, args, error, pid, "" ); -} - -int -TDEApplication::tdeinitExecWait( const TQString& name, const TQStringList &args, - TQString *error, int *pid, const TQCString& startup_id ) -{ - return startServiceInternal("tdeinit_exec_wait(TQString,TQStringList,TQValueList<TQCString>,TQCString)", - name, args, error, 0, pid, startup_id, false); -} - -TQString TDEApplication::tempSaveName( const TQString& pFilename ) const -{ - TQString aFilename; - - if( TQDir::isRelativePath(pFilename) ) - { - kdWarning(101) << "Relative filename passed to TDEApplication::tempSaveName" << endl; - aFilename = TQFileInfo( TQDir( "." ), pFilename ).absFilePath(); - } - else - aFilename = pFilename; - - TQDir aAutosaveDir( TQDir::homeDirPath() + "/autosave/" ); - if( !aAutosaveDir.exists() ) - { - if( !aAutosaveDir.mkdir( aAutosaveDir.absPath() ) ) - { - // Last chance: use temp dir - aAutosaveDir.setPath( TDEGlobal::dirs()->saveLocation("tmp") ); - } - } - - aFilename.replace( "/", "\\!" ).prepend( "#" ).append( "#" ).prepend( "/" ).prepend( aAutosaveDir.absPath() ); - - return aFilename; -} - - -TQString TDEApplication::checkRecoverFile( const TQString& pFilename, - bool& bRecover ) const -{ - TQString aFilename; - - if( TQDir::isRelativePath(pFilename) ) - { - kdWarning(101) << "Relative filename passed to TDEApplication::tempSaveName" << endl; - aFilename = TQFileInfo( TQDir( "." ), pFilename ).absFilePath(); - } - else - aFilename = pFilename; - - TQDir aAutosaveDir( TQDir::homeDirPath() + "/autosave/" ); - if( !aAutosaveDir.exists() ) - { - if( !aAutosaveDir.mkdir( aAutosaveDir.absPath() ) ) - { - // Last chance: use temp dir - aAutosaveDir.setPath( TDEGlobal::dirs()->saveLocation("tmp") ); - } - } - - aFilename.replace( "/", "\\!" ).prepend( "#" ).append( "#" ).prepend( "/" ).prepend( aAutosaveDir.absPath() ); - - if( TQFile( aFilename ).exists() ) - { - bRecover = true; - return aFilename; - } - else - { - bRecover = false; - return pFilename; - } -} - - -bool checkAccess(const TQString& pathname, int mode) -{ - int accessOK = access( TQFile::encodeName(pathname), mode ); - if ( accessOK == 0 ) - return true; // OK, I can really access the file - - // else - // if we want to write the file would be created. Check, if the - // user may write to the directory to create the file. - if ( (mode & W_OK) == 0 ) - return false; // Check for write access is not part of mode => bail out - - - if (!access( TQFile::encodeName(pathname), F_OK)) // if it already exists - return false; - - //strip the filename (everything until '/' from the end - TQString dirName(pathname); - int pos = dirName.findRev('/'); - if ( pos == -1 ) - return false; // No path in argument. This is evil, we won't allow this - else if ( pos == 0 ) // don't turn e.g. /root into an empty string - pos = 1; - - dirName.truncate(pos); // strip everything starting from the last '/' - - accessOK = access( TQFile::encodeName(dirName), W_OK ); - // -?- Can I write to the accessed diretory - if ( accessOK == 0 ) - return true; // Yes - else - return false; // No -} - -void TDEApplication::setTopWidget( TQWidget *topWidget ) -{ - if( !topWidget ) - return; - - // set the specified caption - if ( !topWidget->inherits("TDEMainWindow") ) { // TDEMainWindow does this already for us - topWidget->setCaption( caption() ); - } - - // set the specified icons - topWidget->setIcon( icon() ); //standard X11 -#if defined Q_WS_X11 -//#ifdef Q_WS_X11 // FIXME(E): Implement for Qt/Embedded - KWin::setIcons(topWidget->winId(), icon(), miniIcon() ); // NET_WM hints for KWin - - // set the app startup notification window property - TDEStartupInfo::setWindowStartupId( topWidget->winId(), startupId()); -#endif -} - -TQCString TDEApplication::startupId() const -{ - return d->startup_id; -} - -void TDEApplication::setStartupId( const TQCString& startup_id ) -{ - if( startup_id == d->startup_id ) - return; -#if defined Q_WS_X11 - TDEStartupInfo::handleAutoAppStartedSending(); // finish old startup notification if needed -#endif - if( startup_id.isEmpty()) - d->startup_id = "0"; - else - { - d->startup_id = startup_id; -#if defined Q_WS_X11 - TDEStartupInfoId id; - id.initId( startup_id ); - long timestamp = id.timestamp(); - if( timestamp != 0 ) - updateUserTimestamp( timestamp ); -#endif - } -} - -// read the startup notification env variable, save it and unset it in order -// not to propagate it to processes started from this app -void TDEApplication::read_app_startup_id() -{ -#if defined Q_WS_X11 - TDEStartupInfoId id = TDEStartupInfo::currentStartupIdEnv(); - TDEStartupInfo::resetStartupEnv(); - d->startup_id = id.id(); -#endif -} - -int TDEApplication::random() -{ - static bool init = false; - if (!init) - { - unsigned int seed; - init = true; - int fd = open("/dev/urandom", O_RDONLY); - if (fd < 0 || ::read(fd, &seed, sizeof(seed)) != sizeof(seed)) - { - // No /dev/urandom... try something else. - srand(getpid()); - seed = rand()+time(0); - } - if (fd >= 0) close(fd); - srand(seed); - } - return rand(); -} - -TQString TDEApplication::randomString(int length) -{ - if (length <=0 ) return TQString::null; - - TQString str; str.setLength( length ); - int i = 0; - while (length--) - { - int r=random() % 62; - r+=48; - if (r>57) r+=7; - if (r>90) r+=6; - str[i++] = char(r); - // so what if I work backwards? - } - return str; -} - -bool TDEApplication::authorize(const TQString &genericAction) -{ - if (!d->actionRestrictions) - return true; - - TDEConfig *config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "KDE Action Restrictions" ); - return config->readBoolEntry(genericAction, true); -} - -bool TDEApplication::authorizeTDEAction(const char *action) -{ - if (!d->actionRestrictions || !action) - return true; - - static const TQString &action_prefix = TDEGlobal::staticQString( "action/" ); - - return authorize(action_prefix + action); -} - -bool TDEApplication::authorizeControlModule(const TQString &menuId) -{ - if (menuId.isEmpty() || kde_kiosk_exception) - return true; - TDEConfig *config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "TDE Control Module Restrictions" ); - return config->readBoolEntry(menuId, true); -} - -TQStringList TDEApplication::authorizeControlModules(const TQStringList &menuIds) -{ - TDEConfig *config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "TDE Control Module Restrictions" ); - TQStringList result; - for(TQStringList::ConstIterator it = menuIds.begin(); - it != menuIds.end(); ++it) - { - if (config->readBoolEntry(*it, true)) - result.append(*it); - } - return result; -} - -void TDEApplication::initUrlActionRestrictions() -{ - d->urlActionRestrictions.setAutoDelete(true); - d->urlActionRestrictions.clear(); - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("open", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, true)); - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("list", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, true)); -// TEST: -// d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule -// ("list", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, false)); -// d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule -// ("list", TQString::null, TQString::null, TQString::null, "file", TQString::null, TQDir::homeDirPath(), true)); - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("link", TQString::null, TQString::null, TQString::null, ":internet", TQString::null, TQString::null, true)); - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("redirect", TQString::null, TQString::null, TQString::null, ":internet", TQString::null, TQString::null, true)); - - // We allow redirections to file: but not from internet protocols, redirecting to file: - // is very popular among io-slaves and we don't want to break them - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("redirect", TQString::null, TQString::null, TQString::null, "file", TQString::null, TQString::null, true)); - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("redirect", ":internet", TQString::null, TQString::null, "file", TQString::null, TQString::null, false)); - - // local protocols may redirect everywhere - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("redirect", ":local", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, true)); - - // Anyone may redirect to about: - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("redirect", TQString::null, TQString::null, TQString::null, "about", TQString::null, TQString::null, true)); - - // Anyone may redirect to itself, cq. within it's own group - d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule - ("redirect", TQString::null, TQString::null, TQString::null, "=", TQString::null, TQString::null, true)); - - TDEConfig *config = TDEGlobal::config(); - TDEConfigGroupSaver saver( config, "KDE URL Restrictions" ); - int count = config->readNumEntry("rule_count"); - TQString keyFormat = TQString("rule_%1"); - for(int i = 1; i <= count; i++) - { - TQString key = keyFormat.arg(i); - TQStringList rule = config->readListEntry(key); - if (rule.count() != 8) - continue; - TQString action = rule[0]; - TQString refProt = rule[1]; - TQString refHost = rule[2]; - TQString refPath = rule[3]; - TQString urlProt = rule[4]; - TQString urlHost = rule[5]; - TQString urlPath = rule[6]; - TQString strEnabled = rule[7].lower(); - - bool bEnabled = (strEnabled == "true"); - - if (refPath.startsWith("$HOME")) - refPath.replace(0, 5, TQDir::homeDirPath()); - else if (refPath.startsWith("~")) - refPath.replace(0, 1, TQDir::homeDirPath()); - if (urlPath.startsWith("$HOME")) - urlPath.replace(0, 5, TQDir::homeDirPath()); - else if (urlPath.startsWith("~")) - urlPath.replace(0, 1, TQDir::homeDirPath()); - - if (refPath.startsWith("$TMP")) - refPath.replace(0, 4, TDEGlobal::dirs()->saveLocation("tmp")); - if (urlPath.startsWith("$TMP")) - urlPath.replace(0, 4, TDEGlobal::dirs()->saveLocation("tmp")); - - d->urlActionRestrictions.append(new TDEApplicationPrivate::URLActionRule - ( action, refProt, refHost, refPath, urlProt, urlHost, urlPath, bEnabled)); - } -} - -void TDEApplication::allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL) -{ - if (authorizeURLAction(action, _baseURL, _destURL)) - return; - - d->urlActionRestrictions.append(new TDEApplicationPrivate::URLActionRule - ( action, _baseURL.protocol(), _baseURL.host(), _baseURL.path(-1), - _destURL.protocol(), _destURL.host(), _destURL.path(-1), true)); -} - -bool TDEApplication::authorizeURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL) -{ - if (_destURL.isEmpty()) - return true; - - bool result = false; - if (d->urlActionRestrictions.isEmpty()) - initUrlActionRestrictions(); - - KURL baseURL(_baseURL); - baseURL.setPath(TQDir::cleanDirPath(baseURL.path())); - TQString baseClass = KProtocolInfo::protocolClass(baseURL.protocol()); - KURL destURL(_destURL); - destURL.setPath(TQDir::cleanDirPath(destURL.path())); - TQString destClass = KProtocolInfo::protocolClass(destURL.protocol()); - - for(TDEApplicationPrivate::URLActionRule *rule = d->urlActionRestrictions.first(); - rule; rule = d->urlActionRestrictions.next()) - { - if ((result != rule->permission) && // No need to check if it doesn't make a difference - (action == rule->action) && - rule->baseMatch(baseURL, baseClass) && - rule->destMatch(destURL, destClass, baseURL, baseClass)) - { - result = rule->permission; - } - } - return result; -} - - -uint TDEApplication::keyboardModifiers() -{ -#ifdef Q_WS_X11 - Window root; - Window child; - int root_x, root_y, win_x, win_y; - uint keybstate; - XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child, - &root_x, &root_y, &win_x, &win_y, &keybstate ); - return keybstate & 0x00ff; -#elif defined W_WS_MACX - return GetCurrentEventKeyModifiers() & 0x00ff; -#else - //TODO for win32 - return 0; -#endif -} - -uint TDEApplication::mouseState() -{ - uint mousestate; -#ifdef Q_WS_X11 - Window root; - Window child; - int root_x, root_y, win_x, win_y; - XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child, - &root_x, &root_y, &win_x, &win_y, &mousestate ); -#elif defined(Q_WS_WIN) - const bool mousebtn_swapped = GetSystemMetrics(SM_SWAPBUTTON); - if (GetAsyncKeyState(VK_LBUTTON)) - mousestate |= (mousebtn_swapped ? Button3Mask : Button1Mask); - if (GetAsyncKeyState(VK_MBUTTON)) - mousestate |= Button2Mask; - if (GetAsyncKeyState(VK_RBUTTON)) - mousestate |= (mousebtn_swapped ? Button1Mask : Button3Mask); -#elif defined(Q_WS_MACX) - mousestate = GetCurrentEventButtonState(); -#else - //TODO: other platforms -#endif - return mousestate & 0xff00; -} - -TQ_ButtonState TDEApplication::keyboardMouseState() -{ - int ret = 0; -#ifdef Q_WS_X11 - Window root; - Window child; - int root_x, root_y, win_x, win_y; - uint state; - XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child, - &root_x, &root_y, &win_x, &win_y, &state ); - // transform the same way like Qt's qt_x11_translateButtonState() - if( state & Button1Mask ) - ret |= TQ_LeftButton; - if( state & Button2Mask ) - ret |= TQ_MidButton; - if( state & Button3Mask ) - ret |= TQ_RightButton; - if( state & ShiftMask ) - ret |= TQ_ShiftButton; - if( state & ControlMask ) - ret |= TQ_ControlButton; - if( state & KKeyNative::modX( KKey::ALT )) - ret |= TQ_AltButton; - if( state & KKeyNative::modX( KKey::WIN )) - ret |= TQ_MetaButton; -#elif defined(Q_WS_WIN) - const bool mousebtn_swapped = GetSystemMetrics(SM_SWAPBUTTON); - if (GetAsyncKeyState(VK_LBUTTON)) - ret |= (mousebtn_swapped ? RightButton : LeftButton); - if (GetAsyncKeyState(VK_MBUTTON)) - ret |= TQ_MidButton; - if (GetAsyncKeyState(VK_RBUTTON)) - ret |= (mousebtn_swapped ? TQ_LeftButton : TQ_RightButton); - if (GetAsyncKeyState(VK_SHIFT)) - ret |= TQ_ShiftButton; - if (GetAsyncKeyState(VK_CONTROL)) - ret |= TQ_ControlButton; - if (GetAsyncKeyState(VK_MENU)) - ret |= TQ_AltButton; - if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) - ret |= TQ_MetaButton; -#else - //TODO: other platforms -#endif - return static_cast< ButtonState >( ret ); -} - -void TDEApplication::installSigpipeHandler() -{ -#ifdef Q_OS_UNIX - struct sigaction act; - act.sa_handler = SIG_IGN; - sigemptyset( &act.sa_mask ); - act.sa_flags = 0; - sigaction( SIGPIPE, &act, 0 ); -#endif -} - -void TDEApplication::sigpipeHandler(int) -{ - int saved_errno = errno; - // Using kdDebug from a signal handler is not a good idea. -#ifndef NDEBUG - char msg[1000]; - sprintf(msg, "*** SIGPIPE *** (ignored, pid = %ld)\n", (long) getpid()); - if (write(2, msg, strlen(msg)) < 0) { - // ERROR - } -#endif - - // Do nothing. - errno = saved_errno; -} - -bool TDEApplication::guiEnabled() -{ - return kapp && kapp->d->guiEnabled; -} - -void TDEApplication::virtual_hook( int id, void* data ) -{ TDEInstance::virtual_hook( id, data ); } - -void KSessionManaged::virtual_hook( int, void* ) -{ /*BASE::virtual_hook( id, data );*/ } - -#include "kapplication.moc" diff --git a/tdecore/kapplication.h b/tdecore/kapplication.h deleted file mode 100644 index 5ab8d7ee7..000000000 --- a/tdecore/kapplication.h +++ /dev/null @@ -1,1620 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - Copyright (c) 1998, 1999 KDE Team - - 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KAPP_H -#define _KAPP_H - -// Version macros. Never put this further down. -#include "tdeversion.h" -#include "tdelibs_export.h" - -class TDEConfig; -class KCharsets; -class DCOPClient; -class DCOPObject; - -#include <tqtglobaldefines.h> - -typedef unsigned long Atom; -#if !defined(Q_WS_X11) -typedef void Display; -#endif - -#include <tqapplication.h> -#include <tqpixmap.h> -#include <kinstance.h> - -struct _IceConn; -class TQPopupMenu; -class TQStrList; -class KSessionManaged; -class TDEStyle; -class KURL; - -#define kapp TDEApplication::kApplication() - -class TDEApplicationPrivate; - -/** -* Controls and provides information to all KDE applications. -* -* Only one object of this class can be instantiated in a single app. -* This instance is always accessible via the 'kapp' global variable. -* See cut() for an example. -* -* This class provides the following services to all KDE applications. -* -* @li It controls the event queue (see TQApplication ). -* @li It provides the application with KDE resources such as -* accelerators, common menu entries, a TDEConfig object. session -* management events, help invocation etc. -* @li Installs a signal handler for the SIGCHLD signal in order to -* avoid zombie children. If you want to catch this signal yourself or -* don't want it to be caught at all, you have set a new signal handler -* (or SIG_IGN) after TDEApplication's constructor has run. -* @li Installs an empty signal handler for the SIGPIPE signal using -* installSigpipeHandler(). If you want to catch this signal -* yourself, you have set a new signal handler after TDEApplication's -* constructor has run. -* @li It can start new services -* -* -* The way a service gets started depends on the 'X-DCOP-ServiceType' -* entry in the desktop file of the service: -* -* There are three possibilities: -* @li X-DCOP-ServiceType=None (default) -* Always start a new service, -* don't wait till the service registers with dcop. -* @li X-DCOP-ServiceType=Multi -* Always start a new service, -* wait until the service has registered with dcop. -* @li X-DCOP-ServiceType=Unique -* Only start the service if it isn't already running, -* wait until the service has registered with dcop. -* -* @short Controls and provides information to all KDE applications. -* @author Matthias Kalle Dalheimer <kalle@kde.org> -*/ -class TDECORE_EXPORT TDEApplication : public TQApplication, public TDEInstance -{ - - Q_OBJECT -public: - /** Position of the caption (presumably in the application window's - * title bar). This enum appears to be unused. - * - * @todo Find out if this is used anywhere. - */ - enum CaptionLayout { - CaptionAppLast=1 /**< Display the application name last (before document name). */, - CaptionAppFirst /**< Display the application name first. */ , - CaptionNoApp /**< Do not display application name at all. */ - }; - - /** - * This constructor takes aboutData and command line - * arguments from TDECmdLineArgs. - * - * If ARGB (transparent) widgets are to be used in your application, - * please use - * TDEApplication app(TDEApplication::openX11RGBADisplay()); - * or - * TDEApplication app(TDEApplication::openX11RGBADisplay(), useStyles); - * - * @param allowStyles Set to false to disable the loading on plugin based - * styles. This is only useful to applications that do not display a GUI - * normally. If you do create an application with @p allowStyles set to false - * it normally runs in the background but under special circumstances - * displays widgets. Call enableStyles() before displaying any widgets. - * - * @param GUIenabled Set to false to disable all GUI stuff. This implies - * no styles either. - */ - TDEApplication( bool allowStyles=true, bool GUIenabled=true); - -#ifdef Q_WS_X11 - /** - * Constructor. Parses command-line arguments. Use this constructor when you - * you want ARGB support to be automatically detected and enabled. - * - * @param display Will be passed to Qt as the X display. The display must be - * valid and already opened. - * - * @param allowStyles Set to false to disable the loading on plugin based - * styles. This is only useful to applications that do not display a GUI - * normally. If you do create an application with @p allowStyles set to false - * that normally runs in the background but under special circumstances - * displays widgets call enableStyles() before displaying any widgets. - * - * @since KDE 3.5 - * - * @see RGBADisplay() - */ - TDEApplication(Display *display, bool allowStyles); - - /** - * Constructor. Parses command-line arguments. Use this constructor when you - * you want ARGB support to be automatically detected and enabled. - * - * @param display Will be passed to Qt as the X display. The display must be - * valid and already opened. - * - * @param disable_argb Set to true to disable ARGB visuals in this application. - * - * @param display Will be passed to Qt as the X display. The display must be - * valid and already opened. - * - * @param visual A pointer to the X11 visual that should be used by the - * appliction. Note that only TrueColor visuals are supported on depths - * greater than 8 bpp. If this parameter is NULL, the default visual will - * be used instead. - * - * @param allowStyles Set to false to disable the loading on plugin based - * styles. This is only useful to applications that do not display a GUI - * normally. If you do create an application with @p allowStyles set to false - * that normally runs in the background but under special circumstances - * displays widgets call enableStyles() before displaying any widgets. - * - * @since KDE 3.5 - * - * @see RGBADisplay() - */ - TDEApplication(Display *display, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles); - - /** - * Constructor. Parses command-line arguments. Use this constructor when you - * you need to use a non-default visual or colormap. - * - * @param display Will be passed to Qt as the X display. The display must be - * valid and already opened. - * - * @param visual A pointer to the X11 visual that should be used by the - * appliction. Note that only TrueColor visuals are supported on depths - * greater than 8 bpp. If this parameter is NULL, the default visual will - * be used instead. - * - * @param colormap The colormap that should be used by the application. If - * this parameter is 0, the default colormap will be used instead. - * - * @param allowStyles Set to false to disable the loading on plugin based - * styles. This is only useful to applications that do not display a GUI - * normally. If you do create an application with @p allowStyles set to false - * that normally runs in the background but under special circumstances - * displays widgets call enableStyles() before displaying any widgets. - * - * @since KDE 3.3 - */ - TDEApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0, - bool allowStyles=true); - - /** - * Constructor. Parses command-line arguments. Use this constructor to use TDEApplication - * in a Motif or Xt program. - * - * @param display Will be passed to Qt as the X display. The display must be valid and already - * opened. - * - * @param argc command line argument count - * - * @param argv command line argument value(s) - * - * @param rAppName application name. Will be used for finding the - * associated message files and icon files, and as the default - * registration name for DCOP. This is a mandatory parameter. - * - * @param allowStyles Set to false to disable the loading on plugin based - * styles. This is only useful to applications that do not display a GUI - * normally. If you do create an application with @p allowStyles set to false - * that normally runs in the background but under special circumstances - * displays widgets call enableStyles() before displaying any widgets. - * - * @param GUIenabled Set to false to disable all GUI stuff. This implies - * no styles either. - */ - TDEApplication(Display *display, int& argc, char** argv, const TQCString& rAppName, - bool allowStyles=true, bool GUIenabled=true); -#endif - - /** - * @deprecated do not use it at all, it will make your application crash, use TDECmdLineArgs - * - * Constructor. Parses command-line arguments. - * - * @param argc command line argument count - * - * @param argv command line argument value(s) - * - * @param rAppName application name. Will be used for finding the - * associated message files and icon files, and as the default - * registration name for DCOP. This is a mandatory parameter. - * - * @param allowStyles Set to false to disable the loading on plugin based - * styles. This is only useful to applications that do not display a GUI - * normally. If you do create an application with @p allowStyles set to false - * that normally runs in the background but under special circumstances - * displays widgets call enableStyles() before displaying any widgets. - * - * @param GUIenabled Set to false to disable all GUI stuff. This implies - * no styles either. - */ - // REMOVE FOR KDE 4.0 - using it only gives crashing applications because - // TDECmdLineArgs::init isn't called - TDEApplication(int& argc, char** argv, - const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true) KDE_DEPRECATED; - - /** - * Add Qt and KDE command line options to TDECmdLineArgs. - */ - static void addCmdLineOptions(); - - virtual ~TDEApplication(); - - /** - * Returns the current application object. - * - * This is similar to the global TQApplication pointer tqApp. It - * allows access to the single global TDEApplication object, since - * more than one cannot be created in the same application. It - * saves you the trouble of having to pass the pointer explicitly - * to every function that may require it. - * @return the current application object - */ - static TDEApplication* kApplication() { return KApp; } - - /** - * Returns the application session config object. - * - * @return A pointer to the application's instance specific - * TDEConfig object. - * @see TDEConfig - */ - TDEConfig* sessionConfig(); - - /** - * Is the application restored from the session manager? - * - * @return If true, this application was restored by the session manager. - * Note that this may mean the config object returned by - * sessionConfig() contains data saved by a session closedown. - * @see sessionConfig() - */ - bool isRestored() const { return TQApplication::isSessionRestored(); } - - /** - * Disables session management for this application. - * - * Useful in case your application is started by the - * initial "starttde" script. - */ - void disableSessionManagement(); - - /** - * Enables again session management for this application, formerly - * disabled by calling disableSessionManagement(). You usually - * shouldn't call this function, as the session management is enabled - * by default. - */ - void enableSessionManagement(); - - /** - * The possible values for the @p confirm parameter of requestShutDown(). - */ - enum ShutdownConfirm { - /** - * Obey the user's confirmation setting. - */ - ShutdownConfirmDefault = -1, - /** - * Don't confirm, shutdown without asking. - */ - ShutdownConfirmNo = 0, - /** - * Always confirm, ask even if the user turned it off. - */ - ShutdownConfirmYes = 1 - }; - - /** - * The possible values for the @p sdtype parameter of requestShutDown(). - */ - enum ShutdownType { - /** - * Select previous action or the default if it's the first time. - */ - ShutdownTypeDefault = -1, - /** - * Only log out. - */ - ShutdownTypeNone = 0, - /** - * Log out and reboot the machine. - */ - ShutdownTypeReboot = 1, - /** - * Log out and halt the machine. - */ - ShutdownTypeHalt = 2 - }; - - /** - * The possible values for the @p sdmode parameter of requestShutDown(). - */ - enum ShutdownMode { - /** - * Select previous mode or the default if it's the first time. - */ - ShutdownModeDefault = -1, - /** - * Schedule a shutdown (halt or reboot) for the time all active sessions - * have exited. - */ - ShutdownModeSchedule = 0, - /** - * Shut down, if no sessions are active. Otherwise do nothing. - */ - ShutdownModeTryNow = 1, - /** - * Force shutdown. Kill any possibly active sessions. - */ - ShutdownModeForceNow = 2, - /** - * Pop up a dialog asking the user what to do if sessions are still active. - */ - ShutdownModeInteractive = 3 - }; - - /** - * Asks the session manager to shut the session down. - * - * Using @p confirm == ShutdownConfirmYes or @p sdtype != ShutdownTypeDefault or - * @p sdmode != ShutdownModeDefault causes the use of ksmserver's DCOP - * interface. The remaining two combinations use the standard XSMP and - * will work with any session manager compliant with it. - * - * @param confirm Whether to ask the user if he really wants to log out. - * ShutdownConfirm - * @param sdtype The action to take after logging out. ShutdownType - * @param sdmode If/When the action should be taken. ShutdownMode - * @return true on success, false if the session manager could not be - * contacted. - */ - bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault, - ShutdownType sdtype = ShutdownTypeDefault, - ShutdownMode sdmode = ShutdownModeDefault ); - - /** - * Propagates the network address of the session manager in the - * SESSION_MANAGER environment variable so that child processes can - * pick it up. - * - * If SESSION_MANAGER isn't defined yet, the address is searched in - * $HOME/.KSMserver. - * - * This function is called by clients that are started outside the - * session ( i.e. before ksmserver is started), but want to launch - * other processes that should participate in the session. Examples - * are kdesktop or kicker. - */ - void propagateSessionManager(); - - /** - * Reimplemented for internal purposes, mainly the highlevel - * handling of session management with KSessionManaged. - * @internal - */ - void commitData( TQSessionManager& sm ); - - /** - * Reimplemented for internal purposes, mainly the highlevel - * handling of session management with KSessionManaged. - * @internal - */ - void saveState( TQSessionManager& sm ); - - /** - * Returns true if the application is currently saving its session - * data (most probably before KDE logout). This is intended for use - * mainly in TDEMainWindow::queryClose() and TDEMainWindow::queryExit(). - * - * @see TDEMainWindow::queryClose - * @see TDEMainWindow::queryExit - * @since 3.1.1 - */ - bool sessionSaving() const; - - /** - * Returns a pointer to a DCOPClient for the application. - * If a client does not exist yet, it is created when this - * function is called. - * @return the DCOPClient for the application - */ - static DCOPClient *dcopClient(); - - /** - * Disable automatic dcop registration - * Must be called before creating a TDEApplication instance to have an effect. - */ - static void disableAutoDcopRegistration(); - - /** - * Returns a TQPixmap with the application icon. - * @return the application icon - */ - TQPixmap icon() const; - - /** - * Returns the name of the application icon. - * @return the icon's name - */ - TQString iconName() const; - - /** - * Returns the mini-icon for the application as a TQPixmap. - * @return the application's mini icon - */ - TQPixmap miniIcon() const; - - /** - * Returns the name of the mini-icon for the application. - * @return the mini icon's name - */ - TQString miniIconName() const; - - /** - * Sets the top widget of the application. - * This means basically applying the right window caption and - * icon. An application may have several top widgets. You don't - * need to call this function manually when using TDEMainWindow. - * - * @param topWidget A top widget of the application. - * - * @see icon(), caption() - **/ - void setTopWidget( TQWidget *topWidget ); - - /** - * Invokes the KHelpCenter HTML help viewer from docbook sources. - * - * @param anchor This has to be a defined anchor in your - * docbook sources. If empty the main index - * is loaded - * @param appname This allows you to show the help of another - * application. If empty the current name() is - * used - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - */ - void invokeHelp( const TQString& anchor, - const TQString& appname, - const TQCString& startup_id ) const; - - // KDE4 merge with above with startup_id = "" - void invokeHelp( const TQString& anchor = TQString::null, - const TQString& appname = TQString::null ) const; - - /** - * @deprecated - * Invoke the khelpcenter HTML help viewer from HTML sources. - * Please use invokeHelp() instead. - * - * @param aFilename The filename that is to be loaded. Its - * location is computed automatically - * according to the KFSSTND. If @p aFilename - * is empty, the logical appname with .html - * appended to it is used. - * @param aTopic This allows context-sensitive help. Its - * value will be appended to the filename, - * prefixed with a "#" (hash) character. - */ - void invokeHTMLHelp( const TQString& aFilename, const TQString& aTopic = TQString::null ) const KDE_DEPRECATED; - - /** - * Convenience method; invokes the standard email application. - * - * @param address The destination address - * @param subject Subject string. Can be TQString::null. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - */ - void invokeMailer( const TQString &address, const TQString &subject, const TQCString& startup_id ); - // KDE4 merge with above with startup_id = "" - void invokeMailer( const TQString &address, const TQString &subject ); - - /** - * Invokes the standard email application. - * - * @param mailtoURL A mailto URL. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param allowAttachments whether attachments specified in mailtoURL should be honoured. - The default is false; do not honour requests for attachments. - */ - void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments ); - // KDE4 merge with above with allowAttachments = false - void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id ); - // KDE4 merge with above with startup_id = "" - void invokeMailer( const KURL &mailtoURL ); - - /** - * Convenience method; invokes the standard email application. - * - * All parameters are optional. - * - * @param to The destination address. - * @param cc The Cc field - * @param bcc The Bcc field - * @param subject Subject string - * @param body A string containing the body of the mail (exclusive with messageFile) - * @param messageFile A file (URL) containing the body of the mail (exclusive with body) - currently unsupported - * @param attachURLs List of URLs to be attached to the mail. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - */ - void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc, - const TQString &subject, const TQString &body, - const TQString &messageFile, const TQStringList &attachURLs, - const TQCString& startup_id ); - // KDE4 merge with above with startup_id = "" - void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc, - const TQString &subject, const TQString &body, - const TQString &messageFile = TQString::null, const TQStringList &attachURLs = TQStringList()); - -public slots: - /** - * Invokes the standard browser. - * Note that you should only do this when you know for sure that the browser can - * handle the URL (i.e. its mimetype). In doubt, if the URL can point to an image - * or anything else than directory or HTML, prefer to use new KRun( url ). - * - * @param url The destination address - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - */ - void invokeBrowser( const TQString &url, const TQCString& startup_id ); - // KDE4 merge with above with startup_id = "" - /** - * Invoke the standard browser. Uses a @p startup_id of "" (empty) - * and is otherwise the same as the above function. - */ - void invokeBrowser( const TQString &url ); - - /** - * If the widget with focus provides a cut() slot, call that slot. Thus for a - * simple application cut can be implemented as: - * \code - * KStdAction::cut( kapp, TQT_SLOT( cut() ), actionCollection() ); - * \endcode - */ - void cut(); - - /** - * If the widget with focus provides a copy() slot, call that slot. Thus for a - * simple application copy can be implemented as: - * \code - * KStdAction::copy( kapp, TQT_SLOT( copy() ), actionCollection() ); - * \endcode - */ - void copy(); - - /** - * If the widget with focus provides a paste() slot, call that slot. Thus for a - * simple application copy can be implemented as: - * \code - * KStdAction::paste( kapp, TQT_SLOT( paste() ), actionCollection() ); - * \endcode - */ - void paste(); - - /** - * If the widget with focus provides a clear() slot, call that slot. Thus for a - * simple application clear() can be implemented as: - * \code - * new TDEAction( i18n( "Clear" ), "editclear", 0, kapp, TQT_SLOT( clear() ), actionCollection(), "clear" ); - * \endcode - * - * Note that for some widgets, this may not provide the intended bahavior. For - * example if you make use of the code above and a TDEListView has the focus, clear() - * will clear all of the items in the list. If this is not the intened behavior - * and you want to make use of this slot, you can subclass TDEListView and reimplement - * this slot. For example the following code would implement a TDEListView without this - * behavior: - * - * \code - * class MyListView : public TDEListView { - * Q_OBJECT - * public: - * MyListView( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : TDEListView( parent, name, f ) {} - * virtual ~MyListView() {} - * public slots: - * virtual void clear() {} - * }; - * \endcode - */ - void clear(); - - /** - * If the widget with focus provides a selectAll() slot, call that slot. Thus for a - * simple application select all can be implemented as: - * \code - * KStdAction::selectAll( kapp, TQT_SLOT( selectAll() ), actionCollection() ); - * \endcode - */ - void selectAll(); - - /** - * Broadcast a received keycode to all listening KDE applications - * The primary use for this feature is to connect hotkeys such as - * XF86Display to their respective TDEGlobalAccel functions while - * the screen is locked by kdesktop_lock. - */ - void broadcastKeyCode(unsigned int keyCode); - -public: - /** - * Returns the DCOP name of the service launcher. This will be something like - * klaucher_$host_$uid. - * @return the name of the service launcher - */ - static TQCString launcher(); - - /** - * Starts a service based on the (translated) name of the service. - * E.g. "Web Browser" - * - * @param _name the name of the service - * @param URL if not empty this URL is passed to the service - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param dcopService On success, @p dcopService contains the DCOP name - * under which this service is available. If empty, the service does - * not provide DCOP services. If the pointer is 0 the argument - * will be ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param noWait if set, the function does not wait till the service is running. - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int startServiceByName( const TQString& _name, const TQString &URL, - TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false ); - - /** - * Starts a service based on the (translated) name of the service. - * E.g. "Web Browser" - * - * @param _name the name of the service - * @param URLs if not empty these URLs will be passed to the service - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param dcopService On success, @p dcopService contains the DCOP name - * under which this service is available. If empty, the service does - * not provide DCOP services. If the pointer is 0 the argument - * will be ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param noWait if set, the function does not wait till the service is running. - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int startServiceByName( const TQString& _name, const TQStringList &URLs=TQStringList(), - TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false ); - - /** - * Starts a service based on the desktop path of the service. - * E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop" - * - * @param _name the path of the desktop file - * @param URL if not empty this URL is passed to the service - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param dcopService On success, @p dcopService contains the DCOP name - * under which this service is available. If empty, the service does - * not provide DCOP services. If the pointer is 0 the argument - * will be ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param noWait if set, the function does not wait till the service is running. - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int startServiceByDesktopPath( const TQString& _name, const TQString &URL, - TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); - - /** - * Starts a service based on the desktop path of the service. - * E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop" - * - * @param _name the path of the desktop file - * @param URLs if not empty these URLs will be passed to the service - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param dcopService On success, @p dcopService contains the DCOP name - * under which this service is available. If empty, the service does - * not provide DCOP services. If the pointer is 0 the argument - * will be ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param noWait if set, the function does not wait till the service is running. - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs=TQStringList(), - TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); - - /** - * Starts a service based on the desktop name of the service. - * E.g. "konqueror" - * - * @param _name the desktop name of the service - * @param URL if not empty this URL is passed to the service - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param dcopService On success, @p dcopService contains the DCOP name - * under which this service is available. If empty, the service does - * not provide DCOP services. If the pointer is 0 the argument - * will be ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param noWait if set, the function does not wait till the service is running. - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int startServiceByDesktopName( const TQString& _name, const TQString &URL, - TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); - - /** - * Starts a service based on the desktop name of the service. - * E.g. "konqueror" - * - * @param _name the desktop name of the service - * @param URLs if not empty these URLs will be passed to the service - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param dcopService On success, @p dcopService contains the DCOP name - * under which this service is available. If empty, the service does - * not provide DCOP services. If the pointer is 0 the argument - * will be ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @param noWait if set, the function does not wait till the service is running. - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int startServiceByDesktopName( const TQString& _name, const TQStringList &URLs=TQStringList(), - TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); - - /** - * Starts a program via tdeinit. - * - * program name and arguments are converted to according to the - * local encoding and passed as is to tdeinit. - * - * @param name Name of the program to start - * @param args Arguments to pass to the program - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int tdeinitExec( const TQString& name, const TQStringList &args, - TQString *error, int *pid, const TQCString& startup_id ); - // KDE4 merge with above with startup_id = "" - static int tdeinitExec( const TQString& name, const TQStringList &args=TQStringList(), - TQString *error=0, int *pid = 0 ); - - /** - * Starts a program via tdeinit and wait for it to finish. - * - * Like tdeinitExec(), but it waits till the program is finished. - * As such it behaves similar to the system(...) function. - * - * @param name Name of the program to start - * @param args Arguments to pass to the program - * @param error On failure, @p error contains a description of the error - * that occurred. If the pointer is 0, the argument will be - * ignored - * @param pid On success, the process id of the new service will be written - * here. If the pointer is 0, the argument will be ignored. - * @param startup_id for app startup notification, "0" for none, - * "" ( empty string ) is the default - * @return an error code indicating success (== 0) or failure (> 0). - */ - static int tdeinitExecWait( const TQString& name, const TQStringList &args, - TQString *error, int *pid, const TQCString& startup_id ); - // KDE4 merge with above with startup_id = "" - static int tdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(), - TQString *error=0, int *pid = 0 ); - - /** - * Returns a text for the window caption. - * - * This may be set by - * "-caption", otherwise it will be equivalent to the name of the - * executable. - * @return the text for the window caption - */ - TQString caption() const; - - /** - * @deprecated - */ - KDE_DEPRECATED TDEStyle* kstyle() const { return 0; } - - /** - * Builds a caption that contains the application name along with the - * userCaption using a standard layout. - * - * To make a compliant caption - * for your window, simply do: @p setCaption(kapp->makeStdCaption(yourCaption)); - * - * @param userCaption The caption string you want to display in the - * window caption area. Do not include the application name! - * @param withAppName Indicates that the method shall include or ignore - * the application name when making the caption string. You are not - * compliant if you set this to @p false. - * @param modified If true, a 'modified' sign will be included in the - * returned string. This is useful when indicating that a file is - * modified, i.e., it contains data that has not been saved. - * @return the created caption - */ - TQString makeStdCaption( const TQString &userCaption, - bool withAppName=true, bool modified=false ) const; - - /** - * Get a file name in order to make a temporary copy of your document. - * - * @param pFilename The full path to the current file of your - * document. - * @return A new filename for auto-saving. - */ - TQString tempSaveName( const TQString& pFilename ) const; - - /** - * Check whether an auto-save file exists for the document you want to - * open. - * - * @param pFilename The full path to the document you want to open. - * @param bRecover This gets set to true if there was a recover - * file. - * @return The full path of the file to open. - */ - TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const; - -#if defined(Q_WS_X11) - /** - * @internal - * Get the X11 display - * @return the X11 Display - */ - Display *getDisplay() { return display; } -#endif - - /** - * @internal - * Gets X11 composition information - */ - void getX11RGBAInformation(Display *dpy); - - /** - * Gets the availability of a composition manager such as kompmgr - * Note that at least one application must have called detectCompositionManagerAvailable - * while the current X display was active in order for this method to return valid results. - * @see detectCompositionManagerAvailable() - * @return whether the composition manager is enabled - */ - static bool isCompositionManagerAvailable(); - - /** - * Detects the availability of a composition manager such as kompmgr - * Note that calling this method will probably cause the screen to flicker. - * @see isCompositionManagerAvailable() - * @param force_available If set, force TDE to assume a composition manager is available - * @param available Whether or not the composition manager is available (only used if force_available is TRUE) - * @return whether the composition manager is enabled - */ - bool detectCompositionManagerAvailable(bool force_available=false, bool available=true); - - /** - * @internal - * Opens the display - * This can be used to initialize a TDEApplication with RGBA support like this: - * TDEApplication app(TDEApplication::openX11RGBADisplay()); - * or - * TDEApplication app(TDEApplication::openX11RGBADisplay(), useStyles); - */ - static Display* openX11RGBADisplay(); - - /** - * Returns the X11 display visual - * - * @return A pointer to the X11 display visual - */ - Qt::HANDLE getX11RGBAVisual(Display *dpy); - - /** - * Returns the X11 display colormap - * - * @return An X11 display colormap object - */ - Qt::HANDLE getX11RGBAColormap(Display *dpy); - - /** - * Returns whether or not X11 composition is available - * - * You must first call getX11RGBAInformation() - * - * Note that getX11RGBAInformation() has already - * been called if you used the default TDEApplication - * constructor. - * - * Additionally, at least one application must have called - * detectCompositionManagerAvailable while the current X - * display was active in order for this method to return - * valid results. - * - * @return true if composition is available - */ - bool isX11CompositionAvailable(); - - /** - * Enables style plugins. - * - * This is useful only to applications that normally - * do not display a GUI and create the TDEApplication with - * allowStyles set to false. - */ - void enableStyles(); - - /** - * Disables style plugins. - * - * Current style plugins do not get unloaded. - * - * This is only useful when used in combination with enableStyles(). - */ - void disableStyles(); - - /** - * Installs widget filter as global X11 event filter. - * - * The widget - * filter receives XEvents in its standard TQWidget::x11Event() function. - * - * Warning: Only do this when absolutely necessary. An installed X11 filter - * can slow things down. - **/ - void installX11EventFilter( TQWidget* filter ); - - /** - * Removes global X11 event filter previously installed by - * installX11EventFilter(). - */ - void removeX11EventFilter( const TQWidget* filter ); - - /** - * Generates a uniform random number. - * @return A truly unpredictable number in the range [0, RAND_MAX) - */ - static int random(); - - /** - * Generates a random string. It operates in the range [A-Za-z0-9] - * @param length Generate a string of this length. - * @return the random string - */ - static TQString randomString(int length); - - /** - * Adds a message type to the KIPC event mask. You can only add "system - * messages" to the event mask. These are the messages with id < 32. - * Messages with id >= 32 are user messages. - * @param id The message id. See KIPC::Message. - * @see KIPC - * @see removeKipcEventMask() - * @see kipcMessage() - */ - void addKipcEventMask(int id); - - /** - * Removes a message type from the KIPC event mask. This message will - * not be handled anymore. - * @param id The message id. - * @see KIPC - * @see addKipcEventMask() - * @see kipcMessage() - */ - void removeKipcEventMask(int id); - - /** - * Returns the app startup notification identifier for this running - * application. - * @return the startup notification identifier - */ - TQCString startupId() const; - - /** - * @internal - * Sets a new value for the application startup notification window property for newly - * created toplevel windows. - * @param startup_id the startup notification identifier - * @see TDEStartupInfo::setNewStartupId - */ - void setStartupId( const TQCString& startup_id ); - - /** - * Updates the last user action timestamp to the given time, or to the current time, - * if 0 is given. Do not use unless you're really sure what you're doing. - * Consult focus stealing prevention section in tdebase/twin/README. - * @since 3.2 - */ - void updateUserTimestamp( unsigned long time = 0 ); - - /** - * Returns the last user action timestamp or 0 if no user activity has taken place yet. - * @since 3.2.3 - * @see updateuserTimestamp - */ - unsigned long userTimestamp() const; - - /** - * Updates the last user action timestamp in the application registered to DCOP with dcopId - * to the given time, or to this application's user time, if 0 is given. - * Use before causing user interaction in the remote application, e.g. invoking a dialog - * in the application using a DCOP call. - * Consult focus stealing prevention section in tdebase/twin/README. - * @since 3.3 - */ - void updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time = 0 ); - - /** - * Returns the argument to --geometry if any, so the geometry can be set - * wherever necessary - * @return the geometry argument, or TQString::null if there is none - */ - TQString geometryArgument() const; - - /** - * Install a Qt SQL property map with entries for all KDE widgets - * Call this in any application using KDE widgets in TQSqlForm or TQDataView. - */ - void installKDEPropertyMap(); - - /** - * Returns whether a certain action is authorized - * @param genericAction The name of a generic action - * @return true if the action is authorized - */ - bool authorize(const TQString &genericAction); - - /** - * Returns whether a certain TDEAction is authorized. - * - * @param action The name of a TDEAction action. The name is prepended - * with "action/" before being passed to authorize() - * @return true if the TDEAction is authorized - */ - bool authorizeTDEAction(const char *action); - - /** - * Returns whether a certain URL related action is authorized. - * - * @param action The name of the action. Known actions are - * list (may be listed (e.g. in file selection dialog)), - * link (may be linked to), - * open (may open) and - * redirect (may be redirected to) - * @param baseURL The url where the action originates from - * @param destURL The object of the action - * @return true when the action is authorized, false otherwise. - * @since 3.1 - */ - bool authorizeURLAction(const TQString &action, const KURL &baseURL, const KURL &destURL); - - /** - * Allow a certain URL action. This can be useful if your application - * needs to ensure access to an application specific directory that may - * otherwise be subject to KIOSK restrictions. - * @param action The name of the action. - * @param _baseURL The url where the action originates from - * @param _destURL The object of the action - * @since 3.2 - */ - void allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL); - - /** - * Returns whether access to a certain control module is authorized. - * - * @param menuId identifying the control module, e.g. tde-mouse.desktop - * @return true if access to the module is authorized, false otherwise. - * @since 3.2 - */ - bool authorizeControlModule(const TQString &menuId); - - /** - * Returns whether access to a certain control modules is authorized. - * - * @param menuIds list of menu-ids of control module, - * an example of a menu-id is tde-mouse.desktop. - * @return Those control modules for which access has been authorized. - * @since 3.2 - */ - TQStringList authorizeControlModules(const TQStringList &menuIds); - - /** - * Returns the state of the currently pressed keyboard modifiers (e.g. shift, control, etc.) - * and mouse buttons, similarly to TQKeyEvent::state() and TQMouseEvent::state(). - * You usually should simply use the information provided by TQKeyEvent and TQMouseEvent, - * but it can be useful to query for the status of the modifiers at another moment - * (e.g. some KDE apps do that upon a drop event). - * @return the keyboard modifiers and mouse buttons state - * @since 3.4 - */ - static ButtonState keyboardMouseState(); - - // Same values as ShiftMask etc. in X.h - enum { ShiftModifier = 1<<0, - LockModifier = 1<<1, - ControlModifier = 1<<2, - Modifier1 = 1<<3, - Modifier2 = 1<<4, - Modifier3 = 1<<5, - Modifier4 = 1<<6, - Modifier5 = 1<<7 }; - /** - * @deprecated Use keyboardMouseState() - * @since 3.1 - */ - static uint keyboardModifiers() KDE_DEPRECATED; - - /** @deprecated Same values as Button1Mask etc. in X.h */ - enum { Button1Pressed = 1<<8, - Button2Pressed = 1<<9, - Button3Pressed = 1<<10, - Button4Pressed = 1<<11, - Button5Pressed = 1<<12 }; - /** - * @deprecated Use keyboardMouseState() - * @since 3.1 - */ - static uint mouseState() KDE_DEPRECATED; - - -public slots: - /** - * Tells TDEApplication about one more operation that should be finished - * before the application exits. The standard behavior is to exit on the - * "last window closed" event, but some events should outlive the last window closed - * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client). - */ - void ref(); - - /** - * Tells TDEApplication that one operation such as those described in ref() just finished. - * The application exits if the counter is back to 0. - */ - void deref(); - -protected: - /** - * @internal Used by KUniqueApplication - */ - TDEApplication( bool allowStyles, bool GUIenabled, TDEInstance* _instance ); - -#ifdef Q_WS_X11 - /** - * @internal Used by KUniqueApplication - */ - TDEApplication( Display *display, Qt::HANDLE visual, Qt::HANDLE colormap, - bool allowStyles, TDEInstance* _instance ); - - /** - * Used to catch X11 events - */ - bool x11EventFilter( XEvent * ); - - Display *display; -#endif - Atom kipcCommAtom; - int kipcEventMask; - - /// Current application object. - static TDEApplication *KApp; - int pArgc; - - /** - * This method is used internally to determine which edit slots are implemented - * by the widget that has the focus, and to invoke those slots if available. - * - * @param slot is the slot as returned using the TQT_SLOT() macro, for example TQT_SLOT( cut() ) - * - * This method can be used in TDEApplication subclasses to implement application wide - * edit actions not supported by the TDEApplication class. For example (in your subclass): - * - * \code - * void MyApplication::deselect() - * { - * invokeEditSlot( TQT_SLOT( deselect() ) ); - * } - * \endcode - * - * Now in your application calls to MyApplication::deselect() will call this slot on the - * focused widget if it provides this slot. You can combine this with TDEAction with: - * - * \code - * KStdAction::deselect( static_cast<MyApplication *>( kapp ), TQT_SLOT( cut() ), actionCollection() ); - * \endcode - * - * @see cut() - * @see copy() - * @see paste() - * @see clear() - * @see selectAll() - * - * @since 3.2 - */ - void invokeEditSlot( const char *slot ); - -private slots: - void dcopFailure(const TQString &); - void dcopBlockUserInput( bool ); - void x11FilterDestroyed(); - void checkAppStartedSlot(); - -private: - TQString sessionConfigName() const; - TDEConfig* pSessionConfig; //instance specific application config object - static DCOPClient *s_DCOPClient; // app specific application communication client - static bool s_dcopClientNeedsPostInit; - TQString aCaption; // the name for the window title - bool bSessionManagement; - struct oldPixmapType { TQPixmap a, b; }; - mutable union { - struct { - TQPixmap *icon, *miniIcon; - } pm; - char unused[sizeof(oldPixmapType)]; - } aIconPixmap; // KDE4: remove me - TQString aIconName; - TQString aMiniIconName; - bool useStyles; - TQWidget *smw; - - void init( bool GUIenabled ); - - void parseCommandLine( ); // Handle KDE arguments (Using TDECmdLineArgs) - - void read_app_startup_id(); - - void dcopAutoRegistration(); - void dcopClientPostInit(); - void initUrlActionRestrictions(); - - bool argb_visual; -#if defined(Q_WS_X11) - Qt::HANDLE argb_x11_visual; - Qt::HANDLE argb_x11_colormap; -#endif - -public: - /** - * @internal - */ - bool notify(TQObject *receiver, TQEvent *event); - - /** - @internal - */ - int xErrhandler( Display*, void* ); - - /** - @internal - */ - int xioErrhandler( Display* ); - - /** - * @internal - */ - void iceIOErrorHandler( _IceConn *conn ); - - /** - * @internal - */ - static bool loadedByKdeinit; - - /** - * @internal - */ - static void startKdeinit(); - - /** - * Valid values for the settingsChanged signal - */ - enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS, - SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS }; - - /** - * Used to obtain the TQPalette that will be used to set the application palette. - * - * This is only useful for configuration modules such as krdb and should not be - * used in normal circumstances. - * @return the QPalette - * @since 3.1 - */ - static TQPalette createApplicationPalette(); - - /** - * @internal - * Raw access for use by TDM. - */ - static TQPalette createApplicationPalette( TDEConfig *config, int contrast ); - - /** - * Installs a handler for the SIGPIPE signal. It is thrown when you write to - * a pipe or socket that has been closed. - * The handler is installed automatically in the constructor, but you may - * need it if your application or component does not have a TDEApplication - * instance. - */ - static void installSigpipeHandler(); - - /** - * @internal - * Whether widgets can be used. - * - * @since 3.2 - */ - static bool guiEnabled(); - -signals: - /** - * Emitted when TDEApplication has changed its palette due to a KControl request. - * - * Normally, widgets will update their palette automatically, but you - * should connect to this to program special behavior. - */ - void tdedisplayPaletteChanged(); - - /** - * Emitted when TDEApplication has changed its GUI style in response to a KControl request. - * - * Normally, widgets will update their styles automatically (as they would - * respond to an explicit setGUIStyle() call), but you should connect to - * this to program special behavior. - */ - void tdedisplayStyleChanged(); - - /** - * Emitted when TDEApplication has changed its font in response to a KControl request. - * - * Normally widgets will update their fonts automatically, but you should - * connect to this to monitor global font changes, especially if you are - * using explicit fonts. - * - * Note: If you derive from a QWidget-based class, a faster method is to - * reimplement TQWidget::fontChange(). This is the preferred way - * to get informed about font updates. - */ - void tdedisplayFontChanged(); - - /** - * Emitted when TDEApplication has changed either its GUI style, its font or its palette - * in response to a tdedisplay request. Normally, widgets will update their styles - * automatically, but you should connect to this to program special - * behavior. */ - void appearanceChanged(); - - /** - * Emitted when the settings for toolbars have been changed. TDEToolBar will know what to do. - */ - void toolbarAppearanceChanged(int); - - /** - * Emitted when the desktop background has been changed by @p kcmdisplay. - * - * @param desk The desktop whose background has changed. - */ - void backgroundChanged(int desk); - - /** - * Emitted when the global settings have been changed - see TDEGlobalSettings - * TDEApplication takes care of calling reparseConfiguration on TDEGlobal::config() - * so that applications/classes using this only have to re-read the configuration - * @param category the category among the enum above - */ - void settingsChanged(int category); - - /** - * Emitted when the global icon settings have been changed. - * @param group the new group - */ - void iconChanged(int group); - - /** - * Emitted when a KIPC user message has been received. - * @param id the message id - * @param data the data - * @see KIPC - * @see KIPC::Message - * @see addKipcEventMask - * @see removeKipcEventMask - */ - void kipcMessage(int id, int data); - - /** - Session management asks you to save the state of your application. - - This signal is provided for compatibility only. For new - applications, simply use TDEMainWindow. By reimplementing - TDEMainWindow::queryClose(), TDEMainWindow::saveProperties() and - TDEMainWindow::readProperties() you can simply handle session - management for applications with multiple toplevel windows. - - For purposes without TDEMainWindow, create an instance of - KSessionManaged and reimplement the functions - KSessionManaged::commitData() and/or - KSessionManaged::saveState() - - If you still want to use this signal, here is what you should do: - - Connect to this signal in order to save your data. Do NOT - manipulate the UI in that slot, it is blocked by the session - manager. - - Use the sessionConfig() TDEConfig object to store all your - instance specific data. - - Do not do any closing at this point! The user may still select - Cancel wanting to continue working with your - application. Cleanups could be done after shutDown() (see - the following). - - */ - void saveYourself(); - - /** Your application is killed. Either by your program itself, - @p xkill or (the usual case) by KDE's logout. - - The signal is particularly useful if your application has to do some - last-second cleanups. Note that no user interaction is possible at - this state. - */ - void shutDown(); - - /** - * @internal - * Used to notify TDEIconLoader objects that they need to reload. - */ - void updateIconLoaders(); - - /** - * @internal - * Used to send TDEGlobalAccel objects a new keypress from physical hotkeys. - */ - void coreFakeKeyPress(unsigned int keyCode); - -private: - void propagateSettings(SettingsCategory category); - void tdedisplaySetPalette(); - void tdedisplaySetStyle(); - void tdedisplaySetFont(); - void applyGUIStyle(); - static void sigpipeHandler(int); - - int captionLayout; - - TDEApplication(const TDEApplication&); - TDEApplication& operator=(const TDEApplication&); -protected: - virtual void virtual_hook( int id, void* data ); -private: - TDEApplicationPrivate* d; -}; - - -/** - * \relates TDEGlobal - * Check, if a file may be accessed in a given mode. - * This is a wrapper around the access() system call. - * checkAccess() calls access() with the given parameters. - * If this is OK, checkAccess() returns true. If not, and W_OK - * is part of mode, it is checked if there is write access to - * the directory. If yes, checkAccess() returns true. - * In all other cases checkAccess() returns false. - * - * Other than access() this function EXPLICITLY ignores non-existant - * files if checking for write access. - * - * @param pathname The full path of the file you want to test - * @param mode The access mode, as in the access() system call. - * @return Whether the access is allowed, true = Access allowed - */ -TDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode); - -class KSessionManagedPrivate; - -/** - Provides highlevel access to session management on a per-object - base. - - KSessionManaged makes it possible to provide implementations for - TQApplication::commitData() and TQApplication::saveState(), without - subclassing TDEApplication. TDEMainWindow internally makes use of this. - - You don't need to do anything with this class when using - TDEMainWindow. Instead, use TDEMainWindow::saveProperties(), - TDEMainWindow::readProperties(), TDEMainWindow::queryClose(), - TDEMainWindow::queryExit() and friends. - - @short Highlevel access to session management. - @author Matthias Ettrich <ettrich@kde.org> - */ -class TDECORE_EXPORT KSessionManaged -{ -public: - KSessionManaged(); - virtual ~KSessionManaged(); - - /** - See TQApplication::saveState() for documentation. - - This function is just a convenience version to avoid subclassing TDEApplication. - - Return true to indicate a successful state save or false to - indicate a problem and to halt the shutdown process (will - implicitly call sm.cancel() ). - */ - virtual bool saveState( TQSessionManager& sm ); - /** - See TQApplication::commitData() for documentation. - - This function is just a convenience version to avoid subclassing TDEApplication. - - Return true to indicate a successful commit of data or false to - indicate a problem and to halt the shutdown process (will - implicitly call sm.cancel() ). - */ - virtual bool commitData( TQSessionManager& sm ); - -protected: - virtual void virtual_hook( int id, void* data ); -private: - KSessionManagedPrivate *d; -}; - - -#endif - diff --git a/tdecore/kapplication_win.cpp b/tdecore/kapplication_win.cpp index cd7145ac7..940bc379e 100644 --- a/tdecore/kapplication_win.cpp +++ b/tdecore/kapplication_win.cpp @@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <klocale.h> #include <kurl.h> diff --git a/tdecore/kcharsets.cpp b/tdecore/kcharsets.cpp index 17617bf9e..fa623b693 100644 --- a/tdecore/kcharsets.cpp +++ b/tdecore/kcharsets.cpp @@ -21,7 +21,7 @@ #include "kqiodevicegzip_p.h" #include "kentities.c" -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <klocale.h> #include <tdeconfig.h> diff --git a/tdecore/kclipboard.cpp b/tdecore/kclipboard.cpp index 53865a2c2..54d051486 100644 --- a/tdecore/kclipboard.cpp +++ b/tdecore/kclipboard.cpp @@ -16,7 +16,7 @@ Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kglobal.h> diff --git a/tdecore/kcmdlineargs.cpp b/tdecore/kcmdlineargs.cpp deleted file mode 100644 index a1d3adcf9..000000000 --- a/tdecore/kcmdlineargs.cpp +++ /dev/null @@ -1,1298 +0,0 @@ -/* - Copyright (C) 1999 Waldo Bastian <bastian@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 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <config.h> - -#include <sys/param.h> - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - -#include <tqdir.h> -#include <tqfile.h> -#include <tqasciidict.h> -#include <tqstrlist.h> - -#include "kcmdlineargs.h" -#include <kaboutdata.h> -#include <klocale.h> -#include <kapplication.h> -#include <kglobal.h> -#include <kstringhandler.h> -#include <kstaticdeleter.h> - -#ifdef Q_WS_X11 -#define DISPLAY "DISPLAY" -#elif defined(Q_WS_QWS) -#define DISPLAY "QWS_DISPLAY" -#endif - -#ifdef Q_WS_WIN -#include <win32_utils.h> -#endif - -template class TQAsciiDict<TQCString>; -template class TQPtrList<TDECmdLineArgs>; - -class TDECmdLineParsedOptions : public TQAsciiDict<TQCString> -{ -public: - TDECmdLineParsedOptions() - : TQAsciiDict<TQCString>( 7 ) { } - - // WABA: Huh? - // The compiler doesn't find TDECmdLineParsedOptions::write(s) by itself ??? - // WABA: No, because there is another write function that hides the - // write function in the base class even though this function has a - // different signature. (obscure C++ feature) - TQDataStream& save( TQDataStream &s) const - { return TQGDict::write(s); } - - TQDataStream& load( TQDataStream &s) - { return TQGDict::read(s); } - -protected: - virtual TQDataStream& write( TQDataStream &s, TQPtrCollection::Item data) const - { - TQCString *str = (TQCString *) data; - s << (*str); - return s; - } - - virtual TQDataStream& read( TQDataStream &s, TQPtrCollection::Item &item) - { - TQCString *str = new TQCString; - s >> (*str); - item = (void *)str; - return s; - } - -}; - -class TDECmdLineParsedArgs : public TQStrList -{ -public: - TDECmdLineParsedArgs() - : TQStrList( true ) { } - TQDataStream& save( TQDataStream &s) const - { return TQGList::write(s); } - - TQDataStream& load( TQDataStream &s) - { return TQGList::read(s); } -}; - - -class TDECmdLineArgsList: public TQPtrList<TDECmdLineArgs> -{ -public: - TDECmdLineArgsList() { } -}; - -TDECmdLineArgsList *TDECmdLineArgs::argsList = 0; -int TDECmdLineArgs::argc = 0; -char **TDECmdLineArgs::argv = 0; -char *TDECmdLineArgs::mCwd = 0; -static KStaticDeleter <char> mCwdd; -const TDEAboutData *TDECmdLineArgs::about = 0; -bool TDECmdLineArgs::parsed = false; -bool TDECmdLineArgs::ignoreUnknown = false; - -// -// Static functions -// - -void -TDECmdLineArgs::init(int _argc, char **_argv, const char *_appname, const char* programName, - const char *_description, const char *_version, bool noKApp) -{ - init(_argc, _argv, - new TDEAboutData(_appname, programName, _version, _description), - noKApp); -} - -void -TDECmdLineArgs::init(int _argc, char **_argv, const char *_appname, - const char *_description, const char *_version, bool noKApp) -{ - init(_argc, _argv, - new TDEAboutData(_appname, _appname, _version, _description), - noKApp); -} - -void -TDECmdLineArgs::initIgnore(int _argc, char **_argv, const char *_appname ) -{ - init(_argc, _argv, - new TDEAboutData(_appname, _appname, "unknown", "TDE Application", false)); - ignoreUnknown = true; -} - -void -TDECmdLineArgs::init(const TDEAboutData* ab) -{ - char **_argv = (char **) malloc(sizeof(char *)); - _argv[0] = (char *) ab->appName(); - init(1,_argv,ab, true); -} - - -void -TDECmdLineArgs::init(int _argc, char **_argv, const TDEAboutData *_about, bool noKApp) -{ - argc = _argc; - argv = _argv; - - if (!argv) - { - fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); - fprintf(stderr, "Passing null-pointer to 'argv' is not allowed.\n\n"); - - assert( 0 ); - exit(255); - } - - // Strip path from argv[0] - if (argc) { - char *p = strrchr( argv[0], '/'); - if (p) - argv[0] = p+1; - } - - about = _about; - parsed = false; - mCwd = mCwdd.setObject(mCwd, new char [PATH_MAX+1], true); - (void) getcwd(mCwd, PATH_MAX); -#ifdef Q_WS_WIN - win32_slashify(mCwd, PATH_MAX); -#endif - if (!noKApp) - TDEApplication::addCmdLineOptions(); -} - -TQString TDECmdLineArgs::cwd() -{ - return TQFile::decodeName(TQCString(mCwd)); -} - -const char * TDECmdLineArgs::appName() -{ - if (!argc) return 0; - return argv[0]; -} - -void -TDECmdLineArgs::addCmdLineOptions( const TDECmdLineOptions *options, const char *name, - const char *id, const char *afterId) -{ - if (!argsList) - argsList = new TDECmdLineArgsList(); - - int pos = argsList->count(); - - if (pos && id && argsList->last() && !argsList->last()->name) - pos--; - - TDECmdLineArgs *args; - int i = 0; - for(args = argsList->first(); args; args = argsList->next(), i++) - { - if (!id && !args->id) - return; // Options already present. - - if (id && args->id && (::qstrcmp(id, args->id) == 0)) - return; // Options already present. - - if (afterId && args->id && (::qstrcmp(afterId, args->id) == 0)) - pos = i+1; - } - - assert( parsed == false ); // You must add _ALL_ cmd line options - // before accessing the arguments! - args = new TDECmdLineArgs(options, name, id); - argsList->insert(pos, args); -} - -void -TDECmdLineArgs::saveAppArgs( TQDataStream &ds) -{ - if (!parsed) - parseAllArgs(); - - // Remove Qt and TDE options. - removeArgs("qt"); - removeArgs("tde"); - - TQCString qCwd = mCwd; - ds << qCwd; - - uint count = argsList ? argsList->count() : 0; - ds << count; - - if (!count) return; - - TDECmdLineArgs *args; - for(args = argsList->first(); args; args = argsList->next()) - { - ds << TQCString(args->id); - args->save(ds); - } -} - -void -TDECmdLineArgs::loadAppArgs( TQDataStream &ds) -{ - parsed = true; // don't reparse argc/argv! - - // Remove Qt and TDE options. - removeArgs("qt"); - removeArgs("tde"); - - TDECmdLineArgs *args; - if ( argsList ) { - for(args = argsList->first(); args; args = argsList->next()) - { - args->clear(); - } - } - - if (ds.atEnd()) - return; - - TQCString qCwd; - ds >> qCwd; - delete [] mCwd; - - mCwd = mCwdd.setObject(mCwd, new char[qCwd.length()+1], true); - strncpy(mCwd, qCwd.data(), qCwd.length()+1); - - uint count; - ds >> count; - - while(count--) - { - TQCString id; - ds >> id; - assert( argsList ); - for(args = argsList->first(); args; args = argsList->next()) - { - if (args->id == id) - { - args->load(ds); - break; - } - } - } - parsed = true; -} - -TDECmdLineArgs *TDECmdLineArgs::parsedArgs(const char *id) -{ - TDECmdLineArgs *args = argsList ? argsList->first() : 0; - while(args) - { - if ((id && ::qstrcmp(args->id, id) == 0) || (!id && !args->id)) - { - if (!parsed) - parseAllArgs(); - return args; - } - args = argsList->next(); - } - - return args; -} - -void TDECmdLineArgs::removeArgs(const char *id) -{ - TDECmdLineArgs *args = argsList ? argsList->first() : 0; - while(args) - { - if (args->id && id && ::qstrcmp(args->id, id) == 0) - { - if (!parsed) - parseAllArgs(); - break; - } - args = argsList->next(); - } - - if (args) - delete args; -} - -/* - * @return: - * 0 - option not found. - * 1 - option found // -fork - * 2 - inverse option found ('no') // -nofork - * 3 - option + arg found // -fork now - * - * +4 - no more options follow // !fork - */ -static int -findOption(const TDECmdLineOptions *options, TQCString &opt, - const char *&opt_name, const char *&def, bool &enabled) -{ - int result; - bool inverse; - int len = opt.length(); - while(options && options->name) - { - result = 0; - inverse = false; - opt_name = options->name; - if ((opt_name[0] == ':') || (opt_name[0] == 0)) - { - options++; - continue; - } - - if (opt_name[0] == '!') - { - opt_name++; - result = 4; - } - if ((opt_name[0] == 'n') && (opt_name[1] == 'o')) - { - opt_name += 2; - inverse = true; - } - if (strncmp(opt.data(), opt_name, len) == 0) - { - opt_name += len; - if (!opt_name[0]) - { - if (inverse) - return result+2; - - if (!options->description) - { - options++; - if (!options->name) - return result+0; - TQCString nextOption = options->name; - int p = nextOption.find(' '); - if (p > 0) - nextOption = nextOption.left(p); - if (nextOption[0] == '!') - nextOption = nextOption.mid(1); - if (strncmp(nextOption.data(), "no", 2) == 0) - { - nextOption = nextOption.mid(2); - enabled = !enabled; - } - result = findOption(options, nextOption, opt_name, def, enabled); - assert(result); - opt = nextOption; - return result; - } - - return 1; - } - if (opt_name[0] == ' ') - { - opt_name++; - def = options->def; - return result+3; - } - } - - options++; - } - return 0; -} - - -void -TDECmdLineArgs::findOption(const char *_opt, TQCString opt, int &i, bool _enabled, bool &moreOptions) -{ - TDECmdLineArgs *args = argsList->first(); - const char *opt_name; - const char *def; - TQCString argument; - int j = opt.find('='); - if (j != -1) - { - argument = opt.mid(j+1); - opt = opt.left(j); - } - - bool enabled = true; - int result = 0; - while (args) - { - enabled = _enabled; - result = ::findOption(args->options, opt, opt_name, def, enabled); - if (result) break; - args = argsList->next(); - } - if (!args && (_opt[0] == '-') && _opt[1] && (_opt[1] != '-')) - { - // Option not found check if it is a valid option - // in the style of -Pprinter1 or ps -aux - int p = 1; - while (true) - { - TQCString singleCharOption = " "; - singleCharOption[0] = _opt[p]; - args = argsList->first(); - while (args) - { - enabled = _enabled; - result = ::findOption(args->options, singleCharOption, opt_name, def, enabled); - if (result) break; - args = argsList->next(); - } - if (!args) - break; // Unknown argument - - p++; - if (result == 1) // Single option - { - args->setOption(singleCharOption, enabled); - if (_opt[p]) - continue; // Next option - else - return; // Finished - } - else if (result == 3) // This option takes an argument - { - if (argument.isEmpty()) - { - argument = _opt+p; - } - args->setOption(singleCharOption, (const char*)argument); - return; - } - break; // Unknown argument - } - args = 0; - result = 0; - } - - if (!args || !result) - { - if (ignoreUnknown) - return; - enable_i18n(); - usage( i18n("Unknown option '%1'.").arg(TQString::fromLocal8Bit(_opt))); - } - - if ((result & 4) != 0) - { - result &= ~4; - moreOptions = false; - } - - if (result == 3) // This option takes an argument - { - if (!enabled) - { - if (ignoreUnknown) - return; - enable_i18n(); - usage( i18n("Unknown option '%1'.").arg(TQString::fromLocal8Bit(_opt))); - } - if (argument.isEmpty()) - { - i++; - if (i >= argc) - { - enable_i18n(); - usage( i18n("'%1' missing.").arg( opt_name)); - } - argument = argv[i]; - } - args->setOption(opt, (const char*)argument); - } - else - { - args->setOption(opt, enabled); - } -} - -void -TDECmdLineArgs::printQ(const TQString &msg) -{ - TQCString localMsg = msg.local8Bit(); - fprintf(stdout, "%s", localMsg.data()); -} - -void -TDECmdLineArgs::parseAllArgs() -{ - bool allowArgs = false; - bool inOptions = true; - bool everythingAfterArgIsArgs = false; - TDECmdLineArgs *appOptions = argsList->last(); - if (!appOptions->id) - { - const TDECmdLineOptions *option = appOptions->options; - while(option && option->name) - { - if (option->name[0] == '+') - allowArgs = true; - if ( option->name[0] == '!' && option->name[1] == '+' ) - { - allowArgs = true; - everythingAfterArgIsArgs = true; - } - option++; - } - } - for(int i = 1; i < argc; i++) - { - if (!argv[i]) - continue; - - if ((argv[i][0] == '-') && argv[i][1] && inOptions) - { - bool enabled = true; - const char *option = &argv[i][1]; - const char *orig = argv[i]; - if (option[0] == '-') - { - option++; - argv[i]++; - if (!option[0]) - { - inOptions = false; - continue; - } - } - if (::qstrcmp(option, "help") == 0) - { - usage(0); - } - else if (strncmp(option, "help-",5) == 0) - { - usage(option+5); - } - else if ( (::qstrcmp(option, "version") == 0) || - (::qstrcmp(option, "v") == 0)) - { - printQ( TQString("Qt: %1\n").arg(tqVersion())); - printQ( TQString("TDE: %1\n").arg(TDE_VERSION_STRING)); - printQ( TQString("%1: %2\n"). - arg(about->programName()).arg(about->version())); - exit(0); - } else if ( (::qstrcmp(option, "license") == 0) ) - { - enable_i18n(); - printQ( about->license() ); - printQ( "\n" ); - exit(0); - } else if ( ::qstrcmp( option, "author") == 0 ) { - enable_i18n(); - if ( about ) { - const TQValueList<TDEAboutPerson> authors = about->authors(); - if ( !authors.isEmpty() ) { - TQString authorlist; - for (TQValueList<TDEAboutPerson>::ConstIterator it = authors.begin(); it != authors.end(); ++it ) { - TQString email; - if ( !(*it).emailAddress().isEmpty() ) - email = " <" + (*it).emailAddress() + ">"; - authorlist += TQString(" ") + (*it).name() + email + "\n"; - } - printQ( i18n("the 2nd argument is a list of name+address, one on each line","%1 was written by\n%2").arg ( TQString(about->programName()) ).arg( authorlist ) ); - } - } else { - printQ( i18n("This application was written by somebody who wants to remain anonymous.") ); - } - if (about) - { - if (!about->customAuthorTextEnabled ()) - { - if (about->bugAddress().isEmpty() || about->bugAddress() == "bugs.pearsoncomputing.net" ) - printQ( i18n( "Please use http://bugs.pearsoncomputing.net to report bugs.\n" ) ); - else { - if( about->authors().count() == 1 && about->authors().first().emailAddress() == about->bugAddress() ) - printQ( i18n( "Please report bugs to %1.\n" ).arg( about->authors().first().emailAddress() ) ); - else - printQ( i18n( "Please report bugs to %1.\n" ).arg(about->bugAddress()) ); - } - } - else - { - printQ(about->customAuthorPlainText()); - } - } - exit(0); - } else { - if ((option[0] == 'n') && (option[1] == 'o')) - { - option += 2; - enabled = false; - } - findOption(orig, option, i, enabled, inOptions); - } - } - else - { - // Check whether appOptions allows these arguments - if (!allowArgs) - { - if (ignoreUnknown) - continue; - enable_i18n(); - usage( i18n("Unexpected argument '%1'.").arg(TQString::fromLocal8Bit(argv[i]))); - } - else - { - appOptions->addArgument(argv[i]); - if (everythingAfterArgIsArgs) - inOptions = false; - } - } - } - parsed = true; -} - -/** - * For TDEApplication only: - * - * Return argc - */ -int * -TDECmdLineArgs::tqt_argc() -{ - if (!argsList) - TDEApplication::addCmdLineOptions(); // Lazy bastards! - - static int tqt_argc = -1; - if( tqt_argc != -1 ) - return &tqt_argc; - - TDECmdLineArgs *args = parsedArgs("qt"); - assert(args); // No qt options have been added! - if (!argv) - { - fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); - fprintf(stderr, "Application has not called TDECmdLineArgs::init(...).\n\n"); - - assert( 0 ); - exit(255); - } - - assert(argc >= (args->count()+1)); - tqt_argc = args->count() +1; - return &tqt_argc; -} - -/** - * For TDEApplication only: - * - * Return argv - */ -char *** -TDECmdLineArgs::tqt_argv() -{ - if (!argsList) - TDEApplication::addCmdLineOptions(); // Lazy bastards! - - static char** tqt_argv; - if( tqt_argv != NULL ) - return &tqt_argv; - - TDECmdLineArgs *args = parsedArgs("qt"); - assert(args); // No qt options have been added! - if (!argv) - { - fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); - fprintf(stderr, "Application has not called TDECmdLineArgs::init(...).\n\n"); - - assert( 0 ); - exit(255); - } - - tqt_argv = new char*[ args->count() + 2 ]; - tqt_argv[ 0 ] = tqstrdup( appName()); - int i = 0; - for(; i < args->count(); i++) - { - tqt_argv[i+1] = tqstrdup((char *) args->arg(i)); - } - tqt_argv[i+1] = 0; - - return &tqt_argv; -} - -void -TDECmdLineArgs::enable_i18n() -{ - // called twice or too late - if (TDEGlobal::_locale) - return; - - if (!TDEGlobal::_instance) { - TDEInstance *instance = new TDEInstance(about); - (void) instance->config(); - // Don't delete instance! - } -} - -void -TDECmdLineArgs::usage(const TQString &error) -{ - assert(TDEGlobal::_locale); - TQCString localError = error.local8Bit(); - if (localError[error.length()-1] == '\n') - localError = localError.left(error.length()-1); - fprintf(stderr, "%s: %s\n", argv[0], localError.data()); - - TQString tmp = i18n("Use --help to get a list of available command line options."); - localError = tmp.local8Bit(); - fprintf(stderr, "%s: %s\n", argv[0], localError.data()); - exit(254); -} - -void -TDECmdLineArgs::usage(const char *id) -{ - enable_i18n(); - assert(argsList != 0); // It's an error to call usage(...) without - // having done addCmdLineOptions first! - - TQString optionFormatString = " %1 %2\n"; - TQString optionFormatStringDef = " %1 %2 [%3]\n"; - TQString optionHeaderString = i18n("\n%1:\n"); - TQString tmp; - TQString usage; - - TDECmdLineArgs *args = argsList->last(); - - if (!(args->id) && (args->options) && - (args->options->name) && (args->options->name[0] != '+')) - { - usage = i18n("[options] ")+usage; - } - - while(args) - { - if (args->name) - { - usage = i18n("[%1-options]").arg(args->name)+" "+usage; - } - args = argsList->prev(); - } - - TDECmdLineArgs *appOptions = argsList->last(); - if (!appOptions->id) - { - const TDECmdLineOptions *option = appOptions->options; - while(option && option->name) - { - if (option->name[0] == '+') - usage = usage + (option->name+1) + " "; - else if ( option->name[0] == '!' && option->name[1] == '+' ) - usage = usage + (option->name+2) + " "; - - option++; - } - } - - printQ(i18n("Usage: %1 %2\n").arg(argv[0]).arg(usage)); - printQ("\n"+about->shortDescription()+"\n"); - - printQ(optionHeaderString.arg(i18n("Generic options"))); - printQ(optionFormatString.arg("--help", -25).arg(i18n("Show help about options"))); - - args = argsList->first(); - while(args) - { - if (args->name && args->id) - { - TQString option = TQString("--help-%1").arg(args->id); - TQString desc = i18n("Show %1 specific options").arg(args->name); - - printQ(optionFormatString.arg(option, -25).arg(desc)); - } - args = argsList->next(); - } - - printQ(optionFormatString.arg("--help-all",-25).arg(i18n("Show all options"))); - printQ(optionFormatString.arg("--author",-25).arg(i18n("Show author information"))); - printQ(optionFormatString.arg("-v, --version",-25).arg(i18n("Show version information"))); - printQ(optionFormatString.arg("--license",-25).arg(i18n("Show license information"))); - printQ(optionFormatString.arg("--", -25).arg(i18n("End of options"))); - - args = argsList->first(); // Sets current to 1st. - - bool showAll = id && (::qstrcmp(id, "all") == 0); - - if (!showAll) - { - while(args) - { - if (!id && !args->id) break; - if (id && (::qstrcmp(args->id, id) == 0)) break; - args = argsList->next(); - } - } - - while(args) - { - bool hasArgs = false; - bool hasOptions = false; - TQString optionsHeader; - if (args->name) - optionsHeader = optionHeaderString.arg(i18n("%1 options").arg(TQString::fromLatin1(args->name))); - else - optionsHeader = i18n("\nOptions:\n"); - - while (args) - { - const TDECmdLineOptions *option = args->options; - TQCString opt = ""; -// - while(option && option->name) - { - TQString description; - TQString descriptionRest; - TQStringList dl; - - // Option header - if (option->name[0] == ':') - { - if (option->description) - { - optionsHeader = "\n"+i18n(option->description); - if (!optionsHeader.endsWith("\n")) - optionsHeader.append("\n"); - hasOptions = false; - } - option++; - continue; - } - - // Free-form comment - if (option->name[0] == 0) - { - if (option->description) - { - TQString tmp = "\n"+i18n(option->description); - if (!tmp.endsWith("\n")) - tmp.append("\n"); - printQ(tmp); - } - option++; - continue; - } - - // Options - if (option->description) - { - description = i18n(option->description); - dl = TQStringList::split("\n", description, true); - description = dl.first(); - dl.remove( dl.begin() ); - } - TQCString name = option->name; - if (name[0] == '!') - name = name.mid(1); - - if (name[0] == '+') - { - if (!hasArgs) - { - printQ(i18n("\nArguments:\n")); - hasArgs = true; - } - - name = name.mid(1); - if ((name[0] == '[') && (name[name.length()-1] == ']')) - name = name.mid(1, name.length()-2); - printQ(optionFormatString.arg(QString(name), -25) - .arg(description)); - } - else - { - if (!hasOptions) - { - printQ(optionsHeader); - hasOptions = true; - } - - if ((name.length() == 1) || (name[1] == ' ')) - name = "-"+name; - else - name = "--"+name; - if (!option->description) - { - opt = name + ", "; - } - else - { - opt = opt + name; - if (!option->def) - { - printQ(optionFormatString.arg(QString(opt), -25) - .arg(description)); - } - else - { - printQ(optionFormatStringDef.arg(QString(opt), -25) - .arg(description).arg(option->def)); - } - opt = ""; - } - } - for(TQStringList::Iterator it = dl.begin(); - it != dl.end(); - ++it) - { - printQ(optionFormatString.arg("", -25).arg(*it)); - } - - option++; - } - args = argsList->next(); - if (!args || args->name || !args->id) break; - } - if (!showAll) break; - } - - exit(254); -} - -// -// Member functions -// - -/** - * Constructor. - * - * The given arguments are assumed to be constants. - */ -TDECmdLineArgs::TDECmdLineArgs( const TDECmdLineOptions *_options, - const char *_name, const char *_id) - : options(_options), name(_name), id(_id) -{ - parsedOptionList = 0; - parsedArgList = 0; - isQt = (::qstrcmp(id, "qt") == 0); -} - -/** - * Destructor. - */ -TDECmdLineArgs::~TDECmdLineArgs() -{ - delete parsedOptionList; - delete parsedArgList; - if (argsList) - argsList->removeRef(this); -} - -void -TDECmdLineArgs::clear() -{ - delete parsedArgList; - parsedArgList = 0; - delete parsedOptionList; - parsedOptionList = 0; -} - -void -TDECmdLineArgs::reset() -{ - if ( argsList ) { - argsList->setAutoDelete( true ); - argsList->clear(); - delete argsList; - argsList = 0; - } - parsed = false; -} - -void -TDECmdLineArgs::save( TQDataStream &ds) const -{ - uint count = 0; - if (parsedOptionList) - parsedOptionList->save( ds ); - else - ds << count; - - if (parsedArgList) - parsedArgList->save( ds ); - else - ds << count; -} - -void -TDECmdLineArgs::load( TQDataStream &ds) -{ - if (!parsedOptionList) parsedOptionList = new TDECmdLineParsedOptions; - if (!parsedArgList) parsedArgList = new TDECmdLineParsedArgs; - - parsedOptionList->load( ds ); - parsedArgList->load( ds ); - - if (parsedOptionList->count() == 0) - { - delete parsedOptionList; - parsedOptionList = 0; - } - if (parsedArgList->count() == 0) - { - delete parsedArgList; - parsedArgList = 0; - } -} - -void -TDECmdLineArgs::setOption(const TQCString &opt, bool enabled) -{ - if (isQt) - { - // Qt does it own parsing. - TQCString arg = "-"; - if( !enabled ) - arg += "no"; - arg += opt; - addArgument(arg); - } - if (!parsedOptionList) { - parsedOptionList = new TDECmdLineParsedOptions; - parsedOptionList->setAutoDelete(true); - } - - if (enabled) - parsedOptionList->replace( opt, new TQCString("t") ); - else - parsedOptionList->replace( opt, new TQCString("f") ); -} - -void -TDECmdLineArgs::setOption(const TQCString &opt, const char *value) -{ - if (isQt) - { - // Qt does it's own parsing. - TQCString arg = "-"; - arg += opt; - addArgument(arg); - addArgument(value); - -#ifdef Q_WS_X11 - // Hack coming up! - if (arg == "-display") - { - setenv(DISPLAY, value, true); - } -#endif - } - if (!parsedOptionList) { - parsedOptionList = new TDECmdLineParsedOptions; - parsedOptionList->setAutoDelete(true); - } - - parsedOptionList->insert( opt, new TQCString(value) ); -} - -TQCString -TDECmdLineArgs::getOption(const char *_opt) const -{ - TQCString *value = 0; - if (parsedOptionList) - { - value = parsedOptionList->find(_opt); - } - - if (value) - return (*value); - - // Look up the default. - const char *opt_name; - const char *def; - bool dummy = true; - TQCString opt = _opt; - int result = ::findOption( options, opt, opt_name, def, dummy) & ~4; - - if (result != 3) - { - fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); - fprintf(stderr, "Application requests for getOption(\"%s\") but the \"%s\" option\n", - _opt, _opt); - fprintf(stderr, "has never been specified via addCmdLineOptions( ... )\n\n"); - - assert( 0 ); - exit(255); - } - return TQCString(def); -} - -QCStringList -TDECmdLineArgs::getOptionList(const char *_opt) const -{ - QCStringList result; - if (!parsedOptionList) - return result; - - while(true) - { - TQCString *value = parsedOptionList->take(_opt); - if (!value) - break; - result.prepend(*value); - delete value; - } - - // Reinsert items in dictionary - // WABA: This is rather silly, but I don't want to add restrictions - // to the API like "you can only call this function once". - // I can't access all items without taking them out of the list. - // So taking them out and then putting them back is the only way. - for(QCStringList::ConstIterator it=result.begin(); - it != result.end(); - ++it) - { - parsedOptionList->insert(_opt, new TQCString(*it)); - } - return result; -} - -bool -TDECmdLineArgs::isSet(const char *_opt) const -{ - // Look up the default. - const char *opt_name; - const char *def; - bool dummy = true; - TQCString opt = _opt; - int result = ::findOption( options, opt, opt_name, def, dummy) & ~4; - - if (result == 0) - { - fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); - fprintf(stderr, "Application requests for isSet(\"%s\") but the \"%s\" option\n", - _opt, _opt); - fprintf(stderr, "has never been specified via addCmdLineOptions( ... )\n\n"); - - assert( 0 ); - exit(255); - } - - TQCString *value = 0; - if (parsedOptionList) - { - value = parsedOptionList->find(opt); - } - - if (value) - { - if (result == 3) - return true; - else - return ((*value)[0] == 't'); - } - - if (result == 3) - return false; // String option has 'false' as default. - - // We return 'true' as default if the option was listed as '-nofork' - // We return 'false' as default if the option was listed as '-fork' - return (result == 2); -} - -int -TDECmdLineArgs::count() const -{ - if (!parsedArgList) - return 0; - return parsedArgList->count(); -} - -const char * -TDECmdLineArgs::arg(int n) const -{ - if (!parsedArgList || (n >= (int) parsedArgList->count())) - { - fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs): Argument out of bounds\n"); - fprintf(stderr, "Application requests for arg(%d) without checking count() first.\n", - n); - - assert( 0 ); - exit(255); - } - - return parsedArgList->at(n); -} - -KURL -TDECmdLineArgs::url(int n) const -{ - return makeURL( arg(n) ); -} - -KURL TDECmdLineArgs::makeURL(const char *_urlArg) -{ - const TQString urlArg = TQFile::decodeName(_urlArg); - TQFileInfo fileInfo(urlArg); - if (!fileInfo.isRelative()) { // i.e. starts with '/', on unix - KURL result; - result.setPath(urlArg); - return result; // Absolute path. - } - - if ( KURL::isRelativeURL(urlArg) || fileInfo.exists() ) { - KURL result; - result.setPath( cwd()+'/'+urlArg ); - result.cleanPath(); - return result; // Relative path - } - - return KURL(urlArg); // Argument is a URL -} - -void -TDECmdLineArgs::addArgument(const char *argument) -{ - if (!parsedArgList) - parsedArgList = new TDECmdLineParsedArgs; - - parsedArgList->append(argument); -} - -static const TDECmdLineOptions kde_tempfile_option[] = -{ - { "tempfile", I18N_NOOP("The files/URLs opened by the application will be deleted after use"), 0}, - TDECmdLineLastOption -}; - -void -TDECmdLineArgs::addTempFileOption() -{ - TDECmdLineArgs::addCmdLineOptions( kde_tempfile_option, "TDE-tempfile", "tde-tempfile" ); -} - -bool TDECmdLineArgs::isTempFileSet() -{ - TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs( "tde-tempfile" ); - if ( args ) - return args->isSet( "tempfile" ); - return false; -} diff --git a/tdecore/kcmdlineargs.h b/tdecore/kcmdlineargs.h deleted file mode 100644 index 9b7dc0f4f..000000000 --- a/tdecore/kcmdlineargs.h +++ /dev/null @@ -1,690 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 1999 Waldo Bastian <bastian@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 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., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _KCMDLINEARGS_H_ -#define _KCMDLINEARGS_H_ - -#include "tdelibs_export.h" -#include <kurl.h> - -#include <tqptrlist.h> -#include <tqstring.h> -#include <tqvaluelist.h> - -typedef TQValueList<TQCString> QCStringList; - -/** - * @short Structure that holds command line options. - * - * This class is intended to be used with the TDECmdLineArgs class, which - * provides convenient and powerful command line argument parsing and - * handling functionality. - * - * @see TDECmdLineArgs for additional usage information - */ -struct TDECORE_EXPORT TDECmdLineOptions -{ - /** - * The name of the argument as it should be called on the command line and - * appear in <i>myapp --help</i>. - * - * Note that if this option starts with "no" that you will need to test for - * the name without the "no" and the result will be the inverse of what is - * specified. i.e. if "nofoo" is the name of the option and - * <i>myapp --nofoo</i> is called: - * - * \code - * TDECmdLineArgs::parsedArgs()->isSet("foo"); // false - * \endcode - */ - const char *name; - /** - * The text description of the option as should appear in - * <i>myapp --help</i>. This value should be wrapped with I18N_NOOP(). - */ - const char *description; - /** - * The default value for the option, if it is not specified on the - * command line. - */ - const char *def; // Default -}; - -#define TDECmdLineLastOption { 0, 0, 0 } - -class TDECmdLineArgsList; -class TDEApplication; -class KUniqueApplication; -class TDECmdLineParsedOptions; -class TDECmdLineParsedArgs; -class TDEAboutData; -class TDECmdLineArgsPrivate; - -/** - * @short A class for command-line argument handling. - * - * TDECmdLineArgs provides simple access to the command-line arguments - * for an application. It takes into account Qt-specific options, - * KDE-specific options and application specific options. - * - * This class is used in %main() via the static method - * init(). - * - * A typical %KDE application using %TDECmdLineArgs should look like this: - * - * \code - * int main(int argc, char *argv[]) - * { - * // Initialize command line args - * TDECmdLineArgs::init(argc, argv, appName, programName, description, version); - * - * // Tell which options are supported - * TDECmdLineArgs::addCmdLineOptions( options ); - * - * // Add options from other components - * KUniqueApplication::addCmdLineOptions(); - * - * .... - * - * // Create application object without passing 'argc' and 'argv' again. - * KUniqueApplication app; - * - * .... - * - * // Handle our own options/arguments - * // A TDEApplication will usually do this in main but this is not - * // necessary. - * // A KUniqueApplication might want to handle it in newInstance(). - * - * TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - * - * // A binary option (on / off) - * if (args->isSet("some-option")) - * .... - * - * // An option which takes an additional argument - * TQCString anotherOptionArg = args->getOption("another-option"); - * - * // Arguments (e.g. files to open) - * for(int i = 0; i < args->count(); i++) // Counting start at 0! - * { - * // don't forget to convert to Unicode! - * openFile( TQFile::decodeName( args->arg(i))); - * // Or more convenient: - * // openURL( args->url(i)); - * - * } - * - * args->clear(); // Free up some memory. - * .... - * } - * \endcode - * - * The options that an application supports are configured using the - * TDECmdLineOptions class. An example is shown below: - * - * \code - * static const TDECmdLineOptions options[] = - * { - * { "a", I18N_NOOP("A short binary option"), 0 }, - * { "b \<file>", I18N_NOOP("A short option which takes an argument"), 0 }, - * { "c \<speed>", I18N_NOOP("As above but with a default value"), "9600" }, - * { "option1", I18N_NOOP("A long binary option, off by default"), 0 }, - * { "nooption2", I18N_NOOP("A long binary option, on by default"), 0 }, - * { ":", I18N_NOOP("Extra options:"), 0 }, - * { "option3 \<file>", I18N_NOOP("A long option which takes an argument"), 0 }, - * { "option4 \<speed>", I18N_NOOP("A long option which takes an argument, defaulting to 9600"), "9600" }, - * { "d", 0, 0 }, - * { "option5", I18N_NOOP("A long option which has a short option as alias"), 0 }, - * { "e", 0, 0 }, - * { "nooption6", I18N_NOOP("Another long option with an alias"), 0 }, - * { "f", 0, 0 }, - * { "option7 \<speed>", I18N_NOOP("'--option7 speed' is the same as '-f speed'"), 0 }, - * { "!option8 \<cmd>", I18N_NOOP("All options following this one will be treated as arguments"), 0 }, - * { "+file", I18N_NOOP("A required argument 'file'"), 0 }, - * { "+[arg1]", I18N_NOOP("An optional argument 'arg1'"), 0 }, - * { "!+command", I18N_NOOP("A required argument 'command', that can contain multiple words, even starting with '-'"), 0 }, - * { "", I18N_NOOP("Additional help text not associated with any particular option") 0 }, - * TDECmdLineLastOption // End of options. - * }; - * \endcode - * - * The I18N_NOOP macro is used to indicate that these strings should be - * marked for translation. The actual translation is done by TDECmdLineArgs. - * You can't use i18n() here because we are setting up a static data - * structure and can't do translations at compile time. - * - * Note that a program should define the options before any arguments. - * - * When a long option has a short option as an alias, a program should - * only test for the long option. - * - * With the above options a command line could look like: - * \code - * myapp -a -c 4800 --display localhost:0.0 --nooption5 -d /tmp/file - * \endcode - * - * Long binary options can be in the form 'option' and 'nooption'. - * A command line may contain the same binary option multiple times, - * the last option determines the outcome: - * \code - * myapp --nooption4 --option4 --nooption4 - * \endcode - * is the same as: - * \code - * myapp --nooption4 - * \endcode - * - * If an option value is provided multiple times, normally only the last - * value is used: - * \code - * myapp -c 1200 -c 2400 -c 4800 - * \endcode - * is usually the same as: - * \code - * myapp -c 4800 - * \endcode - * - * However, an application can choose to use all values specified as well. - * As an example of this, consider that you may wish to specify a - * number of directories to use: - * \code - * myapp -I /usr/include -I /opt/kde/include -I /usr/X11/include - * \endcode - * When an application does this it should mention this in the description - * of the option. To access these options, use getOptionList() - * - * Tips for end-users: - * - * @li Single char options like "-a -b -c" may be combined into "-abc" - * @li The option "--foo bar" may also be written "--foo=bar" - * @li The option "-P lp1" may also be written "-P=lp1" or "-Plp1" - * @li The option "--foo bar" may also be written "-foo bar" - * - * @author Waldo Bastian - * @version 0.0.4 - */ -class TDECORE_EXPORT TDECmdLineArgs -{ - friend class TDEApplication; - friend class KUniqueApplication; - friend class TQPtrList<TDECmdLineArgs>; -public: - // Static functions: - - /** - * Initialize class. - * - * This function should be called as the very first thing in - * your application. - * @param _argc As passed to @p main(...). - * @param _argv As passed to @p main(...). - * @param _appname The untranslated name of your application. This should - * match with @p argv[0]. - * @param programName A program name string to be used for display - * purposes. This string should be marked for - * translation. Example: I18N_NOOP("KEdit") - * @param _description A short description of what your application is about. - * @param _version A version. - * @param noKApp Set this true to not add commandline options for - * TQApplication / TDEApplication - * - * @since 3.2 - */ - static void init(int _argc, char **_argv, const char *_appname, - const char* programName, const char *_description, - const char *_version, bool noKApp = false); - /** - * @deprecated - * You should convert any calls to this method to use the one - * above, by adding in the program name to be used for display - * purposes. Do not forget to mark it for translation using I18N_NOOP. - */ - static void init(int _argc, char **_argv, - const char *_appname, const char *_description, - const char *_version, bool noKApp = false) KDE_DEPRECATED; - - /** - * Initialize class. - * - * This function should be called as the very first thing in - * your application. It uses TDEAboutData to replace some of the - * arguments that would otherwise be required. - * - * @param _argc As passed to @p main(...). - * @param _argv As passed to @p main(...). - * @param about A TDEAboutData object describing your program. - * @param noKApp Set this true to not add commandline options for - * TQApplication / TDEApplication - */ - static void init(int _argc, char **_argv, - const TDEAboutData *about, bool noKApp = false); - - /** - * Initialize Class - * - * This function should be called as the very first thing in your - * application. This method will rarely be used, since it doesn't - * provide any argument parsing. It does provide access to the - * TDEAboutData information. - * This method is exactly the same as calling - * init(0,0, const TDEAboutData *about, true). - * - * @param about the about data. - * \see TDEAboutData - */ - static void init(const TDEAboutData *about); - - /** - * Add options to your application. - * - * You must make sure that all possible options have been added before - * any class uses the command line arguments. - * - * The list of options should look like this: - * - * \code - * static TDECmdLineOptions options[] = - * { - * { "option1 \<argument>", I18N_NOOP("Description 1"), "my_extra_arg" }, - * { "o", 0, 0 }, - * { "option2", I18N_NOOP("Description 2"), 0 }, - * { "nooption3", I18N_NOOP("Description 3"), 0 }, - * TDECmdLineLastOption - * } - * \endcode - * - * @li "option1" is an option that requires an additional argument, - * but if one is not provided, it uses "my_extra_arg". - * @li "option2" is an option that can be turned on. The default is off. - * @li "option3" is an option that can be turned off. The default is on. - * @li "o" does not have a description. It is an alias for the option - * that follows. In this case "option2". - * @li "+file" specifies an argument. The '+' is removed. If your program - * doesn't specify that it can use arguments your program will abort - * when an argument is passed to it. Note that the reverse is not - * true. If required, you must check yourself the number of arguments - * specified by the user: - * \code - * TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - * if (args->count() == 0) TDECmdLineArgs::usage(i18n("No file specified!")); - * \endcode - * - * In BNF: - * \code - * cmd = myapp [options] file - * options = (option)* - * option = --option1 \<argument> | - * (-o | --option2 | --nooption2) | - * ( --option3 | --nooption3 ) - * \endcode - * - * Instead of "--option3" one may also use "-option3" - * - * Usage examples: - * - * @li "myapp --option1 test" - * @li "myapp" (same as "myapp --option1 my_extra_arg") - * @li "myapp --option2" - * @li "myapp --nooption2" (same as "myapp", since it is off by default) - * @li "myapp -o" (same as "myapp --option2") - * @li "myapp --nooption3" - * @li "myapp --option3 (same as "myapp", since it is on by default) - * @li "myapp --option2 --nooption2" (same as "myapp", because it - * option2 is off by default, and the last usage applies) - * @li "myapp /tmp/file" - * - * @param options A list of options that your code supplies. - * @param name the name of the option, can be 0. - * @param id A name with which these options can be identified, can be 0. - * @param afterId The options are inserted after this set of options, can be 0. - */ - static void addCmdLineOptions( const TDECmdLineOptions *options, - const char *name=0, const char *id = 0, - const char *afterId=0); - - /** - * Access parsed arguments. - * - * This function returns all command line arguments that your code - * handles. If unknown command-line arguments are encountered the program - * is aborted and usage information is shown. - * - * @param id The name of the options you are interested in, can be 0. - */ - static TDECmdLineArgs *parsedArgs(const char *id=0); - - /** - * Get the CWD (Current Working Directory) associated with the - * current command line arguments. - * - * Typically this is needed in KUniqueApplication::newInstance() - * since the CWD of the process may be different from the CWD - * where the user started a second instance. - * @return the current working directory - **/ - static TQString cwd(); - - /** - * Get the appname according to argv[0]. - * @return the name of the application - **/ - static const char *appName(); - - /** - * Print the usage help to stdout and exit. - * - * @param id if 0, print all options. If id is set, only print the - * option specified by id. The id is the value set by - * addCmdLineOptions(). - **/ - static void usage(const char *id = 0); - - /** - * Print an error to stderr and the usage help to stdout and exit. - * @param error the error to print - **/ - static void usage(const TQString &error); - - /** - * Enable i18n to be able to print a translated error message. - * - * N.B.: This function leaks memory, therefore you are expected to exit - * afterwards (e.g., by calling usage()). - **/ - static void enable_i18n(); - - // Member functions: - - - /** - * Read out a string option. - * - * The option must have a corresponding TDECmdLineOptions entry - * of the form: - * \code - * { "option \<argument>", I18N_NOOP("Description"), "default" } - * \endcode - * You cannot test for the presence of an alias - you must always - * test for the full option. - * - * @param option The name of the option without '-'. - * - * @return The value of the option. If the option was not - * present on the command line the default is returned. - * If the option was present more than the value of the - * last occurrence is used. - */ - TQCString getOption(const char *option) const; - - /** - * Read out all occurrences of a string option. - * - * The option must have a corresponding TDECmdLineOptions entry - * of the form: - * \code - * { "option \<argument>", I18N_NOOP("Description"), "default" } - * \endcode - * You cannot test for the presence of an alias - you must always - * test for the full option. - * - * @param option The name of the option, without '-' or '-no'. - * - * @return A list of all option values. If no option was present - * on the command line, an empty list is returned. - */ - QCStringList getOptionList(const char *option) const; - - /** - * Read out a boolean option or check for the presence of string option. - * - * @param option The name of the option without '-' or '-no'. - * - * @return The value of the option. It will be true if the option - * was specifically turned on in the command line, or if the option - * is turned on by default (in the TDECmdLineOptions list) and was - * not specifically turned off in the command line. Equivalently, - * it will be false if the option was specifically turned off in - * the command line, or if the option is turned off by default (in - * the TDECmdLineOptions list) and was not specifically turned on in - * the command line. - */ - bool isSet(const char *option) const; - - /** - * Read the number of arguments that aren't options (but, - * for example, filenames). - * - * @return The number of arguments that aren't options - */ - int count() const; - - /** - * Read out an argument. - * - * @param n The argument to read. 0 is the first argument. - * count()-1 is the last argument. - * - * @return A @p const @p char @p * pointer to the n'th argument. - */ - const char *arg(int n) const; - - /** - * Read out an argument representing a URL. - * - * The argument can be - * @li an absolute filename - * @li a relative filename - * @li a URL - * - * @param n The argument to read. 0 is the first argument. - * count()-1 is the last argument. - * - * @return a URL representing the n'th argument. - */ - KURL url(int n) const; - - /** - * Used by url(). - * Made public for apps that don't use TDECmdLineArgs - * @param urlArg the argument - * @return the url. - */ - static KURL makeURL( const char * urlArg ); - - /** - * Made public for apps that don't use TDECmdLineArgs - * To be done before makeURL, to set the current working - * directory in case makeURL needs it. - * @param cwd the new working directory - */ - static void setCwd( char * cwd ) { mCwd = cwd; } - - /** - * Clear all options and arguments. - */ - void clear(); - - /** - * Reset all option definitions, i.e. cancel all addCmdLineOptions calls. - * Note that TDEApplication's options are removed too, you might want to - * call TDEApplication::addCmdLineOptions if you want them back. - * - * You usually don't want to call this method. - */ - static void reset(); - - /** - * Load arguments from a stream. - */ - static void loadAppArgs( TQDataStream &); - - /** - * Add standard option --tempfile - * @since 3.4 - */ - static void addTempFileOption(); - - // this avoids having to know the "id" used by addTempFileOption - // but this approach doesn't scale well, we can't have 50 standard options here... - /** - * @return true if --tempfile was set - * @since 3.4 - */ - static bool isTempFileSet(); - -protected: - /** - * @internal - * Constructor. - */ - TDECmdLineArgs( const TDECmdLineOptions *_options, const char *_name, - const char *_id); - - /** - * @internal use only. - * - * Use clear() if you want to free up some memory. - * - * Destructor. - */ - ~TDECmdLineArgs(); - -private: - /** - * @internal - * - * Checks what to do with a single option - */ - static void findOption(const char *_opt, TQCString opt, int &i, bool enabled, bool &moreOptions); - - /** - * @internal - * - * Parse all arguments, verify correct syntax and put all arguments - * where they belong. - */ - static void parseAllArgs(); - - /** - * @internal for TDEApplication only: - * - * Return argc - */ - static int *tqt_argc(); - - /** - * @internal for TDEApplication only: - * - * Return argv - */ - - static char ***tqt_argv(); - - /** - * @internal - * - * Remove named options. - * - * @param id The name of the options to be removed. - */ - static void removeArgs(const char *id); - - /** - * @internal for KUniqueApplication only: - * - * Save all but the Qt and KDE arguments to a stream. - */ - static void saveAppArgs( TQDataStream &); - - /** - * @internal - * - * Set a boolean option - */ - void setOption(const TQCString &option, bool enabled); - - /** - * @internal - * - * Set a string option - */ - void setOption(const TQCString &option, const char *value); - - /** - * @internal - * - * Add an argument - */ - void addArgument(const char *argument); - - /** - * @internal - * - * Save to a stream. - */ - void save( TQDataStream &) const; - - /** - * @internal - * - * Restore from a stream. - */ - void load( TQDataStream &); - - /** - * @internal for TDEApplication only - * - * Initialize class. - * - * This function should be called as the very first thing in - * your application. - * @param argc As passed to @p main(...). - * @param argv As passed to @p main(...). - * @param appname The untranslated name of your application. This should - * match with @p argv[0]. - * - * This function makes TDECmdLineArgs ignore all unknown options as well as - * all arguments. - */ - static void initIgnore(int _argc, char **_argv, const char *_appname); - - static void printQ(const TQString &msg); - - const TDECmdLineOptions *options; - const char *name; - const char *id; - TDECmdLineParsedOptions *parsedOptionList; - TDECmdLineParsedArgs *parsedArgList; - bool isQt; - - static TDECmdLineArgsList *argsList; // All options. - static const TDEAboutData *about; - - static int argc; // The original argc - static char **argv; // The original argv - static bool parsed; // Whether we have parsed the arguments since calling init - static bool ignoreUnknown; // Ignore unknown options and arguments - static char *mCwd; // Current working directory. Important for KUnqiueApp! - static bool parseArgs; - - TDECmdLineArgsPrivate *d; -}; - -#endif - diff --git a/tdecore/kcompletion.cpp b/tdecore/kcompletion.cpp index 730eadbf9..a5349b3ee 100644 --- a/tdecore/kcompletion.cpp +++ b/tdecore/kcompletion.cpp @@ -18,7 +18,7 @@ */ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> #include <knotifyclient.h> diff --git a/tdecore/kcrash.cpp b/tdecore/kcrash.cpp index 05f502311..2eed7c282 100644 --- a/tdecore/kcrash.cpp +++ b/tdecore/kcrash.cpp @@ -46,9 +46,9 @@ #include <tqwindowdefs.h> #include <kglobal.h> #include <kinstance.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <../kinit/tdelauncher_cmds.h> diff --git a/tdecore/kdebug.cpp b/tdecore/kdebug.cpp index 27dcf1418..062864fca 100644 --- a/tdecore/kdebug.cpp +++ b/tdecore/kdebug.cpp @@ -27,7 +27,7 @@ #include "kdebugdcopiface.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "kglobal.h" #include "kinstance.h" #include "kstandarddirs.h" diff --git a/tdecore/kdesktopfile.cpp b/tdecore/kdesktopfile.cpp index 41d7a3d41..a5a57cdd8 100644 --- a/tdecore/kdesktopfile.cpp +++ b/tdecore/kdesktopfile.cpp @@ -31,7 +31,7 @@ #include <kdebug.h> #include "kurl.h" #include "tdeconfigbackend.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "kstandarddirs.h" #include "kmountpoint.h" #include "kcatalogue.h" diff --git a/tdecore/kdetcompmgr.cpp b/tdecore/kdetcompmgr.cpp index 1c7a6f1c3..d78d76b34 100644 --- a/tdecore/kdetcompmgr.cpp +++ b/tdecore/kdetcompmgr.cpp @@ -21,9 +21,9 @@ #include <stdio.h> #include <stdlib.h> -#include <kapplication.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include <klocale.h> #include <kdebug.h> #include <tdeconfig.h> diff --git a/tdecore/kglobal.cpp b/tdecore/kglobal.cpp index 107d3317e..965a537a3 100644 --- a/tdecore/kglobal.cpp +++ b/tdecore/kglobal.cpp @@ -27,8 +27,8 @@ #include <tqptrlist.h> #include "kglobal.h" -#include <kapplication.h> -#include <kaboutdata.h> +#include <tdeapplication.h> +#include <tdeaboutdata.h> #include <kdebug.h> #include <tdeconfig.h> #include <klocale.h> diff --git a/tdecore/kglobalaccel_win.cpp b/tdecore/kglobalaccel_win.cpp index 0393bdd8d..09c216b99 100644 --- a/tdecore/kglobalaccel_win.cpp +++ b/tdecore/kglobalaccel_win.cpp @@ -31,7 +31,7 @@ #include <tqwidget.h> #include <tqmetaobject.h> #include <private/qucomextra_p.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kkeynative.h> diff --git a/tdecore/kglobalaccel_x11.cpp b/tdecore/kglobalaccel_x11.cpp index 64af90572..2a67c73b5 100644 --- a/tdecore/kglobalaccel_x11.cpp +++ b/tdecore/kglobalaccel_x11.cpp @@ -31,7 +31,7 @@ #include <tqwidget.h> #include <tqmetaobject.h> #include <tqucomextra_p.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kkeynative.h> diff --git a/tdecore/kglobalsettings.cpp b/tdecore/kglobalsettings.cpp index d7006b37a..a103c4652 100644 --- a/tdecore/kglobalsettings.cpp +++ b/tdecore/kglobalsettings.cpp @@ -25,7 +25,7 @@ #include <tdeconfig.h> #include <ksimpleconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kipc.h> diff --git a/tdecore/kiconloader.cpp b/tdecore/kiconloader.cpp index 5938331cd..be44a921f 100644 --- a/tdecore/kiconloader.cpp +++ b/tdecore/kiconloader.cpp @@ -26,7 +26,7 @@ #include <tqmovie.h> #include <tqbitmap.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kipc.h> #include <kdebug.h> #include <kstandarddirs.h> diff --git a/tdecore/kinstance.cpp b/tdecore/kinstance.cpp index 749979750..cf0b35791 100644 --- a/tdecore/kinstance.cpp +++ b/tdecore/kinstance.cpp @@ -26,7 +26,7 @@ #include "kiconloader.h" #include "tdehardwaredevices.h" #include "tdenetworkconnections.h" -#include "kaboutdata.h" +#include "tdeaboutdata.h" #include "kstandarddirs.h" #include "kdebug.h" #include "kglobal.h" diff --git a/tdecore/klibloader.cpp b/tdecore/klibloader.cpp index b7cad0fbe..f7e63c215 100644 --- a/tdecore/klibloader.cpp +++ b/tdecore/klibloader.cpp @@ -25,7 +25,7 @@ #include <tqtimer.h> #include <tqobjectdict.h> -#include "kapplication.h" +#include "tdeapplication.h" #include "klibloader.h" #include "kstandarddirs.h" #include "kdebug.h" diff --git a/tdecore/klockfile.cpp b/tdecore/klockfile.cpp index 8b4a991ce..ee09a06c8 100644 --- a/tdecore/klockfile.cpp +++ b/tdecore/klockfile.cpp @@ -37,8 +37,8 @@ #include <tqtextstream.h> #include <kde_file.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kglobal.h> #include <ktempfile.h> diff --git a/tdecore/kmanagerselection.cpp b/tdecore/kmanagerselection.cpp index 15e273d6d..2e019f73e 100644 --- a/tdecore/kmanagerselection.cpp +++ b/tdecore/kmanagerselection.cpp @@ -47,7 +47,7 @@ DEALINGS IN THE SOFTWARE. #include <kdebug.h> #include <tqwidget.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kxerrorhandler.h> #include <X11/Xatom.h> diff --git a/tdecore/knotifyclient.cpp b/tdecore/knotifyclient.cpp index 309be40f0..b6f70bd23 100644 --- a/tdecore/knotifyclient.cpp +++ b/tdecore/knotifyclient.cpp @@ -23,9 +23,9 @@ #include <tqdatastream.h> #include <tqptrstack.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <dcopclient.h> #include <kdebug.h> diff --git a/tdecore/kprotocolinfo_tdecore.cpp b/tdecore/kprotocolinfo_tdecore.cpp index 088ea0363..8cc5091c5 100644 --- a/tdecore/kprotocolinfo_tdecore.cpp +++ b/tdecore/kprotocolinfo_tdecore.cpp @@ -27,7 +27,7 @@ #include <kstandarddirs.h> #include <kglobal.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <ksimpleconfig.h> #include <tdeconfig.h> diff --git a/tdecore/kprotocolinfofactory.cpp b/tdecore/kprotocolinfofactory.cpp index c651024ef..4daab08dd 100644 --- a/tdecore/kprotocolinfofactory.cpp +++ b/tdecore/kprotocolinfofactory.cpp @@ -19,7 +19,7 @@ #include <kstandarddirs.h> #include <kglobal.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdesycoca.h> #include <tdesycocadict.h> diff --git a/tdecore/krandomsequence.cpp b/tdecore/krandomsequence.cpp index 9529ccabb..8896db70b 100644 --- a/tdecore/krandomsequence.cpp +++ b/tdecore/krandomsequence.cpp @@ -21,7 +21,7 @@ #include <tqptrlist.h> #include "krandomsequence.h" -#include "kapplication.h" +#include "tdeapplication.h" const int KRandomSequence::m_nShuffleTableSize = 32; diff --git a/tdecore/krootprop.cpp b/tdecore/krootprop.cpp index cb0200c99..bb15462dd 100644 --- a/tdecore/krootprop.cpp +++ b/tdecore/krootprop.cpp @@ -26,7 +26,7 @@ #include "kglobal.h" #include "klocale.h" #include "kcharsets.h" -#include "kapplication.h" +#include "tdeapplication.h" #include <tqtextstream.h> #include <X11/Xlib.h> diff --git a/tdecore/ksavefile.cpp b/tdecore/ksavefile.cpp index fdf47daf9..4ad96c0f2 100644 --- a/tdecore/ksavefile.cpp +++ b/tdecore/ksavefile.cpp @@ -36,7 +36,7 @@ #include <tqdir.h> #include <kde_file.h> -#include "kapplication.h" +#include "tdeapplication.h" #include "ksavefile.h" #include "kstandarddirs.h" diff --git a/tdecore/ksimpledirwatch.cpp b/tdecore/ksimpledirwatch.cpp index 8454c7a74..f39a94221 100644 --- a/tdecore/ksimpledirwatch.cpp +++ b/tdecore/ksimpledirwatch.cpp @@ -43,7 +43,7 @@ #include <tqstringlist.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeconfig.h> #include <kglobal.h> diff --git a/tdecore/ksocks.cpp b/tdecore/ksocks.cpp index cc0cde8ca..95e36dc15 100644 --- a/tdecore/ksocks.cpp +++ b/tdecore/ksocks.cpp @@ -30,7 +30,7 @@ #include <kdebug.h> #include "klibloader.h" #include <tdeconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <sys/types.h> #include <sys/socket.h> diff --git a/tdecore/kstartupinfo.cpp b/tdecore/kstartupinfo.cpp index 0eb0e91de..a472de5fd 100644 --- a/tdecore/kstartupinfo.cpp +++ b/tdecore/kstartupinfo.cpp @@ -55,7 +55,7 @@ DEALINGS IN THE SOFTWARE. #include <netwm.h> #endif #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <signal.h> #ifdef Q_WS_X11 #include <twinmodule.h> diff --git a/tdecore/ktempdir.cpp b/tdecore/ktempdir.cpp index 69554fd86..53cc83f99 100644 --- a/tdecore/ktempdir.cpp +++ b/tdecore/ktempdir.cpp @@ -48,7 +48,7 @@ #include <tqdir.h> #include "kglobal.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "kinstance.h" #include "ktempdir.h" #include "kstandarddirs.h" diff --git a/tdecore/ktempfile.cpp b/tdecore/ktempfile.cpp index 35d66f81c..973e14070 100644 --- a/tdecore/ktempfile.cpp +++ b/tdecore/ktempfile.cpp @@ -49,7 +49,7 @@ #include <tqtextstream.h> #include "kglobal.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "kinstance.h" #include "ktempfile.h" #include "kstandarddirs.h" diff --git a/tdecore/kuniqueapplication.cpp b/tdecore/kuniqueapplication.cpp index fb8cda9fd..964c7c8c7 100644 --- a/tdecore/kuniqueapplication.cpp +++ b/tdecore/kuniqueapplication.cpp @@ -34,9 +34,9 @@ #include <tqtimer.h> #include <dcopclient.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kstandarddirs.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #if defined Q_WS_X11 #include <twin.h> diff --git a/tdecore/kuniqueapplication.h b/tdecore/kuniqueapplication.h index ede89ef19..3b7bd8d6e 100644 --- a/tdecore/kuniqueapplication.h +++ b/tdecore/kuniqueapplication.h @@ -21,7 +21,7 @@ #ifndef _KUNIQUEAPP_H #define _KUNIQUEAPP_H -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopobject.h> class KUniqueApplicationPrivate; @@ -36,7 +36,7 @@ class KUniqueApplicationPrivate; * the information to the first instance and then quit. * * The .desktop file for the application should state X-DCOP-ServiceType=Unique, - * see kapplication.h + * see tdeapplication.h * * If your application is used to open files, it should also support the --tempfile * option (see TDECmdLineArgs::addTempFileOption()), to delete tempfiles after use. diff --git a/tdecore/kxmessages.cpp b/tdecore/kxmessages.cpp index 52781188f..116c74d1c 100644 --- a/tdecore/kxmessages.cpp +++ b/tdecore/kxmessages.cpp @@ -26,7 +26,7 @@ DEALINGS IN THE SOFTWARE. #include "kxmessages.h" -#include <kapplication.h> +#include <tdeapplication.h> #ifdef Q_WS_X11 // FIXME(E): Figure out what parts we can/should emulate in QT/E diff --git a/tdecore/network/kresolverstandardworkers.cpp b/tdecore/network/kresolverstandardworkers.cpp index dd5e33f23..cde24f752 100644 --- a/tdecore/network/kresolverstandardworkers.cpp +++ b/tdecore/network/kresolverstandardworkers.cpp @@ -46,7 +46,7 @@ #include "kdebug.h" #include "kglobal.h" #include "kstandarddirs.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "kresolver.h" #include "tdesocketaddress.h" diff --git a/tdecore/network/ksockssocketdevice.cpp b/tdecore/network/ksockssocketdevice.cpp index c1649c340..69c674438 100644 --- a/tdecore/network/ksockssocketdevice.cpp +++ b/tdecore/network/ksockssocketdevice.cpp @@ -32,7 +32,7 @@ #define kde_socklen_t ksocklen_t #endif -#include "kapplication.h" +#include "tdeapplication.h" #include "ksocks.h" #include "tdesocketaddress.h" diff --git a/tdecore/tde-config.cpp.cmake b/tdecore/tde-config.cpp.cmake index e235c4f8c..98481cefe 100644 --- a/tdecore/tde-config.cpp.cmake +++ b/tdecore/tde-config.cpp.cmake @@ -1,15 +1,15 @@ // -*- c++ -*- -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <klocale.h> #include <kinstance.h> #include <kstandarddirs.h> #include <kglobal.h> #include <kglobalsettings.h> #include <stdio.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <config.h> -#include <kapplication.h> +#include <tdeapplication.h> static const char *description = I18N_NOOP("A little program to output installation paths"); diff --git a/tdecore/tde-config.cpp.in b/tdecore/tde-config.cpp.in index d44ccd6b5..ac49e5c41 100644 --- a/tdecore/tde-config.cpp.in +++ b/tdecore/tde-config.cpp.in @@ -1,15 +1,15 @@ // -*- c++ -*- -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <klocale.h> #include <kinstance.h> #include <kstandarddirs.h> #include <kglobal.h> #include <kglobalsettings.h> #include <stdio.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <config.h> -#include <kapplication.h> +#include <tdeapplication.h> static const char *description = I18N_NOOP("A little program to output installation paths"); diff --git a/tdecore/tdeaboutdata.cpp b/tdecore/tdeaboutdata.cpp new file mode 100644 index 000000000..bf8538152 --- /dev/null +++ b/tdecore/tdeaboutdata.cpp @@ -0,0 +1,512 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + + +#include <tdeaboutdata.h> +#include <kstandarddirs.h> +#include <tqfile.h> +#include <tqtextstream.h> + +TQString +TDEAboutPerson::name() const +{ + return TQString::fromUtf8(mName); +} + +TQString +TDEAboutPerson::task() const +{ + if (mTask && *mTask) + return i18n(mTask); + else + return TQString::null; +} + +TQString +TDEAboutPerson::emailAddress() const +{ + return TQString::fromUtf8(mEmailAddress); +} + + +TQString +TDEAboutPerson::webAddress() const +{ + return TQString::fromUtf8(mWebAddress); +} + + +TDEAboutTranslator::TDEAboutTranslator(const TQString & name, + const TQString & emailAddress) +{ + mName=name; + mEmail=emailAddress; +} + +TQString TDEAboutTranslator::name() const +{ + return mName; +} + +TQString TDEAboutTranslator::emailAddress() const +{ + return mEmail; +} + +class TDEAboutDataPrivate +{ +public: + TDEAboutDataPrivate() + : translatorName("_: NAME OF TRANSLATORS\nYour names") + , translatorEmail("_: EMAIL OF TRANSLATORS\nYour emails") + , productName(0) + , programLogo(0) + , customAuthorTextEnabled(false) + , mTranslatedProgramName( 0 ) + {} + ~TDEAboutDataPrivate() + { + delete programLogo; + delete[] mTranslatedProgramName; + } + const char *translatorName; + const char *translatorEmail; + const char *productName; + TQImage* programLogo; + TQString customAuthorPlainText, customAuthorRichText; + bool customAuthorTextEnabled; + const char *mTranslatedProgramName; +}; + +const char *TDEAboutData::defaultBugTracker = "http://bugs.trinitydesktop.org"; + +TDEAboutData::TDEAboutData( const char *appName, + const char *programName, + const char *version, + const char *shortDescription, + int licenseType, + const char *copyrightStatement, + const char *text, + const char *homePageAddress, + const char *bugsEmailAddress + ) : + mProgramName( programName ), + mVersion( version ), + mShortDescription( shortDescription ), + mLicenseKey( licenseType ), + mCopyrightStatement( copyrightStatement ), + mOtherText( text ), + mHomepageAddress( homePageAddress ), + mBugEmailAddress( (bugsEmailAddress!=0)?bugsEmailAddress:defaultBugTracker ), + mLicenseText (0) +{ + d = new TDEAboutDataPrivate; + + if( appName ) { + const char *p = strrchr(appName, '/'); + if( p ) + mAppName = p+1; + else + mAppName = appName; + } else + mAppName = 0; +} + +TDEAboutData::~TDEAboutData() +{ + if (mLicenseKey == License_File) + delete [] mLicenseText; + delete d; +} + +void +TDEAboutData::addAuthor( const char *name, const char *task, + const char *emailAddress, const char *webAddress ) +{ + mAuthorList.append(TDEAboutPerson(name,task,emailAddress,webAddress)); +} + +void +TDEAboutData::addCredit( const char *name, const char *task, + const char *emailAddress, const char *webAddress ) +{ + mCreditList.append(TDEAboutPerson(name,task,emailAddress,webAddress)); +} + +void +TDEAboutData::setTranslator( const char *name, const char *emailAddress) +{ + d->translatorName=name; + d->translatorEmail=emailAddress; +} + +void +TDEAboutData::setLicenseText( const char *licenseText ) +{ + mLicenseText = licenseText; + mLicenseKey = License_Custom; +} + +void +TDEAboutData::setLicenseTextFile( const TQString &file ) +{ + mLicenseText = tqstrdup(TQFile::encodeName(file)); + mLicenseKey = License_File; +} + +void +TDEAboutData::setAppName( const char *appName ) +{ + mAppName = appName; +} + +void +TDEAboutData::setProgramName( const char* programName ) +{ + mProgramName = programName; + translateInternalProgramName(); +} + +void +TDEAboutData::setVersion( const char* version ) +{ + mVersion = version; +} + +void +TDEAboutData::setShortDescription( const char *shortDescription ) +{ + mShortDescription = shortDescription; +} + +void +TDEAboutData::setLicense( LicenseKey licenseKey) +{ + mLicenseKey = licenseKey; +} + +void +TDEAboutData::setCopyrightStatement( const char *copyrightStatement ) +{ + mCopyrightStatement = copyrightStatement; +} + +void +TDEAboutData::setOtherText( const char *otherText ) +{ + mOtherText = otherText; +} + +void +TDEAboutData::setHomepage( const char *homepage ) +{ + mHomepageAddress = homepage; +} + +void +TDEAboutData::setBugAddress( const char *bugAddress ) +{ + mBugEmailAddress = bugAddress; +} + +void +TDEAboutData::setProductName( const char *productName ) +{ + d->productName = productName; +} + +const char * +TDEAboutData::appName() const +{ + return mAppName; +} + +const char * +TDEAboutData::productName() const +{ + if (d->productName) + return d->productName; + else + return appName(); +} + +TQString +TDEAboutData::programName() const +{ + if (mProgramName && *mProgramName) + return i18n(mProgramName); + else + return TQString::null; +} + +const char* +TDEAboutData::internalProgramName() const +{ + if (d->mTranslatedProgramName) + return d->mTranslatedProgramName; + else + return mProgramName; +} + +// TDECrash should call as few things as possible and should avoid e.g. malloc() +// because it may deadlock. Since i18n() needs it, when TDELocale is available +// the i18n() call will be done here in advance. +void +TDEAboutData::translateInternalProgramName() const +{ + delete[] d->mTranslatedProgramName; + d->mTranslatedProgramName = 0; + if( TDEGlobal::locale() ) + d->mTranslatedProgramName = tqstrdup( programName().utf8()); +} + +TQImage +TDEAboutData::programLogo() const +{ + return d->programLogo ? (*d->programLogo) : TQImage(); +} + +void +TDEAboutData::setProgramLogo(const TQImage& image) +{ + if (!d->programLogo) + d->programLogo = new TQImage( image ); + else + *d->programLogo = image; +} + +TQString +TDEAboutData::version() const +{ + return TQString::fromLatin1(mVersion); +} + +TQString +TDEAboutData::shortDescription() const +{ + if (mShortDescription && *mShortDescription) + return i18n(mShortDescription); + else + return TQString::null; +} + +TQString +TDEAboutData::homepage() const +{ + return TQString::fromLatin1(mHomepageAddress); +} + +TQString +TDEAboutData::bugAddress() const +{ + return TQString::fromLatin1(mBugEmailAddress); +} + +const TQValueList<TDEAboutPerson> +TDEAboutData::authors() const +{ + return mAuthorList; +} + +const TQValueList<TDEAboutPerson> +TDEAboutData::credits() const +{ + return mCreditList; +} + +const TQValueList<TDEAboutTranslator> +TDEAboutData::translators() const +{ + TQValueList<TDEAboutTranslator> personList; + + if(d->translatorName == 0) + return personList; + + TQStringList nameList; + TQStringList emailList; + + TQString names = i18n(d->translatorName); + if(names != TQString::fromUtf8(d->translatorName)) + { + nameList = TQStringList::split(',',names); + } + + + if(d->translatorEmail) + { + TQString emails = i18n(d->translatorEmail); + + if(emails != TQString::fromUtf8(d->translatorEmail)) + { + emailList = TQStringList::split(',',emails,true); + } + } + + + TQStringList::Iterator nit; + TQStringList::Iterator eit=emailList.begin(); + + for(nit = nameList.begin(); nit != nameList.end(); ++nit) + { + TQString email; + if(eit != emailList.end()) + { + email=*eit; + ++eit; + } + + TQString name=*nit; + + personList.append(TDEAboutTranslator(name.stripWhiteSpace(), email.stripWhiteSpace())); + } + + return personList; +} + +TQString +TDEAboutData::aboutTranslationTeam() +{ + return i18n("replace this with information about your translation team", + "<p>KDE is translated into many languages thanks to the work " + "of the translation teams all over the world.</p>" + "<p>For more information on KDE internationalization " + "visit <a href=\"http://l10n.kde.org\">http://l10n.kde.org</a></p>" + ); +} + +TQString +TDEAboutData::otherText() const +{ + if (mOtherText && *mOtherText) + return i18n(mOtherText); + else + return TQString::null; +} + + +TQString +TDEAboutData::license() const +{ + TQString result; + if (!copyrightStatement().isEmpty()) + result = copyrightStatement() + "\n\n"; + + TQString l; + TQString f; + switch ( mLicenseKey ) + { + case License_File: + f = TQFile::decodeName(mLicenseText); + break; + case License_GPL_V2: + l = "GPL v2"; + f = locate("data", "LICENSES/GPL_V2"); + break; + case License_LGPL_V2: + l = "LGPL v2"; + f = locate("data", "LICENSES/LGPL_V2"); + break; + case License_BSD: + l = "BSD License"; + f = locate("data", "LICENSES/BSD"); + break; + case License_Artistic: + l = "Artistic License"; + f = locate("data", "LICENSES/ARTISTIC"); + break; + case License_QPL_V1_0: + l = "QPL v1.0"; + f = locate("data", "LICENSES/QPL_V1.0"); + break; + case License_Custom: + if (mLicenseText && *mLicenseText) + return( i18n(mLicenseText) ); + // fall through + default: + result += i18n("No licensing terms for this program have been specified.\n" + "Please check the documentation or the source for any\n" + "licensing terms.\n"); + return result; + } + + if (!l.isEmpty()) + result += i18n("This program is distributed under the terms of the %1.").arg( l ); + + if (!f.isEmpty()) + { + TQFile file(f); + if (file.open(IO_ReadOnly)) + { + result += '\n'; + result += '\n'; + TQTextStream str(&file); + result += str.read(); + } + } + + return result; +} + +TQString +TDEAboutData::copyrightStatement() const +{ + if (mCopyrightStatement && *mCopyrightStatement) + return i18n(mCopyrightStatement); + else + return TQString::null; +} + +TQString +TDEAboutData::customAuthorPlainText() const +{ + return d->customAuthorPlainText; +} + +TQString +TDEAboutData::customAuthorRichText() const +{ + return d->customAuthorRichText; +} + +bool +TDEAboutData::customAuthorTextEnabled() const +{ + return d->customAuthorTextEnabled; +} + +void +TDEAboutData::setCustomAuthorText(const TQString &plainText, const TQString &richText) +{ + d->customAuthorPlainText = plainText; + d->customAuthorRichText = richText; + + d->customAuthorTextEnabled = true; +} + +void +TDEAboutData::unsetCustomAuthorText() +{ + d->customAuthorPlainText = TQString::null; + d->customAuthorRichText = TQString::null; + + d->customAuthorTextEnabled = false; +} + diff --git a/tdecore/tdeaboutdata.h b/tdecore/tdeaboutdata.h new file mode 100644 index 000000000..d5addac0a --- /dev/null +++ b/tdecore/tdeaboutdata.h @@ -0,0 +1,630 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include <tqvaluelist.h> +#include <tqstring.h> +#include <tqimage.h> +#include <klocale.h> + +#ifndef _KABOUTDATA_H_ +#define _KABOUTDATA_H_ + +class TDEAboutPersonPrivate; +class TDEAboutDataPrivate; + +/** + * This structure is used to store information about a person or developer. + * It can store the person's name, a task, an email address and a + * link to a home page. This class is intended for use in the + * TDEAboutData class, but it can be used elsewhere as well. + * Normally you should at least define the person's name. + * + * Example Usage within a main(): + * + * \code + * TDEAboutData about("khello", I18N_NOOP("KHello"), "0.1", + * I18N_NOOP("A TDE version of Hello, world!"), + * TDEAboutData::License_LGPL, + * I18N_NOOP("Copyright (c) 2003 Developer")); + * + * about.addAuthor("Joe Developer", I18N_NOOP("developer"), "joe@host.com", 0); + * about.addCredit("Joe User", I18N_NOOP("A lot of bug reports"), + * "joe.user@host.org", 0); + * TDECmdLineArgs::init(argc, argv, &about); + * \endcode + */ +class TDECORE_EXPORT TDEAboutPerson +{ +public: + /** + * Convenience constructor + * + * @param name The name of the person. + * + * @param task The task of this person. This string should be + * marked for translation, e.g. + * I18N_NOOP("Task description....") + * + * @param emailAddress The email address of the person. + * + * @param webAddress Home page of the person. + */ + TDEAboutPerson( const char *name, const char *task, + const char *emailAddress, const char *webAddress ) + { + mName = name; + mTask = task; + mEmailAddress = emailAddress; + mWebAddress = webAddress; + } + /** + * @internal + * Don't use. Required by QValueList + */ + TDEAboutPerson() {} + + /** + * The person's name + * @return the person's name (can be TQString::null, if it has been + * constructed with a null name) + */ + TQString name() const; + + /** + * The person's task + * @return the person's task (can be TQString::null, if it has been + * constructed with a null task) + */ + TQString task() const; + + /** + * The person's email address + * @return the person's email address (can be TQString::null, if it has been + * constructed with a null email) + */ + TQString emailAddress() const; + + /** + * The home page or a relevant link + * @return the persons home page (can be TQString::null, if it has been + * constructed with a null home page) + */ + TQString webAddress() const; + +private: + const char *mName; + const char *mTask; + const char *mEmailAddress; + const char *mWebAddress; + + TDEAboutPersonPrivate *d; +}; + +class TDEAboutTranslatorPrivate; +/** + * This structure is used to store information about a translator. + * It can store the translator's name and an email address. + * This class is intended for use in the TDEAboutData class, + * but it can be used elsewhere as well. + * Normally you should at least define the translator's name. + * + * It's not possible to use TDEAboutPerson for this, because + * TDEAboutPerson stores internally only const char* pointers, but the + * translator information is generated dynamically from the translation + * of a dummy string. +*/ +class TDECORE_EXPORT TDEAboutTranslator +{ +public: + /** + * Convenience constructor + * + * @param name The name of the person. + * + * @param emailAddress The email address of the person. + */ + TDEAboutTranslator(const TQString & name=TQString::null, + const TQString & emailAddress=TQString::null); + + /** + * The translator's name + * @return the translators's name (can be TQString::null, if it has been + * constructed with a null name) + */ + TQString name() const; + + /** + * The translator's email + * @return the translator's email address (can be TQString::null, if it has been + * constructed with a null email) + */ + TQString emailAddress() const; + +private: + TQString mName; + TQString mEmail; + TDEAboutTranslatorPrivate* d; +}; + + +/** + * This class is used to store information about a program. It can store + * such values as version number, program name, home page, email address + * for bug reporting, multiple authors and contributors + * (using TDEAboutPerson), license and copyright information. + * + * Currently, the values set here are shown by the "About" box + * (see TDEAboutDialog), used by the bug report dialog (see KBugReport), + * and by the help shown on command line (see TDECmdLineArgs). + * + * @short Holds information needed by the "About" box and other + * classes. + * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org) + */ +class TDECORE_EXPORT TDEAboutData +{ + public: + /** + * Descibes the license of the software. + */ + enum LicenseKey + { + License_Custom = -2, + License_File = -1, + License_Unknown = 0, + License_GPL = 1, + License_GPL_V2 = 1, + License_LGPL = 2, + License_LGPL_V2 = 2, + License_BSD = 3, + License_Artistic = 4, + License_QPL = 5, + License_QPL_V1_0 = 5 + }; + + public: + /** + * Constructor. + * + * @param appName The program name used internally. Example: "kedit" + * + * @param programName A displayable program name string. This string + * should be marked for translation. Example: I18N_NOOP("KEdit") + * + * @param version The program version string. + * + * @param shortDescription A short description of what the program does. + * This string should be marked for translation. + * Example: I18N_NOOP("A simple text editor.") + * + * @param licenseType The license identifier. Use setLicenseText if + * you use a license not predefined here. + * + * @param copyrightStatement A copyright statement, that can look like this: + * "(c) 1999-2000, Name". The string specified here is not modified + * in any manner. The author information from addAuthor is not + * used. + * + * @param text Some free form text, that can contain any kind of + * information. The text can contain newlines. This string + * should be marked for translation. + * + * @param homePageAddress The program homepage string. + * Start the address with "http://". "http://some.domain" is + * is correct, "some.domain" is not. + * + * @param bugsEmailAddress The bug report email address string. + * This defaults to the trinitydesktop.org bug system. + * + */ + TDEAboutData( const char *appName, + const char *programName, + const char *version, + const char *shortDescription = 0, + int licenseType = License_Unknown, + const char *copyrightStatement = 0, + const char *text = 0, + const char *homePageAddress = 0, + const char *bugsEmailAddress = 0 + ); + + ~TDEAboutData(); + + /** + * Defines an author. You can call this function as many times you + * need. Each entry is appended to a list. The person in the first entry + * is assumed to be the leader of the project. + * + * @param name The developer's name in UTF-8 encoding. + * + * @param task What the person is responsible for. This text can contain + * newlines. It should be marked for translation like this: + * I18N_NOOP("Task description..."). Can be 0. + * + * @param emailAddress An Email address where the person can be reached. + * Can be 0. + * + * @param webAddress The person's homepage or a relevant link. + * Start the address with "http://". "http://some.domain" is + * correct, "some.domain" is not. Can be 0. + * + */ + void addAuthor( const char *name, + const char *task=0, + const char *emailAddress=0, + const char *webAddress=0 ); + + /** + * Defines a person that deserves credit. You can call this function + * as many times you need. Each entry is appended to a list. + * + * @param name The person's name in UTF-8 encoding. + * + * @param task What the person has done to deserve the honor. The + * text can contain newlines. It should be marked for + * translation like this: I18N_NOOP("Task description...") + * Can be 0. + * + * @param emailAddress An Email address when the person can be reached. + * Can be 0. + * + * @param webAddress The person's homepage or a relevant link. + * Start the address with "http://". "http://some.domain" is + * is correct, "some.domain" is not. Can be 0. + * + */ + void addCredit( const char *name, + const char *task=0, + const char *emailAddress=0, + const char *webAddress=0 ); + + /** + * Sets the name of the translator of the gui. Since this depends + * on the language, just use a dummy text marked for translation. + * + * For example: + * \code + * setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\\nYour names") + * ,I18N_NOOP("_: EMAIL OF TRANSLATORS\\nYour emails")); + * \endcode + * + * The translator can then translate this dummy text with his name + * or with a list of names separated with ",". + * If there is no translation or the application is used with the + * default language, this function call is ignored. + * + * Note: If you are using the default KDE automake environment, + * there is no need to use this function, because the two + * default strings above are added to the applications po file + * automatically. + * + * @param name the name of the translator + * @param emailAddress the email address of the translator + * @see TDEAboutTranslator + */ + void setTranslator(const char* name, const char* emailAddress); + + /** + * Defines a license text. + * + * The text will be translated if it got marked for + * translations with the I18N_NOOP() macro. + * + * Example: + * \code + * setLicenseText( I18N_NOOP("This is my license")); + * \endcode + * + * NOTE: No copy of the text is made. + * + * @param license The license text in utf8 encoding. + */ + void setLicenseText( const char *license ); + + /** + * Defines a license text. + * + * @param file File containing the license text. + */ + void setLicenseTextFile( const TQString &file ); + + /** + * Defines the program name used internally. + * + * @param appName The application name. Example: "kate". + */ + void setAppName( const char *appName ); + + /** + * Defines the displayable program name string. + * + * @param programName The program name. This string should be + * marked for translation. + * Example: I18N_NOOP("Advanced Text Editor"). + * @since 3.2 + */ + void setProgramName( const char* programName ); + + /** + * Defines the program logo. + * Use this if you need to have application logo + * in AboutData other than application icon. + * + * @param image logo image. + * @see programLogo() + * @since 3.4 + */ + void setProgramLogo(const TQImage& image); + + /** + * Defines the program version string. + * + * @param version The program version. + */ + void setVersion( const char* version ); + + /** + * Defines a short description of what the program does. + * + * @param shortDescription The program description This string should be marked + * for translation. Example: I18N_NOOP("An advanced text editor + * with syntax highlithing support."). + */ + void setShortDescription( const char *shortDescription ); + + /** + * Defines the license identifier. + * + * @param licenseKey The license identifier. + */ + void setLicense( LicenseKey licenseKey); + + /** + * Defines the copyright statement to show when displaying the license. + * + * @param copyrightStatement A copyright statement, that can look like + * this: "(c) 1999-2000, Name". The string specified here is not + * modified in any manner. The author information from addAuthor + * is not used. + */ + void setCopyrightStatement( const char *copyrightStatement ); + + /** + * Defines the additional text to show in the about dialog. + * + * @param otherText Some free form text, that can contain any kind of + * information. The text can contain newlines. This string + * should be marked for translation. + */ + void setOtherText( const char *otherText ); + + /** + * Defines the program homepage. + * + * @param homepage The program homepage string. + * Start the address with "http://". "http://kate.kde.org" is + * is correct, "kde.kde.org" is not. + */ + void setHomepage( const char *homepage ); + + /** + * Defines the address where bug reports should be sent. + * + * @param bugAddress The bug report email address string. + * This defaults to the kde.org bug system. + */ + void setBugAddress( const char *bugAddress ); + + /** + * Defines the product name wich will be used in the KBugReport dialog. + * By default it's the appName, but you can overwrite it here to provide + * support for special components e.g. 'product/component' like + * 'kontact/summary'. + * + * @param name The name of product + */ + void setProductName( const char *name ); + + /** + * Returns the application's internal name. + * @return the internal program name. + */ + const char *appName() const; + + /** + * Returns the application's product name, which will be used in KBugReport + * dialog. By default it returns appName(), otherwise the one which is set + * with setProductName() + * + * @return the product name. + */ + const char *productName() const; + + /** + * Returns the translated program name. + * @return the program name (translated). + */ + TQString programName() const; + + /** + * @internal + */ + const char* internalProgramName() const; + /** + * @internal + */ + void translateInternalProgramName() const; + + /** + * Returns the program logo image. + * @return the program logo data or null image if there is + * no custom application logo defined. + * @since 3.4 + */ + TQImage programLogo() const; + + /** + * Returns the program's version. + * @return the version string. + */ + TQString version() const; + + /** + * @internal + */ + const char* internalVersion() const { return mVersion; } + + /** + * Returns a short, translated description. + * @return the short description (translated). Can be + * TQString::null if not set. + */ + TQString shortDescription() const; + + /** + * Returns the application homepage. + * @return the application homepage URL. Can be TQString::null if + * not set. + */ + TQString homepage() const; + + /** + * Returns the email address for bugs. + * @return the email address where to report bugs. + */ + TQString bugAddress() const; + + /** + * @internal + */ + const char* internalBugAddress() const { return mBugEmailAddress; } + + /** + * Returns a list of authors. + * @return author information (list of persons). + */ + const TQValueList<TDEAboutPerson> authors() const; + + /** + * Returns a list of persons who contributed. + * @return credit information (list of persons). + */ + const TQValueList<TDEAboutPerson> credits() const; + + /** + * Returns a list of translators. + * @return translators information (list of persons) + */ + const TQValueList<TDEAboutTranslator> translators() const; + + /** + * Returns a message about the translation team. + * @return a message about the translation team + */ + static TQString aboutTranslationTeam(); + + /** + * Returns a translated, free form text. + * @return the free form text (translated). Can be TQString::null if not set. + */ + TQString otherText() const; + + /** + * Returns the license. If the licenseType argument of the constructor has been + * used, any text defined by setLicenseText is ignored, + * and the standard text for the chosen license will be returned. + * + * @return The license text. + */ + TQString license() const; + + /** + * Returns the copyright statement. + * @return the copyright statement. Can be TQString::null if not set. + */ + TQString copyrightStatement() const; + + /** + * Returns the plain text displayed around the list of authors instead + * of the default message telling users to send bug reports to bugAddress(). + * + * @return the plain text displayed around the list of authors instead + * of the default message. Can be TQString::null. + */ + TQString customAuthorPlainText() const; + + /** + * Returns the rich text displayed around the list of authors instead + * of the default message telling users to send bug reports to bugAddress(). + * + * @return the rich text displayed around the list of authors instead + * of the default message. Can be TQString::null. + */ + TQString customAuthorRichText() const; + + /** + * Returns whether custom text should be displayed around the list of + * authors. + * + * @return whether custom text should be displayed around the list of + * authors. + */ + bool customAuthorTextEnabled() const; + + /** + * Sets the custom text displayed around the list of authors instead + * of the default message telling users to send bug reports to bugAddress(). + * + * @param plainText The plain text. + * @param richText The rich text. + * + * Both parameters can be TQString::null to not display any message at + * all. Call unsetCustomAuthorText() to revert to the default mesage. + */ + void setCustomAuthorText(const TQString &plainText, const TQString &richText); + + /** + * Clears any custom text displayed around the list of authors and falls + * back to the default message telling users to send bug reports to + * bugAddress(). + */ + void unsetCustomAuthorText(); + + private: + const char *mAppName; + const char *mProgramName; + const char *mVersion; + const char *mShortDescription; + int mLicenseKey; + const char *mCopyrightStatement; + const char *mOtherText; + const char *mHomepageAddress; + const char *mBugEmailAddress; + TQValueList<TDEAboutPerson> mAuthorList; + TQValueList<TDEAboutPerson> mCreditList; + const char *mLicenseText; + static const char *defaultBugTracker; + + TDEAboutDataPrivate *d; +}; + +#endif + diff --git a/tdecore/tdeaccel.cpp b/tdecore/tdeaccel.cpp index be8fba51b..e019baafc 100644 --- a/tdecore/tdeaccel.cpp +++ b/tdecore/tdeaccel.cpp @@ -27,7 +27,7 @@ #include <tqtimer.h> #include "tdeaccelbase.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> #include <tdeshortcut.h> diff --git a/tdecore/tdeapplication.cpp b/tdecore/tdeapplication.cpp new file mode 100644 index 000000000..24c77826b --- /dev/null +++ b/tdecore/tdeapplication.cpp @@ -0,0 +1,3638 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) + Copyright (C) 1998, 1999, 2000 KDE Team + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#ifdef HAVE_XCOMPOSITE +#define COMPOSITE +#endif + +// #ifdef QTRANSLATOR_H +// #error qtranslator.h was already included +// #endif // QTRANSLATOR_H +// +// #ifdef TQTRANSLATOR_H +// #error tqtranslator.h was already included +// #endif // TQTRANSLATOR_H + +#undef QT_NO_TRANSLATION +#undef TQT_NO_TRANSLATION +#include <tqtranslator.h> +#include "tdeapplication.h" +#define QT_NO_TRANSLATION +#define TQT_NO_TRANSLATION +#include <tqdir.h> +#include <tqptrcollection.h> +#include <tqwidgetlist.h> +#include <tqstrlist.h> +#include <tqfile.h> +#include <tqmessagebox.h> +#include <tqtextstream.h> +#include <tqregexp.h> +#include <tqlineedit.h> +#include <tqtextedit.h> +#include <tqsessionmanager.h> +#include <tqptrlist.h> +#include <tqtimer.h> +#include <tqstylesheet.h> +#include <tqpixmapcache.h> +#include <tqtooltip.h> +#include <tqstylefactory.h> +#include <tqmetaobject.h> +#include <tqimage.h> +#ifndef QT_NO_SQL +#include <tqsqlpropertymap.h> +#endif + +#include <kglobal.h> +#include <kstandarddirs.h> +#include <kdebug.h> +#include <klocale.h> +#include <tdestyle.h> +#include <kiconloader.h> +#include <kclipboard.h> +#include <tdeconfig.h> +#include <ksimpleconfig.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> +#include <kglobalsettings.h> +#include <kcrash.h> +#include <kdatastream.h> +#include <klibloader.h> +#include <kmimesourcefactory.h> +#include <tdestdaccel.h> +#include <tdeaccel.h> +#include "kcheckaccelerators.h" +#include <tqptrdict.h> +#include <kmacroexpander.h> +#include <kshell.h> +#include <kprotocolinfo.h> +#include <kkeynative.h> +#include <kmdcodec.h> +#include <kglobalaccel.h> + +#if defined Q_WS_X11 +#include <kstartupinfo.h> +#endif + +#include <dcopclient.h> +#include <dcopref.h> + +#include <sys/types.h> +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif +#include <sys/wait.h> +#include <grp.h> +#include <sys/types.h> + +#ifndef Q_WS_WIN +#include "twin.h" +#endif + +#include <fcntl.h> +#include <stdlib.h> // getenv(), srand(), rand() +#include <signal.h> +#include <unistd.h> +#include <time.h> +#include <sys/time.h> +#include <errno.h> +#include <string.h> +#include <netdb.h> +#if defined Q_WS_X11 +//#ifndef Q_WS_QWS //FIXME(E): NetWM should talk to QWS... +#include <netwm.h> +#endif + +#include "kprocctrl.h" + +#ifdef HAVE_PATHS_H +#include <paths.h> +#endif + +#ifdef Q_WS_X11 +#include <X11/Xlib.h> +#ifdef COMPOSITE +#include <X11/extensions/Xrender.h> +#include <X11/extensions/Xcomposite.h> +#include <dlfcn.h> +#endif +#include <X11/Xutil.h> +#include <X11/Xatom.h> +#include <X11/SM/SMlib.h> +#include <fixx11h.h> +#endif + +#include <pwd.h> + +#ifndef Q_WS_WIN +#include <KDE-ICE/ICElib.h> +#else +typedef void* IceIOErrorHandler; +#include <windows.h> +//KDE4: remove +#define Button1Mask (1<<8) +#define Button2Mask (1<<9) +#define Button3Mask (1<<10) +#endif + +#ifdef Q_WS_X11 +#define DISPLAY "DISPLAY" +#elif defined(Q_WS_QWS) +#define DISPLAY "QWS_DISPLAY" +#endif + +#if defined Q_WS_X11 +#include <kipc.h> +#endif + +#ifdef Q_WS_MACX +#include <Carbon/Carbon.h> +#include <tqimage.h> +#endif + +#include "kappdcopiface.h" + +// exported for tdm kfrontend +KDE_EXPORT bool kde_have_kipc = true; // magic hook to disable kipc in tdm +bool kde_kiosk_exception = false; // flag to disable kiosk restrictions +bool kde_kiosk_admin = false; + +TDEApplication* TDEApplication::KApp = 0L; +bool TDEApplication::loadedByKdeinit = false; +DCOPClient *TDEApplication::s_DCOPClient = 0L; +bool TDEApplication::s_dcopClientNeedsPostInit = false; + +#ifdef Q_WS_X11 +static Atom atom_DesktopWindow; +static Atom atom_NetSupported; +static Atom kde_xdnd_drop; +#endif + +#ifdef Q_WS_X11 +static int composite_event, composite_error, composite_opcode; +static bool x11_composite_error_generated; +static int x11_error(Display *dpy, XErrorEvent *ev) { + if (ev->request_code == composite_opcode && ev->minor_code == X_CompositeRedirectSubwindows) + { + x11_composite_error_generated = true; + return 0; + } + return 1; +} +#endif + +// duplicated from patched Qt, so that there won't be unresolved symbols if Qt gets +// replaced by unpatched one +TDECORE_EXPORT bool tqt_qclipboard_bailout_hack = false; + +template class TQPtrList<KSessionManaged>; + +#ifdef Q_WS_X11 +extern "C" { +static int kde_xio_errhandler( Display * dpy ) +{ + return kapp->xioErrhandler( dpy ); +} + +static int kde_x_errhandler( Display *dpy, XErrorEvent *err ) +{ + return kapp->xErrhandler( dpy, err ); +} + +} + +extern "C" { +static void kde_ice_ioerrorhandler( IceConn conn ) +{ + if(kapp) + kapp->iceIOErrorHandler( conn ); + // else ignore the error for now +} +} +#endif + +#ifdef Q_WS_WIN +void TDEApplication_init_windows(bool GUIenabled); + +class QAssistantClient; +#endif + +/* + Private data to make keeping binary compatibility easier + */ +class TDEApplicationPrivate +{ +public: + TDEApplicationPrivate() + : actionRestrictions( false ), + refCount( 1 ), + oldIceIOErrorHandler( 0 ), + checkAccelerators( 0 ), + overrideStyle( TQString::null ), + startup_id( "0" ), + app_started_timer( NULL ), + m_KAppDCOPInterface( 0L ), + session_save( false ) +#ifdef Q_WS_X11 + ,oldXErrorHandler( NULL ) + ,oldXIOErrorHandler( NULL ) +#elif defined Q_WS_WIN + ,qassistantclient( 0 ) +#endif + { + } + + ~TDEApplicationPrivate() + { +#ifdef Q_WS_WIN + delete qassistantclient; +#endif + } + + + bool actionRestrictions : 1; + bool guiEnabled : 1; + /** + * This counter indicates when to exit the application. + * It starts at 1, is decremented in TDEMainWindow when the last window is closed, but + * is incremented by operations that should outlive the last window closed + * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client). + */ + int refCount; + IceIOErrorHandler oldIceIOErrorHandler; + KCheckAccelerators* checkAccelerators; + TQString overrideStyle; + TQString geometry_arg; + TQCString startup_id; + TQTimer* app_started_timer; + KAppDCOPInterface *m_KAppDCOPInterface; + bool session_save; +#ifdef Q_WS_X11 + int (*oldXErrorHandler)(Display*,XErrorEvent*); + int (*oldXIOErrorHandler)(Display*); +#elif defined Q_WS_WIN + QAssistantClient* qassistantclient; +#endif + + class URLActionRule + { + public: +#define checkExactMatch(s, b) \ + if (s.isEmpty()) b = true; \ + else if (s[s.length()-1] == '!') \ + { b = false; s.truncate(s.length()-1); } \ + else b = true; +#define checkStartWildCard(s, b) \ + if (s.isEmpty()) b = true; \ + else if (s[0] == '*') \ + { b = true; s = s.mid(1); } \ + else b = false; +#define checkEqual(s, b) \ + b = (s == "="); + + URLActionRule(const TQString &act, + const TQString &bProt, const TQString &bHost, const TQString &bPath, + const TQString &dProt, const TQString &dHost, const TQString &dPath, + bool perm) + : action(act), + baseProt(bProt), baseHost(bHost), basePath(bPath), + destProt(dProt), destHost(dHost), destPath(dPath), + permission(perm) + { + checkExactMatch(baseProt, baseProtWildCard); + checkStartWildCard(baseHost, baseHostWildCard); + checkExactMatch(basePath, basePathWildCard); + checkExactMatch(destProt, destProtWildCard); + checkStartWildCard(destHost, destHostWildCard); + checkExactMatch(destPath, destPathWildCard); + checkEqual(destProt, destProtEqual); + checkEqual(destHost, destHostEqual); + } + + bool baseMatch(const KURL &url, const TQString &protClass) + { + if (baseProtWildCard) + { + if ( !baseProt.isEmpty() && !url.protocol().startsWith(baseProt) && + (protClass.isEmpty() || (protClass != baseProt)) ) + return false; + } + else + { + if ( (url.protocol() != baseProt) && + (protClass.isEmpty() || (protClass != baseProt)) ) + return false; + } + if (baseHostWildCard) + { + if (!baseHost.isEmpty() && !url.host().endsWith(baseHost)) + return false; + } + else + { + if (url.host() != baseHost) + return false; + } + if (basePathWildCard) + { + if (!basePath.isEmpty() && !url.path().startsWith(basePath)) + return false; + } + else + { + if (url.path() != basePath) + return false; + } + return true; + } + + bool destMatch(const KURL &url, const TQString &protClass, const KURL &base, const TQString &baseClass) + { + if (destProtEqual) + { + if ( (url.protocol() != base.protocol()) && + (protClass.isEmpty() || baseClass.isEmpty() || protClass != baseClass) ) + return false; + } + else if (destProtWildCard) + { + if ( !destProt.isEmpty() && !url.protocol().startsWith(destProt) && + (protClass.isEmpty() || (protClass != destProt)) ) + return false; + } + else + { + if ( (url.protocol() != destProt) && + (protClass.isEmpty() || (protClass != destProt)) ) + return false; + } + if (destHostWildCard) + { + if (!destHost.isEmpty() && !url.host().endsWith(destHost)) + return false; + } + else if (destHostEqual) + { + if (url.host() != base.host()) + return false; + } + else + { + if (url.host() != destHost) + return false; + } + if (destPathWildCard) + { + if (!destPath.isEmpty() && !url.path().startsWith(destPath)) + return false; + } + else + { + if (url.path() != destPath) + return false; + } + return true; + } + + TQString action; + TQString baseProt; + TQString baseHost; + TQString basePath; + TQString destProt; + TQString destHost; + TQString destPath; + bool baseProtWildCard : 1; + bool baseHostWildCard : 1; + bool basePathWildCard : 1; + bool destProtWildCard : 1; + bool destHostWildCard : 1; + bool destPathWildCard : 1; + bool destProtEqual : 1; + bool destHostEqual : 1; + bool permission; + }; + TQPtrList<URLActionRule> urlActionRestrictions; + + TQString sessionKey; + TQString pSessionConfigFile; +}; + + +static TQPtrList<TQWidget>*x11Filter = 0; +static bool autoDcopRegistration = true; + +void TDEApplication::installX11EventFilter( TQWidget* filter ) +{ + if ( !filter ) + return; + if (!x11Filter) + x11Filter = new TQPtrList<TQWidget>; + connect ( filter, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( x11FilterDestroyed() ) ); + x11Filter->append( filter ); +} + +void TDEApplication::x11FilterDestroyed() +{ + removeX11EventFilter( static_cast< const TQWidget* >( sender())); +} + +void TDEApplication::removeX11EventFilter( const TQWidget* filter ) +{ + if ( !x11Filter || !filter ) + return; + x11Filter->removeRef( filter ); + if ( x11Filter->isEmpty() ) { + delete x11Filter; + x11Filter = 0; + } +} + +// FIXME: remove this when we've get a better method of +// customizing accelerator handling -- hopefully in Qt. +// For now, this is set whenever an accelerator is overridden +// in TDEAccelEventHandler so that the AccelOverride isn't sent twice. -- ellis, 19/10/02 +extern bool kde_g_bKillAccelOverride; + +bool TDEApplication::notify(TQObject *receiver, TQEvent *event) +{ + TQEvent::Type t = event->type(); + if (kde_g_bKillAccelOverride) + { + kde_g_bKillAccelOverride = false; + // Indicate that the accelerator has been overridden. + if (t == TQEvent::AccelOverride) + { + TQT_TQKEYEVENT(event)->accept(); + return true; + } + else + kdWarning(125) << "kde_g_bKillAccelOverride set, but received an event other than AccelOverride." << endl; + } + + if ((t == TQEvent::AccelOverride) || (t == TQEvent::KeyPress)) + { + static const TDEShortcut& _selectAll = TDEStdAccel::selectAll(); + TQLineEdit *edit = ::tqqt_cast<TQLineEdit *>(receiver); + if (edit) + { + // We have a keypress for a lineedit... + TQKeyEvent *kevent = TQT_TQKEYEVENT(event); + KKey key(kevent); + if (_selectAll.contains(key)) + { + if (t == TQEvent::KeyPress) + { + edit->selectAll(); + return true; + } + else + { + kevent->accept(); + } + } + // Ctrl-U deletes from start of line. + if (key == KKey(Qt::CTRL + Qt::Key_U)) + { + if (t == TQEvent::KeyPress) + { + if (!edit->isReadOnly()) + { + TQString t(edit->text()); + t = t.mid(edit->cursorPosition()); + edit->validateAndSet(t, 0, 0, 0); + } + return true; + } + else + { + kevent->accept(); + } + + } + } + TQTextEdit *medit = ::tqqt_cast<TQTextEdit *>(receiver); + if (medit) + { + // We have a keypress for a multilineedit... + TQKeyEvent *kevent = TQT_TQKEYEVENT(event); + if (_selectAll.contains(KKey(kevent))) + { + if (t == TQEvent::KeyPress) + { + medit->selectAll(); + return true; + } + else + { + kevent->accept(); + } + } + } + } + if( t == TQEvent::Show && receiver->isWidgetType()) + { + TQWidget* w = TQT_TQWIDGET( receiver ); +#if defined Q_WS_X11 + if( w->isTopLevel() && !startupId().isEmpty() && !TQT_TQSHOWEVENT(event)->spontaneous()) // TODO better done using window group leader? + TDEStartupInfo::setWindowStartupId( w->winId(), startupId()); +#endif + if( w->isTopLevel() && !w->testWFlags( WX11BypassWM ) && !w->isPopup() && !event->spontaneous()) + { + if( d->app_started_timer == NULL ) + { + d->app_started_timer = new TQTimer( this, "app_started_timer" ); + connect( d->app_started_timer, TQT_SIGNAL( timeout()), TQT_SLOT( checkAppStartedSlot())); + } + if( !d->app_started_timer->isActive()) + d->app_started_timer->start( 0, true ); + } + if( w->isTopLevel() && ( w->icon() == NULL || w->icon()->isNull())) + { + // icon() cannot be null pixmap, it'll be the "unknown" icon - so check if there is this application icon + static TQPixmap* ic = NULL; + if( ic == NULL ) + ic = new TQPixmap( TDEGlobal::iconLoader()->loadIcon( iconName(), + TDEIcon::NoGroup, 0, TDEIcon::DefaultState, NULL, true )); + if( !ic->isNull()) + { + w->setIcon( *ic ); +#if defined Q_WS_X11 + KWin::setIcons( w->winId(), *ic, miniIcon()); +#endif + } + } + } + return TQApplication::notify(receiver, event); +} + +void TDEApplication::checkAppStartedSlot() +{ +#if defined Q_WS_X11 + TDEStartupInfo::handleAutoAppStartedSending(); +#endif +} + +// the help class for session management communication +static TQPtrList<KSessionManaged>* sessionClients() +{ + static TQPtrList<KSessionManaged>* session_clients = 0L; + if ( !session_clients ) + session_clients = new TQPtrList<KSessionManaged>; + return session_clients; +} + +/* + Auxiliary function to calculate a a session config name used for the + instance specific config object. + Syntax: "session/<appname>_<sessionId>" + */ +TQString TDEApplication::sessionConfigName() const +{ + TQString sessKey = sessionKey(); + if ( sessKey.isEmpty() && !d->sessionKey.isEmpty() ) + sessKey = d->sessionKey; + return TQString("session/%1_%2_%3").arg(name()).arg(sessionId()).arg(sessKey); +} + +#ifdef Q_WS_X11 +static SmcConn mySmcConnection = 0; +static SmcConn tmpSmcConnection = 0; +#else +// FIXME(E): Implement for Qt Embedded +// Possibly "steal" XFree86's libSM? +#endif +static TQTime* smModificationTime = 0; + +TDEApplication::TDEApplication( int& argc, char** argv, const TQCString& rAppName, + bool allowStyles, bool GUIenabled ) : + TQApplication( argc, argv, GUIenabled ), TDEInstance(rAppName), +#ifdef Q_WS_X11 + display(0L), + argb_visual(false), +#endif + d (new TDEApplicationPrivate()) +{ + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + if (!GUIenabled) + allowStyles = false; + useStyles = allowStyles; + Q_ASSERT (!rAppName.isEmpty()); + setName(rAppName); + + installSigpipeHandler(); + TDECmdLineArgs::initIgnore(argc, argv, rAppName.data()); + parseCommandLine( ); + init(GUIenabled); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} + +TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled ) : +// TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), TRUE ), // Qt4 requires that there always be a GUI + TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), GUIenabled ), // We need to be able to run command line apps + TDEInstance( TDECmdLineArgs::about), +#ifdef Q_WS_X11 + display(0L), + argb_visual(false), +#endif + d (new TDEApplicationPrivate) +{ + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + if (!GUIenabled) + allowStyles = false; + useStyles = allowStyles; + setName( instanceName() ); + + installSigpipeHandler(); + parseCommandLine( ); + init(GUIenabled); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} + +#ifdef Q_WS_X11 +TDEApplication::TDEApplication( Display *dpy, bool allowStyles ) : + TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), + getX11RGBAVisual(dpy), getX11RGBAColormap(dpy) ), + TDEInstance( TDECmdLineArgs::about), display(0L), d (new TDEApplicationPrivate) +{ + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + useStyles = allowStyles; + setName( instanceName() ); + installSigpipeHandler(); + parseCommandLine( ); + init( true ); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} + +TDEApplication::TDEApplication( Display *dpy, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles ) : + TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), + disable_argb?visual:getX11RGBAVisual(dpy), disable_argb?colormap:getX11RGBAColormap(dpy) ), + TDEInstance( TDECmdLineArgs::about), display(0L), d (new TDEApplicationPrivate) +{ + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + useStyles = allowStyles; + if (disable_argb) argb_visual = false; + setName( instanceName() ); + installSigpipeHandler(); + parseCommandLine( ); + init( true ); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} + +TDEApplication::TDEApplication( Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap, + bool allowStyles ) : + TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), + visual?visual:getX11RGBAVisual(dpy), colormap?colormap:getX11RGBAColormap(dpy) ), + TDEInstance( TDECmdLineArgs::about), display(0L), d (new TDEApplicationPrivate) +{ + if ((visual) && (colormap)) + getX11RGBAInformation(dpy); + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + useStyles = allowStyles; + setName( instanceName() ); + installSigpipeHandler(); + parseCommandLine( ); + init( true ); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} + +TDEApplication::TDEApplication( Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap, + bool allowStyles, TDEInstance * _instance ) : + TQApplication( dpy, *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), + visual?visual:getX11RGBAVisual(dpy), colormap?colormap:getX11RGBAColormap(dpy) ), + TDEInstance( _instance ), display(0L), d (new TDEApplicationPrivate) +{ + if ((visual) && (colormap)) + getX11RGBAInformation(dpy); + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + useStyles = allowStyles; + setName( instanceName() ); + installSigpipeHandler(); + parseCommandLine( ); + init( true ); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} +#endif + +TDEApplication::TDEApplication( bool allowStyles, bool GUIenabled, TDEInstance* _instance ) : + TQApplication( *TDECmdLineArgs::tqt_argc(), *TDECmdLineArgs::tqt_argv(), + GUIenabled ), + TDEInstance( _instance ), +#ifdef Q_WS_X11 + display(0L), +#endif + argb_visual(false), + d (new TDEApplicationPrivate) +{ + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + if (!GUIenabled) + allowStyles = false; + useStyles = allowStyles; + setName( instanceName() ); + + installSigpipeHandler(); + parseCommandLine( ); + init(GUIenabled); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} + +#ifdef Q_WS_X11 +TDEApplication::TDEApplication(Display *display, int& argc, char** argv, const TQCString& rAppName, + bool allowStyles, bool GUIenabled ) : + TQApplication( display ), TDEInstance(rAppName), + display(0L), + argb_visual(false), + d (new TDEApplicationPrivate()) +{ + aIconPixmap.pm.icon = 0L; + aIconPixmap.pm.miniIcon = 0L; + read_app_startup_id(); + if (!GUIenabled) + allowStyles = false; + useStyles = allowStyles; + + Q_ASSERT (!rAppName.isEmpty()); + setName(rAppName); + + installSigpipeHandler(); + TDECmdLineArgs::initIgnore(argc, argv, rAppName.data()); + parseCommandLine( ); + init(GUIenabled); + d->m_KAppDCOPInterface = new KAppDCOPInterface(this); +} +#endif + +int TDEApplication::xioErrhandler( Display* dpy ) +{ + if(kapp) + { + emit shutDown(); +#ifdef Q_WS_X11 + d->oldXIOErrorHandler( dpy ); +#else + Q_UNUSED(dpy); +#endif + } + exit( 1 ); + return 0; +} + +int TDEApplication::xErrhandler( Display* dpy, void* err_ ) +{ // no idea how to make forward decl. for XErrorEvent +#ifdef Q_WS_X11 + XErrorEvent* err = static_cast< XErrorEvent* >( err_ ); + if(kapp) + { + // add KDE specific stuff here + d->oldXErrorHandler( dpy, err ); + } +#endif + return 0; +} + +void TDEApplication::iceIOErrorHandler( _IceConn *conn ) +{ + emit shutDown(); + +#ifdef Q_WS_X11 + if ( d->oldIceIOErrorHandler != NULL ) + (*d->oldIceIOErrorHandler)( conn ); +#endif + exit( 1 ); +} + +class KDETranslator : public TQTranslator +{ +public: + KDETranslator(TQObject *parent) : TQTranslator(parent, "kdetranslator") {} + virtual TQTranslatorMessage findMessage(const char* context, + const char *sourceText, + const char* message) const + { + TQTranslatorMessage res; + res.setTranslation(TDEGlobal::locale()->translateQt(context, sourceText, message)); + return res; + } +}; + +void TDEApplication::init(bool GUIenabled) +{ + d->guiEnabled = GUIenabled; + if ((getuid() != geteuid()) || + (getgid() != getegid()) ) + { + // man permissions are not exploitable and better than + // world writable directories + struct group *man = getgrnam("man"); + if ( !man || man->gr_gid != getegid() ){ + fprintf(stderr, "The TDE libraries are not designed to run with suid privileges.\n"); + ::exit(127); + } + } + + TDEProcessController::ref(); + + (void) TDEClipboardSynchronizer::self(); + + TQApplication::setDesktopSettingsAware( false ); + + KApp = this; + + +#ifdef Q_WS_X11 //FIXME(E) + // create all required atoms in _one_ roundtrip to the X server + if ( GUIenabled ) { + const int max = 20; + Atom* atoms[max]; + char* names[max]; + Atom atoms_return[max]; + int n = 0; + + atoms[n] = &kipcCommAtom; + names[n++] = (char *) "KIPC_COMM_ATOM"; + + atoms[n] = &atom_DesktopWindow; + names[n++] = (char *) "KDE_DESKTOP_WINDOW"; + + atoms[n] = &atom_NetSupported; + names[n++] = (char *) "_NET_SUPPORTED"; + + atoms[n] = &kde_xdnd_drop; + names[n++] = (char *) "XdndDrop"; + + XInternAtoms( tqt_xdisplay(), names, n, false, atoms_return ); + + for (int i = 0; i < n; i++ ) + *atoms[i] = atoms_return[i]; + } +#endif + + dcopAutoRegistration(); + dcopClientPostInit(); + + smw = 0; + + // Initial KIPC event mask. +#if defined Q_WS_X11 + kipcEventMask = (1 << KIPC::StyleChanged) | (1 << KIPC::PaletteChanged) | + (1 << KIPC::FontChanged) | (1 << KIPC::BackgroundChanged) | + (1 << KIPC::ToolbarStyleChanged) | (1 << KIPC::SettingsChanged) | + (1 << KIPC::ClipboardConfigChanged) | (1 << KIPC::BlockShortcuts); +#endif + + // Trigger creation of locale. + (void) TDEGlobal::locale(); + + TDEConfig* config = TDEGlobal::config(); + d->actionRestrictions = config->hasGroup("KDE Action Restrictions" ) && !kde_kiosk_exception; + // For brain-dead configurations where the user's local config file is not writable. + // * We use kdialog to warn the user, so we better not generate warnings from + // kdialog itself. + // * Don't warn if we run with a read-only $HOME + TQCString readOnly = getenv("TDE_HOME_READONLY"); + if (readOnly.isEmpty() && (tqstrcmp(name(), "kdialog") != 0)) + { + TDEConfigGroupSaver saver(config, "KDE Action Restrictions"); + if (config->readBoolEntry("warn_unwritable_config",true)) + config->checkConfigFilesWritable(true); + } + + if (GUIenabled) + { +#ifdef Q_WS_X11 + // this is important since we fork() to launch the help (Matthias) + fcntl(ConnectionNumber(tqt_xdisplay()), F_SETFD, FD_CLOEXEC); + // set up the fancy (=robust and error ignoring ) KDE xio error handlers (Matthias) + d->oldXErrorHandler = XSetErrorHandler( kde_x_errhandler ); + d->oldXIOErrorHandler = XSetIOErrorHandler( kde_xio_errhandler ); +#endif + + connect( this, TQT_SIGNAL( aboutToQuit() ), this, TQT_SIGNAL( shutDown() ) ); + +#ifdef Q_WS_X11 //FIXME(E) + display = desktop()->x11Display(); +#endif + + { + TQStringList plugins = TDEGlobal::dirs()->resourceDirs( "qtplugins" ); + TQStringList::Iterator it = plugins.begin(); + while (it != plugins.end()) { + addLibraryPath( *it ); + ++it; + } + + } + tdedisplaySetStyle(); + tdedisplaySetFont(); +// tdedisplaySetPalette(); done by tdedisplaySetStyle + propagateSettings(SETTINGS_QT); + + // Set default mime-source factory + // XXX: This is a hack. Make our factory the default factory, but add the + // previous default factory to the list of factories. Why? When the default + // factory can't resolve something, it iterates in the list of factories. + // But it TQWhatsThis only uses the default factory. So if there was already + // a default factory (which happens when using an image library using uic), + // we prefer KDE's factory and so we put that old default factory in the + // list and use KDE as the default. This may speed up things as well. + TQMimeSourceFactory* oldDefaultFactory = TQMimeSourceFactory::takeDefaultFactory(); + TQMimeSourceFactory::setDefaultFactory( mimeSourceFactory() ); + if ( oldDefaultFactory ) { + TQMimeSourceFactory::addFactory( oldDefaultFactory ); + } + + d->checkAccelerators = new KCheckAccelerators( TQT_TQOBJECT(this) ); + } + +#ifdef Q_WS_MACX + if (GUIenabled) { + TQPixmap pixmap = TDEGlobal::iconLoader()->loadIcon( TDECmdLineArgs::appName(), + TDEIcon::NoGroup, TDEIcon::SizeLarge, TDEIcon::DefaultState, 0L, false ); + if (!pixmap.isNull()) { + TQImage i = pixmap.convertToImage().convertDepth(32).smoothScale(40, 40); + for(int y = 0; y < i.height(); y++) { + uchar *l = i.scanLine(y); + for(int x = 0; x < i.width(); x+=4) + *(l+x) = 255; + } + CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB(); + CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, + i.bits(), i.numBytes(), NULL); + CGImageRef ir = CGImageCreate(i.width(), i.height(), 8, 32, i.bytesPerLine(), + cs, kCGImageAlphaNoneSkipFirst, dp, + 0, 0, kCGRenderingIntentDefault); + //cleanup + SetApplicationDockTileImage(ir); + CGImageRelease(ir); + CGColorSpaceRelease(cs); + CGDataProviderRelease(dp); + } + } +#endif + + + // save and restore the RTL setting, as installTranslator calls qt_detectRTLLanguage, + // which makes it impossible to use the -reverse cmdline switch with KDE apps + bool rtl = reverseLayout(); + installTranslator(new KDETranslator(TQT_TQOBJECT(this))); + setReverseLayout( rtl ); + if (i18n( "_: Dear Translator! Translate this string to the string 'LTR' in " + "left-to-right languages (as english) or to 'RTL' in right-to-left " + "languages (such as Hebrew and Arabic) to get proper widget layout." ) == "RTL") + setReverseLayout( !rtl ); + + // install appdata resource type + TDEGlobal::dirs()->addResourceType("appdata", TDEStandardDirs::kde_default("data") + + TQString::fromLatin1(name()) + '/'); + pSessionConfig = 0L; + bSessionManagement = true; + +#ifdef Q_WS_X11 + // register a communication window for desktop changes (Matthias) + if (GUIenabled && kde_have_kipc ) + { + smw = new TQWidget(0,0); + long data = 1; + XChangeProperty(tqt_xdisplay(), smw->winId(), + atom_DesktopWindow, atom_DesktopWindow, + 32, PropModeReplace, (unsigned char *)&data, 1); + } + d->oldIceIOErrorHandler = IceSetIOErrorHandler( kde_ice_ioerrorhandler ); +#elif defined(Q_WS_WIN) + TDEApplication_init_windows(GUIenabled); +#else + // FIXME(E): Implement for Qt Embedded +#endif +} + +static int my_system (const char *command) { + int pid, status; + + pid = fork(); + if (pid == -1) + return -1; + if (pid == 0) { + const char* shell = "/bin/sh"; + execl(shell, shell, "-c", command, (void *)0); + ::_exit(127); + } + do { + if (waitpid(pid, &status, 0) == -1) { + if (errno != EINTR) + return -1; + } else + return status; + } while(1); +} + + +DCOPClient *TDEApplication::dcopClient() +{ + if (s_DCOPClient) + return s_DCOPClient; + + s_DCOPClient = new DCOPClient(); + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs("tde"); + if (args && args->isSet("dcopserver")) + { + s_DCOPClient->setServerAddress( args->getOption("dcopserver")); + } + if( kapp ) { + connect(s_DCOPClient, TQT_SIGNAL(attachFailed(const TQString &)), + kapp, TQT_SLOT(dcopFailure(const TQString &))); + connect(s_DCOPClient, TQT_SIGNAL(blockUserInput(bool) ), + kapp, TQT_SLOT(dcopBlockUserInput(bool)) ); + } + else + s_dcopClientNeedsPostInit = true; + + DCOPClient::setMainClient( s_DCOPClient ); + return s_DCOPClient; +} + +void TDEApplication::dcopClientPostInit() +{ + if( s_dcopClientNeedsPostInit ) + { + s_dcopClientNeedsPostInit = false; + connect(s_DCOPClient, TQT_SIGNAL(blockUserInput(bool) ), + TQT_SLOT(dcopBlockUserInput(bool)) ); + s_DCOPClient->bindToApp(); // Make sure we get events from the DCOPClient. + } +} + +void TDEApplication::dcopAutoRegistration() +{ + if (autoDcopRegistration) + { + ( void ) dcopClient(); + if( dcopClient()->appId().isEmpty()) + dcopClient()->registerAs(name()); + } +} + +void TDEApplication::disableAutoDcopRegistration() +{ + autoDcopRegistration = false; +} + +TDEConfig* TDEApplication::sessionConfig() +{ + if (pSessionConfig) + return pSessionConfig; + + // create an instance specific config object + pSessionConfig = new TDEConfig( sessionConfigName(), false, false); + return pSessionConfig; +} + +void TDEApplication::ref() +{ + d->refCount++; + //kdDebug() << "TDEApplication::ref() : refCount = " << d->refCount << endl; +} + +void TDEApplication::deref() +{ + d->refCount--; + //kdDebug() << "TDEApplication::deref() : refCount = " << d->refCount << endl; + if ( d->refCount <= 0 ) + quit(); +} + +KSessionManaged::KSessionManaged() +{ + sessionClients()->remove( this ); + sessionClients()->append( this ); +} + +KSessionManaged::~KSessionManaged() +{ + sessionClients()->remove( this ); +} + +bool KSessionManaged::saveState(TQSessionManager&) +{ + return true; +} + +bool KSessionManaged::commitData(TQSessionManager&) +{ + return true; +} + + +void TDEApplication::disableSessionManagement() { + bSessionManagement = false; +} + +void TDEApplication::enableSessionManagement() { + bSessionManagement = true; +#ifdef Q_WS_X11 + // Session management support in Qt/TDE is awfully broken. + // If konqueror disables session management right after its startup, + // and enables it later (preloading stuff), it won't be properly + // saved on session shutdown. + // I'm not actually sure why it doesn't work, but saveState() + // doesn't seem to be called on session shutdown, possibly + // because disabling session management after konqueror startup + // disabled it somehow. Forcing saveState() here for this application + // seems to fix it. + if( mySmcConnection ) { + SmcRequestSaveYourself( mySmcConnection, SmSaveLocal, False, + SmInteractStyleAny, + False, False ); + + // flush the request + IceFlush(SmcGetIceConnection(mySmcConnection)); + } +#endif +} + + +bool TDEApplication::requestShutDown( + ShutdownConfirm confirm, ShutdownType sdtype, ShutdownMode sdmode ) +{ +#ifdef Q_WS_X11 + TQApplication::syncX(); + /* use ksmserver's dcop interface if necessary */ + if ( confirm == ShutdownConfirmYes || + sdtype != ShutdownTypeDefault || + sdmode != ShutdownModeDefault ) + { + TQByteArray data; + TQDataStream arg(data, IO_WriteOnly); + arg << (int)confirm << (int)sdtype << (int)sdmode; + return dcopClient()->send( "ksmserver", "ksmserver", + "logout(int,int,int)", data ); + } + + if ( mySmcConnection ) { + // we already have a connection to the session manager, use it. + SmcRequestSaveYourself( mySmcConnection, SmSaveBoth, True, + SmInteractStyleAny, + confirm == ShutdownConfirmNo, True ); + + // flush the request + IceFlush(SmcGetIceConnection(mySmcConnection)); + return true; + } + + // open a temporary connection, if possible + + propagateSessionManager(); + TQCString smEnv = ::getenv("SESSION_MANAGER"); + if (smEnv.isEmpty()) + return false; + + if (! tmpSmcConnection) { + char cerror[256]; + char* myId = 0; + char* prevId = 0; + SmcCallbacks cb; + tmpSmcConnection = SmcOpenConnection( 0, 0, 1, 0, + 0, &cb, + prevId, + &myId, + 255, + cerror ); + ::free( myId ); // it was allocated by C + if (!tmpSmcConnection ) + return false; + } + + SmcRequestSaveYourself( tmpSmcConnection, SmSaveBoth, True, + SmInteractStyleAny, False, True ); + + // flush the request + IceFlush(SmcGetIceConnection(tmpSmcConnection)); + return true; +#else + // FIXME(E): Implement for Qt Embedded + return false; +#endif +} + +void TDEApplication::propagateSessionManager() +{ +#ifdef Q_WS_X11 + TQCString fName = TQFile::encodeName(locateLocal("socket", "KSMserver")); + TQCString display = ::getenv(DISPLAY); + // strip the screen number from the display + display.replace(TQRegExp("\\.[0-9]+$"), ""); + int i; + while( (i = display.find(':')) >= 0) + display[i] = '_'; + + fName += "_"+display; + TQCString smEnv = ::getenv("SESSION_MANAGER"); + bool check = smEnv.isEmpty(); + if ( !check && smModificationTime ) { + TQFileInfo info( fName ); + TQTime current = TQT_TQTIME_OBJECT(info.lastModified().time()); + check = current > *smModificationTime; + } + if ( check ) { + delete smModificationTime; + TQFile f( fName ); + if ( !f.open( IO_ReadOnly ) ) + return; + TQFileInfo info ( f ); + smModificationTime = new TQTime( TQT_TQTIME_OBJECT(info.lastModified().time()) ); + TQTextStream t(&f); + t.setEncoding( TQTextStream::Latin1 ); + TQString s = t.readLine(); + f.close(); + ::setenv( "SESSION_MANAGER", s.latin1(), true ); + } +#endif +} + +void TDEApplication::commitData( TQSessionManager& sm ) +{ + d->session_save = true; + bool canceled = false; + for (KSessionManaged* it = sessionClients()->first(); + it && !canceled; + it = sessionClients()->next() ) { + canceled = !it->commitData( sm ); + } + if ( canceled ) + sm.cancel(); + + if ( sm.allowsInteraction() ) { + TQWidgetList done; + TQWidgetList *list = TQApplication::topLevelWidgets(); + bool canceled = false; + TQWidget* w = list->first(); + while ( !canceled && w ) { + if ( !w->testWState( WState_ForceHide ) && !w->inherits("TDEMainWindow") ) { + TQCloseEvent e; + sendEvent( w, &e ); + canceled = !e.isAccepted(); + if ( !canceled ) + done.append( w ); + delete list; // one never knows... + list = TQApplication::topLevelWidgets(); + w = list->first(); + } else { + w = list->next(); + } + while ( w && done.containsRef( w ) ) + w = list->next(); + } + delete list; + } + + + if ( !bSessionManagement ) + sm.setRestartHint( TQSessionManager::RestartNever ); + else + sm.setRestartHint( TQSessionManager::RestartIfRunning ); + d->session_save = false; +} + +static void checkRestartVersion( TQSessionManager& sm ) +{ + Display* dpy = tqt_xdisplay(); + Atom type; + int format; + unsigned long nitems, after; + unsigned char* data; + if( XGetWindowProperty( dpy, RootWindow( dpy, 0 ), XInternAtom( dpy, "TDE_FULL_SESSION", False ), + 0, 1, False, AnyPropertyType, &type, &format, &nitems, &after, &data ) == Success ) { + if( data != NULL ) + XFree( data ); + if( type == XA_STRING && format == 8 ) { // session set, check if TDE_SESSION_VERSION is not set (meaning KDE3) + if( XGetWindowProperty( dpy, RootWindow( dpy, 0 ), XInternAtom( dpy, "TDE_SESSION_VERSION", False ), + 0, 1, False, AnyPropertyType, &type, &format, &nitems, &after, &data ) == Success ) { + if( data != NULL ) + XFree( data ); // KDE4 or newer + if( type == None ) + return; // we run in our native session, no need to wrap + } else { + return; // we run in our native session, no need to wrap + } + } + } + TQString wrapper = TDEStandardDirs::findExe( "trinity" ); + TQStringList restartCommand = sm.restartCommand(); + restartCommand.prepend( wrapper ); + sm.setRestartCommand( restartCommand ); +} + +void TDEApplication::saveState( TQSessionManager& sm ) +{ + d->session_save = true; +#ifdef Q_WS_X11 + static bool firstTime = true; + mySmcConnection = (SmcConn) sm.handle(); + + if ( !bSessionManagement ) { + sm.setRestartHint( TQSessionManager::RestartNever ); + d->session_save = false; + return; + } + else + sm.setRestartHint( TQSessionManager::RestartIfRunning ); + + if ( firstTime ) { + firstTime = false; + d->session_save = false; + return; // no need to save the state. + } + + // remove former session config if still existing, we want a new + // and fresh one. Note that we do not delete the config file here, + // this is done by the session manager when it executes the + // discard commands. In fact it would be harmful to remove the + // file here, as the session might be stored under a different + // name, meaning the user still might need it eventually. + if ( pSessionConfig ) { + delete pSessionConfig; + pSessionConfig = 0; + } + + // tell the session manager about our new lifecycle + TQStringList restartCommand = sm.restartCommand(); + + TQCString multiHead = getenv("TDE_MULTIHEAD"); + if (multiHead.lower() == "true") { + // if multihead is enabled, we save our -display argument so that + // we are restored onto the correct head... one problem with this + // is that the display is hard coded, which means we cannot restore + // to a different display (ie. if we are in a university lab and try, + // try to restore a multihead session, our apps could be started on + // someone else's display instead of our own) + TQCString displayname = getenv(DISPLAY); + if (! displayname.isNull()) { + // only store the command if we actually have a DISPLAY + // environment variable + restartCommand.append("-display"); + restartCommand.append(displayname); + } + sm.setRestartCommand( restartCommand ); + } + + checkRestartVersion( sm ); + + // finally: do session management + emit saveYourself(); // for compatibility + bool canceled = false; + for (KSessionManaged* it = sessionClients()->first(); + it && !canceled; + it = sessionClients()->next() ) { + canceled = !it->saveState( sm ); + } + + // if we created a new session config object, register a proper discard command + if ( pSessionConfig ) { + pSessionConfig->sync(); + TQStringList discard; + discard << "rm" << locateLocal("config", sessionConfigName()); + sm.setDiscardCommand( discard ); + } else { + sm.setDiscardCommand( TQStringList("") ); + } + + if ( canceled ) + sm.cancel(); +#else + // FIXME(E): Implement for Qt Embedded +#endif + d->session_save = false; +} + +bool TDEApplication::sessionSaving() const +{ + return d->session_save; +} + +void TDEApplication::startKdeinit() +{ +#ifndef Q_WS_WIN //TODO + TDEInstance inst( "starttdeinitlock" ); + TDELockFile lock( locateLocal( "tmp", "starttdeinitlock", &inst )); + if( lock.lock( TDELockFile::LockNoBlock ) != TDELockFile::LockOK ) { + lock.lock(); + DCOPClient cl; + if( cl.attach()) + return; // whoever held the lock has already started dcopserver + } + // Try to launch tdeinit. + TQString srv = TDEStandardDirs::findExe(TQString::fromLatin1("tdeinit")); + if (srv.isEmpty()) + srv = TDEStandardDirs::findExe(TQString::fromLatin1("tdeinit"), TDEGlobal::dirs()->kfsstnd_defaultbindir()); + if (srv.isEmpty()) + return; + if (kapp && (Tty != kapp->type())) + setOverrideCursor( tqwaitCursor ); + my_system(TQFile::encodeName(srv)+" --suicide"+" --new-startup"); + if (kapp && (Tty != kapp->type())) + restoreOverrideCursor(); +#endif +} + +void TDEApplication::dcopFailure(const TQString &msg) +{ + static int failureCount = 0; + failureCount++; + if (failureCount == 1) + { + startKdeinit(); + return; + } + if (failureCount == 2) + { +#ifdef Q_WS_WIN + TDEGlobal::config()->setGroup("General"); + if (TDEGlobal::config()->readBoolEntry("ignoreDCOPFailures", false)) + return; +#endif + TQString msgStr(i18n("There was an error setting up inter-process " + "communications for TDE. The message returned " + "by the system was:\n\n")); + msgStr += msg; + msgStr += i18n("\n\nPlease check that the \"dcopserver\" program is running!"); + + if (Tty != kapp->type()) + { + TQMessageBox::critical + ( + kapp->mainWidget(), + i18n("DCOP communications error (%1)").arg(kapp->caption()), + msgStr, + i18n("&OK") + ); + } + else + { + fprintf(stderr, "%s\n", msgStr.local8Bit().data()); + } + + return; + } +} + +static const TDECmdLineOptions qt_options[] = +{ + //FIXME: Check if other options are specific to Qt/X11 +#ifdef Q_WS_X11 + { "display <displayname>", I18N_NOOP("Use the X-server display 'displayname'"), 0}, +#else + { "display <displayname>", I18N_NOOP("Use the QWS display 'displayname'"), 0}, +#endif + { "session <sessionId>", I18N_NOOP("Restore the application for the given 'sessionId'"), 0}, + { "cmap", I18N_NOOP("Causes the application to install a private color\nmap on an 8-bit display"), 0}, + { "ncols <count>", I18N_NOOP("Limits the number of colors allocated in the color\ncube on an 8-bit display, if the application is\nusing the TQApplication::ManyColor color\nspecification"), 0}, + { "nograb", I18N_NOOP("tells Qt to never grab the mouse or the keyboard"), 0}, + { "dograb", I18N_NOOP("running under a debugger can cause an implicit\n-nograb, use -dograb to override"), 0}, + { "sync", I18N_NOOP("switches to synchronous mode for debugging"), 0}, + { "fn", 0, 0}, + { "font <fontname>", I18N_NOOP("defines the application font"), 0}, + { "bg", 0, 0}, + { "background <color>", I18N_NOOP("sets the default background color and an\napplication palette (light and dark shades are\ncalculated)"), 0}, + { "fg", 0, 0}, + { "foreground <color>", I18N_NOOP("sets the default foreground color"), 0}, + { "btn", 0, 0}, + { "button <color>", I18N_NOOP("sets the default button color"), 0}, + { "name <name>", I18N_NOOP("sets the application name"), 0}, + { "title <title>", I18N_NOOP("sets the application title (caption)"), 0}, +#ifdef Q_WS_X11 + { "visual TrueColor", I18N_NOOP("forces the application to use a TrueColor visual on\nan 8-bit display"), 0}, + { "inputstyle <inputstyle>", I18N_NOOP("sets XIM (X Input Method) input style. Possible\nvalues are onthespot, overthespot, offthespot and\nroot"), 0 }, + { "im <XIM server>", I18N_NOOP("set XIM server"),0}, + { "noxim", I18N_NOOP("disable XIM"), 0 }, +#endif +#ifdef Q_WS_QWS + { "qws", I18N_NOOP("forces the application to run as QWS Server"), 0}, +#endif + { "reverse", I18N_NOOP("mirrors the whole layout of widgets"), 0}, + TDECmdLineLastOption +}; + +static const TDECmdLineOptions kde_options[] = +{ + { "caption <caption>", I18N_NOOP("Use 'caption' as name in the titlebar"), 0}, + { "icon <icon>", I18N_NOOP("Use 'icon' as the application icon"), 0}, + { "miniicon <icon>", I18N_NOOP("Use 'icon' as the icon in the titlebar"), 0}, + { "config <filename>", I18N_NOOP("Use alternative configuration file"), 0}, + { "dcopserver <server>", I18N_NOOP("Use the DCOP Server specified by 'server'"), 0}, + { "nocrashhandler", I18N_NOOP("Disable crash handler, to get core dumps"), 0}, + { "waitforwm", I18N_NOOP("Waits for a WM_NET compatible windowmanager"), 0}, + { "style <style>", I18N_NOOP("sets the application GUI style"), 0}, + { "geometry <geometry>", I18N_NOOP("sets the client geometry of the main widget - see man X for the argument format"), 0}, + { "smkey <sessionKey>", 0, 0}, // this option is obsolete and exists only to allow smooth upgrades from sessions + // saved under Qt 3.0.x -- Qt 3.1.x includes the session key now automatically in + // the session id (Simon) + TDECmdLineLastOption +}; + +void +TDEApplication::addCmdLineOptions() +{ + TDECmdLineArgs::addCmdLineOptions(qt_options, "Qt", "qt"); + TDECmdLineArgs::addCmdLineOptions(kde_options, "TDE", "tde"); +} + +void TDEApplication::parseCommandLine( ) +{ + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs("tde"); + + if ( !args ) return; + + if (args->isSet("config")) + { + TQString config = TQString::fromLocal8Bit(args->getOption("config")); + setConfigName(config); + } + + if (args->isSet("style")) + { + + TQStringList plugins = TDEGlobal::dirs()->resourceDirs( "qtplugins" ); + TQStringList::Iterator itp = plugins.begin(); + while (itp != plugins.end()) { + addLibraryPath( *itp ); + ++itp; + } + + TQStringList styles = TQStyleFactory::keys(); + TQString reqStyle(args->getOption("style").lower()); + + TQStringList list = libraryPaths(); + TQStringList::Iterator it = list.begin(); + while( it != list.end() ) { + ++it; + } + + for (TQStringList::ConstIterator it = styles.begin(); it != styles.end(); ++it) { + if ((*it).lower() == reqStyle) + { + d->overrideStyle = *it; + break; + } + } + + if (d->overrideStyle.isEmpty()) + fprintf(stderr, "%s", TQString(i18n("The style %1 was not found\n").arg(reqStyle)).local8Bit().data()); + } + + if (args->isSet("caption")) + { + aCaption = TQString::fromLocal8Bit(args->getOption("caption")); + } + + if (args->isSet("miniicon")) + { + const char *tmp = args->getOption("miniicon"); + if (!aIconPixmap.pm.miniIcon) { + aIconPixmap.pm.miniIcon = new TQPixmap; + } + *aIconPixmap.pm.miniIcon = SmallIcon(tmp); + aMiniIconName = tmp; + } + + if (args->isSet("icon")) + { + const char *tmp = args->getOption("icon"); + if (!aIconPixmap.pm.icon) { + aIconPixmap.pm.icon = new TQPixmap; + } + *aIconPixmap.pm.icon = DesktopIcon( tmp ); + aIconName = tmp; + if (!aIconPixmap.pm.miniIcon) { + aIconPixmap.pm.miniIcon = new TQPixmap; + } + if (aIconPixmap.pm.miniIcon->isNull()) + { + *aIconPixmap.pm.miniIcon = SmallIcon( tmp ); + aMiniIconName = tmp; + } + } + + bool nocrashhandler = (getenv("TDE_DEBUG") != NULL); + if (!nocrashhandler && args->isSet("crashhandler")) + { + // set default crash handler / set emergency save function to nothing + TDECrash::setCrashHandler(TDECrash::defaultCrashHandler); + TDECrash::setEmergencySaveFunction(NULL); + + TDECrash::setApplicationName(TQString(args->appName())); + } + +#ifdef Q_WS_X11 + if ( args->isSet( "waitforwm" ) ) { + Atom type; + (void) desktop(); // trigger desktop creation, we need PropertyNotify events for the root window + int format; + unsigned long length, after; + unsigned char *data; + while ( XGetWindowProperty( tqt_xdisplay(), tqt_xrootwin(), atom_NetSupported, + 0, 1, false, AnyPropertyType, &type, &format, + &length, &after, &data ) != Success || !length ) { + if ( data ) + XFree( data ); + XEvent event; + XWindowEvent( tqt_xdisplay(), tqt_xrootwin(), PropertyChangeMask, &event ); + } + if ( data ) + XFree( data ); + } +#else + // FIXME(E): Implement for Qt Embedded +#endif + + if (args->isSet("geometry")) + { + d->geometry_arg = args->getOption("geometry"); + } + + if (args->isSet("smkey")) + { + d->sessionKey = args->getOption("smkey"); + } + +} + +TQString TDEApplication::geometryArgument() const +{ + return d->geometry_arg; +} + +TQPixmap TDEApplication::icon() const +{ + if( !aIconPixmap.pm.icon) { + aIconPixmap.pm.icon = new TQPixmap; + } + if( aIconPixmap.pm.icon->isNull()) { + *aIconPixmap.pm.icon = DesktopIcon( instanceName() ); + } + return *aIconPixmap.pm.icon; +} + +TQString TDEApplication::iconName() const +{ + return aIconName.isNull() ? (TQString)instanceName() : aIconName; +} + +TQPixmap TDEApplication::miniIcon() const +{ + if (!aIconPixmap.pm.miniIcon) { + aIconPixmap.pm.miniIcon = new TQPixmap; + } + if (aIconPixmap.pm.miniIcon->isNull()) { + *aIconPixmap.pm.miniIcon = SmallIcon( instanceName() ); + } + return *aIconPixmap.pm.miniIcon; +} + +TQString TDEApplication::miniIconName() const +{ + return aMiniIconName.isNull() ? (TQString)instanceName() : aMiniIconName; +} + +extern void kDebugCleanup(); + +TDEApplication::~TDEApplication() +{ + delete aIconPixmap.pm.miniIcon; + aIconPixmap.pm.miniIcon = 0L; + delete aIconPixmap.pm.icon; + aIconPixmap.pm.icon = 0L; + delete d->m_KAppDCOPInterface; + + // First call the static deleters and then call KLibLoader::cleanup() + // The static deleters may delete libraries for which they need KLibLoader. + // KLibLoader will take care of the remaining ones. + TDEGlobal::deleteStaticDeleters(); + KLibLoader::cleanUp(); + + delete smw; + + // close down IPC + delete s_DCOPClient; + s_DCOPClient = 0L; + + TDEProcessController::deref(); + +#ifdef Q_WS_X11 + if ( d->oldXErrorHandler != NULL ) + XSetErrorHandler( d->oldXErrorHandler ); + if ( d->oldXIOErrorHandler != NULL ) + XSetIOErrorHandler( d->oldXIOErrorHandler ); + if ( d->oldIceIOErrorHandler != NULL ) + IceSetIOErrorHandler( d->oldIceIOErrorHandler ); +#endif + + delete d; + KApp = 0; + +#ifdef Q_WS_X11 + mySmcConnection = 0; + delete smModificationTime; + smModificationTime = 0; + + // close the temporary smc connection + if (tmpSmcConnection) { + SmcCloseConnection( tmpSmcConnection, 0, 0 ); + tmpSmcConnection = 0; + } +#else + // FIXME(E): Implement for Qt Embedded +#endif +} + + +#ifdef Q_WS_X11 +class KAppX11HackWidget: public TQWidget +{ +public: + bool publicx11Event( XEvent * e) { return x11Event( e ); } +}; +#endif + +#if defined(Q_WS_X11) && defined(COMPOSITE) +bool TDEApplication::isCompositionManagerAvailable() { + bool have_manager = false; + const char *home; + struct passwd *p; + p = getpwuid(getuid()); + if (p) + home = p->pw_dir; + else + home = getenv("HOME"); + + char *filename; + const char *configfile = "/.kompmgr.available"; + int n = strlen(home)+strlen(configfile)+1; + filename = (char*)malloc(n*sizeof(char)); + memset(filename,0,n); + strcat(filename, home); + strcat(filename, configfile); + + // Now that we did all that by way of introduction...read the file! + FILE *pFile; + pFile = fopen(filename, "r"); + if (pFile) { + have_manager = true; + fclose(pFile); + } + + free(filename); + filename = NULL; + + return have_manager; +} + +bool TDEApplication::detectCompositionManagerAvailable(bool force_available, bool available) { + bool compositing_manager_available; + if (force_available) { + compositing_manager_available = available; + } + else { + // See if compositing has been enabled + TDECmdLineArgs *qtargs = TDECmdLineArgs::parsedArgs("qt"); + char *displayname = 0; + if ( qtargs->isSet("display")) + displayname = qtargs->getOption( "display" ).data(); + + Display *dpy = XOpenDisplay( displayname ); + + x11_composite_error_generated = false; + compositing_manager_available = false; + XSetErrorHandler(x11_error); + if (!XQueryExtension (dpy, COMPOSITE_NAME, &composite_opcode, &composite_event, &composite_error)) { + XSetErrorHandler(NULL); + compositing_manager_available = false; + } + else { + if (available) { // FIXME This variable does double duty to avoid breaking the ABI for R14.0. In reality it should be called perform_deep_check + Window root_window = XDefaultRootWindow(dpy); + XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual); + XSync(dpy, false); + if (x11_composite_error_generated == true) { + compositing_manager_available = true; + } + else { + XCompositeUnredirectSubwindows(dpy, root_window, CompositeRedirectManual); + compositing_manager_available = false; + } + XSetErrorHandler(NULL); + XCloseDisplay(dpy); + } + else { + compositing_manager_available = true; + } + } + } + + const char *home; + struct passwd *p; + p = getpwuid(getuid()); + if (p) + home = p->pw_dir; + else + home = getenv("HOME"); + + char *filename; + const char *configfile = "/.kompmgr.available"; + int n = strlen(home)+strlen(configfile)+1; + filename = (char*)malloc(n*sizeof(char)); + memset(filename,0,n); + strcat(filename, home); + strcat(filename, configfile); + + /* now that we did all that by way of introduction...create or remove the file! */ + if (compositing_manager_available) { + FILE *pFile; + char buffer[255]; + sprintf(buffer, "available"); + pFile = fopen(filename, "w"); + if (pFile) { + fwrite(buffer,1,strlen(buffer), pFile); + fclose(pFile); + } + } + else { + unlink(filename); + } + + free(filename); + filename = NULL; + + return compositing_manager_available; +} + +Display* TDEApplication::openX11RGBADisplay() { + TDECmdLineArgs *qtargs = TDECmdLineArgs::parsedArgs("qt"); + char *display = 0; + if ( qtargs->isSet("display")) + display = qtargs->getOption( "display" ).data(); + + Display *dpy = XOpenDisplay( display ); + if ( !dpy ) { + kdError() << "cannot connect to X server " << display << endl; + exit( 1 ); + } + + return dpy; +} + +Qt::HANDLE TDEApplication::getX11RGBAVisual(Display *dpy) { + getX11RGBAInformation(dpy); + if (TDEApplication::isCompositionManagerAvailable() == true) { + return argb_x11_visual; + } + else { + return (Qt::HANDLE)NULL; + } +} + +Qt::HANDLE TDEApplication::getX11RGBAColormap(Display *dpy) { + getX11RGBAInformation(dpy); + if (TDEApplication::isCompositionManagerAvailable() == true) { + return argb_x11_colormap; + } + else { + return (Qt::HANDLE)NULL; + } +} + +bool TDEApplication::isX11CompositionAvailable() { + return (argb_visual & isCompositionManagerAvailable()); +} + +void TDEApplication::getX11RGBAInformation(Display *dpy) { + if ( !dpy ) { + argb_visual = false; + return; + } + + int screen = DefaultScreen( dpy ); + Colormap colormap = 0; + Visual *visual = 0; + int event_base, error_base; + + if ( XRenderQueryExtension( dpy, &event_base, &error_base ) ) { + int nvi; + XVisualInfo templ; + templ.screen = screen; + templ.depth = 32; + templ.c_class = TrueColor; + XVisualInfo *xvi = XGetVisualInfo( dpy, VisualScreenMask | VisualDepthMask + | VisualClassMask, &templ, &nvi ); + + for ( int i = 0; i < nvi; i++ ) { + XRenderPictFormat *format = XRenderFindVisualFormat( dpy, xvi[i].visual ); + if ( format->type == PictTypeDirect && format->direct.alphaMask ) { + visual = xvi[i].visual; + colormap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, AllocNone ); + kdDebug() << "found visual with alpha support" << endl; + argb_visual = true; + break; + } + } + } + + if( argb_visual ) { + argb_x11_visual = Qt::HANDLE( visual ); + argb_x11_colormap = Qt::HANDLE( colormap ); + argb_visual = true; + return; + } + argb_visual = false; + return; +} +#else +void TDEApplication::getX11RGBAInformation(Display *dpy) { +} + +bool TDEApplication::isCompositionManagerAvailable() { + return false; +} + +bool TDEApplication::detectCompositionManagerAvailable(bool force_available) { + const char *home; + struct passwd *p; + p = getpwuid(getuid()); + if (p) + home = p->pw_dir; + else + home = getenv("HOME"); + + char *filename; + const char *configfile = "/.kompmgr.available"; + int n = strlen(home)+strlen(configfile)+1; + filename = (char*)malloc(n*sizeof(char)); + memset(filename,0,n); + strcat(filename, home); + strcat(filename, configfile); + + /* now that we did all that by way of introduction...create or remove the file! */ + if (force_available) { + FILE *pFile; + char buffer[255]; + sprintf(buffer, "available"); + pFile = fopen(filename, "w"); + if (pFile) { + fwrite(buffer,1,strlen(buffer), pFile); + fclose(pFile); + } + } + else { + unlink(filename); + } + + free(filename); + filename = NULL; + + return false; +} + +Display* TDEApplication::openX11RGBADisplay() { + return 0; +} + +Qt::HANDLE TDEApplication::getX11RGBAVisual(char *display) { + return 0; +} + +Qt::HANDLE TDEApplication::getX11RGBAColormap(char *display) { + return 0; +} + +bool TDEApplication::isX11CompositionAvailable() { + return false; +} + +TDEApplication TDEApplication::KARGBApplication( bool allowStyles ) { + return TDEApplication::TDEApplication(allowStyles, true); +} +#endif + +static bool kapp_block_user_input = false; + +void TDEApplication::dcopBlockUserInput( bool b ) +{ + kapp_block_user_input = b; +} + +#ifdef Q_WS_X11 +bool TDEApplication::x11EventFilter( XEvent *_event ) +{ + switch ( _event->type ) { + case ClientMessage: + { +#if KDE_IS_VERSION( 3, 90, 90 ) +#warning This should be already in Qt, check. +#endif + // Workaround for focus stealing prevention not working when dragging e.g. text from KWrite + // to KDesktop -> the dialog asking for filename doesn't get activated. This is because + // Qt-3.2.x doesn't have concept of tqt_x_user_time at all, and Qt-3.3.0b1 passes the timestamp + // in the XdndDrop message in incorrect field (and doesn't update tqt_x_user_time either). + // Patch already sent, future Qt version should have this fixed. + if( _event->xclient.message_type == kde_xdnd_drop ) + { // if the message is XdndDrop + if( _event->xclient.data.l[ 1 ] == 1 << 24 // and it's broken the way it's in Qt-3.2.x + && _event->xclient.data.l[ 2 ] == 0 + && _event->xclient.data.l[ 4 ] == 0 + && _event->xclient.data.l[ 3 ] != 0 ) + { + if( GET_QT_X_USER_TIME() == 0 + || NET::timestampCompare( _event->xclient.data.l[ 3 ], GET_QT_X_USER_TIME() ) > 0 ) + { // and the timestamp looks reasonable + SET_QT_X_USER_TIME(_event->xclient.data.l[ 3 ]); // update our tqt_x_user_time from it + } + } + else // normal DND, only needed until Qt updates tqt_x_user_time from XdndDrop + { + if( GET_QT_X_USER_TIME() == 0 + || NET::timestampCompare( _event->xclient.data.l[ 2 ], GET_QT_X_USER_TIME() ) > 0 ) + { // the timestamp looks reasonable + SET_QT_X_USER_TIME(_event->xclient.data.l[ 2 ]); // update our tqt_x_user_time from it + } + } + } + } + default: break; + } + + if ( kapp_block_user_input ) { + switch ( _event->type ) { + case ButtonPress: + case ButtonRelease: + case XKeyPress: + case XKeyRelease: + case MotionNotify: + case EnterNotify: + case LeaveNotify: + return true; + default: + break; + } + } + + if (x11Filter) { + for (TQWidget *w=x11Filter->first(); w; w=x11Filter->next()) { + if (((KAppX11HackWidget*) w)->publicx11Event(_event)) + return true; + } + } + + if ((_event->type == ClientMessage) && + (_event->xclient.message_type == kipcCommAtom)) + { + XClientMessageEvent *cme = (XClientMessageEvent *) _event; + + int id = cme->data.l[0]; + int arg = cme->data.l[1]; + if ((id < 32) && (kipcEventMask & (1 << id))) + { + switch (id) + { + case KIPC::StyleChanged: + TDEGlobal::config()->reparseConfiguration(); + tdedisplaySetStyle(); + break; + + case KIPC::ToolbarStyleChanged: + TDEGlobal::config()->reparseConfiguration(); + if (useStyles) + emit toolbarAppearanceChanged(arg); + break; + + case KIPC::PaletteChanged: + TDEGlobal::config()->reparseConfiguration(); + tdedisplaySetPalette(); + break; + + case KIPC::FontChanged: + TDEGlobal::config()->reparseConfiguration(); + TDEGlobalSettings::rereadFontSettings(); + tdedisplaySetFont(); + break; + + case KIPC::BackgroundChanged: + emit backgroundChanged(arg); + break; + + case KIPC::SettingsChanged: + TDEGlobal::config()->reparseConfiguration(); + if (arg == SETTINGS_PATHS) + TDEGlobalSettings::rereadPathSettings(); + else if (arg == SETTINGS_MOUSE) + TDEGlobalSettings::rereadMouseSettings(); + propagateSettings((SettingsCategory)arg); + break; + + case KIPC::IconChanged: + TQPixmapCache::clear(); + TDEGlobal::config()->reparseConfiguration(); + TDEGlobal::instance()->newIconLoader(); + emit updateIconLoaders(); + emit iconChanged(arg); + break; + + case KIPC::ClipboardConfigChanged: + TDEClipboardSynchronizer::newConfiguration(arg); + break; + + case KIPC::BlockShortcuts: + TDEGlobalAccel::blockShortcuts(arg); + emit kipcMessage(id, arg); // some apps may do additional things + break; + } + } + else if (id >= 32) + { + emit kipcMessage(id, arg); + } + return true; + } + return false; +} +#endif // Q_WS_X11 + +void TDEApplication::updateUserTimestamp( unsigned long time ) +{ +#if defined Q_WS_X11 + if( time == 0 ) + { // get current X timestamp + Window w = XCreateSimpleWindow( tqt_xdisplay(), tqt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 ); + XSelectInput( tqt_xdisplay(), w, PropertyChangeMask ); + unsigned char data[ 1 ]; + XChangeProperty( tqt_xdisplay(), w, XA_ATOM, XA_ATOM, 8, PropModeAppend, data, 1 ); + XEvent ev; + XWindowEvent( tqt_xdisplay(), w, PropertyChangeMask, &ev ); + time = ev.xproperty.time; + XDestroyWindow( tqt_xdisplay(), w ); + } + if( GET_QT_X_USER_TIME() == 0 + || NET::timestampCompare( time, GET_QT_X_USER_TIME() ) > 0 ) // check time > tqt_x_user_time + SET_QT_X_USER_TIME(time); +#endif +} + +unsigned long TDEApplication::userTimestamp() const +{ +#if defined Q_WS_X11 + return GET_QT_X_USER_TIME(); +#else + return 0; +#endif +} + +void TDEApplication::updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time ) +{ +#if defined Q_WS_X11 + if( time == 0 ) + time = GET_QT_X_USER_TIME(); + DCOPRef( dcopId, "MainApplication-Interface" ).call( "updateUserTimestamp", time ); +#endif +} + +void TDEApplication::invokeEditSlot( const char *slot ) +{ + TQObject *object = TQT_TQOBJECT(focusWidget()); + if( !object ) + return; + + TQMetaObject *meta = object->metaObject(); + + int idx = meta->findSlot( slot + 1, true ); + if( idx < 0 ) + return; + + object->tqt_invoke( idx, 0 ); +} + +void TDEApplication::addKipcEventMask(int id) +{ + if (id >= 32) + { + kdDebug(101) << "Cannot use KIPC event mask for message IDs >= 32\n"; + return; + } + kipcEventMask |= (1 << id); +} + +void TDEApplication::removeKipcEventMask(int id) +{ + if (id >= 32) + { + kdDebug(101) << "Cannot use KIPC event mask for message IDs >= 32\n"; + return; + } + kipcEventMask &= ~(1 << id); +} + +void TDEApplication::enableStyles() +{ + if (!useStyles) + { + useStyles = true; + applyGUIStyle(); + } +} + +void TDEApplication::disableStyles() +{ + useStyles = false; +} + +void TDEApplication::applyGUIStyle() +{ + if ( !useStyles ) return; + + TDEConfigGroup pConfig (TDEGlobal::config(), "General"); + TQString defaultStyle = TDEStyle::defaultStyle(); + TQString styleStr = pConfig.readEntry("widgetStyle", defaultStyle); + + if (d->overrideStyle.isEmpty()) { + // ### add check whether we already use the correct style to return then + // (workaround for Qt misbehavior to avoid double style initialization) + + TQStyle* sp = TQStyleFactory::create( styleStr ); + + // If there is no default style available, try falling back any available style + if ( !sp && styleStr != defaultStyle) + sp = TQStyleFactory::create( defaultStyle ); + if ( !sp ) + sp = TQStyleFactory::create( *(TQStyleFactory::keys().begin()) ); + setStyle(sp); + } + else + setStyle(d->overrideStyle); + // Reread palette from config file. + tdedisplaySetPalette(); +} + +TQString TDEApplication::caption() const +{ + // Caption set from command line ? + if( !aCaption.isNull() ) + return aCaption; + else + // We have some about data ? + if ( TDEGlobal::instance()->aboutData() ) + return TDEGlobal::instance()->aboutData()->programName(); + else + // Last resort : application name + return name(); +} + + +// +// 1999-09-20: Espen Sand +// An attempt to simplify consistent captions. +// +TQString TDEApplication::makeStdCaption( const TQString &userCaption, + bool withAppName, bool modified ) const +{ + TQString s = userCaption.isEmpty() ? caption() : userCaption; + + // If the document is modified, add '[modified]'. + if (modified) + s += TQString::fromUtf8(" [") + i18n("modified") + TQString::fromUtf8("]"); + + if ( !userCaption.isEmpty() ) { + // Add the application name if: + // User asked for it, it's not a duplication and the app name (caption()) is not empty + if ( withAppName && !caption().isNull() && !userCaption.endsWith(caption()) ) + s += TQString::fromUtf8(" - ") + caption(); + } + + return s; +} + +TQPalette TDEApplication::createApplicationPalette() +{ + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "General" ); + return createApplicationPalette( config, TDEGlobalSettings::contrast() ); +} + +TQPalette TDEApplication::createApplicationPalette( TDEConfig *config, int contrast_ ) +{ + TQColor trinity4Background( 239, 239, 239 ); + TQColor trinity4Blue( 103,141,178 ); + + TQColor trinity4Button; + if ( TQPixmap::defaultDepth() > 8 ) + trinity4Button.setRgb( 221, 223, 228 ); + else + trinity4Button.setRgb( 220, 220, 220 ); + + TQColor trinity4Link( 0, 0, 238 ); + TQColor trinity4VisitedLink( 82, 24, 139 ); + + TQColor background = config->readColorEntry( "background", &trinity4Background ); + TQColor foreground = config->readColorEntry( "foreground", tqblackptr ); + TQColor button = config->readColorEntry( "buttonBackground", &trinity4Button ); + TQColor buttonText = config->readColorEntry( "buttonForeground", tqblackptr ); + TQColor highlight = config->readColorEntry( "selectBackground", &trinity4Blue ); + TQColor highlightedText = config->readColorEntry( "selectForeground", tqwhiteptr ); + TQColor base = config->readColorEntry( "windowBackground", tqwhiteptr ); + TQColor baseText = config->readColorEntry( "windowForeground", tqblackptr ); + TQColor link = config->readColorEntry( "linkColor", &trinity4Link ); + TQColor visitedLink = config->readColorEntry( "visitedLinkColor", &trinity4VisitedLink ); + + int highlightVal, lowlightVal; + highlightVal = 100 + (2*contrast_+4)*16/10; + lowlightVal = 100 + (2*contrast_+4)*10; + + TQColor disfg = foreground; + + int h, s, v; + disfg.hsv( &h, &s, &v ); + if (v > 128) + // dark bg, light fg - need a darker disabled fg + disfg = disfg.dark(lowlightVal); + else if (disfg != Qt::black) + // light bg, dark fg - need a lighter disabled fg - but only if !black + disfg = disfg.light(highlightVal); + else + // black fg - use darkgray disabled fg + disfg = Qt::darkGray; + + + TQColorGroup disabledgrp(disfg, background, + background.light(highlightVal), + background.dark(lowlightVal), + background.dark(120), + background.dark(120), base); + + TQColorGroup colgrp(foreground, background, background.light(highlightVal), + background.dark(lowlightVal), + background.dark(120), + baseText, base); + + int inlowlightVal = lowlightVal-25; + if(inlowlightVal < 120) + inlowlightVal = 120; + + colgrp.setColor(TQColorGroup::Highlight, highlight); + colgrp.setColor(TQColorGroup::HighlightedText, highlightedText); + colgrp.setColor(TQColorGroup::Button, button); + colgrp.setColor(TQColorGroup::ButtonText, buttonText); + colgrp.setColor(TQColorGroup::Midlight, background.light(110)); + colgrp.setColor(TQColorGroup::Link, link); + colgrp.setColor(TQColorGroup::LinkVisited, visitedLink); + + disabledgrp.setColor(TQColorGroup::Button, button); + + TQColor disbtntext = buttonText; + disbtntext.hsv( &h, &s, &v ); + if (v > 128) + // dark button, light buttonText - need a darker disabled buttonText + disbtntext = disbtntext.dark(lowlightVal); + else if (disbtntext != Qt::black) + // light buttonText, dark button - need a lighter disabled buttonText - but only if !black + disbtntext = disbtntext.light(highlightVal); + else + // black button - use darkgray disabled buttonText + disbtntext = Qt::darkGray; + + disabledgrp.setColor(TQColorGroup::ButtonText, disbtntext); + disabledgrp.setColor(TQColorGroup::Midlight, background.light(110)); + disabledgrp.setColor(TQColorGroup::Highlight, highlight.dark(120)); + disabledgrp.setColor(TQColorGroup::Link, link); + disabledgrp.setColor(TQColorGroup::LinkVisited, visitedLink); + + return TQPalette(colgrp, disabledgrp, colgrp); +} + + +void TDEApplication::tdedisplaySetPalette() +{ +#ifdef Q_WS_MACX + //Can I have this on other platforms, please!? --Sam + { + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "General" ); + bool do_not_set_palette = FALSE; + if(config->readBoolEntry("nopaletteChange", &do_not_set_palette)) + return; + } +#endif + TQApplication::setPalette( createApplicationPalette(), true); + emit tdedisplayPaletteChanged(); + emit appearanceChanged(); +} + + +void TDEApplication::tdedisplaySetFont() +{ + TQApplication::setFont(TDEGlobalSettings::generalFont(), true); + TQApplication::setFont(TDEGlobalSettings::menuFont(), true, TQMENUBAR_OBJECT_NAME_STRING); + TQApplication::setFont(TDEGlobalSettings::menuFont(), true, TQPOPUPMENU_OBJECT_NAME_STRING); + TQApplication::setFont(TDEGlobalSettings::menuFont(), true, "TDEPopupTitle"); + + // "patch" standard TQStyleSheet to follow our fonts + TQStyleSheet* sheet = TQStyleSheet::defaultSheet(); + sheet->item ("pre")->setFontFamily (TDEGlobalSettings::fixedFont().family()); + sheet->item ("code")->setFontFamily (TDEGlobalSettings::fixedFont().family()); + sheet->item ("tt")->setFontFamily (TDEGlobalSettings::fixedFont().family()); + + emit tdedisplayFontChanged(); + emit appearanceChanged(); +} + + +void TDEApplication::tdedisplaySetStyle() +{ + if (useStyles) + { + applyGUIStyle(); + emit tdedisplayStyleChanged(); + emit appearanceChanged(); + } +} + + +void TDEApplication::propagateSettings(SettingsCategory arg) +{ + TDEConfigBase* config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "KDE" ); + +#ifdef QT_HAVE_MAX_IMAGE_SIZE + TQSize maxImageSize(4096, 4096); + maxImageSize = config->readSizeEntry("MaxImageSize", &maxImageSize); + TQImage::setMaxImageSize(maxImageSize); +#endif + + int num = config->readNumEntry("CursorBlinkRate", TQApplication::cursorFlashTime()); + if ((num != 0) && (num < 200)) + num = 200; + if (num > 2000) + num = 2000; + TQApplication::setCursorFlashTime(num); + num = config->readNumEntry("DoubleClickInterval", TQApplication::doubleClickInterval()); + TQApplication::setDoubleClickInterval(num); + num = config->readNumEntry("StartDragTime", TQApplication::startDragTime()); + TQApplication::setStartDragTime(num); + num = config->readNumEntry("StartDragDist", TQApplication::startDragDistance()); + TQApplication::setStartDragDistance(num); + num = config->readNumEntry("WheelScrollLines", TQApplication::wheelScrollLines()); + TQApplication::setWheelScrollLines(num); + + bool b = config->readBoolEntry("EffectAnimateMenu", false); + TQApplication::setEffectEnabled( Qt::UI_AnimateMenu, b); + b = config->readBoolEntry("EffectFadeMenu", false); + TQApplication::setEffectEnabled( Qt::UI_FadeMenu, b); + b = config->readBoolEntry("EffectAnimateCombo", false); + TQApplication::setEffectEnabled( Qt::UI_AnimateCombo, b); + b = config->readBoolEntry("EffectAnimateTooltip", false); + TQApplication::setEffectEnabled( Qt::UI_AnimateTooltip, b); + b = config->readBoolEntry("EffectFadeTooltip", false); + TQApplication::setEffectEnabled( Qt::UI_FadeTooltip, b); + b = !config->readBoolEntry("EffectNoTooltip", false); + TQToolTip::setGloballyEnabled( b ); + + emit settingsChanged(arg); +} + +void TDEApplication::installKDEPropertyMap() +{ +#ifndef QT_NO_SQL + static bool installed = false; + if (installed) return; + installed = true; + /** + * If you are adding a widget that was missing please + * make sure to also add it to TDEConfigDialogManager's retrieveSettings() + * function. + * Thanks. + */ + // TQSqlPropertyMap takes ownership of the new default map. + TQSqlPropertyMap *kdeMap = new TQSqlPropertyMap; + kdeMap->insert( "KColorButton", "color" ); + kdeMap->insert( "KComboBox", "currentItem" ); + kdeMap->insert( "KDatePicker", "date" ); + kdeMap->insert( "KDateWidget", "date" ); + kdeMap->insert( "KDateTimeWidget", "dateTime" ); + kdeMap->insert( "KEditListBox", "items" ); + kdeMap->insert( "TDEFontCombo", "family" ); + kdeMap->insert( "TDEFontRequester", "font" ); + kdeMap->insert( "TDEFontChooser", "font" ); + kdeMap->insert( "KHistoryCombo", "currentItem" ); + kdeMap->insert( "TDEListBox", "currentItem" ); + kdeMap->insert( "KLineEdit", "text" ); + kdeMap->insert( "KRestrictedLine", "text" ); + kdeMap->insert( "KSqueezedTextLabel", "text" ); + kdeMap->insert( "KTextBrowser", "source" ); + kdeMap->insert( "KTextEdit", "text" ); + kdeMap->insert( "KURLRequester", "url" ); + kdeMap->insert( "KPasswordEdit", "password" ); + kdeMap->insert( "KIntNumInput", "value" ); + kdeMap->insert( "KIntSpinBox", "value" ); + kdeMap->insert( "KDoubleNumInput", "value" ); + // Temp til fixed in QT then enable ifdef with the correct version num + kdeMap->insert( TQGROUPBOX_OBJECT_NAME_STRING, "checked" ); + kdeMap->insert( TQTABWIDGET_OBJECT_NAME_STRING, "currentPage" ); + TQSqlPropertyMap::installDefaultMap( kdeMap ); +#endif +} + +void TDEApplication::invokeHelp( const TQString& anchor, + const TQString& _appname) const +{ + return invokeHelp( anchor, _appname, "" ); +} + +#ifndef Q_WS_WIN +// for win32 we're using simple help tools like Qt Assistant, +// see kapplication_win.cpp +void TDEApplication::invokeHelp( const TQString& anchor, + const TQString& _appname, + const TQCString& startup_id ) const +{ + TQString url; + TQString appname; + if (_appname.isEmpty()) + appname = name(); + else + appname = _appname; + + if (!anchor.isEmpty()) + url = TQString("help:/%1?anchor=%2").arg(appname).arg(anchor); + else + url = TQString("help:/%1/index.html").arg(appname); + + TQString error; + if ( !dcopClient()->isApplicationRegistered("khelpcenter") ) + { + if (startServiceByDesktopName("khelpcenter", url, &error, 0, 0, startup_id, false)) + { + if (Tty != kapp->type()) + TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Help Center"), + i18n("Could not launch the TDE Help Center:\n\n%1").arg(error), i18n("&OK")); + else + kdWarning() << "Could not launch help:\n" << error << endl; + return; + } + } + else + DCOPRef( "khelpcenter", "KHelpCenterIface" ).send( "openUrl", url, startup_id ); +} +#endif + +void TDEApplication::invokeHTMLHelp( const TQString& _filename, const TQString& topic ) const +{ + kdWarning() << "invoking HTML help is deprecated! use docbook and invokeHelp!\n"; + + TQString filename; + + if( _filename.isEmpty() ) + filename = TQString(name()) + "/index.html"; + else + filename = _filename; + + TQString url; + if (!topic.isEmpty()) + url = TQString("help:/%1#%2").arg(filename).arg(topic); + else + url = TQString("help:/%1").arg(filename); + + TQString error; + if ( !dcopClient()->isApplicationRegistered("khelpcenter") ) + { + if (startServiceByDesktopName("khelpcenter", url, &error, 0, 0, "", false)) + { + if (Tty != kapp->type()) + TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Help Center"), + i18n("Could not launch the TDE Help Center:\n\n%1").arg(error), i18n("&OK")); + else + kdWarning() << "Could not launch help:\n" << error << endl; + return; + } + } + else + DCOPRef( "khelpcenter", "KHelpCenterIface" ).send( "openUrl", url ); +} + + +void TDEApplication::invokeMailer(const TQString &address, const TQString &subject) +{ + return invokeMailer(address,subject,""); +} + +void TDEApplication::invokeMailer(const TQString &address, const TQString &subject, const TQCString& startup_id) +{ + invokeMailer(address, TQString::null, TQString::null, subject, TQString::null, TQString::null, + TQStringList(), startup_id ); +} + +void TDEApplication::invokeMailer(const KURL &mailtoURL) +{ + return invokeMailer( mailtoURL, "" ); +} + +void TDEApplication::invokeMailer(const KURL &mailtoURL, const TQCString& startup_id ) +{ + return invokeMailer( mailtoURL, startup_id, false); +} + +void TDEApplication::invokeMailer(const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments ) +{ + TQString address = KURL::decode_string(mailtoURL.path()), subject, cc, bcc, body; + TQStringList queries = TQStringList::split('&', mailtoURL.query().mid(1)); + TQStringList attachURLs; + for (TQStringList::Iterator it = queries.begin(); it != queries.end(); ++it) + { + TQString q = (*it).lower(); + if (q.startsWith("subject=")) + subject = KURL::decode_string((*it).mid(8)); + else + if (q.startsWith("cc=")) + cc = cc.isEmpty()? KURL::decode_string((*it).mid(3)): cc + ',' + KURL::decode_string((*it).mid(3)); + else + if (q.startsWith("bcc=")) + bcc = bcc.isEmpty()? KURL::decode_string((*it).mid(4)): bcc + ',' + KURL::decode_string((*it).mid(4)); + else + if (q.startsWith("body=")) + body = KURL::decode_string((*it).mid(5)); + else + if (allowAttachments && q.startsWith("attach=")) + attachURLs.push_back(KURL::decode_string((*it).mid(7))); + else + if (allowAttachments && q.startsWith("attachment=")) + attachURLs.push_back(KURL::decode_string((*it).mid(11))); + else + if (q.startsWith("to=")) + address = address.isEmpty()? KURL::decode_string((*it).mid(3)): address + ',' + KURL::decode_string((*it).mid(3)); + } + + invokeMailer( address, cc, bcc, subject, body, TQString::null, attachURLs, startup_id ); +} + +void TDEApplication::invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc, + const TQString &subject, const TQString &body, + const TQString & messageFile, const TQStringList &attachURLs) +{ + return invokeMailer(to,cc,bcc,subject,body,messageFile,attachURLs,""); +} + +#ifndef Q_WS_WIN +// on win32, for invoking browser we're using win32 API +// see kapplication_win.cpp + +static TQStringList splitEmailAddressList( const TQString & aStr ) +{ + // This is a copy of KPIM::splitEmailAddrList(). + // Features: + // - always ignores quoted characters + // - ignores everything (including parentheses and commas) + // inside quoted strings + // - supports nested comments + // - ignores everything (including double quotes and commas) + // inside comments + + TQStringList list; + + if (aStr.isEmpty()) + return list; + + TQString addr; + uint addrstart = 0; + int commentlevel = 0; + bool insidequote = false; + + for (uint index=0; index<aStr.length(); index++) { + // the following conversion to latin1 is o.k. because + // we can safely ignore all non-latin1 characters + switch (aStr[index].latin1()) { + case '"' : // start or end of quoted string + if (commentlevel == 0) + insidequote = !insidequote; + break; + case '(' : // start of comment + if (!insidequote) + commentlevel++; + break; + case ')' : // end of comment + if (!insidequote) { + if (commentlevel > 0) + commentlevel--; + else { + //kdDebug() << "Error in address splitting: Unmatched ')'" + // << endl; + return list; + } + } + break; + case '\\' : // quoted character + index++; // ignore the quoted character + break; + case ',' : + if (!insidequote && (commentlevel == 0)) { + addr = aStr.mid(addrstart, index-addrstart); + if (!addr.isEmpty()) + list += addr.simplifyWhiteSpace(); + addrstart = index+1; + } + break; + } + } + // append the last address to the list + if (!insidequote && (commentlevel == 0)) { + addr = aStr.mid(addrstart, aStr.length()-addrstart); + if (!addr.isEmpty()) + list += addr.simplifyWhiteSpace(); + } + //else + // kdDebug() << "Error in address splitting: " + // << "Unexpected end of address list" + // << endl; + + return list; +} + +void TDEApplication::invokeMailer(const TQString &_to, const TQString &_cc, const TQString &_bcc, + const TQString &subject, const TQString &body, + const TQString & /*messageFile TODO*/, const TQStringList &attachURLs, + const TQCString& startup_id ) +{ + TDEConfig config("emaildefaults"); + + config.setGroup("Defaults"); + TQString group = config.readEntry("Profile","Default"); + + config.setGroup( TQString("PROFILE_%1").arg(group) ); + TQString command = config.readPathEntry("EmailClient"); + + TQString to, cc, bcc; + if (command.isEmpty() || command == TQString::fromLatin1("kmail") + || command.endsWith("/kmail")) + { + command = TQString::fromLatin1("kmail --composer -s %s -c %c -b %b --body %B --attach %A -- %t"); + if ( !_to.isEmpty() ) + { + // put the whole address lists into RFC2047 encoded blobs; technically + // this isn't correct, but KMail understands it nonetheless + to = TQString( "=?utf8?b?%1?=" ) + .arg( TQString(KCodecs::base64Encode( _to.utf8(), false )) ); + } + if ( !_cc.isEmpty() ) + cc = TQString( "=?utf8?b?%1?=" ) + .arg( TQString(KCodecs::base64Encode( _cc.utf8(), false )) ); + if ( !_bcc.isEmpty() ) + bcc = TQString( "=?utf8?b?%1?=" ) + .arg( TQString(KCodecs::base64Encode( _bcc.utf8(), false )) ); + } else { + to = _to; + cc = _cc; + bcc = _bcc; + if( !command.contains( '%' )) + command += " %u"; + } + + if (config.readBoolEntry("TerminalClient", false)) + { + TDEConfigGroup confGroup( TDEGlobal::config(), "General" ); + TQString preferredTerminal = confGroup.readPathEntry("TerminalApplication", "konsole"); + command = preferredTerminal + " -e " + command; + } + + TQStringList cmdTokens = KShell::splitArgs(command); + TQString cmd = cmdTokens[0]; + cmdTokens.remove(cmdTokens.begin()); + + KURL url; + TQStringList qry; + if (!to.isEmpty()) + { + TQStringList tos = splitEmailAddressList( to ); + url.setPath( tos.first() ); + tos.remove( tos.begin() ); + for (TQStringList::ConstIterator it = tos.begin(); it != tos.end(); ++it) + qry.append( "to=" + KURL::encode_string( *it ) ); + } + const TQStringList ccs = splitEmailAddressList( cc ); + for (TQStringList::ConstIterator it = ccs.begin(); it != ccs.end(); ++it) + qry.append( "cc=" + KURL::encode_string( *it ) ); + const TQStringList bccs = splitEmailAddressList( bcc ); + for (TQStringList::ConstIterator it = bccs.begin(); it != bccs.end(); ++it) + qry.append( "bcc=" + KURL::encode_string( *it ) ); + for (TQStringList::ConstIterator it = attachURLs.begin(); it != attachURLs.end(); ++it) + qry.append( "attach=" + KURL::encode_string( *it ) ); + if (!subject.isEmpty()) + qry.append( "subject=" + KURL::encode_string( subject ) ); + if (!body.isEmpty()) + qry.append( "body=" + KURL::encode_string( body ) ); + url.setQuery( qry.join( "&" ) ); + if ( ! (to.isEmpty() && qry.isEmpty()) ) + url.setProtocol("mailto"); + + TQMap<TQChar, TQString> keyMap; + keyMap.insert('t', to); + keyMap.insert('s', subject); + keyMap.insert('c', cc); + keyMap.insert('b', bcc); + keyMap.insert('B', body); + keyMap.insert('u', url.url()); + + TQString attachlist = attachURLs.join(","); + attachlist.prepend('\''); + attachlist.append('\''); + keyMap.insert('A', attachlist); + + for (TQStringList::Iterator it = cmdTokens.begin(); it != cmdTokens.end(); ) + { + if (*it == "%A") + { + if (it == cmdTokens.begin()) // better safe than sorry ... + continue; + TQStringList::ConstIterator urlit = attachURLs.begin(); + TQStringList::ConstIterator urlend = attachURLs.end(); + if ( urlit != urlend ) + { + TQStringList::Iterator previt = it; + --previt; + *it = *urlit; + ++it; + while ( ++urlit != urlend ) + { + cmdTokens.insert( it, *previt ); + cmdTokens.insert( it, *urlit ); + } + } else { + --it; + it = cmdTokens.remove( cmdTokens.remove( it ) ); + } + } else { + *it = KMacroExpander::expandMacros(*it, keyMap); + ++it; + } + } + + TQString error; + // TODO this should check if cmd has a .desktop file, and use data from it, together + // with sending more ASN data + if (tdeinitExec(cmd, cmdTokens, &error, NULL, startup_id )) { + if (Tty != kapp->type()) { + TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Mail Client"), + i18n("Could not launch the mail client:\n\n%1").arg(error), i18n("&OK")); + } + else { + kdWarning() << "Could not launch mail client:\n" << error << endl; + } + } +} +#endif + +void TDEApplication::invokeBrowser( const TQString &url ) +{ + return invokeBrowser( url, "" ); +} + +#ifndef Q_WS_WIN +// on win32, for invoking browser we're using win32 API +// see kapplication_win.cpp +void TDEApplication::invokeBrowser( const TQString &url, const TQCString& startup_id ) +{ + TQString error; + + if (startServiceByDesktopName("kfmclient", url, &error, 0, 0, startup_id, false)) + { + if (Tty != kapp->type()) + TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Browser"), + i18n("Could not launch the browser:\n\n%1").arg(error), i18n("&OK")); + else + kdWarning() << "Could not launch browser:\n" << error << endl; + return; + } +} +#endif + +void TDEApplication::cut() +{ + invokeEditSlot( TQT_SLOT( cut() ) ); +} + +void TDEApplication::copy() +{ + invokeEditSlot( TQT_SLOT( copy() ) ); +} + +void TDEApplication::paste() +{ + invokeEditSlot( TQT_SLOT( paste() ) ); +} + +void TDEApplication::clear() +{ + invokeEditSlot( TQT_SLOT( clear() ) ); +} + +void TDEApplication::selectAll() +{ + invokeEditSlot( TQT_SLOT( selectAll() ) ); +} + +void TDEApplication::broadcastKeyCode(unsigned int keyCode) +{ + emit coreFakeKeyPress(keyCode); +} + +TQCString +TDEApplication::launcher() +{ + return "tdelauncher"; +} + +static int +startServiceInternal( const TQCString &function, + const TQString& _name, const TQStringList &URLs, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + struct serviceResult + { + int result; + TQCString dcopName; + TQString error; + pid_t pid; + }; + + // Register app as able to send DCOP messages + DCOPClient *dcopClient; + if (kapp) + dcopClient = kapp->dcopClient(); + else + dcopClient = new DCOPClient; + + if (!dcopClient->isAttached()) + { + if (!dcopClient->attach()) + { + if (error) + *error = i18n("Could not register with DCOP.\n"); + if (!kapp) + delete dcopClient; + + return -1; + } + } + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); + stream << _name << URLs; + TQCString replyType; + TQByteArray replyData; + TQCString _launcher = TDEApplication::launcher(); + TQValueList<TQCString> envs; +#ifdef Q_WS_X11 + if (tqt_xdisplay()) { + TQCString dpystring(XDisplayString(tqt_xdisplay())); + envs.append( TQCString("DISPLAY=") + dpystring ); + } else if( getenv( "DISPLAY" )) { + TQCString dpystring( getenv( "DISPLAY" )); + envs.append( TQCString("DISPLAY=") + dpystring ); + } +#endif + stream << envs; +#if defined Q_WS_X11 + // make sure there is id, so that user timestamp exists + stream << ( startup_id.isEmpty() ? TDEStartupInfo::createNewStartupId() : startup_id ); +#endif + if( function.left( 12 ) != "tdeinit_exec" ) + stream << noWait; + + if (!dcopClient->call(_launcher, _launcher, + function, params, replyType, replyData)) + { + if (error) + *error = i18n("TDELauncher could not be reached via DCOP.\n"); + if (!kapp) + delete dcopClient; + return -1; + } + if (!kapp) + delete dcopClient; + + if (noWait) + return 0; + + TQDataStream stream2(replyData, IO_ReadOnly); + serviceResult result; + stream2 >> result.result >> result.dcopName >> result.error >> result.pid; + if (dcopService) + *dcopService = result.dcopName; + if (error) + *error = result.error; + if (pid) + *pid = result.pid; + return result.result; +} + +int +TDEApplication::startServiceByName( const TQString& _name, const TQString &URL, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + TQStringList URLs; + if (!URL.isEmpty()) + URLs.append(URL); + return startServiceInternal( + "start_service_by_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", + _name, URLs, error, dcopService, pid, startup_id, noWait); +} + +int +TDEApplication::startServiceByName( const TQString& _name, const TQStringList &URLs, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + return startServiceInternal( + "start_service_by_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", + _name, URLs, error, dcopService, pid, startup_id, noWait); +} + +int +TDEApplication::startServiceByDesktopPath( const TQString& _name, const TQString &URL, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + TQStringList URLs; + if (!URL.isEmpty()) + URLs.append(URL); + return startServiceInternal( + "start_service_by_desktop_path(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", + _name, URLs, error, dcopService, pid, startup_id, noWait); +} + +int +TDEApplication::startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + return startServiceInternal( + "start_service_by_desktop_path(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", + _name, URLs, error, dcopService, pid, startup_id, noWait); +} + +int +TDEApplication::startServiceByDesktopName( const TQString& _name, const TQString &URL, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + TQStringList URLs; + if (!URL.isEmpty()) + URLs.append(URL); + return startServiceInternal( + "start_service_by_desktop_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", + _name, URLs, error, dcopService, pid, startup_id, noWait); +} + +int +TDEApplication::startServiceByDesktopName( const TQString& _name, const TQStringList &URLs, + TQString *error, TQCString *dcopService, int *pid, const TQCString& startup_id, bool noWait ) +{ + return startServiceInternal( + "start_service_by_desktop_name(TQString,TQStringList,TQValueList<TQCString>,TQCString,bool)", + _name, URLs, error, dcopService, pid, startup_id, noWait); +} + +int +TDEApplication::tdeinitExec( const TQString& name, const TQStringList &args, + TQString *error, int *pid ) +{ + return tdeinitExec( name, args, error, pid, "" ); +} + +int +TDEApplication::tdeinitExec( const TQString& name, const TQStringList &args, + TQString *error, int *pid, const TQCString& startup_id ) +{ + return startServiceInternal("tdeinit_exec(TQString,TQStringList,TQValueList<TQCString>,TQCString)", + name, args, error, 0, pid, startup_id, false); +} + +int +TDEApplication::tdeinitExecWait( const TQString& name, const TQStringList &args, + TQString *error, int *pid ) +{ + return tdeinitExecWait( name, args, error, pid, "" ); +} + +int +TDEApplication::tdeinitExecWait( const TQString& name, const TQStringList &args, + TQString *error, int *pid, const TQCString& startup_id ) +{ + return startServiceInternal("tdeinit_exec_wait(TQString,TQStringList,TQValueList<TQCString>,TQCString)", + name, args, error, 0, pid, startup_id, false); +} + +TQString TDEApplication::tempSaveName( const TQString& pFilename ) const +{ + TQString aFilename; + + if( TQDir::isRelativePath(pFilename) ) + { + kdWarning(101) << "Relative filename passed to TDEApplication::tempSaveName" << endl; + aFilename = TQFileInfo( TQDir( "." ), pFilename ).absFilePath(); + } + else + aFilename = pFilename; + + TQDir aAutosaveDir( TQDir::homeDirPath() + "/autosave/" ); + if( !aAutosaveDir.exists() ) + { + if( !aAutosaveDir.mkdir( aAutosaveDir.absPath() ) ) + { + // Last chance: use temp dir + aAutosaveDir.setPath( TDEGlobal::dirs()->saveLocation("tmp") ); + } + } + + aFilename.replace( "/", "\\!" ).prepend( "#" ).append( "#" ).prepend( "/" ).prepend( aAutosaveDir.absPath() ); + + return aFilename; +} + + +TQString TDEApplication::checkRecoverFile( const TQString& pFilename, + bool& bRecover ) const +{ + TQString aFilename; + + if( TQDir::isRelativePath(pFilename) ) + { + kdWarning(101) << "Relative filename passed to TDEApplication::tempSaveName" << endl; + aFilename = TQFileInfo( TQDir( "." ), pFilename ).absFilePath(); + } + else + aFilename = pFilename; + + TQDir aAutosaveDir( TQDir::homeDirPath() + "/autosave/" ); + if( !aAutosaveDir.exists() ) + { + if( !aAutosaveDir.mkdir( aAutosaveDir.absPath() ) ) + { + // Last chance: use temp dir + aAutosaveDir.setPath( TDEGlobal::dirs()->saveLocation("tmp") ); + } + } + + aFilename.replace( "/", "\\!" ).prepend( "#" ).append( "#" ).prepend( "/" ).prepend( aAutosaveDir.absPath() ); + + if( TQFile( aFilename ).exists() ) + { + bRecover = true; + return aFilename; + } + else + { + bRecover = false; + return pFilename; + } +} + + +bool checkAccess(const TQString& pathname, int mode) +{ + int accessOK = access( TQFile::encodeName(pathname), mode ); + if ( accessOK == 0 ) + return true; // OK, I can really access the file + + // else + // if we want to write the file would be created. Check, if the + // user may write to the directory to create the file. + if ( (mode & W_OK) == 0 ) + return false; // Check for write access is not part of mode => bail out + + + if (!access( TQFile::encodeName(pathname), F_OK)) // if it already exists + return false; + + //strip the filename (everything until '/' from the end + TQString dirName(pathname); + int pos = dirName.findRev('/'); + if ( pos == -1 ) + return false; // No path in argument. This is evil, we won't allow this + else if ( pos == 0 ) // don't turn e.g. /root into an empty string + pos = 1; + + dirName.truncate(pos); // strip everything starting from the last '/' + + accessOK = access( TQFile::encodeName(dirName), W_OK ); + // -?- Can I write to the accessed diretory + if ( accessOK == 0 ) + return true; // Yes + else + return false; // No +} + +void TDEApplication::setTopWidget( TQWidget *topWidget ) +{ + if( !topWidget ) + return; + + // set the specified caption + if ( !topWidget->inherits("TDEMainWindow") ) { // TDEMainWindow does this already for us + topWidget->setCaption( caption() ); + } + + // set the specified icons + topWidget->setIcon( icon() ); //standard X11 +#if defined Q_WS_X11 +//#ifdef Q_WS_X11 // FIXME(E): Implement for Qt/Embedded + KWin::setIcons(topWidget->winId(), icon(), miniIcon() ); // NET_WM hints for KWin + + // set the app startup notification window property + TDEStartupInfo::setWindowStartupId( topWidget->winId(), startupId()); +#endif +} + +TQCString TDEApplication::startupId() const +{ + return d->startup_id; +} + +void TDEApplication::setStartupId( const TQCString& startup_id ) +{ + if( startup_id == d->startup_id ) + return; +#if defined Q_WS_X11 + TDEStartupInfo::handleAutoAppStartedSending(); // finish old startup notification if needed +#endif + if( startup_id.isEmpty()) + d->startup_id = "0"; + else + { + d->startup_id = startup_id; +#if defined Q_WS_X11 + TDEStartupInfoId id; + id.initId( startup_id ); + long timestamp = id.timestamp(); + if( timestamp != 0 ) + updateUserTimestamp( timestamp ); +#endif + } +} + +// read the startup notification env variable, save it and unset it in order +// not to propagate it to processes started from this app +void TDEApplication::read_app_startup_id() +{ +#if defined Q_WS_X11 + TDEStartupInfoId id = TDEStartupInfo::currentStartupIdEnv(); + TDEStartupInfo::resetStartupEnv(); + d->startup_id = id.id(); +#endif +} + +int TDEApplication::random() +{ + static bool init = false; + if (!init) + { + unsigned int seed; + init = true; + int fd = open("/dev/urandom", O_RDONLY); + if (fd < 0 || ::read(fd, &seed, sizeof(seed)) != sizeof(seed)) + { + // No /dev/urandom... try something else. + srand(getpid()); + seed = rand()+time(0); + } + if (fd >= 0) close(fd); + srand(seed); + } + return rand(); +} + +TQString TDEApplication::randomString(int length) +{ + if (length <=0 ) return TQString::null; + + TQString str; str.setLength( length ); + int i = 0; + while (length--) + { + int r=random() % 62; + r+=48; + if (r>57) r+=7; + if (r>90) r+=6; + str[i++] = char(r); + // so what if I work backwards? + } + return str; +} + +bool TDEApplication::authorize(const TQString &genericAction) +{ + if (!d->actionRestrictions) + return true; + + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "KDE Action Restrictions" ); + return config->readBoolEntry(genericAction, true); +} + +bool TDEApplication::authorizeTDEAction(const char *action) +{ + if (!d->actionRestrictions || !action) + return true; + + static const TQString &action_prefix = TDEGlobal::staticQString( "action/" ); + + return authorize(action_prefix + action); +} + +bool TDEApplication::authorizeControlModule(const TQString &menuId) +{ + if (menuId.isEmpty() || kde_kiosk_exception) + return true; + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "TDE Control Module Restrictions" ); + return config->readBoolEntry(menuId, true); +} + +TQStringList TDEApplication::authorizeControlModules(const TQStringList &menuIds) +{ + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "TDE Control Module Restrictions" ); + TQStringList result; + for(TQStringList::ConstIterator it = menuIds.begin(); + it != menuIds.end(); ++it) + { + if (config->readBoolEntry(*it, true)) + result.append(*it); + } + return result; +} + +void TDEApplication::initUrlActionRestrictions() +{ + d->urlActionRestrictions.setAutoDelete(true); + d->urlActionRestrictions.clear(); + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("open", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, true)); + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("list", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, true)); +// TEST: +// d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule +// ("list", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, false)); +// d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule +// ("list", TQString::null, TQString::null, TQString::null, "file", TQString::null, TQDir::homeDirPath(), true)); + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("link", TQString::null, TQString::null, TQString::null, ":internet", TQString::null, TQString::null, true)); + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("redirect", TQString::null, TQString::null, TQString::null, ":internet", TQString::null, TQString::null, true)); + + // We allow redirections to file: but not from internet protocols, redirecting to file: + // is very popular among io-slaves and we don't want to break them + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("redirect", TQString::null, TQString::null, TQString::null, "file", TQString::null, TQString::null, true)); + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("redirect", ":internet", TQString::null, TQString::null, "file", TQString::null, TQString::null, false)); + + // local protocols may redirect everywhere + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("redirect", ":local", TQString::null, TQString::null, TQString::null, TQString::null, TQString::null, true)); + + // Anyone may redirect to about: + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("redirect", TQString::null, TQString::null, TQString::null, "about", TQString::null, TQString::null, true)); + + // Anyone may redirect to itself, cq. within it's own group + d->urlActionRestrictions.append( new TDEApplicationPrivate::URLActionRule + ("redirect", TQString::null, TQString::null, TQString::null, "=", TQString::null, TQString::null, true)); + + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver( config, "KDE URL Restrictions" ); + int count = config->readNumEntry("rule_count"); + TQString keyFormat = TQString("rule_%1"); + for(int i = 1; i <= count; i++) + { + TQString key = keyFormat.arg(i); + TQStringList rule = config->readListEntry(key); + if (rule.count() != 8) + continue; + TQString action = rule[0]; + TQString refProt = rule[1]; + TQString refHost = rule[2]; + TQString refPath = rule[3]; + TQString urlProt = rule[4]; + TQString urlHost = rule[5]; + TQString urlPath = rule[6]; + TQString strEnabled = rule[7].lower(); + + bool bEnabled = (strEnabled == "true"); + + if (refPath.startsWith("$HOME")) + refPath.replace(0, 5, TQDir::homeDirPath()); + else if (refPath.startsWith("~")) + refPath.replace(0, 1, TQDir::homeDirPath()); + if (urlPath.startsWith("$HOME")) + urlPath.replace(0, 5, TQDir::homeDirPath()); + else if (urlPath.startsWith("~")) + urlPath.replace(0, 1, TQDir::homeDirPath()); + + if (refPath.startsWith("$TMP")) + refPath.replace(0, 4, TDEGlobal::dirs()->saveLocation("tmp")); + if (urlPath.startsWith("$TMP")) + urlPath.replace(0, 4, TDEGlobal::dirs()->saveLocation("tmp")); + + d->urlActionRestrictions.append(new TDEApplicationPrivate::URLActionRule + ( action, refProt, refHost, refPath, urlProt, urlHost, urlPath, bEnabled)); + } +} + +void TDEApplication::allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL) +{ + if (authorizeURLAction(action, _baseURL, _destURL)) + return; + + d->urlActionRestrictions.append(new TDEApplicationPrivate::URLActionRule + ( action, _baseURL.protocol(), _baseURL.host(), _baseURL.path(-1), + _destURL.protocol(), _destURL.host(), _destURL.path(-1), true)); +} + +bool TDEApplication::authorizeURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL) +{ + if (_destURL.isEmpty()) + return true; + + bool result = false; + if (d->urlActionRestrictions.isEmpty()) + initUrlActionRestrictions(); + + KURL baseURL(_baseURL); + baseURL.setPath(TQDir::cleanDirPath(baseURL.path())); + TQString baseClass = KProtocolInfo::protocolClass(baseURL.protocol()); + KURL destURL(_destURL); + destURL.setPath(TQDir::cleanDirPath(destURL.path())); + TQString destClass = KProtocolInfo::protocolClass(destURL.protocol()); + + for(TDEApplicationPrivate::URLActionRule *rule = d->urlActionRestrictions.first(); + rule; rule = d->urlActionRestrictions.next()) + { + if ((result != rule->permission) && // No need to check if it doesn't make a difference + (action == rule->action) && + rule->baseMatch(baseURL, baseClass) && + rule->destMatch(destURL, destClass, baseURL, baseClass)) + { + result = rule->permission; + } + } + return result; +} + + +uint TDEApplication::keyboardModifiers() +{ +#ifdef Q_WS_X11 + Window root; + Window child; + int root_x, root_y, win_x, win_y; + uint keybstate; + XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child, + &root_x, &root_y, &win_x, &win_y, &keybstate ); + return keybstate & 0x00ff; +#elif defined W_WS_MACX + return GetCurrentEventKeyModifiers() & 0x00ff; +#else + //TODO for win32 + return 0; +#endif +} + +uint TDEApplication::mouseState() +{ + uint mousestate; +#ifdef Q_WS_X11 + Window root; + Window child; + int root_x, root_y, win_x, win_y; + XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child, + &root_x, &root_y, &win_x, &win_y, &mousestate ); +#elif defined(Q_WS_WIN) + const bool mousebtn_swapped = GetSystemMetrics(SM_SWAPBUTTON); + if (GetAsyncKeyState(VK_LBUTTON)) + mousestate |= (mousebtn_swapped ? Button3Mask : Button1Mask); + if (GetAsyncKeyState(VK_MBUTTON)) + mousestate |= Button2Mask; + if (GetAsyncKeyState(VK_RBUTTON)) + mousestate |= (mousebtn_swapped ? Button1Mask : Button3Mask); +#elif defined(Q_WS_MACX) + mousestate = GetCurrentEventButtonState(); +#else + //TODO: other platforms +#endif + return mousestate & 0xff00; +} + +TQ_ButtonState TDEApplication::keyboardMouseState() +{ + int ret = 0; +#ifdef Q_WS_X11 + Window root; + Window child; + int root_x, root_y, win_x, win_y; + uint state; + XQueryPointer( tqt_xdisplay(), tqt_xrootwin(), &root, &child, + &root_x, &root_y, &win_x, &win_y, &state ); + // transform the same way like Qt's qt_x11_translateButtonState() + if( state & Button1Mask ) + ret |= TQ_LeftButton; + if( state & Button2Mask ) + ret |= TQ_MidButton; + if( state & Button3Mask ) + ret |= TQ_RightButton; + if( state & ShiftMask ) + ret |= TQ_ShiftButton; + if( state & ControlMask ) + ret |= TQ_ControlButton; + if( state & KKeyNative::modX( KKey::ALT )) + ret |= TQ_AltButton; + if( state & KKeyNative::modX( KKey::WIN )) + ret |= TQ_MetaButton; +#elif defined(Q_WS_WIN) + const bool mousebtn_swapped = GetSystemMetrics(SM_SWAPBUTTON); + if (GetAsyncKeyState(VK_LBUTTON)) + ret |= (mousebtn_swapped ? RightButton : LeftButton); + if (GetAsyncKeyState(VK_MBUTTON)) + ret |= TQ_MidButton; + if (GetAsyncKeyState(VK_RBUTTON)) + ret |= (mousebtn_swapped ? TQ_LeftButton : TQ_RightButton); + if (GetAsyncKeyState(VK_SHIFT)) + ret |= TQ_ShiftButton; + if (GetAsyncKeyState(VK_CONTROL)) + ret |= TQ_ControlButton; + if (GetAsyncKeyState(VK_MENU)) + ret |= TQ_AltButton; + if (GetAsyncKeyState(VK_LWIN) || GetAsyncKeyState(VK_RWIN)) + ret |= TQ_MetaButton; +#else + //TODO: other platforms +#endif + return static_cast< ButtonState >( ret ); +} + +void TDEApplication::installSigpipeHandler() +{ +#ifdef Q_OS_UNIX + struct sigaction act; + act.sa_handler = SIG_IGN; + sigemptyset( &act.sa_mask ); + act.sa_flags = 0; + sigaction( SIGPIPE, &act, 0 ); +#endif +} + +void TDEApplication::sigpipeHandler(int) +{ + int saved_errno = errno; + // Using kdDebug from a signal handler is not a good idea. +#ifndef NDEBUG + char msg[1000]; + sprintf(msg, "*** SIGPIPE *** (ignored, pid = %ld)\n", (long) getpid()); + if (write(2, msg, strlen(msg)) < 0) { + // ERROR + } +#endif + + // Do nothing. + errno = saved_errno; +} + +bool TDEApplication::guiEnabled() +{ + return kapp && kapp->d->guiEnabled; +} + +void TDEApplication::virtual_hook( int id, void* data ) +{ TDEInstance::virtual_hook( id, data ); } + +void KSessionManaged::virtual_hook( int, void* ) +{ /*BASE::virtual_hook( id, data );*/ } + +#include "tdeapplication.moc" diff --git a/tdecore/tdeapplication.h b/tdecore/tdeapplication.h new file mode 100644 index 000000000..5ab8d7ee7 --- /dev/null +++ b/tdecore/tdeapplication.h @@ -0,0 +1,1620 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) + Copyright (c) 1998, 1999 KDE Team + + 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KAPP_H +#define _KAPP_H + +// Version macros. Never put this further down. +#include "tdeversion.h" +#include "tdelibs_export.h" + +class TDEConfig; +class KCharsets; +class DCOPClient; +class DCOPObject; + +#include <tqtglobaldefines.h> + +typedef unsigned long Atom; +#if !defined(Q_WS_X11) +typedef void Display; +#endif + +#include <tqapplication.h> +#include <tqpixmap.h> +#include <kinstance.h> + +struct _IceConn; +class TQPopupMenu; +class TQStrList; +class KSessionManaged; +class TDEStyle; +class KURL; + +#define kapp TDEApplication::kApplication() + +class TDEApplicationPrivate; + +/** +* Controls and provides information to all KDE applications. +* +* Only one object of this class can be instantiated in a single app. +* This instance is always accessible via the 'kapp' global variable. +* See cut() for an example. +* +* This class provides the following services to all KDE applications. +* +* @li It controls the event queue (see TQApplication ). +* @li It provides the application with KDE resources such as +* accelerators, common menu entries, a TDEConfig object. session +* management events, help invocation etc. +* @li Installs a signal handler for the SIGCHLD signal in order to +* avoid zombie children. If you want to catch this signal yourself or +* don't want it to be caught at all, you have set a new signal handler +* (or SIG_IGN) after TDEApplication's constructor has run. +* @li Installs an empty signal handler for the SIGPIPE signal using +* installSigpipeHandler(). If you want to catch this signal +* yourself, you have set a new signal handler after TDEApplication's +* constructor has run. +* @li It can start new services +* +* +* The way a service gets started depends on the 'X-DCOP-ServiceType' +* entry in the desktop file of the service: +* +* There are three possibilities: +* @li X-DCOP-ServiceType=None (default) +* Always start a new service, +* don't wait till the service registers with dcop. +* @li X-DCOP-ServiceType=Multi +* Always start a new service, +* wait until the service has registered with dcop. +* @li X-DCOP-ServiceType=Unique +* Only start the service if it isn't already running, +* wait until the service has registered with dcop. +* +* @short Controls and provides information to all KDE applications. +* @author Matthias Kalle Dalheimer <kalle@kde.org> +*/ +class TDECORE_EXPORT TDEApplication : public TQApplication, public TDEInstance +{ + + Q_OBJECT +public: + /** Position of the caption (presumably in the application window's + * title bar). This enum appears to be unused. + * + * @todo Find out if this is used anywhere. + */ + enum CaptionLayout { + CaptionAppLast=1 /**< Display the application name last (before document name). */, + CaptionAppFirst /**< Display the application name first. */ , + CaptionNoApp /**< Do not display application name at all. */ + }; + + /** + * This constructor takes aboutData and command line + * arguments from TDECmdLineArgs. + * + * If ARGB (transparent) widgets are to be used in your application, + * please use + * TDEApplication app(TDEApplication::openX11RGBADisplay()); + * or + * TDEApplication app(TDEApplication::openX11RGBADisplay(), useStyles); + * + * @param allowStyles Set to false to disable the loading on plugin based + * styles. This is only useful to applications that do not display a GUI + * normally. If you do create an application with @p allowStyles set to false + * it normally runs in the background but under special circumstances + * displays widgets. Call enableStyles() before displaying any widgets. + * + * @param GUIenabled Set to false to disable all GUI stuff. This implies + * no styles either. + */ + TDEApplication( bool allowStyles=true, bool GUIenabled=true); + +#ifdef Q_WS_X11 + /** + * Constructor. Parses command-line arguments. Use this constructor when you + * you want ARGB support to be automatically detected and enabled. + * + * @param display Will be passed to Qt as the X display. The display must be + * valid and already opened. + * + * @param allowStyles Set to false to disable the loading on plugin based + * styles. This is only useful to applications that do not display a GUI + * normally. If you do create an application with @p allowStyles set to false + * that normally runs in the background but under special circumstances + * displays widgets call enableStyles() before displaying any widgets. + * + * @since KDE 3.5 + * + * @see RGBADisplay() + */ + TDEApplication(Display *display, bool allowStyles); + + /** + * Constructor. Parses command-line arguments. Use this constructor when you + * you want ARGB support to be automatically detected and enabled. + * + * @param display Will be passed to Qt as the X display. The display must be + * valid and already opened. + * + * @param disable_argb Set to true to disable ARGB visuals in this application. + * + * @param display Will be passed to Qt as the X display. The display must be + * valid and already opened. + * + * @param visual A pointer to the X11 visual that should be used by the + * appliction. Note that only TrueColor visuals are supported on depths + * greater than 8 bpp. If this parameter is NULL, the default visual will + * be used instead. + * + * @param allowStyles Set to false to disable the loading on plugin based + * styles. This is only useful to applications that do not display a GUI + * normally. If you do create an application with @p allowStyles set to false + * that normally runs in the background but under special circumstances + * displays widgets call enableStyles() before displaying any widgets. + * + * @since KDE 3.5 + * + * @see RGBADisplay() + */ + TDEApplication(Display *display, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles); + + /** + * Constructor. Parses command-line arguments. Use this constructor when you + * you need to use a non-default visual or colormap. + * + * @param display Will be passed to Qt as the X display. The display must be + * valid and already opened. + * + * @param visual A pointer to the X11 visual that should be used by the + * appliction. Note that only TrueColor visuals are supported on depths + * greater than 8 bpp. If this parameter is NULL, the default visual will + * be used instead. + * + * @param colormap The colormap that should be used by the application. If + * this parameter is 0, the default colormap will be used instead. + * + * @param allowStyles Set to false to disable the loading on plugin based + * styles. This is only useful to applications that do not display a GUI + * normally. If you do create an application with @p allowStyles set to false + * that normally runs in the background but under special circumstances + * displays widgets call enableStyles() before displaying any widgets. + * + * @since KDE 3.3 + */ + TDEApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0, + bool allowStyles=true); + + /** + * Constructor. Parses command-line arguments. Use this constructor to use TDEApplication + * in a Motif or Xt program. + * + * @param display Will be passed to Qt as the X display. The display must be valid and already + * opened. + * + * @param argc command line argument count + * + * @param argv command line argument value(s) + * + * @param rAppName application name. Will be used for finding the + * associated message files and icon files, and as the default + * registration name for DCOP. This is a mandatory parameter. + * + * @param allowStyles Set to false to disable the loading on plugin based + * styles. This is only useful to applications that do not display a GUI + * normally. If you do create an application with @p allowStyles set to false + * that normally runs in the background but under special circumstances + * displays widgets call enableStyles() before displaying any widgets. + * + * @param GUIenabled Set to false to disable all GUI stuff. This implies + * no styles either. + */ + TDEApplication(Display *display, int& argc, char** argv, const TQCString& rAppName, + bool allowStyles=true, bool GUIenabled=true); +#endif + + /** + * @deprecated do not use it at all, it will make your application crash, use TDECmdLineArgs + * + * Constructor. Parses command-line arguments. + * + * @param argc command line argument count + * + * @param argv command line argument value(s) + * + * @param rAppName application name. Will be used for finding the + * associated message files and icon files, and as the default + * registration name for DCOP. This is a mandatory parameter. + * + * @param allowStyles Set to false to disable the loading on plugin based + * styles. This is only useful to applications that do not display a GUI + * normally. If you do create an application with @p allowStyles set to false + * that normally runs in the background but under special circumstances + * displays widgets call enableStyles() before displaying any widgets. + * + * @param GUIenabled Set to false to disable all GUI stuff. This implies + * no styles either. + */ + // REMOVE FOR KDE 4.0 - using it only gives crashing applications because + // TDECmdLineArgs::init isn't called + TDEApplication(int& argc, char** argv, + const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true) KDE_DEPRECATED; + + /** + * Add Qt and KDE command line options to TDECmdLineArgs. + */ + static void addCmdLineOptions(); + + virtual ~TDEApplication(); + + /** + * Returns the current application object. + * + * This is similar to the global TQApplication pointer tqApp. It + * allows access to the single global TDEApplication object, since + * more than one cannot be created in the same application. It + * saves you the trouble of having to pass the pointer explicitly + * to every function that may require it. + * @return the current application object + */ + static TDEApplication* kApplication() { return KApp; } + + /** + * Returns the application session config object. + * + * @return A pointer to the application's instance specific + * TDEConfig object. + * @see TDEConfig + */ + TDEConfig* sessionConfig(); + + /** + * Is the application restored from the session manager? + * + * @return If true, this application was restored by the session manager. + * Note that this may mean the config object returned by + * sessionConfig() contains data saved by a session closedown. + * @see sessionConfig() + */ + bool isRestored() const { return TQApplication::isSessionRestored(); } + + /** + * Disables session management for this application. + * + * Useful in case your application is started by the + * initial "starttde" script. + */ + void disableSessionManagement(); + + /** + * Enables again session management for this application, formerly + * disabled by calling disableSessionManagement(). You usually + * shouldn't call this function, as the session management is enabled + * by default. + */ + void enableSessionManagement(); + + /** + * The possible values for the @p confirm parameter of requestShutDown(). + */ + enum ShutdownConfirm { + /** + * Obey the user's confirmation setting. + */ + ShutdownConfirmDefault = -1, + /** + * Don't confirm, shutdown without asking. + */ + ShutdownConfirmNo = 0, + /** + * Always confirm, ask even if the user turned it off. + */ + ShutdownConfirmYes = 1 + }; + + /** + * The possible values for the @p sdtype parameter of requestShutDown(). + */ + enum ShutdownType { + /** + * Select previous action or the default if it's the first time. + */ + ShutdownTypeDefault = -1, + /** + * Only log out. + */ + ShutdownTypeNone = 0, + /** + * Log out and reboot the machine. + */ + ShutdownTypeReboot = 1, + /** + * Log out and halt the machine. + */ + ShutdownTypeHalt = 2 + }; + + /** + * The possible values for the @p sdmode parameter of requestShutDown(). + */ + enum ShutdownMode { + /** + * Select previous mode or the default if it's the first time. + */ + ShutdownModeDefault = -1, + /** + * Schedule a shutdown (halt or reboot) for the time all active sessions + * have exited. + */ + ShutdownModeSchedule = 0, + /** + * Shut down, if no sessions are active. Otherwise do nothing. + */ + ShutdownModeTryNow = 1, + /** + * Force shutdown. Kill any possibly active sessions. + */ + ShutdownModeForceNow = 2, + /** + * Pop up a dialog asking the user what to do if sessions are still active. + */ + ShutdownModeInteractive = 3 + }; + + /** + * Asks the session manager to shut the session down. + * + * Using @p confirm == ShutdownConfirmYes or @p sdtype != ShutdownTypeDefault or + * @p sdmode != ShutdownModeDefault causes the use of ksmserver's DCOP + * interface. The remaining two combinations use the standard XSMP and + * will work with any session manager compliant with it. + * + * @param confirm Whether to ask the user if he really wants to log out. + * ShutdownConfirm + * @param sdtype The action to take after logging out. ShutdownType + * @param sdmode If/When the action should be taken. ShutdownMode + * @return true on success, false if the session manager could not be + * contacted. + */ + bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault, + ShutdownType sdtype = ShutdownTypeDefault, + ShutdownMode sdmode = ShutdownModeDefault ); + + /** + * Propagates the network address of the session manager in the + * SESSION_MANAGER environment variable so that child processes can + * pick it up. + * + * If SESSION_MANAGER isn't defined yet, the address is searched in + * $HOME/.KSMserver. + * + * This function is called by clients that are started outside the + * session ( i.e. before ksmserver is started), but want to launch + * other processes that should participate in the session. Examples + * are kdesktop or kicker. + */ + void propagateSessionManager(); + + /** + * Reimplemented for internal purposes, mainly the highlevel + * handling of session management with KSessionManaged. + * @internal + */ + void commitData( TQSessionManager& sm ); + + /** + * Reimplemented for internal purposes, mainly the highlevel + * handling of session management with KSessionManaged. + * @internal + */ + void saveState( TQSessionManager& sm ); + + /** + * Returns true if the application is currently saving its session + * data (most probably before KDE logout). This is intended for use + * mainly in TDEMainWindow::queryClose() and TDEMainWindow::queryExit(). + * + * @see TDEMainWindow::queryClose + * @see TDEMainWindow::queryExit + * @since 3.1.1 + */ + bool sessionSaving() const; + + /** + * Returns a pointer to a DCOPClient for the application. + * If a client does not exist yet, it is created when this + * function is called. + * @return the DCOPClient for the application + */ + static DCOPClient *dcopClient(); + + /** + * Disable automatic dcop registration + * Must be called before creating a TDEApplication instance to have an effect. + */ + static void disableAutoDcopRegistration(); + + /** + * Returns a TQPixmap with the application icon. + * @return the application icon + */ + TQPixmap icon() const; + + /** + * Returns the name of the application icon. + * @return the icon's name + */ + TQString iconName() const; + + /** + * Returns the mini-icon for the application as a TQPixmap. + * @return the application's mini icon + */ + TQPixmap miniIcon() const; + + /** + * Returns the name of the mini-icon for the application. + * @return the mini icon's name + */ + TQString miniIconName() const; + + /** + * Sets the top widget of the application. + * This means basically applying the right window caption and + * icon. An application may have several top widgets. You don't + * need to call this function manually when using TDEMainWindow. + * + * @param topWidget A top widget of the application. + * + * @see icon(), caption() + **/ + void setTopWidget( TQWidget *topWidget ); + + /** + * Invokes the KHelpCenter HTML help viewer from docbook sources. + * + * @param anchor This has to be a defined anchor in your + * docbook sources. If empty the main index + * is loaded + * @param appname This allows you to show the help of another + * application. If empty the current name() is + * used + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + */ + void invokeHelp( const TQString& anchor, + const TQString& appname, + const TQCString& startup_id ) const; + + // KDE4 merge with above with startup_id = "" + void invokeHelp( const TQString& anchor = TQString::null, + const TQString& appname = TQString::null ) const; + + /** + * @deprecated + * Invoke the khelpcenter HTML help viewer from HTML sources. + * Please use invokeHelp() instead. + * + * @param aFilename The filename that is to be loaded. Its + * location is computed automatically + * according to the KFSSTND. If @p aFilename + * is empty, the logical appname with .html + * appended to it is used. + * @param aTopic This allows context-sensitive help. Its + * value will be appended to the filename, + * prefixed with a "#" (hash) character. + */ + void invokeHTMLHelp( const TQString& aFilename, const TQString& aTopic = TQString::null ) const KDE_DEPRECATED; + + /** + * Convenience method; invokes the standard email application. + * + * @param address The destination address + * @param subject Subject string. Can be TQString::null. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + */ + void invokeMailer( const TQString &address, const TQString &subject, const TQCString& startup_id ); + // KDE4 merge with above with startup_id = "" + void invokeMailer( const TQString &address, const TQString &subject ); + + /** + * Invokes the standard email application. + * + * @param mailtoURL A mailto URL. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param allowAttachments whether attachments specified in mailtoURL should be honoured. + The default is false; do not honour requests for attachments. + */ + void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments ); + // KDE4 merge with above with allowAttachments = false + void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id ); + // KDE4 merge with above with startup_id = "" + void invokeMailer( const KURL &mailtoURL ); + + /** + * Convenience method; invokes the standard email application. + * + * All parameters are optional. + * + * @param to The destination address. + * @param cc The Cc field + * @param bcc The Bcc field + * @param subject Subject string + * @param body A string containing the body of the mail (exclusive with messageFile) + * @param messageFile A file (URL) containing the body of the mail (exclusive with body) - currently unsupported + * @param attachURLs List of URLs to be attached to the mail. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + */ + void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc, + const TQString &subject, const TQString &body, + const TQString &messageFile, const TQStringList &attachURLs, + const TQCString& startup_id ); + // KDE4 merge with above with startup_id = "" + void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc, + const TQString &subject, const TQString &body, + const TQString &messageFile = TQString::null, const TQStringList &attachURLs = TQStringList()); + +public slots: + /** + * Invokes the standard browser. + * Note that you should only do this when you know for sure that the browser can + * handle the URL (i.e. its mimetype). In doubt, if the URL can point to an image + * or anything else than directory or HTML, prefer to use new KRun( url ). + * + * @param url The destination address + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + */ + void invokeBrowser( const TQString &url, const TQCString& startup_id ); + // KDE4 merge with above with startup_id = "" + /** + * Invoke the standard browser. Uses a @p startup_id of "" (empty) + * and is otherwise the same as the above function. + */ + void invokeBrowser( const TQString &url ); + + /** + * If the widget with focus provides a cut() slot, call that slot. Thus for a + * simple application cut can be implemented as: + * \code + * KStdAction::cut( kapp, TQT_SLOT( cut() ), actionCollection() ); + * \endcode + */ + void cut(); + + /** + * If the widget with focus provides a copy() slot, call that slot. Thus for a + * simple application copy can be implemented as: + * \code + * KStdAction::copy( kapp, TQT_SLOT( copy() ), actionCollection() ); + * \endcode + */ + void copy(); + + /** + * If the widget with focus provides a paste() slot, call that slot. Thus for a + * simple application copy can be implemented as: + * \code + * KStdAction::paste( kapp, TQT_SLOT( paste() ), actionCollection() ); + * \endcode + */ + void paste(); + + /** + * If the widget with focus provides a clear() slot, call that slot. Thus for a + * simple application clear() can be implemented as: + * \code + * new TDEAction( i18n( "Clear" ), "editclear", 0, kapp, TQT_SLOT( clear() ), actionCollection(), "clear" ); + * \endcode + * + * Note that for some widgets, this may not provide the intended bahavior. For + * example if you make use of the code above and a TDEListView has the focus, clear() + * will clear all of the items in the list. If this is not the intened behavior + * and you want to make use of this slot, you can subclass TDEListView and reimplement + * this slot. For example the following code would implement a TDEListView without this + * behavior: + * + * \code + * class MyListView : public TDEListView { + * Q_OBJECT + * public: + * MyListView( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : TDEListView( parent, name, f ) {} + * virtual ~MyListView() {} + * public slots: + * virtual void clear() {} + * }; + * \endcode + */ + void clear(); + + /** + * If the widget with focus provides a selectAll() slot, call that slot. Thus for a + * simple application select all can be implemented as: + * \code + * KStdAction::selectAll( kapp, TQT_SLOT( selectAll() ), actionCollection() ); + * \endcode + */ + void selectAll(); + + /** + * Broadcast a received keycode to all listening KDE applications + * The primary use for this feature is to connect hotkeys such as + * XF86Display to their respective TDEGlobalAccel functions while + * the screen is locked by kdesktop_lock. + */ + void broadcastKeyCode(unsigned int keyCode); + +public: + /** + * Returns the DCOP name of the service launcher. This will be something like + * klaucher_$host_$uid. + * @return the name of the service launcher + */ + static TQCString launcher(); + + /** + * Starts a service based on the (translated) name of the service. + * E.g. "Web Browser" + * + * @param _name the name of the service + * @param URL if not empty this URL is passed to the service + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param dcopService On success, @p dcopService contains the DCOP name + * under which this service is available. If empty, the service does + * not provide DCOP services. If the pointer is 0 the argument + * will be ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param noWait if set, the function does not wait till the service is running. + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int startServiceByName( const TQString& _name, const TQString &URL, + TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false ); + + /** + * Starts a service based on the (translated) name of the service. + * E.g. "Web Browser" + * + * @param _name the name of the service + * @param URLs if not empty these URLs will be passed to the service + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param dcopService On success, @p dcopService contains the DCOP name + * under which this service is available. If empty, the service does + * not provide DCOP services. If the pointer is 0 the argument + * will be ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param noWait if set, the function does not wait till the service is running. + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int startServiceByName( const TQString& _name, const TQStringList &URLs=TQStringList(), + TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false ); + + /** + * Starts a service based on the desktop path of the service. + * E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop" + * + * @param _name the path of the desktop file + * @param URL if not empty this URL is passed to the service + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param dcopService On success, @p dcopService contains the DCOP name + * under which this service is available. If empty, the service does + * not provide DCOP services. If the pointer is 0 the argument + * will be ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param noWait if set, the function does not wait till the service is running. + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int startServiceByDesktopPath( const TQString& _name, const TQString &URL, + TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); + + /** + * Starts a service based on the desktop path of the service. + * E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop" + * + * @param _name the path of the desktop file + * @param URLs if not empty these URLs will be passed to the service + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param dcopService On success, @p dcopService contains the DCOP name + * under which this service is available. If empty, the service does + * not provide DCOP services. If the pointer is 0 the argument + * will be ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param noWait if set, the function does not wait till the service is running. + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs=TQStringList(), + TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); + + /** + * Starts a service based on the desktop name of the service. + * E.g. "konqueror" + * + * @param _name the desktop name of the service + * @param URL if not empty this URL is passed to the service + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param dcopService On success, @p dcopService contains the DCOP name + * under which this service is available. If empty, the service does + * not provide DCOP services. If the pointer is 0 the argument + * will be ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param noWait if set, the function does not wait till the service is running. + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int startServiceByDesktopName( const TQString& _name, const TQString &URL, + TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); + + /** + * Starts a service based on the desktop name of the service. + * E.g. "konqueror" + * + * @param _name the desktop name of the service + * @param URLs if not empty these URLs will be passed to the service + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param dcopService On success, @p dcopService contains the DCOP name + * under which this service is available. If empty, the service does + * not provide DCOP services. If the pointer is 0 the argument + * will be ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @param noWait if set, the function does not wait till the service is running. + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int startServiceByDesktopName( const TQString& _name, const TQStringList &URLs=TQStringList(), + TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false ); + + /** + * Starts a program via tdeinit. + * + * program name and arguments are converted to according to the + * local encoding and passed as is to tdeinit. + * + * @param name Name of the program to start + * @param args Arguments to pass to the program + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int tdeinitExec( const TQString& name, const TQStringList &args, + TQString *error, int *pid, const TQCString& startup_id ); + // KDE4 merge with above with startup_id = "" + static int tdeinitExec( const TQString& name, const TQStringList &args=TQStringList(), + TQString *error=0, int *pid = 0 ); + + /** + * Starts a program via tdeinit and wait for it to finish. + * + * Like tdeinitExec(), but it waits till the program is finished. + * As such it behaves similar to the system(...) function. + * + * @param name Name of the program to start + * @param args Arguments to pass to the program + * @param error On failure, @p error contains a description of the error + * that occurred. If the pointer is 0, the argument will be + * ignored + * @param pid On success, the process id of the new service will be written + * here. If the pointer is 0, the argument will be ignored. + * @param startup_id for app startup notification, "0" for none, + * "" ( empty string ) is the default + * @return an error code indicating success (== 0) or failure (> 0). + */ + static int tdeinitExecWait( const TQString& name, const TQStringList &args, + TQString *error, int *pid, const TQCString& startup_id ); + // KDE4 merge with above with startup_id = "" + static int tdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(), + TQString *error=0, int *pid = 0 ); + + /** + * Returns a text for the window caption. + * + * This may be set by + * "-caption", otherwise it will be equivalent to the name of the + * executable. + * @return the text for the window caption + */ + TQString caption() const; + + /** + * @deprecated + */ + KDE_DEPRECATED TDEStyle* kstyle() const { return 0; } + + /** + * Builds a caption that contains the application name along with the + * userCaption using a standard layout. + * + * To make a compliant caption + * for your window, simply do: @p setCaption(kapp->makeStdCaption(yourCaption)); + * + * @param userCaption The caption string you want to display in the + * window caption area. Do not include the application name! + * @param withAppName Indicates that the method shall include or ignore + * the application name when making the caption string. You are not + * compliant if you set this to @p false. + * @param modified If true, a 'modified' sign will be included in the + * returned string. This is useful when indicating that a file is + * modified, i.e., it contains data that has not been saved. + * @return the created caption + */ + TQString makeStdCaption( const TQString &userCaption, + bool withAppName=true, bool modified=false ) const; + + /** + * Get a file name in order to make a temporary copy of your document. + * + * @param pFilename The full path to the current file of your + * document. + * @return A new filename for auto-saving. + */ + TQString tempSaveName( const TQString& pFilename ) const; + + /** + * Check whether an auto-save file exists for the document you want to + * open. + * + * @param pFilename The full path to the document you want to open. + * @param bRecover This gets set to true if there was a recover + * file. + * @return The full path of the file to open. + */ + TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const; + +#if defined(Q_WS_X11) + /** + * @internal + * Get the X11 display + * @return the X11 Display + */ + Display *getDisplay() { return display; } +#endif + + /** + * @internal + * Gets X11 composition information + */ + void getX11RGBAInformation(Display *dpy); + + /** + * Gets the availability of a composition manager such as kompmgr + * Note that at least one application must have called detectCompositionManagerAvailable + * while the current X display was active in order for this method to return valid results. + * @see detectCompositionManagerAvailable() + * @return whether the composition manager is enabled + */ + static bool isCompositionManagerAvailable(); + + /** + * Detects the availability of a composition manager such as kompmgr + * Note that calling this method will probably cause the screen to flicker. + * @see isCompositionManagerAvailable() + * @param force_available If set, force TDE to assume a composition manager is available + * @param available Whether or not the composition manager is available (only used if force_available is TRUE) + * @return whether the composition manager is enabled + */ + bool detectCompositionManagerAvailable(bool force_available=false, bool available=true); + + /** + * @internal + * Opens the display + * This can be used to initialize a TDEApplication with RGBA support like this: + * TDEApplication app(TDEApplication::openX11RGBADisplay()); + * or + * TDEApplication app(TDEApplication::openX11RGBADisplay(), useStyles); + */ + static Display* openX11RGBADisplay(); + + /** + * Returns the X11 display visual + * + * @return A pointer to the X11 display visual + */ + Qt::HANDLE getX11RGBAVisual(Display *dpy); + + /** + * Returns the X11 display colormap + * + * @return An X11 display colormap object + */ + Qt::HANDLE getX11RGBAColormap(Display *dpy); + + /** + * Returns whether or not X11 composition is available + * + * You must first call getX11RGBAInformation() + * + * Note that getX11RGBAInformation() has already + * been called if you used the default TDEApplication + * constructor. + * + * Additionally, at least one application must have called + * detectCompositionManagerAvailable while the current X + * display was active in order for this method to return + * valid results. + * + * @return true if composition is available + */ + bool isX11CompositionAvailable(); + + /** + * Enables style plugins. + * + * This is useful only to applications that normally + * do not display a GUI and create the TDEApplication with + * allowStyles set to false. + */ + void enableStyles(); + + /** + * Disables style plugins. + * + * Current style plugins do not get unloaded. + * + * This is only useful when used in combination with enableStyles(). + */ + void disableStyles(); + + /** + * Installs widget filter as global X11 event filter. + * + * The widget + * filter receives XEvents in its standard TQWidget::x11Event() function. + * + * Warning: Only do this when absolutely necessary. An installed X11 filter + * can slow things down. + **/ + void installX11EventFilter( TQWidget* filter ); + + /** + * Removes global X11 event filter previously installed by + * installX11EventFilter(). + */ + void removeX11EventFilter( const TQWidget* filter ); + + /** + * Generates a uniform random number. + * @return A truly unpredictable number in the range [0, RAND_MAX) + */ + static int random(); + + /** + * Generates a random string. It operates in the range [A-Za-z0-9] + * @param length Generate a string of this length. + * @return the random string + */ + static TQString randomString(int length); + + /** + * Adds a message type to the KIPC event mask. You can only add "system + * messages" to the event mask. These are the messages with id < 32. + * Messages with id >= 32 are user messages. + * @param id The message id. See KIPC::Message. + * @see KIPC + * @see removeKipcEventMask() + * @see kipcMessage() + */ + void addKipcEventMask(int id); + + /** + * Removes a message type from the KIPC event mask. This message will + * not be handled anymore. + * @param id The message id. + * @see KIPC + * @see addKipcEventMask() + * @see kipcMessage() + */ + void removeKipcEventMask(int id); + + /** + * Returns the app startup notification identifier for this running + * application. + * @return the startup notification identifier + */ + TQCString startupId() const; + + /** + * @internal + * Sets a new value for the application startup notification window property for newly + * created toplevel windows. + * @param startup_id the startup notification identifier + * @see TDEStartupInfo::setNewStartupId + */ + void setStartupId( const TQCString& startup_id ); + + /** + * Updates the last user action timestamp to the given time, or to the current time, + * if 0 is given. Do not use unless you're really sure what you're doing. + * Consult focus stealing prevention section in tdebase/twin/README. + * @since 3.2 + */ + void updateUserTimestamp( unsigned long time = 0 ); + + /** + * Returns the last user action timestamp or 0 if no user activity has taken place yet. + * @since 3.2.3 + * @see updateuserTimestamp + */ + unsigned long userTimestamp() const; + + /** + * Updates the last user action timestamp in the application registered to DCOP with dcopId + * to the given time, or to this application's user time, if 0 is given. + * Use before causing user interaction in the remote application, e.g. invoking a dialog + * in the application using a DCOP call. + * Consult focus stealing prevention section in tdebase/twin/README. + * @since 3.3 + */ + void updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time = 0 ); + + /** + * Returns the argument to --geometry if any, so the geometry can be set + * wherever necessary + * @return the geometry argument, or TQString::null if there is none + */ + TQString geometryArgument() const; + + /** + * Install a Qt SQL property map with entries for all KDE widgets + * Call this in any application using KDE widgets in TQSqlForm or TQDataView. + */ + void installKDEPropertyMap(); + + /** + * Returns whether a certain action is authorized + * @param genericAction The name of a generic action + * @return true if the action is authorized + */ + bool authorize(const TQString &genericAction); + + /** + * Returns whether a certain TDEAction is authorized. + * + * @param action The name of a TDEAction action. The name is prepended + * with "action/" before being passed to authorize() + * @return true if the TDEAction is authorized + */ + bool authorizeTDEAction(const char *action); + + /** + * Returns whether a certain URL related action is authorized. + * + * @param action The name of the action. Known actions are + * list (may be listed (e.g. in file selection dialog)), + * link (may be linked to), + * open (may open) and + * redirect (may be redirected to) + * @param baseURL The url where the action originates from + * @param destURL The object of the action + * @return true when the action is authorized, false otherwise. + * @since 3.1 + */ + bool authorizeURLAction(const TQString &action, const KURL &baseURL, const KURL &destURL); + + /** + * Allow a certain URL action. This can be useful if your application + * needs to ensure access to an application specific directory that may + * otherwise be subject to KIOSK restrictions. + * @param action The name of the action. + * @param _baseURL The url where the action originates from + * @param _destURL The object of the action + * @since 3.2 + */ + void allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL); + + /** + * Returns whether access to a certain control module is authorized. + * + * @param menuId identifying the control module, e.g. tde-mouse.desktop + * @return true if access to the module is authorized, false otherwise. + * @since 3.2 + */ + bool authorizeControlModule(const TQString &menuId); + + /** + * Returns whether access to a certain control modules is authorized. + * + * @param menuIds list of menu-ids of control module, + * an example of a menu-id is tde-mouse.desktop. + * @return Those control modules for which access has been authorized. + * @since 3.2 + */ + TQStringList authorizeControlModules(const TQStringList &menuIds); + + /** + * Returns the state of the currently pressed keyboard modifiers (e.g. shift, control, etc.) + * and mouse buttons, similarly to TQKeyEvent::state() and TQMouseEvent::state(). + * You usually should simply use the information provided by TQKeyEvent and TQMouseEvent, + * but it can be useful to query for the status of the modifiers at another moment + * (e.g. some KDE apps do that upon a drop event). + * @return the keyboard modifiers and mouse buttons state + * @since 3.4 + */ + static ButtonState keyboardMouseState(); + + // Same values as ShiftMask etc. in X.h + enum { ShiftModifier = 1<<0, + LockModifier = 1<<1, + ControlModifier = 1<<2, + Modifier1 = 1<<3, + Modifier2 = 1<<4, + Modifier3 = 1<<5, + Modifier4 = 1<<6, + Modifier5 = 1<<7 }; + /** + * @deprecated Use keyboardMouseState() + * @since 3.1 + */ + static uint keyboardModifiers() KDE_DEPRECATED; + + /** @deprecated Same values as Button1Mask etc. in X.h */ + enum { Button1Pressed = 1<<8, + Button2Pressed = 1<<9, + Button3Pressed = 1<<10, + Button4Pressed = 1<<11, + Button5Pressed = 1<<12 }; + /** + * @deprecated Use keyboardMouseState() + * @since 3.1 + */ + static uint mouseState() KDE_DEPRECATED; + + +public slots: + /** + * Tells TDEApplication about one more operation that should be finished + * before the application exits. The standard behavior is to exit on the + * "last window closed" event, but some events should outlive the last window closed + * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client). + */ + void ref(); + + /** + * Tells TDEApplication that one operation such as those described in ref() just finished. + * The application exits if the counter is back to 0. + */ + void deref(); + +protected: + /** + * @internal Used by KUniqueApplication + */ + TDEApplication( bool allowStyles, bool GUIenabled, TDEInstance* _instance ); + +#ifdef Q_WS_X11 + /** + * @internal Used by KUniqueApplication + */ + TDEApplication( Display *display, Qt::HANDLE visual, Qt::HANDLE colormap, + bool allowStyles, TDEInstance* _instance ); + + /** + * Used to catch X11 events + */ + bool x11EventFilter( XEvent * ); + + Display *display; +#endif + Atom kipcCommAtom; + int kipcEventMask; + + /// Current application object. + static TDEApplication *KApp; + int pArgc; + + /** + * This method is used internally to determine which edit slots are implemented + * by the widget that has the focus, and to invoke those slots if available. + * + * @param slot is the slot as returned using the TQT_SLOT() macro, for example TQT_SLOT( cut() ) + * + * This method can be used in TDEApplication subclasses to implement application wide + * edit actions not supported by the TDEApplication class. For example (in your subclass): + * + * \code + * void MyApplication::deselect() + * { + * invokeEditSlot( TQT_SLOT( deselect() ) ); + * } + * \endcode + * + * Now in your application calls to MyApplication::deselect() will call this slot on the + * focused widget if it provides this slot. You can combine this with TDEAction with: + * + * \code + * KStdAction::deselect( static_cast<MyApplication *>( kapp ), TQT_SLOT( cut() ), actionCollection() ); + * \endcode + * + * @see cut() + * @see copy() + * @see paste() + * @see clear() + * @see selectAll() + * + * @since 3.2 + */ + void invokeEditSlot( const char *slot ); + +private slots: + void dcopFailure(const TQString &); + void dcopBlockUserInput( bool ); + void x11FilterDestroyed(); + void checkAppStartedSlot(); + +private: + TQString sessionConfigName() const; + TDEConfig* pSessionConfig; //instance specific application config object + static DCOPClient *s_DCOPClient; // app specific application communication client + static bool s_dcopClientNeedsPostInit; + TQString aCaption; // the name for the window title + bool bSessionManagement; + struct oldPixmapType { TQPixmap a, b; }; + mutable union { + struct { + TQPixmap *icon, *miniIcon; + } pm; + char unused[sizeof(oldPixmapType)]; + } aIconPixmap; // KDE4: remove me + TQString aIconName; + TQString aMiniIconName; + bool useStyles; + TQWidget *smw; + + void init( bool GUIenabled ); + + void parseCommandLine( ); // Handle KDE arguments (Using TDECmdLineArgs) + + void read_app_startup_id(); + + void dcopAutoRegistration(); + void dcopClientPostInit(); + void initUrlActionRestrictions(); + + bool argb_visual; +#if defined(Q_WS_X11) + Qt::HANDLE argb_x11_visual; + Qt::HANDLE argb_x11_colormap; +#endif + +public: + /** + * @internal + */ + bool notify(TQObject *receiver, TQEvent *event); + + /** + @internal + */ + int xErrhandler( Display*, void* ); + + /** + @internal + */ + int xioErrhandler( Display* ); + + /** + * @internal + */ + void iceIOErrorHandler( _IceConn *conn ); + + /** + * @internal + */ + static bool loadedByKdeinit; + + /** + * @internal + */ + static void startKdeinit(); + + /** + * Valid values for the settingsChanged signal + */ + enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS, + SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS }; + + /** + * Used to obtain the TQPalette that will be used to set the application palette. + * + * This is only useful for configuration modules such as krdb and should not be + * used in normal circumstances. + * @return the QPalette + * @since 3.1 + */ + static TQPalette createApplicationPalette(); + + /** + * @internal + * Raw access for use by TDM. + */ + static TQPalette createApplicationPalette( TDEConfig *config, int contrast ); + + /** + * Installs a handler for the SIGPIPE signal. It is thrown when you write to + * a pipe or socket that has been closed. + * The handler is installed automatically in the constructor, but you may + * need it if your application or component does not have a TDEApplication + * instance. + */ + static void installSigpipeHandler(); + + /** + * @internal + * Whether widgets can be used. + * + * @since 3.2 + */ + static bool guiEnabled(); + +signals: + /** + * Emitted when TDEApplication has changed its palette due to a KControl request. + * + * Normally, widgets will update their palette automatically, but you + * should connect to this to program special behavior. + */ + void tdedisplayPaletteChanged(); + + /** + * Emitted when TDEApplication has changed its GUI style in response to a KControl request. + * + * Normally, widgets will update their styles automatically (as they would + * respond to an explicit setGUIStyle() call), but you should connect to + * this to program special behavior. + */ + void tdedisplayStyleChanged(); + + /** + * Emitted when TDEApplication has changed its font in response to a KControl request. + * + * Normally widgets will update their fonts automatically, but you should + * connect to this to monitor global font changes, especially if you are + * using explicit fonts. + * + * Note: If you derive from a QWidget-based class, a faster method is to + * reimplement TQWidget::fontChange(). This is the preferred way + * to get informed about font updates. + */ + void tdedisplayFontChanged(); + + /** + * Emitted when TDEApplication has changed either its GUI style, its font or its palette + * in response to a tdedisplay request. Normally, widgets will update their styles + * automatically, but you should connect to this to program special + * behavior. */ + void appearanceChanged(); + + /** + * Emitted when the settings for toolbars have been changed. TDEToolBar will know what to do. + */ + void toolbarAppearanceChanged(int); + + /** + * Emitted when the desktop background has been changed by @p kcmdisplay. + * + * @param desk The desktop whose background has changed. + */ + void backgroundChanged(int desk); + + /** + * Emitted when the global settings have been changed - see TDEGlobalSettings + * TDEApplication takes care of calling reparseConfiguration on TDEGlobal::config() + * so that applications/classes using this only have to re-read the configuration + * @param category the category among the enum above + */ + void settingsChanged(int category); + + /** + * Emitted when the global icon settings have been changed. + * @param group the new group + */ + void iconChanged(int group); + + /** + * Emitted when a KIPC user message has been received. + * @param id the message id + * @param data the data + * @see KIPC + * @see KIPC::Message + * @see addKipcEventMask + * @see removeKipcEventMask + */ + void kipcMessage(int id, int data); + + /** + Session management asks you to save the state of your application. + + This signal is provided for compatibility only. For new + applications, simply use TDEMainWindow. By reimplementing + TDEMainWindow::queryClose(), TDEMainWindow::saveProperties() and + TDEMainWindow::readProperties() you can simply handle session + management for applications with multiple toplevel windows. + + For purposes without TDEMainWindow, create an instance of + KSessionManaged and reimplement the functions + KSessionManaged::commitData() and/or + KSessionManaged::saveState() + + If you still want to use this signal, here is what you should do: + + Connect to this signal in order to save your data. Do NOT + manipulate the UI in that slot, it is blocked by the session + manager. + + Use the sessionConfig() TDEConfig object to store all your + instance specific data. + + Do not do any closing at this point! The user may still select + Cancel wanting to continue working with your + application. Cleanups could be done after shutDown() (see + the following). + + */ + void saveYourself(); + + /** Your application is killed. Either by your program itself, + @p xkill or (the usual case) by KDE's logout. + + The signal is particularly useful if your application has to do some + last-second cleanups. Note that no user interaction is possible at + this state. + */ + void shutDown(); + + /** + * @internal + * Used to notify TDEIconLoader objects that they need to reload. + */ + void updateIconLoaders(); + + /** + * @internal + * Used to send TDEGlobalAccel objects a new keypress from physical hotkeys. + */ + void coreFakeKeyPress(unsigned int keyCode); + +private: + void propagateSettings(SettingsCategory category); + void tdedisplaySetPalette(); + void tdedisplaySetStyle(); + void tdedisplaySetFont(); + void applyGUIStyle(); + static void sigpipeHandler(int); + + int captionLayout; + + TDEApplication(const TDEApplication&); + TDEApplication& operator=(const TDEApplication&); +protected: + virtual void virtual_hook( int id, void* data ); +private: + TDEApplicationPrivate* d; +}; + + +/** + * \relates TDEGlobal + * Check, if a file may be accessed in a given mode. + * This is a wrapper around the access() system call. + * checkAccess() calls access() with the given parameters. + * If this is OK, checkAccess() returns true. If not, and W_OK + * is part of mode, it is checked if there is write access to + * the directory. If yes, checkAccess() returns true. + * In all other cases checkAccess() returns false. + * + * Other than access() this function EXPLICITLY ignores non-existant + * files if checking for write access. + * + * @param pathname The full path of the file you want to test + * @param mode The access mode, as in the access() system call. + * @return Whether the access is allowed, true = Access allowed + */ +TDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode); + +class KSessionManagedPrivate; + +/** + Provides highlevel access to session management on a per-object + base. + + KSessionManaged makes it possible to provide implementations for + TQApplication::commitData() and TQApplication::saveState(), without + subclassing TDEApplication. TDEMainWindow internally makes use of this. + + You don't need to do anything with this class when using + TDEMainWindow. Instead, use TDEMainWindow::saveProperties(), + TDEMainWindow::readProperties(), TDEMainWindow::queryClose(), + TDEMainWindow::queryExit() and friends. + + @short Highlevel access to session management. + @author Matthias Ettrich <ettrich@kde.org> + */ +class TDECORE_EXPORT KSessionManaged +{ +public: + KSessionManaged(); + virtual ~KSessionManaged(); + + /** + See TQApplication::saveState() for documentation. + + This function is just a convenience version to avoid subclassing TDEApplication. + + Return true to indicate a successful state save or false to + indicate a problem and to halt the shutdown process (will + implicitly call sm.cancel() ). + */ + virtual bool saveState( TQSessionManager& sm ); + /** + See TQApplication::commitData() for documentation. + + This function is just a convenience version to avoid subclassing TDEApplication. + + Return true to indicate a successful commit of data or false to + indicate a problem and to halt the shutdown process (will + implicitly call sm.cancel() ). + */ + virtual bool commitData( TQSessionManager& sm ); + +protected: + virtual void virtual_hook( int id, void* data ); +private: + KSessionManagedPrivate *d; +}; + + +#endif + diff --git a/tdecore/tdecmdlineargs.cpp b/tdecore/tdecmdlineargs.cpp new file mode 100644 index 000000000..ad24467e2 --- /dev/null +++ b/tdecore/tdecmdlineargs.cpp @@ -0,0 +1,1298 @@ +/* + Copyright (C) 1999 Waldo Bastian <bastian@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 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <config.h> + +#include <sys/param.h> + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + +#include <tqdir.h> +#include <tqfile.h> +#include <tqasciidict.h> +#include <tqstrlist.h> + +#include "tdecmdlineargs.h" +#include <tdeaboutdata.h> +#include <klocale.h> +#include <tdeapplication.h> +#include <kglobal.h> +#include <kstringhandler.h> +#include <kstaticdeleter.h> + +#ifdef Q_WS_X11 +#define DISPLAY "DISPLAY" +#elif defined(Q_WS_QWS) +#define DISPLAY "QWS_DISPLAY" +#endif + +#ifdef Q_WS_WIN +#include <win32_utils.h> +#endif + +template class TQAsciiDict<TQCString>; +template class TQPtrList<TDECmdLineArgs>; + +class TDECmdLineParsedOptions : public TQAsciiDict<TQCString> +{ +public: + TDECmdLineParsedOptions() + : TQAsciiDict<TQCString>( 7 ) { } + + // WABA: Huh? + // The compiler doesn't find TDECmdLineParsedOptions::write(s) by itself ??? + // WABA: No, because there is another write function that hides the + // write function in the base class even though this function has a + // different signature. (obscure C++ feature) + TQDataStream& save( TQDataStream &s) const + { return TQGDict::write(s); } + + TQDataStream& load( TQDataStream &s) + { return TQGDict::read(s); } + +protected: + virtual TQDataStream& write( TQDataStream &s, TQPtrCollection::Item data) const + { + TQCString *str = (TQCString *) data; + s << (*str); + return s; + } + + virtual TQDataStream& read( TQDataStream &s, TQPtrCollection::Item &item) + { + TQCString *str = new TQCString; + s >> (*str); + item = (void *)str; + return s; + } + +}; + +class TDECmdLineParsedArgs : public TQStrList +{ +public: + TDECmdLineParsedArgs() + : TQStrList( true ) { } + TQDataStream& save( TQDataStream &s) const + { return TQGList::write(s); } + + TQDataStream& load( TQDataStream &s) + { return TQGList::read(s); } +}; + + +class TDECmdLineArgsList: public TQPtrList<TDECmdLineArgs> +{ +public: + TDECmdLineArgsList() { } +}; + +TDECmdLineArgsList *TDECmdLineArgs::argsList = 0; +int TDECmdLineArgs::argc = 0; +char **TDECmdLineArgs::argv = 0; +char *TDECmdLineArgs::mCwd = 0; +static KStaticDeleter <char> mCwdd; +const TDEAboutData *TDECmdLineArgs::about = 0; +bool TDECmdLineArgs::parsed = false; +bool TDECmdLineArgs::ignoreUnknown = false; + +// +// Static functions +// + +void +TDECmdLineArgs::init(int _argc, char **_argv, const char *_appname, const char* programName, + const char *_description, const char *_version, bool noKApp) +{ + init(_argc, _argv, + new TDEAboutData(_appname, programName, _version, _description), + noKApp); +} + +void +TDECmdLineArgs::init(int _argc, char **_argv, const char *_appname, + const char *_description, const char *_version, bool noKApp) +{ + init(_argc, _argv, + new TDEAboutData(_appname, _appname, _version, _description), + noKApp); +} + +void +TDECmdLineArgs::initIgnore(int _argc, char **_argv, const char *_appname ) +{ + init(_argc, _argv, + new TDEAboutData(_appname, _appname, "unknown", "TDE Application", false)); + ignoreUnknown = true; +} + +void +TDECmdLineArgs::init(const TDEAboutData* ab) +{ + char **_argv = (char **) malloc(sizeof(char *)); + _argv[0] = (char *) ab->appName(); + init(1,_argv,ab, true); +} + + +void +TDECmdLineArgs::init(int _argc, char **_argv, const TDEAboutData *_about, bool noKApp) +{ + argc = _argc; + argv = _argv; + + if (!argv) + { + fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); + fprintf(stderr, "Passing null-pointer to 'argv' is not allowed.\n\n"); + + assert( 0 ); + exit(255); + } + + // Strip path from argv[0] + if (argc) { + char *p = strrchr( argv[0], '/'); + if (p) + argv[0] = p+1; + } + + about = _about; + parsed = false; + mCwd = mCwdd.setObject(mCwd, new char [PATH_MAX+1], true); + (void) getcwd(mCwd, PATH_MAX); +#ifdef Q_WS_WIN + win32_slashify(mCwd, PATH_MAX); +#endif + if (!noKApp) + TDEApplication::addCmdLineOptions(); +} + +TQString TDECmdLineArgs::cwd() +{ + return TQFile::decodeName(TQCString(mCwd)); +} + +const char * TDECmdLineArgs::appName() +{ + if (!argc) return 0; + return argv[0]; +} + +void +TDECmdLineArgs::addCmdLineOptions( const TDECmdLineOptions *options, const char *name, + const char *id, const char *afterId) +{ + if (!argsList) + argsList = new TDECmdLineArgsList(); + + int pos = argsList->count(); + + if (pos && id && argsList->last() && !argsList->last()->name) + pos--; + + TDECmdLineArgs *args; + int i = 0; + for(args = argsList->first(); args; args = argsList->next(), i++) + { + if (!id && !args->id) + return; // Options already present. + + if (id && args->id && (::qstrcmp(id, args->id) == 0)) + return; // Options already present. + + if (afterId && args->id && (::qstrcmp(afterId, args->id) == 0)) + pos = i+1; + } + + assert( parsed == false ); // You must add _ALL_ cmd line options + // before accessing the arguments! + args = new TDECmdLineArgs(options, name, id); + argsList->insert(pos, args); +} + +void +TDECmdLineArgs::saveAppArgs( TQDataStream &ds) +{ + if (!parsed) + parseAllArgs(); + + // Remove Qt and TDE options. + removeArgs("qt"); + removeArgs("tde"); + + TQCString qCwd = mCwd; + ds << qCwd; + + uint count = argsList ? argsList->count() : 0; + ds << count; + + if (!count) return; + + TDECmdLineArgs *args; + for(args = argsList->first(); args; args = argsList->next()) + { + ds << TQCString(args->id); + args->save(ds); + } +} + +void +TDECmdLineArgs::loadAppArgs( TQDataStream &ds) +{ + parsed = true; // don't reparse argc/argv! + + // Remove Qt and TDE options. + removeArgs("qt"); + removeArgs("tde"); + + TDECmdLineArgs *args; + if ( argsList ) { + for(args = argsList->first(); args; args = argsList->next()) + { + args->clear(); + } + } + + if (ds.atEnd()) + return; + + TQCString qCwd; + ds >> qCwd; + delete [] mCwd; + + mCwd = mCwdd.setObject(mCwd, new char[qCwd.length()+1], true); + strncpy(mCwd, qCwd.data(), qCwd.length()+1); + + uint count; + ds >> count; + + while(count--) + { + TQCString id; + ds >> id; + assert( argsList ); + for(args = argsList->first(); args; args = argsList->next()) + { + if (args->id == id) + { + args->load(ds); + break; + } + } + } + parsed = true; +} + +TDECmdLineArgs *TDECmdLineArgs::parsedArgs(const char *id) +{ + TDECmdLineArgs *args = argsList ? argsList->first() : 0; + while(args) + { + if ((id && ::qstrcmp(args->id, id) == 0) || (!id && !args->id)) + { + if (!parsed) + parseAllArgs(); + return args; + } + args = argsList->next(); + } + + return args; +} + +void TDECmdLineArgs::removeArgs(const char *id) +{ + TDECmdLineArgs *args = argsList ? argsList->first() : 0; + while(args) + { + if (args->id && id && ::qstrcmp(args->id, id) == 0) + { + if (!parsed) + parseAllArgs(); + break; + } + args = argsList->next(); + } + + if (args) + delete args; +} + +/* + * @return: + * 0 - option not found. + * 1 - option found // -fork + * 2 - inverse option found ('no') // -nofork + * 3 - option + arg found // -fork now + * + * +4 - no more options follow // !fork + */ +static int +findOption(const TDECmdLineOptions *options, TQCString &opt, + const char *&opt_name, const char *&def, bool &enabled) +{ + int result; + bool inverse; + int len = opt.length(); + while(options && options->name) + { + result = 0; + inverse = false; + opt_name = options->name; + if ((opt_name[0] == ':') || (opt_name[0] == 0)) + { + options++; + continue; + } + + if (opt_name[0] == '!') + { + opt_name++; + result = 4; + } + if ((opt_name[0] == 'n') && (opt_name[1] == 'o')) + { + opt_name += 2; + inverse = true; + } + if (strncmp(opt.data(), opt_name, len) == 0) + { + opt_name += len; + if (!opt_name[0]) + { + if (inverse) + return result+2; + + if (!options->description) + { + options++; + if (!options->name) + return result+0; + TQCString nextOption = options->name; + int p = nextOption.find(' '); + if (p > 0) + nextOption = nextOption.left(p); + if (nextOption[0] == '!') + nextOption = nextOption.mid(1); + if (strncmp(nextOption.data(), "no", 2) == 0) + { + nextOption = nextOption.mid(2); + enabled = !enabled; + } + result = findOption(options, nextOption, opt_name, def, enabled); + assert(result); + opt = nextOption; + return result; + } + + return 1; + } + if (opt_name[0] == ' ') + { + opt_name++; + def = options->def; + return result+3; + } + } + + options++; + } + return 0; +} + + +void +TDECmdLineArgs::findOption(const char *_opt, TQCString opt, int &i, bool _enabled, bool &moreOptions) +{ + TDECmdLineArgs *args = argsList->first(); + const char *opt_name; + const char *def; + TQCString argument; + int j = opt.find('='); + if (j != -1) + { + argument = opt.mid(j+1); + opt = opt.left(j); + } + + bool enabled = true; + int result = 0; + while (args) + { + enabled = _enabled; + result = ::findOption(args->options, opt, opt_name, def, enabled); + if (result) break; + args = argsList->next(); + } + if (!args && (_opt[0] == '-') && _opt[1] && (_opt[1] != '-')) + { + // Option not found check if it is a valid option + // in the style of -Pprinter1 or ps -aux + int p = 1; + while (true) + { + TQCString singleCharOption = " "; + singleCharOption[0] = _opt[p]; + args = argsList->first(); + while (args) + { + enabled = _enabled; + result = ::findOption(args->options, singleCharOption, opt_name, def, enabled); + if (result) break; + args = argsList->next(); + } + if (!args) + break; // Unknown argument + + p++; + if (result == 1) // Single option + { + args->setOption(singleCharOption, enabled); + if (_opt[p]) + continue; // Next option + else + return; // Finished + } + else if (result == 3) // This option takes an argument + { + if (argument.isEmpty()) + { + argument = _opt+p; + } + args->setOption(singleCharOption, (const char*)argument); + return; + } + break; // Unknown argument + } + args = 0; + result = 0; + } + + if (!args || !result) + { + if (ignoreUnknown) + return; + enable_i18n(); + usage( i18n("Unknown option '%1'.").arg(TQString::fromLocal8Bit(_opt))); + } + + if ((result & 4) != 0) + { + result &= ~4; + moreOptions = false; + } + + if (result == 3) // This option takes an argument + { + if (!enabled) + { + if (ignoreUnknown) + return; + enable_i18n(); + usage( i18n("Unknown option '%1'.").arg(TQString::fromLocal8Bit(_opt))); + } + if (argument.isEmpty()) + { + i++; + if (i >= argc) + { + enable_i18n(); + usage( i18n("'%1' missing.").arg( opt_name)); + } + argument = argv[i]; + } + args->setOption(opt, (const char*)argument); + } + else + { + args->setOption(opt, enabled); + } +} + +void +TDECmdLineArgs::printQ(const TQString &msg) +{ + TQCString localMsg = msg.local8Bit(); + fprintf(stdout, "%s", localMsg.data()); +} + +void +TDECmdLineArgs::parseAllArgs() +{ + bool allowArgs = false; + bool inOptions = true; + bool everythingAfterArgIsArgs = false; + TDECmdLineArgs *appOptions = argsList->last(); + if (!appOptions->id) + { + const TDECmdLineOptions *option = appOptions->options; + while(option && option->name) + { + if (option->name[0] == '+') + allowArgs = true; + if ( option->name[0] == '!' && option->name[1] == '+' ) + { + allowArgs = true; + everythingAfterArgIsArgs = true; + } + option++; + } + } + for(int i = 1; i < argc; i++) + { + if (!argv[i]) + continue; + + if ((argv[i][0] == '-') && argv[i][1] && inOptions) + { + bool enabled = true; + const char *option = &argv[i][1]; + const char *orig = argv[i]; + if (option[0] == '-') + { + option++; + argv[i]++; + if (!option[0]) + { + inOptions = false; + continue; + } + } + if (::qstrcmp(option, "help") == 0) + { + usage(0); + } + else if (strncmp(option, "help-",5) == 0) + { + usage(option+5); + } + else if ( (::qstrcmp(option, "version") == 0) || + (::qstrcmp(option, "v") == 0)) + { + printQ( TQString("Qt: %1\n").arg(tqVersion())); + printQ( TQString("TDE: %1\n").arg(TDE_VERSION_STRING)); + printQ( TQString("%1: %2\n"). + arg(about->programName()).arg(about->version())); + exit(0); + } else if ( (::qstrcmp(option, "license") == 0) ) + { + enable_i18n(); + printQ( about->license() ); + printQ( "\n" ); + exit(0); + } else if ( ::qstrcmp( option, "author") == 0 ) { + enable_i18n(); + if ( about ) { + const TQValueList<TDEAboutPerson> authors = about->authors(); + if ( !authors.isEmpty() ) { + TQString authorlist; + for (TQValueList<TDEAboutPerson>::ConstIterator it = authors.begin(); it != authors.end(); ++it ) { + TQString email; + if ( !(*it).emailAddress().isEmpty() ) + email = " <" + (*it).emailAddress() + ">"; + authorlist += TQString(" ") + (*it).name() + email + "\n"; + } + printQ( i18n("the 2nd argument is a list of name+address, one on each line","%1 was written by\n%2").arg ( TQString(about->programName()) ).arg( authorlist ) ); + } + } else { + printQ( i18n("This application was written by somebody who wants to remain anonymous.") ); + } + if (about) + { + if (!about->customAuthorTextEnabled ()) + { + if (about->bugAddress().isEmpty() || about->bugAddress() == "bugs.pearsoncomputing.net" ) + printQ( i18n( "Please use http://bugs.pearsoncomputing.net to report bugs.\n" ) ); + else { + if( about->authors().count() == 1 && about->authors().first().emailAddress() == about->bugAddress() ) + printQ( i18n( "Please report bugs to %1.\n" ).arg( about->authors().first().emailAddress() ) ); + else + printQ( i18n( "Please report bugs to %1.\n" ).arg(about->bugAddress()) ); + } + } + else + { + printQ(about->customAuthorPlainText()); + } + } + exit(0); + } else { + if ((option[0] == 'n') && (option[1] == 'o')) + { + option += 2; + enabled = false; + } + findOption(orig, option, i, enabled, inOptions); + } + } + else + { + // Check whether appOptions allows these arguments + if (!allowArgs) + { + if (ignoreUnknown) + continue; + enable_i18n(); + usage( i18n("Unexpected argument '%1'.").arg(TQString::fromLocal8Bit(argv[i]))); + } + else + { + appOptions->addArgument(argv[i]); + if (everythingAfterArgIsArgs) + inOptions = false; + } + } + } + parsed = true; +} + +/** + * For TDEApplication only: + * + * Return argc + */ +int * +TDECmdLineArgs::tqt_argc() +{ + if (!argsList) + TDEApplication::addCmdLineOptions(); // Lazy bastards! + + static int tqt_argc = -1; + if( tqt_argc != -1 ) + return &tqt_argc; + + TDECmdLineArgs *args = parsedArgs("qt"); + assert(args); // No qt options have been added! + if (!argv) + { + fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); + fprintf(stderr, "Application has not called TDECmdLineArgs::init(...).\n\n"); + + assert( 0 ); + exit(255); + } + + assert(argc >= (args->count()+1)); + tqt_argc = args->count() +1; + return &tqt_argc; +} + +/** + * For TDEApplication only: + * + * Return argv + */ +char *** +TDECmdLineArgs::tqt_argv() +{ + if (!argsList) + TDEApplication::addCmdLineOptions(); // Lazy bastards! + + static char** tqt_argv; + if( tqt_argv != NULL ) + return &tqt_argv; + + TDECmdLineArgs *args = parsedArgs("qt"); + assert(args); // No qt options have been added! + if (!argv) + { + fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); + fprintf(stderr, "Application has not called TDECmdLineArgs::init(...).\n\n"); + + assert( 0 ); + exit(255); + } + + tqt_argv = new char*[ args->count() + 2 ]; + tqt_argv[ 0 ] = tqstrdup( appName()); + int i = 0; + for(; i < args->count(); i++) + { + tqt_argv[i+1] = tqstrdup((char *) args->arg(i)); + } + tqt_argv[i+1] = 0; + + return &tqt_argv; +} + +void +TDECmdLineArgs::enable_i18n() +{ + // called twice or too late + if (TDEGlobal::_locale) + return; + + if (!TDEGlobal::_instance) { + TDEInstance *instance = new TDEInstance(about); + (void) instance->config(); + // Don't delete instance! + } +} + +void +TDECmdLineArgs::usage(const TQString &error) +{ + assert(TDEGlobal::_locale); + TQCString localError = error.local8Bit(); + if (localError[error.length()-1] == '\n') + localError = localError.left(error.length()-1); + fprintf(stderr, "%s: %s\n", argv[0], localError.data()); + + TQString tmp = i18n("Use --help to get a list of available command line options."); + localError = tmp.local8Bit(); + fprintf(stderr, "%s: %s\n", argv[0], localError.data()); + exit(254); +} + +void +TDECmdLineArgs::usage(const char *id) +{ + enable_i18n(); + assert(argsList != 0); // It's an error to call usage(...) without + // having done addCmdLineOptions first! + + TQString optionFormatString = " %1 %2\n"; + TQString optionFormatStringDef = " %1 %2 [%3]\n"; + TQString optionHeaderString = i18n("\n%1:\n"); + TQString tmp; + TQString usage; + + TDECmdLineArgs *args = argsList->last(); + + if (!(args->id) && (args->options) && + (args->options->name) && (args->options->name[0] != '+')) + { + usage = i18n("[options] ")+usage; + } + + while(args) + { + if (args->name) + { + usage = i18n("[%1-options]").arg(args->name)+" "+usage; + } + args = argsList->prev(); + } + + TDECmdLineArgs *appOptions = argsList->last(); + if (!appOptions->id) + { + const TDECmdLineOptions *option = appOptions->options; + while(option && option->name) + { + if (option->name[0] == '+') + usage = usage + (option->name+1) + " "; + else if ( option->name[0] == '!' && option->name[1] == '+' ) + usage = usage + (option->name+2) + " "; + + option++; + } + } + + printQ(i18n("Usage: %1 %2\n").arg(argv[0]).arg(usage)); + printQ("\n"+about->shortDescription()+"\n"); + + printQ(optionHeaderString.arg(i18n("Generic options"))); + printQ(optionFormatString.arg("--help", -25).arg(i18n("Show help about options"))); + + args = argsList->first(); + while(args) + { + if (args->name && args->id) + { + TQString option = TQString("--help-%1").arg(args->id); + TQString desc = i18n("Show %1 specific options").arg(args->name); + + printQ(optionFormatString.arg(option, -25).arg(desc)); + } + args = argsList->next(); + } + + printQ(optionFormatString.arg("--help-all",-25).arg(i18n("Show all options"))); + printQ(optionFormatString.arg("--author",-25).arg(i18n("Show author information"))); + printQ(optionFormatString.arg("-v, --version",-25).arg(i18n("Show version information"))); + printQ(optionFormatString.arg("--license",-25).arg(i18n("Show license information"))); + printQ(optionFormatString.arg("--", -25).arg(i18n("End of options"))); + + args = argsList->first(); // Sets current to 1st. + + bool showAll = id && (::qstrcmp(id, "all") == 0); + + if (!showAll) + { + while(args) + { + if (!id && !args->id) break; + if (id && (::qstrcmp(args->id, id) == 0)) break; + args = argsList->next(); + } + } + + while(args) + { + bool hasArgs = false; + bool hasOptions = false; + TQString optionsHeader; + if (args->name) + optionsHeader = optionHeaderString.arg(i18n("%1 options").arg(TQString::fromLatin1(args->name))); + else + optionsHeader = i18n("\nOptions:\n"); + + while (args) + { + const TDECmdLineOptions *option = args->options; + TQCString opt = ""; +// + while(option && option->name) + { + TQString description; + TQString descriptionRest; + TQStringList dl; + + // Option header + if (option->name[0] == ':') + { + if (option->description) + { + optionsHeader = "\n"+i18n(option->description); + if (!optionsHeader.endsWith("\n")) + optionsHeader.append("\n"); + hasOptions = false; + } + option++; + continue; + } + + // Free-form comment + if (option->name[0] == 0) + { + if (option->description) + { + TQString tmp = "\n"+i18n(option->description); + if (!tmp.endsWith("\n")) + tmp.append("\n"); + printQ(tmp); + } + option++; + continue; + } + + // Options + if (option->description) + { + description = i18n(option->description); + dl = TQStringList::split("\n", description, true); + description = dl.first(); + dl.remove( dl.begin() ); + } + TQCString name = option->name; + if (name[0] == '!') + name = name.mid(1); + + if (name[0] == '+') + { + if (!hasArgs) + { + printQ(i18n("\nArguments:\n")); + hasArgs = true; + } + + name = name.mid(1); + if ((name[0] == '[') && (name[name.length()-1] == ']')) + name = name.mid(1, name.length()-2); + printQ(optionFormatString.arg(QString(name), -25) + .arg(description)); + } + else + { + if (!hasOptions) + { + printQ(optionsHeader); + hasOptions = true; + } + + if ((name.length() == 1) || (name[1] == ' ')) + name = "-"+name; + else + name = "--"+name; + if (!option->description) + { + opt = name + ", "; + } + else + { + opt = opt + name; + if (!option->def) + { + printQ(optionFormatString.arg(QString(opt), -25) + .arg(description)); + } + else + { + printQ(optionFormatStringDef.arg(QString(opt), -25) + .arg(description).arg(option->def)); + } + opt = ""; + } + } + for(TQStringList::Iterator it = dl.begin(); + it != dl.end(); + ++it) + { + printQ(optionFormatString.arg("", -25).arg(*it)); + } + + option++; + } + args = argsList->next(); + if (!args || args->name || !args->id) break; + } + if (!showAll) break; + } + + exit(254); +} + +// +// Member functions +// + +/** + * Constructor. + * + * The given arguments are assumed to be constants. + */ +TDECmdLineArgs::TDECmdLineArgs( const TDECmdLineOptions *_options, + const char *_name, const char *_id) + : options(_options), name(_name), id(_id) +{ + parsedOptionList = 0; + parsedArgList = 0; + isQt = (::qstrcmp(id, "qt") == 0); +} + +/** + * Destructor. + */ +TDECmdLineArgs::~TDECmdLineArgs() +{ + delete parsedOptionList; + delete parsedArgList; + if (argsList) + argsList->removeRef(this); +} + +void +TDECmdLineArgs::clear() +{ + delete parsedArgList; + parsedArgList = 0; + delete parsedOptionList; + parsedOptionList = 0; +} + +void +TDECmdLineArgs::reset() +{ + if ( argsList ) { + argsList->setAutoDelete( true ); + argsList->clear(); + delete argsList; + argsList = 0; + } + parsed = false; +} + +void +TDECmdLineArgs::save( TQDataStream &ds) const +{ + uint count = 0; + if (parsedOptionList) + parsedOptionList->save( ds ); + else + ds << count; + + if (parsedArgList) + parsedArgList->save( ds ); + else + ds << count; +} + +void +TDECmdLineArgs::load( TQDataStream &ds) +{ + if (!parsedOptionList) parsedOptionList = new TDECmdLineParsedOptions; + if (!parsedArgList) parsedArgList = new TDECmdLineParsedArgs; + + parsedOptionList->load( ds ); + parsedArgList->load( ds ); + + if (parsedOptionList->count() == 0) + { + delete parsedOptionList; + parsedOptionList = 0; + } + if (parsedArgList->count() == 0) + { + delete parsedArgList; + parsedArgList = 0; + } +} + +void +TDECmdLineArgs::setOption(const TQCString &opt, bool enabled) +{ + if (isQt) + { + // Qt does it own parsing. + TQCString arg = "-"; + if( !enabled ) + arg += "no"; + arg += opt; + addArgument(arg); + } + if (!parsedOptionList) { + parsedOptionList = new TDECmdLineParsedOptions; + parsedOptionList->setAutoDelete(true); + } + + if (enabled) + parsedOptionList->replace( opt, new TQCString("t") ); + else + parsedOptionList->replace( opt, new TQCString("f") ); +} + +void +TDECmdLineArgs::setOption(const TQCString &opt, const char *value) +{ + if (isQt) + { + // Qt does it's own parsing. + TQCString arg = "-"; + arg += opt; + addArgument(arg); + addArgument(value); + +#ifdef Q_WS_X11 + // Hack coming up! + if (arg == "-display") + { + setenv(DISPLAY, value, true); + } +#endif + } + if (!parsedOptionList) { + parsedOptionList = new TDECmdLineParsedOptions; + parsedOptionList->setAutoDelete(true); + } + + parsedOptionList->insert( opt, new TQCString(value) ); +} + +TQCString +TDECmdLineArgs::getOption(const char *_opt) const +{ + TQCString *value = 0; + if (parsedOptionList) + { + value = parsedOptionList->find(_opt); + } + + if (value) + return (*value); + + // Look up the default. + const char *opt_name; + const char *def; + bool dummy = true; + TQCString opt = _opt; + int result = ::findOption( options, opt, opt_name, def, dummy) & ~4; + + if (result != 3) + { + fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); + fprintf(stderr, "Application requests for getOption(\"%s\") but the \"%s\" option\n", + _opt, _opt); + fprintf(stderr, "has never been specified via addCmdLineOptions( ... )\n\n"); + + assert( 0 ); + exit(255); + } + return TQCString(def); +} + +QCStringList +TDECmdLineArgs::getOptionList(const char *_opt) const +{ + QCStringList result; + if (!parsedOptionList) + return result; + + while(true) + { + TQCString *value = parsedOptionList->take(_opt); + if (!value) + break; + result.prepend(*value); + delete value; + } + + // Reinsert items in dictionary + // WABA: This is rather silly, but I don't want to add restrictions + // to the API like "you can only call this function once". + // I can't access all items without taking them out of the list. + // So taking them out and then putting them back is the only way. + for(QCStringList::ConstIterator it=result.begin(); + it != result.end(); + ++it) + { + parsedOptionList->insert(_opt, new TQCString(*it)); + } + return result; +} + +bool +TDECmdLineArgs::isSet(const char *_opt) const +{ + // Look up the default. + const char *opt_name; + const char *def; + bool dummy = true; + TQCString opt = _opt; + int result = ::findOption( options, opt, opt_name, def, dummy) & ~4; + + if (result == 0) + { + fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs):\n"); + fprintf(stderr, "Application requests for isSet(\"%s\") but the \"%s\" option\n", + _opt, _opt); + fprintf(stderr, "has never been specified via addCmdLineOptions( ... )\n\n"); + + assert( 0 ); + exit(255); + } + + TQCString *value = 0; + if (parsedOptionList) + { + value = parsedOptionList->find(opt); + } + + if (value) + { + if (result == 3) + return true; + else + return ((*value)[0] == 't'); + } + + if (result == 3) + return false; // String option has 'false' as default. + + // We return 'true' as default if the option was listed as '-nofork' + // We return 'false' as default if the option was listed as '-fork' + return (result == 2); +} + +int +TDECmdLineArgs::count() const +{ + if (!parsedArgList) + return 0; + return parsedArgList->count(); +} + +const char * +TDECmdLineArgs::arg(int n) const +{ + if (!parsedArgList || (n >= (int) parsedArgList->count())) + { + fprintf(stderr, "\n\nFAILURE (TDECmdLineArgs): Argument out of bounds\n"); + fprintf(stderr, "Application requests for arg(%d) without checking count() first.\n", + n); + + assert( 0 ); + exit(255); + } + + return parsedArgList->at(n); +} + +KURL +TDECmdLineArgs::url(int n) const +{ + return makeURL( arg(n) ); +} + +KURL TDECmdLineArgs::makeURL(const char *_urlArg) +{ + const TQString urlArg = TQFile::decodeName(_urlArg); + TQFileInfo fileInfo(urlArg); + if (!fileInfo.isRelative()) { // i.e. starts with '/', on unix + KURL result; + result.setPath(urlArg); + return result; // Absolute path. + } + + if ( KURL::isRelativeURL(urlArg) || fileInfo.exists() ) { + KURL result; + result.setPath( cwd()+'/'+urlArg ); + result.cleanPath(); + return result; // Relative path + } + + return KURL(urlArg); // Argument is a URL +} + +void +TDECmdLineArgs::addArgument(const char *argument) +{ + if (!parsedArgList) + parsedArgList = new TDECmdLineParsedArgs; + + parsedArgList->append(argument); +} + +static const TDECmdLineOptions kde_tempfile_option[] = +{ + { "tempfile", I18N_NOOP("The files/URLs opened by the application will be deleted after use"), 0}, + TDECmdLineLastOption +}; + +void +TDECmdLineArgs::addTempFileOption() +{ + TDECmdLineArgs::addCmdLineOptions( kde_tempfile_option, "TDE-tempfile", "tde-tempfile" ); +} + +bool TDECmdLineArgs::isTempFileSet() +{ + TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs( "tde-tempfile" ); + if ( args ) + return args->isSet( "tempfile" ); + return false; +} diff --git a/tdecore/tdecmdlineargs.h b/tdecore/tdecmdlineargs.h new file mode 100644 index 000000000..9b7dc0f4f --- /dev/null +++ b/tdecore/tdecmdlineargs.h @@ -0,0 +1,690 @@ +/* This file is part of the KDE project + Copyright (C) 1999 Waldo Bastian <bastian@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 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., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KCMDLINEARGS_H_ +#define _KCMDLINEARGS_H_ + +#include "tdelibs_export.h" +#include <kurl.h> + +#include <tqptrlist.h> +#include <tqstring.h> +#include <tqvaluelist.h> + +typedef TQValueList<TQCString> QCStringList; + +/** + * @short Structure that holds command line options. + * + * This class is intended to be used with the TDECmdLineArgs class, which + * provides convenient and powerful command line argument parsing and + * handling functionality. + * + * @see TDECmdLineArgs for additional usage information + */ +struct TDECORE_EXPORT TDECmdLineOptions +{ + /** + * The name of the argument as it should be called on the command line and + * appear in <i>myapp --help</i>. + * + * Note that if this option starts with "no" that you will need to test for + * the name without the "no" and the result will be the inverse of what is + * specified. i.e. if "nofoo" is the name of the option and + * <i>myapp --nofoo</i> is called: + * + * \code + * TDECmdLineArgs::parsedArgs()->isSet("foo"); // false + * \endcode + */ + const char *name; + /** + * The text description of the option as should appear in + * <i>myapp --help</i>. This value should be wrapped with I18N_NOOP(). + */ + const char *description; + /** + * The default value for the option, if it is not specified on the + * command line. + */ + const char *def; // Default +}; + +#define TDECmdLineLastOption { 0, 0, 0 } + +class TDECmdLineArgsList; +class TDEApplication; +class KUniqueApplication; +class TDECmdLineParsedOptions; +class TDECmdLineParsedArgs; +class TDEAboutData; +class TDECmdLineArgsPrivate; + +/** + * @short A class for command-line argument handling. + * + * TDECmdLineArgs provides simple access to the command-line arguments + * for an application. It takes into account Qt-specific options, + * KDE-specific options and application specific options. + * + * This class is used in %main() via the static method + * init(). + * + * A typical %KDE application using %TDECmdLineArgs should look like this: + * + * \code + * int main(int argc, char *argv[]) + * { + * // Initialize command line args + * TDECmdLineArgs::init(argc, argv, appName, programName, description, version); + * + * // Tell which options are supported + * TDECmdLineArgs::addCmdLineOptions( options ); + * + * // Add options from other components + * KUniqueApplication::addCmdLineOptions(); + * + * .... + * + * // Create application object without passing 'argc' and 'argv' again. + * KUniqueApplication app; + * + * .... + * + * // Handle our own options/arguments + * // A TDEApplication will usually do this in main but this is not + * // necessary. + * // A KUniqueApplication might want to handle it in newInstance(). + * + * TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + * + * // A binary option (on / off) + * if (args->isSet("some-option")) + * .... + * + * // An option which takes an additional argument + * TQCString anotherOptionArg = args->getOption("another-option"); + * + * // Arguments (e.g. files to open) + * for(int i = 0; i < args->count(); i++) // Counting start at 0! + * { + * // don't forget to convert to Unicode! + * openFile( TQFile::decodeName( args->arg(i))); + * // Or more convenient: + * // openURL( args->url(i)); + * + * } + * + * args->clear(); // Free up some memory. + * .... + * } + * \endcode + * + * The options that an application supports are configured using the + * TDECmdLineOptions class. An example is shown below: + * + * \code + * static const TDECmdLineOptions options[] = + * { + * { "a", I18N_NOOP("A short binary option"), 0 }, + * { "b \<file>", I18N_NOOP("A short option which takes an argument"), 0 }, + * { "c \<speed>", I18N_NOOP("As above but with a default value"), "9600" }, + * { "option1", I18N_NOOP("A long binary option, off by default"), 0 }, + * { "nooption2", I18N_NOOP("A long binary option, on by default"), 0 }, + * { ":", I18N_NOOP("Extra options:"), 0 }, + * { "option3 \<file>", I18N_NOOP("A long option which takes an argument"), 0 }, + * { "option4 \<speed>", I18N_NOOP("A long option which takes an argument, defaulting to 9600"), "9600" }, + * { "d", 0, 0 }, + * { "option5", I18N_NOOP("A long option which has a short option as alias"), 0 }, + * { "e", 0, 0 }, + * { "nooption6", I18N_NOOP("Another long option with an alias"), 0 }, + * { "f", 0, 0 }, + * { "option7 \<speed>", I18N_NOOP("'--option7 speed' is the same as '-f speed'"), 0 }, + * { "!option8 \<cmd>", I18N_NOOP("All options following this one will be treated as arguments"), 0 }, + * { "+file", I18N_NOOP("A required argument 'file'"), 0 }, + * { "+[arg1]", I18N_NOOP("An optional argument 'arg1'"), 0 }, + * { "!+command", I18N_NOOP("A required argument 'command', that can contain multiple words, even starting with '-'"), 0 }, + * { "", I18N_NOOP("Additional help text not associated with any particular option") 0 }, + * TDECmdLineLastOption // End of options. + * }; + * \endcode + * + * The I18N_NOOP macro is used to indicate that these strings should be + * marked for translation. The actual translation is done by TDECmdLineArgs. + * You can't use i18n() here because we are setting up a static data + * structure and can't do translations at compile time. + * + * Note that a program should define the options before any arguments. + * + * When a long option has a short option as an alias, a program should + * only test for the long option. + * + * With the above options a command line could look like: + * \code + * myapp -a -c 4800 --display localhost:0.0 --nooption5 -d /tmp/file + * \endcode + * + * Long binary options can be in the form 'option' and 'nooption'. + * A command line may contain the same binary option multiple times, + * the last option determines the outcome: + * \code + * myapp --nooption4 --option4 --nooption4 + * \endcode + * is the same as: + * \code + * myapp --nooption4 + * \endcode + * + * If an option value is provided multiple times, normally only the last + * value is used: + * \code + * myapp -c 1200 -c 2400 -c 4800 + * \endcode + * is usually the same as: + * \code + * myapp -c 4800 + * \endcode + * + * However, an application can choose to use all values specified as well. + * As an example of this, consider that you may wish to specify a + * number of directories to use: + * \code + * myapp -I /usr/include -I /opt/kde/include -I /usr/X11/include + * \endcode + * When an application does this it should mention this in the description + * of the option. To access these options, use getOptionList() + * + * Tips for end-users: + * + * @li Single char options like "-a -b -c" may be combined into "-abc" + * @li The option "--foo bar" may also be written "--foo=bar" + * @li The option "-P lp1" may also be written "-P=lp1" or "-Plp1" + * @li The option "--foo bar" may also be written "-foo bar" + * + * @author Waldo Bastian + * @version 0.0.4 + */ +class TDECORE_EXPORT TDECmdLineArgs +{ + friend class TDEApplication; + friend class KUniqueApplication; + friend class TQPtrList<TDECmdLineArgs>; +public: + // Static functions: + + /** + * Initialize class. + * + * This function should be called as the very first thing in + * your application. + * @param _argc As passed to @p main(...). + * @param _argv As passed to @p main(...). + * @param _appname The untranslated name of your application. This should + * match with @p argv[0]. + * @param programName A program name string to be used for display + * purposes. This string should be marked for + * translation. Example: I18N_NOOP("KEdit") + * @param _description A short description of what your application is about. + * @param _version A version. + * @param noKApp Set this true to not add commandline options for + * TQApplication / TDEApplication + * + * @since 3.2 + */ + static void init(int _argc, char **_argv, const char *_appname, + const char* programName, const char *_description, + const char *_version, bool noKApp = false); + /** + * @deprecated + * You should convert any calls to this method to use the one + * above, by adding in the program name to be used for display + * purposes. Do not forget to mark it for translation using I18N_NOOP. + */ + static void init(int _argc, char **_argv, + const char *_appname, const char *_description, + const char *_version, bool noKApp = false) KDE_DEPRECATED; + + /** + * Initialize class. + * + * This function should be called as the very first thing in + * your application. It uses TDEAboutData to replace some of the + * arguments that would otherwise be required. + * + * @param _argc As passed to @p main(...). + * @param _argv As passed to @p main(...). + * @param about A TDEAboutData object describing your program. + * @param noKApp Set this true to not add commandline options for + * TQApplication / TDEApplication + */ + static void init(int _argc, char **_argv, + const TDEAboutData *about, bool noKApp = false); + + /** + * Initialize Class + * + * This function should be called as the very first thing in your + * application. This method will rarely be used, since it doesn't + * provide any argument parsing. It does provide access to the + * TDEAboutData information. + * This method is exactly the same as calling + * init(0,0, const TDEAboutData *about, true). + * + * @param about the about data. + * \see TDEAboutData + */ + static void init(const TDEAboutData *about); + + /** + * Add options to your application. + * + * You must make sure that all possible options have been added before + * any class uses the command line arguments. + * + * The list of options should look like this: + * + * \code + * static TDECmdLineOptions options[] = + * { + * { "option1 \<argument>", I18N_NOOP("Description 1"), "my_extra_arg" }, + * { "o", 0, 0 }, + * { "option2", I18N_NOOP("Description 2"), 0 }, + * { "nooption3", I18N_NOOP("Description 3"), 0 }, + * TDECmdLineLastOption + * } + * \endcode + * + * @li "option1" is an option that requires an additional argument, + * but if one is not provided, it uses "my_extra_arg". + * @li "option2" is an option that can be turned on. The default is off. + * @li "option3" is an option that can be turned off. The default is on. + * @li "o" does not have a description. It is an alias for the option + * that follows. In this case "option2". + * @li "+file" specifies an argument. The '+' is removed. If your program + * doesn't specify that it can use arguments your program will abort + * when an argument is passed to it. Note that the reverse is not + * true. If required, you must check yourself the number of arguments + * specified by the user: + * \code + * TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + * if (args->count() == 0) TDECmdLineArgs::usage(i18n("No file specified!")); + * \endcode + * + * In BNF: + * \code + * cmd = myapp [options] file + * options = (option)* + * option = --option1 \<argument> | + * (-o | --option2 | --nooption2) | + * ( --option3 | --nooption3 ) + * \endcode + * + * Instead of "--option3" one may also use "-option3" + * + * Usage examples: + * + * @li "myapp --option1 test" + * @li "myapp" (same as "myapp --option1 my_extra_arg") + * @li "myapp --option2" + * @li "myapp --nooption2" (same as "myapp", since it is off by default) + * @li "myapp -o" (same as "myapp --option2") + * @li "myapp --nooption3" + * @li "myapp --option3 (same as "myapp", since it is on by default) + * @li "myapp --option2 --nooption2" (same as "myapp", because it + * option2 is off by default, and the last usage applies) + * @li "myapp /tmp/file" + * + * @param options A list of options that your code supplies. + * @param name the name of the option, can be 0. + * @param id A name with which these options can be identified, can be 0. + * @param afterId The options are inserted after this set of options, can be 0. + */ + static void addCmdLineOptions( const TDECmdLineOptions *options, + const char *name=0, const char *id = 0, + const char *afterId=0); + + /** + * Access parsed arguments. + * + * This function returns all command line arguments that your code + * handles. If unknown command-line arguments are encountered the program + * is aborted and usage information is shown. + * + * @param id The name of the options you are interested in, can be 0. + */ + static TDECmdLineArgs *parsedArgs(const char *id=0); + + /** + * Get the CWD (Current Working Directory) associated with the + * current command line arguments. + * + * Typically this is needed in KUniqueApplication::newInstance() + * since the CWD of the process may be different from the CWD + * where the user started a second instance. + * @return the current working directory + **/ + static TQString cwd(); + + /** + * Get the appname according to argv[0]. + * @return the name of the application + **/ + static const char *appName(); + + /** + * Print the usage help to stdout and exit. + * + * @param id if 0, print all options. If id is set, only print the + * option specified by id. The id is the value set by + * addCmdLineOptions(). + **/ + static void usage(const char *id = 0); + + /** + * Print an error to stderr and the usage help to stdout and exit. + * @param error the error to print + **/ + static void usage(const TQString &error); + + /** + * Enable i18n to be able to print a translated error message. + * + * N.B.: This function leaks memory, therefore you are expected to exit + * afterwards (e.g., by calling usage()). + **/ + static void enable_i18n(); + + // Member functions: + + + /** + * Read out a string option. + * + * The option must have a corresponding TDECmdLineOptions entry + * of the form: + * \code + * { "option \<argument>", I18N_NOOP("Description"), "default" } + * \endcode + * You cannot test for the presence of an alias - you must always + * test for the full option. + * + * @param option The name of the option without '-'. + * + * @return The value of the option. If the option was not + * present on the command line the default is returned. + * If the option was present more than the value of the + * last occurrence is used. + */ + TQCString getOption(const char *option) const; + + /** + * Read out all occurrences of a string option. + * + * The option must have a corresponding TDECmdLineOptions entry + * of the form: + * \code + * { "option \<argument>", I18N_NOOP("Description"), "default" } + * \endcode + * You cannot test for the presence of an alias - you must always + * test for the full option. + * + * @param option The name of the option, without '-' or '-no'. + * + * @return A list of all option values. If no option was present + * on the command line, an empty list is returned. + */ + QCStringList getOptionList(const char *option) const; + + /** + * Read out a boolean option or check for the presence of string option. + * + * @param option The name of the option without '-' or '-no'. + * + * @return The value of the option. It will be true if the option + * was specifically turned on in the command line, or if the option + * is turned on by default (in the TDECmdLineOptions list) and was + * not specifically turned off in the command line. Equivalently, + * it will be false if the option was specifically turned off in + * the command line, or if the option is turned off by default (in + * the TDECmdLineOptions list) and was not specifically turned on in + * the command line. + */ + bool isSet(const char *option) const; + + /** + * Read the number of arguments that aren't options (but, + * for example, filenames). + * + * @return The number of arguments that aren't options + */ + int count() const; + + /** + * Read out an argument. + * + * @param n The argument to read. 0 is the first argument. + * count()-1 is the last argument. + * + * @return A @p const @p char @p * pointer to the n'th argument. + */ + const char *arg(int n) const; + + /** + * Read out an argument representing a URL. + * + * The argument can be + * @li an absolute filename + * @li a relative filename + * @li a URL + * + * @param n The argument to read. 0 is the first argument. + * count()-1 is the last argument. + * + * @return a URL representing the n'th argument. + */ + KURL url(int n) const; + + /** + * Used by url(). + * Made public for apps that don't use TDECmdLineArgs + * @param urlArg the argument + * @return the url. + */ + static KURL makeURL( const char * urlArg ); + + /** + * Made public for apps that don't use TDECmdLineArgs + * To be done before makeURL, to set the current working + * directory in case makeURL needs it. + * @param cwd the new working directory + */ + static void setCwd( char * cwd ) { mCwd = cwd; } + + /** + * Clear all options and arguments. + */ + void clear(); + + /** + * Reset all option definitions, i.e. cancel all addCmdLineOptions calls. + * Note that TDEApplication's options are removed too, you might want to + * call TDEApplication::addCmdLineOptions if you want them back. + * + * You usually don't want to call this method. + */ + static void reset(); + + /** + * Load arguments from a stream. + */ + static void loadAppArgs( TQDataStream &); + + /** + * Add standard option --tempfile + * @since 3.4 + */ + static void addTempFileOption(); + + // this avoids having to know the "id" used by addTempFileOption + // but this approach doesn't scale well, we can't have 50 standard options here... + /** + * @return true if --tempfile was set + * @since 3.4 + */ + static bool isTempFileSet(); + +protected: + /** + * @internal + * Constructor. + */ + TDECmdLineArgs( const TDECmdLineOptions *_options, const char *_name, + const char *_id); + + /** + * @internal use only. + * + * Use clear() if you want to free up some memory. + * + * Destructor. + */ + ~TDECmdLineArgs(); + +private: + /** + * @internal + * + * Checks what to do with a single option + */ + static void findOption(const char *_opt, TQCString opt, int &i, bool enabled, bool &moreOptions); + + /** + * @internal + * + * Parse all arguments, verify correct syntax and put all arguments + * where they belong. + */ + static void parseAllArgs(); + + /** + * @internal for TDEApplication only: + * + * Return argc + */ + static int *tqt_argc(); + + /** + * @internal for TDEApplication only: + * + * Return argv + */ + + static char ***tqt_argv(); + + /** + * @internal + * + * Remove named options. + * + * @param id The name of the options to be removed. + */ + static void removeArgs(const char *id); + + /** + * @internal for KUniqueApplication only: + * + * Save all but the Qt and KDE arguments to a stream. + */ + static void saveAppArgs( TQDataStream &); + + /** + * @internal + * + * Set a boolean option + */ + void setOption(const TQCString &option, bool enabled); + + /** + * @internal + * + * Set a string option + */ + void setOption(const TQCString &option, const char *value); + + /** + * @internal + * + * Add an argument + */ + void addArgument(const char *argument); + + /** + * @internal + * + * Save to a stream. + */ + void save( TQDataStream &) const; + + /** + * @internal + * + * Restore from a stream. + */ + void load( TQDataStream &); + + /** + * @internal for TDEApplication only + * + * Initialize class. + * + * This function should be called as the very first thing in + * your application. + * @param argc As passed to @p main(...). + * @param argv As passed to @p main(...). + * @param appname The untranslated name of your application. This should + * match with @p argv[0]. + * + * This function makes TDECmdLineArgs ignore all unknown options as well as + * all arguments. + */ + static void initIgnore(int _argc, char **_argv, const char *_appname); + + static void printQ(const TQString &msg); + + const TDECmdLineOptions *options; + const char *name; + const char *id; + TDECmdLineParsedOptions *parsedOptionList; + TDECmdLineParsedArgs *parsedArgList; + bool isQt; + + static TDECmdLineArgsList *argsList; // All options. + static const TDEAboutData *about; + + static int argc; // The original argc + static char **argv; // The original argv + static bool parsed; // Whether we have parsed the arguments since calling init + static bool ignoreUnknown; // Ignore unknown options and arguments + static char *mCwd; // Current working directory. Important for KUnqiueApp! + static bool parseArgs; + + TDECmdLineArgsPrivate *d; +}; + +#endif + diff --git a/tdecore/tdeconfig.cpp b/tdecore/tdeconfig.cpp index 1e75be6f1..35c5b73bc 100644 --- a/tdecore/tdeconfig.cpp +++ b/tdecore/tdeconfig.cpp @@ -32,7 +32,7 @@ #include <tqfileinfo.h> -#include <kapplication.h> +#include <tdeapplication.h> #include "tdeconfigbackend.h" #include "tdeconfig.h" diff --git a/tdecore/tdeconfig_compiler/example/autoexample.cpp b/tdecore/tdeconfig_compiler/example/autoexample.cpp index 6ed89d75f..e25219787 100644 --- a/tdecore/tdeconfig_compiler/example/autoexample.cpp +++ b/tdecore/tdeconfig_compiler/example/autoexample.cpp @@ -24,11 +24,11 @@ #include "exampleprefs_base.h" -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kglobal.h> #include <tdeconfig.h> #include <kstandarddirs.h> diff --git a/tdecore/tdeconfig_compiler/example/example.cpp b/tdecore/tdeconfig_compiler/example/example.cpp index 6788d1ee0..c08339d4a 100644 --- a/tdecore/tdeconfig_compiler/example/example.cpp +++ b/tdecore/tdeconfig_compiler/example/example.cpp @@ -21,11 +21,11 @@ #include "exampleprefs_base.h" -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kglobal.h> #include <tdeconfig.h> #include <kstandarddirs.h> diff --git a/tdecore/tdeconfig_compiler/tdeconfig_compiler.cpp b/tdecore/tdeconfig_compiler/tdeconfig_compiler.cpp index 4a8f52712..753bae532 100644 --- a/tdecore/tdeconfig_compiler/tdeconfig_compiler.cpp +++ b/tdecore/tdeconfig_compiler/tdeconfig_compiler.cpp @@ -27,11 +27,11 @@ #include <tqdom.h> #include <tqregexp.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kglobal.h> #include <tdeconfig.h> #include <ksimpleconfig.h> diff --git a/tdecore/tdeconfigbackend.cpp b/tdecore/tdeconfigbackend.cpp index 4ad70b4a8..d050a2efe 100644 --- a/tdecore/tdeconfigbackend.cpp +++ b/tdecore/tdeconfigbackend.cpp @@ -41,7 +41,7 @@ #include "tdeconfigbackend.h" #include "tdeconfigbase.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <kprocess.h> #include <klocale.h> diff --git a/tdecore/tdeconfigbase.cpp b/tdecore/tdeconfigbase.cpp index d2ecef888..668a688d8 100644 --- a/tdecore/tdeconfigbase.cpp +++ b/tdecore/tdeconfigbase.cpp @@ -27,7 +27,7 @@ #include <tqdir.h> #include <tqtextstream.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <klocale.h> #include <kcharsets.h> diff --git a/tdecore/tdeconfigdialogmanager.cpp b/tdecore/tdeconfigdialogmanager.cpp index ab5218687..dfabefb59 100644 --- a/tdecore/tdeconfigdialogmanager.cpp +++ b/tdecore/tdeconfigdialogmanager.cpp @@ -30,7 +30,7 @@ #include <tqtimer.h> #include <tqwhatsthis.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfigskeleton.h> #include <kdebug.h> #include <kglobal.h> diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index 559650e20..263bc5507 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -30,7 +30,7 @@ #include <ksimpledirwatch.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <libudev.h> diff --git a/tdecore/tdesycoca.cpp b/tdecore/tdesycoca.cpp index 31da8b741..16914c0bc 100644 --- a/tdecore/tdesycoca.cpp +++ b/tdecore/tdesycoca.cpp @@ -26,7 +26,7 @@ #include <tqfile.h> #include <tqbuffer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <kglobal.h> #include <kdebug.h> diff --git a/tdecore/tests/KIDLTest.cpp b/tdecore/tests/KIDLTest.cpp index f022e307a..a54e32be5 100644 --- a/tdecore/tests/KIDLTest.cpp +++ b/tdecore/tests/KIDLTest.cpp @@ -1,6 +1,6 @@ #include "KIDLTest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> KIDLTest::KIDLTest( const TQCString& id ) diff --git a/tdecore/tests/KIDLTestClient.cpp b/tdecore/tests/KIDLTestClient.cpp index 75d5949c7..4614ed51e 100644 --- a/tdecore/tests/KIDLTestClient.cpp +++ b/tdecore/tests/KIDLTestClient.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include "KIDLTest_stub.h" diff --git a/tdecore/tests/dcopkonqtest.cpp b/tdecore/tests/dcopkonqtest.cpp index 79137cd5f..b8bb055d6 100644 --- a/tdecore/tests/dcopkonqtest.cpp +++ b/tdecore/tests/dcopkonqtest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <dcopclient.h> diff --git a/tdecore/tests/kapptest.cpp b/tdecore/tests/kapptest.cpp index bae6a9c2e..0952f292c 100644 --- a/tdecore/tests/kapptest.cpp +++ b/tdecore/tests/kapptest.cpp @@ -17,11 +17,11 @@ */ #define private public -#include "kapplication.h" +#include "tdeapplication.h" #include <stdio.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> #include <kglobalsettings.h> #include <tdesycoca.h> diff --git a/tdecore/tests/kcalendartest.cpp b/tdecore/tests/kcalendartest.cpp index 7856c0430..12c9010e2 100644 --- a/tdecore/tests/kcalendartest.cpp +++ b/tdecore/tests/kcalendartest.cpp @@ -7,12 +7,12 @@ #include <tqstringlist.h> -#include <kapplication.h> -#include <kaboutdata.h> +#include <tdeapplication.h> +#include <tdeaboutdata.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> class TDELocale; diff --git a/tdecore/tests/kcmdlineargstest.cpp b/tdecore/tests/kcmdlineargstest.cpp index f05168e1a..8148e4208 100644 --- a/tdecore/tests/kcmdlineargstest.cpp +++ b/tdecore/tests/kcmdlineargstest.cpp @@ -1,6 +1,6 @@ -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdio.h> diff --git a/tdecore/tests/kglobaltest.cpp b/tdecore/tests/kglobaltest.cpp index 9c7b081de..eaab091f9 100644 --- a/tdecore/tests/kglobaltest.cpp +++ b/tdecore/tests/kglobaltest.cpp @@ -2,11 +2,11 @@ #include <kglobal.h> #include <stdio.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdlib.h> #include <kdebug.h> #include <assert.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> static bool check(const TQString& txt, TQString a, TQString b) { diff --git a/tdecore/tests/kiconloadertest.cpp b/tdecore/tests/kiconloadertest.cpp index 29f810488..c6da1994c 100644 --- a/tdecore/tests/kiconloadertest.cpp +++ b/tdecore/tests/kiconloadertest.cpp @@ -1,7 +1,7 @@ #include <kiconloader.h> #include <tqdatetime.h> #include <stdio.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdlib.h> #include <kdebug.h> diff --git a/tdecore/tests/kipctest.cpp b/tdecore/tests/kipctest.cpp index d6cff80e3..af6785f0c 100644 --- a/tdecore/tests/kipctest.cpp +++ b/tdecore/tests/kipctest.cpp @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <tqobject.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kipc.h> #include "kipctest.h" diff --git a/tdecore/tests/klocaletest.cpp b/tdecore/tests/klocaletest.cpp index 1d0ca7aba..0647a10d3 100644 --- a/tdecore/tests/klocaletest.cpp +++ b/tdecore/tests/klocaletest.cpp @@ -14,7 +14,7 @@ #include <kglobal.h> #include <kglobalsettings.h> #include "klocale.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kcharsets.h> #include <kdebug.h> diff --git a/tdecore/tests/kmacroexpandertest.cpp b/tdecore/tests/kmacroexpandertest.cpp index fe3f66c65..e357b5801 100644 --- a/tdecore/tests/kmacroexpandertest.cpp +++ b/tdecore/tests/kmacroexpandertest.cpp @@ -1,7 +1,7 @@ #include <kmacroexpander.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <stdlib.h> diff --git a/tdecore/tests/kmdcodectest.cpp b/tdecore/tests/kmdcodectest.cpp index 5cdf4ac3e..bd3162f52 100644 --- a/tdecore/tests/kmdcodectest.cpp +++ b/tdecore/tests/kmdcodectest.cpp @@ -28,8 +28,8 @@ #include <kdebug.h> #include <klocale.h> -#include <kcmdlineargs.h> -#include <kapplication.h> +#include <tdecmdlineargs.h> +#include <tdeapplication.h> #include <kmdcodec.h> diff --git a/tdecore/tests/kmemtest.cpp b/tdecore/tests/kmemtest.cpp index 0a2a1bdb8..f0115b569 100644 --- a/tdecore/tests/kmemtest.cpp +++ b/tdecore/tests/kmemtest.cpp @@ -1,5 +1,5 @@ #include <stdio.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdlib.h> #include <errno.h> #include <string.h> diff --git a/tdecore/tests/knotifytest.cpp b/tdecore/tests/knotifytest.cpp index 27076a1e8..6c5af25a7 100644 --- a/tdecore/tests/knotifytest.cpp +++ b/tdecore/tests/knotifytest.cpp @@ -1,5 +1,5 @@ #include <knotifyclient.h> -#include <kapplication.h> +#include <tdeapplication.h> int main( int argc, char **argv ) { diff --git a/tdecore/tests/kprocesstest.cpp b/tdecore/tests/kprocesstest.cpp index f86cb2f20..c81dada50 100644 --- a/tdecore/tests/kprocesstest.cpp +++ b/tdecore/tests/kprocesstest.cpp @@ -13,7 +13,7 @@ #include <stdio.h> #include <string.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <signal.h> diff --git a/tdecore/tests/kprociotest.cpp b/tdecore/tests/kprociotest.cpp index a4fbb19ad..ee7aaf2b7 100644 --- a/tdecore/tests/kprociotest.cpp +++ b/tdecore/tests/kprociotest.cpp @@ -13,7 +13,7 @@ #include <stdio.h> #include <string.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <signal.h> diff --git a/tdecore/tests/krandomsequencetest.cpp b/tdecore/tests/krandomsequencetest.cpp index 53c42facb..2ba0c72ae 100644 --- a/tdecore/tests/krandomsequencetest.cpp +++ b/tdecore/tests/krandomsequencetest.cpp @@ -19,7 +19,7 @@ #include <tqptrlist.h> #include "krandomsequence.h" -#include "kapplication.h" +#include "tdeapplication.h" #include <stdio.h> diff --git a/tdecore/tests/kresolvertest.cpp b/tdecore/tests/kresolvertest.cpp index 6e1a3080f..0e05cab4e 100644 --- a/tdecore/tests/kresolvertest.cpp +++ b/tdecore/tests/kresolvertest.cpp @@ -40,8 +40,8 @@ #include <ksocks.h> #include <ksockaddr.h> #include <kextsock.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include "netsupp.h" diff --git a/tdecore/tests/krfcdatetest.cpp b/tdecore/tests/krfcdatetest.cpp index cb8bffbfd..6ef0fe5e5 100644 --- a/tdecore/tests/krfcdatetest.cpp +++ b/tdecore/tests/krfcdatetest.cpp @@ -1,5 +1,5 @@ #include <stdio.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdlib.h> #include <kdebug.h> #include <kglobal.h> diff --git a/tdecore/tests/ksimpleconfigtest.cpp b/tdecore/tests/ksimpleconfigtest.cpp index 85193f40b..8b0e4ef25 100644 --- a/tdecore/tests/ksimpleconfigtest.cpp +++ b/tdecore/tests/ksimpleconfigtest.cpp @@ -6,7 +6,7 @@ // demonstrates use of KSimpleConfig class #include <ksimpleconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <unistd.h> #include <stdio.h> diff --git a/tdecore/tests/ksocktest.cpp b/tdecore/tests/ksocktest.cpp index e038cbd2c..01a9c4c3a 100644 --- a/tdecore/tests/ksocktest.cpp +++ b/tdecore/tests/ksocktest.cpp @@ -23,8 +23,8 @@ #include "ksockaddr.h" #include "kextsock.h" -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> diff --git a/tdecore/tests/kstddirstest.cpp b/tdecore/tests/kstddirstest.cpp index 75c326280..ae6ea16bd 100644 --- a/tdecore/tests/kstddirstest.cpp +++ b/tdecore/tests/kstddirstest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kinstance.h> #include <kstandarddirs.h> diff --git a/tdecore/tests/ktempfiletest.cpp b/tdecore/tests/ktempfiletest.cpp index ec3a004cd..20cd6b36d 100644 --- a/tdecore/tests/ktempfiletest.cpp +++ b/tdecore/tests/ktempfiletest.cpp @@ -17,7 +17,7 @@ */ #include "ktempfile.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "kstandarddirs.h" #include <tqstring.h> diff --git a/tdecore/tests/ktimezonestest.cpp b/tdecore/tests/ktimezonestest.cpp index 729c88bb6..5eaf5a4fb 100644 --- a/tdecore/tests/ktimezonestest.cpp +++ b/tdecore/tests/ktimezonestest.cpp @@ -1,5 +1,5 @@ #include "ktimezones.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <stdio.h> #include <stdlib.h> diff --git a/tdecore/tests/kuniqueapptest.cpp b/tdecore/tests/kuniqueapptest.cpp index 053956715..60ac98b5a 100644 --- a/tdecore/tests/kuniqueapptest.cpp +++ b/tdecore/tests/kuniqueapptest.cpp @@ -22,8 +22,8 @@ #include <unistd.h> #include <stdlib.h> #include <stdio.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> class TestApp : public KUniqueApplication { diff --git a/tdecore/tests/kurltest.cpp b/tdecore/tests/kurltest.cpp index 178aec6d5..6694d0d80 100644 --- a/tdecore/tests/kurltest.cpp +++ b/tdecore/tests/kurltest.cpp @@ -2,7 +2,7 @@ #include <kurl.h> #include <stdio.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdlib.h> #include <kdebug.h> #include <kglobal.h> @@ -10,7 +10,7 @@ #include <tqtextcodec.h> #include <tqdatastream.h> #include <assert.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> static bool check(TQString txt, TQString a, TQString b) { diff --git a/tdecore/tests/startserviceby.cpp b/tdecore/tests/startserviceby.cpp index 5cccaa3dc..20fc95f34 100644 --- a/tdecore/tests/startserviceby.cpp +++ b/tdecore/tests/startserviceby.cpp @@ -16,11 +16,11 @@ Boston, MA 02110-1301, USA. */ -#include "kapplication.h" +#include "tdeapplication.h" #include <stdio.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> #include <kglobalsettings.h> #include <kdebug.h> diff --git a/tdecore/tests/tdeconfigtestgui.cpp b/tdecore/tests/tdeconfigtestgui.cpp index 5ae85d26d..d1e2d5393 100644 --- a/tdecore/tests/tdeconfigtestgui.cpp +++ b/tdecore/tests/tdeconfigtestgui.cpp @@ -29,7 +29,7 @@ #include <unistd.h> #include <stdlib.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tqdialog.h> #include <tqfile.h> #include <tqfileinfo.h> diff --git a/tdecore/tests/tdeconfigtestgui.h b/tdecore/tests/tdeconfigtestgui.h index 347a9c81d..4aa50cb5f 100644 --- a/tdecore/tests/tdeconfigtestgui.h +++ b/tdecore/tests/tdeconfigtestgui.h @@ -19,7 +19,7 @@ #ifndef _KCONFIG_TEST_H #define _KCONFIG_TEST_H -#include <kapplication.h> +#include <tdeapplication.h> #include <tqdialog.h> #include <tqfile.h> #include <tqfileinfo.h> diff --git a/tdecore/tests/tdestdacceltest.cpp b/tdecore/tests/tdestdacceltest.cpp index fbc5077a5..7a1fe8697 100644 --- a/tdecore/tests/tdestdacceltest.cpp +++ b/tdecore/tests/tdestdacceltest.cpp @@ -1,6 +1,6 @@ #include <config.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdestdaccel.h> #include <stdlib.h> // for exit diff --git a/tdecore/tests/testqtargs.cpp b/tdecore/tests/testqtargs.cpp index a27073468..8383f930e 100644 --- a/tdecore/tests/testqtargs.cpp +++ b/tdecore/tests/testqtargs.cpp @@ -28,7 +28,7 @@ --bg is aliased to --background but If you try it with --background or -background, you get the same thing. - in tdecore/kapplication.cpp, TDECmdLineOption qt_options is defined and used + in tdecore/tdeapplication.cpp, TDECmdLineOption qt_options is defined and used by the static method Kapplication::addCmdLineOptions to add the Qt options but its' entries look like this: @@ -43,9 +43,9 @@ application palette (light and dark shades are\ncalculated)."), 0}, */ -#include <kapplication.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> #include <klocale.h> static const TDECmdLineOptions options[] = diff --git a/tdecore/twin.cpp b/tdecore/twin.cpp index 841463e52..93352dacc 100644 --- a/tdecore/twin.cpp +++ b/tdecore/twin.cpp @@ -35,7 +35,7 @@ #include "config.h" #include "twin.h" -#include "kapplication.h" +#include "tdeapplication.h" #include <kglobal.h> #include <kiconloader.h> diff --git a/tdecore/twinmodule.cpp b/tdecore/twinmodule.cpp index adc20f218..27b8b0cdd 100644 --- a/tdecore/twinmodule.cpp +++ b/tdecore/twinmodule.cpp @@ -26,7 +26,7 @@ #include "twinmodule.h" #include "twin.h" #include <X11/Xatom.h> -#include "kapplication.h" +#include "tdeapplication.h" #include "kdebug.h" #include <tqtl.h> #include <tqptrlist.h> diff --git a/tdefx/CMakeLists.txt b/tdefx/CMakeLists.txt index 1aa52627f..60d81fe38 100644 --- a/tdefx/CMakeLists.txt +++ b/tdefx/CMakeLists.txt @@ -27,7 +27,7 @@ link_directories( install( FILES kpixmap.h kpixmapsplitter.h kpixmapeffect.h - kimageeffect.h kdrawutil.h kstyle.h kcpuinfo.h + kimageeffect.h kdrawutil.h tdestyle.h kcpuinfo.h DESTINATION ${INCLUDE_INSTALL_DIR} ) @@ -37,7 +37,7 @@ set( target tdefx ) set( ${target}_SRCS kpixmap.cpp kpixmapsplitter.cpp kpixmapeffect.cpp - kimageeffect.cpp kdrawutil.cpp kstyle.cpp kcpuinfo.cpp + kimageeffect.cpp kdrawutil.cpp tdestyle.cpp kcpuinfo.cpp ) tde_add_library( ${target} SHARED AUTOMOC diff --git a/tdefx/Makefile.am b/tdefx/Makefile.am index 2b588ba54..7fb97e400 100644 --- a/tdefx/Makefile.am +++ b/tdefx/Makefile.am @@ -30,10 +30,10 @@ libtdefx_la_NMCHECKWEAK = $(srcdir)/libtdefx_weak.nmcheck $(top_srcdir)/tdecore/ $(top_srcdir)/tdecore/standard_weak.nmcheck include_HEADERS = kpixmap.h kpixmapsplitter.h \ - kpixmapeffect.h kimageeffect.h kdrawutil.h kstyle.h kcpuinfo.h + kpixmapeffect.h kimageeffect.h kdrawutil.h tdestyle.h kcpuinfo.h libtdefx_la_SOURCES = kpixmap.cpp kpixmapsplitter.cpp \ - kpixmapeffect.cpp kimageeffect.cpp kdrawutil.cpp kstyle.cpp \ + kpixmapeffect.cpp kimageeffect.cpp kdrawutil.cpp tdestyle.cpp \ kcpuinfo.cpp METASOURCES = AUTO diff --git a/tdefx/kstyle.cpp b/tdefx/kstyle.cpp deleted file mode 100644 index 29663faf3..000000000 --- a/tdefx/kstyle.cpp +++ /dev/null @@ -1,2418 +0,0 @@ -/* - * - * TDEStyle - * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org> - * - * TQWindowsStyle CC_ListView and style images were kindly donated by TrollTech, - * Copyright (C) 1998-2000 TrollTech AS. - * - * Many thanks to Bradley T. Hughes for the 3 button scrollbar code. - * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "kstyle.h" - -#include <tqapplication.h> -#include <tqbitmap.h> -#include <tqmetaobject.h> -#include <tqcleanuphandler.h> -#include <tqmap.h> -#include <tqimage.h> -#include <tqlistview.h> -#include <tqmenubar.h> -#include <tqpainter.h> -#include <tqpixmap.h> -#include <tqpopupmenu.h> -#include <tqprogressbar.h> -#include <tqscrollbar.h> -#include <tqsettings.h> -#include <tqslider.h> -#include <tqstylefactory.h> -#include <tqtabbar.h> -#include <tqtoolbar.h> -#include <tqframe.h> - -#include <kpixmap.h> -#include <kpixmapeffect.h> -#include <kimageeffect.h> - -#ifdef Q_WS_X11 -# include <X11/Xlib.h> -# ifdef HAVE_XRENDER -# include <X11/extensions/Xrender.h> // schroder - extern bool tqt_use_xrender; -# endif -#else -#undef HAVE_XRENDER -#endif - -#ifdef HAVE_XCOMPOSITE -#include <X11/extensions/Xrender.h> -#include <X11/extensions/Xcomposite.h> -#include <dlfcn.h> -#endif - -#include <limits.h> - -namespace -{ - // INTERNAL - enum TransparencyEngine { - Disabled = 0, - SoftwareTint, - SoftwareBlend, - XRender - }; - - // Drop Shadow - struct ShadowElements { - TQWidget* w1; - TQWidget* w2; - }; - typedef TQMap<const TQWidget*,ShadowElements> ShadowMap; - static ShadowMap *_shadowMap = 0; - TQSingleCleanupHandler<ShadowMap> cleanupShadowMap; - ShadowMap &shadowMap() { - if ( !_shadowMap ) { - _shadowMap = new ShadowMap; - cleanupShadowMap.set( &_shadowMap ); - } - return *_shadowMap; - } - - - // DO NOT ASK ME HOW I MADE THESE TABLES! - // (I probably won't remember anyway ;) - const double top_right_corner[16] = - { 0.949, 0.965, 0.980, 0.992, - 0.851, 0.890, 0.945, 0.980, - 0.706, 0.780, 0.890, 0.960, - 0.608, 0.706, 0.851, 0.949 }; - - const double bottom_right_corner[16] = - { 0.608, 0.706, 0.851, 0.949, - 0.706, 0.780, 0.890, 0.960, - 0.851, 0.890, 0.945, 0.980, - 0.949, 0.965, 0.980, 0.992 }; - - const double bottom_left_corner[16] = - { 0.949, 0.851, 0.706, 0.608, - 0.965, 0.890, 0.780, 0.706, - 0.980, 0.945, 0.890, 0.851, - 0.992, 0.980, 0.960, 0.949 }; - - const double shadow_strip[4] = - { 0.565, 0.675, 0.835, 0.945 }; - - static bool useDropShadow(TQWidget* w) - { - return w && w->metaObject() && - w->metaObject()->findProperty("TDEStyleMenuDropShadow") != -1; - } -} - -namespace -{ -class TransparencyHandler : public TQObject -{ - public: - TransparencyHandler(TDEStyle* style, TransparencyEngine tEngine, - float menuOpacity, bool useDropShadow); - ~TransparencyHandler(); - bool eventFilter(TQObject* object, TQEvent* event); - - protected: - void blendToColor(const TQColor &col); - void blendToPixmap(const TQColorGroup &cg, const TQWidget* p); -#ifdef HAVE_XRENDER - void XRenderBlendToPixmap(const TQWidget* p); -#endif - bool haveX11RGBASupport(); - TQImage handleRealAlpha(TQImage); - void createShadowWindows(const TQWidget* p); - void removeShadowWindows(const TQWidget* p); - void rightShadow(TQImage& dst); - void bottomShadow(TQImage& dst); - private: - bool dropShadow; - float opacity; - TQPixmap pix; - TDEStyle* kstyle; - TransparencyEngine te; -}; -} // namespace - -struct TDEStylePrivate -{ - bool highcolor : 1; - bool useFilledFrameWorkaround : 1; - bool etchDisabledText : 1; - bool scrollablePopupmenus : 1; - bool autoHideAccelerators : 1; - bool menuAltKeyNavigation : 1; - bool menuDropShadow : 1; - bool sloppySubMenus : 1; - bool semiTransparentRubberband : 1; - int popupMenuDelay; - float menuOpacity; - - TransparencyEngine transparencyEngine; - TDEStyle::TDEStyleScrollBarType scrollbarType; - TransparencyHandler* menuHandler; - TDEStyle::TDEStyleFlags flags; - - //For KPE_ListViewBranch - TQBitmap *verticalLine; - TQBitmap *horizontalLine; -}; - -// ----------------------------------------------------------------------------- - - -TDEStyle::TDEStyle( TDEStyleFlags flags, TDEStyleScrollBarType sbtype ) - : TQCommonStyle(), d(new TDEStylePrivate) -{ - d->flags = flags; - bool useMenuTransparency = (flags & AllowMenuTransparency); - d->useFilledFrameWorkaround = (flags & FilledFrameWorkaround); - d->scrollbarType = sbtype; - d->highcolor = TQPixmap::defaultDepth() > 8; - - // Read style settings - TQSettings settings; - d->popupMenuDelay = settings.readNumEntry ("/TDEStyle/Settings/PopupMenuDelay", 256); - d->sloppySubMenus = settings.readBoolEntry("/TDEStyle/Settings/SloppySubMenus", false); - d->etchDisabledText = settings.readBoolEntry("/TDEStyle/Settings/EtchDisabledText", true); - d->menuAltKeyNavigation = settings.readBoolEntry("/TDEStyle/Settings/MenuAltKeyNavigation", true); - d->scrollablePopupmenus = settings.readBoolEntry("/TDEStyle/Settings/ScrollablePopupMenus", false); - d->autoHideAccelerators = settings.readBoolEntry("/TDEStyle/Settings/AutoHideAccelerators", false); - d->menuDropShadow = settings.readBoolEntry("/TDEStyle/Settings/MenuDropShadow", false); - d->semiTransparentRubberband = settings.readBoolEntry("/TDEStyle/Settings/SemiTransparentRubberband", false); - d->menuHandler = NULL; - - if (useMenuTransparency) { - TQString effectEngine = settings.readEntry("/TDEStyle/Settings/MenuTransparencyEngine", "Disabled"); - -#ifdef HAVE_XRENDER - if (effectEngine == "XRender") - d->transparencyEngine = XRender; -#else - if (effectEngine == "XRender") - d->transparencyEngine = SoftwareBlend; -#endif - else if (effectEngine == "SoftwareBlend") - d->transparencyEngine = SoftwareBlend; - else if (effectEngine == "SoftwareTint") - d->transparencyEngine = SoftwareTint; - else - d->transparencyEngine = Disabled; - - if (d->transparencyEngine != Disabled) { - // Create an instance of the menu transparency handler - d->menuOpacity = settings.readDoubleEntry("/TDEStyle/Settings/MenuOpacity", 0.90); - d->menuHandler = new TransparencyHandler(this, d->transparencyEngine, - d->menuOpacity, d->menuDropShadow); - } - } - - d->verticalLine = 0; - d->horizontalLine = 0; - - // Create a transparency handler if only drop shadows are enabled. - if (!d->menuHandler && d->menuDropShadow) - d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, d->menuDropShadow); -} - - -TDEStyle::~TDEStyle() -{ - delete d->verticalLine; - delete d->horizontalLine; - - delete d->menuHandler; - - d->menuHandler = NULL; - delete d; -} - - -TQString TDEStyle::defaultStyle() -{ - if (TQPixmap::defaultDepth() > 8) - return TQString("plastik"); - else - return TQString("light, 3rd revision"); -} - -void TDEStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { - TQWidget* widget = reinterpret_cast<TQWidget*>(ptr); - if ( d->useFilledFrameWorkaround ) - { - if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) { - TQFrame::Shape shape = frame->frameShape(); - if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel) - widget->installEventFilter(this); - } - } - if (widget->isTopLevel()) - { - if (!d->menuHandler && useDropShadow(widget)) - d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, false); - - if (d->menuHandler && useDropShadow(widget)) - widget->installEventFilter(d->menuHandler); - } - } -} - - -void TDEStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { - TQWidget* widget = reinterpret_cast<TQWidget*>(ptr); - if ( d->useFilledFrameWorkaround ) - { - if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) { - TQFrame::Shape shape = frame->frameShape(); - if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel) - widget->removeEventFilter(this); - } - } - if (widget->isTopLevel() && d->menuHandler && useDropShadow(widget)) - widget->removeEventFilter(d->menuHandler); - } -} - - -// Style changes (should) always re-polish popups. -void TDEStyle::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) -{ - if ( !(ceData.windowState & WState_Polished ) ) { - widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); - } - - if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { - TQWidget* widget = reinterpret_cast<TQWidget*>(ptr); - TQPopupMenu *p = dynamic_cast<TQPopupMenu*>(widget); - if (p) { - // Install transparency handler if the effect is enabled. - if ( d->menuHandler && (strcmp(p->name(), "tear off menu") != 0)) { - p->installEventFilter(d->menuHandler); - } - } - } -} - - -// ----------------------------------------------------------------------------- -// TDEStyle extensions -// ----------------------------------------------------------------------------- - -void TDEStyle::setScrollBarType(TDEStyleScrollBarType sbtype) -{ - d->scrollbarType = sbtype; -} - -TDEStyle::TDEStyleFlags TDEStyle::styleFlags() const -{ - return d->flags; -} - -void TDEStyle::renderMenuBlendPixmap( KPixmap &pix, const TQColorGroup &cg, - const TQPopupMenu* /* popup */ ) const -{ - pix.fill(cg.button()); // Just tint as the default behavior -} - -void TDEStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, - TQPainter* p, - const TQWidget* widget, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption &opt ) const -{ - TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); - drawTDEStylePrimitive(kpe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, opt); -} - -void TDEStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption&, /* opt */ - const TQWidget* widget ) const -{ - switch( kpe ) - { - // Dock / Toolbar / General handles. - // --------------------------------- - - case KPE_DockWindowHandle: { - - // Draws a nice DockWindow handle including the dock title. - TQWidget* wid = const_cast<TQWidget*>(widget); - bool horizontal = flags & Style_Horizontal; - int x,y,w,h,x2,y2; - - r.rect( &x, &y, &w, &h ); - if ((w <= 2) || (h <= 2)) { - p->fillRect(r, cg.highlight()); - return; - } - - - x2 = x + w - 1; - y2 = y + h - 1; - - TQFont fnt; - fnt = TQApplication::font(wid); - fnt.setPointSize( fnt.pointSize()-2 ); - - // Draw the item on an off-screen pixmap - // to preserve Xft antialiasing for - // vertically oriented handles. - TQPixmap pix; - if (horizontal) - pix.resize( h-2, w-2 ); - else - pix.resize( w-2, h-2 ); - - TQString title = wid->parentWidget()->caption(); - TQPainter p2; - p2.begin(&pix); - p2.fillRect(pix.rect(), cg.brush(TQColorGroup::Highlight)); - p2.setPen(cg.highlightedText()); - p2.setFont(fnt); - p2.drawText(pix.rect(), AlignCenter, title); - p2.end(); - - // Draw a sunken bevel - p->setPen(cg.dark()); - p->drawLine(x, y, x2, y); - p->drawLine(x, y, x, y2); - p->setPen(cg.light()); - p->drawLine(x+1, y2, x2, y2); - p->drawLine(x2, y+1, x2, y2); - - if (horizontal) { - TQWMatrix m; - m.rotate(-90.0); - TQPixmap vpix = pix.xForm(m); - bitBlt(wid, r.x()+1, r.y()+1, &vpix); - } else - bitBlt(wid, r.x()+1, r.y()+1, &pix); - - break; - } - - - /* - * KPE_ListViewExpander and KPE_ListViewBranch are based on code from - * QWindowStyle's CC_ListView, kindly donated by TrollTech. - * CC_ListView code is Copyright (C) 1998-2000 TrollTech AS. - */ - - case KPE_ListViewExpander: { - // Typical Windows style expand/collapse element. - int radius = (r.width() - 4) / 2; - int centerx = r.x() + r.width()/2; - int centery = r.y() + r.height()/2; - - // Outer box - p->setPen( cg.mid() ); - p->drawRect( r ); - - // plus or minus - p->setPen( cg.text() ); - p->drawLine( centerx - radius, centery, centerx + radius, centery ); - if ( flags & Style_On ) // Collapsed = On - p->drawLine( centerx, centery - radius, centerx, centery + radius ); - break; - } - - case KPE_ListViewBranch: { - // Typical Windows style listview branch element (dotted line). - - // Create the dotline pixmaps if not already created - if ( !d->verticalLine ) - { - // make 128*1 and 1*128 bitmaps that can be used for - // drawing the right sort of lines. - d->verticalLine = new TQBitmap( 1, 129, true ); - d->horizontalLine = new TQBitmap( 128, 1, true ); - TQPointArray a( 64 ); - TQPainter p2; - p2.begin( d->verticalLine ); - - int i; - for( i=0; i < 64; i++ ) - a.setPoint( i, 0, i*2+1 ); - p2.setPen( color1 ); - p2.drawPoints( a ); - p2.end(); - TQApplication::flushX(); - d->verticalLine->setMask( *d->verticalLine ); - - p2.begin( d->horizontalLine ); - for( i=0; i < 64; i++ ) - a.setPoint( i, i*2+1, 0 ); - p2.setPen( color1 ); - p2.drawPoints( a ); - p2.end(); - TQApplication::flushX(); - d->horizontalLine->setMask( *d->horizontalLine ); - } - - p->setPen( cg.text() ); // cg.dark() is bad for dark color schemes. - - if (flags & Style_Horizontal) - { - int point = r.x(); - int other = r.y(); - int end = r.x()+r.width(); - int thickness = r.height(); - - while( point < end ) - { - int i = 128; - if ( i+point > end ) - i = end-point; - p->drawPixmap( point, other, *d->horizontalLine, 0, 0, i, thickness ); - point += i; - } - - } else { - int point = r.y(); - int other = r.x(); - int end = r.y()+r.height(); - int thickness = r.width(); - int pixmapoffset = (flags & Style_NoChange) ? 0 : 1; // ### Hackish - - while( point < end ) - { - int i = 128; - if ( i+point > end ) - i = end-point; - p->drawPixmap( other, point, *d->verticalLine, 0, pixmapoffset, thickness, i ); - point += i; - } - } - - break; - } - - // Reimplement the other primitives in your styles. - // The current implementation just paints something visibly different. - case KPE_ToolBarHandle: - case KPE_GeneralHandle: - case KPE_SliderHandle: - p->fillRect(r, cg.light()); - break; - - case KPE_SliderGroove: - p->fillRect(r, cg.dark()); - break; - - default: - p->fillRect(r, Qt::yellow); // Something really bad happened - highlight. - break; - } -} - - -int TDEStyle::kPixelMetric( TDEStylePixelMetric kpm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* /* widget */) const -{ - int value; - switch(kpm) - { - case KPM_ListViewBranchThickness: - value = 1; - break; - - case KPM_MenuItemSeparatorHeight: - case KPM_MenuItemHMargin: - case KPM_MenuItemVMargin: - case KPM_MenuItemHFrame: - case KPM_MenuItemVFrame: - case KPM_MenuItemCheckMarkHMargin: - case KPM_MenuItemArrowHMargin: - case KPM_MenuItemTabSpacing: - default: - value = 0; - } - - return value; -} - -// ----------------------------------------------------------------------------- - -// #ifdef USE_QT4 // tdebindings / smoke needs this function declaration available at all times. Furthermore I don't think it would hurt to have the declaration available at all times...so leave these commented out for now - -//void TDEStyle::drawPrimitive( TQ_ControlElement pe, -// TQPainter* p, -// const TQStyleControlElementData &ceData, -// ControlElementFlags elementFlags, -// const TQRect &r, -// const TQColorGroup &cg, -// SFlags flags, -// const TQStyleOption& opt ) const -//{ -// // FIXME: -// // What should "widget" be in actuality? How should I get it? From where? -// // Almost certainly it should not be null! -// TQWidget *widget = 0; -// drawControl(pe, p, ceData, elementFlags, r, cg, flags, opt, widget); -//} - -// #endif // USE_QT4 - -// ----------------------------------------------------------------------------- - -void TDEStyle::drawPrimitive( TQ_PrimitiveElement pe, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption& opt ) const -{ - // TOOLBAR/DOCK WINDOW HANDLE - // ------------------------------------------------------------------------ - if (pe == PE_DockWindowHandle) - { - // Wild workarounds are here. Beware. - TQWidget *widget, *parent; - - if (p && p->device()->devType() == TQInternal::Widget) { - widget = static_cast<TQWidget*>(p->device()); - parent = widget->parentWidget(); - } else - return; // Don't paint on non-widgets - - // Check if we are a normal toolbar or a hidden dockwidget. - if ( parent && - (parent->inherits(TQTOOLBAR_OBJECT_NAME_STRING) || // Normal toolbar - (parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING)) )) // Collapsed dock - - // Draw a toolbar handle - drawTDEStylePrimitive( KPE_ToolBarHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); - - else if (ceData.widgetObjectTypes.contains(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING)) - - // Draw a dock window handle - drawTDEStylePrimitive( KPE_DockWindowHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); - - else - // General handle, probably a kicker applet handle. - drawTDEStylePrimitive( KPE_GeneralHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); -#if TQT_VERSION >= 0x030300 -#ifdef HAVE_XRENDER - } else if ( d->semiTransparentRubberband && pe == TQStyle::PE_RubberBand ) { - TQRect rect = r.normalize(); - TQPoint point; - point = p->xForm( point ); - - static XRenderColor clr = { 0, 0, 0, 0 }; - static unsigned long fillColor = 0; - if ( fillColor != cg.highlight().rgb() ) { - fillColor = cg.highlight().rgb(); - - unsigned long color = fillColor << 8 | 0x40; - - int red = (color >> 24) & 0xff; - int green = (color >> 16) & 0xff; - int blue = (color >> 8) & 0xff; - int alpha = (color >> 0) & 0xff; - - red = red * alpha / 255; - green = green * alpha / 255; - blue = blue * alpha / 255; - - clr.red = (red << 8) + red; - clr.green = (green << 8) + green; - clr.blue = (blue << 8) + blue; - clr.alpha = (alpha << 8) + alpha; - } - - XRenderFillRectangle( - p->device()->x11Display(), - PictOpOver, - p->device()->x11RenderHandle(), - &clr, - rect.x() + point.x(), - rect.y() + point.y(), - rect.width(), - rect.height() ); - - p->save(); - p->setRasterOp( TQt::CopyROP ); - p->setPen( TQPen( cg.highlight().dark( 160 ), 1 ) ); - p->setBrush( NoBrush ); - p->drawRect( - rect.x() + point.x(), - rect.y() + point.y(), - rect.width(), - rect.height() ); - p->restore(); -#endif -#endif - } else - TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); -} - - - -void TDEStyle::drawControl( TQ_ControlElement element, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - const TQStyleOption &opt, - const TQWidget* widget ) const -{ - switch (element) - { - // TABS - // ------------------------------------------------------------------------ - case CE_TabBarTab: { - TQTabBar::Shape tbs = ceData.tabBarData.shape; - bool selected = flags & Style_Selected; - int x = r.x(), y=r.y(), bottom=r.bottom(), right=r.right(); - - switch (tbs) { - - case TQTabBar::RoundedAbove: { - if (!selected) - p->translate(0,1); - p->setPen(selected ? cg.light() : cg.shadow()); - p->drawLine(x, y+4, x, bottom); - p->drawLine(x, y+4, x+4, y); - p->drawLine(x+4, y, right-1, y); - if (selected) - p->setPen(cg.shadow()); - p->drawLine(right, y+1, right, bottom); - - p->setPen(cg.midlight()); - p->drawLine(x+1, y+4, x+1, bottom); - p->drawLine(x+1, y+4, x+4, y+1); - p->drawLine(x+5, y+1, right-2, y+1); - - if (selected) { - p->setPen(cg.mid()); - p->drawLine(right-1, y+1, right-1, bottom); - } else { - p->setPen(cg.mid()); - p->drawPoint(right-1, y+1); - p->drawLine(x+4, y+2, right-1, y+2); - p->drawLine(x+3, y+3, right-1, y+3); - p->fillRect(x+2, y+4, r.width()-3, r.height()-6, cg.mid()); - - p->setPen(cg.light()); - p->drawLine(x, bottom-1, right, bottom-1); - p->translate(0,-1); - } - break; - } - - case TQTabBar::RoundedBelow: { - if (!selected) - p->translate(0,-1); - p->setPen(selected ? cg.light() : cg.shadow()); - p->drawLine(x, bottom-4, x, y); - if (selected) - p->setPen(cg.mid()); - p->drawLine(x, bottom-4, x+4, bottom); - if (selected) - p->setPen(cg.shadow()); - p->drawLine(x+4, bottom, right-1, bottom); - p->drawLine(right, bottom-1, right, y); - - p->setPen(cg.midlight()); - p->drawLine(x+1, bottom-4, x+1, y); - p->drawLine(x+1, bottom-4, x+4, bottom-1); - p->drawLine(x+5, bottom-1, right-2, bottom-1); - - if (selected) { - p->setPen(cg.mid()); - p->drawLine(right-1, y, right-1, bottom-1); - } else { - p->setPen(cg.mid()); - p->drawPoint(right-1, bottom-1); - p->drawLine(x+4, bottom-2, right-1, bottom-2); - p->drawLine(x+3, bottom-3, right-1, bottom-3); - p->fillRect(x+2, y+2, r.width()-3, r.height()-6, cg.mid()); - p->translate(0,1); - p->setPen(cg.dark()); - p->drawLine(x, y, right, y); - } - break; - } - - case TQTabBar::TriangularAbove: { - if (!selected) - p->translate(0,1); - p->setPen(selected ? cg.light() : cg.shadow()); - p->drawLine(x, bottom, x, y+6); - p->drawLine(x, y+6, x+6, y); - p->drawLine(x+6, y, right-6, y); - if (selected) - p->setPen(cg.mid()); - p->drawLine(right-5, y+1, right-1, y+5); - p->setPen(cg.shadow()); - p->drawLine(right, y+6, right, bottom); - - p->setPen(cg.midlight()); - p->drawLine(x+1, bottom, x+1, y+6); - p->drawLine(x+1, y+6, x+6, y+1); - p->drawLine(x+6, y+1, right-6, y+1); - p->drawLine(right-5, y+2, right-2, y+5); - p->setPen(cg.mid()); - p->drawLine(right-1, y+6, right-1, bottom); - - TQPointArray a(6); - a.setPoint(0, x+2, bottom); - a.setPoint(1, x+2, y+7); - a.setPoint(2, x+7, y+2); - a.setPoint(3, right-7, y+2); - a.setPoint(4, right-2, y+7); - a.setPoint(5, right-2, bottom); - p->setPen (selected ? cg.background() : cg.mid()); - p->setBrush(selected ? cg.background() : cg.mid()); - p->drawPolygon(a); - p->setBrush(NoBrush); - if (!selected) { - p->translate(0,-1); - p->setPen(cg.light()); - p->drawLine(x, bottom, right, bottom); - } - break; - } - - default: { // TQTabBar::TriangularBelow - if (!selected) - p->translate(0,-1); - p->setPen(selected ? cg.light() : cg.shadow()); - p->drawLine(x, y, x, bottom-6); - if (selected) - p->setPen(cg.mid()); - p->drawLine(x, bottom-6, x+6, bottom); - if (selected) - p->setPen(cg.shadow()); - p->drawLine(x+6, bottom, right-6, bottom); - p->drawLine(right-5, bottom-1, right-1, bottom-5); - if (!selected) - p->setPen(cg.shadow()); - p->drawLine(right, bottom-6, right, y); - - p->setPen(cg.midlight()); - p->drawLine(x+1, y, x+1, bottom-6); - p->drawLine(x+1, bottom-6, x+6, bottom-1); - p->drawLine(x+6, bottom-1, right-6, bottom-1); - p->drawLine(right-5, bottom-2, right-2, bottom-5); - p->setPen(cg.mid()); - p->drawLine(right-1, bottom-6, right-1, y); - - TQPointArray a(6); - a.setPoint(0, x+2, y); - a.setPoint(1, x+2, bottom-7); - a.setPoint(2, x+7, bottom-2); - a.setPoint(3, right-7, bottom-2); - a.setPoint(4, right-2, bottom-7); - a.setPoint(5, right-2, y); - p->setPen (selected ? cg.background() : cg.mid()); - p->setBrush(selected ? cg.background() : cg.mid()); - p->drawPolygon(a); - p->setBrush(NoBrush); - if (!selected) { - p->translate(0,1); - p->setPen(cg.dark()); - p->drawLine(x, y, right, y); - } - break; - } - }; - - break; - } - - // Popup menu scroller - // ------------------------------------------------------------------------ - case CE_PopupMenuScroller: { - p->fillRect(r, cg.background()); - drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, Style_Enabled); - drawPrimitive((flags & Style_Up) ? PE_ArrowUp : PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled); - break; - } - - - // PROGRESSBAR - // ------------------------------------------------------------------------ - case CE_ProgressBarGroove: { - TQRect fr = subRect(SR_ProgressBarGroove, ceData, elementFlags, widget); - drawPrimitive(PE_Panel, p, ceData, elementFlags, fr, cg, Style_Sunken, TQStyleOption::SO_Default); - break; - } - - case CE_ProgressBarContents: { - // ### Take into account totalSteps() for busy indicator - TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget); - double progress = ceData.currentStep; - bool reverse = TQApplication::reverseLayout(); - int steps = ceData.totalSteps; - - if (!cr.isValid()) - return; - - // Draw progress bar - if (progress > 0 || steps == 0) { - double pg = (steps == 0) ? 0.1 : progress / steps; - int width = QMIN(cr.width(), (int)(pg * cr.width())); - if (steps == 0) { //Busy indicator - - if (width < 1) width = 1; //A busy indicator with width 0 is kind of useless - - int remWidth = cr.width() - width; //Never disappear completely - if (remWidth <= 0) remWidth = 1; //Do something non-crashy when too small... - - int pstep = int(progress) % ( 2 * remWidth ); - - if ( pstep > remWidth ) { - //Bounce about.. We're remWidth + some delta, we want to be remWidth - delta... - // - ( (remWidth + some delta) - 2* remWidth ) = - (some deleta - remWidth) = remWidth - some delta.. - pstep = - (pstep - 2 * remWidth ); - } - - if (reverse) - p->fillRect(cr.x() + cr.width() - width - pstep, cr.y(), width, cr.height(), - cg.brush(TQColorGroup::Highlight)); - else - p->fillRect(cr.x() + pstep, cr.y(), width, cr.height(), - cg.brush(TQColorGroup::Highlight)); - - return; - } - - - // Do fancy gradient for highcolor displays - if (d->highcolor) { - TQColor c(cg.highlight()); - KPixmap pix; - pix.resize(cr.width(), cr.height()); - KPixmapEffect::gradient(pix, reverse ? c.light(150) : c.dark(150), - reverse ? c.dark(150) : c.light(150), - KPixmapEffect::HorizontalGradient); - if (reverse) - p->drawPixmap(cr.x()+(cr.width()-width), cr.y(), pix, - cr.width()-width, 0, width, cr.height()); - else - p->drawPixmap(cr.x(), cr.y(), pix, 0, 0, width, cr.height()); - } else - if (reverse) - p->fillRect(cr.x()+(cr.width()-width), cr.y(), width, cr.height(), - cg.brush(TQColorGroup::Highlight)); - else - p->fillRect(cr.x(), cr.y(), width, cr.height(), - cg.brush(TQColorGroup::Highlight)); - } - break; - } - - case CE_ProgressBarLabel: { - TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget); - double progress = ceData.currentStep; - bool reverse = TQApplication::reverseLayout(); - int steps = ceData.totalSteps; - - if (!cr.isValid()) - return; - - TQFont font = p->font(); - font.setBold(true); - p->setFont(font); - - // Draw label - if (progress > 0 || steps == 0) { - double pg = (steps == 0) ? 1.0 : progress / steps; - int width = QMIN(cr.width(), (int)(pg * cr.width())); - TQRect crect; - if (reverse) - crect.setRect(cr.x()+(cr.width()-width), cr.y(), cr.width(), cr.height()); - else - crect.setRect(cr.x()+width, cr.y(), cr.width(), cr.height()); - - p->save(); - p->setPen((elementFlags & CEF_IsEnabled) ? (reverse ? cg.text() : cg.highlightedText()) : cg.text()); - p->drawText(r, AlignCenter, ceData.progressText); - p->setClipRect(crect); - p->setPen(reverse ? cg.highlightedText() : cg.text()); - p->drawText(r, AlignCenter, ceData.progressText); - p->restore(); - - } else { - p->setPen(cg.text()); - p->drawText(r, AlignCenter, ceData.progressText); - } - - break; - } - - default: - TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); - } -} - - -TQRect TDEStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const -{ - switch(r) - { - // KDE2 look smooth progress bar - // ------------------------------------------------------------------------ - case SR_ProgressBarGroove: - return ceData.rect; - - case SR_ProgressBarContents: - case SR_ProgressBarLabel: { - // ### take into account indicatorFollowsStyle() - TQRect rt = ceData.rect; - return TQRect(rt.x()+2, rt.y()+2, rt.width()-4, rt.height()-4); - } - - default: - return TQCommonStyle::subRect(r, ceData, elementFlags, widget); - } -} - - -int TDEStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* widget) const -{ - switch(m) - { - // BUTTONS - // ------------------------------------------------------------------------ - case PM_ButtonShiftHorizontal: // Offset by 1 - case PM_ButtonShiftVertical: // ### Make configurable - return 1; - - case PM_DockWindowHandleExtent: - { - TQWidget* parent = 0; - // Check that we are not a normal toolbar or a hidden dockwidget, - // in which case we need to adjust the height for font size - if (widget - && !(ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING)) - && !(ceData.parentWidgetData.widgetObjectTypes.contains(TQMAINWINDOW_OBJECT_NAME_STRING)) - && (ceData.widgetObjectTypes.contains(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING)) ) - return widget->fontMetrics().lineSpacing(); - else - return TQCommonStyle::pixelMetric(m, ceData, elementFlags, widget); - } - - // TABS - // ------------------------------------------------------------------------ - case PM_TabBarTabHSpace: - return 24; - - case PM_TabBarTabVSpace: { - if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove || - ceData.tabBarData.shape == TQTabBar::RoundedBelow ) - return 10; - else - return 4; - } - - case PM_TabBarTabOverlap: { - TQTabBar::Shape tbs = ceData.tabBarData.shape; - - if ( (tbs == TQTabBar::RoundedAbove) || - (tbs == TQTabBar::RoundedBelow) ) - return 0; - else - return 2; - } - - // SLIDER - // ------------------------------------------------------------------------ - case PM_SliderLength: - return 18; - - case PM_SliderThickness: - return 24; - - // Determines how much space to leave for the actual non-tickmark - // portion of the slider. - case PM_SliderControlThickness: { - TQSlider::TickSetting ts = (TQSlider::TickSetting)ceData.tickMarkSetting; - int thickness = (ceData.orientation == TQt::Horizontal) ? - ceData.rect.height() : ceData.rect.width(); - switch (ts) { - case TQSlider::NoMarks: // Use total area. - break; - case TQSlider::Both: - thickness = (thickness/2) + 3; // Use approx. 1/2 of area. - break; - default: // Use approx. 2/3 of area - thickness = ((thickness*2)/3) + 3; - break; - }; - return thickness; - } - - // SPLITTER - // ------------------------------------------------------------------------ - case PM_SplitterWidth: - if (ceData.widgetObjectTypes.contains(TQDOCKWINDOWRESIZEHANDLE_OBJECT_NAME_STRING)) - return 8; // ### why do we need 2pix extra? - else - return 6; - - // FRAMES - // ------------------------------------------------------------------------ - case PM_MenuBarFrameWidth: - return 1; - - case PM_DockWindowFrameWidth: - return 1; - - // GENERAL - // ------------------------------------------------------------------------ - case PM_MaximumDragDistance: - return -1; - - case PM_MenuBarItemSpacing: - return 5; - - case PM_ToolBarItemSpacing: - return 0; - - case PM_PopupMenuScrollerHeight: - return pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, 0); - - default: - return TQCommonStyle::pixelMetric( m, ceData, elementFlags, widget ); - } -} - -//Helper to find the next sibling that's not hidden -static TQListViewItem* nextVisibleSibling(TQListViewItem* item) -{ - TQListViewItem* sibling = item; - do - { - sibling = sibling->nextSibling(); - } - while (sibling && !sibling->isVisible()); - - return sibling; -} - -void TDEStyle::drawComplexControl( TQ_ComplexControl control, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags, - SCFlags controls, - SCFlags active, - const TQStyleOption &opt, - const TQWidget* widget ) const -{ - switch(control) - { - // 3 BUTTON SCROLLBAR - // ------------------------------------------------------------------------ - case CC_ScrollBar: { - // Many thanks to Brad Hughes for contributing this code. - bool useThreeButtonScrollBar = (d->scrollbarType & ThreeButtonScrollBar); - - bool maxedOut = (ceData.minSteps == ceData.maxSteps); - bool horizontal = (ceData.orientation == TQt::Horizontal); - SFlags sflags = ((horizontal ? Style_Horizontal : Style_Default) | - (maxedOut ? Style_Default : Style_Enabled)); - - TQRect addline, subline, subline2, addpage, subpage, slider, first, last; - subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); - addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); - subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); - addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); - slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); - first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); - last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); - subline2 = addline; - - if ( useThreeButtonScrollBar ) { - if (horizontal) { - subline2.moveBy(-addline.width(), 0); - } - else { - subline2.moveBy(0, -addline.height()); - } - } - - // Draw the up/left button set - if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { - drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, - sflags | (active == SC_ScrollBarSubLine ? - Style_Down : Style_Default)); - - if (useThreeButtonScrollBar && subline2.isValid()) - drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg, - sflags | (active == SC_ScrollBarSubLine ? - Style_Down : Style_Default)); - } - - if ((controls & SC_ScrollBarAddLine) && addline.isValid()) - drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, - sflags | ((active == SC_ScrollBarAddLine) ? - Style_Down : Style_Default)); - - if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) - drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, - sflags | ((active == SC_ScrollBarSubPage) ? - Style_Down : Style_Default)); - - if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) - drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, - sflags | ((active == SC_ScrollBarAddPage) ? - Style_Down : Style_Default)); - - if ((controls & SC_ScrollBarFirst) && first.isValid()) - drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, - sflags | ((active == SC_ScrollBarFirst) ? - Style_Down : Style_Default)); - - if ((controls & SC_ScrollBarLast) && last.isValid()) - drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, - sflags | ((active == SC_ScrollBarLast) ? - Style_Down : Style_Default)); - - if ((controls & SC_ScrollBarSlider) && slider.isValid()) { - drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, - sflags | ((active == SC_ScrollBarSlider) ? - Style_Down : Style_Default)); - // Draw focus rect - if (elementFlags & CEF_HasFocus) { - TQRect fr(slider.x() + 2, slider.y() + 2, - slider.width() - 5, slider.height() - 5); - drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); - } - } - break; - } - - - // SLIDER - // ------------------------------------------------------------------- - case CC_Slider: { - TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget); - TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget); - - // Double-buffer slider for no flicker - TQPixmap pix(ceData.rect.size()); - TQPainter p2; - p2.begin(&pix); - - if ( (elementFlags & CEF_HasParentWidget) && - !ceData.parentWidgetData.bgPixmap.isNull() ) { - TQPixmap pixmap = ceData.parentWidgetData.bgPixmap; - p2.drawTiledPixmap(r, pixmap, ceData.pos); - } else - pix.fill(cg.background()); - - // Draw slider groove - if ((controls & SC_SliderGroove) && groove.isValid()) { - drawTDEStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget ); - - // Draw the focus rect around the groove - if (elementFlags & CEF_HasFocus) { - drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg); - } - } - - // Draw the tickmarks - if (controls & SC_SliderTickmarks) - TQCommonStyle::drawComplexControl(control, &p2, ceData, elementFlags, - r, cg, flags, SC_SliderTickmarks, active, opt, widget); - - // Draw the slider handle - if ((controls & SC_SliderHandle) && handle.isValid()) { - if (active == SC_SliderHandle) - flags |= Style_Active; - drawTDEStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget ); - } - - p2.end(); - - TQPaintDevice* ppd = p->device(); - if (ppd->isExtDev()) { - p->drawPixmap(0, 0, pix); - } - else { - bitBlt((TQWidget*)widget, r.x(), r.y(), &pix); - } - break; - } - - // LISTVIEW - // ------------------------------------------------------------------- - case CC_ListView: { - - /* - * Many thanks to TrollTech AS for donating CC_ListView from TQWindowsStyle. - * CC_ListView code is Copyright (C) 1998-2000 TrollTech AS. - */ - - // Paint the icon and text. - if ( controls & SC_ListView ) - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget ); - - // If we're have a branch or are expanded... - if ( controls & (SC_ListViewBranch | SC_ListViewExpand) ) - { - // If no list view item was supplied, break - if (opt.isDefault()) - break; - - TQListViewItem *item = opt.listViewItem(); - TQListViewItem *child = item->firstChild(); - - int y = r.y(); - int c; // dotline vertice count - int dotoffset = 0; - TQPointArray dotlines; - - if ( active == SC_All && controls == SC_ListViewExpand ) { - // We only need to draw a vertical line - c = 2; - dotlines.resize(2); - dotlines[0] = TQPoint( r.right(), r.top() ); - dotlines[1] = TQPoint( r.right(), r.bottom() ); - - } else { - - int linetop = 0, linebot = 0; - // each branch needs at most two lines, ie. four end points - dotoffset = (item->itemPos() + item->height() - y) % 2; - dotlines.resize( item->childCount() * 4 ); - c = 0; - - // skip the stuff above the exposed rectangle - while ( child && y + child->height() <= 0 ) - { - y += child->totalHeight(); - child = nextVisibleSibling(child); - } - - int bx = r.width() / 2; - - // paint stuff in the magical area - TQListView* v = item->listView(); - int lh = QMAX( p->fontMetrics().height() + 2 * v->itemMargin(), - TQApplication::globalStrut().height() ); - if ( lh % 2 > 0 ) - lh++; - - // Draw all the expand/close boxes... - TQRect boxrect; - TQStyle::StyleFlags boxflags; - while ( child && y < r.height() ) - { - linebot = y + lh/2; - if ( (child->isExpandable() || child->childCount()) && - (child->height() > 0) ) - { - // The primitive requires a rect. - boxrect = TQRect( bx-4, linebot-4, 9, 9 ); - boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On; - - // TDEStyle extension: Draw the box and expand/collapse indicator - drawTDEStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL ); - - // dotlinery - p->setPen( cg.mid() ); - dotlines[c++] = TQPoint( bx, linetop ); - dotlines[c++] = TQPoint( bx, linebot - 5 ); - dotlines[c++] = TQPoint( bx + 5, linebot ); - dotlines[c++] = TQPoint( r.width(), linebot ); - linetop = linebot + 5; - } else { - // just dotlinery - dotlines[c++] = TQPoint( bx+1, linebot ); - dotlines[c++] = TQPoint( r.width(), linebot ); - } - - y += child->totalHeight(); - child = nextVisibleSibling(child); - } - - if ( child ) // there's a child to draw, so move linebot to edge of rectangle - linebot = r.height(); - - if ( linetop < linebot ) - { - dotlines[c++] = TQPoint( bx, linetop ); - dotlines[c++] = TQPoint( bx, linebot ); - } - } - - // Draw all the branches... - static int thickness = kPixelMetric( KPM_ListViewBranchThickness, ceData, elementFlags ); - int line; // index into dotlines - TQRect branchrect; - TQStyle::StyleFlags branchflags; - for( line = 0; line < c; line += 2 ) - { - // assumptions here: lines are horizontal or vertical. - // lines always start with the numerically lowest - // coordinate. - - // point ... relevant coordinate of current point - // end ..... same coordinate of the end of the current line - // other ... the other coordinate of the current point/line - if ( dotlines[line].y() == dotlines[line+1].y() ) - { - // Horizontal branch - int end = dotlines[line+1].x(); - int point = dotlines[line].x(); - int other = dotlines[line].y(); - - branchrect = TQRect( point, other-(thickness/2), end-point, thickness ); - branchflags = TQStyle::Style_Horizontal; - - // TDEStyle extension: Draw the horizontal branch - drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL ); - - } else { - // Vertical branch - int end = dotlines[line+1].y(); - int point = dotlines[line].y(); - int other = dotlines[line].x(); - int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0; - - branchrect = TQRect( other-(thickness/2), point, thickness, end-point ); - if (!pixmapoffset) // ### Hackish - used to hint the offset - branchflags = TQStyle::Style_NoChange; - else - branchflags = TQStyle::Style_Default; - - // TDEStyle extension: Draw the vertical branch - drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL ); - } - } - } - break; - } - - default: - TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, - flags, controls, active, opt, widget ); - break; - } -} - - -TQStyle::SubControl TDEStyle::querySubControl( TQ_ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQPoint &pos, - const TQStyleOption &opt, - const TQWidget* widget ) const -{ - TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, opt, widget); - - if (d->scrollbarType == ThreeButtonScrollBar) { - // Enable third button - if (control == CC_ScrollBar && ret == SC_None) - ret = SC_ScrollBarSubLine; - } - return ret; -} - - -TQRect TDEStyle::querySubControlMetrics( TQ_ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption &opt, - const TQWidget* widget ) const -{ - TQRect ret; - - if (control == CC_ScrollBar) - { - bool threeButtonScrollBar = d->scrollbarType & ThreeButtonScrollBar; - bool platinumScrollBar = d->scrollbarType & PlatinumStyleScrollBar; - bool nextScrollBar = d->scrollbarType & NextStyleScrollBar; - - bool horizontal = ceData.orientation == TQt::Horizontal; - int sliderstart = ceData.startStep; - int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); - int maxlen = (horizontal ? ceData.rect.width() : ceData.rect.height()) - - (sbextent * (threeButtonScrollBar ? 3 : 2)); - int sliderlen; - - // calculate slider length - if (ceData.maxSteps != ceData.minSteps) - { - uint range = ceData.maxSteps - ceData.minSteps; - sliderlen = (ceData.pageStep * maxlen) / (range + ceData.pageStep); - - int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); - if ( sliderlen < slidermin || range > INT_MAX / 2 ) - sliderlen = slidermin; - if ( sliderlen > maxlen ) - sliderlen = maxlen; - } else - sliderlen = maxlen; - - // Subcontrols - switch (sc) - { - case SC_ScrollBarSubLine: { - // top/left button - if (platinumScrollBar) { - if (horizontal) - ret.setRect(ceData.rect.width() - 2 * sbextent, 0, sbextent, sbextent); - else - ret.setRect(0, ceData.rect.height() - 2 * sbextent, sbextent, sbextent); - } else - ret.setRect(0, 0, sbextent, sbextent); - break; - } - - case SC_ScrollBarAddLine: { - // bottom/right button - if (nextScrollBar) { - if (horizontal) - ret.setRect(sbextent, 0, sbextent, sbextent); - else - ret.setRect(0, sbextent, sbextent, sbextent); - } else { - if (horizontal) - ret.setRect(ceData.rect.width() - sbextent, 0, sbextent, sbextent); - else - ret.setRect(0, ceData.rect.height() - sbextent, sbextent, sbextent); - } - break; - } - - case SC_ScrollBarSubPage: { - // between top/left button and slider - if (platinumScrollBar) { - if (horizontal) - ret.setRect(0, 0, sliderstart, sbextent); - else - ret.setRect(0, 0, sbextent, sliderstart); - } else if (nextScrollBar) { - if (horizontal) - ret.setRect(sbextent*2, 0, sliderstart-2*sbextent, sbextent); - else - ret.setRect(0, sbextent*2, sbextent, sliderstart-2*sbextent); - } else { - if (horizontal) - ret.setRect(sbextent, 0, sliderstart - sbextent, sbextent); - else - ret.setRect(0, sbextent, sbextent, sliderstart - sbextent); - } - break; - } - - case SC_ScrollBarAddPage: { - // between bottom/right button and slider - int fudge; - - if (platinumScrollBar) - fudge = 0; - else if (nextScrollBar) - fudge = 2*sbextent; - else - fudge = sbextent; - - if (horizontal) - ret.setRect(sliderstart + sliderlen, 0, - maxlen - sliderstart - sliderlen + fudge, sbextent); - else - ret.setRect(0, sliderstart + sliderlen, sbextent, - maxlen - sliderstart - sliderlen + fudge); - break; - } - - case SC_ScrollBarGroove: { - int multi = threeButtonScrollBar ? 3 : 2; - int fudge; - - if (platinumScrollBar) - fudge = 0; - else if (nextScrollBar) - fudge = 2*sbextent; - else - fudge = sbextent; - - if (horizontal) - ret.setRect(fudge, 0, ceData.rect.width() - sbextent * multi, ceData.rect.height()); - else - ret.setRect(0, fudge, ceData.rect.width(), ceData.rect.height() - sbextent * multi); - break; - } - - case SC_ScrollBarSlider: { - if (horizontal) - ret.setRect(sliderstart, 0, sliderlen, sbextent); - else - ret.setRect(0, sliderstart, sbextent, sliderlen); - break; - } - - default: - ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget); - break; - } - } else - ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget); - - return ret; -} - -static const char * const kstyle_close_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"..##....##..", -"...##..##...", -"....####....", -".....##.....", -"....####....", -"...##..##...", -"..##....##..", -"............", -"............", -"............"}; - -static const char * const kstyle_maximize_xpm[]={ -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -".##########.", -".##########.", -".#........#.", -".#........#.", -".#........#.", -".#........#.", -".#........#.", -".#........#.", -".##########.", -"............"}; - - -static const char * const kstyle_minimize_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"............", -"............", -"............", -"............", -"............", -"...######...", -"...######...", -"............", -"............", -"............"}; - -static const char * const kstyle_normalizeup_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"...#######..", -"...#######..", -"...#.....#..", -".#######.#..", -".#######.#..", -".#.....#.#..", -".#.....###..", -".#.....#....", -".#.....#....", -".#######....", -"............"}; - - -static const char * const kstyle_shade_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"............", -"............", -"............", -".....#......", -"....###.....", -"...#####....", -"..#######...", -"............", -"............", -"............"}; - -static const char * const kstyle_unshade_xpm[] = { -"12 12 2 1", -"# c #000000", -". c None", -"............", -"............", -"............", -"............", -"..#######...", -"...#####....", -"....###.....", -".....#......", -"............", -"............", -"............", -"............"}; - -static const char * const dock_window_close_xpm[] = { -"8 8 2 1", -"# c #000000", -". c None", -"##....##", -".##..##.", -"..####..", -"...##...", -"..####..", -".##..##.", -"##....##", -"........"}; - -// Message box icons, from page 210 of the Windows style guide. - -// Hand-drawn to resemble Microsoft's icons, but in the Mac/Netscape -// palette. The "question mark" icon, which Microsoft recommends not -// using but a lot of people still use, is left out. - -/* XPM */ -static const char * const information_xpm[]={ -"32 32 5 1", -". c None", -"c c #000000", -"* c #999999", -"a c #ffffff", -"b c #0000ff", -"...........********.............", -"........***aaaaaaaa***..........", -"......**aaaaaaaaaaaaaa**........", -".....*aaaaaaaaaaaaaaaaaa*.......", -"....*aaaaaaaabbbbaaaaaaaac......", -"...*aaaaaaaabbbbbbaaaaaaaac.....", -"..*aaaaaaaaabbbbbbaaaaaaaaac....", -".*aaaaaaaaaaabbbbaaaaaaaaaaac...", -".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.", -"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", -".*aaaaaaaaaaabbbbbaaaaaaaaaac***", -".*aaaaaaaaaaabbbbbaaaaaaaaaac***", -"..*aaaaaaaaaabbbbbaaaaaaaaac***.", -"...caaaaaaabbbbbbbbbaaaaaac****.", -"....caaaaaaaaaaaaaaaaaaaac****..", -".....caaaaaaaaaaaaaaaaaac****...", -"......ccaaaaaaaaaaaaaacc****....", -".......*cccaaaaaaaaccc*****.....", -"........***cccaaaac*******......", -"..........****caaac*****........", -".............*caaac**...........", -"...............caac**...........", -"................cac**...........", -".................cc**...........", -"..................***...........", -"...................**..........."}; -/* XPM */ -static const char* const warning_xpm[]={ -"32 32 4 1", -". c None", -"a c #ffff00", -"* c #000000", -"b c #999999", -".............***................", -"............*aaa*...............", -"...........*aaaaa*b.............", -"...........*aaaaa*bb............", -"..........*aaaaaaa*bb...........", -"..........*aaaaaaa*bb...........", -".........*aaaaaaaaa*bb..........", -".........*aaaaaaaaa*bb..........", -"........*aaaaaaaaaaa*bb.........", -"........*aaaa***aaaa*bb.........", -".......*aaaa*****aaaa*bb........", -".......*aaaa*****aaaa*bb........", -"......*aaaaa*****aaaaa*bb.......", -"......*aaaaa*****aaaaa*bb.......", -".....*aaaaaa*****aaaaaa*bb......", -".....*aaaaaa*****aaaaaa*bb......", -"....*aaaaaaaa***aaaaaaaa*bb.....", -"....*aaaaaaaa***aaaaaaaa*bb.....", -"...*aaaaaaaaa***aaaaaaaaa*bb....", -"...*aaaaaaaaaa*aaaaaaaaaa*bb....", -"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...", -"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...", -".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..", -".*aaaaaaaaaaa****aaaaaaaaaa*bb..", -"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.", -"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", -"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", -".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb", -"..*************************bbbbb", -"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.", -".....bbbbbbbbbbbbbbbbbbbbbbbbb.."}; -/* XPM */ -static const char* const critical_xpm[]={ -"32 32 4 1", -". c None", -"a c #999999", -"* c #ff0000", -"b c #ffffff", -"...........********.............", -".........************...........", -".......****************.........", -"......******************........", -".....********************a......", -"....**********************a.....", -"...************************a....", -"..*******b**********b*******a...", -"..******bbb********bbb******a...", -".******bbbbb******bbbbb******a..", -".*******bbbbb****bbbbb*******a..", -"*********bbbbb**bbbbb*********a.", -"**********bbbbbbbbbb**********a.", -"***********bbbbbbbb***********aa", -"************bbbbbb************aa", -"************bbbbbb************aa", -"***********bbbbbbbb***********aa", -"**********bbbbbbbbbb**********aa", -"*********bbbbb**bbbbb*********aa", -".*******bbbbb****bbbbb*******aa.", -".******bbbbb******bbbbb******aa.", -"..******bbb********bbb******aaa.", -"..*******b**********b*******aa..", -"...************************aaa..", -"....**********************aaa...", -"....a********************aaa....", -".....a******************aaa.....", -"......a****************aaa......", -".......aa************aaaa.......", -".........aa********aaaaa........", -"...........aaaaaaaaaaa..........", -".............aaaaaaa............"}; - -TQPixmap TDEStyle::stylePixmap( StylePixmap stylepixmap, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption& opt, - const TQWidget* widget) const -{ - switch (stylepixmap) { - case SP_TitleBarShadeButton: - return TQPixmap(const_cast<const char**>(kstyle_shade_xpm)); - case SP_TitleBarUnshadeButton: - return TQPixmap(const_cast<const char**>(kstyle_unshade_xpm)); - case SP_TitleBarNormalButton: - return TQPixmap(const_cast<const char**>(kstyle_normalizeup_xpm)); - case SP_TitleBarMinButton: - return TQPixmap(const_cast<const char**>(kstyle_minimize_xpm)); - case SP_TitleBarMaxButton: - return TQPixmap(const_cast<const char**>(kstyle_maximize_xpm)); - case SP_TitleBarCloseButton: - return TQPixmap(const_cast<const char**>(kstyle_close_xpm)); - case SP_DockWindowCloseButton: - return TQPixmap(const_cast<const char**>(dock_window_close_xpm )); - case SP_MessageBoxInformation: - return TQPixmap(const_cast<const char**>(information_xpm)); - case SP_MessageBoxWarning: - return TQPixmap(const_cast<const char**>(warning_xpm)); - case SP_MessageBoxCritical: - return TQPixmap(const_cast<const char**>(critical_xpm)); - default: - break; - } - return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); -} - - -int TDEStyle::styleHint( TQ_StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, - const TQStyleOption &opt, TQStyleHintReturn* shr, const TQWidget* w) const -{ - switch (sh) - { - case SH_EtchDisabledText: - return d->etchDisabledText ? 1 : 0; - - case SH_PopupMenu_Scrollable: - return d->scrollablePopupmenus ? 1 : 0; - - case SH_HideUnderlineAcceleratorWhenAltUp: - return d->autoHideAccelerators ? 1 : 0; - - case SH_MenuBar_AltKeyNavigation: - return d->menuAltKeyNavigation ? 1 : 0; - - case SH_PopupMenu_SubMenuPopupDelay: - if ( styleHint( SH_PopupMenu_SloppySubMenus, ceData, elementFlags, TQStyleOption::Default, 0, w ) ) - return QMIN( 100, d->popupMenuDelay ); - else - return d->popupMenuDelay; - - case SH_PopupMenu_SloppySubMenus: - return d->sloppySubMenus; - - case SH_ItemView_ChangeHighlightOnFocus: - case SH_Slider_SloppyKeyEvents: - case SH_MainWindow_SpaceBelowMenuBar: - case SH_PopupMenu_AllowActiveAndDisabled: - return 0; - - case SH_Slider_SnapToValue: - case SH_PrintDialog_RightAlignButtons: - case SH_FontDialog_SelectAssociatedText: - case SH_MenuBar_MouseTracking: - case SH_PopupMenu_MouseTracking: - case SH_ComboBox_ListMouseTracking: - case SH_ScrollBar_MiddleClickAbsolutePosition: - return 1; - case SH_LineEdit_PasswordCharacter: - { - if (w) { - const TQFontMetrics &fm = w->fontMetrics(); - if (fm.inFont(TQChar(0x25CF))) { - return 0x25CF; - } else if (fm.inFont(TQChar(0x2022))) { - return 0x2022; - } - } - return '*'; - } - - default: - return TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, shr, w); - } -} - - -bool TDEStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) -{ - if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { - TQObject* object = reinterpret_cast<TQObject*>(source); - if ( d->useFilledFrameWorkaround ) - { - // Make the QMenuBar/TQToolBar paintEvent() cover a larger area to - // ensure that the filled frame contents are properly painted. - // We essentially modify the paintEvent's rect to include the - // panel border, which also paints the widget's interior. - // This is nasty, but I see no other way to properly repaint - // filled frames in all QMenuBars and QToolBars. - // -- Karol. - TQFrame *frame = 0; - if ( event->type() == TQEvent::Paint - && (frame = ::tqqt_cast<TQFrame*>(object)) ) - { - if (frame->frameShape() != TQFrame::ToolBarPanel && frame->frameShape() != TQFrame::MenuBarPanel) - return false; - - bool horizontal = true; - TQPaintEvent* pe = (TQPaintEvent*)event; - TQToolBar *toolbar = ::tqqt_cast< TQToolBar *>( frame ); - TQRect r = pe->rect(); - - if (toolbar && toolbar->orientation() == Qt::Vertical) - horizontal = false; - - if (horizontal) { - if ( r.height() == frame->height() ) - return false; // Let TQFrame handle the painting now. - - // Else, send a new paint event with an updated paint rect. - TQPaintEvent dummyPE( TQRect( r.x(), 0, r.width(), frame->height()) ); - TQApplication::sendEvent( frame, &dummyPE ); - } - else { // Vertical - if ( r.width() == frame->width() ) - return false; - - TQPaintEvent dummyPE( TQRect( 0, r.y(), frame->width(), r.height()) ); - TQApplication::sendEvent( frame, &dummyPE ); - } - - // Discard this event as we sent a new paintEvent. - return true; - } - } - } - - return false; -} - - -// ----------------------------------------------------------------------------- -// I N T E R N A L - TDEStyle menu transparency handler -// ----------------------------------------------------------------------------- - -TransparencyHandler::TransparencyHandler( TDEStyle* style, - TransparencyEngine tEngine, float menuOpacity, bool useDropShadow ) - : TQObject() -{ - te = tEngine; - kstyle = style; - opacity = menuOpacity; - dropShadow = useDropShadow; - pix.setOptimization(TQPixmap::BestOptim); -} - -TransparencyHandler::~TransparencyHandler() -{ -} - -bool TransparencyHandler::haveX11RGBASupport() -{ - // Simple way to determine if we have ARGB support - if (TQPaintDevice::x11AppDepth() == 32) { - return true; - } - else { - return false; - } -} - -#define REAL_ALPHA_STRENGTH 255.0 - -// This is meant to be ugly but fast. -void TransparencyHandler::rightShadow(TQImage& dst) -{ - bool have_composite = haveX11RGBASupport(); - - if (dst.depth() != 32) - dst = dst.convertDepth(32); - - // blend top-right corner. - int pixels = dst.width() * dst.height(); -#ifdef WORDS_BIGENDIAN - register unsigned char* data = dst.bits() + 1; // Skip alpha -#else - register unsigned char* data = dst.bits(); // Skip alpha -#endif - for(register int i = 0; i < 16; i++) { - if (have_composite) { - data++; - data++; - data++; - *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-top_right_corner[i])); data++; - } - else { - *data = (unsigned char)((*data)*top_right_corner[i]); data++; - *data = (unsigned char)((*data)*top_right_corner[i]); data++; - *data = (unsigned char)((*data)*top_right_corner[i]); data++; - data++; // skip alpha - } - } - - pixels -= 32; // tint right strip without rounded edges. - register int c = 0; - for(register int i = 0; i < pixels; i++) { - if (have_composite) { - data++; - data++; - data++;; - *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-shadow_strip[c])); data++; - } - else { - *data = (unsigned char)((*data)*shadow_strip[c]); data++; - *data = (unsigned char)((*data)*shadow_strip[c]); data++; - *data = (unsigned char)((*data)*shadow_strip[c]); data++; - data++; // skip alpha - } - ++c; - c %= 4; - } - - // tint bottom edge - for(register int i = 0; i < 16; i++) { - if (have_composite) { - data++; - data++; - data++; - *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-bottom_right_corner[i])); data++; - } - else { - *data = (unsigned char)((*data)*bottom_right_corner[i]); data++; - *data = (unsigned char)((*data)*bottom_right_corner[i]); data++; - *data = (unsigned char)((*data)*bottom_right_corner[i]); data++; - data++; // skip alpha - } - } -} - -void TransparencyHandler::bottomShadow(TQImage& dst) -{ - bool have_composite = haveX11RGBASupport(); - - if (dst.depth() != 32) - dst = dst.convertDepth(32); - - int line = 0; - int width = dst.width() - 4; - double strip_data = shadow_strip[0]; - double* corner = const_cast<double*>(bottom_left_corner); - -#ifdef WORDS_BIGENDIAN - register unsigned char* data = dst.bits() + 1; // Skip alpha -#else - register unsigned char* data = dst.bits(); // Skip alpha -#endif - - for(int y = 0; y < 4; y++) - { - // Bottom-left Corner - for(register int x = 0; x < 4; x++) { - if (have_composite) { - data++; - data++; - data++; - *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-(*corner))); data++; - } - else { - *data = (unsigned char)((*data)*(*corner)); data++; - *data = (unsigned char)((*data)*(*corner)); data++; - *data = (unsigned char)((*data)*(*corner)); data++; - data++; // skip alpha - } - corner++; - } - - // Scanline - for(register int x = 0; x < width; x++) { - if (have_composite) { - data++; - data++; - data++; - *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-strip_data)); data++; - } - else { - *data = (unsigned char)((*data)*strip_data); data++; - *data = (unsigned char)((*data)*strip_data); data++; - *data = (unsigned char)((*data)*strip_data); data++; - data++; // skip alpha - } - } - - strip_data = shadow_strip[++line]; - } -} - -TQImage TransparencyHandler::handleRealAlpha(TQImage img) { - TQImage clearImage = img.convertDepth(32); - clearImage.setAlphaBuffer(true); - - int w = clearImage.width(); - int h = clearImage.height(); - - for (int y = 0; y < h; ++y) { - TQRgb *ls = (TQRgb *)clearImage.scanLine( y ); - for (int x = 0; x < w; ++x) { - ls[x] = tqRgba( 0, 0, 0, 0 ); - } - } - - return clearImage; -} - -// Create a shadow of thickness 4. -void TransparencyHandler::createShadowWindows(const TQWidget* p) -{ -#ifdef Q_WS_X11 - int x2 = p->x()+p->width(); - int y2 = p->y()+p->height(); - TQRect shadow1(x2, p->y() + 4, 4, p->height()); - TQRect shadow2(p->x() + 4, y2, p->width() - 4, 4); - - bool have_composite = haveX11RGBASupport(); - - // Create a fake drop-down shadow effect via blended Xwindows - ShadowElements se; - se.w1 = new TQWidget(0, 0, (WFlags)(WStyle_Customize | WType_Popup | WX11BypassWM) ); - se.w2 = new TQWidget(0, 0, (WFlags)(WStyle_Customize | WType_Popup | WX11BypassWM) ); - se.w1->setGeometry(shadow1); - se.w2->setGeometry(shadow2); - XSelectInput(tqt_xdisplay(), se.w1->winId(), StructureNotifyMask ); - XSelectInput(tqt_xdisplay(), se.w2->winId(), StructureNotifyMask ); - - // Insert a new ShadowMap entry - shadowMap()[p] = se; - - // Some hocus-pocus here to create the drop-shadow. - TQPixmap pix_shadow1; - TQPixmap pix_shadow2; - if (have_composite) { - pix_shadow1 = TQPixmap(shadow1.width(), shadow1.height()); - pix_shadow2 = TQPixmap(shadow2.width(), shadow2.height()); - } - else { - pix_shadow1 = TQPixmap::grabWindow(tqt_xrootwin(), - shadow1.x(), shadow1.y(), shadow1.width(), shadow1.height()); - pix_shadow2 = TQPixmap::grabWindow(tqt_xrootwin(), - shadow2.x(), shadow2.y(), shadow2.width(), shadow2.height()); - } - - TQImage img; - img = pix_shadow1.convertToImage(); - if (have_composite) img = handleRealAlpha(img); - rightShadow(img); - pix_shadow1.convertFromImage(img); - img = pix_shadow2.convertToImage(); - if (have_composite) img = handleRealAlpha(img); - bottomShadow(img); - pix_shadow2.convertFromImage(img); - - // Set the background pixmaps - se.w1->setErasePixmap(pix_shadow1); - se.w2->setErasePixmap(pix_shadow2); - - // Show the 'shadow' just before showing the popup menu window - // Don't use TQWidget::show() so we don't confuse QEffects, thus causing broken focus. - XMapWindow(tqt_xdisplay(), se.w1->winId()); - XMapWindow(tqt_xdisplay(), se.w2->winId()); -#else - Q_UNUSED( p ) -#endif -} - -void TransparencyHandler::removeShadowWindows(const TQWidget* p) -{ -#ifdef Q_WS_X11 - ShadowMap::iterator it = shadowMap().find(p); - if (it != shadowMap().end()) - { - ShadowElements se = it.data(); - XUnmapWindow(tqt_xdisplay(), se.w1->winId()); // hide - XUnmapWindow(tqt_xdisplay(), se.w2->winId()); - XFlush(tqt_xdisplay()); // try to hide faster - delete se.w1; - delete se.w2; - shadowMap().erase(it); - } -#else - Q_UNUSED( p ) -#endif -} - -bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event ) -{ -#if !defined Q_WS_MAC && !defined Q_WS_WIN - // Transparency idea was borrowed from KDE2's "MegaGradient" Style, - // Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> - - // Added 'fake' menu shadows <04-Jul-2002> -- Karol - TQWidget* p = (TQWidget*)object; - TQEvent::Type et = event->type(); - - if (et == TQEvent::Show) - { - // Handle translucency - if (te != Disabled) - { - pix = TQPixmap::grabWindow(tqt_xrootwin(), - p->x(), p->y(), p->width(), p->height()); - - switch (te) { -#ifdef HAVE_XRENDER - case XRender: - if (tqt_use_xrender) { - XRenderBlendToPixmap(p); - break; - } - // Fall through intended -#else - case XRender: -#endif - case SoftwareBlend: - blendToPixmap(p->colorGroup(), p); - break; - - case SoftwareTint: - default: - blendToColor(p->colorGroup().button()); - }; - - p->setErasePixmap(pix); - } - - // Handle drop shadow - // * FIXME : !shadowMap().contains(p) is a workaround for leftover - // * shadows after duplicate show events. - // * TODO : determine real cause for duplicate events - // * till 20021005 - if ((dropShadow || useDropShadow(p)) - && p->width() > 16 && p->height() > 16 && !shadowMap().contains( p )) - createShadowWindows(p); - } - else if (et == TQEvent::Resize && p->isShown() && p->isTopLevel()) - { - // Handle drop shadow - if (dropShadow || useDropShadow(p)) - { - removeShadowWindows(p); - createShadowWindows(p); - } - } - else if (et == TQEvent::Hide) - { - // Handle drop shadow - if (dropShadow || useDropShadow(p)) - removeShadowWindows(p); - - // Handle translucency - if (te != Disabled) - p->setErasePixmap(TQPixmap()); - } - -#endif - return false; -} - - -// Blends a TQImage to a predefined color, with a given opacity. -void TransparencyHandler::blendToColor(const TQColor &col) -{ - if (opacity < 0.0 || opacity > 1.0) - return; - - TQImage img = pix.convertToImage(); - KImageEffect::blend(col, img, opacity); - pix.convertFromImage(img); -} - - -void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQWidget* p) -{ - if (opacity < 0.0 || opacity > 1.0) - return; - - KPixmap blendPix; - blendPix.resize( pix.width(), pix.height() ); - - if (blendPix.width() != pix.width() || - blendPix.height() != pix.height()) - return; - - // Allow styles to define the blend pixmap - allows for some interesting effects. - if (::tqqt_cast<TQPopupMenu*>(p)) - kstyle->renderMenuBlendPixmap( blendPix, cg, ::tqqt_cast<TQPopupMenu*>(p) ); - else - blendPix.fill(cg.button()); // Just tint as the default behavior - - TQImage blendImg = blendPix.convertToImage(); - TQImage backImg = pix.convertToImage(); - KImageEffect::blend(blendImg, backImg, opacity); - pix.convertFromImage(backImg); -} - - -#ifdef HAVE_XRENDER -// Here we go, use XRender in all its glory. -// NOTE: This is actually a bit slower than the above routines -// on non-accelerated displays. -- Karol. -void TransparencyHandler::XRenderBlendToPixmap(const TQWidget* p) -{ - KPixmap renderPix; - renderPix.resize( pix.width(), pix.height() ); - - // Allow styles to define the blend pixmap - allows for some interesting effects. - if (::tqqt_cast<TQPopupMenu*>(p)) - kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(), - ::tqqt_cast<TQPopupMenu*>(p) ); - else - renderPix.fill(p->colorGroup().button()); // Just tint as the default behavior - - Display* dpy = tqt_xdisplay(); - Pixmap alphaPixmap; - Picture alphaPicture; - XRenderPictFormat Rpf; - XRenderPictureAttributes Rpa; - XRenderColor clr; - clr.alpha = ((unsigned short)(255*opacity) << 8); - - Rpf.type = PictTypeDirect; - Rpf.depth = 8; - Rpf.direct.alphaMask = 0xff; - Rpa.repeat = True; // Tile - - XRenderPictFormat* xformat = XRenderFindFormat(dpy, - PictFormatType | PictFormatDepth | PictFormatAlphaMask, &Rpf, 0); - - alphaPixmap = XCreatePixmap(dpy, p->handle(), 1, 1, 8); - alphaPicture = XRenderCreatePicture(dpy, alphaPixmap, xformat, CPRepeat, &Rpa); - - XRenderFillRectangle(dpy, PictOpSrc, alphaPicture, &clr, 0, 0, 1, 1); - - XRenderComposite(dpy, PictOpOver, - renderPix.x11RenderHandle(), alphaPicture, pix.x11RenderHandle(), // src, mask, dst - 0, 0, // srcx, srcy - 0, 0, // maskx, masky - 0, 0, // dstx, dsty - pix.width(), pix.height()); - - XRenderFreePicture(dpy, alphaPicture); - XFreePixmap(dpy, alphaPixmap); -} -#endif - -void TDEStyle::virtual_hook( int, void* ) -{ /*BASE::virtual_hook( id, data );*/ } - -// HACK for gtk-qt-engine - -extern "C" KDE_EXPORT -void kde_kstyle_set_scrollbar_type_windows( void* style ) -{ - ((TDEStyle*)style)->setScrollBarType( TDEStyle::WindowsStyleScrollBar ); -} - -// vim: set noet ts=4 sw=4: -// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; - -#include "kstyle.moc" diff --git a/tdefx/kstyle.h b/tdefx/kstyle.h deleted file mode 100644 index 9c3867bb3..000000000 --- a/tdefx/kstyle.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * $Id$ - * - * TDEStyle - * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org> - * - * TQWindowsStyle CC_ListView and style images were kindly donated by TrollTech, - * Copyright (C) 1998-2000 TrollTech AS. - * - * Many thanks to Bradley T. Hughes for the 3 button scrollbar code. - * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef __KSTYLE_H -#define __KSTYLE_H - -// W A R N I N G -// ------------- -// This API is still subject to change. -// I will remove this warning when I feel the API is sufficiently flexible. - -#include <tqcommonstyle.h> - -#include <tdelibs_export.h> - -class KPixmap; - -struct TDEStylePrivate; -/** - * Simplifies and extends the TQStyle API to make style coding easier. - * - * The TDEStyle class provides a simple internal menu transparency engine - * which attempts to use XRender for accelerated blending where requested, - * or falls back to fast internal software tinting/blending routines. - * It also simplifies more complex portions of the TQStyle API, such as - * the PopupMenuItems, ScrollBars and Sliders by providing extra "primitive - * elements" which are simple to implement by the style writer. - * - * @see TQStyle::QStyle - * @see TQCommonStyle::QCommonStyle - * @author Karol Szwed (gallium@kde.org) - * @version $Id$ - */ -class TDEFX_EXPORT TDEStyle: public TQCommonStyle -{ - Q_OBJECT - - - public: - - /** - * TDEStyle Flags: - * - * @li Default - Default style setting, where menu transparency - * and the FilledFrameWorkaround are disabled. - * - * @li AllowMenuTransparency - Enable this flag to use TDEStyle's - * internal menu transparency engine. - * - * @li FilledFrameWorkaround - Enable this flag to facilitate - * proper repaints of QMenuBars and QToolBars when the style chooses - * to paint the interior of a TQFrame. The style primitives in question - * are PE_PanelMenuBar and PE_PanelDockWindow. The HighColor style uses - * this workaround to enable painting of gradients in menubars and - * toolbars. - */ - typedef uint TDEStyleFlags; - enum TDEStyleOption { - Default = 0x00000000, //!< All options disabled - AllowMenuTransparency = 0x00000001, //!< Internal transparency enabled - FilledFrameWorkaround = 0x00000002 //!< Filled frames enabled - }; - - /** - * TDEStyle ScrollBarType: - * - * Allows the style writer to easily select what type of scrollbar - * should be used without having to duplicate large amounts of source - * code by implementing the complex control CC_ScrollBar. - * - * @li WindowsStyleScrollBar - Two button scrollbar with the previous - * button at the top/left, and the next button at the bottom/right. - * - * @li PlatinumStyleScrollBar - Two button scrollbar with both the - * previous and next buttons at the bottom/right. - * - * @li ThreeButtonScrollBar - %KDE style three button scrollbar with - * two previous buttons, and one next button. The next button is always - * at the bottom/right, whilst the two previous buttons are on either - * end of the scrollbar. - * - * @li NextStyleScrollBar - Similar to the PlatinumStyle scroll bar, but - * with the buttons grouped on the opposite end of the scrollbar. - * - * @see TDEStyle::TDEStyle() - */ - enum TDEStyleScrollBarType { - WindowsStyleScrollBar = 0x00000000, //!< two button, windows style - PlatinumStyleScrollBar = 0x00000001, //!< two button, platinum style - ThreeButtonScrollBar = 0x00000002, //!< three buttons, %KDE style - NextStyleScrollBar = 0x00000004 //!< two button, NeXT style - }; - - /** - * Constructs a TDEStyle object. - * - * Select the appropriate TDEStyle flags and scrollbar type - * for your style. The user's style preferences selected in KControl - * are read by using TQSettings and are automatically applied to the style. - * As a fallback, TDEStyle paints progressbars and tabbars. It inherits from - * TQCommonStyle for speed, so don't expect much to be implemented. - * - * It is advisable to use a currently implemented style such as the HighColor - * style as a foundation for any new TDEStyle, so the limited number of - * drawing fallbacks should not prove problematic. - * - * @param flags the style to be applied - * @param sbtype the scroll bar type - * @see TDEStyle::TDEStyleFlags - * @see TDEStyle::TDEStyleScrollBarType - * @author Karol Szwed (gallium@kde.org) - */ - TDEStyle( TDEStyleFlags flags = TDEStyle::Default, - TDEStyleScrollBarType sbtype = TDEStyle::WindowsStyleScrollBar ); - - /** - * Destructs the TDEStyle object. - */ - ~TDEStyle(); - - /** - * Returns the default widget style depending on color depth. - */ - static TQString defaultStyle(); - - /** - * Modifies the scrollbar type used by the style. - * - * This function is only provided for convenience. It allows - * you to make a late decision about what scrollbar type to use for the - * style after performing some processing in your style's constructor. - * In most situations however, setting the scrollbar type via the TDEStyle - * constructor should suffice. - * @param sbtype the scroll bar type - * @see TDEStyle::TDEStyleScrollBarType - */ - void setScrollBarType(TDEStyleScrollBarType sbtype); - - /** - * Returns the TDEStyle flags used to initialize the style. - * - * This is used solely for the kcmstyle module, and hence is internal. - */ - TDEStyleFlags styleFlags() const; - - // --------------------------------------------------------------------------- - - /** - * This virtual function defines the pixmap used to blend between the popup - * menu and the background to create different menu transparency effects. - * For example, you can fill the pixmap "pix" with a gradient based on the - * popup's colorGroup, a texture, or some other fancy painting routine. - * TDEStyle will then internally blend this pixmap with a snapshot of the - * background behind the popupMenu to create the illusion of transparency. - * - * This virtual is never called if XRender/Software blending is disabled by - * the user in KDE's style control module. - */ - virtual void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup& cg, - const TQPopupMenu* popup ) const; - - /** - * TDEStyle Primitive Elements: - * - * The TDEStyle class extends the Qt's Style API by providing certain - * simplifications for parts of TQStyle. To do this, the TDEStylePrimitive - * elements were defined, which are very similar to Qt's PrimitiveElement. - * - * The first three Handle primitives simplify and extend PE_DockWindowHandle, - * so do not reimplement PE_DockWindowHandle if you want the TDEStyle handle - * simplifications to be operable. Similarly do not reimplement CC_Slider, - * SC_SliderGroove and SC_SliderHandle when using the TDEStyle slider - * primitives. TDEStyle automatically double-buffers slider painting - * when they are drawn via these TDEStyle primitives to avoid flicker. - * - * @li KPE_DockWindowHandle - This primitive is already implemented in TDEStyle, - * and paints a bevelled rect with the DockWindow caption text. Re-implement - * this primitive to perform other more fancy effects when drawing the dock window - * handle. - * - * @li KPE_ToolBarHandle - This primitive must be reimplemented. It currently - * only paints a filled rectangle as default behavior. This primitive is used - * to render TQToolBar handles. - * - * @li KPE_GeneralHandle - This primitive must be reimplemented. It is used - * to render general handles that are not part of a TQToolBar or TQDockWindow, such - * as the applet handles used in Kicker. The default implementation paints a filled - * rect of arbitrary color. - * - * @li KPE_SliderGroove - This primitive must be reimplemented. It is used to - * paint the slider groove. The default implementation paints a filled rect of - * arbitrary color. - * - * @li KPE_SliderHandle - This primitive must be reimplemented. It is used to - * paint the slider handle. The default implementation paints a filled rect of - * arbitrary color. - * - * @li KPE_ListViewExpander - This primitive is already implemented in TDEStyle. It - * is used to draw the Expand/Collapse element in QListViews. To indicate the - * expanded state, the style flags are set to Style_Off, while Style_On implies collapsed. - * - * @li KPE_ListViewBranch - This primitive is already implemented in TDEStyle. It is - * used to draw the ListView branches where necessary. - */ - enum TDEStylePrimitive { - KPE_DockWindowHandle, - KPE_ToolBarHandle, - KPE_GeneralHandle, - - KPE_SliderGroove, - KPE_SliderHandle, - - KPE_ListViewExpander, - KPE_ListViewBranch - }; - - // Old API - // DEPRECATED - virtual void drawTDEStylePrimitive( TDEStylePrimitive kpe, - TQPainter* p, - const TQWidget* widget, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::SO_Default ) const; - - /** - * This function is identical to Qt's TQStyle::tqdrawPrimitive(), except that - * it adds one further parameter, 'widget', that can be used to determine - * the widget state of the TDEStylePrimitive in question. - * - * @see TDEStyle::TDEStylePrimitive - * @see TQStyle::tqdrawPrimitive - * @see TQStyle::drawComplexControl - */ - virtual void drawTDEStylePrimitive( TDEStylePrimitive kpe, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::SO_Default, - const TQWidget* widget = 0 ) const; - - - enum TDEStylePixelMetric { - KPM_MenuItemSeparatorHeight = 0x00000001, - KPM_MenuItemHMargin = 0x00000002, - KPM_MenuItemVMargin = 0x00000004, - KPM_MenuItemHFrame = 0x00000008, - KPM_MenuItemVFrame = 0x00000010, - KPM_MenuItemCheckMarkHMargin = 0x00000020, - KPM_MenuItemArrowHMargin = 0x00000040, - KPM_MenuItemTabSpacing = 0x00000080, - KPM_ListViewBranchThickness = 0x00000100 - }; - - int kPixelMetric( TDEStylePixelMetric kpm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* widget = 0 ) const; - - // --------------------------------------------------------------------------- - - void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); - void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ); - - void drawPrimitive( TQ_PrimitiveElement pe, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::SO_Default ) const; - -// #ifdef USE_QT4 // tdebindings / smoke needs this function declaration available at all times. Furthermore I don't think it would hurt to have the declaration available at all times...so leave these commented out for now - -// void drawPrimitive( TQ_ControlElement pe, -// TQPainter* p, -// const TQStyleControlElementData &ceData, -// ControlElementFlags elementFlags, -// const TQRect &r, -// const TQColorGroup &cg, -// SFlags flags = Style_Default, -// const TQStyleOption& = TQStyleOption::SO_Default ) const; - -// #endif // USE_QT4 - - void drawControl( TQ_ControlElement element, - TQPainter* p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::SO_Default, - const TQWidget* widget = 0 ) const; - - void drawComplexControl( TQ_ComplexControl control, - TQPainter *p, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQRect &r, - const TQColorGroup &cg, - SFlags flags = Style_Default, - SCFlags controls = SC_All, - SCFlags active = SC_None, - const TQStyleOption& = TQStyleOption::SO_Default, - const TQWidget* widget = 0 ) const; - - SubControl querySubControl( TQ_ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQPoint &pos, - const TQStyleOption& = TQStyleOption::SO_Default, - const TQWidget* widget = 0 ) const; - - TQRect querySubControlMetrics( TQ_ComplexControl control, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - SubControl sc, - const TQStyleOption& = TQStyleOption::SO_Default, - const TQWidget* widget = 0 ) const; - - int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, - const TQWidget* widget = 0 ) const; - - TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, - const TQWidget* widget = 0 ) const; - - TQPixmap stylePixmap( StylePixmap stylepixmap, - const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption& = TQStyleOption::SO_Default, - const TQWidget* widget = 0 ) const; - - int styleHint( TQ_StyleHint sh, const TQStyleControlElementData &ceData, - ControlElementFlags elementFlags, - const TQStyleOption &opt = TQStyleOption::SO_Default, - TQStyleHintReturn* shr = 0, - const TQWidget* w = 0 ) const; - - protected: - virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); - - private: - // Disable copy constructor and = operator - TDEStyle( const TDEStyle & ); - TDEStyle& operator=( const TDEStyle & ); - - protected: - virtual void virtual_hook( int id, void* data ); - private: - TDEStylePrivate *d; -}; - - -// vim: set noet ts=4 sw=4: -#endif - diff --git a/tdefx/tdestylen.cpp b/tdefx/tdestylen.cpp new file mode 100644 index 000000000..0c6a7f1fe --- /dev/null +++ b/tdefx/tdestylen.cpp @@ -0,0 +1,2418 @@ +/* + * + * TDEStyle + * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org> + * + * TQWindowsStyle CC_ListView and style images were kindly donated by TrollTech, + * Copyright (C) 1998-2000 TrollTech AS. + * + * Many thanks to Bradley T. Hughes for the 3 button scrollbar code. + * + * 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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "tdestyle.h" + +#include <tqapplication.h> +#include <tqbitmap.h> +#include <tqmetaobject.h> +#include <tqcleanuphandler.h> +#include <tqmap.h> +#include <tqimage.h> +#include <tqlistview.h> +#include <tqmenubar.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqpopupmenu.h> +#include <tqprogressbar.h> +#include <tqscrollbar.h> +#include <tqsettings.h> +#include <tqslider.h> +#include <tqstylefactory.h> +#include <tqtabbar.h> +#include <tqtoolbar.h> +#include <tqframe.h> + +#include <kpixmap.h> +#include <kpixmapeffect.h> +#include <kimageeffect.h> + +#ifdef Q_WS_X11 +# include <X11/Xlib.h> +# ifdef HAVE_XRENDER +# include <X11/extensions/Xrender.h> // schroder + extern bool tqt_use_xrender; +# endif +#else +#undef HAVE_XRENDER +#endif + +#ifdef HAVE_XCOMPOSITE +#include <X11/extensions/Xrender.h> +#include <X11/extensions/Xcomposite.h> +#include <dlfcn.h> +#endif + +#include <limits.h> + +namespace +{ + // INTERNAL + enum TransparencyEngine { + Disabled = 0, + SoftwareTint, + SoftwareBlend, + XRender + }; + + // Drop Shadow + struct ShadowElements { + TQWidget* w1; + TQWidget* w2; + }; + typedef TQMap<const TQWidget*,ShadowElements> ShadowMap; + static ShadowMap *_shadowMap = 0; + TQSingleCleanupHandler<ShadowMap> cleanupShadowMap; + ShadowMap &shadowMap() { + if ( !_shadowMap ) { + _shadowMap = new ShadowMap; + cleanupShadowMap.set( &_shadowMap ); + } + return *_shadowMap; + } + + + // DO NOT ASK ME HOW I MADE THESE TABLES! + // (I probably won't remember anyway ;) + const double top_right_corner[16] = + { 0.949, 0.965, 0.980, 0.992, + 0.851, 0.890, 0.945, 0.980, + 0.706, 0.780, 0.890, 0.960, + 0.608, 0.706, 0.851, 0.949 }; + + const double bottom_right_corner[16] = + { 0.608, 0.706, 0.851, 0.949, + 0.706, 0.780, 0.890, 0.960, + 0.851, 0.890, 0.945, 0.980, + 0.949, 0.965, 0.980, 0.992 }; + + const double bottom_left_corner[16] = + { 0.949, 0.851, 0.706, 0.608, + 0.965, 0.890, 0.780, 0.706, + 0.980, 0.945, 0.890, 0.851, + 0.992, 0.980, 0.960, 0.949 }; + + const double shadow_strip[4] = + { 0.565, 0.675, 0.835, 0.945 }; + + static bool useDropShadow(TQWidget* w) + { + return w && w->metaObject() && + w->metaObject()->findProperty("TDEStyleMenuDropShadow") != -1; + } +} + +namespace +{ +class TransparencyHandler : public TQObject +{ + public: + TransparencyHandler(TDEStyle* style, TransparencyEngine tEngine, + float menuOpacity, bool useDropShadow); + ~TransparencyHandler(); + bool eventFilter(TQObject* object, TQEvent* event); + + protected: + void blendToColor(const TQColor &col); + void blendToPixmap(const TQColorGroup &cg, const TQWidget* p); +#ifdef HAVE_XRENDER + void XRenderBlendToPixmap(const TQWidget* p); +#endif + bool haveX11RGBASupport(); + TQImage handleRealAlpha(TQImage); + void createShadowWindows(const TQWidget* p); + void removeShadowWindows(const TQWidget* p); + void rightShadow(TQImage& dst); + void bottomShadow(TQImage& dst); + private: + bool dropShadow; + float opacity; + TQPixmap pix; + TDEStyle* kstyle; + TransparencyEngine te; +}; +} // namespace + +struct TDEStylePrivate +{ + bool highcolor : 1; + bool useFilledFrameWorkaround : 1; + bool etchDisabledText : 1; + bool scrollablePopupmenus : 1; + bool autoHideAccelerators : 1; + bool menuAltKeyNavigation : 1; + bool menuDropShadow : 1; + bool sloppySubMenus : 1; + bool semiTransparentRubberband : 1; + int popupMenuDelay; + float menuOpacity; + + TransparencyEngine transparencyEngine; + TDEStyle::TDEStyleScrollBarType scrollbarType; + TransparencyHandler* menuHandler; + TDEStyle::TDEStyleFlags flags; + + //For KPE_ListViewBranch + TQBitmap *verticalLine; + TQBitmap *horizontalLine; +}; + +// ----------------------------------------------------------------------------- + + +TDEStyle::TDEStyle( TDEStyleFlags flags, TDEStyleScrollBarType sbtype ) + : TQCommonStyle(), d(new TDEStylePrivate) +{ + d->flags = flags; + bool useMenuTransparency = (flags & AllowMenuTransparency); + d->useFilledFrameWorkaround = (flags & FilledFrameWorkaround); + d->scrollbarType = sbtype; + d->highcolor = TQPixmap::defaultDepth() > 8; + + // Read style settings + TQSettings settings; + d->popupMenuDelay = settings.readNumEntry ("/TDEStyle/Settings/PopupMenuDelay", 256); + d->sloppySubMenus = settings.readBoolEntry("/TDEStyle/Settings/SloppySubMenus", false); + d->etchDisabledText = settings.readBoolEntry("/TDEStyle/Settings/EtchDisabledText", true); + d->menuAltKeyNavigation = settings.readBoolEntry("/TDEStyle/Settings/MenuAltKeyNavigation", true); + d->scrollablePopupmenus = settings.readBoolEntry("/TDEStyle/Settings/ScrollablePopupMenus", false); + d->autoHideAccelerators = settings.readBoolEntry("/TDEStyle/Settings/AutoHideAccelerators", false); + d->menuDropShadow = settings.readBoolEntry("/TDEStyle/Settings/MenuDropShadow", false); + d->semiTransparentRubberband = settings.readBoolEntry("/TDEStyle/Settings/SemiTransparentRubberband", false); + d->menuHandler = NULL; + + if (useMenuTransparency) { + TQString effectEngine = settings.readEntry("/TDEStyle/Settings/MenuTransparencyEngine", "Disabled"); + +#ifdef HAVE_XRENDER + if (effectEngine == "XRender") + d->transparencyEngine = XRender; +#else + if (effectEngine == "XRender") + d->transparencyEngine = SoftwareBlend; +#endif + else if (effectEngine == "SoftwareBlend") + d->transparencyEngine = SoftwareBlend; + else if (effectEngine == "SoftwareTint") + d->transparencyEngine = SoftwareTint; + else + d->transparencyEngine = Disabled; + + if (d->transparencyEngine != Disabled) { + // Create an instance of the menu transparency handler + d->menuOpacity = settings.readDoubleEntry("/TDEStyle/Settings/MenuOpacity", 0.90); + d->menuHandler = new TransparencyHandler(this, d->transparencyEngine, + d->menuOpacity, d->menuDropShadow); + } + } + + d->verticalLine = 0; + d->horizontalLine = 0; + + // Create a transparency handler if only drop shadows are enabled. + if (!d->menuHandler && d->menuDropShadow) + d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, d->menuDropShadow); +} + + +TDEStyle::~TDEStyle() +{ + delete d->verticalLine; + delete d->horizontalLine; + + delete d->menuHandler; + + d->menuHandler = NULL; + delete d; +} + + +TQString TDEStyle::defaultStyle() +{ + if (TQPixmap::defaultDepth() > 8) + return TQString("plastik"); + else + return TQString("light, 3rd revision"); +} + +void TDEStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget* widget = reinterpret_cast<TQWidget*>(ptr); + if ( d->useFilledFrameWorkaround ) + { + if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) { + TQFrame::Shape shape = frame->frameShape(); + if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel) + widget->installEventFilter(this); + } + } + if (widget->isTopLevel()) + { + if (!d->menuHandler && useDropShadow(widget)) + d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, false); + + if (d->menuHandler && useDropShadow(widget)) + widget->installEventFilter(d->menuHandler); + } + } +} + + +void TDEStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget* widget = reinterpret_cast<TQWidget*>(ptr); + if ( d->useFilledFrameWorkaround ) + { + if ( TQFrame *frame = ::tqqt_cast< TQFrame* >( widget ) ) { + TQFrame::Shape shape = frame->frameShape(); + if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel) + widget->removeEventFilter(this); + } + } + if (widget->isTopLevel() && d->menuHandler && useDropShadow(widget)) + widget->removeEventFilter(d->menuHandler); + } +} + + +// Style changes (should) always re-polish popups. +void TDEStyle::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ) +{ + if ( !(ceData.windowState & WState_Polished ) ) { + widgetActionRequest(ceData, elementFlags, ptr, WAR_SetCheckable); + } + + if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) { + TQWidget* widget = reinterpret_cast<TQWidget*>(ptr); + TQPopupMenu *p = dynamic_cast<TQPopupMenu*>(widget); + if (p) { + // Install transparency handler if the effect is enabled. + if ( d->menuHandler && (strcmp(p->name(), "tear off menu") != 0)) { + p->installEventFilter(d->menuHandler); + } + } + } +} + + +// ----------------------------------------------------------------------------- +// TDEStyle extensions +// ----------------------------------------------------------------------------- + +void TDEStyle::setScrollBarType(TDEStyleScrollBarType sbtype) +{ + d->scrollbarType = sbtype; +} + +TDEStyle::TDEStyleFlags TDEStyle::styleFlags() const +{ + return d->flags; +} + +void TDEStyle::renderMenuBlendPixmap( KPixmap &pix, const TQColorGroup &cg, + const TQPopupMenu* /* popup */ ) const +{ + pix.fill(cg.button()); // Just tint as the default behavior +} + +void TDEStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, + TQPainter* p, + const TQWidget* widget, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption &opt ) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + drawTDEStylePrimitive(kpe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, opt); +} + +void TDEStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption&, /* opt */ + const TQWidget* widget ) const +{ + switch( kpe ) + { + // Dock / Toolbar / General handles. + // --------------------------------- + + case KPE_DockWindowHandle: { + + // Draws a nice DockWindow handle including the dock title. + TQWidget* wid = const_cast<TQWidget*>(widget); + bool horizontal = flags & Style_Horizontal; + int x,y,w,h,x2,y2; + + r.rect( &x, &y, &w, &h ); + if ((w <= 2) || (h <= 2)) { + p->fillRect(r, cg.highlight()); + return; + } + + + x2 = x + w - 1; + y2 = y + h - 1; + + TQFont fnt; + fnt = TQApplication::font(wid); + fnt.setPointSize( fnt.pointSize()-2 ); + + // Draw the item on an off-screen pixmap + // to preserve Xft antialiasing for + // vertically oriented handles. + TQPixmap pix; + if (horizontal) + pix.resize( h-2, w-2 ); + else + pix.resize( w-2, h-2 ); + + TQString title = wid->parentWidget()->caption(); + TQPainter p2; + p2.begin(&pix); + p2.fillRect(pix.rect(), cg.brush(TQColorGroup::Highlight)); + p2.setPen(cg.highlightedText()); + p2.setFont(fnt); + p2.drawText(pix.rect(), AlignCenter, title); + p2.end(); + + // Draw a sunken bevel + p->setPen(cg.dark()); + p->drawLine(x, y, x2, y); + p->drawLine(x, y, x, y2); + p->setPen(cg.light()); + p->drawLine(x+1, y2, x2, y2); + p->drawLine(x2, y+1, x2, y2); + + if (horizontal) { + TQWMatrix m; + m.rotate(-90.0); + TQPixmap vpix = pix.xForm(m); + bitBlt(wid, r.x()+1, r.y()+1, &vpix); + } else + bitBlt(wid, r.x()+1, r.y()+1, &pix); + + break; + } + + + /* + * KPE_ListViewExpander and KPE_ListViewBranch are based on code from + * QWindowStyle's CC_ListView, kindly donated by TrollTech. + * CC_ListView code is Copyright (C) 1998-2000 TrollTech AS. + */ + + case KPE_ListViewExpander: { + // Typical Windows style expand/collapse element. + int radius = (r.width() - 4) / 2; + int centerx = r.x() + r.width()/2; + int centery = r.y() + r.height()/2; + + // Outer box + p->setPen( cg.mid() ); + p->drawRect( r ); + + // plus or minus + p->setPen( cg.text() ); + p->drawLine( centerx - radius, centery, centerx + radius, centery ); + if ( flags & Style_On ) // Collapsed = On + p->drawLine( centerx, centery - radius, centerx, centery + radius ); + break; + } + + case KPE_ListViewBranch: { + // Typical Windows style listview branch element (dotted line). + + // Create the dotline pixmaps if not already created + if ( !d->verticalLine ) + { + // make 128*1 and 1*128 bitmaps that can be used for + // drawing the right sort of lines. + d->verticalLine = new TQBitmap( 1, 129, true ); + d->horizontalLine = new TQBitmap( 128, 1, true ); + TQPointArray a( 64 ); + TQPainter p2; + p2.begin( d->verticalLine ); + + int i; + for( i=0; i < 64; i++ ) + a.setPoint( i, 0, i*2+1 ); + p2.setPen( color1 ); + p2.drawPoints( a ); + p2.end(); + TQApplication::flushX(); + d->verticalLine->setMask( *d->verticalLine ); + + p2.begin( d->horizontalLine ); + for( i=0; i < 64; i++ ) + a.setPoint( i, i*2+1, 0 ); + p2.setPen( color1 ); + p2.drawPoints( a ); + p2.end(); + TQApplication::flushX(); + d->horizontalLine->setMask( *d->horizontalLine ); + } + + p->setPen( cg.text() ); // cg.dark() is bad for dark color schemes. + + if (flags & Style_Horizontal) + { + int point = r.x(); + int other = r.y(); + int end = r.x()+r.width(); + int thickness = r.height(); + + while( point < end ) + { + int i = 128; + if ( i+point > end ) + i = end-point; + p->drawPixmap( point, other, *d->horizontalLine, 0, 0, i, thickness ); + point += i; + } + + } else { + int point = r.y(); + int other = r.x(); + int end = r.y()+r.height(); + int thickness = r.width(); + int pixmapoffset = (flags & Style_NoChange) ? 0 : 1; // ### Hackish + + while( point < end ) + { + int i = 128; + if ( i+point > end ) + i = end-point; + p->drawPixmap( other, point, *d->verticalLine, 0, pixmapoffset, thickness, i ); + point += i; + } + } + + break; + } + + // Reimplement the other primitives in your styles. + // The current implementation just paints something visibly different. + case KPE_ToolBarHandle: + case KPE_GeneralHandle: + case KPE_SliderHandle: + p->fillRect(r, cg.light()); + break; + + case KPE_SliderGroove: + p->fillRect(r, cg.dark()); + break; + + default: + p->fillRect(r, Qt::yellow); // Something really bad happened - highlight. + break; + } +} + + +int TDEStyle::kPixelMetric( TDEStylePixelMetric kpm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* /* widget */) const +{ + int value; + switch(kpm) + { + case KPM_ListViewBranchThickness: + value = 1; + break; + + case KPM_MenuItemSeparatorHeight: + case KPM_MenuItemHMargin: + case KPM_MenuItemVMargin: + case KPM_MenuItemHFrame: + case KPM_MenuItemVFrame: + case KPM_MenuItemCheckMarkHMargin: + case KPM_MenuItemArrowHMargin: + case KPM_MenuItemTabSpacing: + default: + value = 0; + } + + return value; +} + +// ----------------------------------------------------------------------------- + +// #ifdef USE_QT4 // tdebindings / smoke needs this function declaration available at all times. Furthermore I don't think it would hurt to have the declaration available at all times...so leave these commented out for now + +//void TDEStyle::drawPrimitive( TQ_ControlElement pe, +// TQPainter* p, +// const TQStyleControlElementData &ceData, +// ControlElementFlags elementFlags, +// const TQRect &r, +// const TQColorGroup &cg, +// SFlags flags, +// const TQStyleOption& opt ) const +//{ +// // FIXME: +// // What should "widget" be in actuality? How should I get it? From where? +// // Almost certainly it should not be null! +// TQWidget *widget = 0; +// drawControl(pe, p, ceData, elementFlags, r, cg, flags, opt, widget); +//} + +// #endif // USE_QT4 + +// ----------------------------------------------------------------------------- + +void TDEStyle::drawPrimitive( TQ_PrimitiveElement pe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + // TOOLBAR/DOCK WINDOW HANDLE + // ------------------------------------------------------------------------ + if (pe == PE_DockWindowHandle) + { + // Wild workarounds are here. Beware. + TQWidget *widget, *parent; + + if (p && p->device()->devType() == TQInternal::Widget) { + widget = static_cast<TQWidget*>(p->device()); + parent = widget->parentWidget(); + } else + return; // Don't paint on non-widgets + + // Check if we are a normal toolbar or a hidden dockwidget. + if ( parent && + (parent->inherits(TQTOOLBAR_OBJECT_NAME_STRING) || // Normal toolbar + (parent->inherits(TQMAINWINDOW_OBJECT_NAME_STRING)) )) // Collapsed dock + + // Draw a toolbar handle + drawTDEStylePrimitive( KPE_ToolBarHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); + + else if (ceData.widgetObjectTypes.contains(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING)) + + // Draw a dock window handle + drawTDEStylePrimitive( KPE_DockWindowHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); + + else + // General handle, probably a kicker applet handle. + drawTDEStylePrimitive( KPE_GeneralHandle, p, ceData, elementFlags, r, cg, flags, opt, widget ); +#if TQT_VERSION >= 0x030300 +#ifdef HAVE_XRENDER + } else if ( d->semiTransparentRubberband && pe == TQStyle::PE_RubberBand ) { + TQRect rect = r.normalize(); + TQPoint point; + point = p->xForm( point ); + + static XRenderColor clr = { 0, 0, 0, 0 }; + static unsigned long fillColor = 0; + if ( fillColor != cg.highlight().rgb() ) { + fillColor = cg.highlight().rgb(); + + unsigned long color = fillColor << 8 | 0x40; + + int red = (color >> 24) & 0xff; + int green = (color >> 16) & 0xff; + int blue = (color >> 8) & 0xff; + int alpha = (color >> 0) & 0xff; + + red = red * alpha / 255; + green = green * alpha / 255; + blue = blue * alpha / 255; + + clr.red = (red << 8) + red; + clr.green = (green << 8) + green; + clr.blue = (blue << 8) + blue; + clr.alpha = (alpha << 8) + alpha; + } + + XRenderFillRectangle( + p->device()->x11Display(), + PictOpOver, + p->device()->x11RenderHandle(), + &clr, + rect.x() + point.x(), + rect.y() + point.y(), + rect.width(), + rect.height() ); + + p->save(); + p->setRasterOp( TQt::CopyROP ); + p->setPen( TQPen( cg.highlight().dark( 160 ), 1 ) ); + p->setBrush( NoBrush ); + p->drawRect( + rect.x() + point.x(), + rect.y() + point.y(), + rect.width(), + rect.height() ); + p->restore(); +#endif +#endif + } else + TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt ); +} + + + +void TDEStyle::drawControl( TQ_ControlElement element, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption &opt, + const TQWidget* widget ) const +{ + switch (element) + { + // TABS + // ------------------------------------------------------------------------ + case CE_TabBarTab: { + TQTabBar::Shape tbs = ceData.tabBarData.shape; + bool selected = flags & Style_Selected; + int x = r.x(), y=r.y(), bottom=r.bottom(), right=r.right(); + + switch (tbs) { + + case TQTabBar::RoundedAbove: { + if (!selected) + p->translate(0,1); + p->setPen(selected ? cg.light() : cg.shadow()); + p->drawLine(x, y+4, x, bottom); + p->drawLine(x, y+4, x+4, y); + p->drawLine(x+4, y, right-1, y); + if (selected) + p->setPen(cg.shadow()); + p->drawLine(right, y+1, right, bottom); + + p->setPen(cg.midlight()); + p->drawLine(x+1, y+4, x+1, bottom); + p->drawLine(x+1, y+4, x+4, y+1); + p->drawLine(x+5, y+1, right-2, y+1); + + if (selected) { + p->setPen(cg.mid()); + p->drawLine(right-1, y+1, right-1, bottom); + } else { + p->setPen(cg.mid()); + p->drawPoint(right-1, y+1); + p->drawLine(x+4, y+2, right-1, y+2); + p->drawLine(x+3, y+3, right-1, y+3); + p->fillRect(x+2, y+4, r.width()-3, r.height()-6, cg.mid()); + + p->setPen(cg.light()); + p->drawLine(x, bottom-1, right, bottom-1); + p->translate(0,-1); + } + break; + } + + case TQTabBar::RoundedBelow: { + if (!selected) + p->translate(0,-1); + p->setPen(selected ? cg.light() : cg.shadow()); + p->drawLine(x, bottom-4, x, y); + if (selected) + p->setPen(cg.mid()); + p->drawLine(x, bottom-4, x+4, bottom); + if (selected) + p->setPen(cg.shadow()); + p->drawLine(x+4, bottom, right-1, bottom); + p->drawLine(right, bottom-1, right, y); + + p->setPen(cg.midlight()); + p->drawLine(x+1, bottom-4, x+1, y); + p->drawLine(x+1, bottom-4, x+4, bottom-1); + p->drawLine(x+5, bottom-1, right-2, bottom-1); + + if (selected) { + p->setPen(cg.mid()); + p->drawLine(right-1, y, right-1, bottom-1); + } else { + p->setPen(cg.mid()); + p->drawPoint(right-1, bottom-1); + p->drawLine(x+4, bottom-2, right-1, bottom-2); + p->drawLine(x+3, bottom-3, right-1, bottom-3); + p->fillRect(x+2, y+2, r.width()-3, r.height()-6, cg.mid()); + p->translate(0,1); + p->setPen(cg.dark()); + p->drawLine(x, y, right, y); + } + break; + } + + case TQTabBar::TriangularAbove: { + if (!selected) + p->translate(0,1); + p->setPen(selected ? cg.light() : cg.shadow()); + p->drawLine(x, bottom, x, y+6); + p->drawLine(x, y+6, x+6, y); + p->drawLine(x+6, y, right-6, y); + if (selected) + p->setPen(cg.mid()); + p->drawLine(right-5, y+1, right-1, y+5); + p->setPen(cg.shadow()); + p->drawLine(right, y+6, right, bottom); + + p->setPen(cg.midlight()); + p->drawLine(x+1, bottom, x+1, y+6); + p->drawLine(x+1, y+6, x+6, y+1); + p->drawLine(x+6, y+1, right-6, y+1); + p->drawLine(right-5, y+2, right-2, y+5); + p->setPen(cg.mid()); + p->drawLine(right-1, y+6, right-1, bottom); + + TQPointArray a(6); + a.setPoint(0, x+2, bottom); + a.setPoint(1, x+2, y+7); + a.setPoint(2, x+7, y+2); + a.setPoint(3, right-7, y+2); + a.setPoint(4, right-2, y+7); + a.setPoint(5, right-2, bottom); + p->setPen (selected ? cg.background() : cg.mid()); + p->setBrush(selected ? cg.background() : cg.mid()); + p->drawPolygon(a); + p->setBrush(NoBrush); + if (!selected) { + p->translate(0,-1); + p->setPen(cg.light()); + p->drawLine(x, bottom, right, bottom); + } + break; + } + + default: { // TQTabBar::TriangularBelow + if (!selected) + p->translate(0,-1); + p->setPen(selected ? cg.light() : cg.shadow()); + p->drawLine(x, y, x, bottom-6); + if (selected) + p->setPen(cg.mid()); + p->drawLine(x, bottom-6, x+6, bottom); + if (selected) + p->setPen(cg.shadow()); + p->drawLine(x+6, bottom, right-6, bottom); + p->drawLine(right-5, bottom-1, right-1, bottom-5); + if (!selected) + p->setPen(cg.shadow()); + p->drawLine(right, bottom-6, right, y); + + p->setPen(cg.midlight()); + p->drawLine(x+1, y, x+1, bottom-6); + p->drawLine(x+1, bottom-6, x+6, bottom-1); + p->drawLine(x+6, bottom-1, right-6, bottom-1); + p->drawLine(right-5, bottom-2, right-2, bottom-5); + p->setPen(cg.mid()); + p->drawLine(right-1, bottom-6, right-1, y); + + TQPointArray a(6); + a.setPoint(0, x+2, y); + a.setPoint(1, x+2, bottom-7); + a.setPoint(2, x+7, bottom-2); + a.setPoint(3, right-7, bottom-2); + a.setPoint(4, right-2, bottom-7); + a.setPoint(5, right-2, y); + p->setPen (selected ? cg.background() : cg.mid()); + p->setBrush(selected ? cg.background() : cg.mid()); + p->drawPolygon(a); + p->setBrush(NoBrush); + if (!selected) { + p->translate(0,1); + p->setPen(cg.dark()); + p->drawLine(x, y, right, y); + } + break; + } + }; + + break; + } + + // Popup menu scroller + // ------------------------------------------------------------------------ + case CE_PopupMenuScroller: { + p->fillRect(r, cg.background()); + drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, Style_Enabled); + drawPrimitive((flags & Style_Up) ? PE_ArrowUp : PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled); + break; + } + + + // PROGRESSBAR + // ------------------------------------------------------------------------ + case CE_ProgressBarGroove: { + TQRect fr = subRect(SR_ProgressBarGroove, ceData, elementFlags, widget); + drawPrimitive(PE_Panel, p, ceData, elementFlags, fr, cg, Style_Sunken, TQStyleOption::SO_Default); + break; + } + + case CE_ProgressBarContents: { + // ### Take into account totalSteps() for busy indicator + TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget); + double progress = ceData.currentStep; + bool reverse = TQApplication::reverseLayout(); + int steps = ceData.totalSteps; + + if (!cr.isValid()) + return; + + // Draw progress bar + if (progress > 0 || steps == 0) { + double pg = (steps == 0) ? 0.1 : progress / steps; + int width = QMIN(cr.width(), (int)(pg * cr.width())); + if (steps == 0) { //Busy indicator + + if (width < 1) width = 1; //A busy indicator with width 0 is kind of useless + + int remWidth = cr.width() - width; //Never disappear completely + if (remWidth <= 0) remWidth = 1; //Do something non-crashy when too small... + + int pstep = int(progress) % ( 2 * remWidth ); + + if ( pstep > remWidth ) { + //Bounce about.. We're remWidth + some delta, we want to be remWidth - delta... + // - ( (remWidth + some delta) - 2* remWidth ) = - (some deleta - remWidth) = remWidth - some delta.. + pstep = - (pstep - 2 * remWidth ); + } + + if (reverse) + p->fillRect(cr.x() + cr.width() - width - pstep, cr.y(), width, cr.height(), + cg.brush(TQColorGroup::Highlight)); + else + p->fillRect(cr.x() + pstep, cr.y(), width, cr.height(), + cg.brush(TQColorGroup::Highlight)); + + return; + } + + + // Do fancy gradient for highcolor displays + if (d->highcolor) { + TQColor c(cg.highlight()); + KPixmap pix; + pix.resize(cr.width(), cr.height()); + KPixmapEffect::gradient(pix, reverse ? c.light(150) : c.dark(150), + reverse ? c.dark(150) : c.light(150), + KPixmapEffect::HorizontalGradient); + if (reverse) + p->drawPixmap(cr.x()+(cr.width()-width), cr.y(), pix, + cr.width()-width, 0, width, cr.height()); + else + p->drawPixmap(cr.x(), cr.y(), pix, 0, 0, width, cr.height()); + } else + if (reverse) + p->fillRect(cr.x()+(cr.width()-width), cr.y(), width, cr.height(), + cg.brush(TQColorGroup::Highlight)); + else + p->fillRect(cr.x(), cr.y(), width, cr.height(), + cg.brush(TQColorGroup::Highlight)); + } + break; + } + + case CE_ProgressBarLabel: { + TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget); + double progress = ceData.currentStep; + bool reverse = TQApplication::reverseLayout(); + int steps = ceData.totalSteps; + + if (!cr.isValid()) + return; + + TQFont font = p->font(); + font.setBold(true); + p->setFont(font); + + // Draw label + if (progress > 0 || steps == 0) { + double pg = (steps == 0) ? 1.0 : progress / steps; + int width = QMIN(cr.width(), (int)(pg * cr.width())); + TQRect crect; + if (reverse) + crect.setRect(cr.x()+(cr.width()-width), cr.y(), cr.width(), cr.height()); + else + crect.setRect(cr.x()+width, cr.y(), cr.width(), cr.height()); + + p->save(); + p->setPen((elementFlags & CEF_IsEnabled) ? (reverse ? cg.text() : cg.highlightedText()) : cg.text()); + p->drawText(r, AlignCenter, ceData.progressText); + p->setClipRect(crect); + p->setPen(reverse ? cg.highlightedText() : cg.text()); + p->drawText(r, AlignCenter, ceData.progressText); + p->restore(); + + } else { + p->setPen(cg.text()); + p->drawText(r, AlignCenter, ceData.progressText); + } + + break; + } + + default: + TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget); + } +} + + +TQRect TDEStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const +{ + switch(r) + { + // KDE2 look smooth progress bar + // ------------------------------------------------------------------------ + case SR_ProgressBarGroove: + return ceData.rect; + + case SR_ProgressBarContents: + case SR_ProgressBarLabel: { + // ### take into account indicatorFollowsStyle() + TQRect rt = ceData.rect; + return TQRect(rt.x()+2, rt.y()+2, rt.width()-4, rt.height()-4); + } + + default: + return TQCommonStyle::subRect(r, ceData, elementFlags, widget); + } +} + + +int TDEStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* widget) const +{ + switch(m) + { + // BUTTONS + // ------------------------------------------------------------------------ + case PM_ButtonShiftHorizontal: // Offset by 1 + case PM_ButtonShiftVertical: // ### Make configurable + return 1; + + case PM_DockWindowHandleExtent: + { + TQWidget* parent = 0; + // Check that we are not a normal toolbar or a hidden dockwidget, + // in which case we need to adjust the height for font size + if (widget + && !(ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING)) + && !(ceData.parentWidgetData.widgetObjectTypes.contains(TQMAINWINDOW_OBJECT_NAME_STRING)) + && (ceData.widgetObjectTypes.contains(TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING)) ) + return widget->fontMetrics().lineSpacing(); + else + return TQCommonStyle::pixelMetric(m, ceData, elementFlags, widget); + } + + // TABS + // ------------------------------------------------------------------------ + case PM_TabBarTabHSpace: + return 24; + + case PM_TabBarTabVSpace: { + if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove || + ceData.tabBarData.shape == TQTabBar::RoundedBelow ) + return 10; + else + return 4; + } + + case PM_TabBarTabOverlap: { + TQTabBar::Shape tbs = ceData.tabBarData.shape; + + if ( (tbs == TQTabBar::RoundedAbove) || + (tbs == TQTabBar::RoundedBelow) ) + return 0; + else + return 2; + } + + // SLIDER + // ------------------------------------------------------------------------ + case PM_SliderLength: + return 18; + + case PM_SliderThickness: + return 24; + + // Determines how much space to leave for the actual non-tickmark + // portion of the slider. + case PM_SliderControlThickness: { + TQSlider::TickSetting ts = (TQSlider::TickSetting)ceData.tickMarkSetting; + int thickness = (ceData.orientation == TQt::Horizontal) ? + ceData.rect.height() : ceData.rect.width(); + switch (ts) { + case TQSlider::NoMarks: // Use total area. + break; + case TQSlider::Both: + thickness = (thickness/2) + 3; // Use approx. 1/2 of area. + break; + default: // Use approx. 2/3 of area + thickness = ((thickness*2)/3) + 3; + break; + }; + return thickness; + } + + // SPLITTER + // ------------------------------------------------------------------------ + case PM_SplitterWidth: + if (ceData.widgetObjectTypes.contains(TQDOCKWINDOWRESIZEHANDLE_OBJECT_NAME_STRING)) + return 8; // ### why do we need 2pix extra? + else + return 6; + + // FRAMES + // ------------------------------------------------------------------------ + case PM_MenuBarFrameWidth: + return 1; + + case PM_DockWindowFrameWidth: + return 1; + + // GENERAL + // ------------------------------------------------------------------------ + case PM_MaximumDragDistance: + return -1; + + case PM_MenuBarItemSpacing: + return 5; + + case PM_ToolBarItemSpacing: + return 0; + + case PM_PopupMenuScrollerHeight: + return pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, 0); + + default: + return TQCommonStyle::pixelMetric( m, ceData, elementFlags, widget ); + } +} + +//Helper to find the next sibling that's not hidden +static TQListViewItem* nextVisibleSibling(TQListViewItem* item) +{ + TQListViewItem* sibling = item; + do + { + sibling = sibling->nextSibling(); + } + while (sibling && !sibling->isVisible()); + + return sibling; +} + +void TDEStyle::drawComplexControl( TQ_ComplexControl control, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags controls, + SCFlags active, + const TQStyleOption &opt, + const TQWidget* widget ) const +{ + switch(control) + { + // 3 BUTTON SCROLLBAR + // ------------------------------------------------------------------------ + case CC_ScrollBar: { + // Many thanks to Brad Hughes for contributing this code. + bool useThreeButtonScrollBar = (d->scrollbarType & ThreeButtonScrollBar); + + bool maxedOut = (ceData.minSteps == ceData.maxSteps); + bool horizontal = (ceData.orientation == TQt::Horizontal); + SFlags sflags = ((horizontal ? Style_Horizontal : Style_Default) | + (maxedOut ? Style_Default : Style_Enabled)); + + TQRect addline, subline, subline2, addpage, subpage, slider, first, last; + subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget); + addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget); + subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget); + addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget); + slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget); + first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget); + last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget); + subline2 = addline; + + if ( useThreeButtonScrollBar ) { + if (horizontal) { + subline2.moveBy(-addline.width(), 0); + } + else { + subline2.moveBy(0, -addline.height()); + } + } + + // Draw the up/left button set + if ((controls & SC_ScrollBarSubLine) && subline.isValid()) { + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg, + sflags | (active == SC_ScrollBarSubLine ? + Style_Down : Style_Default)); + + if (useThreeButtonScrollBar && subline2.isValid()) + drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg, + sflags | (active == SC_ScrollBarSubLine ? + Style_Down : Style_Default)); + } + + if ((controls & SC_ScrollBarAddLine) && addline.isValid()) + drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, + sflags | ((active == SC_ScrollBarAddLine) ? + Style_Down : Style_Default)); + + if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) + drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg, + sflags | ((active == SC_ScrollBarSubPage) ? + Style_Down : Style_Default)); + + if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) + drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg, + sflags | ((active == SC_ScrollBarAddPage) ? + Style_Down : Style_Default)); + + if ((controls & SC_ScrollBarFirst) && first.isValid()) + drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg, + sflags | ((active == SC_ScrollBarFirst) ? + Style_Down : Style_Default)); + + if ((controls & SC_ScrollBarLast) && last.isValid()) + drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg, + sflags | ((active == SC_ScrollBarLast) ? + Style_Down : Style_Default)); + + if ((controls & SC_ScrollBarSlider) && slider.isValid()) { + drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg, + sflags | ((active == SC_ScrollBarSlider) ? + Style_Down : Style_Default)); + // Draw focus rect + if (elementFlags & CEF_HasFocus) { + TQRect fr(slider.x() + 2, slider.y() + 2, + slider.width() - 5, slider.height() - 5); + drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default); + } + } + break; + } + + + // SLIDER + // ------------------------------------------------------------------- + case CC_Slider: { + TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, opt, widget); + TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, opt, widget); + + // Double-buffer slider for no flicker + TQPixmap pix(ceData.rect.size()); + TQPainter p2; + p2.begin(&pix); + + if ( (elementFlags & CEF_HasParentWidget) && + !ceData.parentWidgetData.bgPixmap.isNull() ) { + TQPixmap pixmap = ceData.parentWidgetData.bgPixmap; + p2.drawTiledPixmap(r, pixmap, ceData.pos); + } else + pix.fill(cg.background()); + + // Draw slider groove + if ((controls & SC_SliderGroove) && groove.isValid()) { + drawTDEStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, flags, opt, widget ); + + // Draw the focus rect around the groove + if (elementFlags & CEF_HasFocus) { + drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg); + } + } + + // Draw the tickmarks + if (controls & SC_SliderTickmarks) + TQCommonStyle::drawComplexControl(control, &p2, ceData, elementFlags, + r, cg, flags, SC_SliderTickmarks, active, opt, widget); + + // Draw the slider handle + if ((controls & SC_SliderHandle) && handle.isValid()) { + if (active == SC_SliderHandle) + flags |= Style_Active; + drawTDEStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, flags, opt, widget ); + } + + p2.end(); + + TQPaintDevice* ppd = p->device(); + if (ppd->isExtDev()) { + p->drawPixmap(0, 0, pix); + } + else { + bitBlt((TQWidget*)widget, r.x(), r.y(), &pix); + } + break; + } + + // LISTVIEW + // ------------------------------------------------------------------- + case CC_ListView: { + + /* + * Many thanks to TrollTech AS for donating CC_ListView from TQWindowsStyle. + * CC_ListView code is Copyright (C) 1998-2000 TrollTech AS. + */ + + // Paint the icon and text. + if ( controls & SC_ListView ) + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget ); + + // If we're have a branch or are expanded... + if ( controls & (SC_ListViewBranch | SC_ListViewExpand) ) + { + // If no list view item was supplied, break + if (opt.isDefault()) + break; + + TQListViewItem *item = opt.listViewItem(); + TQListViewItem *child = item->firstChild(); + + int y = r.y(); + int c; // dotline vertice count + int dotoffset = 0; + TQPointArray dotlines; + + if ( active == SC_All && controls == SC_ListViewExpand ) { + // We only need to draw a vertical line + c = 2; + dotlines.resize(2); + dotlines[0] = TQPoint( r.right(), r.top() ); + dotlines[1] = TQPoint( r.right(), r.bottom() ); + + } else { + + int linetop = 0, linebot = 0; + // each branch needs at most two lines, ie. four end points + dotoffset = (item->itemPos() + item->height() - y) % 2; + dotlines.resize( item->childCount() * 4 ); + c = 0; + + // skip the stuff above the exposed rectangle + while ( child && y + child->height() <= 0 ) + { + y += child->totalHeight(); + child = nextVisibleSibling(child); + } + + int bx = r.width() / 2; + + // paint stuff in the magical area + TQListView* v = item->listView(); + int lh = QMAX( p->fontMetrics().height() + 2 * v->itemMargin(), + TQApplication::globalStrut().height() ); + if ( lh % 2 > 0 ) + lh++; + + // Draw all the expand/close boxes... + TQRect boxrect; + TQStyle::StyleFlags boxflags; + while ( child && y < r.height() ) + { + linebot = y + lh/2; + if ( (child->isExpandable() || child->childCount()) && + (child->height() > 0) ) + { + // The primitive requires a rect. + boxrect = TQRect( bx-4, linebot-4, 9, 9 ); + boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On; + + // TDEStyle extension: Draw the box and expand/collapse indicator + drawTDEStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL ); + + // dotlinery + p->setPen( cg.mid() ); + dotlines[c++] = TQPoint( bx, linetop ); + dotlines[c++] = TQPoint( bx, linebot - 5 ); + dotlines[c++] = TQPoint( bx + 5, linebot ); + dotlines[c++] = TQPoint( r.width(), linebot ); + linetop = linebot + 5; + } else { + // just dotlinery + dotlines[c++] = TQPoint( bx+1, linebot ); + dotlines[c++] = TQPoint( r.width(), linebot ); + } + + y += child->totalHeight(); + child = nextVisibleSibling(child); + } + + if ( child ) // there's a child to draw, so move linebot to edge of rectangle + linebot = r.height(); + + if ( linetop < linebot ) + { + dotlines[c++] = TQPoint( bx, linetop ); + dotlines[c++] = TQPoint( bx, linebot ); + } + } + + // Draw all the branches... + static int thickness = kPixelMetric( KPM_ListViewBranchThickness, ceData, elementFlags ); + int line; // index into dotlines + TQRect branchrect; + TQStyle::StyleFlags branchflags; + for( line = 0; line < c; line += 2 ) + { + // assumptions here: lines are horizontal or vertical. + // lines always start with the numerically lowest + // coordinate. + + // point ... relevant coordinate of current point + // end ..... same coordinate of the end of the current line + // other ... the other coordinate of the current point/line + if ( dotlines[line].y() == dotlines[line+1].y() ) + { + // Horizontal branch + int end = dotlines[line+1].x(); + int point = dotlines[line].x(); + int other = dotlines[line].y(); + + branchrect = TQRect( point, other-(thickness/2), end-point, thickness ); + branchflags = TQStyle::Style_Horizontal; + + // TDEStyle extension: Draw the horizontal branch + drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL ); + + } else { + // Vertical branch + int end = dotlines[line+1].y(); + int point = dotlines[line].y(); + int other = dotlines[line].x(); + int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0; + + branchrect = TQRect( other-(thickness/2), point, thickness, end-point ); + if (!pixmapoffset) // ### Hackish - used to hint the offset + branchflags = TQStyle::Style_NoChange; + else + branchflags = TQStyle::Style_Default; + + // TDEStyle extension: Draw the vertical branch + drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL ); + } + } + } + break; + } + + default: + TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, + flags, controls, active, opt, widget ); + break; + } +} + + +TQStyle::SubControl TDEStyle::querySubControl( TQ_ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQPoint &pos, + const TQStyleOption &opt, + const TQWidget* widget ) const +{ + TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, opt, widget); + + if (d->scrollbarType == ThreeButtonScrollBar) { + // Enable third button + if (control == CC_ScrollBar && ret == SC_None) + ret = SC_ScrollBarSubLine; + } + return ret; +} + + +TQRect TDEStyle::querySubControlMetrics( TQ_ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption &opt, + const TQWidget* widget ) const +{ + TQRect ret; + + if (control == CC_ScrollBar) + { + bool threeButtonScrollBar = d->scrollbarType & ThreeButtonScrollBar; + bool platinumScrollBar = d->scrollbarType & PlatinumStyleScrollBar; + bool nextScrollBar = d->scrollbarType & NextStyleScrollBar; + + bool horizontal = ceData.orientation == TQt::Horizontal; + int sliderstart = ceData.startStep; + int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget); + int maxlen = (horizontal ? ceData.rect.width() : ceData.rect.height()) + - (sbextent * (threeButtonScrollBar ? 3 : 2)); + int sliderlen; + + // calculate slider length + if (ceData.maxSteps != ceData.minSteps) + { + uint range = ceData.maxSteps - ceData.minSteps; + sliderlen = (ceData.pageStep * maxlen) / (range + ceData.pageStep); + + int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget ); + if ( sliderlen < slidermin || range > INT_MAX / 2 ) + sliderlen = slidermin; + if ( sliderlen > maxlen ) + sliderlen = maxlen; + } else + sliderlen = maxlen; + + // Subcontrols + switch (sc) + { + case SC_ScrollBarSubLine: { + // top/left button + if (platinumScrollBar) { + if (horizontal) + ret.setRect(ceData.rect.width() - 2 * sbextent, 0, sbextent, sbextent); + else + ret.setRect(0, ceData.rect.height() - 2 * sbextent, sbextent, sbextent); + } else + ret.setRect(0, 0, sbextent, sbextent); + break; + } + + case SC_ScrollBarAddLine: { + // bottom/right button + if (nextScrollBar) { + if (horizontal) + ret.setRect(sbextent, 0, sbextent, sbextent); + else + ret.setRect(0, sbextent, sbextent, sbextent); + } else { + if (horizontal) + ret.setRect(ceData.rect.width() - sbextent, 0, sbextent, sbextent); + else + ret.setRect(0, ceData.rect.height() - sbextent, sbextent, sbextent); + } + break; + } + + case SC_ScrollBarSubPage: { + // between top/left button and slider + if (platinumScrollBar) { + if (horizontal) + ret.setRect(0, 0, sliderstart, sbextent); + else + ret.setRect(0, 0, sbextent, sliderstart); + } else if (nextScrollBar) { + if (horizontal) + ret.setRect(sbextent*2, 0, sliderstart-2*sbextent, sbextent); + else + ret.setRect(0, sbextent*2, sbextent, sliderstart-2*sbextent); + } else { + if (horizontal) + ret.setRect(sbextent, 0, sliderstart - sbextent, sbextent); + else + ret.setRect(0, sbextent, sbextent, sliderstart - sbextent); + } + break; + } + + case SC_ScrollBarAddPage: { + // between bottom/right button and slider + int fudge; + + if (platinumScrollBar) + fudge = 0; + else if (nextScrollBar) + fudge = 2*sbextent; + else + fudge = sbextent; + + if (horizontal) + ret.setRect(sliderstart + sliderlen, 0, + maxlen - sliderstart - sliderlen + fudge, sbextent); + else + ret.setRect(0, sliderstart + sliderlen, sbextent, + maxlen - sliderstart - sliderlen + fudge); + break; + } + + case SC_ScrollBarGroove: { + int multi = threeButtonScrollBar ? 3 : 2; + int fudge; + + if (platinumScrollBar) + fudge = 0; + else if (nextScrollBar) + fudge = 2*sbextent; + else + fudge = sbextent; + + if (horizontal) + ret.setRect(fudge, 0, ceData.rect.width() - sbextent * multi, ceData.rect.height()); + else + ret.setRect(0, fudge, ceData.rect.width(), ceData.rect.height() - sbextent * multi); + break; + } + + case SC_ScrollBarSlider: { + if (horizontal) + ret.setRect(sliderstart, 0, sliderlen, sbextent); + else + ret.setRect(0, sliderstart, sbextent, sliderlen); + break; + } + + default: + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget); + break; + } + } else + ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, opt, widget); + + return ret; +} + +static const char * const kstyle_close_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"..##....##..", +"...##..##...", +"....####....", +".....##.....", +"....####....", +"...##..##...", +"..##....##..", +"............", +"............", +"............"}; + +static const char * const kstyle_maximize_xpm[]={ +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +".##########.", +".##########.", +".#........#.", +".#........#.", +".#........#.", +".#........#.", +".#........#.", +".#........#.", +".##########.", +"............"}; + + +static const char * const kstyle_minimize_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"............", +"............", +"............", +"............", +"............", +"...######...", +"...######...", +"............", +"............", +"............"}; + +static const char * const kstyle_normalizeup_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"...#######..", +"...#######..", +"...#.....#..", +".#######.#..", +".#######.#..", +".#.....#.#..", +".#.....###..", +".#.....#....", +".#.....#....", +".#######....", +"............"}; + + +static const char * const kstyle_shade_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"............", +"............", +"............", +".....#......", +"....###.....", +"...#####....", +"..#######...", +"............", +"............", +"............"}; + +static const char * const kstyle_unshade_xpm[] = { +"12 12 2 1", +"# c #000000", +". c None", +"............", +"............", +"............", +"............", +"..#######...", +"...#####....", +"....###.....", +".....#......", +"............", +"............", +"............", +"............"}; + +static const char * const dock_window_close_xpm[] = { +"8 8 2 1", +"# c #000000", +". c None", +"##....##", +".##..##.", +"..####..", +"...##...", +"..####..", +".##..##.", +"##....##", +"........"}; + +// Message box icons, from page 210 of the Windows style guide. + +// Hand-drawn to resemble Microsoft's icons, but in the Mac/Netscape +// palette. The "question mark" icon, which Microsoft recommends not +// using but a lot of people still use, is left out. + +/* XPM */ +static const char * const information_xpm[]={ +"32 32 5 1", +". c None", +"c c #000000", +"* c #999999", +"a c #ffffff", +"b c #0000ff", +"...........********.............", +"........***aaaaaaaa***..........", +"......**aaaaaaaaaaaaaa**........", +".....*aaaaaaaaaaaaaaaaaa*.......", +"....*aaaaaaaabbbbaaaaaaaac......", +"...*aaaaaaaabbbbbbaaaaaaaac.....", +"..*aaaaaaaaabbbbbbaaaaaaaaac....", +".*aaaaaaaaaaabbbbaaaaaaaaaaac...", +".*aaaaaaaaaaaaaaaaaaaaaaaaaac*..", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaaac*.", +"*aaaaaaaaaabbbbbbbaaaaaaaaaaac*.", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +"*aaaaaaaaaaaabbbbbaaaaaaaaaaac**", +".*aaaaaaaaaaabbbbbaaaaaaaaaac***", +".*aaaaaaaaaaabbbbbaaaaaaaaaac***", +"..*aaaaaaaaaabbbbbaaaaaaaaac***.", +"...caaaaaaabbbbbbbbbaaaaaac****.", +"....caaaaaaaaaaaaaaaaaaaac****..", +".....caaaaaaaaaaaaaaaaaac****...", +"......ccaaaaaaaaaaaaaacc****....", +".......*cccaaaaaaaaccc*****.....", +"........***cccaaaac*******......", +"..........****caaac*****........", +".............*caaac**...........", +"...............caac**...........", +"................cac**...........", +".................cc**...........", +"..................***...........", +"...................**..........."}; +/* XPM */ +static const char* const warning_xpm[]={ +"32 32 4 1", +". c None", +"a c #ffff00", +"* c #000000", +"b c #999999", +".............***................", +"............*aaa*...............", +"...........*aaaaa*b.............", +"...........*aaaaa*bb............", +"..........*aaaaaaa*bb...........", +"..........*aaaaaaa*bb...........", +".........*aaaaaaaaa*bb..........", +".........*aaaaaaaaa*bb..........", +"........*aaaaaaaaaaa*bb.........", +"........*aaaa***aaaa*bb.........", +".......*aaaa*****aaaa*bb........", +".......*aaaa*****aaaa*bb........", +"......*aaaaa*****aaaaa*bb.......", +"......*aaaaa*****aaaaa*bb.......", +".....*aaaaaa*****aaaaaa*bb......", +".....*aaaaaa*****aaaaaa*bb......", +"....*aaaaaaaa***aaaaaaaa*bb.....", +"....*aaaaaaaa***aaaaaaaa*bb.....", +"...*aaaaaaaaa***aaaaaaaaa*bb....", +"...*aaaaaaaaaa*aaaaaaaaaa*bb....", +"..*aaaaaaaaaaa*aaaaaaaaaaa*bb...", +"..*aaaaaaaaaaaaaaaaaaaaaaa*bb...", +".*aaaaaaaaaaaa**aaaaaaaaaaa*bb..", +".*aaaaaaaaaaa****aaaaaaaaaa*bb..", +"*aaaaaaaaaaaa****aaaaaaaaaaa*bb.", +"*aaaaaaaaaaaaa**aaaaaaaaaaaa*bb.", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", +"*aaaaaaaaaaaaaaaaaaaaaaaaaaa*bbb", +".*aaaaaaaaaaaaaaaaaaaaaaaaa*bbbb", +"..*************************bbbbb", +"....bbbbbbbbbbbbbbbbbbbbbbbbbbb.", +".....bbbbbbbbbbbbbbbbbbbbbbbbb.."}; +/* XPM */ +static const char* const critical_xpm[]={ +"32 32 4 1", +". c None", +"a c #999999", +"* c #ff0000", +"b c #ffffff", +"...........********.............", +".........************...........", +".......****************.........", +"......******************........", +".....********************a......", +"....**********************a.....", +"...************************a....", +"..*******b**********b*******a...", +"..******bbb********bbb******a...", +".******bbbbb******bbbbb******a..", +".*******bbbbb****bbbbb*******a..", +"*********bbbbb**bbbbb*********a.", +"**********bbbbbbbbbb**********a.", +"***********bbbbbbbb***********aa", +"************bbbbbb************aa", +"************bbbbbb************aa", +"***********bbbbbbbb***********aa", +"**********bbbbbbbbbb**********aa", +"*********bbbbb**bbbbb*********aa", +".*******bbbbb****bbbbb*******aa.", +".******bbbbb******bbbbb******aa.", +"..******bbb********bbb******aaa.", +"..*******b**********b*******aa..", +"...************************aaa..", +"....**********************aaa...", +"....a********************aaa....", +".....a******************aaa.....", +"......a****************aaa......", +".......aa************aaaa.......", +".........aa********aaaaa........", +"...........aaaaaaaaaaa..........", +".............aaaaaaa............"}; + +TQPixmap TDEStyle::stylePixmap( StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& opt, + const TQWidget* widget) const +{ + switch (stylepixmap) { + case SP_TitleBarShadeButton: + return TQPixmap(const_cast<const char**>(kstyle_shade_xpm)); + case SP_TitleBarUnshadeButton: + return TQPixmap(const_cast<const char**>(kstyle_unshade_xpm)); + case SP_TitleBarNormalButton: + return TQPixmap(const_cast<const char**>(kstyle_normalizeup_xpm)); + case SP_TitleBarMinButton: + return TQPixmap(const_cast<const char**>(kstyle_minimize_xpm)); + case SP_TitleBarMaxButton: + return TQPixmap(const_cast<const char**>(kstyle_maximize_xpm)); + case SP_TitleBarCloseButton: + return TQPixmap(const_cast<const char**>(kstyle_close_xpm)); + case SP_DockWindowCloseButton: + return TQPixmap(const_cast<const char**>(dock_window_close_xpm )); + case SP_MessageBoxInformation: + return TQPixmap(const_cast<const char**>(information_xpm)); + case SP_MessageBoxWarning: + return TQPixmap(const_cast<const char**>(warning_xpm)); + case SP_MessageBoxCritical: + return TQPixmap(const_cast<const char**>(critical_xpm)); + default: + break; + } + return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget); +} + + +int TDEStyle::styleHint( TQ_StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, + const TQStyleOption &opt, TQStyleHintReturn* shr, const TQWidget* w) const +{ + switch (sh) + { + case SH_EtchDisabledText: + return d->etchDisabledText ? 1 : 0; + + case SH_PopupMenu_Scrollable: + return d->scrollablePopupmenus ? 1 : 0; + + case SH_HideUnderlineAcceleratorWhenAltUp: + return d->autoHideAccelerators ? 1 : 0; + + case SH_MenuBar_AltKeyNavigation: + return d->menuAltKeyNavigation ? 1 : 0; + + case SH_PopupMenu_SubMenuPopupDelay: + if ( styleHint( SH_PopupMenu_SloppySubMenus, ceData, elementFlags, TQStyleOption::Default, 0, w ) ) + return QMIN( 100, d->popupMenuDelay ); + else + return d->popupMenuDelay; + + case SH_PopupMenu_SloppySubMenus: + return d->sloppySubMenus; + + case SH_ItemView_ChangeHighlightOnFocus: + case SH_Slider_SloppyKeyEvents: + case SH_MainWindow_SpaceBelowMenuBar: + case SH_PopupMenu_AllowActiveAndDisabled: + return 0; + + case SH_Slider_SnapToValue: + case SH_PrintDialog_RightAlignButtons: + case SH_FontDialog_SelectAssociatedText: + case SH_MenuBar_MouseTracking: + case SH_PopupMenu_MouseTracking: + case SH_ComboBox_ListMouseTracking: + case SH_ScrollBar_MiddleClickAbsolutePosition: + return 1; + case SH_LineEdit_PasswordCharacter: + { + if (w) { + const TQFontMetrics &fm = w->fontMetrics(); + if (fm.inFont(TQChar(0x25CF))) { + return 0x25CF; + } else if (fm.inFont(TQChar(0x2022))) { + return 0x2022; + } + } + return '*'; + } + + default: + return TQCommonStyle::styleHint(sh, ceData, elementFlags, opt, shr, w); + } +} + + +bool TDEStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event ) +{ + if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) { + TQObject* object = reinterpret_cast<TQObject*>(source); + if ( d->useFilledFrameWorkaround ) + { + // Make the QMenuBar/TQToolBar paintEvent() cover a larger area to + // ensure that the filled frame contents are properly painted. + // We essentially modify the paintEvent's rect to include the + // panel border, which also paints the widget's interior. + // This is nasty, but I see no other way to properly repaint + // filled frames in all QMenuBars and QToolBars. + // -- Karol. + TQFrame *frame = 0; + if ( event->type() == TQEvent::Paint + && (frame = ::tqqt_cast<TQFrame*>(object)) ) + { + if (frame->frameShape() != TQFrame::ToolBarPanel && frame->frameShape() != TQFrame::MenuBarPanel) + return false; + + bool horizontal = true; + TQPaintEvent* pe = (TQPaintEvent*)event; + TQToolBar *toolbar = ::tqqt_cast< TQToolBar *>( frame ); + TQRect r = pe->rect(); + + if (toolbar && toolbar->orientation() == Qt::Vertical) + horizontal = false; + + if (horizontal) { + if ( r.height() == frame->height() ) + return false; // Let TQFrame handle the painting now. + + // Else, send a new paint event with an updated paint rect. + TQPaintEvent dummyPE( TQRect( r.x(), 0, r.width(), frame->height()) ); + TQApplication::sendEvent( frame, &dummyPE ); + } + else { // Vertical + if ( r.width() == frame->width() ) + return false; + + TQPaintEvent dummyPE( TQRect( 0, r.y(), frame->width(), r.height()) ); + TQApplication::sendEvent( frame, &dummyPE ); + } + + // Discard this event as we sent a new paintEvent. + return true; + } + } + } + + return false; +} + + +// ----------------------------------------------------------------------------- +// I N T E R N A L - TDEStyle menu transparency handler +// ----------------------------------------------------------------------------- + +TransparencyHandler::TransparencyHandler( TDEStyle* style, + TransparencyEngine tEngine, float menuOpacity, bool useDropShadow ) + : TQObject() +{ + te = tEngine; + kstyle = style; + opacity = menuOpacity; + dropShadow = useDropShadow; + pix.setOptimization(TQPixmap::BestOptim); +} + +TransparencyHandler::~TransparencyHandler() +{ +} + +bool TransparencyHandler::haveX11RGBASupport() +{ + // Simple way to determine if we have ARGB support + if (TQPaintDevice::x11AppDepth() == 32) { + return true; + } + else { + return false; + } +} + +#define REAL_ALPHA_STRENGTH 255.0 + +// This is meant to be ugly but fast. +void TransparencyHandler::rightShadow(TQImage& dst) +{ + bool have_composite = haveX11RGBASupport(); + + if (dst.depth() != 32) + dst = dst.convertDepth(32); + + // blend top-right corner. + int pixels = dst.width() * dst.height(); +#ifdef WORDS_BIGENDIAN + register unsigned char* data = dst.bits() + 1; // Skip alpha +#else + register unsigned char* data = dst.bits(); // Skip alpha +#endif + for(register int i = 0; i < 16; i++) { + if (have_composite) { + data++; + data++; + data++; + *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-top_right_corner[i])); data++; + } + else { + *data = (unsigned char)((*data)*top_right_corner[i]); data++; + *data = (unsigned char)((*data)*top_right_corner[i]); data++; + *data = (unsigned char)((*data)*top_right_corner[i]); data++; + data++; // skip alpha + } + } + + pixels -= 32; // tint right strip without rounded edges. + register int c = 0; + for(register int i = 0; i < pixels; i++) { + if (have_composite) { + data++; + data++; + data++;; + *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-shadow_strip[c])); data++; + } + else { + *data = (unsigned char)((*data)*shadow_strip[c]); data++; + *data = (unsigned char)((*data)*shadow_strip[c]); data++; + *data = (unsigned char)((*data)*shadow_strip[c]); data++; + data++; // skip alpha + } + ++c; + c %= 4; + } + + // tint bottom edge + for(register int i = 0; i < 16; i++) { + if (have_composite) { + data++; + data++; + data++; + *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-bottom_right_corner[i])); data++; + } + else { + *data = (unsigned char)((*data)*bottom_right_corner[i]); data++; + *data = (unsigned char)((*data)*bottom_right_corner[i]); data++; + *data = (unsigned char)((*data)*bottom_right_corner[i]); data++; + data++; // skip alpha + } + } +} + +void TransparencyHandler::bottomShadow(TQImage& dst) +{ + bool have_composite = haveX11RGBASupport(); + + if (dst.depth() != 32) + dst = dst.convertDepth(32); + + int line = 0; + int width = dst.width() - 4; + double strip_data = shadow_strip[0]; + double* corner = const_cast<double*>(bottom_left_corner); + +#ifdef WORDS_BIGENDIAN + register unsigned char* data = dst.bits() + 1; // Skip alpha +#else + register unsigned char* data = dst.bits(); // Skip alpha +#endif + + for(int y = 0; y < 4; y++) + { + // Bottom-left Corner + for(register int x = 0; x < 4; x++) { + if (have_composite) { + data++; + data++; + data++; + *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-(*corner))); data++; + } + else { + *data = (unsigned char)((*data)*(*corner)); data++; + *data = (unsigned char)((*data)*(*corner)); data++; + *data = (unsigned char)((*data)*(*corner)); data++; + data++; // skip alpha + } + corner++; + } + + // Scanline + for(register int x = 0; x < width; x++) { + if (have_composite) { + data++; + data++; + data++; + *data = (unsigned char)(REAL_ALPHA_STRENGTH*(1.0-strip_data)); data++; + } + else { + *data = (unsigned char)((*data)*strip_data); data++; + *data = (unsigned char)((*data)*strip_data); data++; + *data = (unsigned char)((*data)*strip_data); data++; + data++; // skip alpha + } + } + + strip_data = shadow_strip[++line]; + } +} + +TQImage TransparencyHandler::handleRealAlpha(TQImage img) { + TQImage clearImage = img.convertDepth(32); + clearImage.setAlphaBuffer(true); + + int w = clearImage.width(); + int h = clearImage.height(); + + for (int y = 0; y < h; ++y) { + TQRgb *ls = (TQRgb *)clearImage.scanLine( y ); + for (int x = 0; x < w; ++x) { + ls[x] = tqRgba( 0, 0, 0, 0 ); + } + } + + return clearImage; +} + +// Create a shadow of thickness 4. +void TransparencyHandler::createShadowWindows(const TQWidget* p) +{ +#ifdef Q_WS_X11 + int x2 = p->x()+p->width(); + int y2 = p->y()+p->height(); + TQRect shadow1(x2, p->y() + 4, 4, p->height()); + TQRect shadow2(p->x() + 4, y2, p->width() - 4, 4); + + bool have_composite = haveX11RGBASupport(); + + // Create a fake drop-down shadow effect via blended Xwindows + ShadowElements se; + se.w1 = new TQWidget(0, 0, (WFlags)(WStyle_Customize | WType_Popup | WX11BypassWM) ); + se.w2 = new TQWidget(0, 0, (WFlags)(WStyle_Customize | WType_Popup | WX11BypassWM) ); + se.w1->setGeometry(shadow1); + se.w2->setGeometry(shadow2); + XSelectInput(tqt_xdisplay(), se.w1->winId(), StructureNotifyMask ); + XSelectInput(tqt_xdisplay(), se.w2->winId(), StructureNotifyMask ); + + // Insert a new ShadowMap entry + shadowMap()[p] = se; + + // Some hocus-pocus here to create the drop-shadow. + TQPixmap pix_shadow1; + TQPixmap pix_shadow2; + if (have_composite) { + pix_shadow1 = TQPixmap(shadow1.width(), shadow1.height()); + pix_shadow2 = TQPixmap(shadow2.width(), shadow2.height()); + } + else { + pix_shadow1 = TQPixmap::grabWindow(tqt_xrootwin(), + shadow1.x(), shadow1.y(), shadow1.width(), shadow1.height()); + pix_shadow2 = TQPixmap::grabWindow(tqt_xrootwin(), + shadow2.x(), shadow2.y(), shadow2.width(), shadow2.height()); + } + + TQImage img; + img = pix_shadow1.convertToImage(); + if (have_composite) img = handleRealAlpha(img); + rightShadow(img); + pix_shadow1.convertFromImage(img); + img = pix_shadow2.convertToImage(); + if (have_composite) img = handleRealAlpha(img); + bottomShadow(img); + pix_shadow2.convertFromImage(img); + + // Set the background pixmaps + se.w1->setErasePixmap(pix_shadow1); + se.w2->setErasePixmap(pix_shadow2); + + // Show the 'shadow' just before showing the popup menu window + // Don't use TQWidget::show() so we don't confuse QEffects, thus causing broken focus. + XMapWindow(tqt_xdisplay(), se.w1->winId()); + XMapWindow(tqt_xdisplay(), se.w2->winId()); +#else + Q_UNUSED( p ) +#endif +} + +void TransparencyHandler::removeShadowWindows(const TQWidget* p) +{ +#ifdef Q_WS_X11 + ShadowMap::iterator it = shadowMap().find(p); + if (it != shadowMap().end()) + { + ShadowElements se = it.data(); + XUnmapWindow(tqt_xdisplay(), se.w1->winId()); // hide + XUnmapWindow(tqt_xdisplay(), se.w2->winId()); + XFlush(tqt_xdisplay()); // try to hide faster + delete se.w1; + delete se.w2; + shadowMap().erase(it); + } +#else + Q_UNUSED( p ) +#endif +} + +bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event ) +{ +#if !defined Q_WS_MAC && !defined Q_WS_WIN + // Transparency idea was borrowed from KDE2's "MegaGradient" Style, + // Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> + + // Added 'fake' menu shadows <04-Jul-2002> -- Karol + TQWidget* p = (TQWidget*)object; + TQEvent::Type et = event->type(); + + if (et == TQEvent::Show) + { + // Handle translucency + if (te != Disabled) + { + pix = TQPixmap::grabWindow(tqt_xrootwin(), + p->x(), p->y(), p->width(), p->height()); + + switch (te) { +#ifdef HAVE_XRENDER + case XRender: + if (tqt_use_xrender) { + XRenderBlendToPixmap(p); + break; + } + // Fall through intended +#else + case XRender: +#endif + case SoftwareBlend: + blendToPixmap(p->colorGroup(), p); + break; + + case SoftwareTint: + default: + blendToColor(p->colorGroup().button()); + }; + + p->setErasePixmap(pix); + } + + // Handle drop shadow + // * FIXME : !shadowMap().contains(p) is a workaround for leftover + // * shadows after duplicate show events. + // * TODO : determine real cause for duplicate events + // * till 20021005 + if ((dropShadow || useDropShadow(p)) + && p->width() > 16 && p->height() > 16 && !shadowMap().contains( p )) + createShadowWindows(p); + } + else if (et == TQEvent::Resize && p->isShown() && p->isTopLevel()) + { + // Handle drop shadow + if (dropShadow || useDropShadow(p)) + { + removeShadowWindows(p); + createShadowWindows(p); + } + } + else if (et == TQEvent::Hide) + { + // Handle drop shadow + if (dropShadow || useDropShadow(p)) + removeShadowWindows(p); + + // Handle translucency + if (te != Disabled) + p->setErasePixmap(TQPixmap()); + } + +#endif + return false; +} + + +// Blends a TQImage to a predefined color, with a given opacity. +void TransparencyHandler::blendToColor(const TQColor &col) +{ + if (opacity < 0.0 || opacity > 1.0) + return; + + TQImage img = pix.convertToImage(); + KImageEffect::blend(col, img, opacity); + pix.convertFromImage(img); +} + + +void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQWidget* p) +{ + if (opacity < 0.0 || opacity > 1.0) + return; + + KPixmap blendPix; + blendPix.resize( pix.width(), pix.height() ); + + if (blendPix.width() != pix.width() || + blendPix.height() != pix.height()) + return; + + // Allow styles to define the blend pixmap - allows for some interesting effects. + if (::tqqt_cast<TQPopupMenu*>(p)) + kstyle->renderMenuBlendPixmap( blendPix, cg, ::tqqt_cast<TQPopupMenu*>(p) ); + else + blendPix.fill(cg.button()); // Just tint as the default behavior + + TQImage blendImg = blendPix.convertToImage(); + TQImage backImg = pix.convertToImage(); + KImageEffect::blend(blendImg, backImg, opacity); + pix.convertFromImage(backImg); +} + + +#ifdef HAVE_XRENDER +// Here we go, use XRender in all its glory. +// NOTE: This is actually a bit slower than the above routines +// on non-accelerated displays. -- Karol. +void TransparencyHandler::XRenderBlendToPixmap(const TQWidget* p) +{ + KPixmap renderPix; + renderPix.resize( pix.width(), pix.height() ); + + // Allow styles to define the blend pixmap - allows for some interesting effects. + if (::tqqt_cast<TQPopupMenu*>(p)) + kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(), + ::tqqt_cast<TQPopupMenu*>(p) ); + else + renderPix.fill(p->colorGroup().button()); // Just tint as the default behavior + + Display* dpy = tqt_xdisplay(); + Pixmap alphaPixmap; + Picture alphaPicture; + XRenderPictFormat Rpf; + XRenderPictureAttributes Rpa; + XRenderColor clr; + clr.alpha = ((unsigned short)(255*opacity) << 8); + + Rpf.type = PictTypeDirect; + Rpf.depth = 8; + Rpf.direct.alphaMask = 0xff; + Rpa.repeat = True; // Tile + + XRenderPictFormat* xformat = XRenderFindFormat(dpy, + PictFormatType | PictFormatDepth | PictFormatAlphaMask, &Rpf, 0); + + alphaPixmap = XCreatePixmap(dpy, p->handle(), 1, 1, 8); + alphaPicture = XRenderCreatePicture(dpy, alphaPixmap, xformat, CPRepeat, &Rpa); + + XRenderFillRectangle(dpy, PictOpSrc, alphaPicture, &clr, 0, 0, 1, 1); + + XRenderComposite(dpy, PictOpOver, + renderPix.x11RenderHandle(), alphaPicture, pix.x11RenderHandle(), // src, mask, dst + 0, 0, // srcx, srcy + 0, 0, // maskx, masky + 0, 0, // dstx, dsty + pix.width(), pix.height()); + + XRenderFreePicture(dpy, alphaPicture); + XFreePixmap(dpy, alphaPixmap); +} +#endif + +void TDEStyle::virtual_hook( int, void* ) +{ /*BASE::virtual_hook( id, data );*/ } + +// HACK for gtk-qt-engine + +extern "C" KDE_EXPORT +void kde_kstyle_set_scrollbar_type_windows( void* style ) +{ + ((TDEStyle*)style)->setScrollBarType( TDEStyle::WindowsStyleScrollBar ); +} + +// vim: set noet ts=4 sw=4: +// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; + +#include "tdestyle.moc" diff --git a/tdefx/tdestylen.h b/tdefx/tdestylen.h new file mode 100644 index 000000000..9c3867bb3 --- /dev/null +++ b/tdefx/tdestylen.h @@ -0,0 +1,383 @@ +/* + * $Id$ + * + * TDEStyle + * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org> + * + * TQWindowsStyle CC_ListView and style images were kindly donated by TrollTech, + * Copyright (C) 1998-2000 TrollTech AS. + * + * Many thanks to Bradley T. Hughes for the 3 button scrollbar code. + * + * 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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __KSTYLE_H +#define __KSTYLE_H + +// W A R N I N G +// ------------- +// This API is still subject to change. +// I will remove this warning when I feel the API is sufficiently flexible. + +#include <tqcommonstyle.h> + +#include <tdelibs_export.h> + +class KPixmap; + +struct TDEStylePrivate; +/** + * Simplifies and extends the TQStyle API to make style coding easier. + * + * The TDEStyle class provides a simple internal menu transparency engine + * which attempts to use XRender for accelerated blending where requested, + * or falls back to fast internal software tinting/blending routines. + * It also simplifies more complex portions of the TQStyle API, such as + * the PopupMenuItems, ScrollBars and Sliders by providing extra "primitive + * elements" which are simple to implement by the style writer. + * + * @see TQStyle::QStyle + * @see TQCommonStyle::QCommonStyle + * @author Karol Szwed (gallium@kde.org) + * @version $Id$ + */ +class TDEFX_EXPORT TDEStyle: public TQCommonStyle +{ + Q_OBJECT + + + public: + + /** + * TDEStyle Flags: + * + * @li Default - Default style setting, where menu transparency + * and the FilledFrameWorkaround are disabled. + * + * @li AllowMenuTransparency - Enable this flag to use TDEStyle's + * internal menu transparency engine. + * + * @li FilledFrameWorkaround - Enable this flag to facilitate + * proper repaints of QMenuBars and QToolBars when the style chooses + * to paint the interior of a TQFrame. The style primitives in question + * are PE_PanelMenuBar and PE_PanelDockWindow. The HighColor style uses + * this workaround to enable painting of gradients in menubars and + * toolbars. + */ + typedef uint TDEStyleFlags; + enum TDEStyleOption { + Default = 0x00000000, //!< All options disabled + AllowMenuTransparency = 0x00000001, //!< Internal transparency enabled + FilledFrameWorkaround = 0x00000002 //!< Filled frames enabled + }; + + /** + * TDEStyle ScrollBarType: + * + * Allows the style writer to easily select what type of scrollbar + * should be used without having to duplicate large amounts of source + * code by implementing the complex control CC_ScrollBar. + * + * @li WindowsStyleScrollBar - Two button scrollbar with the previous + * button at the top/left, and the next button at the bottom/right. + * + * @li PlatinumStyleScrollBar - Two button scrollbar with both the + * previous and next buttons at the bottom/right. + * + * @li ThreeButtonScrollBar - %KDE style three button scrollbar with + * two previous buttons, and one next button. The next button is always + * at the bottom/right, whilst the two previous buttons are on either + * end of the scrollbar. + * + * @li NextStyleScrollBar - Similar to the PlatinumStyle scroll bar, but + * with the buttons grouped on the opposite end of the scrollbar. + * + * @see TDEStyle::TDEStyle() + */ + enum TDEStyleScrollBarType { + WindowsStyleScrollBar = 0x00000000, //!< two button, windows style + PlatinumStyleScrollBar = 0x00000001, //!< two button, platinum style + ThreeButtonScrollBar = 0x00000002, //!< three buttons, %KDE style + NextStyleScrollBar = 0x00000004 //!< two button, NeXT style + }; + + /** + * Constructs a TDEStyle object. + * + * Select the appropriate TDEStyle flags and scrollbar type + * for your style. The user's style preferences selected in KControl + * are read by using TQSettings and are automatically applied to the style. + * As a fallback, TDEStyle paints progressbars and tabbars. It inherits from + * TQCommonStyle for speed, so don't expect much to be implemented. + * + * It is advisable to use a currently implemented style such as the HighColor + * style as a foundation for any new TDEStyle, so the limited number of + * drawing fallbacks should not prove problematic. + * + * @param flags the style to be applied + * @param sbtype the scroll bar type + * @see TDEStyle::TDEStyleFlags + * @see TDEStyle::TDEStyleScrollBarType + * @author Karol Szwed (gallium@kde.org) + */ + TDEStyle( TDEStyleFlags flags = TDEStyle::Default, + TDEStyleScrollBarType sbtype = TDEStyle::WindowsStyleScrollBar ); + + /** + * Destructs the TDEStyle object. + */ + ~TDEStyle(); + + /** + * Returns the default widget style depending on color depth. + */ + static TQString defaultStyle(); + + /** + * Modifies the scrollbar type used by the style. + * + * This function is only provided for convenience. It allows + * you to make a late decision about what scrollbar type to use for the + * style after performing some processing in your style's constructor. + * In most situations however, setting the scrollbar type via the TDEStyle + * constructor should suffice. + * @param sbtype the scroll bar type + * @see TDEStyle::TDEStyleScrollBarType + */ + void setScrollBarType(TDEStyleScrollBarType sbtype); + + /** + * Returns the TDEStyle flags used to initialize the style. + * + * This is used solely for the kcmstyle module, and hence is internal. + */ + TDEStyleFlags styleFlags() const; + + // --------------------------------------------------------------------------- + + /** + * This virtual function defines the pixmap used to blend between the popup + * menu and the background to create different menu transparency effects. + * For example, you can fill the pixmap "pix" with a gradient based on the + * popup's colorGroup, a texture, or some other fancy painting routine. + * TDEStyle will then internally blend this pixmap with a snapshot of the + * background behind the popupMenu to create the illusion of transparency. + * + * This virtual is never called if XRender/Software blending is disabled by + * the user in KDE's style control module. + */ + virtual void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup& cg, + const TQPopupMenu* popup ) const; + + /** + * TDEStyle Primitive Elements: + * + * The TDEStyle class extends the Qt's Style API by providing certain + * simplifications for parts of TQStyle. To do this, the TDEStylePrimitive + * elements were defined, which are very similar to Qt's PrimitiveElement. + * + * The first three Handle primitives simplify and extend PE_DockWindowHandle, + * so do not reimplement PE_DockWindowHandle if you want the TDEStyle handle + * simplifications to be operable. Similarly do not reimplement CC_Slider, + * SC_SliderGroove and SC_SliderHandle when using the TDEStyle slider + * primitives. TDEStyle automatically double-buffers slider painting + * when they are drawn via these TDEStyle primitives to avoid flicker. + * + * @li KPE_DockWindowHandle - This primitive is already implemented in TDEStyle, + * and paints a bevelled rect with the DockWindow caption text. Re-implement + * this primitive to perform other more fancy effects when drawing the dock window + * handle. + * + * @li KPE_ToolBarHandle - This primitive must be reimplemented. It currently + * only paints a filled rectangle as default behavior. This primitive is used + * to render TQToolBar handles. + * + * @li KPE_GeneralHandle - This primitive must be reimplemented. It is used + * to render general handles that are not part of a TQToolBar or TQDockWindow, such + * as the applet handles used in Kicker. The default implementation paints a filled + * rect of arbitrary color. + * + * @li KPE_SliderGroove - This primitive must be reimplemented. It is used to + * paint the slider groove. The default implementation paints a filled rect of + * arbitrary color. + * + * @li KPE_SliderHandle - This primitive must be reimplemented. It is used to + * paint the slider handle. The default implementation paints a filled rect of + * arbitrary color. + * + * @li KPE_ListViewExpander - This primitive is already implemented in TDEStyle. It + * is used to draw the Expand/Collapse element in QListViews. To indicate the + * expanded state, the style flags are set to Style_Off, while Style_On implies collapsed. + * + * @li KPE_ListViewBranch - This primitive is already implemented in TDEStyle. It is + * used to draw the ListView branches where necessary. + */ + enum TDEStylePrimitive { + KPE_DockWindowHandle, + KPE_ToolBarHandle, + KPE_GeneralHandle, + + KPE_SliderGroove, + KPE_SliderHandle, + + KPE_ListViewExpander, + KPE_ListViewBranch + }; + + // Old API + // DEPRECATED + virtual void drawTDEStylePrimitive( TDEStylePrimitive kpe, + TQPainter* p, + const TQWidget* widget, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::SO_Default ) const; + + /** + * This function is identical to Qt's TQStyle::tqdrawPrimitive(), except that + * it adds one further parameter, 'widget', that can be used to determine + * the widget state of the TDEStylePrimitive in question. + * + * @see TDEStyle::TDEStylePrimitive + * @see TQStyle::tqdrawPrimitive + * @see TQStyle::drawComplexControl + */ + virtual void drawTDEStylePrimitive( TDEStylePrimitive kpe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::SO_Default, + const TQWidget* widget = 0 ) const; + + + enum TDEStylePixelMetric { + KPM_MenuItemSeparatorHeight = 0x00000001, + KPM_MenuItemHMargin = 0x00000002, + KPM_MenuItemVMargin = 0x00000004, + KPM_MenuItemHFrame = 0x00000008, + KPM_MenuItemVFrame = 0x00000010, + KPM_MenuItemCheckMarkHMargin = 0x00000020, + KPM_MenuItemArrowHMargin = 0x00000040, + KPM_MenuItemTabSpacing = 0x00000080, + KPM_ListViewBranchThickness = 0x00000100 + }; + + int kPixelMetric( TDEStylePixelMetric kpm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* widget = 0 ) const; + + // --------------------------------------------------------------------------- + + void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * ); + void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr ); + + void drawPrimitive( TQ_PrimitiveElement pe, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::SO_Default ) const; + +// #ifdef USE_QT4 // tdebindings / smoke needs this function declaration available at all times. Furthermore I don't think it would hurt to have the declaration available at all times...so leave these commented out for now + +// void drawPrimitive( TQ_ControlElement pe, +// TQPainter* p, +// const TQStyleControlElementData &ceData, +// ControlElementFlags elementFlags, +// const TQRect &r, +// const TQColorGroup &cg, +// SFlags flags = Style_Default, +// const TQStyleOption& = TQStyleOption::SO_Default ) const; + +// #endif // USE_QT4 + + void drawControl( TQ_ControlElement element, + TQPainter* p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + const TQStyleOption& = TQStyleOption::SO_Default, + const TQWidget* widget = 0 ) const; + + void drawComplexControl( TQ_ComplexControl control, + TQPainter *p, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags = Style_Default, + SCFlags controls = SC_All, + SCFlags active = SC_None, + const TQStyleOption& = TQStyleOption::SO_Default, + const TQWidget* widget = 0 ) const; + + SubControl querySubControl( TQ_ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQPoint &pos, + const TQStyleOption& = TQStyleOption::SO_Default, + const TQWidget* widget = 0 ) const; + + TQRect querySubControlMetrics( TQ_ComplexControl control, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + SubControl sc, + const TQStyleOption& = TQStyleOption::SO_Default, + const TQWidget* widget = 0 ) const; + + int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, + const TQWidget* widget = 0 ) const; + + TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, + const TQWidget* widget = 0 ) const; + + TQPixmap stylePixmap( StylePixmap stylepixmap, + const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption& = TQStyleOption::SO_Default, + const TQWidget* widget = 0 ) const; + + int styleHint( TQ_StyleHint sh, const TQStyleControlElementData &ceData, + ControlElementFlags elementFlags, + const TQStyleOption &opt = TQStyleOption::SO_Default, + TQStyleHintReturn* shr = 0, + const TQWidget* w = 0 ) const; + + protected: + virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ); + + private: + // Disable copy constructor and = operator + TDEStyle( const TDEStyle & ); + TDEStyle& operator=( const TDEStyle & ); + + protected: + virtual void virtual_hook( int id, void* data ); + private: + TDEStylePrivate *d; +}; + + +// vim: set noet ts=4 sw=4: +#endif + diff --git a/tdehtml/ecma/kjs_debugwin.cpp b/tdehtml/ecma/kjs_debugwin.cpp index 069720c0b..f1b2b430d 100644 --- a/tdehtml/ecma/kjs_debugwin.cpp +++ b/tdehtml/ecma/kjs_debugwin.cpp @@ -55,7 +55,7 @@ #include <tdeshortcut.h> #include <tdeconfig.h> #include <tdeconfigbase.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcop/dcopclient.h> #include <kstringhandler.h> diff --git a/tdehtml/html/html_documentimpl.cpp b/tdehtml/html/html_documentimpl.cpp index 21c3e12c5..e4f090973 100644 --- a/tdehtml/html/html_documentimpl.cpp +++ b/tdehtml/html/html_documentimpl.cpp @@ -44,7 +44,7 @@ #include "dom/dom_exception.h" #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kurl.h> #include <kglobal.h> diff --git a/tdehtml/html/html_formimpl.cpp b/tdehtml/html/html_formimpl.cpp index 3f8384a97..372904e0e 100644 --- a/tdehtml/html/html_formimpl.cpp +++ b/tdehtml/html/html_formimpl.cpp @@ -51,7 +51,7 @@ #include <kdebug.h> #include <kmimetype.h> #include <kmessagebox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #ifndef TDEHTML_NO_WALLET #include <tdewallet.h> diff --git a/tdehtml/java/kjavaappletserver.cpp b/tdehtml/java/kjavaappletserver.cpp index 7ad046b9a..5d108ffcf 100644 --- a/tdehtml/java/kjavaappletserver.cpp +++ b/tdehtml/java/kjavaappletserver.cpp @@ -29,7 +29,7 @@ #include <tdeconfig.h> #include <klocale.h> #include <tdeparts/browserextension.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <tdeio/job.h> diff --git a/tdehtml/java/kjavaappletviewer.cpp b/tdehtml/java/kjavaappletviewer.cpp index 913678092..5d5b47fbf 100644 --- a/tdehtml/java/kjavaappletviewer.cpp +++ b/tdehtml/java/kjavaappletviewer.cpp @@ -30,12 +30,12 @@ #include <tqlabel.h> #include <klibloader.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kstaticdeleter.h> #include <klocale.h> #include <kstatusbar.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeconfig.h> #include <tdeio/authinfo.h> diff --git a/tdehtml/java/tests/testkjavaappletserver.cpp b/tdehtml/java/tests/testkjavaappletserver.cpp index d0af25127..641b06327 100644 --- a/tdehtml/java/tests/testkjavaappletserver.cpp +++ b/tdehtml/java/tests/testkjavaappletserver.cpp @@ -1,5 +1,5 @@ -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <tqstring.h> #include <stdio.h> diff --git a/tdehtml/misc/helper.cpp b/tdehtml/misc/helper.cpp index 047a278fa..b5191c7ca 100644 --- a/tdehtml/misc/helper.cpp +++ b/tdehtml/misc/helper.cpp @@ -29,7 +29,7 @@ #include <rendering/render_object.h> #include <tqptrlist.h> #include <kstaticdeleter.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <tqtooltip.h> diff --git a/tdehtml/misc/loader.cpp b/tdehtml/misc/loader.cpp index 6fccfced8..b7f42aa29 100644 --- a/tdehtml/misc/loader.cpp +++ b/tdehtml/misc/loader.cpp @@ -56,7 +56,7 @@ #include <tqmovie.h> #include <tqwidget.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeio/job.h> #include <tdeio/jobclasses.h> #include <kglobal.h> diff --git a/tdehtml/rendering/render_frames.cpp b/tdehtml/rendering/render_frames.cpp index 64bef11dc..12d0d75ec 100644 --- a/tdehtml/rendering/render_frames.cpp +++ b/tdehtml/rendering/render_frames.cpp @@ -38,7 +38,7 @@ #include "tdehtml_part.h" #include "misc/knsplugininstaller.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <kmimetype.h> #include <klocale.h> diff --git a/tdehtml/rendering/render_image.cpp b/tdehtml/rendering/render_image.cpp index 97c2641ba..b41911e3a 100644 --- a/tdehtml/rendering/render_image.cpp +++ b/tdehtml/rendering/render_image.cpp @@ -30,7 +30,7 @@ #include <tqdrawutil.h> #include <tqpainter.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kglobalsettings.h> diff --git a/tdehtml/tdehtml_ext.cpp b/tdehtml/tdehtml_ext.cpp index fe9763b0e..3cc65676d 100644 --- a/tdehtml/tdehtml_ext.cpp +++ b/tdehtml/tdehtml_ext.cpp @@ -53,7 +53,7 @@ #include <ksavefile.h> #include <kurldrag.h> #include <kstringhandler.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <kstandarddirs.h> #include <krun.h> diff --git a/tdehtml/tdehtml_factory.cpp b/tdehtml/tdehtml_factory.cpp index 103945736..b52476ea1 100644 --- a/tdehtml/tdehtml_factory.cpp +++ b/tdehtml/tdehtml_factory.cpp @@ -30,7 +30,7 @@ #include "misc/arena.h" #include <kinstance.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <klocale.h> #include <assert.h> diff --git a/tdehtml/tdehtml_part.cpp b/tdehtml/tdehtml_part.cpp index b6fdde210..c4bba759c 100644 --- a/tdehtml/tdehtml_part.cpp +++ b/tdehtml/tdehtml_part.cpp @@ -91,7 +91,7 @@ using namespace DOM; #include <ktempfile.h> #include <kglobalsettings.h> #include <kurldrag.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeparts/browserinterface.h> #if !defined(QT_NO_DRAGANDDROP) #include <tdemultipledrag.h> diff --git a/tdehtml/tdehtmlview.cpp b/tdehtml/tdehtmlview.cpp index 48ead5cf2..010075f2a 100644 --- a/tdehtml/tdehtmlview.cpp +++ b/tdehtml/tdehtmlview.cpp @@ -61,7 +61,7 @@ #include "xml/dom2_rangeimpl.h" #endif -#include <kapplication.h> +#include <tdeapplication.h> #include <kcursor.h> #include <kdebug.h> #include <kdialogbase.h> diff --git a/tdehtml/tdemultipart/tdemultipart.h b/tdehtml/tdemultipart/tdemultipart.h index 776584c91..de309eef1 100644 --- a/tdehtml/tdemultipart/tdemultipart.h +++ b/tdehtml/tdemultipart/tdemultipart.h @@ -25,7 +25,7 @@ #include <tdeparts/part.h> #include <tdeparts/factory.h> #include <tdeparts/browserextension.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <tqdatetime.h> class TDEHTMLPart; diff --git a/tdehtml/test_regression.cpp b/tdehtml/test_regression.cpp index a127bb709..028fadc36 100644 --- a/tdehtml/test_regression.cpp +++ b/tdehtml/test_regression.cpp @@ -30,7 +30,7 @@ #include <pwd.h> #include <signal.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <tqimage.h> #include <tqfile.h> @@ -60,7 +60,7 @@ #include <tdeaction.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include "tdehtml_factory.h" #include <tdeio/job.h> #include <tdemainwindow.h> diff --git a/tdehtml/test_regression_fontoverload.cpp b/tdehtml/test_regression_fontoverload.cpp index 744150ffe..d09a3dbd1 100644 --- a/tdehtml/test_regression_fontoverload.cpp +++ b/tdehtml/test_regression_fontoverload.cpp @@ -353,7 +353,7 @@ KDE_EXPORT void TQApplication::setPalette( const TQPalette &, bool , done = true; } -#include <kapplication.h> +#include <tdeapplication.h> void TDEApplication::dcopFailure( const TQString & ) { tqDebug( "TDEApplication::dcopFailure" ); diff --git a/tdehtml/testtdehtml.cpp b/tdehtml/testtdehtml.cpp index 91eb19eee..bce2c4db0 100644 --- a/tdehtml/testtdehtml.cpp +++ b/tdehtml/testtdehtml.cpp @@ -2,7 +2,7 @@ #include <stdlib.h> #include "decoder.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "html_document.h" #include "htmltokenizer.h" // to be able to delete a static protected member pointer in kbrowser... @@ -27,7 +27,7 @@ #include "html/html_imageimpl.h" #include "rendering/render_style.h" #include <tdemainwindow.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <tdeaction.h> #include "domtreeview.h" #include <tdefiledialog.h> diff --git a/tdehtml/xml/dom_docimpl.cpp b/tdehtml/xml/dom_docimpl.cpp index 854d7b3e3..47836b41e 100644 --- a/tdehtml/xml/dom_docimpl.cpp +++ b/tdehtml/xml/dom_docimpl.cpp @@ -77,7 +77,7 @@ #include "html/html_tableimpl.h" #include "html/html_objectimpl.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeio/job.h> #include <stdlib.h> diff --git a/tdeio/bookmarks/kbookmark.cc b/tdeio/bookmarks/kbookmark.cc index ab1cc398a..e6bef2e02 100644 --- a/tdeio/bookmarks/kbookmark.cc +++ b/tdeio/bookmarks/kbookmark.cc @@ -28,7 +28,7 @@ #include <kglobal.h> #include <klocale.h> #include <assert.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <kbookmarkmanager.h> diff --git a/tdeio/bookmarks/kbookmarkimporter_crash.cc b/tdeio/bookmarks/kbookmarkimporter_crash.cc index f49879124..0443b3b1c 100644 --- a/tdeio/bookmarks/kbookmarkimporter_crash.cc +++ b/tdeio/bookmarks/kbookmarkimporter_crash.cc @@ -24,7 +24,7 @@ #include <kstringhandler.h> #include <klocale.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <tqfile.h> #include <tqdir.h> diff --git a/tdeio/bookmarks/kbookmarkmanager.cc b/tdeio/bookmarks/kbookmarkmanager.cc index a87e0f20e..205d879ab 100644 --- a/tdeio/bookmarks/kbookmarkmanager.cc +++ b/tdeio/bookmarks/kbookmarkmanager.cc @@ -32,7 +32,7 @@ #include <kmessagebox.h> #include <kprocess.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <tqfile.h> #include <tqfileinfo.h> diff --git a/tdeio/bookmarks/kbookmarkmenu.cc b/tdeio/bookmarks/kbookmarkmenu.cc index c99d02284..0468bcd5a 100644 --- a/tdeio/bookmarks/kbookmarkmenu.cc +++ b/tdeio/bookmarks/kbookmarkmenu.cc @@ -26,7 +26,7 @@ #include "kbookmarkimporter_ie.h" #include "kbookmarkdrag.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kdialogbase.h> diff --git a/tdeio/kpasswdserver/kpasswdserver.cpp b/tdeio/kpasswdserver/kpasswdserver.cpp index ff7295181..4986eb45a 100644 --- a/tdeio/kpasswdserver/kpasswdserver.cpp +++ b/tdeio/kpasswdserver/kpasswdserver.cpp @@ -29,7 +29,7 @@ #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kmessagebox.h> #include <kdebug.h> diff --git a/tdeio/kssl/ksslcertdlg.cc b/tdeio/kssl/ksslcertdlg.cc index 3d51c1e85..ea3c29556 100644 --- a/tdeio/kssl/ksslcertdlg.cc +++ b/tdeio/kssl/ksslcertdlg.cc @@ -29,7 +29,7 @@ #include <tqframe.h> #include <tqlabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <klocale.h> #include <kglobalsettings.h> diff --git a/tdeio/kssl/ksslinfodlg.cc b/tdeio/kssl/ksslinfodlg.cc index 289c3a8d2..03a1300e8 100644 --- a/tdeio/kssl/ksslinfodlg.cc +++ b/tdeio/kssl/ksslinfodlg.cc @@ -30,7 +30,7 @@ #include <tqscrollview.h> #include <tqfile.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <klocale.h> #include <kprocess.h> diff --git a/tdeio/kssl/ksslkeygen.cc b/tdeio/kssl/ksslkeygen.cc index 669a76cee..93d6d2da4 100644 --- a/tdeio/kssl/ksslkeygen.cc +++ b/tdeio/kssl/ksslkeygen.cc @@ -23,7 +23,7 @@ #include "keygenwizard.h" #include "keygenwizard2.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> #include <kmessagebox.h> diff --git a/tdeio/misc/kpac/proxyscout.cpp b/tdeio/misc/kpac/proxyscout.cpp index b651e2313..a010d328e 100644 --- a/tdeio/misc/kpac/proxyscout.cpp +++ b/tdeio/misc/kpac/proxyscout.cpp @@ -22,7 +22,7 @@ #include <ctime> #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <knotifyclient.h> #include <kprotocolmanager.h> diff --git a/tdeio/misc/tdefile/fileprops.cpp b/tdeio/misc/tdefile/fileprops.cpp index 854aeffc5..df210fa4d 100644 --- a/tdeio/misc/tdefile/fileprops.cpp +++ b/tdeio/misc/tdefile/fileprops.cpp @@ -21,9 +21,9 @@ #include <tqfile.h> #include <tqptrlist.h> -#include <kaboutdata.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <tdefilemetainfo.h> #include <klocale.h> #include <kpropertiesdialog.h> diff --git a/tdeio/misc/tdemailservice.cpp b/tdeio/misc/tdemailservice.cpp index c59067610..2d256c5c9 100644 --- a/tdeio/misc/tdemailservice.cpp +++ b/tdeio/misc/tdemailservice.cpp @@ -16,9 +16,9 @@ Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> static const TDECmdLineOptions options[] = { diff --git a/tdeio/misc/tdentlm/tdentlm.cpp b/tdeio/misc/tdentlm/tdentlm.cpp index 2ef5d1cb6..812c41a64 100644 --- a/tdeio/misc/tdentlm/tdentlm.cpp +++ b/tdeio/misc/tdentlm/tdentlm.cpp @@ -24,7 +24,7 @@ #include <string.h> #include <tqdatetime.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kswap.h> #include <kmdcodec.h> #include <kdebug.h> diff --git a/tdeio/misc/tdesendbugmail/main.cpp b/tdeio/misc/tdesendbugmail/main.cpp index 9b44a18b2..aaffd3b65 100644 --- a/tdeio/misc/tdesendbugmail/main.cpp +++ b/tdeio/misc/tdesendbugmail/main.cpp @@ -8,11 +8,11 @@ #include <tqtextstream.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kemailsettings.h> #include <klocale.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> #include <kdebug.h> #include <tdeconfig.h> diff --git a/tdeio/misc/tdetelnetservice.cpp b/tdeio/misc/tdetelnetservice.cpp index d3788e5d2..99260d8d0 100644 --- a/tdeio/misc/tdetelnetservice.cpp +++ b/tdeio/misc/tdetelnetservice.cpp @@ -21,9 +21,9 @@ // $Id$ -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <klocale.h> #include <kprocess.h> diff --git a/tdeio/misc/tdewalletd/tdewalletd.cpp b/tdeio/misc/tdewalletd/tdewalletd.cpp index a8b3ade1a..364197b72 100644 --- a/tdeio/misc/tdewalletd/tdewalletd.cpp +++ b/tdeio/misc/tdewalletd/tdewalletd.cpp @@ -28,7 +28,7 @@ #include <dcopclient.h> #include <dcopref.h> #include <kactivelabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kdirwatch.h> diff --git a/tdeio/misc/uiserver.cpp b/tdeio/misc/uiserver.cpp index abe918854..107b57c64 100644 --- a/tdeio/misc/uiserver.cpp +++ b/tdeio/misc/uiserver.cpp @@ -29,8 +29,8 @@ #include <tdeconfig.h> #include <kstandarddirs.h> #include <kuniqueapplication.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include <kglobal.h> #include <klocale.h> #include <dcopclient.h> diff --git a/tdeio/tdefile/kcombiview.cpp b/tdeio/tdefile/kcombiview.cpp index ae408c8e2..13830ab01 100644 --- a/tdeio/tdefile/kcombiview.cpp +++ b/tdeio/tdefile/kcombiview.cpp @@ -32,7 +32,7 @@ #include <tqdir.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kglobal.h> diff --git a/tdeio/tdefile/kdiroperator.cpp b/tdeio/tdefile/kdiroperator.cpp index 706b63164..1ae03daec 100644 --- a/tdeio/tdefile/kdiroperator.cpp +++ b/tdeio/tdefile/kdiroperator.cpp @@ -32,7 +32,7 @@ #include <tqvbox.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kdialog.h> #include <kdialogbase.h> diff --git a/tdeio/tdefile/kdirselectdialog.cpp b/tdeio/tdefile/kdirselectdialog.cpp index e26c2cdf5..39959229d 100644 --- a/tdeio/tdefile/kdirselectdialog.cpp +++ b/tdeio/tdefile/kdirselectdialog.cpp @@ -24,7 +24,7 @@ #include <tqvaluestack.h> #include <tdeactionclasses.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcombobox.h> #include <tdeconfig.h> #include <tdefiledialog.h> diff --git a/tdeio/tdefile/kicondialog.cpp b/tdeio/tdefile/kicondialog.cpp index aa8968b05..9d7975e2b 100644 --- a/tdeio/tdefile/kicondialog.cpp +++ b/tdeio/tdefile/kicondialog.cpp @@ -19,7 +19,7 @@ #include <kiconviewsearchline.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kglobal.h> #include <kstandarddirs.h> diff --git a/tdeio/tdefile/kimagefilepreview.cpp b/tdeio/tdefile/kimagefilepreview.cpp index 6c6722951..a1ce7d6b3 100644 --- a/tdeio/tdefile/kimagefilepreview.cpp +++ b/tdeio/tdefile/kimagefilepreview.cpp @@ -14,7 +14,7 @@ #include <tqwhatsthis.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kglobal.h> #include <kiconloader.h> diff --git a/tdeio/tdefile/knotifydialog.cpp b/tdeio/tdefile/knotifydialog.cpp index bd1abb277..f23ac78e4 100644 --- a/tdeio/tdefile/knotifydialog.cpp +++ b/tdeio/tdefile/knotifydialog.cpp @@ -18,8 +18,8 @@ #include <dcopclient.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kaudioplayer.h> #include <kcombobox.h> #include <tdeconfig.h> diff --git a/tdeio/tdefile/kopenwith.cpp b/tdeio/tdefile/kopenwith.cpp index ca0043e70..5a855de21 100644 --- a/tdeio/tdefile/kopenwith.cpp +++ b/tdeio/tdefile/kopenwith.cpp @@ -34,7 +34,7 @@ #include <tqstyle.h> #include <tqwhatsthis.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kbuttonbox.h> #include <kcombobox.h> #include <kdesktopfile.h> diff --git a/tdeio/tdefile/kpropertiesdialog.cpp b/tdeio/tdefile/kpropertiesdialog.cpp index 9d4ee6534..389115a3c 100644 --- a/tdeio/tdefile/kpropertiesdialog.cpp +++ b/tdeio/tdefile/kpropertiesdialog.cpp @@ -85,7 +85,7 @@ extern "C" { } #endif -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialog.h> #include <kdirsize.h> #include <kdirwatch.h> diff --git a/tdeio/tdefile/kurlbar.cpp b/tdeio/tdefile/kurlbar.cpp index 0f575e4e5..46b096c2b 100644 --- a/tdeio/tdefile/kurlbar.cpp +++ b/tdeio/tdefile/kurlbar.cpp @@ -30,7 +30,7 @@ #include <tqvbox.h> #include <tqwhatsthis.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <tdeconfig.h> #include <kdebug.h> #include <kglobal.h> diff --git a/tdeio/tdefile/tdefiledetailview.cpp b/tdeio/tdefile/tdefiledetailview.cpp index 897c99aec..b3c44250e 100644 --- a/tdeio/tdefile/tdefiledetailview.cpp +++ b/tdeio/tdefile/tdefiledetailview.cpp @@ -25,7 +25,7 @@ #include <tqpainter.h> #include <tqpixmap.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdefileitem.h> #include <kglobal.h> #include <kglobalsettings.h> diff --git a/tdeio/tdefile/tdefiledialog.cpp b/tdeio/tdefile/tdefiledialog.cpp index ed50ae49b..8db764724 100644 --- a/tdeio/tdefile/tdefiledialog.cpp +++ b/tdeio/tdefile/tdefiledialog.cpp @@ -44,9 +44,9 @@ #include <tdeaccel.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcharsets.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <tdecompletionbox.h> #include <tdeconfig.h> #include <kdebug.h> diff --git a/tdeio/tdefile/tdefileiconview.cpp b/tdeio/tdefile/tdefileiconview.cpp index 406e3d3fe..131485273 100644 --- a/tdeio/tdefile/tdefileiconview.cpp +++ b/tdeio/tdefile/tdefileiconview.cpp @@ -30,7 +30,7 @@ #include <tqtooltip.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tdefileitem.h> #include <kiconeffect.h> diff --git a/tdeio/tdefile/tdefilesharedlg.cpp b/tdeio/tdefile/tdefilesharedlg.cpp index d64918b4f..6204fa6bb 100644 --- a/tdeio/tdefile/tdefilesharedlg.cpp +++ b/tdeio/tdefile/tdefilesharedlg.cpp @@ -37,7 +37,7 @@ #include <tdeio/tdefileshare.h> #include <kseparator.h> #include <tqpushbutton.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <ksimpleconfig.h> #include <kmessagebox.h> diff --git a/tdeio/tdefile/tdefileview.cpp b/tdeio/tdefile/tdefileview.cpp index fb3cb0e9f..63c973723 100644 --- a/tdeio/tdefile/tdefileview.cpp +++ b/tdeio/tdefile/tdefileview.cpp @@ -23,7 +23,7 @@ #include <stdlib.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> diff --git a/tdeio/tdefile/tderecentdocument.cpp b/tdeio/tdefile/tderecentdocument.cpp index 3d5ec44e7..968db93a4 100644 --- a/tdeio/tdefile/tderecentdocument.cpp +++ b/tdeio/tdefile/tderecentdocument.cpp @@ -28,7 +28,7 @@ #include <tderecentdocument.h> #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kurl.h> #include <kdebug.h> #include <kmimetype.h> diff --git a/tdeio/tdefile/tests/kcustommenueditortest.cpp b/tdeio/tdefile/tests/kcustommenueditortest.cpp index 40a34b203..3d95b6c9f 100644 --- a/tdeio/tdefile/tests/kcustommenueditortest.cpp +++ b/tdeio/tdefile/tests/kcustommenueditortest.cpp @@ -1,5 +1,5 @@ #include "kcustommenueditor.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tdeconfig.h> diff --git a/tdeio/tdefile/tests/kdirselectdialogtest.cpp b/tdeio/tdefile/tests/kdirselectdialogtest.cpp index 3d15c47d0..0c2209d31 100644 --- a/tdeio/tdefile/tests/kdirselectdialogtest.cpp +++ b/tdeio/tdefile/tests/kdirselectdialogtest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdirselectdialog.h> #include <kmessagebox.h> #include <kurl.h> diff --git a/tdeio/tdefile/tests/kfdtest.cpp b/tdeio/tdefile/tests/kfdtest.cpp index 60c8b6d70..baf82725f 100644 --- a/tdeio/tdefile/tests/kfdtest.cpp +++ b/tdeio/tdefile/tests/kfdtest.cpp @@ -2,7 +2,7 @@ #include <tqstringlist.h> #include <tdefiledialog.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <tqtimer.h> diff --git a/tdeio/tdefile/tests/kfstest.cpp b/tdeio/tdefile/tests/kfstest.cpp index 0a2a698f5..c57e3678e 100644 --- a/tdeio/tdefile/tests/kfstest.cpp +++ b/tdeio/tdefile/tests/kfstest.cpp @@ -32,7 +32,7 @@ #include <tdefileiconview.h> #include <kmessagebox.h> #include <tdeconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kurl.h> #include <kurlbar.h> #include <kdiroperator.h> diff --git a/tdeio/tdefile/tests/kicondialogtest.cpp b/tdeio/tdefile/tests/kicondialogtest.cpp index c3f7a827d..3000e89a0 100644 --- a/tdeio/tdefile/tests/kicondialogtest.cpp +++ b/tdeio/tdefile/tests/kicondialogtest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kicondialog.h> int main( int argc, char **argv ) diff --git a/tdeio/tdefile/tests/knotifytest.cpp b/tdeio/tdefile/tests/knotifytest.cpp index 0493b59b4..1716a86a3 100644 --- a/tdeio/tdefile/tests/knotifytest.cpp +++ b/tdeio/tdefile/tests/knotifytest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <knotifydialog.h> int main( int argc, char **argv ) diff --git a/tdeio/tdefile/tests/kopenwithtest.cpp b/tdeio/tdefile/tests/kopenwithtest.cpp index f78b1830b..925aa7625 100644 --- a/tdeio/tdefile/tests/kopenwithtest.cpp +++ b/tdeio/tdefile/tests/kopenwithtest.cpp @@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqwidget.h> #include <tqstringlist.h> #include <tqdir.h> diff --git a/tdeio/tdefile/tests/kurlrequestertest.cpp b/tdeio/tdefile/tests/kurlrequestertest.cpp index 0e4851cfb..829055304 100644 --- a/tdeio/tdefile/tests/kurlrequestertest.cpp +++ b/tdeio/tdefile/tests/kurlrequestertest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <keditlistbox.h> #include <kurlrequester.h> #include <kurlrequesterdlg.h> diff --git a/tdeio/tdefile/tests/tdefiletreeviewtest.cpp b/tdeio/tdefile/tests/tdefiletreeviewtest.cpp index 689472597..529d12dda 100644 --- a/tdeio/tdefile/tests/tdefiletreeviewtest.cpp +++ b/tdeio/tdefile/tests/tdefiletreeviewtest.cpp @@ -22,7 +22,7 @@ #include <kglobal.h> #include <kiconloader.h> #include <tdemainwindow.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kurl.h> #include <kdebug.h> #include <kstatusbar.h> diff --git a/tdeio/tdeio/defaultprogress.cpp b/tdeio/tdeio/defaultprogress.cpp index 10db4fde7..4293e752e 100644 --- a/tdeio/tdeio/defaultprogress.cpp +++ b/tdeio/tdeio/defaultprogress.cpp @@ -22,7 +22,7 @@ #include <tqdatetime.h> #include <tqcheckbox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kdialog.h> #include <kstringhandler.h> diff --git a/tdeio/tdeio/job.cpp b/tdeio/tdeio/job.cpp index eba15be03..a4e731451 100644 --- a/tdeio/tdeio/job.cpp +++ b/tdeio/tdeio/job.cpp @@ -41,7 +41,7 @@ extern "C" { #include <tqtimer.h> #include <tqfile.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <klocale.h> #include <ksimpleconfig.h> diff --git a/tdeio/tdeio/kdcopservicestarter.cpp b/tdeio/tdeio/kdcopservicestarter.cpp index a6e39815f..c859cce2b 100644 --- a/tdeio/tdeio/kdcopservicestarter.cpp +++ b/tdeio/tdeio/kdcopservicestarter.cpp @@ -18,7 +18,7 @@ #include "kdcopservicestarter.h" #include "ktrader.h" -#include <kapplication.h> +#include <tdeapplication.h> #include "kservice.h" #include <kstaticdeleter.h> #include <kdebug.h> diff --git a/tdeio/tdeio/kdirlister.cpp b/tdeio/tdeio/kdirlister.cpp index 0d3498aa7..669766ab5 100644 --- a/tdeio/tdeio/kdirlister.cpp +++ b/tdeio/tdeio/kdirlister.cpp @@ -26,7 +26,7 @@ #include <tqtimer.h> #include <tqeventloop.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> #include <tdeio/job.h> diff --git a/tdeio/tdeio/kdirwatch.cpp b/tdeio/tdeio/kdirwatch.cpp index 4fcb921bb..63c89b9d7 100644 --- a/tdeio/tdeio/kdirwatch.cpp +++ b/tdeio/tdeio/kdirwatch.cpp @@ -54,7 +54,7 @@ #include <tqstringlist.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeconfig.h> #include <kglobal.h> diff --git a/tdeio/tdeio/kimageio.cpp b/tdeio/tdeio/kimageio.cpp index e983cb945..f9de08376 100644 --- a/tdeio/tdeio/kimageio.cpp +++ b/tdeio/tdeio/kimageio.cpp @@ -11,7 +11,7 @@ #include"config.h" #include <tqdir.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <tqstring.h> #include <tqregexp.h> diff --git a/tdeio/tdeio/kmessageboxwrapper.h b/tdeio/tdeio/kmessageboxwrapper.h index 3590b5e89..c55060549 100644 --- a/tdeio/tdeio/kmessageboxwrapper.h +++ b/tdeio/tdeio/kmessageboxwrapper.h @@ -19,7 +19,7 @@ #ifndef KMESSAGEBOXWRAPPER_H #define KMESSAGEBOXWRAPPER_H #include <kmessagebox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> /** diff --git a/tdeio/tdeio/kmimemagic.cpp b/tdeio/tdeio/kmimemagic.cpp index 4285e3ec7..4d75d8d58 100644 --- a/tdeio/tdeio/kmimemagic.cpp +++ b/tdeio/tdeio/kmimemagic.cpp @@ -18,7 +18,7 @@ */ #include "kmimemagic.h" #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tqfile.h> #include <ksimpleconfig.h> #include <kstandarddirs.h> diff --git a/tdeio/tdeio/kmimetype.cpp b/tdeio/tdeio/kmimetype.cpp index c610e7e3f..8129b31f9 100644 --- a/tdeio/tdeio/kmimetype.cpp +++ b/tdeio/tdeio/kmimetype.cpp @@ -46,7 +46,7 @@ #include <dcopclient.h> #include <dcopref.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kprocess.h> #include <kdebug.h> #include <kdesktopfile.h> diff --git a/tdeio/tdeio/kprotocolmanager.h b/tdeio/tdeio/kprotocolmanager.h index ce504a83f..95106f90d 100644 --- a/tdeio/tdeio/kprotocolmanager.h +++ b/tdeio/tdeio/kprotocolmanager.h @@ -22,7 +22,7 @@ #include <tqstringlist.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeio/global.h> /** @deprecated Use KProtocolManager::defaultUserAgent() instead. */ diff --git a/tdeio/tdeio/krun.cpp b/tdeio/tdeio/krun.cpp index 69274ce24..8547802d6 100644 --- a/tdeio/tdeio/krun.cpp +++ b/tdeio/tdeio/krun.cpp @@ -42,7 +42,7 @@ #include <kdatastream.h> #include <kmessageboxwrapper.h> #include <kurl.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> #include <kprotocolinfo.h> diff --git a/tdeio/tdeio/kservice.cpp b/tdeio/tdeio/kservice.cpp index 5147af0ad..13be78bea 100644 --- a/tdeio/tdeio/kservice.cpp +++ b/tdeio/tdeio/kservice.cpp @@ -37,7 +37,7 @@ #include <tqtl.h> #include <ksimpleconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kdesktopfile.h> #include <kglobal.h> diff --git a/tdeio/tdeio/kservicetypefactory.cpp b/tdeio/tdeio/kservicetypefactory.cpp index ecf527384..e198f1333 100644 --- a/tdeio/tdeio/kservicetypefactory.cpp +++ b/tdeio/tdeio/kservicetypefactory.cpp @@ -24,7 +24,7 @@ #include "kmimetype.h" #include "kuserprofile.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <assert.h> #include <kstringhandler.h> diff --git a/tdeio/tdeio/kshred.cpp b/tdeio/tdeio/kshred.cpp index f3997bf58..470f9a03e 100644 --- a/tdeio/tdeio/kshred.cpp +++ b/tdeio/tdeio/kshred.cpp @@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <klocale.h> #include <kdebug.h> #include <stdlib.h> -#include <kapplication.h> +#include <tdeapplication.h> // antlarr: KDE 4: Make it const TQString & KShred::KShred(TQString fileName) diff --git a/tdeio/tdeio/kurlcompletion.cpp b/tdeio/tdeio/kurlcompletion.cpp index dc6581ce6..e9ce26908 100644 --- a/tdeio/tdeio/kurlcompletion.cpp +++ b/tdeio/tdeio/kurlcompletion.cpp @@ -39,7 +39,7 @@ #include <tqdeepcopy.h> #include <tqthread.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kcompletion.h> #include <kurl.h> diff --git a/tdeio/tdeio/kuserprofile.cpp b/tdeio/tdeio/kuserprofile.cpp index ebd8b8deb..124f7f8f8 100644 --- a/tdeio/tdeio/kuserprofile.cpp +++ b/tdeio/tdeio/kuserprofile.cpp @@ -22,7 +22,7 @@ #include "kservicetypefactory.h" #include <tdeconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <kdebug.h> #include <kstaticdeleter.h> diff --git a/tdeio/tdeio/netaccess.cpp b/tdeio/tdeio/netaccess.cpp index 89830d88b..dd3a1bdc8 100644 --- a/tdeio/tdeio/netaccess.cpp +++ b/tdeio/tdeio/netaccess.cpp @@ -33,7 +33,7 @@ #include <tqfile.h> #include <tqmetaobject.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <ktempfile.h> #include <kdebug.h> diff --git a/tdeio/tdeio/observer.cpp b/tdeio/tdeio/observer.cpp index 5e4e7aa87..dfd847b04 100644 --- a/tdeio/tdeio/observer.cpp +++ b/tdeio/tdeio/observer.cpp @@ -22,7 +22,7 @@ #include <assert.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <kurl.h> diff --git a/tdeio/tdeio/previewjob.cpp b/tdeio/tdeio/previewjob.cpp index 2279aef40..c51ba154d 100644 --- a/tdeio/tdeio/previewjob.cpp +++ b/tdeio/tdeio/previewjob.cpp @@ -42,7 +42,7 @@ #include <kdatastream.h> // Do not remove, needed for correct bool serialization #include <tdefileitem.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <ktempfile.h> #include <ktrader.h> #include <kmdcodec.h> diff --git a/tdeio/tdeio/renamedlg.cpp b/tdeio/tdeio/renamedlg.cpp index f5c2d32dd..06b12d129 100644 --- a/tdeio/tdeio/renamedlg.cpp +++ b/tdeio/tdeio/renamedlg.cpp @@ -32,7 +32,7 @@ #include <kmessagebox.h> #include <kpushbutton.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeio/global.h> #include <ktrader.h> #include <klibloader.h> diff --git a/tdeio/tdeio/skipdlg.cpp b/tdeio/tdeio/skipdlg.cpp index eab245dfc..6cd924136 100644 --- a/tdeio/tdeio/skipdlg.cpp +++ b/tdeio/tdeio/skipdlg.cpp @@ -26,7 +26,7 @@ #include <tqlayout.h> #include <tqlabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kurl.h> #include <kpushbutton.h> diff --git a/tdeio/tdeio/slave.cpp b/tdeio/tdeio/slave.cpp index 380be2058..e66a719df 100644 --- a/tdeio/tdeio/slave.cpp +++ b/tdeio/tdeio/slave.cpp @@ -38,7 +38,7 @@ #include <klocale.h> #include <kglobal.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <ktempfile.h> #include <ksock.h> #include <kprocess.h> diff --git a/tdeio/tdeio/slavebase.cpp b/tdeio/tdeio/slavebase.cpp index 8b6ee3903..29a8e0c48 100644 --- a/tdeio/tdeio/slavebase.cpp +++ b/tdeio/tdeio/slavebase.cpp @@ -44,7 +44,7 @@ #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <ksock.h> #include <kcrash.h> #include <tdesu/client.h> diff --git a/tdeio/tdeio/slaveinterface.cpp b/tdeio/tdeio/slaveinterface.cpp index 40b66c47a..6de70b57f 100644 --- a/tdeio/tdeio/slaveinterface.cpp +++ b/tdeio/tdeio/slaveinterface.cpp @@ -27,7 +27,7 @@ #include <unistd.h> #include <signal.h> #include <tdeio/observer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <time.h> #include <tqtimer.h> diff --git a/tdeio/tdeio/statusbarprogress.cpp b/tdeio/tdeio/statusbarprogress.cpp index 66517ca03..e0497e391 100644 --- a/tdeio/tdeio/statusbarprogress.cpp +++ b/tdeio/tdeio/statusbarprogress.cpp @@ -22,7 +22,7 @@ #include <tqpushbutton.h> #include <tqlabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kdebug.h> #include <kprogress.h> diff --git a/tdeio/tdeio/tcpslavebase.cpp b/tdeio/tdeio/tcpslavebase.cpp index 2b7df9d7b..2a4aff68e 100644 --- a/tdeio/tdeio/tcpslavebase.cpp +++ b/tdeio/tdeio/tcpslavebase.cpp @@ -53,7 +53,7 @@ #include <tqcstring.h> #include <tqdatastream.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kprotocolmanager.h> #include <kde_file.h> diff --git a/tdeio/tdeioexec/main.cpp b/tdeio/tdeioexec/main.cpp index 0276008a4..eb615344b 100644 --- a/tdeio/tdeioexec/main.cpp +++ b/tdeio/tdeioexec/main.cpp @@ -26,7 +26,7 @@ #include <tqfile.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <kdebug.h> #include <kmessagebox.h> @@ -36,8 +36,8 @@ #include <kprocess.h> #include <kservice.h> #include <klocale.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> #include <kstartupinfo.h> #include <kshell.h> #include <kde_file.h> diff --git a/tdeio/tests/getalltest.cpp b/tdeio/tests/getalltest.cpp index 07d8723ed..37f9b1ab2 100644 --- a/tdeio/tests/getalltest.cpp +++ b/tdeio/tests/getalltest.cpp @@ -2,7 +2,7 @@ #include <kmimetype.h> #include <kservicetype.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> int main(int argc, char *argv[]) diff --git a/tdeio/tests/jobtest.cpp b/tdeio/tests/jobtest.cpp index c6a79743a..a2d5b40d1 100644 --- a/tdeio/tests/jobtest.cpp +++ b/tdeio/tests/jobtest.cpp @@ -22,11 +22,11 @@ #include <config.h> #include <kurl.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klargefile.h> #include <tdeio/netaccess.h> #include <kdebug.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kprotocolinfo.h> #include <tqfileinfo.h> diff --git a/tdeio/tests/kacltest.cpp b/tdeio/tests/kacltest.cpp index b55aedce8..50d3bc25a 100644 --- a/tdeio/tests/kacltest.cpp +++ b/tdeio/tests/kacltest.cpp @@ -22,9 +22,9 @@ #include <config.h> #include <kacl.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <tqfileinfo.h> #include <tqeventloop.h> diff --git a/tdeio/tests/kdcopcheck.cpp b/tdeio/tests/kdcopcheck.cpp index 79f050f51..5f1ad611a 100644 --- a/tdeio/tests/kdcopcheck.cpp +++ b/tdeio/tests/kdcopcheck.cpp @@ -13,7 +13,7 @@ #include "kdcopcheck.h" #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdio.h> #include <stdlib.h> diff --git a/tdeio/tests/kdefaultprogresstest.cpp b/tdeio/tests/kdefaultprogresstest.cpp index 7e77611ed..7f1bad6a4 100644 --- a/tdeio/tests/kdefaultprogresstest.cpp +++ b/tdeio/tests/kdefaultprogresstest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeio/defaultprogress.h> #include <kurl.h> #include <kdebug.h> diff --git a/tdeio/tests/kdirlistertest.cpp b/tdeio/tests/kdirlistertest.cpp index 000fb200c..aaba5400a 100644 --- a/tdeio/tests/kdirlistertest.cpp +++ b/tdeio/tests/kdirlistertest.cpp @@ -21,7 +21,7 @@ #include <tqlayout.h> #include <tqpushbutton.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdirlister.h> #include <kdebug.h> diff --git a/tdeio/tests/kdirwatchtest.cpp b/tdeio/tests/kdirwatchtest.cpp index 0ca853f1a..9f50c2170 100644 --- a/tdeio/tests/kdirwatchtest.cpp +++ b/tdeio/tests/kdirwatchtest.cpp @@ -12,7 +12,7 @@ #include <tqfile.h> #include <kdebug.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include "kdirwatchtest.h" diff --git a/tdeio/tests/kdirwatchtest.h b/tdeio/tests/kdirwatchtest.h index 24dc94a91..493043c01 100644 --- a/tdeio/tests/kdirwatchtest.h +++ b/tdeio/tests/kdirwatchtest.h @@ -17,7 +17,7 @@ #include <tqobject.h> #include "kdirwatch.h" -#include "kapplication.h" +#include "tdeapplication.h" class myTest : public TQObject { diff --git a/tdeio/tests/kdirwatchunittest.h b/tdeio/tests/kdirwatchunittest.h index 42222a787..416aeecfe 100644 --- a/tdeio/tests/kdirwatchunittest.h +++ b/tdeio/tests/kdirwatchunittest.h @@ -17,7 +17,7 @@ #include <tqobject.h> #include "kdirwatch.h" -#include "kapplication.h" +#include "tdeapplication.h" #include <tdeunittest/tester.h> #include <tdeunittest/module.h> diff --git a/tdeio/tests/kionetrctest.cpp b/tdeio/tests/kionetrctest.cpp index 4c05f77e1..b0fbf7087 100644 --- a/tdeio/tests/kionetrctest.cpp +++ b/tdeio/tests/kionetrctest.cpp @@ -1,7 +1,7 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include "authinfo.h" diff --git a/tdeio/tests/kiopassdlgtest.cpp b/tdeio/tests/kiopassdlgtest.cpp index adb14a306..3dd4d7294 100644 --- a/tdeio/tests/kiopassdlgtest.cpp +++ b/tdeio/tests/kiopassdlgtest.cpp @@ -1,8 +1,8 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kmessagebox.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include "passdlg.h" diff --git a/tdeio/tests/kmimefromext.cpp b/tdeio/tests/kmimefromext.cpp index 9b3f9dd54..d2cc0bca8 100644 --- a/tdeio/tests/kmimefromext.cpp +++ b/tdeio/tests/kmimefromext.cpp @@ -18,8 +18,8 @@ #include <ktrader.h> #include <kmimetype.h> -#include <kcmdlineargs.h> -#include <kapplication.h> +#include <tdecmdlineargs.h> +#include <tdeapplication.h> #include <stdio.h> diff --git a/tdeio/tests/kpropsdlgtest.cpp b/tdeio/tests/kpropsdlgtest.cpp index c09ff622c..638a60ec2 100644 --- a/tdeio/tests/kpropsdlgtest.cpp +++ b/tdeio/tests/kpropsdlgtest.cpp @@ -1,8 +1,8 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kpropertiesdialog.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> static TDECmdLineOptions options[] = diff --git a/tdeio/tests/kprotocolinfotest.cpp b/tdeio/tests/kprotocolinfotest.cpp index 30c9decd8..646249678 100644 --- a/tdeio/tests/kprotocolinfotest.cpp +++ b/tdeio/tests/kprotocolinfotest.cpp @@ -18,10 +18,10 @@ #include <kprotocolinfo.h> #include <kprotocolmanager.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobalsettings.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> #include <kdebug.h> #include <assert.h> diff --git a/tdeio/tests/kruntest.cpp b/tdeio/tests/kruntest.cpp index d8f47859b..f2065f8b8 100644 --- a/tdeio/tests/kruntest.cpp +++ b/tdeio/tests/kruntest.cpp @@ -21,7 +21,7 @@ #include "kruntest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kshell.h> #include <kservice.h> diff --git a/tdeio/tests/kscantest.cpp b/tdeio/tests/kscantest.cpp index 14abd1b33..d37f2eb97 100644 --- a/tdeio/tests/kscantest.cpp +++ b/tdeio/tests/kscantest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kscan.h> int main( int argc, char **argv ) diff --git a/tdeio/tests/kurifiltertest.cpp b/tdeio/tests/kurifiltertest.cpp index 67f27645d..5cc79bd82 100644 --- a/tdeio/tests/kurifiltertest.cpp +++ b/tdeio/tests/kurifiltertest.cpp @@ -22,10 +22,10 @@ #include <iostream> #include <stdlib.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kstandarddirs.h> #include <ksimpleconfig.h> diff --git a/tdeio/tests/kurlcompletiontest.cpp b/tdeio/tests/kurlcompletiontest.cpp index c8dc99595..7d479d156 100644 --- a/tdeio/tests/kurlcompletiontest.cpp +++ b/tdeio/tests/kurlcompletiontest.cpp @@ -16,14 +16,14 @@ * Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <kurlcompletion.h> #include <kdebug.h> #include <tqdir.h> #include <assert.h> #include <tqfile.h> #include <ktempdir.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <unistd.h> class KURLCompletionTest diff --git a/tdeio/tests/metatest.cpp b/tdeio/tests/metatest.cpp index 9890bb711..cd391e0d5 100644 --- a/tdeio/tests/metatest.cpp +++ b/tdeio/tests/metatest.cpp @@ -1,6 +1,6 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <tdefilemetainfo.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <tqstringlist.h> #include <tqimage.h> #include <kdebug.h> diff --git a/tdeio/tests/netaccesstest.cpp b/tdeio/tests/netaccesstest.cpp index 1a5de205d..b9b0ffab7 100644 --- a/tdeio/tests/netaccesstest.cpp +++ b/tdeio/tests/netaccesstest.cpp @@ -16,7 +16,7 @@ * Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kurl.h> #include <tdeio/netaccess.h> diff --git a/tdeio/tests/previewtest.cpp b/tdeio/tests/previewtest.cpp index 87bdd326d..6d0cd78b2 100644 --- a/tdeio/tests/previewtest.cpp +++ b/tdeio/tests/previewtest.cpp @@ -3,7 +3,7 @@ #include <tqlayout.h> #include <tqpushbutton.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klineedit.h> diff --git a/tdeio/tests/speed.cpp b/tdeio/tests/speed.cpp index 8256fa04f..4b14a6bb6 100644 --- a/tdeio/tests/speed.cpp +++ b/tdeio/tests/speed.cpp @@ -17,11 +17,11 @@ * Boston, MA 02110-1301, USA. */ #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <time.h> #include "speed.h" #include <tdeio/job.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <tqdir.h> #include <tdeio/global.h> diff --git a/tdeio/tests/tdeioslavetest.cpp b/tdeio/tests/tdeioslavetest.cpp index aee514f54..ecc5e4af5 100644 --- a/tdeio/tests/tdeioslavetest.cpp +++ b/tdeio/tests/tdeioslavetest.cpp @@ -14,8 +14,8 @@ #include <tqdir.h> #include <kacl.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <klocale.h> #include <kurl.h> diff --git a/tdeio/tests/tdesycocatest.cpp b/tdeio/tests/tdesycocatest.cpp index e1b40339f..719d90da8 100644 --- a/tdeio/tests/tdesycocatest.cpp +++ b/tdeio/tests/tdesycocatest.cpp @@ -28,7 +28,7 @@ #include <kprotocolinfo.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdio.h> #include <stdlib.h> diff --git a/tdeio/tests/tdesycocaupdatetest.cpp b/tdeio/tests/tdesycocaupdatetest.cpp index e7778e056..48a195a00 100644 --- a/tdeio/tests/tdesycocaupdatetest.cpp +++ b/tdeio/tests/tdesycocaupdatetest.cpp @@ -1,6 +1,6 @@ #include <kservice.h> -#include <kapplication.h> +#include <tdeapplication.h> int main(int argc, char *argv[]) { diff --git a/tdeio/tests/tdetradertest.cpp b/tdeio/tests/tdetradertest.cpp index 7a4b258dc..b33dcf398 100644 --- a/tdeio/tests/tdetradertest.cpp +++ b/tdeio/tests/tdetradertest.cpp @@ -16,10 +16,10 @@ * Boston, MA 02110-1301, USA. */ -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <ktrader.h> #include <kmimetype.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdio.h> static TDECmdLineOptions options[] = diff --git a/tdeioslave/http/http.cc b/tdeioslave/http/http.cc index 2dd5cc143..539cc4dc5 100644 --- a/tdeioslave/http/http.cc +++ b/tdeioslave/http/http.cc @@ -62,7 +62,7 @@ #include <kmimemagic.h> #include <dcopclient.h> #include <kdatastream.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <kstringhandler.h> #include <kremoteencoding.h> diff --git a/tdeioslave/http/http_cache_cleaner.cpp b/tdeioslave/http/http_cache_cleaner.cpp index c9f4e4678..af9ede123 100644 --- a/tdeioslave/http/http_cache_cleaner.cpp +++ b/tdeioslave/http/http_cache_cleaner.cpp @@ -34,7 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kinstance.h> #include <klocale.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kglobal.h> #include <kstandarddirs.h> #include <dcopclient.h> diff --git a/tdeioslave/http/kcookiejar/kcookieserver.cpp b/tdeioslave/http/kcookiejar/kcookieserver.cpp index ceb1df57f..798b06318 100644 --- a/tdeioslave/http/kcookiejar/kcookieserver.cpp +++ b/tdeioslave/http/kcookiejar/kcookieserver.cpp @@ -37,8 +37,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tdeconfig.h> #include <kdebug.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kstandarddirs.h> #include "kcookiejar.h" diff --git a/tdeioslave/http/kcookiejar/kcookiewin.cpp b/tdeioslave/http/kcookiejar/kcookiewin.cpp index 57a22f62c..3b845a104 100644 --- a/tdeioslave/http/kcookiejar/kcookiewin.cpp +++ b/tdeioslave/http/kcookiejar/kcookiewin.cpp @@ -63,7 +63,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kurllabel.h> #include <klineedit.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #ifdef Q_WS_X11 #include <X11/Xlib.h> diff --git a/tdeioslave/http/kcookiejar/main.cpp b/tdeioslave/http/kcookiejar/main.cpp index 976b6b87c..59d912524 100644 --- a/tdeioslave/http/kcookiejar/main.cpp +++ b/tdeioslave/http/kcookiejar/main.cpp @@ -22,9 +22,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <dcopclient.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> static const char description[] = I18N_NOOP("HTTP Cookie Daemon"); diff --git a/tdeioslave/http/kcookiejar/tests/kcookiejartest.cpp b/tdeioslave/http/kcookiejar/tests/kcookiejartest.cpp index 51e61a332..9d720d6c4 100644 --- a/tdeioslave/http/kcookiejar/tests/kcookiejartest.cpp +++ b/tdeioslave/http/kcookiejar/tests/kcookiejartest.cpp @@ -24,9 +24,9 @@ #include <tqdatetime.h> #include <tqstring.h> -#include <kapplication.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include <kstandarddirs.h> #include "../kcookiejar.cpp" diff --git a/tdeioslave/metainfo/metainfo.cpp b/tdeioslave/metainfo/metainfo.cpp index 68f07c800..54f7acc3a 100644 --- a/tdeioslave/metainfo/metainfo.cpp +++ b/tdeioslave/metainfo/metainfo.cpp @@ -20,7 +20,7 @@ #include <kdatastream.h> // Do not remove, needed for correct bool serialization #include <kurl.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmimetype.h> #include <kdebug.h> #include <tdefilemetainfo.h> diff --git a/tdelfeditor/tdelfeditor.cpp b/tdelfeditor/tdelfeditor.cpp index 7d58c9f08..99af949ed 100644 --- a/tdelfeditor/tdelfeditor.cpp +++ b/tdelfeditor/tdelfeditor.cpp @@ -43,10 +43,10 @@ extern "C" { #include <tqfileinfo.h> #include <kglobal.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> /* return application name */ diff --git a/tdemdi/tdemdi/dockcontainer.cpp b/tdemdi/tdemdi/dockcontainer.cpp index db29c293f..88bfa020d 100644 --- a/tdemdi/tdemdi/dockcontainer.cpp +++ b/tdemdi/tdemdi/dockcontainer.cpp @@ -33,7 +33,7 @@ #include <kdebug.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <klocale.h> diff --git a/tdemdi/tdemdi/guiclient.cpp b/tdemdi/tdemdi/guiclient.cpp index d3e162e14..255150289 100644 --- a/tdemdi/tdemdi/guiclient.cpp +++ b/tdemdi/tdemdi/guiclient.cpp @@ -22,7 +22,7 @@ #include "guiclient.moc" #include <tqpopupmenu.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <tdetoolbar.h> #include <klocale.h> diff --git a/tdemdi/tdemdi/mainwindow.cpp b/tdemdi/tdemdi/mainwindow.cpp index 358791ab0..4d477fc9c 100644 --- a/tdemdi/tdemdi/mainwindow.cpp +++ b/tdemdi/tdemdi/mainwindow.cpp @@ -52,7 +52,7 @@ #include <tqmenubar.h> #include <kmenubar.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeversion.h> #include <tqtabwidget.h> diff --git a/tdemdi/tdemdidockcontainer.cpp b/tdemdi/tdemdidockcontainer.cpp index 17f4dcf8a..ba0ba0de0 100644 --- a/tdemdi/tdemdidockcontainer.cpp +++ b/tdemdi/tdemdidockcontainer.cpp @@ -32,7 +32,7 @@ #include <kdebug.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <klocale.h> diff --git a/tdemdi/tdemdiguiclient.cpp b/tdemdi/tdemdiguiclient.cpp index c9b2f70f3..1c43b8039 100644 --- a/tdemdi/tdemdiguiclient.cpp +++ b/tdemdi/tdemdiguiclient.cpp @@ -21,7 +21,7 @@ #include "tdemdiguiclient.moc" #include <tqpopupmenu.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <tdetoolbar.h> #include <tdemainwindow.h> diff --git a/tdemdi/tdemdimainfrm.cpp b/tdemdi/tdemdimainfrm.cpp index 771afb8de..3c9f7c442 100644 --- a/tdemdi/tdemdimainfrm.cpp +++ b/tdemdi/tdemdimainfrm.cpp @@ -44,7 +44,7 @@ #include <tqmenubar.h> #include <kmenubar.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeversion.h> #include <tqtabwidget.h> diff --git a/tdemdi/test/main.cpp b/tdemdi/test/main.cpp index 4f14a410c..29a91e39f 100644 --- a/tdemdi/test/main.cpp +++ b/tdemdi/test/main.cpp @@ -26,7 +26,7 @@ //---------------------------------------------------------------------------- #ifndef NO_KDE -# include <kapplication.h> +# include <tdeapplication.h> TDEApplication* theApp; #else # include <tqapplication.h> diff --git a/tdeparts/genericfactory.h b/tdeparts/genericfactory.h index 75a5292ed..eb54959a4 100644 --- a/tdeparts/genericfactory.h +++ b/tdeparts/genericfactory.h @@ -4,7 +4,7 @@ #include <tdeparts/factory.h> #include <tdeparts/part.h> #include <kgenericfactory.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kdebug.h> namespace KParts diff --git a/tdeparts/historyprovider.cpp b/tdeparts/historyprovider.cpp index 17cf609a1..9c893ae53 100644 --- a/tdeparts/historyprovider.cpp +++ b/tdeparts/historyprovider.cpp @@ -19,7 +19,7 @@ #include <tqdict.h> -#include <kapplication.h> +#include <tdeapplication.h> #include "historyprovider.h" diff --git a/tdeparts/tests/example.cpp b/tdeparts/tests/example.cpp index 0571bf4ad..403fda062 100644 --- a/tdeparts/tests/example.cpp +++ b/tdeparts/tests/example.cpp @@ -9,7 +9,7 @@ #include <kiconloader.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <tdeaction.h> #include <klocale.h> diff --git a/tdeparts/tests/ghostview.cpp b/tdeparts/tests/ghostview.cpp index 24d70a14d..72b165e65 100644 --- a/tdeparts/tests/ghostview.cpp +++ b/tdeparts/tests/ghostview.cpp @@ -1,11 +1,11 @@ #include <kiconloader.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeaction.h> #include <klocale.h> #include <tdefiledialog.h> #include <kmessagebox.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <klibloader.h> #include <tqwidget.h> diff --git a/tdeparts/tests/normalktm.cpp b/tdeparts/tests/normalktm.cpp index 14efbef94..664d6c7ec 100644 --- a/tdeparts/tests/normalktm.cpp +++ b/tdeparts/tests/normalktm.cpp @@ -9,7 +9,7 @@ #include <kiconloader.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <tdeaction.h> #include <klocale.h> diff --git a/tdeparts/tests/notepad.cpp b/tdeparts/tests/notepad.cpp index 547cab520..81ff2c1f2 100644 --- a/tdeparts/tests/notepad.cpp +++ b/tdeparts/tests/notepad.cpp @@ -8,8 +8,8 @@ #include <tqtextstream.h> #include <tqmultilineedit.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeaction.h> #include <klocale.h> diff --git a/tdeparts/tests/parts.cpp b/tdeparts/tests/parts.cpp index e765f55e7..408e73280 100644 --- a/tdeparts/tests/parts.cpp +++ b/tdeparts/tests/parts.cpp @@ -12,7 +12,7 @@ #include <tqvbox.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kmessagebox.h> #include <tdeaction.h> diff --git a/tdeprint/cups/cupsdconf2/main.cpp b/tdeprint/cups/cupsdconf2/main.cpp index 5febb18a1..abc81477c 100644 --- a/tdeprint/cups/cupsdconf2/main.cpp +++ b/tdeprint/cups/cupsdconf2/main.cpp @@ -21,8 +21,8 @@ #include <tqfile.h> #include <klocale.h> -#include <kcmdlineargs.h> -#include <kapplication.h> +#include <tdecmdlineargs.h> +#include <tdeapplication.h> static TDECmdLineOptions options[] = { diff --git a/tdeprint/cups/cupsinfos.cpp b/tdeprint/cups/cupsinfos.cpp index 5013b57cc..330429583 100644 --- a/tdeprint/cups/cupsinfos.cpp +++ b/tdeprint/cups/cupsinfos.cpp @@ -26,7 +26,7 @@ #include <tdeio/authinfo.h> #include <klocale.h> #include <tdeconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <kdebug.h> #include <kstringhandler.h> diff --git a/tdeprint/cups/kmcupsmanager.cpp b/tdeprint/cups/kmcupsmanager.cpp index 99fff556a..cd472eefa 100644 --- a/tdeprint/cups/kmcupsmanager.cpp +++ b/tdeprint/cups/kmcupsmanager.cpp @@ -41,7 +41,7 @@ #include <tqdatetime.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tdeconfig.h> #include <kstandarddirs.h> diff --git a/tdeprint/kmfactory.cpp b/tdeprint/kmfactory.cpp index 7d972cbf8..09a2cf45a 100644 --- a/tdeprint/kmfactory.cpp +++ b/tdeprint/kmfactory.cpp @@ -40,7 +40,7 @@ #include <klocale.h> #include <ksimpleconfig.h> #include <kstaticdeleter.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <dcopclient.h> #include <dcopref.h> #include <tdeio/authinfo.h> diff --git a/tdeprint/kmmanager.cpp b/tdeprint/kmmanager.cpp index 1c772ec3c..ca9b1036f 100644 --- a/tdeprint/kmmanager.cpp +++ b/tdeprint/kmmanager.cpp @@ -32,7 +32,7 @@ #include <tdeconfig.h> #include <klocale.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klibloader.h> #include <unistd.h> diff --git a/tdeprint/kpcopiespage.cpp b/tdeprint/kpcopiespage.cpp index 3557fe4d4..d804cc9f2 100644 --- a/tdeprint/kpcopiespage.cpp +++ b/tdeprint/kpcopiespage.cpp @@ -34,7 +34,7 @@ #include <tqwhatsthis.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kiconloader.h> #include <kseparator.h> diff --git a/tdeprint/kpfilterpage.cpp b/tdeprint/kpfilterpage.cpp index 7f3d18807..4704abb15 100644 --- a/tdeprint/kpfilterpage.cpp +++ b/tdeprint/kpfilterpage.cpp @@ -32,7 +32,7 @@ #include <kmessagebox.h> #include <kactivelabel.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialog.h> KPFilterPage::KPFilterPage(TQWidget *parent, const char *name) diff --git a/tdeprint/kprintdialog.cpp b/tdeprint/kprintdialog.cpp index 73e700886..312146855 100644 --- a/tdeprint/kprintdialog.cpp +++ b/tdeprint/kprintdialog.cpp @@ -61,7 +61,7 @@ #include <tdeconfig.h> #include <kguiitem.h> #include <kstdguiitem.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeio/renamedlg.h> #include <time.h> diff --git a/tdeprint/kprinter.cpp b/tdeprint/kprinter.cpp index 4d34280a0..95cfc1733 100644 --- a/tdeprint/kprinter.cpp +++ b/tdeprint/kprinter.cpp @@ -33,7 +33,7 @@ #include <tqtl.h> #include <tqdir.h> #include <tqguardedptr.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <kglobal.h> #include <tdeconfig.h> diff --git a/tdeprint/kprinterimpl.cpp b/tdeprint/kprinterimpl.cpp index fd05024a3..ac79220f5 100644 --- a/tdeprint/kprinterimpl.cpp +++ b/tdeprint/kprinterimpl.cpp @@ -34,7 +34,7 @@ #include <kinputdialog.h> #include <klocale.h> #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <kdatastream.h> #include <kdebug.h> diff --git a/tdeprint/kprintpreview.cpp b/tdeprint/kprintpreview.cpp index b1a2f50ac..0311f543d 100644 --- a/tdeprint/kprintpreview.cpp +++ b/tdeprint/kprintpreview.cpp @@ -32,7 +32,7 @@ #include <ktrader.h> #include <kuserprofile.h> #include <krun.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <klocale.h> #include <kmessagebox.h> diff --git a/tdeprint/kprintprocess.cpp b/tdeprint/kprintprocess.cpp index fbee05a0c..ec93fcce6 100644 --- a/tdeprint/kprintprocess.cpp +++ b/tdeprint/kprintprocess.cpp @@ -18,7 +18,7 @@ **/ #include "kprintprocess.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tqfile.h> diff --git a/tdeprint/lpr/matichandler.cpp b/tdeprint/lpr/matichandler.cpp index 738f7e178..e1242c5fc 100644 --- a/tdeprint/lpr/matichandler.cpp +++ b/tdeprint/lpr/matichandler.cpp @@ -31,7 +31,7 @@ #include <klocale.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kprocess.h> #include <tqfile.h> diff --git a/tdeprint/management/kaddprinterwizard.cpp b/tdeprint/management/kaddprinterwizard.cpp index 99da2a9b7..256b85011 100644 --- a/tdeprint/management/kaddprinterwizard.cpp +++ b/tdeprint/management/kaddprinterwizard.cpp @@ -1,6 +1,6 @@ #include "kmmanager.h" -#include <kcmdlineargs.h> -#include <kapplication.h> +#include <tdecmdlineargs.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <klocale.h> #include <kglobal.h> diff --git a/tdeprint/management/kmdbcreator.cpp b/tdeprint/management/kmdbcreator.cpp index c101bb270..2297d4034 100644 --- a/tdeprint/management/kmdbcreator.cpp +++ b/tdeprint/management/kmdbcreator.cpp @@ -25,7 +25,7 @@ #include <tqfileinfo.h> #include <tqdir.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <kdebug.h> diff --git a/tdeprint/management/kmdriverdb.cpp b/tdeprint/management/kmdriverdb.cpp index a7d14fe92..9eb28cf87 100644 --- a/tdeprint/management/kmdriverdb.cpp +++ b/tdeprint/management/kmdriverdb.cpp @@ -28,7 +28,7 @@ #include <tqtextstream.h> #include <tqfileinfo.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> KMDriverDB* KMDriverDB::m_self = 0; diff --git a/tdeprint/management/kmjobviewer.cpp b/tdeprint/management/kmjobviewer.cpp index 9d5c498c0..741e69378 100644 --- a/tdeprint/management/kmjobviewer.cpp +++ b/tdeprint/management/kmjobviewer.cpp @@ -39,7 +39,7 @@ #include <tdeaction.h> #include <kstdaction.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcursor.h> #include <kmenubar.h> #include <kdebug.h> diff --git a/tdeprint/management/kmmainview.cpp b/tdeprint/management/kmmainview.cpp index da5b2dd0a..5e68f3726 100644 --- a/tdeprint/management/kmmainview.cpp +++ b/tdeprint/management/kmmainview.cpp @@ -54,7 +54,7 @@ #include <kdialogbase.h> #include <ksimpleconfig.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kprocess.h> #undef m_manager diff --git a/tdeprint/management/kmwdrivertest.cpp b/tdeprint/management/kmwdrivertest.cpp index 4f57762aa..cb46a45a0 100644 --- a/tdeprint/management/kmwdrivertest.cpp +++ b/tdeprint/management/kmwdrivertest.cpp @@ -29,7 +29,7 @@ #include <kpushbutton.h> #include <tqlayout.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <kguiitem.h> #include <tdeio/netaccess.h> diff --git a/tdeprint/management/kmwizard.cpp b/tdeprint/management/kmwizard.cpp index 5dc915572..5bb86967a 100644 --- a/tdeprint/management/kmwizard.cpp +++ b/tdeprint/management/kmwizard.cpp @@ -31,7 +31,7 @@ #include <klocale.h> #include <kdebug.h> #include <kseparator.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstdguiitem.h> #include "kmwinfopage.h" diff --git a/tdeprint/management/kmwsocketutil.cpp b/tdeprint/management/kmwsocketutil.cpp index 04556c07b..a4f23959a 100644 --- a/tdeprint/management/kmwsocketutil.cpp +++ b/tdeprint/management/kmwsocketutil.cpp @@ -32,7 +32,7 @@ #include <tqregexp.h> #include <knumvalidator.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kextsock.h> #include <kdebug.h> diff --git a/tdeprint/management/kxmlcommanddlg.cpp b/tdeprint/management/kxmlcommanddlg.cpp index 5019b92b3..2080149d9 100644 --- a/tdeprint/management/kxmlcommanddlg.cpp +++ b/tdeprint/management/kxmlcommanddlg.cpp @@ -45,7 +45,7 @@ #include <tdelistbox.h> #include <kmimetype.h> #include <kmessagebox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kguiitem.h> diff --git a/tdeprint/messagewindow.cpp b/tdeprint/messagewindow.cpp index a1b6ddf29..7f642896e 100644 --- a/tdeprint/messagewindow.cpp +++ b/tdeprint/messagewindow.cpp @@ -25,7 +25,7 @@ #include <tqpixmap.h> #include <tqhbox.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> TQPtrDict<MessageWindow> MessageWindow::m_windows; diff --git a/tdeprint/tdeprintd.cpp b/tdeprint/tdeprintd.cpp index 02d32ab77..5080cc40c 100644 --- a/tdeprint/tdeprintd.cpp +++ b/tdeprint/tdeprintd.cpp @@ -33,7 +33,7 @@ #include <kiconloader.h> #include <kstandarddirs.h> #include <twin.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tqlayout.h> #include <tqtimer.h> #include <tqregexp.h> diff --git a/tdeprint/tests/drawdemo.cpp b/tdeprint/tests/drawdemo.cpp index 3f04c9196..71d4a0680 100644 --- a/tdeprint/tests/drawdemo.cpp +++ b/tdeprint/tests/drawdemo.cpp @@ -14,7 +14,7 @@ #include <tqpushbutton.h> #include <tqradiobutton.h> #include <tqbuttongroup.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tqapplication.h> #include <math.h> diff --git a/tdeprint/tests/main.cpp b/tdeprint/tests/main.cpp index 332ba1fc4..d714bcdf6 100644 --- a/tdeprint/tests/main.cpp +++ b/tdeprint/tests/main.cpp @@ -9,7 +9,7 @@ *****************************************************************************/ #include "helpwindow.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tqwindowsstyle.h> #include <tqstylesheet.h> #include <stdlib.h> diff --git a/tderandr/libtderandr.cc b/tderandr/libtderandr.cc index 65005f91e..976b156ac 100644 --- a/tderandr/libtderandr.cc +++ b/tderandr/libtderandr.cc @@ -28,7 +28,7 @@ #include <klocale.h> #include <kmessagebox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <stdlib.h> #include <unistd.h> diff --git a/tderandr/randr.cpp b/tderandr/randr.cpp index 334da5a79..68bfc2e68 100644 --- a/tderandr/randr.cpp +++ b/tderandr/randr.cpp @@ -24,7 +24,7 @@ #include <kdebug.h> #include <klocale.h> #include <kglobal.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kiconloader.h> #include <dcopclient.h> #include <kipc.h> diff --git a/tderesources/configpage.cpp b/tderesources/configpage.cpp index d0ba22df7..e70332c71 100644 --- a/tderesources/configpage.cpp +++ b/tderesources/configpage.cpp @@ -25,7 +25,7 @@ #include <tqlabel.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcombobox.h> #include <kdebug.h> #include <klocale.h> diff --git a/tderesources/kcmtderesources.cpp b/tderesources/kcmtderesources.cpp index 6afc1c1f6..1b779fabd 100644 --- a/tderesources/kcmtderesources.cpp +++ b/tderesources/kcmtderesources.cpp @@ -21,7 +21,7 @@ #include <tqlayout.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kgenericfactory.h> #include <klocale.h> diff --git a/tderesources/managerimpl.cpp b/tderesources/managerimpl.cpp index 467f049e9..288a40223 100644 --- a/tderesources/managerimpl.cpp +++ b/tderesources/managerimpl.cpp @@ -23,8 +23,8 @@ #include <dcopclient.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tdeconfig.h> #include <kstandarddirs.h> diff --git a/tderesources/resource.cpp b/tderesources/resource.cpp index 2a16ee159..41c08767e 100644 --- a/tderesources/resource.cpp +++ b/tderesources/resource.cpp @@ -22,7 +22,7 @@ */ #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <klocale.h> #include "resource.h" diff --git a/tderesources/testresources.cpp b/tderesources/testresources.cpp index 515563172..7644315d4 100644 --- a/tderesources/testresources.cpp +++ b/tderesources/testresources.cpp @@ -1,7 +1,7 @@ #include <kdebug.h> -#include <kapplication.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include "resource.h" #include "manager.h" diff --git a/tdersync/rsyncconfigdialog.cpp b/tdersync/rsyncconfigdialog.cpp index 8b22b84a2..78df9e335 100644 --- a/tdersync/rsyncconfigdialog.cpp +++ b/tdersync/rsyncconfigdialog.cpp @@ -82,7 +82,7 @@ #include <kprogressbox.h> #include <kpassdlg.h> #include <tdelistview.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfigdialog.h> #include <kdirlister.h> diff --git a/tdersync/tdersync.h b/tdersync/tdersync.h index ffb5cfd6f..a4908fe63 100644 --- a/tdersync/tdersync.h +++ b/tdersync/tdersync.h @@ -61,7 +61,7 @@ #include <kprogressbox.h> #include <kpassdlg.h> #include <tdelistview.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfigdialog.h> #include <kdirlister.h> diff --git a/tdespell2/tests/backgroundtest.cpp b/tdespell2/tests/backgroundtest.cpp index 14f9e029d..92c7e7792 100644 --- a/tdespell2/tests/backgroundtest.cpp +++ b/tdespell2/tests/backgroundtest.cpp @@ -24,7 +24,7 @@ #include "broker.h" using namespace KSpell2; -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> const char *text = "Rationale \ diff --git a/tdespell2/tests/test.cpp b/tdespell2/tests/test.cpp index e8ceabaf7..b68dbee42 100644 --- a/tdespell2/tests/test.cpp +++ b/tdespell2/tests/test.cpp @@ -21,7 +21,7 @@ #include "broker.h" #include "dictionary.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tqdatetime.h> diff --git a/tdespell2/tests/test_config.cpp b/tdespell2/tests/test_config.cpp index 2d243bd46..c3c5ec740 100644 --- a/tdespell2/tests/test_config.cpp +++ b/tdespell2/tests/test_config.cpp @@ -20,7 +20,7 @@ */ #include "configdialog.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> using namespace KSpell2; diff --git a/tdespell2/tests/test_configdialog.cpp b/tdespell2/tests/test_configdialog.cpp index a9ff16cdd..4e3b560e9 100644 --- a/tdespell2/tests/test_configdialog.cpp +++ b/tdespell2/tests/test_configdialog.cpp @@ -21,7 +21,7 @@ #include "configdialog.h" #include "broker.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> using namespace KSpell2; diff --git a/tdespell2/tests/test_dialog.cpp b/tdespell2/tests/test_dialog.cpp index 19503e307..d6441bde6 100644 --- a/tdespell2/tests/test_dialog.cpp +++ b/tdespell2/tests/test_dialog.cpp @@ -25,7 +25,7 @@ #include "dictionary.h" #include "filter.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> using namespace KSpell2; diff --git a/tdespell2/tests/test_filter.cpp b/tdespell2/tests/test_filter.cpp index 430f157dd..a1fcb670c 100644 --- a/tdespell2/tests/test_filter.cpp +++ b/tdespell2/tests/test_filter.cpp @@ -21,7 +21,7 @@ #include "filter.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> using namespace KSpell2; diff --git a/tdespell2/tests/test_highlighter.cpp b/tdespell2/tests/test_highlighter.cpp index c11972254..3f7c253e4 100644 --- a/tdespell2/tests/test_highlighter.cpp +++ b/tdespell2/tests/test_highlighter.cpp @@ -22,7 +22,7 @@ #include "dictionary.h" #include "filter.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tqtextedit.h> diff --git a/tdesu/client.cpp b/tdesu/client.cpp index 8eaf86af8..91e922250 100644 --- a/tdesu/client.cpp +++ b/tdesu/client.cpp @@ -32,7 +32,7 @@ #include <kdebug.h> #include <kstandarddirs.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kde_file.h> #include "client.h" diff --git a/tdesu/stub.cpp b/tdesu/stub.cpp index f5b435b40..4cd5864de 100644 --- a/tdesu/stub.cpp +++ b/tdesu/stub.cpp @@ -20,7 +20,7 @@ #include <tqcstring.h> #include <kdatastream.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <dcopclient.h> diff --git a/tdeui/CMakeLists.txt b/tdeui/CMakeLists.txt index b8e11ed32..85d2fc9b4 100644 --- a/tdeui/CMakeLists.txt +++ b/tdeui/CMakeLists.txt @@ -53,7 +53,7 @@ install( FILES klineeditdlg.h kinputdialog.h kactivelabel.h kcharselect.h kcolordrag.h qxembed.h knumvalidator.h kdialog.h kdialogbase.h - kjanuswidget.h kaboutdialog.h + kjanuswidget.h tdeaboutdialog.h kauthicon.h kmessagebox.h ksharedpixmap.h kdualcolorbtn.h kdualcolorbutton.h tdetoolbarbutton.h tdetoolbarradiogroup.h ktextbrowser.h @@ -64,7 +64,7 @@ install( FILES kxmlguiclient.h kxmlgui.h kxmlguibuilder.h kxmlguifactory.h kpixmapio.h kwordwrap.h kedittoolbar.h kdockwidget.h kanimwidget.h - krootpixmap.h kaboutkde.h kaboutapplication.h + krootpixmap.h tdeabouttde.h tdeaboutapplication.h kpanelapplet.h kpushbutton.h kdcopactionproxy.h kcolorcombo.h kpanelextension.h tdecompletionbox.h ksqueezedtextlabel.h kcommand.h twindowlistmenu.h tdefontcombo.h tdeaccelgen.h ktip.h @@ -117,7 +117,7 @@ set( ${target}_SRCS kruler.cpp kcursor.cpp klineeditdlg.cpp kcharselect.cpp kcolordrag.cpp knumvalidator.cpp kdialog.cpp kdialogbase.cpp - kjanuswidget.cpp kaboutdialog.cpp + kjanuswidget.cpp tdeaboutdialog.cpp kauthicon.cpp kmessagebox.cpp kdualcolorbutton.cpp tdetoolbarradiogroup.cpp tdetoolbarbutton.cpp ktextbrowser.cpp khelpmenu.cpp kswitchlanguagedialog.cpp @@ -126,8 +126,8 @@ set( ${target}_SRCS kcombobox.cpp kpassdlg.cpp kxmlguiclient.cpp kxmlguifactory.cpp kxmlguifactory_p.cpp kxmlguibuilder.cpp kedittoolbar.cpp kpanelappmenu.cpp kdockwidget.cpp kdockwidget_private.cpp - kanimwidget.cpp krootpixmap.cpp kaboutkde.cpp - kaboutapplication.cpp kpanelapplet.cpp kdcopactionproxy.cpp + kanimwidget.cpp krootpixmap.cpp tdeabouttde.cpp + tdeaboutapplication.cpp kpanelapplet.cpp kdcopactionproxy.cpp kcolorcombo.cpp kpushbutton.cpp kpanelextension.cpp tdecompletionbox.cpp ksqueezedtextlabel.cpp tdecmodule.cpp kcommand.cpp twindowlistmenu.cpp tdefontcombo.cpp ktip.cpp diff --git a/tdeui/MAINTAINERS b/tdeui/MAINTAINERS index 4e22d00a0..f4e2165fb 100644 --- a/tdeui/MAINTAINERS +++ b/tdeui/MAINTAINERS @@ -5,9 +5,9 @@ that class. When adding yourself as a maintainer, don't be afraid to reorder the files to a more logical grouping. -kaboutapplication.cpp -kaboutdialog.cpp -kaboutkde.cpp +tdeaboutapplication.cpp +tdeaboutdialog.cpp +tdeabouttde.cpp tdeaction.cpp Holger Freyther <freyther@kde.org>, Martijn Klingens <klingens@kde.org> kanimwidget.cpp Waldo Bastian <bastian@kde.org> karrowbutton.cpp Frerich Raabe <raabe@kde.org> diff --git a/tdeui/Makefile.am b/tdeui/Makefile.am index 4a1b472ff..26a9423cd 100644 --- a/tdeui/Makefile.am +++ b/tdeui/Makefile.am @@ -50,7 +50,7 @@ include_HEADERS = kprogressbox.h kprogress.h kcolordlg.h \ klineeditdlg.h kinputdialog.h kactivelabel.h \ kcharselect.h kcolordrag.h qxembed.h \ knumvalidator.h kdialog.h kdialogbase.h \ - kjanuswidget.h kaboutdialog.h \ + kjanuswidget.h tdeaboutdialog.h \ kauthicon.h kmessagebox.h ksharedpixmap.h \ kdualcolorbtn.h kdualcolorbutton.h tdetoolbarbutton.h \ tdetoolbarradiogroup.h ktextbrowser.h \ @@ -61,7 +61,7 @@ include_HEADERS = kprogressbox.h kprogress.h kcolordlg.h \ kxmlguiclient.h kxmlgui.h kxmlguibuilder.h kxmlguifactory.h \ kpixmapio.h kwordwrap.h \ kedittoolbar.h kdockwidget.h kanimwidget.h \ - krootpixmap.h kaboutkde.h kaboutapplication.h \ + krootpixmap.h tdeabouttde.h tdeaboutapplication.h \ kpanelapplet.h kpushbutton.h kdcopactionproxy.h kcolorcombo.h \ kpanelextension.h tdecompletionbox.h ksqueezedtextlabel.h \ kcommand.h twindowlistmenu.h tdefontcombo.h tdeaccelgen.h ktip.h \ @@ -98,7 +98,7 @@ libtdeui_la_SOURCES = \ kruler.cpp kcursor.cpp klineeditdlg.cpp \ kcharselect.cpp kcolordrag.cpp \ knumvalidator.cpp kdialog.cpp kdialogbase.cpp \ - kjanuswidget.cpp kaboutdialog.cpp \ + kjanuswidget.cpp tdeaboutdialog.cpp \ kauthicon.cpp kmessagebox.cpp kdualcolorbutton.cpp \ tdetoolbarradiogroup.cpp tdetoolbarbutton.cpp \ ktextbrowser.cpp khelpmenu.cpp kswitchlanguagedialog.cpp \ @@ -107,8 +107,8 @@ libtdeui_la_SOURCES = \ kcombobox.cpp kpassdlg.cpp kxmlguiclient.cpp kxmlguifactory.cpp \ kxmlguifactory_p.cpp kxmlguibuilder.cpp kedittoolbar.cpp \ kpanelappmenu.cpp kdockwidget.cpp kdockwidget_private.cpp \ - kanimwidget.cpp krootpixmap.cpp kaboutkde.cpp \ - kaboutapplication.cpp kpanelapplet.cpp kdcopactionproxy.cpp \ + kanimwidget.cpp krootpixmap.cpp tdeabouttde.cpp \ + tdeaboutapplication.cpp kpanelapplet.cpp kdcopactionproxy.cpp \ kcolorcombo.cpp kpushbutton.cpp kpanelextension.cpp \ tdecompletionbox.cpp ksqueezedtextlabel.cpp tdecmodule.cpp \ kcommand.cpp twindowlistmenu.cpp tdefontcombo.cpp ktip.cpp \ diff --git a/tdeui/kaboutapplication.cpp b/tdeui/kaboutapplication.cpp deleted file mode 100644 index 681b22642..000000000 --- a/tdeui/kaboutapplication.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and - * Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -// I (espen) prefer that header files are included alphabetically - -#include <tqlabel.h> -#include <kaboutapplication.h> -#include <kaboutdialog_private.h> -#include <kaboutdata.h> -#include <kapplication.h> -#include <kglobal.h> -#include <klocale.h> -#include <kurllabel.h> -#include <kactivelabel.h> -#include "ktextedit.h" - -TDEAboutApplication::TDEAboutApplication( TQWidget *parent, const char *name, - bool modal ) - :TDEAboutDialog( AbtTabbed|AbtProduct, - kapp ? kapp->caption() : TQString::null, - Close, Close, - parent, name, modal ) -{ - buildDialog(TDEGlobal::instance()->aboutData()); -} - -TDEAboutApplication::TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent, - const char *name, bool modal ) - :TDEAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close, - parent, name, modal ) -{ - buildDialog(aboutData); -} - -void TDEAboutApplication::buildDialog( const TDEAboutData *aboutData ) -{ - if( !aboutData ) - { - // - // Recovery - // - - //i18n "??" is displayed as (pseudo-)version when no data is known about the application - setProduct( kapp ? kapp->caption() : TQString::null, i18n("??"), TQString::null, TQString::null ); - TDEAboutContainer *appPage = addContainerPage( i18n("&About")); - - TQString appPageText = - i18n("No information available.\n" - "The supplied TDEAboutData object does not exist."); - TQLabel *appPageLabel = new TQLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 ); - appPage->addWidget( appPageLabel ); - return; - } - - setProduct( aboutData->programName(), aboutData->version(), - TQString::null, TQString::null ); - - if (!aboutData->programLogo().isNull()) - setProgramLogo( aboutData->programLogo() ); - - TQString appPageText = aboutData->shortDescription() + "\n"; - - if (!aboutData->otherText().isEmpty()) - appPageText += "\n" + aboutData->otherText()+"\n"; - - if (!aboutData->copyrightStatement().isEmpty()) - appPageText += "\n" + aboutData->copyrightStatement()+"\n"; - - TDEAboutContainer *appPage = addContainerPage( i18n("&About")); - - TQLabel *appPageLabel = new TQLabel( appPageText, 0 ); - appPage->addWidget( appPageLabel ); - - if (!aboutData->homepage().isEmpty()) - { - KURLLabel *url = new KURLLabel(); - url->setText(aboutData->homepage()); - url->setURL(aboutData->homepage()); - appPage->addWidget( url ); - connect( url, TQT_SIGNAL(leftClickedURL(const TQString &)), - this, TQT_SLOT(openURLSlot(const TQString &))); - } - - int authorCount = aboutData->authors().count(); - if (authorCount) - { - TQString authorPageTitle = authorCount == 1 ? - i18n("A&uthor") : i18n("A&uthors"); - TDEAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle ); - - if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ()) - { - TQString text; - KActiveLabel* activeLabel = new KActiveLabel( authorPage ); - if (!aboutData->customAuthorTextEnabled()) - { - if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.pearsoncomputing.net") - text = i18n( "Please use <a href=\"http://bugs.pearsoncomputing.net\">http://bugs.pearsoncomputing.net</a> to report bugs.\n" ); - else { - if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) ) - { - text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() ); - } - else { - text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() ); - } - } - } - else - { - text = aboutData->customAuthorRichText(); - } - activeLabel->setText( text ); - authorPage->addWidget( activeLabel ); - } - - TQValueList<TDEAboutPerson>::ConstIterator it; - for (it = aboutData->authors().begin(); - it != aboutData->authors().end(); ++it) - { - authorPage->addPerson( (*it).name(), (*it).emailAddress(), - (*it).webAddress(), (*it).task() ); - } - } - - int creditsCount = aboutData->credits().count(); - if (creditsCount) - { - TDEAboutContainer *creditsPage = - addScrolledContainerPage( i18n("&Thanks To") ); - TQValueList<TDEAboutPerson>::ConstIterator it; - for (it = aboutData->credits().begin(); - it != aboutData->credits().end(); ++it) - { - creditsPage->addPerson( (*it).name(), (*it).emailAddress(), - (*it).webAddress(), (*it).task() ); - } - } - - const TQValueList<TDEAboutTranslator> translatorList = aboutData->translators(); - - if(translatorList.count() > 0) - { - TQString text = "<qt>"; - - TQValueList<TDEAboutTranslator>::ConstIterator it; - for(it = translatorList.begin(); it != translatorList.end(); ++it) - { - text += TQString("<p>%1<br>   " - "<a href=\"mailto:%2\">%2</a></p>") - .arg((*it).name()) - .arg((*it).emailAddress()) - .arg((*it).emailAddress()); - } - - text += TDEAboutData::aboutTranslationTeam() + "</qt>"; - addTextPage( i18n("T&ranslation"), text, true); - } - - if (!aboutData->license().isEmpty() ) - { - addLicensePage( i18n("&License Agreement"), aboutData->license() ); - } - - // - // Make sure the dialog has a reasonable width - // - setInitialSize( TQSize(400,1) ); -} diff --git a/tdeui/kaboutapplication.h b/tdeui/kaboutapplication.h deleted file mode 100644 index c313460ff..000000000 --- a/tdeui/kaboutapplication.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and - * Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef _KABOUT_APPLICATION_H_ -#define _KABOUT_APPLICATION_H_ - -#include <kaboutdata.h> -#include <kaboutdialog.h> - -/** - * @short Standard "About Application" dialog box. - * - * This class provides the standard "About Application" dialog box - * that is used by KHelpMenu. It uses the information of the global - * TDEAboutData that is specified at the start of your program in - * main(). Normally you should not use this class directly but rather - * the KHelpMenu class or even better just subclass your toplevel - * window from TDEMainWindow. If you do the latter, the help menu and - * thereby this dialog box is available through the - * TDEMainWindow::helpMenu() function. - * - * @author Waldo Bastian (bastian@kde.org) and Espen Sand (espen@kde.org) - */ - -class TDEUI_EXPORT TDEAboutApplication : public TDEAboutDialog -{ - public: - /** - * Constructor. Creates a fully featured "About Application" dialog box. - * Note that this dialog is made modeless in the KHelpMenu class so - * the users may expect a modeless dialog. - * - * @param parent The parent of the dialog box. You should use the - * toplevel window so that the dialog becomes centered. - * @param name Internal name of the widget. This name is not used in the - * caption. - * @param modal If false, this widget will be modeless and must be - * made visible using TQWidget::show(). Otherwise it will be - * modal and must be made visible using TQWidget::exec(). - */ - TDEAboutApplication( TQWidget *parent=0, const char *name=0, bool modal=true ); - - /** - * Constructor. Mostly does the same stuff as the previous constructor, except - * that it can take a custom TDEAboutData object instead of the one specified - * in your main() function. This is especially useful for applications - * which are implemented as (dynamically loaded) libraries, e.g. panel - * applets. - * - * @param aboutData A pointer to a TDEAboutData object which data - * will be used for filling the dialog. - * @param parent The parent of the dialog box. You should use the - * toplevel window so that the dialog becomes centered. - * @param name Internal name of the widget. This name is not used in the - * caption. - * @param modal If false, this widget will be modeless and must be - * made visible using TQWidget::show(). Otherwise it will be - * modal and must be made visible using TQWidget::exec(). - */ - TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent=0, const char *name=0, bool modal=true ); - -/* - FIXME: The two constructors should be replaced with the following after the lib freeze: - - TDEAboutApplication( const TDEAboutData *aboutData=0, TQWidget *parent=0, const char *name=0, bool modal=true ); - - This will make buildDialog() obsolete as well (Frerich). -*/ - protected: - void buildDialog( const TDEAboutData *aboutData ); -}; - - -#endif - diff --git a/tdeui/kaboutdialog.cpp b/tdeui/kaboutdialog.cpp deleted file mode 100644 index 7cc1c6327..000000000 --- a/tdeui/kaboutdialog.cpp +++ /dev/null @@ -1,1797 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 1999-2001 Mirko Boehm <mirko@kde.org> and - * Espen Sand <espensa@online.no> - * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include <tqclipboard.h> -#include <tqimage.h> -#include <tqlabel.h> -#include <tqlayout.h> -#include <ktextedit.h> -#include <tqobjectlist.h> -#include <tqpainter.h> -#include <tqrect.h> -#include <tqtabwidget.h> -#include <tqtabbar.h> - -#include <kapplication.h> -#include <kglobal.h> -#include <kglobalsettings.h> -#include <klocale.h> -#include <ktextbrowser.h> -#include <kurllabel.h> -#include <kaboutdialog.h> -#include <kaboutdialog_private.h> -#include <kdebug.h> - -//MOC_SKIP_BEGIN -template class TQPtrList<TDEAboutContributor>; -//MOC_SKIP_END - -#define WORKTEXT_IDENTATION 16 -#define Grid 3 - -// ############################################################## -// MOC OUTPUT FILES: -#include "kaboutdialog.moc" -#include "kaboutdialog_private.moc" -// ############################################################## - -class TDEAboutTabWidget : public TQTabWidget -{ -public: - TDEAboutTabWidget( TQWidget* parent ) : TQTabWidget( parent ) {} - TQSize sizeHint() const { - return TQTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + TQSize(4,4) ); - } -}; - - - - -TDEAboutContributor::TDEAboutContributor( TQWidget *_parent, const char *wname, - const TQString &_name,const TQString &_email, - const TQString &_url, const TQString &_work, - bool showHeader, bool showFrame, - bool showBold ) - : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0) -{ - if( showFrame ) - { - setFrameStyle(TQFrame::Panel | TQFrame::Raised); - } - - mLabel[0] = new TQLabel( this ); - mLabel[1] = new TQLabel( this ); - mLabel[2] = new TQLabel( this ); - mLabel[3] = new TQLabel( this ); - mText[0] = new TQLabel( this ); - mText[1] = new KURLLabel( this ); - mText[2] = new KURLLabel( this ); - mText[3] = new TQLabel( this ); - - setName( _name, i18n("Author"), false ); - setEmail( _email, i18n("Email"), false ); - setURL( _url, i18n("Homepage"), false ); - setWork( _work, i18n("Task"), false ); - - KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]); - kurl->setFloat(true); - kurl->setUnderline(true); - kurl->setMargin(0); - connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), - TQT_SLOT(emailClickedSlot(const TQString &))); - - kurl = static_cast<KURLLabel *>(mText[2]); - kurl->setFloat(true); - kurl->setUnderline(true); - kurl->setMargin(0); - connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), - TQT_SLOT(urlClickedSlot(const TQString &))); - - mLabel[3]->setAlignment( AlignTop ); - - fontChange( font() ); - updateLayout(); -} - - -void TDEAboutContributor::setName( const TQString &_text, const TQString &_header, - bool _update ) -{ - mLabel[0]->setText(_header); - mText[0]->setText(_text); - if( _update ) { updateLayout(); } -} - - -void TDEAboutContributor::setEmail( const TQString &_text, const TQString &_header, - bool _update ) -{ - mLabel[1]->setText(_header); - KURLLabel* const kurl = static_cast<KURLLabel *>(mText[1]); - kurl->setText(_text); - kurl->setURL(_text); - if( _update ) { updateLayout(); } -} - - -void TDEAboutContributor::setURL( const TQString &_text, const TQString &_header, - bool _update ) -{ - mLabel[2]->setText(_header); - KURLLabel* const kurl = static_cast<KURLLabel *>(mText[2]); - kurl->setText(_text); - kurl->setURL(_text); - if( _update ) { updateLayout(); } -} - - -void TDEAboutContributor::setWork( const TQString &_text, const TQString &_header, - bool _update ) -{ - mLabel[3]->setText(_header); - mText[3]->setText(_text); - if( _update ) { updateLayout(); } -} - - -TQString TDEAboutContributor::getName( void ) const -{ - return mText[0]->text(); -} - - -TQString TDEAboutContributor::getEmail( void ) const -{ - return mText[1]->text(); -} - - -TQString TDEAboutContributor::getURL( void ) const -{ - return mText[2]->text(); -} - - -TQString TDEAboutContributor::getWork( void ) const -{ - return mText[3]->text(); -} - - - -void TDEAboutContributor::updateLayout( void ) -{ - delete layout(); - - int row = 0; - if( !mText[0]->text().isEmpty() ) { ++row; } - if( !mText[1]->text().isEmpty() ) { ++row; } - if( !mText[2]->text().isEmpty() ) { ++row; } - if( !mText[3]->text().isEmpty() ) { ++row; } - - - TQGridLayout *gbox; - if( row == 0 ) - { - gbox = new TQGridLayout( this, 1, 1, 0 ); - for( int i=0; i<4; ++i ) - { - mLabel[i]->hide(); - mText[i]->hide(); - } - } - else - { - if( mText[0]->text().isEmpty() && !mShowHeader ) - { - gbox = new TQGridLayout( this, row, 1, frameWidth()+1, 2 ); - } - else - { - gbox = new TQGridLayout( this, row, 2, frameWidth()+1, 2 ); - if( !mShowHeader ) - { - gbox->addColSpacing( 0, KDialog::spacingHint()*2 ); - } - gbox->setColStretch( 1, 10 ); - } - - for( int i=0, r=0; i<4; ++i ) - { - mLabel[i]->setFixedHeight( fontMetrics().lineSpacing() ); - if( i != 3 ) - { - mText[i]->setFixedHeight( fontMetrics().lineSpacing() ); - } - - if( !mText[i]->text().isEmpty() ) - { - if( mShowHeader ) - { - gbox->addWidget( TQT_TQWIDGET(mLabel[i]), r, 0, (TQ_Alignment)AlignLeft ); - gbox->addWidget( TQT_TQWIDGET(mText[i]), r, 1, (TQ_Alignment)AlignLeft ); - mLabel[i]->show(); - mText[i]->show(); - } - else - { - mLabel[i]->hide(); - if( !i ) - { - gbox->addMultiCellWidget( TQT_TQWIDGET(mText[i]), r, r, 0, 1, (TQ_Alignment)AlignLeft ); - } - else - { - gbox->addWidget( TQT_TQWIDGET(mText[i]), r, 1, (TQ_Alignment)AlignLeft ); - } - mText[i]->show(); - } - ++r; - } - else - { - mLabel[i]->hide(); - mText[i]->hide(); - } - } - } - - gbox->activate(); - setMinimumSize( sizeHint() ); -} - - -void TDEAboutContributor::fontChange( const TQFont &/*oldFont*/ ) -{ - if( mShowBold ) - { - TQFont f( font() ); - f.setBold( true ); - mText[0]->setFont( f ); - } - update(); -} - - -TQSize TDEAboutContributor::sizeHint( void ) const -{ - return minimumSizeHint(); -} - - -void TDEAboutContributor::urlClickedSlot( const TQString &u ) -{ - emit openURL(u); -} - - -void TDEAboutContributor::emailClickedSlot( const TQString &e ) -{ - emit sendEmail( mText[0]->text(), e ) ; -} - - -// -// Internal widget for the TDEAboutDialog class. -// -TDEAboutContainerBase::TDEAboutContainerBase( int layoutType, TQWidget *_parent, - char *_name ) - : TQWidget( _parent, _name ), - mImageLabel(0), mTitleLabel(0), mIconLabel(0),mVersionLabel(0), - mAuthorLabel(0), mImageFrame(0),mPageTab(0),mPlainSpace(0),d(0) -{ - mTopLayout = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); - if( !mTopLayout ) { return; } - - if( layoutType & AbtImageOnly ) - { - layoutType &= ~(AbtImageLeft|AbtImageRight|AbtTabbed|AbtPlain); - } - if( layoutType & AbtImageLeft ) - { - layoutType &= ~AbtImageRight; - } - - if( layoutType & AbtTitle ) - { - mTitleLabel = new TQLabel( this, "title" ); - mTitleLabel->setAlignment(AlignCenter); - mTopLayout->addWidget( mTitleLabel ); - mTopLayout->addSpacing( KDialog::spacingHint() ); - } - - if( layoutType & AbtProduct ) - { - TQWidget* const productArea = new TQWidget( this, "area" ); - mTopLayout->addWidget( productArea, 0, TQApplication::reverseLayout() ? AlignRight : AlignLeft ); - - TQHBoxLayout* const hbox = new TQHBoxLayout(productArea,0,KDialog::spacingHint()); - if( !hbox ) { return; } - - mIconLabel = new TQLabel( productArea ); - hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter ); - - TQVBoxLayout* const vbox = new TQVBoxLayout(); - if( !vbox ) { return; } - hbox->addLayout( vbox ); - - mVersionLabel = new TQLabel( productArea, "version" ); - mAuthorLabel = new TQLabel( productArea, "author" ); - vbox->addWidget( mVersionLabel ); - vbox->addWidget( mAuthorLabel ); - hbox->activate(); - - mTopLayout->addSpacing( KDialog::spacingHint() ); - } - - TQHBoxLayout* const hbox = new TQHBoxLayout(); - if( !hbox ) { return; } - mTopLayout->addLayout( hbox, 10 ); - - if( layoutType & AbtImageLeft ) - { - TQVBoxLayout* vbox = new TQVBoxLayout(); - hbox->addLayout(vbox); - vbox->addSpacing(1); - mImageFrame = new TQFrame( this ); - setImageFrame( true ); - vbox->addWidget( mImageFrame ); - vbox->addSpacing(1); - - vbox = new TQVBoxLayout( mImageFrame, 1 ); - mImageLabel = new KImageTrackLabel( mImageFrame ); - connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )), - TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) ); - vbox->addStretch(10); - vbox->addWidget( mImageLabel ); - vbox->addStretch(10); - vbox->activate(); - } - - if( layoutType & AbtTabbed ) - { - mPageTab = new TDEAboutTabWidget( this ); - if( !mPageTab ) { return; } - hbox->addWidget( mPageTab, 10 ); - } - else if( layoutType & AbtImageOnly ) - { - mImageFrame = new TQFrame( this ); - setImageFrame( true ); - hbox->addWidget( mImageFrame, 10 ); - - TQGridLayout* const gbox = new TQGridLayout(mImageFrame, 3, 3, 1, 0 ); - gbox->setRowStretch( 0, 10 ); - gbox->setRowStretch( 2, 10 ); - gbox->setColStretch( 0, 10 ); - gbox->setColStretch( 2, 10 ); - - mImageLabel = new KImageTrackLabel( mImageFrame ); - connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )), - TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) ); - gbox->addWidget( mImageLabel, 1, 1 ); - gbox->activate(); - } - else - { - mPlainSpace = new TQFrame( this ); - if( !mPlainSpace ) { return; } - hbox->addWidget( mPlainSpace, 10 ); - } - - if( layoutType & AbtImageRight ) - { - TQVBoxLayout *vbox = new TQVBoxLayout(); - hbox->addLayout(vbox); - vbox->addSpacing(1); - mImageFrame = new TQFrame( this ); - setImageFrame( true ); - vbox->addWidget( mImageFrame ); - vbox->addSpacing(1); - - vbox = new TQVBoxLayout( mImageFrame, 1 ); - mImageLabel = new KImageTrackLabel( mImageFrame ); - connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )), - TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) ); - vbox->addStretch(10); - vbox->addWidget( mImageLabel ); - vbox->addStretch(10); - vbox->activate(); - } - - fontChange( font() ); -} - - -void TDEAboutContainerBase::show( void ) -{ - TQWidget::show(); -} - -TQSize TDEAboutContainerBase::sizeHint( void ) const -{ - return minimumSize().expandedTo( TQSize( TQWidget::sizeHint().width(), 0 ) ); -} - -void TDEAboutContainerBase::fontChange( const TQFont &/*oldFont*/ ) -{ - if( mTitleLabel ) - { - TQFont f( TDEGlobalSettings::generalFont() ); - f.setBold( true ); - int fs = f.pointSize(); - if (fs == -1) - fs = TQFontInfo(f).pointSize(); - f.setPointSize( fs+2 ); // Lets not make it too big - mTitleLabel->setFont(f); - } - - if( mVersionLabel ) - { - TQFont f( TDEGlobalSettings::generalFont() ); - f.setBold( true ); - mVersionLabel->setFont(f); - mAuthorLabel->setFont(f); - mVersionLabel->parentWidget()->layout()->activate(); - } - - update(); -} - -TQFrame *TDEAboutContainerBase::addTextPage( const TQString &title, - const TQString &text, - bool richText, int numLines ) -{ - TQFrame* const page = addEmptyPage( title ); - if( !page ) { return 0; } - if( numLines <= 0 ) { numLines = 10; } - - TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() ); - - if( richText ) - { - KTextBrowser* const browser = new KTextBrowser( page, "browser" ); - browser->setHScrollBarMode( TQScrollView::AlwaysOff ); - browser->setText( text ); - browser->setMinimumHeight( fontMetrics().lineSpacing()*numLines ); - - vbox->addWidget(browser); - connect(browser, TQT_SIGNAL(urlClick(const TQString &)), - TQT_SLOT(slotUrlClick(const TQString &))); - connect(browser, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), - TQT_SLOT(slotMailClick(const TQString &,const TQString &))); - } - else - { - KTextEdit* const textEdit = new KTextEdit( page, "text" ); - textEdit->setReadOnly( true ); - textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines ); - textEdit->setWordWrap( TQTextEdit::NoWrap ); - vbox->addWidget( textEdit ); - } - - return page; -} - -TQFrame *TDEAboutContainerBase::addLicensePage( const TQString &title, - const TQString &text, int numLines) -{ - TQFrame* const page = addEmptyPage( title ); - if( !page ) { return 0; } - if( numLines <= 0 ) { numLines = 10; } - - TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() ); - - KTextEdit* const textEdit = new KTextEdit( page, "license" ); - textEdit->setFont( TDEGlobalSettings::fixedFont() ); - textEdit->setReadOnly( true ); - textEdit->setWordWrap( TQTextEdit::NoWrap ); - textEdit->setText( text ); - textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines ); - vbox->addWidget( textEdit ); - return page; -} - - -TDEAboutContainer *TDEAboutContainerBase::addContainerPage( const TQString &title, - int childAlignment, - int innerAlignment ) -{ - if( !mPageTab ) - { - kdDebug(291) << "addPage: " << "Invalid layout" << endl; - return 0; - } - - TDEAboutContainer* const container = new TDEAboutContainer( mPageTab, "container", - KDialog::spacingHint(), KDialog::spacingHint(), childAlignment, - innerAlignment ); - mPageTab->addTab( container, title ); - - connect(container, TQT_SIGNAL(urlClick(const TQString &)), - TQT_SLOT(slotUrlClick(const TQString &))); - connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), - TQT_SLOT(slotMailClick(const TQString &,const TQString &))); - - return container; -} - - -TDEAboutContainer *TDEAboutContainerBase::addScrolledContainerPage( - const TQString &title, - int childAlignment, - int innerAlignment ) -{ - if( !mPageTab ) - { - kdDebug(291) << "addPage: " << "Invalid layout" << endl; - return 0; - } - - TQFrame* const page = addEmptyPage( title ); - TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() ); - TQScrollView* const scrollView = new TQScrollView( page ); - scrollView->viewport()->setBackgroundMode( PaletteBackground ); - vbox->addWidget( scrollView ); - - TDEAboutContainer* const container = new TDEAboutContainer( scrollView, "container", - KDialog::spacingHint(), KDialog::spacingHint(), childAlignment, - innerAlignment ); - scrollView->addChild( container ); - - - connect(container, TQT_SIGNAL(urlClick(const TQString &)), - TQT_SLOT(slotUrlClick(const TQString &))); - connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), - TQT_SLOT(slotMailClick(const TQString &,const TQString &))); - - return container; -} - - -TQFrame *TDEAboutContainerBase::addEmptyPage( const TQString &title ) -{ - if( !mPageTab ) - { - kdDebug(291) << "addPage: " << "Invalid layout" << endl; - return 0; - } - - TQFrame* const page = new TQFrame( mPageTab, title.latin1() ); - page->setFrameStyle( TQFrame::NoFrame ); - - mPageTab->addTab( page, title ); - return page; -} - - -TDEAboutContainer *TDEAboutContainerBase::addContainer( int childAlignment, - int innerAlignment ) -{ - TDEAboutContainer* const container = new TDEAboutContainer( this, "container", - 0, KDialog::spacingHint(), childAlignment, innerAlignment ); - mTopLayout->addWidget( container, 0, childAlignment ); - - connect(container, TQT_SIGNAL(urlClick(const TQString &)), - TQT_SLOT(slotUrlClick(const TQString &))); - connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), - TQT_SLOT(slotMailClick(const TQString &,const TQString &))); - - return container; -} - - - -void TDEAboutContainerBase::setTitle( const TQString &title ) -{ - if( !mTitleLabel ) - { - kdDebug(291) << "setTitle: " << "Invalid layout" << endl; - return; - } - mTitleLabel->setText(title); -} - - -void TDEAboutContainerBase::setImage( const TQString &fileName ) -{ - if( !mImageLabel ) - { - kdDebug(291) << "setImage: " << "Invalid layout" << endl; - return; - } - if( fileName.isNull() ) - { - return; - } - - const TQPixmap logo( fileName ); - if( !logo.isNull() ) - mImageLabel->setPixmap( logo ); - - mImageFrame->layout()->activate(); -} - -void TDEAboutContainerBase::setProgramLogo( const TQString &fileName ) -{ - if( fileName.isNull() ) - { - return; - } - - const TQPixmap logo( fileName ); - setProgramLogo( logo ); -} - -void TDEAboutContainerBase::setProgramLogo( const TQPixmap &pixmap ) -{ - if( !mIconLabel ) - { - kdDebug(291) << "setProgramLogo: " << "Invalid layout" << endl; - return; - } - if( !pixmap.isNull() ) - { - mIconLabel->setPixmap( pixmap ); - } -} - -void TDEAboutContainerBase::setImageBackgroundColor( const TQColor &color ) -{ - if( mImageFrame ) - { - mImageFrame->setBackgroundColor( color ); - } -} - - -void TDEAboutContainerBase::setImageFrame( bool state ) -{ - if( mImageFrame ) - { - if( state ) - { - mImageFrame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); - mImageFrame->setLineWidth(1); - } - else - { - mImageFrame->setFrameStyle( TQFrame::NoFrame ); - mImageFrame->setLineWidth(0); - } - } -} - - -void TDEAboutContainerBase::setProduct( const TQString &appName, - const TQString &version, - const TQString &author, - const TQString &year ) -{ - if( !mIconLabel ) - { - kdDebug(291) << "setProduct: " << "Invalid layout" << endl; - return; - } - - if ( kapp ) - { - mIconLabel->setPixmap( kapp->icon() ); - kdDebug(291) << "setPixmap (iconName): " << kapp->iconName() << endl; - } - else - kdDebug(291) << "no kapp" << endl; - - const TQString msg1 = i18n("%1 %2 (Using Trinity %3)").arg(appName).arg(version). - arg(TQString::fromLatin1(TDE_VERSION_STRING)); - const TQString msg2 = !year.isEmpty() ? i18n("%1 %2, %3").arg('©').arg(year). - arg(author) : TQString::fromLatin1(""); - - //if (!year.isEmpty()) - // msg2 = i18n("%1 %2, %3").arg('©').arg(year).arg(author); - - mVersionLabel->setText( msg1 ); - mAuthorLabel->setText( msg2 ); - if( msg2.isEmpty() ) - { - mAuthorLabel->hide(); - } - - mIconLabel->parentWidget()->layout()->activate(); -} - - -void TDEAboutContainerBase::slotMouseTrack( int mode, const TQMouseEvent *e ) -{ - emit mouseTrack( mode, e ); -} - - -void TDEAboutContainerBase::slotUrlClick( const TQString &url ) -{ - emit urlClick( url ); -} - -void TDEAboutContainerBase::slotMailClick( const TQString &_name, - const TQString &_address ) -{ - emit mailClick( _name, _address ); -} - - - -TDEAboutContainer::TDEAboutContainer( TQWidget *_parent, const char *_name, - int _margin, int _spacing, - int childAlignment, int innerAlignment ) - : TQFrame( _parent, _name ), d(0) -{ - mAlignment = innerAlignment; - - TQGridLayout* const gbox = new TQGridLayout( this, 3, 3, _margin, _spacing ); - if( childAlignment & AlignHCenter ) - { - gbox->setColStretch( 0, 10 ); - gbox->setColStretch( 2, 10 ); - } - else if( childAlignment & AlignRight ) - { - gbox->setColStretch( 0, 10 ); - } - else - { - gbox->setColStretch( 2, 10 ); - } - - if( childAlignment & AlignVCenter ) - { - gbox->setRowStretch( 0, 10 ); - gbox->setRowStretch( 2, 10 ); - } - else if( childAlignment & AlignRight ) - { - gbox->setRowStretch( 0, 10 ); - } - else - { - gbox->setRowStretch( 2, 10 ); - } - - mVbox = new TQVBoxLayout( _spacing ); - gbox->addLayout( mVbox, 1, 1 ); - gbox->activate(); -} - - -void TDEAboutContainer::childEvent( TQChildEvent *e ) -{ - if( !e->inserted() || !e->child()->isWidgetType() ) - { - return; - } - - TQWidget* const w = static_cast<TQWidget *>(e->child()); - mVbox->addWidget( w, 0, mAlignment ); - const TQSize s( sizeHint() ); - setMinimumSize( s ); - - TQObjectList const l = childrenListObject(); // silence please - TQObjectListIterator itr( l ); - TQObject * o; - while ( (o = itr.current()) ) { - ++itr; - if( o->isWidgetType() ) - { - TQT_TQWIDGET(o)->setMinimumWidth( s.width() ); - } - } -} - - -TQSize TDEAboutContainer::sizeHint( void ) const -{ - // - // The size is computed by adding the sizeHint().height() of all - // widget children and taking the width of the widest child and adding - // layout()->margin() and layout()->spacing() - // - - TQSize total_size; - - int numChild = 0; - TQObjectList const l = childrenListObject(); // silence please - - TQObjectListIterator itr( l ); - TQObject * o; - while ( (o = itr.current()) ) { - ++itr; - if( o->isWidgetType() ) - { - ++numChild; - TQWidget* const w= TQT_TQWIDGET(o); - - TQSize s = w->minimumSize(); - if( s.isEmpty() ) - { - s = w->minimumSizeHint(); - if( s.isEmpty() ) - { - s = w->sizeHint(); - if( s.isEmpty() ) - { - s = TQSize( 100, 100 ); // Default size - } - } - } - total_size.setHeight( total_size.height() + s.height() ); - if( s.width() > total_size.width() ) { total_size.setWidth( s.width() ); } - } - } - - if( numChild > 0 ) - { - // - // Seems I have to add 1 to the height to properly show the border - // of the last entry if layout()->margin() is 0 - // - - total_size.setHeight( total_size.height() + layout()->spacing()*(numChild-1) ); - total_size += TQSize( layout()->margin()*2, layout()->margin()*2 + 1 ); - } - else - { - total_size = TQSize( 1, 1 ); - } - return total_size; -} - - -TQSize TDEAboutContainer::minimumSizeHint( void ) const -{ - return sizeHint(); -} - - -void TDEAboutContainer::addWidget( TQWidget *widget ) -{ - widget->reparent( this, 0, TQPoint(0,0) ); -} - - -void TDEAboutContainer::addPerson( const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_task, - bool showHeader, bool showFrame,bool showBold) -{ - - TDEAboutContributor* const cont = new TDEAboutContributor( this, "pers", - _name, _email, _url, _task, showHeader, showFrame, showBold ); - connect( cont, TQT_SIGNAL( openURL(const TQString&)), - this, TQT_SIGNAL( urlClick(const TQString &))); - connect( cont, TQT_SIGNAL( sendEmail(const TQString &, const TQString &)), - this, TQT_SIGNAL( mailClick(const TQString &, const TQString &))); -} - - -void TDEAboutContainer::addTitle( const TQString &title, int alignment, - bool showFrame, bool showBold ) -{ - - TQLabel* const label = new TQLabel( title, this, "title" ); - if( showBold ) - { - TQFont labelFont( font() ); - labelFont.setBold( true ); - label->setFont( labelFont ); - } - if( showFrame ) - { - label->setFrameStyle(TQFrame::Panel | TQFrame::Raised); - } - label->setAlignment( alignment ); -} - - -void TDEAboutContainer::addImage( const TQString &fileName, int alignment ) -{ - if( fileName.isNull() ) - { - return; - } - - KImageTrackLabel* const label = new KImageTrackLabel( this, "image" ); - const TQImage logo( fileName ); - if( !logo.isNull() ) - { - TQPixmap pix; - pix = logo; - label->setPixmap( pix ); - } - label->setAlignment( alignment ); -} - -#if 0 -//MOC_SKIP_BEGIN - -/** Every person displayed is stored in a TDEAboutContributor object. - * Every contributor, the author and/or the maintainer of the application are - * stored in objects of this local class. Every single field may be empty. - * To add a contributor, create a TDEAboutContributor object as a child of your - * @ref TDEAboutDialog, set its contents and add it using add addContributor. */ -class TDEAboutContributor : public QFrame -{ - // ############################################################################ - Q_OBJECT - // ---------------------------------------------------------------------------- -public: - /** The Qt constructor. */ - TDEAboutContributor(TQWidget* parent=0, const char* name=0); - /** Set the name (a literal string). */ - void setName(const TQString&); - /** Get the name. */ - TQString getName(); - /** The email address (dito). */ - void setEmail(const TQString&); - /** Get the email address. */ - TQString getEmail(); - /** The URL (dito). */ - void setURL(const TQString&); - /** Get the URL. */ - TQString getURL(); - /** The tasks the person worked on (a literal string). More than one line is - * possible, but very long texts might look ugly. */ - void setWork(const TQString&); - /** The size hint. Very important here, since TDEAboutWidget relies on it for - * geometry management. */ - TQSize sizeHint(); - TQSize minimumSizeHint(void); - virtual void show( void ); - - // ---------------------------------------------------------------------------- -protected: - // events: - /** The resize event. */ - void resizeEvent(TQResizeEvent*); - /** The paint event. */ - void paintEvent(TQPaintEvent*); - /** The label showing the program version. */ - TQLabel *name; - /** The clickable URL label showing the email address. It is only visible if - * its text is not empty. */ - KURLLabel *email; - /** Another interactive part that displays the homepage URL. */ - KURLLabel *url; - /** The description of the contributions of the person. */ - TQString work; - // ---------------------------------------------------------------------------- -protected slots: - /** The homepage URL has been clicked. */ - void urlClickedSlot(const TQString&); - /** The email address has been clicked. */ - void emailClickedSlot(const TQString& emailaddress); - // ---------------------------------------------------------------------------- -signals: - /** The email address has been clicked. */ - void sendEmail(const TQString& name, const TQString& email); - /** The URL has been clicked. */ - void openURL(const TQString& url); - // ############################################################################ -}; - - - -TDEAboutContributor::TDEAboutContributor(TQWidget* parent, const char* n) - : TQFrame(parent, n), - name(new TQLabel(this)), - email(new KURLLabel(this)), - url(new KURLLabel(this)) -{ - // ############################################################ - if(name==0 || email==0) - { // this will nearly never happen (out of memory in about box?) - kdDebug() << "TDEAboutContributor::TDEAboutContributor: Out of memory." << endl; - tqApp->quit(); - } - setFrameStyle(TQFrame::Panel | TQFrame::Raised); - // ----- - connect(email, TQT_SIGNAL(leftClickedURL(const TQString&)), - TQT_SLOT(emailClickedSlot(const TQString&))); - connect(url, TQT_SIGNAL(leftClickedURL(const TQString&)), - TQT_SLOT(urlClickedSlot(const TQString&))); - // ############################################################ -} - -void -TDEAboutContributor::setName(const TQString& n) -{ - // ############################################################ - name->setText(n); - // ############################################################ -} - -QString -TDEAboutContributor::getName() -{ - // ########################################################### - return name->text(); - // ########################################################### -} -void -TDEAboutContributor::setURL(const TQString& u) -{ - // ########################################################### - url->setText(u); - // ########################################################### -} - -QString -TDEAboutContributor::getURL() -{ - // ########################################################### - return url->text(); - // ########################################################### -} - -void -TDEAboutContributor::setEmail(const TQString& e) -{ - // ########################################################### - email->setText(e); - // ########################################################### -} - -QString -TDEAboutContributor::getEmail() -{ - // ########################################################### - return email->text(); - // ########################################################### -} - -void -TDEAboutContributor::emailClickedSlot(const TQString& e) -{ - // ########################################################### - kdDebug() << "TDEAboutContributor::emailClickedSlot: called." << endl; - emit(sendEmail(name->text(), e)); - // ########################################################### -} - -void -TDEAboutContributor::urlClickedSlot(const TQString& u) -{ - // ########################################################### - kdDebug() << "TDEAboutContributor::urlClickedSlot: called." << endl; - emit(openURL(u)); - // ########################################################### -} - -void -TDEAboutContributor::setWork(const TQString& w) -{ - // ########################################################### - work=w; - // ########################################################### -} - -#endif - - -#if 0 -QSize -TDEAboutContributor::sizeHint() -{ - // ############################################################################ - const int FrameWidth=frameWidth(); - const int WorkTextWidth=200; - int maxx, maxy; - TQRect rect; - // ----- first calculate name and email width: - maxx=name->sizeHint().width(); - maxx=QMAX(maxx, email->sizeHint().width()+WORKTEXT_IDENTATION); - // ----- now determine "work" text rectangle: - if(!work.isEmpty()) // save time - { - rect=fontMetrics().boundingRect - (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work); - } - if(maxx<rect.width()) - { - maxx=WorkTextWidth+WORKTEXT_IDENTATION; - } - maxx=QMAX(maxx, url->sizeHint().width()+WORKTEXT_IDENTATION); - // ----- - maxy=2*(name->sizeHint().height()+Grid); // need a space above the KURLLabels - maxy+=/* email */ name->sizeHint().height(); - maxy+=rect.height(); - // ----- - maxx+=2*FrameWidth; - maxy+=2*FrameWidth; - return TQSize(maxx, maxy); - // ############################################################################ -} - -TQSize TDEAboutContributor::minimumSizeHint(void) -{ - return( sizeHint() ); -} - - -void TDEAboutContributor::show( void ) -{ - TQFrame::show(); - setMinimumSize( sizeHint() ); -} - - - -void -TDEAboutContributor::resizeEvent(TQResizeEvent*) -{ // the widgets are simply aligned from top to bottom, since the parent is - // expected to respect the size hint - // ############################################################################ - int framewidth=frameWidth(), childwidth=width()-2*framewidth; - int cy=framewidth; - // ----- - name->setGeometry - (framewidth, framewidth, childwidth, name->sizeHint().height()); - cy=name->height()+Grid; - email->setGeometry - (framewidth+WORKTEXT_IDENTATION, cy, - childwidth-WORKTEXT_IDENTATION, /* email */ name->sizeHint().height()); - cy+=name->height()+Grid; - url->setGeometry - (framewidth+WORKTEXT_IDENTATION, cy, - childwidth-WORKTEXT_IDENTATION, /* url */ name->sizeHint().height()); - // the work text is drawn in the paint event - // ############################################################################ -} - - -void -TDEAboutContributor::paintEvent(TQPaintEvent* e) -{ // the widgets are simply aligned from top to bottom, since the parent is - // expected to respect the size hint (the widget is only used locally by now) - // ############################################################################ - int cy=frameWidth()+name->height()+email->height()+Grid+url->height()+Grid; - int h=height()-cy-frameWidth(); - int w=width()-WORKTEXT_IDENTATION-2*frameWidth(); - // ----- - TQFrame::paintEvent(e); - if(work.isEmpty()) return; - TQPainter paint(this); // construct painter only if there is something to draw - // ----- - paint.drawText(WORKTEXT_IDENTATION, cy, w, h, AlignLeft | WordBreak, work); - // ############################################################################ -} -// MOC_SKIP_END -#endif - - -#if 0 -TQSize TDEAboutContributor::sizeHint( void ) -{ - int s = KDialog::spacingHint(); - int h = fontMetrics().lineSpacing()*3 + 2*s; - int m = frameWidth(); - - int w = name->sizeHint().width(); - w = QMAX( w, email->sizeHint().width()+s); - w = QMAX( w, url->sizeHint().width()+s); - - if( work.isEmpty() == false ) - { - const int WorkTextWidth=200; - TQRect r = fontMetrics().boundingRect - (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work); - if( w < r.width() ) - { - w = QMAX( w, WorkTextWidth+s ); - } - h += QMAX( fontMetrics().lineSpacing(), r.height() ) + s; - } - return( TQSize( w + 2*m, h + 2*m ) ); - - - /* - int s = 3; - int m = frameWidth() + KDialog::spacingHint(); - int h = ls * 3 + s * 2; - int w = name->sizeHint().width(); - - w = QMAX( w, email->sizeHint().width()+WORKTEXT_IDENTATION); - w = QMAX( w, url->sizeHint().width()+WORKTEXT_IDENTATION); - if( work.isEmpty() == false ) - { - const int WorkTextWidth=200; - - TQRect r = fontMetrics().boundingRect - (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work); - if( w < r.width() ) - { - w = QMAX( w, WorkTextWidth + WORKTEXT_IDENTATION ); - } - h += r.height() + s; - } - return( TQSize( w + 2*m, h + 2*m ) ); - */ -} - - -// -// The widgets are simply aligned from top to bottom, since the parent is -// expected to respect the size hint -// -void TDEAboutContributor::resizeEvent(TQResizeEvent*) -{ - int x = frameWidth(); - int s = KDialog::spacingHint(); - int h = fontMetrics().lineSpacing(); - int w = width() - 2*x; - int y = x; - - name->setGeometry( x, y, w, h ); - y += h + s; - email->setGeometry( x+s, y, w-s, h ); - y += h + s; - url->setGeometry( x+s, y, w-s, h ); - - /* - int x = frameWidth() + KDialog::spacingHint(); - int y = x; - int w = width() - 2*x; - int h = name->sizeHint().height(); - int s = 3; - - name->setGeometry( x, y, w, h ); - y += h + s; - email->setGeometry( x+WORKTEXT_IDENTATION, y, w-WORKTEXT_IDENTATION, h ); - y += h + s; - url->setGeometry( x+WORKTEXT_IDENTATION, y, w-WORKTEXT_IDENTATION, h ); - // - // the work text is drawn in the paint event - // - */ -} - - - -void TDEAboutContributor::paintEvent( TQPaintEvent *e ) -{ - TQFrame::paintEvent(e); - if(work.isEmpty()) return; - - int x = frameWidth() + KDialog::spacingHint(); - int h = fontMetrics().lineSpacing(); - int y = height() - frameWidth() - fontMetrics().lineSpacing(); - int w = width() - frameWidth()*2 - KDialog::spacingHint(); - - TQPainter paint( this ); - paint.drawText( x, y, w, h, AlignLeft | WordBreak, work ); - - /* - - int s = 3; - int x = frameWidth() + KDialog::spacingHint() + WORKTEXT_IDENTATION; - int w = width()-WORKTEXT_IDENTATION-2*(frameWidth()+KDialog::spacingHint()); - int y = frameWidth()+KDialog::spacingHint()+(name->sizeHint().height()+s)*3; - int h = height()-y-frameWidth(); - - TQPainter paint( this ); - paint.drawText( x, y, w, h, AlignLeft | WordBreak, work ); - */ -} -#endif - - - - - - -TDEAboutWidget::TDEAboutWidget(TQWidget *_parent, const char *_name) - : TQWidget(_parent, _name), - version(new TQLabel(this)), - cont(new TQLabel(this)), - logo(new TQLabel(this)), - author(new TDEAboutContributor(this)), - maintainer(new TDEAboutContributor(this)), - showMaintainer(false), - d(0) -{ - // ################################################################# - if( !version || !cont || !logo || !author || !maintainer ) - { - // this will nearly never happen (out of memory in about box?) - kdDebug() << "TDEAboutWidget::TDEAboutWidget: Out of memory." << endl; - tqApp->quit(); - } - // ----- - cont->setText(i18n("Other Contributors:")); - logo->setText(i18n("(No logo available)")); - logo->setFrameStyle(TQFrame::Panel | TQFrame::Raised); - version->setAlignment(AlignCenter); - // ----- - connect(author, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), - TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); - connect(author, TQT_SIGNAL(openURL(const TQString&)), - TQT_SLOT(openURLSlot(const TQString&))); - connect(maintainer, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), - TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); - connect(maintainer, TQT_SIGNAL(openURL(const TQString&)), - TQT_SLOT(openURLSlot(const TQString&))); - // ################################################################# -} - - -void -TDEAboutWidget::adjust() -{ - // ################################################################# - int cx, cy, tempx; - int maintWidth, maintHeight; - TQSize total_size; - // ----- - if(showMaintainer) - { - total_size=maintainer->sizeHint(); - maintWidth=total_size.width(); - maintHeight=total_size.height(); - } else { - maintWidth=0; - maintHeight=0; - } - total_size=author->sizeHint(); - logo->adjustSize(); - cy=version->sizeHint().height()+Grid; - cx=logo->width(); - tempx=QMAX(total_size.width(), maintWidth); - cx+=Grid+tempx; - cx=QMAX(cx, version->sizeHint().width()); - cy+=QMAX(logo->height(), - total_size.height()+(showMaintainer ? Grid+maintHeight : 0)); - // ----- - if(!contributors.isEmpty()) - { - cx=QMAX(cx, cont->sizeHint().width()); - cy+=cont->sizeHint().height()+Grid; - TQPtrListIterator<TDEAboutContributor> _pos(contributors); - TDEAboutContributor* currEntry; - while ( (currEntry = _pos.current()) ) - { - ++_pos; - cy+=currEntry->sizeHint().height(); - } - } - // ----- - setMinimumSize(cx, cy); - // ################################################################# -} - -void -TDEAboutWidget::setLogo(const TQPixmap& i) -{ - // ############################################################################ - logo->setPixmap(i); - // ############################################################################ -} - -void TDEAboutWidget::sendEmailSlot(const TQString &_name, const TQString &_email) -{ - emit(sendEmail(_name, _email)); -} - -void TDEAboutWidget::openURLSlot(const TQString& _url) -{ - emit(openURL(_url)); -} - -void -TDEAboutWidget::setAuthor(const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_w) -{ - // ############################################################################ - author->setName(_name); - author->setEmail(_email); - author->setURL(_url); - author->setWork(_w); - // ############################################################################ -} - -void -TDEAboutWidget::setMaintainer(const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_w) -{ - // ############################################################################ - maintainer->setName(_name); - maintainer->setEmail(_email); - maintainer->setWork(_w); - maintainer->setURL(_url); - showMaintainer=true; - // ############################################################################ -} - -void -TDEAboutWidget::addContributor(const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_w) -{ - // ############################################################################ - TDEAboutContributor* const c=new TDEAboutContributor(this); - // ----- - c->setName(_name); - c->setEmail(_email); - c->setURL(_url); - c->setWork(_w); - contributors.append(c); - connect(c, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), - TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); - connect(c, TQT_SIGNAL(openURL(const TQString&)), TQT_SLOT(openURLSlot(const TQString&))); - // ############################################################################ -} - -void -TDEAboutWidget::setVersion(const TQString &_name) -{ - // ############################################################################ - version->setText(_name); - // ############################################################################ -} - -void -TDEAboutWidget::resizeEvent(TQResizeEvent*) -{ - // ############################################################################ - int _x=0, _y, cx, tempx, tempy; - // ----- set version label geometry: - version->setGeometry(0, 0, width(), version->sizeHint().height()); - _y=version->height()+Grid; - // ----- move logo to correct position: - logo->adjustSize(); - logo->move(0, _y); - // ----- move author and maintainer right to it: - tempx=logo->width()+Grid; - cx=width()-tempx; - author->setGeometry - (tempx, _y, cx, author->sizeHint().height()); - maintainer->setGeometry - (tempx, _y+author->height()+Grid, cx, maintainer->sizeHint().height()); - - _y+=QMAX(logo->height(), - author->height()+(showMaintainer ? Grid+maintainer->height() : 0)); - // ----- - if(!contributors.isEmpty()) - { - tempy=cont->sizeHint().height(); - cont->setGeometry(0, _y, width(), tempy); - cont->show(); - _y+=tempy+Grid; - } else { - cont->hide(); - } - TQPtrListIterator<TDEAboutContributor> _pos(contributors); - TDEAboutContributor* currEntry; - while( (currEntry = _pos.current()) ) - { - ++_pos; - tempy=currEntry->sizeHint().height(); - // y+=Grid; - currEntry->setGeometry(_x, _y, width(), tempy); - _y+=tempy; - } - if(showMaintainer) - { - maintainer->show(); - } else { - maintainer->hide(); - } - // ############################################################################ -} - -TDEAboutDialog::TDEAboutDialog(TQWidget *_parent, const char *_name, bool modal) - : KDialogBase(_parent, _name, modal, TQString::null, Ok, Ok ), - about(new TDEAboutWidget(this)), mContainerBase(0), d(0) -{ - // ################################################################# - if(!about) - { - // this will nearly never happen (out of memory in about box?) - kdDebug() << "TDEAboutDialog::TDEAboutDialog: Out of memory." << endl; - tqApp->quit(); - } - setMainWidget(about); - connect(about, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), - TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); - connect(about, TQT_SIGNAL(openURL(const TQString&)), - TQT_SLOT(openURLSlot(const TQString&))); - // ################################################################# -} - - -TDEAboutDialog::TDEAboutDialog( int layoutType, const TQString &_caption, - int buttonMask, ButtonCode defaultButton, - TQWidget *_parent, const char *_name, bool modal, - bool separator, const TQString &user1, - const TQString &user2, const TQString &user3 ) - :KDialogBase( _parent, _name, modal, TQString::null, buttonMask, defaultButton, - separator, user1, user2, user3 ), - about(0), d(0) -{ - setPlainCaption( i18n("About %1").arg(_caption) ); - - mContainerBase = new TDEAboutContainerBase( layoutType, this ); - setMainWidget(mContainerBase); - - connect( mContainerBase, TQT_SIGNAL(urlClick(const TQString &)), - this, TQT_SLOT(openURLSlot(const TQString &))); - connect( mContainerBase, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), - this, TQT_SLOT(sendEmailSlot(const TQString &,const TQString &))); - connect( mContainerBase, TQT_SIGNAL(mouseTrack(int, const TQMouseEvent *)), - this, TQT_SLOT(mouseTrackSlot(int, const TQMouseEvent *))); -} - - -void TDEAboutDialog::show( void ) -{ - adjust(); - if( mContainerBase ) { mContainerBase->show(); } - TQDialog::show(); -} - - -void TDEAboutDialog::show( TQWidget * /*centerParent*/ ) -{ - adjust(); - if( mContainerBase ) { mContainerBase->show(); } - TQDialog::show(); -} - - -void TDEAboutDialog::adjust() -{ - if( !about ) { return; } - about->adjust(); - //initializeGeometry(); - resize( sizeHint() ); -} - - -void TDEAboutDialog::setLogo(const TQPixmap& i) -{ - if( !about ) { return; } - about->setLogo(i); -} - - -void TDEAboutDialog::setMaintainer(const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_w) -{ - // ################################################################# - if( !about ) { return; } - about->setMaintainer(_name, _email, _url, _w); - // ################################################################# -} - -void TDEAboutDialog::setAuthor(const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_work) -{ - // ################################################################# - if( !about ) { return; } - about->setAuthor(_name, _email, _url, _work); - // ################################################################# -} - -void TDEAboutDialog::addContributor(const TQString &_name, const TQString &_email, - const TQString &_url, const TQString &_w) -{ - // ################################################################# - if( !about ) { return; } - about->addContributor(_name, _email, _url, _w); - // ################################################################# -} - -void TDEAboutDialog::setVersion(const TQString &_name) -{ - // ################################################################# - if( !about ) { return; } - about->setVersion(_name); - // ################################################################# -} - -void TDEAboutDialog::sendEmailSlot(const TQString& /*name*/, const TQString& email) -{ - if ( kapp ) - kapp->invokeMailer( email, TQString::null ); - /* - kdDebug() << "TDEAboutDialog::sendEmailSlot: request to send an email to " - << name << ", " << email << endl; - emit(sendEmail(name, email)); - */ -} - -void TDEAboutDialog::openURLSlot(const TQString& url) -{ - if ( kapp ) - kapp->invokeBrowser( url ); - //kdDebug() << "TDEAboutDialog::openURLSlot: request to open URL " << url << endl; - //emit(openURL(url)); -} - - -void TDEAboutDialog::mouseTrackSlot( int /*mode*/, const TQMouseEvent * /*e*/ ) -{ - // By default we do nothing. This method must be reimplemented. -} - - -TQFrame *TDEAboutDialog::addTextPage( const TQString &title, const TQString &text, - bool richText, int numLines ) -{ - if( !mContainerBase ) { return 0; } - return mContainerBase->addTextPage( title, text, richText, numLines ); -} - -TQFrame *TDEAboutDialog::addLicensePage( const TQString &title, const TQString &text, - int numLines ) -{ - if( !mContainerBase ) { return 0; } - return mContainerBase->addLicensePage( title, text, numLines ); -} - - -TDEAboutContainer *TDEAboutDialog::addContainerPage( const TQString &title, - int childAlignment, int innerAlignment ) -{ - if( !mContainerBase ) { return 0; } - return mContainerBase->addContainerPage( title, childAlignment, - innerAlignment); -} - - -TDEAboutContainer *TDEAboutDialog::addScrolledContainerPage( const TQString &title, - int childAlignment, int innerAlignment ) -{ - if( !mContainerBase ) { return 0; } - return mContainerBase->addScrolledContainerPage( title, childAlignment, - innerAlignment); -} - - - -TQFrame *TDEAboutDialog::addPage( const TQString &title ) -{ - if( !mContainerBase ) { return 0; } - return mContainerBase->addEmptyPage( title ); -} - - -TDEAboutContainer *TDEAboutDialog::addContainer( int childAlignment, - int innerAlignment ) -{ - if( !mContainerBase ) { return 0; } - return mContainerBase->addContainer( childAlignment, innerAlignment ); -} - - -void TDEAboutDialog::setTitle( const TQString &title ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setTitle( title ); -} - - -void TDEAboutDialog::setImage( const TQString &fileName ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setImage( fileName ); -} - -// KDE4: remove -void TDEAboutDialog::setIcon( const TQString &fileName ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setProgramLogo( fileName ); -} - -void TDEAboutDialog::setProgramLogo( const TQString &fileName ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setProgramLogo( fileName ); -} - -void TDEAboutDialog::setProgramLogo( const TQPixmap &pixmap ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setProgramLogo( pixmap ); -} - -void TDEAboutDialog::setImageBackgroundColor( const TQColor &color ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setImageBackgroundColor( color ); -} - - -void TDEAboutDialog::setImageFrame( bool state ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setImageFrame( state ); -} - - -void TDEAboutDialog::setProduct( const TQString &appName, const TQString &version, - const TQString &author, const TQString &year ) -{ - if( !mContainerBase ) { return; } - mContainerBase->setProduct( appName, version, author, year ); -} - - - -void TDEAboutDialog::imageURL( TQWidget *_parent, const TQString &_caption, - const TQString &_path, const TQColor &_imageColor, - const TQString &_url ) -{ - TDEAboutDialog a( AbtImageOnly, TQString::null, Close, Close, _parent, "image", true ); - a.setPlainCaption( _caption ); - a.setImage( _path ); - a.setImageBackgroundColor( _imageColor ); - - TDEAboutContainer* const c = a.addContainer( AlignCenter, AlignCenter ); - if( c ) - { - c->addPerson( TQString::null, TQString::null, _url, TQString::null ); - } - a.exec(); -} - - - - -// -// A class that can can monitor mouse movements on the image -// -KImageTrackLabel::KImageTrackLabel( TQWidget *_parent, const char *_name, WFlags f ) - : TQLabel( _parent, _name, f ) -{ - setText( i18n("Image missing")); -} - -void KImageTrackLabel::mousePressEvent( TQMouseEvent *e ) -{ - emit mouseTrack( MousePress, e ); -} - -void KImageTrackLabel::mouseReleaseEvent( TQMouseEvent *e ) -{ - emit mouseTrack( MouseRelease, e ); -} - -void KImageTrackLabel::mouseDoubleClickEvent( TQMouseEvent *e ) -{ - emit mouseTrack( MouseDoubleClick, e ); -} - -void KImageTrackLabel::mouseMoveEvent ( TQMouseEvent *e ) -{ - emit mouseTrack( MouseDoubleClick, e ); -} - -void TDEAboutDialog::virtual_hook( int id, void* data ) -{ KDialogBase::virtual_hook( id, data ); } - diff --git a/tdeui/kaboutdialog.h b/tdeui/kaboutdialog.h deleted file mode 100644 index fbb19b98e..000000000 --- a/tdeui/kaboutdialog.h +++ /dev/null @@ -1,633 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and - * Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -/* - * This file declares a class for creating "About ..." dialogs - * in a general way. It provides geometry management and some - * options to connect for, like emailing the author or maintainer. - */ - - -#ifndef _KABOUTDIALOG_H_ -#define _KABOUTDIALOG_H_ - -#include <kdialogbase.h> -#include <tqstring.h> - -class TQFrame; -class TQLabel; -class TQVBoxLayout; -class TQTabWidget; -class KURLLabel; -class TDEAboutContainer; -class TDEAboutContainerBase; - -class TDEAboutWidgetPrivate; - -class TDEAboutContainerPrivate; -/** - * TDEAboutContainer can be used to make a application specific AboutDialog. - */ -class TDEUI_EXPORT TDEAboutContainer : public TQFrame -{ - Q_OBJECT - - public: - TDEAboutContainer( TQWidget *parent=0, const char *name=0, - int margin=0, int spacing=0, - int childAlignment = AlignCenter, - int innerAlignment = AlignCenter ); - - void addWidget( TQWidget *widget ); - void addPerson( const TQString &name, const TQString &email, - const TQString &url, const TQString &task, - bool showHeader = false, bool showframe = false, - bool showBold = false ); - void addTitle( const TQString &title, int alignment=AlignLeft, - bool showframe = false, bool showBold = false ); - void addImage( const TQString &fileName, int alignment=AlignLeft ); - - virtual TQSize sizeHint( void ) const; - virtual TQSize minimumSizeHint( void ) const; - - protected: - virtual void childEvent( TQChildEvent *e ); - - signals: - void urlClick( const TQString &url ); - void mailClick( const TQString &name, const TQString &address ); - - - private: - TQVBoxLayout *mVbox; - int mAlignment; - TDEAboutContainerPrivate* const d; -}; - -class TDEAboutContributorPrivate; - -/** - * Used internally by TDEAboutWidget - * @internal - */ -class TDEUI_EXPORT TDEAboutContributor : public TQFrame -{ - Q_OBJECT - - public: - TDEAboutContributor( TQWidget *parent=0, const char *name=0, - const TQString &username=TQString::null, - const TQString &email=TQString::null, - const TQString &url=TQString::null, - const TQString &work=TQString::null, - bool showHeader=false, bool showFrame=true, - bool showBold=false ); - - void setName( const TQString &text, const TQString &header=TQString::null, - bool update = true ); - void setEmail( const TQString &text, const TQString &header=TQString::null, - bool update = true ); - void setURL( const TQString &text, const TQString &header=TQString::null, - bool update = true ); - void setWork( const TQString &text, const TQString &header=TQString::null, - bool update = true ); - TQString getName( void ) const; - TQString getEmail( void ) const; - TQString getURL( void ) const; - TQString getWork( void ) const; - - virtual TQSize sizeHint( void ) const; - - protected: - virtual void fontChange( const TQFont &oldFont ); - - protected slots: - void urlClickedSlot( const TQString& ); - void emailClickedSlot( const TQString& emailaddress ); - - private: - void updateLayout( void ); - - signals: - void sendEmail(const TQString& name, const TQString& email); - void openURL(const TQString& url); - - private: - TQLabel *mLabel[4]; - TQLabel *mText[4]; - bool mShowHeader; - bool mShowBold; - - TDEAboutContributorPrivate* const d; - - virtual void setName(const char *_name) { TQFrame::setName(_name); } -}; - -/** - * TDEAboutWidget is the main widget for TDEAboutDialog. - * - * It has a minimum size set. - */ -class TDEUI_EXPORT TDEAboutWidget : public TQWidget -{ - Q_OBJECT - -public: - - /** - * The Qt constructor. - */ - TDEAboutWidget(TQWidget* parent=0, const char* name=0 ); - - /** - * Adjust the minimum size (after setting the properties of the image and - * the labels. - */ - void adjust(); - - /** - * Sets the image as the application logo. - */ - void setLogo(const TQPixmap&); - /** - * Sets the author's name and email address. - */ - void setAuthor(const TQString& name, const TQString& email, - const TQString& url, const TQString& work); - /** - * Sets the maintainers name and email address. - */ - void setMaintainer(const TQString& name, const TQString& email, - const TQString& url, const TQString& work); - /** - * Shows this person as one of the major contributors. - */ - void addContributor(const TQString& name, const TQString& email, - const TQString& url, const TQString& work); - /** - * Sets the text describing the version. - */ - void setVersion(const TQString& name); - // ------------------------------------------------------------------------- -protected slots: - /** - * Catches the signals from the contributors elements. - */ - void sendEmailSlot(const TQString& name, const TQString& email); - /** - * Catches the clicked URLs. - */ - void openURLSlot(const TQString& url); - // ------------------------------------------------------------------------- -signals: - /** - * An email address has been selected by the user. - */ - void sendEmail(const TQString& name, const TQString& email); - /** - * An URL has been clicked. - */ - void openURL(const TQString& url); - // ------------------------------------------------------------------------- -protected: - // events: - /** - * The resize event. - */ - void resizeEvent(TQResizeEvent*); - /** - * The label showing the program version. - */ - TQLabel *version; - /** - * The label showing the text "Other contributors:". - */ - TQLabel *cont; - /** - * The frame showing the logo. - */ - TQLabel *logo; - /** - * The application developer. - */ - TDEAboutContributor *author; - /** - * The application maintainer. - */ - TDEAboutContributor *maintainer; - /** - * Show the maintainer? - */ - bool showMaintainer; - /** - * A set of people who contributed to the application. - */ - TQPtrList<TDEAboutContributor> contributors; - // ######################################################################### - // -private: - TDEAboutWidgetPrivate* const d; -}; - -class TDEAboutDialogPrivate; -/** - * A KDialogBase with predefined main widget. - * - * As a KDialogBase it uses your application wide settings - * for KDialogBase - * objects (base frame tiles, main frame tiles etc). - * To use it, simply create a TDEAboutDialog object, set all (or some) of its - * properties and show it. Do not derive it to create your own about dialog - * until you need some cool features that are unsupported and you have - * contacted me to add them. - * - * The dialog can be created using two different constructors. The - * difference between these constructors is the available components that - * can be used to build the contents of the dialog. The first (Constructor I) - * provides a number of easy to use methods. Basically it allows you - * to add the components of choice, and the components are placed in a - * predefined layout. You do not have to plan the layout. Everything is - * taken care of. - * - * The second constructor (Constructor II) works in quite the same manner - * as the first, but you have better control on where the components - * are postioned in the layout and you have access to an extended number - * of components you can install such as titles, product information, - * a tabbed pages (where you can display rich text with url links) and - * a person (developer) information field. The "About KDE" dialog box is - * created with Constructor II. - * - * For the derived features, see the basic class KDialogBase. - * @author Mirko Boehm (mirko@kde.org) and Espen Sand (espensa@online.no) - * @see KDialogBase - */ -class TDEUI_EXPORT TDEAboutDialog : public KDialogBase -{ - Q_OBJECT - - public: - /** - * Layout formats. - **/ - enum LayoutType - { - AbtPlain = 0x0001, - AbtTabbed = 0x0002, - AbtTitle = 0x0004, - AbtImageLeft = 0x0008, - AbtImageRight = 0x0010, - AbtImageOnly = 0x0020, - AbtProduct = 0x0040, - AbtKDEStandard = AbtTabbed|AbtTitle|AbtImageLeft, - AbtAppStandard = AbtTabbed|AbtTitle|AbtProduct, - AbtImageAndTitle = AbtPlain|AbtTitle|AbtImageOnly - }; - - public: - /** - * The standard Qt constructor (Constructor I). - * - * Add components with the following methods: - * setLogo(), setAuthor(), setMaintainer(), - * addContributor(), or setVersion(). - * The dialog will be laid out automatically. - */ - TDEAboutDialog( TQWidget *parent=0, const char *name=0, bool modal=true ); - - /** - * The extended constructor. (Constructor II). - * - * Add components with the methods: - * setTitle(), setImage(), setImageBackgroundColor(), - * setImageFrame(), setProduct(), addTextPage(), - * addContainerPage(), addContainer(), or addPage(). - * - * @param dialogLayout Use a mask of LayoutType flags. - * @param caption The dialog caption. The text you specify is prepended - * by i18n("About"). - * @param buttonMask Specifies what buttons will be visible. - * @param defaultButton Specifies what button will be marked as the default. - * @param parent Parent of the dialog. - * @param name Dialog name (for internal use only) - * @param modal Sets dialog modality. If false, the rest of the - * program interface (other dialogs, for example) is accessible while - * the dialog is open. - * @param separator If true, a separator line is drawn between the action - * buttons an the main widget. - * @param user1 User button1 text. - * @param user2 User button2 text. - * @param user3 User button3 text. - * - */ - TDEAboutDialog( int dialogLayout, const TQString &caption, int buttonMask, - ButtonCode defaultButton, TQWidget *parent=0, - const char *name=0, bool modal=false, bool separator = false, - const TQString &user1 = TQString::null, - const TQString &user2 = TQString::null, - const TQString &user3 = TQString::null ); - - /** - * Adjusts the dialog. - * - * You can call this method after you have set up all - * the contents but it is not required. It is done automatically when - * show() is executed. - */ - void adjust(); - - /** - * Makes a modeless (modal = false in constructor) dialog visible. - * - * If you reimplement this method make sure you run it - * in the new method (e.g., show()). Reimplemented - * from KDialogBase. - */ - virtual void show( void ); - - /** - * Makes a modeless (modal = false in constructor) dialog visible. - * - * If you reimplmement this method make sure you run it - * in the new method (i.e., show( parent )). - * - * @param centerParent Center the dialog with respect to this widget. - */ - virtual void show( TQWidget *centerParent ); - - /** - * (Constructor II only) - * Sets a title (not caption) in the uppermost area of the dialog. - * - * @param title Title string. - */ - void setTitle( const TQString &title ); - - /** - * (Constructor II only) - * Define an image to be shown in the dialog. The position is dependent - * on the @p dialogLayout in the constructor - * - * @param fileName Path to image file. - */ - void setImage( const TQString &fileName ); - - /** - * (Constructor II only) - * Define the program logo to be shown in the dialog. Use this to override the - * default program logo. For example, use this function if the - * TDEAboutDialog is for a panel applet and you want to override the - * appletproxy logo with your own pixmap. - * - * @param fileName Path to file containing logo data in a format that - * can be loaded by TQPixmap. - * - * @since 3.3 - */ - void setIcon( const TQString &fileName ) KDE_DEPRECATED; // KDE4: remove - - /** - * Overloaded version of setProgramLogo(const TQPixmap& pixmap). - * - * @since 3.4 - */ - void setProgramLogo( const TQString &fileName ); - - /** - * (Constructor II only) - * Define the program logo to be shown in the dialog. Use this to override the - * default program logo. For example, use this function if the - * TDEAboutDialog is for a panel applet and you want to override the - * appletproxy logo with your own pixmap. - * - * @param pixmap The logo pixmap. - * - * @since 3.4 - */ - void setProgramLogo( const TQPixmap &pixmap ); - - /** - * (Constructor II only) - * The image has a minimum size, but is centered within an area if the - * dialog box is enlarged by the user. You set the background color - * of the area with this method. - * - * @param color Background color. - */ - void setImageBackgroundColor( const TQColor &color ); - - /** - * (Constructor II only) - * Enables or disables a frame around the image. The frame is, by default, - * enabled in the constructor - * - * @param state A value of @p true enables the frame - */ - void setImageFrame( bool state ); - - /** - * (Constructor II only) - * Prints the application name, KDE version, author, a copyright sign - * and a year string. To the left of the text the standard application - * icon is displayed. - * - * @param appName The application name. - * @param version Application version. - * @param author One or more authors. - * @param year A string telling when the application was made. - */ - void setProduct( const TQString &appName, const TQString &version, - const TQString &author, const TQString &year ); - - /** - * (Constructor II only) - * Adds a text page to a tab box. The text can be regular text or - * rich text. The rich text can contain URLs and mail links. - * - * @param title Tab name. - * @param text The text to display. - * @param richText Set this to @p true if 'text' is rich text. - * @param numLines The text area height will be adjusted so that this - * is the minimum number of lines of text that are visible. - * @return The frame that contains the page. - */ - TQFrame *addTextPage( const TQString &title, const TQString &text, - bool richText=false, int numLines=10 ); - - /** - * (Constructor II only) - * Adds a license page to a tab box. - * - * @param title Tab name. - * @param text The text to display. - * @param numLines The text area height will be adjusted so that this - * is the minimum number of lines of text that are visible. - * @return The frame that contains the page. - */ - TQFrame *addLicensePage( const TQString &title, const TQString &text, - int numLines=10 ); - - /** - * (Constructor II only) - * Adds a container to a tab box. You can add text and images to a - * container. - * - * @param title Tab name. - * @param childAlignment Specifies how the children of the container are - * aligned with respect to the container. - * @param innerAlignment Specifies how the children are aligned with - * respect to each other. - * @return The new container. - */ - TDEAboutContainer *addContainerPage( const TQString &title, - int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); - - /** - * (Constructor II only) - * Adds a container inside a TQScrollView to a tab box. You can add text - * and images to a container. - * - * @param title Tab name. - * @param childAlignment Specifies how the children of the container are - * aligned with respect to the container. - * @param innerAlignment Specifies how the children are aligned with - * respect to each other. - * @return The new container. - */ - TDEAboutContainer *addScrolledContainerPage( const TQString &title, - int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); - - /** - * (Constructor II only) - * Adds a container. You can add text and images to a container. - * - * @param childAlignment Specifies how the children of the container are - * aligned with respect to the container. - * @param innerAlignment Specifies how the children are aligned with - * respect to each other. - * @return The new container. - */ - TDEAboutContainer *addContainer( int childAlignment, int innerAlignment ); - - /** - * (Constructor II only) - * Adds an empty page to a tab box. - * - * @param title Tab name - * @return The new page. - */ - TQFrame *addPage( const TQString &title ); - - - /** - * (Constructor I only) - * Sets the image as the application logo. - */ - void setLogo(const TQPixmap&); - - /** - * (Constructor I only) - * Sets the author's name and email address. - */ - void setAuthor(const TQString& name, const TQString& email, - const TQString& url, const TQString& work); - - /** - * (Constructor I only) - * Sets the maintainer's name and email address. - */ - void setMaintainer(const TQString& name, const TQString& email, - const TQString& url, const TQString& work); - - /** - * (Constructor I only) - * Show this person as one of the major contributors. - */ - void addContributor(const TQString& name, const TQString& email, - const TQString& url, const TQString& work); - - /** - * (Constructor I only) - * Sets the text describing the version. - */ - void setVersion(const TQString& name); - - /** - * Create a modal dialog with an image in the upper area with a - * URL link below. - */ - static void imageURL( TQWidget *parent, const TQString &caption, - const TQString &path, const TQColor &imageColor, - const TQString &url ); - -signals: - /** - * Send an email to this person. - * - * The application must provide the - * functionality. - */ - void sendEmail(const TQString& name, const TQString& email); - - /** - * Open the selected URL. - */ - void openURL(const TQString& url); - // ---------------------------------------------------------------------------- -protected: - /** - * The main widget (Constructor I) - */ - TDEAboutWidget * about; - - /** - * The main widget (Constructor II) - */ - TDEAboutContainerBase *mContainerBase; - - // ------------------------------------------------------------------------- -protected slots: - - /** - * Connected to widget->sendEmail. - */ - void sendEmailSlot(const TQString& name, const TQString& email); - - /** - * Open this URL. - */ - void openURLSlot(const TQString& url); - - /** - * (Constructor II only) - * Tells the position of the mouse cursor when the left mouse button - * is pressed above an image - */ - virtual void mouseTrackSlot( int mode, const TQMouseEvent *e ); - - // ######################################################################### -protected: - virtual void virtual_hook( int id, void* data ); -private: - TDEAboutDialogPrivate* const d; -}; - -#endif // defined KABOUTDIALOG_H diff --git a/tdeui/kaboutkde.cpp b/tdeui/kaboutkde.cpp deleted file mode 100644 index 5ccd8822a..000000000 --- a/tdeui/kaboutkde.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -// I (espen) prefer that header files are included alphabetically -#include <kaboutkde.h> -#include <kapplication.h> -#include <klocale.h> -#include <kstandarddirs.h> - - -TDEAboutKDE::TDEAboutKDE( TQWidget *parent, const char *name, bool modal ) - :TDEAboutDialog( TDEAboutDialog::AbtKDEStandard, TQString::fromLatin1("TDE"), - KDialogBase::Help|KDialogBase::Close, KDialogBase::Close, - parent, name, modal ) -{ - const TQString text1 = i18n("" - "The <b>Trinity Desktop Environment</b> is a fork of the " - "K Desktop Environment version 3.5, which was originally written by the KDE Team, " - "a world-wide network of software engineers committed to <a " - "href=\"http://www.gnu.org/philosophy/free-sw.html\">Free Software</a> " - "development.<br><br>No single group, company or organization controls the " - "Trinity source code. Everyone is welcome to contribute to Trinity.<br><br>Visit <A " - "HREF=\"http://www.trinitydesktop.org/\">http://www.trinitydesktop.org</A> for more information " - "about Trinity, and <A HREF=\"http://www.kde.org/\">http://www.kde.org</A> " - "for more information on the KDE project. "); - - const TQString text2 = i18n("" - "Software can always be improved, and the Trinity Team is ready to " - "do so. However, you - the user - must tell us when " - "something does not work as expected or could be done better.<br><br>" - "The Trinity Desktop Environment has a bug tracking system. Visit " - "<A HREF=\"http://bugs.pearsoncomputing.net/\">http://bugs.pearsoncomputing.net</A> or " - "use the \"Report Bug...\" dialog from the \"Help\" menu to report bugs.<br><br>" - "If you have a suggestion for improvement then you are welcome to use " - "the bug tracking system to register your wish. Make sure you use the " - "severity called \"Wishlist\"." ); - - const TQString text3 = i18n("" - "You do not have to be a software developer to be a member of the " - "Trinity team. You can join the national teams that translate " - "program interfaces. You can provide graphics, themes, sounds, and " - "improved documentation. You decide!" - "<br><br>" - "Visit " - "<A HREF=\"http://www.trinitydesktop.org/jobs/\">http://www.trinitydesktop.org/jobs/</A> " - "for information on some projects in which you can participate." - "<br><br>" - "If you need more information or documentation, then a visit to " - "<A HREF=\"http://www.trinitydesktop.org/docs/\">http://www.trinitydesktop.org/docs/</A> " - "will provide you with what you need."); - const TQString text4 = i18n("" - "Trinity is available free of charge, but making it is not free.<br><br>" - "<br><br>" - "The Trinity team does need financial support. Most of the money is used to " - "reimburse members and others on expenses they experienced when " - "contributing to Trinity. You are encouraged to support Trinity through a financial " - "donation, using one of the ways described at " - "<a href=\"http://www.trinitydesktop.org/donate.php\">http://www.trinitydesktop.org/donate.php</a>." - "<br><br>Thank you very much in advance for your support!"); - setHelp( TQString::fromLatin1("khelpcenter/main.html"), TQString::null ); - setTitle(i18n("Trinity Desktop Environment. Release %1"). - arg(TQString::fromLatin1(TDE_VERSION_STRING)) ); - addTextPage( i18n("About Trinity","&About"), text1, true ); - addTextPage( i18n("&Report Bugs/Request Enhancements"), text2, true ); - addTextPage( i18n("&Join the Trinity Team"), text3, true ); - addTextPage( i18n("&Support Trinity"), text4, true ); - setImage( locate( "data", TQString::fromLatin1("tdeui/pics/aboutkde.png")) ); - setImageBackgroundColor( white ); -} diff --git a/tdeui/kaboutkde.h b/tdeui/kaboutkde.h deleted file mode 100644 index 8013d093d..000000000 --- a/tdeui/kaboutkde.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of the KDE Libraries - * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef _KABOUT_KDE_H_ -#define _KABOUT_KDE_H_ - -#include <kaboutdialog.h> - -/** - * @short Standard "About KDE" dialog box, - * - * This class provides the standard "About KDE" dialog box that is used - * KHelpMenu Normally you should not use this class directly but - * rather the KHelpMenu class or even better just subclass your - * toplevel window from TDEMainWindow. If you do the latter, the help - * menu and thereby this dialog box is available through the - * TDEMainWindow::helpMenu() function. - * - * @author Espen Sand (espen@kde.org) - */ - -class TDEUI_EXPORT TDEAboutKDE : public TDEAboutDialog -{ - public: - /** - * Constructor. Creates a fully featured "About KDE" dialog box. - * Note that this dialog is made modeless in the KHelpMenu class so - * the users may expect a modeless dialog. - * - * @param parent The parent of the dialog box. You should use the - * toplevel window so that the dialog becomes centered. - * @param name Internal name of the widget. This name in not used in the - * caption. - * @param modal If false, this widget will be modeless and must be - * made visible using TQWidget::show(). Otherwise it will be - * modal and must be made visible using TQWidget::exec() - */ - TDEAboutKDE( TQWidget *parent=0, const char *name=0, bool modal=true ); -}; - - -#endif - - diff --git a/tdeui/kactivelabel.cpp b/tdeui/kactivelabel.cpp index a30fac7f4..0e5abc5ad 100644 --- a/tdeui/kactivelabel.cpp +++ b/tdeui/kactivelabel.cpp @@ -19,7 +19,7 @@ #include "kactivelabel.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tqregexp.h> #include <tqwhatsthis.h> #include <tqsimplerichtext.h> diff --git a/tdeui/kbugreport.cpp b/tdeui/kbugreport.cpp index efee22366..91c6aa66c 100644 --- a/tdeui/kbugreport.cpp +++ b/tdeui/kbugreport.cpp @@ -26,8 +26,8 @@ #include <tqwhatsthis.h> #include <tqregexp.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <klineedit.h> diff --git a/tdeui/kcharselect.cpp b/tdeui/kcharselect.cpp index ace147496..a623b3efa 100644 --- a/tdeui/kcharselect.cpp +++ b/tdeui/kcharselect.cpp @@ -36,7 +36,7 @@ #include <tqtooltip.h> #include <tqvalidator.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kdialog.h> #include <klineedit.h> diff --git a/tdeui/kcolorcombo.cpp b/tdeui/kcolorcombo.cpp index 0449550fd..7e9353cf4 100644 --- a/tdeui/kcolorcombo.cpp +++ b/tdeui/kcolorcombo.cpp @@ -44,7 +44,7 @@ #include <tqpushbutton.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kglobal.h> #include <kglobalsettings.h> diff --git a/tdeui/kcolordialog.cpp b/tdeui/kcolordialog.cpp index 16f16d07e..29292f960 100644 --- a/tdeui/kcolordialog.cpp +++ b/tdeui/kcolordialog.cpp @@ -45,7 +45,7 @@ #include <tqspinbox.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kglobal.h> #include <kglobalsettings.h> diff --git a/tdeui/kdatepicker.cpp b/tdeui/kdatepicker.cpp index 91cafddbd..98d72030d 100644 --- a/tdeui/kdatepicker.cpp +++ b/tdeui/kdatepicker.cpp @@ -33,7 +33,7 @@ #include "kdatepicker.h" #include <kglobal.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialog.h> #include <klocale.h> #include <kiconloader.h> diff --git a/tdeui/kdatetbl.cpp b/tdeui/kdatetbl.cpp index 2fd593493..542f89f08 100644 --- a/tdeui/kdatetbl.cpp +++ b/tdeui/kdatetbl.cpp @@ -35,7 +35,7 @@ #include <tdeconfig.h> #include <kglobal.h> #include <kglobalsettings.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeaccel.h> #include <klocale.h> #include <kdebug.h> diff --git a/tdeui/kdcopactionproxy.cpp b/tdeui/kdcopactionproxy.cpp index c8444cfdf..028c90883 100644 --- a/tdeui/kdcopactionproxy.cpp +++ b/tdeui/kdcopactionproxy.cpp @@ -20,7 +20,7 @@ #include "kdcopactionproxy.h" #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeaction.h> #include <kdebug.h> #include <kdcoppropertyproxy.h> diff --git a/tdeui/kdetrayproxy/kdetrayproxy.cpp b/tdeui/kdetrayproxy/kdetrayproxy.cpp index f1e6995ee..d0e7a84cf 100644 --- a/tdeui/kdetrayproxy/kdetrayproxy.cpp +++ b/tdeui/kdetrayproxy/kdetrayproxy.cpp @@ -19,7 +19,7 @@ #include "kdetrayproxy.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <netwm.h> #include <X11/Xlib.h> @@ -182,7 +182,7 @@ void KDETrayProxy::withdrawWindow( Window w ) #include "kdetrayproxy.moc" #if 0 -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> int main( int argc, char* argv[] ) { TDECmdLineArgs::init( argc, argv, "a", "b", "c", "d" ); diff --git a/tdeui/kdialog.cpp b/tdeui/kdialog.cpp index ddac1ddd8..f6b2b8b56 100644 --- a/tdeui/kdialog.cpp +++ b/tdeui/kdialog.cpp @@ -19,7 +19,7 @@ */ #include <tdeconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialog.h> #include <kwhatsthismanager_p.h> #include <kdebug.h> diff --git a/tdeui/kdialogbase.cpp b/tdeui/kdialogbase.cpp index 46d0697d5..6656d6803 100644 --- a/tdeui/kdialogbase.cpp +++ b/tdeui/kdialogbase.cpp @@ -33,7 +33,7 @@ #include <tqtimer.h> #include <tqfocusdata.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tdeconfig.h> #include <kiconloader.h> diff --git a/tdeui/keditcl1.cpp b/tdeui/keditcl1.cpp index baff8db25..37cee99fb 100644 --- a/tdeui/keditcl1.cpp +++ b/tdeui/keditcl1.cpp @@ -24,7 +24,7 @@ #include <tqtextstream.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcursor.h> #include <kdebug.h> #include <kcmenumngr.h> diff --git a/tdeui/keditcl2.cpp b/tdeui/keditcl2.cpp index 92ca542d4..a7db92555 100644 --- a/tdeui/keditcl2.cpp +++ b/tdeui/keditcl2.cpp @@ -31,7 +31,7 @@ #include <tqhbox.h> #include <tqpopupmenu.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcombobox.h> #include <knuminput.h> #include <kmessagebox.h> diff --git a/tdeui/keditlistbox.cpp b/tdeui/keditlistbox.cpp index 040e77c70..1a31bbaa4 100644 --- a/tdeui/keditlistbox.cpp +++ b/tdeui/keditlistbox.cpp @@ -31,7 +31,7 @@ #include <kdialog.h> #include <klineedit.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <knotifyclient.h> #include "keditlistbox.h" diff --git a/tdeui/khelpmenu.cpp b/tdeui/khelpmenu.cpp index dd6b7d174..41fa063c2 100644 --- a/tdeui/khelpmenu.cpp +++ b/tdeui/khelpmenu.cpp @@ -27,11 +27,11 @@ #include <tqwhatsthis.h> #include <tqwidget.h> -#include <kaboutapplication.h> -#include <kaboutdata.h> -#include <kaboutkde.h> +#include <tdeaboutapplication.h> +#include <tdeaboutdata.h> +#include <tdeabouttde.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kbugreport.h> #include <kdialogbase.h> #include <khelpmenu.h> diff --git a/tdeui/kiconview.cpp b/tdeui/kiconview.cpp index 3a139985a..bcf9550b4 100644 --- a/tdeui/kiconview.cpp +++ b/tdeui/kiconview.cpp @@ -29,7 +29,7 @@ #include <kdebug.h> #include <kglobal.h> #include <kglobalsettings.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kipc.h> #include <kcursor.h> diff --git a/tdeui/kjanuswidget.cpp b/tdeui/kjanuswidget.cpp index fc1a04e7e..e9dd9df85 100644 --- a/tdeui/kjanuswidget.cpp +++ b/tdeui/kjanuswidget.cpp @@ -33,7 +33,7 @@ #include <tqpainter.h> #include <tqstyle.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialog.h> // Access to some static members #include <klocale.h> #include <kglobal.h> diff --git a/tdeui/kkeybutton.cpp b/tdeui/kkeybutton.cpp index e0a41ce5d..24191aa45 100644 --- a/tdeui/kkeybutton.cpp +++ b/tdeui/kkeybutton.cpp @@ -24,7 +24,7 @@ #include <tqcursor.h> #include <tqdrawutil.h> #include <tqpainter.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kglobalaccel.h> #include <klocale.h> diff --git a/tdeui/kkeydialog.cpp b/tdeui/kkeydialog.cpp index b6db9bb71..7faad35c4 100644 --- a/tdeui/kkeydialog.cpp +++ b/tdeui/kkeydialog.cpp @@ -39,7 +39,7 @@ #include <tdeaction.h> #include <tdeaccelaction.h> #include <tdeactionshortcutlist.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kglobal.h> @@ -51,7 +51,7 @@ #include <tdeshortcut.h> #include <tdeshortcutlist.h> #include <kxmlguifactory.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <kstaticdeleter.h> #ifdef Q_WS_X11 diff --git a/tdeui/kled.cpp b/tdeui/kled.cpp index dc245cd6f..6b29ac0ca 100644 --- a/tdeui/kled.cpp +++ b/tdeui/kled.cpp @@ -30,7 +30,7 @@ #include <tqpainter.h> #include <tqimage.h> #include <tqcolor.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kpixmapeffect.h> #include "kled.h" diff --git a/tdeui/klineedit.cpp b/tdeui/klineedit.cpp index 4e11f5fa3..a1c05aaab 100644 --- a/tdeui/klineedit.cpp +++ b/tdeui/klineedit.cpp @@ -40,7 +40,7 @@ #include <kurl.h> #include <kurldrag.h> #include <kiconloader.h> -#include <kapplication.h> +#include <tdeapplication.h> #include "klineedit.h" #include "klineedit.moc" diff --git a/tdeui/klineeditdlg.cpp b/tdeui/klineeditdlg.cpp index 9551fc1f6..ca4fd8266 100644 --- a/tdeui/klineeditdlg.cpp +++ b/tdeui/klineeditdlg.cpp @@ -28,7 +28,7 @@ #include <kbuttonbox.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klineedit.h> #include <kstdguiitem.h> diff --git a/tdeui/kmenubar.cpp b/tdeui/kmenubar.cpp index 9f21ce300..71158370b 100644 --- a/tdeui/kmenubar.cpp +++ b/tdeui/kmenubar.cpp @@ -35,7 +35,7 @@ #include <tdeconfig.h> #include <kglobalsettings.h> #include <kmenubar.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <kdebug.h> #include <kmanagerselection.h> diff --git a/tdeui/kmessagebox.cpp b/tdeui/kmessagebox.cpp index 1e3c0bfda..5684c6484 100644 --- a/tdeui/kmessagebox.cpp +++ b/tdeui/kmessagebox.cpp @@ -31,7 +31,7 @@ #include <tqpushbutton.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kdialogbase.h> diff --git a/tdeui/kpanelapplet.cpp b/tdeui/kpanelapplet.cpp index 02a098283..f88cb5a8a 100644 --- a/tdeui/kpanelapplet.cpp +++ b/tdeui/kpanelapplet.cpp @@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kpanelapplet.h" #include "kpanelapplet.moc" -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> class KPanelApplet::KPanelAppletPrivate diff --git a/tdeui/kpanelappmenu.cpp b/tdeui/kpanelappmenu.cpp index 4cc77b5fe..247d844de 100644 --- a/tdeui/kpanelappmenu.cpp +++ b/tdeui/kpanelappmenu.cpp @@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "kpanelappmenu.h" #include <tqstringlist.h> #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> static int panelmenu_get_seq_id() diff --git a/tdeui/kpassdlg.cpp b/tdeui/kpassdlg.cpp index e2ca0bb80..302b4e679 100644 --- a/tdeui/kpassdlg.cpp +++ b/tdeui/kpassdlg.cpp @@ -36,11 +36,11 @@ #include <kglobal.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kiconloader.h> #include <kmessagebox.h> -#include <kaboutdialog.h> +#include <tdeaboutdialog.h> #include <tdeconfig.h> #include <kstandarddirs.h> #include <kprogress.h> diff --git a/tdeui/kprogress.cpp b/tdeui/kprogress.cpp index 9b72dcf2c..3f0186e3d 100644 --- a/tdeui/kprogress.cpp +++ b/tdeui/kprogress.cpp @@ -34,7 +34,7 @@ #include "kprogress.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <twin.h> diff --git a/tdeui/kprogressbox.cpp b/tdeui/kprogressbox.cpp index 4638f78fb..6dda25a33 100644 --- a/tdeui/kprogressbox.cpp +++ b/tdeui/kprogressbox.cpp @@ -37,7 +37,7 @@ #include "ktextedit.h" #include "kprogressbox.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <twin.h> diff --git a/tdeui/kpushbutton.cpp b/tdeui/kpushbutton.cpp index 35bf0928f..e92fe8583 100644 --- a/tdeui/kpushbutton.cpp +++ b/tdeui/kpushbutton.cpp @@ -29,7 +29,7 @@ #include <tdeconfig.h> #include <kglobal.h> #include <kipc.h> -#include <kapplication.h> +#include <tdeapplication.h> class KPushButton::KPushButtonPrivate { diff --git a/tdeui/krootpixmap.cpp b/tdeui/krootpixmap.cpp index 71b1d86ca..6be62d157 100644 --- a/tdeui/krootpixmap.cpp +++ b/tdeui/krootpixmap.cpp @@ -14,7 +14,7 @@ #include <tqrect.h> #include <tqimage.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kimageeffect.h> #include <kpixmapio.h> #include <twinmodule.h> diff --git a/tdeui/ksconfig.cpp b/tdeui/ksconfig.cpp index 363a9b8b4..d27ae07ca 100644 --- a/tdeui/ksconfig.cpp +++ b/tdeui/ksconfig.cpp @@ -25,7 +25,7 @@ #include <tqlayout.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kdialog.h> diff --git a/tdeui/kseparator.cpp b/tdeui/kseparator.cpp index 9e860f3cf..c5a4879d8 100644 --- a/tdeui/kseparator.cpp +++ b/tdeui/kseparator.cpp @@ -20,7 +20,7 @@ #include <tqstyle.h> #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> #include "kseparator.moc" diff --git a/tdeui/ksharedpixmap.cpp b/tdeui/ksharedpixmap.cpp index b9e0e69c4..33eca17e4 100644 --- a/tdeui/ksharedpixmap.cpp +++ b/tdeui/ksharedpixmap.cpp @@ -22,7 +22,7 @@ #ifdef Q_WS_X11 -#include <kapplication.h> +#include <tdeapplication.h> #include <krootprop.h> #include <ksharedpixmap.h> #include <kdebug.h> diff --git a/tdeui/kstdaction.cpp b/tdeui/kstdaction.cpp index a0e840e5a..8dd874a9d 100644 --- a/tdeui/kstdaction.cpp +++ b/tdeui/kstdaction.cpp @@ -21,9 +21,9 @@ #include <tqtoolbutton.h> #include <tqwhatsthis.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kglobal.h> #include <kiconloader.h> diff --git a/tdeui/kstdguiitem.cpp b/tdeui/kstdguiitem.cpp index 2367804a8..78f3fd6f6 100644 --- a/tdeui/kstdguiitem.cpp +++ b/tdeui/kstdguiitem.cpp @@ -20,7 +20,7 @@ #include <kguiitem.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> KGuiItem KStdGuiItem::guiItem ( StdItem ui_enum ) { diff --git a/tdeui/ksyntaxhighlighter.cpp b/tdeui/ksyntaxhighlighter.cpp index 1d0ce4159..ba938382b 100644 --- a/tdeui/ksyntaxhighlighter.cpp +++ b/tdeui/ksyntaxhighlighter.cpp @@ -31,7 +31,7 @@ #include <kdebug.h> #include <kglobal.h> #include <tdespell.h> -#include <kapplication.h> +#include <tdeapplication.h> #include "ksyntaxhighlighter.h" diff --git a/tdeui/ksystemtray.cpp b/tdeui/ksystemtray.cpp index 572616833..fcd0389da 100644 --- a/tdeui/ksystemtray.cpp +++ b/tdeui/ksystemtray.cpp @@ -24,9 +24,9 @@ #include "tdeshortcut.h" #include "ksystemtray.h" #include "tdepopupmenu.h" -#include "kapplication.h" +#include "tdeapplication.h" #include "klocale.h" -#include "kaboutdata.h" +#include "tdeaboutdata.h" #ifdef Q_WS_X11 #include <twin.h> diff --git a/tdeui/ktextbrowser.cpp b/tdeui/ktextbrowser.cpp index 15f14d711..b17e38067 100644 --- a/tdeui/ktextbrowser.cpp +++ b/tdeui/ktextbrowser.cpp @@ -19,7 +19,7 @@ #include <tqpopupmenu.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobalsettings.h> #include <ktextbrowser.h> #include <kcursor.h> diff --git a/tdeui/ktip.cpp b/tdeui/ktip.cpp index d52e134b6..44f710fb9 100644 --- a/tdeui/ktip.cpp +++ b/tdeui/ktip.cpp @@ -33,8 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tqtextstream.h> #include <tqimage.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kglobal.h> diff --git a/tdeui/kwhatsthismanager.cpp b/tdeui/kwhatsthismanager.cpp index 2f4d1750f..bcf48438c 100644 --- a/tdeui/kwhatsthismanager.cpp +++ b/tdeui/kwhatsthismanager.cpp @@ -22,7 +22,7 @@ #include <kdebug.h> #include <tqtextedit.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> KWhatsThisManager *KWhatsThisManager::s_instance = 0; diff --git a/tdeui/kxmlguibuilder.cpp b/tdeui/kxmlguibuilder.cpp index 3eb756678..6fd472ad5 100644 --- a/tdeui/kxmlguibuilder.cpp +++ b/tdeui/kxmlguibuilder.cpp @@ -18,7 +18,7 @@ Boston, MA 02110-1301, USA. */ -#include "kapplication.h" +#include "tdeapplication.h" #include "kxmlguibuilder.h" #include "kmenubar.h" #include "tdepopupmenu.h" diff --git a/tdeui/kxmlguiclient.cpp b/tdeui/kxmlguiclient.cpp index a02718f0a..de015b5a4 100644 --- a/tdeui/kxmlguiclient.cpp +++ b/tdeui/kxmlguiclient.cpp @@ -32,7 +32,7 @@ #include <kstandarddirs.h> #include <kdebug.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <assert.h> diff --git a/tdeui/tdeaboutapplication.cpp b/tdeui/tdeaboutapplication.cpp new file mode 100644 index 000000000..08ee46450 --- /dev/null +++ b/tdeui/tdeaboutapplication.cpp @@ -0,0 +1,188 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and + * Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +// I (espen) prefer that header files are included alphabetically + +#include <tqlabel.h> +#include <tdeaboutapplication.h> +#include <kaboutdialog_private.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <kglobal.h> +#include <klocale.h> +#include <kurllabel.h> +#include <kactivelabel.h> +#include "ktextedit.h" + +TDEAboutApplication::TDEAboutApplication( TQWidget *parent, const char *name, + bool modal ) + :TDEAboutDialog( AbtTabbed|AbtProduct, + kapp ? kapp->caption() : TQString::null, + Close, Close, + parent, name, modal ) +{ + buildDialog(TDEGlobal::instance()->aboutData()); +} + +TDEAboutApplication::TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent, + const char *name, bool modal ) + :TDEAboutDialog( AbtTabbed|AbtProduct, aboutData->programName(), Close, Close, + parent, name, modal ) +{ + buildDialog(aboutData); +} + +void TDEAboutApplication::buildDialog( const TDEAboutData *aboutData ) +{ + if( !aboutData ) + { + // + // Recovery + // + + //i18n "??" is displayed as (pseudo-)version when no data is known about the application + setProduct( kapp ? kapp->caption() : TQString::null, i18n("??"), TQString::null, TQString::null ); + TDEAboutContainer *appPage = addContainerPage( i18n("&About")); + + TQString appPageText = + i18n("No information available.\n" + "The supplied TDEAboutData object does not exist."); + TQLabel *appPageLabel = new TQLabel( "\n\n\n\n"+appPageText+"\n\n\n\n", 0 ); + appPage->addWidget( appPageLabel ); + return; + } + + setProduct( aboutData->programName(), aboutData->version(), + TQString::null, TQString::null ); + + if (!aboutData->programLogo().isNull()) + setProgramLogo( aboutData->programLogo() ); + + TQString appPageText = aboutData->shortDescription() + "\n"; + + if (!aboutData->otherText().isEmpty()) + appPageText += "\n" + aboutData->otherText()+"\n"; + + if (!aboutData->copyrightStatement().isEmpty()) + appPageText += "\n" + aboutData->copyrightStatement()+"\n"; + + TDEAboutContainer *appPage = addContainerPage( i18n("&About")); + + TQLabel *appPageLabel = new TQLabel( appPageText, 0 ); + appPage->addWidget( appPageLabel ); + + if (!aboutData->homepage().isEmpty()) + { + KURLLabel *url = new KURLLabel(); + url->setText(aboutData->homepage()); + url->setURL(aboutData->homepage()); + appPage->addWidget( url ); + connect( url, TQT_SIGNAL(leftClickedURL(const TQString &)), + this, TQT_SLOT(openURLSlot(const TQString &))); + } + + int authorCount = aboutData->authors().count(); + if (authorCount) + { + TQString authorPageTitle = authorCount == 1 ? + i18n("A&uthor") : i18n("A&uthors"); + TDEAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle ); + + if (!aboutData->customAuthorTextEnabled() || !aboutData->customAuthorRichText().isEmpty ()) + { + TQString text; + KActiveLabel* activeLabel = new KActiveLabel( authorPage ); + if (!aboutData->customAuthorTextEnabled()) + { + if ( aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == "submit@bugs.pearsoncomputing.net") + text = i18n( "Please use <a href=\"http://bugs.pearsoncomputing.net\">http://bugs.pearsoncomputing.net</a> to report bugs.\n" ); + else { + if( aboutData->authors().count() == 1 && ( aboutData->authors().first().emailAddress() == aboutData->bugAddress() ) ) + { + text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg( aboutData->authors().first().emailAddress() ).arg( aboutData->authors().first().emailAddress() ); + } + else { + text = i18n( "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n" ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress() ); + } + } + } + else + { + text = aboutData->customAuthorRichText(); + } + activeLabel->setText( text ); + authorPage->addWidget( activeLabel ); + } + + TQValueList<TDEAboutPerson>::ConstIterator it; + for (it = aboutData->authors().begin(); + it != aboutData->authors().end(); ++it) + { + authorPage->addPerson( (*it).name(), (*it).emailAddress(), + (*it).webAddress(), (*it).task() ); + } + } + + int creditsCount = aboutData->credits().count(); + if (creditsCount) + { + TDEAboutContainer *creditsPage = + addScrolledContainerPage( i18n("&Thanks To") ); + TQValueList<TDEAboutPerson>::ConstIterator it; + for (it = aboutData->credits().begin(); + it != aboutData->credits().end(); ++it) + { + creditsPage->addPerson( (*it).name(), (*it).emailAddress(), + (*it).webAddress(), (*it).task() ); + } + } + + const TQValueList<TDEAboutTranslator> translatorList = aboutData->translators(); + + if(translatorList.count() > 0) + { + TQString text = "<qt>"; + + TQValueList<TDEAboutTranslator>::ConstIterator it; + for(it = translatorList.begin(); it != translatorList.end(); ++it) + { + text += TQString("<p>%1<br>   " + "<a href=\"mailto:%2\">%2</a></p>") + .arg((*it).name()) + .arg((*it).emailAddress()) + .arg((*it).emailAddress()); + } + + text += TDEAboutData::aboutTranslationTeam() + "</qt>"; + addTextPage( i18n("T&ranslation"), text, true); + } + + if (!aboutData->license().isEmpty() ) + { + addLicensePage( i18n("&License Agreement"), aboutData->license() ); + } + + // + // Make sure the dialog has a reasonable width + // + setInitialSize( TQSize(400,1) ); +} diff --git a/tdeui/tdeaboutapplication.h b/tdeui/tdeaboutapplication.h new file mode 100644 index 000000000..19fa0fe61 --- /dev/null +++ b/tdeui/tdeaboutapplication.h @@ -0,0 +1,94 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Waldo Bastian (bastian@kde.org) and + * Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef _KABOUT_APPLICATION_H_ +#define _KABOUT_APPLICATION_H_ + +#include <tdeaboutdata.h> +#include <tdeaboutdialog.h> + +/** + * @short Standard "About Application" dialog box. + * + * This class provides the standard "About Application" dialog box + * that is used by KHelpMenu. It uses the information of the global + * TDEAboutData that is specified at the start of your program in + * main(). Normally you should not use this class directly but rather + * the KHelpMenu class or even better just subclass your toplevel + * window from TDEMainWindow. If you do the latter, the help menu and + * thereby this dialog box is available through the + * TDEMainWindow::helpMenu() function. + * + * @author Waldo Bastian (bastian@kde.org) and Espen Sand (espen@kde.org) + */ + +class TDEUI_EXPORT TDEAboutApplication : public TDEAboutDialog +{ + public: + /** + * Constructor. Creates a fully featured "About Application" dialog box. + * Note that this dialog is made modeless in the KHelpMenu class so + * the users may expect a modeless dialog. + * + * @param parent The parent of the dialog box. You should use the + * toplevel window so that the dialog becomes centered. + * @param name Internal name of the widget. This name is not used in the + * caption. + * @param modal If false, this widget will be modeless and must be + * made visible using TQWidget::show(). Otherwise it will be + * modal and must be made visible using TQWidget::exec(). + */ + TDEAboutApplication( TQWidget *parent=0, const char *name=0, bool modal=true ); + + /** + * Constructor. Mostly does the same stuff as the previous constructor, except + * that it can take a custom TDEAboutData object instead of the one specified + * in your main() function. This is especially useful for applications + * which are implemented as (dynamically loaded) libraries, e.g. panel + * applets. + * + * @param aboutData A pointer to a TDEAboutData object which data + * will be used for filling the dialog. + * @param parent The parent of the dialog box. You should use the + * toplevel window so that the dialog becomes centered. + * @param name Internal name of the widget. This name is not used in the + * caption. + * @param modal If false, this widget will be modeless and must be + * made visible using TQWidget::show(). Otherwise it will be + * modal and must be made visible using TQWidget::exec(). + */ + TDEAboutApplication( const TDEAboutData *aboutData, TQWidget *parent=0, const char *name=0, bool modal=true ); + +/* + FIXME: The two constructors should be replaced with the following after the lib freeze: + + TDEAboutApplication( const TDEAboutData *aboutData=0, TQWidget *parent=0, const char *name=0, bool modal=true ); + + This will make buildDialog() obsolete as well (Frerich). +*/ + protected: + void buildDialog( const TDEAboutData *aboutData ); +}; + + +#endif + diff --git a/tdeui/tdeaboutdialog.cpp b/tdeui/tdeaboutdialog.cpp new file mode 100644 index 000000000..b46c0b959 --- /dev/null +++ b/tdeui/tdeaboutdialog.cpp @@ -0,0 +1,1797 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 1999-2001 Mirko Boehm <mirko@kde.org> and + * Espen Sand <espensa@online.no> + * + * 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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include <tqclipboard.h> +#include <tqimage.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <ktextedit.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqrect.h> +#include <tqtabwidget.h> +#include <tqtabbar.h> + +#include <tdeapplication.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <klocale.h> +#include <ktextbrowser.h> +#include <kurllabel.h> +#include <tdeaboutdialog.h> +#include <kaboutdialog_private.h> +#include <kdebug.h> + +//MOC_SKIP_BEGIN +template class TQPtrList<TDEAboutContributor>; +//MOC_SKIP_END + +#define WORKTEXT_IDENTATION 16 +#define Grid 3 + +// ############################################################## +// MOC OUTPUT FILES: +#include "tdeaboutdialog.moc" +#include "kaboutdialog_private.moc" +// ############################################################## + +class TDEAboutTabWidget : public TQTabWidget +{ +public: + TDEAboutTabWidget( TQWidget* parent ) : TQTabWidget( parent ) {} + TQSize sizeHint() const { + return TQTabWidget::sizeHint().expandedTo( tabBar()->sizeHint() + TQSize(4,4) ); + } +}; + + + + +TDEAboutContributor::TDEAboutContributor( TQWidget *_parent, const char *wname, + const TQString &_name,const TQString &_email, + const TQString &_url, const TQString &_work, + bool showHeader, bool showFrame, + bool showBold ) + : TQFrame( _parent, wname ), mShowHeader(showHeader), mShowBold(showBold), d(0) +{ + if( showFrame ) + { + setFrameStyle(TQFrame::Panel | TQFrame::Raised); + } + + mLabel[0] = new TQLabel( this ); + mLabel[1] = new TQLabel( this ); + mLabel[2] = new TQLabel( this ); + mLabel[3] = new TQLabel( this ); + mText[0] = new TQLabel( this ); + mText[1] = new KURLLabel( this ); + mText[2] = new KURLLabel( this ); + mText[3] = new TQLabel( this ); + + setName( _name, i18n("Author"), false ); + setEmail( _email, i18n("Email"), false ); + setURL( _url, i18n("Homepage"), false ); + setWork( _work, i18n("Task"), false ); + + KURLLabel *kurl = static_cast<KURLLabel *>(mText[1]); + kurl->setFloat(true); + kurl->setUnderline(true); + kurl->setMargin(0); + connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), + TQT_SLOT(emailClickedSlot(const TQString &))); + + kurl = static_cast<KURLLabel *>(mText[2]); + kurl->setFloat(true); + kurl->setUnderline(true); + kurl->setMargin(0); + connect(kurl, TQT_SIGNAL(leftClickedURL(const TQString &)), + TQT_SLOT(urlClickedSlot(const TQString &))); + + mLabel[3]->setAlignment( AlignTop ); + + fontChange( font() ); + updateLayout(); +} + + +void TDEAboutContributor::setName( const TQString &_text, const TQString &_header, + bool _update ) +{ + mLabel[0]->setText(_header); + mText[0]->setText(_text); + if( _update ) { updateLayout(); } +} + + +void TDEAboutContributor::setEmail( const TQString &_text, const TQString &_header, + bool _update ) +{ + mLabel[1]->setText(_header); + KURLLabel* const kurl = static_cast<KURLLabel *>(mText[1]); + kurl->setText(_text); + kurl->setURL(_text); + if( _update ) { updateLayout(); } +} + + +void TDEAboutContributor::setURL( const TQString &_text, const TQString &_header, + bool _update ) +{ + mLabel[2]->setText(_header); + KURLLabel* const kurl = static_cast<KURLLabel *>(mText[2]); + kurl->setText(_text); + kurl->setURL(_text); + if( _update ) { updateLayout(); } +} + + +void TDEAboutContributor::setWork( const TQString &_text, const TQString &_header, + bool _update ) +{ + mLabel[3]->setText(_header); + mText[3]->setText(_text); + if( _update ) { updateLayout(); } +} + + +TQString TDEAboutContributor::getName( void ) const +{ + return mText[0]->text(); +} + + +TQString TDEAboutContributor::getEmail( void ) const +{ + return mText[1]->text(); +} + + +TQString TDEAboutContributor::getURL( void ) const +{ + return mText[2]->text(); +} + + +TQString TDEAboutContributor::getWork( void ) const +{ + return mText[3]->text(); +} + + + +void TDEAboutContributor::updateLayout( void ) +{ + delete layout(); + + int row = 0; + if( !mText[0]->text().isEmpty() ) { ++row; } + if( !mText[1]->text().isEmpty() ) { ++row; } + if( !mText[2]->text().isEmpty() ) { ++row; } + if( !mText[3]->text().isEmpty() ) { ++row; } + + + TQGridLayout *gbox; + if( row == 0 ) + { + gbox = new TQGridLayout( this, 1, 1, 0 ); + for( int i=0; i<4; ++i ) + { + mLabel[i]->hide(); + mText[i]->hide(); + } + } + else + { + if( mText[0]->text().isEmpty() && !mShowHeader ) + { + gbox = new TQGridLayout( this, row, 1, frameWidth()+1, 2 ); + } + else + { + gbox = new TQGridLayout( this, row, 2, frameWidth()+1, 2 ); + if( !mShowHeader ) + { + gbox->addColSpacing( 0, KDialog::spacingHint()*2 ); + } + gbox->setColStretch( 1, 10 ); + } + + for( int i=0, r=0; i<4; ++i ) + { + mLabel[i]->setFixedHeight( fontMetrics().lineSpacing() ); + if( i != 3 ) + { + mText[i]->setFixedHeight( fontMetrics().lineSpacing() ); + } + + if( !mText[i]->text().isEmpty() ) + { + if( mShowHeader ) + { + gbox->addWidget( TQT_TQWIDGET(mLabel[i]), r, 0, (TQ_Alignment)AlignLeft ); + gbox->addWidget( TQT_TQWIDGET(mText[i]), r, 1, (TQ_Alignment)AlignLeft ); + mLabel[i]->show(); + mText[i]->show(); + } + else + { + mLabel[i]->hide(); + if( !i ) + { + gbox->addMultiCellWidget( TQT_TQWIDGET(mText[i]), r, r, 0, 1, (TQ_Alignment)AlignLeft ); + } + else + { + gbox->addWidget( TQT_TQWIDGET(mText[i]), r, 1, (TQ_Alignment)AlignLeft ); + } + mText[i]->show(); + } + ++r; + } + else + { + mLabel[i]->hide(); + mText[i]->hide(); + } + } + } + + gbox->activate(); + setMinimumSize( sizeHint() ); +} + + +void TDEAboutContributor::fontChange( const TQFont &/*oldFont*/ ) +{ + if( mShowBold ) + { + TQFont f( font() ); + f.setBold( true ); + mText[0]->setFont( f ); + } + update(); +} + + +TQSize TDEAboutContributor::sizeHint( void ) const +{ + return minimumSizeHint(); +} + + +void TDEAboutContributor::urlClickedSlot( const TQString &u ) +{ + emit openURL(u); +} + + +void TDEAboutContributor::emailClickedSlot( const TQString &e ) +{ + emit sendEmail( mText[0]->text(), e ) ; +} + + +// +// Internal widget for the TDEAboutDialog class. +// +TDEAboutContainerBase::TDEAboutContainerBase( int layoutType, TQWidget *_parent, + char *_name ) + : TQWidget( _parent, _name ), + mImageLabel(0), mTitleLabel(0), mIconLabel(0),mVersionLabel(0), + mAuthorLabel(0), mImageFrame(0),mPageTab(0),mPlainSpace(0),d(0) +{ + mTopLayout = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); + if( !mTopLayout ) { return; } + + if( layoutType & AbtImageOnly ) + { + layoutType &= ~(AbtImageLeft|AbtImageRight|AbtTabbed|AbtPlain); + } + if( layoutType & AbtImageLeft ) + { + layoutType &= ~AbtImageRight; + } + + if( layoutType & AbtTitle ) + { + mTitleLabel = new TQLabel( this, "title" ); + mTitleLabel->setAlignment(AlignCenter); + mTopLayout->addWidget( mTitleLabel ); + mTopLayout->addSpacing( KDialog::spacingHint() ); + } + + if( layoutType & AbtProduct ) + { + TQWidget* const productArea = new TQWidget( this, "area" ); + mTopLayout->addWidget( productArea, 0, TQApplication::reverseLayout() ? AlignRight : AlignLeft ); + + TQHBoxLayout* const hbox = new TQHBoxLayout(productArea,0,KDialog::spacingHint()); + if( !hbox ) { return; } + + mIconLabel = new TQLabel( productArea ); + hbox->addWidget( mIconLabel, 0, AlignLeft|AlignHCenter ); + + TQVBoxLayout* const vbox = new TQVBoxLayout(); + if( !vbox ) { return; } + hbox->addLayout( vbox ); + + mVersionLabel = new TQLabel( productArea, "version" ); + mAuthorLabel = new TQLabel( productArea, "author" ); + vbox->addWidget( mVersionLabel ); + vbox->addWidget( mAuthorLabel ); + hbox->activate(); + + mTopLayout->addSpacing( KDialog::spacingHint() ); + } + + TQHBoxLayout* const hbox = new TQHBoxLayout(); + if( !hbox ) { return; } + mTopLayout->addLayout( hbox, 10 ); + + if( layoutType & AbtImageLeft ) + { + TQVBoxLayout* vbox = new TQVBoxLayout(); + hbox->addLayout(vbox); + vbox->addSpacing(1); + mImageFrame = new TQFrame( this ); + setImageFrame( true ); + vbox->addWidget( mImageFrame ); + vbox->addSpacing(1); + + vbox = new TQVBoxLayout( mImageFrame, 1 ); + mImageLabel = new KImageTrackLabel( mImageFrame ); + connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )), + TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) ); + vbox->addStretch(10); + vbox->addWidget( mImageLabel ); + vbox->addStretch(10); + vbox->activate(); + } + + if( layoutType & AbtTabbed ) + { + mPageTab = new TDEAboutTabWidget( this ); + if( !mPageTab ) { return; } + hbox->addWidget( mPageTab, 10 ); + } + else if( layoutType & AbtImageOnly ) + { + mImageFrame = new TQFrame( this ); + setImageFrame( true ); + hbox->addWidget( mImageFrame, 10 ); + + TQGridLayout* const gbox = new TQGridLayout(mImageFrame, 3, 3, 1, 0 ); + gbox->setRowStretch( 0, 10 ); + gbox->setRowStretch( 2, 10 ); + gbox->setColStretch( 0, 10 ); + gbox->setColStretch( 2, 10 ); + + mImageLabel = new KImageTrackLabel( mImageFrame ); + connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )), + TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) ); + gbox->addWidget( mImageLabel, 1, 1 ); + gbox->activate(); + } + else + { + mPlainSpace = new TQFrame( this ); + if( !mPlainSpace ) { return; } + hbox->addWidget( mPlainSpace, 10 ); + } + + if( layoutType & AbtImageRight ) + { + TQVBoxLayout *vbox = new TQVBoxLayout(); + hbox->addLayout(vbox); + vbox->addSpacing(1); + mImageFrame = new TQFrame( this ); + setImageFrame( true ); + vbox->addWidget( mImageFrame ); + vbox->addSpacing(1); + + vbox = new TQVBoxLayout( mImageFrame, 1 ); + mImageLabel = new KImageTrackLabel( mImageFrame ); + connect( mImageLabel, TQT_SIGNAL(mouseTrack( int, const TQMouseEvent * )), + TQT_SLOT( slotMouseTrack( int, const TQMouseEvent * )) ); + vbox->addStretch(10); + vbox->addWidget( mImageLabel ); + vbox->addStretch(10); + vbox->activate(); + } + + fontChange( font() ); +} + + +void TDEAboutContainerBase::show( void ) +{ + TQWidget::show(); +} + +TQSize TDEAboutContainerBase::sizeHint( void ) const +{ + return minimumSize().expandedTo( TQSize( TQWidget::sizeHint().width(), 0 ) ); +} + +void TDEAboutContainerBase::fontChange( const TQFont &/*oldFont*/ ) +{ + if( mTitleLabel ) + { + TQFont f( TDEGlobalSettings::generalFont() ); + f.setBold( true ); + int fs = f.pointSize(); + if (fs == -1) + fs = TQFontInfo(f).pointSize(); + f.setPointSize( fs+2 ); // Lets not make it too big + mTitleLabel->setFont(f); + } + + if( mVersionLabel ) + { + TQFont f( TDEGlobalSettings::generalFont() ); + f.setBold( true ); + mVersionLabel->setFont(f); + mAuthorLabel->setFont(f); + mVersionLabel->parentWidget()->layout()->activate(); + } + + update(); +} + +TQFrame *TDEAboutContainerBase::addTextPage( const TQString &title, + const TQString &text, + bool richText, int numLines ) +{ + TQFrame* const page = addEmptyPage( title ); + if( !page ) { return 0; } + if( numLines <= 0 ) { numLines = 10; } + + TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() ); + + if( richText ) + { + KTextBrowser* const browser = new KTextBrowser( page, "browser" ); + browser->setHScrollBarMode( TQScrollView::AlwaysOff ); + browser->setText( text ); + browser->setMinimumHeight( fontMetrics().lineSpacing()*numLines ); + + vbox->addWidget(browser); + connect(browser, TQT_SIGNAL(urlClick(const TQString &)), + TQT_SLOT(slotUrlClick(const TQString &))); + connect(browser, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), + TQT_SLOT(slotMailClick(const TQString &,const TQString &))); + } + else + { + KTextEdit* const textEdit = new KTextEdit( page, "text" ); + textEdit->setReadOnly( true ); + textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines ); + textEdit->setWordWrap( TQTextEdit::NoWrap ); + vbox->addWidget( textEdit ); + } + + return page; +} + +TQFrame *TDEAboutContainerBase::addLicensePage( const TQString &title, + const TQString &text, int numLines) +{ + TQFrame* const page = addEmptyPage( title ); + if( !page ) { return 0; } + if( numLines <= 0 ) { numLines = 10; } + + TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() ); + + KTextEdit* const textEdit = new KTextEdit( page, "license" ); + textEdit->setFont( TDEGlobalSettings::fixedFont() ); + textEdit->setReadOnly( true ); + textEdit->setWordWrap( TQTextEdit::NoWrap ); + textEdit->setText( text ); + textEdit->setMinimumHeight( fontMetrics().lineSpacing()*numLines ); + vbox->addWidget( textEdit ); + return page; +} + + +TDEAboutContainer *TDEAboutContainerBase::addContainerPage( const TQString &title, + int childAlignment, + int innerAlignment ) +{ + if( !mPageTab ) + { + kdDebug(291) << "addPage: " << "Invalid layout" << endl; + return 0; + } + + TDEAboutContainer* const container = new TDEAboutContainer( mPageTab, "container", + KDialog::spacingHint(), KDialog::spacingHint(), childAlignment, + innerAlignment ); + mPageTab->addTab( container, title ); + + connect(container, TQT_SIGNAL(urlClick(const TQString &)), + TQT_SLOT(slotUrlClick(const TQString &))); + connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), + TQT_SLOT(slotMailClick(const TQString &,const TQString &))); + + return container; +} + + +TDEAboutContainer *TDEAboutContainerBase::addScrolledContainerPage( + const TQString &title, + int childAlignment, + int innerAlignment ) +{ + if( !mPageTab ) + { + kdDebug(291) << "addPage: " << "Invalid layout" << endl; + return 0; + } + + TQFrame* const page = addEmptyPage( title ); + TQVBoxLayout* const vbox = new TQVBoxLayout( page, KDialog::spacingHint() ); + TQScrollView* const scrollView = new TQScrollView( page ); + scrollView->viewport()->setBackgroundMode( PaletteBackground ); + vbox->addWidget( scrollView ); + + TDEAboutContainer* const container = new TDEAboutContainer( scrollView, "container", + KDialog::spacingHint(), KDialog::spacingHint(), childAlignment, + innerAlignment ); + scrollView->addChild( container ); + + + connect(container, TQT_SIGNAL(urlClick(const TQString &)), + TQT_SLOT(slotUrlClick(const TQString &))); + connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), + TQT_SLOT(slotMailClick(const TQString &,const TQString &))); + + return container; +} + + +TQFrame *TDEAboutContainerBase::addEmptyPage( const TQString &title ) +{ + if( !mPageTab ) + { + kdDebug(291) << "addPage: " << "Invalid layout" << endl; + return 0; + } + + TQFrame* const page = new TQFrame( mPageTab, title.latin1() ); + page->setFrameStyle( TQFrame::NoFrame ); + + mPageTab->addTab( page, title ); + return page; +} + + +TDEAboutContainer *TDEAboutContainerBase::addContainer( int childAlignment, + int innerAlignment ) +{ + TDEAboutContainer* const container = new TDEAboutContainer( this, "container", + 0, KDialog::spacingHint(), childAlignment, innerAlignment ); + mTopLayout->addWidget( container, 0, childAlignment ); + + connect(container, TQT_SIGNAL(urlClick(const TQString &)), + TQT_SLOT(slotUrlClick(const TQString &))); + connect(container, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), + TQT_SLOT(slotMailClick(const TQString &,const TQString &))); + + return container; +} + + + +void TDEAboutContainerBase::setTitle( const TQString &title ) +{ + if( !mTitleLabel ) + { + kdDebug(291) << "setTitle: " << "Invalid layout" << endl; + return; + } + mTitleLabel->setText(title); +} + + +void TDEAboutContainerBase::setImage( const TQString &fileName ) +{ + if( !mImageLabel ) + { + kdDebug(291) << "setImage: " << "Invalid layout" << endl; + return; + } + if( fileName.isNull() ) + { + return; + } + + const TQPixmap logo( fileName ); + if( !logo.isNull() ) + mImageLabel->setPixmap( logo ); + + mImageFrame->layout()->activate(); +} + +void TDEAboutContainerBase::setProgramLogo( const TQString &fileName ) +{ + if( fileName.isNull() ) + { + return; + } + + const TQPixmap logo( fileName ); + setProgramLogo( logo ); +} + +void TDEAboutContainerBase::setProgramLogo( const TQPixmap &pixmap ) +{ + if( !mIconLabel ) + { + kdDebug(291) << "setProgramLogo: " << "Invalid layout" << endl; + return; + } + if( !pixmap.isNull() ) + { + mIconLabel->setPixmap( pixmap ); + } +} + +void TDEAboutContainerBase::setImageBackgroundColor( const TQColor &color ) +{ + if( mImageFrame ) + { + mImageFrame->setBackgroundColor( color ); + } +} + + +void TDEAboutContainerBase::setImageFrame( bool state ) +{ + if( mImageFrame ) + { + if( state ) + { + mImageFrame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); + mImageFrame->setLineWidth(1); + } + else + { + mImageFrame->setFrameStyle( TQFrame::NoFrame ); + mImageFrame->setLineWidth(0); + } + } +} + + +void TDEAboutContainerBase::setProduct( const TQString &appName, + const TQString &version, + const TQString &author, + const TQString &year ) +{ + if( !mIconLabel ) + { + kdDebug(291) << "setProduct: " << "Invalid layout" << endl; + return; + } + + if ( kapp ) + { + mIconLabel->setPixmap( kapp->icon() ); + kdDebug(291) << "setPixmap (iconName): " << kapp->iconName() << endl; + } + else + kdDebug(291) << "no kapp" << endl; + + const TQString msg1 = i18n("%1 %2 (Using Trinity %3)").arg(appName).arg(version). + arg(TQString::fromLatin1(TDE_VERSION_STRING)); + const TQString msg2 = !year.isEmpty() ? i18n("%1 %2, %3").arg('©').arg(year). + arg(author) : TQString::fromLatin1(""); + + //if (!year.isEmpty()) + // msg2 = i18n("%1 %2, %3").arg('©').arg(year).arg(author); + + mVersionLabel->setText( msg1 ); + mAuthorLabel->setText( msg2 ); + if( msg2.isEmpty() ) + { + mAuthorLabel->hide(); + } + + mIconLabel->parentWidget()->layout()->activate(); +} + + +void TDEAboutContainerBase::slotMouseTrack( int mode, const TQMouseEvent *e ) +{ + emit mouseTrack( mode, e ); +} + + +void TDEAboutContainerBase::slotUrlClick( const TQString &url ) +{ + emit urlClick( url ); +} + +void TDEAboutContainerBase::slotMailClick( const TQString &_name, + const TQString &_address ) +{ + emit mailClick( _name, _address ); +} + + + +TDEAboutContainer::TDEAboutContainer( TQWidget *_parent, const char *_name, + int _margin, int _spacing, + int childAlignment, int innerAlignment ) + : TQFrame( _parent, _name ), d(0) +{ + mAlignment = innerAlignment; + + TQGridLayout* const gbox = new TQGridLayout( this, 3, 3, _margin, _spacing ); + if( childAlignment & AlignHCenter ) + { + gbox->setColStretch( 0, 10 ); + gbox->setColStretch( 2, 10 ); + } + else if( childAlignment & AlignRight ) + { + gbox->setColStretch( 0, 10 ); + } + else + { + gbox->setColStretch( 2, 10 ); + } + + if( childAlignment & AlignVCenter ) + { + gbox->setRowStretch( 0, 10 ); + gbox->setRowStretch( 2, 10 ); + } + else if( childAlignment & AlignRight ) + { + gbox->setRowStretch( 0, 10 ); + } + else + { + gbox->setRowStretch( 2, 10 ); + } + + mVbox = new TQVBoxLayout( _spacing ); + gbox->addLayout( mVbox, 1, 1 ); + gbox->activate(); +} + + +void TDEAboutContainer::childEvent( TQChildEvent *e ) +{ + if( !e->inserted() || !e->child()->isWidgetType() ) + { + return; + } + + TQWidget* const w = static_cast<TQWidget *>(e->child()); + mVbox->addWidget( w, 0, mAlignment ); + const TQSize s( sizeHint() ); + setMinimumSize( s ); + + TQObjectList const l = childrenListObject(); // silence please + TQObjectListIterator itr( l ); + TQObject * o; + while ( (o = itr.current()) ) { + ++itr; + if( o->isWidgetType() ) + { + TQT_TQWIDGET(o)->setMinimumWidth( s.width() ); + } + } +} + + +TQSize TDEAboutContainer::sizeHint( void ) const +{ + // + // The size is computed by adding the sizeHint().height() of all + // widget children and taking the width of the widest child and adding + // layout()->margin() and layout()->spacing() + // + + TQSize total_size; + + int numChild = 0; + TQObjectList const l = childrenListObject(); // silence please + + TQObjectListIterator itr( l ); + TQObject * o; + while ( (o = itr.current()) ) { + ++itr; + if( o->isWidgetType() ) + { + ++numChild; + TQWidget* const w= TQT_TQWIDGET(o); + + TQSize s = w->minimumSize(); + if( s.isEmpty() ) + { + s = w->minimumSizeHint(); + if( s.isEmpty() ) + { + s = w->sizeHint(); + if( s.isEmpty() ) + { + s = TQSize( 100, 100 ); // Default size + } + } + } + total_size.setHeight( total_size.height() + s.height() ); + if( s.width() > total_size.width() ) { total_size.setWidth( s.width() ); } + } + } + + if( numChild > 0 ) + { + // + // Seems I have to add 1 to the height to properly show the border + // of the last entry if layout()->margin() is 0 + // + + total_size.setHeight( total_size.height() + layout()->spacing()*(numChild-1) ); + total_size += TQSize( layout()->margin()*2, layout()->margin()*2 + 1 ); + } + else + { + total_size = TQSize( 1, 1 ); + } + return total_size; +} + + +TQSize TDEAboutContainer::minimumSizeHint( void ) const +{ + return sizeHint(); +} + + +void TDEAboutContainer::addWidget( TQWidget *widget ) +{ + widget->reparent( this, 0, TQPoint(0,0) ); +} + + +void TDEAboutContainer::addPerson( const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_task, + bool showHeader, bool showFrame,bool showBold) +{ + + TDEAboutContributor* const cont = new TDEAboutContributor( this, "pers", + _name, _email, _url, _task, showHeader, showFrame, showBold ); + connect( cont, TQT_SIGNAL( openURL(const TQString&)), + this, TQT_SIGNAL( urlClick(const TQString &))); + connect( cont, TQT_SIGNAL( sendEmail(const TQString &, const TQString &)), + this, TQT_SIGNAL( mailClick(const TQString &, const TQString &))); +} + + +void TDEAboutContainer::addTitle( const TQString &title, int alignment, + bool showFrame, bool showBold ) +{ + + TQLabel* const label = new TQLabel( title, this, "title" ); + if( showBold ) + { + TQFont labelFont( font() ); + labelFont.setBold( true ); + label->setFont( labelFont ); + } + if( showFrame ) + { + label->setFrameStyle(TQFrame::Panel | TQFrame::Raised); + } + label->setAlignment( alignment ); +} + + +void TDEAboutContainer::addImage( const TQString &fileName, int alignment ) +{ + if( fileName.isNull() ) + { + return; + } + + KImageTrackLabel* const label = new KImageTrackLabel( this, "image" ); + const TQImage logo( fileName ); + if( !logo.isNull() ) + { + TQPixmap pix; + pix = logo; + label->setPixmap( pix ); + } + label->setAlignment( alignment ); +} + +#if 0 +//MOC_SKIP_BEGIN + +/** Every person displayed is stored in a TDEAboutContributor object. + * Every contributor, the author and/or the maintainer of the application are + * stored in objects of this local class. Every single field may be empty. + * To add a contributor, create a TDEAboutContributor object as a child of your + * @ref TDEAboutDialog, set its contents and add it using add addContributor. */ +class TDEAboutContributor : public QFrame +{ + // ############################################################################ + Q_OBJECT + // ---------------------------------------------------------------------------- +public: + /** The Qt constructor. */ + TDEAboutContributor(TQWidget* parent=0, const char* name=0); + /** Set the name (a literal string). */ + void setName(const TQString&); + /** Get the name. */ + TQString getName(); + /** The email address (dito). */ + void setEmail(const TQString&); + /** Get the email address. */ + TQString getEmail(); + /** The URL (dito). */ + void setURL(const TQString&); + /** Get the URL. */ + TQString getURL(); + /** The tasks the person worked on (a literal string). More than one line is + * possible, but very long texts might look ugly. */ + void setWork(const TQString&); + /** The size hint. Very important here, since TDEAboutWidget relies on it for + * geometry management. */ + TQSize sizeHint(); + TQSize minimumSizeHint(void); + virtual void show( void ); + + // ---------------------------------------------------------------------------- +protected: + // events: + /** The resize event. */ + void resizeEvent(TQResizeEvent*); + /** The paint event. */ + void paintEvent(TQPaintEvent*); + /** The label showing the program version. */ + TQLabel *name; + /** The clickable URL label showing the email address. It is only visible if + * its text is not empty. */ + KURLLabel *email; + /** Another interactive part that displays the homepage URL. */ + KURLLabel *url; + /** The description of the contributions of the person. */ + TQString work; + // ---------------------------------------------------------------------------- +protected slots: + /** The homepage URL has been clicked. */ + void urlClickedSlot(const TQString&); + /** The email address has been clicked. */ + void emailClickedSlot(const TQString& emailaddress); + // ---------------------------------------------------------------------------- +signals: + /** The email address has been clicked. */ + void sendEmail(const TQString& name, const TQString& email); + /** The URL has been clicked. */ + void openURL(const TQString& url); + // ############################################################################ +}; + + + +TDEAboutContributor::TDEAboutContributor(TQWidget* parent, const char* n) + : TQFrame(parent, n), + name(new TQLabel(this)), + email(new KURLLabel(this)), + url(new KURLLabel(this)) +{ + // ############################################################ + if(name==0 || email==0) + { // this will nearly never happen (out of memory in about box?) + kdDebug() << "TDEAboutContributor::TDEAboutContributor: Out of memory." << endl; + tqApp->quit(); + } + setFrameStyle(TQFrame::Panel | TQFrame::Raised); + // ----- + connect(email, TQT_SIGNAL(leftClickedURL(const TQString&)), + TQT_SLOT(emailClickedSlot(const TQString&))); + connect(url, TQT_SIGNAL(leftClickedURL(const TQString&)), + TQT_SLOT(urlClickedSlot(const TQString&))); + // ############################################################ +} + +void +TDEAboutContributor::setName(const TQString& n) +{ + // ############################################################ + name->setText(n); + // ############################################################ +} + +QString +TDEAboutContributor::getName() +{ + // ########################################################### + return name->text(); + // ########################################################### +} +void +TDEAboutContributor::setURL(const TQString& u) +{ + // ########################################################### + url->setText(u); + // ########################################################### +} + +QString +TDEAboutContributor::getURL() +{ + // ########################################################### + return url->text(); + // ########################################################### +} + +void +TDEAboutContributor::setEmail(const TQString& e) +{ + // ########################################################### + email->setText(e); + // ########################################################### +} + +QString +TDEAboutContributor::getEmail() +{ + // ########################################################### + return email->text(); + // ########################################################### +} + +void +TDEAboutContributor::emailClickedSlot(const TQString& e) +{ + // ########################################################### + kdDebug() << "TDEAboutContributor::emailClickedSlot: called." << endl; + emit(sendEmail(name->text(), e)); + // ########################################################### +} + +void +TDEAboutContributor::urlClickedSlot(const TQString& u) +{ + // ########################################################### + kdDebug() << "TDEAboutContributor::urlClickedSlot: called." << endl; + emit(openURL(u)); + // ########################################################### +} + +void +TDEAboutContributor::setWork(const TQString& w) +{ + // ########################################################### + work=w; + // ########################################################### +} + +#endif + + +#if 0 +QSize +TDEAboutContributor::sizeHint() +{ + // ############################################################################ + const int FrameWidth=frameWidth(); + const int WorkTextWidth=200; + int maxx, maxy; + TQRect rect; + // ----- first calculate name and email width: + maxx=name->sizeHint().width(); + maxx=QMAX(maxx, email->sizeHint().width()+WORKTEXT_IDENTATION); + // ----- now determine "work" text rectangle: + if(!work.isEmpty()) // save time + { + rect=fontMetrics().boundingRect + (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work); + } + if(maxx<rect.width()) + { + maxx=WorkTextWidth+WORKTEXT_IDENTATION; + } + maxx=QMAX(maxx, url->sizeHint().width()+WORKTEXT_IDENTATION); + // ----- + maxy=2*(name->sizeHint().height()+Grid); // need a space above the KURLLabels + maxy+=/* email */ name->sizeHint().height(); + maxy+=rect.height(); + // ----- + maxx+=2*FrameWidth; + maxy+=2*FrameWidth; + return TQSize(maxx, maxy); + // ############################################################################ +} + +TQSize TDEAboutContributor::minimumSizeHint(void) +{ + return( sizeHint() ); +} + + +void TDEAboutContributor::show( void ) +{ + TQFrame::show(); + setMinimumSize( sizeHint() ); +} + + + +void +TDEAboutContributor::resizeEvent(TQResizeEvent*) +{ // the widgets are simply aligned from top to bottom, since the parent is + // expected to respect the size hint + // ############################################################################ + int framewidth=frameWidth(), childwidth=width()-2*framewidth; + int cy=framewidth; + // ----- + name->setGeometry + (framewidth, framewidth, childwidth, name->sizeHint().height()); + cy=name->height()+Grid; + email->setGeometry + (framewidth+WORKTEXT_IDENTATION, cy, + childwidth-WORKTEXT_IDENTATION, /* email */ name->sizeHint().height()); + cy+=name->height()+Grid; + url->setGeometry + (framewidth+WORKTEXT_IDENTATION, cy, + childwidth-WORKTEXT_IDENTATION, /* url */ name->sizeHint().height()); + // the work text is drawn in the paint event + // ############################################################################ +} + + +void +TDEAboutContributor::paintEvent(TQPaintEvent* e) +{ // the widgets are simply aligned from top to bottom, since the parent is + // expected to respect the size hint (the widget is only used locally by now) + // ############################################################################ + int cy=frameWidth()+name->height()+email->height()+Grid+url->height()+Grid; + int h=height()-cy-frameWidth(); + int w=width()-WORKTEXT_IDENTATION-2*frameWidth(); + // ----- + TQFrame::paintEvent(e); + if(work.isEmpty()) return; + TQPainter paint(this); // construct painter only if there is something to draw + // ----- + paint.drawText(WORKTEXT_IDENTATION, cy, w, h, AlignLeft | WordBreak, work); + // ############################################################################ +} +// MOC_SKIP_END +#endif + + +#if 0 +TQSize TDEAboutContributor::sizeHint( void ) +{ + int s = KDialog::spacingHint(); + int h = fontMetrics().lineSpacing()*3 + 2*s; + int m = frameWidth(); + + int w = name->sizeHint().width(); + w = QMAX( w, email->sizeHint().width()+s); + w = QMAX( w, url->sizeHint().width()+s); + + if( work.isEmpty() == false ) + { + const int WorkTextWidth=200; + TQRect r = fontMetrics().boundingRect + (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work); + if( w < r.width() ) + { + w = QMAX( w, WorkTextWidth+s ); + } + h += QMAX( fontMetrics().lineSpacing(), r.height() ) + s; + } + return( TQSize( w + 2*m, h + 2*m ) ); + + + /* + int s = 3; + int m = frameWidth() + KDialog::spacingHint(); + int h = ls * 3 + s * 2; + int w = name->sizeHint().width(); + + w = QMAX( w, email->sizeHint().width()+WORKTEXT_IDENTATION); + w = QMAX( w, url->sizeHint().width()+WORKTEXT_IDENTATION); + if( work.isEmpty() == false ) + { + const int WorkTextWidth=200; + + TQRect r = fontMetrics().boundingRect + (0, 0, WorkTextWidth, 32000, WordBreak | AlignLeft, work); + if( w < r.width() ) + { + w = QMAX( w, WorkTextWidth + WORKTEXT_IDENTATION ); + } + h += r.height() + s; + } + return( TQSize( w + 2*m, h + 2*m ) ); + */ +} + + +// +// The widgets are simply aligned from top to bottom, since the parent is +// expected to respect the size hint +// +void TDEAboutContributor::resizeEvent(TQResizeEvent*) +{ + int x = frameWidth(); + int s = KDialog::spacingHint(); + int h = fontMetrics().lineSpacing(); + int w = width() - 2*x; + int y = x; + + name->setGeometry( x, y, w, h ); + y += h + s; + email->setGeometry( x+s, y, w-s, h ); + y += h + s; + url->setGeometry( x+s, y, w-s, h ); + + /* + int x = frameWidth() + KDialog::spacingHint(); + int y = x; + int w = width() - 2*x; + int h = name->sizeHint().height(); + int s = 3; + + name->setGeometry( x, y, w, h ); + y += h + s; + email->setGeometry( x+WORKTEXT_IDENTATION, y, w-WORKTEXT_IDENTATION, h ); + y += h + s; + url->setGeometry( x+WORKTEXT_IDENTATION, y, w-WORKTEXT_IDENTATION, h ); + // + // the work text is drawn in the paint event + // + */ +} + + + +void TDEAboutContributor::paintEvent( TQPaintEvent *e ) +{ + TQFrame::paintEvent(e); + if(work.isEmpty()) return; + + int x = frameWidth() + KDialog::spacingHint(); + int h = fontMetrics().lineSpacing(); + int y = height() - frameWidth() - fontMetrics().lineSpacing(); + int w = width() - frameWidth()*2 - KDialog::spacingHint(); + + TQPainter paint( this ); + paint.drawText( x, y, w, h, AlignLeft | WordBreak, work ); + + /* + + int s = 3; + int x = frameWidth() + KDialog::spacingHint() + WORKTEXT_IDENTATION; + int w = width()-WORKTEXT_IDENTATION-2*(frameWidth()+KDialog::spacingHint()); + int y = frameWidth()+KDialog::spacingHint()+(name->sizeHint().height()+s)*3; + int h = height()-y-frameWidth(); + + TQPainter paint( this ); + paint.drawText( x, y, w, h, AlignLeft | WordBreak, work ); + */ +} +#endif + + + + + + +TDEAboutWidget::TDEAboutWidget(TQWidget *_parent, const char *_name) + : TQWidget(_parent, _name), + version(new TQLabel(this)), + cont(new TQLabel(this)), + logo(new TQLabel(this)), + author(new TDEAboutContributor(this)), + maintainer(new TDEAboutContributor(this)), + showMaintainer(false), + d(0) +{ + // ################################################################# + if( !version || !cont || !logo || !author || !maintainer ) + { + // this will nearly never happen (out of memory in about box?) + kdDebug() << "TDEAboutWidget::TDEAboutWidget: Out of memory." << endl; + tqApp->quit(); + } + // ----- + cont->setText(i18n("Other Contributors:")); + logo->setText(i18n("(No logo available)")); + logo->setFrameStyle(TQFrame::Panel | TQFrame::Raised); + version->setAlignment(AlignCenter); + // ----- + connect(author, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), + TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); + connect(author, TQT_SIGNAL(openURL(const TQString&)), + TQT_SLOT(openURLSlot(const TQString&))); + connect(maintainer, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), + TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); + connect(maintainer, TQT_SIGNAL(openURL(const TQString&)), + TQT_SLOT(openURLSlot(const TQString&))); + // ################################################################# +} + + +void +TDEAboutWidget::adjust() +{ + // ################################################################# + int cx, cy, tempx; + int maintWidth, maintHeight; + TQSize total_size; + // ----- + if(showMaintainer) + { + total_size=maintainer->sizeHint(); + maintWidth=total_size.width(); + maintHeight=total_size.height(); + } else { + maintWidth=0; + maintHeight=0; + } + total_size=author->sizeHint(); + logo->adjustSize(); + cy=version->sizeHint().height()+Grid; + cx=logo->width(); + tempx=QMAX(total_size.width(), maintWidth); + cx+=Grid+tempx; + cx=QMAX(cx, version->sizeHint().width()); + cy+=QMAX(logo->height(), + total_size.height()+(showMaintainer ? Grid+maintHeight : 0)); + // ----- + if(!contributors.isEmpty()) + { + cx=QMAX(cx, cont->sizeHint().width()); + cy+=cont->sizeHint().height()+Grid; + TQPtrListIterator<TDEAboutContributor> _pos(contributors); + TDEAboutContributor* currEntry; + while ( (currEntry = _pos.current()) ) + { + ++_pos; + cy+=currEntry->sizeHint().height(); + } + } + // ----- + setMinimumSize(cx, cy); + // ################################################################# +} + +void +TDEAboutWidget::setLogo(const TQPixmap& i) +{ + // ############################################################################ + logo->setPixmap(i); + // ############################################################################ +} + +void TDEAboutWidget::sendEmailSlot(const TQString &_name, const TQString &_email) +{ + emit(sendEmail(_name, _email)); +} + +void TDEAboutWidget::openURLSlot(const TQString& _url) +{ + emit(openURL(_url)); +} + +void +TDEAboutWidget::setAuthor(const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_w) +{ + // ############################################################################ + author->setName(_name); + author->setEmail(_email); + author->setURL(_url); + author->setWork(_w); + // ############################################################################ +} + +void +TDEAboutWidget::setMaintainer(const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_w) +{ + // ############################################################################ + maintainer->setName(_name); + maintainer->setEmail(_email); + maintainer->setWork(_w); + maintainer->setURL(_url); + showMaintainer=true; + // ############################################################################ +} + +void +TDEAboutWidget::addContributor(const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_w) +{ + // ############################################################################ + TDEAboutContributor* const c=new TDEAboutContributor(this); + // ----- + c->setName(_name); + c->setEmail(_email); + c->setURL(_url); + c->setWork(_w); + contributors.append(c); + connect(c, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), + TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); + connect(c, TQT_SIGNAL(openURL(const TQString&)), TQT_SLOT(openURLSlot(const TQString&))); + // ############################################################################ +} + +void +TDEAboutWidget::setVersion(const TQString &_name) +{ + // ############################################################################ + version->setText(_name); + // ############################################################################ +} + +void +TDEAboutWidget::resizeEvent(TQResizeEvent*) +{ + // ############################################################################ + int _x=0, _y, cx, tempx, tempy; + // ----- set version label geometry: + version->setGeometry(0, 0, width(), version->sizeHint().height()); + _y=version->height()+Grid; + // ----- move logo to correct position: + logo->adjustSize(); + logo->move(0, _y); + // ----- move author and maintainer right to it: + tempx=logo->width()+Grid; + cx=width()-tempx; + author->setGeometry + (tempx, _y, cx, author->sizeHint().height()); + maintainer->setGeometry + (tempx, _y+author->height()+Grid, cx, maintainer->sizeHint().height()); + + _y+=QMAX(logo->height(), + author->height()+(showMaintainer ? Grid+maintainer->height() : 0)); + // ----- + if(!contributors.isEmpty()) + { + tempy=cont->sizeHint().height(); + cont->setGeometry(0, _y, width(), tempy); + cont->show(); + _y+=tempy+Grid; + } else { + cont->hide(); + } + TQPtrListIterator<TDEAboutContributor> _pos(contributors); + TDEAboutContributor* currEntry; + while( (currEntry = _pos.current()) ) + { + ++_pos; + tempy=currEntry->sizeHint().height(); + // y+=Grid; + currEntry->setGeometry(_x, _y, width(), tempy); + _y+=tempy; + } + if(showMaintainer) + { + maintainer->show(); + } else { + maintainer->hide(); + } + // ############################################################################ +} + +TDEAboutDialog::TDEAboutDialog(TQWidget *_parent, const char *_name, bool modal) + : KDialogBase(_parent, _name, modal, TQString::null, Ok, Ok ), + about(new TDEAboutWidget(this)), mContainerBase(0), d(0) +{ + // ################################################################# + if(!about) + { + // this will nearly never happen (out of memory in about box?) + kdDebug() << "TDEAboutDialog::TDEAboutDialog: Out of memory." << endl; + tqApp->quit(); + } + setMainWidget(about); + connect(about, TQT_SIGNAL(sendEmail(const TQString&, const TQString&)), + TQT_SLOT(sendEmailSlot(const TQString&, const TQString&))); + connect(about, TQT_SIGNAL(openURL(const TQString&)), + TQT_SLOT(openURLSlot(const TQString&))); + // ################################################################# +} + + +TDEAboutDialog::TDEAboutDialog( int layoutType, const TQString &_caption, + int buttonMask, ButtonCode defaultButton, + TQWidget *_parent, const char *_name, bool modal, + bool separator, const TQString &user1, + const TQString &user2, const TQString &user3 ) + :KDialogBase( _parent, _name, modal, TQString::null, buttonMask, defaultButton, + separator, user1, user2, user3 ), + about(0), d(0) +{ + setPlainCaption( i18n("About %1").arg(_caption) ); + + mContainerBase = new TDEAboutContainerBase( layoutType, this ); + setMainWidget(mContainerBase); + + connect( mContainerBase, TQT_SIGNAL(urlClick(const TQString &)), + this, TQT_SLOT(openURLSlot(const TQString &))); + connect( mContainerBase, TQT_SIGNAL(mailClick(const TQString &,const TQString &)), + this, TQT_SLOT(sendEmailSlot(const TQString &,const TQString &))); + connect( mContainerBase, TQT_SIGNAL(mouseTrack(int, const TQMouseEvent *)), + this, TQT_SLOT(mouseTrackSlot(int, const TQMouseEvent *))); +} + + +void TDEAboutDialog::show( void ) +{ + adjust(); + if( mContainerBase ) { mContainerBase->show(); } + TQDialog::show(); +} + + +void TDEAboutDialog::show( TQWidget * /*centerParent*/ ) +{ + adjust(); + if( mContainerBase ) { mContainerBase->show(); } + TQDialog::show(); +} + + +void TDEAboutDialog::adjust() +{ + if( !about ) { return; } + about->adjust(); + //initializeGeometry(); + resize( sizeHint() ); +} + + +void TDEAboutDialog::setLogo(const TQPixmap& i) +{ + if( !about ) { return; } + about->setLogo(i); +} + + +void TDEAboutDialog::setMaintainer(const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_w) +{ + // ################################################################# + if( !about ) { return; } + about->setMaintainer(_name, _email, _url, _w); + // ################################################################# +} + +void TDEAboutDialog::setAuthor(const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_work) +{ + // ################################################################# + if( !about ) { return; } + about->setAuthor(_name, _email, _url, _work); + // ################################################################# +} + +void TDEAboutDialog::addContributor(const TQString &_name, const TQString &_email, + const TQString &_url, const TQString &_w) +{ + // ################################################################# + if( !about ) { return; } + about->addContributor(_name, _email, _url, _w); + // ################################################################# +} + +void TDEAboutDialog::setVersion(const TQString &_name) +{ + // ################################################################# + if( !about ) { return; } + about->setVersion(_name); + // ################################################################# +} + +void TDEAboutDialog::sendEmailSlot(const TQString& /*name*/, const TQString& email) +{ + if ( kapp ) + kapp->invokeMailer( email, TQString::null ); + /* + kdDebug() << "TDEAboutDialog::sendEmailSlot: request to send an email to " + << name << ", " << email << endl; + emit(sendEmail(name, email)); + */ +} + +void TDEAboutDialog::openURLSlot(const TQString& url) +{ + if ( kapp ) + kapp->invokeBrowser( url ); + //kdDebug() << "TDEAboutDialog::openURLSlot: request to open URL " << url << endl; + //emit(openURL(url)); +} + + +void TDEAboutDialog::mouseTrackSlot( int /*mode*/, const TQMouseEvent * /*e*/ ) +{ + // By default we do nothing. This method must be reimplemented. +} + + +TQFrame *TDEAboutDialog::addTextPage( const TQString &title, const TQString &text, + bool richText, int numLines ) +{ + if( !mContainerBase ) { return 0; } + return mContainerBase->addTextPage( title, text, richText, numLines ); +} + +TQFrame *TDEAboutDialog::addLicensePage( const TQString &title, const TQString &text, + int numLines ) +{ + if( !mContainerBase ) { return 0; } + return mContainerBase->addLicensePage( title, text, numLines ); +} + + +TDEAboutContainer *TDEAboutDialog::addContainerPage( const TQString &title, + int childAlignment, int innerAlignment ) +{ + if( !mContainerBase ) { return 0; } + return mContainerBase->addContainerPage( title, childAlignment, + innerAlignment); +} + + +TDEAboutContainer *TDEAboutDialog::addScrolledContainerPage( const TQString &title, + int childAlignment, int innerAlignment ) +{ + if( !mContainerBase ) { return 0; } + return mContainerBase->addScrolledContainerPage( title, childAlignment, + innerAlignment); +} + + + +TQFrame *TDEAboutDialog::addPage( const TQString &title ) +{ + if( !mContainerBase ) { return 0; } + return mContainerBase->addEmptyPage( title ); +} + + +TDEAboutContainer *TDEAboutDialog::addContainer( int childAlignment, + int innerAlignment ) +{ + if( !mContainerBase ) { return 0; } + return mContainerBase->addContainer( childAlignment, innerAlignment ); +} + + +void TDEAboutDialog::setTitle( const TQString &title ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setTitle( title ); +} + + +void TDEAboutDialog::setImage( const TQString &fileName ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setImage( fileName ); +} + +// KDE4: remove +void TDEAboutDialog::setIcon( const TQString &fileName ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setProgramLogo( fileName ); +} + +void TDEAboutDialog::setProgramLogo( const TQString &fileName ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setProgramLogo( fileName ); +} + +void TDEAboutDialog::setProgramLogo( const TQPixmap &pixmap ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setProgramLogo( pixmap ); +} + +void TDEAboutDialog::setImageBackgroundColor( const TQColor &color ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setImageBackgroundColor( color ); +} + + +void TDEAboutDialog::setImageFrame( bool state ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setImageFrame( state ); +} + + +void TDEAboutDialog::setProduct( const TQString &appName, const TQString &version, + const TQString &author, const TQString &year ) +{ + if( !mContainerBase ) { return; } + mContainerBase->setProduct( appName, version, author, year ); +} + + + +void TDEAboutDialog::imageURL( TQWidget *_parent, const TQString &_caption, + const TQString &_path, const TQColor &_imageColor, + const TQString &_url ) +{ + TDEAboutDialog a( AbtImageOnly, TQString::null, Close, Close, _parent, "image", true ); + a.setPlainCaption( _caption ); + a.setImage( _path ); + a.setImageBackgroundColor( _imageColor ); + + TDEAboutContainer* const c = a.addContainer( AlignCenter, AlignCenter ); + if( c ) + { + c->addPerson( TQString::null, TQString::null, _url, TQString::null ); + } + a.exec(); +} + + + + +// +// A class that can can monitor mouse movements on the image +// +KImageTrackLabel::KImageTrackLabel( TQWidget *_parent, const char *_name, WFlags f ) + : TQLabel( _parent, _name, f ) +{ + setText( i18n("Image missing")); +} + +void KImageTrackLabel::mousePressEvent( TQMouseEvent *e ) +{ + emit mouseTrack( MousePress, e ); +} + +void KImageTrackLabel::mouseReleaseEvent( TQMouseEvent *e ) +{ + emit mouseTrack( MouseRelease, e ); +} + +void KImageTrackLabel::mouseDoubleClickEvent( TQMouseEvent *e ) +{ + emit mouseTrack( MouseDoubleClick, e ); +} + +void KImageTrackLabel::mouseMoveEvent ( TQMouseEvent *e ) +{ + emit mouseTrack( MouseDoubleClick, e ); +} + +void TDEAboutDialog::virtual_hook( int id, void* data ) +{ KDialogBase::virtual_hook( id, data ); } + diff --git a/tdeui/tdeaboutdialog.h b/tdeui/tdeaboutdialog.h new file mode 100644 index 000000000..fbb19b98e --- /dev/null +++ b/tdeui/tdeaboutdialog.h @@ -0,0 +1,633 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and + * Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +/* + * This file declares a class for creating "About ..." dialogs + * in a general way. It provides geometry management and some + * options to connect for, like emailing the author or maintainer. + */ + + +#ifndef _KABOUTDIALOG_H_ +#define _KABOUTDIALOG_H_ + +#include <kdialogbase.h> +#include <tqstring.h> + +class TQFrame; +class TQLabel; +class TQVBoxLayout; +class TQTabWidget; +class KURLLabel; +class TDEAboutContainer; +class TDEAboutContainerBase; + +class TDEAboutWidgetPrivate; + +class TDEAboutContainerPrivate; +/** + * TDEAboutContainer can be used to make a application specific AboutDialog. + */ +class TDEUI_EXPORT TDEAboutContainer : public TQFrame +{ + Q_OBJECT + + public: + TDEAboutContainer( TQWidget *parent=0, const char *name=0, + int margin=0, int spacing=0, + int childAlignment = AlignCenter, + int innerAlignment = AlignCenter ); + + void addWidget( TQWidget *widget ); + void addPerson( const TQString &name, const TQString &email, + const TQString &url, const TQString &task, + bool showHeader = false, bool showframe = false, + bool showBold = false ); + void addTitle( const TQString &title, int alignment=AlignLeft, + bool showframe = false, bool showBold = false ); + void addImage( const TQString &fileName, int alignment=AlignLeft ); + + virtual TQSize sizeHint( void ) const; + virtual TQSize minimumSizeHint( void ) const; + + protected: + virtual void childEvent( TQChildEvent *e ); + + signals: + void urlClick( const TQString &url ); + void mailClick( const TQString &name, const TQString &address ); + + + private: + TQVBoxLayout *mVbox; + int mAlignment; + TDEAboutContainerPrivate* const d; +}; + +class TDEAboutContributorPrivate; + +/** + * Used internally by TDEAboutWidget + * @internal + */ +class TDEUI_EXPORT TDEAboutContributor : public TQFrame +{ + Q_OBJECT + + public: + TDEAboutContributor( TQWidget *parent=0, const char *name=0, + const TQString &username=TQString::null, + const TQString &email=TQString::null, + const TQString &url=TQString::null, + const TQString &work=TQString::null, + bool showHeader=false, bool showFrame=true, + bool showBold=false ); + + void setName( const TQString &text, const TQString &header=TQString::null, + bool update = true ); + void setEmail( const TQString &text, const TQString &header=TQString::null, + bool update = true ); + void setURL( const TQString &text, const TQString &header=TQString::null, + bool update = true ); + void setWork( const TQString &text, const TQString &header=TQString::null, + bool update = true ); + TQString getName( void ) const; + TQString getEmail( void ) const; + TQString getURL( void ) const; + TQString getWork( void ) const; + + virtual TQSize sizeHint( void ) const; + + protected: + virtual void fontChange( const TQFont &oldFont ); + + protected slots: + void urlClickedSlot( const TQString& ); + void emailClickedSlot( const TQString& emailaddress ); + + private: + void updateLayout( void ); + + signals: + void sendEmail(const TQString& name, const TQString& email); + void openURL(const TQString& url); + + private: + TQLabel *mLabel[4]; + TQLabel *mText[4]; + bool mShowHeader; + bool mShowBold; + + TDEAboutContributorPrivate* const d; + + virtual void setName(const char *_name) { TQFrame::setName(_name); } +}; + +/** + * TDEAboutWidget is the main widget for TDEAboutDialog. + * + * It has a minimum size set. + */ +class TDEUI_EXPORT TDEAboutWidget : public TQWidget +{ + Q_OBJECT + +public: + + /** + * The Qt constructor. + */ + TDEAboutWidget(TQWidget* parent=0, const char* name=0 ); + + /** + * Adjust the minimum size (after setting the properties of the image and + * the labels. + */ + void adjust(); + + /** + * Sets the image as the application logo. + */ + void setLogo(const TQPixmap&); + /** + * Sets the author's name and email address. + */ + void setAuthor(const TQString& name, const TQString& email, + const TQString& url, const TQString& work); + /** + * Sets the maintainers name and email address. + */ + void setMaintainer(const TQString& name, const TQString& email, + const TQString& url, const TQString& work); + /** + * Shows this person as one of the major contributors. + */ + void addContributor(const TQString& name, const TQString& email, + const TQString& url, const TQString& work); + /** + * Sets the text describing the version. + */ + void setVersion(const TQString& name); + // ------------------------------------------------------------------------- +protected slots: + /** + * Catches the signals from the contributors elements. + */ + void sendEmailSlot(const TQString& name, const TQString& email); + /** + * Catches the clicked URLs. + */ + void openURLSlot(const TQString& url); + // ------------------------------------------------------------------------- +signals: + /** + * An email address has been selected by the user. + */ + void sendEmail(const TQString& name, const TQString& email); + /** + * An URL has been clicked. + */ + void openURL(const TQString& url); + // ------------------------------------------------------------------------- +protected: + // events: + /** + * The resize event. + */ + void resizeEvent(TQResizeEvent*); + /** + * The label showing the program version. + */ + TQLabel *version; + /** + * The label showing the text "Other contributors:". + */ + TQLabel *cont; + /** + * The frame showing the logo. + */ + TQLabel *logo; + /** + * The application developer. + */ + TDEAboutContributor *author; + /** + * The application maintainer. + */ + TDEAboutContributor *maintainer; + /** + * Show the maintainer? + */ + bool showMaintainer; + /** + * A set of people who contributed to the application. + */ + TQPtrList<TDEAboutContributor> contributors; + // ######################################################################### + // +private: + TDEAboutWidgetPrivate* const d; +}; + +class TDEAboutDialogPrivate; +/** + * A KDialogBase with predefined main widget. + * + * As a KDialogBase it uses your application wide settings + * for KDialogBase + * objects (base frame tiles, main frame tiles etc). + * To use it, simply create a TDEAboutDialog object, set all (or some) of its + * properties and show it. Do not derive it to create your own about dialog + * until you need some cool features that are unsupported and you have + * contacted me to add them. + * + * The dialog can be created using two different constructors. The + * difference between these constructors is the available components that + * can be used to build the contents of the dialog. The first (Constructor I) + * provides a number of easy to use methods. Basically it allows you + * to add the components of choice, and the components are placed in a + * predefined layout. You do not have to plan the layout. Everything is + * taken care of. + * + * The second constructor (Constructor II) works in quite the same manner + * as the first, but you have better control on where the components + * are postioned in the layout and you have access to an extended number + * of components you can install such as titles, product information, + * a tabbed pages (where you can display rich text with url links) and + * a person (developer) information field. The "About KDE" dialog box is + * created with Constructor II. + * + * For the derived features, see the basic class KDialogBase. + * @author Mirko Boehm (mirko@kde.org) and Espen Sand (espensa@online.no) + * @see KDialogBase + */ +class TDEUI_EXPORT TDEAboutDialog : public KDialogBase +{ + Q_OBJECT + + public: + /** + * Layout formats. + **/ + enum LayoutType + { + AbtPlain = 0x0001, + AbtTabbed = 0x0002, + AbtTitle = 0x0004, + AbtImageLeft = 0x0008, + AbtImageRight = 0x0010, + AbtImageOnly = 0x0020, + AbtProduct = 0x0040, + AbtKDEStandard = AbtTabbed|AbtTitle|AbtImageLeft, + AbtAppStandard = AbtTabbed|AbtTitle|AbtProduct, + AbtImageAndTitle = AbtPlain|AbtTitle|AbtImageOnly + }; + + public: + /** + * The standard Qt constructor (Constructor I). + * + * Add components with the following methods: + * setLogo(), setAuthor(), setMaintainer(), + * addContributor(), or setVersion(). + * The dialog will be laid out automatically. + */ + TDEAboutDialog( TQWidget *parent=0, const char *name=0, bool modal=true ); + + /** + * The extended constructor. (Constructor II). + * + * Add components with the methods: + * setTitle(), setImage(), setImageBackgroundColor(), + * setImageFrame(), setProduct(), addTextPage(), + * addContainerPage(), addContainer(), or addPage(). + * + * @param dialogLayout Use a mask of LayoutType flags. + * @param caption The dialog caption. The text you specify is prepended + * by i18n("About"). + * @param buttonMask Specifies what buttons will be visible. + * @param defaultButton Specifies what button will be marked as the default. + * @param parent Parent of the dialog. + * @param name Dialog name (for internal use only) + * @param modal Sets dialog modality. If false, the rest of the + * program interface (other dialogs, for example) is accessible while + * the dialog is open. + * @param separator If true, a separator line is drawn between the action + * buttons an the main widget. + * @param user1 User button1 text. + * @param user2 User button2 text. + * @param user3 User button3 text. + * + */ + TDEAboutDialog( int dialogLayout, const TQString &caption, int buttonMask, + ButtonCode defaultButton, TQWidget *parent=0, + const char *name=0, bool modal=false, bool separator = false, + const TQString &user1 = TQString::null, + const TQString &user2 = TQString::null, + const TQString &user3 = TQString::null ); + + /** + * Adjusts the dialog. + * + * You can call this method after you have set up all + * the contents but it is not required. It is done automatically when + * show() is executed. + */ + void adjust(); + + /** + * Makes a modeless (modal = false in constructor) dialog visible. + * + * If you reimplement this method make sure you run it + * in the new method (e.g., show()). Reimplemented + * from KDialogBase. + */ + virtual void show( void ); + + /** + * Makes a modeless (modal = false in constructor) dialog visible. + * + * If you reimplmement this method make sure you run it + * in the new method (i.e., show( parent )). + * + * @param centerParent Center the dialog with respect to this widget. + */ + virtual void show( TQWidget *centerParent ); + + /** + * (Constructor II only) + * Sets a title (not caption) in the uppermost area of the dialog. + * + * @param title Title string. + */ + void setTitle( const TQString &title ); + + /** + * (Constructor II only) + * Define an image to be shown in the dialog. The position is dependent + * on the @p dialogLayout in the constructor + * + * @param fileName Path to image file. + */ + void setImage( const TQString &fileName ); + + /** + * (Constructor II only) + * Define the program logo to be shown in the dialog. Use this to override the + * default program logo. For example, use this function if the + * TDEAboutDialog is for a panel applet and you want to override the + * appletproxy logo with your own pixmap. + * + * @param fileName Path to file containing logo data in a format that + * can be loaded by TQPixmap. + * + * @since 3.3 + */ + void setIcon( const TQString &fileName ) KDE_DEPRECATED; // KDE4: remove + + /** + * Overloaded version of setProgramLogo(const TQPixmap& pixmap). + * + * @since 3.4 + */ + void setProgramLogo( const TQString &fileName ); + + /** + * (Constructor II only) + * Define the program logo to be shown in the dialog. Use this to override the + * default program logo. For example, use this function if the + * TDEAboutDialog is for a panel applet and you want to override the + * appletproxy logo with your own pixmap. + * + * @param pixmap The logo pixmap. + * + * @since 3.4 + */ + void setProgramLogo( const TQPixmap &pixmap ); + + /** + * (Constructor II only) + * The image has a minimum size, but is centered within an area if the + * dialog box is enlarged by the user. You set the background color + * of the area with this method. + * + * @param color Background color. + */ + void setImageBackgroundColor( const TQColor &color ); + + /** + * (Constructor II only) + * Enables or disables a frame around the image. The frame is, by default, + * enabled in the constructor + * + * @param state A value of @p true enables the frame + */ + void setImageFrame( bool state ); + + /** + * (Constructor II only) + * Prints the application name, KDE version, author, a copyright sign + * and a year string. To the left of the text the standard application + * icon is displayed. + * + * @param appName The application name. + * @param version Application version. + * @param author One or more authors. + * @param year A string telling when the application was made. + */ + void setProduct( const TQString &appName, const TQString &version, + const TQString &author, const TQString &year ); + + /** + * (Constructor II only) + * Adds a text page to a tab box. The text can be regular text or + * rich text. The rich text can contain URLs and mail links. + * + * @param title Tab name. + * @param text The text to display. + * @param richText Set this to @p true if 'text' is rich text. + * @param numLines The text area height will be adjusted so that this + * is the minimum number of lines of text that are visible. + * @return The frame that contains the page. + */ + TQFrame *addTextPage( const TQString &title, const TQString &text, + bool richText=false, int numLines=10 ); + + /** + * (Constructor II only) + * Adds a license page to a tab box. + * + * @param title Tab name. + * @param text The text to display. + * @param numLines The text area height will be adjusted so that this + * is the minimum number of lines of text that are visible. + * @return The frame that contains the page. + */ + TQFrame *addLicensePage( const TQString &title, const TQString &text, + int numLines=10 ); + + /** + * (Constructor II only) + * Adds a container to a tab box. You can add text and images to a + * container. + * + * @param title Tab name. + * @param childAlignment Specifies how the children of the container are + * aligned with respect to the container. + * @param innerAlignment Specifies how the children are aligned with + * respect to each other. + * @return The new container. + */ + TDEAboutContainer *addContainerPage( const TQString &title, + int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); + + /** + * (Constructor II only) + * Adds a container inside a TQScrollView to a tab box. You can add text + * and images to a container. + * + * @param title Tab name. + * @param childAlignment Specifies how the children of the container are + * aligned with respect to the container. + * @param innerAlignment Specifies how the children are aligned with + * respect to each other. + * @return The new container. + */ + TDEAboutContainer *addScrolledContainerPage( const TQString &title, + int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); + + /** + * (Constructor II only) + * Adds a container. You can add text and images to a container. + * + * @param childAlignment Specifies how the children of the container are + * aligned with respect to the container. + * @param innerAlignment Specifies how the children are aligned with + * respect to each other. + * @return The new container. + */ + TDEAboutContainer *addContainer( int childAlignment, int innerAlignment ); + + /** + * (Constructor II only) + * Adds an empty page to a tab box. + * + * @param title Tab name + * @return The new page. + */ + TQFrame *addPage( const TQString &title ); + + + /** + * (Constructor I only) + * Sets the image as the application logo. + */ + void setLogo(const TQPixmap&); + + /** + * (Constructor I only) + * Sets the author's name and email address. + */ + void setAuthor(const TQString& name, const TQString& email, + const TQString& url, const TQString& work); + + /** + * (Constructor I only) + * Sets the maintainer's name and email address. + */ + void setMaintainer(const TQString& name, const TQString& email, + const TQString& url, const TQString& work); + + /** + * (Constructor I only) + * Show this person as one of the major contributors. + */ + void addContributor(const TQString& name, const TQString& email, + const TQString& url, const TQString& work); + + /** + * (Constructor I only) + * Sets the text describing the version. + */ + void setVersion(const TQString& name); + + /** + * Create a modal dialog with an image in the upper area with a + * URL link below. + */ + static void imageURL( TQWidget *parent, const TQString &caption, + const TQString &path, const TQColor &imageColor, + const TQString &url ); + +signals: + /** + * Send an email to this person. + * + * The application must provide the + * functionality. + */ + void sendEmail(const TQString& name, const TQString& email); + + /** + * Open the selected URL. + */ + void openURL(const TQString& url); + // ---------------------------------------------------------------------------- +protected: + /** + * The main widget (Constructor I) + */ + TDEAboutWidget * about; + + /** + * The main widget (Constructor II) + */ + TDEAboutContainerBase *mContainerBase; + + // ------------------------------------------------------------------------- +protected slots: + + /** + * Connected to widget->sendEmail. + */ + void sendEmailSlot(const TQString& name, const TQString& email); + + /** + * Open this URL. + */ + void openURLSlot(const TQString& url); + + /** + * (Constructor II only) + * Tells the position of the mouse cursor when the left mouse button + * is pressed above an image + */ + virtual void mouseTrackSlot( int mode, const TQMouseEvent *e ); + + // ######################################################################### +protected: + virtual void virtual_hook( int id, void* data ); +private: + TDEAboutDialogPrivate* const d; +}; + +#endif // defined KABOUTDIALOG_H diff --git a/tdeui/tdeabouttde.cpp b/tdeui/tdeabouttde.cpp new file mode 100644 index 000000000..0e7078af4 --- /dev/null +++ b/tdeui/tdeabouttde.cpp @@ -0,0 +1,87 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +// I (espen) prefer that header files are included alphabetically +#include <tdeabouttde.h> +#include <tdeapplication.h> +#include <klocale.h> +#include <kstandarddirs.h> + + +TDEAboutKDE::TDEAboutKDE( TQWidget *parent, const char *name, bool modal ) + :TDEAboutDialog( TDEAboutDialog::AbtKDEStandard, TQString::fromLatin1("TDE"), + KDialogBase::Help|KDialogBase::Close, KDialogBase::Close, + parent, name, modal ) +{ + const TQString text1 = i18n("" + "The <b>Trinity Desktop Environment</b> is a fork of the " + "K Desktop Environment version 3.5, which was originally written by the KDE Team, " + "a world-wide network of software engineers committed to <a " + "href=\"http://www.gnu.org/philosophy/free-sw.html\">Free Software</a> " + "development.<br><br>No single group, company or organization controls the " + "Trinity source code. Everyone is welcome to contribute to Trinity.<br><br>Visit <A " + "HREF=\"http://www.trinitydesktop.org/\">http://www.trinitydesktop.org</A> for more information " + "about Trinity, and <A HREF=\"http://www.kde.org/\">http://www.kde.org</A> " + "for more information on the KDE project. "); + + const TQString text2 = i18n("" + "Software can always be improved, and the Trinity Team is ready to " + "do so. However, you - the user - must tell us when " + "something does not work as expected or could be done better.<br><br>" + "The Trinity Desktop Environment has a bug tracking system. Visit " + "<A HREF=\"http://bugs.pearsoncomputing.net/\">http://bugs.pearsoncomputing.net</A> or " + "use the \"Report Bug...\" dialog from the \"Help\" menu to report bugs.<br><br>" + "If you have a suggestion for improvement then you are welcome to use " + "the bug tracking system to register your wish. Make sure you use the " + "severity called \"Wishlist\"." ); + + const TQString text3 = i18n("" + "You do not have to be a software developer to be a member of the " + "Trinity team. You can join the national teams that translate " + "program interfaces. You can provide graphics, themes, sounds, and " + "improved documentation. You decide!" + "<br><br>" + "Visit " + "<A HREF=\"http://www.trinitydesktop.org/jobs/\">http://www.trinitydesktop.org/jobs/</A> " + "for information on some projects in which you can participate." + "<br><br>" + "If you need more information or documentation, then a visit to " + "<A HREF=\"http://www.trinitydesktop.org/docs/\">http://www.trinitydesktop.org/docs/</A> " + "will provide you with what you need."); + const TQString text4 = i18n("" + "Trinity is available free of charge, but making it is not free.<br><br>" + "<br><br>" + "The Trinity team does need financial support. Most of the money is used to " + "reimburse members and others on expenses they experienced when " + "contributing to Trinity. You are encouraged to support Trinity through a financial " + "donation, using one of the ways described at " + "<a href=\"http://www.trinitydesktop.org/donate.php\">http://www.trinitydesktop.org/donate.php</a>." + "<br><br>Thank you very much in advance for your support!"); + setHelp( TQString::fromLatin1("khelpcenter/main.html"), TQString::null ); + setTitle(i18n("Trinity Desktop Environment. Release %1"). + arg(TQString::fromLatin1(TDE_VERSION_STRING)) ); + addTextPage( i18n("About Trinity","&About"), text1, true ); + addTextPage( i18n("&Report Bugs/Request Enhancements"), text2, true ); + addTextPage( i18n("&Join the Trinity Team"), text3, true ); + addTextPage( i18n("&Support Trinity"), text4, true ); + setImage( locate( "data", TQString::fromLatin1("tdeui/pics/aboutkde.png")) ); + setImageBackgroundColor( white ); +} diff --git a/tdeui/tdeabouttde.h b/tdeui/tdeabouttde.h new file mode 100644 index 000000000..a75b92904 --- /dev/null +++ b/tdeui/tdeabouttde.h @@ -0,0 +1,62 @@ +/* + * This file is part of the KDE Libraries + * Copyright (C) 2000 Espen Sand (espen@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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef _KABOUT_KDE_H_ +#define _KABOUT_KDE_H_ + +#include <tdeaboutdialog.h> + +/** + * @short Standard "About KDE" dialog box, + * + * This class provides the standard "About KDE" dialog box that is used + * KHelpMenu Normally you should not use this class directly but + * rather the KHelpMenu class or even better just subclass your + * toplevel window from TDEMainWindow. If you do the latter, the help + * menu and thereby this dialog box is available through the + * TDEMainWindow::helpMenu() function. + * + * @author Espen Sand (espen@kde.org) + */ + +class TDEUI_EXPORT TDEAboutKDE : public TDEAboutDialog +{ + public: + /** + * Constructor. Creates a fully featured "About KDE" dialog box. + * Note that this dialog is made modeless in the KHelpMenu class so + * the users may expect a modeless dialog. + * + * @param parent The parent of the dialog box. You should use the + * toplevel window so that the dialog becomes centered. + * @param name Internal name of the widget. This name in not used in the + * caption. + * @param modal If false, this widget will be modeless and must be + * made visible using TQWidget::show(). Otherwise it will be + * modal and must be made visible using TQWidget::exec() + */ + TDEAboutKDE( TQWidget *parent=0, const char *name=0, bool modal=true ); +}; + + +#endif + + diff --git a/tdeui/tdeaction.cpp b/tdeui/tdeaction.cpp index 1cae013a2..d817a5ba4 100644 --- a/tdeui/tdeaction.cpp +++ b/tdeui/tdeaction.cpp @@ -33,7 +33,7 @@ #include <tdeaccel.h> #include <tdeaccelbase.h> #include <tdeaccelprivate.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kguiitem.h> #include <tdemainwindow.h> diff --git a/tdeui/tdeactionclasses.cpp b/tdeui/tdeactionclasses.cpp index 3b07f56ca..1fc963887 100644 --- a/tdeui/tdeactionclasses.cpp +++ b/tdeui/tdeactionclasses.cpp @@ -42,7 +42,7 @@ #include <dcopclient.h> #include <dcopref.h> #include <tdeaccel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <tdefontcombo.h> diff --git a/tdeui/tdeactioncollection.cpp b/tdeui/tdeactioncollection.cpp index 9181fca89..16104e242 100644 --- a/tdeui/tdeactioncollection.cpp +++ b/tdeui/tdeactioncollection.cpp @@ -31,7 +31,7 @@ #include <tdeaccel.h> #include <tdeaccelbase.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tqpopupmenu.h> diff --git a/tdeui/tdecmodule.cpp b/tdeui/tdecmodule.cpp index 85a23341e..4e6ce943f 100644 --- a/tdeui/tdecmodule.cpp +++ b/tdeui/tdecmodule.cpp @@ -23,7 +23,7 @@ #include <tqlayout.h> -#include <kaboutdata.h> +#include <tdeaboutdata.h> #include <tdeconfigskeleton.h> #include <tdeconfigdialogmanager.h> #include <kdebug.h> diff --git a/tdeui/tdefontdialog.cpp b/tdeui/tdefontdialog.cpp index 2a8398419..15c687e13 100644 --- a/tdeui/tdefontdialog.cpp +++ b/tdeui/tdefontdialog.cpp @@ -41,7 +41,7 @@ #include <tqwhatsthis.h> #include <tqtooltip.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcharsets.h> #include <tdeconfig.h> #include <kdialog.h> diff --git a/tdeui/tdelistbox.cpp b/tdeui/tdelistbox.cpp index 02ecf2fd1..9f7c23688 100644 --- a/tdeui/tdelistbox.cpp +++ b/tdeui/tdelistbox.cpp @@ -21,7 +21,7 @@ #include <kglobalsettings.h> #include <kcursor.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kipc.h> #include <kdebug.h> diff --git a/tdeui/tdelistview.cpp b/tdeui/tdelistview.cpp index 158eac5ab..020f18679 100644 --- a/tdeui/tdelistview.cpp +++ b/tdeui/tdelistview.cpp @@ -30,7 +30,7 @@ #include <kglobalsettings.h> #include <tdeconfig.h> #include <kcursor.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kipc.h> #include <kdebug.h> diff --git a/tdeui/tdemainwindow.cpp b/tdeui/tdemainwindow.cpp index b7596c262..01b6a09e0 100644 --- a/tdeui/tdemainwindow.cpp +++ b/tdeui/tdemainwindow.cpp @@ -36,7 +36,7 @@ #include <tdeaccel.h> #include <tdeaction.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <khelpmenu.h> diff --git a/tdeui/tdemainwindowiface.cpp b/tdeui/tdemainwindowiface.cpp index fc864d9fa..8f8a9d40c 100644 --- a/tdeui/tdemainwindowiface.cpp +++ b/tdeui/tdemainwindowiface.cpp @@ -20,7 +20,7 @@ #include "tdemainwindowiface.h" #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdcopactionproxy.h> #include <kdcoppropertyproxy.h> #include <tdemainwindow.h> diff --git a/tdeui/tdepopupmenu.cpp b/tdeui/tdepopupmenu.cpp index 62ac6f4ad..46d5c758f 100644 --- a/tdeui/tdepopupmenu.cpp +++ b/tdeui/tdepopupmenu.cpp @@ -30,7 +30,7 @@ #include "tdepopupmenu.h" #include <kdebug.h> -#include <kapplication.h> +#include <tdeapplication.h> TDEPopupTitle::TDEPopupTitle(TQWidget *parent, const char *name) : TQWidget(parent, name) diff --git a/tdeui/tdeshortcutdialog.cpp b/tdeui/tdeshortcutdialog.cpp index 73f06581f..fe3593b7e 100644 --- a/tdeui/tdeshortcutdialog.cpp +++ b/tdeui/tdeshortcutdialog.cpp @@ -52,7 +52,7 @@ #include <tqtimer.h> #include <tqvbox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> #include <kglobal.h> diff --git a/tdeui/tdespell.cpp b/tdeui/tdespell.cpp index 8eac3bde2..629013121 100644 --- a/tdeui/tdespell.cpp +++ b/tdeui/tdespell.cpp @@ -37,7 +37,7 @@ #include <tqtextcodec.h> #include <tqtimer.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kmessagebox.h> #include <kdebug.h> #include <klocale.h> diff --git a/tdeui/tdespelldlg.cpp b/tdeui/tdespelldlg.cpp index ac0ccb984..280ddf861 100644 --- a/tdeui/tdespelldlg.cpp +++ b/tdeui/tdespelldlg.cpp @@ -24,7 +24,7 @@ #include <tqlabel.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tdelistbox.h> #include <kcombobox.h> diff --git a/tdeui/tdetoolbar.cpp b/tdeui/tdetoolbar.cpp index 02173e41b..a095f1493 100644 --- a/tdeui/tdetoolbar.cpp +++ b/tdeui/tdetoolbar.cpp @@ -47,7 +47,7 @@ #include <klineedit.h> #include <kseparator.h> #include <klocale.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeaction.h> #include <kstdaction.h> #include <kglobal.h> diff --git a/tdeui/tdetoolbarbutton.cpp b/tdeui/tdetoolbarbutton.cpp index da5fc7b9b..608c31a32 100644 --- a/tdeui/tdetoolbarbutton.cpp +++ b/tdeui/tdetoolbarbutton.cpp @@ -38,7 +38,7 @@ #include <tqpainter.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kglobal.h> #include <kglobalsettings.h> diff --git a/tdeui/tdetoolbarhandler.cpp b/tdeui/tdetoolbarhandler.cpp index e03880bad..4242a119e 100644 --- a/tdeui/tdetoolbarhandler.cpp +++ b/tdeui/tdetoolbarhandler.cpp @@ -19,7 +19,7 @@ #include "tdetoolbarhandler.h" #include <tqpopupmenu.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdetoolbar.h> #include <tdemainwindow.h> #include <klocale.h> diff --git a/tdeui/tests/itemcontainertest.cpp b/tdeui/tests/itemcontainertest.cpp index af7fb41e2..c96d6a4eb 100644 --- a/tdeui/tests/itemcontainertest.cpp +++ b/tdeui/tests/itemcontainertest.cpp @@ -16,7 +16,7 @@ #include <tqcheckbox.h> #include <tqlabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> #include <tdeconfig.h> #include <kiconview.h> diff --git a/tdeui/tests/kaboutdialogtest.cpp b/tdeui/tests/kaboutdialogtest.cpp index 0555070a6..c3be2de25 100644 --- a/tdeui/tests/kaboutdialogtest.cpp +++ b/tdeui/tests/kaboutdialogtest.cpp @@ -8,10 +8,10 @@ * $Revision$ */ -#include "kaboutdialog.h" +#include "tdeaboutdialog.h" // #include <kimgio.h> #include <tqimage.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> int main(int argc, char** argv) diff --git a/tdeui/tests/kblendtest.cpp b/tdeui/tests/kblendtest.cpp index dc708f2b5..4672b76ee 100644 --- a/tdeui/tests/kblendtest.cpp +++ b/tdeui/tests/kblendtest.cpp @@ -1,5 +1,5 @@ #include "kblendtest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kimageeffect.h> #include <tqpainter.h> #include <tqdatetime.h> diff --git a/tdeui/tests/kbuttonboxtest.cpp b/tdeui/tests/kbuttonboxtest.cpp index 8f2052b28..c9eb1134b 100644 --- a/tdeui/tests/kbuttonboxtest.cpp +++ b/tdeui/tests/kbuttonboxtest.cpp @@ -16,7 +16,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include "kbuttonbox.h" #include <tqlayout.h> #include <tqlabel.h> diff --git a/tdeui/tests/kcharselecttest.cpp b/tdeui/tests/kcharselecttest.cpp index 019f6bd43..ccd6cd10a 100644 --- a/tdeui/tests/kcharselecttest.cpp +++ b/tdeui/tests/kcharselecttest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include "kcharselect.h" diff --git a/tdeui/tests/kcolordlgtest.cpp b/tdeui/tests/kcolordlgtest.cpp index 23c0b89ea..f45df0de7 100644 --- a/tdeui/tests/kcolordlgtest.cpp +++ b/tdeui/tests/kcolordlgtest.cpp @@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include "kcolordialog.h" #include <tdeconfig.h> #include <klocale.h> diff --git a/tdeui/tests/kcolortest.cpp b/tdeui/tests/kcolortest.cpp index 3f61da00f..243de265b 100644 --- a/tdeui/tests/kcolortest.cpp +++ b/tdeui/tests/kcolortest.cpp @@ -1,6 +1,6 @@ #include "kcolortest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kimageeffect.h> #include <stdio.h> #include <tqdatetime.h> diff --git a/tdeui/tests/kcomboboxtest.cpp b/tdeui/tests/kcomboboxtest.cpp index 701710891..225c80c0f 100644 --- a/tdeui/tests/kcomboboxtest.cpp +++ b/tdeui/tests/kcomboboxtest.cpp @@ -6,7 +6,7 @@ #include <assert.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kdialog.h> #include <klocale.h> diff --git a/tdeui/tests/kcompletiontest.cpp b/tdeui/tests/kcompletiontest.cpp index 617957b4c..12e3835dc 100644 --- a/tdeui/tests/kcompletiontest.cpp +++ b/tdeui/tests/kcompletiontest.cpp @@ -18,7 +18,7 @@ #include <tqtooltip.h> #include <tqwhatsthis.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klineedit.h> #include <kcombobox.h> /* diff --git a/tdeui/tests/kdatepicktest.cpp b/tdeui/tests/kdatepicktest.cpp index df8bc7013..abcfeb24a 100644 --- a/tdeui/tests/kdatepicktest.cpp +++ b/tdeui/tests/kdatepicktest.cpp @@ -1,6 +1,6 @@ #include "kdatepicker.h" #include <tqlineedit.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> int main(int argc, char** argv) diff --git a/tdeui/tests/kdatetimewidgettest.cpp b/tdeui/tests/kdatetimewidgettest.cpp index 9b158faf8..721f86492 100644 --- a/tdeui/tests/kdatetimewidgettest.cpp +++ b/tdeui/tests/kdatetimewidgettest.cpp @@ -1,5 +1,5 @@ #include "kdatetimewidget.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> int main(int argc, char** argv) diff --git a/tdeui/tests/kdatewidgettest.cpp b/tdeui/tests/kdatewidgettest.cpp index 16521da20..11fb243f3 100644 --- a/tdeui/tests/kdatewidgettest.cpp +++ b/tdeui/tests/kdatewidgettest.cpp @@ -1,6 +1,6 @@ #include "kdatewidget.h" #include <tqlineedit.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> int main(int argc, char** argv) diff --git a/tdeui/tests/kdesattest.cpp b/tdeui/tests/kdesattest.cpp index fbf93bfe8..8eab0b125 100644 --- a/tdeui/tests/kdesattest.cpp +++ b/tdeui/tests/kdesattest.cpp @@ -1,5 +1,5 @@ #include "kdesattest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kimageeffect.h> #include <tqpainter.h> #include <tqdatetime.h> diff --git a/tdeui/tests/kdialogbasetest.cpp b/tdeui/tests/kdialogbasetest.cpp index b1c7d422c..7f8023bd2 100644 --- a/tdeui/tests/kdialogbasetest.cpp +++ b/tdeui/tests/kdialogbasetest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialogbase.h> #include <tqstring.h> diff --git a/tdeui/tests/kdocktest.cpp b/tdeui/tests/kdocktest.cpp index fbbb799fc..538e2b888 100644 --- a/tdeui/tests/kdocktest.cpp +++ b/tdeui/tests/kdocktest.cpp @@ -1,6 +1,6 @@ #include "kdocktest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kiconloader.h> #include <tqwidget.h> diff --git a/tdeui/tests/kdockwidgetdemo.cpp b/tdeui/tests/kdockwidgetdemo.cpp index c252c7cf8..a922acf2d 100644 --- a/tdeui/tests/kdockwidgetdemo.cpp +++ b/tdeui/tests/kdockwidgetdemo.cpp @@ -20,7 +20,7 @@ #include <tqpainter.h> #include <tdeconfig.h> -#include <kapplication.h> +#include <tdeapplication.h> //#include <kimgio.h> #include <stdlib.h> diff --git a/tdeui/tests/kdockwidgettest.cpp b/tdeui/tests/kdockwidgettest.cpp index 144391f50..683d42acd 100644 --- a/tdeui/tests/kdockwidgettest.cpp +++ b/tdeui/tests/kdockwidgettest.cpp @@ -15,7 +15,7 @@ #include "kdockwidgettest.h" #include <tqpushbutton.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kiconloader.h> #include <kstatusbar.h> #include <kmenubar.h> diff --git a/tdeui/tests/kdualcolortest.cpp b/tdeui/tests/kdualcolortest.cpp index ea749cd6e..e52d6e671 100644 --- a/tdeui/tests/kdualcolortest.cpp +++ b/tdeui/tests/kdualcolortest.cpp @@ -1,6 +1,6 @@ #include "kdualcolortest.h" #include <kdualcolorbutton.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <tqlayout.h> #include <tqpalette.h> diff --git a/tdeui/tests/keditlistboxtest.cpp b/tdeui/tests/keditlistboxtest.cpp index 177a8b6ec..5b4e45ddb 100644 --- a/tdeui/tests/keditlistboxtest.cpp +++ b/tdeui/tests/keditlistboxtest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <keditlistbox.h> #include <kcombobox.h> diff --git a/tdeui/tests/kedittest.cpp b/tdeui/tests/kedittest.cpp index 42d6f659f..f806c3bdf 100644 --- a/tdeui/tests/kedittest.cpp +++ b/tdeui/tests/kedittest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <keditcl.h> #include <tqpopupmenu.h> diff --git a/tdeui/tests/kgradienttest.cpp b/tdeui/tests/kgradienttest.cpp index dcd45673c..4ee8c0f93 100644 --- a/tdeui/tests/kgradienttest.cpp +++ b/tdeui/tests/kgradienttest.cpp @@ -1,5 +1,5 @@ #include "kgradienttest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kpixmapeffect.h> #include <tqpainter.h> #include <tqdatetime.h> diff --git a/tdeui/tests/khashtest.cpp b/tdeui/tests/khashtest.cpp index af7cc60cd..d392fcbc5 100644 --- a/tdeui/tests/khashtest.cpp +++ b/tdeui/tests/khashtest.cpp @@ -1,5 +1,5 @@ #include "khashtest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kpixmapeffect.h> #include <kimageeffect.h> #include <tqpainter.h> diff --git a/tdeui/tests/kinputdialogtest.cpp b/tdeui/tests/kinputdialogtest.cpp index 5db3babff..b40b5c562 100644 --- a/tdeui/tests/kinputdialogtest.cpp +++ b/tdeui/tests/kinputdialogtest.cpp @@ -3,7 +3,7 @@ * License: GPL V2 */ -#include <kapplication.h> +#include <tdeapplication.h> #include <kinputdialog.h> #include <kdebug.h> diff --git a/tdeui/tests/kjanuswidgettest.cpp b/tdeui/tests/kjanuswidgettest.cpp index 12a267a02..71e72fb13 100644 --- a/tdeui/tests/kjanuswidgettest.cpp +++ b/tdeui/tests/kjanuswidgettest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <kjanuswidget.h> #include <tqstring.h> diff --git a/tdeui/tests/kledtest.cpp b/tdeui/tests/kledtest.cpp index 48f2f1430..4ba158776 100644 --- a/tdeui/tests/kledtest.cpp +++ b/tdeui/tests/kledtest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqwidget.h> #include <tqtimer.h> #include <stdlib.h> diff --git a/tdeui/tests/klineeditdlgtest.cpp b/tdeui/tests/klineeditdlgtest.cpp index 012a22b7f..ecc6ac984 100644 --- a/tdeui/tests/klineeditdlgtest.cpp +++ b/tdeui/tests/klineeditdlgtest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <klineeditdlg.h> #include <tqstring.h> diff --git a/tdeui/tests/klineedittest.cpp b/tdeui/tests/klineedittest.cpp index 5146b7d15..793988968 100644 --- a/tdeui/tests/klineedittest.cpp +++ b/tdeui/tests/klineedittest.cpp @@ -4,9 +4,9 @@ #include <tqhbox.h> #include <tqtimer.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kdialog.h> #include <klocale.h> diff --git a/tdeui/tests/kmessageboxtest.cpp b/tdeui/tests/kmessageboxtest.cpp index 69f28e8c6..ce333edee 100644 --- a/tdeui/tests/kmessageboxtest.cpp +++ b/tdeui/tests/kmessageboxtest.cpp @@ -8,7 +8,7 @@ #include <stdio.h> #include <kstatusbar.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kglobal.h> diff --git a/tdeui/tests/knuminputtest.cpp b/tdeui/tests/knuminputtest.cpp index fad4cd50a..9a333dfda 100644 --- a/tdeui/tests/knuminputtest.cpp +++ b/tdeui/tests/knuminputtest.cpp @@ -11,7 +11,7 @@ #include <tqlayout.h> #include <tqvgroupbox.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <knuminput.h> #include "knuminputtest.h" diff --git a/tdeui/tests/kpalettetest.cpp b/tdeui/tests/kpalettetest.cpp index 8edb97a57..94036244e 100644 --- a/tdeui/tests/kpalettetest.cpp +++ b/tdeui/tests/kpalettetest.cpp @@ -1,5 +1,5 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqwidget.h> #include <tqtimer.h> #include <stdlib.h> diff --git a/tdeui/tests/kpanelmenutest.cpp b/tdeui/tests/kpanelmenutest.cpp index 1890ff13e..a14cb3366 100644 --- a/tdeui/tests/kpanelmenutest.cpp +++ b/tdeui/tests/kpanelmenutest.cpp @@ -1,5 +1,5 @@ #include "kpanelmenutest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kstandarddirs.h> #include <dcopclient.h> diff --git a/tdeui/tests/kpixmapregionselectordialogtest.cpp b/tdeui/tests/kpixmapregionselectordialogtest.cpp index 8c5cb545e..28a51a3f7 100644 --- a/tdeui/tests/kpixmapregionselectordialogtest.cpp +++ b/tdeui/tests/kpixmapregionselectordialogtest.cpp @@ -1,8 +1,8 @@ #include "kpixmapregionselectordialog.h" #include <tqpixmap.h> #include <tqimage.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <iostream> static const TDECmdLineOptions options[] = diff --git a/tdeui/tests/kprogresstest.cpp b/tdeui/tests/kprogresstest.cpp index c3665865d..6106a236b 100644 --- a/tdeui/tests/kprogresstest.cpp +++ b/tdeui/tests/kprogresstest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqwidget.h> #include "kprogress.h" diff --git a/tdeui/tests/krulertest.h b/tdeui/tests/krulertest.h index cf1abc155..0242fb5d7 100644 --- a/tdeui/tests/krulertest.h +++ b/tdeui/tests/krulertest.h @@ -3,7 +3,7 @@ #ifndef krulertest_h #define krulertest_h -#include <kapplication.h> +#include <tdeapplication.h> #include <tdemainwindow.h> #include <tqwidget.h> #include <tqcheckbox.h> diff --git a/tdeui/tests/kseparatortest.cpp b/tdeui/tests/kseparatortest.cpp index 17e965ca8..a791fa930 100644 --- a/tdeui/tests/kseparatortest.cpp +++ b/tdeui/tests/kseparatortest.cpp @@ -18,7 +18,7 @@ */ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqlayout.h> #include <tqwidget.h> diff --git a/tdeui/tests/ksqueezedtextlabeltest.cpp b/tdeui/tests/ksqueezedtextlabeltest.cpp index a0a0e400f..7c3fd413c 100644 --- a/tdeui/tests/ksqueezedtextlabeltest.cpp +++ b/tdeui/tests/ksqueezedtextlabeltest.cpp @@ -1,5 +1,5 @@ #include "ksqueezedtextlabel.h" -#include <kapplication.h> +#include <tdeapplication.h> int main( int argc, char **argv ) { diff --git a/tdeui/tests/kstatusbartest.cpp b/tdeui/tests/kstatusbartest.cpp index c06f18b51..82c03e271 100644 --- a/tdeui/tests/kstatusbartest.cpp +++ b/tdeui/tests/kstatusbartest.cpp @@ -10,7 +10,7 @@ #include <stdlib.h> #include "kstatusbar.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tdemainwindow.h> #include <kmenubar.h> #include "kstatusbartest.h" diff --git a/tdeui/tests/ksystemtraytest.cpp b/tdeui/tests/ksystemtraytest.cpp index 07572f8d3..27a6629d9 100644 --- a/tdeui/tests/ksystemtraytest.cpp +++ b/tdeui/tests/ksystemtraytest.cpp @@ -1,5 +1,5 @@ #include <ksystemtray.h> -#include <kapplication.h> +#include <tdeapplication.h> int main(int argc, char **argv) { diff --git a/tdeui/tests/ktabctltest.cpp b/tdeui/tests/ktabctltest.cpp index b864017b0..05fe2aeb3 100644 --- a/tdeui/tests/ktabctltest.cpp +++ b/tdeui/tests/ktabctltest.cpp @@ -2,7 +2,7 @@ * */ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqpushbutton.h> #include <tqlabel.h> #include <tqobject.h> diff --git a/tdeui/tests/ktabwidgettest.cpp b/tdeui/tests/ktabwidgettest.cpp index 84a35952f..64d2795fc 100644 --- a/tdeui/tests/ktabwidgettest.cpp +++ b/tdeui/tests/ktabwidgettest.cpp @@ -2,8 +2,8 @@ #include <tqlayout.h> #include <tqdragobject.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kinputdialog.h> #include <kdebug.h> diff --git a/tdeui/tests/ktextedittest.cpp b/tdeui/tests/ktextedittest.cpp index 6af109d5a..6570bf26d 100644 --- a/tdeui/tests/ktextedittest.cpp +++ b/tdeui/tests/ktextedittest.cpp @@ -17,7 +17,7 @@ Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <ktextedit.h> #include <tqfile.h> diff --git a/tdeui/tests/ktimewidgettest.cpp b/tdeui/tests/ktimewidgettest.cpp index f4465fbf7..bbff45648 100644 --- a/tdeui/tests/ktimewidgettest.cpp +++ b/tdeui/tests/ktimewidgettest.cpp @@ -1,5 +1,5 @@ #include "ktimewidget.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> int main(int argc, char** argv) diff --git a/tdeui/tests/kunbalancedgrdtest.cpp b/tdeui/tests/kunbalancedgrdtest.cpp index d9e7448d8..40904000b 100644 --- a/tdeui/tests/kunbalancedgrdtest.cpp +++ b/tdeui/tests/kunbalancedgrdtest.cpp @@ -1,5 +1,5 @@ #include "kunbalancedgrdtest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kpixmapeffect.h> #include <tqpainter.h> #include <tqstring.h> diff --git a/tdeui/tests/kwizardtest.cpp b/tdeui/tests/kwizardtest.cpp index f103a114f..0635188d0 100644 --- a/tdeui/tests/kwizardtest.cpp +++ b/tdeui/tests/kwizardtest.cpp @@ -20,7 +20,7 @@ #include <tqlabel.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kwizard.h> int main(int argc, char **argv) diff --git a/tdeui/tests/kwordwraptest.cpp b/tdeui/tests/kwordwraptest.cpp index bd51800e8..690fbf157 100644 --- a/tdeui/tests/kwordwraptest.cpp +++ b/tdeui/tests/kwordwraptest.cpp @@ -16,7 +16,7 @@ * Boston, MA 02110-1301, USA. */ -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tqwidget.h> #include "kwordwrap.h" diff --git a/tdeui/tests/kxmlguitest.cpp b/tdeui/tests/kxmlguitest.cpp index 89c5caf30..1a79526aa 100644 --- a/tdeui/tests/kxmlguitest.cpp +++ b/tdeui/tests/kxmlguitest.cpp @@ -1,5 +1,5 @@ #include "kxmlguitest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tdemainwindow.h> #include <kxmlguifactory.h> #include <kxmlguiclient.h> diff --git a/tdeui/tests/tdeactiontest.cpp b/tdeui/tests/tdeactiontest.cpp index d62d9c3fc..dcec16189 100644 --- a/tdeui/tests/tdeactiontest.cpp +++ b/tdeui/tests/tdeactiontest.cpp @@ -1,7 +1,7 @@ #include <tqguardedptr.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdeaction.h> #include <assert.h> diff --git a/tdeui/tests/tdefontdialogtest.cpp b/tdeui/tests/tdefontdialogtest.cpp index 2d4e187b2..ff7ac2840 100644 --- a/tdeui/tests/tdefontdialogtest.cpp +++ b/tdeui/tests/tdefontdialogtest.cpp @@ -24,7 +24,7 @@ */ -#include <kapplication.h> +#include <tdeapplication.h> #include "tdefontdialog.h" #include <tdeconfig.h> diff --git a/tdeui/tests/tdelistviewtest.cpp b/tdeui/tests/tdelistviewtest.cpp index d73baf087..c2a0e78cf 100644 --- a/tdeui/tests/tdelistviewtest.cpp +++ b/tdeui/tests/tdelistviewtest.cpp @@ -1,5 +1,5 @@ #include <tdelistview.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdialogbase.h> #include <tqvbox.h> diff --git a/tdeui/tests/tdemainwindowrestoretest.cpp b/tdeui/tests/tdemainwindowrestoretest.cpp index 7b477f8f7..559348ec0 100644 --- a/tdeui/tests/tdemainwindowrestoretest.cpp +++ b/tdeui/tests/tdemainwindowrestoretest.cpp @@ -1,7 +1,7 @@ #include "tdemainwindowrestoretest.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <tqlabel.h> diff --git a/tdeui/tests/tdemainwindowtest.cpp b/tdeui/tests/tdemainwindowtest.cpp index b83123dde..c8ace159e 100644 --- a/tdeui/tests/tdemainwindowtest.cpp +++ b/tdeui/tests/tdemainwindowtest.cpp @@ -1,7 +1,7 @@ #include <tqtimer.h> #include <tqlabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kstatusbar.h> #include <kmenubar.h> diff --git a/tdeui/tests/tdepopuptest.cpp b/tdeui/tests/tdepopuptest.cpp index c830525f1..f9a97bad4 100644 --- a/tdeui/tests/tdepopuptest.cpp +++ b/tdeui/tests/tdepopuptest.cpp @@ -1,4 +1,4 @@ -#include <kapplication.h> +#include <tdeapplication.h> #include <tqwidget.h> #include <tqcursor.h> #include "tdepopupmenu.h" diff --git a/tdeui/tests/tdespelltest.cpp b/tdeui/tests/tdespelltest.cpp index b4b5e571e..5ec103b99 100644 --- a/tdeui/tests/tdespelltest.cpp +++ b/tdeui/tests/tdespelltest.cpp @@ -17,7 +17,7 @@ */ #include "tdespell.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <tqstring.h> diff --git a/tdeui/tests/tdetoolbarlabelactiontest.cpp b/tdeui/tests/tdetoolbarlabelactiontest.cpp index ae12e56d8..b919c2725 100644 --- a/tdeui/tests/tdetoolbarlabelactiontest.cpp +++ b/tdeui/tests/tdetoolbarlabelactiontest.cpp @@ -18,7 +18,7 @@ #include <tqguardedptr.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdemainwindow.h> #include <klineedit.h> #include <tdelistview.h> diff --git a/tdeui/tests/twindowtest.cpp b/tdeui/tests/twindowtest.cpp index d45bc2554..3823ab46f 100644 --- a/tdeui/tests/twindowtest.cpp +++ b/tdeui/tests/twindowtest.cpp @@ -9,10 +9,10 @@ #include <stdlib.h> #include <kstatusbar.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kcombobox.h> #include <khelpmenu.h> -#include <kcmdlineargs.h> +#include <tdecmdlineargs.h> #include <kmenubar.h> #include <tdetoolbarradiogroup.h> #include <kiconloader.h> diff --git a/tdeui/twindowlistmenu.cpp b/tdeui/twindowlistmenu.cpp index e23cf18da..7ca8fda3f 100644 --- a/tdeui/twindowlistmenu.cpp +++ b/tdeui/twindowlistmenu.cpp @@ -37,8 +37,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kstringhandler.h> #include <netwm.h> -#include <kapplication.h> -#include <kstyle.h> +#include <tdeapplication.h> +#include <tdestyle.h> #include <dcopclient.h> #undef Bool diff --git a/tdeunittest/modrunner.cpp b/tdeunittest/modrunner.cpp index f5e29efa1..4caa2d609 100644 --- a/tdeunittest/modrunner.cpp +++ b/tdeunittest/modrunner.cpp @@ -26,8 +26,8 @@ #include <kdebug.h> #include <kglobal.h> #include <kinstance.h> -#include <kaboutdata.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdecmdlineargs.h> #include <klocale.h> #include "runner.h" diff --git a/tdeunittest/tester.h b/tdeunittest/tester.h index c193cc158..332381ec8 100644 --- a/tdeunittest/tester.h +++ b/tdeunittest/tester.h @@ -134,10 +134,10 @@ SampleTest - 1 test passed, 1 test failed * looks like this: * * @code - * #include <kaboutdata.h> - * #include <kapplication.h> - * #include <kcmdlineargs.h> - * #include <kcmdlineargs.h> + * #include <tdeaboutdata.h> + * #include <tdeapplication.h> + * #include <tdecmdlineargs.h> + * #include <tdecmdlineargs.h> * #include <klocale.h> * #include <tdeunittest/runnergui.h> * diff --git a/tdeutils/kcmultidialog.cpp b/tdeutils/kcmultidialog.cpp index 8c09b8be9..9bb067ca0 100644 --- a/tdeutils/kcmultidialog.cpp +++ b/tdeutils/kcmultidialog.cpp @@ -26,8 +26,8 @@ #include <tqlayout.h> #include <tqpushbutton.h> -#include <kaboutdata.h> -#include <kapplication.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> #include <kdebug.h> #include <kiconloader.h> #include <klibloader.h> diff --git a/tdeutils/kfind.cpp b/tdeutils/kfind.cpp index 7b2da6899..99ef317b6 100644 --- a/tdeutils/kfind.cpp +++ b/tdeutils/kfind.cpp @@ -21,7 +21,7 @@ #include "kfind.h" #include "kfinddialog.h" -#include <kapplication.h> +#include <tdeapplication.h> #include <klocale.h> #include <kmessagebox.h> #include <tqlabel.h> diff --git a/tdeutils/kreplace.cpp b/tdeutils/kreplace.cpp index f825e93cc..0aad733da 100644 --- a/tdeutils/kreplace.cpp +++ b/tdeutils/kreplace.cpp @@ -19,7 +19,7 @@ */ #include <tqlabel.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> diff --git a/tdeutils/tdecmoduleloader.cpp b/tdeutils/tdecmoduleloader.cpp index 3627e1777..73f92379f 100644 --- a/tdeutils/tdecmoduleloader.cpp +++ b/tdeutils/tdecmoduleloader.cpp @@ -25,7 +25,7 @@ #include <tqlabel.h> #include <tqlayout.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <kdebug.h> #include <klocale.h> #include <kmessagebox.h> diff --git a/tdeutils/tdecmoduleproxy.cpp b/tdeutils/tdecmoduleproxy.cpp index 473b8a667..2d3150935 100644 --- a/tdeutils/tdecmoduleproxy.cpp +++ b/tdeutils/tdecmoduleproxy.cpp @@ -35,8 +35,8 @@ #include <dcopclient.h> #include <qxembed.h> -#include <kapplication.h> -#include <kaboutdata.h> +#include <tdeapplication.h> +#include <tdeaboutdata.h> #include <tdecmodule.h> #include <tdecmoduleinfo.h> #include <tdecmoduleloader.h> diff --git a/tdeutils/tdecmoduleproxyIfaceImpl.cpp b/tdeutils/tdecmoduleproxyIfaceImpl.cpp index 127831b02..5b1bcc339 100644 --- a/tdeutils/tdecmoduleproxyIfaceImpl.cpp +++ b/tdeutils/tdecmoduleproxyIfaceImpl.cpp @@ -21,7 +21,7 @@ #include <dcopclient.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tdecmoduleproxy.h> #include <kdebug.h> diff --git a/tdeutils/tests/kfindtest.cpp b/tdeutils/tests/kfindtest.cpp index 6c64245dc..c913e5ec6 100644 --- a/tdeutils/tests/kfindtest.cpp +++ b/tdeutils/tests/kfindtest.cpp @@ -21,8 +21,8 @@ #include "../kfinddialog.h" #include "kfindtest.h" -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <stdlib.h> diff --git a/tdeutils/tests/kreplacetest.cpp b/tdeutils/tests/kreplacetest.cpp index 26b0f7c9e..19ead8e77 100644 --- a/tdeutils/tests/kreplacetest.cpp +++ b/tdeutils/tests/kreplacetest.cpp @@ -19,8 +19,8 @@ #include <assert.h> -#include <kcmdlineargs.h> -#include <kapplication.h> +#include <tdecmdlineargs.h> +#include <tdeapplication.h> #include <tqeventloop.h> #include <kpushbutton.h> #include "../kreplace.h" diff --git a/tdewallet/backend/tests/backendtest.cpp b/tdewallet/backend/tests/backendtest.cpp index 4e19ce43f..76d59b153 100644 --- a/tdewallet/backend/tests/backendtest.cpp +++ b/tdewallet/backend/tests/backendtest.cpp @@ -1,7 +1,7 @@ #include <stdlib.h> #include <stdio.h> -#include <kapplication.h> +#include <tdeapplication.h> #include <tqstring.h> #include "tdewalletbackend.h" diff --git a/tdewallet/tests/tdewalletasync.cpp b/tdewallet/tests/tdewalletasync.cpp index 3512cc799..7668b90a7 100644 --- a/tdewallet/tests/tdewalletasync.cpp +++ b/tdewallet/tests/tdewalletasync.cpp @@ -1,9 +1,9 @@ #include <tqtextstream.h> #include <tqtimer.h> -#include <kaboutdata.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <kglobal.h> #include <kstandarddirs.h> diff --git a/tdewallet/tests/tdewalletboth.cpp b/tdewallet/tests/tdewalletboth.cpp index eabb26eaa..a5ba26711 100644 --- a/tdewallet/tests/tdewalletboth.cpp +++ b/tdewallet/tests/tdewalletboth.cpp @@ -1,9 +1,9 @@ #include <tqtextstream.h> #include <tqtimer.h> -#include <kaboutdata.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <kglobal.h> #include <kstandarddirs.h> diff --git a/tdewallet/tests/tdewalletsync.cpp b/tdewallet/tests/tdewalletsync.cpp index 54ffd6a12..4774e289e 100644 --- a/tdewallet/tests/tdewalletsync.cpp +++ b/tdewallet/tests/tdewalletsync.cpp @@ -1,9 +1,9 @@ #include <tqtextstream.h> #include <tqtimer.h> -#include <kaboutdata.h> -#include <kapplication.h> -#include <kcmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> #include <kdebug.h> #include <kglobal.h> #include <kstandarddirs.h> diff --git a/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro b/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro index 7a81aa820..62b5d6b39 100644 --- a/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro +++ b/win/pro_files/kstyles/thinkeramik/widget-engine/thinkeramik_rel.pro @@ -37,13 +37,13 @@ pixmaploader.cpp #compile in tdefx SOURCES += \ -../../../tdefx/kstyle.cpp \ +../../../tdefx/tdestyle.cpp \ ../../../tdefx/kimageeffect.cpp \ ../../../tdefx/kpixmapeffect.cpp \ ../../../tdefx/kpixmap.cpp system( moc thinkeramik.h -o moc/thinkeramik.moc ) -system( moc ../../../tdefx/kstyle.h -o moc/kstyle.moc ) +system( moc ../../../tdefx/tdestyle.h -o moc/tdestyle.moc ) system( bash ./genemb.sh ) diff --git a/win/pro_files/tdecore/tdecore.pro b/win/pro_files/tdecore/tdecore.pro index 56db79c55..7e564a250 100644 --- a/win/pro_files/tdecore/tdecore.pro +++ b/win/pro_files/tdecore/tdecore.pro @@ -38,9 +38,9 @@ kcalendarsystemgregorian.cpp \ kcalendarsystemhebrew.cpp \ kcalendarsystemhijri.cpp \ kcalendarsystemjalali.cpp \ -kaboutdata.cpp \ +tdeaboutdata.cpp \ kstringhandler.cpp \ -kcmdlineargs.cpp \ +tdecmdlineargs.cpp \ kurldrag.cpp \ kurl.cpp \ kidna.cpp \ @@ -83,7 +83,7 @@ kuniqueapplication.cpp \ tdesycoca.cpp \ tdesycocadict.cpp \ tdesycocafactory.cpp \ -kapplication.cpp \ +tdeapplication.cpp \ kapplication_win.cpp \ kappdcopiface.cpp \ kprocctrl.cpp \ diff --git a/win/pro_files/tdefx/tdefx.pro b/win/pro_files/tdefx/tdefx.pro index f37639f92..f88c90381 100644 --- a/win/pro_files/tdefx/tdefx.pro +++ b/win/pro_files/tdefx/tdefx.pro @@ -15,7 +15,7 @@ kimageeffect.cpp \ kpixmapeffect.cpp \ kpixmapsplitter.cpp \ kpixmap.cpp \ -kstyle.cpp \ +tdestyle.cpp \ kdrawutil.cpp \ kcpuinfo.cpp diff --git a/win/pro_files/tdefx/tdefx_rel.pro b/win/pro_files/tdefx/tdefx_rel.pro index 0f013895c..358f60dc4 100644 --- a/win/pro_files/tdefx/tdefx_rel.pro +++ b/win/pro_files/tdefx/tdefx_rel.pro @@ -10,7 +10,7 @@ include( $(KDELIBS)/win/common.pro ) # needed to export library classes: DEFINES += MAKE_TDEFX_LIB -system( moc kstyle.h -o moc/kstyle.moc ) +system( moc tdestyle.h -o moc/tdestyle.moc ) LIBS -= "$(TDEDIR)\lib\kdewin32_$(KDE_VER).lib" "$(TDEDIR)\lib\ltdl_$(KDE_VER).lib" @@ -18,7 +18,7 @@ SOURCES = \ kimageeffect.cpp \ kpixmapeffect.cpp \ kpixmap.cpp \ -kstyle.cpp \ +tdestyle.cpp \ kdrawutil.cpp \ kcpuinfo.cpp diff --git a/win/pro_files/tdeui/tdeui.pro b/win/pro_files/tdeui/tdeui.pro index 29924203c..b5a506f8b 100644 --- a/win/pro_files/tdeui/tdeui.pro +++ b/win/pro_files/tdeui/tdeui.pro @@ -15,9 +15,9 @@ system( bash kdcopidl ) TARGET = tdeui$$KDEBUG SOURCES = \ -kaboutapplication.cpp \ -kaboutdialog.cpp \ -kaboutkde.cpp \ +tdeaboutapplication.cpp \ +tdeaboutdialog.cpp \ +tdeabouttde.cpp \ tdeactionclasses.cpp \ tdeactioncollection.cpp \ tdeaction.cpp \ -- cgit v1.2.3