summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile385
-rw-r--r--gammu/emb/common/common.pro4
-rw-r--r--gammu/emb/common/device/bluetoth/blue_w32.c4
-rw-r--r--gammu/emb/common/device/bluetoth/blue_w32.h4
-rw-r--r--gammu/emb/common/device/serial/ser_w32.h2
-rw-r--r--gammu/emb/gammu/gammu.pro4
-rw-r--r--kabc/address.h6
-rw-r--r--kabc/addressbook.cpp30
-rw-r--r--kabc/addressbook.h4
-rw-r--r--kabc/addressee.cpp2
-rw-r--r--kabc/addressee.h4
-rw-r--r--kabc/addresseedialog.cpp51
-rw-r--r--kabc/addresseedialog.h18
-rw-r--r--kabc/addresseelist.cpp12
-rw-r--r--kabc/addresseelist.h6
-rw-r--r--kabc/addresseeview.cpp47
-rw-r--r--kabc/addresseeview.h4
-rw-r--r--kabc/distributionlist.cpp6
-rw-r--r--kabc/distributionlist.h7
-rw-r--r--kabc/distributionlistdialog.cpp36
-rw-r--r--kabc/distributionlistdialog.h12
-rw-r--r--kabc/distributionlisteditor.cpp30
-rw-r--r--kabc/distributionlisteditor.h10
-rw-r--r--kabc/field.cpp10
-rw-r--r--kabc/field.h4
-rw-r--r--kabc/formatfactory.cpp2
-rw-r--r--kabc/formatfactory.h4
-rw-r--r--kabc/formats/binary/kabcformat_binaryE.pro2
-rw-r--r--kabc/formats/vcardformatplugin2.cpp20
-rw-r--r--kabc/kabc.pro8
-rw-r--r--kabc/kabcE.pro8
-rw-r--r--kabc/key.h6
-rw-r--r--kabc/phonenumber.h6
-rw-r--r--kabc/picture.cpp2
-rw-r--r--kabc/picture.h2
-rw-r--r--kabc/plugins/dir/dir.pro14
-rw-r--r--kabc/plugins/dir/dirE.pro4
-rw-r--r--kabc/plugins/dir/resourcedir.cpp8
-rw-r--r--kabc/plugins/dir/resourcedirconfig.cpp4
-rw-r--r--kabc/plugins/file/file.pro14
-rw-r--r--kabc/plugins/file/fileE.pro4
-rw-r--r--kabc/plugins/file/resourcefile.cpp10
-rw-r--r--kabc/plugins/file/resourcefileconfig.cpp4
-rw-r--r--kabc/plugins/ldap/ldapE.pro4
-rw-r--r--kabc/plugins/olaccess/olaccess.pro8
-rw-r--r--kabc/plugins/opie/opieE.pro6
-rw-r--r--kabc/plugins/qtopia/qtopia.pro16
-rw-r--r--kabc/plugins/qtopia/qtopiaE.pro6
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp24
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.h9
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp14
-rw-r--r--kabc/plugins/qtopia/resourceqtopiaconfig.cpp4
-rw-r--r--kabc/plugins/sharpdtm/sharpdtmE.pro8
-rw-r--r--kabc/secrecy.h4
-rw-r--r--kabc/sound.h2
-rw-r--r--kabc/tmpaddressbook.cpp2
-rw-r--r--kabc/vcard/AdrParam.cpp10
-rw-r--r--kabc/vcard/AdrValue.cpp9
-rw-r--r--kabc/vcard/AgentParam.cpp6
-rw-r--r--kabc/vcard/AgentValue.cpp6
-rw-r--r--kabc/vcard/ClassValue.cpp6
-rw-r--r--kabc/vcard/ContentLine.cpp36
-rw-r--r--kabc/vcard/DateParam.cpp6
-rw-r--r--kabc/vcard/DateValue.cpp30
-rw-r--r--kabc/vcard/EmailParam.cpp6
-rw-r--r--kabc/vcard/Entity.cpp12
-rw-r--r--kabc/vcard/Enum.cpp8
-rw-r--r--kabc/vcard/FloatValue.cpp8
-rw-r--r--kabc/vcard/GeoValue.cpp6
-rw-r--r--kabc/vcard/ImageParam.cpp6
-rw-r--r--kabc/vcard/ImageValue.cpp6
-rw-r--r--kabc/vcard/ImgValue.cpp6
-rw-r--r--kabc/vcard/LangValue.cpp24
-rw-r--r--kabc/vcard/NValue.cpp10
-rw-r--r--kabc/vcard/OrgValue.cpp10
-rw-r--r--kabc/vcard/Param.cpp16
-rw-r--r--kabc/vcard/PhoneNumberValue.cpp6
-rw-r--r--kabc/vcard/RToken.cpp6
-rw-r--r--kabc/vcard/SoundValue.cpp6
-rw-r--r--kabc/vcard/SourceParam.cpp6
-rw-r--r--kabc/vcard/TelParam.cpp6
-rw-r--r--kabc/vcard/TelValue.cpp6
-rw-r--r--kabc/vcard/TextBinParam.cpp6
-rw-r--r--kabc/vcard/TextBinValue.cpp6
-rw-r--r--kabc/vcard/TextListValue.cpp10
-rw-r--r--kabc/vcard/TextParam.cpp6
-rw-r--r--kabc/vcard/TextValue.cpp8
-rw-r--r--kabc/vcard/URIValue.cpp16
-rw-r--r--kabc/vcard/UTCValue.cpp6
-rw-r--r--kabc/vcard/VCardEntity.cpp12
-rw-r--r--kabc/vcard/VCardv.cpp33
-rw-r--r--kabc/vcard/Value.cpp6
-rw-r--r--kabc/vcard/include/VCardAdrParam.h16
-rw-r--r--kabc/vcard/include/VCardAdrValue.h46
-rw-r--r--kabc/vcard/include/VCardAgentParam.h4
-rw-r--r--kabc/vcard/include/VCardAgentValue.h2
-rw-r--r--kabc/vcard/include/VCardClassValue.h2
-rw-r--r--kabc/vcard/include/VCardContentLine.h18
-rw-r--r--kabc/vcard/include/VCardDateParam.h2
-rw-r--r--kabc/vcard/include/VCardDateValue.h2
-rw-r--r--kabc/vcard/include/VCardDefines.h6
-rw-r--r--kabc/vcard/include/VCardEmailParam.h8
-rw-r--r--kabc/vcard/include/VCardEntity.h14
-rw-r--r--kabc/vcard/include/VCardEnum.h8
-rw-r--r--kabc/vcard/include/VCardFloatValue.h2
-rw-r--r--kabc/vcard/include/VCardImageParam.h2
-rw-r--r--kabc/vcard/include/VCardImageValue.h2
-rw-r--r--kabc/vcard/include/VCardLangValue.h16
-rw-r--r--kabc/vcard/include/VCardNValue.h26
-rw-r--r--kabc/vcard/include/VCardOrgValue.h8
-rw-r--r--kabc/vcard/include/VCardParam.h22
-rw-r--r--kabc/vcard/include/VCardRToken.h4
-rw-r--r--kabc/vcard/include/VCardSoundValue.h2
-rw-r--r--kabc/vcard/include/VCardSourceParam.h12
-rw-r--r--kabc/vcard/include/VCardTelParam.h6
-rw-r--r--kabc/vcard/include/VCardTelValue.h2
-rw-r--r--kabc/vcard/include/VCardTextBinParam.h2
-rw-r--r--kabc/vcard/include/VCardTextBinValue.h2
-rw-r--r--kabc/vcard/include/VCardTextListValue.h8
-rw-r--r--kabc/vcard/include/VCardTextParam.h2
-rw-r--r--kabc/vcard/include/VCardURIValue.h16
-rw-r--r--kabc/vcard/include/VCardUTCValue.h2
-rw-r--r--kabc/vcard/include/VCardVCard.h18
-rw-r--r--kabc/vcard/include/VCardVCardEntity.h6
-rw-r--r--kabc/vcard/include/VCardValue.h6
-rw-r--r--kabc/vcard/include/generated/AdrParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/AdrValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/AgentParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/AgentValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/ClassValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/ContentLine-generated.h10
-rw-r--r--kabc/vcard/include/generated/DateParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/DateValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/EmailParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/FloatValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/GeoValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/Group-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImageParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImageValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImgParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/ImgValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/LangValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/NValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/Name-generated.h10
-rw-r--r--kabc/vcard/include/generated/OrgValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/Param-generated.h10
-rw-r--r--kabc/vcard/include/generated/ParamName-generated.h10
-rw-r--r--kabc/vcard/include/generated/ParamValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/PhoneNumberValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/SoundValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/SourceParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TelParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TelValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextBinParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextBinValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextListValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextNSParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextParam-generated.h10
-rw-r--r--kabc/vcard/include/generated/TextValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/URIValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/UTCValue-generated.h10
-rw-r--r--kabc/vcard/include/generated/VCard-generated.h10
-rw-r--r--kabc/vcard/include/generated/VCardEntity-generated.h10
-rw-r--r--kabc/vcard/include/generated/Value-generated.h10
-rw-r--r--kabc/vcard/testread.cpp12
-rw-r--r--kabc/vcard/testwrite.cpp4
-rw-r--r--kabc/vcard21parser.cpp40
-rw-r--r--kabc/vcard21parser.h10
-rw-r--r--kabc/vcardformatimpl.cpp25
-rw-r--r--kabc/vcardformatplugin.cpp2
-rw-r--r--kabc/vcardparser/vcard.h4
-rw-r--r--kabc/vcardparser/vcardline.cpp6
-rw-r--r--kabc/vcardparser/vcardline.h8
-rw-r--r--kabc/vcardparser/vcardparser.cpp2
-rw-r--r--kabc/vcardparser/vcardtool.cpp2
-rw-r--r--kaddressbook/addresseditwidget.cpp55
-rw-r--r--kaddressbook/addresseditwidget.h18
-rw-r--r--kaddressbook/addresseeconfig.cpp6
-rw-r--r--kaddressbook/addresseeconfig.h6
-rw-r--r--kaddressbook/addresseeeditordialog.cpp9
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp46
-rw-r--r--kaddressbook/addresseeeditorwidget.h12
-rw-r--r--kaddressbook/addresseeutil.cpp2
-rw-r--r--kaddressbook/addviewdialog.cpp16
-rw-r--r--kaddressbook/addviewdialog.h10
-rw-r--r--kaddressbook/details/detailsviewcontainer.cpp19
-rw-r--r--kaddressbook/details/detailsviewcontainer.h8
-rw-r--r--kaddressbook/details/look_basic.cpp6
-rw-r--r--kaddressbook/details/look_basic.h4
-rw-r--r--kaddressbook/details/look_details.cpp12
-rw-r--r--kaddressbook/details/look_details.h4
-rw-r--r--kaddressbook/details/look_html.cpp6
-rw-r--r--kaddressbook/emaileditwidget.cpp16
-rw-r--r--kaddressbook/emaileditwidget.h10
-rw-r--r--kaddressbook/extensionmanager.cpp14
-rw-r--r--kaddressbook/extensionmanager.h10
-rw-r--r--kaddressbook/extensionwidget.cpp5
-rw-r--r--kaddressbook/extensionwidget.h4
-rw-r--r--kaddressbook/features/distributionlistwidget.cpp39
-rw-r--r--kaddressbook/features/distributionlistwidget.h13
-rw-r--r--kaddressbook/features/mergewidget.cpp14
-rw-r--r--kaddressbook/features/mergewidget.h2
-rw-r--r--kaddressbook/filter.cpp2
-rw-r--r--kaddressbook/filter.h4
-rw-r--r--kaddressbook/filtereditdialog.cpp38
-rw-r--r--kaddressbook/filtereditdialog.h9
-rw-r--r--kaddressbook/geowidget.cpp35
-rw-r--r--kaddressbook/geowidget.h4
-rw-r--r--kaddressbook/imagewidget.cpp32
-rw-r--r--kaddressbook/imagewidget.h3
-rw-r--r--kaddressbook/incsearchwidget.cpp14
-rw-r--r--kaddressbook/jumpbuttonbar.cpp13
-rw-r--r--kaddressbook/jumpbuttonbar.h11
-rw-r--r--kaddressbook/kabcore.cpp146
-rw-r--r--kaddressbook/kabcore.h40
-rw-r--r--kaddressbook/kabprefs.cpp4
-rw-r--r--kaddressbook/kabprefs.h8
-rw-r--r--kaddressbook/kaddressbook.pro46
-rw-r--r--kaddressbook/kaddressbookE.pro6
-rw-r--r--kaddressbook/kaddressbookmain.cpp22
-rw-r--r--kaddressbook/kaddressbookmain.h14
-rw-r--r--kaddressbook/kaddressbookview.cpp8
-rw-r--r--kaddressbook/kaddressbookview.h12
-rw-r--r--kaddressbook/kcmconfigs/addresseewidget.cpp36
-rw-r--r--kaddressbook/kcmconfigs/addresseewidget.h8
-rw-r--r--kaddressbook/kcmconfigs/extensionconfigdialog.cpp11
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.cpp59
-rw-r--r--kaddressbook/kcmconfigs/kabconfigwidget.h6
-rw-r--r--kaddressbook/kcmconfigs/kcmkabconfig.cpp8
-rw-r--r--kaddressbook/keywidget.cpp28
-rw-r--r--kaddressbook/mainembedded.cpp5
-rw-r--r--kaddressbook/nameeditdialog.cpp12
-rw-r--r--kaddressbook/old_mainwindow.cpp12
-rw-r--r--kaddressbook/phoneeditwidget.cpp60
-rw-r--r--kaddressbook/phoneeditwidget.h24
-rw-r--r--kaddressbook/secrecywidget.cpp8
-rw-r--r--kaddressbook/undo.cpp4
-rw-r--r--kaddressbook/undo.h4
-rw-r--r--kaddressbook/undocmds.cpp2
-rw-r--r--kaddressbook/viewconfigurefieldspage.cpp54
-rw-r--r--kaddressbook/viewconfigurefieldspage.h8
-rw-r--r--kaddressbook/viewconfigurefilterpage.cpp15
-rw-r--r--kaddressbook/viewconfigurefilterpage.h4
-rw-r--r--kaddressbook/viewconfigurewidget.cpp19
-rw-r--r--kaddressbook/viewconfigurewidget.h4
-rw-r--r--kaddressbook/viewmanager.cpp30
-rw-r--r--kaddressbook/viewmanager.h12
-rw-r--r--kaddressbook/views/cardview.cpp114
-rw-r--r--kaddressbook/views/cardview.h14
-rw-r--r--kaddressbook/views/colorlistbox.cpp25
-rw-r--r--kaddressbook/views/colorlistbox.h15
-rw-r--r--kaddressbook/views/configurecardviewdialog.cpp57
-rw-r--r--kaddressbook/views/configurecardviewdialog.h6
-rw-r--r--kaddressbook/views/configuretableviewdialog.cpp35
-rw-r--r--kaddressbook/views/configuretableviewdialog.h6
-rw-r--r--kaddressbook/views/contactlistview.cpp32
-rw-r--r--kaddressbook/views/contactlistview.h6
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp19
-rw-r--r--kaddressbook/views/kaddressbookcardview.h3
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp60
-rw-r--r--kaddressbook/views/kaddressbookiconview.h29
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp56
-rw-r--r--kaddressbook/views/kaddressbooktableview.h18
-rw-r--r--kaddressbook/xxport/csv_xxport.cpp14
-rw-r--r--kaddressbook/xxport/csvimportdialog.cpp66
-rw-r--r--kaddressbook/xxport/csvimportdialog.h12
-rw-r--r--kaddressbook/xxport/kde2_xxport.cpp4
-rw-r--r--kaddressbook/xxport/vcard_xxport.cpp20
-rw-r--r--kaddressbook/xxportmanager.cpp17
-rw-r--r--kaddressbook/xxportmanager.h4
-rw-r--r--kaddressbook/xxportobject.cpp4
-rw-r--r--kaddressbook/xxportselectdialog.cpp59
-rw-r--r--kaddressbook/xxportselectdialog.h12
-rw-r--r--kalarmd/alarmdialog.cpp26
-rw-r--r--kalarmd/alarmdialog.h2
-rw-r--r--kalarmd/simplealarmdaemonimpl.cpp16
-rw-r--r--kalarmd/simplealarmdaemonimpl.h3
-rw-r--r--kdepim-desktop.pro4
-rw-r--r--kmicromail/accountitem.cpp128
-rw-r--r--kmicromail/accountitem.h63
-rw-r--r--kmicromail/accountview.cpp30
-rw-r--r--kmicromail/accountview.h22
-rw-r--r--kmicromail/composemail.cpp14
-rw-r--r--kmicromail/composemail.h6
-rw-r--r--kmicromail/editaccounts.cpp40
-rw-r--r--kmicromail/editaccounts.h18
-rw-r--r--kmicromail/kmicromail.pro10
-rw-r--r--kmicromail/kmicromailE.pro2
-rw-r--r--kmicromail/koprefs.cpp2
-rw-r--r--kmicromail/koprefsdialog.cpp149
-rw-r--r--kmicromail/koprefsdialog.h12
-rw-r--r--kmicromail/libetpan/libetpan.pro2
-rw-r--r--kmicromail/libetpan/libetpanE.pro2
-rw-r--r--kmicromail/libmailwrapper/abstractmail.cpp30
-rw-r--r--kmicromail/libmailwrapper/abstractmail.h12
-rw-r--r--kmicromail/libmailwrapper/generatemail.cpp6
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp14
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp28
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.h14
-rw-r--r--kmicromail/libmailwrapper/libmailwrapper.pro8
-rw-r--r--kmicromail/libmailwrapper/logindialog.cpp2
-rw-r--r--kmicromail/libmailwrapper/logindialog.h2
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp10
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h14
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.cpp14
-rw-r--r--kmicromail/libmailwrapper/mailwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/mboxwrapper.cpp14
-rw-r--r--kmicromail/libmailwrapper/mboxwrapper.h10
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.cpp12
-rw-r--r--kmicromail/libmailwrapper/mhwrapper.h8
-rw-r--r--kmicromail/libmailwrapper/nntpwrapper.cpp12
-rw-r--r--kmicromail/libmailwrapper/nntpwrapper.h6
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp20
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.h8
-rw-r--r--kmicromail/libmailwrapper/sendmailprogress.cpp2
-rw-r--r--kmicromail/libmailwrapper/settings.cpp10
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp6
-rw-r--r--kmicromail/mailistviewitem.cpp4
-rw-r--r--kmicromail/mailistviewitem.h2
-rw-r--r--kmicromail/main.cpp5
-rw-r--r--kmicromail/mainwindow.cpp74
-rw-r--r--kmicromail/mainwindow.h26
-rw-r--r--kmicromail/nntpgroups.cpp16
-rw-r--r--kmicromail/nntpgroups.h2
-rw-r--r--kmicromail/nntpgroupsdlg.cpp4
-rw-r--r--kmicromail/opiemail.cpp47
-rw-r--r--kmicromail/opiemail.h17
-rw-r--r--kmicromail/qpe/qdialog.h2
-rw-r--r--kmicromail/qpe/qdialog_hacked.cpp6
-rw-r--r--kmicromail/selectsmtp.cpp4
-rw-r--r--kmicromail/selectsmtp.h2
-rw-r--r--kmicromail/selectstore.h2
-rw-r--r--kmicromail/settingsdialog.cpp6
-rw-r--r--kmicromail/settingsdialog.h2
-rw-r--r--kmicromail/statuswidget.cpp4
-rw-r--r--kmicromail/statuswidget.h2
-rw-r--r--kmicromail/viewmail.cpp47
-rw-r--r--kmicromail/viewmail.h26
-rw-r--r--kmicromail/viewmailbase.cpp25
-rw-r--r--kmicromail/viewmailbase.h25
-rw-r--r--korganizer/calendarview.cpp148
-rw-r--r--korganizer/calendarview.h32
-rw-r--r--korganizer/calprintbase.cpp102
-rw-r--r--korganizer/calprinter.cpp23
-rw-r--r--korganizer/calprinter.h18
-rw-r--r--korganizer/calprintplugins.cpp4
-rw-r--r--korganizer/cellitem.cpp14
-rw-r--r--korganizer/cellitem.h4
-rw-r--r--korganizer/datenavigatorcontainer.cpp2
-rw-r--r--korganizer/datenavigatorcontainer.h5
-rw-r--r--korganizer/filteredit_base.cpp40
-rw-r--r--korganizer/filteredit_base.h42
-rw-r--r--korganizer/filtereditdialog.cpp11
-rw-r--r--korganizer/filtereditdialog.h6
-rw-r--r--korganizer/incomingdialog.cpp30
-rw-r--r--korganizer/incomingdialog.h10
-rw-r--r--korganizer/incomingdialog_base.cpp14
-rw-r--r--korganizer/incomingdialog_base.h22
-rw-r--r--korganizer/interfaces/korganizer/baseview.h8
-rw-r--r--korganizer/interfaces/korganizer/calendarviewbase.h4
-rw-r--r--korganizer/journalentry.cpp39
-rw-r--r--korganizer/journalentry.h9
-rw-r--r--korganizer/kdatenavigator.cpp20
-rw-r--r--korganizer/kdatenavigator.h11
-rw-r--r--korganizer/koagenda.cpp169
-rw-r--r--korganizer/koagenda.h43
-rw-r--r--korganizer/koagendaitem.cpp70
-rw-r--r--korganizer/koagendaitem.h17
-rw-r--r--korganizer/koagendaview.cpp78
-rw-r--r--korganizer/koagendaview.h52
-rw-r--r--korganizer/kocounterdialog.h2
-rw-r--r--korganizer/kodaymatrix.cpp47
-rw-r--r--korganizer/kodaymatrix.h14
-rw-r--r--korganizer/kodialogmanager.cpp8
-rw-r--r--korganizer/kodialogmanager.h4
-rw-r--r--korganizer/koeditordetails.cpp38
-rw-r--r--korganizer/koeditordetails.h12
-rw-r--r--korganizer/koeditorgeneral.cpp39
-rw-r--r--korganizer/koeditorgeneral.h21
-rw-r--r--korganizer/koeditorgeneralevent.cpp32
-rw-r--r--korganizer/koeditorgeneralevent.h12
-rw-r--r--korganizer/koeditorgeneraltodo.cpp39
-rw-r--r--korganizer/koeditorgeneraltodo.h16
-rw-r--r--korganizer/koeditorrecurrence.cpp94
-rw-r--r--korganizer/koeditorrecurrence.h30
-rw-r--r--korganizer/koeventeditor.cpp43
-rw-r--r--korganizer/koeventpopupmenu.cpp17
-rw-r--r--korganizer/koeventpopupmenu.h16
-rw-r--r--korganizer/koeventview.cpp4
-rw-r--r--korganizer/koeventview.h4
-rw-r--r--korganizer/koeventviewer.cpp37
-rw-r--r--korganizer/koeventviewer.h17
-rw-r--r--korganizer/koeventviewerdialog.cpp5
-rw-r--r--korganizer/koeventviewerdialog.h5
-rw-r--r--korganizer/kofilterview.cpp48
-rw-r--r--korganizer/kofilterview.h36
-rw-r--r--korganizer/koimportoldialog.cpp30
-rw-r--r--korganizer/koimportoldialog.h4
-rw-r--r--korganizer/koincidenceeditor.cpp10
-rw-r--r--korganizer/kojournalview.cpp36
-rw-r--r--korganizer/kojournalview.h15
-rw-r--r--korganizer/kolistview.cpp193
-rw-r--r--korganizer/kolistview.h42
-rw-r--r--korganizer/komonthview.cpp218
-rw-r--r--korganizer/komonthview.h57
-rw-r--r--korganizer/koprefs.cpp8
-rw-r--r--korganizer/koprefs.h11
-rw-r--r--korganizer/koprefsdialog.cpp138
-rw-r--r--korganizer/koprefsdialog.h12
-rw-r--r--korganizer/korganizer.pro57
-rw-r--r--korganizer/korganizerE.pro6
-rw-r--r--korganizer/kotimespanview.cpp20
-rw-r--r--korganizer/kotimespanview.h6
-rw-r--r--korganizer/kotodoeditor.cpp43
-rw-r--r--korganizer/kotodoview.cpp198
-rw-r--r--korganizer/kotodoview.h58
-rw-r--r--korganizer/kotodoviewitem.cpp42
-rw-r--r--korganizer/kotodoviewitem.h14
-rw-r--r--korganizer/koviewmanager.cpp8
-rw-r--r--korganizer/kowhatsnextview.cpp38
-rw-r--r--korganizer/kowhatsnextview.h20
-rw-r--r--korganizer/ktimeedit.cpp89
-rw-r--r--korganizer/ktimeedit.h7
-rw-r--r--korganizer/lineview.cpp2
-rw-r--r--korganizer/lineview.h8
-rw-r--r--korganizer/main.cpp10
-rw-r--r--korganizer/mainwindow.cpp316
-rw-r--r--korganizer/mainwindow.h68
-rw-r--r--korganizer/navigatorbar.cpp29
-rw-r--r--korganizer/navigatorbar.h7
-rw-r--r--korganizer/outgoingdialog.cpp28
-rw-r--r--korganizer/outgoingdialog.h10
-rw-r--r--korganizer/outgoingdialog_base.cpp18
-rw-r--r--korganizer/outgoingdialog_base.h22
-rw-r--r--korganizer/publishdialog.cpp18
-rw-r--r--korganizer/publishdialog.h4
-rw-r--r--korganizer/publishdialog_base.cpp27
-rw-r--r--korganizer/publishdialog_base.h28
-rw-r--r--korganizer/savetemplatedialog.cpp7
-rw-r--r--korganizer/searchdialog.cpp43
-rw-r--r--korganizer/searchdialog.h16
-rw-r--r--korganizer/statusdialog.cpp9
-rw-r--r--korganizer/timeline.cpp6
-rw-r--r--korganizer/timeline.h4
-rw-r--r--korganizer/timespanview.cpp22
-rw-r--r--korganizer/timespanview.h10
-rw-r--r--libetpan/libetpan.pro5
-rw-r--r--libetpan/libetpanE.pro2
-rw-r--r--libical/src/libical/libical.pro2
-rw-r--r--libical/src/libicalss/libicalss.pro2
-rw-r--r--libkcal/alarm.cpp10
-rw-r--r--libkcal/alarm.h12
-rw-r--r--libkcal/calendar.cpp66
-rw-r--r--libkcal/calendar.h40
-rw-r--r--libkcal/calendarlocal.cpp66
-rw-r--r--libkcal/calendarlocal.h28
-rw-r--r--libkcal/calfilter.cpp6
-rw-r--r--libkcal/calfilter.h10
-rw-r--r--libkcal/customproperties.cpp32
-rw-r--r--libkcal/customproperties.h22
-rw-r--r--libkcal/dndfactory.cpp9
-rw-r--r--libkcal/dndfactory.h2
-rw-r--r--libkcal/dndfactory_dummy.h2
-rw-r--r--libkcal/dummyscheduler.cpp16
-rw-r--r--libkcal/dummyscheduler.h4
-rw-r--r--libkcal/event.cpp2
-rw-r--r--libkcal/event.h4
-rw-r--r--libkcal/filestorage.cpp2
-rw-r--r--libkcal/freebusy.cpp11
-rw-r--r--libkcal/freebusy.h14
-rw-r--r--libkcal/icaldrag.cpp2
-rw-r--r--libkcal/icaldrag.h4
-rw-r--r--libkcal/icalformat.cpp32
-rw-r--r--libkcal/icalformat.h4
-rw-r--r--libkcal/icalformatimpl.cpp35
-rw-r--r--libkcal/icalformatimpl.h6
-rw-r--r--libkcal/imipscheduler.cpp6
-rw-r--r--libkcal/imipscheduler.h4
-rw-r--r--libkcal/incidence.cpp38
-rw-r--r--libkcal/incidence.h20
-rw-r--r--libkcal/incidencebase.cpp14
-rw-r--r--libkcal/incidencebase.h16
-rw-r--r--libkcal/journal.h4
-rw-r--r--libkcal/kincidenceformatter.cpp10
-rw-r--r--libkcal/libkcal.pro6
-rw-r--r--libkcal/libkcalE.pro2
-rw-r--r--libkcal/listbase.h24
-rw-r--r--libkcal/phoneformat.cpp23
-rw-r--r--libkcal/qtopiaformat.cpp8
-rw-r--r--libkcal/recurrence.cpp187
-rw-r--r--libkcal/recurrence.h26
-rw-r--r--libkcal/scheduler.cpp12
-rw-r--r--libkcal/scheduler.h4
-rw-r--r--libkcal/sharpformat.cpp48
-rw-r--r--libkcal/todo.cpp2
-rw-r--r--libkcal/todo.h4
-rw-r--r--libkcal/vcaldrag.cpp2
-rw-r--r--libkcal/vcaldrag.h4
-rw-r--r--libkcal/vcalformat.cpp52
-rw-r--r--libkcal/vcalformat.h13
-rw-r--r--libkdepim/categoryeditdialog.cpp19
-rw-r--r--libkdepim/categoryeditdialog.h18
-rw-r--r--libkdepim/categoryeditdialog_base.cpp20
-rw-r--r--libkdepim/categoryeditdialog_base.h26
-rw-r--r--libkdepim/categoryselectdialog.cpp43
-rw-r--r--libkdepim/categoryselectdialog.h10
-rw-r--r--libkdepim/categoryselectdialog_base.cpp19
-rw-r--r--libkdepim/categoryselectdialog_base.h26
-rw-r--r--libkdepim/externalapphandler.cpp30
-rw-r--r--libkdepim/externalapphandler.h15
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp4
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp53
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h6
-rw-r--r--libkdepim/kdateedit.cpp40
-rw-r--r--libkdepim/kdateedit.h11
-rw-r--r--libkdepim/kdatepicker.cpp8
-rw-r--r--libkdepim/kdatepicker.h7
-rw-r--r--libkdepim/kpimglobalprefs.cpp10
-rw-r--r--libkdepim/kpimglobalprefs.h4
-rw-r--r--libkdepim/kprefsdialog.cpp19
-rw-r--r--libkdepim/kprefsdialog.h12
-rw-r--r--libkdepim/kprefswidget.cpp19
-rw-r--r--libkdepim/kprefswidget.h12
-rw-r--r--libkdepim/ksyncmanager.cpp97
-rw-r--r--libkdepim/ksyncmanager.h26
-rw-r--r--libkdepim/ksyncprefsdialog.cpp130
-rw-r--r--libkdepim/ksyncprefsdialog.h30
-rw-r--r--libkdepim/ksyncprofile.h2
-rw-r--r--libkdepim/libkdepim.pro4
-rw-r--r--libkdepim/libkdepimE.pro6
-rwxr-xr-xlibkdepim/ol_access.cpp52
-rwxr-xr-xlibkdepim/ol_access.h4
-rw-r--r--libkdepim/phoneaccess.cpp15
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp194
-rw-r--r--microkde/KDGanttMinimizeSplitter.h35
-rwxr-xr-xmicrokde/fncolordialog.h16
-rw-r--r--microkde/kapplication.cpp33
-rw-r--r--microkde/kcolorbutton.cpp3
-rw-r--r--microkde/kconfig.cpp30
-rw-r--r--microkde/kconfig.h6
-rw-r--r--microkde/kdatepickernew.cpp2
-rw-r--r--microkde/kdatetbl.cpp99
-rw-r--r--microkde/kdatetbl.h20
-rw-r--r--microkde/kdebug.h4
-rw-r--r--microkde/kdecore/kcatalogue.cpp4
-rw-r--r--microkde/kdecore/kconfigbase.h4
-rw-r--r--microkde/kdecore/klibloader.cpp29
-rw-r--r--microkde/kdecore/klibloader.h10
-rw-r--r--microkde/kdecore/klocale.cpp23
-rw-r--r--microkde/kdecore/klocale.h4
-rw-r--r--microkde/kdecore/kmdcodec.cpp139
-rw-r--r--microkde/kdecore/kmdcodec.h38
-rw-r--r--microkde/kdecore/kprefs.cpp16
-rw-r--r--microkde/kdecore/kprefs.h10
-rw-r--r--microkde/kdecore/kshortcut.h8
-rw-r--r--microkde/kdecore/kstandarddirs.cpp24
-rw-r--r--microkde/kdecore/kstandarddirs.h10
-rw-r--r--microkde/kdeui/kaction.cpp75
-rw-r--r--microkde/kdeui/kaction.h26
-rw-r--r--microkde/kdeui/kactionclasses.cpp111
-rw-r--r--microkde/kdeui/kactionclasses.h51
-rw-r--r--microkde/kdeui/kactioncollection.cpp50
-rw-r--r--microkde/kdeui/kactioncollection.h4
-rw-r--r--microkde/kdeui/kbuttonbox.cpp18
-rw-r--r--microkde/kdeui/kbuttonbox.h4
-rw-r--r--microkde/kdeui/kguiitem.cpp14
-rw-r--r--microkde/kdeui/kguiitem.h12
-rw-r--r--microkde/kdeui/kjanuswidget.cpp140
-rw-r--r--microkde/kdeui/kjanuswidget.h56
-rw-r--r--microkde/kdeui/klistbox.cpp56
-rw-r--r--microkde/kdeui/klistbox.h25
-rw-r--r--microkde/kdeui/klistview.cpp337
-rw-r--r--microkde/kdeui/klistview.h121
-rw-r--r--microkde/kdeui/kmainwindow.cpp97
-rw-r--r--microkde/kdeui/kmainwindow.h19
-rw-r--r--microkde/kdeui/knuminput.cpp61
-rw-r--r--microkde/kdeui/knuminput.h15
-rw-r--r--microkde/kdeui/kpopupmenu.cpp5
-rw-r--r--microkde/kdeui/kpopupmenu.h6
-rw-r--r--microkde/kdeui/kseparator.cpp18
-rw-r--r--microkde/kdeui/kseparator.h8
-rw-r--r--microkde/kdeui/ksqueezedtextlabel.cpp3
-rw-r--r--microkde/kdeui/ksqueezedtextlabel.h2
-rw-r--r--microkde/kdeui/kstdaction.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.cpp185
-rw-r--r--microkde/kdeui/ktoolbar.h68
-rw-r--r--microkde/kdeui/ktoolbarbutton.cpp106
-rw-r--r--microkde/kdeui/ktoolbarbutton.h17
-rw-r--r--microkde/kdeui/ktoolbarhandler.cpp26
-rw-r--r--microkde/kdeui/ktoolbarhandler.h10
-rw-r--r--microkde/kdeui/kxmlguiclient.cpp12
-rw-r--r--microkde/kdeui/kxmlguiclient.h6
-rw-r--r--microkde/kdialog.cpp10
-rw-r--r--microkde/kdialog.h6
-rw-r--r--microkde/kdialogbase.cpp20
-rw-r--r--microkde/kdialogbase.h16
-rw-r--r--microkde/keditlistbox.cpp33
-rw-r--r--microkde/keditlistbox.h16
-rw-r--r--microkde/kfiledialog.cpp14
-rw-r--r--microkde/kfontdialog.cpp4
-rw-r--r--microkde/kglobal.cpp5
-rw-r--r--microkde/kglobalsettings.cpp1
-rw-r--r--microkde/kiconloader.cpp12
-rw-r--r--microkde/kiconloader.h4
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp10
-rw-r--r--microkde/kio/kfile/kurlrequester.h4
-rw-r--r--microkde/kio/kio/kdirwatch.cpp12
-rw-r--r--microkde/kio/kio/kdirwatch_p.h10
-rw-r--r--microkde/klineedit.h2
-rw-r--r--microkde/klineeditdlg.h4
-rw-r--r--microkde/kresources/configdialog.cpp17
-rw-r--r--microkde/kresources/configpage.cpp38
-rw-r--r--microkde/kresources/configpage.h10
-rw-r--r--microkde/kresources/factory.cpp6
-rw-r--r--microkde/kresources/factory.h4
-rw-r--r--microkde/kresources/kcmkresources.cpp7
-rw-r--r--microkde/kresources/manager.h8
-rw-r--r--microkde/kresources/managerimpl.cpp10
-rw-r--r--microkde/kresources/managerimpl.h8
-rw-r--r--microkde/kresources/resource.h4
-rw-r--r--microkde/kresources/selectdialog.cpp22
-rw-r--r--microkde/kresources/selectdialog.h10
-rw-r--r--microkde/ksystemtray.cpp3
-rw-r--r--microkde/ksystemtray.h2
-rw-r--r--microkde/ktempfile.cpp4
-rw-r--r--microkde/ktempfile.h4
-rw-r--r--microkde/ktextedit.cpp16
-rw-r--r--microkde/ktextedit.h6
-rw-r--r--microkde/kurl.cpp30
-rw-r--r--microkde/kurl.h14
-rw-r--r--microkde/kutils/kcmultidialog.cpp16
-rw-r--r--microkde/kutils/kcmultidialog.h8
-rw-r--r--microkde/microkde.pro4
-rw-r--r--microkde/microkdeE.pro2
-rw-r--r--microkde/ofileselector_p.cpp2
-rw-r--r--microkde/ofileselector_p.h2
-rw-r--r--microkde/qlayoutengine_p.h8
-rw-r--r--pwmanager/libcrypt/cipher/cipher.pro2
-rw-r--r--pwmanager/libcrypt/error/error.pro4
-rw-r--r--pwmanager/libcrypt/mpi/mpi.pro2
-rw-r--r--pwmanager/libcrypt/zlib/zlib.pro2
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.cpp19
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.h17
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.cpp6
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.h10
-rw-r--r--pwmanager/pwmanager/binentrygen.h2
-rw-r--r--pwmanager/pwmanager/commentbox.cpp12
-rw-r--r--pwmanager/pwmanager/commentbox.h8
-rw-r--r--pwmanager/pwmanager/csv.cpp36
-rw-r--r--pwmanager/pwmanager/csv.h6
-rw-r--r--pwmanager/pwmanager/editcategory.cpp8
-rw-r--r--pwmanager/pwmanager/editcategory.h15
-rw-r--r--pwmanager/pwmanager/findwnd_emb.cpp8
-rw-r--r--pwmanager/pwmanager/findwndimpl.cpp4
-rw-r--r--pwmanager/pwmanager/genpasswd.cpp4
-rw-r--r--pwmanager/pwmanager/genpasswd.h4
-rw-r--r--pwmanager/pwmanager/getkeycardwnd.cpp13
-rw-r--r--pwmanager/pwmanager/getkeycardwnd.h12
-rw-r--r--pwmanager/pwmanager/getmasterpwwnd_emb.cpp9
-rw-r--r--pwmanager/pwmanager/getmasterpwwndimpl.cpp4
-rw-r--r--pwmanager/pwmanager/globalstuff.h4
-rw-r--r--pwmanager/pwmanager/htmlgen.cpp2
-rw-r--r--pwmanager/pwmanager/ipc.cpp12
-rw-r--r--pwmanager/pwmanager/ipc.h4
-rw-r--r--pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp4
-rw-r--r--pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp27
-rw-r--r--pwmanager/pwmanager/listobjselectwnd.cpp19
-rw-r--r--pwmanager/pwmanager/listobjselectwnd.h18
-rw-r--r--pwmanager/pwmanager/listviewpwm.cpp17
-rw-r--r--pwmanager/pwmanager/listviewpwm.h7
-rw-r--r--pwmanager/pwmanager/main.cpp1
-rw-r--r--pwmanager/pwmanager/printtext.h4
-rw-r--r--pwmanager/pwmanager/pwgenwnd_emb.cpp15
-rw-r--r--pwmanager/pwmanager/pwgenwndimpl.cpp2
-rw-r--r--pwmanager/pwmanager/pwgenwndimpl.h2
-rw-r--r--pwmanager/pwmanager/pwm.cpp68
-rw-r--r--pwmanager/pwmanager/pwm.h11
-rw-r--r--pwmanager/pwmanager/pwmanager.pro6
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro4
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp26
-rw-r--r--pwmanager/pwmanager/pwmdoc.h4
-rw-r--r--pwmanager/pwmanager/pwmdocui.cpp4
-rw-r--r--pwmanager/pwmanager/pwminit.cpp21
-rw-r--r--pwmanager/pwmanager/pwminit.h11
-rw-r--r--pwmanager/pwmanager/pwmprefs.h6
-rw-r--r--pwmanager/pwmanager/pwmtray.cpp23
-rw-r--r--pwmanager/pwmanager/pwmtray.h36
-rw-r--r--pwmanager/pwmanager/pwmview.cpp48
-rw-r--r--pwmanager/pwmanager/pwmview.h18
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.cpp26
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.h16
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_0.cpp15
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_0.h12
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.cpp30
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.h18
-rw-r--r--pwmanager/pwmanager/randomizer.cpp6
-rw-r--r--pwmanager/pwmanager/rencatwnd.cpp13
-rw-r--r--pwmanager/pwmanager/rencatwnd.h12
-rw-r--r--pwmanager/pwmanager/serializer.cpp18
-rw-r--r--pwmanager/pwmanager/serializer.h8
-rw-r--r--pwmanager/pwmanager/setmasterpwwnd_emb.cpp15
-rw-r--r--pwmanager/pwmanager/setmasterpwwnd_emb.h2
-rw-r--r--pwmanager/pwmanager/setmasterpwwndimpl.cpp4
-rw-r--r--pwmanager/pwmanager/waitwnd.cpp12
-rw-r--r--pwmanager/pwmanager/waitwnd.h9
-rw-r--r--qtcompat/qptrlist.h4
-rw-r--r--qtcompat/qptrstack.h4
708 files changed, 7875 insertions, 6766 deletions
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 594d47d..0000000
--- a/Makefile
+++ b/dev/null
@@ -1,385 +0,0 @@
-export KDEPIMDIR = $(shell pwd)
-
-export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version)
-
-ifeq ($(PLATFORM) , zaurus)
- BUILD_NO_LDAP_PLUGIN=1
-endif
-
-ifneq ($(PLATFORM) , zaurus)
- BUILD_NO_SHARP_PLUGIN=1
-endif
-
-#opie plugin is deprecated. The qtopia plugin handles the task from now on.
-BUILD_NO_OPIE_PLUGIN=1
-
-SUBDIRS_MICROKDE = \
- libical/src/libical \
- libical/src/libicalss \
- qtcompat \
- microkde \
- libkcal \
- libkdepim \
- kabc \
- kabc/formats/binary \
- kabc/plugins/file \
- kabc/plugins/dir \
- korganizer \
- kalarmd \
- kaddressbook
-
-SUBDIRS_QTOPIA_PLUGIN = \
- kabc/plugins/qtopia
-
-SUBDIRS_OPIE_PLUGIN = \
- kabc/plugins/opie
-
-SUBDIRS_SHARP_PLUGIN = \
- kabc/plugins/sharpdtm
-
-SUBDIRS_LDAP_PLUGIN = \
- kabc/plugins/ldap
-
-SUBDIRS_MICROMAIL = \
- libetpan \
- kmicromail/libmailwrapper \
- kmicromail
-
-SUBDIRS_GAMMU = \
- gammu/emb/common \
- gammu/emb/gammu
-
-SUBDIRS_PWMANAGER = \
- pwmanager/libcrypt/mpi \
- pwmanager/libcrypt/error \
- pwmanager/libcrypt/cipher \
- pwmanager/libcrypt/zlib \
- pwmanager/pwmanager
-
-SUBDIRS = \
- $(SUBDIRS_MICROKDE) \
- $(SUBDIRS_QTOPIA_PLUGIN) \
- $(SUBDIRS_OPIE_PLUGIN) \
- $(SUBDIRS_SHARP_PLUGIN) \
- $(SUBDIRS_LDAP_PLUGIN) \
- $(SUBDIRS_MICROMAIL) \
- $(SUBDIRS_GAMMU) \
- $(SUBDIRS_PWMANAGER)
-
-
-all: build_microkde \
- build_qtopia_plugin \
- build_opie_plugin \
- build_sharp_plugin \
- build_ldap_plugin \
- build_micromail \
- build_gammu \
- build_pwmanager
-
-
-build_microkde: variable_test tmake
- for i in $(SUBDIRS_MICROKDE); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
-
-build_qtopia_plugin: build_microkde
- ifdef BUILD_NO_QTOPIA_PLUGIN
- @echo == qtopia plugin not build.
- else
- for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-build_opie_plugin: build_microkde
- ifdef BUILD_NO_OPIE_PLUGIN
- @echo == opie plugin not build.
- else
- for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-build_sharp_plugin: build_microkde
- ifdef BUILD_NO_SHARP_PLUGIN
- @echo == ldap plugin not build.
- else
- for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-build_ldap_plugin: build_microkde
- ifdef BUILD_NO_LDAP_PLUGIN
- @echo == ldap plugin not build.
- else
- for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-
-build_micromail: build_microkde
- ifdef BUILD_NO_MICROMAIL
- @echo == kmicromail not build.
- else
- for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-build_gammu: variable_test tmake
- ifdef BUILD_NO_GAMMU
- @echo == gammu not build.
- else
- for i in $(SUBDIRS_GAMMU); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-build_pwmanager: build_microkde
- ifdef BUILD_NO_PWMANAGER
- @echo == pwmanager not build.
- else
- for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \
- make -f Makefile$(PLATFORM) || exit 1; popd; \
- done
- endif
-
-
-variable_info:
- @echo --------------------------------------
- @echo KDEPIM buildsystem, variableinfo...
- @echo KDEPIMDIR=$(KDEPIMDIR)
- @echo QTDIR=$(QTDIR)
- @echo QPEDIR=$(QPEDIR)
- @echo OPIEDIR=$(OPIEDIR)
- @echo PLATFORM=$(PLATFORM)
- @echo RELEASE_DEBUG=$(RELEASE_DEBUG)
- @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL)
- @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN)
- @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN)
- @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN)
- @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN)
- ifndef BUILD_NO_SHARP_PLUGIN
- @echo SHARPDTMSDK=$(SHARPDTMSDK)
- endif
- @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU)
- @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER)
- @echo --------------------------------------
-
-variable_test: variable_info
- @echo KDEPIM buildsystem, variablecheck...
- ifndef KDEPIMDIR
- @echo KDEPIMDIR is not defined.
- $(error KDEPIMDIR is not defined)
- endif
- ifndef PLATFORM
- @echo PLATFORM is not defined.
- $(error PLATFORM is not defined)
- endif
- ifdef BUILD_NO_LDAP_PLUGIN
- @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN)
- endif
- ifdef BUILD_NO_OPIE_PLUGIN
- @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN)
- endif
- ifdef BUILD_NO_QTOPIA_PLUGIN
- @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN)
- endif
- ifdef BUILD_NO_MICROMAIL
- @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL)
- endif
- ifdef BUILD_NO_SHARP_PLUGIN
- @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN)
- else
- ifndef SHARPDTMSDK
- @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK)
- $(error SHARPDTMSDK is not defined)
- endif
- endif
- ifdef BUILD_NO_GAMMU
- @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU)
- endif
- ifdef BUILD_NO_PWMANAGER
- @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER)
- endif
- @echo --------------------------------------
-
-
-objects:
- for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done
- for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done
- mkdir -p libical/lib/$(PLATFORM)
- mkdir -p dest
- mkdir -p dest$(LIBICAL_PATH)
- mkdir -p pwmanager/libcrypt/$(PLATFORM)
-
-clean:
- rm -rf libical/lib/$(PLATFORM)/*;
- rm -rf pwmanager/libcrypt/$(PLATFORM)/*;
- for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\
- rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \
- done
-
-pac:
- rm -f $(QPEDIR)/lib/libmicro*
- rm -f $(QPEDIR)/plugins/applets/libkopi*
- make
- make install
- make dist
-install:
-
- cd bin/kdepim; make install
- cp -r Pim $(QPEDIR)/apps
- cp db2file/db2file $(QPEDIR)/bin/db2file
- chmod ugo+x $(QPEDIR)/bin/db2file
- cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop
- cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop
- cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop
- cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop
-
-dist:
- @echo Dont forget to do "make install" before "make dist"
- rm -f *arm.ipk
- rm -f *ipk.zip
- rm -rf ../kdepimpi_$(KDEPIM_VERSION)/*
- rm -f *~
- cd ..;mkdir -p kdepimpi_$(KDEPIM_VERSION)
- cd ../kdepimpi_$(KDEPIM_VERSION);mkdir -p ipk
- cd ..; tar czf kdepimpi-$(KDEPIM_VERSION).tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim
- mkipks kmicrokdelibs.control
- mkipks korganizer.control
- mkipks kaddressbook.control
- ifndef BUILD_NO_MICROMAIL
- mkipks kopiemail.control
- endif
- ifndef BUILD_NO_SHARP_PLUGIN
- mkipks ksharpPIM-DTMaccess.control
- endif
- mkipks korganizer-alarm.control
- ifndef BUILD_NO_GAMMU
- mkipks kmobilephoneaccess.control
- endif
- ifndef BUILD_NO_PWMANAGER
- mkipks pwmanager.control
- endif
- mkipks pimTABicon.control
- zip kdepim_$(KDEPIM_VERSION)_for_SharpRom.ipk.zip *.ipk ReleaseNotes.txt
- mv *.ipk ../kdepimpi_$(KDEPIM_VERSION)/ipk/
- mv *for_SharpRom.ipk.zip ../kdepimpi_$(KDEPIM_VERSION)/
- mv ../kdepimpi-$(KDEPIM_VERSION).tar.gz ../kdepimpi_$(KDEPIM_VERSION)/
-
-tmake: objects \
- qtcompat/Makefile$(PLATFORM) \
- microkde/Makefile$(PLATFORM) \
- libkcal/Makefile$(PLATFORM) \
- libkdepim/Makefile$(PLATFORM) \
- korganizer/Makefile$(PLATFORM) \
- kalarmd/Makefile$(PLATFORM) \
- libical/src/libical/Makefile$(PLATFORM) \
- libical/src/libicalss/Makefile$(PLATFORM) \
- kabc/Makefile$(PLATFORM) \
- kabc/formats/binary/Makefile$(PLATFORM) \
- kabc/plugins/file/Makefile$(PLATFORM) \
- kabc/plugins/dir/Makefile$(PLATFORM) \
- kabc/plugins/ldap/Makefile$(PLATFORM) \
- kabc/plugins/opie/Makefile$(PLATFORM) \
- kabc/plugins/qtopia/Makefile$(PLATFORM) \
- kabc/plugins/sharpdtm/Makefile$(PLATFORM) \
- kaddressbook/Makefile$(PLATFORM) \
- kmicromail/Makefile$(PLATFORM) \
- libetpan/Makefile$(PLATFORM) \
- kmicromail/libmailwrapper/Makefile$(PLATFORM) \
- gammu/emb/common/Makefile$(PLATFORM) \
- gammu/emb/gammu/Makefile$(PLATFORM) \
- pwmanager/pwmanager/Makefile$(PLATFORM) \
- pwmanager/libcrypt/mpi/Makefile$(PLATFORM) \
- pwmanager/libcrypt/error/Makefile$(PLATFORM) \
- pwmanager/libcrypt/cipher/Makefile$(PLATFORM) \
- pwmanager/libcrypt/zlib/Makefile$(PLATFORM)
-
-qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro
- cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM)
-
-microkde/Makefile$(PLATFORM): microkde/microkdeE.pro
- cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM)
-
-libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro
- cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM)
-
-
-libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro
- cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM)
-
-kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro
- cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM)
-
-korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro
- cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM)
-
-libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro
- cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM)
-
-libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro
- cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM)
-
-kabc/Makefile$(PLATFORM): kabc/kabcE.pro
- cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM)
-
-kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro
- cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro
- cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro
- cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro
- cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro
- cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro
- cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM)
-
-kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro
- cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM)
-
-kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro
- cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM)
-
-kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro
- cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM)
-
-libetpan/Makefile$(PLATFORM): libetpan/libetpanE.pro
- cd libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM)
-
-kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro
- cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM)
-
-gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro
- cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM)
-
-gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro
- cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM)
-
-pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro
- cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM)
-
-
-pwmanager/libcrypt/mpi/Makefile$(PLATFORM): pwmanager/libcrypt/mpi/mpi.pro
- cd pwmanager/libcrypt/mpi;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" mpi.pro -o Makefile$(PLATFORM)
-
-pwmanager/libcrypt/error/Makefile$(PLATFORM): pwmanager/libcrypt/error/error.pro
- cd pwmanager/libcrypt/error;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" error.pro -o Makefile$(PLATFORM)
-
-pwmanager/libcrypt/cipher/Makefile$(PLATFORM): pwmanager/libcrypt/cipher/cipher.pro
- cd pwmanager/libcrypt/cipher;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" cipher.pro -o Makefile$(PLATFORM)
-
-pwmanager/libcrypt/zlib/Makefile$(PLATFORM): pwmanager/libcrypt/zlib/zlib.pro
- cd pwmanager/libcrypt/zlib;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" zlib.pro -o Makefile$(PLATFORM)
-
-
diff --git a/gammu/emb/common/common.pro b/gammu/emb/common/common.pro
index af45382..65fd303 100644
--- a/gammu/emb/common/common.pro
+++ b/gammu/emb/common/common.pro
@@ -141,54 +141,56 @@ device/bluetoth/bluetoth.c \
device/serial/ser_djg.c \
device/irda/irda.c \
device/devfunc.c \
protocol/at/at.c \
protocol/alcatel/alcabus.c \
protocol/nokia/mbus2.c \
protocol/nokia/fbus2.c \
protocol/nokia/phonet.c \
protocol/obex/obex.c \
protocol/symbian/mrouter.c \
phone/pfunc.c \
phone/at/atgen.c \
phone/at/siemens.c \
phone/at/samsung.c \
phone/at/sonyeric.c \
phone/alcatel/alcatel.c \
phone/nokia/dct3/n6110.c \
phone/nokia/dct3/n7110.c \
phone/nokia/dct3/n0650.c \
phone/nokia/dct3/n9210.c \
phone/nokia/dct3/dct3func.c \
phone/nokia/dct4/n3320.c \
phone/nokia/dct4/n3650.c \
phone/nokia/dct4/n6510.c \
phone/nokia/dct4/dct4func.c \
phone/nokia/nauto.c \
phone/nokia/nfunc.c \
phone/nokia/nfuncold.c \
phone/obex/obexgen.c \
phone/symbian/mroutgen.c
DEFINES += DESKTOP_VERSION
-TARGET = microgammu
+TARGET = xmicrogammu
CONFIG = warn_off release console
DESTDIR = ../../../bin
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
unix: {
HEADERS += device/serial/ser_unx.h \
device/irda/irda_unx.h
SOURCES += device/serial/ser_unx.c \
}
win32:{
HEADERS += device/serial/ser_w32.h \
device/irda/irda_w32.h \
device/bluetoth/blue_w32.h
SOURCES += device/serial/ser_w32.c \
device/bluetoth/blue_w32.c
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/gammu/emb/common/device/bluetoth/blue_w32.c b/gammu/emb/common/device/bluetoth/blue_w32.c
index a631c9f..8a367f4 100644
--- a/gammu/emb/common/device/bluetoth/blue_w32.c
+++ b/gammu/emb/common/device/bluetoth/blue_w32.c
@@ -59,115 +59,115 @@ GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device)
dbgprintf("Remote Bluetooth device is %04x%08x\n",
GET_NAP(sab.btAddr), GET_SAP(sab.btAddr));
if (connect (d->hPhone, (struct sockaddr *)&sab, sizeof(sab)) != 0) {
i = GetLastError();
GSM_OSErrorInfo(s, "Connect in bluetooth_open");
if (i == 10060) return ERR_TIMEOUT; //remote device failed to respond
if (i == 10050) return ERR_DEVICENOTWORK; //socket operation connected with dead network
//noauth
close(d->hPhone);
return ERR_UNKNOWN;
}
return ERR_NONE;
}
#ifdef BLUETOOTH_RF_SEARCHING
#pragma comment(lib, "irprops.lib")
#pragma comment(lib, "ws2_32.lib")
static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, char *address, WSAPROTOCOL_INFO *protocolInfo)
{
GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth;
WSAQUERYSET querySet;
DWORD flags;
GUID protocol;
int i, result;
BYTE buffer[2000];
char addressAsString[1000];
DWORD bufferLength, addressSize;
WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer;
- HANDLE handle;
+ Qt::HANDLE handle;
GSM_Error error;
memset(&querySet, 0, sizeof(querySet));
querySet.dwSize = sizeof(querySet);
protocol = L2CAP_PROTOCOL_UUID;
querySet.lpServiceClassId = &protocol;
querySet.dwNameSpace = NS_BTH;
querySet.lpszContext = address;
flags = LUP_FLUSHCACHE | LUP_RETURN_NAME |
LUP_RETURN_TYPE | LUP_RETURN_ADDR |
LUP_RETURN_BLOB | LUP_RETURN_COMMENT;
result = WSALookupServiceBegin(&querySet, flags, &handle);
if (result != 0) return ERR_UNKNOWN;
bufferLength = sizeof(buffer);
while (1) {
result = WSALookupServiceNext(handle, flags, &bufferLength, pResults);
if (result != 0) break;
addressSize = sizeof(addressAsString);
addressAsString[0] = 0;
if (WSAAddressToString(pResults->lpcsaBuffer->RemoteAddr.lpSockaddr,
pResults->lpcsaBuffer->RemoteAddr.iSockaddrLength, protocolInfo,
addressAsString,&addressSize)==0) {
smprintf(s, "%s - ", addressAsString);
}
smprintf(s, "\"%s\"\n", pResults->lpszServiceInstanceName);
if (addressAsString[0] != 0) {
for (i=strlen(addressAsString)-1;i>0;i--) {
if (addressAsString[i] == ':') break;
}
if (bluetooth_checkservicename(s, pResults->lpszServiceInstanceName) == ERR_NONE) {
error = bluetooth_connect(s,atoi(addressAsString+i+1),address+1);
result = WSALookupServiceEnd(handle);
return error;
}
}
}
result = WSALookupServiceEnd(handle);
return ERR_NOTSUPPORTED;
}
GSM_Error bluetooth_findchannel(GSM_StateMachine *s)
{
GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth;
WSADATA wsaData;
int i, protocolInfoSize, result;
WSAPROTOCOL_INFO protocolInfo;
- HANDLE handle;
+ Qt::HANDLE handle;
DWORD flags;
WSAQUERYSET querySet;
BYTE buffer[2000];
char addressAsString[1000];
DWORD bufferLength, addressSize;
WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer;
GSM_Error error;
if (WSAStartup(MAKEWORD(2,2), &wsaData)!=0x00) return ERR_DEVICENODRIVER;
d->hPhone = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
if (d->hPhone == INVALID_SOCKET) {
i = GetLastError();
GSM_OSErrorInfo(s, "Socket in bluetooth_open");
if (i == 10041) return ERR_DEVICENODRIVER;//unknown socket type
return ERR_UNKNOWN;
}
protocolInfoSize = sizeof(protocolInfo);
if (getsockopt(d->hPhone, SOL_SOCKET, SO_PROTOCOL_INFO,
(char*)&protocolInfo, &protocolInfoSize) != 0)
{
close(d->hPhone);
return ERR_UNKNOWN;
}
close(d->hPhone);
if (!strcmp(s->CurrentConfig->Device,"com2:")) {
bufferLength = sizeof(buffer);
flags = LUP_RETURN_NAME | LUP_CONTAINERS |
LUP_RETURN_ADDR | LUP_FLUSHCACHE |
diff --git a/gammu/emb/common/device/bluetoth/blue_w32.h b/gammu/emb/common/device/bluetoth/blue_w32.h
index e457c92..409f4b1 100644
--- a/gammu/emb/common/device/bluetoth/blue_w32.h
+++ b/gammu/emb/common/device/bluetoth/blue_w32.h
@@ -90,73 +90,73 @@ DEFINE_GUID(L2CAP_PROTOCOL_UUID, 0x00000100, 0x0000, 0x1000, 0x80, 0x00, 0x00,
#endif
#define LUP_CONTAINERS 0x0002
#define LUP_RETURN_NAME 0x0010
#define LUP_RETURN_TYPE 0x0020
#define LUP_RETURN_COMMENT 0x0080
#define LUP_RETURN_ADDR 0x0100
#define LUP_RETURN_BLOB 0x0200
#define LUP_FLUSHCACHE 0x1000
#define LUP_RES_SERVICE 0x8000
#define WSAAPI FAR PASCAL
#ifndef WINSOCK_API_LINKAGE
#ifdef DECLSPEC_IMPORT
#define WINSOCK_API_LINKAGE DECLSPEC_IMPORT
#else
#define WINSOCK_API_LINKAGE
#endif
#endif
WINSOCK_API_LINKAGE INT WSAAPI
WSALookupServiceBeginA(
IN LPWSAQUERYSETA lpqsRestrictions,
IN DWORD dwControlFlags,
OUT LPHANDLE lphLookup
);
#define WSALookupServiceBegin WSALookupServiceBeginA
WINSOCK_API_LINKAGE INT WSAAPI
WSALookupServiceNextA(
- IN HANDLE hLookup,
+ IN Qt::HANDLE hLookup,
IN DWORD dwControlFlags,
IN OUT LPDWORD lpdwBufferLength,
OUT LPWSAQUERYSETA lpqsResults
);
#define WSALookupServiceNext WSALookupServiceNextA
-WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceEnd(IN HANDLE hLookup);
+WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceEnd(IN Qt::HANDLE hLookup);
#define MAX_PROTOCOL_CHAIN 7
typedef struct _WSAPROTOCOLCHAIN {
int ChainLen; /* the length of the chain, */
/* length = 0 means layered protocol, */
/* length = 1 means base protocol, */
/* length > 1 means protocol chain */
DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */
} WSAPROTOCOLCHAIN, FAR * LPWSAPROTOCOLCHAIN;
#define WSAPROTOCOL_LEN 255
typedef struct _WSAPROTOCOL_INFOA {
DWORD dwServiceFlags1;
DWORD dwServiceFlags2;
DWORD dwServiceFlags3;
DWORD dwServiceFlags4;
DWORD dwProviderFlags;
GUID ProviderId;
DWORD dwCatalogEntryId;
WSAPROTOCOLCHAIN ProtocolChain;
int iVersion;
int iAddressFamily;
int iMaxSockAddr;
int iMinSockAddr;
int iSocketType;
int iProtocol;
int iProtocolMaxOffset;
int iNetworkByteOrder;
int iSecurityScheme;
DWORD dwMessageSize;
diff --git a/gammu/emb/common/device/serial/ser_w32.h b/gammu/emb/common/device/serial/ser_w32.h
index d226f32..d1aa37a 100644
--- a/gammu/emb/common/device/serial/ser_w32.h
+++ b/gammu/emb/common/device/serial/ser_w32.h
@@ -1,19 +1,19 @@
#ifdef WIN32
#ifndef winserial_h
#define winserial_h
#include <windows.h>
typedef struct {
- HANDLE hPhone;
+ Qt::HANDLE hPhone;
DCB old_settings;
OVERLAPPED osWrite,osRead;
} GSM_Device_SerialData;
#endif
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
diff --git a/gammu/emb/gammu/gammu.pro b/gammu/emb/gammu/gammu.pro
index c8aa3f0..e8ccac3 100644
--- a/gammu/emb/gammu/gammu.pro
+++ b/gammu/emb/gammu/gammu.pro
@@ -18,48 +18,50 @@ HEADERS += gammu.h \
sniff.h \
smsd/s_files.h \
smsd/s_mysql.h \
smsd/smsdcore.h \
depend/nokia/dct3.h \
depend/nokia/dct4.h \
depend/siemens/chiffre.h \
depend/siemens/dsiemens.h \
depend/nokia/dct3trac/type-cc.h \
depend/nokia/dct3trac/type-mm.h \
depend/nokia/dct3trac/type-rr.h \
depend/nokia/dct3trac/type-sms.h \
depend/nokia/dct3trac/type-ss.h \
depend/nokia/dct3trac/wmx-gsm.h \
depend/nokia/dct3trac/wmx-list.h \
depend/nokia/dct3trac/wmx-sim.h \
depend/nokia/dct3trac/wmx-util.h \
depend/nokia/dct3trac/wmx.h
SOURCES += gammu.c \
sniff.c \
smsd/s_files.c \
smsd/smsdcore.c \
depend/nokia/dct3.c \
depend/nokia/dct4.c \
depend/siemens/chiffre.c \
depend/siemens/dsiemens.c \
depend/nokia/dct3trac/wmx-gsm.c \
depend/nokia/dct3trac/wmx-list.c \
depend/nokia/dct3trac/wmx-sim.c \
depend/nokia/dct3trac/wmx-util.c \
depend/nokia/dct3trac/wmx.c
unix : {
-LIBS += ../../../bin/libmicrogammu.so /usr/lib/libpthread.so
+LIBS += ../../../bin/libxmicrogammu.so -lpthread
# bluetooth disabled for now
#/usr/lib/libbluetooth.so /usr/lib/libsdp.so
OBJECTS_DIR = obj/unix
}
win32 : {
CONFIG += qt warn_on
#LIBS += mfc71u.lib
LIBS += libc.lib
#LIBS += msvcrt.lib
QMAKE_LINK += /NODEFAULTLIB:msvcrt
LIBS += ../../../bin/microgammu.lib
OBJECTS_DIR = obj/win
}
DESTDIR = ../../../bin
TARGET = kammu
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/kabc/address.h b/kabc/address.h
index 38ad20b..41794fe 100644
--- a/kabc/address.h
+++ b/kabc/address.h
@@ -3,102 +3,102 @@
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_ADDRESS_H
#define KABC_ADDRESS_H
#include <qmap.h>
#include <qstring.h>
#include <qregexp.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
// template tags for address formatting localization
#define KABC_FMTTAG_realname QString("%n")
#define KABC_FMTTAG_REALNAME QString("%N")
#define KABC_FMTTAG_company QString("%cm")
#define KABC_FMTTAG_COMPANY QString("%CM")
#define KABC_FMTTAG_pobox QString("%p")
#define KABC_FMTTAG_street QString("%s")
#define KABC_FMTTAG_STREET QString("%S")
#define KABC_FMTTAG_zipcode QString("%z")
#define KABC_FMTTAG_location QString("%l")
#define KABC_FMTTAG_LOCATION QString("%L")
#define KABC_FMTTAG_region QString("%r")
#define KABC_FMTTAG_REGION QString("%R")
#define KABC_FMTTAG_newline QString("\\n")
#define KABC_FMTTAG_condcomma QString("%,")
#define KABC_FMTTAG_condwhite QString("%w")
#define KABC_FMTTAG_purgeempty QString("%0")
namespace KABC {
/**
@short Postal address information.
This class represents information about a postal address.
*/
class Address
{
friend QDataStream &operator<<( QDataStream &, const Address & );
friend QDataStream &operator>>( QDataStream &, Address & );
public:
/**
List of addresses.
*/
- typedef QValueList<Address> List;
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<Address> List;
+ typedef Q3ValueList<int> TypeList;
/**
Address types:
@li @p Dom - domestic
@li @p Intl - international
@li @p Postal - postal
@li @p Parcel - parcel
@li @p Home - home address
@li @p Work - address at work
@li @p Pref - preferred address
*/
enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32,
Pref = 64 };
/**
Constructor that creates an empty Address, which is initialized
with a unique id (see @ref id()).
*/
Address();
/**
This is like @ref Address() just above, with the difference
that you can specify the type.
*/
Address( int );
bool matchAddress( QRegExp* searchExp ) const;
bool operator==( const Address & ) const;
bool operator!=( const Address & ) const;
/**
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index fe59fcb..c700897 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -8,66 +8,66 @@
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
/*US
#include <qfile.h>
#include <qregexp.h>
#include <qtimer.h>
#include <kapplication.h>
#include <kinstance.h>
#include <kstandarddirs.h>
#include "errorhandler.h"
*/
-#include <qptrlist.h>
-#include <qtextstream.h>
+#include <q3ptrlist.h>
+#include <q3textstream.h>
#include <qfile.h>
#include <qregexp.h>
#include <kglobal.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <libkcal/syncdefines.h>
#include <libkdepim/phoneaccess.h>
#include "addressbook.h"
#include "resource.h"
#include "vcardconverter.h"
#include "vcardparser/vcardtool.h"
//US #include "addressbook.moc"
using namespace KABC;
struct AddressBook::AddressBookData
{
Addressee::List mAddressees;
Addressee::List mRemovedAddressees;
Field::List mAllFields;
KConfig *mConfig;
KRES::Manager<Resource> *mManager;
//US ErrorHandler *mErrorHandler;
};
struct AddressBook::Iterator::IteratorData
{
Addressee::List::Iterator mIt;
};
@@ -215,65 +215,65 @@ bool AddressBook::ConstIterator::operator==( const ConstIterator &it )
{
return ( d->mIt == it.d->mIt );
}
bool AddressBook::ConstIterator::operator!=( const ConstIterator &it )
{
return ( d->mIt != it.d->mIt );
}
AddressBook::AddressBook()
{
init(0, "contact");
}
AddressBook::AddressBook( const QString &config )
{
init(config, "contact");
}
AddressBook::AddressBook( const QString &config, const QString &family )
{
init(config, family);
}
// the default family is "contact"
void AddressBook::init(const QString &config, const QString &family )
{
blockLSEchange = false;
d = new AddressBookData;
QString fami = family;
- if (config != 0) {
+ if (!config.isEmpty()) {
if ( family == "syncContact" ) {
qDebug("creating sync config ");
fami = "contact";
KConfig* con = new KConfig( locateLocal("config", "syncContactrc") );
con->setGroup( "General" );
con->writeEntry( "ResourceKeys", QString("sync") );
con->writeEntry( "Standard", QString("sync") );
con->setGroup( "Resource_sync" );
con->writeEntry( "FileName", config );
con->writeEntry( "FileFormat", QString("vcard") );
con->writeEntry( "ResourceIdentifier", QString("sync") );
con->writeEntry( "ResourceName", QString("sync_res") );
if ( config.right(4) == ".xml" )
con->writeEntry( "ResourceType", QString("qtopia") );
else if ( config == "sharp" ) {
con->writeEntry( "ResourceType", QString("sharp") );
} else {
con->writeEntry( "ResourceType", QString("file") );
}
//con->sync();
d->mConfig = con;
}
else
d->mConfig = new KConfig( locateLocal("config", config) );
// qDebug("AddressBook::init 1 config=%s",config.latin1() );
}
else {
d->mConfig = 0;
// qDebug("AddressBook::init 1 config=0");
}
//US d->mErrorHandler = 0;
@@ -352,71 +352,71 @@ bool AddressBook::load()
qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) );
}
// mark all addressees as unchanged
Addressee::List::Iterator addrIt;
for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) {
(*addrIt).setChanged( false );
QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" );
if ( !id.isEmpty() ) {
//qDebug("setId aa %s ", id.latin1());
(*addrIt).setIDStr(id );
}
}
blockLSEchange = true;
return ok;
}
bool AddressBook::save( Ticket *ticket )
{
kdDebug(5700) << "AddressBook::save()"<< endl;
if ( ticket->resource() ) {
deleteRemovedAddressees();
return ticket->resource()->save( ticket );
}
return false;
}
// exports all Addressees, which are syncable
void AddressBook::export2File( QString fileName, QString resourceName )
{
QFile outFile( fileName );
- if ( !outFile.open( IO_WriteOnly ) ) {
+ if ( !outFile.open( QIODevice::WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
KMessageBox::error( 0, text.arg( fileName ) );
return ;
}
- QTextStream t( &outFile );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( &outFile );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
Iterator it;
KABC::VCardConverter::Version version;
version = KABC::VCardConverter::v3_0;
for ( it = begin(); it != end(); ++it ) {
if ( (*it).resource() ) {
bool include = (*it).resource()->includeInSync();
if ( !resourceName.isEmpty() )
include = (resourceName == (*it).resource()->resourceName() );
if ( include ) {
//qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->resourceName() ).arg( fileName ) );
if ( !(*it).IDStr().isEmpty() ) {
(*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() );
}
KABC::VCardConverter converter;
QString vcard;
//Resource *resource() const;
converter.addresseeToVCard( *it, vcard, version );
t << vcard << "\r\n";
}
}
}
t << "\r\n\r\n";
outFile.close();
}
// if QStringList uids is empty, all are exported
bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
{
KABC::VCardConverter converter;
QString datastream;
Iterator it;
bool all = uids.isEmpty();
for ( it = begin(); it != end(); ++it ) {
@@ -439,87 +439,87 @@ bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName )
QString vcardnew;
converter.addresseeToVCard( a, vcard );
int start = 0;
int next;
while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
int semi = vcard.find(";", next);
int dopp = vcard.find(":", next);
int sep;
if ( semi < dopp && semi >= 0 )
sep = semi ;
else
sep = dopp;
vcardnew +=vcard.mid( start, next - start);
vcardnew +=vcard.mid( next+5,sep -next -5 ).upper();
start = sep;
}
vcardnew += vcard.mid( start,vcard.length() );
vcard = "";
start = 0;
while ( (next = vcardnew.find("ADR", start) )>= 0 ) {
int sep = vcardnew.find(":", next);
vcard +=vcardnew.mid( start, next - start+3);
start = sep;
}
vcard += vcardnew.mid( start,vcardnew.length() );
vcard.replace ( QRegExp(";;;") , "" );
vcard.replace ( QRegExp(";;") , "" );
datastream += vcard;
}
QFile outFile(fileName);
- if ( outFile.open(IO_WriteOnly) ) {
+ if ( outFile.open(QIODevice::WriteOnly) ) {
datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
- QTextStream t( &outFile ); // use a text stream
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( &outFile ); // use a text stream
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t <<datastream;
t << "\r\n\r\n";
outFile.close();
} else {
qDebug("Error open temp file ");
return false;
}
return true;
}
int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld, QString resource )
{
if ( removeOld )
setUntagged( true, resource );
KABC::Addressee::List list;
QFile file( fileName );
- file.open( IO_ReadOnly );
+ file.open( QIODevice::ReadOnly );
QByteArray rawData = file.readAll();
file.close();
QString data;
if ( replaceLabel ) {
data = QString::fromLatin1( rawData.data(), rawData.size() + 1 );
data.replace ( QRegExp("LABEL") , "ADR" );
data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" );
} else
data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
KABC::VCardTool tool;
list = tool.parseVCards( data );
KABC::Addressee::List::Iterator it;
Resource * setRes = 0;
if ( !resource.isEmpty() ) {
KRES::Manager<Resource>::ActiveIterator it;
KRES::Manager<Resource> *manager = d->mManager;
for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
//qDebug("SaveAB::checking resource..." );
if ( (*it)->resourceName() == resource ) {
setRes = (*it);
qDebug("KA: AB: Inserting imported contacs to resource %s", resource.latin1());
break;
}
}
}
for ( it = list.begin(); it != list.end(); ++it ) {
QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
if ( !id.isEmpty() )
(*it).setIDStr(id );
(*it).setResource( setRes );
if ( replaceLabel )
@@ -605,65 +605,65 @@ void AddressBook::removeSyncInfo( QString syncProfile)
}
} else {
Addressee lse;
lse = findByUid( "last-syncAddressee-"+ syncProfile );
if ( ! lse.isEmpty() )
removeAddressee( lse );
}
}
void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync )
{
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
QString id = (*ait).IDStr();
(*ait).setIDStr( ":");
(*ait).setExternalUID( id );
(*ait).setOriginalExternalUID( id );
if ( isPreSync )
(*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
else {
(*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
(*ait).setID( currentSyncDevice,id );
}
}
}
void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice )
{
setUntagged();
KABC::Addressee::List list;
QFile file( fileName );
- file.open( IO_ReadOnly );
+ file.open( QIODevice::ReadOnly );
QByteArray rawData = file.readAll();
file.close();
QString data;
data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
KABC::VCardTool tool;
list = tool.parseVCards( data );
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
Iterator ait;
for ( ait = begin(); ait != end(); ++ait ) {
if ( !(*ait).tagged() ) {
if ( (*ait).containsAdr(*it)) {
(*ait).setTagged(true);
QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" );
(*it).setIDStr( ":");
(*it).setID( currentSyncDevice,id );
(*it).setExternalUID( id );
(*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
(*it).setUid( ( (*ait).uid() ));
break;
}
}
}
if ( ait == end() )
qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1());
}
clear();
for ( it = list.begin(); it != list.end(); ++it ) {
insertAddressee( (*it) );
}
@@ -1189,89 +1189,89 @@ bool AddressBook::addCustomField( const QString &label, int category,
QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab )
{
if (!ab.d) return s;
return s << ab.d->mAddressees;
}
QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab )
{
if (!ab.d) return s;
s >> ab.d->mAddressees;
return s;
}
bool AddressBook::addResource( Resource *resource )
{
if ( !resource->open() ) {
kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl;
return false;
}
resource->setAddressBook( this );
d->mManager->add( resource );
return true;
}
void AddressBook::removeResources()
{
//remove all possible resources. This should cleanup the configfile.
- QPtrList<KABC::Resource> mResources = resources();
+ Q3PtrList<KABC::Resource> mResources = resources();
- QPtrListIterator<KABC::Resource> it(mResources);
+ Q3PtrListIterator<KABC::Resource> it(mResources);
for ( ; it.current(); ++it ) {
KABC::Resource *res = it.current();
removeResource(res);
}
}
bool AddressBook::removeResource( Resource *resource )
{
resource->close();
if ( resource == standardResource() )
d->mManager->setStandardResource( 0 );
resource->setAddressBook( 0 );
d->mManager->remove( resource );
return true;
}
-QPtrList<Resource> AddressBook::resources()
+Q3PtrList<Resource> AddressBook::resources()
{
- QPtrList<Resource> list;
+ Q3PtrList<Resource> list;
// qDebug("AddressBook::resources() 1");
KRES::Manager<Resource>::ActiveIterator it;
for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
list.append( *it );
return list;
}
/*US
void AddressBook::setErrorHandler( ErrorHandler *handler )
{
delete d->mErrorHandler;
d->mErrorHandler = handler;
}
*/
void AddressBook::error( const QString& msg )
{
/*US
if ( !d->mErrorHandler ) // create default error handler
d->mErrorHandler = new ConsoleErrorHandler;
if ( d->mErrorHandler )
d->mErrorHandler->error( msg );
else
kdError(5700) << "no error handler defined" << endl;
*/
kdDebug(5700) << "msg" << endl;
qDebug(msg);
}
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index a8a9fc1..56fce4d 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -2,65 +2,65 @@
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_ADDRESSBOOK_H
#define KABC_ADDRESSBOOK_H
#include <qobject.h>
#include <kresources/manager.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "addressee.h"
#include "field.h"
namespace KABC {
class ErrorHandler;
class Resource;
class Ticket;
/**
@short Address Book
This class provides access to a collection of address book entries.
*/
class AddressBook : public QObject
{
Q_OBJECT
friend QDataStream &operator<<( QDataStream &, const AddressBook & );
friend QDataStream &operator>>( QDataStream &, AddressBook & );
friend class StdAddressBook;
public:
/**
@short Address Book Iterator
This class provides an iterator for address book entries.
*/
class Iterator
{
public:
@@ -251,65 +251,65 @@ class AddressBook : public QObject
with the given field category.
*/
Field::List fields( int category = Field::All );
/**
Add custom field to address book.
@param label User visible label of the field.
@param category Ored list of field categories.
@param key Identifier used as key for reading and writing the field.
@param app String used as application key for reading and writing
the field.
*/
bool addCustomField( const QString &label, int category = Field::All,
const QString &key = QString::null,
const QString &app = QString::null );
/**
Add address book resource.
*/
bool addResource( Resource * );
/**
Remove address book resource.
*/
void removeResources();
bool removeResource( Resource * );
/**
Return pointer list of all resources.
*/
- QPtrList<Resource> resources();
+ Q3PtrList<Resource> resources();
/**
Set the @p ErrorHandler, that is used by @ref error() to
provide gui-independend error messages.
*/
void setErrorHandler( ErrorHandler * );
/**
Shows gui independend error messages.
*/
void error( const QString& );
/**
Query all resources to clean up their lock files
*/
void cleanUp();
// sync stuff
//Addressee::List getExternLastSyncAddressees();
void resetTempSyncStat();
QStringList uidList();
void removeSyncAddressees( bool removeDeleted = false );
void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset );
const Addressee findByExternUid( const QString& uid , const QString& profile ) const;
bool containsExternalUid( const QString& uid );
void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset );
void preOLSync( AddressBook* aBook, const QString& csd);
void postExternSync( AddressBook* aBook, const QString& csd , bool setID );
signals:
/**
Emitted, when the address book has changed on disk.
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index e8e440c..9994e29 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -362,65 +362,65 @@ void Addressee::mergeOLContact( const Addressee& ad )
break;
}
}
if ( ! found ) {
mData->keys.append( *itA );
}
}
}
KABC::Address addthis = otherAddress();
KABC::Address addother = ad.otherAddress();
if ( !addthis.isEmpty() && !addother.isEmpty() )
addthis.setType( addother.type() );
//qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
setRevision( ad.revision() );
}
void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
{
// merge all standard non-outlook fields.
//if isSubSet (e.g. mobile phone sync) merge all fields
detach();
if ( isSubSet ) {
if ( mData->name.isEmpty() ) mData->name = ad.mData->name;
if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName;
if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName;
if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ;
- if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName;
+ if ( mData->additionalName.isEmpty() ) mData->additionalName = ad.mData->additionalName;
if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix;
if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix;
if ( mData->title .isEmpty() ) mData->title = ad.mData->title ;
if ( mData->role.isEmpty() ) mData->role = ad.mData->role ;
if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName;
if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ;
if ( mData->note.isEmpty() ) mData->note = ad.mData->note ;
if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy;
if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ;
if ( !mData->birthday.isValid() )
if ( ad.mData->birthday.isValid())
mData->birthday = ad.mData->birthday;
}
if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer;
if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone;
if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo;
if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId;
if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString;
QStringList t;
QStringList tAD;
uint iii;
// ********** phone numbers
if ( isSubSet ) {
PhoneNumber::List phoneAD = ad.phoneNumbers();
PhoneNumber::List::Iterator phoneItAD;
for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) {
bool found = false;
PhoneNumber::List::Iterator it;
for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) {
if ( ( *phoneItAD ).contains( (*it) ) ) {
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 0ea1803..30dcd5d 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -4,116 +4,116 @@
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_ADDRESSEE_H
#define KABC_ADDRESSEE_H
#include <qdatetime.h>
#include <qstring.h>
#include <qregexp.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <ksharedptr.h>
#include <kurl.h>
#include "address.h"
#include "agent.h"
#include "geo.h"
#include "key.h"
#include "phonenumber.h"
#include "picture.h"
#include "secrecy.h"
#include "sound.h"
#include "timezone.h"
namespace KABC {
class Resource;
/**
@short address book entry
This class represents an entry in the address book.
The data of this class is implicitly shared. You can pass this class by value.
If you need the name of a field for presenting it to the user you should use
the functions ending in Label(). They return a translated string which can be
used as label for the corresponding field.
About the name fields:
givenName() is the first name and familyName() the last name. In some
countries the family name comes first, that's the reason for the
naming. formattedName() is the full name with the correct formatting.
It is used as an override, when the correct formatting can't be generated
from the other name fields automatically.
realName() returns a fully formatted name(). It uses formattedName, if set,
otherwise it constucts the name from the name fields. As fallback, if
nothing else is set it uses name().
name() is the NAME type of RFC2426. It can be used as internal name for the
data enty, but shouldn't be used for displaying the data to the user.
*/
class Addressee
{
friend QDataStream &operator<<( QDataStream &, const Addressee & );
friend QDataStream &operator>>( QDataStream &, Addressee & );
public:
- typedef QValueList<Addressee> List;
+ typedef Q3ValueList<Addressee> List;
/**
Construct an empty address book entry.
*/
Addressee();
~Addressee();
Addressee( const Addressee & );
Addressee &operator=( const Addressee & );
bool operator==( const Addressee & ) const;
bool operator!=( const Addressee & ) const;
// sync stuff
void setTempSyncStat(int id);
int tempSyncStat() const;
void setIDStr( const QString & );
const QString IDStr() const;
void setID( const QString &, const QString & );
const QString getID( const QString & ) const;
void setCsum( const QString &, const QString & );
const QString getCsum( const QString & ) const ;
void removeID(const QString &);
void computeCsum(const QString &dev);
ulong getCsum4List( const QStringList & attList);
/**
Return, if the address book entry is empty.
*/
bool isEmpty() const;
void setExternalUID( const QString &id );
const QString externalUID() const;
void setOriginalExternalUID( const QString &id );
QString originalExternalUID() const;
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp
index 671787e..bda1b9e 100644
--- a/kabc/addresseedialog.cpp
+++ b/kabc/addresseedialog.cpp
@@ -1,290 +1,293 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qapplication.h>
#include <qregexp.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include "stdaddressbook.h"
#include "addresseedialog.h"
#include "KDGanttMinimizeSplitter.h"
//#include "addresseedialog.moc"
using namespace KABC;
-AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) :
- QListViewItem( parent ),
+AddresseeItem::AddresseeItem( Q3ListView *parent, const Addressee &addressee ) :
+ Q3ListViewItem( parent ),
mAddressee( addressee )
{
setText( Name,addressee.realName());
setText( Email, addressee.preferredEmail() );
setText( Category, addressee.categories().join(";") );
}
QString AddresseeItem::key( int column, bool ) const
{
if (column == Email) {
QString value = text(Email);
int val = value.findRev("@");
return value.mid( val) + value.left( val );
}
return text(column).lower();
}
AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) :
KDialogBase( KDialogBase::Plain, i18n("Select Addressee"),
Ok|Cancel, No, parent ), mMultiple( multiple )
{
qDebug("NEW AddresseeDialog ");
KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this );
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
setMainWidget( mMiniSplitter );
QWidget *listWidget = new QWidget( mMiniSplitter );
- QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ;
+ Q3VBoxLayout *listLayout = new Q3VBoxLayout (listWidget) ;
//topLayout->addLayout( listLayout );
mAddresseeList = new KListView( listWidget );
mAddresseeList->addColumn( i18n("Name") );
mAddresseeList->addColumn( i18n("Email") );
mAddresseeList->addColumn( i18n("Category") );
mAddresseeList->setAllColumnsShowFocus( true );
mAddresseeList->setFullWidth( true );
listLayout->addWidget( mAddresseeList );
- connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ),
+ connect( mAddresseeList, SIGNAL( doubleClicked( Q3ListViewItem * ) ),
SLOT( slotOk() ) );
//QHBox* searchBox = new QHBox ( listWidget );
- QHBox * hb = new QHBox ( listWidget );
+ Q3HBox * hb = new Q3HBox ( listWidget );
listLayout->addWidget ( hb );
mAddresseeEdit = new QLineEdit( hb );
connect( mAddresseeEdit, SIGNAL( returnPressed() ),
SLOT( loadAddressBook() ) );
mAddresseeEdit->setFocus();
QPushButton *searchButton = new QPushButton( i18n("Search!"), hb );
connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) );
if ( mMultiple ) {
mSelectedList = new KListView( mMiniSplitter );
mSelectedList->addColumn( i18n("Selected Name") );
mSelectedList->addColumn( i18n("Email") );
mSelectedList->setAllColumnsShowFocus( true );
mSelectedList->setFullWidth( true );
//connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ),
// SLOT( removeSelected() ) );
- connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ),
+ connect( mSelectedList, SIGNAL( clicked( Q3ListViewItem * ) ),
SLOT( removeSelected() ) );
- connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ),
+ connect( mSelectedList, SIGNAL( returnPressed( Q3ListViewItem *) ),
SLOT( removeSelected() ) );
#if 0
QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup );
connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) );
#endif
- connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ),
- SLOT( addSelected( QListViewItem * ) ) );
- connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ),
- SLOT( selectNextItem( QListViewItem * ) ) );
+ connect( mAddresseeList, SIGNAL( clicked( Q3ListViewItem * ) ),
+ SLOT( addSelected( Q3ListViewItem * ) ) );
+ connect( mAddresseeList, SIGNAL( returnPressed( Q3ListViewItem * ) ),
+ SLOT( selectNextItem( Q3ListViewItem * ) ) );
}
mAddressBook = StdAddressBook::self( true );
connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ),
SLOT( addressBookChanged() ) );
#if 0
connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ),
SLOT( addressBookChanged() ) );
#endif
loadAddressBook();
- QValueList<int> splitterSize;
+ Q3ValueList<int> splitterSize;
splitterSize.append( ( width() / 5 ) * 3 );
splitterSize.append( ( width() / 5 ) *2 );
mMiniSplitter->setSizes( splitterSize );
}
AddresseeDialog::~AddresseeDialog()
{
qDebug("DELETE AddresseeDialog ");
}
void AddresseeDialog::loadAddressBook()
{
mAddresseeList->clear();
mItemDict.clear();
if ( mAddresseeEdit->text().isEmpty() ) {
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
new AddresseeItem( mAddresseeList, (*it) );
}
return;
}
//mAddresseeEdit->completionObject()->clear();
QRegExp re;
re.setWildcard(true); // most people understand these better.
re.setCaseSensitive(false);
re.setPattern( "*"+ mAddresseeEdit->text() + "*");
AddressBook::Iterator it;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
QString name = (*it).realName();
name += (*it).preferredEmail();
name += (*it).categories().join(";");
#if QT_VERSION >= 0x030000
if (re.search(name) != -1)
#else
if (re.match(name) != -1)
#endif
AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) );
}
}
-void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item )
+void AddresseeDialog::addCompletionItem( const QString &str, Q3ListViewItem *item )
{
if ( str.isEmpty() ) return;
mItemDict.insert( str, item );
//mAddresseeEdit->completionObject()->addItem( str );
}
void AddresseeDialog::selectItem( const QString &str )
{
if ( str.isEmpty() ) return;
- QListViewItem *item = mItemDict.find( str );
+ Q3ListViewItem *item = mItemDict.find( str );
if ( item ) {
mAddresseeList->blockSignals( true );
mAddresseeList->setSelected( item, true );
mAddresseeList->ensureItemVisible( item );
mAddresseeList->blockSignals( false );
}
}
-void AddresseeDialog::updateEdit( QListViewItem *item )
+void AddresseeDialog::updateEdit( Q3ListViewItem *item )
{
mAddresseeEdit->setText( item->text( 0 ) );
mAddresseeEdit->setSelection( 0, item->text( 0 ).length() );
}
-void AddresseeDialog::selectNextItem( QListViewItem *item )
+void AddresseeDialog::selectNextItem( Q3ListViewItem *item )
{
addSelected( item );
- QListViewItem *next = item->nextSibling();
+ Q3ListViewItem *next = item->nextSibling();
if ( next ) {
next->setSelected( true );
item->setSelected( false );
mAddresseeList->setCurrentItem( next );
}
}
-void AddresseeDialog::addSelected( QListViewItem *item )
+void AddresseeDialog::addSelected( Q3ListViewItem *item )
{
AddresseeItem *addrItem = (AddresseeItem *)( item );
if ( !addrItem ) return;
Addressee a = addrItem->addressee();
- QListViewItem *selectedItem = mSelectedDict.find( a.uid() );
+ Q3ListViewItem *selectedItem = mSelectedDict.find( a.uid() );
if ( !selectedItem ) {
selectedItem = new AddresseeItem( mSelectedList, a );
mSelectedDict.insert( a.uid(), selectedItem );
}
}
void AddresseeDialog::removeSelected()
{
- QListViewItem *item = mSelectedList->selectedItem();
+ Q3ListViewItem *item = mSelectedList->selectedItem();
AddresseeItem *addrItem = (AddresseeItem *)( item );
if ( !addrItem ) return;
- QListViewItem *next = item->nextSibling();
+ Q3ListViewItem *next = item->nextSibling();
mSelectedDict.remove( addrItem->addressee().uid() );
delete addrItem;
if ( next )
next->setSelected( true );
}
Addressee AddresseeDialog::addressee()
{
AddresseeItem *aItem = 0;
if ( mMultiple )
aItem = (AddresseeItem *)( mSelectedList->firstChild() );
else
aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
if (aItem) return aItem->addressee();
return Addressee();
}
Addressee::List AddresseeDialog::addressees()
{
Addressee::List al;
AddresseeItem *aItem = 0;
if ( mMultiple ) {
- QListViewItem *item = mSelectedList->firstChild();
+ Q3ListViewItem *item = mSelectedList->firstChild();
while( item ) {
aItem = (AddresseeItem *)( item );
if ( aItem ) al.append( aItem->addressee() );
item = item->nextSibling();
}
}
else
{
aItem = (AddresseeItem *)( mAddresseeList->selectedItem() );
if (aItem) al.append( aItem->addressee() );
}
return al;
}
Addressee AddresseeDialog::getAddressee( QWidget *parent )
{
AddresseeDialog *dlg = new AddresseeDialog( parent );
Addressee addressee;
#ifdef DESKTOP_VERSION
static int geoX = 0;
static int geoY = 0;
static int geoW = 0;
static int geoH = 0;
if ( !geoX && ! geoY && !geoW &&!geoH ) {
geoX = dlg->geometry().x();
geoY = dlg->geometry().y();
geoW = dlg->width();
geoH = dlg->height();
} else {
dlg->show();
dlg->setGeometry(geoX , geoY,geoW , geoH );
diff --git a/kabc/addresseedialog.h b/kabc/addresseedialog.h
index 6fab62d..be7bbb4 100644
--- a/kabc/addresseedialog.h
+++ b/kabc/addresseedialog.h
@@ -1,86 +1,86 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KABC_ADDRESSEEDIALOG_H
#define KABC_ADDRESSEEDIALOG_H
-#include <qdict.h>
+#include <q3dict.h>
#include <kdialogbase.h>
#include <klineedit.h>
#include <klistview.h>
#include "addressbook.h"
namespace KABC {
/**
@short Special ListViewItem, that is used by the AddresseeDialog.
*/
-class AddresseeItem : public QListViewItem
+class AddresseeItem : public Q3ListViewItem
{
public:
/**
Type of column
@li @p Name - Name in Addressee
@li @p Email - Email in Addressee
*/
enum columns { Name = 0, Email = 1,Category = 2 };
/**
Constructor.
@param parent The parent listview.
@param addressee The associated addressee.
*/
- AddresseeItem( QListView *parent, const Addressee &addressee );
+ AddresseeItem( Q3ListView *parent, const Addressee &addressee );
/**
Returns the addressee.
*/
Addressee addressee() const { return mAddressee; }
/**
Method used by QListView to sort the items.
*/
virtual QString key( int column, bool ascending ) const;
private:
Addressee mAddressee;
};
/**
@short Dialog for selecting address book entries.
This class provides a dialog for selecting entries from the standard KDE
address book. Use the getAddressee() function to open a modal dialog,
returning an address book entry.
In the dialog you can select an entry from the list with the mouse or type in
the first letters of the name or email address you are searching for. The
entry matching best is automatically selected. Use double click, pressing
return or pressing the ok button to return the selected addressee to the
application.
*/
class AddresseeDialog : public KDialogBase
{
Q_OBJECT
@@ -100,62 +100,62 @@ class AddresseeDialog : public KDialogBase
/**
Return the address chosen.
If it is a multiple select, this will return only the first address chosen
*/
Addressee addressee();
/**
Return the list of addresses chosen
*/
Addressee::List addressees();
/**
Select a single address book entry.
Open addressee select dialog and return the entry selected by the user.
If the user doesn't select an entry or presses cancel, the returned
addressee is empty.
*/
static Addressee getAddressee( QWidget *parent );
/**
Select multiple address book entries.
Open addressee select dialog and return the entries selected by the user.
If the user doesn't select an entry or presses cancel, the returned
addressee list is empty.
*/
static Addressee::List getAddressees( QWidget *parent );
private slots:
void selectItem( const QString & );
- void selectNextItem( QListViewItem *item );
- void updateEdit( QListViewItem *item );
- void addSelected( QListViewItem *item );
+ void selectNextItem( Q3ListViewItem *item );
+ void updateEdit( Q3ListViewItem *item );
+ void addSelected( Q3ListViewItem *item );
void removeSelected();
void loadAddressBook();
protected slots:
void addressBookChanged();
private:
- void addCompletionItem( const QString &str, QListViewItem *item );
+ void addCompletionItem( const QString &str, Q3ListViewItem *item );
bool mMultiple;
KListView *mAddresseeList;
QLineEdit *mAddresseeEdit;
KListView *mSelectedList;
AddressBook *mAddressBook;
- QDict<QListViewItem> mItemDict;
- QDict<QListViewItem> mSelectedDict;
+ Q3Dict<Q3ListViewItem> mItemDict;
+ Q3Dict<Q3ListViewItem> mSelectedDict;
class AddresseeDialogPrivate;
AddresseeDialogPrivate *d;
};
}
#endif
diff --git a/kabc/addresseelist.cpp b/kabc/addresseelist.cpp
index 097e162..e1ba1ce 100644
--- a/kabc/addresseelist.cpp
+++ b/kabc/addresseelist.cpp
@@ -1,63 +1,65 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Jost Schenck <jost@schenck.de>
2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kdebug.h>
//US
-#include <qtl.h>
+#include <q3tl.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "addresseelist.h"
#include "field.h"
using namespace KABC;
//
//
// Traits
//
//
bool SortingTraits::Uid::eq( const Addressee &a1, const Addressee &a2 )
{
// locale awareness doesn't make sense sorting ids
return ( QString::compare( a1.uid(), a2.uid() ) == 0 );
}
bool SortingTraits::Uid::lt( const Addressee &a1, const Addressee &a2 )
{
// locale awareness doesn't make sense sorting ids
return ( QString::compare( a1.uid(), a2.uid() ) < 0 );
}
bool SortingTraits::Name::eq( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.name(), a2.name() ) == 0 );
}
bool SortingTraits::Name::lt( const Addressee &a1, const Addressee &a2 )
@@ -92,84 +94,84 @@ bool SortingTraits::FamilyName::lt( const Addressee &a1, const Addressee &a2 )
if ( 0 == family ) {
return ( QString::compare( a1.givenName(), a2.givenName() ) < 0 );
} else {
return family < 0;
}
}
bool SortingTraits::GivenName::eq( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
return ( QString::compare( a1.givenName(), a2.givenName() ) == 0
&& QString::compare( a1.familyName(), a2.familyName() ) == 0 );
}
bool SortingTraits::GivenName::lt( const Addressee &a1, const Addressee &a2 )
{
//US QString::localeAwareCompare is not available in my distribution. Redefine it to compare
int given = QString::compare( a1.givenName(), a2.givenName() );
if ( 0 == given ) {
return ( QString::compare( a1.familyName(), a2.familyName() ) < 0 );
} else {
return given < 0;
}
}
//
//
// AddresseeList
//
//
AddresseeList::AddresseeList()
- : QValueList<Addressee>()
+ : Q3ValueList<Addressee>()
{
mReverseSorting = false;
mActiveSortingCriterion = FormattedName;
mActiveSortingField = 0;
}
AddresseeList::~AddresseeList()
{
}
AddresseeList::AddresseeList( const AddresseeList &l )
- : QValueList<Addressee>( l )
+ : Q3ValueList<Addressee>( l )
{
mReverseSorting = l.reverseSorting();
mActiveSortingCriterion = l.sortingCriterion();
}
-AddresseeList::AddresseeList( const QValueList<Addressee> &l )
- : QValueList<Addressee>( l )
+AddresseeList::AddresseeList( const Q3ValueList<Addressee> &l )
+ : Q3ValueList<Addressee>( l )
{
mReverseSorting = false;
}
void AddresseeList::dump() const
{
kdDebug(5700) << "AddresseeList {" << endl;
kdDebug(5700) << "reverse order: " << ( mReverseSorting ? "true" : "false" ) << endl;
QString crit;
if ( Uid == mActiveSortingCriterion ) {
crit = "Uid";
} else if ( Name == mActiveSortingCriterion ) {
crit = "Name";
} else if ( FormattedName == mActiveSortingCriterion ) {
crit = "FormattedName";
} else if ( FamilyName == mActiveSortingCriterion ) {
crit = "FamilyName";
} else if ( GivenName == mActiveSortingCriterion ) {
crit = "GivenName";
} else {
crit = "unknown -- update dump method";
}
kdDebug(5700) << "sorting criterion: " << crit << endl;
//US
//US for ( const_iterator it = begin(); it != end(); ++it )
for ( ConstIterator it = begin(); it != end(); ++it )
(*it).dump();
kdDebug(5700) << "}" << endl;
diff --git a/kabc/addresseelist.h b/kabc/addresseelist.h
index 2df252c..6106804 100644
--- a/kabc/addresseelist.h
+++ b/kabc/addresseelist.h
@@ -1,64 +1,64 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Jost Schenck <jost@schenck.de>
2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_ADDRESSEELIST_H
#define KABC_ADDRESSEELIST_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "addressee.h"
namespace KABC {
class Field;
/**
* Each trait must implement one static function for equality, one for "less
* than". Class name should be the field name. A trait does not necessarily
* have to stick to just one field: a trait sorting by family name can e.g.
* sort addressees with equal family name by given name.
*
* If you want to implement reverse sorting, you do not have to write another
* trait, as AddresseeList takes care of that.
*/
namespace SortingTraits
{
class Uid
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
class Name
{
public:
static bool eq( const Addressee &, const Addressee & );
static bool lt( const Addressee &, const Addressee & );
};
@@ -85,71 +85,71 @@ class GivenName // fallback to family name
};
}
/**
* Addressee attribute used for sorting.
*/
typedef enum { Uid, Name, FormattedName, FamilyName, GivenName } SortingCriterion;
/**
* @short a QValueList of Addressee, with sorting functionality
*
* This class extends the functionality of QValueList with
* sorting methods specific to the Addressee class. It can be used
* just like any other QValueList but is no template class.
*
* An AddresseeList does not automatically keep sorted when addressees
* are added or removed or the sorting order is changed, as this would
* slow down larger operations by sorting after every step. So after
* such operations you have to call {@link #sort} or {@link #sortBy} to
* create a defined order again.
*
* Iterator usage is inherited by QValueList and extensively documented
* there. Please remember that the state of an iterator is undefined
* after any sorting operation.
*
* For the enumeration Type SortingCriterion, which specifies the
* field by the collection will be sorted, the following values exist:
* Uid, Name, FormattedName, FamilyName, GivenName.
*
* @author Jost Schenck jost@schenck.de
*/
-class AddresseeList : public QValueList<Addressee>
+class AddresseeList : public Q3ValueList<Addressee>
{
public:
AddresseeList();
~AddresseeList();
AddresseeList( const AddresseeList & );
- AddresseeList( const QValueList<Addressee> & );
+ AddresseeList( const Q3ValueList<Addressee> & );
/**
* Debug output.
*/
void dump() const;
/**
* Determines the direction of sorting. On change, the list
* will <em>not</em> automatically be resorted.
* @param r <tt>true</tt> if sorting should be done reverse, <tt>false</tt> otherwise
*/
void setReverseSorting( bool r = true ) { mReverseSorting = r; }
/**
* Returns the direction of sorting.
* @return <tt>true</tt> if sorting is done reverse, <tt>false</tt> otherwise
*/
bool reverseSorting() const { return mReverseSorting; }
/**
* Sorts this list by a specific criterion.
* @param c the criterion by which should be sorted
*/
void sortBy( SortingCriterion c );
/**
* Sorts this list by a specific field. If no parameter is given, the
* last used Field object will be used.
* @param field pointer to the Field object to be sorted by
*/
void sortByField( Field *field = 0 );
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index cde19a1..425e67c 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -1,117 +1,122 @@
/*
This file is part of libkdepim.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kabc/address.h>
#include <kabc/addressee.h>
#include <kabc/phonenumber.h>
#include <kglobal.h>
//US#include <kglobalsettings.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstringhandler.h>
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include <qregexp.h>
#include <qfile.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qlabel.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qapplication.h>
#include <qpushbutton.h>
#ifdef DESKTOP_VERSION
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#include <qprinter.h>
#include <qpainter.h>
#endif
+#include <QDesktopWidget>
-#include <qstylesheet.h>
+#include <q3stylesheet.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QPixmap>
+#include <Q3VBoxLayout>
#include "externalapphandler.h"
#include <kabc/addresseeview.h>
//US #ifndef DESKTOP_VERSION
//US #include <qtopia/qcopenvelope_qws.h>
//US #include <qpe/qpeapplication.h>
//US #endif
//US static int kphoneInstalled = 0;
using namespace KABC;
bool AddresseeView::sFullDetailsMode = false;
AddresseeView::AddresseeView( QWidget *parent, const char *name )
- : QTextBrowser( parent, name )
+ : Q3TextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
void AddresseeView::printMe()
{
#ifdef DESKTOP_VERSION
QPrinter printer;
if (!printer.setup() )
return;
QPainter p;
p.begin ( &printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
p.scale( scale, scale );
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
#endif
}
void AddresseeView::setSource(const QString& n)
{
//qDebug("********AddresseeView::setSource %s", n.latin1());
if ( n == "allDetails" ) {
sFullDetailsMode = true;
setAddressee( mCurrentContact );
} else if ( n == "notAllDetails" ) {
sFullDetailsMode = false;
setAddressee( mCurrentContact );
} else if ( n.left( 6 ) == "mailto" )
ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
else if ( n.left( 7 ) == "phoneto" )
ExternalAppHandler::instance()->callByPhone( n.mid(8) );
else if ( n.left( 5 ) == "faxto" )
ExternalAppHandler::instance()->callByFax( n.mid(6) );
@@ -373,132 +378,132 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
"<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" )
.arg( i18n("Details") )
.arg( i18n("Show!") );
}
QString aRole = "";
QString aOrga = "";
if ( true /*!mAddressee.role().isEmpty()*/ ) {
aRole = "<tr>"
"<td align=\"left\">" + mAddressee.role() + "</td>"
"</tr>";
}
if ( true /*!mAddressee.organization().isEmpty()*/ ) {
aOrga = "<tr>"
"<td align=\"left\">" + mAddressee.organization() + "</td>"
"</tr>";
}
mText = "";
QString picString = "";
KABC::Picture picture = mAddressee.photo();
if (picture.undefined() ) picture = mAddressee.logo();
bool picAvailintern = false;
bool picAvailUrl = false;
if (! picture.undefined() ) {
picAvailintern = (picture.isIntern() && !picture.data().isNull());
picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
}
if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
if ( picAvailintern ) {
- QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
+ Q3MimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
int wid = picture.data().width();
int hei = picture.data().height();
if ( wid > 128 || hei > 128 ) {
if ( wid > hei ) {
hei = (hei*128)/wid;
wid = 128;
} else {
wid = (wid*128)/hei;
hei = 128;
}
}
picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
} else {
if ( picAvailUrl ) {
QPixmap picPix( picture.url() );
- QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
int wid = picPix.width();
int hei = picPix.height();
if ( wid > 128 || hei > 128 ) {
if ( wid > hei ) {
hei = (hei*128)/wid;
wid = 128;
} else {
wid = (wid*128)/hei;
hei = 128;
}
}
picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
} else {
if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
static bool setDefaultImageChildren = false;
if ( !setDefaultImageChildren ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
setDefaultImageChildren = true;
}
picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
} else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
static bool setDefaultImagepouses = false;
if ( !setDefaultImagepouses ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
setDefaultImagepouses = true;
}
picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
} else {
QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
if ( gen == "male" ) {
static bool setDefaultImageMale = false;
if ( !setDefaultImageMale ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
setDefaultImageMale = true;
}
picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
} else if ( gen == "female" ) {
static bool setDefaultImageFemale = false;
if ( !setDefaultImageFemale ) {
- QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
setDefaultImageFemale = true;
}
picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
} else {
static bool setDefaultImage = false;
if ( !setDefaultImage ) {
//qDebug("Setting default pixmap ");
- QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
+ Q3MimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
setDefaultImage = true;
}
picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
}
}
}
}
mText = QString::fromLatin1(
"<html>"
"<body text=\"%1\" bgcolor=\"%2\">" // text and background color
"<table>"
"<tr>"
"<td rowspan=\"3\" align=\"right\" valign=\"top\">"
"%3"
"</td>"
"<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
"</tr>"
"%5" // role
"%6" // organization
"<td colspan=\"2\">&nbsp;</td>"
"%7" // dynamic part
"%8" // notes
"</table>"
"</body>"
"</html>")
//US
.arg( /*KGlobalSettings::textColor().name()*/ "black" )
//US
.arg( /*KGlobalSettings::baseColor().name()*/ "white" )
.arg( picString )
.arg( name )
.arg( aRole )
@@ -624,116 +629,116 @@ QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones_unsorted
if ( !extension.isEmpty() ) {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( phonetype ) )
.arg( extension )
.arg( (*phoneIt).number() )
.arg( (*phoneIt).number() )
.arg( sms );
} else {
dynamicPart += QString(
"<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2 %3</td></tr>" )
.arg( KABC::PhoneNumber::typeLabel( phonetype ) )
.arg( (*phoneIt).number() )
.arg( sms );
}
}
return dynamicPart;
}
/*
KABC::Addressee AddresseeView::addressee() const
{
return mAddressee;
}
*/
void AddresseeView::addTag(const QString & tag,const QString & text)
{
if ( text.isEmpty() )
return;
- int number=text.contains("\n");
+ int number=text.count("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
{
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
QWidget* topframe = new QWidget( this );
setMainWidget( topframe );
- QBoxLayout* bl;
+ Q3BoxLayout* bl;
if ( QApplication::desktop()->width() < 640 ) {
- bl = new QVBoxLayout( topframe );
+ bl = new Q3VBoxLayout( topframe );
} else {
- bl = new QHBoxLayout( topframe );
+ bl = new Q3HBoxLayout( topframe );
}
- QVBox* subframe = new QVBox( topframe );
+ Q3VBox* subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
if ( takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
AddresseeView * av = new AddresseeView( subframe );
av->setAddressee( loc );
- subframe = new QVBox( topframe );
+ subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
lab = new QLabel( i18n("Remote Addressee"), subframe );
if ( !takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
av = new AddresseeView( subframe );
av->setAddressee( rem );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
#ifndef DESKTOP_VERSION
showMaximized();
#else
resize ( 640, 400 );
#endif
}
int AddresseeChooser::executeD( bool local )
{
mSyncResult = 3;
if ( local )
findButton( User1 )->setFocus();
else
findButton( Ok )->setFocus();
exec();
return mSyncResult;
}
void AddresseeChooser::slot_remote()
{
mSyncResult = 2;
accept();
}
void AddresseeChooser::slot_local()
{
mSyncResult = 1;
accept();
}
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h
index a4de085..f7ce2e0 100644
--- a/kabc/addresseeview.h
+++ b/kabc/addresseeview.h
@@ -1,66 +1,66 @@
/*
This file is part of libkdepim.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KPIM_ADDRESSEEVIEW_H
#define KPIM_ADDRESSEEVIEW_H
#include <kabc/addressee.h>
#include <kdialogbase.h>
//US #include <ktextbrowser.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
namespace KABC {
//US class AddresseeView : public KTextBrowser
-class AddresseeView : public QTextBrowser
+class AddresseeView : public Q3TextBrowser
{
public:
AddresseeView( QWidget *parent = 0, const char *name = 0 );
/**
Sets the addressee object. The addressee is displayed immediately.
@param addr The addressee object.
*/
void setAddressee( const KABC::Addressee& addr );
void setSource(const QString& n);
/**
Returns the current addressee object.
*/
//KABC::Addressee addressee() const;
void printMe();
static bool sFullDetailsMode;
private:
Addressee mCurrentContact;
//KABC::Addressee mAddressee;
QString mText;
QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred );
void addTag(const QString & tag,const QString & text);
//class AddresseeViewPrivate;
//AddresseeViewPrivate *d;
};
class AddresseeChooser : public KDialogBase
{
Q_OBJECT
public:
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp
index d34ba0b..cf5afa6 100644
--- a/kabc/distributionlist.cpp
+++ b/kabc/distributionlist.cpp
@@ -1,109 +1,111 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include "distributionlist.h"
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KABC;
DistributionList::DistributionList( DistributionListManager *manager,
const QString &name ) :
mManager( manager ), mName( name )
{
mManager->insert( this );
}
DistributionList::~DistributionList()
{
mManager->remove( this );
}
void DistributionList::setName( const QString &name )
{
mName = name;
}
QString DistributionList::name() const
{
return mName;
}
void DistributionList::insertEntry( const Addressee &a, const QString &email )
{
QString em = email;
if (em.isNull() )
em = a.preferredEmail();
Entry e( a, em );
- QValueList<Entry>::Iterator it;
+ Q3ValueList<Entry>::Iterator it;
for( it = mEntries.begin(); it != mEntries.end(); ++it ) {
if ( (*it).addressee.uid() == a.uid() ) {
/**
We have to check if both email addresses contains no data,
a simple 'email1 == email2' wont work here
*/
if ( ( (*it).email.isNull() && em.isEmpty() ) ||
( (*it).email.isEmpty() && em.isNull() ) ||
( (*it).email == em ) ) {
//*it = e;
return;
}
}
}
mEntries.append( e );
}
void DistributionList::removeEntry( const Addressee &a, const QString &email )
{
- QValueList<Entry>::Iterator it;
+ Q3ValueList<Entry>::Iterator it;
for( it = mEntries.begin(); it != mEntries.end(); ++it ) {
if ( (*it).addressee.uid() == a.uid() && (*it).email == email ) {
mEntries.remove( it );
return;
}
}
}
QStringList DistributionList::emails() const
{
QStringList emails;
Entry::List::ConstIterator it;
for( it = mEntries.begin(); it != mEntries.end(); ++it ) {
Addressee a = (*it).addressee;
QString email = (*it).email.isEmpty() ? a.fullEmail() :
a.fullEmail( (*it).email );
if ( !email.isEmpty() ) {
emails.append( email );
}
}
return emails;
}
DistributionList::Entry::List DistributionList::entries() const
{
return mEntries;
}
diff --git a/kabc/distributionlist.h b/kabc/distributionlist.h
index c81e543..8d21a17 100644
--- a/kabc/distributionlist.h
+++ b/kabc/distributionlist.h
@@ -1,83 +1,86 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KABC_DISTRIBUTIONLIST_H
#define KABC_DISTRIBUTIONLIST_H
//#include <kdirwatch.h>
#include "addressbook.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
namespace KABC {
class DistributionListManager;
/**
@short Distribution list of email addresses
This class represents a list of email addresses. Each email address is
associated with an address book entry. If the address book entry changes, the
entry in the distribution list is automatically updated.
*/
class DistributionList
{
public:
/**
@short Distribution List Entry
This class represents an entry of a distribution list. It consists of an
addressee and an email address. If the email address is null, the
preferred email address of the addressee is used.
*/
struct Entry
{
- typedef QValueList<Entry> List;
+ typedef Q3ValueList<Entry> List;
Entry() {}
Entry( const Addressee &_addressee, const QString &_email ) :
addressee( _addressee ), email( _email ) {}
Addressee addressee;
QString email;
};
/**
Create distribution list object.
@param manager Managing object of this list.
@param name Name of this list.
*/
DistributionList( DistributionListManager *manager, const QString &name );
/**
Destructor.
*/
~DistributionList();
/**
Set name of this list. The name is used as key by the
DistributinListManager.
*/
void setName( const QString & );
/**
Get name of this list.
*/
QString name() const;
@@ -138,65 +141,65 @@ class DistributionListManager
DistributionList *list( const QString &name );
/**
Insert distribution list. If a list with this name already exists, nothing
happens.
*/
void insert( DistributionList * );
/**
Remove distribution list. If a list with this name doesn't exist, nothing
happens.
*/
void remove( DistributionList * );
/**
Return names of all distribution lists managed by this manager.
*/
QStringList listNames();
/**
Load distribution lists form disk.
*/
bool load();
/**
Save distribution lists to disk.
*/
bool save();
private:
AddressBook *mAddressBook;
- QPtrList<DistributionList> mLists;
+ Q3PtrList<DistributionList> mLists;
};
/**
@short Watchdog for distribution lists
This class provides a @ref changed() signal that i emitted when the
distribution lists has changed in some way.
Exapmle:
<pre>
KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self()
connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) );
</pre>
*/
/*
class DistributionListWatcher : public QObject
{
Q_OBJECT_XX
public:
static DistributionListWatcher *self();
signals:
void changed();
protected:
diff --git a/kabc/distributionlistdialog.cpp b/kabc/distributionlistdialog.cpp
index d2e1144..82883e6 100644
--- a/kabc/distributionlistdialog.cpp
+++ b/kabc/distributionlistdialog.cpp
@@ -1,216 +1,222 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qcombobox.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
#include <klineeditdlg.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
+#include <Q3Button>
#include <qradiobutton.h>
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include "addressbook.h"
#include "addresseedialog.h"
#include "distributionlist.h"
#include "distributionlistdialog.h"
//US #include "distributionlistdialog.moc"
using namespace KABC;
DistributionListDialog::DistributionListDialog( AddressBook *addressBook, QWidget *parent)
: KDialogBase( parent, "", true, i18n("Configure Distribution Lists"), Ok, Ok, true)
{
mEditor = new DistributionListEditorWidget( addressBook, this );
setMainWidget( mEditor );
connect( this, SIGNAL( okClicked() ), mEditor, SLOT( save() ) );
}
DistributionListDialog::~DistributionListDialog()
{
}
EmailSelector::EmailSelector( const QStringList &emails, const QString &current,
QWidget *parent ) :
KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
parent )
{
- QFrame *topFrame = plainPage();
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = plainPage();
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
- mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
+ mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"),
topFrame );
topLayout->addWidget( mButtonGroup );
QStringList::ConstIterator it;
for( it = emails.begin(); it != emails.end(); ++it ) {
QRadioButton *button = new QRadioButton( *it, mButtonGroup );
if ( (*it) == current ) {
button->setDown( true );
}
}
}
QString EmailSelector::selected()
{
- QButton *button = mButtonGroup->selected();
+ QAbstractButton *button = mButtonGroup->selected();
if ( button ) return button->text();
return QString::null;
}
QString EmailSelector::getEmail( const QStringList &emails, const QString &current,
QWidget *parent )
{
EmailSelector *dlg = new EmailSelector( emails, current, parent );
dlg->exec();
QString result = dlg->selected();
delete dlg;
return result;
}
-class EntryItem : public QListViewItem
+class EntryItem : public Q3ListViewItem
{
public:
- EntryItem( QListView *parent, const Addressee &addressee,
+ EntryItem( Q3ListView *parent, const Addressee &addressee,
const QString &email=QString::null ) :
- QListViewItem( parent ),
+ Q3ListViewItem( parent ),
mAddressee( addressee ),
mEmail( email )
{
setText( 0, addressee.realName() );
if( email.isEmpty() ) {
setText( 1, addressee.preferredEmail() );
setText( 2, i18n("Yes") );
} else {
setText( 1, email );
setText( 2, i18n("No") );
}
}
Addressee addressee() const
{
return mAddressee;
}
QString email() const
{
return mEmail;
}
private:
Addressee mAddressee;
QString mEmail;
};
DistributionListEditorWidget::DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent) :
QWidget( parent ),
mAddressBook( addressBook )
{
kdDebug(5700) << "DistributionListEditor()" << endl;
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
- QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ;
+ Q3BoxLayout *nameLayout = new Q3HBoxLayout( topLayout) ;
mNameCombo = new QComboBox( this );
nameLayout->addWidget( mNameCombo );
connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) );
mNewButton = new QPushButton( i18n("New List..."), this );
nameLayout->addWidget( mNewButton );
connect( mNewButton, SIGNAL( clicked() ), SLOT( newList() ) );
mEditButton = new QPushButton( i18n("Rename List..."), this );
nameLayout->addWidget( mEditButton );
connect( mEditButton, SIGNAL( clicked() ), SLOT( editList() ) );
mRemoveButton = new QPushButton( i18n("Remove List"), this );
nameLayout->addWidget( mRemoveButton );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeList() ) );
- QGridLayout *gridLayout = new QGridLayout( topLayout, 3, 3 );
+ Q3GridLayout *gridLayout = new Q3GridLayout( topLayout, 3, 3 );
gridLayout->setColStretch(1, 1);
QLabel *listLabel = new QLabel( i18n("Available addresses:"), this );
gridLayout->addWidget( listLabel, 0, 0 );
mListLabel = new QLabel( this );
gridLayout->addMultiCellWidget( mListLabel, 0, 0, 1, 2 );
- mAddresseeView = new QListView( this );
+ mAddresseeView = new Q3ListView( this );
mAddresseeView->addColumn( i18n("Name") );
mAddresseeView->addColumn( i18n("Preferred Email") );
mAddresseeView->setAllColumnsShowFocus( true );
gridLayout->addWidget( mAddresseeView, 1, 0 );
connect( mAddresseeView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionAddresseeViewChanged() ) );
- connect( mAddresseeView, SIGNAL( doubleClicked( QListViewItem * ) ),
+ connect( mAddresseeView, SIGNAL( doubleClicked( Q3ListViewItem * ) ),
SLOT( addEntry() ) );
mAddEntryButton = new QPushButton( i18n("Add Entry"), this );
mAddEntryButton->setEnabled(false);
gridLayout->addWidget( mAddEntryButton, 2, 0 );
connect( mAddEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) );
- mEntryView = new QListView( this );
+ mEntryView = new Q3ListView( this );
mEntryView->addColumn( i18n("Name") );
mEntryView->addColumn( i18n("Email") );
mEntryView->addColumn( i18n("Use Preferred") );
mEntryView->setEnabled(false);
mEntryView->setAllColumnsShowFocus( true );
gridLayout->addMultiCellWidget( mEntryView, 1, 1, 1, 2 );
connect( mEntryView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionEntryViewChanged() ) );
mChangeEmailButton = new QPushButton( i18n("Change Email..."), this );
gridLayout->addWidget( mChangeEmailButton, 2, 1 );
connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
mRemoveEntryButton = new QPushButton( i18n("Remove Entry"), this );
gridLayout->addWidget( mRemoveEntryButton, 2, 2 );
connect( mRemoveEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) );
mManager = new DistributionListManager( mAddressBook );
mManager->load();
updateAddresseeView();
updateNameCombo();
}
DistributionListEditorWidget::~DistributionListEditorWidget()
{
kdDebug(5700) << "~DistributionListEditor()" << endl;
delete mManager;
}
void DistributionListEditorWidget::save()
diff --git a/kabc/distributionlistdialog.h b/kabc/distributionlistdialog.h
index b6d3c80..3627431 100644
--- a/kabc/distributionlistdialog.h
+++ b/kabc/distributionlistdialog.h
@@ -1,140 +1,142 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KABC_DISTRIBUTIONLISTDIALOG_H
#define KABC_DISTRIBUTIONLISTDIALOG_H
#include <qwidget.h>
+//Added by qt3to4:
+#include <QLabel>
#include <kdialogbase.h>
-class QListView;
+class Q3ListView;
class QLabel;
class QComboBox;
-class QButtonGroup;
+class Q3ButtonGroup;
namespace KABC {
class AddressBook;
class DistributionListEditorWidget;
class DistributionListManager;
/**
@short Frontend to create distribution lists
Creating a new DistributionListDialog does automatically
load all addressees and distribution lists from the config
files. The changes will be saved when clicking the 'OK'
button.
Example:
<pre>
KABC::DistributionListDialog *dlg = new
KABC::DistributionListDialog( KABC::StdAddressBook::self(), this );
dlg->exec();
</pre>
*/
class DistributionListDialog : public KDialogBase
{
Q_OBJECT
public:
/**
Constructor.
@param ab The addressbook, the addressees should be used from
@param parent The parent widget
*/
DistributionListDialog( AddressBook *ab, QWidget *parent );
/**
Destructor.
*/
virtual ~DistributionListDialog();
private:
DistributionListEditorWidget *mEditor;
struct Data;
Data *d;
};
/**
@short Helper class
*/
class EmailSelector : public KDialogBase
{
public:
EmailSelector( const QStringList &emails, const QString &current,
QWidget *parent );
QString selected();
static QString getEmail( const QStringList &emails, const QString &current,
QWidget *parent );
private:
- QButtonGroup *mButtonGroup;
+ Q3ButtonGroup *mButtonGroup;
};
/**
@short Helper class
*/
class DistributionListEditorWidget : public QWidget
{
Q_OBJECT
public:
DistributionListEditorWidget( AddressBook *, QWidget *parent );
virtual ~DistributionListEditorWidget();
private slots:
void newList();
void editList();
void removeList();
void addEntry();
void removeEntry();
void changeEmail();
void updateEntryView();
void updateAddresseeView();
void updateNameCombo();
void slotSelectionEntryViewChanged();
void slotSelectionAddresseeViewChanged();
void save();
private:
QComboBox *mNameCombo;
QLabel *mListLabel;
- QListView *mEntryView;
- QListView *mAddresseeView;
+ Q3ListView *mEntryView;
+ Q3ListView *mAddresseeView;
AddressBook *mAddressBook;
DistributionListManager *mManager;
QPushButton *mNewButton, *mEditButton, *mRemoveButton;
QPushButton *mChangeEmailButton, *mRemoveEntryButton, *mAddEntryButton;
struct Data;
Data *d;
};
}
#endif
diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp
index 9f5840b..ca5ecb7 100644
--- a/kabc/distributionlisteditor.cpp
+++ b/kabc/distributionlisteditor.cpp
@@ -1,197 +1,201 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#ifdef DESKTOP_VERSION
#include <qinputdialog.h>
#else
#include <qtcompat/qinputdialog.h>
#endif
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qradiobutton.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kdebug.h>
#include "addressbook.h"
#include "addresseedialog.h"
#include "distributionlist.h"
#include "distributionlisteditor.h"
//US #include "distributionlisteditor.moc"
using namespace KABC;
EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current,
QWidget *parent ) :
KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
parent )
{
- QFrame *topFrame = plainPage();
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = plainPage();
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
- mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
+ mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"),
topFrame );
topLayout->addWidget( mButtonGroup );
QStringList::ConstIterator it;
for( it = emails.begin(); it != emails.end(); ++it ) {
QRadioButton *button = new QRadioButton( *it, mButtonGroup );
if ( (*it) == current ) {
button->setDown( true );
}
}
}
QString EmailSelectDialog::selected()
{
- QButton *button = mButtonGroup->selected();
+ QAbstractButton *button = mButtonGroup->selected();
if ( button ) return button->text();
return QString::null;
}
QString EmailSelectDialog::getEmail( const QStringList &emails, const QString &current,
QWidget *parent )
{
EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent );
dlg->exec();
QString result = dlg->selected();
delete dlg;
return result;
}
-class EditEntryItem : public QListViewItem
+class EditEntryItem : public Q3ListViewItem
{
public:
- EditEntryItem( QListView *parent, const Addressee &addressee,
+ EditEntryItem( Q3ListView *parent, const Addressee &addressee,
const QString &email=QString::null ) :
- QListViewItem( parent ),
+ Q3ListViewItem( parent ),
mAddressee( addressee ),
mEmail( email )
{
setText( 0, addressee.realName() );
if( email.isEmpty() ) {
setText( 1, addressee.preferredEmail() );
setText( 2, i18n("Yes") );
} else {
setText( 1, email );
setText( 2, i18n("No") );
}
}
Addressee addressee() const
{
return mAddressee;
}
QString email() const
{
return mEmail;
}
private:
Addressee mAddressee;
QString mEmail;
};
DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) :
QWidget( parent ),
mAddressBook( addressBook )
{
kdDebug(5700) << "DistributionListEditor()" << endl;
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setMargin( KDialog::marginHint() );
topLayout->setSpacing( KDialog::spacingHint() );
- QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ;
+ Q3BoxLayout *nameLayout = new Q3HBoxLayout( topLayout) ;
mNameCombo = new QComboBox( this );
nameLayout->addWidget( mNameCombo );
connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) );
newButton = new QPushButton( i18n("New List"), this );
nameLayout->addWidget( newButton );
connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) );
removeButton = new QPushButton( i18n("Remove List"), this );
nameLayout->addWidget( removeButton );
connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) );
- mEntryView = new QListView( this );
+ mEntryView = new Q3ListView( this );
mEntryView->addColumn( i18n("Name") );
mEntryView->addColumn( i18n("Email") );
mEntryView->addColumn( i18n("Use Preferred") );
topLayout->addWidget( mEntryView );
connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged()));
changeEmailButton = new QPushButton( i18n("Change Email"), this );
topLayout->addWidget( changeEmailButton );
connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
removeEntryButton = new QPushButton( i18n("Remove Entry"), this );
topLayout->addWidget( removeEntryButton );
connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) );
addEntryButton = new QPushButton( i18n("Add Entry"), this );
topLayout->addWidget( addEntryButton );
connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) );
- mAddresseeView = new QListView( this );
+ mAddresseeView = new Q3ListView( this );
mAddresseeView->addColumn( i18n("Name") );
mAddresseeView->addColumn( i18n("Preferred Email") );
topLayout->addWidget( mAddresseeView );
connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged()));
mManager = new DistributionListManager( mAddressBook );
mManager->load();
updateAddresseeView();
updateNameCombo();
removeButton->setEnabled(!mManager->listNames().isEmpty());
}
DistributionListEditor::~DistributionListEditor()
{
kdDebug(5700) << "~DistributionListEditor()" << endl;
mManager->save();
delete mManager;
}
void DistributionListEditor::slotSelectionEntryViewChanged()
{
//US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() );
EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() );
bool state = (entryItem != 0L);
changeEmailButton->setEnabled(state);
removeEntryButton->setEnabled(state);
}
diff --git a/kabc/distributionlisteditor.h b/kabc/distributionlisteditor.h
index e0b4221..e672a14 100644
--- a/kabc/distributionlisteditor.h
+++ b/kabc/distributionlisteditor.h
@@ -1,86 +1,86 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KABC_DISTRIBUTIONLISTEDITOR_H
#define KABC_DISTRIBUTIONLISTEDITOR_H
#include <qwidget.h>
#include <kdialogbase.h>
-class QListView;
+class Q3ListView;
class QComboBox;
-class QButtonGroup;
+class Q3ButtonGroup;
namespace KABC {
class AddressBook;
class DistributionListManager;
class EmailSelectDialog : public KDialogBase
{
public:
EmailSelectDialog( const QStringList &emails, const QString &current,
QWidget *parent );
QString selected();
static QString getEmail( const QStringList &emails, const QString &current,
QWidget *parent );
private:
- QButtonGroup *mButtonGroup;
+ Q3ButtonGroup *mButtonGroup;
};
/**
@obsolete
*/
class DistributionListEditor : public QWidget
{
Q_OBJECT
public:
DistributionListEditor( AddressBook *, QWidget *parent );
virtual ~DistributionListEditor();
private slots:
void newList();
void removeList();
void addEntry();
void removeEntry();
void changeEmail();
void updateEntryView();
void updateAddresseeView();
void updateNameCombo();
void slotSelectionEntryViewChanged();
void slotSelectionAddresseeViewChanged();
private:
QComboBox *mNameCombo;
- QListView *mEntryView;
- QListView *mAddresseeView;
+ Q3ListView *mEntryView;
+ Q3ListView *mAddresseeView;
AddressBook *mAddressBook;
DistributionListManager *mManager;
QPushButton *newButton, *removeButton;
QPushButton *changeEmailButton,*removeEntryButton,*addEntryButton;
};
}
#endif
diff --git a/kabc/field.cpp b/kabc/field.cpp
index 7c6d7a9..203f696 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -4,64 +4,66 @@
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <klocale.h>
#include <kconfig.h>
#include <kconfigbase.h>
#include <kglobal.h>
#include "field.h"
#include "resource.h"
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KABC;
class Field::FieldImpl
{
public:
FieldImpl( int fieldId, int category = 0,
const QString &label = QString::null,
const QString &key = QString::null,
const QString &app = QString::null )
: mFieldId( fieldId ), mCategory( category ), mLabel( label ),
mKey( key ), mApp( app ) {}
enum FieldId
{
CustomField,
FormattedName,
FamilyName,
GivenName,
AdditionalName,
Prefix,
Suffix,
NickName,
Birthday,
Category,
HomeAddressStreet,
HomeAddressLocality,
HomeAddressRegion,
HomeAddressPostalCode,
HomeAddressCountry,
HomeAddressLabel,
BusinessAddressStreet,
@@ -348,65 +350,65 @@ bool Field::setValue( KABC::Addressee &a, const QString &value )
a.setAdditionalName( value );
return true;
case FieldImpl::Prefix:
a.setPrefix( value );
return true;
case FieldImpl::Suffix:
a.setSuffix( value );
return true;
case FieldImpl::NickName:
a.setNickName( value );
return true;
case FieldImpl::Mailer:
a.setMailer( value );
return true;
case FieldImpl::Title:
a.setTitle( value );
return true;
case FieldImpl::Role:
a.setRole( value );
return true;
case FieldImpl::Organization:
a.setOrganization( value );
return true;
case FieldImpl::Note:
a.setNote( value );
return true;
case FieldImpl::Birthday:
//US
//the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) );
// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ?
{
QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate
- a.setBirthday(dt);
+ a.setBirthday((QDateTime)dt);
}
return true;
case FieldImpl::CustomField:
a.insertCustom( mImpl->app(), mImpl->key(), value );
//US never copy the resourcename back to the adressee.
case FieldImpl::Resource:
default:
return false;
}
}
bool Field::isCustom()
{
return mImpl->fieldId() == FieldImpl::CustomField;
}
Field::List Field::allFields()
{
if ( mAllFields.isEmpty() ) {
createField( FieldImpl::FormattedName, Frequent );
createField( FieldImpl::FamilyName, Frequent );
createField( FieldImpl::GivenName, Frequent );
createField( FieldImpl::AdditionalName );
createField( FieldImpl::Prefix );
createField( FieldImpl::Suffix );
createField( FieldImpl::NickName, Personal );
createField( FieldImpl::Birthday, Personal );
createField( FieldImpl::Category );
createField( FieldImpl::HomeAddressStreet, Address|Personal );
createField( FieldImpl::HomeAddressLocality, Address|Personal );
createField( FieldImpl::HomeAddressRegion, Address|Personal );
createField( FieldImpl::HomeAddressPostalCode, Address|Personal );
@@ -464,112 +466,112 @@ void Field::createDefaultField( int id, int category )
void Field::deleteFields()
{
Field::List::ConstIterator it;
for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) {
delete (*it);
}
mAllFields.clear();
for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) {
delete (*it);
}
mDefaultFields.clear();
for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) {
delete (*it);
}
mCustomFields.clear();
}
void Field::saveFields( const QString &identifier,
const Field::List &fields )
{
KConfig *cfg = KGlobal::config();
KConfigGroupSaver( cfg, "KABCFields" );
saveFields( cfg, identifier, fields );
}
void Field::saveFields( KConfig *cfg, const QString &identifier,
const Field::List &fields )
{
- QValueList<int> fieldIds;
+ Q3ValueList<int> fieldIds;
//US
// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1());
int custom = 0;
Field::List::ConstIterator it;
for( it = fields.begin(); it != fields.end(); ++it ) {
//US
// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId());
fieldIds.append( (*it)->mImpl->fieldId() );
if( (*it)->isCustom() ) {
QStringList customEntry;
customEntry << (*it)->mImpl->label();
customEntry << (*it)->mImpl->key();
customEntry << (*it)->mImpl->app();
cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" +
QString::number( custom++ ), customEntry );
}
}
cfg->writeEntry( identifier, fieldIds );
}
Field::List Field::restoreFields( const QString &identifier )
{
//US
// qDebug("Field::restoreFields, identifier: %s", identifier.latin1());
KConfig *cfg = KGlobal::config();
KConfigGroupSaver( cfg, "KABCFields" );
cfg->setGroup( "KABCFields" );
Field::List l = restoreFields( cfg, identifier );
return l;
}
Field::List Field::restoreFields( KConfig *cfg, const QString &identifier )
{
- QValueList<int> fieldIds = cfg->readIntListEntry( identifier);
+ Q3ValueList<int> fieldIds = cfg->readIntListEntry( identifier);
//US
// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1());
Field::List fields;
int custom = 0;
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int>::ConstIterator it;
for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) {
FieldImpl *f = 0;
if ( (*it) == FieldImpl::CustomField ) {
QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" +
identifier + "_" +
QString::number( custom++ ) );
f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ],
customEntry[ 1 ], customEntry[ 2 ] );
} else {
f = new FieldImpl( *it );
}
fields.append( new Field( f ) );
}
return fields;
}
bool Field::equals( Field *field )
{
bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() );
if ( !sameId ) return false;
if ( mImpl->fieldId() != FieldImpl::CustomField ) return true;
return mImpl->key() == field->mImpl->key();
}
Field *Field::createCustomField( const QString &label, int category,
const QString &key, const QString &app )
{
Field *field = new Field( new FieldImpl( FieldImpl::CustomField,
diff --git a/kabc/field.h b/kabc/field.h
index 9e06597..55cc705 100644
--- a/kabc/field.h
+++ b/kabc/field.h
@@ -1,78 +1,78 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_FIELD_H
#define KABC_FIELD_H
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "addressee.h"
class KConfig;
namespace KABC {
class Field
{
class FieldImpl;
friend class FieldImpl;
public:
- typedef QValueList<Field *> List;
+ typedef Q3ValueList<Field *> List;
/**
* @li @p All -
* @li @p Frequent -
* @li @p Address -
* @li @p Email -
* @li @p Personal -
* @li @p Organization -
* @li @p CustomCategory -
*/
enum FieldCategory
{
All = 0x0,
Frequent = 0x01,
Address = 0x02,
Email = 0x04,
Personal = 0x08,
Organization = 0x10,
CustomCategory = 0x20
};
/**
* Returns the translated label for this field.
*/
virtual QString label();
/**
* Returns the ored categories the field belongs to.
*/
virtual int category();
/**
diff --git a/kabc/formatfactory.cpp b/kabc/formatfactory.cpp
index 3ae1c27..cbb97a2 100644
--- a/kabc/formatfactory.cpp
+++ b/kabc/formatfactory.cpp
@@ -73,65 +73,65 @@ US lets enter all resources directly instead of using teh desktopfiles.
config.setGroup( "Plugin" );
QString type = config.readEntry( "Type" );
info->library = config.readEntry( "X-KDE-Library" );
config.setGroup( "Misc" );
info->nameLabel = config.readEntry( "Name" );
info->descriptionLabel = config.readEntry( "Comment", i18n( "No description available." ) );
mFormatList.insert( type, info );
}
#endif
//US we already have vcard as default format.
info = new FormatInfo;
info->library = i18n("microkabcformat_binary");
info->nameLabel = i18n( "Binary" );
info->descriptionLabel = i18n( "No description available." );
mFormatList.insert( "binary", info );
}
FormatFactory::~FormatFactory()
{
mFormatList.clear();
}
QStringList FormatFactory::formats()
{
QStringList retval;
// make sure 'vcard' is the first entry
retval << "vcard";
- QDictIterator<FormatInfo> it( mFormatList );
+ Q3DictIterator<FormatInfo> it( mFormatList );
for ( ; it.current(); ++it )
if ( it.currentKey() != "vcard" )
retval << it.currentKey();
return retval;
}
FormatInfo *FormatFactory::info( const QString &type )
{
if ( type.isEmpty() )
return 0;
else
return mFormatList[ type ];
}
FormatPlugin *FormatFactory::format( const QString& type )
{
FormatPlugin *format = 0;
if ( type.isEmpty() )
return 0;
if ( type == "vcard" ) {
format = new VCardFormatPlugin;
format->setType( type );
format->setNameLabel( i18n( "vCard" ) );
format->setDescriptionLabel( i18n( "vCard Format" ) );
return format;
}
FormatInfo *fi = mFormatList[ type ];
if (!fi)
diff --git a/kabc/formatfactory.h b/kabc/formatfactory.h
index 9612374..de15b17 100644
--- a/kabc/formatfactory.h
+++ b/kabc/formatfactory.h
@@ -1,56 +1,56 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KABC_FORMATFACTORY_H
#define KABC_FORMATFACTORY_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qstring.h>
#include <kconfig.h>
#ifndef DESKTOP_VERSION
#include <klibloader.h>
#endif
#include "formatplugin.h"
namespace KABC {
struct FormatInfo
{
QString library;
QString nameLabel;
QString descriptionLabel;
};
/**
* Class for loading format plugins.
*
* Example:
*
* <pre>
* KABC::FormatFactory *factory = KABC::FormatFactory::self();
*
* QStringList list = factory->formats();
* QStringList::Iterator it;
* for ( it = list.begin(); it != list.end(); ++it ) {
* KABC::FormatPlugin *format = factory->format( (*it) );
* // do something with format
* }
@@ -68,37 +68,37 @@ class FormatFactory
/**
* Returns the global format factory.
*/
static FormatFactory *self();
/**
* Returns a pointer to a format object or a null pointer
* if format type doesn't exist.
*
* @param type The type of the format, returned by @ref formats()
*/
FormatPlugin *format( const QString &type );
/**
* Returns a list of all available format types.
*/
QStringList formats();
/**
* Returns the info structure for a special type.
*/
FormatInfo *info( const QString &type );
protected:
FormatFactory();
private:
#ifndef DESKTOP_VERSION
KLibrary *openLibrary( const QString& libName );
#endif
static FormatFactory *mSelf;
- QDict<FormatInfo> mFormatList;
+ Q3Dict<FormatInfo> mFormatList;
};
}
#endif
diff --git a/kabc/formats/binary/kabcformat_binaryE.pro b/kabc/formats/binary/kabcformat_binaryE.pro
index 2d9594d..c71197e 100644
--- a/kabc/formats/binary/kabcformat_binaryE.pro
+++ b/kabc/formats/binary/kabcformat_binaryE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
TARGET = microkabcformat_binary
#INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat
INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../qtcompat
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED
INTERFACES = \
HEADERS = \
binaryformat.h
SOURCES = \
binaryformat.cpp
diff --git a/kabc/formats/vcardformatplugin2.cpp b/kabc/formats/vcardformatplugin2.cpp
index 41b0c9a..fbebe92 100644
--- a/kabc/formats/vcardformatplugin2.cpp
+++ b/kabc/formats/vcardformatplugin2.cpp
@@ -1,124 +1,124 @@
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include "vcardformatplugin2.h"
#include "address.h"
#include "addressee.h"
#include "vcardparser/vcardtool.h"
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
using namespace KABC;
extern "C"
{
FormatPlugin *format()
{
return new VCardFormatPlugin2();
}
}
VCardFormatPlugin2::VCardFormatPlugin2()
{
}
VCardFormatPlugin2::~VCardFormatPlugin2()
{
}
bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin2::load");
QString data;
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
data = t.read();
VCardTool tool;
Addressee::List l = tool.parseVCards( data );
if ( ! l.first().isEmpty() ) {
addressee = l.first();
return true;
}
return false;
}
bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
qDebug("VCardFormatPlugin2::loadAll");
QString data;
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
data = t.read();
VCardTool tool;
Addressee::List l = tool.parseVCards( data );
Addressee::List::Iterator itr;
for ( itr = l.begin(); itr != l.end(); ++itr) {
Addressee addressee = *itr;
addressee.setResource( resource );
addressBook->insertAddressee( addressee );
}
return true;
}
void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin2::save");
VCardTool tool;
Addressee::List vcardlist;
vcardlist.append( addressee );
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t << tool.createVCards( vcardlist );
}
void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file )
{
qDebug("VCardFormatPlugin2::saveAll");
VCardTool tool;
Addressee::List vcardlist;
AddressBook::Iterator it;
for ( it = ab->begin(); it != ab->end(); ++it ) {
if ( (*it).resource() == resource ) {
(*it).setChanged( false );
vcardlist.append( *it );
}
}
- QTextStream t( file );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( file );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t << tool.createVCards( vcardlist );
}
bool VCardFormatPlugin2::checkFormat( QFile *file ) const
{
QString line;
- file->readLine( line, 1024 );
+ char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp;
line = line.stripWhiteSpace();
if ( line == "BEGIN:VCARD" )
return true;
else
return false;
}
diff --git a/kabc/kabc.pro b/kabc/kabc.pro
index 17ebff8..846ed8a 100644
--- a/kabc/kabc.pro
+++ b/kabc/kabc.pro
@@ -1,44 +1,44 @@
TEMPLATE = lib
CONFIG += qt warn_on
#release debug
DESTDIR=../bin
-TARGET = microkabc
+TARGET = xmicrokabc
include( ../variables.pri )
INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui ..
-#LIBS += -lmicrokde -lldap
+#LIBS += -lxmicrokde -lldap
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
resource.h \
stdaddressbook.h \
agent.h \
geo.h \
key.h \
field.h \
plugin.h \
address.h \
addresseelist.h \
addresseeview.h \
formatfactory.h \
formatplugin.h \
phonenumber.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
@@ -187,32 +187,36 @@ vcard/Enum.cpp \
vcard/GeoValue.cpp \
vcard/ImageParam.cpp \
vcard/ImageValue.cpp \
vcard/LangValue.cpp \
vcard/NValue.cpp \
vcard/Param.cpp \
vcard/PhoneNumberValue.cpp \
vcard/RToken.cpp \
vcard/SourceParam.cpp \
vcard/TelParam.cpp \
vcard/TextParam.cpp \
vcard/TextValue.cpp \
vcard/TextBinParam.cpp \
vcard/URIValue.cpp \
vcard/VCardv.cpp \
vcard/VCardEntity.cpp \
vcard/Value.cpp \
vcard/SoundValue.cpp \
vcard/AgentValue.cpp \
vcard/TelValue.cpp \
vcard/TextBinValue.cpp \
vcard/OrgValue.cpp \
vcard/UTCValue.cpp \
vcard/ClassValue.cpp \
vcard/FloatValue.cpp \
vcard/TextListValue.cpp
# plugins/ldap/resourceldap.cpp \
# plugins/ldap/resourceldapconfig.cpp \
#formats/binary/binaryformat.cpp \
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+QT +=
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro
index 1d28a4d..6045b68 100644
--- a/kabc/kabcE.pro
+++ b/kabc/kabcE.pro
@@ -1,43 +1,43 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc
+TARGET = xmicrokabc
INCLUDEPATH += . $(KDEPIMDIR) vcard/include vcard/include/generated $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde
-LIBS += -lmicrokdepim
+LIBS += -lxmicrokde
+LIBS += -lxmicrokdepim
#LIBS += -lldap
LIBS += -L$(QPEDIR)/lib
DEFINES += KAB_EMBEDDED
#enable the following line if you want to get debugoutput while loading adresses
#DEFINES += VCARD_DEBUG
INTERFACES = \
HEADERS = \
address.h \
addressbook.h \
addressee.h \
addresseedialog.h \
addresseelist.h \
addresseeview.h \
agent.h \
distributionlist.h \
distributionlistdialog.h \
distributionlisteditor.h \
field.h \
formatfactory.h \
formatplugin.h \
geo.h \
key.h \
phonenumber.h \
picture.h \
plugin.h \
resource.h \
secrecy.h \
sound.h \
stdaddressbook.h \
@@ -165,32 +165,34 @@ vcard/EmailParam.cpp \
vcard/Entity.cpp \
vcard/Enum.cpp \
vcard/GeoValue.cpp \
vcard/ImageParam.cpp \
vcard/ImageValue.cpp \
vcard/LangValue.cpp \
vcard/NValue.cpp \
vcard/Param.cpp \
vcard/PhoneNumberValue.cpp \
vcard/RToken.cpp \
vcard/SourceParam.cpp \
vcard/TelParam.cpp \
vcard/TextParam.cpp \
vcard/TextValue.cpp \
vcard/TextBinParam.cpp \
vcard/URIValue.cpp \
vcard/VCardv.cpp \
vcard/VCardEntity.cpp \
vcard/Value.cpp \
vcard/SoundValue.cpp \
vcard/AgentValue.cpp \
vcard/TelValue.cpp \
vcard/TextBinValue.cpp \
vcard/OrgValue.cpp \
vcard/UTCValue.cpp \
vcard/ClassValue.cpp \
vcard/FloatValue.cpp \
vcard/TextListValue.cpp
# plugins/ldap/resourceldap.cpp \
# plugins/ldap/resourceldapconfig.cpp \
+#The following line was inserted by qt3to4
+QT += qt3support
diff --git a/kabc/key.h b/kabc/key.h
index 6ea5b47..313eb7d 100644
--- a/kabc/key.h
+++ b/kabc/key.h
@@ -1,77 +1,77 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_KEY_H
#define KABC_KEY_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
namespace KABC {
/**
* @short A class to store an encryption key.
*/
class Key
{
friend QDataStream &operator<<( QDataStream &, const Key & );
friend QDataStream &operator>>( QDataStream &, Key & );
public:
- typedef QValueList<Key> List;
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<Key> List;
+ typedef Q3ValueList<int> TypeList;
/**
* Key types
*
* @li X509 - X509 key
* @li PGP - Pretty Good Privacy key
* @li Custom - Custom or IANA conform key
*/
enum Types {
X509,
PGP,
Custom
};
/**
* Constructor.
*
* @param text The text data.
* @param type The key type, @see Types.
*/
Key( const QString &text = QString::null, int type = PGP );
/**
* Destructor.
*/
~Key();
bool operator==( const Key & ) const;
bool operator!=( const Key & ) const;
/**
* Sets the unique identifier.
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h
index feeba6c..6bc89d3 100644
--- a/kabc/phonenumber.h
+++ b/kabc/phonenumber.h
@@ -1,82 +1,82 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_PHONENUMBER_H
#define KABC_PHONENUMBER_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qstring.h>
namespace KABC {
/**
@short Phonenumber information.
This class provides phone number information. A phone number is classified by
a type. The following types are available, it's possible to use multiple types
@ref Types for a number by combining them through a logical or.
*/
class PhoneNumber
{
friend QDataStream &operator<<( QDataStream &, const PhoneNumber & );
friend QDataStream &operator>>( QDataStream &, PhoneNumber & );
public:
- typedef QValueList<PhoneNumber> List;
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<PhoneNumber> List;
+ typedef Q3ValueList<int> TypeList;
/**
@li @p Home - Home number
@li @p Work - Office number
@li @p Msg - Messaging
@li @p Pref - Preferred number
@li @p Voice - Voice
@li @p Fax - Fax machine
@li @p Cell - Cell phone
@li @p Video - Video phone
@li @p Bbs - Mailbox
@li @p Modem - Modem
@li @p Car - Car phone
@li @p Isdn - ISDN connection
@li @p Pcs - Personal Communication Service
@li @p Pager - Pager
*/
enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32,
Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024,
Isdn = 2048, Pcs = 4096, Pager = 8192 };
/**
Create an empty phone number object.
*/
PhoneNumber();
/**
Create a phonenumber object.
@param number Number
@param type Type as defined in enum. Multiple types can be
specified by combining them by a logical or.
diff --git a/kabc/picture.cpp b/kabc/picture.cpp
index 57aa297..0c59937 100644
--- a/kabc/picture.cpp
+++ b/kabc/picture.cpp
@@ -1,60 +1,62 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include "picture.h"
+//Added by qt3to4:
+#include <QPixmap>
using namespace KABC;
Picture::Picture()
: mIntern( false )
{
mUndefined = true;
}
Picture::Picture( const QString &url )
: mUrl( url ), mIntern( false )
{
mUndefined = false;
}
Picture::Picture( const QImage &data )
: mData( data ), mIntern( true )
{
mUndefined = false;
}
Picture::~Picture()
{
}
bool Picture::operator==( const Picture &p ) const
{
//qDebug("compare PIC ");
if ( mUndefined && p.mUndefined ) {
//qDebug("compare PIC true 1 ");
return true;
}
diff --git a/kabc/picture.h b/kabc/picture.h
index 714d1e2..1b63610 100644
--- a/kabc/picture.h
+++ b/kabc/picture.h
@@ -1,63 +1,65 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_PICTURE_H
#define KABC_PICTURE_H
#include <qimage.h>
+//Added by qt3to4:
+#include <QPixmap>
namespace KABC {
class Picture
{
friend QDataStream &operator<<( QDataStream &, const Picture & );
friend QDataStream &operator>>( QDataStream &, Picture & );
public:
/**
* Consturctor. Creates an empty object.
*/
Picture();
/**
* Consturctor.
*
* @param url A URL that describes the position of the picture file.
*/
Picture( const QString &url );
/**
* Consturctor.
*
* @param data The raw data of the picture.
*/
Picture( const QImage &data );
/**
* Destructor.
*/
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro
index 3e18594..9b3b894 100644
--- a/kabc/plugins/dir/dir.pro
+++ b/kabc/plugins/dir/dir.pro
@@ -1,36 +1,40 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
include( ../../../variables.pri )
-TARGET = microkabc_dir
+TARGET = xmicrokabc_dir
INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat
DESTDIR = ../../../bin
-#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -lxmicrokde -lxmicrokabc
#LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcedir.h \
resourcedirconfig.h
SOURCES = \
resourcedir.cpp \
resourcedirconfig.cpp
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
CONFIG += dll
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
-LIBS += ../../../bin/microkdepim.lib
-LIBS += ../../../bin/microkcal.lib
-LIBS += ../../../bin/microkde.lib
+LIBS += ../../../bin/xmicrokdepim.lib
+LIBS += ../../../bin/xmicrokcal.lib
+LIBS += ../../../bin/xmicrokde.lib
LIBS += ../../../bin/microkabc.lib
}
+#The following line was inserted by qt3to4
+QT += qt3support
+#The following line was inserted by qt3to4
+QT += xml
diff --git a/kabc/plugins/dir/dirE.pro b/kabc/plugins/dir/dirE.pro
index cda4e2f..75332a0 100644
--- a/kabc/plugins/dir/dirE.pro
+++ b/kabc/plugins/dir/dirE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
-TARGET = microkabc_dir
+TARGET = xmicrokabc_dir
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcedir.h \
resourcedirconfig.h
SOURCES = \
resourcedir.cpp \
resourcedirconfig.cpp
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp
index c61664b..cc4afee 100644
--- a/kabc/plugins/dir/resourcedir.cpp
+++ b/kabc/plugins/dir/resourcedir.cpp
@@ -141,162 +141,162 @@ void ResourceDir::writeConfig( KConfig *config )
config->writeEntry( "FilePath", mPath );
config->writeEntry( "FileFormat", mFormatName );
}
Ticket *ResourceDir::requestSaveTicket()
{
if ( !addressBook() ) return 0;
#ifdef ALLOW_LOCKING
if ( !lock( mPath ) ) {
return 0;
}
#endif
return createTicket( this );
}
bool ResourceDir::doOpen()
{
QDir dir( mPath );
if ( !dir.exists() ) { // no directory available
return dir.mkdir( dir.path() );
} else {
QString testName = dir.entryList( QDir::Files )[0];
if ( testName.isNull() || testName.isEmpty() ) // no file in directory
return true;
QFile file( mPath + "/" + testName );
- if ( file.open( IO_ReadOnly ) )
+ if ( file.open( QIODevice::ReadOnly ) )
return true;
if ( file.size() == 0 )
return true;
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceDir::doClose()
{
}
bool ResourceDir::load()
{
QDir dir( mPath );
QStringList files = dir.entryList( QDir::Files );
QStringList::Iterator it;
bool ok = true;
for ( it = files.begin(); it != files.end(); ++it ) {
QFile file( mPath + "/" + (*it) );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) );
ok = false;
continue;
}
if ( !mFormat->loadAll( addressBook(), this, &file ) )
ok = false;
file.close();
}
return ok;
}
bool ResourceDir::save( Ticket *ticket )
{
AddressBook::Iterator it;
bool ok = true;
#ifndef NO_DIRWATCH
mDirWatch.stopScan();
#endif
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
if ( (*it).resource() != this || !(*it).changed() )
continue;
QFile file( mPath + "/" + (*it).uid() );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::WriteOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) );
continue;
}
mFormat->save( *it, &file );
// mark as unchanged
(*it).setChanged( false );
file.close();
}
#ifndef NO_DIRWATCH
mDirWatch.startScan();
#endif
delete ticket;
#ifdef ALLOW_LOCKING
unlock( mPath );
#endif
return ok;
}
bool ResourceDir::lock( const QString &path )
{
#ifdef ALLOW_LOCKING
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if ( QFile::exists( lockName ) ) return false;
QString lockUniqueName;
lockUniqueName = p + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
// Create unique file
QFile file( mLockUniqueName );
- file.open( IO_WriteOnly );
+ file.open( QIODevice::WriteOnly );
file.close();
// Create lock file
int result = 0;
#ifndef _WIN32_
result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
#else
return true;
#endif
}
void ResourceDir::unlock( const QString &path )
{
#ifdef ALLOW_LOCKING
QString p = path;
//US change the implementation how the lockfilename is getting created
//US p.replace( QRegExp( "/" ), "_" );
//US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" );
KURL url(p);
QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" );
::unlink( QFile::encodeName( lockName ) );
diff --git a/kabc/plugins/dir/resourcedirconfig.cpp b/kabc/plugins/dir/resourcedirconfig.cpp
index 98d18fe..8fa48d0 100644
--- a/kabc/plugins/dir/resourcedirconfig.cpp
+++ b/kabc/plugins/dir/resourcedirconfig.cpp
@@ -1,79 +1,81 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlabel.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kdialog.h>
//US #include "formatfactory.h"
#include "resourcedir.h"
#include "stdaddressbook.h"
#include "resourcedirconfig.h"
using namespace KABC;
ResourceDirConfig::ResourceDirConfig( QWidget* parent, const char* name )
: KRES::ConfigWidget( parent, name )
{
- QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0,
+ Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0,
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Format:" ), this );
mFormatBox = new KComboBox( this );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFormatBox, 0, 1 );
label = new QLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
//US mFileNameEdit->setMode( KFile::Directory );
mainLayout->addWidget( label, 1, 0 );
mainLayout->addWidget( mFileNameEdit, 1, 1 );
/*US lets hardcode the formats instead of using a factory
FormatFactory *factory = FormatFactory::self();
QStringList formats = factory->formats();
QStringList::Iterator it;
for ( it = formats.begin(); it != formats.end(); ++it ) {
FormatInfo *info = factory->info( *it );
if ( info ) {
mFormatTypes << (*it);
mFormatBox->insertItem( info->nameLabel );
}
}
*/
mFormatTypes << "vcard";
mFormatTypes << "binary";
mFormatBox->insertItem( "vcard" );
mFormatBox->insertItem( "binary" );
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro
index 2d17313..e4f1270 100644
--- a/kabc/plugins/file/file.pro
+++ b/kabc/plugins/file/file.pro
@@ -1,37 +1,41 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
include( ../../../variables.pri )
-TARGET = microkabc_file
+TARGET = xmicrokabc_file
INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat
DESTDIR = ../../../bin
-#LIBS += -lmicrokde -lmicrokabc
+#LIBS += -lxmicrokde -lxmicrokabc
#LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcefile.h \
resourcefileconfig.h
SOURCES = \
resourcefile.cpp \
resourcefileconfig.cpp
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
CONFIG += dll
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
-LIBS += ../../../bin/microkdepim.lib
-LIBS += ../../../bin/microkcal.lib
-LIBS += ../../../bin/microkde.lib
+LIBS += ../../../bin/xmicrokdepim.lib
+LIBS += ../../../bin/xmicrokcal.lib
+LIBS += ../../../bin/xmicrokde.lib
LIBS += ../../../bin/microkabc.lib
}
+#The following line was inserted by qt3to4
+QT += qt3support
+#The following line was inserted by qt3to4
+QT += xml
diff --git a/kabc/plugins/file/fileE.pro b/kabc/plugins/file/fileE.pro
index 16707e5..5044cd9 100644
--- a/kabc/plugins/file/fileE.pro
+++ b/kabc/plugins/file/fileE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
-TARGET = microkabc_file
+TARGET = xmicrokabc_file
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourcefile.h \
resourcefileconfig.h
SOURCES = \
resourcefile.cpp \
resourcefileconfig.cpp
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp
index dad4571..3ed850c 100644
--- a/kabc/plugins/file/resourcefile.cpp
+++ b/kabc/plugins/file/resourcefile.cpp
@@ -172,94 +172,94 @@ void ResourceFile::writeConfig( KConfig *config )
Resource::writeConfig( config );
config->writeEntry( "FileName", fileName() );
config->writeEntry( "FileFormat", mFormatName );
// qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1());
}
Ticket *ResourceFile::requestSaveTicket()
{
kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl;
if ( !addressBook() ) return 0;
#ifdef ALLOW_LOCKING
if ( !lock( mFileName ) ) {
qDebug("unablt to lock file ");
return 0;
}
#endif
return createTicket( this );
}
bool ResourceFile::doOpen()
{
QFile file( fileName() );
qDebug("ResourceFile::openfile %s ", fileName().latin1());
if ( !file.exists() ) {
// try to create the file
- bool ok = file.open( IO_WriteOnly );
+ bool ok = file.open( QIODevice::WriteOnly );
if ( ok )
file.close();
return ok;
} else {
- if ( !file.open( IO_ReadWrite ) )
+ if ( !file.open( QIODevice::ReadWrite ) )
return false;
if ( file.size() < 10 ) {
file.close();
return true;
}
bool ok = mFormat->checkFormat( &file );
file.close();
return ok;
}
}
void ResourceFile::doClose()
{
}
bool ResourceFile::load()
{
QFile file( fileName() );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) );
return false;
}
// qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1());
return mFormat->loadAll( addressBook(), this, &file );
}
bool ResourceFile::save( Ticket *ticket )
{
// qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1());
// create backup file
QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() );
/*US we use a simpler method to create a backupfile
(void) KSaveFile::backupFile( mFileName, QString::null
,extension );
KSaveFile saveFile( mFileName );
bool ok = false;
if ( saveFile.status() == 0 && saveFile.file() )
{
mFormat->saveAll( addressBook(), this, saveFile.file() );
ok = saveFile.close();
}
*/
//US ToDo: write backupfile
@@ -282,117 +282,117 @@ bool ResourceFile::save( Ticket *ticket )
qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate );
if ( stdDir )
bupDir = KGlobalSettings::backupDataDir();
int retval = KApplication::createBackup( fileName(), bupDir, num );
if ( retval == 0 ) {
qDebug("KO: Backup cancelled. Will try again tomorrow ");
// retval == 0 : backup skipped for today, try again tomorrow
mLastBackupDate = daysTo - d_count+1;
saveDate = true;
} else if ( retval == 1 ){
qDebug("KO: Backup created.");
// backup ok
mLastBackupDate = daysTo;
saveDate = true;
} else if ( retval == 2 ){
qDebug("KO: Backup globally cancelled.");
// backup globally cancelled
b_enabled = false;
}
if ( !b_enabled ) {
conf.writeEntry( "mBackupEnabled", false );
}
if ( saveDate ) {
KConfig config ( locateLocal("config","kabcrc") );
config.setGroup( "Resource_" + identifier() );
config.writeEntry( "LastBackupDate", mLastBackupDate );
}
}
}
}
QFile info;
info.setName( fileName() );
- bool ok = info.open( IO_WriteOnly );
+ bool ok = info.open( QIODevice::WriteOnly );
if ( ok ) {
mFormat->saveAll( addressBook(), this, &info );
info.close();
ok = true;
}
else {
}
if ( !ok )
addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) );
#ifndef NO_DIRWATCH
mDirWatch.startScan();
#endif
delete ticket;
#ifdef ALLOW_LOCKING
unlock( mFileName );
#endif
return ok;
}
bool ResourceFile::lock( const QString &fileName )
{
#ifdef ALLOW_LOCKING
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp("/"), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if (QFile::exists( lockName )) return false;
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
QFile file( mLockUniqueName );
- file.open( IO_WriteOnly );
+ file.open( QIODevice::WriteOnly );
file.close();
// Create lock file
int result = 0;
#ifndef _WIN32_
result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
#else
return true;
#endif
}
void ResourceFile::unlock( const QString &fileName )
{
#ifdef ALLOW_LOCKING
QString fn = fileName;
//US change the implementation how the lockfilename is getting created
//US fn.replace( QRegExp( "/" ), "_" );
//US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" );
//US QString lockName = fn + ".lock";
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
diff --git a/kabc/plugins/file/resourcefileconfig.cpp b/kabc/plugins/file/resourcefileconfig.cpp
index b63775d..70b0bac 100644
--- a/kabc/plugins/file/resourcefileconfig.cpp
+++ b/kabc/plugins/file/resourcefileconfig.cpp
@@ -1,85 +1,87 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlabel.h>
#include <qlayout.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kdialog.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
//US #include "formatfactory.h"
#include <qfile.h>
#include "resourcefile.h"
#include "stdaddressbook.h"
#include "resourcefileconfig.h"
using namespace KABC;
ResourceFileConfig::ResourceFileConfig( QWidget* parent, const char* name )
: ConfigWidget( parent, name )
{
//qDebug("ResourceFileConfig::ResourceFileConfig");
- QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0,
+ Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0,
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Format:" ), this );
mFormatBox = new KComboBox( this );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFormatBox, 0, 1 );
label = new QLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
SLOT( checkFilePermissions( const QString & ) ) );
mainLayout->addWidget( label, 1, 0 );
mainLayout->addWidget( mFileNameEdit, 1, 1 );
/*US lets hardcode the formats instead of using a factory
FormatFactory *factory = FormatFactory::self();
QStringList formats = factory->formats();
QStringList::Iterator it;
for ( it = formats.begin(); it != formats.end(); ++it ) {
FormatInfo *info = factory->info( *it );
if ( info ) {
mFormatTypes << (*it);
mFormatBox->insertItem( info->nameLabel );
}
}
*/
mFormatTypes << "vcard";
diff --git a/kabc/plugins/ldap/ldapE.pro b/kabc/plugins/ldap/ldapE.pro
index 57b6f84..c56d24d 100644
--- a/kabc/plugins/ldap/ldapE.pro
+++ b/kabc/plugins/ldap/ldapE.pro
@@ -1,21 +1,21 @@
TEMPLATE = lib
CONFIG += qt warn_on release
#release debug
-TARGET = microkabc_ldap
+TARGET = xmicrokabc_ldap
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde -lmicrokabc
+LIBS += -lxmicrokde -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
resourceldap.h \
resourceldapconfig.h
SOURCES = \
resourceldap.cpp \
resourceldapconfig.cpp
diff --git a/kabc/plugins/olaccess/olaccess.pro b/kabc/plugins/olaccess/olaccess.pro
index 9b95015..ad7e1ef 100644
--- a/kabc/plugins/olaccess/olaccess.pro
+++ b/kabc/plugins/olaccess/olaccess.pro
@@ -1,35 +1,35 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc_olaccess
+TARGET = xmicrokabc_olaccess
include( ../../../variables.pri )
INCLUDEPATH += ../../.. ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat
INTERFACES = \
DESTDIR = ../../../bin
HEADERS = \
resourceolaccess.h \
resourceolaccessconfig.h \
olaccessconverter.h
SOURCES = \
resourceolaccess.cpp \
resourceolaccessconfig.cpp \
olaccessconverter.cpp
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
CONFIG += dll
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
-LIBS += ../../../bin/microkdepim.lib
-LIBS += ../../../bin/microkcal.lib
-LIBS += ../../../bin/microkde.lib
+LIBS += ../../../bin/xmicrokdepim.lib
+LIBS += ../../../bin/xmicrokcal.lib
+LIBS += ../../../bin/xmicrokde.lib
LIBS += ../../../bin/microkabc.lib
}
diff --git a/kabc/plugins/opie/opieE.pro b/kabc/plugins/opie/opieE.pro
index b7ecbc0..aa6b8ea 100644
--- a/kabc/plugins/opie/opieE.pro
+++ b/kabc/plugins/opie/opieE.pro
@@ -1,31 +1,31 @@
TEMPLATE = lib
CONFIG += qt warn_on
#release debug
-TARGET = microkabc_opie
+TARGET = xmicrokabc_opie
INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include $(OPIEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde
-LIBS += -lmicrokabc
+LIBS += -lxmicrokde
+LIBS += -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
LIBS += -L$(OPIEDIR)/lib
LIBS += -lopie
LIBS += -lqpe
LIBS += -lqte
INTERFACES = \
HEADERS = \
resourceopie.h \
resourceopieconfig.h \
opieconverter.h \
SOURCES = \
resourceopie.cpp \
resourceopieconfig.cpp \
opieconverter.cpp \
diff --git a/kabc/plugins/qtopia/qtopia.pro b/kabc/plugins/qtopia/qtopia.pro
index 64d1abc..d91a2e3 100644
--- a/kabc/plugins/qtopia/qtopia.pro
+++ b/kabc/plugins/qtopia/qtopia.pro
@@ -1,43 +1,47 @@
TEMPLATE = lib
CONFIG += qt warn_on release
include( ../../../variables.pri )
-TARGET = microkabc_qtopia
+TARGET = xmicrokabc_qtopia
INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources
DESTDIR = ../../../bin
-#LIBS += -lmicrokde
-#LIBS += -lkamicrokabc
+#LIBS += -lxmicrokde
+#LIBS += -lxkamicrokabc
DEFINES += KAB_EMBEDDED DESKTOP_VERSION
INTERFACES = \
HEADERS = \
resourceqtopia.h \
resourceqtopiaconfig.h \
qtopiaconverter.h
SOURCES = \
resourceqtopia.cpp \
resourceqtopiaconfig.cpp \
qtopiaconverter.cpp
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
CONFIG += dll
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
-LIBS += ../../../bin/microkdepim.lib
-LIBS += ../../../bin/microkcal.lib
-LIBS += ../../../bin/microkde.lib
+LIBS += ../../../bin/xmicrokdepim.lib
+LIBS += ../../../bin/xmicrokcal.lib
+LIBS += ../../../bin/xmicrokde.lib
LIBS += ../../../bin/microkabc.lib
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+QT +=
diff --git a/kabc/plugins/qtopia/qtopiaE.pro b/kabc/plugins/qtopia/qtopiaE.pro
index 700057b..4b174b2 100644
--- a/kabc/plugins/qtopia/qtopiaE.pro
+++ b/kabc/plugins/qtopia/qtopiaE.pro
@@ -1,26 +1,26 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc_qtopia
+TARGET = xmicrokabc_qtopia
INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde
-LIBS += -lmicrokabc
+LIBS += -lxmicrokde
+LIBS += -lxmicrokabc
LIBS += -L$(QPEDIR)/lib
LIBS += -lqpe
INTERFACES = \
HEADERS = \
resourceqtopia.h \
resourceqtopiaconfig.h \
qtopiaconverter.h
SOURCES = \
resourceqtopia.cpp \
resourceqtopiaconfig.cpp \
qtopiaconverter.cpp
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp
index 9693a68..9b3903b 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.cpp
+++ b/kabc/plugins/qtopia/qtopiaconverter.cpp
@@ -5,103 +5,105 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
//US
#include "kglobal.h"
#include "klocale.h"
#include "qtopiaconverter.h"
#include <qfile.h>
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//#include <.h>
#include <libkdepim/ksyncprofile.h>
using namespace KABC;
QtopiaConverter::QtopiaConverter()
{
m_edit = 0;
}
QtopiaConverter::~QtopiaConverter()
{
deinit();
}
bool QtopiaConverter::init()
{
QString fn = QDir::homeDirPath() +"/Settings/Categories.xml";
m_edit = new CategoryEdit( fn);
return true;
}
void QtopiaConverter::deinit()
{
if (m_edit)
{
delete m_edit;
m_edit = 0;
}
}
QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app )
{
startover:
QStringList dummy;
- QValueList<OpieCategories>::ConstIterator catIt;
- QValueList<OpieCategories> categories = m_edit->categories();
+ Q3ValueList<OpieCategories>::ConstIterator catIt;
+ Q3ValueList<OpieCategories> categories = m_edit->categories();
bool found = false;
for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) {
/* skip empty category name */
if ( (*listIt).isEmpty() ) continue;
found = false;
for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
/*
* We currently do not take app into account
* if name matches and the id isn't already in dummy we'll add it
*/
if ( (*catIt).name() == (*listIt) && !dummy.contains(( *catIt).id() ) ) { // the same name
found= true;
dummy << (*catIt).id();
}
}
/* if not found and the category is not empty
*
* generate a new category and start over again
* ugly goto to reiterate
*/
if ( !found && !(*listIt).isEmpty() ){
m_edit->addCategory( app, (*listIt) ); // generate a new category
goto startover;
}
}
return dummy.join(";");
}
@@ -163,65 +165,65 @@ QDate QtopiaConverter::dateFromString( const QString& s )
return date;
}
QString QtopiaConverter::dateToString( const QDate &d )
{
if ( d.isNull() || !d.isValid() )
return QString::null;
// ISO format in year, month, day (YYYYMMDD); e.g. 20021231
QString year = QString::number( d.year() );
QString month = QString::number( d.month() );
month = month.rightJustify( 2, '0' );
QString day = QString::number( d.day() );
day = day.rightJustify( 2, '0' );
QString str = year + month + day;
return str;
}
bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
{
{ //LR
adr.setUid( el.attribute("Uid" ) );
adr.setFamilyName( el.attribute( "LastName" ) );
adr.setGivenName( el.attribute( "FirstName" ) );
adr.setAdditionalName( el.attribute( "MiddleName" ) );
adr.setSuffix( el.attribute( "Suffix" ) );
adr.setNickName( el.attribute( "Nickname" ) );
QDate date = dateFromString( el.attribute( "Birthday" ) );
if ( date.isValid() )
- adr.setBirthday( date );
+ adr.setBirthday( (QDateTime)date );
adr.setRole( el.attribute( "JobTitle" ) );
if ( !el.attribute( "FileAs" ).isEmpty() )
adr.setFormattedName( el.attribute( "FileAs" ) );
adr.setOrganization( el.attribute( "Company" ) );
KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ),
KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
KABC::PhoneNumber businessFaxNum( el.attribute( "BusinessFax" ),
KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
KABC::PhoneNumber businessMobile( el.attribute( "BusinessMobile" ),
KABC::PhoneNumber::Car );
KABC::PhoneNumber businessPager( el.attribute( "BusinessPager" ),
KABC::PhoneNumber::Pager );
if ( !businessPhoneNum.number().isEmpty() )
adr.insertPhoneNumber( businessPhoneNum );
if ( !businessFaxNum.number().isEmpty() )
adr.insertPhoneNumber( businessFaxNum );
if ( !businessMobile.number().isEmpty() )
adr.insertPhoneNumber( businessMobile );
if ( !businessPager.number().isEmpty() )
adr.insertPhoneNumber( businessPager );
// Handle multiple mail addresses
QString DefaultEmail = el.attribute( "DefaultEmail" );
if ( !DefaultEmail.isEmpty() )
adr.insertEmail( DefaultEmail, true ); // preferred
QStringList Emails = QStringList::split(" ",el.attribute("Emails"));
int i;
for (i = 0;i < Emails.count();++i) {
@@ -288,65 +290,65 @@ bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr )
if ( !el.attribute( "HomeWebPage" ).isEmpty() )
adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) );
if ( !el.attribute( "Spouse" ).isEmpty() )
adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) );
if ( !el.attribute( "Gender" ).isEmpty() ) {
if ( el.attribute( "Gender" ) == "1" )
adr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
else if ( el.attribute( "Gender" ) == "2" )
adr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
}
QDate ann = dateFromString( el.attribute( "Anniversary" ) );
if ( ann.isValid() ) {
QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate);
adr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt );
}
if ( !el.attribute( "Children" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Children", el.attribute("Children") );
if ( !el.attribute( "Office" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") );
if ( !el.attribute( "Profession" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-Profession", el.attribute("Profession") );
if ( !el.attribute( "Assistant" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-AssistantsName", el.attribute("Assistant") );
if ( !el.attribute( "Manager" ).isEmpty() )
adr.insertCustom("KADDRESSBOOK", "X-ManagersName", el.attribute("Manager") );
}
return true;
}
-bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *stream )
+bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, Q3TextStream *stream )
{
*stream << "<Contact ";
*stream << "FirstName=\"" << escape(ab.givenName()) << "\" ";
*stream << "MiddleName=\"" << escape(ab.additionalName()) << "\" ";
*stream << "LastName=\"" << escape(ab.familyName()) << "\" ";
*stream << "Suffix=\"" << escape(ab.suffix()) << "\" ";
QString sortStr;
sortStr = ab.formattedName();
/* is formattedName is empty we use the assembled name as fallback */
if (sortStr.isEmpty() )
sortStr = ab.assembledName();
*stream << "FileAs=\"" << escape(sortStr) << "\" ";
*stream << "JobTitle=\"" << escape(ab.role()) << "\" ";
*stream << "Department=\"" << escape(ab.custom( "KADDRESSBOOK", "X-Department" )) << "\" ";
*stream << "Company=\"" << escape(ab.organization()) << "\" ";
KABC::PhoneNumber businessPhoneNum = ab.phoneNumber(KABC::PhoneNumber::Work );
*stream << "BusinessPhone=\"" << escape( businessPhoneNum.number() ) << "\" ";
KABC::PhoneNumber businessFaxNum = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
*stream << "BusinessFax=\"" << escape( businessFaxNum.number() )<< "\" ";
KABC::PhoneNumber businessMobile = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Cell );
*stream << "BusinessMobile=\"" << escape( businessMobile.number() ) << "\" ";
*stream << "DefaultEmail=\"" << escape( ab.preferredEmail() ) << "\" ";
QStringList list = ab.emails();
if ( list.count() > 0 ) {
QStringList::Iterator it = list.begin();
*stream << "Emails=\"" << escape( *it );
@@ -455,168 +457,168 @@ QStringList AddressBook::attributes()const {
lst << "HomeState";
lst << "HomeZip";
lst << "HomeCountry";
lst << "HomeWebPage";
lst << "Spouse";
lst << "Gender";
lst << "Anniversary";
lst << "Nickname";
lst << "Children";
lst << "Notes";
lst << "Categories";
lst << "Uid";
lst << "Birthday";
return lst;
}
#endif
CategoryEdit::CategoryEdit(){
}
CategoryEdit::CategoryEdit(const QString &fileName){
parse( fileName );
}
CategoryEdit::~CategoryEdit(){
}
void CategoryEdit::save(const QString& fileName)const{
QFile file( fileName );
QString endl = "\n";
- if ( file.open( IO_WriteOnly ) ) {
- QTextStream stream( &file );
- stream.setEncoding( QTextStream::UnicodeUTF8 );
+ if ( file.open( QIODevice::WriteOnly ) ) {
+ Q3TextStream stream( &file );
+ stream.setEncoding( Q3TextStream::UnicodeUTF8 );
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
stream << "<!DOCTYPE CategoryList>" << endl;
stream << "<Categories>" << endl;
- for ( QValueList<OpieCategories>::ConstIterator it = m_categories.begin();
+ for ( Q3ValueList<OpieCategories>::ConstIterator it = m_categories.begin();
it != m_categories.end(); ++it )
{
stream << "<Category id=\""<< ( (*it).id() ) << "\" ";
if ( !(*it).app().isEmpty() )
stream << " app=\""<< ( (*it).app() ) << "\" ";
stream << "name=\"" << ( (*it).name() ) << "\" ";
stream << " />" << endl;
}
stream << "</Categories>" << endl;
file.close();
}
}
int CategoryEdit::addCategory( const QString &name, int id ){
return addCategory( QString::null, name, id );
}
int CategoryEdit::addCategory( const QString &appName, const QString &name, int id ){
if ( id == 0 ) {
// code from tt
//generate uid
QDateTime dt = QDateTime::currentDateTime();
id = -1 * (int) dt.secsTo( QDateTime(QDate( 2000,1,1)) );
while ( ids.contains( id ) ){
id += -1;
if ( id > 0 )
id = -1;
}
}
ids.insert( id, TRUE );
OpieCategories categories(QString::number(id), name, appName);
//pending FIXME LR m_categories.remove( categories);
m_categories.append( categories);
return id;
}
/*
* we parse the simple Category File here
* We also keep track of global Cats
* and Of Organizer and Contact cats and then
* we will add them to the kde side...
*/
void CategoryEdit::parse( const QString &tempFile ){
clear();
QDomDocument doc( "mydocument" );
QFile f( tempFile );
- if ( !f.open( IO_ReadOnly ) )
+ if ( !f.open( QIODevice::ReadOnly ) )
return;
if ( !doc.setContent( &f ) ) {
f.close();
return;
}
f.close();
QStringList global, contact, organizer;
// print out the element names of all elements that are a direct child
// of the outermost element.
QDomElement docElem = doc.documentElement();
QDomNode n = docElem.firstChild();
if( docElem.nodeName() == QString::fromLatin1("Categories") ){
while( !n.isNull() ) {
QDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() ) { // the node was really an element.
QString id = e.attribute("id" );
QString app = e.attribute("app" );
QString name = e.attribute("name");
/*
* see where it belongs default to global
*/
if (app == QString::fromLatin1("Calendar") || app == QString::fromLatin1("Todo List") )
organizer.append( name );
else if ( app == QString::fromLatin1("Contacts") )
contact.append( name );
else
global.append( name );
OpieCategories category( id, name, app );
m_categories.append( category ); // cheater
}
n = n.nextSibling();
}
}
updateKDE( "kaddressbookrc", global + contact );
updateKDE( "korganizerrc", global + organizer );
}
void CategoryEdit::clear()
{
ids.clear();
m_categories.clear();
}
QString CategoryEdit::categoryById( const QString &id, const QString &app )const
{
- QValueList<OpieCategories>::ConstIterator it;
+ Q3ValueList<OpieCategories>::ConstIterator it;
QString category;
QString fallback;
for( it = m_categories.begin(); it != m_categories.end(); ++it ){
if( id.stripWhiteSpace() == (*it).id().stripWhiteSpace() ){
if( app == (*it).app() ){
category = (*it).name();
break;
}else{
fallback = (*it).name();
}
}
}
return category.isEmpty() ? fallback : category;
}
QStringList CategoryEdit::categoriesByIds( const QStringList& ids,
const QString& app) {
QStringList list;
QStringList::ConstIterator it;
QString temp;
for ( it = ids.begin(); it != ids.end(); ++it ) {
temp = categoryById( (*it), app );
if (!temp.isEmpty() )
list << temp;
}
return list;
}
void CategoryEdit::updateKDE( const QString& configFile, const QStringList& cats ) {
KConfig conf(configFile);
conf.setGroup("General");
QStringList avail = conf.readListEntry("Custom Categories");
diff --git a/kabc/plugins/qtopia/qtopiaconverter.h b/kabc/plugins/qtopia/qtopiaconverter.h
index 744dd41..389926c 100644
--- a/kabc/plugins/qtopia/qtopiaconverter.h
+++ b/kabc/plugins/qtopia/qtopiaconverter.h
@@ -1,133 +1,136 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_QTOPIACONVERTER_H
#define KABC_QTOPIACONVERTER_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3TextStream>
#include "addressee.h"
#ifdef DESKTOP_VERSION
#include <qdom.h>
#else
#include <xml/qdom.h>
#endif
class Categories;
namespace KABC {
class OpieCategories {
public:
//friend class KSync::OpieSocket;
friend bool operator== ( const OpieCategories &a, const OpieCategories &b );
OpieCategories();
OpieCategories(const QString &id, const QString &name, const QString &app );
OpieCategories(const OpieCategories & );
~OpieCategories() {};
OpieCategories &operator=(const OpieCategories & );
QString id()const;
QString name()const;
QString app()const;
private:
QString m_name;
QString m_app;
QString m_id;
};
class CategoryEdit {
public:
CategoryEdit();
CategoryEdit(const QString &fileName);
~CategoryEdit();
void save(const QString&) const;
int addCategory( const QString &name, int id = 0 );
int addCategory(const QString &appName, const QString &name, int id = 0);
void parse( const QString &fileName );
QString categoryById(const QString &id, const QString &app )const;
QStringList categoriesByIds( const QStringList& ids, const QString& app );
void clear();
- QValueList<OpieCategories> categories()const { return m_categories; };
+ Q3ValueList<OpieCategories> categories()const { return m_categories; };
private:
/**
* this function will be used internally to update the kde categories...
*/
void updateKDE( const QString& app, const QStringList& categories );
QMap<int, bool> ids; // from tt Qtopia::UidGen
- QValueList<OpieCategories> m_categories;
+ Q3ValueList<OpieCategories> m_categories;
};
class QtopiaConverter
{
public:
/**
* Constructor.
*/
QtopiaConverter();
/**
* Destructor.
*/
virtual ~QtopiaConverter();
bool init();
void deinit();
/**
* Converts a vcard string to an addressee.
*
* @param contact The qtopia contact.
* @param addr The addressee.
*/
bool qtopiaToAddressee( const QDomElement& el, Addressee &adr );
/**
* Converts an addressee to a vcard string.
*
* @param addr The addressee.
* @param contact The qtopia contact.
*/
- bool addresseeToQtopia( const Addressee &ab, QTextStream *stream );
+ bool addresseeToQtopia( const Addressee &ab, Q3TextStream *stream );
private:
QString categoriesToNumber( const QStringList &list, const QString &app );
QString escape( const QString& s){ return s;};
CategoryEdit *m_edit;
QDate fromString( const QString& );
QDate dateFromString( const QString& );
QString dateToString( const QDate& );
};
}
#endif
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp
index 79ddaea..a36eb8f 100644
--- a/kabc/plugins/qtopia/resourceqtopia.cpp
+++ b/kabc/plugins/qtopia/resourceqtopia.cpp
@@ -2,65 +2,65 @@
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qdir.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfileinfo.h>
#include <qregexp.h>
//US #include <qtimer.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
//US #include <ksavefile.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include "resourceqtopiaconfig.h"
#include "stdaddressbook.h"
#include "qtopiaconverter.h"
#include "resourceqtopia.h"
using namespace KABC;
extern "C"
#ifdef _WIN32_
__declspec(dllexport)
#else
{
#endif
void *init_microkabc_qtopia()
{
return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>();
}
@@ -127,169 +127,169 @@ bool ResourceQtopia::doOpen()
if (mConverter == 0)
{
mConverter = new QtopiaConverter();
bool res = mConverter->init();
if ( !res )
{
QString msg("Unable to initialize qtopia converter. Most likely a problem with the category file");
qDebug(msg);
return false;
}
}
return true;
}
void ResourceQtopia::doClose()
{
qDebug("ResourceQtopia::doClose: %s", fileName().latin1());
// it seems so, that deletion of access deletes backend as well
//delete backend;
return;
}
bool ResourceQtopia::load()
{
QFile file( fileName() );
- if ( !file.open(IO_ReadOnly ) ) {
+ if ( !file.open(QIODevice::ReadOnly ) ) {
return false;
}
QDomDocument doc("mydocument" );
if ( !doc.setContent( &file ) ) {
file.close();
return false;
}
bool res;
QDomElement docElem = doc.documentElement( );
QDomNode n = docElem.firstChild();
while ( !n.isNull() ) {
QDomElement e = n.toElement();
if ( !e.isNull() ) {
if ( e.tagName() == QString::fromLatin1( "Contacts" ) ) {
QDomNode no = e.firstChild();
while ( !no.isNull() ) {
QDomElement el = no.toElement();
if ( !el.isNull() ) {
KABC::Addressee addressee;
res = mConverter->qtopiaToAddressee( el, addressee );
if ( !addressee.isEmpty() && res )
{
addressee.setResource( this );
addressBook()->insertAddressee( addressee );
}
}
no = no.nextSibling();
}
}
}
n = n.nextSibling();
}
return true;
}
bool ResourceQtopia::save( Ticket *ticket )
{
#ifdef _USE_DIRWATCH_
mDirWatch.stopScan();
#endif
KABC::AddressBook::Iterator it;
bool res;
QFile file( fileName() );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
- QTextStream *stream = &ts;
- stream->setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream ts( &file );
+ Q3TextStream *stream = &ts;
+ stream->setEncoding( Q3TextStream::UnicodeUTF8 );
*stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl;
*stream << " <Groups>" << endl;
*stream << " </Groups>" << endl;
*stream << " <Contacts> " << endl;
// for all entries
KABC::Addressee ab;
for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
KABC::Addressee addressee = (*it);
res = mConverter->addresseeToQtopia( addressee, stream );
if (!res == true)
{
qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1());
}
}
*stream << "</Contacts>" << endl;
*stream << "</AddressBook>" << endl;
file.close();
#ifdef _USE_DIRWATCH_
mDirWatch.startScan();
#endif
delete ticket;
unlock( fileName() );
return true;
}
bool ResourceQtopia::lock( const QString &lockfileName )
{
//disabled
return true;
qDebug("ResourceQtopia::lock: %s", fileName().latin1());
QString fn = lockfileName;
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
if (QFile::exists( lockName ))
{
qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName().latin1());
return false;
}
QString lockUniqueName;
lockUniqueName = fn + KApplication::randomString( 8 );
url = lockUniqueName;
//US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName );
mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() );
kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl;
// Create unique file
QFile file( mLockUniqueName );
- file.open( IO_WriteOnly );
+ file.open( QIODevice::WriteOnly );
file.close();
// Create lock file
int result = 0;
#ifndef _WIN32_
result = ::link( QFile::encodeName( mLockUniqueName ),
QFile::encodeName( lockName ) );
#endif
if ( result == 0 ) {
addressBook()->emitAddressBookLocked();
return true;
}
// TODO: check stat
return false;
}
void ResourceQtopia::unlock( const QString &fileName )
{
//disabled
return;
qDebug("ResourceQtopia::unlock() %s", fileName.latin1());
QString fn = fileName;
KURL url(fn);
QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" );
QFile::remove( lockName );
QFile::remove( mLockUniqueName );
addressBook()->emitAddressBookUnlocked();
}
diff --git a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
index d5d6141..42fd428 100644
--- a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
+++ b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp
@@ -1,81 +1,83 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlabel.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kdialog.h>
//#include <unistd.h>
#include <qdir.h>
#include <qfile.h>
#include "resourceqtopia.h"
#include "resourceqtopiaconfig.h"
using namespace KABC;
ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name )
: ConfigWidget( parent, name )
{
- QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0,
+ Q3GridLayout *mainLayout = new Q3GridLayout( this, 1, 2, 0,
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Location:" ), this );
mFileNameEdit = new KURLRequester( this );
connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ),
SLOT( checkFilePermissions( const QString & ) ) );
mainLayout->addWidget( label, 0, 0 );
mainLayout->addWidget( mFileNameEdit, 0, 1 );
}
void ResourceQtopiaConfig::loadSettings( KRES::Resource *res )
{
//US ResourceFile *resource = dynamic_cast<ResourceFile*>( res );
ResourceQtopia *resource = (ResourceQtopia*)( res );
if ( !resource ) {
kdDebug(5700) << "ResourceQtopiaConfig::loadSettings(): cast failed" << endl;
return;
}
mFileNameEdit->setURL( resource->fileName() );
if ( mFileNameEdit->url().isEmpty() )
mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" );
//US Qtopia resources are ReadOnly by definition
emit setPersistentReadOnly( true );
//US we can not choose the filename for the qtopia backend => make it readonly.
mFileNameEdit->setEnabled( false );
diff --git a/kabc/plugins/sharpdtm/sharpdtmE.pro b/kabc/plugins/sharpdtm/sharpdtmE.pro
index 23b0b76..7fc8ba8 100644
--- a/kabc/plugins/sharpdtm/sharpdtmE.pro
+++ b/kabc/plugins/sharpdtm/sharpdtmE.pro
@@ -1,35 +1,35 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkabc_sharpdtm
+TARGET = xmicrokabc_sharpdtm
INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(SHARPDTMSDK)/include $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
-LIBS += -lmicrokde
-LIBS += -lmicrokabc
-LIBS += -lmicrokdepim
+LIBS += -lxmicrokde
+LIBS += -lxmicrokabc
+LIBS += -lxmicrokdepim
LIBS += -lmicroqtcompat
LIBS += -L$(QPEDIR)/lib
LIBS += -ljpeg
LIBS += -lqpe
LIBS += -lqte
LIBS += -lzdtm
LIBS += -lsl
INTERFACES = \
HEADERS = \
resourcesharpdtm.h \
resourcesharpdtmconfig.h \
sharpdtmconverter.h
SOURCES = \
resourcesharpdtm.cpp \
resourcesharpdtmconfig.cpp \
sharpdtmconverter.cpp
diff --git a/kabc/secrecy.h b/kabc/secrecy.h
index b2ff565..0fe956e 100644
--- a/kabc/secrecy.h
+++ b/kabc/secrecy.h
@@ -1,73 +1,73 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_SECRECY_H
#define KABC_SECRECY_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
namespace KABC {
class Secrecy
{
friend QDataStream &operator<<( QDataStream &, const Secrecy & );
friend QDataStream &operator>>( QDataStream &, Secrecy & );
public:
- typedef QValueList<int> TypeList;
+ typedef Q3ValueList<int> TypeList;
/**
* Secrecy types
*
* @li Public - for public access
* @li Private - only private access
* @li Confidential - access for confidential persons
*/
enum Types {
Public,
Private,
Confidential,
Invalid
};
/**
* Constructor.
*
* @param type The secrecy type, @see Types.
*/
Secrecy( int type = Public );
bool operator==( const Secrecy & ) const;
bool operator!=( const Secrecy & ) const;
/**
Returns if the Secrecy object has a valid value.
*/
bool isValid() const;
/**
* Sets the type, @see Types.
diff --git a/kabc/sound.h b/kabc/sound.h
index 0ec5ec8..9777054 100644
--- a/kabc/sound.h
+++ b/kabc/sound.h
@@ -1,63 +1,63 @@
/*
This file is part of libkabc.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_SOUND_H
#define KABC_SOUND_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <qstring.h>
namespace KABC {
class Sound
{
friend QDataStream &operator<<( QDataStream &, const Sound & );
friend QDataStream &operator>>( QDataStream &, Sound & );
public:
/**
* Consturctor. Creates an empty object.
*/
Sound();
/**
* Consturctor.
*
* @param url A URL that describes the position of the sound file.
*/
Sound( const QString &url );
/**
* Consturctor.
*
* @param data The raw data of the sound.
*/
Sound( const QByteArray &data );
/**
* Destructor.
diff --git a/kabc/tmpaddressbook.cpp b/kabc/tmpaddressbook.cpp
index cfa57e3..5152e00 100644
--- a/kabc/tmpaddressbook.cpp
+++ b/kabc/tmpaddressbook.cpp
@@ -1,49 +1,49 @@
/*
This file is part of libkabc.
Copyright (c) 2004 Ulf Schenk
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "tmpaddressbook.h"
using namespace KABC;
#include "resource.h"
TmpAddressBook::TmpAddressBook()
: AddressBook(0, "tmpcontact")
{
}
TmpAddressBook::TmpAddressBook( const QString &config )
: AddressBook( config, "tmpcontact" )
{
}
TmpAddressBook::~TmpAddressBook()
{
removeResources();
}
diff --git a/kabc/vcard/AdrParam.cpp b/kabc/vcard/AdrParam.cpp
index fa46499..33d358c 100644
--- a/kabc/vcard/AdrParam.cpp
+++ b/kabc/vcard/AdrParam.cpp
@@ -1,126 +1,128 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardAdrParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
AdrParam::AdrParam()
: Param()
{
}
AdrParam::AdrParam(const AdrParam & x)
: Param(x),
adrTypeList_ (x.adrTypeList_)
{
}
-AdrParam::AdrParam(const QCString & s)
+AdrParam::AdrParam(const Q3CString & s)
: Param(s)
{
}
AdrParam &
AdrParam::operator = (AdrParam & x)
{
if (*this == x) return *this;
adrTypeList_ = x.adrTypeList();
textParam_ = x.textParam();
Param::operator = (x);
return *this;
}
AdrParam &
-AdrParam::operator = (const QCString & s)
+AdrParam::operator = (const Q3CString & s)
{
Param::operator = (s);
adrTypeList_.clear();
textParam_.truncate(0);
return *this;
}
bool
AdrParam::operator == (AdrParam & x)
{
parse();
if (!x.textParam().isEmpty())
return (x.textParam_ == textParam_);
if (x.adrTypeList().count() != adrTypeList_.count())
return false;
- QStrListIterator it(x.adrTypeList_);
+ Q3StrListIterator it(x.adrTypeList_);
for (; it.current(); ++it)
if (!adrTypeList_.find(it.current()))
return false;
return true;
}
AdrParam::~AdrParam()
{
}
void
AdrParam::_parse()
{
adrTypeList_.clear();
if (strRep_.left(4) != "TYPE") {
textParam_ = strRep_;
return;
}
if (!strRep_.contains('='))
return;
RTokenise(strRep_, ",", adrTypeList_);
}
void
AdrParam::_assemble()
{
if (!textParam_.isEmpty()) {
strRep_ = textParam_;
return;
}
- QStrListIterator it(adrTypeList_);
+ Q3StrListIterator it(adrTypeList_);
for (; it.current(); ++it) {
strRep_ += it.current();
if (it.current() != adrTypeList_.last())
strRep_ += ',';
}
}
diff --git a/kabc/vcard/AdrValue.cpp b/kabc/vcard/AdrValue.cpp
index 7ecef33..51ca12a 100644
--- a/kabc/vcard/AdrValue.cpp
+++ b/kabc/vcard/AdrValue.cpp
@@ -1,140 +1,143 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardAdrValue.h>
#include <VCardValue.h>
#include <VCardDefines.h>
+//Added by qt3to4:
+#include <Q3StrList>
+#include <Q3CString>
using namespace VCARD;
AdrValue::AdrValue()
: Value()
{
}
AdrValue::AdrValue(const AdrValue & x)
: Value(x),
poBox_ (x.poBox_),
extAddress_ (x.extAddress_),
street_ (x.street_),
locality_ (x.locality_),
region_ (x.region_),
postCode_ (x.postCode_),
countryName_ (x.countryName_)
{
}
-AdrValue::AdrValue(const QCString & s)
+AdrValue::AdrValue(const Q3CString & s)
: Value(s)
{
}
AdrValue &
AdrValue::operator = (AdrValue & x)
{
if (*this == x) return *this;
poBox_ = x.poBox_;
extAddress_ = x.extAddress_;
street_ = x.street_;
locality_ = x.locality_;
region_ = x.region_;
postCode_ = x.postCode_;
countryName_ = x.countryName_;
Value::operator = (x);
return *this;
}
AdrValue &
-AdrValue::operator = (const QCString & s)
+AdrValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
AdrValue::operator == (AdrValue & x)
{
parse();
x.parse();
return (
poBox_ == x.poBox_ &&
extAddress_ == x.extAddress_ &&
street_ == x.street_ &&
locality_ == x.locality_ &&
region_ == x.region_ &&
postCode_ == x.postCode_ &&
countryName_ == x.countryName_);
}
AdrValue::~AdrValue()
{
}
AdrValue *
AdrValue::clone()
{
return new AdrValue( *this );
}
void
AdrValue::_parse()
{
vDebug("AdrValue::_parse()");
- QStrList l;
+ Q3StrList l;
RTokenise(strRep_, ";", l);
for (unsigned int i = 0; i < l.count(); i++) {
switch (i) {
case 0: poBox_ = l.at(0); break;
case 1: extAddress_ = l.at(1); break;
case 2: street_ = l.at(2); break;
case 3: locality_ = l.at(3); break;
case 4: region_ = l.at(4); break;
case 5: postCode_ = l.at(5); break;
case 6: countryName_ = l.at(6); break;
default: break;
}
}
}
void
AdrValue::_assemble()
{
vDebug("AdrValue::_assemble");
strRep_ = poBox_;
strRep_ += ";" + extAddress_;
strRep_ += ";" + street_;
strRep_ += ";" + locality_;
strRep_ += ";" + region_;
strRep_ += ";" + postCode_;
strRep_ += ";" + countryName_;
}
diff --git a/kabc/vcard/AgentParam.cpp b/kabc/vcard/AgentParam.cpp
index 5625e00..aae35ac 100644
--- a/kabc/vcard/AgentParam.cpp
+++ b/kabc/vcard/AgentParam.cpp
@@ -1,92 +1,94 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardAgentParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
AgentParam::AgentParam()
: Param()
{
}
AgentParam::AgentParam(const AgentParam & x)
: Param(x),
refer_ (x.refer_),
uri_ (x.uri_)
{
}
-AgentParam::AgentParam(const QCString & s)
+AgentParam::AgentParam(const Q3CString & s)
: Param(s)
{
}
AgentParam &
AgentParam::operator = (AgentParam & x)
{
if (*this == x) return *this;
refer_ = x.refer_;
uri_ = x.uri_;
Param::operator = (x);
return *this;
}
AgentParam &
-AgentParam::operator = (const QCString & s)
+AgentParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
AgentParam::operator == (AgentParam & x)
{
parse();
if (refer_)
return (x.refer() && uri_ == x.uri_);
return !x.refer();
}
AgentParam::~AgentParam()
{
}
void
AgentParam::_parse()
{
if (strRep_.isEmpty()) {
refer_ = false;
return;
}
refer_ = true;
uri_ = strRep_;
}
diff --git a/kabc/vcard/AgentValue.cpp b/kabc/vcard/AgentValue.cpp
index bccde80..14e73b1 100644
--- a/kabc/vcard/AgentValue.cpp
+++ b/kabc/vcard/AgentValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardAgentValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
AgentValue::AgentValue()
: Value()
{
}
AgentValue::AgentValue(const AgentValue & x)
: Value(x)
{
}
-AgentValue::AgentValue(const QCString & s)
+AgentValue::AgentValue(const Q3CString & s)
: Value(s)
{
}
AgentValue &
AgentValue::operator = (AgentValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
AgentValue &
-AgentValue::operator = (const QCString & s)
+AgentValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
AgentValue::operator == (AgentValue & x)
{
x.parse();
return false;
}
AgentValue::~AgentValue()
{
}
void
AgentValue::_parse()
{
}
void
AgentValue::_assemble()
{
}
diff --git a/kabc/vcard/ClassValue.cpp b/kabc/vcard/ClassValue.cpp
index f01e5a6..c088d7c 100644
--- a/kabc/vcard/ClassValue.cpp
+++ b/kabc/vcard/ClassValue.cpp
@@ -1,93 +1,95 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardClassValue.h>
#include <VCardValue.h>
#include <kdebug.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ClassValue::ClassValue()
: Value()
{
}
ClassValue::ClassValue(const ClassValue & x)
: Value(x),
classType_(x.classType_)
{
}
-ClassValue::ClassValue(const QCString & s)
+ClassValue::ClassValue(const Q3CString & s)
: Value(s)
{
}
ClassValue &
ClassValue::operator = (ClassValue & x)
{
if (*this == x) return *this;
x.parse();
classType_ = x.classType_;
Value::operator = (x);
return *this;
}
ClassValue &
-ClassValue::operator = (const QCString & s)
+ClassValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
ClassValue::operator == (ClassValue & x)
{
x.parse();
return ( classType_ == x.classType_ );
}
ClassValue::~ClassValue()
{
}
ClassValue *
ClassValue::clone()
{
return new ClassValue( *this );
}
void
ClassValue::_parse()
{
if (qstricmp(strRep_, "PUBLIC") == 0)
classType_ = Public;
else if (qstricmp(strRep_, "PRIVATE") == 0)
classType_ = Private;
else if (qstricmp(strRep_, "CONFIDENTIAL") == 0)
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp
index 0a2f97d..1d4886c 100644
--- a/kabc/vcard/ContentLine.cpp
+++ b/kabc/vcard/ContentLine.cpp
@@ -1,57 +1,57 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <qregexp.h>
#include <kdebug.h>
#include <VCardAdrParam.h>
#include <VCardAgentParam.h>
#include <VCardDateParam.h>
#include <VCardEmailParam.h>
#include <VCardImageParam.h>
#include <VCardSourceParam.h>
#include <VCardTelParam.h>
#include <VCardTextBinParam.h>
#include <VCardTextParam.h>
#include <VCardAdrValue.h>
#include <VCardAgentValue.h>
#include <VCardDateValue.h>
#include <VCardImageValue.h>
#include <VCardTextValue.h>
#include <VCardTextBinValue.h>
#include <VCardLangValue.h>
#include <VCardNValue.h>
#include <VCardURIValue.h>
#include <VCardSoundValue.h>
#include <VCardClassValue.h>
#include <VCardFloatValue.h>
#include <VCardOrgValue.h>
#include <VCardTelValue.h>
#include <VCardTextListValue.h>
#include <VCardUTCValue.h>
#include <VCardGeoValue.h>
@@ -69,199 +69,199 @@ ContentLine::ContentLine()
value_(0),
paramType_( ParamUnknown ),
valueType_( ValueUnknown ),
entityType_( EntityUnknown )
{
paramList_.setAutoDelete( TRUE );
}
ContentLine::ContentLine(const ContentLine & x)
: Entity(x),
group_ (x.group_),
name_ (x.name_),
/*US paramList_(x.paramList_),*/
value_(x.value_->clone()),
paramType_(x.paramType_),
valueType_(x.valueType_),
entityType_(x.entityType_)
{
paramList_.setAutoDelete( TRUE );
ParamListIterator it(x.paramList_);
for (; it.current(); ++it)
{
Param *p = new Param;
p->setName( it.current()->name() );
p->setValue( it.current()->value() );
paramList_.append(p);
}
}
-ContentLine::ContentLine(const QCString & s)
+ContentLine::ContentLine(const Q3CString & s)
: Entity(s),
value_(0),
paramType_( ParamUnknown ),
valueType_( ValueUnknown ),
entityType_( EntityUnknown )
{
paramList_.setAutoDelete( TRUE );
}
ContentLine &
ContentLine::operator = (ContentLine & x)
{
if (*this == x) return *this;
ParamListIterator it(x.paramList_);
for (; it.current(); ++it)
{
Param *p = new Param;
p->setName( it.current()->name() );
p->setValue( it.current()->value() );
paramList_.append(p);
}
value_ = x.value_->clone();
Entity::operator = (x);
return *this;
}
ContentLine &
-ContentLine::operator = (const QCString & s)
+ContentLine::operator = (const Q3CString & s)
{
Entity::operator = (s);
delete value_;
value_ = 0;
return *this;
}
bool
ContentLine::operator == (ContentLine & x)
{
x.parse();
- QPtrListIterator<Param> it(x.paramList());
+ Q3PtrListIterator<Param> it(x.paramList());
if (!paramList_.find(it.current()))
return false;
return true;
}
ContentLine::~ContentLine()
{
delete value_;
value_ = 0;
}
void
ContentLine::_parse()
{
vDebug("parse");
// Unfold folded lines
// NLR
- strRep_ = strRep_.replace( QRegExp( "\\r" ), "" );
+ strRep_ = strRep_.replace( "\\r" , "" );
// Unqote newlines
- strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" );
+ strRep_ = strRep_.replace( "\\\\n", "\n" );
//NLR
- strRep_ = strRep_.replace( QRegExp( "\\\\r" ), "\r" );
+ strRep_ = strRep_.replace( "\\\\r" , "\r" );
int split = strRep_.find(':');
if (split == -1) { // invalid content line
vDebug("No ':'");
return;
}
- QCString firstPart(strRep_.left(split));
- QCString valuePart(strRep_.mid(split + 1));
+ Q3CString firstPart(strRep_.left(split));
+ Q3CString valuePart(strRep_.mid(split + 1));
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.mid(split + 1);
}
vDebug("Group == " + group_);
vDebug("firstPart == " + firstPart);
vDebug("valuePart == " + valuePart);
// Now we have the group, the name and param list together and the value.
- QStrList l;
+ Q3StrList l;
RTokenise(firstPart, ";", l);
if (l.count() == 0) {// invalid - no name !
vDebug("No name for this content line !");
return;
}
name_ = l.at(0);
// Now we have the name, so the rest of 'l' is the params.
// Remove the name part.
l.remove(0u);
entityType_ = EntityNameToEntityType(name_);
paramType_ = EntityTypeToParamType(entityType_);
unsigned int i = 0;
// For each parameter, create a new parameter of the correct type.
- QStrListIterator it(l);
+ Q3StrListIterator it(l);
for (; it.current(); ++it, i++) {
- QCString str = *it;
+ Q3CString str = *it;
split = str.find("=");
if (split < 0 ) {
vDebug("No '=' in paramter.");
continue;
}
- QCString paraName = str.left(split);
- QCString paraValue = str.mid(split + 1);
+ Q3CString paraName = str.left(split);
+ Q3CString paraValue = str.mid(split + 1);
- QStrList paraValues;
+ Q3StrList paraValues;
RTokenise(paraValue, ",", paraValues);
- QStrListIterator it2( paraValues );
+ Q3StrListIterator it2( paraValues );
for(; it2.current(); ++it2) {
Param *p = new Param;
p->setName( paraName );
p->setValue( *it2 );
paramList_.append(p);
}
}
// Create a new value of the correct type.
valueType_ = EntityTypeToValueType(entityType_);
// kdDebug(5710) << "valueType: " << valueType_ << endl;
switch (valueType_) {
case ValueSound: value_ = new SoundValue; break;
case ValueAgent: value_ = new AgentValue; break;
case ValueAddress: value_ = new AdrValue; break;
case ValueTel: value_ = new TelValue; break;
case ValueTextBin: value_ = new TextBinValue; break;
case ValueOrg: value_ = new OrgValue; break;
case ValueN: value_ = new NValue; break;
case ValueUTC: value_ = new UTCValue; break;
case ValueURI: value_ = new URIValue; break;
case ValueClass: value_ = new ClassValue; break;
case ValueFloat: value_ = new FloatValue; break;
case ValueImage: value_ = new ImageValue; break;
case ValueDate: value_ = new DateValue; break;
@@ -280,65 +280,65 @@ ContentLine::_assemble()
{
//strRep_.truncate(0);
QString line;
if (!group_.isEmpty())
line = group_ + '.';
line += name_;
ParamListIterator it(paramList_);
for (; it.current(); ++it)
line += ";" + it.current()->asString();
if (value_ != 0)
line += ":" + value_->asString();
line = line.replace( QRegExp( "\r" ), "\\r" );
line = line.replace( QRegExp( "\n" ), "\\n" );
// Fold lines longer than 72 chars
const int maxLen = 72;
uint cursor = 0;
QString cut;
while( line.length() > ( cursor + 1 ) * maxLen ) {
cut += line.mid( cursor * maxLen, maxLen );
cut += "\r\n ";
++cursor;
}
cut += line.mid( cursor * maxLen );
strRep_ = cut.latin1();
//qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
#if 0
vDebug("Assemble (argl) - my name is \"" + name_ + "\"");
strRep_.truncate(0);
- QCString line;
+ Q3CString line;
if (!group_.isEmpty())
line += group_ + '.';
line += name_;
vDebug("Adding parameters");
ParamListIterator it(paramList_);
for (; it.current(); ++it)
line += ";" + it.current()->asString();
vDebug("Adding value");
if (value_ != 0)
line += ":" + value_->asString();
else
vDebug("No value");
// Quote newlines
line = line.replace( QRegExp( "\n" ), "\\n" );
// Fold lines longer than 72 chars
const int maxLen = 72;
uint cursor = 0;
while( line.length() > ( cursor + 1 ) * maxLen ) {
strRep_ += line.mid( cursor * maxLen, maxLen );
strRep_ += "\r\n ";
++cursor;
}
strRep_ += line.mid( cursor * maxLen );
qDebug("ContentLine::_assemble()\n%s*****", strRep_.data());
#endif
diff --git a/kabc/vcard/DateParam.cpp b/kabc/vcard/DateParam.cpp
index 52af089..52fb828 100644
--- a/kabc/vcard/DateParam.cpp
+++ b/kabc/vcard/DateParam.cpp
@@ -1,82 +1,84 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardDateParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
DateParam::DateParam()
: Param()
{
}
DateParam::DateParam(const DateParam & x)
: Param(x)
{
}
-DateParam::DateParam(const QCString & s)
+DateParam::DateParam(const Q3CString & s)
: Param(s)
{
}
DateParam &
DateParam::operator = (DateParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
DateParam &
-DateParam::operator = (const QCString & s)
+DateParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
DateParam::operator == (DateParam & x)
{
x.parse();
return false;
}
DateParam::~DateParam()
{
}
void
DateParam::_parse()
{
}
void
DateParam::_assemble()
{
}
diff --git a/kabc/vcard/DateValue.cpp b/kabc/vcard/DateValue.cpp
index c5c5c85..87c7007 100644
--- a/kabc/vcard/DateValue.cpp
+++ b/kabc/vcard/DateValue.cpp
@@ -1,56 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include <VCardDefines.h>
#include <VCardDateValue.h>
#include <VCardValue.h>
using namespace VCARD;
DateValue::DateValue()
: Value()
{
vDebug("DateValue::DateValue()");
}
DateValue::DateValue(
unsigned int year,
unsigned int month,
unsigned int day,
unsigned int hour,
unsigned int minute,
unsigned int second,
double secFrac,
bool zonePositive,
unsigned int zoneHour,
unsigned int zoneMinute)
: Value (),
year_ (year),
month_ (month),
day_ (day),
hour_ (hour),
minute_ (minute),
@@ -76,205 +78,205 @@ DateValue::DateValue(const QDate & d)
assembled_ = false;
}
DateValue::DateValue(const QDateTime & d)
: Value (),
year_ (d.date().year()),
month_ (d.date().month()),
day_ (d.date().day()),
hour_ (d.time().hour()),
minute_ (d.time().minute()),
second_ (d.time().second()),
hasTime_(true)
{
parsed_ = true;
assembled_ = false;
}
DateValue::DateValue(const DateValue & x)
: Value(x)
{
year_ = x.year_;
month_ = x.month_;
day_ = x.day_;
hour_ = x.hour_;
minute_ = x.minute_;
second_ = x.second_;
zoneHour_ = x.zoneHour_;
zoneMinute_ = x.zoneMinute_;
secFrac_ = x.secFrac_;
hasTime_ = x.hasTime_;
}
-DateValue::DateValue(const QCString & s)
+DateValue::DateValue(const Q3CString & s)
: Value(s)
{
}
DateValue &
DateValue::operator = (DateValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
DateValue &
-DateValue::operator = (const QCString & s)
+DateValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
DateValue::operator == (DateValue & x)
{
x.parse();
return false;
}
DateValue::~DateValue()
{
}
DateValue *
DateValue::clone()
{
return new DateValue( *this );
}
void
DateValue::_parse()
{
vDebug("DateValue::_parse()");
// date = date-full-year ["-"] date-month ["-"] date-mday
// time = time-hour [":"] time-minute [":"] time-second [":"]
// [time-secfrac] [time-zone]
int timeSep = strRep_.find('T');
- QCString dateStr;
- QCString timeStr;
+ Q3CString dateStr;
+ Q3CString timeStr;
if (timeSep == -1) {
dateStr = strRep_;
vDebug("Has date string \"" + dateStr + "\"");
} else {
dateStr = strRep_.left(timeSep);
vDebug("Has date string \"" + dateStr + "\"");
timeStr = strRep_.mid(timeSep + 1);
vDebug("Has time string \"" + timeStr + "\"");
}
/////////////////////////////////////////////////////////////// DATE
- dateStr.replace(QRegExp("-"), "");
+ dateStr.replace("-", "");
kdDebug(5710) << "dateStr: " << dateStr << endl;
year_ = dateStr.left(4).toInt();
month_ = dateStr.mid(4, 2).toInt();
day_ = dateStr.right(2).toInt();
if (timeSep == -1) {
hasTime_ = false;
return; // No time, done.
}
else
hasTime_ = true;
/////////////////////////////////////////////////////////////// TIME
/////////////////////////////////////////////////////////////// ZONE
int zoneSep = timeStr.find('Z');
if (zoneSep != -1 && timeStr.length() - zoneSep > 3) {
- QCString zoneStr(timeStr.mid(zoneSep + 1));
+ Q3CString zoneStr(timeStr.mid(zoneSep + 1));
vDebug("zoneStr == " + zoneStr);
zonePositive_ = (zoneStr[0] == '+');
zoneHour_ = zoneStr.mid(1, 2).toInt();
zoneMinute_ = zoneStr.right(2).toInt();
timeStr.remove(zoneSep, timeStr.length() - zoneSep);
}
//////////////////////////////////////////////////// SECOND FRACTION
int secFracSep = timeStr.findRev(',');
if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors.
- QCString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep);
+ Q3CString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep);
secFrac_ = quirkafleeg.toDouble();
}
/////////////////////////////////////////////////////////////// HMS
- timeStr.replace(QRegExp(":"), "");
+ timeStr.replace(":", "");
hour_ = timeStr.left(2).toInt();
minute_ = timeStr.mid(2, 2).toInt();
second_ = timeStr.mid(4, 2).toInt();
}
void
DateValue::_assemble()
{
vDebug("DateValue::_assemble");
- QCString year;
- QCString month;
- QCString day;
+ Q3CString year;
+ Q3CString month;
+ Q3CString day;
year.setNum( year_ );
month.setNum( month_ );
day.setNum( day_ );
if ( month.length() < 2 ) month.prepend( "0" );
if ( day.length() < 2 ) day.prepend( "0" );
strRep_ = year + '-' + month + '-' + day;
if ( hasTime_ ) {
- QCString hour;
- QCString minute;
- QCString second;
+ Q3CString hour;
+ Q3CString minute;
+ Q3CString second;
hour.setNum( hour_ );
minute.setNum( minute_ );
second.setNum( second_ );
if ( hour.length() < 2 ) hour.prepend( "0" );
if ( minute.length() < 2 ) minute.prepend( "0" );
if ( second.length() < 2 ) second.prepend( "0" );
strRep_ += 'T' + hour + ':' + minute + ':' + second + 'Z';
}
}
unsigned int
DateValue::year()
{
parse();
return year_;
}
unsigned int
DateValue::month()
{
parse();
return month_;
}
unsigned int
DateValue::day()
{
parse();
return day_;
diff --git a/kabc/vcard/EmailParam.cpp b/kabc/vcard/EmailParam.cpp
index 8c87477..877af60 100644
--- a/kabc/vcard/EmailParam.cpp
+++ b/kabc/vcard/EmailParam.cpp
@@ -1,93 +1,95 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardEmailParam.h>
#include <VCardParam.h>
#include <VCardDefines.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
EmailParam::EmailParam()
: Param()
{
vDebug("ctor");
}
EmailParam::EmailParam(const EmailParam & x)
: Param(x),
emailType_ (x.emailType_),
pref_ (x.pref_)
{
}
-EmailParam::EmailParam(const QCString & s)
+EmailParam::EmailParam(const Q3CString & s)
: Param(s)
{
}
EmailParam &
EmailParam::operator = (EmailParam & x)
{
if (*this == x) return *this;
emailType_ = x.emailType();
pref_ = x.pref_;
Param::operator = (x);
return *this;
}
EmailParam &
-EmailParam::operator = (const QCString & s)
+EmailParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
EmailParam::operator == (EmailParam & x)
{
parse();
if (pref_)
return (x.pref_ && x.emailType() == emailType_);
return !x.pref();
}
EmailParam::~EmailParam()
{
}
void
EmailParam::_parse()
{
#if 0
Param::parseToList();
SubParamListIterator it(subParamList_);
pref_ = true;
emailType_ = "";
for (; it.current(); ++it) {
diff --git a/kabc/vcard/Entity.cpp b/kabc/vcard/Entity.cpp
index b7d09e0..e38fa11 100644
--- a/kabc/vcard/Entity.cpp
+++ b/kabc/vcard/Entity.cpp
@@ -1,134 +1,136 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardEntity.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
Entity::Entity()
: parsed_ (false),
assembled_ (true)
{
// empty
}
Entity::Entity(const Entity & e)
: strRep_ (e.strRep_),
parsed_ (e.parsed_),
assembled_ (e.assembled_)
{
// empty
}
-Entity::Entity(const QCString & s)
+Entity::Entity(const Q3CString & s)
: strRep_ (s),
parsed_ (false),
assembled_ (true)
{
// empty
}
Entity &
Entity::operator = (const Entity & e)
{
if (this == &e) return *this;
strRep_ = e.strRep_;
parsed_ = e.parsed_;
assembled_ = e.assembled_;
return *this;
}
Entity &
-Entity::operator = (const QCString & s)
+Entity::operator = (const Q3CString & s)
{
strRep_ = s;
parsed_ = false;
assembled_ = true;
return *this;
}
bool
Entity::operator == (Entity & e)
{
return asString() == e.asString();
}
bool
Entity::operator != (Entity & e)
{
return !(*this == e);
}
bool
-Entity::operator == (const QCString & s)
+Entity::operator == (const Q3CString & s)
{
return asString() == s;
}
bool
-Entity::operator != (const QCString & s)
+Entity::operator != (const Q3CString & s)
{
return !(*this == s);
}
Entity::~Entity()
{
// empty
}
- QCString
+ Q3CString
Entity::asString()
{
// vDebug("Entity::asString()");
assemble();
return strRep_;
}
void
Entity::parse()
{
// vDebug( "Entity::parse()" );
if (!parsed_) _parse();
parsed_ = true;
assembled_ = false;
}
void
Entity::assemble()
{
// vDebug( "Entity::assemble()" );
if (assembled_) return;
parse();
_assemble();
assembled_ = true;
}
diff --git a/kabc/vcard/Enum.cpp b/kabc/vcard/Enum.cpp
index cc48b5a..036324c 100644
--- a/kabc/vcard/Enum.cpp
+++ b/kabc/vcard/Enum.cpp
@@ -1,64 +1,64 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qcstring.h>
+#include <q3cstring.h>
#include <ctype.h>
#include <VCardEnum.h>
using namespace VCARD;
// There are 31 possible types, not including extensions.
- const QCString
+ const Q3CString
VCARD::paramNames [] =
{
"NAME",
"PROFILE",
"SOURCE",
"FN",
"N",
"NICKNAME",
"PHOTO",
"BDAY",
"ADR",
"LABEL",
"TEL",
"EMAIL",
"MAILER",
"TZ",
"GEO",
"TITLE",
"ROLE",
"LOGO",
"AGENT",
"ORG",
"CATEGORIES",
"NOTE",
"PRODID",
"REV",
"SORT-STRING",
"SOUND",
"UID",
"URL",
"VERSION",
"CLASS",
@@ -193,73 +193,73 @@ VCARD::EntityTypeToValueType(EntityType e)
//---------------------------------------------------------------//
case EntityPhoto:
case EntityLogo: t = ValueImage; break;
//---------------------------------------------------------------//
case EntityBirthday:
case EntityRevision: t = ValueDate; break;
//---------------------------------------------------------------//
case EntityCategories:
case EntityNickname: t = ValueTextList; break;
//---------------------------------------------------------------//
case EntityLabel:
case EntityExtension:
case EntityEmail:
case EntityTitle:
case EntityRole:
case EntityFullName:
case EntityMailer:
case EntityProductID:
case EntityName:
case EntitySortString:
case EntityVersion:
case EntityProfile:
case EntityUID:
case EntityNote:
default: t = ValueText; break;
//---------------------------------------------------------------//
}
return t;
}
- QCString
+ Q3CString
VCARD::EntityTypeToParamName(EntityType e)
{
if ( e > EntityUnknown ) e = EntityUnknown;
return paramNames[ int( e ) ];
}
EntityType
-VCARD::EntityNameToEntityType(const QCString & s)
+VCARD::EntityNameToEntityType(const Q3CString & s)
{
if (s.isEmpty()) return EntityUnknown;
EntityType t(EntityUnknown);
switch (s[0]) {
case 'A':
if (s == "ADR")
t = EntityAddress;
else if (s == "AGENT")
t = EntityAgent;
break;
case 'B':
if (s == "BDAY")
t = EntityBirthday;
break;
case 'C':
if (s == "CATEGORIES")
t = EntityCategories;
else if (s == "CLASS")
t = EntityClass;
break;
case 'E':
if (s == "EMAIL")
t = EntityEmail;
break;
case 'F':
diff --git a/kabc/vcard/FloatValue.cpp b/kabc/vcard/FloatValue.cpp
index 15bb664..7065081 100644
--- a/kabc/vcard/FloatValue.cpp
+++ b/kabc/vcard/FloatValue.cpp
@@ -1,120 +1,122 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardFloatValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
FloatValue::FloatValue()
: Value()
{
}
FloatValue::FloatValue(float f)
: Value (),
value_ (f)
{
parsed_ = true;
}
FloatValue::FloatValue(const FloatValue & x)
: Value(x)
{
value_ = x.value_;
}
-FloatValue::FloatValue(const QCString & s)
+FloatValue::FloatValue(const Q3CString & s)
: Value(s)
{
}
FloatValue &
FloatValue::operator = (FloatValue & x)
{
if (*this == x) return *this;
x.parse();
value_ = x.value_;
Value::operator = (x);
return *this;
}
FloatValue &
-FloatValue::operator = (const QCString & s)
+FloatValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
FloatValue::operator == (FloatValue & x)
{
x.parse();
return (value_ == x.value_);
}
FloatValue::~FloatValue()
{
}
void
FloatValue::_parse()
{
bool negative(false);
if (strRep_[0] == '-' || strRep_[1] == '+') {
if (strRep_[0] == '-')
negative = true;
strRep_.remove(0, 1);
}
value_ = strRep_.toFloat();
if (negative)
value_ = -value_;
}
void
FloatValue::_assemble()
{
- strRep_ = QCString().setNum(value_);
+ strRep_ = Q3CString().setNum(value_);
}
float
FloatValue::value()
{
parse();
return value_;
}
void
FloatValue::setValue(float f)
{
parsed_ = true;
value_ = f;
}
diff --git a/kabc/vcard/GeoValue.cpp b/kabc/vcard/GeoValue.cpp
index e02b402..ba57a6b 100644
--- a/kabc/vcard/GeoValue.cpp
+++ b/kabc/vcard/GeoValue.cpp
@@ -1,89 +1,91 @@
/*
This file is part of libvcard.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <VCardGeoValue.h>
#include <VCardValue.h>
#include <kdebug.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
GeoValue::GeoValue()
: Value()
{
}
GeoValue::GeoValue(const GeoValue & x)
: Value(x), latitude_(x.latitude_), longitude_(x.longitude_)
{
}
-GeoValue::GeoValue(const QCString & s)
+GeoValue::GeoValue(const Q3CString & s)
: Value(s)
{
}
GeoValue &
GeoValue::operator = (GeoValue & x)
{
if (*this == x) return *this;
latitude_ = x.latitude_;
longitude_ = x.longitude_;
Value::operator = (x);
return *this;
}
GeoValue &
-GeoValue::operator = (const QCString & s)
+GeoValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
GeoValue::operator == (GeoValue & x)
{
x.parse();
if ( latitude_ != x.latitude_ ) return false;
if ( longitude_ != x.longitude_ ) return false;
return true;
}
GeoValue::~GeoValue()
{
}
GeoValue *
GeoValue::clone()
{
return new GeoValue( *this );
}
void
GeoValue::_parse()
{
int semiColon = strRep_.find( ";" );
if ( semiColon == -1 ) // invalid
diff --git a/kabc/vcard/ImageParam.cpp b/kabc/vcard/ImageParam.cpp
index c9cf6fd..6da317d 100644
--- a/kabc/vcard/ImageParam.cpp
+++ b/kabc/vcard/ImageParam.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardImageParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ImageParam::ImageParam()
: Param()
{
}
ImageParam::ImageParam(const ImageParam & x)
: Param(x)
{
}
-ImageParam::ImageParam(const QCString & s)
+ImageParam::ImageParam(const Q3CString & s)
: Param(s)
{
}
ImageParam &
ImageParam::operator = (ImageParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
ImageParam &
-ImageParam::operator = (const QCString & s)
+ImageParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
ImageParam::operator == (ImageParam & x)
{
x.parse();
return false;
}
ImageParam::~ImageParam()
{
}
void
ImageParam::_parse()
{
}
void
ImageParam::_assemble()
{
}
diff --git a/kabc/vcard/ImageValue.cpp b/kabc/vcard/ImageValue.cpp
index 4630fac..678a81c 100644
--- a/kabc/vcard/ImageValue.cpp
+++ b/kabc/vcard/ImageValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardImageValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ImageValue::ImageValue()
: Value()
{
}
ImageValue::ImageValue(const ImageValue & x)
: Value(x)
{
}
-ImageValue::ImageValue(const QCString & s)
+ImageValue::ImageValue(const Q3CString & s)
: Value(s)
{
}
ImageValue &
ImageValue::operator = (ImageValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
ImageValue &
-ImageValue::operator = (const QCString & s)
+ImageValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
ImageValue::operator == (ImageValue & x)
{
x.parse();
return false;
}
ImageValue::~ImageValue()
{
}
void
ImageValue::_parse()
{
}
void
ImageValue::_assemble()
{
}
diff --git a/kabc/vcard/ImgValue.cpp b/kabc/vcard/ImgValue.cpp
index 7b961f8..1b289df 100644
--- a/kabc/vcard/ImgValue.cpp
+++ b/kabc/vcard/ImgValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardImgValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
ImgValue::ImgValue()
: Value()
{
}
ImgValue::ImgValue(const ImgValue & x)
: Value(x)
{
}
-ImgValue::ImgValue(const QCString & s)
+ImgValue::ImgValue(const Q3CString & s)
: Value(s)
{
}
ImgValue &
ImgValue::operator = (ImgValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
ImgValue &
-ImgValue::operator = (const QCString & s)
+ImgValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
ImgValue::operator == (ImgValue & x)
{
x.parse();
return false;
}
ImgValue::~ImgValue()
{
}
void
ImgValue::_parse()
{
}
void
ImgValue::_assemble()
{
}
diff --git a/kabc/vcard/LangValue.cpp b/kabc/vcard/LangValue.cpp
index edf1804..52a0204 100644
--- a/kabc/vcard/LangValue.cpp
+++ b/kabc/vcard/LangValue.cpp
@@ -1,127 +1,131 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardLangValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3StrList>
using namespace VCARD;
LangValue::LangValue()
: Value()
{
}
LangValue::LangValue(const LangValue & x)
: Value(x)
{
}
-LangValue::LangValue(const QCString & s)
+LangValue::LangValue(const Q3CString & s)
: Value(s)
{
}
LangValue &
LangValue::operator = (LangValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
LangValue &
-LangValue::operator = (const QCString & s)
+LangValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
LangValue::operator == (LangValue & x)
{
x.parse();
return false;
}
LangValue::~LangValue()
{
}
void
LangValue::_parse()
{
- QStrList l;
+ Q3StrList l;
RTokenise(strRep_, "-", l);
if (l.count() == 0) return;
primary_ = l.at(0);
l.remove(0u);
subtags_ = l;
}
void
LangValue::_assemble()
{
strRep_ = primary_;
- QStrListIterator it(subtags_);
+ Q3StrListIterator it(subtags_);
- for (; it.current(); ++it)
- strRep_ += QCString('-') + it.current();
+ for (; it.current(); ++it) {
+ strRep_ += Q3CString('-'); strRep_ += it.current();
+ }
}
- QCString
+ Q3CString
LangValue::primary()
{
parse();
return primary_;
}
- QStrList
+ Q3StrList
LangValue::subtags()
{
parse();
return subtags_;
}
void
-LangValue::setPrimary(const QCString & s)
+LangValue::setPrimary(const Q3CString & s)
{
parse();
primary_ = s;
}
void
-LangValue::setSubTags(const QStrList & l)
+LangValue::setSubTags(const Q3StrList & l)
{
parse();
subtags_ = l;
}
diff --git a/kabc/vcard/NValue.cpp b/kabc/vcard/NValue.cpp
index cdec621..6c0f365 100644
--- a/kabc/vcard/NValue.cpp
+++ b/kabc/vcard/NValue.cpp
@@ -1,128 +1,130 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qstrlist.h>
+#include <q3strlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardRToken.h>
#include <VCardNValue.h>
#include <VCardValue.h>
#include <VCardDefines.h>
using namespace VCARD;
NValue::NValue()
: Value()
{
vDebug("ctor");
}
NValue::NValue(const NValue & x)
: Value(x),
family_ (x.family_),
given_ (x.given_),
middle_ (x.middle_),
prefix_ (x.prefix_),
suffix_ (x.suffix_)
{
}
-NValue::NValue(const QCString & s)
+NValue::NValue(const Q3CString & s)
: Value(s)
{
vDebug("ctor");
}
NValue &
NValue::operator = (NValue & x)
{
if (*this == x) return *this;
family_ = x.family_;
given_ = x.given_;
middle_ = x.middle_;
prefix_ = x.prefix_;
suffix_ = x.suffix_;
Value::operator = (x);
return *this;
}
NValue &
-NValue::operator = (const QCString & s)
+NValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
NValue::operator == (NValue & x)
{
x.parse();
return (
family_ == x.family_ &&
given_ == x.given_ &&
middle_ == x.middle_ &&
prefix_ == x.prefix_ &&
suffix_ == x.suffix_);
}
NValue::~NValue()
{
}
NValue *
NValue::clone()
{
return new NValue( *this );
}
void
NValue::_parse()
{
- QStrList l;
+ Q3StrList l;
RTokenise(strRep_, ";", l);
for (unsigned int i = 0; i < l.count(); i++) {
switch (i) {
case 0: family_ = l.at(0); break;
case 1: given_ = l.at(1); break;
case 2: middle_ = l.at(2); break;
case 3: prefix_ = l.at(3); break;
case 4: suffix_ = l.at(4); break;
default: break;
}
}
}
void
NValue::_assemble()
{
strRep_ = family_;
strRep_ += ";" + given_;
strRep_ += ";" + middle_;
strRep_ += ";" + prefix_;
strRep_ += ";" + suffix_;
}
diff --git a/kabc/vcard/OrgValue.cpp b/kabc/vcard/OrgValue.cpp
index c3134c8..a6a32dd 100644
--- a/kabc/vcard/OrgValue.cpp
+++ b/kabc/vcard/OrgValue.cpp
@@ -1,107 +1,109 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardOrgValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
OrgValue::OrgValue()
: Value()
{
}
OrgValue::OrgValue(const OrgValue & x)
: Value(x)
{
}
-OrgValue::OrgValue(const QCString & s)
+OrgValue::OrgValue(const Q3CString & s)
: Value(s)
{
}
OrgValue &
OrgValue::operator = (OrgValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
OrgValue &
-OrgValue::operator = (const QCString & s)
+OrgValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
OrgValue::operator == (OrgValue & x)
{
x.parse();
return false;
}
OrgValue::~OrgValue()
{
}
void
OrgValue::_parse()
{
RTokenise(strRep_, ";", valueList_);
}
void
OrgValue::_assemble()
{
bool first(true);
- QStrListIterator it(valueList_);
+ Q3StrListIterator it(valueList_);
for (; it.current(); ++it) {
if (!first) strRep_ += ';';
strRep_ += it.current();
first = false;
}
}
unsigned int
OrgValue::numValues()
{
parse();
return valueList_.count();
}
- QCString
+ Q3CString
OrgValue::value(unsigned int i)
{
parse();
return valueList_.at(i);
}
diff --git a/kabc/vcard/Param.cpp b/kabc/vcard/Param.cpp
index c513613..bd6b299 100644
--- a/kabc/vcard/Param.cpp
+++ b/kabc/vcard/Param.cpp
@@ -1,129 +1,131 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardParam.h>
#include <VCardEntity.h>
#include <VCardRToken.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
Param::Param()
: Entity(),
name_(""),
value_("")
{
}
Param::Param(const Param & x)
: Entity(x),
name_(x.name_),
value_(x.value_)
{
}
-Param::Param(const QCString & s)
+Param::Param(const Q3CString & s)
: Entity(s),
name_(""),
value_("")
{
}
Param &
Param::operator = (Param & x)
{
if (*this == x) return *this;
Entity::operator = (x);
name_ = x.name_;
value_ = x.value_;
return *this;
}
Param &
-Param::operator = (const QCString & s)
+Param::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
Param::operator == (Param & x)
{
x.parse();
return false;
}
Param::~Param()
{
}
void
Param::_parse()
{
}
void
Param::_assemble()
{
strRep_ = name_ + "=" + value_;
}
-Param::Param(const QCString &name, const QCString &value)
+Param::Param(const Q3CString &name, const Q3CString &value)
: Entity(),
name_(name),
value_(value)
{
parsed_ = true;
assembled_ = false;
}
void
-Param::setName(const QCString & name)
+Param::setName(const Q3CString & name)
{
name_ = name;
assembled_ = false;
}
void
-Param::setValue(const QCString & value)
+Param::setValue(const Q3CString & value)
{
value_ = value;
assembled_ = false;
}
- QCString
+ Q3CString
Param::name()
{
return name_;
}
- QCString
+ Q3CString
Param::value()
{
return value_;
}
diff --git a/kabc/vcard/PhoneNumberValue.cpp b/kabc/vcard/PhoneNumberValue.cpp
index 17b1400..57aa336 100644
--- a/kabc/vcard/PhoneNumberValue.cpp
+++ b/kabc/vcard/PhoneNumberValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardPhoneNumberValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
PhoneNumberValue::PhoneNumberValue()
: Value()
{
}
PhoneNumberValue::PhoneNumberValue(const PhoneNumberValue & x)
: Value(x)
{
}
-PhoneNumberValue::PhoneNumberValue(const QCString & s)
+PhoneNumberValue::PhoneNumberValue(const Q3CString & s)
: Value(s)
{
}
PhoneNumberValue &
PhoneNumberValue::operator = (PhoneNumberValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
PhoneNumberValue &
-PhoneNumberValue::operator = (const QCString & s)
+PhoneNumberValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
PhoneNumberValue::operator == (PhoneNumberValue & x)
{
x.parse();
return false;
}
PhoneNumberValue::~PhoneNumberValue()
{
}
void
PhoneNumberValue::_parse()
{
}
void
PhoneNumberValue::_assemble()
{
}
diff --git a/kabc/vcard/RToken.cpp b/kabc/vcard/RToken.cpp
index 2a85820..8fc0558 100644
--- a/kabc/vcard/RToken.cpp
+++ b/kabc/vcard/RToken.cpp
@@ -1,66 +1,66 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
#include <stddef.h>
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
namespace VCARD
{
Q_UINT32
-RTokenise(const char * str, const char * delim, QStrList & l)
+RTokenise(const char * str, const char * delim, Q3StrList & l)
{
// FIXME no stderr !
l.clear();
if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0;
char * len = (char *)(str + strlen(str)); // End of string.
register char * rstart = new char[strlen(str) + 1];
register char * r = rstart;
register const char * i = str; // Cursor.
while (i <= len) {
if (*i == '\\') { // Escaped chars go straight through.
*r++ = *i++;
if (i <= len)
*r++ = *i++;
continue;
}
if (strchr(delim, *i) != 0) {
// We hit a delimiter. If we have some text, make a new token.
// This has the effect that multiple delimiters are collapsed.
// cs: We mustn't collapse multiple delimiters, otherwise we
// lose empty fields.
*r = '\0';
// if (r != rstart) {
l.append(rstart);
// }
diff --git a/kabc/vcard/SoundValue.cpp b/kabc/vcard/SoundValue.cpp
index 81040d1..4d098d2 100644
--- a/kabc/vcard/SoundValue.cpp
+++ b/kabc/vcard/SoundValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardSoundValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
SoundValue::SoundValue()
: Value()
{
}
SoundValue::SoundValue(const SoundValue & x)
: Value(x)
{
}
-SoundValue::SoundValue(const QCString & s)
+SoundValue::SoundValue(const Q3CString & s)
: Value(s)
{
}
SoundValue &
SoundValue::operator = (SoundValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
SoundValue &
-SoundValue::operator = (const QCString & s)
+SoundValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
SoundValue::operator == (SoundValue & x)
{
x.parse();
return false;
}
SoundValue::~SoundValue()
{
}
void
SoundValue::_parse()
{
}
void
SoundValue::_assemble()
{
}
diff --git a/kabc/vcard/SourceParam.cpp b/kabc/vcard/SourceParam.cpp
index cd51cbd..8f02113 100644
--- a/kabc/vcard/SourceParam.cpp
+++ b/kabc/vcard/SourceParam.cpp
@@ -1,95 +1,97 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardSourceParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
SourceParam::SourceParam()
: Param(),
type_(SourceParam::TypeUnknown)
{
}
SourceParam::SourceParam(const SourceParam & x)
: Param(x),
type_ (x.type_),
par_ (x.par_),
val_ (x.val_)
{
}
-SourceParam::SourceParam(const QCString & s)
+SourceParam::SourceParam(const Q3CString & s)
: Param(s),
type_(SourceParam::TypeUnknown)
{
}
SourceParam &
SourceParam::operator = (SourceParam & x)
{
if (*this == x) return *this;
type_ = x.type();
par_ = x.par();
val_ = x.val();
Param::operator = (x);
return *this;
}
SourceParam &
-SourceParam::operator = (const QCString & s)
+SourceParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
SourceParam::operator == (SourceParam & x)
{
x.parse();
return false;
}
SourceParam::~SourceParam()
{
}
void
SourceParam::_parse()
{
int i = strRep_.find('=');
if (i == -1) // Invalid
return;
par_ = strRep_.left(i);
val_ = strRep_.right(strRep_.length() - i - 1);
if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0)
type_ = TypeValue;
else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0)
type_ = TypeContext;
else if (qstrnicmp(par_, "X-", 2) == 0) {
type_ = TypeX;
diff --git a/kabc/vcard/TelParam.cpp b/kabc/vcard/TelParam.cpp
index 9d9fe4d..4bc8b6a 100644
--- a/kabc/vcard/TelParam.cpp
+++ b/kabc/vcard/TelParam.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTelParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TelParam::TelParam()
: Param()
{
}
TelParam::TelParam(const TelParam & x)
: Param(x)
{
}
-TelParam::TelParam(const QCString & s)
+TelParam::TelParam(const Q3CString & s)
: Param(s)
{
}
TelParam &
TelParam::operator = (TelParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
TelParam &
-TelParam::operator = (const QCString & s)
+TelParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
TelParam::operator == (TelParam & x)
{
x.parse();
return false;
}
TelParam::~TelParam()
{
}
void
TelParam::_parse()
{
}
void
TelParam::_assemble()
{
}
diff --git a/kabc/vcard/TelValue.cpp b/kabc/vcard/TelValue.cpp
index 349f99a..d9cbf3e 100644
--- a/kabc/vcard/TelValue.cpp
+++ b/kabc/vcard/TelValue.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTelValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TelValue::TelValue()
: Value()
{
}
TelValue::TelValue(const TelValue & x)
: Value(x)
{
}
-TelValue::TelValue(const QCString & s)
+TelValue::TelValue(const Q3CString & s)
: Value(s)
{
}
TelValue &
TelValue::operator = (TelValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
TelValue &
-TelValue::operator = (const QCString & s)
+TelValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TelValue::operator == (TelValue & x)
{
x.parse();
return false;
}
TelValue::~TelValue()
{
}
void
TelValue::_parse()
{
}
void
TelValue::_assemble()
{
}
diff --git a/kabc/vcard/TextBinParam.cpp b/kabc/vcard/TextBinParam.cpp
index 66f2946..2866c12 100644
--- a/kabc/vcard/TextBinParam.cpp
+++ b/kabc/vcard/TextBinParam.cpp
@@ -1,81 +1,83 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTextBinParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextBinParam::TextBinParam()
: Param()
{
}
TextBinParam::TextBinParam(const TextBinParam & x)
: Param(x)
{
}
-TextBinParam::TextBinParam(const QCString & s)
+TextBinParam::TextBinParam(const Q3CString & s)
: Param(s)
{
}
TextBinParam &
TextBinParam::operator = (TextBinParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
TextBinParam &
-TextBinParam::operator = (const QCString & s)
+TextBinParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
TextBinParam::operator == (TextBinParam & x)
{
x.parse();
return false;
}
TextBinParam::~TextBinParam()
{
}
void
TextBinParam::_parse()
{
}
void
TextBinParam::_assemble()
{
}
diff --git a/kabc/vcard/TextBinValue.cpp b/kabc/vcard/TextBinValue.cpp
index c584009..a3a96ae 100644
--- a/kabc/vcard/TextBinValue.cpp
+++ b/kabc/vcard/TextBinValue.cpp
@@ -1,95 +1,97 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <kmdcodec.h>
#include <VCardTextBinValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextBinValue::TextBinValue()
: Value()
{
}
TextBinValue::TextBinValue(const TextBinValue & x)
: Value(x)
{
mIsBinary_ = x.mIsBinary_;
mData_ = x.mData_;
mUrl_ = x.mUrl_;
}
-TextBinValue::TextBinValue(const QCString & s)
+TextBinValue::TextBinValue(const Q3CString & s)
: Value(s)
{
}
TextBinValue &
TextBinValue::operator = (TextBinValue & x)
{
if (*this == x) return *this;
mIsBinary_ = x.mIsBinary_;
mData_ = x.mData_;
mUrl_ = x.mUrl_;
Value::operator = (x);
return *this;
}
TextBinValue &
-TextBinValue::operator = (const QCString & s)
+TextBinValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TextBinValue::operator == (TextBinValue & x)
{
x.parse();
if ( mIsBinary_ != x.mIsBinary_ ) return false;
if ( mData_ != x.mData_ ) return false;
if ( mUrl_ != x.mUrl_ ) return false;
return true;
}
TextBinValue::~TextBinValue()
{
}
TextBinValue *
TextBinValue::clone()
{
return new TextBinValue( *this );
}
void
TextBinValue::_parse()
{
}
diff --git a/kabc/vcard/TextListValue.cpp b/kabc/vcard/TextListValue.cpp
index c4ac1e3..919f4f7 100644
--- a/kabc/vcard/TextListValue.cpp
+++ b/kabc/vcard/TextListValue.cpp
@@ -1,107 +1,109 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardRToken.h>
#include <VCardTextListValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextListValue::TextListValue()
: Value()
{
}
TextListValue::TextListValue(const TextListValue & x)
: Value(x)
{
}
-TextListValue::TextListValue(const QCString & s)
+TextListValue::TextListValue(const Q3CString & s)
: Value(s)
{
}
TextListValue &
TextListValue::operator = (TextListValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
TextListValue &
-TextListValue::operator = (const QCString & s)
+TextListValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TextListValue::operator == (TextListValue & x)
{
x.parse();
return false;
}
TextListValue::~TextListValue()
{
}
void
TextListValue::_parse()
{
RTokenise(strRep_, ";", valueList_);
}
void
TextListValue::_assemble()
{
bool first(true);
- QStrListIterator it(valueList_);
+ Q3StrListIterator it(valueList_);
for (; it.current(); ++it) {
if (!first) strRep_ += ';';
strRep_ += it.current();
first = false;
}
}
unsigned int
TextListValue::numValues()
{
parse();
return valueList_.count();
}
- QCString
+ Q3CString
TextListValue::value(unsigned int i)
{
parse();
return valueList_.at(i);
}
diff --git a/kabc/vcard/TextParam.cpp b/kabc/vcard/TextParam.cpp
index 7c68700..ce6661f 100644
--- a/kabc/vcard/TextParam.cpp
+++ b/kabc/vcard/TextParam.cpp
@@ -1,82 +1,84 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTextParam.h>
#include <VCardParam.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextParam::TextParam()
: Param()
{
}
TextParam::TextParam(const TextParam & x)
: Param(x)
{
}
-TextParam::TextParam(const QCString & s)
+TextParam::TextParam(const Q3CString & s)
: Param(s)
{
}
TextParam &
TextParam::operator = (TextParam & x)
{
if (*this == x) return *this;
Param::operator = (x);
return *this;
}
TextParam &
-TextParam::operator = (const QCString & s)
+TextParam::operator = (const Q3CString & s)
{
Param::operator = (s);
return *this;
}
bool
TextParam::operator == (TextParam & x)
{
x.parse();
return false;
}
TextParam::~TextParam()
{
}
void
TextParam::_parse()
{
}
void
TextParam::_assemble()
{
}
diff --git a/kabc/vcard/TextValue.cpp b/kabc/vcard/TextValue.cpp
index 09934fa..d0d2996 100644
--- a/kabc/vcard/TextValue.cpp
+++ b/kabc/vcard/TextValue.cpp
@@ -1,86 +1,88 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardTextValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
TextValue::TextValue()
: Value()
{
}
TextValue::TextValue(const TextValue & x)
: Value(x)
{
}
-TextValue::TextValue(const QCString & s)
+TextValue::TextValue(const Q3CString & s)
: Value(s)
{
}
TextValue &
TextValue::operator = (TextValue & x)
{
if (*this == x) return *this;
Value::operator = (x);
return *this;
}
TextValue &
-TextValue::operator = (const QCString & s)
+TextValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
TextValue::operator == (TextValue & x)
{
- return strRep_ = x.strRep_;
+ return strRep_ == x.strRep_;
}
TextValue::~TextValue()
{
}
TextValue *
TextValue::clone()
{
return new TextValue( *this );
}
void
TextValue::_parse()
{
}
void
TextValue::_assemble()
{
}
diff --git a/kabc/vcard/URIValue.cpp b/kabc/vcard/URIValue.cpp
index c1d1022..26da7f4 100644
--- a/kabc/vcard/URIValue.cpp
+++ b/kabc/vcard/URIValue.cpp
@@ -1,133 +1,135 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardURIValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
URIValue::URIValue()
: Value()
{
}
-URIValue::URIValue(const QCString & scheme, const QCString & schemeSpecificPart)
+URIValue::URIValue(const Q3CString & scheme, const Q3CString & schemeSpecificPart)
: Value(),
scheme_ (scheme),
schemeSpecificPart_ (schemeSpecificPart)
{
parsed_ = true;
}
URIValue::URIValue(const URIValue & x)
: Value (x),
scheme_ (x.scheme_),
schemeSpecificPart_ (x.schemeSpecificPart_)
{
}
-URIValue::URIValue(const QCString & s)
+URIValue::URIValue(const Q3CString & s)
: Value(s)
{
}
URIValue &
URIValue::operator = (URIValue & x)
{
if (*this == x) return *this;
scheme_ = x.scheme_;
schemeSpecificPart_ = x.schemeSpecificPart_;
Value::operator = (x);
return *this;
}
URIValue &
-URIValue::operator = (const QCString & s)
+URIValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
URIValue::operator == (URIValue & x)
{
x.parse();
return (
(scheme_ == x.scheme_) &&
(schemeSpecificPart_ == x.schemeSpecificPart_));
return false;
}
URIValue::~URIValue()
{
}
void
URIValue::_parse()
{
int split = strRep_.find(':');
if (split == -1)
return;
scheme_ = strRep_.left(split);
schemeSpecificPart_ = strRep_.mid(split + 1);
}
void
URIValue::_assemble()
{
strRep_ = scheme_ + ':' + schemeSpecificPart_;
}
- QCString
+ Q3CString
URIValue::scheme()
{
parse();
return scheme_;
}
- QCString
+ Q3CString
URIValue::schemeSpecificPart()
{
parse();
return schemeSpecificPart_;
}
void
-URIValue::setScheme(const QCString & s)
+URIValue::setScheme(const Q3CString & s)
{
parse();
scheme_ = s;
}
void
-URIValue::setSchemeSpecificPart(const QCString & s)
+URIValue::setSchemeSpecificPart(const Q3CString & s)
{
parse();
schemeSpecificPart_ = s;
}
diff --git a/kabc/vcard/UTCValue.cpp b/kabc/vcard/UTCValue.cpp
index 374306c..f35d986 100644
--- a/kabc/vcard/UTCValue.cpp
+++ b/kabc/vcard/UTCValue.cpp
@@ -1,92 +1,94 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardUTCValue.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
UTCValue::UTCValue()
: Value()
{
}
UTCValue::UTCValue(const UTCValue & x)
: Value(x), positive_(x.positive_), hour_(x.hour_), minute_(x.minute_)
{
}
-UTCValue::UTCValue(const QCString & s)
+UTCValue::UTCValue(const Q3CString & s)
: Value(s)
{
}
UTCValue &
UTCValue::operator = (UTCValue & x)
{
if (*this == x) return *this;
positive_ = x.positive_;
hour_ = x.hour_;
minute_ = x.minute_;
Value::operator = (x);
return *this;
}
UTCValue &
-UTCValue::operator = (const QCString & s)
+UTCValue::operator = (const Q3CString & s)
{
Value::operator = (s);
return *this;
}
bool
UTCValue::operator == (UTCValue & x)
{
x.parse();
if (positive_ != x.positive_) return false;
if (hour_ != x.hour_) return false;
if (minute_ != x.minute_) return false;
return true;
}
UTCValue::~UTCValue()
{
}
UTCValue *
UTCValue::clone()
{
return new UTCValue( *this );
}
void
UTCValue::_parse()
{
if ( strRep_.isEmpty() )
return;
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp
index a2ff327..bae5385 100644
--- a/kabc/vcard/VCardEntity.cpp
+++ b/kabc/vcard/VCardEntity.cpp
@@ -1,167 +1,169 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <qregexp.h>
#include <qdatetime.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardDefines.h>
#include <VCardVCardEntity.h>
using namespace VCARD;
VCardEntity::VCardEntity()
: Entity()
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity::VCardEntity(const VCardEntity & x)
: Entity(x)
{
cardList_.setAutoDelete( TRUE );
}
-VCardEntity::VCardEntity(const QCString & s)
+VCardEntity::VCardEntity(const Q3CString & s)
: Entity(s)
{
cardList_.setAutoDelete( TRUE );
}
VCardEntity &
VCardEntity::operator = (VCardEntity & x)
{
if (*this == x) return *this;
Entity::operator = (x);
return *this;
}
VCardEntity &
-VCardEntity::operator = (const QCString & s)
+VCardEntity::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
VCardEntity::operator == (VCardEntity & x)
{
x.parse();
return false;
}
VCardEntity::~VCardEntity()
{
}
void
VCardEntity::_parse()
{
#if 0
QTime tim;
tim.start();
int num = 0;
// old code
vDebug("parse");
- QCString s(strRep_);
+ Q3CString s(strRep_);
int i = s.find(QRegExp("BEGIN:VCARD", false));
while (i != -1) {
i = s.find(QRegExp("BEGIN:VCARD", false), 11);
- QCString cardStr(s.left(i));
+ Q3CString cardStr(s.left(i));
VCard * v = new VCard(cardStr);
cardList_.append(v);
v->parse();
s.remove(0, i);
}
#else
// this code is up to 17 (!) times faster
int start = 0;
QTime tim;
tim.start();
int i = 11;
int len = strRep_.length();
int num = 0;
while (i < len ) {
while( i < len ) {
int add = 1;
if ( strRep_.at(i) == 'B' ) {
if ( i+add < len && strRep_.at(i+add++) == 'E')
if ( i+add < len && strRep_.at(i+add++) == 'G')
if ( i+add < len && strRep_.at(i+add++) == 'I')
if ( i+add < len && strRep_.at(i+add++) == 'N')
if ( i+add < len && strRep_.at(i+add++) == ':')
if ( i+add < len && strRep_.at(i+add++) == 'V')
if ( i+add < len && strRep_.at(i+add++) == 'C')
if ( i+add < len && strRep_.at(i+add++) == 'A')
if ( i+add < len && strRep_.at(i+add++) == 'R')
if ( i+add < len && strRep_.at(i+add++) == 'D')
if ( i+add < len && (strRep_.at(i+add) == '\r' || strRep_.at(i+add) == '\n' ))
break;
}
++i;
}
if ( i <= len ) {
++num;
char* dat = strRep_.data()+start;
- VCard * v = new VCard( QCString ( dat,i-start ) );
+ VCard * v = new VCard( Q3CString ( dat,i-start ) );
start = i;
cardList_.append(v);
v->parse();
}
i+= 11;
}
#endif
//qDebug("***time %d found %d", tim.elapsed(), num);
}
void
VCardEntity::_assemble()
{
VCardListIterator it(cardList_);
for (; it.current(); ++it)
strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck.
}
VCardList &
VCardEntity::cardList()
{
parse();
return cardList_;
}
void
VCardEntity::setCardList(const VCardList & l)
{
parse();
//US cardList_ = l;
VCardListIterator it(l);
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp
index bad2ef1..5dd675d 100644
--- a/kabc/vcard/VCardv.cpp
+++ b/kabc/vcard/VCardv.cpp
@@ -1,144 +1,145 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <qstringlist.h>
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <VCardEntity.h>
#include <VCardVCard.h>
#include <VCardContentLine.h>
#include <VCardRToken.h>
#include <VCardDefines.h>
using namespace VCARD;
VCard::VCard()
: Entity()
{
contentLineList_.setAutoDelete( TRUE );
}
VCard::VCard(const VCard & x)
: Entity(x),
group_(x.group_)
{
contentLineList_.setAutoDelete( TRUE );
- QPtrListIterator<ContentLine> it(x.contentLineList_);
+ Q3PtrListIterator<ContentLine> it(x.contentLineList_);
for (; it.current(); ++it) {
ContentLine * c = new ContentLine(*it.current());
contentLineList_.append(c);
}
}
-VCard::VCard(const QCString & s)
+VCard::VCard(const Q3CString & s)
: Entity(s)
{
contentLineList_.setAutoDelete( TRUE );
}
VCard &
VCard::operator = (VCard & x)
{
if (*this == x) return *this;
group_ = x.group();
- QPtrListIterator<ContentLine> it(x.contentLineList_);
+ Q3PtrListIterator<ContentLine> it(x.contentLineList_);
for (; it.current(); ++it) {
ContentLine * c = new ContentLine(*it.current());
contentLineList_.append(c);
}
Entity::operator = (x);
return *this;
}
VCard &
-VCard::operator = (const QCString & s)
+VCard::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
VCard::operator == (VCard & x)
{
x.parse();
return false;
}
VCard::~VCard()
{
}
void
VCard::_parse()
{
QStringList l;
- QStrList sl;
+ Q3StrList sl;
RTokenise(strRep_, "\r\n", sl);
if (sl.count() < 3) { // Invalid VCARD !
//qDebug("invalid vcard ");
return;
}
- l = QStringList::fromStrList( sl );
+ for(Q3StrList::iterator i=sl.begin();i!=sl.end();++i)
+ l.push_back(*i);
// Get the first line
QString beginLine = l[0].stripWhiteSpace();
// Remove extra blank lines
while (l.last().isEmpty())
l.remove(l.last());
// Now we know this is the last line
QString endLine = l.last();
// Trash the first and last lines as we have seen them.
l.remove(l.begin());
l.remove(l.last());
///////////////////////////////////////////////////////////////
// FIRST LINE
int split = beginLine.find(':');
if (split == -1) { // invalid, no BEGIN
vDebug("No split");
return;
}
QString firstPart(beginLine.left(split));
QString valuePart(beginLine.mid(split + 1));
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.right(firstPart.length() - split - 1);
@@ -151,144 +152,144 @@ VCard::_parse()
if (valuePart.left(5) != "VCARD") { // Not a vcard !
qDebug("not a VCARD ");
return;
}
///////////////////////////////////////////////////////////////
// CONTENT LINES
//
vDebug("Content lines");
// Handle folded lines.
QStringList refolded;
QStringList::Iterator it = l.begin();
QString cur;
for (; it != l.end(); ++it) {
cur = (*it);
++it;
while ( it!= l.end() && (*it).at(0) == ' ' && (*it).length()!= 1) {
cur += (*it).mid(1) ;
++it;
}
--it;
refolded.append(cur);
}
QStringList::Iterator it2 = refolded.begin();
for (; it2 != refolded.end(); ++it2) {
- ContentLine * cl = new ContentLine(QCString((*it2).latin1()));
+ ContentLine * cl = new ContentLine(Q3CString((*it2).latin1()));
cl->parse();
if (cl->value() == 0)
{
qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1());
delete cl;
}
else
contentLineList_.append(cl);
}
///////////////////////////////////////////////////////////////
// LAST LINE
// LR: sorry, but the remaining code in this method makes no sense
#if 0
split = endLine.find(':');
if (split == -1) // invalid, no END
return;
firstPart = endLine.left(split);
valuePart = endLine.right(firstPart.length() - split - 1);
split = firstPart.find('.');
if (split != -1) {
group_ = firstPart.left(split);
firstPart = firstPart.right(firstPart.length() - split - 1);
}
if (qstricmp(firstPart, "END") != 0) // No END !
return;
if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard !
return;
#endif
}
void
VCard::_assemble()
{
vDebug("Assembling vcard");
strRep_ = "BEGIN:VCARD\r\n";
strRep_ += "VERSION:3.0\r\n";
- QPtrListIterator<ContentLine> it(contentLineList_);
+ Q3PtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
strRep_ += it.current()->asString() + "\r\n";
strRep_ += "END:VCARD\r\n";
}
bool
VCard::has(EntityType t)
{
parse();
return contentLine(t) == 0 ? false : true;
}
bool
-VCard::has(const QCString & s)
+VCard::has(const Q3CString & s)
{
parse();
return contentLine(s) == 0 ? false : true;
}
void
VCard::add(const ContentLine & cl)
{
parse();
ContentLine * c = new ContentLine(cl);
contentLineList_.append(c);
}
void
-VCard::add(const QCString & s)
+VCard::add(const Q3CString & s)
{
parse();
ContentLine * c = new ContentLine(s);
contentLineList_.append(c);
}
ContentLine *
VCard::contentLine(EntityType t)
{
parse();
- QPtrListIterator<ContentLine> it(contentLineList_);
+ Q3PtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
if (it.current()->entityType() == t)
return it.current();
return 0;
}
ContentLine *
-VCard::contentLine(const QCString & s)
+VCard::contentLine(const Q3CString & s)
{
parse();
- QPtrListIterator<ContentLine> it(contentLineList_);
+ Q3PtrListIterator<ContentLine> it(contentLineList_);
for (; it.current(); ++it)
if (it.current()->entityType() == EntityNameToEntityType(s))
return it.current();
return 0;
}
diff --git a/kabc/vcard/Value.cpp b/kabc/vcard/Value.cpp
index 1978af2..3a4d406 100644
--- a/kabc/vcard/Value.cpp
+++ b/kabc/vcard/Value.cpp
@@ -1,82 +1,84 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1998 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <VCardEntity.h>
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace VCARD;
Value::Value()
: Entity()
{
}
Value::Value(const Value & x)
: Entity(x)
{
}
-Value::Value(const QCString & s)
+Value::Value(const Q3CString & s)
: Entity(s)
{
}
Value &
Value::operator = (Value & x)
{
if (*this == x) return *this;
Entity::operator = (x);
return *this;
}
Value &
-Value::operator = (const QCString & s)
+Value::operator = (const Q3CString & s)
{
Entity::operator = (s);
return *this;
}
bool
Value::operator == (Value & x)
{
x.parse();
return false;
}
Value::~Value()
{
}
void
Value::_parse()
{
}
void
Value::_assemble()
{
//US vDebug("Value::_assemble()");
qDebug("Value::_assemble()");
}
diff --git a/kabc/vcard/include/VCardAdrParam.h b/kabc/vcard/include/VCardAdrParam.h
index 89dcb64..6456624 100644
--- a/kabc/vcard/include/VCardAdrParam.h
+++ b/kabc/vcard/include/VCardAdrParam.h
@@ -1,64 +1,64 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ADRPARAM_H
#define ADRPARAM_H
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <VCardParam.h>
namespace VCARD
{
class AdrParam : public Param
{
#include "AdrParam-generated.h"
- QStrList adrTypeList()
+ Q3StrList adrTypeList()
{ parse(); return adrTypeList_; }
- QCString textParam()
+ Q3CString textParam()
{ parse(); return textParam_; }
- void setAdrTypeList(const QStrList & l)
+ void setAdrTypeList(const Q3StrList & l)
{ adrTypeList_ = l; assembled_ = false; }
- void setTextParam(const QCString & s)
+ void setTextParam(const Q3CString & s)
{ textParam_ = s; assembled_ = false; }
enum AdrType {
AdrDom, AdrIntl, AdrPostal, AdrParcel, AdrHome, AdrWork, AdrPref,
AdrIANA, AdrX
};
private:
- QStrList adrTypeList_;
- QCString textParam_;
+ Q3StrList adrTypeList_;
+ Q3CString textParam_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardAdrValue.h b/kabc/vcard/include/VCardAdrValue.h
index 0731924..14ddb02 100644
--- a/kabc/vcard/include/VCardAdrValue.h
+++ b/kabc/vcard/include/VCardAdrValue.h
@@ -1,83 +1,85 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ADRVALUE_H
#define ADRVALUE_H
-#include <qstrlist.h>
+#include <q3strlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardValue.h>
namespace VCARD
{
class AdrValue : public Value
{
#include "AdrValue-generated.h"
AdrValue *clone();
- void setPOBox(const QCString & s)
+ void setPOBox(const Q3CString & s)
{ poBox_ = s; assembled_ = false; }
- void setExtAddress(const QCString & s)
+ void setExtAddress(const Q3CString & s)
{ extAddress_ = s; assembled_ = false; }
- void setStreet(const QCString & s)
+ void setStreet(const Q3CString & s)
{ street_ = s; assembled_ = false; }
- void setLocality(const QCString & s)
+ void setLocality(const Q3CString & s)
{ locality_ = s; assembled_ = false; }
- void setRegion(const QCString & s)
+ void setRegion(const Q3CString & s)
{ region_ = s; assembled_ = false; }
- void setPostCode(const QCString & s)
+ void setPostCode(const Q3CString & s)
{ postCode_ = s; assembled_ = false; }
- void setCountryName(const QCString & s)
+ void setCountryName(const Q3CString & s)
{ countryName_ = s; assembled_ = false; }
- QCString poBox() { parse(); return poBox_; }
- QCString extAddress() { parse(); return extAddress_; }
- QCString street() { parse(); return street_; }
- QCString locality() { parse(); return locality_; }
- QCString region() { parse(); return region_; }
- QCString postCode() { parse(); return postCode_; }
- QCString countryName() { parse(); return countryName_; }
+ Q3CString poBox() { parse(); return poBox_; }
+ Q3CString extAddress() { parse(); return extAddress_; }
+ Q3CString street() { parse(); return street_; }
+ Q3CString locality() { parse(); return locality_; }
+ Q3CString region() { parse(); return region_; }
+ Q3CString postCode() { parse(); return postCode_; }
+ Q3CString countryName() { parse(); return countryName_; }
private:
- QCString poBox_;
- QCString extAddress_;
- QCString street_;
- QCString locality_;
- QCString region_;
- QCString postCode_;
- QCString countryName_;
+ Q3CString poBox_;
+ Q3CString extAddress_;
+ Q3CString street_;
+ Q3CString locality_;
+ Q3CString region_;
+ Q3CString postCode_;
+ Q3CString countryName_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardAgentParam.h b/kabc/vcard/include/VCardAgentParam.h
index 72a05db..5733540 100644
--- a/kabc/vcard/include/VCardAgentParam.h
+++ b/kabc/vcard/include/VCardAgentParam.h
@@ -1,60 +1,60 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef AGENTPARAM_H
#define AGENTPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
#include <VCardURIValue.h>
namespace VCARD
{
class AgentParam : public Param
{
#include "AgentParam-generated.h"
bool refer()
{ parse(); return refer_; }
URIValue uri()
{ parse(); return uri_; }
void setRefer(bool b)
{ refer_ = b; assembled_ = false; }
- void setURI(const QCString & s)
+ void setURI(const Q3CString & s)
{ uri_ = s; assembled_ = false; }
private:
bool refer_;
URIValue uri_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardAgentValue.h b/kabc/vcard/include/VCardAgentValue.h
index f655836..b0d883b 100644
--- a/kabc/vcard/include/VCardAgentValue.h
+++ b/kabc/vcard/include/VCardAgentValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef AGENTVALUE_H
#define AGENTVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class AgentValue : public Value
{
#include "AgentValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardClassValue.h b/kabc/vcard/include/VCardClassValue.h
index ff133c2..c450169 100644
--- a/kabc/vcard/include/VCardClassValue.h
+++ b/kabc/vcard/include/VCardClassValue.h
@@ -1,56 +1,56 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef CLASSVALUE_H
#define CLASSVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
#include <kdebug.h>
namespace VCARD
{
class ClassValue : public Value
{
#include "ClassValue-generated.h"
enum ClassType {
Public, Private, Confidential, Other
};
ClassValue *clone();
void setType( int type ) { classType_ = type; assembled_ = false; parsed_ = true; }
int type() { parse(); return classType_; }
private:
int classType_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardContentLine.h b/kabc/vcard/include/VCardContentLine.h
index 1c5f5be..c3c5253 100644
--- a/kabc/vcard/include/VCardContentLine.h
+++ b/kabc/vcard/include/VCardContentLine.h
@@ -1,77 +1,79 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef CONTENTLINE_H
#define CONTENTLINE_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "VCardEnum.h"
#include "VCardEntity.h"
#include "VCardParam.h"
#include "VCardValue.h"
namespace VCARD
{
class ContentLine : public Entity
{
#include "ContentLine-generated.h"
- QCString group() { parse(); return group_; }
- QCString name() { parse(); return name_; }
+ Q3CString group() { parse(); return group_; }
+ Q3CString name() { parse(); return name_; }
Value * value() { parse(); return value_; }
ParamList paramList() { parse(); return paramList_; }
ParamType paramType() { parse(); return paramType_; }
ValueType valueType() { parse(); return valueType_; }
EntityType entityType() { parse(); return entityType_; }
- void setGroup (const QCString & s)
+ void setGroup (const Q3CString & s)
{ group_ = s; assembled_ = false; }
- void setName (const QCString & s)
+ void setName (const Q3CString & s)
{ name_ = s; assembled_ = false; }
void setValue (Value *s)
{ value_ = s; assembled_ = false; }
void setParamList (const ParamList & l)
{ paramList_ = l; assembled_ = false; }
void clear ();
private:
- QCString group_;
- QCString name_;
- QPtrList<Param> paramList_;
+ Q3CString group_;
+ Q3CString name_;
+ Q3PtrList<Param> paramList_;
Value * value_;
ParamType paramType_;
ValueType valueType_;
EntityType entityType_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardDateParam.h b/kabc/vcard/include/VCardDateParam.h
index 21ac1f1..959b75b 100644
--- a/kabc/vcard/include/VCardDateParam.h
+++ b/kabc/vcard/include/VCardDateParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DATEPARAM_H
#define DATEPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class DateParam : public Param
{
#include "DateParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardDateValue.h b/kabc/vcard/include/VCardDateValue.h
index c248966..fc216c0 100644
--- a/kabc/vcard/include/VCardDateValue.h
+++ b/kabc/vcard/include/VCardDateValue.h
@@ -1,59 +1,59 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DATEVALUE_H
#define DATEVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <qdatetime.h>
#include <VCardValue.h>
namespace VCARD
{
class DateValue : public Value
{
#include "DateValue-generated.h"
DateValue(
unsigned int year,
unsigned int month,
unsigned int day,
unsigned int hour = 0,
unsigned int minute = 0,
unsigned int second = 0,
double secFrac = 0,
bool zonePositive = true,
unsigned int zoneHour = 0,
unsigned int zoneMinute = 0);
DateValue(const QDate &);
DateValue(const QDateTime &);
DateValue *clone();
bool hasTime();
unsigned int year();
unsigned int month();
diff --git a/kabc/vcard/include/VCardDefines.h b/kabc/vcard/include/VCardDefines.h
index 557410f..5d4f2f4 100644
--- a/kabc/vcard/include/VCardDefines.h
+++ b/kabc/vcard/include/VCardDefines.h
@@ -6,48 +6,48 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VCARD_DEFINES_H
#define VCARD_DEFINES_H
#include <kdebug.h>
#ifdef VCARD_DEBUG
//US #define vDebug(a) kdDebug(5710) << a << endl;
#define vDebug(a) qDebug(a);
#else
#define vDebug(a)
#endif
#if 0
#ifndef NDEBUG
-# include <qcstring.h>
+# include <q3cstring.h>
# include <iostream>
# ifdef __GNUG__
# define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \
- << __LINE__ << "): " << QCString((a)).data() << endl;
+ << __LINE__ << "): " << Q3CString((a)).data() << endl;
# else
# define vDebug(a) cerr << className() << ": " \
- << QCString((a)).data() << endl;
+ << Q3CString((a)).data() << endl;
# endif
#else
# define vDebug(a)
#endif
#endif
#endif // Included this file
diff --git a/kabc/vcard/include/VCardEmailParam.h b/kabc/vcard/include/VCardEmailParam.h
index 98d1b30..ff07324 100644
--- a/kabc/vcard/include/VCardEmailParam.h
+++ b/kabc/vcard/include/VCardEmailParam.h
@@ -1,56 +1,56 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef EMAILPARAM_H
#define EMAILPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class EmailParam : public Param
{
#include "EmailParam-generated.h"
- QCString emailType() { parse(); return emailType_; }
+ Q3CString emailType() { parse(); return emailType_; }
bool pref() { parse(); return pref_; }
- void setEmailType(const QCString & s)
+ void setEmailType(const Q3CString & s)
{ emailType_ = s; assembled_ = false; }
void setPref(bool b)
{ pref_ = b; assembled_ = false; }
private:
- QCString emailType_;
+ Q3CString emailType_;
bool pref_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardEntity.h b/kabc/vcard/include/VCardEntity.h
index 3c945b5..1a3d20f 100644
--- a/kabc/vcard/include/VCardEntity.h
+++ b/kabc/vcard/include/VCardEntity.h
@@ -1,67 +1,67 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ENTITY_H
#define ENTITY_H
-#include <qcstring.h>
+#include <q3cstring.h>
namespace VCARD
{
class Entity
{
public:
Entity();
Entity(const Entity & e);
- Entity(const QCString & s);
+ Entity(const Q3CString & s);
virtual Entity & operator = (const Entity & e);
- virtual Entity & operator = (const QCString & s);
+ virtual Entity & operator = (const Q3CString & s);
virtual bool operator == (Entity & e);
virtual bool operator != (Entity & e);
- virtual bool operator == (const QCString & s);
- virtual bool operator != (const QCString & s);
+ virtual bool operator == (const Q3CString & s);
+ virtual bool operator != (const Q3CString & s);
virtual ~Entity();
- QCString asString();
+ Q3CString asString();
virtual void parse();
virtual void assemble();
virtual void _parse() = 0;
virtual void _assemble() = 0;
protected:
- QCString strRep_;
+ Q3CString strRep_;
bool parsed_;
bool assembled_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardEnum.h b/kabc/vcard/include/VCardEnum.h
index b4e4094..0c35e5e 100644
--- a/kabc/vcard/include/VCardEnum.h
+++ b/kabc/vcard/include/VCardEnum.h
@@ -1,64 +1,64 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ENUM_H
#define ENUM_H
-#include <qcstring.h>
+#include <q3cstring.h>
namespace VCARD
{
-extern const QCString paramNames [];
+extern const Q3CString paramNames [];
enum EntityType {
EntityName,
EntityProfile,
EntitySource,
EntityFullName,
EntityN,
EntityNickname,
EntityPhoto,
EntityBirthday,
EntityAddress,
EntityLabel,
EntityTelephone,
EntityEmail,
EntityMailer,
EntityTimeZone,
EntityGeo,
EntityTitle,
EntityRole,
EntityLogo,
EntityAgent,
EntityOrganisation,
EntityCategories,
EntityNote,
EntityProductID,
EntityRevision,
EntitySortString,
EntitySound,
EntityUID,
EntityURL,
EntityVersion,
EntityClass,
@@ -79,42 +79,42 @@ enum ValueType {
ValueURI,
ValueClass,
ValueFloat,
ValueImage,
ValueDate,
ValueTextList,
ValueText,
ValueGeo,
ValueUnknown
};
enum ParamType {
ParamUnknown,
ParamNone,
ParamSource,
ParamText,
ParamImage,
ParamDate,
ParamAddrText,
ParamTel,
ParamEmail,
ParamMailer,
ParamAgent,
ParamTextBin,
ParamTextNS,
ParamSound
};
extern const ParamType paramTypesTable[];
ParamType EntityTypeToParamType(EntityType);
ValueType EntityTypeToValueType(EntityType);
-QCString EntityTypeToParamName(EntityType);
-EntityType EntityNameToEntityType(const QCString &);
+Q3CString EntityTypeToParamName(EntityType);
+EntityType EntityNameToEntityType(const Q3CString &);
char * encodeBase64(const char *, unsigned long, unsigned long &);
char * decodeBase64(const char *, unsigned long, unsigned long &);
}
#endif
diff --git a/kabc/vcard/include/VCardFloatValue.h b/kabc/vcard/include/VCardFloatValue.h
index 69fdc22..cac7a91 100644
--- a/kabc/vcard/include/VCardFloatValue.h
+++ b/kabc/vcard/include/VCardFloatValue.h
@@ -1,51 +1,51 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef FLOATVALUE_H
#define FLOATVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class FloatValue : public Value
{
#include "FloatValue-generated.h"
FloatValue(float);
float value();
void setValue(float);
private:
float value_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardImageParam.h b/kabc/vcard/include/VCardImageParam.h
index ce99ccc..2785331 100644
--- a/kabc/vcard/include/VCardImageParam.h
+++ b/kabc/vcard/include/VCardImageParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef IMGPARAM_H
#define IMGPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class ImageParam : public Param
{
#include "ImageParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardImageValue.h b/kabc/vcard/include/VCardImageValue.h
index 6ce0371..3b64731 100644
--- a/kabc/vcard/include/VCardImageValue.h
+++ b/kabc/vcard/include/VCardImageValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef IMAGEVALUE_H
#define IMAGEVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class ImageValue : public Value
{
#include "ImageValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardLangValue.h b/kabc/vcard/include/VCardLangValue.h
index 991ceed..319de76 100644
--- a/kabc/vcard/include/VCardLangValue.h
+++ b/kabc/vcard/include/VCardLangValue.h
@@ -1,51 +1,51 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef LANGVALUE_H
#define LANGVALUE_H
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <VCardValue.h>
namespace VCARD
{
class LangValue : public Value
{
#include "LangValue-generated.h"
- QCString primary();
- QStrList subtags();
+ Q3CString primary();
+ Q3StrList subtags();
- void setPrimary(const QCString &);
- void setSubTags(const QStrList &);
+ void setPrimary(const Q3CString &);
+ void setSubTags(const Q3StrList &);
- QCString primary_;
- QStrList subtags_;
+ Q3CString primary_;
+ Q3StrList subtags_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardNValue.h b/kabc/vcard/include/VCardNValue.h
index 306821b..ffc5355 100644
--- a/kabc/vcard/include/VCardNValue.h
+++ b/kabc/vcard/include/VCardNValue.h
@@ -1,56 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef NVALUE_H
#define NVALUE_H
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace VCARD
{
class NValue : public Value
{
#include "NValue-generated.h"
NValue *clone();
- QCString family() { parse(); return family_; }
- QCString given() { parse(); return given_; }
- QCString middle() { parse(); return middle_; }
- QCString prefix() { parse(); return prefix_; }
- QCString suffix() { parse(); return suffix_; }
-
- void setFamily (const QCString & s) { family_ = s; assembled_ = false; }
- void setGiven (const QCString & s) { given_ = s; assembled_ = false; }
- void setMiddle (const QCString & s) { middle_ = s; assembled_ = false; }
- void setPrefix (const QCString & s) { prefix_ = s; assembled_ = false; }
- void setSuffix (const QCString & s) { suffix_ = s; assembled_ = false; }
+ Q3CString family() { parse(); return family_; }
+ Q3CString given() { parse(); return given_; }
+ Q3CString middle() { parse(); return middle_; }
+ Q3CString prefix() { parse(); return prefix_; }
+ Q3CString suffix() { parse(); return suffix_; }
+
+ void setFamily (const Q3CString & s) { family_ = s; assembled_ = false; }
+ void setGiven (const Q3CString & s) { given_ = s; assembled_ = false; }
+ void setMiddle (const Q3CString & s) { middle_ = s; assembled_ = false; }
+ void setPrefix (const Q3CString & s) { prefix_ = s; assembled_ = false; }
+ void setSuffix (const Q3CString & s) { suffix_ = s; assembled_ = false; }
private:
- QCString family_, given_, middle_, prefix_, suffix_;
+ Q3CString family_, given_, middle_, prefix_, suffix_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardOrgValue.h b/kabc/vcard/include/VCardOrgValue.h
index c4f3f25..2e5d32f 100644
--- a/kabc/vcard/include/VCardOrgValue.h
+++ b/kabc/vcard/include/VCardOrgValue.h
@@ -1,50 +1,50 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ORGVALUE_H
#define ORGVALUE_H
-#include <qcstring.h>
-#include <qstrlist.h>
+#include <q3cstring.h>
+#include <q3strlist.h>
#include <VCardValue.h>
namespace VCARD
{
class OrgValue : public Value
{
#include "OrgValue-generated.h"
unsigned int numValues();
- QCString value(unsigned int);
+ Q3CString value(unsigned int);
private:
- QStrList valueList_;
+ Q3StrList valueList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardParam.h b/kabc/vcard/include/VCardParam.h
index b61ce5c..b83fde1 100644
--- a/kabc/vcard/include/VCardParam.h
+++ b/kabc/vcard/include/VCardParam.h
@@ -1,59 +1,59 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PARAM_H
#define PARAM_H
-#include <qcstring.h>
-#include <qptrlist.h>
+#include <q3cstring.h>
+#include <q3ptrlist.h>
#include <VCardEntity.h>
namespace VCARD
{
class Param : public Entity
{
#include "Param-generated.h"
- Param(const QCString &name, const QCString &value);
+ Param(const Q3CString &name, const Q3CString &value);
- void setName(const QCString &);
- void setValue(const QCString &);
+ void setName(const Q3CString &);
+ void setValue(const Q3CString &);
- QCString name();
- QCString value();
+ Q3CString name();
+ Q3CString value();
private:
- QCString name_;
- QCString value_;
+ Q3CString name_;
+ Q3CString value_;
};
-typedef QPtrList<Param> ParamList;
-typedef QPtrListIterator<Param> ParamListIterator;
+typedef Q3PtrList<Param> ParamList;
+typedef Q3PtrListIterator<Param> ParamListIterator;
}
#endif
diff --git a/kabc/vcard/include/VCardRToken.h b/kabc/vcard/include/VCardRToken.h
index 2f95f1b..4a5adb2 100644
--- a/kabc/vcard/include/VCardRToken.h
+++ b/kabc/vcard/include/VCardRToken.h
@@ -1,38 +1,38 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef RTOKEN_H
#define RTOKEN_H
-#include <qstrlist.h>
+#include <q3strlist.h>
namespace VCARD
{
-Q_UINT32 RTokenise(const char * str, const char * delim, QStrList & l);
+Q_UINT32 RTokenise(const char * str, const char * delim, Q3StrList & l);
}
#endif
diff --git a/kabc/vcard/include/VCardSoundValue.h b/kabc/vcard/include/VCardSoundValue.h
index 994f55e..26f750b 100644
--- a/kabc/vcard/include/VCardSoundValue.h
+++ b/kabc/vcard/include/VCardSoundValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SOUNDVALUE_H
#define SOUNDVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class SoundValue : public Value
{
#include "SoundValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardSourceParam.h b/kabc/vcard/include/VCardSourceParam.h
index 887ea20..5218864 100644
--- a/kabc/vcard/include/VCardSourceParam.h
+++ b/kabc/vcard/include/VCardSourceParam.h
@@ -1,58 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SOURCEPARAM_H
#define SOURCEPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class SourceParam : public Param
{
#include "SourceParam-generated.h"
enum SourceParamType { TypeUnknown, TypeValue, TypeContext, TypeX };
SourceParamType type() { parse(); return type_;}
- QCString par() { parse(); return par_; }
- QCString val() { parse(); return val_; }
+ Q3CString par() { parse(); return par_; }
+ Q3CString val() { parse(); return val_; }
void setType(SourceParamType t) { type_ = t; assembled_ = false; }
- void setPar(const QCString & s) { par_ = s; assembled_ = false; }
- void setVal(const QCString & s) { val_ = s; assembled_ = false; }
+ void setPar(const Q3CString & s) { par_ = s; assembled_ = false; }
+ void setVal(const Q3CString & s) { val_ = s; assembled_ = false; }
private:
SourceParamType type_;
// May be "VALUE = uri" or "CONTEXT = word" or "x-name = *SAFE-CHAR"
- QCString par_, val_; // Sub-parameter, value
+ Q3CString par_, val_; // Sub-parameter, value
};
}
#endif
diff --git a/kabc/vcard/include/VCardTelParam.h b/kabc/vcard/include/VCardTelParam.h
index 27d7dcc..0c45a3a 100644
--- a/kabc/vcard/include/VCardTelParam.h
+++ b/kabc/vcard/include/VCardTelParam.h
@@ -1,51 +1,53 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TELPARAM_H
#define TELPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <VCardParam.h>
namespace VCARD
{
class TelParam : public Param
{
#include "TelParam-generated.h"
enum TelType {
TelHome, TelWork, TelPref, TelVoice, TelFex, TelMsg, TelCell,
TelPager, TelBBS, TelModem, TelCar, TelISDN, TelVideo, TelPCS,
TelIANA, TelX
};
private:
- QPtrList<TelType> types_;
+ Q3PtrList<TelType> types_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardTelValue.h b/kabc/vcard/include/VCardTelValue.h
index 9cf5a98..a119e4a 100644
--- a/kabc/vcard/include/VCardTelValue.h
+++ b/kabc/vcard/include/VCardTelValue.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TELVALUE_H
#define TELVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class TelValue : public Value
{
#include "TelValue-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextBinParam.h b/kabc/vcard/include/VCardTextBinParam.h
index 31dec86..d186995 100644
--- a/kabc/vcard/include/VCardTextBinParam.h
+++ b/kabc/vcard/include/VCardTextBinParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTBINPARAM_H
#define TEXTBINPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class TextBinParam : public Param
{
#include "TextBinParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextBinValue.h b/kabc/vcard/include/VCardTextBinValue.h
index 8d44fdf..3924f2a 100644
--- a/kabc/vcard/include/VCardTextBinValue.h
+++ b/kabc/vcard/include/VCardTextBinValue.h
@@ -1,59 +1,59 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTBINVALUE_H
#define TEXTBINVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class TextBinValue : public Value
{
#include "TextBinValue-generated.h"
TextBinValue *clone();
bool isBinary() { parse(); return mIsBinary_; }
QByteArray data() { parse(); return mData_; }
QString url() { parse(); return mUrl_; }
void setData( const QByteArray &data )
{
mData_ = data;
mIsBinary_ = true;
assembled_ = false;
}
void setUrl( const QString &url )
{
mUrl_ = url;
mIsBinary_ = false;
assembled_ = false;
}
private:
diff --git a/kabc/vcard/include/VCardTextListValue.h b/kabc/vcard/include/VCardTextListValue.h
index 8e47af5..ac42a29 100644
--- a/kabc/vcard/include/VCardTextListValue.h
+++ b/kabc/vcard/include/VCardTextListValue.h
@@ -1,51 +1,51 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTLISTVALUE_H
#define TEXTLISTVALUE_H
-#include <qstrlist.h>
+#include <q3strlist.h>
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class TextListValue : public Value
{
#include "TextListValue-generated.h"
unsigned int numValues();
- QCString value(unsigned int);
+ Q3CString value(unsigned int);
private:
- QStrList valueList_;
+ Q3StrList valueList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardTextParam.h b/kabc/vcard/include/VCardTextParam.h
index 08b5f57..2503337 100644
--- a/kabc/vcard/include/VCardTextParam.h
+++ b/kabc/vcard/include/VCardTextParam.h
@@ -1,44 +1,44 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXTPARAM_H
#define TEXTPARAM_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardParam.h>
namespace VCARD
{
class TextParam : public Param
{
#include "TextParam-generated.h"
private:
};
}
#endif
diff --git a/kabc/vcard/include/VCardURIValue.h b/kabc/vcard/include/VCardURIValue.h
index 5fd7184..116e4c8 100644
--- a/kabc/vcard/include/VCardURIValue.h
+++ b/kabc/vcard/include/VCardURIValue.h
@@ -1,52 +1,54 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef URIVALUE_H
#define URIVALUE_H
#include <VCardValue.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace VCARD
{
class URIValue : public Value
{
#include "URIValue-generated.h"
- URIValue(const QCString & scheme, const QCString & schemeSpecificPart);
+ URIValue(const Q3CString & scheme, const Q3CString & schemeSpecificPart);
- QCString scheme();
- QCString schemeSpecificPart();
+ Q3CString scheme();
+ Q3CString schemeSpecificPart();
- void setScheme (const QCString &);
- void setSchemeSpecificPart (const QCString &);
+ void setScheme (const Q3CString &);
+ void setSchemeSpecificPart (const Q3CString &);
private:
- QCString scheme_;
- QCString schemeSpecificPart_;
+ Q3CString scheme_;
+ Q3CString schemeSpecificPart_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardUTCValue.h b/kabc/vcard/include/VCardUTCValue.h
index ff695e0..eb69829 100644
--- a/kabc/vcard/include/VCardUTCValue.h
+++ b/kabc/vcard/include/VCardUTCValue.h
@@ -1,58 +1,58 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef UTCVALUE_H
#define UTCVALUE_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <VCardValue.h>
namespace VCARD
{
class UTCValue : public Value
{
#include "UTCValue-generated.h"
UTCValue *clone();
void setPositive( int p ) { positive_ = p; assembled_ = false; }
void setHour( int h ) { hour_ = h; assembled_ = false; }
void setMinute( int m ) { minute_ = m; assembled_ = false; }
bool positive() { parse(); return positive_; }
unsigned int hour() { parse(); return hour_; }
unsigned int minute() { parse(); return minute_; }
private:
bool positive_;
unsigned int hour_;
unsigned int minute_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardVCard.h b/kabc/vcard/include/VCardVCard.h
index 5dec166..5b66074 100644
--- a/kabc/vcard/include/VCardVCard.h
+++ b/kabc/vcard/include/VCardVCard.h
@@ -1,63 +1,65 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VCARD_VCARD_H
#define VCARD_VCARD_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCardEnum.h>
#include <VCardEntity.h>
#include <VCardContentLine.h>
namespace VCARD
{
class VCard : public Entity
{
#include "VCard-generated.h"
bool has(EntityType);
- bool has(const QCString &);
+ bool has(const Q3CString &);
void add(const ContentLine &);
- void add(const QCString &);
+ void add(const Q3CString &);
ContentLine * contentLine(EntityType);
- ContentLine * contentLine(const QCString &);
+ ContentLine * contentLine(const Q3CString &);
- QCString group() { parse(); return group_; }
+ Q3CString group() { parse(); return group_; }
- QPtrList<ContentLine> contentLineList() { parse(); return contentLineList_; }
+ Q3PtrList<ContentLine> contentLineList() { parse(); return contentLineList_; }
private:
- QCString group_;
- QPtrList<ContentLine> contentLineList_;
+ Q3CString group_;
+ Q3PtrList<ContentLine> contentLineList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardVCardEntity.h b/kabc/vcard/include/VCardVCardEntity.h
index 47ba370..8c824e7 100644
--- a/kabc/vcard/include/VCardVCardEntity.h
+++ b/kabc/vcard/include/VCardVCardEntity.h
@@ -1,56 +1,56 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VCARD_ENTITY_H
#define VCARD_ENTITY_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <VCardEnum.h>
#include <VCardVCard.h>
#include <VCardEntity.h>
namespace VCARD
{
-typedef QPtrList<VCard> VCardList;
-typedef QPtrListIterator<VCard> VCardListIterator;
+typedef Q3PtrList<VCard> VCardList;
+typedef Q3PtrListIterator<VCard> VCardListIterator;
class VCardEntity : public Entity
{
#include "VCardEntity-generated.h"
void setCardList(const VCardList & l);
VCardList & cardList();
private:
VCardList cardList_;
};
}
#endif
diff --git a/kabc/vcard/include/VCardValue.h b/kabc/vcard/include/VCardValue.h
index 7cfe4a0..024397c 100644
--- a/kabc/vcard/include/VCardValue.h
+++ b/kabc/vcard/include/VCardValue.h
@@ -1,46 +1,46 @@
/*
libvcard - vCard parsing library for vCard version 3.0
Copyright (C) 1999 Rik Hemsley rik@kde.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VALUE_H
#define VALUE_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <VCardEntity.h>
namespace VCARD
{
class Value : public Entity
{
#include "Value-generated.h"
virtual Value *clone() { return new Value( *this ); }
};
-typedef QPtrList<Value> ValueList;
-typedef QPtrListIterator<Value> ValueListIterator;
+typedef Q3PtrList<Value> ValueList;
+typedef Q3PtrListIterator<Value> ValueListIterator;
}
#endif
diff --git a/kabc/vcard/include/generated/AdrParam-generated.h b/kabc/vcard/include/generated/AdrParam-generated.h
index 3e265d8..a11d142 100644
--- a/kabc/vcard/include/generated/AdrParam-generated.h
+++ b/kabc/vcard/include/generated/AdrParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AdrParam();
AdrParam(const AdrParam&);
-AdrParam(const QCString&);
+AdrParam(const Q3CString&);
AdrParam & operator = (AdrParam&);
-AdrParam & operator = (const QCString&);
+AdrParam & operator = (const Q3CString&);
bool operator ==(AdrParam&);
bool operator !=(AdrParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AdrParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AdrParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AdrParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AdrParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/AdrValue-generated.h b/kabc/vcard/include/generated/AdrValue-generated.h
index e1d93e4..c0a33a3 100644
--- a/kabc/vcard/include/generated/AdrValue-generated.h
+++ b/kabc/vcard/include/generated/AdrValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AdrValue();
AdrValue(const AdrValue&);
-AdrValue(const QCString&);
+AdrValue(const Q3CString&);
AdrValue & operator = (AdrValue&);
-AdrValue & operator = (const QCString&);
+AdrValue & operator = (const Q3CString&);
bool operator ==(AdrValue&);
bool operator !=(AdrValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AdrValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AdrValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AdrValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AdrValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/AgentParam-generated.h b/kabc/vcard/include/generated/AgentParam-generated.h
index 6423867..d5ed988 100644
--- a/kabc/vcard/include/generated/AgentParam-generated.h
+++ b/kabc/vcard/include/generated/AgentParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AgentParam();
AgentParam(const AgentParam&);
-AgentParam(const QCString&);
+AgentParam(const Q3CString&);
AgentParam & operator = (AgentParam&);
-AgentParam & operator = (const QCString&);
+AgentParam & operator = (const Q3CString&);
bool operator ==(AgentParam&);
bool operator !=(AgentParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AgentParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AgentParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AgentParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AgentParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/AgentValue-generated.h b/kabc/vcard/include/generated/AgentValue-generated.h
index 76bb81c..eef5277 100644
--- a/kabc/vcard/include/generated/AgentValue-generated.h
+++ b/kabc/vcard/include/generated/AgentValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
AgentValue();
AgentValue(const AgentValue&);
-AgentValue(const QCString&);
+AgentValue(const Q3CString&);
AgentValue & operator = (AgentValue&);
-AgentValue & operator = (const QCString&);
+AgentValue & operator = (const Q3CString&);
bool operator ==(AgentValue&);
bool operator !=(AgentValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {AgentValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {AgentValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~AgentValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "AgentValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ClassValue-generated.h b/kabc/vcard/include/generated/ClassValue-generated.h
index df4ed5f..b84c98f 100644
--- a/kabc/vcard/include/generated/ClassValue-generated.h
+++ b/kabc/vcard/include/generated/ClassValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ClassValue();
ClassValue(const ClassValue&);
-ClassValue(const QCString&);
+ClassValue(const Q3CString&);
ClassValue & operator = (ClassValue&);
-ClassValue & operator = (const QCString&);
+ClassValue & operator = (const Q3CString&);
bool operator ==(ClassValue&);
bool operator !=(ClassValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ClassValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ClassValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ClassValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ClassValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ContentLine-generated.h b/kabc/vcard/include/generated/ContentLine-generated.h
index 9efe273..84d0822 100644
--- a/kabc/vcard/include/generated/ContentLine-generated.h
+++ b/kabc/vcard/include/generated/ContentLine-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ContentLine();
ContentLine(const ContentLine&);
-ContentLine(const QCString&);
+ContentLine(const Q3CString&);
ContentLine & operator = (ContentLine&);
-ContentLine & operator = (const QCString&);
+ContentLine & operator = (const Q3CString&);
bool operator ==(ContentLine&);
bool operator !=(ContentLine& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ContentLine a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ContentLine a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ContentLine();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ContentLine"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/DateParam-generated.h b/kabc/vcard/include/generated/DateParam-generated.h
index ff1da58..029c1da 100644
--- a/kabc/vcard/include/generated/DateParam-generated.h
+++ b/kabc/vcard/include/generated/DateParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
DateParam();
DateParam(const DateParam&);
-DateParam(const QCString&);
+DateParam(const Q3CString&);
DateParam & operator = (DateParam&);
-DateParam & operator = (const QCString&);
+DateParam & operator = (const Q3CString&);
bool operator ==(DateParam&);
bool operator !=(DateParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {DateParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {DateParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~DateParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "DateParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/DateValue-generated.h b/kabc/vcard/include/generated/DateValue-generated.h
index a382823..70eecce 100644
--- a/kabc/vcard/include/generated/DateValue-generated.h
+++ b/kabc/vcard/include/generated/DateValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
DateValue();
DateValue(const DateValue&);
-DateValue(const QCString&);
+DateValue(const Q3CString&);
DateValue & operator = (DateValue&);
-DateValue & operator = (const QCString&);
+DateValue & operator = (const Q3CString&);
bool operator ==(DateValue&);
bool operator !=(DateValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {DateValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {DateValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~DateValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "DateValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/EmailParam-generated.h b/kabc/vcard/include/generated/EmailParam-generated.h
index 428a6fc..f498931 100644
--- a/kabc/vcard/include/generated/EmailParam-generated.h
+++ b/kabc/vcard/include/generated/EmailParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
EmailParam();
EmailParam(const EmailParam&);
-EmailParam(const QCString&);
+EmailParam(const Q3CString&);
EmailParam & operator = (EmailParam&);
-EmailParam & operator = (const QCString&);
+EmailParam & operator = (const Q3CString&);
bool operator ==(EmailParam&);
bool operator !=(EmailParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {EmailParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {EmailParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~EmailParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "EmailParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/FloatValue-generated.h b/kabc/vcard/include/generated/FloatValue-generated.h
index cac55cf..c04b85f 100644
--- a/kabc/vcard/include/generated/FloatValue-generated.h
+++ b/kabc/vcard/include/generated/FloatValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
FloatValue();
FloatValue(const FloatValue&);
-FloatValue(const QCString&);
+FloatValue(const Q3CString&);
FloatValue & operator = (FloatValue&);
-FloatValue & operator = (const QCString&);
+FloatValue & operator = (const Q3CString&);
bool operator ==(FloatValue&);
bool operator !=(FloatValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {FloatValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {FloatValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~FloatValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "FloatValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/GeoValue-generated.h b/kabc/vcard/include/generated/GeoValue-generated.h
index 594f3ad..ab659bf 100644
--- a/kabc/vcard/include/generated/GeoValue-generated.h
+++ b/kabc/vcard/include/generated/GeoValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
GeoValue();
GeoValue(const GeoValue&);
-GeoValue(const QCString&);
+GeoValue(const Q3CString&);
GeoValue & operator = (GeoValue&);
-GeoValue & operator = (const QCString&);
+GeoValue & operator = (const Q3CString&);
bool operator ==(GeoValue&);
bool operator !=(GeoValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {GeoValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {GeoValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~GeoValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "GeoValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Group-generated.h b/kabc/vcard/include/generated/Group-generated.h
index f39302d..ae16e3d 100644
--- a/kabc/vcard/include/generated/Group-generated.h
+++ b/kabc/vcard/include/generated/Group-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
Group();
Group(const Group&);
-Group(const QCString&);
+Group(const Q3CString&);
Group & operator = (Group&);
-Group & operator = (const QCString&);
+Group & operator = (const Q3CString&);
bool operator ==(Group&);
bool operator !=(Group& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {Group a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {Group a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~Group();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "Group"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImageParam-generated.h b/kabc/vcard/include/generated/ImageParam-generated.h
index 81edfd2..91b09a4 100644
--- a/kabc/vcard/include/generated/ImageParam-generated.h
+++ b/kabc/vcard/include/generated/ImageParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImageParam();
ImageParam(const ImageParam&);
-ImageParam(const QCString&);
+ImageParam(const Q3CString&);
ImageParam & operator = (ImageParam&);
-ImageParam & operator = (const QCString&);
+ImageParam & operator = (const Q3CString&);
bool operator ==(ImageParam&);
bool operator !=(ImageParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImageParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImageParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImageParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ImageParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImageValue-generated.h b/kabc/vcard/include/generated/ImageValue-generated.h
index 5a2c493..d71282e 100644
--- a/kabc/vcard/include/generated/ImageValue-generated.h
+++ b/kabc/vcard/include/generated/ImageValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImageValue();
ImageValue(const ImageValue&);
-ImageValue(const QCString&);
+ImageValue(const Q3CString&);
ImageValue & operator = (ImageValue&);
-ImageValue & operator = (const QCString&);
+ImageValue & operator = (const Q3CString&);
bool operator ==(ImageValue&);
bool operator !=(ImageValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImageValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImageValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImageValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "ImageValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImgParam-generated.h b/kabc/vcard/include/generated/ImgParam-generated.h
index 46a6ca0..461ca6d 100644
--- a/kabc/vcard/include/generated/ImgParam-generated.h
+++ b/kabc/vcard/include/generated/ImgParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImgParam();
ImgParam(const ImgParam&);
-ImgParam(const QCString&);
+ImgParam(const Q3CString&);
ImgParam & operator = (ImgParam&);
-ImgParam & operator = (const QCString&);
+ImgParam & operator = (const Q3CString&);
bool operator ==(ImgParam&);
bool operator !=(ImgParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImgParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImgParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImgParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
virtual const char * className() const { return "ImgParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ImgValue-generated.h b/kabc/vcard/include/generated/ImgValue-generated.h
index d75d545..80ee646 100644
--- a/kabc/vcard/include/generated/ImgValue-generated.h
+++ b/kabc/vcard/include/generated/ImgValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
ImgValue();
ImgValue(const ImgValue&);
-ImgValue(const QCString&);
+ImgValue(const Q3CString&);
ImgValue & operator = (ImgValue&);
-ImgValue & operator = (const QCString&);
+ImgValue & operator = (const Q3CString&);
bool operator ==(ImgValue&);
bool operator !=(ImgValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {ImgValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {ImgValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~ImgValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
virtual const char * className() const { return "ImgValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/LangValue-generated.h b/kabc/vcard/include/generated/LangValue-generated.h
index 23e138b..434f762 100644
--- a/kabc/vcard/include/generated/LangValue-generated.h
+++ b/kabc/vcard/include/generated/LangValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
LangValue();
LangValue(const LangValue&);
-LangValue(const QCString&);
+LangValue(const Q3CString&);
LangValue & operator = (LangValue&);
-LangValue & operator = (const QCString&);
+LangValue & operator = (const Q3CString&);
bool operator ==(LangValue&);
bool operator !=(LangValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {LangValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {LangValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~LangValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "LangValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/NValue-generated.h b/kabc/vcard/include/generated/NValue-generated.h
index 082c253..086810f 100644
--- a/kabc/vcard/include/generated/NValue-generated.h
+++ b/kabc/vcard/include/generated/NValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
NValue();
NValue(const NValue&);
-NValue(const QCString&);
+NValue(const Q3CString&);
NValue & operator = (NValue&);
-NValue & operator = (const QCString&);
+NValue & operator = (const Q3CString&);
bool operator ==(NValue&);
bool operator !=(NValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {NValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {NValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~NValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "NValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Name-generated.h b/kabc/vcard/include/generated/Name-generated.h
index 0e69abd..a3bcb25 100644
--- a/kabc/vcard/include/generated/Name-generated.h
+++ b/kabc/vcard/include/generated/Name-generated.h
@@ -1,22 +1,24 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
V_Name();
V_Name(const V_Name&);
-V_Name(const QCString&);
+V_Name(const Q3CString&);
V_Name & operator = (V_Name&);
-V_Name & operator = (const QCString&);
+V_Name & operator = (const Q3CString&);
bool operator ==(V_Name&);
bool operator !=(V_Name& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {V_Name a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {V_Name a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~V_Name();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/OrgValue-generated.h b/kabc/vcard/include/generated/OrgValue-generated.h
index 51eb1b7..275f56f 100644
--- a/kabc/vcard/include/generated/OrgValue-generated.h
+++ b/kabc/vcard/include/generated/OrgValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
OrgValue();
OrgValue(const OrgValue&);
-OrgValue(const QCString&);
+OrgValue(const Q3CString&);
OrgValue & operator = (OrgValue&);
-OrgValue & operator = (const QCString&);
+OrgValue & operator = (const Q3CString&);
bool operator ==(OrgValue&);
bool operator !=(OrgValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {OrgValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {OrgValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~OrgValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "OrgValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Param-generated.h b/kabc/vcard/include/generated/Param-generated.h
index cf4666a..1a35166 100644
--- a/kabc/vcard/include/generated/Param-generated.h
+++ b/kabc/vcard/include/generated/Param-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
Param();
Param(const Param&);
-Param(const QCString&);
+Param(const Q3CString&);
Param & operator = (Param&);
-Param & operator = (const QCString&);
+Param & operator = (const Q3CString&);
bool operator ==(Param&);
bool operator !=(Param& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {Param a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {Param a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~Param();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "Param"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ParamName-generated.h b/kabc/vcard/include/generated/ParamName-generated.h
index ef673c3..b45022e 100644
--- a/kabc/vcard/include/generated/ParamName-generated.h
+++ b/kabc/vcard/include/generated/ParamName-generated.h
@@ -1,22 +1,24 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
V_ParamName();
V_ParamName(const V_ParamName&);
-V_ParamName(const QCString&);
+V_ParamName(const Q3CString&);
V_ParamName & operator = (V_ParamName&);
-V_ParamName & operator = (const QCString&);
+V_ParamName & operator = (const Q3CString&);
bool operator ==(V_ParamName&);
bool operator !=(V_ParamName& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {V_ParamName a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {V_ParamName a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~V_ParamName();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/ParamValue-generated.h b/kabc/vcard/include/generated/ParamValue-generated.h
index e73500f..956c8da 100644
--- a/kabc/vcard/include/generated/ParamValue-generated.h
+++ b/kabc/vcard/include/generated/ParamValue-generated.h
@@ -1,22 +1,24 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
V_ParamValue();
V_ParamValue(const V_ParamValue&);
-V_ParamValue(const QCString&);
+V_ParamValue(const Q3CString&);
V_ParamValue & operator = (V_ParamValue&);
-V_ParamValue & operator = (const QCString&);
+V_ParamValue & operator = (const Q3CString&);
bool operator ==(V_ParamValue&);
bool operator !=(V_ParamValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {V_ParamValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {V_ParamValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~V_ParamValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/PhoneNumberValue-generated.h b/kabc/vcard/include/generated/PhoneNumberValue-generated.h
index 1320f18..0d206f4 100644
--- a/kabc/vcard/include/generated/PhoneNumberValue-generated.h
+++ b/kabc/vcard/include/generated/PhoneNumberValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
PhoneNumberValue();
PhoneNumberValue(const PhoneNumberValue&);
-PhoneNumberValue(const QCString&);
+PhoneNumberValue(const Q3CString&);
PhoneNumberValue & operator = (PhoneNumberValue&);
-PhoneNumberValue & operator = (const QCString&);
+PhoneNumberValue & operator = (const Q3CString&);
bool operator ==(PhoneNumberValue&);
bool operator !=(PhoneNumberValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {PhoneNumberValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {PhoneNumberValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~PhoneNumberValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "PhoneNumberValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/SoundValue-generated.h b/kabc/vcard/include/generated/SoundValue-generated.h
index a9ab2e8..2cc9c0d 100644
--- a/kabc/vcard/include/generated/SoundValue-generated.h
+++ b/kabc/vcard/include/generated/SoundValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
SoundValue();
SoundValue(const SoundValue&);
-SoundValue(const QCString&);
+SoundValue(const Q3CString&);
SoundValue & operator = (SoundValue&);
-SoundValue & operator = (const QCString&);
+SoundValue & operator = (const Q3CString&);
bool operator ==(SoundValue&);
bool operator !=(SoundValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {SoundValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {SoundValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~SoundValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "SoundValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/SourceParam-generated.h b/kabc/vcard/include/generated/SourceParam-generated.h
index 75fefb8..537e093 100644
--- a/kabc/vcard/include/generated/SourceParam-generated.h
+++ b/kabc/vcard/include/generated/SourceParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
SourceParam();
SourceParam(const SourceParam&);
-SourceParam(const QCString&);
+SourceParam(const Q3CString&);
SourceParam & operator = (SourceParam&);
-SourceParam & operator = (const QCString&);
+SourceParam & operator = (const Q3CString&);
bool operator ==(SourceParam&);
bool operator !=(SourceParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {SourceParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {SourceParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~SourceParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "SourceParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TelParam-generated.h b/kabc/vcard/include/generated/TelParam-generated.h
index 3ee77cc..8d9ba0f 100644
--- a/kabc/vcard/include/generated/TelParam-generated.h
+++ b/kabc/vcard/include/generated/TelParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TelParam();
TelParam(const TelParam&);
-TelParam(const QCString&);
+TelParam(const Q3CString&);
TelParam & operator = (TelParam&);
-TelParam & operator = (const QCString&);
+TelParam & operator = (const Q3CString&);
bool operator ==(TelParam&);
bool operator !=(TelParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TelParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TelParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TelParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TelParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TelValue-generated.h b/kabc/vcard/include/generated/TelValue-generated.h
index 3213e1c..b72fa7d 100644
--- a/kabc/vcard/include/generated/TelValue-generated.h
+++ b/kabc/vcard/include/generated/TelValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TelValue();
TelValue(const TelValue&);
-TelValue(const QCString&);
+TelValue(const Q3CString&);
TelValue & operator = (TelValue&);
-TelValue & operator = (const QCString&);
+TelValue & operator = (const Q3CString&);
bool operator ==(TelValue&);
bool operator !=(TelValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TelValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TelValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TelValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TelValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextBinParam-generated.h b/kabc/vcard/include/generated/TextBinParam-generated.h
index d075c10..2e433b0 100644
--- a/kabc/vcard/include/generated/TextBinParam-generated.h
+++ b/kabc/vcard/include/generated/TextBinParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextBinParam();
TextBinParam(const TextBinParam&);
-TextBinParam(const QCString&);
+TextBinParam(const Q3CString&);
TextBinParam & operator = (TextBinParam&);
-TextBinParam & operator = (const QCString&);
+TextBinParam & operator = (const Q3CString&);
bool operator ==(TextBinParam&);
bool operator !=(TextBinParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextBinParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextBinParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextBinParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextBinParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextBinValue-generated.h b/kabc/vcard/include/generated/TextBinValue-generated.h
index e9553ac..bc3ad61 100644
--- a/kabc/vcard/include/generated/TextBinValue-generated.h
+++ b/kabc/vcard/include/generated/TextBinValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextBinValue();
TextBinValue(const TextBinValue&);
-TextBinValue(const QCString&);
+TextBinValue(const Q3CString&);
TextBinValue & operator = (TextBinValue&);
-TextBinValue & operator = (const QCString&);
+TextBinValue & operator = (const Q3CString&);
bool operator ==(TextBinValue&);
bool operator !=(TextBinValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextBinValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextBinValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextBinValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextBinValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextListValue-generated.h b/kabc/vcard/include/generated/TextListValue-generated.h
index 9f46124..9df8a46 100644
--- a/kabc/vcard/include/generated/TextListValue-generated.h
+++ b/kabc/vcard/include/generated/TextListValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextListValue();
TextListValue(const TextListValue&);
-TextListValue(const QCString&);
+TextListValue(const Q3CString&);
TextListValue & operator = (TextListValue&);
-TextListValue & operator = (const QCString&);
+TextListValue & operator = (const Q3CString&);
bool operator ==(TextListValue&);
bool operator !=(TextListValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextListValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextListValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextListValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextListValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextNSParam-generated.h b/kabc/vcard/include/generated/TextNSParam-generated.h
index d7f58ca..8842bd6 100644
--- a/kabc/vcard/include/generated/TextNSParam-generated.h
+++ b/kabc/vcard/include/generated/TextNSParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextNSParam();
TextNSParam(const TextNSParam&);
-TextNSParam(const QCString&);
+TextNSParam(const Q3CString&);
TextNSParam & operator = (TextNSParam&);
-TextNSParam & operator = (const QCString&);
+TextNSParam & operator = (const Q3CString&);
bool operator ==(TextNSParam&);
bool operator !=(TextNSParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextNSParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextNSParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextNSParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextNSParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextParam-generated.h b/kabc/vcard/include/generated/TextParam-generated.h
index 154e1bf..e56a8a5 100644
--- a/kabc/vcard/include/generated/TextParam-generated.h
+++ b/kabc/vcard/include/generated/TextParam-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextParam();
TextParam(const TextParam&);
-TextParam(const QCString&);
+TextParam(const Q3CString&);
TextParam & operator = (TextParam&);
-TextParam & operator = (const QCString&);
+TextParam & operator = (const Q3CString&);
bool operator ==(TextParam&);
bool operator !=(TextParam& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextParam a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextParam a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextParam();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextParam"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/TextValue-generated.h b/kabc/vcard/include/generated/TextValue-generated.h
index e1c4dcc..3f205e0 100644
--- a/kabc/vcard/include/generated/TextValue-generated.h
+++ b/kabc/vcard/include/generated/TextValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
TextValue();
TextValue(const TextValue&);
-TextValue(const QCString&);
+TextValue(const Q3CString&);
TextValue & operator = (TextValue&);
-TextValue & operator = (const QCString&);
+TextValue & operator = (const Q3CString&);
bool operator ==(TextValue&);
bool operator !=(TextValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {TextValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {TextValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~TextValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "TextValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/URIValue-generated.h b/kabc/vcard/include/generated/URIValue-generated.h
index dbcb5c1..464178f 100644
--- a/kabc/vcard/include/generated/URIValue-generated.h
+++ b/kabc/vcard/include/generated/URIValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
URIValue();
URIValue(const URIValue&);
-URIValue(const QCString&);
+URIValue(const Q3CString&);
URIValue & operator = (URIValue&);
-URIValue & operator = (const QCString&);
+URIValue & operator = (const Q3CString&);
bool operator ==(URIValue&);
bool operator !=(URIValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {URIValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {URIValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~URIValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "URIValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/UTCValue-generated.h b/kabc/vcard/include/generated/UTCValue-generated.h
index 46e447b..1a34b5c 100644
--- a/kabc/vcard/include/generated/UTCValue-generated.h
+++ b/kabc/vcard/include/generated/UTCValue-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
UTCValue();
UTCValue(const UTCValue&);
-UTCValue(const QCString&);
+UTCValue(const Q3CString&);
UTCValue & operator = (UTCValue&);
-UTCValue & operator = (const QCString&);
+UTCValue & operator = (const Q3CString&);
bool operator ==(UTCValue&);
bool operator !=(UTCValue& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {UTCValue a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {UTCValue a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~UTCValue();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "UTCValue"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/VCard-generated.h b/kabc/vcard/include/generated/VCard-generated.h
index 4d7d96d..d09c789 100644
--- a/kabc/vcard/include/generated/VCard-generated.h
+++ b/kabc/vcard/include/generated/VCard-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
VCard();
VCard(const VCard&);
-VCard(const QCString&);
+VCard(const Q3CString&);
VCard & operator = (VCard&);
-VCard & operator = (const QCString&);
+VCard & operator = (const Q3CString&);
bool operator ==(VCard&);
bool operator !=(VCard& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {VCard a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {VCard a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~VCard();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "VCard"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/VCardEntity-generated.h b/kabc/vcard/include/generated/VCardEntity-generated.h
index 9f2dfbc..cbbe8e1 100644
--- a/kabc/vcard/include/generated/VCardEntity-generated.h
+++ b/kabc/vcard/include/generated/VCardEntity-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
VCardEntity();
VCardEntity(const VCardEntity&);
-VCardEntity(const QCString&);
+VCardEntity(const Q3CString&);
VCardEntity & operator = (VCardEntity&);
-VCardEntity & operator = (const QCString&);
+VCardEntity & operator = (const Q3CString&);
bool operator ==(VCardEntity&);
bool operator !=(VCardEntity& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {VCardEntity a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {VCardEntity a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~VCardEntity();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "VCardEntity"; }
// End of automatically generated code //
diff --git a/kabc/vcard/include/generated/Value-generated.h b/kabc/vcard/include/generated/Value-generated.h
index 7afac34..142e720 100644
--- a/kabc/vcard/include/generated/Value-generated.h
+++ b/kabc/vcard/include/generated/Value-generated.h
@@ -1,23 +1,25 @@
+//Added by qt3to4:
+#include <Q3CString>
// XXX Automatically generated. DO NOT EDIT! XXX //
public:
Value();
Value(const Value&);
-Value(const QCString&);
+Value(const Q3CString&);
Value & operator = (Value&);
-Value & operator = (const QCString&);
+Value & operator = (const Q3CString&);
bool operator ==(Value&);
bool operator !=(Value& x) {return !(*this==x);}
-bool operator ==(const QCString& s) {Value a(s);return(*this==a);}
-bool operator != (const QCString& s) {return !(*this == s);}
+bool operator ==(const Q3CString& s) {Value a(s);return(*this==a);}
+bool operator != (const Q3CString& s) {return !(*this == s);}
virtual ~Value();
void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;}
void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;}
void _parse();
void _assemble();
const char * className() const { return "Value"; }
// End of automatically generated code //
diff --git a/kabc/vcard/testread.cpp b/kabc/vcard/testread.cpp
index 919c661..4d66aaf 100644
--- a/kabc/vcard/testread.cpp
+++ b/kabc/vcard/testread.cpp
@@ -1,87 +1,89 @@
#include <iostream>
#include <stdlib.h>
#include <assert.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <VCard.h>
using namespace std;
int main(int argc, char * argv[])
{
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <filename>" << endl;
exit(1);
}
QFile f(argv[1]);
- QCString str;
+ Q3CString str;
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
cerr << "Couldn't open file \"" << argv[1] << endl;
exit(1);
}
- QTextStream t(&f);
+ Q3TextStream t(&f);
while (!t.eof())
str += t.readLine().utf8() + '\n';
using namespace VCARD;
// Iterate through all vCards in the file.
cout << "--------- begin ----------" << endl;
cout << str.data();
cout << "--------- end ----------" << endl;
VCardEntity e(str);
VCardListIterator it(e.cardList());
for (; it.current(); ++it) {
cerr << "****************** VCARD ********************" << endl;
// Create a vcard using the string representation.
VCard & v (*it.current());
if (v.has(EntityEmail)) {
cerr << "Email parameter found" << endl;
- QCString s = v.contentLine(EntityEmail)->value()->asString();
+ Q3CString s = v.contentLine(EntityEmail)->value()->asString();
cerr << "Email value == " << s << endl;
}
if (v.has(EntityNickname)) {
cerr << "Nickname parameter found" << endl;
cerr << "Nickname value == " <<
v.contentLine(EntityNickname)->value()->asString() <<
endl;
}
if (v.has(EntityRevision)) {
cerr << "Revision parameter found" << endl;
DateValue * d =
(DateValue *)
v.contentLine(EntityRevision)->value();
assert(d != 0);
cerr << "Revision date: " << endl;
cerr << "Day : " << d->day() << endl;
cerr << "Month : " << d->month() << endl;
cerr << "Year : " << d->year() << endl;
if (d->hasTime()) {
cerr << "Revision date has a time component" << endl;
cerr << "Revision time: " << endl;
cerr << "Hour : " << d->hour() << endl;
cerr << "Minute : " << d->minute() << endl;
diff --git a/kabc/vcard/testwrite.cpp b/kabc/vcard/testwrite.cpp
index e4bbe7b..846e51a 100644
--- a/kabc/vcard/testwrite.cpp
+++ b/kabc/vcard/testwrite.cpp
@@ -1,41 +1,43 @@
#include <kaboutdata.h>
#include <kapplication.h>
#include <kdebug.h>
#include <klocale.h>
#include <kcmdlineargs.h>
#include <VCard.h>
+//Added by qt3to4:
+#include <Q3CString>
int main(int argc,char **argv)
{
KAboutData aboutData("testwrite",I18N_NOOP("TestWritevCard"),"0.1");
KCmdLineArgs::init(argc,argv,&aboutData);
KApplication app;
kdDebug() << "Test Write VCard" << endl;
using namespace VCARD;
VCard v;
ContentLine cl1;
cl1.setName(EntityTypeToParamName(EntityName));
cl1.setValue(new TextValue("Hans Wurst"));
v.add(cl1);
ContentLine cl2;
cl2.setName(EntityTypeToParamName(EntityTelephone));
cl2.setValue(new TelValue("12345"));
ParamList p;
p.append( new TelParam("home") );
p.append( new TelParam("fax") );
cl2.setParamList( p );
v.add(cl2);
- QCString str = v.asString();
+ Q3CString str = v.asString();
kdDebug() << "--- VCard begin ---" << endl
<< str
<< "--- VCard end ---" << endl;
}
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp
index 60d02b8..e24a9dc 100644
--- a/kabc/vcard21parser.cpp
+++ b/kabc/vcard21parser.cpp
@@ -1,80 +1,82 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Mark Westcott <mark@houseoffish.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qmap.h>
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kmdcodec.h>
#include "vcard21parser.h"
#include "vcardconverter.h"
using namespace KABC;
bool VCardLineX::isValid() const
{
// Invalid: if it is "begin:vcard" or "end:vcard"
if ( name == VCARD_BEGIN_N || name == VCARD_END_N )
return false;
if ( name[0] == 'x' && name[1] == '-' ) // A custom x- line
return true;
// This is long but it makes it a bit faster (and saves me from using
// a tree which is probably the ideal situation, but a bit memory heavy)
- switch( name[0] ) {
+ switch( name[0].unicode() ) {
case 'a':
if ( name == VCARD_ADR && qualified &&
(qualifiers.contains(VCARD_ADR_DOM) ||
qualifiers.contains(VCARD_ADR_INTL) ||
qualifiers.contains(VCARD_ADR_POSTAL) ||
qualifiers.contains(VCARD_ADR_HOME) ||
qualifiers.contains(VCARD_ADR_WORK) ||
qualifiers.contains(VCARD_ADR_PREF)
) )
return true;
if ( name == VCARD_AGENT )
return true;
break;
case 'b':
if ( name == VCARD_BDAY )
return true;
break;
case 'c':
if ( name == VCARD_CATEGORIES )
return true;
if ( name == VCARD_CLASS && qualified &&
(qualifiers.contains(VCARD_CLASS_PUBLIC) ||
qualifiers.contains(VCARD_CLASS_PRIVATE) ||
qualifiers.contains(VCARD_CLASS_CONFIDENTIAL)
) )
return true;
break;
case 'e':
@@ -240,123 +242,126 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data)
tmpStr = (mVCard->getValue(VCARD_FN));
if (!tmpStr.isEmpty())
addressee.setFormattedName(tmpStr);
//set the addressee's nick name
tmpStr = mVCard->getValue(VCARD_NICKNAME);
addressee.setNickName(tmpStr);
//set the addressee's organisation
tmpStr = mVCard->getValue(VCARD_ORG);
addressee.setOrganization(tmpStr);
//set the addressee's title
tmpStr = mVCard->getValue(VCARD_TITLE);
addressee.setTitle(tmpStr);
//set the addressee's email - we can only deal with two. The preferenced one and one other.
tmpStr = mVCard->getValue(VCARD_EMAIL, VCARD_EMAIL_INTERNET);
addressee.insertEmail(tmpStr, false);
tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF);
addressee.insertEmail(tmpStr, true);
//set the addressee's url
tmpStr = mVCard->getValue(VCARD_URL);
if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK);
if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME);
if (!tmpStr.isEmpty()) {
addressee.setUrl(KURL(tmpStr));
}
//set the addressee's birthday
tmpStr = mVCard->getValue(VCARD_BDAY);
addressee.setBirthday(VCardStringToDate(tmpStr));
//set the addressee's phone numbers
- for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
+ for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_TEL ) {
int type = 0;
if ( (*i).qualified ) {
if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) )
type |= PhoneNumber::Home;
if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) )
type |= PhoneNumber::Work;
if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) )
type |= PhoneNumber::Pref;
if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) )
type |= PhoneNumber::Voice;
if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) )
type |= PhoneNumber::Fax;
if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) )
type |= PhoneNumber::Msg;
if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) )
type |= PhoneNumber::Cell;
if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) )
type |= PhoneNumber::Pager;
if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) )
type |= PhoneNumber::Bbs;
if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) )
type |= PhoneNumber::Modem;
if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) )
type |= PhoneNumber::Car;
if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) )
type |= PhoneNumber::Isdn;
if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) )
type |= PhoneNumber::Video;
if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) )
type |= PhoneNumber::Pcs;
}
addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) );
}
}
addressee.makePhoneNumbersOLcompatible();
//set the addressee's addresses
- for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
+ for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) {
if ( (*i).name == VCARD_ADR ) {
int type = 0;
if ( (*i).qualified ) {
if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) )
type |= Address::Dom;
if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) )
type |= Address::Intl;
if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) )
type |= Address::Postal;
if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) )
type |= Address::Parcel;
if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) )
type |= Address::Home;
if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) )
type |= Address::Work;
if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) )
type |= Address::Pref;
}
- addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) );
+ QStringList tmp;
+ for(Q3ValueList<QString>::const_iterator ii=(*i).parameters.begin();ii!=(*i).parameters.end();++ii)
+ tmp.push_back(*ii);
+ addressee.insertAddress( readAddressFromQStringList( tmp, type ) );
}
}
//set the addressee's delivery label
tmpStr = mVCard->getValue(VCARD_LABEL);
if (!tmpStr.isEmpty()) {
qDebug("VCard21Parser::readFromString please verify if replace is correct");
//US tmpStr.replace("\r\n","\n");
tmpStr.replace( QRegExp("\r\n"), "\n" );
Address tmpAddress;
tmpAddress.setLabel(tmpStr);
addressee.insertAddress(tmpAddress);
}
//set the addressee's notes
tmpStr = mVCard->getValue(VCARD_NOTE);
qDebug("VCard21Parser::readFromString please verify if correct");
//US tmpStr.replace("\r\n","\n");
tmpStr.replace( QRegExp("\r\n"), "\n" );
addressee.setNote(tmpStr);
//set the addressee's timezone
tmpStr = mVCard->getValue(VCARD_TZ);
TimeZone tmpZone(tmpStr.toInt());
addressee.setTimeZone(tmpZone);
//set the addressee's geographical position
tmpList = mVCard->getValues(VCARD_GEO);
if (tmpList.count()==2)
{
tmpStr = tmpList[0];
float glat = tmpStr.toFloat();
@@ -379,68 +384,68 @@ qDebug("VCard21Parser::readFromString please verify if correct");
KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &data, const int type )
{
KABC::Address mAddress;
mAddress.setType( type );
if ( data.count() > 0 )
mAddress.setPostOfficeBox( data[0] );
if ( data.count() > 1 )
mAddress.setExtended( data[1] );
if ( data.count() > 2 )
mAddress.setStreet( data[2] );
if ( data.count() > 3 )
mAddress.setLocality( data[3] );
if ( data.count() > 4 )
mAddress.setRegion( data[4] );
if ( data.count() > 5 )
mAddress.setPostalCode( data[5] );
if ( data.count() > 6 )
mAddress.setCountry( data[6] );
return mAddress;
}
VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err )
{
int _err = 0;
int _state = VC_STATE_BEGIN;
- QValueList<VCardLineX> *_vcdata;
- QValueList<QString> lines;
+ Q3ValueList<VCardLineX> *_vcdata;
+ QStringList lines;
- _vcdata = new QValueList<VCardLineX>;
+ _vcdata = new Q3ValueList<VCardLineX>;
lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc );
// for each line in the vCard
for ( QStringList::Iterator j = lines.begin(); j != lines.end(); ++j ) {
VCardLineX _vcl;
// take spaces off the end - ugly but necessary hack
for ( int g = (*j).length()-1; g > 0 && (*j)[g].isSpace(); --g )
(*j)[g] = 0;
// first token:
// verify state, update if necessary
if ( _state & VC_STATE_BEGIN) {
if ( !qstricmp( (*j).latin1(), VCARD_BEGIN ) ) {
_state = VC_STATE_BODY;
continue;
} else {
_err = VC_ERR_NO_BEGIN;
break;
}
} else if ( _state & VC_STATE_BODY ) {
if ( !qstricmp( (*j).latin1(), VCARD_END ) ) {
_state |= VC_STATE_END;
break;
}
// split into two tokens
int colon = (*j).find( ':' );
if ( colon < 0 ) {
_err = VC_ERR_INVALID_LINE;
break;
@@ -472,136 +477,137 @@ VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err )
first_pass = false;
}
} else {
_err = VC_ERR_INVALID_LINE;
}
if ( _err != 0 )
break;
if ( _vcl.name == VCARD_VERSION )
_state |= VC_STATE_HAVE_VERSION;
if ( _vcl.name == VCARD_N || _vcl.name == VCARD_FN )
_state |= VC_STATE_HAVE_N;
// second token:
// split into tokens by ;
// add to parameters vector
if ( b64 ) {
if ( value.at( value.length() - 1 ) != '=' )
do {
value += *( ++j );
} while ( (*j).at( (*j).length() - 1 ) != '=' );
} else {
if ( qp ) { // join any split lines
while ( value.at( value.length() - 1 ) == '=' ) {
value.remove( value.length() - 1, 1 );
value.append(*( ++j ));
}
}
_vcl.parameters = QStringList::split( ';', value, true );
if ( qp ) { // decode the quoted printable
- for ( QStringList::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z )
- *z = KCodecs::quotedPrintableDecode( (*z).latin1() );
+ for ( QLinkedList<QString>::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z )
+ *z = KCodecs::quotedPrintableDecode( (Q3CString)(*z).latin1() );
}
}
} else {
_err = VC_ERR_INTERNAL;
break;
}
// validate VCardLineX
if ( !_vcl.isValid() ) {
_err = VC_ERR_INVALID_LINE;
break;
}
// add to vector
_vcdata->append( _vcl );
}
// errors to check at the last minute (exit state related)
if ( _err == 0 ) {
if ( !( _state & VC_STATE_END ) ) // we have to have an end!!
_err = VC_ERR_NO_END;
if ( !( _state & VC_STATE_HAVE_N ) || // we have to have the mandatories!
!( _state & VC_STATE_HAVE_VERSION ) )
_err = VC_ERR_MISSING_MANDATORY;
}
// set the error message if we can, and only return an object
// if the vCard was valid.
if ( err )
*err = _err;
if ( _err != 0 ) {
delete _vcdata;
return 0;
}
return new VCard21ParserImpl( _vcdata );
}
-VCard21ParserImpl::VCard21ParserImpl(QValueList<VCardLineX> *_vcd) : _vcdata(_vcd)
+VCard21ParserImpl::VCard21ParserImpl(Q3ValueList<VCardLineX> *_vcd) : _vcdata(_vcd)
{
}
QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifier)
{
QString failed;
const QString lowname = name.lower();
const QString lowqualifier = qualifier.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) {
if ((*i).parameters.count() > 0)
return (*i).parameters[0];
else return failed;
}
}
return failed;
}
QString VCard21ParserImpl::getValue(const QString& name)
{
QString failed;
const QString lowname = name.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && !(*i).qualified) {
if ((*i).parameters.count() > 0)
return (*i).parameters[0];
else return failed;
}
}
return failed;
}
QStringList VCard21ParserImpl::getValues(const QString& name)
{
const QString lowname = name.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
- if ((*i).name == lowname && !(*i).qualified)
- return (*i).parameters;
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ if ((*i).name == lowname && !(*i).qualified) {
+ return QStringList( (*i).parameters );
+ }
}
// failed.
return QStringList();
}
QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qualifier)
{
const QString lowname = name.lower();
const QString lowqualifier = qualifier.lower();
- for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
+ for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) {
if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier))
- return (*i).parameters;
+ return QStringList( (*i).parameters );
}
// failed.
return QStringList();
}
diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h
index 77e69b6..80ba6ef 100644
--- a/kabc/vcard21parser.h
+++ b/kabc/vcard21parser.h
@@ -5,65 +5,65 @@
Copyright (c) 2000 George Staikos <staikos@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KABC_VCARD21FORMAT_H
#define KABC_VCARD21FORMAT_H
#include <qdatetime.h>
#include <kdebug.h>
#include <qregexp.h>
#include <qstring.h>
#include <kurl.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "addressee.h"
#include "addressbook.h"
#include "phonenumber.h"
#define VCARD_BEGIN "begin:vcard"
#define VCARD_END "end:vcard"
#define VCARD_BEGIN_N "begin"
#define VCARD_END_N "end"
#define VCARD_VERSION "version"
#define VCARD_FN "fn"
#define VCARD_N "n"
// optional
#define VCARD_NAME "name"
#define VCARD_NICKNAME "nickname"
#define VCARD_PHOTO "photo"
#define VCARD_BDAY "bday"
#define VCARD_ADR "adr"
// types
#define VCARD_ADR_DOM "dom"
#define VCARD_ADR_INTL "intl"
#define VCARD_ADR_POSTAL "postal"
#define VCARD_ADR_PARCEL "parcel"
#define VCARD_ADR_HOME "home"
#define VCARD_ADR_WORK "work"
#define VCARD_ADR_PREF "pref"
// values
#define VCARD_ADR_POBOX "PO Box"
@@ -167,60 +167,60 @@ public:
*/
void readFromString( KABC::AddressBook *ab, const QString &str );
/**
* FIXME: we need a writeToString method
* QString writeToString (KABC::AddressBook *);
*/
/**
* Parses a string in vcard2.1 format and returns the inherent addressee.
*/
KABC::Addressee readFromString( const QString &data);
/**
* Helper method to store a address.
*
* @param data A string list, that is filled with 'street', 'house number' ...
* @param type The type of the returned address.
*/
static KABC::Address readAddressFromQStringList (const QStringList &data, const int type);
};
}
/**
* @short Helper class
*/
class VCardLineX
{
public:
QString name;
bool qualified;
- QValueList<QString> qualifiers;
- QValueList<QString> parameters;
+ Q3ValueList<QString> qualifiers;
+ Q3ValueList<QString> parameters;
bool isValid() const;
};
/**
* @short Helper class
*/
class VCard21ParserImpl
{
friend class VCardLineX;
public:
VCard21ParserImpl() { };
virtual ~VCard21ParserImpl() { };
static VCard21ParserImpl *parseVCard(const QString& vc, int *err = NULL);
QString getValue(const QString& name, const QString& qualifier);
QString getValue(const QString& name);
QStringList getValues(const QString& name, const QString& qualifier);
QStringList getValues(const QString& name);
- QValueList<VCardLineX> *_vcdata;
+ Q3ValueList<VCardLineX> *_vcdata;
private:
- VCard21ParserImpl (QValueList<VCardLineX> *_vcd);
+ VCard21ParserImpl (Q3ValueList<VCardLineX> *_vcd);
};
#endif
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp
index 580c28b..2417874 100644
--- a/kabc/vcardformatimpl.cpp
+++ b/kabc/vcardformatimpl.cpp
@@ -1,168 +1,171 @@
/*
This file is part of libkabc.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qfile.h>
#include <qregexp.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#include <kdebug.h>
#include <kmdcodec.h>
#include <kstandarddirs.h>
#include <ktempfile.h>
#include <VCard.h>
#include "addressbook.h"
#include "vcardformatimpl.h"
using namespace KABC;
using namespace VCARD;
int VCardFormatImpl::debug = -1;
VCardFormatImpl::VCardFormatImpl()
{
debug = (getenv("KABC_DEBUG") != 0);
}
bool VCardFormatImpl::load( Addressee &addressee, QFile *file )
{
kdDebug(5700) << "VCardFormat::load()" << endl;
QByteArray fdata = file->readAll();
- QCString data(fdata.data(), fdata.size()+1);
+ Q3CString data(fdata.data(), fdata.size()+1);
VCardEntity e( data );
VCardListIterator it( e.cardList() );
if ( it.current() ) {
//US VCard v(*it.current());
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
return true;
}
return false;
}
#include <kmessagebox.h>
bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
- QCString data(file->readAll().data(), file->size()+1);
+ Q3CString data(file->readAll().data(), file->size()+1);
VCardEntity e( data );
VCardListIterator it( e.cardList() );
for (; it.current(); ++it) {
//US VCard v(*it.current());
Addressee addressee;
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
addressee.setResource( resource );
addressBook->insertAddressee( addressee );
if (debug == true)
{
printf("address %s loaded successfully\n", addressee.formattedName().latin1());
}
}
return true;
}
void VCardFormatImpl::save( const Addressee &addressee, QFile *file )
{
VCardEntity vcards;
VCardList vcardlist;
vcardlist.setAutoDelete( true );
VCard *v = new VCard;
saveAddressee( addressee, v, false );
vcardlist.append( v );
vcards.setCardList( vcardlist );
- QCString vcardData = vcards.asString();
+ Q3CString vcardData = vcards.asString();
file->writeBlock( (const char*)vcardData, vcardData.length() );
}
void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file )
{
AddressBook::Iterator it;
for ( it = ab->begin(); it != ab->end(); ++it ) {
if ( (*it).resource() == resource ) {
save((*it),file);
qApp->processEvents();
(*it).setChanged( false );
}
}
// for memory usage status test only
// KMessageBox::information ( 0, "Stoppppp", QString("Stop ") );
}
bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
{
- QPtrList<ContentLine> contentLines = v->contentLineList();
+ Q3PtrList<ContentLine> contentLines = v->contentLineList();
ContentLine *cl;
for( cl = contentLines.first(); cl; cl = contentLines.next() ) {
- QCString n = cl->name();
+ Q3CString n = cl->name();
if ( n.left( 2 ) == "X-" ) {
n = n.mid( 2 );
int posDash = n.find( "-" );
addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ),
QString::fromUtf8( n.mid( posDash + 1 ) ),
QString::fromUtf8( cl->value()->asString() ) );
continue;
}
EntityType type = cl->entityType();
switch( type ) {
case EntityUID:
addressee.setUid( readTextValue( cl ) );
break;
case EntityEmail:
addressee.insertEmail( readTextValue( cl ) );
break;
case EntityName:
addressee.setName( readTextValue( cl ) );
break;
case EntityFullName:
addressee.setFormattedName( readTextValue( cl ) );
break;
case EntityURL:
addressee.setUrl( KURL( readTextValue( cl ) ) );
break;
@@ -190,65 +193,65 @@ bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v )
addressee.setOrganization( readTextValue( cl ) );
break;
case EntityNote:
addressee.setNote( readTextValue( cl ) );
break;
case EntityProductID:
addressee.setProductId( readTextValue( cl ) );
break;
case EntitySortString:
addressee.setSortString( readTextValue( cl ) );
break;
case EntityN:
readNValue( cl, addressee );
break;
case EntityAddress:
addressee.insertAddress( readAddressValue( cl ) );
break;
case EntityTelephone:
addressee.insertPhoneNumber( readTelephoneValue( cl ) );
break;
case EntityCategories:
addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) );
break;
case EntityBirthday:
- addressee.setBirthday( readDateValue( cl ) );
+ addressee.setBirthday( (QDateTime) readDateValue( cl ) );
break;
case EntityRevision:
addressee.setRevision( readDateTimeValue( cl ) );
break;
case EntityGeo:
addressee.setGeo( readGeoValue( cl ) );
break;
case EntityTimeZone:
addressee.setTimeZone( readUTCValue( cl ) );
break;
case EntityVersion:
break;
case EntityClass:
addressee.setSecrecy( readClassValue( cl ) );
break;
case EntityKey:
addressee.insertKey( readKeyValue( cl ) );
break;
case EntityPhoto:
addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) );
break;
case EntityLogo:
addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) );
break;
@@ -501,65 +504,65 @@ void VCardFormatImpl::addClassValue( VCard *vcard, const Secrecy &secrecy )
case Secrecy::Confidential:
v->setType( (int)ClassValue::Confidential );
break;
}
cl.setValue( v );
vcard->add(cl);
}
Address VCardFormatImpl::readAddressValue( ContentLine *cl )
{
Address a;
AdrValue *v = (AdrValue *)cl->value();
a.setPostOfficeBox( QString::fromUtf8( v->poBox() ) );
a.setExtended( QString::fromUtf8( v->extAddress() ) );
a.setStreet( QString::fromUtf8( v->street() ) );
a.setLocality( QString::fromUtf8( v->locality() ) );
a.setRegion( QString::fromUtf8( v->region() ) );
a.setPostalCode( QString::fromUtf8( v->postCode() ) );
a.setCountry( QString::fromUtf8( v->countryName() ) );
a.setType( readAddressParam( cl ) );
return a;
}
int VCardFormatImpl::readAddressParam( ContentLine *cl )
{
int type = 0;
ParamList params = cl->paramList();
ParamListIterator it( params );
- QCString tmpStr;
+ Q3CString tmpStr;
for( ; it.current(); ++it ) {
if ( (*it)->name().upper() == "TYPE" ) {
tmpStr = (*it)->value().lower();
if ( tmpStr == "dom" ) type |= Address::Dom;
else if ( tmpStr == "intl" ) type |= Address::Intl;
else if ( tmpStr == "parcel" ) type |= Address::Parcel;
else if ( tmpStr == "postal" ) type |= Address::Postal;
else if ( tmpStr == "work" ) type |= Address::Work;
else if ( tmpStr == "home" ) type |= Address::Home;
else if ( tmpStr == "pref" ) type |= Address::Pref;
}
}
return type;
}
void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a )
{
ContentLine cl;
cl.setName(EntityTypeToParamName( EntityN ) );
NValue *v = new NValue;
v->setFamily( a.familyName().utf8() );
v->setGiven( a.givenName().utf8() );
v->setMiddle( a.additionalName().utf8() );
v->setPrefix( a.prefix().utf8() );
v->setSuffix( a.suffix().utf8() );
cl.setValue( v );
vcard->add(cl);
}
void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a )
{
@@ -580,65 +583,65 @@ void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p )
cl.setName(EntityTypeToParamName(EntityTelephone));
cl.setValue(new TelValue( p.number().utf8() ));
ParamList params;
if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) );
if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) );
if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) );
if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) );
if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) );
if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) );
if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) );
if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) );
if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) );
if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) );
if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) );
if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) );
if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) );
if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) );
cl.setParamList( params );
v->add(cl);
}
PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl )
{
PhoneNumber p;
TelValue *value = (TelValue *)cl->value();
p.setNumber( QString::fromUtf8( value->asString() ) );
int type = 0;
ParamList params = cl->paramList();
ParamListIterator it( params );
- QCString tmpStr;
+ Q3CString tmpStr;
for( ; it.current(); ++it ) {
if ( (*it)->name() == "TYPE" ) {
tmpStr = (*it)->value().lower();
if ( tmpStr == "home" ) type |= PhoneNumber::Home;
else if ( tmpStr == "work" ) type |= PhoneNumber::Work;
else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg;
else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref;
else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice;
else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax;
else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell;
else if ( tmpStr == "video" ) type |= PhoneNumber::Video;
else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs;
else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem;
else if ( tmpStr == "car" ) type |= PhoneNumber::Car;
else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn;
else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs;
else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager;
}
}
p.setType( type );
return p;
}
QString VCardFormatImpl::readTextValue( ContentLine *cl )
{
VCARD::Value *value = cl->value();
if ( value ) {
return QString::fromUtf8( value->asString() );
} else {
kdDebug(5700) << "No value: " << cl->asString() << endl;
qDebug("No value: %s", (const char*)(cl->asString()));
@@ -841,65 +844,65 @@ Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl )
vstr.replace( QRegExp("\\\\n"), "\r\n" );
vstr.replace( QRegExp("\\\\:"), ":" );
vstr.replace( QRegExp("\\\\,"), "," );
vstr.replace( QRegExp("\\\\;"), ";" );
Addressee *addr = new Addressee;
readFromString( vstr, *addr );
agent.setAddressee( addr );
} else {
agent.setUrl( QString::fromUtf8( v->asString() ) );
}
return agent;
}
#include <qstringlist.h>
void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern )
{
ContentLine cl;
cl.setName( EntityTypeToParamName( type ) );
// qDebug( "IIIMMMMM %s",QImage::outputFormatList ().join("-").latin1() );
if ( pic.isIntern() && pic.data().isNull() )
return;
if ( !pic.isIntern() && pic.url().isEmpty() )
return;
ParamList params;
if ( pic.isIntern() ) {
QImage img = pic.data();
if ( intern ) { // only for vCard export we really write the data inline
QByteArray data;
- QDataStream s( data, IO_WriteOnly );
+ QDataStream s( &data, QIODevice::WriteOnly );
s.setVersion( 4 ); // to produce valid png files
s << img;
cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
params.append( new Param( "ENCODING", "b" ) );
if ( !pic.type().isEmpty() )
params.append( new Param( "TYPE", pic.type().utf8() ) );
} else { // save picture in cache
QString dir;
if ( type == EntityPhoto )
dir = "photos";
if ( type == EntityLogo )
dir = "logos";
QString imUrl = locateLocal( "data", "kabc/" + dir + "/" + addr.uid() );
KABC::Picture* ppic =(KABC::Picture*) &pic;
ppic->setUrl( imUrl );
img.save(imUrl, "PNG" );
cl.setValue( new TextValue( pic.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
} else {
cl.setValue( new TextValue( pic.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
cl.setParamList( params );
vcard->add( cl );
}
Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::EntityType type, const Addressee &addr )
{
@@ -930,97 +933,97 @@ Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::Entity
} else {
QByteArray data;
KCodecs::base64Decode( v->asString(), data );
img.loadFromData( data );
}
pic.setData( img );
pic.setType( picType );
} else {
pic.setUrl( QString::fromUtf8( v->asString() ) );
}
return pic;
}
void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, const Addressee &addr, bool intern )
{
ContentLine cl;
cl.setName( EntityTypeToParamName( EntitySound ) );
if ( sound.isIntern() && sound.data().isNull() )
return;
if ( !sound.isIntern() && sound.url().isEmpty() )
return;
ParamList params;
if ( sound.isIntern() ) {
QByteArray data = sound.data();
if ( intern ) { // only for vCard export we really write the data inline
cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) );
} else { // save sound in cache
QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) );
- if ( file.open( IO_WriteOnly ) ) {
+ if ( file.open( QIODevice::WriteOnly ) ) {
file.writeBlock( data );
}
cl.setValue( new TextValue( "<dummy>" ) );
}
params.append( new Param( "ENCODING", "b" ) );
} else {
cl.setValue( new TextValue( sound.url().utf8() ) );
params.append( new Param( "VALUE", "uri" ) );
}
cl.setParamList( params );
vcard->add( cl );
}
Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &addr )
{
Sound sound;
bool isInline = false;
TextValue *v = (TextValue *)cl->value();
ParamList params = cl->paramList();
ParamListIterator it( params );
for( ; it.current(); ++it ) {
if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" )
isInline = true;
}
if ( isInline ) {
QByteArray data;
if ( v->asString() == "<dummy>" ) { // no sound inline stored => sound is in cache
QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) );
- if ( file.open( IO_ReadOnly ) ) {
+ if ( file.open( QIODevice::ReadOnly ) ) {
data = file.readAll();
file.close();
}
} else {
KCodecs::base64Decode( v->asString(), data );
}
sound.setData( data );
} else {
sound.setUrl( QString::fromUtf8( v->asString() ) );
}
return sound;
}
bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee )
{
VCardEntity e( vcard.utf8() );
VCardListIterator it( e.cardList() );
if ( it.current() ) {
//US VCard v(*it.current());
//US loadAddressee( addressee, v );
loadAddressee( addressee, it.current() );
return true;
}
return false;
}
bool VCardFormatImpl::writeToString( const Addressee &addressee, QString &vcard )
{
VCardEntity vcards;
diff --git a/kabc/vcardformatplugin.cpp b/kabc/vcardformatplugin.cpp
index 8db8c11..0b97a08 100644
--- a/kabc/vcardformatplugin.cpp
+++ b/kabc/vcardformatplugin.cpp
@@ -32,39 +32,39 @@ VCardFormatPlugin::~VCardFormatPlugin()
{
delete mImpl;
}
bool VCardFormatPlugin::load( Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin::load");
return mImpl->load( addressee, file );
}
bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
// qDebug("VCardFormatPlugin::loadAll");
return mImpl->loadAll( addressBook, resource, file );
}
void VCardFormatPlugin::save( const Addressee &addressee, QFile *file )
{
qDebug("VCardFormatPlugin::save");
mImpl->save( addressee, file );
}
void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file )
{
qDebug("VCardFormatPlugin::saveAll");
mImpl->saveAll( addressBook, resource, file );
}
bool VCardFormatPlugin::checkFormat( QFile *file ) const
{
QString line;
- file->readLine( line, 1024 );
+ char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp;
line = line.stripWhiteSpace();
if ( line == "BEGIN:VCARD" )
return true;
else
return false;
}
diff --git a/kabc/vcardparser/vcard.h b/kabc/vcardparser/vcard.h
index 0bee441..85b50e4 100644
--- a/kabc/vcardparser/vcard.h
+++ b/kabc/vcardparser/vcard.h
@@ -1,66 +1,66 @@
/*
This file is part of libkabc.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef VCARDPARSER_VCARD_H
#define VCARDPARSER_VCARD_H
#include "vcardline.h"
#include <qmap.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
namespace KABC {
class VCard
{
public:
- typedef QValueList<VCard> List;
+ typedef Q3ValueList<VCard> List;
typedef QMap< QString, VCardLine::List > LineMap;
enum Version { v2_1, v3_0 };
VCard();
VCard( const VCard& );
~VCard();
VCard& operator=( const VCard& );
/**
* Removes all lines from the vCard.
*/
void clear();
/**
* Returns a list of all identifiers that exists in the
* vCard.
*/
QStringList identifiers() const;
/**
* Adds a VCardLine to the VCard
*/
void addLine( const VCardLine& line );
/**
* Returns all lines of the vcard with a special identifier.
*/
VCardLine::List lines( const QString& identifier ) const;
diff --git a/kabc/vcardparser/vcardline.cpp b/kabc/vcardparser/vcardline.cpp
index 8df2d32..c7254a0 100644
--- a/kabc/vcardparser/vcardline.cpp
+++ b/kabc/vcardparser/vcardline.cpp
@@ -1,121 +1,123 @@
/*
This file is part of libkabc.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "vcardline.h"
+//Added by qt3to4:
+#include <Q3CString>
using namespace KABC;
class VCardLine::VCardLinePrivate
{
public:
QString mGroup;
};
VCardLine::VCardLine()
: d( 0 )
{
}
VCardLine::VCardLine( const QString &identifier )
: d( 0 )
{
mIdentifier = identifier;
}
VCardLine::VCardLine( const QString &identifier, const QString &value )
: d( 0 )
{
mIdentifier = identifier;
- mValue.assign( value.data(), value.length() );
+ mValue = value;
}
VCardLine::VCardLine( const VCardLine& line )
: d( 0 )
{
mParamMap = line.mParamMap;
mValue = line.mValue;
mIdentifier = line.mIdentifier;
}
VCardLine::~VCardLine()
{
delete d;
d = 0;
}
VCardLine& VCardLine::operator=( const VCardLine& line )
{
if ( &line == this )
return *this;
mParamMap = line.mParamMap;
mValue = line.mValue;
mIdentifier = line.mIdentifier;
return *this;
}
void VCardLine::setIdentifier( const QString& identifier )
{
mIdentifier = identifier;
}
QString VCardLine::identifier() const
{
return mIdentifier;
}
void VCardLine::setValueString( const QString& value )
{
setValueCString( value.utf8() );
}
-void VCardLine::setValueCString( const QCString& value )
+void VCardLine::setValueCString( const Q3CString& value )
{
mValue.duplicate( value.data(), value.length() );
}
void VCardLine::setValueBytes( const QByteArray& value )
{
mValue = value;
}
QString VCardLine::valueString() const
{
return QString::fromUtf8( mValue.data(), mValue.size() );
}
QByteArray VCardLine::valueBytes() const
{
return mValue;
}
void VCardLine::setGroup( const QString& group )
{
if ( !d )
d = new VCardLinePrivate();
d->mGroup = group;
}
QString VCardLine::group() const
{
if ( d )
return d->mGroup;
else
diff --git a/kabc/vcardparser/vcardline.h b/kabc/vcardparser/vcardline.h
index 8dc9322..dc4bdec 100644
--- a/kabc/vcardparser/vcardline.h
+++ b/kabc/vcardparser/vcardline.h
@@ -1,94 +1,94 @@
/*
This file is part of libkabc.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef VCARDLINE_H
#define VCARDLINE_H
#include <qstringlist.h>
-#include <qvaluelist.h>
-#include <qcstring.h>
+#include <q3valuelist.h>
+#include <q3cstring.h>
#include <qvariant.h>
#include <qmap.h>
#include <qstring.h>
namespace KABC {
class VCardLine
{
public:
- typedef QValueList<VCardLine> List;
+ typedef Q3ValueList<VCardLine> List;
typedef QMap<QString, QStringList> ParamMap;
VCardLine();
VCardLine( const QString &identifier );
VCardLine( const QString &identifier, const QString &value );
VCardLine( const VCardLine& );
~VCardLine();
VCardLine& operator=( const VCardLine& );
/**
* Sets the identifier of this line e.g. UID, FN, CLASS
*/
void setIdentifier( const QString& identifier );
/**
* Returns the identifier of this line.
*/
QString identifier() const;
/**
* Sets the value of of this line.
*/
void setValueString( const QString& value );
- void setValueCString( const QCString& value );
+ void setValueCString( const Q3CString& value );
void setValueBytes( const QByteArray& value );
/**
* Returns the value of this line.
*/
QString valueString() const;
QByteArray valueBytes() const;
/**
* Sets the group the line belongs to.
*/
void setGroup( const QString& group );
/**
* Returns the group the line belongs to.
*/
QString group() const;
/**
* Returns whether the line belongs to a group.
*/
bool hasGroup() const;
/**
* Returns all parameters.
*/
QStringList parameterList() const;
/**
* Add a new parameter to the line.
*/
void addParameter( const QString& param, const QString& value );
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp
index 11622a0..a319531 100644
--- a/kabc/vcardparser/vcardparser.cpp
+++ b/kabc/vcardparser/vcardparser.cpp
@@ -189,52 +189,52 @@ QString VCardParser::createVCards( const VCard::List& list )
// iterate over the lines
for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) {
if ( !(*lineIt).valueString().isEmpty() ) {
if ( (*lineIt).hasGroup() )
textLine = (*lineIt).group() + "." + (*lineIt).identifier();
else
textLine = (*lineIt).identifier();
params = (*lineIt).parameterList();
hasEncoding = false;
if ( params.count() > 0 ) { // we have parameters
for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) {
if ( (*paramIt) == "encoding" ) {
hasEncoding = true;
encodingType = (*lineIt).parameter( "encoding" ).lower();
}
values = (*lineIt).parameters( *paramIt );
for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) {
textLine.append( ";" + (*paramIt).upper() );
if ( !(*valueIt).isEmpty() )
textLine.append( "=" + (*valueIt) );
}
}
}
if ( hasEncoding ) { // have to encode the data
QByteArray input, output;
input = (*lineIt).valueBytes();
if ( encodingType == "b" )
KCodecs::base64Encode( input, output );
else if ( encodingType == "quoted-printable" )
- KCodecs::quotedPrintableEncode( input, output );
+ KCodecs::quotedPrintableEncode( input, output, true );
textLine.append( ":" + QString( output ) );
} else
textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) );
if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line
for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i )
text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" );
} else
text.append( textLine + "\r\n" );
}
}
}
text.append( "END:VCARD\r\n" );
text.append( "\r\n" );
}
return text;
}
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp
index 204326e..435c3b0 100644
--- a/kabc/vcardparser/vcardtool.cpp
+++ b/kabc/vcardparser/vcardtool.cpp
@@ -623,65 +623,65 @@ QString VCardTool::createDateTime( const QDateTime &dateTime )
}
return str;
}
Picture VCardTool::parsePicture( const VCardLine &line )
{
Picture pic;
const QStringList params = line.parameterList();
if ( params.findIndex( "encoding" ) != -1 ) {
QImage img;
img.loadFromData( line.valueBytes() );
pic.setData( img );
} else if ( params.findIndex( "value" ) != -1 ) {
if ( line.parameter( "value" ).lower() == "uri" )
pic.setUrl( line.valueString() );
}
if ( params.findIndex( "type" ) != -1 )
pic.setType( line.parameter( "type" ) );
return pic;
}
VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pic )
{
VCardLine line( identifier );
if ( pic.isIntern() ) {
if ( !pic.data().isNull() ) {
QByteArray input;
- QDataStream s( input, IO_WriteOnly );
+ QDataStream s( &input, QIODevice::WriteOnly );
s.setVersion( 4 );
s << pic.data();
line.setValueBytes( input );
line.addParameter( "encoding", "b" );
line.addParameter( "type", "image/png" );
}
} else if ( !pic.url().isEmpty() ) {
QByteArray ba;
line.setValueString( pic.url() );
line.addParameter( "value", "URI" );
}
return line;
}
Sound VCardTool::parseSound( const VCardLine &line )
{
Sound snd;
const QStringList params = line.parameterList();
if ( params.findIndex( "encoding" ) != -1 )
snd.setData( line.valueBytes() );
else if ( params.findIndex( "value" ) != -1 ) {
if ( line.parameter( "value" ).lower() == "uri" )
snd.setUrl( line.valueString() );
}
/* TODO: support sound types
if ( params.contains( "type" ) )
snd.setType( line.parameter( "type" ) );
*/
diff --git a/kaddressbook/addresseditwidget.cpp b/kaddressbook/addresseditwidget.cpp
index 3dcd592..83908d0 100644
--- a/kaddressbook/addresseditwidget.cpp
+++ b/kaddressbook/addresseditwidget.cpp
@@ -1,216 +1,223 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qcheckbox.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistbox.h>
-#include <qlistview.h>
+#include <q3listbox.h>
+#include <q3listview.h>
#include <qpushbutton.h>
-#include <qsignal.h>
+#include <q3signal.h>
#include <qstring.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
#ifndef KAB_EMBEDDED
-#include <qtextedit.h>
+#include <q3textedit.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3VBoxLayout>
#include <kaccelmanager.h>
#include <kbuttonbox.h>
#else //KAB_EMBEDDED
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#endif //KAB_EMBEDDED
#include <qtoolbutton.h>
#include <qtooltip.h>
#include <kapplication.h>
#include <kcombobox.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kseparator.h>
#include "addresseditwidget.h"
AddressEditWidget::AddressEditWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
mConfig = AddresseeConfig::instance();
- QVBoxLayout *layout = new QVBoxLayout( this );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this );
layout->setSpacing( KDialog::spacingHintSmall() );
- QHBox *b1 = new QHBox( this);
+ Q3HBox *b1 = new Q3HBox( this);
//QLabel * label = new QLabel( b1 );
//label->setPixmap( KGlobal::iconLoader()->loadIcon( "gohome", KIcon::Desktop, 0 ) );
//label->setAlignment( AlignCenter);
layout->addWidget( b1 );
mTypeCombo = new AddressTypeCombo( mAddressList, b1 );
QPushButton *editButton = new QPushButton( i18n( "&Edit Addresses..." ),
b1 );
connect( mTypeCombo, SIGNAL( activated( int ) ),
SLOT( updateAddressEdit() ) );
// layout->addWidget( mTypeCombo );
#ifndef KAB_EMBEDDED
- mAddressTextEdit = new QTextEdit( this );
+ mAddressTextEdit = new Q3TextEdit( this );
mAddressTextEdit->setReadOnly( true );
mAddressTextEdit->setMinimumHeight( 20 );
#else //KAB_EMBEDDED
- mAddressTextEdit = new QMultiLineEdit( this );
+ mAddressTextEdit = new Q3MultiLineEdit( this );
mAddressTextEdit->setReadOnly( true );
mAddressTextEdit->setMinimumHeight( 20 );
#endif //KAB_EMBEDDED
layout->addWidget( mAddressTextEdit );
connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) );
}
AddressEditWidget::~AddressEditWidget()
{
}
KABC::Address::List AddressEditWidget::addresses()
{
KABC::Address::List retList;
KABC::Address::List::Iterator it;
for ( it = mAddressList.begin(); it != mAddressList.end(); ++it )
if ( !(*it).isEmpty() )
retList.append( *it );
return retList;
}
void AddressEditWidget::setAddresses( const KABC::Addressee &addr,
const KABC::Address::List &list )
{
mAddressee = addr;
mAddressList.clear();
// Insert types for existing numbers.
mTypeCombo->insertTypeList( list );
- QValueList<int> defaultTypes;
+ Q3ValueList<int> defaultTypes;
defaultTypes << KABC::Address::Home;
defaultTypes << KABC::Address::Work;
mConfig->setUid( mAddressee.uid() );
- QValueList<int> configList = mConfig->noDefaultAddrTypes();
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int> configList = mConfig->noDefaultAddrTypes();
+ Q3ValueList<int>::ConstIterator it;
for ( it = configList.begin(); it != configList.end(); ++it )
defaultTypes.remove( *it );
// Insert default types.
// Doing this for mPrefCombo is enough because the list is shared by all
// combos.
for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
if ( !mTypeCombo->hasType( *it ) )
mTypeCombo->insertType( list, *it, Address( *it ) );
}
mTypeCombo->updateTypes();
// find preferred address which will be shown
int preferred = KABC::Address::Home; // default if no preferred address set
uint i;
for (i = 0; i < list.count(); i++)
if ( list[i].type() & KABC::Address::Pref ) {
preferred = list[i].type();
break;
}
mTypeCombo->selectType( preferred );
updateAddressEdit();
}
void AddressEditWidget::edit()
{
AddressEditDialog dialog( mAddressList, mTypeCombo->currentItem(), this );
if ( dialog.exec() ) {
if ( dialog.changed() ) {
mAddressList = dialog.addresses();
bool hasHome = false, hasWork = false;
KABC::Address::List::Iterator it;
for ( it = mAddressList.begin(); it != mAddressList.end(); ++it ) {
if ( (*it).type() == KABC::Address::Home ) {
if ( !(*it).isEmpty() )
hasHome = true;
}
if ( (*it).type() == KABC::Address::Work ) {
if ( !(*it).isEmpty() )
hasWork = true;
}
}
mConfig->setUid( mAddressee.uid() );
- QValueList<int> configList;
+ Q3ValueList<int> configList;
if ( !hasHome ) {
configList << KABC::Address::Home;
}
if ( !hasWork ) {
configList << KABC::Address::Work;
}
mConfig->setNoDefaultAddrTypes( configList );
mTypeCombo->updateTypes();
updateAddressEdit();
emit modified();
}
}
}
void AddressEditWidget::updateAddressEdit()
{
KABC::Address::List::Iterator it = mTypeCombo->selectedElement();
bool block = signalsBlocked();
blockSignals( true );
mAddressTextEdit->setText( "" );
if ( it != mAddressList.end() ) {
KABC::Address a = *it;
if ( !a.isEmpty() ) {
#if KDE_VERSION >= 319
if ( a.type() & KABC::Address::Work ) {
mAddressTextEdit->setText( a.formattedAddress( mAddressee.realName(),
mAddressee.organization() ) );
} else {
@@ -226,128 +233,128 @@ void AddressEditWidget::updateAddressEdit()
text += a.locality() + QString(" ") + a.region();
if ( !a.postalCode().isEmpty() )
text += QString(", ") + a.postalCode();
text += "\n";
if ( !a.country().isEmpty() )
text += a.country() + "\n";
text += a.extended();
mAddressTextEdit->setText( text );
#endif
}
}
blockSignals( block );
}
AddressEditDialog::AddressEditDialog( const KABC::Address::List &list,
int selected, QWidget *parent,
const char *name )
: KDialogBase( Plain, i18n( "Edit Address" ), Ok | Cancel, Ok,
parent, name, true, true ),
mPreviousAddress( 0 )
{
mAddressList = list;
QWidget *page = plainPage();
- QGridLayout *topLayout = new QGridLayout( page, 8, 2 );
+ Q3GridLayout *topLayout = new Q3GridLayout( page, 8, 2 );
topLayout->setSpacing( spacingHintSmall() );
mTypeCombo = new AddressTypeCombo( mAddressList, page );
topLayout->addMultiCellWidget( mTypeCombo, 0, 0, 0, 1 );
QLabel *label = new QLabel( i18n( "Street:" ), page );
label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
topLayout->addWidget( label, 1, 0 );
#ifndef KAB_EMBEDDED
- mStreetTextEdit = new QTextEdit( page );
+ mStreetTextEdit = new Q3TextEdit( page );
#else //KAB_EMBEDDED
- mStreetTextEdit = new QMultiLineEdit( page );
+ mStreetTextEdit = new Q3MultiLineEdit( page );
//US qDebug("AddressEditDialog::AddressEditDialog has to be changed");
#endif //KAB_EMBEDDED
label->setBuddy( mStreetTextEdit );
topLayout->addWidget( mStreetTextEdit, 1, 1 );
label = new QLabel( i18n( "Post office box:" ), page );
topLayout->addWidget( label, 2 , 0 );
mPOBoxEdit = new KLineEdit( page );
label->setBuddy( mPOBoxEdit );
topLayout->addWidget( mPOBoxEdit, 2, 1 );
int maxwid = QApplication::desktop()->width();
maxwid -= (spacingHintSmall()+label->sizeHint().width() );
label = new QLabel( i18n( "Locality:" ), page );
topLayout->addWidget( label, 3, 0 );
mLocalityEdit = new KLineEdit( page );
label->setBuddy( mLocalityEdit );
topLayout->addWidget( mLocalityEdit, 3, 1 );
label = new QLabel( i18n( "Region:" ), page );
topLayout->addWidget( label, 4, 0 );
mRegionEdit = new KLineEdit( page );
label->setBuddy( mRegionEdit );
topLayout->addWidget( mRegionEdit, 4, 1 );
label = new QLabel( i18n( "Postal code:" ), page );
topLayout->addWidget( label, 5, 0 );
mPostalCodeEdit = new KLineEdit( page );
label->setBuddy( mPostalCodeEdit );
topLayout->addWidget( mPostalCodeEdit, 5, 1 );
label = new QLabel( i18n( "Country:" ), page );
topLayout->addWidget( label, 6, 0 );
mCountryCombo = new KComboBox( page );
mCountryCombo->setMaximumWidth( maxwid -10 );
mCountryCombo->setEditable( true );
mCountryCombo->setDuplicatesEnabled( false );
mCountryCombo->setAutoCompletion( true );
fillCountryCombo();
label->setBuddy( mCountryCombo );
topLayout->addWidget( mCountryCombo, 6, 1 );
- mCountryCombo->setSizeLimit( 8);
+ mCountryCombo->setMaxVisibleItems( 8);
mPreferredCheckBox = new QCheckBox( i18n( "This is the preferred address" ), page );
topLayout->addMultiCellWidget( mPreferredCheckBox, 7, 7, 0, 1 );
/*
KSeparator *sep = new KSeparator( KSeparator::HLine, page );
topLayout->addMultiCellWidget( sep, 8, 8, 0, 1 );
*/
- QHBox *buttonBox = new QHBox( page );
+ Q3HBox *buttonBox = new Q3HBox( page );
buttonBox->setSpacing( spacingHint() );
topLayout->addMultiCellWidget( buttonBox, 9, 9, 0, 1 );
QPushButton *addButton = new QPushButton( i18n( "New..." ), buttonBox );
connect( addButton, SIGNAL( clicked() ), SLOT( addAddress() ) );
mRemoveButton = new QPushButton( i18n( "Remove" ), buttonBox );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeAddress() ) );
mChangeTypeButton = new QPushButton( i18n( "Change Type" ), buttonBox );
connect( mChangeTypeButton, SIGNAL( clicked() ), SLOT( changeType() ) );
mTypeCombo->updateTypes();
mTypeCombo->setCurrentItem( selected );
updateAddressEdits();
connect( mTypeCombo, SIGNAL( activated( int ) ),
SLOT( updateAddressEdits() ) );
connect( mStreetTextEdit, SIGNAL( textChanged() ), SLOT( modified() ) );
connect( mPOBoxEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mLocalityEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mRegionEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mPostalCodeEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mCountryCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
connect( mPreferredCheckBox, SIGNAL( toggled( bool ) ), SLOT( modified() ) );
#ifndef KAB_EMBEDDED
KAcceleratorManager::manage( this );
#else //KAB_EMBEDDED
//US qDebug("AddressEditDialog::AddressEditDialog has to be changed 2");
#endif //KAB_EMBEDDED
@@ -554,69 +561,69 @@ void AddressEditDialog::fillCountryCombo()
i18n( "Sri Lanka" ), i18n( "St. Kitts and Nevis" ), i18n( "Sudan" ),
i18n( "Suriname" ), i18n( "Swaziland" ), i18n( "Sweden" ),
i18n( "Switzerland" ), i18n( "Syria" ), i18n( "Taiwan" ),
i18n( "Tajikistan" ), i18n( "Tanzania" ), i18n( "Thailand" ),
i18n( "Tibet" ), i18n( "Togo" ), i18n( "Tonga" ),
i18n( "Trinidad and Tobago" ), i18n( "Tunisia" ), i18n( "Turkey" ),
i18n( "Turkmenistan" ), i18n( "Turks and Caicos Islands" ),
i18n( "Tuvalu" ), i18n( "Uganda " ), i18n( "Ukraine" ),
i18n( "United Arab Emirates" ), i18n( "United Kingdom" ),
i18n( "United States" ), i18n( "Uruguay" ), i18n( "Uzbekistan" ),
i18n( "Vanuatu" ), i18n( "Vatican City" ), i18n( "Venezuela" ),
i18n( "Vietnam" ), i18n( "Western Samoa" ), i18n( "Yemen" ),
i18n( "Yugoslavia" ), i18n( "Zaire" ), i18n( "Zambia" ),
i18n( "Zimbabwe" ),
""
};
QStringList countries;
for ( int i = 0; !country[ i ].isEmpty(); ++i )
countries.append( country[ i ] );
countries.sort();
mCountryCombo->insertStringList( countries );
}
AddressTypeDialog::AddressTypeDialog( int type, QWidget *parent )
: KDialogBase( Plain, i18n( "Edit Address Type" ), Ok | Cancel, Ok,
parent, "AddressTypeDialog" )
{
QWidget *page = plainPage();
- QVBoxLayout *layout = new QVBoxLayout( page );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( page );
- mGroup = new QButtonGroup( 2, Horizontal, i18n( "Address Types" ), page );
+ mGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "Address Types" ), page );
layout->addWidget( mGroup );
mTypeList = KABC::Address::typeList();
mTypeList.remove( KABC::Address::Pref );
KABC::Address::TypeList::Iterator it;
for ( it = mTypeList.begin(); it != mTypeList.end(); ++it )
new QCheckBox( KABC::Address::typeLabel( *it ), mGroup );
for ( int i = 0; i < mGroup->count(); ++i ) {
QCheckBox *box = (QCheckBox*)mGroup->find( i );
box->setChecked( type & mTypeList[ i ] );
}
}
AddressTypeDialog::~AddressTypeDialog()
{
}
int AddressTypeDialog::type() const
{
int type = 0;
for ( int i = 0; i < mGroup->count(); ++i ) {
QCheckBox *box = (QCheckBox*)mGroup->find( i );
if ( box->isChecked() )
type += mTypeList[ i ];
}
return type;
}
-#ifndef KAB_EMBEDDED
-#include "addresseditwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_addresseditwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addresseditwidget.h b/kaddressbook/addresseditwidget.h
index bc96d74..1d4e138 100644
--- a/kaddressbook/addresseditwidget.h
+++ b/kaddressbook/addresseditwidget.h
@@ -4,156 +4,156 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ADDRESSEDITWIDGET_H
#define ADDRESSEDITWIDGET_H
#include <qwidget.h>
#include <kdialogbase.h>
#include <kabc/address.h>
#include <kabc/addressee.h>
#include "addresseeconfig.h"
#include "typecombo.h"
-class QButtonGroup;
+class Q3ButtonGroup;
class QCheckBox;
-class QListView;
+class Q3ListView;
#ifndef KAB_EMBEDDED
-class QTextEdit;
+class Q3TextEdit;
#else //KAB_EMBEDDED
-class QMultiLineEdit;
+class Q3MultiLineEdit;
#endif //KAB_EMBEDDED
class QToolButton;
class KComboBox;
class KLineEdit;
class KListView;
typedef TypeCombo<KABC::Address> AddressTypeCombo;
/**
Editor widget for addresses.
*/
class AddressEditWidget : public QWidget
{
Q_OBJECT
public:
AddressEditWidget( QWidget *parent, const char *name = 0 );
~AddressEditWidget();
KABC::Address::List addresses();
void setAddresses( const KABC::Addressee &addr,
const KABC::Address::List &list );
void updateTypeCombo( const KABC::Address::List&, KComboBox* );
KABC::Address currentAddress( KComboBox*, int );
signals:
void modified();
protected slots:
void updateAddressEdit();
void edit();
private:
AddresseeConfig * mConfig;
AddressTypeCombo *mTypeCombo;
QPushButton *mEditButton;
#ifndef KAB_EMBEDDED
- QTextEdit *mAddressTextEdit;
+ Q3TextEdit *mAddressTextEdit;
#else //KAB_EMBEDDED
- QMultiLineEdit *mAddressTextEdit;
+ Q3MultiLineEdit *mAddressTextEdit;
#endif //KAB_EMBEDDED
KABC::Address::List mAddressList;
KABC::Addressee mAddressee;
int mIndex;
};
/**
Dialog for editing address details.
*/
class AddressEditDialog : public KDialogBase
{
Q_OBJECT
public:
AddressEditDialog( const KABC::Address::List &list, int selected,
QWidget *parent, const char *name = 0 );
~AddressEditDialog();
KABC::Address::List addresses();
bool changed() const;
protected slots:
void addAddress();
void removeAddress();
void changeType();
void updateAddressEdits();
void modified();
private:
void saveAddress( KABC::Address &addr );
void fillCountryCombo();
AddressTypeCombo *mTypeCombo;
#ifndef KAB_EMBEDDED
- QTextEdit *mStreetTextEdit;
+ Q3TextEdit *mStreetTextEdit;
#else //KAB_EMBEDDED
- QMultiLineEdit *mStreetTextEdit;
+ Q3MultiLineEdit *mStreetTextEdit;
#endif //KAB_EMBEDDED
KComboBox *mCountryCombo;
KLineEdit *mRegionEdit;
KLineEdit *mLocalityEdit;
KLineEdit *mPostalCodeEdit;
KLineEdit *mPOBoxEdit;
QCheckBox *mPreferredCheckBox;
QPushButton *mRemoveButton;
QPushButton *mChangeTypeButton;
KABC::Address::List mAddressList;
KABC::Address *mPreviousAddress;
bool mChanged;
};
/**
Dialog for selecting an address type.
*/
class AddressTypeDialog : public KDialogBase
{
public:
AddressTypeDialog( int type, QWidget *parent );
~AddressTypeDialog();
int type() const;
private:
- QButtonGroup *mGroup;
+ Q3ButtonGroup *mGroup;
KABC::Address::TypeList mTypeList;
};
#endif
diff --git a/kaddressbook/addresseeconfig.cpp b/kaddressbook/addresseeconfig.cpp
index ea0436f..81b1bf4 100644
--- a/kaddressbook/addresseeconfig.cpp
+++ b/kaddressbook/addresseeconfig.cpp
@@ -1,94 +1,96 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include "addresseeconfig.h"
#include "kabprefs.h"
//US
#include <kstandarddirs.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KABC;
static AddresseeConfig* extern_AddresseeConfig = 0;
static KConfig * extern_Config = 0;
AddresseeConfig::AddresseeConfig()
{
}
AddresseeConfig::~AddresseeConfig()
{
delete AddresseeConfig::config();
}
AddresseeConfig* AddresseeConfig::instance()
{
if ( ! extern_AddresseeConfig )
extern_AddresseeConfig = new AddresseeConfig();
return extern_AddresseeConfig;
}
KConfig* AddresseeConfig::config()
{
if ( ! extern_Config ) {
QString conf = locateLocal("config", "kaddressrc");
extern_Config= new KConfig( conf );
}
return extern_Config;
}
void AddresseeConfig::setUid( const QString & uid )
{
AddresseeConfig::config()->setGroup( uid );
mUid = uid;
}
void AddresseeConfig::setAutomaticNameParsing( bool value )
{
AddresseeConfig::config()->writeEntry( "AutomaticNameParsing", value );
}
bool AddresseeConfig::automaticNameParsing()
{
return AddresseeConfig::config()->readBoolEntry( "AutomaticNameParsing",
KABPrefs::instance()->mAutomaticNameParsing );
}
-void AddresseeConfig::setNoDefaultAddrTypes( const QValueList<int> &types )
+void AddresseeConfig::setNoDefaultAddrTypes( const Q3ValueList<int> &types )
{
AddresseeConfig::config()->writeEntry( "NoDefaultAddrTypes", types );
AddresseeConfig::config()->sync();
}
- QValueList<int> AddresseeConfig::noDefaultAddrTypes() const
+ Q3ValueList<int> AddresseeConfig::noDefaultAddrTypes() const
{
return AddresseeConfig::config()->readIntListEntry( "NoDefaultAddrTypes" );
}
void AddresseeConfig::remove( const QString & uid )
{
AddresseeConfig::config()->deleteGroup( uid );
}
diff --git a/kaddressbook/addresseeconfig.h b/kaddressbook/addresseeconfig.h
index 47fbdd6..f6bb3e9 100644
--- a/kaddressbook/addresseeconfig.h
+++ b/kaddressbook/addresseeconfig.h
@@ -1,55 +1,57 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ADDRESSEECONFIG_H
#define ADDRESSEECONFIG_H
#include <kabc/addressee.h>
#include <kconfig.h>
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KABC;
class AddresseeConfig
{
public:
AddresseeConfig();
~AddresseeConfig();
static AddresseeConfig* instance();
static KConfig* config();
Addressee addressee();
void setUid( const QString & uid );
void setAutomaticNameParsing( bool value );
bool automaticNameParsing();
- void setNoDefaultAddrTypes( const QValueList<int> &types );
- QValueList<int> noDefaultAddrTypes() const;
+ void setNoDefaultAddrTypes( const Q3ValueList<int> &types );
+ Q3ValueList<int> noDefaultAddrTypes() const;
void remove( const QString & uid);
private:
QString mUid;
};
#endif
diff --git a/kaddressbook/addresseeeditordialog.cpp b/kaddressbook/addresseeeditordialog.cpp
index b5a60f2..b925a07 100644
--- a/kaddressbook/addresseeeditordialog.cpp
+++ b/kaddressbook/addresseeeditordialog.cpp
@@ -1,78 +1,81 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include "addresseeeditorwidget.h"
#include "kabcore.h"
#include "addresseeeditordialog.h"
AddresseeEditorDialog::AddresseeEditorDialog( KABCore *core, QWidget *parent,
const char *name )
: KDialogBase( KDialogBase::Plain, i18n( "Edit Contact" ),
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Apply,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
- QVBoxLayout *layout = new QVBoxLayout( page );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( page );
mEditorWidget = new AddresseeEditorWidget( core, false, page );
connect( mEditorWidget, SIGNAL( modified( const KABC::Addressee::List& ) ),
SLOT( widgetModified() ) );
layout->addWidget( mEditorWidget );
enableButton( KDialogBase::Apply, false );
if ( QApplication::desktop()->width() < 480 ) {
hideButtons();
}
}
AddresseeEditorDialog::~AddresseeEditorDialog()
{
//emit editorDestroyed( mEditorWidget->addressee().uid() );
}
void AddresseeEditorDialog::setAddressee( const KABC::Addressee &addr )
{
enableButton( KDialogBase::Apply, false );
mEditorWidget->setAddressee( addr );
this->setCaption(i18n ("Edit ") + addr.formattedName());
}
KABC::Addressee AddresseeEditorDialog::addressee()
{
return mEditorWidget->addressee();
}
bool AddresseeEditorDialog::dirty()
@@ -89,35 +92,35 @@ void AddresseeEditorDialog::slotApply()
enableButton( KDialogBase::Apply, false );
KDialogBase::slotApply();
}
void AddresseeEditorDialog:: accept ()
{
slotOk();
}
void AddresseeEditorDialog::slotOk()
{
slotApply();
//KDialogBase::slotOk();
emit okClicked();
QDialog::accept();
}
void AddresseeEditorDialog::widgetModified()
{
enableButton( KDialogBase::Apply, true );
}
void AddresseeEditorDialog::slotCancel()
{
KDialogBase::slotCancel();
}
-#ifndef KAB_EMBEDDED
-#include "addresseeeditordialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_addresseeeditordialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 4313998..a95db03 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,73 +1,77 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcheckbox.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qapplication.h>
#ifndef KAB_EMBEDDED
-#include <qtextedit.h>
+#include <q3textedit.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
#include <kaccelmanager.h>
#include "keywidget.h"
#include "soundwidget.h"
#else //KAB_EMBEDDED
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#endif //KAB_EMBEDDED
#include "keywidget.h"
#include "geowidget.h"
#include "imagewidget.h"
#include "nameeditdialog.h"
#include "phoneeditwidget.h"
#include "secrecywidget.h"
#include <qtoolbutton.h>
#include <qtooltip.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kseparator.h>
#include <ksqueezedtextlabel.h>
#include <libkdepim/categoryeditdialog.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kdateedit.h>
@@ -101,95 +105,95 @@ AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
AddresseeEditorWidget::~AddresseeEditorWidget()
{
kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
}
void AddresseeEditorWidget::contactsSelectionChanged()
{
KABC::Addressee::List list = selectedContacts();
mAddressee = list[ 0 ];
load();
}
void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
{
mAddressee = addr;
load();
}
const KABC::Addressee &AddresseeEditorWidget::addressee()
{
return mAddressee;
}
void AddresseeEditorWidget::textChanged( const QString& )
{
emitModified();
}
void AddresseeEditorWidget::initGUI()
{
- QVBoxLayout *layout = new QVBoxLayout( this );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this );
mTabWidget = new QTabWidget( this );
layout->addWidget( mTabWidget );
setupTab1();
setupTab1_1();
setupTab2();
setupTab2_1();
setupTab3();
setupTab3_1();
mNameEdit->setFocus();
connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
SLOT( pageChanged(QWidget*) ) );
}
void AddresseeEditorWidget::setupTab1()
{
// This is the General tab
QWidget *tab1 = new QWidget( mTabWidget );
//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
bool horLayout = false;
int maxCol = 1;
if ( QApplication::desktop()->width() == 640 || QApplication::desktop()->width() == 320 ) {
horLayout = true;
maxCol = 3;
}
- QGridLayout *layout = new QGridLayout( tab1, 7-maxCol, maxCol );
+ Q3GridLayout *layout = new Q3GridLayout( tab1, 7-maxCol, maxCol );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
QPushButton *button;
//////////////////////////////////
// Upper left group (person info)
// Person icon
/* LR
label = new QLabel( tab1 );
//US ambiguous call. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 0, 1, 0, 0 );
*/
// First name
button = new QPushButton( i18n( "Name..." ), tab1 );
//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
mNameEdit = new KLineEdit( tab1, "mNameEdit" );
connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( nameTextChanged( const QString& ) ) );
connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
mNameLabel = new KSqueezedTextLabel( tab1 );
mNameLabel->hide();
layout->addWidget( button, 0, 0 );
layout->addWidget( mNameEdit, 0, 1 );
@@ -298,75 +302,75 @@ void AddresseeEditorWidget::setupTab1()
// add the separator
bar = new KSeparator( KSeparator::HLine, tab1 );
layout->addMultiCellWidget( bar, 7, 7, 3, 6 );
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, 0) );
layout->addMultiCellWidget( label, 8, 9, 3, 3 );
label = new QLabel( i18n( "URL:" ), tab1 );
mURLEdit = new KLineEdit( tab1 );
connect( mURLEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mURLEdit );
layout->addWidget( label, 8, 4 );
layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
label = new QLabel( i18n( "&IM address:" ), tab1 );
mIMAddressEdit = new KLineEdit( tab1 );
connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mIMAddressEdit );
layout->addWidget( label, 9, 4 );
layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
layout->addColSpacing( 6, 50 );
bar = new KSeparator( KSeparator::HLine, tab1 );
layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
*/
///////////////////////////////////////
- QHBox *categoryBox = new QHBox( tab1 ,"cato");
+ Q3HBox *categoryBox = new Q3HBox( tab1 ,"cato");
categoryBox->setSpacing( KDialogBase::spacingHint() );
categoryBox->setMargin( KDialogBase::marginHintSmall() );
// Categories
button = new QPushButton( i18n( "Categories" )+":", categoryBox );
connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
mCategoryEdit = new QPushButton ( categoryBox );
mCategoryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
- mCatPopup = new QPopupMenu ( categoryBox );
+ mCatPopup = new Q3PopupMenu ( categoryBox );
mCategoryEdit->setPopup( mCatPopup );
connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
//connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
// SLOT( textChanged( const QString& ) ) );
mSecrecyWidget = new SecrecyWidget( categoryBox );
connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab1, i18n( "&General" ) );
}
void AddresseeEditorWidget::showCatPopup()
{
mCatPopup->clear();
QStringList checkedCategories = QStringList::split (",", mCategoryEdit->text());
int index = 0;
for (QStringList::Iterator it = KABPrefs::instance()->mCustomCategories.begin ();
it != KABPrefs::instance()->mCustomCategories.end ();
++it) {
mCatPopup->insertItem (*it, index );
//mCategory[index] = *it;
if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
++index;
}
}
@@ -382,65 +386,65 @@ void AddresseeEditorWidget::selectedCatPopup( int index )
if ( !colcat.isEmpty() ) {
if ( categories.find ( colcat ) != categories.end () ) {
categories.remove( colcat );
categories.prepend( colcat );
}
}
mCategoryEdit->setText( categories.join(",") );
emitModified();
}
void AddresseeEditorWidget::setRole2FN()
{
if ( mRoleEdit->text().isEmpty() ) return;
mFormattedNameType = NameEditDialog::CustomName;
mAddressee.setFormattedName( mRoleEdit->text() );
mFormattedNameLabel->setText( mRoleEdit->text() );
emitModified();
}
void AddresseeEditorWidget::setCompany2FN()
{
if ( mOrgEdit->text().isEmpty() ) return;
mFormattedNameType = NameEditDialog::CustomName;
mAddressee.setFormattedName( mOrgEdit->text() );
mFormattedNameLabel->setText( mOrgEdit->text() );
emitModified();
}
void AddresseeEditorWidget::setupTab1_1()
{
// This is the Address tab
QWidget *tab1_1 = new QWidget( mTabWidget );
//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
- QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
+ Q3GridLayout *layout = new Q3GridLayout( tab1_1, 7, 2 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
QPushButton *button;
/*US
//////////////////////////////////
// Upper left group (person info)
// Person icon
label = new QLabel( tab1 );
//US ambiguous call. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 0, 1, 0, 0 );
// First name
button = new QPushButton( i18n( "Name..." ), tab1 );
QToolTip::add( button, i18n( "Edit the contact's name" ) );
mNameEdit = new KLineEdit( tab1, "mNameEdit" );
connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( nameTextChanged( const QString& ) ) );
connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
#ifndef KAB_EMBEDDED
mNameLabel = new KSqueezedTextLabel( tab1 );
mNameLabel->hide();
#else //KAB_EMBEDDED
qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
#endif //KAB_EMBEDDED
@@ -583,65 +587,65 @@ qDebug("AddresseeEditorWidget::setupTab1 has to be changed");
/*US
///////////////////////////////////////
QHBox *categoryBox = new QHBox( tab1 );
categoryBox->setSpacing( KDialogBase::spacingHintSmall() );
// Categories
button = new QPushButton( i18n( "Categories" ), categoryBox );
connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
mCategoryEdit = new KLineEdit( categoryBox );
mCategoryEdit->setReadOnly( true );
connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
mSecrecyWidget = new SecrecyWidget( categoryBox );
connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
*/
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab1_1, i18n( "&Address" ) );
}
void AddresseeEditorWidget::setupTab2()
{
// This is the Details tab
QWidget *tab2 = new QWidget( mTabWidget );
- QGridLayout *layout = new QGridLayout( tab2, 8, 3 );
+ Q3GridLayout *layout = new Q3GridLayout( tab2, 8, 3 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
///////////////////////
// Office info
// Department
label = new QLabel( tab2 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 0, 1, 0, 0 );
label = new QLabel( i18n( "Department:" ), tab2 );
layout->addWidget( label, 0, 1 );
mDepartmentEdit = new KLineEdit( tab2 );
connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mDepartmentEdit );
layout->addWidget( mDepartmentEdit, 0, 2 );
label = new QLabel( i18n( "Office:" ), tab2 );
layout->addWidget( label, 1, 1 );
mOfficeEdit = new KLineEdit( tab2 );
connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mOfficeEdit );
layout->addWidget( mOfficeEdit, 1, 2 );
@@ -662,109 +666,109 @@ void AddresseeEditorWidget::setupTab2()
label->setBuddy( mManagerEdit );
//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
layout->addWidget( mManagerEdit, 3, 2 );
label = new QLabel( i18n( "Assistant's name:" ), tab2 );
//US layout->addWidget( label, 1, 3 );
layout->addWidget( label, 4, 1 );
mAssistantEdit = new KLineEdit( tab2 );
connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mAssistantEdit );
//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
layout->addWidget( mAssistantEdit, 4, 2 );
bar = new KSeparator( KSeparator::HLine, tab2 );
//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
/////////////////////////////////////////////////
// Personal info
//label = new QLabel( tab2 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
//label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
//layout->addMultiCellWidget( label, 6, 7, 0, 0 );
int iii = 6;
if ( QApplication::desktop()->width() == 640 ) {
- QHBox * nbox = new QHBox ( tab2 );
+ Q3HBox * nbox = new Q3HBox ( tab2 );
label = new QLabel( i18n( "Nick name:" )+" ", nbox );
mNicknameEdit = new KLineEdit( nbox );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
label = new QLabel( " "+i18n( "Spouse's name:" )+" ", nbox );
mSpouseEdit = new KLineEdit( nbox );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
++iii;
} else {
label = new QLabel( i18n( "Nick name:" ), tab2 );
layout->addWidget( label, iii, 1 );
mNicknameEdit = new KLineEdit( tab2 );
connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mNicknameEdit );
layout->addWidget( mNicknameEdit, iii, 2 );
++iii;
label = new QLabel( i18n( "Spouse's name:" ), tab2 );
layout->addWidget( label, iii, 1 );
mSpouseEdit = new KLineEdit( tab2 );
connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mSpouseEdit );
layout->addWidget( mSpouseEdit, iii, 2 );
++iii;
}
label = new QLabel( i18n( "Children's names:" ), tab2 );
layout->addWidget( label, iii, 1 );
mChildEdit = new KLineEdit( tab2 );
connect( mChildEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mChildEdit );
layout->addWidget( mChildEdit, iii, 2 );
++iii;
if ( QApplication::desktop()->width() == 640 ) {
- QHBox * nbox = new QHBox ( tab2 );
+ Q3HBox * nbox = new Q3HBox ( tab2 );
label = new QLabel( i18n( "Birthday:" )+" ", nbox );
mBirthdayPicker = new KDateEdit( nbox );
//mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
label = new QLabel( " "+i18n( "Anniversary:" )+" ", nbox );
mAnniversaryPicker = new KDateEdit( nbox );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mAnniversaryPicker );
layout->addMultiCellWidget( nbox, iii, iii, 1, 2 );
++iii;
} else {
label = new QLabel( i18n( "Birthday:" ), tab2 );
layout->addWidget( label, iii, 1 );
mBirthdayPicker = new KDateEdit( tab2 );
//mBirthdayPicker->toggleDateFormat();
mBirthdayPicker->setHandleInvalid( true );
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mBirthdayPicker );
layout->addWidget( mBirthdayPicker, iii, 2 );
++iii;
@@ -775,65 +779,65 @@ void AddresseeEditorWidget::setupTab2()
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
label->setBuddy( mAnniversaryPicker );
layout->addWidget( mAnniversaryPicker, iii, 2 );
++iii;
}
label = new QLabel( i18n( "Gender:" ), tab2 );
layout->addWidget( label, iii, 1 );
mGenderBox = new QComboBox ( tab2 );
mGenderBox->insertItem ( i18n( "ALIEN (undefined)" ));
mGenderBox->insertItem ( i18n( "female" ));
mGenderBox->insertItem ( i18n( "male" ));
connect( mGenderBox, SIGNAL( activated ( const QString & ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mGenderBox );
layout->addWidget( mGenderBox, iii, 2 );
++iii;
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab2, i18n( "&Details" ) );
}
void AddresseeEditorWidget::setupTab2_1()
{
// This is the Details tab
QWidget *tab2_2 = new QWidget( mTabWidget );
- QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
+ Q3GridLayout *layout = new Q3GridLayout( tab2_2, 1, 2 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
/*US
///////////////////////
// Office info
// Department
label = new QLabel( tab2 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 0, 1, 0, 0 );
label = new QLabel( i18n( "Department:" ), tab2 );
layout->addWidget( label, 0, 1 );
mDepartmentEdit = new KLineEdit( tab2 );
connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mDepartmentEdit );
layout->addWidget( mDepartmentEdit, 0, 2 );
label = new QLabel( i18n( "Office:" ), tab2 );
layout->addWidget( label, 1, 1 );
mOfficeEdit = new KLineEdit( tab2 );
connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
label->setBuddy( mOfficeEdit );
layout->addWidget( mOfficeEdit, 1, 2 );
@@ -897,144 +901,144 @@ void AddresseeEditorWidget::setupTab2_1()
connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
SLOT( invalidDate() ) );
connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
SLOT( emitModified() ) );
label->setBuddy( mBirthdayPicker );
layout->addWidget( mBirthdayPicker, 4, 4 );
label = new QLabel( i18n( "Anniversary:" ), tab2 );
layout->addWidget( label, 5, 3 );
mAnniversaryPicker = new KDateEdit( tab2 );
mAnniversaryPicker->setHandleInvalid( true );
connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
SLOT( dateChanged( QDate ) ) );
connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
SLOT( invalidDate() ) );
connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
SLOT( emitModified() ) );
label->setBuddy( mAnniversaryPicker );
layout->addWidget( mAnniversaryPicker, 5, 4 );
bar = new KSeparator( KSeparator::HLine, tab2 );
layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
*/
//////////////////////////////////////
// Notes
label = new QLabel( i18n( "Note:" ), tab2_2 );
label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
//US layout->addWidget( label, 7, 0 );
layout->addWidget( label, 0, 0 );
#ifndef KAB_EMBEDDED
- mNoteEdit = new QTextEdit( tab2_2 );
- mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
+ mNoteEdit = new Q3TextEdit( tab2_2 );
+ mNoteEdit->setWordWrap( Q3TextEdit::WidgetWidth );
mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
#else //KAB_EMBEDDED
- mNoteEdit = new QMultiLineEdit( tab2_2 );
- mNoteEdit->setWordWrap( QMultiLineEdit::WidgetWidth );
+ mNoteEdit = new Q3MultiLineEdit( tab2_2 );
+ mNoteEdit->setWordWrap( Q3MultiLineEdit::WidgetWidth );
mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
#endif //KAB_EMBEDDED
connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
label->setBuddy( mNoteEdit );
//US layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
layout->addWidget( mNoteEdit, 1, 0);
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab2_2, i18n( "&Notes" ) );
}
void AddresseeEditorWidget::setupTab3()
{
// This is the Misc tab
QWidget *tab3 = new QWidget( mTabWidget );
- QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( tab3, 1, 1 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
//US layout->setColStretch( 2, 1 );
//////////////////////////////////////
// Geo
mGeoWidget = new GeoWidget( tab3 );
// mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mGeoWidget, 0, 0 );
/*US
//////////////////////////////////////
// Sound
#ifndef KAB_EMBEDDED
mSoundWidget = new SoundWidget( tab3 );
mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
#else //KAB_EMBEDDED
qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
#endif //KAB_EMBEDDED
//////////////////////////////////////
// Images
mImageWidget = new ImageWidget( tab3 );
mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
*/
//US
/*
KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
*/
//////////////////////////////////////
// Keys
mKeyWidget = new KeyWidget( tab3 );
//mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
layout->addWidget( mKeyWidget, 1, 0 );
mTabWidget->addTab( tab3, i18n( "&Misc" ) );
}
void AddresseeEditorWidget::setupTab3_1()
{
// This is the Misc tab
QWidget *tab3 = new QWidget( mTabWidget );
//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
- QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( tab3, 1, 1 );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
//US layout->setColStretch( 2, 1 );
/*US
//////////////////////////////////////
// Geo
mGeoWidget = new GeoWidget( tab3 );
mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
*/
//////////////////////////////////////
// Sound
#ifndef KAB_EMBEDDED
mSoundWidget = new SoundWidget( tab3 );
mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
#else //KAB_EMBEDDED
//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
#endif //KAB_EMBEDDED
//////////////////////////////////////
// Images
mImageWidget = new ImageWidget( tab3 );
mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
/*US
//////////////////////////////////////
// Keys
@@ -1401,35 +1405,35 @@ void AddresseeEditorWidget::dateChanged( QDate )
{
emitModified();
}
//US invalid dates are handdled by the KDateEdit widget itself
void AddresseeEditorWidget::invalidDate()
{
KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
}
void AddresseeEditorWidget::pageChanged( QWidget *wdg )
{
#ifndef KAB_EMBEDDED
if ( wdg )
KAcceleratorManager::manage( wdg );
#else //KAB_EMBEDDED
//US
#endif //KAB_EMBEDDED
}
QString AddresseeEditorWidget::title() const
{
return i18n( "Contact Editor" );
}
QString AddresseeEditorWidget::identifier() const
{
return i18n( "contact_editor" );
}
-#ifndef KAB_EMBEDDED
-#include "addresseeeditorwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_addresseeeditorwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index 816bbb5..aa1207e 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -1,77 +1,77 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ADDRESSEEEDITORWIDGET_H
#define ADDRESSEEEDITORWIDGET_H
#include <qdatetime.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcombobox.h>
#include <kabc/addressee.h>
#include <kdialogbase.h>
#include <kjanuswidget.h>
#include "extensionwidget.h"
class AddresseeConfig;
class QCheckBox;
class QSpinBox;
class QTabWidget;
#ifndef KAB_EMBEDDED
-class QTextEdit;
+class Q3TextEdit;
#else //KAB_EMBEDDED
-class QMultiLineEdit;
+class Q3MultiLineEdit;
#endif //KAB_EMBEDDED
class KComboBox;
class KDateEdit;
class KLineEdit;
class KSqueezedTextLabel;
class AddressEditWidget;
class EmailEditWidget;
class GeoWidget;
class ImageWidget;
class KABCore;
class KeyWidget;
class PhoneEditWidget;
class SecrecyWidget;
class SoundWidget;
namespace KPIM
{
class CategorySelectDialog;
class CategoryEditDialog;
}
namespace KABC { class AddressBook; }
class AddresseeEditorWidget : public ExtensionWidget
{
Q_OBJECT
public:
AddresseeEditorWidget( KABCore *core, bool isExtension,
QWidget *parent, const char *name = 0 );
@@ -126,68 +126,68 @@ class AddresseeEditorWidget : public ExtensionWidget
AddresseeConfig * mAConfig;
void initGUI();
void setupTab1();
void setupTab1_1();
void setupTab2();
void setupTab2_1();
void setupTab3();
void setupTab3_1();
KABC::Addressee mAddressee;
int mFormattedNameType;
bool mDirty;
bool mIsExtension;
bool mBlockSignals;
// GUI
KPIM::CategorySelectDialog *mCategoryDialog;
KPIM::CategoryEditDialog *mCategoryEditDialog;
QTabWidget *mTabWidget;
// Tab1 and Tab1_1
KLineEdit *mNameEdit;
KLineEdit *mRoleEdit;
KLineEdit *mOrgEdit;
KSqueezedTextLabel *mFormattedNameLabel;
AddressEditWidget *mAddressEditWidget;
EmailEditWidget *mEmailWidget;
PhoneEditWidget *mPhoneEditWidget;
KLineEdit *mURLEdit;
KLineEdit *mIMAddressEdit;
QPushButton *mCategoryEdit;
- QPopupMenu *mCatPopup;
+ Q3PopupMenu *mCatPopup;
SecrecyWidget *mSecrecyWidget;
KSqueezedTextLabel *mNameLabel;
// Tab2 and Tab2_2
KLineEdit *mDepartmentEdit;
KLineEdit *mOfficeEdit;
KLineEdit *mProfessionEdit;
KLineEdit *mManagerEdit;
KLineEdit *mAssistantEdit;
KLineEdit *mNicknameEdit;
KLineEdit *mSpouseEdit;
KLineEdit *mChildEdit;
QComboBox *mGenderBox;
KDateEdit *mBirthdayPicker;
KDateEdit *mAnniversaryPicker;
#ifndef KAB_EMBEDDED
- QTextEdit *mNoteEdit;
+ Q3TextEdit *mNoteEdit;
#else //KAB_EMBEDDED
- QMultiLineEdit *mNoteEdit;
+ Q3MultiLineEdit *mNoteEdit;
#endif //KAB_EMBEDDED
QSpinBox *mTimeZoneSpin;
QSpinBox *mGeoLat;
QSpinBox *mGeoLon;
// Tab3
GeoWidget *mGeoWidget;
ImageWidget *mImageWidget;
#ifndef KAB_EMBEDDED
SoundWidget *mSoundWidget;
#endif //KAB_EMBEDDED
KeyWidget *mKeyWidget;
};
#endif
diff --git a/kaddressbook/addresseeutil.cpp b/kaddressbook/addresseeutil.cpp
index 366384a..a860f6d 100644
--- a/kaddressbook/addresseeutil.cpp
+++ b/kaddressbook/addresseeutil.cpp
@@ -17,50 +17,50 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kabc/stdaddressbook.h>
#include <kabc/vcardconverter.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include "addresseeutil.h"
QString AddresseeUtil::addresseesToClipboard( const KABC::Addressee::List &list )
{
KABC::VCardConverter converter;
QString vcard;
KABC::Addressee::List::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
QString tmp;
if ( converter.addresseeToVCard( *it, tmp ) )
vcard += tmp + "\r\n";
}
return vcard;
}
KABC::Addressee::List AddresseeUtil::clipboardToAddressees( const QString &data )
{
- uint numVCards = data.contains( "BEGIN:VCARD", false );
+ uint numVCards = data.count( "BEGIN:VCARD", Qt::CaseInsensitive );
QStringList dataList = QStringList::split( "\r\n\r\n", data );
KABC::Addressee::List addrList;
for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) {
KABC::VCardConverter converter;
KABC::Addressee addr;
if ( !converter.vCardToAddressee( dataList[ i ].stripWhiteSpace(), addr ) ) {
KMessageBox::error( 0, i18n( "Invalid vCard format in clipboard" ) );
continue;
}
addrList.append( addr );
}
return addrList;
}
diff --git a/kaddressbook/addviewdialog.cpp b/kaddressbook/addviewdialog.cpp
index 6def26b..b52a83c 100644
--- a/kaddressbook/addviewdialog.cpp
+++ b/kaddressbook/addviewdialog.cpp
@@ -1,118 +1,120 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KAB_EMBEDDED
#endif //KAB_EMBEDDED
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <klocale.h>
#include <kglobal.h>
#include "kaddressbookview.h"
#include "addviewdialog.h"
-AddViewDialog::AddViewDialog( QDict<ViewFactory> *viewFactoryDict,
+AddViewDialog::AddViewDialog( Q3Dict<ViewFactory> *viewFactoryDict,
QWidget *parent, const char *name )
: KDialogBase( KDialogBase::Plain, i18n( "Add View" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name ),
mViewFactoryDict( viewFactoryDict )
{
//US setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 300));
mTypeId = 0;
QWidget *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 2, 2 );
+ Q3GridLayout *layout = new Q3GridLayout( page, 2, 2 );
layout->setSpacing( spacingHint() );
layout->setRowStretch( 1, 1 );
layout->setColStretch( 1, 1 );
QLabel *label = new QLabel( i18n( "View name:" ), page );
layout->addWidget( label, 0, 0 );
mViewNameEdit = new QLineEdit( page );
connect( mViewNameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
layout->addWidget( mViewNameEdit, 0, 1 );
- mTypeGroup = new QButtonGroup( 2, Qt::Horizontal, i18n( "View Type" ), page );
+ mTypeGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "View Type" ), page );
connect( mTypeGroup, SIGNAL( clicked( int ) ), this, SLOT( clicked( int ) ) );
layout->addMultiCellWidget( mTypeGroup, 1, 1, 0, 1 );
// Now create the radio buttons. This needs some layout work.
- QDictIterator<ViewFactory> iter( *mViewFactoryDict );
+ Q3DictIterator<ViewFactory> iter( *mViewFactoryDict );
for ( iter.toFirst(); iter.current(); ++iter ) {
//US i am not quit sure, why I can nopt use (*iter)-> here
//US new QRadioButton( (*iter)->type(), mTypeGroup );
//US label = new QLabel( (*iter)->description(), mTypeGroup );
#ifdef DESKTOP_VERSION
new QRadioButton( (*iter)->type(), mTypeGroup );
label = new QLabel( (*iter)->description(), mTypeGroup );
#else
new QRadioButton( (*iter).type(), mTypeGroup );
label = new QLabel( (*iter).description(), mTypeGroup );
#endif
label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
}
mTypeGroup->setButton( 0 );
mViewNameEdit->setFocus();
enableButton( KDialogBase::Ok, false );
}
AddViewDialog::~AddViewDialog()
{
}
QString AddViewDialog::viewName()const
{
return mViewNameEdit->text();
}
QString AddViewDialog::viewType()const
{
return mTypeGroup->find( mTypeId )->text();
}
void AddViewDialog::clicked( int id )
{
mTypeId = id;
}
void AddViewDialog::textChanged( const QString &text )
{
enableButton( KDialogBase::Ok, !text.isEmpty() );
}
-#ifndef KAB_EMBEDDED
-#include "addviewdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_addviewdialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/addviewdialog.h b/kaddressbook/addviewdialog.h
index 8cc12f5..c3e8efd 100644
--- a/kaddressbook/addviewdialog.h
+++ b/kaddressbook/addviewdialog.h
@@ -1,73 +1,73 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ADDVIEWDIALOG_H
#define ADDVIEWDIALOG_H
#include <kdialogbase.h>
-#include <qdict.h>
+#include <q3dict.h>
#include <qstring.h>
class ViewFactory;
-class QButtonGroup;
+class Q3ButtonGroup;
class QLineEdit;
/**
Modal dialog used for adding a new view. The dialog asks for the name of
the view as well as the type. Someday it would be nice for this to be a
wizard.
*/
class AddViewDialog : public KDialogBase
{
Q_OBJECT
public:
- AddViewDialog( QDict<ViewFactory> *viewFactoryDict, QWidget *parent,
+ AddViewDialog( Q3Dict<ViewFactory> *viewFactoryDict, QWidget *parent,
const char *name = 0 );
~AddViewDialog();
QString viewName()const;
QString viewType()const ;
protected slots:
/**
Called when the user selects a type radio button.
*/
void clicked( int id );
/**
Called when the user changes the text in the name of the view.
*/
void textChanged( const QString &text );
private:
- QDict<ViewFactory> *mViewFactoryDict;
+ Q3Dict<ViewFactory> *mViewFactoryDict;
QLineEdit *mViewNameEdit;
- QButtonGroup *mTypeGroup;
+ Q3ButtonGroup *mTypeGroup;
int mTypeId;
};
#endif
diff --git a/kaddressbook/details/detailsviewcontainer.cpp b/kaddressbook/details/detailsviewcontainer.cpp
index cee5886..4a86aca 100644
--- a/kaddressbook/details/detailsviewcontainer.cpp
+++ b/kaddressbook/details/detailsviewcontainer.cpp
@@ -1,99 +1,102 @@
/*
This file is part of KAddressBook.
Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcombobox.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include <kapplication.h>
#include <kdebug.h>
#include <kdialog.h>
#include "look_basic.h"
//#include "look_details.h"
#include "look_html.h"
#ifdef KAB_EMBEDDED
#include "kabprefs.h"
#endif //KAB_EMBEDDED
#include "detailsviewcontainer.h"
ViewContainer::ViewContainer( QWidget *parent, const char* name )
: QWidget( parent, name ), mCurrentLook( 0 )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
//topLayout->setMargin( KDialog::marginHint() );
//topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( 0 );
topLayout->setSpacing( 0 );
- QBoxLayout *styleLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *styleLayout = new Q3HBoxLayout( topLayout );
QLabel *label = new QLabel( i18n("Style:"), this );
styleLayout->addWidget( label );
mStyleCombo = new QComboBox( this );
styleLayout->addWidget( mStyleCombo );
- QFrame *frameRuler = new QFrame( this );
+ Q3Frame *frameRuler = new Q3Frame( this );
//US frameRuler->setFrameShape( QFrame::HLine );
//US frameRuler->setFrameShadow( QFrame::Sunken );
//US topLayout->addWidget( frameRuler );
- mDetailsStack = new QWidgetStack( this );
+ mDetailsStack = new Q3WidgetStack( this );
topLayout->addWidget( mDetailsStack, 1 );
registerLooks();
#if 1
// Hide detailed view selection combo box, because we currently have
// only one. Reenable it when there are more detailed views.
label->hide();
mStyleCombo->hide();
frameRuler->hide();
#endif
}
void ViewContainer::printView()
{
mCurrentLook->printView();
}
KABBasicLook *ViewContainer::currentLook()
{
return mCurrentLook;
}
void ViewContainer::registerLooks()
{
mLookFactories.append( new KABHtmlViewFactory( mDetailsStack ) );
// mLookFactories.append( new KABDetailedViewFactory( mDetailsStack ) );
mStyleCombo->clear();
for ( uint i = 0; i < mLookFactories.count(); ++i )
mStyleCombo->insertItem( mLookFactories.at( i )->description() );
if ( !mLookFactories.isEmpty() )
@@ -130,35 +133,35 @@ void ViewContainer::slotStyleSelected( int index )
SIGNAL( browse( const QString& ) ) );
}
mCurrentLook->restoreSettings( config );
mCurrentLook->setAddressee( addr );
}
void ViewContainer::setAddressee( const KABC::Addressee& addressee )
{
if ( mCurrentLook != 0 ) {
mCurrentAddressee = addressee;
mCurrentLook->setAddressee( mCurrentAddressee );
}
}
KABC::Addressee ViewContainer::addressee()
{
static KABC::Addressee empty; // do not use!
if ( !mCurrentLook )
return empty;
else
return mCurrentLook->addressee();
}
void ViewContainer::setReadOnly( bool state )
{
if ( mCurrentLook )
mCurrentLook->setReadOnly( state );
}
-#ifndef KAB_EMBEDDED
-#include "detailsviewcontainer.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_detailsviewcontainer.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/detailsviewcontainer.h b/kaddressbook/details/detailsviewcontainer.h
index 9684736..f310a30 100644
--- a/kaddressbook/details/detailsviewcontainer.h
+++ b/kaddressbook/details/detailsviewcontainer.h
@@ -1,103 +1,103 @@
/*
This file is part of KAddressBook.
Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef DETAILSVIEWCONTAINER_H
#define DETAILSVIEWCONTAINER_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "look_basic.h"
class QComboBox;
-class QWidgetStack;
+class Q3WidgetStack;
class ViewContainer : public QWidget
{
Q_OBJECT
public:
ViewContainer( QWidget *parent = 0, const char* name = 0 );
/**
Return the look currently selected. If there is none, it
returns zero. Do not use this pointer to store a reference
to a look, the user might select another one (e.g., create
a new object) at any time.
*/
KABBasicLook *currentLook();
/**
Return the contact currently displayed.
*/
KABC::Addressee addressee();
public slots:
void printView();
/**
Set the contact currently displayed.
*/
void setAddressee( const KABC::Addressee& addressee );
/**
Set read-write state.
*/
void setReadOnly( bool state );
signals:
/**
The contact has been changed.
*/
void addresseeChanged();
/**
The user acticated the email address displayed. This may happen
by, for example, clicking on the displayed mailto-URL.
*/
void sendEmail( const QString& );
/**
The user activated one of the displayed HTTP URLs. For example
by clicking on the displayed homepage address.
*/
void browse( const QString& );
protected:
/**
A style has been selected. Overloaded from base class.
*/
void slotStyleSelected( int );
/**
Register the available looks.
*/
void registerLooks();
private:
KABC::Addressee mCurrentAddressee;
KABBasicLook *mCurrentLook;
- QPtrList<KABLookFactory> mLookFactories;
+ Q3PtrList<KABLookFactory> mLookFactories;
QComboBox *mStyleCombo;
- QWidgetStack *mDetailsStack;
+ Q3WidgetStack *mDetailsStack;
};
#endif
diff --git a/kaddressbook/details/look_basic.cpp b/kaddressbook/details/look_basic.cpp
index 0245686..48cc42a 100644
--- a/kaddressbook/details/look_basic.cpp
+++ b/kaddressbook/details/look_basic.cpp
@@ -1,75 +1,75 @@
/*
This file is part of KAddressBook.
Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kdebug.h>
#include "look_basic.h"
KABBasicLook::KABBasicLook( QWidget *parent, const char *name )
- : QVBox( parent, name ), mReadOnly( false )
+ : Q3VBox( parent, name ), mReadOnly( false )
{
}
void KABBasicLook::setReadOnly( bool state )
{
mReadOnly = state;
}
bool KABBasicLook::isReadOnly() const
{
return mReadOnly;
}
void KABBasicLook::setAddressee( const KABC::Addressee &addr )
{
if ( mAddressee == addr )
return;
mAddressee = addr;
repaint( false );
}
KABC::Addressee KABBasicLook::addressee()
{
return mAddressee;
}
void KABBasicLook::restoreSettings( KConfig* )
{
}
void KABBasicLook::saveSettings( KConfig* )
{
}
KABLookFactory::KABLookFactory( QWidget *parent, const char *name )
: mParent( parent ), mName( name )
{
}
KABLookFactory::~KABLookFactory()
{
}
-#ifndef KAB_EMBEDDED
-#include "look_basic.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_look_basic.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_basic.h b/kaddressbook/details/look_basic.h
index a65c99c..a70e7f7 100644
--- a/kaddressbook/details/look_basic.h
+++ b/kaddressbook/details/look_basic.h
@@ -1,76 +1,76 @@
/*
This file is part of KAddressBook.
Copyright (c) 1996-2002 Mirko Boehm <mirko@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef LOOK_KABBASIC_H
#define LOOK_KABBASIC_H
#include <kabc/addressbook.h>
-#include <qvbox.h>
+#include <q3vbox.h>
class KConfig;
/**
This is a pure virtual base class that defines the
interface for how to display and change entries of
the KDE addressbook.
This basic widget does not show anything in its client space.
Derive it and implement its look and how the user may edit the
entry.
The paintEvent() has to paint the whole widget, since repaint()
calls will not delete the widgets background.
*/
-class KABBasicLook : public QVBox
+class KABBasicLook : public Q3VBox
{
Q_OBJECT
public:
/**
The constructor.
*/
KABBasicLook( QWidget *parent = 0, const char *name = 0 );
/**
Set the entry. It will be displayed automatically.
*/
virtual void setAddressee( const KABC::Addressee& addressee );
/**
Get the current entry.
*/
virtual KABC::Addressee addressee();
/**
Configure the view from the configuration file.
*/
virtual void restoreSettings( KConfig* );
/**
Save the view settings to the configuration file.
*/
virtual void saveSettings( KConfig* );
/**
Retrieve read-write state.
*/
diff --git a/kaddressbook/details/look_details.cpp b/kaddressbook/details/look_details.cpp
index 11d06e9..2c3a79d 100644
--- a/kaddressbook/details/look_details.cpp
+++ b/kaddressbook/details/look_details.cpp
@@ -160,68 +160,68 @@ void KABDetailedView::paintEvent( QPaintEvent* )
mPainter->setShowURLs( mActionShowURLs->isChecked() );
mPainter->printAddressee( addressee(), QRect( 0, 0, entryArea.width(),
entryArea.height() ), &p );
p.end();
bitBlt( this, 0, 0, &pm );
}
void KABDetailedView::mouseMoveEvent( QMouseEvent *e )
{
QPoint bias( mGrid, mGrid );
int rc;
bool hit = false;
if ( ( rc = mPainter->hitsEmail( e->pos() - bias ) ) != -1 )
hit = true;
else if ( ( rc = mPainter->hitsURL( e->pos() - bias ) ) != -1 )
hit = true;
else if ( ( rc = mPainter->hitsPhone( e->pos() - bias ) ) != -1 )
hit = true;
else if ( ( rc = mPainter->hitsTalk( e->pos() - bias ) ) != -1 )
hit = true;
if ( hit ) {
if ( cursor().shape() != PointingHandCursor )
setCursor( PointingHandCursor );
else if( cursor().shape() != ArrowCursor )
setCursor(ArrowCursor);
}
}
void KABDetailedView::mousePressEvent( QMouseEvent *e )
{
- QPopupMenu menu( this );
- QPopupMenu *menuBG = new QPopupMenu( &menu );
- mMenuBorderedBG = new QPopupMenu( &menu );
- mMenuTiledBG = new QPopupMenu( &menu );
+ Q3PopupMenu menu( this );
+ Q3PopupMenu *menuBG = new Q3PopupMenu( &menu );
+ mMenuBorderedBG = new Q3PopupMenu( &menu );
+ mMenuTiledBG = new Q3PopupMenu( &menu );
menu.insertItem( i18n( "Select Background" ), menuBG );
menuBG->insertItem( i18n( "Bordered Backgrounds" ), mMenuBorderedBG );
menuBG->insertItem( i18n( "Tiled Backgrounds" ), mMenuTiledBG );
menu.insertSeparator();
QPoint point = e->pos() - QPoint( mGrid, mGrid );
int rc;
QStringList dirsBorderedBG, dirsTiledBG;
QDir dir;
switch( e->button() ) {
case QMouseEvent::RightButton:
if ( isReadOnly() )
menu.setItemEnabled( menu.idAt( 0 ), false );
else {
// TODO: settings need to be saved in view options
dirsBorderedBG = KGlobal::instance()->dirs()->findDirs( "data", mBorderedBGDir );
if ( dirsBorderedBG.count() > 0 ) {
dir.setPath( dirsBorderedBG[ 0 ] );
mBorders = dir.entryList( QDir::Files );
for ( uint count = 0; count < mBorders.count(); ++count )
mMenuBorderedBG->insertItem( mBorders[ count ], count );
connect( mMenuBorderedBG, SIGNAL( activated( int ) ),
SLOT( slotBorderedBGSelected( int ) ) );
} else
menuBG->setItemEnabled( menuBG->idAt( 0 ), false );
dirsTiledBG = KGlobal::instance()->dirs()->findDirs( "data", mTiledBGDir );
if ( dirsTiledBG.count() > 0 ) {
dir.setPath( dirsTiledBG[ 0 ] );
@@ -385,35 +385,35 @@ void KABDetailedView::restoreSettings( KConfig *config )
}
}
if ( count == dirs.count() ) {
mUseDefaultBGImage = getBackground( bgImage, mDefaultBGImage );
if ( !mUseDefaultBGImage )
kdDebug(5720) << "KABDetailedView::configure: "
<< "default BG image selected, but could not be loaded."
<< endl;
}
}
mDefaultBGColor = config->readColorEntry( ConfigView_DefaultBackgroundColor, &white );
mHeadLineBGColor = config->readColorEntry( ConfigView_HeadlineBGColor, &darkBlue );
mHeadLineTextColor = config->readColorEntry( ConfigView_HeadlineTextColor, &yellow );
mUseHeadLineBGColor = config->readBoolEntry( ConfigView_UseHeadlineBGColor, true );
if ( !mPainter )
mPainter = new KABEntryPainter;
mPainter->setForegroundColor( black );
mPainter->setHeaderColor( mHeadLineTextColor );
mPainter->setUseHeaderColor( mUseHeadLineBGColor );
mPainter->setBackgroundColor( mHeadLineBGColor );
mPainter->setHeaderFont( QFont( gfont, gpointsize + 4, QFont::Bold, true ) );
mPainter->setHeadLineFont( QFont( gfont, gpointsize + 2, QFont::Bold, true ) );
mPainter->setBodyFont( QFont( gfont, gpointsize, QFont::Normal, false ) );
mPainter->setFixedFont( QFont( ffont, fpointsize, QFont::Normal, false ) );
mPainter->setCommentFont( QFont( gfont, gpointsize, QFont::Normal, false ) );
}
-#ifndef KAB_EMBEDDED
-#include "look_details.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_look_details.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/details/look_details.h b/kaddressbook/details/look_details.h
index e8d50a9..b59d3a7 100644
--- a/kaddressbook/details/look_details.h
+++ b/kaddressbook/details/look_details.h
@@ -101,57 +101,57 @@ class KABDetailedView : public KABBasicLook
*/
bool getBackground( QString path, QPixmap& image );
private:
QPtrList<QRect> mURLRects;
QPtrList<QRect> mEmailRects;
QPtrList<QRect> mPhoneRects;
KABEntryPainter *mPainter;
QMap<QString, QPixmap> mBackgroundMap;
QPixmap mCurrentBackground;
BackgroundStyle mBackgroundStyle;
bool mUseDefaultBGImage;
bool mUseHeadLineBGColor;
QColor mDefaultBGColor;
QColor mHeadLineBGColor;
QColor mHeadLineTextColor;
QPixmap mDefaultBGImage;
KToggleAction *mActionShowAddresses;
KToggleAction *mActionShowEmails;
KToggleAction *mActionShowPhones;
KToggleAction *mActionShowURLs;
const int mGrid;
QStringList mBorders;
QStringList mTiles;
- QPopupMenu *mMenuBorderedBG;
- QPopupMenu *mMenuTiledBG;
+ Q3PopupMenu *mMenuBorderedBG;
+ Q3PopupMenu *mMenuTiledBG;
static const QString mBorderedBGDir;
static const QString mTiledBGDir;
};
class KABDetailedViewFactory : public KABLookFactory
{
public:
KABDetailedViewFactory( QWidget *parent = 0, const char *name = 0 )
: KABLookFactory( parent, name ) {}
KABBasicLook *create()
{
return new KABDetailedView( mParent, mName );
}
QString description()
{
return i18n( "Detailed Style: Display all details, no modifications." );
}
};
#endif
diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp
index bb30650..4ec1c7d 100644
--- a/kaddressbook/details/look_html.cpp
+++ b/kaddressbook/details/look_html.cpp
@@ -1,56 +1,56 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <addresseeview.h>
#include "look_html.h"
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include "kabprefs.h"
#include <kabc/addresseeview.h>
KABHtmlView::KABHtmlView( QWidget *parent, const char *name )
: KABBasicLook( parent, name )
{
mView = new KABC::AddresseeView( this );
mView->setFont( KABPrefs::instance()->mDetailsFont );
connect(this, SIGNAL(printMyView()),
this , SLOT(printMe()));
}
KABHtmlView::~KABHtmlView()
{
}
void KABHtmlView::printMe()
{
mView->printMe();
}
void KABHtmlView::setAddressee( const KABC::Addressee &addr )
{
mView->setFont( KABPrefs::instance()->mDetailsFont );
mView->setAddressee( addr );
}
-#ifndef KAB_EMBEDDED
-#include "look_html.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_look_html.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/emaileditwidget.cpp b/kaddressbook/emaileditwidget.cpp
index e72face..09df47f 100644
--- a/kaddressbook/emaileditwidget.cpp
+++ b/kaddressbook/emaileditwidget.cpp
@@ -1,90 +1,92 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qstring.h>
#include <qtoolbutton.h>
#include <qtooltip.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#endif //KAB_EMBEDDED
#include <kconfig.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include "emaileditwidget.h"
EmailEditWidget::EmailEditWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QGridLayout *topLayout = new QGridLayout( this, 2, 2 );
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 2, 2 );
topLayout->setSpacing( KDialog::spacingHint() );
QLabel* label = new QLabel( this );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "mail_send", KIcon::Desktop, 0) );
topLayout->addWidget( label, 0, 0 );
- label->setAlignment( AlignCenter );
+ label->setAlignment( Qt::AlignCenter );
QPushButton *editButton = new QPushButton( i18n( "Edit Email Addresses..." ), this);
topLayout->addWidget( editButton, 0, 1 );
label = new QLabel( i18n( "Email:" ), this );
topLayout->addWidget( label, 1, 0 );
mEmailEdit = new KLineEdit( this );
connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ),
SIGNAL( modified() ) );
label->setBuddy( mEmailEdit );
topLayout->addWidget( mEmailEdit, 1, 1 );
connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) );
topLayout->activate();
}
EmailEditWidget::~EmailEditWidget()
{
}
void EmailEditWidget::setEmails( const QStringList &list )
{
mEmailList = list;
bool blocked = mEmailEdit->signalsBlocked();
mEmailEdit->blockSignals( true );
if ( list.count() > 0 )
mEmailEdit->setText( list[ 0 ] );
else
@@ -108,82 +110,82 @@ QStringList EmailEditWidget::emails()
}
void EmailEditWidget::edit()
{
EmailEditDialog dlg( mEmailList, this );
if ( dlg.exec() ) {
if ( dlg.changed() ) {
mEmailList = dlg.emails();
mEmailEdit->setText( mEmailList[ 0 ] );
emit modified();
}
}
}
void EmailEditWidget::textChanged( const QString &text )
{
if ( mEmailList.count() > 0 )
mEmailList.remove( mEmailList.begin() );
mEmailList.prepend( text );
}
EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent,
const char *name )
: KDialogBase( KDialogBase::Plain, i18n( "Edit Email Addresses" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name, true )
{
QWidget *page = plainPage();
- QGridLayout *topLayout = new QGridLayout( page, 4, 3 );
+ Q3GridLayout *topLayout = new Q3GridLayout( page, 4, 3 );
QLabel *label = new QLabel( i18n( "Email address:" ), page );
topLayout->addWidget( label, 0, 0 );
mEmailEdit = new KLineEdit( page );
label->setBuddy( mEmailEdit );
topLayout->addWidget( mEmailEdit, 0, 1 );
connect( mEmailEdit, SIGNAL( returnPressed() ), SLOT( add() ) );
connect( mEmailEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( emailChanged() ) );
mAddButton = new QPushButton( i18n( "Add" ), page );
mAddButton->setEnabled( false );
connect( mAddButton, SIGNAL( clicked() ), SLOT( add() ) );
topLayout->addWidget( mAddButton, 0, 2 );
- mEmailListBox = new QListBox( page );
+ mEmailListBox = new Q3ListBox( page );
// Make sure there is room for the scrollbar
mEmailListBox->setMinimumHeight( mEmailListBox->sizeHint().height() + 30 );
connect( mEmailListBox, SIGNAL( highlighted( int ) ),
SLOT( selectionChanged( int ) ) );
topLayout->addMultiCellWidget( mEmailListBox, 1, 3, 0, 1 );
mEditButton = new QPushButton( i18n( "Change" ), page );
connect( mEditButton, SIGNAL( clicked() ), SLOT( edit() ) );
topLayout->addWidget( mEditButton, 1, 2 );
mRemoveButton = new QPushButton( i18n( "Remove" ), page );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( remove() ) );
topLayout->addWidget( mRemoveButton, 2, 2 );
mStandardButton = new QPushButton( i18n( "Set Standard" ), page );
connect( mStandardButton, SIGNAL( clicked() ), SLOT( standard() ) );
topLayout->addWidget( mStandardButton, 3, 2 );
topLayout->activate();
QStringList items = list;
qDebug("EmailEditDialog::EmailEditDialog has to be changed (lowPrio)");
//US must be fixed !!!
/*
if ( items.remove( "" ) > 0 )
mChanged = true;
else
mChanged = false;
*/
mEmailListBox->insertStringList( items );
@@ -243,35 +245,35 @@ void EmailEditDialog::remove()
}
}
bool EmailEditDialog::changed() const
{
return mChanged;
}
void EmailEditDialog::standard()
{
QString text = mEmailListBox->currentText();
mEmailListBox->removeItem( mEmailListBox->currentItem() );
mEmailListBox->insertItem( text, 0 );
mEmailListBox->setSelected( 0, true );
mChanged = true;
}
void EmailEditDialog::selectionChanged( int index )
{
bool value = ( index >= 0 ); // An item is selected
mRemoveButton->setEnabled( value );
mEditButton->setEnabled( value );
mStandardButton->setEnabled( value );
}
void EmailEditDialog::emailChanged()
{
mAddButton->setEnabled( !mEmailEdit->text().isEmpty() );
}
-#ifndef KAB_EMBEDDED
-#include "emaileditwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_emaileditwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/emaileditwidget.h b/kaddressbook/emaileditwidget.h
index acdecaf..618acee 100644
--- a/kaddressbook/emaileditwidget.h
+++ b/kaddressbook/emaileditwidget.h
@@ -1,101 +1,101 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef EMAILEDITWIDGET_H
#define EMAILEDITWIDGET_H
#include <kabc/addressee.h>
#include <kdialogbase.h>
#include "addresseeconfig.h"
-class QButtonGroup;
+class Q3ButtonGroup;
class QCheckBox;
-class QListView;
-class QListBox;
-class QTextEdit;
+class Q3ListView;
+class Q3ListBox;
+class Q3TextEdit;
class QToolButton;
class KComboBox;
class KLineEdit;
class KListView;
/**
This widget displays a list box of the email addresses as well as buttons
to manipulate them (up, down, add, remove).
*/
class EmailEditWidget : public QWidget
{
Q_OBJECT
public:
EmailEditWidget( QWidget *parent, const char *name = 0 );
~EmailEditWidget();
void setEmails( const QStringList &list );
QStringList emails();
signals:
void modified();
private slots:
void edit();
void textChanged( const QString& );
private:
KLineEdit *mEmailEdit;
QStringList mEmailList;
};
class EmailEditDialog : public KDialogBase
{
Q_OBJECT
public:
EmailEditDialog( const QStringList &list, QWidget *parent,
const char *name = 0 );
~EmailEditDialog();
QStringList emails() const;
bool changed() const;
protected slots:
void add();
void remove();
void edit();
void standard();
void selectionChanged( int );
void emailChanged();
private:
KLineEdit *mEmailEdit;
- QListBox *mEmailListBox;
+ Q3ListBox *mEmailListBox;
QPushButton *mAddButton;
QPushButton *mRemoveButton;
QPushButton *mEditButton;
QPushButton *mStandardButton;
bool mChanged;
};
#endif
diff --git a/kaddressbook/extensionmanager.cpp b/kaddressbook/extensionmanager.cpp
index 46defa1..5356224 100644
--- a/kaddressbook/extensionmanager.cpp
+++ b/kaddressbook/extensionmanager.cpp
@@ -1,93 +1,95 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
#include <kactionclasses.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else //KAB_EMBEDDED
#include <features/mergewidget.h>
#include <features/distributionlistwidget.h>
#endif //KAB_EMBEDDED
#include "addresseeeditorwidget.h"
#include "kabcore.h"
#include "kabprefs.h"
#include "extensionmanager.h"
ExtensionManager::ExtensionManager( KABCore *core, QWidget *parent,
const char *name )
- : QScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 )
+ : Q3ScrollView( parent, name ), mCore( core ), mCurrentExtensionWidget( 0 )
{
#ifdef KAB_EMBEDDED
//US QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
QWidget *settingsmenu = (QWidget*)mCore->getViewMenu();
#endif //KAB_EMBEDDED
mActionExtensions = new KSelectAction( i18n( "Show Extension Bar" ), 0,
mCore->actionCollection(),
"options_show_extensions" );
mActionExtensions->plug( settingsmenu ,0);
connect( mActionExtensions, SIGNAL( activated( int ) ),
SLOT( setActiveExtension( int ) ) );
mWidgetBox = new QWidget( viewport() );
- new QHBoxLayout (mWidgetBox );
+ new Q3HBoxLayout (mWidgetBox );
addChild( mWidgetBox );
setResizePolicy(AutoOneFit);
createExtensionWidgets();
hide();
}
ExtensionManager::~ExtensionManager()
{
}
void ExtensionManager::restoreSettings()
{
mActionExtensions->setCurrentItem( KABPrefs::instance()->mCurrentExtension );
int i = 1;
mCurrentExtensionWidget = mExtensionWidgetList.at( i-1 );
while ( mCurrentExtensionWidget ) {
if( i != KABPrefs::instance()->mCurrentExtension )
mCurrentExtensionWidget->hide();
mCurrentExtensionWidget = mExtensionWidgetList.at( ++i-1 );
}
setActiveExtension( mActionExtensions->currentItem() );
}
void ExtensionManager::saveSettings()
{
KABPrefs::instance()->mCurrentExtension = mActionExtensions->currentItem();
}
void ExtensionManager::reconfigure()
{
saveSettings();
@@ -119,76 +121,76 @@ void ExtensionManager::setActiveExtension( int id )
#endif //KAB_EMBEDDED
} else if ( id > 0 ) {
if ( mCurrentExtensionWidget )
mCurrentExtensionWidget->hide();
mCurrentExtensionWidget = mExtensionWidgetList.at( id - 1 );
if ( mCurrentExtensionWidget ) {
#ifndef DESKTOP_VERSION
//US our screen is so small, that we better hide the detailscreen, just in case.
//US mCore->setDetailsVisible( false );
#endif //KAB_EMBEDDED
show();
mWidgetBox->show();
mCurrentExtensionWidget->show();
} else {
hide();
mCurrentExtensionWidget = 0;
#ifndef DESKTOP_VERSION
//US our screen is so small, that we better hide the detailscreen, just in case.
//US mCore->setDetailsToState( );
#endif //KAB_EMBEDDED
}
}
emit changedActiveExtension( id );
}
void ExtensionManager::createExtensionWidgets()
{
// clear extension widget list
mExtensionWidgetList.setAutoDelete( true );
- QPtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList );
+ Q3PtrListIterator<ExtensionWidget> wdgIt( mExtensionWidgetList );
ExtensionWidget *wdg = 0;
while ( ( wdg = wdgIt.current() ) != 0 )
mExtensionWidgetList.remove( wdg );
mExtensionWidgetList.setAutoDelete( false );
QStringList extensionNames( i18n( "None" ) );
// add addressee editor as default
- QHBoxLayout *hbl = (QHBoxLayout *) mWidgetBox->layout();;
+ Q3HBoxLayout *hbl = (Q3HBoxLayout *) mWidgetBox->layout();;
wdg = new AddresseeEditorWidget( mCore, true, mWidgetBox );
hbl->addWidget( wdg );
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
// load the other extensions
QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions;
#ifndef KAB_EMBEDDED
KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) )
continue;
KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
if ( !factory ) {
//kdDebug(5720) << "ExtensionManager::loadExtensions(): Factory creation failed" << endl;
continue;
}
ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
if ( !extensionFactory ) {
//kdDebug(5720) << "ExtensionManager::loadExtensions(): Cast failed" << endl;
continue;
}
@@ -215,35 +217,35 @@ void ExtensionManager::createExtensionWidgets()
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
}
}
//load DistributionListfactory/extension
extensionFactory = new DistributionListFactory();
if (activeExtensions.contains( extensionFactory->identifier() ) )
{
wdg = extensionFactory->extension( mCore, mWidgetBox );
if ( wdg ) {
hbl->addWidget( wdg );
//wdg->hide();
connect( wdg, SIGNAL( modified( const KABC::Addressee::List& ) ),
SIGNAL( modified( const KABC::Addressee::List& ) ) );
mExtensionWidgetList.append( wdg );
extensionNames.append( wdg->title() );
}
}
hbl->addStretch();
#endif //KAB_EMBEDDED
mActionExtensions->setItems( extensionNames );
mCurrentExtensionWidget = 0;
}
-#ifndef KAB_EMBEDDED
-#include "extensionmanager.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_extensionmanager.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/extensionmanager.h b/kaddressbook/extensionmanager.h
index 611a037..84c948b 100644
--- a/kaddressbook/extensionmanager.h
+++ b/kaddressbook/extensionmanager.h
@@ -1,89 +1,89 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef EXTENSIONMANAGER_H
#define EXTENSIONMANAGER_H
-#include <qhbox.h>
-#include <qscrollview.h>
-#include <qptrlist.h>
+#include <q3hbox.h>
+#include <q3scrollview.h>
+#include <q3ptrlist.h>
#include <extensionwidget.h>
class KABCore;
class KSelectAction;
-class ExtensionManager : public QScrollView
+class ExtensionManager : public Q3ScrollView
{
Q_OBJECT
public:
ExtensionManager( KABCore *core, QWidget *parent, const char *name = 0 );
~ExtensionManager();
/**
Restores the extension manager specific settings.
*/
void restoreSettings();
/**
Saves the extension manager specific settings.
*/
void saveSettings();
/**
Rereads the extension manager specific settings with some
additional initialization stuff.
*/
void reconfigure();
/**
Returns whether the quickedit extension is currently visible.
*/
bool isQuickEditVisible() const;
public slots:
void setSelectionChanged();
signals:
void modified( const KABC::Addressee::List& );
void changedActiveExtension( int id );
private slots:
void setActiveExtension( int id );
private:
void createExtensionWidgets();
KABCore *mCore;
QWidget *mWidgetBox;
ExtensionWidget *mCurrentExtensionWidget;
- QPtrList<ExtensionWidget> mExtensionWidgetList;
+ Q3PtrList<ExtensionWidget> mExtensionWidgetList;
KSelectAction *mActionExtensions;
};
#endif
diff --git a/kaddressbook/extensionwidget.cpp b/kaddressbook/extensionwidget.cpp
index 69f4aa8..7c3b415 100644
--- a/kaddressbook/extensionwidget.cpp
+++ b/kaddressbook/extensionwidget.cpp
@@ -49,36 +49,35 @@ bool ExtensionWidget::contactsSelected() const
KABC::Addressee::List ExtensionWidget::selectedContacts()
{
KABC::Addressee::List list;
QStringList uids = mCore->selectedUIDs();
QStringList::Iterator it;
for ( it = uids.begin(); it != uids.end(); ++it )
list.append( mCore->addressBook()->findByUid( *it ) );
return list;
}
void ExtensionWidget::contactsSelectionChanged()
{
// do nothing
}
QString ExtensionWidget::title() const
{
return "<bug!!!>";
}
QString ExtensionWidget::identifier() const
{
return "<bug!!!>";
}
ConfigureWidget *ExtensionFactory::configureWidget( QWidget*, const char* )
{
return 0;
}
-#ifndef KAB_EMBEDDED
-#include "extensionwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_extensionwidget.cpp"
#endif //KAB_EMBEDDED
-
diff --git a/kaddressbook/extensionwidget.h b/kaddressbook/extensionwidget.h
index fc91f21..9fcfba9 100644
--- a/kaddressbook/extensionwidget.h
+++ b/kaddressbook/extensionwidget.h
@@ -57,63 +57,63 @@ class ExtensionWidget : public QWidget
Use @ref addresseesSelected() to test if there exists selected
contacts.
*/
KABC::Addressee::List selectedContacts();
/**
This method is called whenever the selection in the view changed.
*/
virtual void contactsSelectionChanged();
/**
This method should be reimplemented and return the i18ned title of this
widget.
*/
virtual QString title() const;
/**
This method should be reimplemented and return a unique identifier.
*/
virtual QString identifier() const;
signals:
void modified( const KABC::Addressee::List &list );
private:
KABCore *mCore;
class ExtensionWidgetPrivate;
ExtensionWidgetPrivate *d;
};
#ifndef KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class ExtensionFactory : public KLibFactory
-//MOC_SKIP_END
+#endif
#else //KAB_EMBEDDED
class ExtensionFactory
#endif //KAB_EMBEDDED
{
public:
virtual ExtensionWidget *extension( KABCore *core, QWidget *parent,
const char *name = 0 ) = 0;
virtual ConfigureWidget *configureWidget( QWidget *parent,
const char *name = 0 );
virtual bool configureWidgetAvailable() { return false; }
/**
This method should return the same identifier like the config
widget.
*/
virtual QString identifier() const = 0;
protected:
virtual QObject* createObject( QObject*, const char*, const char*,
const QStringList & )
{
return 0;
}
};
#endif
diff --git a/kaddressbook/features/distributionlistwidget.cpp b/kaddressbook/features/distributionlistwidget.cpp
index bfcb121..996177b 100644
--- a/kaddressbook/features/distributionlistwidget.cpp
+++ b/kaddressbook/features/distributionlistwidget.cpp
@@ -1,202 +1,209 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
+#include <QDragEnterEvent>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <klineeditdlg.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kabc/addressbook.h>
#include <kabc/addresseedialog.h>
#include <kabc/distributionlist.h>
#include <kabc/vcardconverter.h>
#ifndef KAB_EMBEDDED
#include <libkdepim/kvcarddrag.h>
#endif //KAB_EMBEDDED
#include "kabcore.h"
#include "distributionlistwidget.h"
#ifndef KAB_EMBEDDED
class DistributionListFactory : public ExtensionFactory
{
public:
ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
{
return new DistributionListWidget( core, parent, name );
}
QString identifier() const
{
return "distribution_list_editor";
}
};
extern "C" {
void *init_libkaddrbk_distributionlist()
{
return ( new DistributionListFactory );
}
}
#endif //KAB_EMBEDDED
-class ContactItem : public QListViewItem
+class ContactItem : public Q3ListViewItem
{
public:
ContactItem( DistributionListView *parent, const KABC::Addressee &addressee,
const QString &email = QString::null ) :
- QListViewItem( parent ),
+ Q3ListViewItem( parent ),
mAddressee( addressee ),
mEmail( email )
{
setText( 0, addressee.realName() );
if( email.isEmpty() ) {
setText( 1, addressee.preferredEmail() );
setText( 2, i18n( "Yes" ) );
} else {
setText( 1, email );
setText( 2, i18n( "No" ) );
}
}
KABC::Addressee addressee() const
{
return mAddressee;
}
QString email() const
{
return mEmail;
}
protected:
bool acceptDrop( const QMimeSource* )
{
return true;
}
private:
KABC::Addressee mAddressee;
QString mEmail;
};
DistributionListWidget::DistributionListWidget( KABCore *core, QWidget *parent,
const char *name )
: ExtensionWidget( core, parent, name ), mManager( 0 )
{
- QGridLayout *topLayout = new QGridLayout( this, 3, 4, KDialog::marginHint(),
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 4, KDialog::marginHint(),
KDialog::spacingHint() );
if (KGlobal::getOrientation() == KGlobal::Portrait)
{
mCreateListButton = new QPushButton( i18n( "New List" ), this );
mEditListButton = new QPushButton( i18n( "Ren List" ), this );
mRemoveListButton = new QPushButton( i18n( "Del List" ), this );
mAddContactButton = new QPushButton( i18n( "Add Cont." ), this );
mChangeEmailButton = new QPushButton( i18n( "Chge Email" ), this );
mRemoveContactButton = new QPushButton( i18n( "Del Cont." ), this );
}
else
{
mCreateListButton = new QPushButton( i18n( "New List..." ), this );
mEditListButton = new QPushButton( i18n( "Rename List..." ), this );
mRemoveListButton = new QPushButton( i18n( "Remove List" ), this );
mAddContactButton = new QPushButton( i18n( "Add Contact" ), this );
mChangeEmailButton = new QPushButton( i18n( "Change Email..." ), this );
mRemoveContactButton = new QPushButton( i18n( "Remove Contact" ), this );
}
mNameCombo = new QComboBox( this );
topLayout->addWidget( mNameCombo, 0, 0 );
connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateContactView() ) );
topLayout->addWidget( mCreateListButton, 0, 1 );
connect( mCreateListButton, SIGNAL( clicked() ), SLOT( createList() ) );
topLayout->addWidget( mEditListButton, 0, 2 );
connect( mEditListButton, SIGNAL( clicked() ), SLOT( editList() ) );
topLayout->addWidget( mRemoveListButton, 0, 3 );
connect( mRemoveListButton, SIGNAL( clicked() ), SLOT( removeList() ) );
mContactView = new DistributionListView( this );
mContactView->addColumn( i18n( "Name" ) );
mContactView->addColumn( i18n( "Email" ) );
mContactView->addColumn( i18n( "Use Preferred" ) );
mContactView->setEnabled( false );
mContactView->setAllColumnsShowFocus( true );
mContactView->setMinimumHeight( 30 );
topLayout->addMultiCellWidget( mContactView, 1, 1, 0, 3 );
connect( mContactView, SIGNAL( selectionChanged() ),
SLOT( selectionContactViewChanged() ) );
- connect( mContactView, SIGNAL( dropped( QDropEvent*, QListViewItem* ) ),
- SLOT( dropped( QDropEvent*, QListViewItem* ) ) );
+ connect( mContactView, SIGNAL( dropped( QDropEvent*, Q3ListViewItem* ) ),
+ SLOT( dropped( QDropEvent*, Q3ListViewItem* ) ) );
mAddContactButton->setEnabled( false );
topLayout->addWidget( mAddContactButton, 2, 0 );
connect( mAddContactButton, SIGNAL( clicked() ), SLOT( addContact() ) );
topLayout->addWidget( mChangeEmailButton, 2, 2 );
connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) );
topLayout->addWidget( mRemoveContactButton, 2, 3 );
connect( mRemoveContactButton, SIGNAL( clicked() ), SLOT( removeContact() ) );
mManager = new KABC::DistributionListManager( core->addressBook() );
mManager->load();
updateNameCombo();
#ifdef KAB_EMBEDDED
// if (KGlobal::getOrientation() == KGlobal::Portrait)
// parent->setMaximumSize( KGlobal::getDesktopWidth() , 150);
#endif //KAB_EMBEDDED
#ifndef KAB_EMBEDDED
KAcceleratorManager::manage( this );
#endif //KAB_EMBEDDED
}
DistributionListWidget::~DistributionListWidget()
{
delete mManager;
}
void DistributionListWidget::save()
@@ -381,121 +388,121 @@ void DistributionListWidget::dropEvent( QDropEvent *e )
#endif //KAB_EMBEDDED
QStringList list = QStringList::split( "\r\n\r\n", vcards );
QStringList::Iterator it;
KABC::VCardConverter converter;
for ( it = list.begin(); it != list.end(); ++it ) {
KABC::Addressee addr;
if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) )
distributionList->insertEntry( addr );
}
changed();
updateContactView();
#ifndef KAB_EMBEDDED
}
#endif //KAB_EMBEDDED
}
void DistributionListWidget::contactsSelectionChanged()
{
mAddContactButton->setEnabled( contactsSelected() && mNameCombo->count() > 0 );
}
QString DistributionListWidget::title() const
{
return i18n( "Distribution List Editor" );
}
QString DistributionListWidget::identifier() const
{
return "distribution_list_editor";
}
-void DistributionListWidget::dropped( QDropEvent *e, QListViewItem* )
+void DistributionListWidget::dropped( QDropEvent *e, Q3ListViewItem* )
{
dropEvent( e );
}
void DistributionListWidget::changed()
{
save();
}
DistributionListView::DistributionListView( QWidget *parent, const char* name )
: KListView( parent, name )
{
setDragEnabled( true );
setAcceptDrops( true );
setAllColumnsShowFocus( true );
}
void DistributionListView::dragEnterEvent( QDragEnterEvent* e )
{
#ifndef KAB_EMBEDDED
- bool canDecode = QTextDrag::canDecode( e );
+ bool canDecode = Q3TextDrag::canDecode( e );
e->accept( canDecode );
#endif //KAB_EMBEDDED
}
void DistributionListView::viewportDragMoveEvent( QDragMoveEvent *e )
{
#ifndef KAB_EMBEDDED
- bool canDecode = QTextDrag::canDecode( e );
+ bool canDecode = Q3TextDrag::canDecode( e );
e->accept( canDecode );
#endif //KAB_EMBEDDED
}
void DistributionListView::viewportDropEvent( QDropEvent *e )
{
emit dropped( e, 0 );
}
void DistributionListView::dropEvent( QDropEvent *e )
{
emit dropped( e, 0 );
}
EmailSelector::EmailSelector( const QStringList &emails,
const QString &current, QWidget *parent )
: KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
parent )
{
- QFrame *topFrame = plainPage();
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = plainPage();
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
- mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
+ mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"),
topFrame );
topLayout->addWidget( mButtonGroup );
QStringList::ConstIterator it;
for( it = emails.begin(); it != emails.end(); ++it ) {
QRadioButton *button = new QRadioButton( *it, mButtonGroup );
if ( (*it) == current ) {
button->setDown( true );
}
}
}
QString EmailSelector::selected()
{
- QButton *button = mButtonGroup->selected();
+ QAbstractButton *button = mButtonGroup->selected();
if ( button )
return button->text();
return QString::null;
}
QString EmailSelector::getEmail( const QStringList &emails,
const QString &current, QWidget *parent )
{
EmailSelector dlg( emails, current, parent );
dlg.exec();
return dlg.selected();
}
-#ifndef KAB_EMBEDDED
-#include "distributionlistwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_distributionlistwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/features/distributionlistwidget.h b/kaddressbook/features/distributionlistwidget.h
index 82bac3d..f619389 100644
--- a/kaddressbook/features/distributionlistwidget.h
+++ b/kaddressbook/features/distributionlistwidget.h
@@ -1,143 +1,148 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef DISTRIBUTIONLISTWIDGET_H
#define DISTRIBUTIONLISTWIDGET_H
#include <kdialogbase.h>
#include <klistview.h>
#include "extensionwidget.h"
+//Added by qt3to4:
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QLabel>
+#include <QDragMoveEvent>
-class QButtonGroup;
+class Q3ButtonGroup;
class QComboBox;
class QLabel;
-class QListView;
+class Q3ListView;
class DistributionListView;
class KABCore;
namespace KABC {
class AddressBook;
class DistributionListManager;
}
class DistributionListWidget : public ExtensionWidget
{
Q_OBJECT
public:
DistributionListWidget( KABCore*, QWidget *parent, const char *name = 0 );
virtual ~DistributionListWidget();
void contactsSelectionChanged();
QString title() const;
QString identifier() const;
public slots:
void save();
- void dropped( QDropEvent*, QListViewItem* );
+ void dropped( QDropEvent*, Q3ListViewItem* );
private slots:
void createList();
void editList();
void removeList();
void addContact();
void removeContact();
void changeEmail();
void updateNameCombo();
void updateContactView();
void selectionContactViewChanged();
void changed();
protected:
void dropEvent( QDropEvent* );
private:
QComboBox *mNameCombo;
QLabel *mListLabel;
DistributionListView *mContactView;
KABC::DistributionListManager *mManager;
QPushButton *mCreateListButton;
QPushButton *mEditListButton;
QPushButton *mRemoveListButton;
QPushButton *mChangeEmailButton;
QPushButton *mAddContactButton;
QPushButton *mRemoveContactButton;
};
/**
@short Helper class
*/
class DistributionListView : public KListView
{
Q_OBJECT
public:
DistributionListView( QWidget *parent, const char* name = 0 );
protected:
void dragEnterEvent( QDragEnterEvent *e );
void dropEvent( QDropEvent *e );
void viewportDragMoveEvent( QDragMoveEvent *e );
void viewportDropEvent( QDropEvent *e );
};
/**
@short Helper class
*/
class EmailSelector : public KDialogBase
{
public:
EmailSelector( const QStringList &emails, const QString &current,
QWidget *parent );
QString selected();
static QString getEmail( const QStringList &emails, const QString &current,
QWidget *parent );
private:
- QButtonGroup *mButtonGroup;
+ Q3ButtonGroup *mButtonGroup;
};
#ifdef KAB_EMBEDDED
class DistributionListFactory : public ExtensionFactory
{
public:
ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
{
return new DistributionListWidget( core, parent, name );
}
QString identifier() const
{
return "distribution_list_editor";
}
};
#endif //KAB_EMBEDDED
#endif
diff --git a/kaddressbook/features/mergewidget.cpp b/kaddressbook/features/mergewidget.cpp
index 2476e42..1becc2f 100644
--- a/kaddressbook/features/mergewidget.cpp
+++ b/kaddressbook/features/mergewidget.cpp
@@ -1,129 +1,131 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kabc/addressbook.h>
#include "kabcore.h"
#include "mergewidget.h"
#ifndef KAB_EMBEDDED
class MergeFactory : public ExtensionFactory
{
public:
ExtensionWidget *extension( KABCore *core, QWidget *parent, const char *name )
{
return new MergeWidget( core, parent, name );
}
QString identifier() const
{
return "merge";
}
};
extern "C" {
void *init_libkaddrbk_merge()
{
return ( new MergeFactory );
}
}
#endif //KAB_EMBEDDED
-class ContactItem : public QListViewItem
+class ContactItem : public Q3ListViewItem
{
public:
ContactItem( KListView *parent, const KABC::Addressee &addressee )
- : QListViewItem( parent ), mAddressee( addressee )
+ : Q3ListViewItem( parent ), mAddressee( addressee )
{
KABC::Field::List fieldList = KABC::Field::defaultFields();
KABC::Field::List::ConstIterator it;
int i = 0;
for ( it = fieldList.begin(); it != fieldList.end(); ++it )
setText( i++, (*it)->value( mAddressee ) );
}
KABC::Addressee addressee() const
{
return mAddressee;
}
private:
KABC::Addressee mAddressee;
};
MergeWidget::MergeWidget( KABCore *core, QWidget *parent, const char *name )
: ExtensionWidget( core, parent, name ), mBlockUpdate( false )
{
#ifdef KAB_EMBEDDED
if (KGlobal::getOrientation() == KGlobal::Portrait)
parent->setMaximumSize( KGlobal::getDesktopWidth() , 180);
#endif //KAB_EMBEDDED
- QGridLayout *topLayout = new QGridLayout( this, 3, 2, KDialog::marginHint(),
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 3, 2, KDialog::marginHint(),
KDialog::spacingHint() );
mContactView = new KListView( this );
KABC::Field::List fieldList = KABC::Field::defaultFields();
KABC::Field::List::ConstIterator it;
for ( it = fieldList.begin(); it != fieldList.end(); ++it )
mContactView->addColumn( (*it)->label() );
mContactView->setEnabled( false );
mContactView->setAllColumnsShowFocus( true );
topLayout->addMultiCellWidget( mContactView, 0, 2, 0, 0 );
connect( mContactView, SIGNAL( selectionChanged() ),
SLOT( selectionContactViewChanged() ) );
mMergeAndRemoveButton = new QPushButton( i18n( "Merge and Remove" ), this );
mMergeAndRemoveButton->setEnabled( false );
topLayout->addWidget( mMergeAndRemoveButton, 0, 1 );
connect( mMergeAndRemoveButton, SIGNAL( clicked() ), SLOT( mergeAndRemove() ) );
mMergeButton = new QPushButton( i18n( "Merge" ), this );
mMergeButton->setEnabled( false );
topLayout->addWidget( mMergeButton, 1, 1 );
connect( mMergeButton, SIGNAL( clicked() ), SLOT( merge() ) );
#ifndef KAB_EMBEDDED
KAcceleratorManager::manage( this );
#endif //KAB_EMBEDDED
}
MergeWidget::~MergeWidget()
@@ -185,65 +187,65 @@ void MergeWidget::updateView()
new ContactItem( mContactView, *it );
}
QString MergeWidget::title() const
{
return i18n( "Merge Contacts Editor" );
}
QString MergeWidget::identifier() const
{
return "merge";
}
void MergeWidget::mergeAndRemove()
{
#ifndef KAB_EMBEDDED
ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() );
#else //KAB_EMBEDDED
ContactItem *item = (ContactItem*)( mContactView->currentItem() );
#endif //KAB_EMBEDDED
if ( !item )
return;
QString oldUID = item->addressee().uid();
doMerge( item->addressee() );
KABC::Addressee::List retval;
retval << mMasterAddressee;
emit modified( retval );
mBlockUpdate = true;
- core()->deleteContacts( oldUID );
+ core()->deleteContacts( QStringList(oldUID) );
core()->setContactSelected( mMasterAddressee.uid() );
mBlockUpdate = false;
updateView();
}
void MergeWidget::merge()
{
#ifndef KAB_EMBEDDED
ContactItem *item = dynamic_cast<ContactItem*>( mContactView->currentItem() );
#else //KAB_EMBEDDED
ContactItem *item = (ContactItem*)( mContactView->currentItem() );
#endif //KAB_EMBEDDED
if ( !item )
return;
doMerge( item->addressee() );
KABC::Addressee::List retval;
retval << mMasterAddressee;
emit modified( retval );
mBlockUpdate = true;
core()->setContactSelected( mMasterAddressee.uid() );
mBlockUpdate = false;
updateView();
}
void MergeWidget::doMerge( const KABC::Addressee &addr )
{
// ADR + LABEL
@@ -340,35 +342,35 @@ void MergeWidget::doMerge( const KABC::Addressee &addr )
// TEL
KABC::PhoneNumber::List phones = addr.phoneNumbers();
KABC::PhoneNumber::List masterPhones = mMasterAddressee.phoneNumbers();
KABC::PhoneNumber::List::ConstIterator phoneIt;
for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt )
if ( !masterPhones.contains( *it ) )
mMasterAddressee.insertPhoneNumber( *it );
// TITLE
if ( mMasterAddressee.title().isEmpty() && !addr.title().isEmpty() )
mMasterAddressee.setTitle( addr.title() );
// TZ
if ( !mMasterAddressee.timeZone().isValid() && addr.timeZone().isValid() )
mMasterAddressee.setTimeZone( addr.timeZone() );
// UID // ignore UID
// URL
if ( mMasterAddressee.url().isEmpty() && !addr.url().isEmpty() )
mMasterAddressee.setUrl( addr.url() );
// X-
QStringList customs = addr.customs();
QStringList masterCustoms = mMasterAddressee.customs();
QStringList newCustoms( masterCustoms );
for ( it = customs.begin(); it != customs.end(); ++it )
if ( !masterCustoms.contains( *it ) )
newCustoms.append( *it );
mMasterAddressee.setCustoms( newCustoms );
}
-#ifndef KAB_EMBEDDED
-#include "mergewidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_mergewidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/features/mergewidget.h b/kaddressbook/features/mergewidget.h
index 1063c80..bb16282 100644
--- a/kaddressbook/features/mergewidget.h
+++ b/kaddressbook/features/mergewidget.h
@@ -1,64 +1,64 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef MERGEWIDGET_H
#define MERGEWIDGET_H
#include <kdialogbase.h>
#include <klistview.h>
#include "extensionwidget.h"
-class QListView;
+class Q3ListView;
class KABCore;
namespace KABC {
class AddressBook;
}
class MergeWidget : public ExtensionWidget
{
Q_OBJECT
public:
MergeWidget( KABCore*, QWidget *parent, const char *name = 0 );
virtual ~MergeWidget();
void contactsSelectionChanged();
QString title() const;
QString identifier() const;
private slots:
void mergeAndRemove();
void merge();
void selectionContactViewChanged();
private:
void updateView();
void doMerge( const KABC::Addressee &addr );
KListView *mContactView;
QPushButton *mMergeAndRemoveButton;
diff --git a/kaddressbook/filter.cpp b/kaddressbook/filter.cpp
index 12ab1e3..6462310 100644
--- a/kaddressbook/filter.cpp
+++ b/kaddressbook/filter.cpp
@@ -189,50 +189,50 @@ void Filter::save( KConfig *config, QString baseGroup, Filter::List &list )
config->writeEntry( "Count", index );
}
Filter::List Filter::restore( KConfig *config, QString baseGroup )
{
Filter::List list;
int count = 0;
Filter f;
{
KConfigGroupSaver s( config, baseGroup );
count = config->readNumEntry( "Count", 0 );
}
for ( int i = 0; i < count; i++ ) {
{
KConfigGroupSaver s( config, QString( "%1_%2" ).arg( baseGroup ).arg( i ) );
f.restore( config );
}
list.append( f );
}
if ( list.isEmpty()) {
QStringList cats = KABPrefs::instance()->mCustomCategories;
for ( QStringList::Iterator it = cats.begin(); it != cats.end(); ++it ) {
Filter filter;
filter.noName = false;
filter.mName = *it;
filter.mEnabled = true;
- filter.mCategoryList = *it;
+ filter.mCategoryList = QStringList(*it);
filter.mMatchRule = Matching;
filter.mInternal = true;
list.append( filter );
}
}
return list;
}
void Filter::setMatchRule( MatchRule rule )
{
mMatchRule = rule;
}
Filter::MatchRule Filter::matchRule() const
{
return mMatchRule;
}
diff --git a/kaddressbook/filter.h b/kaddressbook/filter.h
index f4ae123..508436d 100644
--- a/kaddressbook/filter.h
+++ b/kaddressbook/filter.h
@@ -1,77 +1,77 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef FILTER_H
#define FILTER_H
#include <qstring.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <kabc/addressee.h>
#include <kconfig.h>
/**
Filter for AddressBook related objects (Addressees)
@todo This class should be switched to use shared data.
*/
class Filter
{
public:
enum { ShowPublic = 1, ShowPrivate = 2, ShowConfidential = 4 };
void setCriteria(int c) { mCriteria = c ;}
int criteria() const { return mCriteria;}
- typedef QValueList<Filter> List;
+ typedef Q3ValueList<Filter> List;
enum MatchRule { Matching = 0, NotMatching = 1 };
Filter();
Filter( const QString& name );
~Filter();
/**
Set the name of the filter.
*/
void setName( const QString &name );
/**
@return The name of the filter.
*/
const QString &name() const;
/**
@return Whether the filter is an internal one.
*/
bool isInternal() const;
/**
Apply the filter to the addressee list. All addressees not passing
the filter criterias will be removed from the list.
If the MatchRule is NotMatch, then all the addressees matching the
filter will be removed from the list.
*/
void apply( KABC::Addressee::List &addresseeList );
/**
diff --git a/kaddressbook/filtereditdialog.cpp b/kaddressbook/filtereditdialog.cpp
index ef9b979..40698a7 100644
--- a/kaddressbook/filtereditdialog.cpp
+++ b/kaddressbook/filtereditdialog.cpp
@@ -1,199 +1,201 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
-#include <qbuttongroup.h>
-#include <qhbox.h>
+#include <q3buttongroup.h>
+#include <q3hbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qregexp.h>
#include <qstring.h>
#include <qtoolbutton.h>
#include <qtooltip.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kapplication.h>
#include <kbuttonbox.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klistbox.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include "kabprefs.h"
#include "filtereditdialog.h"
FilterEditDialog::FilterEditDialog( QWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Edit Address Book Filter" ),
Help | Ok | Cancel, Ok, parent, name, /*US false*/ true, true )
{
initGUI();
QStringList cats = KABPrefs::instance()->mCustomCategories;
QStringList::Iterator iter;
for ( iter = cats.begin(); iter != cats.end(); ++iter )
- mCategoriesView->insertItem( new QCheckListItem( mCategoriesView, (*iter), QCheckListItem::CheckBox ) );
+ mCategoriesView->insertItem( new Q3CheckListItem( mCategoriesView, (*iter), Q3CheckListItem::CheckBox ) );
filterNameTextChanged( mNameEdit->text() );
}
FilterEditDialog::~FilterEditDialog()
{
}
void FilterEditDialog::setFilter( const Filter &filter )
{
mNameEdit->setText( filter.name() );
QStringList categories = filter.categories();
- QListViewItem *item = mCategoriesView->firstChild();
+ Q3ListViewItem *item = mCategoriesView->firstChild();
while ( item != 0 ) {
if ( categories.contains( item->text( 0 ) ) ) {
- QCheckListItem *checkItem = static_cast<QCheckListItem*>( item );
+ Q3CheckListItem *checkItem = static_cast<Q3CheckListItem*>( item );
checkItem->setOn( true );
}
item = item->nextSibling();
}
if ( filter.matchRule() == Filter::Matching )
mMatchRuleGroup->setButton( 0 );
else
mMatchRuleGroup->setButton( 1 );
int c = filter.criteria() ;
mPublic->setChecked(c &Filter::ShowPublic);
mPrivate->setChecked(c & Filter::ShowPrivate);
mConfidential->setChecked(c & Filter::ShowConfidential);
}
Filter FilterEditDialog::filter()
{
Filter filter;
filter.setName( mNameEdit->text() );
QStringList categories;
- QListViewItem *item = mCategoriesView->firstChild();
+ Q3ListViewItem *item = mCategoriesView->firstChild();
while ( item != 0 ) {
- QCheckListItem *checkItem = static_cast<QCheckListItem*>( item );
+ Q3CheckListItem *checkItem = static_cast<Q3CheckListItem*>( item );
if ( checkItem->isOn() )
categories.append( item->text( 0 ) );
item = item->nextSibling();
}
filter.setCategories( categories );
if ( mMatchRuleGroup->find( 0 )->isOn() )
filter.setMatchRule( Filter::Matching );
else
filter.setMatchRule( Filter::NotMatching );
int c = 0;
if (mPublic->isChecked()) c |= Filter::ShowPublic;
if (mPrivate->isChecked()) c |= Filter::ShowPrivate;
if (mConfidential->isChecked()) c |= Filter::ShowConfidential;
filter.setCriteria( c ) ;
return filter;
}
void FilterEditDialog::initGUI()
{
#ifndef KAB_EMBEDDED
resize( 490, 300 );
#else //KAB_EMBEDDED
resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
#endif //KAB_EMBEDDED
QWidget *page = plainPage();
QLabel *label;
- QGridLayout *topLayout = new QGridLayout( page, 3, 2, 0, spacingHint() );
+ Q3GridLayout *topLayout = new Q3GridLayout( page, 3, 2, 0, spacingHint() );
label = new QLabel( i18n( "Name" ), page );
mNameEdit = new KLineEdit( page );
mNameEdit->setFocus();
topLayout->addWidget( label, 0, 0 );
topLayout->addWidget( mNameEdit, 0, 1 );
connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( filterNameTextChanged( const QString&) ) );
mCategoriesView = new KListView( page );
mCategoriesView->addColumn( i18n( "Categories" ) );
topLayout->addMultiCellWidget( mCategoriesView, 1, 1, 0, 1 );
- mMatchRuleGroup = new QHButtonGroup( i18n( "Category rule" ), page );
+ mMatchRuleGroup = new Q3HButtonGroup( i18n( "Category rule" ), page );
mMatchRuleGroup->setExclusive( true );
QRadioButton *radio = new QRadioButton( i18n( "Include categories" ), mMatchRuleGroup );
//mMatchRuleGroup->insert( radio );
radio = new QRadioButton( i18n( "Exclude categories" ), mMatchRuleGroup );
radio->setChecked( true );
//mMatchRuleGroup->insert( radio );
topLayout->addMultiCellWidget( mMatchRuleGroup, 2, 2, 0, 1 );
- QHButtonGroup * mMatchPPCGroup = new QHButtonGroup(i18n( "Include contacts, that are:" ), page );
+ Q3HButtonGroup * mMatchPPCGroup = new Q3HButtonGroup(i18n( "Include contacts, that are:" ), page );
mPublic = new QCheckBox( i18n( "public" ), mMatchPPCGroup );
mPrivate = new QCheckBox( i18n( "private" ), mMatchPPCGroup );
mConfidential = new QCheckBox( i18n( "confidential" ), mMatchPPCGroup );
mPublic->setChecked( true );
mPrivate->setChecked( true );
mConfidential->setChecked( true );
topLayout->addMultiCellWidget( mMatchPPCGroup, 3, 3, 0, 1 );
}
void FilterEditDialog::filterNameTextChanged( const QString &text )
{
enableButtonOK( !text.isEmpty() );
}
void FilterEditDialog::slotHelp()
{
#ifndef KAB_EMBEDDED
kapp->invokeHelp( "using-filters" );
#endif //KAB_EMBEDDED
}
FilterDialog::FilterDialog( QWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Edit Address Book Filters" ),
Ok | Cancel, Ok, parent, name, /*US false*/true, true )
{
initGUI();
}
FilterDialog::~FilterDialog()
{
}
@@ -243,73 +245,73 @@ void FilterDialog::edit()
uint pos = mFilterListBox->currentItem();
dlg.setFilter( mFilterList[ pos ] );
if ( dlg.exec() ) {
mFilterList.remove( mFilterList.at( pos ) );
mFilterList.insert( mFilterList.at( pos ), dlg.filter() );
}
refresh();
mFilterListBox->setCurrentItem( pos );
}
void FilterDialog::remove()
{
mFilterList.remove( mFilterList.at( mFilterListBox->currentItem() ) );
selectionChanged( 0 );
refresh();
}
void FilterDialog::refresh()
{
mFilterListBox->clear();
Filter::List::Iterator iter;
for ( iter = mFilterList.begin(); iter != mFilterList.end(); ++iter )
mFilterListBox->insertItem( (*iter).name() );
}
-void FilterDialog::selectionChanged( QListBoxItem *item )
+void FilterDialog::selectionChanged( Q3ListBoxItem *item )
{
bool state = ( item != 0 );
mEditButton->setEnabled( state );
mRemoveButton->setEnabled( state );
}
void FilterDialog::initGUI()
{
#ifndef KAB_EMBEDDED
resize( 330, 200 );
#else //KAB_EMBEDDED
resize( KMIN(KGlobal::getDesktopWidth()-10, 330), KMIN(KGlobal::getDesktopHeight()-50, 200));
#endif //KAB_EMBEDDED
QWidget *page = plainPage();
- QGridLayout *topLayout = new QGridLayout( page, 1, 2, 0, spacingHint() );
+ Q3GridLayout *topLayout = new Q3GridLayout( page, 1, 2, 0, spacingHint() );
mFilterListBox = new KListBox( page );
topLayout->addWidget( mFilterListBox, 0, 0 );
- connect( mFilterListBox, SIGNAL( selectionChanged( QListBoxItem * ) ),
- SLOT( selectionChanged( QListBoxItem * ) ) );
- connect( mFilterListBox, SIGNAL( doubleClicked ( QListBoxItem * ) ),
+ connect( mFilterListBox, SIGNAL( selectionChanged( Q3ListBoxItem * ) ),
+ SLOT( selectionChanged( Q3ListBoxItem * ) ) );
+ connect( mFilterListBox, SIGNAL( doubleClicked ( Q3ListBoxItem * ) ),
SLOT( edit() ) );
- KButtonBox *buttonBox = new KButtonBox( page, Vertical );
+ KButtonBox *buttonBox = new KButtonBox( page, Qt::Vertical );
buttonBox->addButton( i18n( "&Add..." ), this, SLOT( add() ) );
mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( edit() ) );
mEditButton->setEnabled( false );
mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( remove() ) );
mRemoveButton->setEnabled( false );
buttonBox->layout();
topLayout->addWidget( buttonBox, 0, 1 );
}
-#ifndef KAB_EMBEDDED
-#include "filtereditdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_filtereditdialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/filtereditdialog.h b/kaddressbook/filtereditdialog.h
index 5a8bad1..64d2976 100644
--- a/kaddressbook/filtereditdialog.h
+++ b/kaddressbook/filtereditdialog.h
@@ -2,108 +2,107 @@
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef FILTEREDITDIALOG_H
#define FILTEREDITDIALOG_H
-class QButtonGroup;
+#include <Q3HButtonGroup>
class QString;
class QToolButton;
class QWidget;
-class QListBoxItem;
+class Q3ListBoxItem;
class QCheckBox;
class KLineEdit;
class KListBox;
class KListView;
#include <kdialogbase.h>
-#include <qhbuttongroup.h>
#include "filter.h"
class FilterDialog : public KDialogBase
{
Q_OBJECT
public:
FilterDialog( QWidget *parent, const char *name = 0 );
~FilterDialog();
void setFilters( const Filter::List &list );
Filter::List filters() const;
protected slots:
void add();
void edit();
void remove();
- void selectionChanged( QListBoxItem* );
+ void selectionChanged( Q3ListBoxItem* );
private:
void initGUI();
void refresh();
Filter::List mFilterList;
Filter::List mInternalFilterList;
KListBox *mFilterListBox;
QPushButton *mAddButton;
QPushButton *mEditButton;
QPushButton *mRemoveButton;
};
class FilterEditDialog : public KDialogBase
{
Q_OBJECT
public:
FilterEditDialog( QWidget *parent, const char *name = 0 );
~FilterEditDialog();
void setFilter( const Filter &filter );
Filter filter();
protected slots:
void filterNameTextChanged( const QString& );
void slotHelp();
private:
void initGUI();
Filter mFilter;
KLineEdit *mNameEdit;
KListView *mCategoriesView;
- QHButtonGroup *mMatchRuleGroup;
+ Q3HButtonGroup *mMatchRuleGroup;
QCheckBox *mPrivate;
QCheckBox *mPublic;
QCheckBox *mConfidential;
QPushButton *mEditButton;
QPushButton *mRemoveButton;
};
#endif
diff --git a/kaddressbook/geowidget.cpp b/kaddressbook/geowidget.cpp
index 13cd084..caff3b2 100644
--- a/kaddressbook/geowidget.cpp
+++ b/kaddressbook/geowidget.cpp
@@ -1,104 +1,111 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kabc/geo.h>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#else //KAB_EMBEDDED
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <QMouseEvent>
#include <kglobal.h>
#endif //KAB_EMBEDDED
+#include <QDesktopWidget>
+
#include <knuminput.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <qcheckbox.h>
#include <qfile.h>
#include <qapplication.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qregexp.h>
#include <qstring.h>
#include <stdlib.h>
#include "geowidget.h"
GeoWidget::GeoWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
QLabel *label = 0;
- QGridLayout *topLayout = new QGridLayout( this, 4, 3 );
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 4, 3 );
topLayout->setMargin( KDialog::marginHint() );
topLayout->setSpacing( KDialog::spacingHint() );
label = new QLabel( this );
//US ambiguous call to loadIcon. Add an additional parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "package_network", KIcon::Desktop, 0 ) );
label->setAlignment( Qt::AlignTop );
topLayout->addMultiCellWidget( label, 0, 3, 0, 0 );
- label->setAlignment( AlignCenter );
+ label->setAlignment( Qt::AlignCenter );
mGeoIsValid = new QCheckBox( i18n( "Use geo data" ), this );
topLayout->addMultiCellWidget( mGeoIsValid, 0, 0, 1, 2 );
label = new QLabel( i18n( "Latitude:" ), this );
topLayout->addWidget( label, 1, 1 );
mLatitudeBox = new KDoubleSpinBox( -90, 90, 1, 0, 6, this );
mLatitudeBox->setEnabled( false );
mLatitudeBox->setSuffix( "" );
topLayout->addWidget( mLatitudeBox, 1, 2 );
label->setBuddy( mLatitudeBox );
label = new QLabel( i18n( "Longitude:" ), this );
topLayout->addWidget( label, 2, 1 );
mLongitudeBox = new KDoubleSpinBox( -180, 180, 1, 0, 6, this );
mLongitudeBox->setEnabled( false );
mLongitudeBox->setSuffix( "" );
topLayout->addWidget( mLongitudeBox, 2, 2 );
label->setBuddy( mLongitudeBox );
mExtendedButton = new QPushButton( i18n( "Edit Geo Data..." ), this );
mExtendedButton->setEnabled( false );
topLayout->addMultiCellWidget( mExtendedButton, 3, 3, 1, 2 );
connect( mLatitudeBox, SIGNAL( valueChanged( double ) ),
SIGNAL( changed() ) );
connect( mLongitudeBox, SIGNAL( valueChanged( double ) ),
SIGNAL( changed() ) );
connect( mExtendedButton, SIGNAL( clicked() ),
SLOT( editGeoData() ) );
@@ -138,74 +145,74 @@ KABC::Geo GeoWidget::geo() const
geo.setLatitude( mLatitudeBox->value() );
geo.setLongitude( mLongitudeBox->value() );
} else {
geo.setLatitude( 91 );
geo.setLongitude( 181 );
}
return geo;
}
void GeoWidget::editGeoData()
{
GeoDialog dlg( this );
dlg.setLatitude( mLatitudeBox->value() );
dlg.setLongitude( mLongitudeBox->value() );
if ( dlg.exec() ) {
mLatitudeBox->setValue( dlg.latitude() );
mLongitudeBox->setValue( dlg.longitude() );
emit changed();
}
}
GeoDialog::GeoDialog( QWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok,
parent, name, true, true ),
mUpdateSexagesimalInput( true )
{
- QFrame *page = plainPage();
+ Q3Frame *page = plainPage();
- QGridLayout *topLayout = new QGridLayout( page, 1, 1, marginHintSmall(),
+ Q3GridLayout *topLayout = new Q3GridLayout( page, 1, 1, marginHintSmall(),
spacingHint() );
//topLayout->setRowStretch( 1, 1 );
mMapWidget = new GeoMapWidget( page );
mCityCombo = new KComboBox( page );
- QGroupBox *sexagesimalGroup = new QGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page );
- QGridLayout *sexagesimalLayout = new QGridLayout( sexagesimalGroup->layout(),
+ Q3GroupBox *sexagesimalGroup = new Q3GroupBox( 0, Qt::Vertical, i18n( "Sexagesimal" ), page );
+ Q3GridLayout *sexagesimalLayout = new Q3GridLayout( sexagesimalGroup->layout(),
2, 5, spacingHint() );
QLabel *label;
if ( QApplication::desktop()->width() < 320 ) {
label = new QLabel( i18n( "La." ), sexagesimalGroup );
sexagesimalLayout->setSpacing ( spacingHintSmall() );
sexagesimalLayout->setMargin ( marginHintSmall() );
topLayout->setMargin ( 0 );
mCityCombo->setMaximumWidth( 220 );
sexagesimalGroup->setMaximumWidth( 220 );
}
else
label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup );
sexagesimalLayout->addWidget( label, 0, 0 );
int maxWid = 60;
if ( QApplication::desktop()->width() < 320 )
maxWid = 40;
mLatDegrees = new QSpinBox( 0, 90, 1, sexagesimalGroup );
mLatDegrees->setSuffix( "" );
mLatDegrees->setWrapping( false );
sexagesimalLayout->addWidget( mLatDegrees, 0, 1 );
mLatDegrees->setMaximumWidth( maxWid );
mLatMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup );
mLatMinutes->setSuffix( "'" );
sexagesimalLayout->addWidget( mLatMinutes, 0, 2 );
mLatMinutes->setMaximumWidth( maxWid );
mLatSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup );
mLatSeconds->setSuffix( "\"" );
sexagesimalLayout->addWidget( mLatSeconds, 0, 3 );
mLatSeconds->setMaximumWidth( maxWid );
@@ -400,66 +407,66 @@ void GeoDialog::updateInputs()
mCityCombo->setCurrentItem( 0 );
mCityCombo->blockSignals( false );
mLatDegrees->blockSignals( false );
mLatMinutes->blockSignals( false );
mLatSeconds->blockSignals( false );
mLatDirection->blockSignals( false );
mLongDegrees->blockSignals( false );
mLongMinutes->blockSignals( false );
mLongSeconds->blockSignals( false );
mLongDirection->blockSignals( false );
}
void GeoDialog::loadCityList()
{
mCityCombo->clear();
mGeoDataMap.clear();
QString fileName ;
#ifdef DESKTOP_VERSION
#ifndef _WIN32_
fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/zone.tab";
#else
fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\zone.tab";
#endif
#else
fileName = getenv("QPEDIR");
fileName += "/pics/kdepim/kaddressbook/zone.tab";
#endif
QFile file( fileName);
- if ( file.open( IO_ReadOnly ) ) {
- QTextStream s( &file );
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ Q3TextStream s( &file );
QString line, country;
QRegExp coord( "[+-]\\d+[+-]\\d+" );
QRegExp name( "[^\\s]+/[^\\s]+" );
int posc, posn, pos;
while ( !s.eof() ) {
line = s.readLine().stripWhiteSpace();
if ( line.isEmpty() || line[ 0 ] == '#' )
continue;
country = line.left( 2 );
QString c, n;
#ifdef DESKTOP_VERSION
posc = coord.search( line, 0 );
#else
posc = coord.find( line, 0 );
#endif
// if ( pos >= 0 )
//c = line.mid( pos, coord.matchedLength() );
#ifdef DESKTOP_VERSION
posn = name.search(line, posc);
#else
posn = name.find(line, posc);
#endif
if ( posn > 0 ) {
c = line.mid( posc, posn-posc ).stripWhiteSpace();
//qDebug("*%s* ", c.latin1());
int nend = line.find(" ", posn );
if ( nend < 0 )
nend = line.length();
@@ -523,65 +530,65 @@ double GeoDialog::calculateCoordinate( const QString &coordinate )
d = str.left( 3 ).toInt();
m = str.mid( 3, 2 ).toInt();
s = str.right( 2 ).toInt();
break;
default:
break;
}
if ( neg )
return - ( d + m / 60.0 + s / 3600.0 );
else
return d + m / 60.0 + s / 3600.0;
}
int GeoDialog::nearestCity( double x, double y )
{
QMap<QString, GeoData>::Iterator it;
int pos = 0;
for ( it = mGeoDataMap.begin(); it != mGeoDataMap.end(); ++it, pos++ ) {
double dist = ( (*it).longitude - x ) * ( (*it).longitude - x ) +
( (*it).latitude - y ) * ( (*it).latitude - y );
if ( dist < 1.5 )
return pos;
}
return -1;
}
GeoMapWidget::GeoMapWidget( QWidget *parent, const char *name )
: QWidget( parent, name ), mLatitude( 0 ), mLongitude( 0 )
{
- setBackgroundMode( NoBackground );
+ setBackgroundMode( Qt::NoBackground );
setFixedSize( 240, 120 );
update();
}
GeoMapWidget::~GeoMapWidget()
{
}
void GeoMapWidget::setLatitude( double latitude )
{
mLatitude = latitude;
}
double GeoMapWidget::latitude()const
{
return mLatitude;
}
void GeoMapWidget::setLongitude( double longitude )
{
mLongitude = longitude;
}
double GeoMapWidget::longitude()const
{
return mLongitude;
}
void GeoMapWidget::mousePressEvent( QMouseEvent *event )
{
@@ -595,35 +602,35 @@ void GeoMapWidget::mousePressEvent( QMouseEvent *event )
mLongitude = ( longOffset * 180 ) / longMid;
emit changed();
}
void GeoMapWidget::paintEvent( QPaintEvent* )
{
uint w = width();
uint h = height();
QPixmap world = KGlobal::iconLoader()->loadIcon( "world", KIcon::Desktop, 0 );
QPainter p;
p.begin( &world, this );
p.setPen( QColor( 255, 0, 0 ) );
p.setBrush( QColor( 255, 0, 0 ) );
double latMid = h / 2;
double longMid = w / 2;
double latOffset = ( mLatitude * latMid ) / 90;
double longOffset = ( mLongitude * longMid ) / 180;
int x = (int)(longMid + longOffset);
int y = (int)(latMid - latOffset);
p.drawEllipse( x, y, 4, 4 );
p.end();
bitBlt( this, 0, 0, &world );
}
-#ifndef KAB_EMBEDDED
-#include "geowidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_geowidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/geowidget.h b/kaddressbook/geowidget.h
index 3d39691..5b64370 100644
--- a/kaddressbook/geowidget.h
+++ b/kaddressbook/geowidget.h
@@ -1,61 +1,65 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef GEOWIDGET_H
#define GEOWIDGET_H
#include <qmap.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <QLabel>
+#include <QMouseEvent>
+#include <QPaintEvent>
#include <kdialogbase.h>
namespace KABC {
class Geo;
}
class GeoMapWidget;
class KComboBox;
class KDoubleSpinBox;
class QCheckBox;
class QLabel;
class QSpinBox;
class QPushButton;
typedef struct {
double latitude;
double longitude;
QString country;
} GeoData;
class GeoWidget : public QWidget
{
Q_OBJECT
public:
GeoWidget( QWidget *parent, const char *name = 0 );
~GeoWidget();
/**
Sets the geo object.
diff --git a/kaddressbook/imagewidget.cpp b/kaddressbook/imagewidget.cpp
index eec5e08..6ecf66d 100644
--- a/kaddressbook/imagewidget.cpp
+++ b/kaddressbook/imagewidget.cpp
@@ -8,132 +8,136 @@
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kabc/picture.h>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#include <kio/netaccess.h>
#include <kimageio.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kurlrequester.h>
#include <kurl.h>
#include <qcheckbox.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3Frame>
#include "imagewidget.h"
ImageWidget::ImageWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QGridLayout *topLayout = new QGridLayout( this, 2, 1, KDialog::marginHint(),
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 2, 1, KDialog::marginHint(),
KDialog::spacingHint() );
- QGroupBox *photoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
- QGridLayout *boxLayout = new QGridLayout( photoBox->layout(), 3, 2,
+ Q3GroupBox *photoBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Photo" ), this );
+ Q3GridLayout *boxLayout = new Q3GridLayout( photoBox->layout(), 3, 2,
KDialog::spacingHint() );
boxLayout->setRowStretch( 2, 1 );
mPhotoLabel = new QLabel( photoBox );
int fac = 9;
if ( QApplication::desktop()->width() > 320 )
fac = 6;
mPhotoLabel->setFixedSize( 50*9/fac, 70*9/fac );
mPhotoLabel->setScaledContents( true );
- mPhotoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+ mPhotoLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
boxLayout->addMultiCellWidget( mPhotoLabel, 0, 3, 0, 0 );
mPhotoUrl = new KURLRequester( photoBox );
#ifndef KAB_EMBEDDED
mPhotoUrl->setFilter( KImageIO::pattern() );
#else //KAB_EMBEDDED
//US qDebug("ImageWidget::ImageWidget KImageIO not defined. Does this harm ???");
#endif //KAB_EMBEDDED
boxLayout->addWidget( mPhotoUrl, 0, 1 );
- QHBox *hb1 = new QHBox ( photoBox );
+ Q3HBox *hb1 = new Q3HBox ( photoBox );
mUsePhotoUrl = new QCheckBox( i18n( "Store as URL" ), hb1 );
mUsePhotoUrl->setEnabled( false );
boxLayout->addWidget( hb1, 1, 1 );
QPushButton * pb = new QPushButton( i18n( "Remove" ), hb1 );
connect( pb, SIGNAL( clicked() ),this, SLOT( removePhoto() ) );
boxLayout->addWidget( new QLabel( photoBox ), 2, 1 );
topLayout->addWidget( photoBox, 0, 0 );
- QGroupBox *logoBox = new QGroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
- boxLayout = new QGridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() );
+ Q3GroupBox *logoBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Logo" ), this );
+ boxLayout = new Q3GridLayout( logoBox->layout(), 3, 2, KDialog::spacingHint() );
boxLayout->setRowStretch( 2, 1 );
mLogoLabel = new QLabel( logoBox );
mLogoLabel->setFixedSize( 50*9/fac, 70*9/fac );
mLogoLabel->setScaledContents( true );
- mLogoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+ mLogoLabel->setFrameStyle( Q3Frame::Panel | Q3Frame::Sunken );
boxLayout->addMultiCellWidget( mLogoLabel, 0, 3, 0, 0 );
mLogoUrl = new KURLRequester( logoBox );
#ifndef KAB_EMBEDDED
mLogoUrl->setFilter( KImageIO::pattern() );
#else //KAB_EMBEDDED
//US qDebug("ImageWidget::ImageWidget KImageIO not defined 2");
#endif //KAB_EMBEDDED
boxLayout->addWidget( mLogoUrl, 0, 1 );
- QHBox *hb2 = new QHBox ( logoBox );
+ Q3HBox *hb2 = new Q3HBox ( logoBox );
mUseLogoUrl = new QCheckBox( i18n( "Store as URL" ), hb2 );
mUseLogoUrl->setEnabled( false );
boxLayout->addWidget( hb2, 1, 1 );
pb = new QPushButton( i18n( "Remove" ), hb2 );
connect( pb, SIGNAL( clicked() ),this, SLOT( removeLogo() ) );
boxLayout->addWidget( new QLabel( logoBox ), 2, 1 );
topLayout->addWidget( logoBox, 1, 0 );
connect( mPhotoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadPhoto() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mPhotoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUsePhotoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( textChanged( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( loadLogo() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SIGNAL( changed() ) );
connect( mLogoUrl, SIGNAL( urlSelected( const QString& ) ),
SLOT( updateGUI() ) );
connect( mUseLogoUrl, SIGNAL( toggled( bool ) ),
SIGNAL( changed() ) );
#ifndef KAB_EMBEDDED
@@ -151,147 +155,147 @@ void ImageWidget::setPhoto( const KABC::Picture &photo )
bool blocked = signalsBlocked();
blockSignals( true );
if ( photo.isIntern() ) {
//US
//US mPhotoLabel->setPixmap( photo.data() );
if (photo.data().isNull() != true)
{
QPixmap pm;
pm.convertFromImage(photo.data());
mPhotoLabel->setPixmap( pm );
}
mUsePhotoUrl->setChecked( false );
} else {
mPhotoUrl->setURL( photo.url() );
if ( !photo.url().isEmpty() )
mUsePhotoUrl->setChecked( true );
loadPhoto();
}
blockSignals( blocked );
}
KABC::Picture ImageWidget::photo() const
{
KABC::Picture photo;
if ( mUsePhotoUrl->isChecked() )
photo.setUrl( mPhotoUrl->url() );
else {
- QPixmap *px = mPhotoLabel->pixmap();
+ const QPixmap *px = mPhotoLabel->pixmap();
if ( px ) {
#ifndef KAB_EMBEDDED
if ( px->height() > px->width() )
photo.setData( px->convertToImage().scaleHeight( 140 ) );
else
photo.setData( px->convertToImage().scaleWidth( 100 ) );
#else //KAB_EMBEDDED
//US add teh nullcheck
if (px->isNull() != true )
photo.setData( px->convertToImage() );
#endif //KAB_EMBEDDED
photo.setType( "PNG" );
}
}
return photo;
}
void ImageWidget::setLogo( const KABC::Picture &logo )
{
bool blocked = signalsBlocked();
blockSignals( true );
if ( logo.isIntern() ) {
//US
//US mLogoLabel->setPixmap( logo.data() );
if (logo.data().isNull() != true)
{
QPixmap pm;
pm.convertFromImage(logo.data());
mLogoLabel->setPixmap( pm );
}
mUseLogoUrl->setChecked( false );
} else {
mLogoUrl->setURL( logo.url() );
if ( !logo.url().isEmpty() )
mUseLogoUrl->setChecked( true );
loadLogo();
}
blockSignals( blocked );
}
KABC::Picture ImageWidget::logo() const
{
KABC::Picture logo;
if ( mUseLogoUrl->isChecked() )
logo.setUrl( mLogoUrl->url() );
else {
- QPixmap *px = mLogoLabel->pixmap();
+ const QPixmap *px = mLogoLabel->pixmap();
if ( px ) {
#ifndef KAB_EMBEDDED
if ( px->height() > px->width() )
logo.setData( px->convertToImage().scaleHeight( 140 ) );
else
logo.setData( px->convertToImage().scaleWidth( 100 ) );
#else //KAB_EMBEDDED
if (px->isNull() != true )
logo.setData( px->convertToImage() );
#endif //KAB_EMBEDDED
logo.setType( "PNG" );
}
}
return logo;
}
void ImageWidget::removePhoto()
{
setPhoto(KABC::Picture() );
}
void ImageWidget::removeLogo()
{
setLogo(KABC::Picture() );
}
void ImageWidget::loadPhoto()
{
mPhotoLabel->setPixmap( loadPixmap( mPhotoUrl->url() ) );
}
void ImageWidget::loadLogo()
{
mLogoLabel->setPixmap( loadPixmap( mLogoUrl->url() ) );
}
void ImageWidget::updateGUI()
{
KURLRequester *ptr = (KURLRequester*)sender();
if ( ptr == mPhotoUrl )
mUsePhotoUrl->setEnabled( true );
else if ( ptr == mLogoUrl )
mUseLogoUrl->setEnabled( true );
}
QPixmap ImageWidget::loadPixmap( const QString &url )
{
QPixmap pixmap;
if ( url.isEmpty() )
return pixmap;
pixmap.load( url );
return pixmap;
}
-#ifndef KAB_EMBEDDED
-#include "imagewidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_imagewidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/imagewidget.h b/kaddressbook/imagewidget.h
index bbfba58..9320a6b 100644
--- a/kaddressbook/imagewidget.h
+++ b/kaddressbook/imagewidget.h
@@ -1,59 +1,62 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef IMAGEWIDGET_H
#define IMAGEWIDGET_H
#include <qwidget.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QLabel>
#include <kabc/picture.h>
#include <kdialogbase.h>
class KURL;
class KURLRequester;
class QCheckBox;
class QLabel;
class ImageWidget : public QWidget
{
Q_OBJECT
public:
ImageWidget( QWidget *parent, const char *name = 0 );
~ImageWidget();
/**
Sets the photo object.
*/
void setPhoto( const KABC::Picture &photo );
/**
Returns a photo object.
*/
KABC::Picture photo() const;
/**
Sets the logo object.
*/
void setLogo( const KABC::Picture &photo );
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp
index 5f8b83d..a54d1cd 100644
--- a/kaddressbook/incsearchwidget.cpp
+++ b/kaddressbook/incsearchwidget.cpp
@@ -1,82 +1,86 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlabel.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qcombobox.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
#include <kdialog.h>
#include <klineedit.h>
#include <klocale.h>
#include <kglobal.h>
#include <kglobal.h>
#include "kabprefs.h"
#include "incsearchwidget.h"
IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
- : QWidget( parent, name )
{
+ setObjectName(name);
+ setParent(parent);
#ifndef KAB_EMBEDDED
//US setCaption( i18n( "Incremental Search" ) );
#endif //KAB_EMBEDDED
- QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() );
+ Q3HBoxLayout *layout = new Q3HBoxLayout( this, 2, KDialog::spacingHint() );
#ifdef DESKTOP_VERSION
QLabel *label = new QLabel( i18n( "Search:" ), this );
- label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
+ label->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
layout->addWidget( label );
#endif //KAB_EMBEDDED
mSearchText = new KLineEdit( this );
layout->addWidget( mSearchText );
// #ifdef KAB_EMBEDDED
// if (KGlobal::getOrientation() == KGlobal::Portrait)
// mSearchText->setMaximumWidth(30);
// #endif //KAB_EMBEDDED
//mSearchText->setMaximumWidth(60);
mFieldCombo = new QComboBox( false, this );
layout->addWidget( mFieldCombo );
mFieldCombo->setMaximumHeight( 34 );
QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) );
// #ifndef KAB_EMBEDDED
// resize( QSize(420, 50).expandedTo( sizeHint() ) );
// #else //KAB_EMBEDDED
// resize( QSize(30, 10).expandedTo( sizeHint() ) );
// #endif //KAB_EMBEDDED
// for performance reasons, we do a search on the pda only after return is pressed
connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
SLOT( announceDoSearch2() ) );
connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
SLOT( announceDoSearch2() ) );
connect( mSearchText, SIGNAL( returnPressed() ),
SLOT( announceDoSearch() ) );
@@ -147,35 +151,35 @@ void IncSearchWidget::setFields( const KABC::Field::List &list )
mFieldList = list;
announceDoSearch();
announceFieldChanged();
setSize();
}
KABC::Field::List IncSearchWidget::fields() const
{
return mFieldList;
}
KABC::Field *IncSearchWidget::currentField()const
{
if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 )
return 0; // for error or 'use all fields'
else
return mFieldList[ mFieldCombo->currentItem() - 1 ];
}
void IncSearchWidget::setCurrentItem( int pos )
{
mFieldCombo->setCurrentItem( pos );
announceFieldChanged();
}
int IncSearchWidget::currentItem() const
{
return mFieldCombo->currentItem();
}
-#ifndef KAB_EMBEDDED
-#include "incsearchwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_incsearchwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/jumpbuttonbar.cpp b/kaddressbook/jumpbuttonbar.cpp
index aebf8a6..740b7db 100644
--- a/kaddressbook/jumpbuttonbar.cpp
+++ b/kaddressbook/jumpbuttonbar.cpp
@@ -1,110 +1,113 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qevent.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qstring.h>
-#include <qtl.h>
+#include <q3tl.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kabc/addressbook.h>
#include <kabc/field.h>
#include <kdebug.h>
#include <klocale.h>
#include "kabcore.h"
#include "jumpbuttonbar.h"
class JumpButton : public QPushButton
{
public:
JumpButton( const QString &text, QWidget *parent,
const QString &character );
void setCharacter( const QString &character );
QString character() const;
private:
QString mCharacter;
};
JumpButton::JumpButton( const QString &text, QWidget *parent,
const QString &character )
: QPushButton( text, parent )
{
mCharacter = character;
}
void JumpButton::setCharacter( const QString &character )
{
mCharacter = character;
setText(mCharacter.upper() );
}
QString JumpButton::character() const
{
return mCharacter;
}
JumpButtonBar::JumpButtonBar( KABCore *core, QWidget *parent, const char *name )
: QWidget( parent, name ), mCore( core )
{
if ( QApplication::desktop()->width() < 480 )
- mButtonLayout = new QGridLayout( this, 1, 18 );
+ mButtonLayout = new Q3GridLayout( this, 1, 18 );
else
- mButtonLayout = new QGridLayout( this, 1, 20 );
+ mButtonLayout = new Q3GridLayout( this, 1, 20 );
mButtonLayout->setAlignment( Qt::AlignTop );
recreateButtons();
}
JumpButtonBar::~JumpButtonBar()
{
}
QSizePolicy JumpButtonBar::sizePolicy() const
{
#ifndef KAB_EMBEDDED
return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum,
QSizePolicy::Vertically );
#else //KAB_EMBEDDED
return QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Minimum);
#endif //KAB_EMBEDDED
}
void JumpButtonBar::letterClicked()
{
JumpButton *button = (JumpButton*)sender();
QString character = button->character();
if ( character.length() == 2 )
character = character.left(1) +"-"+character.right(1);
if ( !character.isNull() )
emit jumpToLetter( character );
//qDebug("emit *%s* ",character.latin1());
}
void JumpButtonBar::recreateButtons()
{
@@ -223,35 +226,35 @@ void JumpButtonBar::recreateButtons()
}
void JumpButtonBar::sortListLocaleAware( QStringList &list )
{
QStringList::Iterator beginIt = list.begin();
QStringList::Iterator endIt = list.end();
--endIt;
if ( beginIt == endIt ) // don't need sorting
return;
QStringList::Iterator walkBackIt = endIt;
while ( beginIt != endIt ) {
QStringList::Iterator j1 = list.begin();
QStringList::Iterator j2 = j1;
++j2;
while ( j1 != walkBackIt ) {
#ifndef KAB_EMBEDDED
if ( QString::localeAwareCompare( *j2, *j1 ) < 0 )
#else //KAB_EMBEDDED
if ( QString::compare( *j2, *j1 ) < 0 )
#endif //KAB_EMBEDDED
qSwap( *j1, *j2 );
++j1;
++j2;
}
++beginIt;
--walkBackIt;
}
}
-#ifndef KAB_EMBEDDED
-#include "jumpbuttonbar.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_jumpbuttonbar.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/jumpbuttonbar.h b/kaddressbook/jumpbuttonbar.h
index d534f2b..0589812 100644
--- a/kaddressbook/jumpbuttonbar.h
+++ b/kaddressbook/jumpbuttonbar.h
@@ -1,84 +1,87 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef JUMPBUTTONBAR_H
#define JUMPBUTTONBAR_H
#include <qsizepolicy.h>
#include <qwidget.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <Q3GridLayout>
class QChar;
-class QGridLayout;
+class Q3GridLayout;
class QResizeEvent;
class QPushButton;
class JumpButton;
namespace KABC {
class Field;
}
class KABCore;
/**
Used to draw the jump button bar on the right of the view.
*/
class JumpButtonBar : public QWidget
{
Q_OBJECT
public:
JumpButtonBar( KABCore *core, QWidget *parent, const char *name = 0 );
~JumpButtonBar();
QSizePolicy sizePolicy() const;
public slots:
/**
This method removes all buttons from the GUI and recreates them
according to the current global search field and the content of
the address book.
*/
void recreateButtons();
signals:
/**
Emitted whenever a letter is selected by the user.
*/
void jumpToLetter( const QString &character );
protected slots:
void letterClicked();
private:
void sortListLocaleAware( QStringList &list );
KABCore *mCore;
- QGridLayout *mButtonLayout;
+ Q3GridLayout *mButtonLayout;
QStringList mCharacters;
- QPtrList<JumpButton> mButtons;
+ Q3PtrList<JumpButton> mButtons;
};
#endif
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index ab2824c..03b44d1 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -10,293 +10,303 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Async a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*s
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include "kabcore.h"
#include <stdaddressbook.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <qtimer.h>
#include <qlabel.h>
#include <qregexp.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QPixmap>
+#include <Q3ValueList>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <Q3CString>
+#include <Q3PopupMenu>
+#include <Q3PtrList>
#include <libkdepim/phoneaccess.h>
#ifndef KAB_EMBEDDED
#include <qclipboard.h>
#include <qdir.h>
#include <qfile.h>
#include <qapplicaton.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qlayout.h>
#include <qregexp.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <kabc/addresseelist.h>
#include <kabc/errorhandler.h>
#include <kabc/resource.h>
#include <kabc/vcardconverter.h>
#include <kapplication.h>
#include <kactionclasses.h>
#include <kcmultidialog.h>
#include <kdebug.h>
#include <kdeversion.h>
#include <kkeydialog.h>
#include <kmessagebox.h>
#include <kprinter.h>
#include <kprotocolinfo.h>
#include <kresources/selectdialog.h>
#include <kstandarddirs.h>
#include <ktempfile.h>
#include <kxmlguiclient.h>
#include <kaboutdata.h>
#include <libkdepim/categoryselectdialog.h>
#include "addresseeutil.h"
#include "addresseeeditordialog.h"
#include "extensionmanager.h"
#include "kstdaction.h"
#include "kaddressbookservice.h"
#include "ldapsearchdialog.h"
#include "printing/printingwizard.h"
#else // KAB_EMBEDDED
#include <kapplication.h>
#include "KDGanttMinimizeSplitter.h"
#include "kaddressbookmain.h"
#include "kactioncollection.h"
#include "addresseedialog.h"
//US
#include <addresseeview.h>
-#include <qapp.h>
+#include <qapplication.h>
#include <qmenubar.h>
//#include <qtoolbar.h>
#include <qmessagebox.h>
#include <kdebug.h>
#include <kiconloader.h> // needed for SmallIcon
#include <kresources/kcmkresources.h>
#include <ktoolbar.h>
#include <kprefsdialog.h>
//#include <qlabel.h>
#ifndef DESKTOP_VERSION
#include <qpe/ir.h>
#include <qpe/qpemenubar.h>
#include <qtopia/qcopenvelope_qws.h>
#else
#include <qmenubar.h>
#endif
#endif // KAB_EMBEDDED
#include "kcmconfigs/kcmkabconfig.h"
#include "kcmconfigs/kcmkdepimconfig.h"
#include "kpimglobalprefs.h"
#include "externalapphandler.h"
#include "xxportselectdialog.h"
#include <kresources/selectdialog.h>
#include <kmessagebox.h>
#include <picture.h>
#include <resource.h>
//US#include <qsplitter.h>
#include <qmap.h>
#include <qdir.h>
#include <qfile.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qlayout.h>
#include <qclipboard.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/categoryeditdialog.h>
#include <kabc/vcardconverter.h>
#include "addresseeutil.h"
#include "undocmds.h"
#include "addresseeeditordialog.h"
#include "viewmanager.h"
#include "details/detailsviewcontainer.h"
#include "kabprefs.h"
#include "xxportmanager.h"
#include "incsearchwidget.h"
#include "jumpbuttonbar.h"
#include "extensionmanager.h"
#include "addresseeconfig.h"
#include "nameeditdialog.h"
#include <kcmultidialog.h>
#ifdef _WIN32_
#ifdef _OL_IMPORT_
#include "kaimportoldialog.h"
#include <libkdepim/ol_access.h>
#endif
#else
#include <unistd.h>
#endif
// sync includes
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/ksyncprefsdialog.h>
class KABCatPrefs : public QDialog
{
public:
KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Manage new Categories") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
lay->addWidget( lab );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
addCatBut = new QRadioButton(i18n("Add to category list"), format );
new QRadioButton(i18n("Remove from addressees"), format );
addCatBut->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
bool addCat() { return addCatBut->isChecked(); }
private:
QRadioButton* addCatBut;
};
class KABFormatPrefs : public QDialog
{
public:
KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Set formatted name") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
lay->addWidget( lab );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Set formatted name to:"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
simple = new QRadioButton(i18n("Simple: James Bond"), format );
full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
company = new QRadioButton(i18n("Organization: MI6"), format );
simple->setChecked( true );
setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
lay->addWidget( setCompany );
QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
//resize( 200, 200 );
}
public:
QRadioButton* simple, *full, *reverse, *company;
QCheckBox* setCompany;
};
class KAex2phonePrefs : public QDialog
{
public:
KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Export to phone options") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel *lab;
lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
- lab->setAlignment (AlignHCenter );
- QHBox* temphb;
- temphb = new QHBox( this );
+ lab->setAlignment (Qt::AlignHCenter );
+ Q3HBox* temphb;
+ temphb = new Q3HBox( this );
new QLabel( i18n("I/O device: "), temphb );
mPhoneDevice = new QLineEdit( temphb);
lay->addWidget( temphb );
- temphb = new QHBox( this );
+ temphb = new Q3HBox( this );
new QLabel( i18n("Connection: "), temphb );
mPhoneConnection = new QLineEdit( temphb);
lay->addWidget( temphb );
- temphb = new QHBox( this );
+ temphb = new Q3HBox( this );
new QLabel( i18n("Model(opt.): "), temphb );
mPhoneModel = new QLineEdit( temphb);
lay->addWidget( temphb );
// mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
// lay->addWidget( mWriteToSim );
lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
- lab->setAlignment (AlignHCenter);
+ lab->setAlignment (Qt::AlignHCenter);
QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 220, 240 );
}
public:
QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
QCheckBox* mWriteToSim;
};
bool pasteWithNewUid = true;
#ifdef KAB_EMBEDDED
KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
#else //KAB_EMBEDDED
KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
: QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
mReadWrite( readWrite ), mModified( false )
#endif //KAB_EMBEDDED
{
// syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
// syncManager->setBlockSave(false);
@@ -378,138 +388,138 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
#ifndef KAB_EMBEDDED
connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
mXXPortManager, SLOT( importVCard( const KURL& ) ) );
connect( mDetails, SIGNAL( browse( const QString& ) ),
SLOT( browse( const QString& ) ) );
mAddressBookService = new KAddressBookService( this );
#endif //KAB_EMBEDDED
mMessageTimer = new QTimer( this );
connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
mEditorDialog = 0;
createAddresseeEditorDialog( this );
setModified( false );
mBRdisabled = false;
#ifndef DESKTOP_VERSION
infrared = 0;
#endif
//toggleBeamReceive( );
mMainWindow->toolBar()->show();
// we have a toolbar repainting error on the Zaurus when starting KA/Pi
//QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() ));
}
-void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data )
+void KABCore::receiveStart( const Q3CString& cmsg, const QByteArray& data )
{
//qDebug("KO: QCOP start message received: %s ", cmsg.data() );
mCStringMess = cmsg;
mByteData = data;
}
void KABCore::loadDataAfterStart()
{
//qDebug("KABCore::loadDataAfterStart() ");
((StdAddressBook*)mAddressBook)->init( true );
mViewManager->refreshView();
#ifndef DESKTOP_VERSION
- disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & )));
+ disconnect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT (receiveStart ( const Q3CString &, const QByteArray & )));
- QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
+ QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & )));
if ( !mCStringMess.isEmpty() )
ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData );
#endif
// QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
setCaptionBack();
}
void KABCore::updateToolBar()
{
static int iii = 0;
++iii;
mMainWindow->toolBar()->repaintMe();
if ( iii < 4 )
QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
}
KABCore::~KABCore()
{
// save();
//saveSettings();
//KABPrefs::instance()->writeConfig();
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
delete syncManager;
#ifndef DESKTOP_VERSION
if ( infrared )
delete infrared;
#endif
}
-void KABCore::receive( const QCString& cmsg, const QByteArray& data )
+void KABCore::receive( const Q3CString& cmsg, const QByteArray& data )
{
//qDebug("KA: QCOP message received: %s ", cmsg.data() );
if ( cmsg == "setDocument(QString)" ) {
- QDataStream stream( data, IO_ReadOnly );
+ QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
QString fileName;
stream >> fileName;
recieve( fileName );
return;
}
}
void KABCore::toggleBeamReceive( )
{
if ( mBRdisabled )
return;
#ifndef DESKTOP_VERSION
if ( infrared ) {
qDebug("KA: AB disable BeamReceive ");
delete infrared;
infrared = 0;
mActionBR->setChecked(false);
return;
}
qDebug("KA: AB enable BeamReceive ");
mActionBR->setChecked(true);
infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
- QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
+ QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(receive( const Q3CString&, const QByteArray& )));
#endif
}
void KABCore::disableBR(bool b)
{
#ifndef DESKTOP_VERSION
if ( b ) {
if ( infrared ) {
toggleBeamReceive( );
}
mBRdisabled = true;
} else {
if ( mBRdisabled ) {
mBRdisabled = false;
//toggleBeamReceive( );
}
}
#endif
}
void KABCore::recieve( QString fn )
{
//qDebug("KABCore::recieve ");
int count = mAddressBook->importFromFile( fn, true );
if ( count )
setModified( true );
mViewManager->refreshView();
message(i18n("%1 contact(s) received!").arg( count ));
topLevelWidget()->showMaximized();
topLevelWidget()->raise();
}
@@ -531,65 +541,65 @@ void KABCore::restoreSettings()
mActionJumpBar->setChecked( state );
setJumpButtonBarVisible( state );
/*US
QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
if ( splitterSize.count() == 0 ) {
splitterSize.append( width() / 2 );
splitterSize.append( width() / 2 );
}
mMiniSplitter->setSizes( splitterSize );
if ( mExtensionBarSplitter ) {
splitterSize = KABPrefs::instance()->mExtensionsSplitter;
if ( splitterSize.count() == 0 ) {
splitterSize.append( width() / 2 );
splitterSize.append( width() / 2 );
}
mExtensionBarSplitter->setSizes( splitterSize );
}
*/
mViewManager->restoreSettings();
mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
mExtensionManager->restoreSettings();
#ifdef DESKTOP_VERSION
int wid = width();
if ( wid < 10 )
wid = 400;
#else
int wid = QApplication::desktop()->width();
if ( wid < 640 )
wid = QApplication::desktop()->height();
#endif
- QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
+ Q3ValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
if ( true /*splitterSize.count() == 0*/ ) {
splitterSize.append( wid / 2 );
splitterSize.append( wid / 2 );
}
mMiniSplitter->setSizes( splitterSize );
if ( mExtensionBarSplitter ) {
//splitterSize = KABPrefs::instance()->mExtensionsSplitter;
if ( true /*splitterSize.count() == 0*/ ) {
splitterSize.append( wid / 2 );
splitterSize.append( wid / 2 );
}
mExtensionBarSplitter->setSizes( splitterSize );
}
#ifdef DESKTOP_VERSION
KConfig *config = KABPrefs::instance()->getConfig();
config->setGroup("WidgetLayout");
QStringList list;
list = config->readListEntry("MainLayout");
int x,y,w,h;
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
topLevelWidget()->setGeometry(x,y,w,h);
} else {
topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
}
#endif
@@ -621,68 +631,68 @@ KABC::AddressBook *KABCore::addressBook() const
return mAddressBook;
}
KConfig *KABCore::config()
{
#ifndef KAB_EMBEDDED
return KABPrefs::instance()->config();
#else //KAB_EMBEDDED
return KABPrefs::instance()->getConfig();
#endif //KAB_EMBEDDED
}
KActionCollection *KABCore::actionCollection() const
{
return mGUIClient->actionCollection();
}
KABC::Field *KABCore::currentSearchField() const
{
if (mIncSearchWidget)
return mIncSearchWidget->currentField();
else
return 0;
}
QStringList KABCore::selectedUIDs() const
{
return mViewManager->selectedUids();
}
KABC::Resource *KABCore::requestResource( QWidget *parent )
{
- QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
+ Q3PtrList<KABC::Resource> kabcResources = addressBook()->resources();
- QPtrList<KRES::Resource> kresResources;
- QPtrListIterator<KABC::Resource> resIt( kabcResources );
+ Q3PtrList<KRES::Resource> kresResources;
+ Q3PtrListIterator<KABC::Resource> resIt( kabcResources );
KABC::Resource *resource;
while ( ( resource = resIt.current() ) != 0 ) {
++resIt;
if ( !resource->readOnly() ) {
KRES::Resource *res = static_cast<KRES::Resource*>( resource );
if ( res )
kresResources.append( res );
}
}
KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
return static_cast<KABC::Resource*>( res );
}
#ifndef KAB_EMBEDDED
KAboutData *KABCore::createAboutData()
#else //KAB_EMBEDDED
void KABCore::createAboutData()
#endif //KAB_EMBEDDED
{
QString version;
#include <../version>
QMessageBox::about( this, "About KAddressbook/Pi",
"KAddressbook/Platform-independent\n"
"(KA/Pi) " +version + " - " +
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
"PDA-Edition\n"
"for: Zaurus 5500 / 7x0 / 8x0\n"
@@ -766,72 +776,72 @@ void KABCore::sendMail( const QString& emaillist )
void KABCore::mailVCard()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
mailVCard( uids );
}
void KABCore::mailVCard( const QStringList& uids )
{
QStringList urls;
// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
QString dirName = "/tmp/" + KApplication::randomString( 8 );
QDir().mkdir( dirName, true );
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
QString name = a.givenName() + "_" + a.familyName() + ".vcf";
QString fileName = dirName + "/" + name;
QFile outFile(fileName);
- if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
+ if ( outFile.open(QIODevice::WriteOnly) ) { // file opened successfully
KABC::VCardConverter converter;
QString vcard;
converter.addresseeToVCard( a, vcard );
- QTextStream t( &outFile ); // use a text stream
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( &outFile ); // use a text stream
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
t << vcard;
outFile.close();
urls.append( fileName );
}
}
bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
/*US
kapp->invokeMailer( QString::null, QString::null, QString::null,
QString::null, // subject
QString::null, // body
QString::null,
urls ); // attachments
*/
}
/**
Beams the "WhoAmI contact.
*/
void KABCore::beamMySelf()
{
KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
if (!a.isEmpty())
{
QStringList uids;
uids << a.uid();
@@ -987,69 +997,69 @@ void KABCore::beamVCard(const QStringList& uids)
KABC::VCardConverter converter;
QString description;
QString datastream;
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
if (description.isEmpty())
description = a.formattedName();
QString vcard;
converter.addresseeToVCard( a, vcard );
int start = 0;
int next;
while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
int semi = vcard.find(";", next);
int dopp = vcard.find(":", next);
int sep;
if ( semi < dopp && semi >= 0 )
sep = semi ;
else
sep = dopp;
datastream +=vcard.mid( start, next - start);
datastream +=vcard.mid( next+5,sep -next -5 ).upper();
start = sep;
}
datastream += vcard.mid( start,vcard.length() );
}
#ifndef DESKTOP_VERSION
QFile outFile(fileName);
- if ( outFile.open(IO_WriteOnly) ) {
+ if ( outFile.open(QIODevice::WriteOnly) ) {
datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
- QTextStream t( &outFile ); // use a text stream
+ Q3TextStream t( &outFile ); // use a text stream
//t.setEncoding( QTextStream::UnicodeUTF8 );
- t.setEncoding( QTextStream::Latin1 );
+ t.setEncoding( Q3TextStream::Latin1 );
t <<datastream.latin1();
outFile.close();
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
ir->send( fileName, description, "text/x-vCard" );
} else {
qDebug("KA: Error open temp beam file ");
return;
}
#endif
}
void KABCore::beamDone( Ir *ir )
{
#ifndef DESKTOP_VERSION
delete ir;
#endif
topLevelWidget()->raise();
message( i18n("Beaming finished!") );
}
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
@@ -1268,68 +1278,68 @@ void KABCore::contactModified( const KABC::Addressee &addr )
#if 0 // debug only
KABC::Addressee ad = addr;
ad.computeCsum( "123");
#endif
}
void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
{
Command *command = 0;
QString uid;
// check if it exists already
KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
if ( origAddr.isEmpty() )
command = new PwNewCommand( mAddressBook, addr );
else {
command = new PwEditCommand( mAddressBook, origAddr, addr );
uid = addr.uid();
}
UndoStack::instance()->push( command );
RedoStack::instance()->clear();
if ( updateDetails )
mDetails->setAddressee( addr );
setModified( true );
}
void KABCore::newContact()
{
- QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
+ Q3PtrList<KABC::Resource> kabcResources = mAddressBook->resources();
- QPtrList<KRES::Resource> kresResources;
- QPtrListIterator<KABC::Resource> it( kabcResources );
+ Q3PtrList<KRES::Resource> kresResources;
+ Q3PtrListIterator<KABC::Resource> it( kabcResources );
KABC::Resource *resource;
while ( ( resource = it.current() ) != 0 ) {
++it;
if ( !resource->readOnly() ) {
KRES::Resource *res = static_cast<KRES::Resource*>( resource );
if ( res )
kresResources.append( res );
}
}
KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
resource = static_cast<KABC::Resource*>( res );
if ( resource ) {
KABC::Addressee addr;
addr.setResource( resource );
mEditorDialog->setAddressee( addr );
mEditorDialog->setCaption( i18n("Edit new contact"));
KApplication::execDialog ( mEditorDialog );
} else
return;
// mEditorDict.insert( dialog->addressee().uid(), dialog );
}
void KABCore::addEmail( QString aStr )
{
#ifndef KAB_EMBEDDED
QString fullName, email;
@@ -1827,138 +1837,138 @@ void KABCore::addressBookChanged()
}
mViewManager->refreshView();
}
AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
const char *name )
{
if ( mEditorDialog == 0 ) {
mEditorDialog = new AddresseeEditorDialog( this, parent,
name ? name : "editorDialog" );
connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
SLOT( contactModified( const KABC::Addressee& ) ) );
//connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
// SLOT( slotEditorDestroyed( const QString& ) ) ;
}
return mEditorDialog;
}
void KABCore::slotEditorDestroyed( const QString &uid )
{
//mEditorDict.remove( uid );
}
void KABCore::initGUI()
{
#ifndef KAB_EMBEDDED
- QHBoxLayout *topLayout = new QHBoxLayout( this );
+ Q3HBoxLayout *topLayout = new Q3HBoxLayout( this );
topLayout->setSpacing( KDialogBase::spacingHint() );
mExtensionBarSplitter = new QSplitter( this );
mExtensionBarSplitter->setOrientation( Qt::Vertical );
mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
- QVBox *viewSpace = new QVBox( mDetailsSplitter );
+ Q3VBox *viewSpace = new Q3VBox( mDetailsSplitter );
mIncSearchWidget = new IncSearchWidget( viewSpace );
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
mViewManager = new ViewManager( this, viewSpace );
viewSpace->setStretchFactor( mViewManager, 1 );
mDetails = new ViewContainer( mDetailsSplitter );
mJumpButtonBar = new JumpButtonBar( this, this );
mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
topLayout->addWidget( mExtensionBarSplitter );
topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
topLayout->addWidget( mJumpButtonBar );
//topLayout->setStretchFactor( mJumpButtonBar, 1 );
mXXPortManager = new XXPortManager( this, this );
#else //KAB_EMBEDDED
//US initialize viewMenu before settingup viewmanager.
// Viewmanager needs this menu to plugin submenues.
- viewMenu = new QPopupMenu( this );
- settingsMenu = new QPopupMenu( this );
+ viewMenu = new Q3PopupMenu( this );
+ settingsMenu = new Q3PopupMenu( this );
//filterMenu = new QPopupMenu( this );
- ImportMenu = new QPopupMenu( this );
- ExportMenu = new QPopupMenu( this );
- syncMenu = new QPopupMenu( this );
- changeMenu= new QPopupMenu( this );
- beamMenu= new QPopupMenu( this );
+ ImportMenu = new Q3PopupMenu( this );
+ ExportMenu = new Q3PopupMenu( this );
+ syncMenu = new Q3PopupMenu( this );
+ changeMenu= new Q3PopupMenu( this );
+ beamMenu= new Q3PopupMenu( this );
//US since we have no splitter for the embedded system, setup
// a layout with two frames. One left and one right.
- QBoxLayout *topLayout;
+ Q3BoxLayout *topLayout;
// = new QHBoxLayout( this );
// QBoxLayout *topLayout = (QBoxLayout*)layout();
// QWidget *mainBox = new QWidget( this );
// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
#ifdef DESKTOP_VERSION
- topLayout = new QHBoxLayout( this );
+ topLayout = new Q3HBoxLayout( this );
mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
topLayout->addWidget(mMiniSplitter );
mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
mViewManager = new ViewManager( this, mExtensionBarSplitter );
mDetails = new ViewContainer( mMiniSplitter );
mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
#else
if ( QApplication::desktop()->width() > 480 ) {
- topLayout = new QHBoxLayout( this );
+ topLayout = new Q3HBoxLayout( this );
mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
} else {
- topLayout = new QHBoxLayout( this );
+ topLayout = new Q3HBoxLayout( this );
mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
}
topLayout->addWidget(mMiniSplitter );
mViewManager = new ViewManager( this, mMiniSplitter );
mDetails = new ViewContainer( mMiniSplitter );
mExtensionManager = new ExtensionManager( this, mMiniSplitter );
#endif
//eh->hide();
// topLayout->addWidget(mExtensionManager );
/*US
#ifndef KAB_NOSPLITTER
QHBoxLayout *topLayout = new QHBoxLayout( this );
//US topLayout->setSpacing( KDialogBase::spacingHint() );
topLayout->setSpacing( 10 );
mDetailsSplitter = new QSplitter( this );
QVBox *viewSpace = new QVBox( mDetailsSplitter );
mViewManager = new ViewManager( this, viewSpace );
viewSpace->setStretchFactor( mViewManager, 1 );
mDetails = new ViewContainer( mDetailsSplitter );
topLayout->addWidget( mDetailsSplitter );
topLayout->setStretchFactor( mDetailsSplitter, 100 );
@@ -2005,142 +2015,142 @@ void KABCore::initGUI()
// mActionQuit->plug ( mMainWindow->toolBar());
//mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
//mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
// mIncSearchWidget->hide();
connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
SLOT( incrementalSearch( const QString& ) ) );
connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
mJumpButtonBar = new JumpButtonBar( this, this );
topLayout->addWidget( mJumpButtonBar );
//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
// mMainWindow->getIconToolBar()->raise();
#endif //KAB_EMBEDDED
}
void KABCore::initActions()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifndef KAB_EMBEDDED
connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
SLOT( clipboardDataChanged() ) );
#endif //KAB_EMBEDDED
// file menu
mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
//mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
- mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
+ mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", Qt::CTRL + Qt::Key_P, mViewManager,
SLOT( printView() ), actionCollection(), "kaddressbook_print" );
mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
- mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
+ mActionSave = new KAction( i18n( "&Save" ), "filesave", Qt::CTRL+Qt::Key_S, this,
SLOT( save() ), actionCollection(), "file_sync" );
- mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
+ mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", Qt::CTRL+Qt::Key_N, this,
SLOT( newContact() ), actionCollection(), "file_new_contact" );
mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
this, SLOT( mailVCard() ),
actionCollection(), "file_mail_vcard");
mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
SLOT( export2phone() ), actionCollection(),
"kaddressbook_ex2phone" );
mActionBeamVCard = 0;
mActionBeam = 0;
#ifndef DESKTOP_VERSION
if ( Ir::supported() ) {
mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
SLOT( beamVCard() ), actionCollection(),
"kaddressbook_beam_vcard" );
mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
SLOT( beamMySelf() ), actionCollection(),
"kaddressbook_beam_myself" );
}
#endif
mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
this, SLOT( editContact2() ),
actionCollection(), "file_properties" );
#ifdef KAB_EMBEDDED
// mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
mMainWindow, SLOT( exit() ),
actionCollection(), "quit" );
#endif //KAB_EMBEDDED
// edit menu
if ( mIsPart ) {
- mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
+ mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", Qt::CTRL + Qt::Key_C, this,
SLOT( copyContacts() ), actionCollection(),
"kaddressbook_copy" );
- mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
+ mActionCut = new KAction( i18n( "Cu&t" ), "editcut", Qt::CTRL + Qt::Key_X, this,
SLOT( cutContacts() ), actionCollection(),
"kaddressbook_cut" );
- mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
+ mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", Qt::CTRL + Qt::Key_V, this,
SLOT( pasteContacts() ), actionCollection(),
"kaddressbook_paste" );
- mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
+ mActionSelectAll = new KAction( i18n( "Select &All" ), Qt::CTRL + Qt::Key_A, this,
SLOT( selectAllContacts() ), actionCollection(),
"kaddressbook_select_all" );
- mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
+ mActionUndo = new KAction( i18n( "&Undo" ), "undo", Qt::CTRL + Qt::Key_Z, this,
SLOT( undo() ), actionCollection(),
"kaddressbook_undo" );
- mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
+ mActionRedo = new KAction( i18n( "Re&do" ), "redo", Qt::CTRL + Qt::SHIFT + Qt::Key_Z,
this, SLOT( redo() ), actionCollection(),
"kaddressbook_redo" );
} else {
mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
}
mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
- Key_Delete, this, SLOT( deleteContacts() ),
+ Qt::Key_Delete, this, SLOT( deleteContacts() ),
actionCollection(), "edit_delete" );
mActionUndo->setEnabled( false );
mActionRedo->setEnabled( false );
// settings menu
#ifdef KAB_EMBEDDED
//US special menuentry to configure the addressbook resources. On KDE
// you do that through the control center !!!
mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
SLOT( configureResources() ), actionCollection(),
"kaddressbook_configure_resources" );
#endif //KAB_EMBEDDED
if ( mIsPart ) {
mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
SLOT( openConfigDialog() ), actionCollection(),
"kaddressbook_configure" );
//US not implemented yet
//mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
// this, SLOT( configureKeyBindings() ), actionCollection(),
// "kaddressbook_configure_shortcuts" );
#ifdef KAB_EMBEDDED
mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
mActionConfigureToolbars->setEnabled( false );
#endif //KAB_EMBEDDED
} else {
mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this,
SLOT( openConfigDialog() ), actionCollection(),
"kaddressbook_configure" );
@@ -2217,95 +2227,95 @@ void KABCore::initActions()
mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0,
this, SLOT( storagehowto() ), actionCollection(),
"storage" );
mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
this, SLOT( synchowto() ), actionCollection(),
"sync" );
mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
this, SLOT( kdesynchowto() ), actionCollection(),
"kdesync" );
mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
this, SLOT( multisynchowto() ), actionCollection(),
"multisync" );
mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
this, SLOT( createAboutData() ), actionCollection(),
"kaddressbook_about_data" );
#endif //KAB_EMBEDDED
clipboardDataChanged();
connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
}
//US we need this function, to plug all actions into the correct menues.
// KDE uses a XML format to plug the actions, but we work her without this overhead.
void KABCore::addActionsManually()
{
//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
#ifdef KAB_EMBEDDED
- QPopupMenu *fileMenu = new QPopupMenu( this );
- QPopupMenu *editMenu = new QPopupMenu( this );
- QPopupMenu *helpMenu = new QPopupMenu( this );
+ Q3PopupMenu *fileMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *editMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *helpMenu = new Q3PopupMenu( this );
KToolBar* tb = mMainWindow->toolBar();
mMainWindow->setToolBarsMovable (false );
#ifndef DESKTOP_VERSION
if ( KABPrefs::instance()->mFullMenuBarVisible ) {
#endif
QMenuBar* mb = mMainWindow->menuBar();
//US setup menubar.
//Disable the following block if you do not want to have a menubar.
mb->insertItem( i18n("&File"), fileMenu );
mb->insertItem( i18n("&Edit"), editMenu );
mb->insertItem( i18n("&View"), viewMenu );
mb->insertItem( i18n("&Settings"), settingsMenu );
#ifdef DESKTOP_VERSION
mb->insertItem( i18n("Synchronize"), syncMenu );
#else
mb->insertItem( i18n("Sync"), syncMenu );
#endif
//mb->insertItem( i18n("&Change"), changeMenu );
mb->insertItem( i18n("&Help"), helpMenu );
mIncSearchWidget = new IncSearchWidget( tb );
// tb->insertWidget(-1, 0, mIncSearchWidget);
#ifndef DESKTOP_VERSION
} else {
//US setup toolbar
QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
- QPopupMenu *popupBarTB = new QPopupMenu( this );
+ Q3PopupMenu *popupBarTB = new Q3PopupMenu( this );
menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
tb->insertWidget(-1, 0, menuBarTB);
mIncSearchWidget = new IncSearchWidget( tb );
tb->enableMoving(false);
popupBarTB->insertItem( i18n("&File"), fileMenu );
popupBarTB->insertItem( i18n("&Edit"), editMenu );
popupBarTB->insertItem( i18n("&View"), viewMenu );
popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
mViewManager->getFilterAction()->plug ( popupBarTB);
//popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
popupBarTB->insertItem( i18n("&Help"), helpMenu );
if (QApplication::desktop()->width() > 320 ) {
// mViewManager->getFilterAction()->plug ( tb);
}
}
#endif
mIncSearchWidget->setSize();
// mActionQuit->plug ( mMainWindow->toolBar());
//US Now connect the actions with the menue entries.
#ifdef DESKTOP_VERSION
mActionPrint->plug( fileMenu );
mActionPrintDetails->plug( fileMenu );
fileMenu->insertSeparator();
#endif
mActionMail->plug( fileMenu );
fileMenu->insertSeparator();
mActionNewContact->plug( editMenu );
@@ -2602,65 +2612,65 @@ void KABCore::clipboardDataChanged()
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
RedoStack *redo = RedoStack::instance();
if ( undo->isEmpty() )
mActionUndo->setText( i18n( "Undo" ) );
else
mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
mActionUndo->setEnabled( !undo->isEmpty() );
if ( !redo->top() )
mActionRedo->setText( i18n( "Redo" ) );
else
mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
mActionRedo->setEnabled( !redo->isEmpty() );
}
void KABCore::configureKeyBindings()
{
#ifndef KAB_EMBEDDED
KKeyDialog::configure( actionCollection(), true );
#else //KAB_EMBEDDED
qDebug("KABCore::configureKeyBindings() not implemented");
#endif //KAB_EMBEDDED
}
#ifdef KAB_EMBEDDED
void KABCore::configureResources()
{
- KRES::KCMKResources dlg( this, "" , 0 );
+ KRES::KCMKResources dlg( this, "" , QStringList() );
if ( !dlg.exec() )
return;
KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
}
#endif //KAB_EMBEDDED
/* this method will be called through the QCop interface from Ko/Pi to select addresses
* for the attendees list of an event.
*/
void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
{
qDebug("KABCore::requestForNameEmailUidList ");
bool ok = false;
mEmailSourceChannel = sourceChannel;
mEmailSourceUID = uid;
QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
//callContactdialog();
#if 0
int wid = uid.toInt( &ok );
qDebug("UID %s ", uid.latin1());
if ( ok ) {
if ( wid != QApplication::desktop()->width() ) {
qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
message( i18n("Resizing, please wait...") );
mMainWindow->showMinimized();
/*
{
QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
}
*/
@@ -2698,65 +2708,65 @@ void KABCore::callContactdialog()
KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
uint i=0;
for (i=0; i < list.count(); i++)
{
nameList.append(list[i].realName());
emailList.append(list[i].preferredEmail());
uidList.append(list[i].uid());
}
QString uid = mEmailSourceUID;
//qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
running = false;
}
/* this method will be called through the QCop interface from Ko/Pi to select birthdays
* to put them into the calendar.
*/
void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
{
// qDebug("KABCore::requestForBirthdayList");
QStringList birthdayList;
QStringList anniversaryList;
QStringList realNameList;
QStringList preferredEmailList;
QStringList assembledNameList;
QStringList uidList;
KABC::AddressBook::Iterator it;
int count = 0;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
++count;
}
- QProgressBar bar(count,0 );
+ Q3ProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
bar.setCaption (i18n("Collecting birthdays - close to abort!") );
qApp->processEvents();
QDate bday;
QString anni;
QString formattedbday;
for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
{
if ( ! bar.isVisible() )
return;
bar.setProgress( count++ );
qApp->processEvents();
bday = (*it).birthday().date();
anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
if ( bday.isValid() || !anni.isEmpty())
{
if (bday.isValid())
formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
else
formattedbday = "NOTVALID";
if (anni.isEmpty())
anni = "INVALID";
@@ -2879,65 +2889,65 @@ void KABCore::synchowto()
KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
}
void KABCore::kdesynchowto()
{
KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
}
void KABCore::multisynchowto()
{
KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
}
void KABCore::faq()
{
KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
}
#include <libkcal/syncdefines.h>
KABC::Addressee KABCore::getLastSyncAddressee()
{
Addressee lse;
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
if (lse.isEmpty()) {
qDebug("KA: Creating new last-syncAddressee ");
lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
QString sum = "";
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
sum = "E: ";
lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
lse.setRevision( mLastAddressbookSync );
- lse.setCategories( i18n("SyncEvent") );
+ lse.setCategories( QStringList(i18n("SyncEvent")) );
mAddressBook->insertAddressee( lse );
}
return lse;
}
int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
{
//void setZaurusId(int id);
// int zaurusId() const;
// void setZaurusUid(int id);
// int zaurusUid() const;
// void setZaurusStat(int id);
// int zaurusStat() const;
// 0 equal
// 1 take local
// 2 take remote
// 3 cancel
QDateTime lastSync = mLastAddressbookSync;
QDateTime localMod = local->revision();
QDateTime remoteMod = remote->revision();
QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
bool remCh, locCh;
remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
//if ( remCh )
// qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
locCh = ( localMod > mLastAddressbookSync );
//qDebug("cahnged rem %d loc %d",remCh, locCh );
if ( !remCh && ! locCh ) {
//qDebug("both not changed ");
@@ -3070,65 +3080,65 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
//KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
bool fullDateRange = false;
local->resetTempSyncStat();
mLastAddressbookSync = QDateTime::currentDateTime();
if ( syncManager->syncWithDesktop() ) {
// remote->removeSyncInfo( QString());//remove all info
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
} else {
qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime ");
}
}
QDateTime modifiedCalendar = mLastAddressbookSync;
addresseeLSync = getLastSyncAddressee();
qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1());
addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
if ( !addresseeR.isEmpty() ) {
addresseeRSync = addresseeR;
remote->removeAddressee(addresseeR );
} else {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
addresseeRSync = addresseeLSync ;
} else {
//qDebug("FULLDATE 1");
fullDateRange = true;
Addressee newAdd;
addresseeRSync = newAdd;
addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
addresseeRSync.setRevision( mLastAddressbookSync );
- addresseeRSync.setCategories( i18n("SyncAddressee") );
+ addresseeRSync.setCategories( QStringList(i18n("SyncAddressee")) );
}
}
if ( addresseeLSync.revision() == mLastAddressbookSync ) {
// qDebug("FULLDATE 2");
fullDateRange = true;
}
if ( ! fullDateRange ) {
if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
// qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
//qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
fullDateRange = true;
//qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
}
}
// fullDateRange = true; // debug only!
if ( fullDateRange )
mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
else
mLastAddressbookSync = addresseeLSync.revision();
// for resyncing if own file has changed
// PENDING fixme later when implemented
#if 0
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastAddressbookSync = loadedFileVersion;
qDebug("setting mLastAddressbookSync ");
}
#endif
// ********** setting filters ****************
Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ec6a9ec..4351720 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,171 +1,175 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KABCORE_H
#define KABCORE_H
#include <kabc/field.h>
#ifndef KAB_EMBEDDED
#endif //KAB_EMBEDDED
-#include <qdict.h>
+#include <q3dict.h>
#include <qtimer.h>
#include <qwidget.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <QPixmap>
+#include <QResizeEvent>
#include <ksyncmanager.h>
#ifndef DESKTOP_VERSION
#include <qcopchannel_qws.h>
#endif
namespace KABC {
class AddressBook;
}
#ifndef KAB_EMBEDDED
class KAboutData;
class KConfig;
class KAddressBookService;
class LDAPSearchDialog;
#else //KAB_EMBEDDED
class KAddressBookMain;
//US class QAction;
#endif //KAB_EMBEDDED
class KCMultiDialog;
class KXMLGUIClient;
class ExtensionManager;
class XXPortManager;
class JumpButtonBar;
class IncSearchWidget;
class KDGanttMinimizeSplitter;
class KAction;
class KActionCollection;
class KToggleAction;
class KSyncProfile;
class QAction;
class QMenuBar;
class QSplitter;
class ViewContainer;
class ViewManager;
class AddresseeEditorDialog;
class Ir;
class KABCore : public QWidget, public KSyncInterface
{
Q_OBJECT
public:
KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
~KABCore();
#ifdef KAB_EMBEDDED
//US added functionality
- QPopupMenu* getViewMenu() {return viewMenu;}
- QPopupMenu* getFilterMenu() {return filterMenu;}
- QPopupMenu* getSettingsMenu() {return settingsMenu;}
+ Q3PopupMenu* getViewMenu() {return viewMenu;}
+ Q3PopupMenu* getFilterMenu() {return filterMenu;}
+ Q3PopupMenu* getSettingsMenu() {return settingsMenu;}
void addActionsManually();
#endif //KAB_EMBEDDED
/**
Restores the global settings.
*/
void restoreSettings();
/**
Returns a pointer to the StdAddressBook of the application.
*/
KABC::AddressBook *addressBook() const;
/**
Returns a pointer to the KConfig object of the application.
*/
static KConfig *config();
/**
Returns a pointer to the global KActionCollection object. So
other classes can register their actions easily.
*/
KActionCollection *actionCollection() const;
/**
Returns the current search field of the Incremental Search Widget.
*/
KABC::Field *currentSearchField() const;
/**
Returns the uid list of the currently selected contacts.
*/
QStringList selectedUIDs() const;
/**
Displays the ResourceSelectDialog and returns the selected
resource or a null pointer if no resource was selected by
the user.
*/
KABC::Resource *requestResource( QWidget *parent );
#ifndef KAB_EMBEDDED
static KAboutData *createAboutData();
#endif //KAB_EMBEDDED
#ifdef KAB_EMBEDDED
- inline QPopupMenu* getImportMenu() { return ImportMenu;}
- inline QPopupMenu* getExportMenu() { return ExportMenu;}
+ inline Q3PopupMenu* getImportMenu() { return ImportMenu;}
+ inline Q3PopupMenu* getExportMenu() { return ExportMenu;}
#endif //KAB_EMBEDDED
public slots:
#ifdef KAB_EMBEDDED
void createAboutData();
#endif //KAB_EMBEDDED
void setDetailsToggle();
void showLicence();
void faq();
void whatsnew() ;
void synchowto() ;
void storagehowto() ;
void multisynchowto() ;
void kdesynchowto() ;
void writeToPhone();
/**
Is called whenever a contact is selected in the view.
*/
void setContactSelected( const QString &uid );
/**
Opens the preferred mail composer with all selected contacts as
arguments.
*/
void sendMail();
/**
Opens the preferred mail composer with the given contacts as
arguments.
*/
@@ -337,93 +341,93 @@ class KABCore : public QWidget, public KSyncInterface
/**
Creates a KAddressBookPrinter, which will display the print
dialog and do the printing.
*/
void print();
/**
Registers a new GUI client, so plugins can register its actions.
*/
void addGUIClient( KXMLGUIClient *client );
void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
signals:
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
void loadDataAfterStart();
void recieve(QString cmsg );
void getFile( bool success,const QString & );
void syncFileRequest(const QString &);
void setDetailsVisible( bool visible );
void setDetailsToState();
void saveSettings();
private slots:
void updateToolBar();
void updateMainWindow();
- void receive( const QCString& cmsg, const QByteArray& data );
- void receiveStart( const QCString& cmsg, const QByteArray& data );
+ void receive( const Q3CString& cmsg, const QByteArray& data );
+ void receiveStart( const Q3CString& cmsg, const QByteArray& data );
void toggleBeamReceive( );
void disableBR(bool);
void setJumpButtonBarVisible( bool visible );
void setJumpButtonBar( bool visible );
void setCaptionBack();
void resizeAndCallContactdialog();
void callContactdialog();
void doRingSync();
void importFromOL();
void extensionModified( const KABC::Addressee::List &list );
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
void setFormattedName();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
- QCString mCStringMess;
+ Q3CString mCStringMess;
QByteArray mByteData;
QString mEmailSourceChannel;
QString mEmailSourceUID;
void resizeEvent(QResizeEvent* e );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
QTimer *mMessageTimer;
void initGUI();
void initActions();
QString getPhoneFile();
AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
const char *name = 0 );
KXMLGUIClient *mGUIClient;
KABC::AddressBook *mAddressBook;
ViewManager *mViewManager;
// QSplitter *mDetailsSplitter;
KDGanttMinimizeSplitter *mExtensionBarSplitter;
ViewContainer *mDetails;
KDGanttMinimizeSplitter* mMiniSplitter;
XXPortManager *mXXPortManager;
JumpButtonBar *mJumpButtonBar;
IncSearchWidget *mIncSearchWidget;
ExtensionManager *mExtensionManager;
KCMultiDialog *mConfigureDialog;
@@ -457,84 +461,84 @@ class KABCore : public QWidget, public KSyncInterface
KAction *mActionCopy;
KAction *mActionCut;
KAction *mActionPaste;
KAction *mActionSelectAll;
KAction *mActionUndo;
KAction *mActionRedo;
KAction *mActionDelete;
//US settings menu
KAction *mActionConfigResources;
KAction *mActionConfigGlobal;
KAction *mActionConfigKAddressbook;
KAction *mActionConfigShortcuts;
KAction *mActionConfigureToolbars;
KAction *mActionKeyBindings;
KToggleAction *mActionJumpBar;
KToggleAction *mActionDetails;
KAction *mActionWhoAmI;
KAction *mActionCategories;
KAction *mActionEditCategories;
KAction *mActionManageCategories;
KAction *mActionAboutKAddressbook;
KAction *mActionLicence;
KAction *mActionFaq;
KAction *mActionWN;
KAction *mActionSyncHowto;
KAction *mActionStorageHowto;
KAction *mActionKdeSyncHowto;
KAction *mActionMultiSyncHowto;
KAction *mActionDeleteView;
- QPopupMenu *viewMenu;
- QPopupMenu *filterMenu;
- QPopupMenu *settingsMenu;
- QPopupMenu *changeMenu;
- QPopupMenu *beamMenu;
+ Q3PopupMenu *viewMenu;
+ Q3PopupMenu *filterMenu;
+ Q3PopupMenu *settingsMenu;
+ Q3PopupMenu *changeMenu;
+ Q3PopupMenu *beamMenu;
//US QAction *mActionSave;
- QPopupMenu *ImportMenu;
- QPopupMenu *ExportMenu;
+ Q3PopupMenu *ImportMenu;
+ Q3PopupMenu *ExportMenu;
//LR additional methods
KAction *mActionRemoveVoice;
KAction *mActionSetFormattedName;
KAction * mActionImportOL;
#ifndef KAB_EMBEDDED
KAddressBookService *mAddressBookService;
#endif //KAB_EMBEDDED
class KABCorePrivate;
KABCorePrivate *d;
//US bool mBlockSaveFlag;
#ifdef KAB_EMBEDDED
KAddressBookMain *mMainWindow; // should be the same like mGUIClient
#endif //KAB_EMBEDDED
//this are the overwritten callbackmethods from the syncinterface
virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource);
virtual bool syncExternal(KSyncManager* manager, QString resource);
virtual void removeSyncInfo( QString syncProfile);
bool readOLdata( KABC::AddressBook* local );
bool writeOLdata( KABC::AddressBook* local );
bool syncOL();
bool syncPhone();
void message( QString m , bool startTimer = true);
// LR *******************************
// sync stuff!
QString sentSyncFile();
- QPopupMenu *syncMenu;
+ Q3PopupMenu *syncMenu;
KSyncManager* syncManager;
int mGlobalSyncMode;
bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
KABC::Addressee getLastSyncAddressee();
QDateTime mLastAddressbookSync;
int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
// *********************
//OL sync stuff
QString mOLsyncFolderID;
};
#endif
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index 42d541b..6f9c995 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,60 +1,60 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
//US#ifdef KAB_EMBEDDED
//#include <qstring.h>
//#endif //KAB_EMBEDDED
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
#include <qregexp.h>
#include <stdlib.h>
#include <libkdepim/kpimglobalprefs.h>
#include <kconfig.h>
#include <klocale.h>
#include <kstaticdeleter.h>
#include <kglobalsettings.h>
//US#include <kdebug.h> // defines kdDebug()
#include "kabprefs.h"
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#endif
KABPrefs *KABPrefs::sInstance = 0;
static KStaticDeleter<KABPrefs> staticDeleterAB;
KABPrefs::KABPrefs()
: KPimPrefs("kaddressbookrc")
{
KPrefs::setCurrentGroup( "Views" );
addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
KPrefs::setCurrentGroup( "General" );
addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
#ifdef KAB_EMBEDDED
addItemBool("AskForDelete",&mAskForDelete,true);
addItemBool("AskForQuit",&mAskForQuit,true);
@@ -62,65 +62,65 @@ KABPrefs::KABPrefs()
addItemBool("ToolBarUp",&mToolBarUp, false );
addItemBool("SearchWithReturn",&mSearchWithReturn, false );
addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false );
addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false );
addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont());
#endif //KAB_EMBEDDED
KPrefs::setCurrentGroup( "MainWindow" );
bool m_visible = false;
#ifdef DESKTOP_VERSION
m_visible = true;
#endif
addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible );
addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
addItemIntList( "DetailsSplitter", &mDetailsSplitter );
addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
KPrefs::setCurrentGroup( "Extensions_General" );
QStringList defaultExtensions;
defaultExtensions << "merge";
defaultExtensions << "distribution_list_editor";
addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
KPrefs::setCurrentGroup( "Views" );
QString defaultView = i18n( "Default Table View" );
addItemString( "CurrentView", &mCurrentView, defaultView );
- addItemStringList( "ViewNames", &mViewNames, defaultView );
+ addItemStringList( "ViewNames", &mViewNames, QStringList(defaultView) );
KPrefs::setCurrentGroup( "Filters" );
addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
}
KABPrefs::~KABPrefs()
{
//qDebug("KABPrefs::~KABPrefs() ");
if (sInstance == this)
sInstance = staticDeleterAB.setObject(0);
}
KABPrefs *KABPrefs::instance()
{
if ( !sInstance ) {
#ifdef KAB_EMBEDDED
sInstance = staticDeleterAB.setObject( new KABPrefs() );
#else //KAB_EMBEDDED
//US the following line has changed ???. Why
staticDeleterAB.setObject( sInstance, new KABPrefs() );
#endif //KAB_EMBEDDED
sInstance->readConfig();
}
return sInstance;
}
void KABPrefs::setCategoryDefaults()
{
mCustomCategories.clear();
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h
index ddbc0c0..aff725e 100644
--- a/kaddressbook/kabprefs.h
+++ b/kaddressbook/kabprefs.h
@@ -1,99 +1,101 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KABPREFS_H
#define KABPREFS_H
#include <qstringlist.h>
-#include <qdict.h>
+#include <q3dict.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libkdepim/kpimprefs.h>
class KConfig;
class KABPrefs : public KPimPrefs
{
public:
virtual ~KABPrefs();
static KABPrefs *instance();
// General
bool mHonorSingleClick;
bool mAutomaticNameParsing;
int mCurrentIncSearchField;
#ifdef KAB_EMBEDDED
// US introduce a nonconst way to return the config object.
KConfig* getConfig();
bool mToolBarHor;
bool mToolBarUp;
bool mAskForQuit;
/** Set preferences to default values */
// void usrSetDefaults();
/** Read preferences from config file */
// void usrReadConfig();
/** Write preferences to config file */
// void usrWriteConfig();
#endif //KAB_EMBEDDED
void usrReadConfig();
// GUI
bool mFullMenuBarVisible;
bool mJumpButtonBarVisible;
bool mDetailsPageVisible;
bool mMultipleViewsAtOnce;
bool mSearchWithReturn;
bool mAutoSearchWithWildcard;
bool mHideSearchOnSwitch;
bool mAskForDelete;
- QValueList<int> mExtensionsSplitter;
- QValueList<int> mDetailsSplitter;
+ Q3ValueList<int> mExtensionsSplitter;
+ Q3ValueList<int> mDetailsSplitter;
// Extensions stuff
int mCurrentExtension;
QStringList mActiveExtensions;
// Views stuff
QString mCurrentView;
QStringList mViewNames;
// Filter
int mCurrentFilter;
void setCategoryDefaults();
QFont mDetailsFont;
private:
KABPrefs();
static KABPrefs *sInstance;
};
#endif
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro
index cd38e5f..4eb1f7f 100644
--- a/kaddressbook/kaddressbook.pro
+++ b/kaddressbook/kaddressbook.pro
@@ -1,81 +1,81 @@
TEMPLATE = app
CONFIG = qt warn_on
TARGET = kapi
DESTDIR= ../bin
include( ../variables.pri )
INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces
DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION
unix : {
staticlib: {
TARGET = kapi_linux
-LIBS += ../bin/libmicrokabc_qtopia.a
-LIBS += ../bin/libmicrokabc_file.a
-LIBS += ../bin/libmicrokabc_dir.a
-LIBS += ../bin/libmicrokdepim.a
-LIBS += ../bin/libmicrokcal.a
-LIBS += ../bin/libmicrokabc.a
-LIBS += ../bin/libmicrokde.a
-LIBS += ../bin/libmicrokabc_qtopia.a
-LIBS += ../bin/libmicrokabc_file.a
-LIBS += ../bin/libmicrokabc_dir.a
-LIBS += ../bin/libmicrokdepim.a
-LIBS += ../bin/libmicrokcal.a
-LIBS += ../bin/libmicrokabc.a
-LIBS += ../bin/libmicrokde.a
+LIBS += ../bin/libxmicrokabc_qtopia.a
+LIBS += ../bin/libxmicrokabc_file.a
+LIBS += ../bin/libxmicrokabc_dir.a
+LIBS += ../bin/libxmicrokdepim.a
+LIBS += ../bin/libxmicrokcal.a
+LIBS += ../bin/libxmicrokabc.a
+LIBS += ../bin/libxmicrokde.a
+LIBS += ../bin/libxmicrokabc_qtopia.a
+LIBS += ../bin/libxmicrokabc_file.a
+LIBS += ../bin/libxmicrokabc_dir.a
+LIBS += ../bin/libxmicrokdepim.a
+LIBS += ../bin/libxmicrokcal.a
+LIBS += ../bin/libxmicrokabc.a
+LIBS += ../bin/libxmicrokde.a
LIBS += ../libical/lib/libical.a
LIBS += ../libical/lib/libicalss.a
} else {
-LIBS += ../bin/libmicrokdepim.so
-LIBS += ../bin/libmicrokde.so
-LIBS += ../bin/libmicrokabc.so
-LIBS += ../bin/libmicrokcal.so
+LIBS += ../bin/libxmicrokdepim.so
+LIBS += ../bin/libxmicrokde.so
+LIBS += ../bin/libxmicrokabc.so
+LIBS += ../bin/libxmicrokcal.so
#LIBS += -lldap
}
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
RC_FILE = winicons.rc
DEFINES += _WIN32_
-LIBS += ../bin/microkdepim.lib
-LIBS += ../bin/microkcal.lib
-LIBS += ../bin/microkde.lib
-LIBS += ../bin/microkabc.lib
+LIBS += ../bin/xmicrokdepim.lib
+LIBS += ../bin/xmicrokcal.lib
+LIBS += ../bin/xmicrokde.lib
+LIBS += ../bin/xmicrokabc.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
#olimport section
importol {
debug: {
LIBS += mfc71ud.lib
}
release: {
LIBS += mfc71u.lib
}
DEFINES += _OL_IMPORT_
HEADERS = ../outport/msoutl9.h \
kaimportoldialog.h
SOURCES = ../outport/msoutl9.cpp \
kaimportoldialog.cpp
#olimport section end
TARGET = kapi_xp
} else {
TARGET = kapi_me
}
}
INTERFACES = \
# filteredit_base.ui \
# kofilterview_base.ui \
HEADERS += \
features/mergewidget.h \
features/distributionlistwidget.h \
kcmconfigs/addresseewidget.h \
kcmconfigs/extensionconfigdialog.h \
@@ -175,32 +175,34 @@ addviewdialog.cpp \
configurewidget.cpp \
viewconfigurewidget.cpp \
viewconfigurefieldspage.cpp \
viewconfigurefilterpage.cpp \
undo.cpp \
undocmds.cpp \
xxportmanager.cpp \
xxportobject.cpp \
xxportselectdialog.cpp \
details/detailsviewcontainer.cpp \
details/look_basic.cpp \
details/look_html.cpp \
views/kaddressbookiconview.cpp \
views/kaddressbooktableview.cpp \
views/kaddressbookcardview.cpp \
views/configuretableviewdialog.cpp \
views/configurecardviewdialog.cpp \
views/cardview.cpp \
views/contactlistview.cpp \
views/colorlistbox.cpp \
xxport/vcard_xxport.cpp \
xxport/kde2_xxport.cpp \
xxport/csv_xxport.cpp \
xxport/csvimportdialog.cpp \
xxport/opie_xxport.cpp \
xxport/qtopia_xxport.cpp \
xxport/sharpdtm_xxport.cpp \
#details/look_details.cpp \
#mainwindow.cpp \
# calendarview.cpp \
# timespanview.cpp
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index 64e3a4a..c4b2499 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -1,50 +1,50 @@
TEMPLATE = app
CONFIG += qt warn_on
TARGET = kapi
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include
DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
#DEFINES += KORG_NOLVALTERNATION
-LIBS += -lmicrokdepim
-LIBS += -lmicrokde
+LIBS += -lxmicrokdepim
+LIBS += -lxmicrokde
LIBS += -lmicroqtcompat
-LIBS += -lmicrokabc
+LIBS += -lxmicrokabc
LIBS += -lqpe
LIBS += -ljpeg
LIBS += $(QTOPIALIB)
LIBS += -L$(QPEDIR)/lib
LIBS += -Wl,-export-dynamic
LIBS += $(GCC3EXTRALIB1)
LIBS += $(GCC3EXTRALIB2)
INTERFACES = \
# filteredit_base.ui \
# kofilterview_base.ui \
HEADERS = \
features/mergewidget.h \
features/distributionlistwidget.h \
kcmconfigs/addresseewidget.h \
kcmconfigs/extensionconfigdialog.h \
kcmconfigs/kcmkabconfig.h \
kcmconfigs/kabconfigwidget.h \
addresseeeditordialog.h \
addresseeeditorwidget.h \
addresseditwidget.h \
addresseeconfig.h \
addresseeutil.h \
emaileditwidget.h \
filtereditdialog.h \
kaddressbookmain.h \
kabprefs.h \
kabcore.h \
viewmanager.h \
extensionmanager.h \
extensionwidget.h \
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index c417226..b317974 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -1,120 +1,123 @@
/*
This file is part of KAddressbook.
Copyright (c) 1999 Don Sanders <dsanders@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifdef KAB_EMBEDDED
#include "kabprefs.h"
#include <kglobal.h>
#include <qmessagebox.h>
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <QCloseEvent>
#else //KAB_EMBEDDED
#include <kedittoolbar.h>
#include <kkeydialog.h>
#include <kmessagebox.h>
#include <kstatusbar.h>
#endif //KAB_EMBEDDED
#include <klocale.h>
#include "kabcore.h"
#include "kaddressbookmain.h"
#include "kactioncollection.h"
#ifdef KAB_EMBEDDED
KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "abmain" )
#else //KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 )
-//MOC_SKIP_END
+#endif
#endif //KAB_EMBEDDED
{
setIcon(SmallIcon( "ka24" ) );
#if 0
//US for embedded systems, create the toolbar before we initiate KABCore.
// KABCore will fill the toolbar with menues and icons
- QMainWindow::ToolBarDock tbd;
- tbd = Top;
- iconToolBar = new QToolBar( this );
+ Qt::ToolBarDock tbd;
+ tbd = Qt::DockTop;
+ iconToolBar = new Q3ToolBar( this );
addToolBar (iconToolBar , tbd );
iconToolBar->setHorizontalStretchable(true);
//US iconToolBar->setWidth(300);
#endif // 0
mCore = new KABCore( this, true, this );
#ifdef KAB_EMBEDDED
setCaption( i18n( "KAddressbook/Pi" ) );
#else //KAB_EMBEDDED
setCaption( i18n( "Address Book Browser" ) );
#endif //KAB_EMBEDDED
//mCore->restoreSettings();
initActions();
setCentralWidget( mCore );
//US statusBar()->show();
#ifndef KAB_EMBEDDED
setStandardToolBarMenuEnabled(true);
createGUI( "kaddressbookui.rc", false );
#endif //KAB_EMBEDDED
setAutoSaveSettings();
mCore->restoreSettings();
#ifndef DESKTOP_VERSION
- QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), mCore, SLOT (receiveStart ( const QCString &, const QByteArray & )));
+ QObject::connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), mCore, SLOT (receiveStart ( const Q3CString &, const QByteArray & )));
#endif
}
KAddressBookMain::~KAddressBookMain()
{
// mCore->saveSettings();
}
void KAddressBookMain::showMinimized ()
{
QWidget::showMinimized () ;
}
void KAddressBookMain::addEmail( QString addr )
{
mCore->addEmail( addr );
}
#ifndef KAB_EMBEDDED
ASYNC KAddressBookMain::showContactEditor( QString uid )
{
mCore->editContact( uid );
}
#endif //KAB_EMBEDDED
void KAddressBookMain::newContact()
{
mCore->newContact();
}
QString KAddressBookMain::getNameByPhone( QString phone )
{
return mCore->getNameByPhone( phone );
}
@@ -206,36 +209,35 @@ void KAddressBookMain::closeEvent( QCloseEvent* ce )
QString mess = i18n( "Close KA/Pi?");
if ( mModified == true )
mess += i18n( "\nChanges will be saved!");
else
mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
bool mQuit = true;
if (mAskForQuit)
{
int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
if (res == 0)
mQuit = true;
else
mQuit = false;
}
if (mQuit == false)
return;
if (mModified == true)
{
save();
mCore->saveSettings();
//KABPrefs::instance()->writeConfig();
}
ce->accept();
}
-#ifndef KAB_EMBEDDED
-#include "kaddressbookmain.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kaddressbookmain.cpp"
#endif //KAB_EMBEDDED
-
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index b6d9b4b..d3f5cc7 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -1,110 +1,112 @@
/*
This file is part of KAddressbook.
Copyright (c) 1999 Don Sanders <dsanders@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KADDRESSBOOKMAIN_H
#define KADDRESSBOOKMAIN_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QCloseEvent>
#ifdef KAB_EMBEDDED
-class QToolBar;
+class Q3ToolBar;
#include <qaction.h>
//#include <qmainwindow.h>
#include <kmainwindow.h>
#else //KAB_EMBEDDED
#include <kaction.h>
#include <kapplication.h>
#include <kmainwindow.h>
#include "kaddressbookiface.h"
#endif //KAB_EMBEDDED
class KABCore;
class KConfig;
/**
This class serves as the main window for KAddressBook. It handles the
menus, toolbars, and status bars.
@short Main window class
@author Don Sanders <dsanders@kde.org>
@version 0.1
*/
#ifdef KAB_EMBEDDED
class KAddressBookMain : public KMainWindow
#else //KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
-//MOC_SKIP_END
+#endif
#endif //KAB_EMBEDDED
{
Q_OBJECT
public:
KAddressBookMain();
virtual ~KAddressBookMain();
#ifdef KAB_EMBEDDED
// QPEToolBar * getIconToolBar();
// QToolBar * getIconToolBar();
#endif //KAB_EMBEDDED
public slots:
void showMinimized () ;
virtual void addEmail( QString addr );
#ifndef KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
virtual ASYNC showContactEditor( QString uid );
-//MOC_SKIP_END
+#endif
#endif //KAB_EMBEDDED
virtual void newContact();
virtual QString getNameByPhone( QString phone );
virtual void save();
virtual void exit();
protected:
void initActions();
#ifdef KAB_EMBEDDED
//US new method to setup menues and toolbars on embedded systems
void createGUI();
#endif //KAB_EMBEDDED
/**
This function is called when it is time for the app to save its
properties for session management purposes.
*/
void saveProperties( KConfig* );
/**
This function is called when this app is restored. The KConfig
object points to the session management config file that was saved
with @ref saveProperties
*/
void readProperties( KConfig* );
void closeEvent( QCloseEvent* ce );
protected slots:
void configureToolbars();
void configureKeys();
void slotNewToolbarConfig();
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp
index 86898e2..4823b37 100644
--- a/kaddressbook/kaddressbookview.cpp
+++ b/kaddressbook/kaddressbookview.cpp
@@ -3,64 +3,66 @@
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KAB_EMBEDDED
#include <qapplication.h>
#include <kabc/distributionlistdialog.h>
#include <kconfig.h>
#include <klocale.h>
#include "viewmanager.h"
#endif //KAB_EMBEDDED
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kabc/distributionlistdialog.h>
#include <kabc/addressbook.h>
#include <kdebug.h>
#include "kaddressbookview.h"
KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent,
const char *name )
: QWidget( parent, name ), mAddressBook( ab ), mFieldList()
{
initGUI();
}
KAddressBookView::~KAddressBookView()
{
}
QRegExp KAddressBookView::getRegExp( const QString s )
{
QRegExp re;
if ( s.length() == 3 && s.mid(1,1) == "-" ) {
QString pattern = "^[" + s.lower() +"]";
re.setCaseSensitive(false);
re.setPattern( pattern );
} else {
QString pattern = s.lower()+"*";
re.setWildcard(true); // most people understand these better.
re.setCaseSensitive(false);
@@ -104,85 +106,85 @@ QString KAddressBookView::selectedEmails()
m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this );
email = addr.fullEmail( m );
if ( !first )
emailAddrs += ", ";
else
first = false;
emailAddrs += email;
}
}
return emailAddrs;
}
KABC::Addressee::List KAddressBookView::addressees()
{
KABC::Addressee::List addresseeList;
KABC::AddressBook::Iterator it;
for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( mFilter.filterAddressee( *it ) )
addresseeList.append( *it );
}
return addresseeList;
}
void KAddressBookView::initGUI()
{
// Create the layout
- QVBoxLayout *layout = new QVBoxLayout( this );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this );
// Add the view widget
mViewWidget = new QWidget( this );
layout->addWidget( mViewWidget );
}
KABC::Field::List KAddressBookView::fields() const
{
return mFieldList;
}
KABC::Field::List KAddressBookView::allFields() const
{
return KABC::Field::allFields();
}
void KAddressBookView::setFilter( const Filter &filter )
{
mFilter = filter;
}
KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const
{
return mDefaultFilterType;
}
const QString &KAddressBookView::defaultFilterName() const
{
return mDefaultFilterName;
}
KABC::AddressBook *KAddressBookView::addressBook() const
{
return mAddressBook;
}
QWidget *KAddressBookView::viewWidget()
{
return mViewWidget;
}
ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
QWidget *parent,
const char *name )
{
return new ViewConfigureWidget( ab, parent, name );
}
-#ifndef KAB_EMBEDDED
-#include "kaddressbookview.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kaddressbookview.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 3a3f71a..e423cd7 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -1,75 +1,77 @@
+//Added by qt3to4:
+#include <QDropEvent>
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KADDRESSBOOKVIEW_H
#define KADDRESSBOOKVIEW_H
#ifndef KAB_EMBEDDED
#include <klibloader.h>
#endif //KAB_EMBEDDED
class KConfig;
class QDropEvent;
#include <qstringlist.h>
#include <kabc/field.h>
#include <qwidget.h>
#include <qregexp.h>
#include "viewconfigurewidget.h"
#include "filter.h"
#ifdef DESKTOP_VERSION
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#include <qprinter.h>
#include <qpainter.h>
#endif
namespace KABC { class AddressBook; }
/**
Base class for all views in kaddressbook. This class implements
all the common methods needed to provide a view to the user.
To implement a specific view (table, card, etc), just inherit from
this class and implement all the pure virtuals.
@author Mike Pilone <mpilone@slac.com>
*/
class KAddressBookView : public QWidget
{
Q_OBJECT
public:
enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name );
virtual ~KAddressBookView();
/**
Must be overloaded in subclasses. Should return a list of
all the uids of selected contacts.
*/
virtual QStringList selectedUids() = 0;
virtual void doSearch( const QString& s ,KABC::Field *field ) = 0;
virtual void scrollUP() = 0;
@@ -146,67 +148,67 @@ class KAddressBookView : public QWidget
defaultFilterName()
*/
DefaultFilterType defaultFilterType() const;
/**
@return The name of the default filter. This string is
only valid if defaultFilterType() is returning SpecificFilter.
*/
const QString &defaultFilterName() const;
/**
@return The address book.
*/
KABC::AddressBook *addressBook() const;
void printMyView() { emit printView() ;}
public slots:
/**
Must be overloaded in subclasses to refresh the view.
Refreshing includes updating the view to ensure that only items
in the document are visible. If <i>uid</i> is valid, only the
addressee with uid needs to be refreshed. This is an optimization
only.
*/
virtual void refresh( QString uid = QString::null ) = 0;
/**
This method must be overloaded in subclasses. Select (highlight)
the addressee matching <i>uid</i>. If uid
is equal to QString::null, then all addressees should be selected.
*/
#ifndef KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0;
-//MOC_SKIP_END
+#endif
#else //KAB_EMBEDDED
//US my moc can not handle the default parameters. Is this a problem ???
virtual void setSelected( QString uid, bool selected) = 0;
#endif //KAB_EMBEDDED
signals:
void printView();
/**
This signal should be emitted by a subclass whenever an addressee
is modified.
*/
void modified();
/**
This signal should be emitted by a subclass whenever an addressee
is selected. Selected means that the addressee was given the focus.
Some widgets may call this 'highlighted'. The view is responsible for
emitting this signal multiple times if multiple items are selected,
with the last item selected being the last emit.
@param uid The uid of the selected addressee.
@see KListView
*/
void selected( const QString &uid );
void deleteRequest();
/**
This signal should be emitted by a subclass whenever an addressee
is executed. This is defined by the KDE system wide config, but it
either means single or doubleclicked.
@@ -233,67 +235,67 @@ class KAddressBookView : public QWidget
protected:
/**
Returns a list of the addressees that should be displayed. This method
should always be used by the subclass to get a list of addressees. This
method internally takes many factors into account, including the current
filter.
*/
KABC::Addressee::List addressees();
/**
This method returns the widget that should be used as the parent for
all view components. By using this widget as the parent and not
'this', the view subclass has the option of placing other widgets
around the view (ie: search fields, etc). Do not delete this widget!
*/
QWidget *viewWidget();
QRegExp getRegExp( const QString );
private:
void initGUI();
DefaultFilterType mDefaultFilterType;
Filter mFilter;
QString mDefaultFilterName;
KABC::AddressBook *mAddressBook;
KABC::Field::List mFieldList;
QWidget *mViewWidget;
};
#ifndef KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class ViewFactory : public KLibFactory
-//MOC_SKIP_END
+#endif
#else //KAB_EMBEDDED
class ViewFactory
#endif //KAB_EMBEDDED
{
public:
virtual KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 ) = 0;
/**
@return The type of the view. This is normally a small one word
string (ie: Table, Icon, Tree, etc).
*/
virtual QString type() const = 0;
/**
@return The description of the view. This should be a 3 to
4 line string (don't actually use return characters in the string)
describing the features offered by the view.
*/
virtual QString description() const = 0;
/**
Creates a config dialog for the view type. The default
implementation will return a ViewConfigDialog. This default
dialog will allow the user to set the visible fields only. If
you need more config options (as most views will), this method
can be overloaded to return your sublcass of ViewConfigDialog.
If this method is over loaded the base classes method should
<B>not</B> be called.
*/
virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab,
diff --git a/kaddressbook/kcmconfigs/addresseewidget.cpp b/kaddressbook/kcmconfigs/addresseewidget.cpp
index 168d39e..8055085 100644
--- a/kaddressbook/kcmconfigs/addresseewidget.cpp
+++ b/kaddressbook/kcmconfigs/addresseewidget.cpp
@@ -1,238 +1,242 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
#include <kbuttonbox.h>
#include <kcombobox.h>
#include <kconfig.h>
#include <kdialog.h>
#include <klocale.h>
#include <kglobal.h>
#include <klineedit.h>
#include <kstandarddirs.h>
#include "addresseewidget.h"
NamePartWidget::NamePartWidget( const QString &title, QWidget *parent,
const char *name )
: QWidget( parent, name )
{
if (KGlobal::getOrientation() == KGlobal::Portrait)
{
- QGridLayout* layout = new QGridLayout( this, 1, 1, KDialog::marginHintSmall(),
+ Q3GridLayout* layout = new Q3GridLayout( this, 1, 1, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
QLabel *label = new QLabel( i18n( title ), this );
layout->addWidget( label, 0, 1 );
- mBox = new QListBox( this );
+ mBox = new Q3ListBox( this );
mBox->setMaximumSize(70, 70);
layout->addMultiCellWidget( mBox, 0, 1, 0, 0 );
KButtonBox *bbox = new KButtonBox( this, Qt::Vertical );
mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
mRemoveButton = bbox->addButton( i18n( "Rem" ), this, SLOT( remove() ) );
bbox->layout();
layout->addMultiCellWidget( bbox, 0, 1, 2,2);
mEdit = new KLineEdit( this );
layout->addWidget( mEdit, 1, 1 );
//mEdit->setMinimumWidth(50);
// layout->addWidget( group );
}
else
{
- QHBoxLayout *layout = new QHBoxLayout( this );
+ Q3HBoxLayout *layout = new Q3HBoxLayout( this );
- QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this );
- QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2,
+ Q3GroupBox *group = new Q3GroupBox( 0, Qt::Vertical, title, this );
+ Q3GridLayout *groupLayout = new Q3GridLayout( group->layout(), 2, 2,
KDialog::spacingHint() );
- mBox = new QListBox( group );
+ mBox = new Q3ListBox( group );
groupLayout->addWidget( mBox, 0, 0 );
KButtonBox *bbox = new KButtonBox( group, Qt::Vertical );
mAddButton = bbox->addButton( i18n( "Add" ), this, SLOT( add() ) );
mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) );
bbox->layout();
groupLayout->addWidget( bbox, 0, 1 );
mEdit = new KLineEdit( group );
groupLayout->addMultiCellWidget( mEdit, 1, 1, 0, 1 );
layout->addWidget( group );
}
mAddButton->setEnabled( false );
mRemoveButton->setEnabled( false );
- connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ),
- SLOT( selectionChanged( QListBoxItem* ) ) );
+ connect( mBox, SIGNAL( selectionChanged( Q3ListBoxItem* ) ),
+ SLOT( selectionChanged( Q3ListBoxItem* ) ) );
connect( mEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
connect( mEdit, SIGNAL( returnPressed() ), SLOT( add() ) );
}
NamePartWidget::~NamePartWidget()
{
}
void NamePartWidget::setNameParts( const QStringList &list )
{
mBox->clear();
mBox->insertStringList( list );
}
QStringList NamePartWidget::nameParts() const
{
QStringList parts;
for ( uint i = 0; i < mBox->count(); ++i )
parts.append( mBox->text( i ) );
return parts;
}
void NamePartWidget::add()
{
if ( !mEdit->text().isEmpty() ) {
mBox->insertItem( mEdit->text() );
emit modified();
}
mEdit->setText( "" );
}
void NamePartWidget::remove()
{
mBox->removeItem( mBox->currentItem() );
if ( mBox->count() == 0 )
selectionChanged( 0 );
emit modified();
}
-void NamePartWidget::selectionChanged( QListBoxItem *item )
+void NamePartWidget::selectionChanged( Q3ListBoxItem *item )
{
mRemoveButton->setEnabled( item != 0 );
}
void NamePartWidget::textChanged( const QString& text )
{
mAddButton->setEnabled( !text.isEmpty() );
}
AddresseeWidget::AddresseeWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QGridLayout *layout;
+ Q3GridLayout *layout;
mPrefix = new NamePartWidget( i18n( "Prefixes" ), this );
mInclusion = new NamePartWidget( i18n( "Inclusions" ), this );
mSuffix = new NamePartWidget( i18n( "Suffixes" ), this );
QString dfn;
if (QApplication::desktop()->width() > 320 )
dfn = i18n( "Default formatted name:" );
else
dfn = i18n( "Def. formatted name:" );
QLabel *label = new QLabel( dfn, this );
mFormattedNameCombo = new KComboBox( this );
mFormattedNameCombo->insertItem( i18n( "Empty" ) );
mFormattedNameCombo->insertItem( i18n( "Simple Name" ) );
mFormattedNameCombo->insertItem( i18n( "Full Name" ) );
mFormattedNameCombo->insertItem( i18n( "Reverse Name" ) );
if (KGlobal::getOrientation() == KGlobal::Portrait)
{
- layout = new QGridLayout( this, 4, 2, KDialog::marginHintSmall(),
+ layout = new Q3GridLayout( this, 4, 2, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
layout->addMultiCellWidget( mPrefix, 0, 0, 0, 1 );
layout->addMultiCellWidget( mInclusion, 1, 1, 0, 1 );
layout->addMultiCellWidget( mSuffix, 2, 2, 0, 1 );
layout->addWidget( label, 3, 0 );
layout->addWidget( mFormattedNameCombo, 3, 1 );
}
else
{
- layout = new QGridLayout( this, 2, 3, KDialog::marginHint(),
+ layout = new Q3GridLayout( this, 2, 3, KDialog::marginHint(),
KDialog::spacingHint() );
layout->addWidget( mPrefix, 0, 0 );
layout->addWidget( mInclusion, 0, 1 );
layout->addWidget( mSuffix, 0, 2 );
layout->addWidget( label, 1, 0 );
layout->addMultiCellWidget( mFormattedNameCombo, 1, 1, 1, 2 );
}
connect( mPrefix, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( mInclusion, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( mSuffix, SIGNAL( modified() ), SIGNAL( modified() ) );
connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SIGNAL( modified() ) );
}
AddresseeWidget::~AddresseeWidget()
{
}
void AddresseeWidget::restoreSettings()
{
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
mPrefix->setNameParts( config.readListEntry( "Prefixes" ) );
mInclusion->setNameParts( config.readListEntry( "Inclusions" ) );
mSuffix->setNameParts( config.readListEntry( "Suffixes" ) );
mFormattedNameCombo->setCurrentItem( config.readNumEntry( "FormattedNameType", 1 ) );
}
void AddresseeWidget::saveSettings()
{
qDebug("AddresseeWidget::saveSettings() ");
KConfig config( locateLocal("config","kabcrc") );
config.setGroup( "General" );
config.writeEntry( "Prefixes", mPrefix->nameParts() );
config.writeEntry( "Inclusions", mInclusion->nameParts() );
config.writeEntry( "Suffixes", mSuffix->nameParts() );
config.writeEntry( "FormattedNameType", mFormattedNameCombo->currentItem() );
}
-#ifndef KAB_EMBEDDED
-#include "addresseewidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_addresseewidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kcmconfigs/addresseewidget.h b/kaddressbook/kcmconfigs/addresseewidget.h
index 09330c8..f2a95a8 100644
--- a/kaddressbook/kcmconfigs/addresseewidget.h
+++ b/kaddressbook/kcmconfigs/addresseewidget.h
@@ -1,87 +1,87 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ADDRESSEEWIDGET_H
#define ADDRESSEEWIDGET_H
#include <qwidget.h>
class KComboBox;
class KLineEdit;
-class QListBox;
-class QListBoxItem;
+class Q3ListBox;
+class Q3ListBoxItem;
class QPushButton;
class NamePartWidget : public QWidget
{
Q_OBJECT
public:
NamePartWidget( const QString &title, QWidget *parent,
const char *name = 0 );
~NamePartWidget();
void setNameParts( const QStringList &list );
QStringList nameParts() const;
signals:
void modified();
private slots:
void add();
void remove();
- void selectionChanged( QListBoxItem* );
+ void selectionChanged( Q3ListBoxItem* );
void textChanged( const QString& );
private:
KLineEdit *mEdit;
- QListBox *mBox;
+ Q3ListBox *mBox;
QPushButton *mAddButton;
QPushButton *mRemoveButton;
};
class AddresseeWidget : public QWidget
{
Q_OBJECT
public:
AddresseeWidget( QWidget *parent, const char *name = 0 );
~AddresseeWidget();
void restoreSettings();
void saveSettings();
signals:
void modified();
private:
KComboBox *mFormattedNameCombo;
NamePartWidget *mPrefix;
NamePartWidget *mInclusion;
NamePartWidget *mSuffix;
};
#endif
diff --git a/kaddressbook/kcmconfigs/extensionconfigdialog.cpp b/kaddressbook/kcmconfigs/extensionconfigdialog.cpp
index e87b000..33b66ad 100644
--- a/kaddressbook/kcmconfigs/extensionconfigdialog.cpp
+++ b/kaddressbook/kcmconfigs/extensionconfigdialog.cpp
@@ -1,59 +1,62 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3Frame>
#include <klocale.h>
#include "configurewidget.h"
#include "extensionconfigdialog.h"
ExtensionConfigDialog::ExtensionConfigDialog( ExtensionFactory *factory, KConfig *config,
QWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Extension Settings" ), Ok | Cancel, Ok, parent,
name, true, true ), mWidget( 0 ), mConfig( config )
{
- QFrame *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 1, 1, marginHint(), spacingHint() );
+ Q3Frame *page = plainPage();
+ Q3GridLayout *layout = new Q3GridLayout( page, 1, 1, marginHint(), spacingHint() );
mWidget = factory->configureWidget( page, "ExtensionConfigWidget" );
layout->addWidget( mWidget, 0, 0 );
mWidget->restoreSettings( mConfig );
}
ExtensionConfigDialog::~ExtensionConfigDialog()
{
}
void ExtensionConfigDialog::slotOk()
{
mWidget->saveSettings( mConfig );
KDialogBase::slotOk();
}
-#ifndef KAB_EMBEDDED
-#include "extensionconfigdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_extensionconfigdialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
index 9e4db74..d2b7ef1 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp
@@ -1,227 +1,231 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcheckbox.h>
-#include <qframe.h>
-#include <qgroupbox.h>
+#include <q3frame.h>
+#include <q3groupbox.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qfile.h>
-#include <qvbox.h>
+#include <q3vbox.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3PtrList>
+#include <Q3VBoxLayout>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else // KAB_EMBEDDED
#include <mergewidget.h>
#include <distributionlistwidget.h>
#endif // KAB_EMBEDDED
#include "addresseewidget.h"
#include "extensionconfigdialog.h"
#include "extensionwidget.h"
#include "kabprefs.h"
#include "kabconfigwidget.h"
#include <kglobalsettings.h>
-class ExtensionItem : public QCheckListItem
+class ExtensionItem : public Q3CheckListItem
{
public:
#ifndef KAB_EMBEDDED
- ExtensionItem( QListView *parent, const QString &text );
+ ExtensionItem( Q3ListView *parent, const QString &text );
void setService( const KService::Ptr &ptr );
#else //KAB_EMBEDDED
- ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment );
+ ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment );
void setFactory( ExtensionFactory* fac );
#endif //KAB_EMBEDDED
bool configWidgetAvailable() const;
ExtensionFactory *factory() const;
virtual QString text( int column ) const;
private:
#ifndef KAB_EMBEDDED
KService::Ptr mPtr;
#else //KAB_EMBEDDED
ExtensionFactory* mFactory;
QString mName;
QString mComment;
#endif //KAB_EMBEDDED
};
KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name )
: KPrefsWidget( prefs, parent, name )
{
- QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0,
KDialog::spacingHintSmall() );
QTabWidget *tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
// General page
QWidget *generalPage = new QWidget( this );
- QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(),
+ Q3VBoxLayout *layout = new Q3VBoxLayout( generalPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
QWidget *hBox = new QWidget( generalPage, "qhbox" );
- QHBoxLayout *hboxLayout = new QHBoxLayout( hBox);
+ Q3HBoxLayout *hboxLayout = new Q3HBoxLayout( hBox);
KPrefsWidFont *detailsFont =
addWidFont(i18n("phone:123"),i18n("Details view font"),
&(KABPrefs::instance()->mDetailsFont),hBox);
hboxLayout->addWidget(detailsFont->label());
hboxLayout->addWidget(detailsFont->preview());
hboxLayout->addWidget(detailsFont->button());
hboxLayout->setMargin(KDialog::marginHintSmall() );
hboxLayout->setSpacing(KDialog::spacingHintSmall());
//hBox->setBackgroundColor( black);
layout->addWidget( hBox );
//general groupbox
QWidget *vBox = new QWidget( generalPage, "qvbox" );
- QVBoxLayout *boxLayout = new QVBoxLayout( vBox );
+ Q3VBoxLayout *boxLayout = new Q3VBoxLayout( vBox );
boxLayout->setAlignment( Qt::AlignTop );
boxLayout->setMargin(KDialog::marginHintSmall() );
boxLayout->setSpacing( KDialog::spacingHintSmall() );
mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" );
boxLayout->addWidget( mMenuBarBox );
mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" );
boxLayout->addWidget( mSearchReturnBox );
mAutoSearchWithWildcardBox = new QCheckBox( i18n( "Search with '*' prefix (wildcard)" ), vBox, "mwildcard" );
boxLayout->addWidget( mAutoSearchWithWildcardBox);
mHideSearchOnSwitchBox = new QCheckBox( i18n( "Shrink searchfield in portrait view" ), vBox, "mswitch" );
boxLayout->addWidget( mHideSearchOnSwitchBox );
#ifdef DESKTOP_VERSION
mHideSearchOnSwitchBox->hide();
#endif
mViewsSingleClickBox = new QCheckBox( i18n( "Show edit dialog on single click" ), vBox, "msingle" );
boxLayout->addWidget( mViewsSingleClickBox );
mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new contacts" ), vBox, "mparse" );
boxLayout->addWidget( mNameParsing );
mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" );
boxLayout->addWidget( mMultipleViewsAtOnce );
mAskForDelete = new QCheckBox( i18n( "Ask before delete contact" ), vBox, "mdel" );
boxLayout->addWidget( mAskForDelete );
mAskForQuit = new QCheckBox( i18n( "Show exit confirmation" ), vBox, "mquit" );
boxLayout->addWidget( mAskForQuit );
layout->addWidget( vBox );
tabWidget->addTab( generalPage, i18n( "General" ) );
// Extension page
QWidget *extensionPage = new QWidget( this );
- QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(),
+ Q3VBoxLayout *extensionLayout = new Q3VBoxLayout( extensionPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
//extensions groupbox
- QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
- boxLayout = new QVBoxLayout( groupBox->layout() );
+ Q3GroupBox* groupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage );
+ boxLayout = new Q3VBoxLayout( groupBox->layout() );
boxLayout->setAlignment( Qt::AlignTop );
boxLayout->setMargin(KDialog::marginHintSmall());
boxLayout->setSpacing(KDialog::spacingHintSmall());
groupBox->layout()->setMargin(1) ;
groupBox->layout()->setSpacing(0);
mExtensionView = new KListView( groupBox );
mExtensionView->setAllColumnsShowFocus( true );
mExtensionView->addColumn( i18n( "Name" ) );
mExtensionView->addColumn( i18n( "Description" ) );
//mExtensionView->setMaximumHeight(80);
boxLayout->addWidget( mExtensionView );
mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox );
mConfigureButton->setEnabled( false );
boxLayout->addWidget( mConfigureButton );
extensionLayout->addWidget( groupBox );
connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mAutoSearchWithWildcardBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mHideSearchOnSwitchBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
connect( mAskForDelete, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) );
- connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ),
- SLOT( selectionChanged( QListViewItem* ) ) );
- connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ),
- SLOT( itemClicked( QListViewItem* ) ) );
+ connect( mExtensionView, SIGNAL( selectionChanged( Q3ListViewItem* ) ),
+ SLOT( selectionChanged( Q3ListViewItem* ) ) );
+ connect( mExtensionView, SIGNAL( clicked( Q3ListViewItem* ) ),
+ SLOT( itemClicked( Q3ListViewItem* ) ) );
connect( mConfigureButton, SIGNAL( clicked() ),
SLOT( configureExtension() ) );
tabWidget->addTab( extensionPage, i18n( "Extensions" ) );
// Addressee page
mAddresseeWidget = new AddresseeWidget( this );
tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) );
connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) );
}
void KABConfigWidget::usrReadConfig()
{
KABPrefs* prefs = KABPrefs::instance();
bool blocked = signalsBlocked();
blockSignals( true );
mMenuBarBox->setChecked( prefs->mFullMenuBarVisible);
mNameParsing->setChecked( prefs->mAutomaticNameParsing );
mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick );
mSearchReturnBox->setChecked( prefs->mSearchWithReturn );
mAutoSearchWithWildcardBox->setChecked( prefs->mAutoSearchWithWildcard );
mHideSearchOnSwitchBox->setChecked( prefs->mHideSearchOnSwitch );
mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce );
mAskForQuit->setChecked( prefs->mAskForQuit );
mAskForDelete->setChecked( prefs->mAskForDelete );
mAddresseeWidget->restoreSettings();
restoreExtensionSettings();
@@ -266,159 +270,158 @@ void KABConfigWidget::restoreExtensionSettings()
item->setService( *it );
if ( activeExtensions.contains( item->factory()->identifier() ) )
item->setOn( true );
}
#else //KAB_EMBEDDED
ExtensionFactory *extensionFactory = new MergeFactory();
ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts");
item->setFactory( extensionFactory );
if ( activeExtensions.contains( extensionFactory->identifier() ) )
item->setOn( true );
extensionFactory = new DistributionListFactory();
item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists");
item->setFactory( extensionFactory );
if ( activeExtensions.contains( extensionFactory->identifier() ) )
item->setOn( true );
#endif //KAB_EMBEDDED
}
void KABConfigWidget::saveExtensionSettings()
{
QStringList activeExtensions;
- QPtrList<QListViewItem> list;
- QListViewItemIterator it( mExtensionView );
+ Q3PtrList<Q3ListViewItem> list;
+ Q3ListViewItemIterator it( mExtensionView );
while ( it.current() ) {
ExtensionItem *item = static_cast<ExtensionItem*>( it.current() );
if ( item ) {
if ( item->isOn() )
activeExtensions.append( item->factory()->identifier() );
}
++it;
}
KABPrefs::instance()->mActiveExtensions = activeExtensions;
}
void KABConfigWidget::configureExtension()
{
ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() );
if ( !item )
return;
#ifndef KAB_EMBEDDED
KConfig config( "kaddressbookrc" );
#else //KAB_EMBEDDED
KConfig config( locateLocal("config", "kaddressbookrc") );
#endif //KAB_EMBEDDED
config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) );
ExtensionConfigDialog dlg( item->factory(), &config, this );
dlg.exec();
config.sync();
}
-void KABConfigWidget::selectionChanged( QListViewItem *i )
+void KABConfigWidget::selectionChanged( Q3ListViewItem *i )
{
ExtensionItem *item = static_cast<ExtensionItem*>( i );
if ( !item )
return;
mConfigureButton->setEnabled( item->configWidgetAvailable() );
}
-void KABConfigWidget::itemClicked( QListViewItem *item )
+void KABConfigWidget::itemClicked( Q3ListViewItem *item )
{
if ( item != 0 )
modified();
}
#ifndef KAB_EMBEDDED
-ExtensionItem::ExtensionItem( QListView *parent, const QString &text )
- : QCheckListItem( parent, text, CheckBox )
+ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text )
+ : Q3CheckListItem( parent, text, CheckBox )
{
}
void ExtensionItem::setService( const KService::Ptr &ptr )
{
mPtr = ptr;
}
#else //KAB_EMBEDDED
-ExtensionItem::ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment )
- : QCheckListItem( parent, text, CheckBox )
+ExtensionItem::ExtensionItem( Q3ListView *parent, const QString &text, const QString &name, const QString &comment )
+ : Q3CheckListItem( parent, text, CheckBox )
{
mName = name;
mComment = comment;
}
void ExtensionItem::setFactory( ExtensionFactory* fac )
{
mFactory = fac;
}
#endif //KAB_EMBEDDED
bool ExtensionItem::configWidgetAvailable() const
{
#ifndef KAB_EMBEDDED
KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
if ( !factory )
return false;
ExtensionFactory *extensionFactory = static_cast<ExtensionFactory*>( factory );
if ( !extensionFactory )
return false;
return extensionFactory->configureWidgetAvailable();
#else //KAB_EMBEDDED
return mFactory->configureWidgetAvailable();
#endif //KAB_EMBEDDED
}
ExtensionFactory *ExtensionItem::factory() const
{
#ifndef KAB_EMBEDDED
KLibFactory *factory = KLibLoader::self()->factory( mPtr->library().latin1() );
if ( !factory )
return 0;
return static_cast<ExtensionFactory*>( factory );
#else //KAB_EMBEDDED
return mFactory;
#endif //KAB_EMBEDDED
}
QString ExtensionItem::text( int column ) const
{
#ifndef KAB_EMBEDDED
if ( column == 0 )
return mPtr->name();
else if ( column == 1 )
return mPtr->comment();
else
return QString::null;
#else //KAB_EMBEDDED
if ( column == 0 )
return mName;
else if ( column == 1 )
return mComment;
else
return QString::null;
#endif //KAB_EMBEDDED
}
-#ifndef KAB_EMBEDDED
-#include "kabconfigwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kabconfigwidget.cpp"
#endif //KAB_EMBEDDED
-
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h
index f2a6b1b..4b6e58c 100644
--- a/kaddressbook/kcmconfigs/kabconfigwidget.h
+++ b/kaddressbook/kcmconfigs/kabconfigwidget.h
@@ -1,78 +1,78 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KABCONFIGWIDGET_H
#define KABCONFIGWIDGET_H
#include <kprefswidget.h>
class QCheckBox;
-class QListViewItem;
+class Q3ListViewItem;
class QPushButton;
class QComboBox;
class QLineEdit;
class KListView;
class KABPrefs;
class AddresseeWidget;
class KABConfigWidget : public KPrefsWidget
{
Q_OBJECT
public:
KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 );
protected:
/** Implement this to read custom configuration widgets. */
virtual void usrReadConfig();
/** Implement this to write custom configuration widgets. */
virtual void usrWriteConfig();
private slots:
void configureExtension();
- void selectionChanged( QListViewItem* );
- void itemClicked( QListViewItem* );
+ void selectionChanged( Q3ListViewItem* );
+ void itemClicked( Q3ListViewItem* );
private:
void restoreExtensionSettings();
void saveExtensionSettings();
KListView *mExtensionView;
QCheckBox *mSearchReturnBox;
QCheckBox *mNameParsing;
QCheckBox *mViewsSingleClickBox;
QCheckBox *mAutoSearchWithWildcardBox;
QCheckBox *mHideSearchOnSwitchBox;
QCheckBox *mMultipleViewsAtOnce;
QCheckBox *mAskForQuit;
QCheckBox *mMenuBarBox;
QCheckBox *mAskForDelete;
QPushButton *mConfigureButton;
AddresseeWidget *mAddresseeWidget;
};
#endif
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.cpp b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
index cbfedbd..55ffcd8 100644
--- a/kaddressbook/kcmconfigs/kcmkabconfig.cpp
+++ b/kaddressbook/kcmconfigs/kcmkabconfig.cpp
@@ -1,92 +1,94 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#ifndef KAB_EMBEDDED
#include <kaboutdata.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
//#include <klocale.h>
//#include <stdlib.h>
#include "kabconfigwidget.h"
#include "kcmkabconfig.h"
#include "kabprefs.h"
#include "kprefs.h"
extern "C"
{
KCModule *create_kabconfig( QWidget *parent, const char * ) {
return new KCMKabConfig( parent, "kcmkabconfig" );
}
}
KCMKabConfig::KCMKabConfig( QWidget *parent, const char *name )
: KCModule( KABPrefs::instance(), parent, name )
{
//abort();
- QVBoxLayout *layout = new QVBoxLayout( this );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this );
mConfigWidget = new KABConfigWidget( (KABPrefs*)getPreferences(), this, "KABConfigWidget" );
layout->addWidget( mConfigWidget );
layout->setSpacing( 0 );
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}
void KCMKabConfig::load()
{
mConfigWidget->readConfig();
}
void KCMKabConfig::save()
{
mConfigWidget->writeConfig();
}
void KCMKabConfig::defaults()
{
mConfigWidget->setDefaults();
}
#ifndef KAB_EMBEDDED
const KAboutData* KCMKabConfig::aboutData() const
{
KAboutData *about = new KAboutData( I18N_NOOP( "kcmkabconfig" ),
I18N_NOOP( "KAddressBook Configure Dialog" ),
0, 0, KAboutData::License_GPL,
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
return about;
}
#endif //KAB_EMBEDDED
-#ifndef KAB_EMBEDDED
-#include "kcmkabconfig.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kcmkabconfig.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/keywidget.cpp b/kaddressbook/keywidget.cpp
index c117d34..8ebee19 100644
--- a/kaddressbook/keywidget.cpp
+++ b/kaddressbook/keywidget.cpp
@@ -1,87 +1,89 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qfile.h>
#include <qinputdialog.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#include <kio/netaccess.h>
#include <kmessagebox.h>
#else //KAB_EMBEDDED
#include <qmap.h>
#include <qmessagebox.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <kurl.h>
#endif //KAB_EMBEDDED
#include <kapplication.h>
#include <kcombobox.h>
#include <kdialog.h>
#include <kfiledialog.h>
#include <klocale.h>
#include <ktempfile.h>
#include "keywidget.h"
KeyWidget::KeyWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QGridLayout *layout = new QGridLayout( this, 2, 2, KDialog::marginHint(),
+ Q3GridLayout *layout = new Q3GridLayout( this, 2, 2, KDialog::marginHint(),
KDialog::spacingHint() );
QLabel *label = new QLabel( i18n( "Keys:" ), this );
layout->addWidget( label, 0, 0 );
mKeyCombo = new KComboBox( this );
layout->addWidget( mKeyCombo, 0, 1 );
mAddButton = new QPushButton( i18n( "Add" ), this );
layout->addWidget( mAddButton, 1, 0 );
mRemoveButton = new QPushButton( i18n( "Remove" ), this );
mRemoveButton->setEnabled( false );
layout->addWidget( mRemoveButton, 1, 1 );
mExportButton = new QPushButton( i18n( "Export" ), this );
mExportButton->setEnabled( false );
layout->addMultiCellWidget( mExportButton, 2, 2, 0, 1 );
connect( mAddButton, SIGNAL( clicked() ), SLOT( addKey() ) );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeKey() ) );
connect( mExportButton, SIGNAL( clicked() ), SLOT( exportKey() ) );
}
KeyWidget::~KeyWidget()
{
}
void KeyWidget::setKeys( const KABC::Key::List &list )
{
mKeyList = list;
@@ -107,171 +109,171 @@ void KeyWidget::addKey()
KABC::Key::TypeList typeList = KABC::Key::typeList();
KABC::Key::TypeList::Iterator it;
for ( it = typeList.begin(); it != typeList.end(); ++it ) {
if ( (*it) != KABC::Key::Custom &&
!existingKeyTypes.contains( KABC::Key::typeLabel( *it ) ) ) {
keyMap.insert( KABC::Key::typeLabel( *it ), *it );
keyTypeNames.append( KABC::Key::typeLabel( *it ) );
}
}
bool ok;
QString name = QInputDialog::getItem( i18n( "Key type" ), i18n( "Select the key type." ), keyTypeNames, 0, true, &ok );
if ( !ok || name.isEmpty() )
return;
int type = keyMap[ name ];
if ( !keyTypeNames.contains( name ) )
type = KABC::Key::Custom;
#ifndef KAB_EMBEDDED
KURL url = KFileDialog::getOpenURL();
if ( url.isEmpty() )
return;
QString tmpFile;
if ( KIO::NetAccess::download( url, tmpFile ) ) {
QFile file( tmpFile );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) );
KMessageBox::error( this, text.arg( url.url() ) );
return;
}
#else //KAB_EMBEDDED
QString keyfile = KFileDialog::getOpenFileName( "huhu",
"Select Key", this );
if ( keyfile.isEmpty() )
return;
{
QFile file( keyfile );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) );
QString caption( i18n( "Error" ) );
QMessageBox::critical( this, caption, text.arg( keyfile ) );
return;
}
#endif //KAB_EMBEDDED
- QTextStream s( &file );
+ Q3TextStream s( &file );
QString data;
- s.setEncoding( QTextStream::UnicodeUTF8 );
+ s.setEncoding( Q3TextStream::UnicodeUTF8 );
s >> data;
file.close();
KABC::Key key( data, type );
if ( type == KABC::Key::Custom )
key.setCustomTypeString( name );
mKeyList.append( key );
emit changed();
#ifndef KAB_EMBEDDED
KIO::NetAccess::removeTempFile( tmpFile );
#endif //KAB_EMBEDDED
}
updateKeyCombo();
}
void KeyWidget::removeKey()
{
int pos = mKeyCombo->currentItem();
if ( pos == -1 )
return;
QString type = mKeyCombo->currentText();
QString text = i18n( "<qt>Do you really want to remove the key <b>%1</b>?</qt>" );
#ifndef KAB_EMBEDDED
if ( KMessageBox::questionYesNo( this, text.arg( type ) ) == KMessageBox::No )
return;
#else //KAB_EMBEDDED
QString caption = i18n( "Confirm Delete" );
if (QMessageBox::information( this, caption,
text.arg( type ),
i18n("Yes!"), i18n("No"), 0, 0 ) == 1)
return;
#endif //KAB_EMBEDDED
mKeyList.remove( mKeyList.at( pos ) );
emit changed();
updateKeyCombo();
}
void KeyWidget::exportKey()
{
KABC::Key key = (*mKeyList.at( mKeyCombo->currentItem() ) );
#ifndef KAB_EMBEDDED
KURL url = KFileDialog::getSaveURL();
KTempFile tempFile;
- QTextStream *s = tempFile.textStream();
- s->setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream *s = tempFile.textStream();
+ s->setEncoding( Q3TextStream::UnicodeUTF8 );
(*s) << key.textData();
tempFile.close();
KIO::NetAccess::upload( tempFile.name(), url, kapp->mainWidget() );
#else //KAB_EMBEDDED
QString keyfile = KFileDialog::getSaveFileName( "huhu",
"Save Key", this );
if ( keyfile.isEmpty() )
return;
QFile file( keyfile );
- if ( !file.open( IO_ReadWrite ) ) {
+ if ( !file.open( QIODevice::ReadWrite ) ) {
QString text( i18n( "<qt>Unable to open file <b>%1</b>.</qt>" ) );
QString caption( i18n( "Error" ) );
QMessageBox::critical( this, caption, text.arg( keyfile ) );
return;
}
- QTextStream s( &file );
- s.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream s( &file );
+ s.setEncoding( Q3TextStream::UnicodeUTF8 );
s << key.textData();
file.close();
#endif //KAB_EMBEDDED
}
void KeyWidget::updateKeyCombo()
{
int pos = mKeyCombo->currentItem();
mKeyCombo->clear();
KABC::Key::List::Iterator it;
for ( it = mKeyList.begin(); it != mKeyList.end(); ++it ) {
if ( (*it).type() == KABC::Key::Custom )
mKeyCombo->insertItem( (*it).customTypeString() );
else
mKeyCombo->insertItem( KABC::Key::typeLabel( (*it).type() ) );
}
mKeyCombo->setCurrentItem( pos );
bool state = ( mKeyList.count() != 0 );
mRemoveButton->setEnabled( state );
mExportButton->setEnabled( state );
}
-#ifndef KAB_EMBEDDED
-#include "keywidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_keywidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 2f3531d..e373105 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,64 +1,63 @@
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <qcopchannel_qws.h>
#include <stdlib.h>
#else
#include <qapplication.h>
#include <qwindowsstyle.h>
-#include <qplatinumstyle.h>
-#include <qmainwindow.h>
+#include <q3mainwindow.h>
#include <qmessagebox.h>
#include <stdlib.h>
#endif
#include <qtextcodec.h>
#include <kstandarddirs.h>
#include <qregexp.h>
#include <kglobal.h>
#include <stdio.h>
#include <qdir.h>
#include "kabprefs.h"
#include "kaddressbookmain.h"
#include "externalapphandler.h"
#include <libkdepim/kpimglobalprefs.h>
void dumpMissing();
int main( int argc, char **argv )
{
+ if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi");
#ifndef DESKTOP_VERSION
QPEApplication a( argc, argv );
a.setKeepRunning ();
#else
QApplication a( argc, argv );
- QApplication::setStyle( new QPlatinumStyle ());
#ifdef _WIN32_
QString hdir ( getenv( "HOME") );
if ( hdir.isEmpty() ) {
QString hd ("C:/" );
//QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
if ( QDir::homeDirPath().lower() == hd.lower() ) {
_putenv( "HOME=C:");
//QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
}
} else {
QDir app_dir;
if ( !app_dir.exists(hdir) )
app_dir.mkdir (hdir);
}
#endif
#endif
bool exitHelp = false;
if ( argc > 1 ) {
QString command = argv[1];
if ( command == "-help" ){
printf("KA/E command line commands:\n");
printf(" no command: Start KA/E in usual way\n");
printf(" -help: This output\n");
printf(" KA/E is exiting now. Bye!\n");
exitHelp = true;
}
}
if ( ! exitHelp ) {
KGlobal::setAppName( "kaddressbook" );
#ifndef DESKTOP_VERSION
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index 199f3d6..96822d8 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -1,92 +1,94 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qlabel.h>
-#include <qlistbox.h>
-#include <qlistview.h>
+#include <q3listbox.h>
+#include <q3listview.h>
#include <qtooltip.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#ifndef KAB_EMBEDDED
#include <kaccelmanager.h>
#else //KAB_EMBEDDED
#include <kstandarddirs.h>
#endif //KAB_EMBEDDED
#include <kapplication.h>
#include <kbuttonbox.h>
#include <kconfig.h>
#include <klineedit.h>
#include <klistview.h>
#include <kcombobox.h>
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include "nameeditdialog.h"
NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
QWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel,
Ok, parent, name, true )
{
QWidget *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 5, 3 );
+ Q3GridLayout *layout = new Q3GridLayout( page, 5, 3 );
layout->setSpacing( spacingHint() );
layout->addColSpacing( 2, 100 );
QLabel *label;
label = new QLabel( i18n( "Honorific prefixes:" ), page );
layout->addWidget( label, 0, 0 );
mPrefixCombo = new KComboBox( page );
mPrefixCombo->setDuplicatesEnabled( false );
mPrefixCombo->setEditable( true );
label->setBuddy( mPrefixCombo );
layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 );
label = new QLabel( i18n( "Given name:" ), page );
layout->addWidget( label, 1, 0 );
mGivenNameEdit = new KLineEdit( page );
label->setBuddy( mGivenNameEdit );
layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 );
label = new QLabel( i18n( "Additional names:" ), page );
layout->addWidget( label, 2, 0 );
mAdditionalNameEdit = new KLineEdit( page );
label->setBuddy( mAdditionalNameEdit );
layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 );
label = new QLabel( i18n( "Family names:" ), page );
layout->addWidget( label, 3, 0 );
mFamilyNameEdit = new KLineEdit( page );
label->setBuddy( mFamilyNameEdit );
layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 );
label = new QLabel( i18n( "Honorific suffixes:" ), page );
layout->addWidget( label, 4, 0 );
@@ -266,35 +268,35 @@ void NameEditDialog::modified()
mChanged = true;
}
void NameEditDialog::updateTypeCombo()
{
KABC::Addressee addr;
addr.setPrefix( mPrefixCombo->currentText() );
addr.setGivenName( mGivenNameEdit->text() );
addr.setAdditionalName( mAdditionalNameEdit->text() );
addr.setFamilyName( mFamilyNameEdit->text() );
addr.setSuffix( mSuffixCombo->currentText() );
int pos = mFormattedNameCombo->currentItem();
mFormattedNameCombo->clear();
mFormattedNameCombo->insertItem( i18n( "Custom" ) );
mFormattedNameCombo->insertItem( formattedName( addr, SimpleName ) );
mFormattedNameCombo->insertItem( formattedName( addr, FullName ) );
mFormattedNameCombo->insertItem( formattedName( addr, ReverseName ) );
mFormattedNameCombo->setCurrentItem( pos );
}
void NameEditDialog::slotHelp()
{
#ifndef KAB_EMBEDDED
kapp->invokeHelp( "managing-contacts-automatic-nameparsing" );
#else //KAB_EMBEDDED
qDebug("NameEditDialog::slotHelp Help is not supported yet");
#endif //KAB_EMBEDDED
}
-#ifndef KAB_EMBEDDED
-#include "nameeditdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_nameeditdialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/old_mainwindow.cpp b/kaddressbook/old_mainwindow.cpp
index 0e886d9..7a445c7 100644
--- a/kaddressbook/old_mainwindow.cpp
+++ b/kaddressbook/old_mainwindow.cpp
@@ -287,71 +287,71 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
mView->viewManager()->showWhatsNextView();
}
}
showMaximized();
raise();
*/
}
QPixmap MainWindow::loadPixmap( QString name )
{
return KGlobal::iconLoader().loadPixmap( name );
/*US use the advanced version of the iconloader
#ifdef DESKTOP_VERSION
QPixmap pixmapLoader;
QString file;
file = QDir::homeDirPath()+"/kaddressbook/pics/" + name+".png";
//qDebug("pixmap name %s ", file.latin1());
pixmapLoader.load( file );
return pixmapLoader;
#else
return Resource::loadPixmap( name );
#endif
*/
}
void MainWindow::initActions()
{
iconToolBar->clear();
KABPrefs *p = KABPrefs::instance();
QPEMenuBar *menuBar1 = new QPEMenuBar( iconToolBar );
- QPopupMenu *menuBar = new QPopupMenu( this );
+ Q3PopupMenu *menuBar = new Q3PopupMenu( this );
menuBar1->insertItem( "ME", menuBar);
- QPopupMenu *fileMenu = new QPopupMenu( this );
- QPopupMenu *editMenu = new QPopupMenu( this );
- QPopupMenu *viewMenu = new QPopupMenu( this );
- QPopupMenu *settingsMenu = new QPopupMenu( this );
- QPopupMenu *importMenu = new QPopupMenu( this );
+ Q3PopupMenu *fileMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *editMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *viewMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *settingsMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *importMenu = new Q3PopupMenu( this );
menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
QIconSet icon;
icon = loadPixmap( pathString + "newtodo" );
configureToolBarMenu->insertItem(icon, "New todo", 20 );
QAction* nt_action = new QAction( "New Todo", icon, "New Todo...", 0, this );
nt_action->addTo( actionMenu );
connect( nt_action, SIGNAL( activated() ),
mView, SLOT( newTodo() ) );
/*
QAction *action;
QIconSet icon;
// QPopupMenu *configureMenu= new QPopupMenu( menuBar );
configureToolBarMenu = new QPopupMenu( this );
configureToolBarMenu->setCheckable( true );
#ifdef DESKTOP_VERSION
QString pathString = "";
#else
QString pathString = "kaddressbook/";
#endif
if ( QApplication::desktop()->width() < 480 )
pathString += "icons16/";
configureAgendaMenu = new QPopupMenu( menuBar );
configureAgendaMenu->setCheckable( true );
configureAgendaMenu->insertItem("Toggle Allday", 1 );
configureAgendaMenu->insertSeparator();
configureAgendaMenu->insertItem("Tiny", 4 );
configureAgendaMenu->insertItem("Small", 6 );
diff --git a/kaddressbook/phoneeditwidget.cpp b/kaddressbook/phoneeditwidget.cpp
index df3b551..3661677 100644
--- a/kaddressbook/phoneeditwidget.cpp
+++ b/kaddressbook/phoneeditwidget.cpp
@@ -1,125 +1,131 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qlabel.h>
#include <qtooltip.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qstring.h>
-#include <qlistbox.h>
-#include <qlistview.h>
-#include <qbuttongroup.h>
-#include <qhbox.h>
+#include <q3listbox.h>
+#include <q3listview.h>
+#include <q3buttongroup.h>
+#include <q3hbox.h>
#include <qcursor.h>
#include <qtimer.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
#include <kbuttonbox.h>
#include <klistview.h>
#include <kapplication.h>
#include <qapplication.h>
#include <kconfig.h>
#include <kmessagebox.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <klocale.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kabc/phonenumber.h>
#include "typecombo.h"
#include "phoneeditwidget.h"
PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
: QWidget(parent,name)
{
- QGridLayout* gridLayout = new QGridLayout ( this, 2,2 );
+ Q3GridLayout* gridLayout = new Q3GridLayout ( this, 2,2 );
QLabel *temp = new QLabel( "", this );
temp->setAlignment( Qt::AlignCenter );
temp->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
QPushButton *addBut = new QPushButton ( "add", this );
addBut->setPixmap ( SmallIcon("plus"));
addBut->setMaximumSize( addBut->sizeHint().height(),addBut->sizeHint().height() );
connect(addBut,SIGNAL(clicked ()),SLOT(addNumber()));
- sv = new QScrollView( this );
- sv->setFrameStyle ( QFrame::Plain );
+ sv = new Q3ScrollView( this );
+ sv->setFrameStyle ( Q3Frame::Plain );
sv->setLineWidth ( 0 );
sv->setMidLineWidth ( 0 );
mw = new QWidget ( sv->viewport() );
sv->addChild(mw);
- sv->setResizePolicy( QScrollView::AutoOneFit );
- mainLayout = new QVBoxLayout ( mw );
+ sv->setResizePolicy( Q3ScrollView::AutoOneFit );
+ mainLayout = new Q3VBoxLayout ( mw );
mainLayout->setMargin( 0 );
mainLayout->setSpacing( 0 );
gridLayout->setMargin( 2 );
gridLayout->setSpacing( 4 );
if ( QApplication::desktop()->width() == 240 || QApplication::desktop()->width() == 480 ) {
gridLayout->addWidget( addBut, 0, 0 );
gridLayout->addWidget( temp, 0, 1 );
gridLayout->addMultiCellWidget( sv, 1,1 , 0,1 );
} else {
gridLayout->addWidget( temp, 1, 0 );
gridLayout->addWidget( addBut, 0, 0 );
gridLayout->addMultiCellWidget( sv, 0, 1, 1,1 );
}
setDefaults();
mTypeNumberEditList.setAutoDelete( true );
- mPopup = new QPopupMenu( this );
+ mPopup = new Q3PopupMenu( this );
QStringList list = PhoneNumber::supportedTypeListNames();
mPopupCount = list.count();
int i = 0;
while ( i < mPopupCount ) {
mPopup->insertItem( list[ i ], i );
++i;
}
connect(mPopup,SIGNAL(activated(int)),this,SLOT(addNumberInt( int)));
}
PhoneEditWidget::~PhoneEditWidget()
{
}
void PhoneEditWidget::setDefaults()
{
mTypeNumberEditList.clear();
PhoneTypeNumberEdit* edit = appendEditCombo();
KABC::PhoneNumber phoneNumber;
phoneNumber.setType( KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref );
edit->setPhoneNumber( phoneNumber );
edit = appendEditCombo();
KABC::PhoneNumber phoneNumber2;
phoneNumber2.setType( KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref );
edit->setPhoneNumber( phoneNumber2 );
edit = appendEditCombo();
KABC::PhoneNumber phoneNumber3;
phoneNumber3.setType( KABC::PhoneNumber::Cell );
edit->setPhoneNumber( phoneNumber3 );
}
void PhoneEditWidget::addNumberInt( int index )
@@ -197,75 +203,75 @@ void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &li )
}
++i;
}
for ( it = list2.begin(); it != list2.end(); ++it ) {
if ( (*it).type() == tList[ max-1 ] )
list.append( (*it ) );
}
for ( it = list.begin(); it != list.end(); ++it ) {
PhoneTypeNumberEdit* editNew = appendEditCombo();
editNew->setPhoneNumber( (*it ) );
}
}
KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
{
KABC::PhoneNumber::List retList;
PhoneTypeNumberEdit* edit = mTypeNumberEditList.first();
while ( edit ) {
if ( edit->isValid() ) {
retList.append( edit->phoneNumber());
}
edit = mTypeNumberEditList.next();
}
return retList;
}
#if 0
PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QGridLayout *layout = new QGridLayout( this, 4, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( this, 4, 1 );
//US layout->setSpacing( KDialog::spacingHint() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel* label = new QLabel( this );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
- label->setAlignment( AlignCenter );
+ label->setAlignment( Qt::AlignCenter );
//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
layout->addWidget( label, 0, 0 );
QPushButton *editButton = new QPushButton( i18n( "Edit Phone Numbers..." ),
this );
if ( QApplication::desktop()->width() < 640 )
layout->addWidget( editButton, 0, 1 );
else
layout->addMultiCellWidget( editButton, 0, 0, 1, 3);
mPrefCombo = new PhoneTypeCombo( mPhoneList, this );
mPrefEdit = new KLineEdit( this );
//mPrefEdit->setMinimumWidth( int(mPrefEdit->sizeHint().width() * 1.5) );
mPrefCombo->setLineEdit( mPrefEdit );
layout->addWidget( mPrefCombo, 1, 0 );
layout->addWidget( mPrefEdit, 1, 1 );
int x = 1, y = 2;
if ( QApplication::desktop()->width() < 640 ) {
++x;
y = 0;
}
mSecondCombo = new PhoneTypeCombo( mPhoneList, this );
mSecondEdit = new KLineEdit( this );
mSecondCombo->setLineEdit( mSecondEdit );
layout->addWidget( mSecondCombo, x, y++ );
layout->addWidget( mSecondEdit, x, y++ );
y = 0;
++x;
mThirdCombo = new PhoneTypeCombo( mPhoneList, this );
mThirdEdit = new KLineEdit( this );
mThirdCombo->setLineEdit( mThirdEdit );
@@ -298,75 +304,75 @@ PhoneEditWidget::PhoneEditWidget( QWidget *parent, const char *name )
connect( mPrefEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotPrefEditChanged() ) );
connect( mSecondEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotSecondEditChanged() ) );
connect( mThirdEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotThirdEditChanged() ) );
connect( mFourthEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( slotFourthEditChanged() ) );
connect( editButton, SIGNAL( clicked() ), SLOT( edit() ) );
connect( mPrefCombo, SIGNAL( activated( int ) ),
SLOT( updatePrefEdit() ) );
connect( mSecondCombo, SIGNAL( activated( int ) ),
SLOT( updateSecondEdit() ) );
connect( mThirdCombo, SIGNAL( activated( int ) ),
SLOT( updateThirdEdit() ) );
connect( mFourthCombo, SIGNAL( activated( int ) ),
SLOT( updateFourthEdit() ) );
}
PhoneEditWidget::~PhoneEditWidget()
{
}
void PhoneEditWidget::setPhoneNumbers( const KABC::PhoneNumber::List &list )
{
mPhoneList.clear();
// Insert types for existing numbers.
mPrefCombo->insertTypeList( list );
- QValueList<int> defaultTypes;
+ Q3ValueList<int> defaultTypes;
defaultTypes << KABC::PhoneNumber::Home;
defaultTypes << KABC::PhoneNumber::Work;
defaultTypes << KABC::PhoneNumber::Cell;
defaultTypes << ( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax );
defaultTypes << ( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax );
// Insert default types.
// Doing this for mPrefCombo is enough because the list is shared by all
// combos.
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int>::ConstIterator it;
for( it = defaultTypes.begin(); it != defaultTypes.end(); ++it ) {
if ( !mPrefCombo->hasType( *it ) )
mPrefCombo->insertType( list, *it, PhoneNumber( "", *it ) );
}
updateCombos();
mPrefCombo->selectType( defaultTypes[ 0 ] );
mSecondCombo->selectType( defaultTypes[ 1 ] );
mThirdCombo->selectType( defaultTypes[ 2 ] );
mFourthCombo->selectType( defaultTypes[ 3 ] );
updateLineEdits();
}
void PhoneEditWidget::updateLineEdits()
{
updatePrefEdit();
updateSecondEdit();
updateThirdEdit();
updateFourthEdit();
}
void PhoneEditWidget::updateCombos()
{
mPrefCombo->updateTypes();
mSecondCombo->updateTypes();
mThirdCombo->updateTypes();
mFourthCombo->updateTypes();
}
KABC::PhoneNumber::List PhoneEditWidget::phoneNumbers()
@@ -458,274 +464,274 @@ void PhoneEditWidget::slotFourthEditChanged()
}
void PhoneEditWidget::updatePhoneNumber( PhoneTypeCombo *combo )
{
QLineEdit *edit = combo->lineEdit();
if ( !edit ) return;
PhoneNumber::List::Iterator it = combo->selectedElement();
if ( it != mPhoneList.end() ) {
(*it).setNumber( edit->text() );
}
updateOtherEdit( combo, mPrefCombo );
updateOtherEdit( combo, mSecondCombo );
updateOtherEdit( combo, mThirdCombo );
updateOtherEdit( combo, mFourthCombo );
emit modified();
}
void PhoneEditWidget::updateOtherEdit( PhoneTypeCombo *combo, PhoneTypeCombo *otherCombo )
{
if ( combo == otherCombo ) return;
if ( combo->currentItem() == otherCombo->currentItem() ) {
updateEdit( otherCombo );
}
}
///////////////////////////////////////////
// PhoneEditDialog
-class PhoneViewItem : public QListViewItem
+class PhoneViewItem : public Q3ListViewItem
{
public:
- PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number );
+ PhoneViewItem( Q3ListView *parent, const KABC::PhoneNumber &number );
void setPhoneNumber( const KABC::PhoneNumber &number )
{
mPhoneNumber = number;
makeText();
}
QString key() { return mPhoneNumber.id(); }
QString country() { return ""; }
QString region() { return ""; }
QString number() { return ""; }
KABC::PhoneNumber phoneNumber() { return mPhoneNumber; }
private:
void makeText();
KABC::PhoneNumber mPhoneNumber;
};
-PhoneViewItem::PhoneViewItem( QListView *parent, const KABC::PhoneNumber &number )
- : QListViewItem( parent ), mPhoneNumber( number )
+PhoneViewItem::PhoneViewItem( Q3ListView *parent, const KABC::PhoneNumber &number )
+ : Q3ListViewItem( parent ), mPhoneNumber( number )
{
#ifdef DESKTOP_VERSION
setRenameEnabled ( 0, true );
#endif
makeText();
}
void PhoneViewItem::makeText()
{
/**
* Will be used in future versions of kaddressbook/libkabc
setText( 0, mPhoneNumber.country() );
setText( 1, mPhoneNumber.region() );
setText( 2, mPhoneNumber.number() );
setText( 3, mPhoneNumber.typeLabel() );
*/
setText( 0, mPhoneNumber.number() );
setText( 1, mPhoneNumber.typeLabel() );
}
PhoneEditDialog::PhoneEditDialog( const KABC::PhoneNumber::List &list, QWidget *parent, const char *name )
: KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Numbers" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name, true)
{
mPhoneNumberList = list;
QWidget *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 1, 2 );
+ Q3GridLayout *layout = new Q3GridLayout( page, 1, 2 );
layout->setSpacing( spacingHint() );
mListView = new KListView( page );
mListView->setAllColumnsShowFocus( true );
mListView->addColumn( i18n( "Number" ) );
mListView->addColumn( i18n( "Type" ) );
- KButtonBox *buttonBox = new KButtonBox( page, Vertical );
+ KButtonBox *buttonBox = new KButtonBox( page, Qt::Vertical );
buttonBox->addButton( i18n( "&Add..." ), this, SLOT( slotAddPhoneNumber() ) );
mEditButton = buttonBox->addButton( i18n( "&Edit..." ), this, SLOT( slotEditPhoneNumber() ) );
mEditButton->setEnabled( false );
mRemoveButton = buttonBox->addButton( i18n( "&Remove" ), this, SLOT( slotRemovePhoneNumber() ) );
mRemoveButton->setEnabled( false );
buttonBox->layout();
layout->addWidget( mListView, 0, 0 );
layout->addWidget( buttonBox, 0, 1 );
connect( mListView, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged()) );
- connect( mListView, SIGNAL(doubleClicked( QListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber()));
+ connect( mListView, SIGNAL(doubleClicked( Q3ListViewItem *, const QPoint &, int )), this, SLOT( slotEditPhoneNumber()));
KABC::PhoneNumber::List::Iterator it;
for ( it = mPhoneNumberList.begin(); it != mPhoneNumberList.end(); ++it )
new PhoneViewItem( mListView, *it );
if (QApplication::desktop()->width() < 480 )
showMaximized();
else
resize( 400, 400 );
mChanged = false;
}
PhoneEditDialog::~PhoneEditDialog()
{
qDebug("PhoneEditDialog::~PhoneEditDialog() ");
}
void PhoneEditDialog::slotAddPhoneNumber()
{
KABC::PhoneNumber tmp( "", 0 );
PhoneTypeDialog dlg( tmp, this );
if ( dlg.exec() ) {
- QListViewItem* i = mListView->firstChild();
+ Q3ListViewItem* i = mListView->firstChild();
KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
bool insert = true;
while ( i ) {
PhoneViewItem* p = ( PhoneViewItem* ) i;
KABC::PhoneNumber pn = p->phoneNumber();
if ( (pn.type() | KABC::PhoneNumber::Pref) == (phoneNumber.type() | KABC::PhoneNumber::Pref) ) {
if ( p->text(0).isEmpty()) {
p->setPhoneNumber( phoneNumber );
mPhoneNumberList.remove( pn );
mPhoneNumberList.append( phoneNumber );
insert = false;
break;
}
}
i = i->nextSibling();
}
if ( insert ) {
mPhoneNumberList.append( phoneNumber );
new PhoneViewItem( mListView, phoneNumber );
}
mChanged = true;
}
}
void PhoneEditDialog::slotRemovePhoneNumber()
{
PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
if ( !item )
return;
mPhoneNumberList.remove( item->phoneNumber() );
- QListViewItem *currItem = mListView->currentItem();
+ Q3ListViewItem *currItem = mListView->currentItem();
mListView->takeItem( currItem );
delete currItem;
mChanged = true;
}
void PhoneEditDialog::slotEditPhoneNumber()
{
PhoneViewItem *item = static_cast<PhoneViewItem*>( mListView->currentItem() );
if ( !item )
return;
PhoneTypeDialog dlg( item->phoneNumber(), this );
if ( dlg.exec() ) {
slotRemovePhoneNumber();
KABC::PhoneNumber phoneNumber = dlg.phoneNumber();
mPhoneNumberList.append( phoneNumber );
new PhoneViewItem( mListView, phoneNumber );
mChanged = true;
}
}
void PhoneEditDialog::slotSelectionChanged()
{
bool state = ( mListView->currentItem() != 0 );
mRemoveButton->setEnabled( state );
mEditButton->setEnabled( state );
}
const KABC::PhoneNumber::List &PhoneEditDialog::phoneNumbers()
{
return mPhoneNumberList;
}
bool PhoneEditDialog::changed() const
{
return mChanged;
}
///////////////////////////////////////////
// PhoneTypeDialog
PhoneTypeDialog::PhoneTypeDialog( const KABC::PhoneNumber &phoneNumber,
QWidget *parent, const char *name)
: KDialogBase( KDialogBase::Plain, i18n( "Edit Phone Number" ),
KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok,
parent, name, true), mPhoneNumber( phoneNumber )
{
QWidget *page = plainPage();
QLabel *label = 0;
- QGridLayout *layout = new QGridLayout( page, 3, 2, marginHint(), spacingHint() );
+ Q3GridLayout *layout = new Q3GridLayout( page, 3, 2, marginHint(), spacingHint() );
label = new QLabel( i18n( "Number:" ), page );
layout->addWidget( label, 0, 0 );
mNumber = new KLineEdit( page );
layout->addWidget( mNumber, 0, 1 );
mPreferredBox = new QCheckBox( i18n( "This is the preferred phone number" ), page );
layout->addMultiCellWidget( mPreferredBox, 1, 1, 0, 1 );
- mGroup = new QButtonGroup( 2, Horizontal, i18n( "Types" ), page );
+ mGroup = new Q3ButtonGroup( 2, Qt::Horizontal, i18n( "Types" ), page );
layout->addMultiCellWidget( mGroup, 2, 2, 0, 1 );
// fill widgets
mNumber->setText( mPhoneNumber.number() );
mTypeList = KABC::PhoneNumber::typeList();
mTypeList.remove( KABC::PhoneNumber::Pref );
KABC::PhoneNumber::TypeList::Iterator it;
for ( it = mTypeList.begin(); it != mTypeList.end(); ++it )
new QCheckBox( KABC::PhoneNumber::typeLabel( *it ), mGroup );
for ( int i = 0; i < mGroup->count(); ++i ) {
int type = mPhoneNumber.type();
QCheckBox *box = (QCheckBox*)mGroup->find( i );
box->setChecked( type & mTypeList[ i ] );
}
mPreferredBox->setChecked( mPhoneNumber.type() & KABC::PhoneNumber::Pref );
mNumber->setFocus();
mNumber->setSelection( 0, 1024);
}
KABC::PhoneNumber PhoneTypeDialog::phoneNumber()
{
mPhoneNumber.setNumber( mNumber->text() );
int type = 0;
for ( int i = 0; i < mGroup->count(); ++i ) {
QCheckBox *box = (QCheckBox*)mGroup->find( i );
if ( box->isChecked() )
type += mTypeList[ i ];
}
if ( mPreferredBox->isChecked() )
mPhoneNumber.setType( type | KABC::PhoneNumber::Pref );
else
mPhoneNumber.setType( type & ~KABC::PhoneNumber::Pref );
return mPhoneNumber;
}
#endif
-#ifndef KAB_EMBEDDED
-#include "phoneeditwidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_phoneeditwidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/phoneeditwidget.h b/kaddressbook/phoneeditwidget.h
index 5bb4226..2be3e2b 100644
--- a/kaddressbook/phoneeditwidget.h
+++ b/kaddressbook/phoneeditwidget.h
@@ -1,137 +1,141 @@
#ifndef PHONEEDITWIDGET_H
#define PHONEEDITWIDGET_H
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kdialogbase.h>
#include <kiconloader.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qapplication.h>
+#include <QDesktopWidget>
-#include <qptrlist.h>
-#include <qscrollview.h>
+#include <q3ptrlist.h>
+#include <q3scrollview.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include "addresseeconfig.h"
#include "typecombo.h"
-class QButtonGroup;
+class Q3ButtonGroup;
class QCheckBox;
class PhoneTypeNumberEdit;
#include <klineedit.h>
#include <kcombobox.h>
#include <kabc/phonenumber.h>
typedef TypeCombo<KABC::PhoneNumber> PhoneTypeCombo;
/**
Widget for editing phone numbers.
*/
class PhoneEditWidget : public QWidget
{
Q_OBJECT
public:
PhoneEditWidget( QWidget *parent, const char *name = 0 );
~PhoneEditWidget();
void setPhoneNumbers( const KABC::PhoneNumber::List &list );
KABC::PhoneNumber::List phoneNumbers();
// void updateTypeCombo( const KABC::PhoneNumber::List&, KComboBox* );
//KABC::PhoneNumber currentPhoneNumber( KComboBox*, int );
signals:
void modified();
void typeChange( int oldType, int newType );
private slots:
void bottomVisible();
void addNumberInt( int );
void deleteEdit( PhoneTypeNumberEdit* ew );
void addNumber();
void pendingDelete();
protected:
private:
- QScrollView* sv;
- QPopupMenu *mPopup;
+ Q3ScrollView* sv;
+ Q3PopupMenu *mPopup;
int mPopupCount;
PhoneTypeNumberEdit* mPendingDelete;
void setDefaults();
PhoneTypeNumberEdit* appendEditCombo();
QWidget* mw;
- QVBoxLayout* mainLayout;
- QPtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
+ Q3VBoxLayout* mainLayout;
+ Q3PtrList <PhoneTypeNumberEdit> mTypeNumberEditList;
};
class PhoneTypeNumberEdit : public QWidget
{
Q_OBJECT
public:
PhoneTypeNumberEdit( QWidget *parent, const char *name = 0 ) :QWidget( parent )
{
- QHBoxLayout * lay = new QHBoxLayout( this );
+ Q3HBoxLayout * lay = new Q3HBoxLayout( this );
lay->setSpacing( 2 );
lay->setMargin( 0 );
mMinusButton = new QPushButton ( this );
mMinusButton->setPixmap ( SmallIcon("minus"));
mCombo = new KComboBox( this );
if ( QApplication::desktop()->width() <= 640 )
- mCombo->setSizeLimit ( 6 );
+ mCombo->setMaxVisibleItems ( 6 );
mNumber = new KLineEdit( this );
mMinusButton->setMaximumHeight( mNumber->sizeHint().height() + 6);
lay->addWidget( mMinusButton );
lay->addWidget( mCombo );
lay->addWidget( mNumber );
connect( mMinusButton , SIGNAL ( clicked() ), this, SLOT ( deleteNumber() ) );
connect( mCombo , SIGNAL ( activated ( int ) ), this, SLOT ( comboTypeChange( int ) ) );
connect( mNumber , SIGNAL ( textChanged ( const QString & ) ),
this, SLOT ( textChanged ( const QString & ) ) );
mCombo->insertStringList( PhoneNumber::supportedTypeListNames() );
}
~PhoneTypeNumberEdit() {
// qDebug("~PhoneTypeNumberEdit() ");
}
void setPhoneNumber( const KABC::PhoneNumber &phoneNumber )
{
mPhoneNumber = phoneNumber;
int index = PhoneNumber::typeListIndex4Type( mPhoneNumber.type() );
mCombo->setCurrentItem( index );
mNumber->setText( mPhoneNumber.number() );
show();
mNumber->setFocus();
}
KABC::PhoneNumber phoneNumber()
{
mPhoneNumber.setNumber( mNumber->text() );
int index = mCombo->currentItem();
mPhoneNumber.setType( PhoneNumber::supportedTypeList()[index] );
return mPhoneNumber;
}
bool isValid()
{
diff --git a/kaddressbook/secrecywidget.cpp b/kaddressbook/secrecywidget.cpp
index 4a2acc8..1c237c0 100644
--- a/kaddressbook/secrecywidget.cpp
+++ b/kaddressbook/secrecywidget.cpp
@@ -1,70 +1,72 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kabc/secrecy.h>
#include <kcombobox.h>
#include <kdialog.h>
#include "secrecywidget.h"
SecrecyWidget::SecrecyWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QVBoxLayout *layout = new QVBoxLayout( this, KDialog::marginHint(),
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this, KDialog::marginHint(),
KDialog::spacingHint() );
mSecrecyCombo = new KComboBox( this );
layout->addWidget( mSecrecyCombo );
KABC::Secrecy::TypeList list = KABC::Secrecy::typeList();
KABC::Secrecy::TypeList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it )
mSecrecyCombo->insertItem( KABC::Secrecy::typeLabel( *it ), *it );
connect( mSecrecyCombo, SIGNAL( activated( const QString& ) ),
SIGNAL( changed() ) );
}
SecrecyWidget::~SecrecyWidget()
{
}
void SecrecyWidget::setSecrecy( const KABC::Secrecy &secrecy )
{
//US to avoid an indexoutofbounds error if value is invalid
if (secrecy.isValid())
mSecrecyCombo->setCurrentItem( secrecy.type() );
}
KABC::Secrecy SecrecyWidget::secrecy() const
{
KABC::Secrecy secrecy;
secrecy.setType( mSecrecyCombo->currentItem() );
return secrecy;
}
-#ifndef KAB_EMBEDDED
-#include "secrecywidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_secrecywidget.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/undo.cpp b/kaddressbook/undo.cpp
index 4442087..a6c1580 100644
--- a/kaddressbook/undo.cpp
+++ b/kaddressbook/undo.cpp
@@ -85,35 +85,35 @@ void UndoStack::undo()
RedoStack::instance()->push( command );
}
////////////////////
// RedoStack
RedoStack* RedoStack::instance_ = 0;
RedoStack::RedoStack()
{
mCommandStack.setAutoDelete( true );
}
RedoStack* RedoStack::instance()
{
if (!instance_)
instance_ = new RedoStack();
return instance_;
}
void RedoStack::redo()
{
Command *command;
if (isEmpty())
return;
command = pop();
command->redo();
UndoStack::instance()->push( command );
}
-#ifndef KAB_EMBEDDED
-#include "undo.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_undo.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/undo.h b/kaddressbook/undo.h
index 843bc26..a8ba2ee 100644
--- a/kaddressbook/undo.h
+++ b/kaddressbook/undo.h
@@ -1,95 +1,95 @@
/*
This file is part of KAddressBook.
Copyright (C) 1999 Don Sanders <sanders@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef UNDO_H
#define UNDO_H
#include <qobject.h>
-#include <qptrstack.h>
+#include <q3ptrstack.h>
#include <qstring.h>
class Command
{
public:
Command() {}
virtual ~Command() {};
virtual QString name() = 0;
virtual void redo() = 0; // egcs requires these methods to have
virtual void undo() = 0; // implementations (Seems like a bug)
// pure virtual may not work
};
/** The Undo and Redo stacks now no longer inherit directly from a stack.
* They now contain a stack internally and inherit from StackBase, which
* has a signal for when the stack is modified. This is need to keep
* the edit menu and toolbar up to date.
*
* Really this is a simple observable stack.
*/
class StackBase : public QObject
{
Q_OBJECT
public:
StackBase() : QObject() {}
void push(Command *c);
bool isEmpty();
Command *top();
void clear();
signals:
void changed();
protected:
/** Protect the pop method so users must call undo/redo to properly
* use the stack, however the subclasses need it to modify the stack.
*/
Command *pop();
- QPtrStack<Command> mCommandStack;
+ Q3PtrStack<Command> mCommandStack;
};
class UndoStack : public StackBase
{
public:
static UndoStack *instance();
void undo();
protected:
UndoStack();
static UndoStack* instance_;
};
class RedoStack : public StackBase
{
public:
static RedoStack *instance();
void redo();
protected:
RedoStack();
static RedoStack* instance_;
};
#endif
diff --git a/kaddressbook/undocmds.cpp b/kaddressbook/undocmds.cpp
index 5807dc0..e900b00 100644
--- a/kaddressbook/undocmds.cpp
+++ b/kaddressbook/undocmds.cpp
@@ -1,56 +1,56 @@
/*
This file is part of KAddressBook.
Copyright (C) 1999 Don Sanders <sanders@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <klocale.h>
#include <kdebug.h>
#include <kapplication.h>
#include <kabc/addressbook.h>
#include "addresseeutil.h"
#include "addresseeconfig.h"
#include "kabcore.h"
#include "undocmds.h"
extern bool pasteWithNewUid;
/////////////////////////////////
// PwDelete Methods
PwDeleteCommand::PwDeleteCommand(KABC::AddressBook *doc,
const QStringList &uidList)
: Command(), mDocument(doc), mAddresseeList(), mUidList(uidList)
{
redo();
}
PwDeleteCommand::~PwDeleteCommand()
{
}
QString PwDeleteCommand::name()
{
return i18n( "Delete" );
diff --git a/kaddressbook/viewconfigurefieldspage.cpp b/kaddressbook/viewconfigurefieldspage.cpp
index 5daae1a..7366a0b 100644
--- a/kaddressbook/viewconfigurefieldspage.cpp
+++ b/kaddressbook/viewconfigurefieldspage.cpp
@@ -7,135 +7,139 @@
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KAB_EMBEDDED
#include <kcombobox.h>
#include <qpushbutton.h>
#include <kdebug.h>
#else //KAB_EMBEDDED
#include <qcombobox.h>
#endif //KAB_EMBEDDED
#include <kiconloader.h>
#include <kdialog.h>
#include <klocale.h>
#include <qtoolbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlabel.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3BoxLayout>
#include "viewconfigurefieldspage.h"
-class FieldItem : public QListBoxText
+class FieldItem : public Q3ListBoxText
{
public:
- FieldItem( QListBox *parent, KABC::Field *field )
- : QListBoxText( parent, field->label() ), mField( field ) {}
+ FieldItem( Q3ListBox *parent, KABC::Field *field )
+ : Q3ListBoxText( parent, field->label() ), mField( field ) {}
- FieldItem( QListBox *parent, KABC::Field *field, int index )
- : QListBoxText( parent, field->label(), parent->item( index ) ),
+ FieldItem( Q3ListBox *parent, KABC::Field *field, int index )
+ : Q3ListBoxText( parent, field->label(), parent->item( index ) ),
mField( field ) {}
KABC::Field *field() { return mField; }
private:
KABC::Field *mField;
};
ViewConfigureFieldsPage::ViewConfigureFieldsPage( KABC::AddressBook *ab,
QWidget *parent,
const char *name )
: QWidget( parent, name ), mAddressBook( ab )
{
initGUI();
}
void ViewConfigureFieldsPage::restoreSettings( KConfig *config )
{
KABC::Field::List fields = KABC::Field::restoreFields( config, "KABCFields" );
if ( fields.isEmpty() )
fields = KABC::Field::defaultFields();
KABC::Field::List::ConstIterator it;
for( it = fields.begin(); it != fields.end(); ++it )
new FieldItem( mSelectedBox, *it );
slotShowFields( mCategoryCombo->currentItem() );
}
void ViewConfigureFieldsPage::saveSettings( KConfig *config )
{
KABC::Field::List fields;
for( uint i = 0; i < mSelectedBox->count(); ++i ) {
FieldItem *fieldItem = static_cast<FieldItem *>( mSelectedBox->item( i ) );
fields.append( fieldItem->field() );
}
KABC::Field::saveFields( config, "KABCFields", fields );
}
void ViewConfigureFieldsPage::slotShowFields( int index )
{
int currentPos = mUnSelectedBox->currentItem();
mUnSelectedBox->clear();
int category;
if ( index == 0 ) category = KABC::Field::All;
else category = 1 << ( index - 1 );
KABC::Field::List allFields = mAddressBook->fields( category );
KABC::Field::List::ConstIterator it;
for ( it = allFields.begin(); it != allFields.end(); ++it ) {
- QListBoxItem *item = mSelectedBox->firstItem();
+ Q3ListBoxItem *item = mSelectedBox->firstItem();
while( item ) {
FieldItem *fieldItem = static_cast<FieldItem *>( item );
if ( (*it)->equals( fieldItem->field() ) )
break;
item = item->next();
}
if ( !item )
new FieldItem( mUnSelectedBox, *it );
}
mUnSelectedBox->sort();
mUnSelectedBox->setCurrentItem( currentPos );
}
void ViewConfigureFieldsPage::slotSelect()
{
// insert selected items in the unselected list to the selected list,
// directoy under the current item if selected, or at the bottonm if
// nothing is selected in the selected list
int where = mSelectedBox->currentItem();
//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead.
if ( !(where > -1 && mSelectedBox->item( where )->selected()) )
where = mSelectedBox->count() - 1;
for ( uint i = 0; i < mUnSelectedBox->count(); ++i )
if ( mUnSelectedBox->isSelected( mUnSelectedBox->item( i ) ) ) {
FieldItem *fieldItem = static_cast<FieldItem *>( mUnSelectedBox->item( i ) );
new FieldItem( mSelectedBox, fieldItem->field(), where );
where++;
}
@@ -160,192 +164,192 @@ void ViewConfigureFieldsPage::slotButtonsEnabled()
for( uint i = 0; i < mUnSelectedBox->count(); ++i )
//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead.
if ( mUnSelectedBox->item( i )->selected() ) {
state = true;
break;
}
mAddButton->setEnabled( state );
int j = mSelectedBox->currentItem();
state = ( j > -1 && mSelectedBox->isSelected( j ) );
// up button: enabled if there is a current item > 0 and that is selected
mUpButton->setEnabled( ( j > 0 && state ) );
// down button: enabled if there is a current item < count - 2 and that is selected
mDownButton->setEnabled( ( j > -1 && j < (int)mSelectedBox->count() - 1 && state ) );
// remove button: enabled if any items are selected in the selected list
state = false;
for ( uint i = 0; i < mSelectedBox->count(); ++i )
//US QListBoxItem::isSelected()) is not available in QT 2.x. Use selected instead.
if ( mSelectedBox->item( i )->selected() ) {
state = true;
break;
}
mRemoveButton->setEnabled( state );
}
void ViewConfigureFieldsPage::slotMoveUp()
{
int i = mSelectedBox->currentItem();
if ( i > 0 ) {
- QListBoxItem *item = mSelectedBox->item( i );
+ Q3ListBoxItem *item = mSelectedBox->item( i );
mSelectedBox->takeItem( item );
mSelectedBox->insertItem( item, i - 1 );
mSelectedBox->setCurrentItem( item );
mSelectedBox->setSelected( i - 1, true );
}
}
void ViewConfigureFieldsPage::slotMoveDown()
{
int i = mSelectedBox->currentItem();
if ( i > -1 && i < (int)mSelectedBox->count() - 1 ) {
- QListBoxItem *item = mSelectedBox->item( i );
+ Q3ListBoxItem *item = mSelectedBox->item( i );
mSelectedBox->takeItem( item );
mSelectedBox->insertItem( item, i + 1 );
mSelectedBox->setCurrentItem( item );
mSelectedBox->setSelected( i + 1, true );
}
}
void ViewConfigureFieldsPage::initGUI()
{
//US change the orientation dependent on the following flag
// right the flag is set only staticly.
// 0 = 640x480 ; 1 = 240x320
bool orientation = 1;
setCaption( i18n("Select Fields to Display") );
- QGridLayout *gl = 0;
+ Q3GridLayout *gl = 0;
if (orientation == 0)
- gl = new QGridLayout( this , 6, 4, 0, KDialog::spacingHint() );
+ gl = new Q3GridLayout( this , 6, 4, 0, KDialog::spacingHint() );
else
- gl = new QGridLayout( this , 4, 6, 0, KDialog::spacingHint() );
+ gl = new Q3GridLayout( this , 4, 6, 0, KDialog::spacingHint() );
#ifndef KAB_EMBEDDED
mCategoryCombo = new KComboBox( false, this );
#else //KAB_EMBEDDED
mCategoryCombo = new QComboBox( false, this );
#endif //KAB_EMBEDDED
if ( QApplication::desktop()->width() < 320 )
mCategoryCombo->setMaximumWidth( 70 );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::All ) );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Frequent ) );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Address ) );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Email ) );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Personal ) );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::Organization ) );
mCategoryCombo->insertItem( KABC::Field::categoryLabel( KABC::Field::CustomCategory ) );
connect( mCategoryCombo, SIGNAL( activated(int) ), SLOT( slotShowFields(int) ) );
gl->addWidget( mCategoryCombo, 0, 0 );
QLabel *label = new QLabel( i18n( "&Selected\nfields:" ), this );
if (orientation == 0)
gl->addWidget( label, 0, 2 );
else
gl->addWidget( label, 2, 0 );
- mUnSelectedBox = new QListBox( this );
- mUnSelectedBox->setSelectionMode( QListBox::Extended );
+ mUnSelectedBox = new Q3ListBox( this );
+ mUnSelectedBox->setSelectionMode( Q3ListBox::Extended );
mUnSelectedBox->setMinimumHeight( 80 );
if (orientation == 0)
gl->addWidget( mUnSelectedBox, 1, 0 );
else
gl->addWidget( mUnSelectedBox, 0, 1 );
- mSelectedBox = new QListBox( this );
+ mSelectedBox = new Q3ListBox( this );
//if ( QApplication::desktop()->width() < 320 ) {
// mUnSelectedBox->setMaximumWidth( 134 );
// mSelectedBox->setMaximumWidth( 134 );
//}
- mSelectedBox->setSelectionMode( QListBox::Extended );
+ mSelectedBox->setSelectionMode( Q3ListBox::Extended );
mSelectedBox->setMinimumHeight( 80 );
label->setBuddy( mSelectedBox );
if (orientation == 0)
gl->addWidget( mSelectedBox, 1, 2 );
else
gl->addWidget( mSelectedBox, 2, 1 );
- QBoxLayout *vb1 = 0;
+ Q3BoxLayout *vb1 = 0;
if (orientation == 0)
- vb1 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() );
+ vb1 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() );
else
- vb1 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() );
+ vb1 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() );
vb1->addStretch();
mAddButton = new QToolButton( this );
if (orientation == 0)
mAddButton->setIconSet( SmallIconSet( "1rightarrow" ) );
else
mAddButton->setIconSet( SmallIconSet( "1downarrow" ) );
connect( mAddButton, SIGNAL( clicked() ), SLOT( slotSelect() ) );
vb1->addWidget( mAddButton );
mRemoveButton = new QToolButton( this );
if (orientation == 0)
mRemoveButton->setIconSet( SmallIconSet( "1leftarrow" ) );
else
mRemoveButton->setIconSet( SmallIconSet( "1uparrow" ) );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotUnSelect() ) );
vb1->addWidget( mRemoveButton );
vb1->addStretch();
if (orientation == 0)
gl->addLayout( vb1, 1, 1 );
else
gl->addLayout( vb1, 1, 1 );
- QBoxLayout *vb2 = 0;
+ Q3BoxLayout *vb2 = 0;
if (orientation == 0)
- vb2 = new QBoxLayout( QBoxLayout::TopToBottom, KDialog::spacingHint() );
+ vb2 = new Q3BoxLayout( Q3BoxLayout::TopToBottom, KDialog::spacingHint() );
else
- vb2 = new QBoxLayout( QBoxLayout::LeftToRight, KDialog::spacingHint() );
+ vb2 = new Q3BoxLayout( Q3BoxLayout::LeftToRight, KDialog::spacingHint() );
vb2->addStretch();
mUpButton = new QToolButton( this );
mUpButton->setIconSet( SmallIconSet( "1uparrow" ) );
connect( mUpButton, SIGNAL( clicked() ), SLOT( slotMoveUp() ) );
vb2->addWidget( mUpButton );
mDownButton = new QToolButton( this );
mDownButton->setIconSet( SmallIconSet( "1downarrow" ) );
connect( mDownButton, SIGNAL( clicked() ), SLOT( slotMoveDown() ) );
vb2->addWidget( mDownButton );
vb2->addStretch();
if (orientation == 0)
gl->addLayout( vb2, 1, 3 );
else
gl->addLayout( vb2, 3, 1 );
QSize sizeHint = mUnSelectedBox->sizeHint();
// make sure we fill the list with all items, so that we can
// get the maxItemWidth we need to not truncate the view
slotShowFields( 0 );
//sizeHint = sizeHint.expandedTo( mSelectedBox->sizeHint() );
//sizeHint.setWidth( mUnSelectedBox->maxItemWidth() );
// mUnSelectedBox->setMinimumSize( sizeHint );
//mSelectedBox->setMinimumSize( sizeHint );
gl->activate();
connect( mUnSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) );
connect( mSelectedBox, SIGNAL( selectionChanged() ), SLOT( slotButtonsEnabled() ) );
- connect( mSelectedBox, SIGNAL( currentChanged( QListBoxItem * ) ), SLOT( slotButtonsEnabled() ) );
+ connect( mSelectedBox, SIGNAL( currentChanged( Q3ListBoxItem * ) ), SLOT( slotButtonsEnabled() ) );
slotButtonsEnabled();
}
-#ifndef KAB_EMBEDDED
-#include "viewconfigurefieldspage.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_viewconfigurefieldspage.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/viewconfigurefieldspage.h b/kaddressbook/viewconfigurefieldspage.h
index b27668c..42d132f 100644
--- a/kaddressbook/viewconfigurefieldspage.h
+++ b/kaddressbook/viewconfigurefieldspage.h
@@ -6,76 +6,76 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef VIEWCONFIGUREFIELDSPAGE_H
#define VIEWCONFIGUREFIELDSPAGE_H
#include <qwidget.h>
#include <kabc/field.h>
#include <kabc/addressbook.h>
#ifndef KAB_EMBEDDED
class KComboBox;
#else //KAB_EMBEDDED
class QComboBox;
#endif //KAB_EMBEDDED
-class QListBox;
-class QListBoxItem;
+class Q3ListBox;
+class Q3ListBoxItem;
class QPushButton;
class QToolButton;
class ViewConfigureFieldsPage : public QWidget
{
Q_OBJECT
public:
ViewConfigureFieldsPage( KABC::AddressBook *ab, QWidget *parent = 0,
const char *name = 0 );
void restoreSettings( KConfig* );
void saveSettings( KConfig* );
public slots:
void slotSelect();
void slotUnSelect();
void slotMoveUp();
void slotMoveDown();
void slotShowFields( int );
void slotButtonsEnabled();
private:
void initGUI();
#ifndef KAB_EMBEDDED
KComboBox *mCategoryCombo;
#else //KAB_EMBEDDED
QComboBox *mCategoryCombo;
#endif //KAB_EMBEDDED
- QListBox *mSelectedBox;
- QListBox *mUnSelectedBox;
+ Q3ListBox *mSelectedBox;
+ Q3ListBox *mUnSelectedBox;
QToolButton *mAddButton;
QToolButton *mRemoveButton;
QToolButton *mUpButton;
QToolButton *mDownButton;
KABC::AddressBook *mAddressBook;
};
#endif
diff --git a/kaddressbook/viewconfigurefilterpage.cpp b/kaddressbook/viewconfigurefilterpage.cpp
index b085a5e..cdb778b 100644
--- a/kaddressbook/viewconfigurefilterpage.cpp
+++ b/kaddressbook/viewconfigurefilterpage.cpp
@@ -1,137 +1,140 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KAB_EMBEDDED
#include <kcombobox.h>
#else //KAB_EMBEDDED
#include <qcombobox.h>
#endif //KAB_EMBEDDED
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qradiobutton.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include <kconfig.h>
#include <kdialog.h>
#include <klocale.h>
#include "filter.h"
#include "viewconfigurefilterpage.h"
ViewConfigureFilterPage::ViewConfigureFilterPage( QWidget *parent,
const char *name )
: QWidget( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this, 0, KDialog::spacingHint() );
- mFilterGroup = new QButtonGroup();
+ mFilterGroup = new Q3ButtonGroup();
connect( mFilterGroup, SIGNAL( clicked( int ) ), SLOT( buttonClicked( int ) ) );
QLabel *label = new QLabel( i18n( "The default filter will be activated whenever"
" this view is displayed. This feature allows you to configure views that only"
" interact with certain types of information based on the filter. Once the view"
" is activated, the filter can be changed at anytime." ), this );
label->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
topLayout->addWidget( label );
QWidget *spacer = new QWidget( this );
spacer->setMinimumHeight( 5 );
topLayout->addWidget( spacer );
QRadioButton *button = new QRadioButton( i18n( "No default filter" ), this );
mFilterGroup->insert( button );
topLayout->addWidget( button );
button = new QRadioButton( i18n( "Use last active filter" ), this );
mFilterGroup->insert( button );
topLayout->addWidget( button );
- QBoxLayout *comboLayout = new QHBoxLayout();
+ Q3BoxLayout *comboLayout = new Q3HBoxLayout();
topLayout->addLayout( comboLayout );
button = new QRadioButton( i18n( "Use filter:" ), this );
mFilterGroup->insert( button );
comboLayout->addWidget( button );
#ifndef KAB_EMBEDDED
mFilterCombo = new KComboBox( this );
#else //KAB_EMBEDDED
mFilterCombo = new QComboBox( this );
#endif //KAB_EMBEDDED
comboLayout->addWidget( mFilterCombo );
}
ViewConfigureFilterPage::~ViewConfigureFilterPage()
{
delete mFilterGroup;
}
void ViewConfigureFilterPage::restoreSettings( KConfig *config )
{
mFilterCombo->clear();
//US I had to adjust the whole method in order to work with QComboBoxes
// in case of the Platformindependent version
QString defaultfiltername = config->readEntry( "DefaultFilterName" );
int id = config->readNumEntry( "DefaultFilterType", 1 );
mFilterGroup->setButton( id );
buttonClicked( id );
// Load the filter combo
Filter::List list = Filter::restore( config, "Filter" );
Filter::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it )
{
mFilterCombo->insertItem( (*it).name() );
if ( id == 2 && (*it).name() == defaultfiltername) // has default filter
{
mFilterCombo->insertItem( (*it).name(), 0);
}
else
{
mFilterCombo->insertItem( (*it).name() );
}
}
}
void ViewConfigureFilterPage::saveSettings( KConfig *config )
{
config->writeEntry( "DefaultFilterName", mFilterCombo->currentText() );
config->writeEntry( "DefaultFilterType", mFilterGroup->id( mFilterGroup->selected() ) );
}
void ViewConfigureFilterPage::buttonClicked( int id )
{
mFilterCombo->setEnabled( id == 2 );
}
-#ifndef KAB_EMBEDDED
-#include "viewconfigurefilterpage.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_viewconfigurefilterpage.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/viewconfigurefilterpage.h b/kaddressbook/viewconfigurefilterpage.h
index 3be9564..fb39a61 100644
--- a/kaddressbook/viewconfigurefilterpage.h
+++ b/kaddressbook/viewconfigurefilterpage.h
@@ -1,63 +1,63 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef VIEWCONFIGUREFILTERPAGE
#define VIEWCONFIGUREFILTERPAGE
#include <qwidget.h>
-class QButtonGroup;
+class Q3ButtonGroup;
#ifndef KAB_EMBEDDED
class KComboBox;
#else //KAB_EMBEDDED
class QComboBox;
#endif //KAB_EMBEDDED
class KConfig;
class ViewConfigureFilterPage : public QWidget
{
Q_OBJECT
public:
ViewConfigureFilterPage( QWidget *parent, const char *name = 0 );
~ViewConfigureFilterPage();
void restoreSettings( KConfig* );
void saveSettings( KConfig* );
protected slots:
void buttonClicked( int id );
private:
#ifndef KAB_EMBEDDED
KComboBox *mFilterCombo;
#else //KAB_EMBEDDED
QComboBox *mFilterCombo;
#endif //KAB_EMBEDDED
- QButtonGroup *mFilterGroup;
+ Q3ButtonGroup *mFilterGroup;
};
#endif
diff --git a/kaddressbook/viewconfigurewidget.cpp b/kaddressbook/viewconfigurewidget.cpp
index 666e188..047df8c 100644
--- a/kaddressbook/viewconfigurewidget.cpp
+++ b/kaddressbook/viewconfigurewidget.cpp
@@ -1,159 +1,160 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KAB_EMBEDDED
-#include <qvbox.h>
+#include <q3vbox.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kiconloader.h>
#include "viewmanager.h"
#endif //KAB_EMBEDDED
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <QPixmap>
#include <kjanuswidget.h>
#include <kglobal.h>
#include <klocale.h>
#include "viewconfigurewidget.h"
#include "viewconfigurefieldspage.h"
#include "viewconfigurefilterpage.h"
ViewConfigureWidget::ViewConfigureWidget( KABC::AddressBook *ab, QWidget *parent,
const char *name )
: ConfigureWidget( ab, parent, name )
{
- QVBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( this );
mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
topLayout->addWidget( mMainWidget );
// Add the first page, the attributes
- QVBox *page = addPage( i18n( "Fields" ), QString::null,
+ Q3VBox *page = addPage( i18n( "Fields" ), QString::null,
KGlobal::iconLoader()->loadIcon( "view_detailed",
KIcon::Panel, 16 ) );
// Add the select fields page
mFieldsPage = new ViewConfigureFieldsPage( addressBook(), (QWidget*)page );
//US mFieldsPage->setMinimumSize(300,300);
// Add the second page, the filter selection
page = addPage( i18n( "Default Filter" ), QString::null,
KGlobal::iconLoader()->loadIcon( "filter",
KIcon::Panel, 16 ) );
mFilterPage = new ViewConfigureFilterPage( (QWidget*)page );
//qDebug("+++++ViewConfigureWidget::ViewConfigureWidget ");
}
ViewConfigureWidget::~ViewConfigureWidget()
{
//qDebug("-----ViewConfigureWidget::~ViewConfigureWidget() ");
}
void ViewConfigureWidget::restoreSettings( KConfig *config )
{
mFieldsPage->restoreSettings( config );
mFilterPage->restoreSettings( config );
}
void ViewConfigureWidget::saveSettings( KConfig *config )
{
mFieldsPage->saveSettings( config );
mFilterPage->saveSettings( config );
}
-QVBox *ViewConfigureWidget::addPage( const QString &item, const QString &header,
+Q3VBox *ViewConfigureWidget::addPage( const QString &item, const QString &header,
const QPixmap &pixmap )
{
return mMainWidget->addVBoxPage( item, header, pixmap );
}
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qlayout.h>
#include <stdlib.h>
ViewConfigureDialog::ViewConfigureDialog( ViewConfigureWidget *wdg, const QString &viewName,
QWidget *parent, const char *name )
: KDialogBase( Swallow, i18n( "Modify View: " ) + viewName, Help | Ok | Cancel,
Ok, parent, name, true, true ), mConfigWidget( wdg )
{
//US, I have to change the way, how to connect the ViewConfigureWidget. It looks
// like it has changed.
//QFrame *topFrame = plainPage();
if ( mConfigWidget ) {
mConfigWidget->reparent(this, QPoint(0,0), true);
// QVBoxLayout * layout = new QVBoxLayout( this );
//layout->addWidget(mConfigWidget );
//mConfigWidget->reparent(topFrame, QPoint(1,1), true);
setMainWidget( mConfigWidget );
}
}
ViewConfigureDialog::~ViewConfigureDialog()
{
}
void ViewConfigureDialog::setWidget( ViewConfigureWidget *wdg )
{
mConfigWidget = wdg ;
setMainWidget( mConfigWidget );
}
void ViewConfigureDialog::restoreSettings( KConfig *config )
{
mConfigWidget->restoreSettings( config );
}
void ViewConfigureDialog::saveSettings( KConfig *config )
{
mConfigWidget->saveSettings( config );
}
void ViewConfigureDialog::slotHelp()
{
#ifndef KAB_EMBEDDED
kapp->invokeHelp( "using-views" );
#else //KAB_EMBEDDED
qDebug("ViewConfigureDialog::slotHelp not yet implemented");
#endif //KAB_EMBEDDED
}
-#ifndef KAB_EMBEDDED
-#include "viewconfigurewidget.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_viewconfigurewidget.cpp"
#endif //KAB_EMBEDDED
-
-
diff --git a/kaddressbook/viewconfigurewidget.h b/kaddressbook/viewconfigurewidget.h
index 0c2b77c..e3b9b12 100644
--- a/kaddressbook/viewconfigurewidget.h
+++ b/kaddressbook/viewconfigurewidget.h
@@ -1,106 +1,106 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can rremovePageedistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef VIEWCONFIGUREWIDGET_H
#define VIEWCONFIGUREWIDGET_H
#include "configurewidget.h"
-class QVBox;
+class Q3VBox;
#include <kdialogbase.h>
#include <qpixmap.h>
class KJanusWidget;
class QString;
class ViewConfigureFieldsPage;
class ViewConfigureFilterPage;
class ViewConfigureDialog;
/**
This widget is the base class for all view configuration widgets. The
author of a view may wish to inherit from this widget and add config pages
that add custom config options. The default implementation of this widget
is to show a page with the select fields widget. For simple views this may
be sufficient.
*/
class ViewConfigureWidget : public ConfigureWidget
{
Q_OBJECT
public:
ViewConfigureWidget( KABC::AddressBook *ab, QWidget *parent, const char *name = 0 );
virtual ~ViewConfigureWidget();
/**
Reads the configuration from the config object and sets the values
in the GUI. If this method is overloaded, be sure to call the base
class's method.
Do not change the group of the config object in this method.
*/
virtual void restoreSettings( KConfig *config );
/**
Writes the configuration from the GUI to the config object. If this
method is overloaded, be sure to call the base class's method.
Do not change the group of the config object in this method.
*/
virtual void saveSettings( KConfig *config );
/**
Use this method to add new pages to the widget.
*/
- QVBox *addPage( const QString &item, const QString &header = QString::null,
+ Q3VBox *addPage( const QString &item, const QString &header = QString::null,
const QPixmap &pixmap = QPixmap() );
private:
KJanusWidget *mMainWidget;
ViewConfigureFieldsPage *mFieldsPage;
ViewConfigureFilterPage *mFilterPage;
};
class ViewConfigureDialog : public KDialogBase
{
Q_OBJECT
public:
ViewConfigureDialog( ViewConfigureWidget *wdg, const QString &viewName,
QWidget *parent, const char *name = 0 );
~ViewConfigureDialog();
void restoreSettings( KConfig* );
void saveSettings( KConfig* );
void setWidget( ViewConfigureWidget *wdg );
protected slots:
void slotHelp();
private:
ViewConfigureWidget *mConfigWidget;
};
#endif
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp
index b5d9419..5cfe3ad 100644
--- a/kaddressbook/viewmanager.cpp
+++ b/kaddressbook/viewmanager.cpp
@@ -21,176 +21,180 @@
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KAB_EMBEDDED
#include <libkdepim/kvcarddrag.h>
#include <kabc/vcardconverter.h>
#include <kconfig.h>
#include <kdeversion.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kmultipledrag.h>
#include <ktrader.h>
#include <kurldrag.h>
#include "addresseeutil.h"
#else //KAB_EMBEDDED
#include "views/kaddressbookiconview.h"
#include "views/kaddressbooktableview.h"
#include "views/kaddressbookcardview.h"
#include "kaddressbookview.h"
#include <qaction.h>
#include <qmessagebox.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QDropEvent>
#include <kconfigbase.h>
#endif //KAB_EMBEDDED
#include <kdebug.h>
#include <kactionclasses.h>
#include <qlayout.h>
#include <qapplication.h>
-#include <qwidgetstack.h>
+#include <QDesktopWidget>
+#include <q3widgetstack.h>
#include <kabc/addressbook.h>
#include "filtereditdialog.h"
#include "addviewdialog.h"
#include "kabcore.h"
#include "kabprefs.h"
#include "viewmanager.h"
ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name )
: QWidget( parent, name ), mCore( core ), mActiveView( 0 )
{
initGUI();
initActions();
mViewDict.setAutoDelete( true );
createViewFactories();
}
ViewManager::~ViewManager()
{
unloadViews();
mViewFactoryDict.clear();
}
void ViewManager::scrollUP()
{
if ( mActiveView )
mActiveView->scrollUP();
}
void ViewManager::scrollDOWN()
{
if ( mActiveView )
mActiveView->scrollDOWN();
}
void ViewManager::restoreSettings()
{
mViewNameList = KABPrefs::instance()->mViewNames;
QString activeViewName = KABPrefs::instance()->mCurrentView;
mActionSelectView->setItems( mViewNameList );
// Filter
mFilterList = Filter::restore( mCore->config(), "Filter" );
mActionSelectFilter->setItems( filterNames() );
mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter );
int cw = 150;
if ( QApplication::desktop()->width() >= 800 )
cw = 200;
if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch)
cw = 0;
mActionSelectFilter->setComboWidth( cw );
// Tell the views to reread their config, since they may have
// been modified by global settings
QString _oldgroup = mCore->config()->group();
- QDictIterator<KAddressBookView> it( mViewDict );
+ Q3DictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
it.current()->readConfig( mCore->config() );
}
setActiveView( activeViewName );
mActionDeleteView->setEnabled( mViewNameList.count() > 1 );
}
void ViewManager::saveSettings()
{
QString _oldgroup = mCore->config()->group();
- QDictIterator<KAddressBookView> it( mViewDict );
+ Q3DictIterator<KAddressBookView> it( mViewDict );
for ( it.toFirst(); it.current(); ++it ) {
KConfigGroupSaver saver( mCore->config(), it.currentKey() );
#ifdef DESKTOP_VERSION
(*it)->writeConfig( mCore->config() );
#else
(*it).writeConfig( mCore->config() );
#endif
}
Filter::save( mCore->config(), "Filter", mFilterList );
KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem();
// write the view name list
KABPrefs::instance()->mViewNames = mViewNameList;
KABPrefs::instance()->mCurrentView = mActiveView->caption();
}
QStringList ViewManager::selectedUids() const
{
if ( mActiveView )
return mActiveView->selectedUids();
else
return QStringList();
}
QStringList ViewManager::selectedEmails() const
{
if ( mActiveView )
- return mActiveView->selectedEmails();
+ return QStringList(mActiveView->selectedEmails());
else
return QStringList();
}
KABC::Addressee::List ViewManager::selectedAddressees() const
{
KABC::Addressee::List list;
if ( mActiveView ) {
QStringList uids = mActiveView->selectedUids();
QStringList::Iterator it;
for ( it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee addr = mCore->addressBook()->findByUid( *it );
if ( !addr.isEmpty() )
list.append( addr );
}
}
return list;
}
//US added another method with no parameter, since my moc compiler does not support default parameters.
void ViewManager::setSelected()
{
setSelected( QString::null, true );
}
void ViewManager::setSelected( const QString &uid, bool selected )
{
if ( mActiveView )
mActiveView->setSelected( uid, selected );
}
void ViewManager::setListSelected(QStringList list)
@@ -527,65 +531,65 @@ void ViewManager::dropped( QDropEvent *e )
for ( it = list.begin(); it != list.end(); ++it ) {
if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) {
KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() );
if ( a.isEmpty() ) {
mCore->addressBook()->insertAddressee( addr );
emit modified();
}
}
}
mActiveView->refresh();
}
#else //KAB_EMBEDDED
qDebug("ViewManager::dropped() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::startDrag()
{
kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl;
#ifndef KAB_EMBEDDED
// Get the list of all the selected addressees
KABC::Addressee::List addrList;
QStringList uidList = selectedUids();
QStringList::Iterator iter;
for ( iter = uidList.begin(); iter != uidList.end(); ++iter )
addrList.append( mCore->addressBook()->findByUid( *iter ) );
KMultipleDrag *drag = new KMultipleDrag( this );
- drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
+ drag->addDragObject( new Q3TextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) );
KABC::Addressee::List::Iterator it;
QStringList vcards;
for ( it = addrList.begin(); it != addrList.end(); ++it ) {
QString vcard = QString::null;
KABC::VCardConverter converter;
if ( converter.addresseeToVCard( *it, vcard ) )
vcards.append( vcard );
}
drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) );
drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) );
drag->dragCopy();
#else //KAB_EMBEDDED
qDebug("ViewManager::startDrag() has to be changed!!" );
#endif //KAB_EMBEDDED
}
void ViewManager::doSearch( const QString& s,KABC::Field *field )
{
if ( mActiveView )
mActiveView->doSearch( s, field );
}
void ViewManager::setActiveFilter( int index )
{
Filter currentFilter;
if ( ( index - 1 ) < 0 )
currentFilter = Filter();
else
currentFilter = mFilterList[ index - 1 ];
@@ -630,67 +634,67 @@ QStringList ViewManager::filterNames() const
names.append( (*it).name() );
return names;
}
Filter ViewManager::getFilterByName( const QString &name ) const
{
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it )
if ( name == (*it).name() )
return (*it);
return Filter();
}
int ViewManager::filterPosition( const QString &name ) const
{
int pos = 0;
Filter::List::ConstIterator it;
for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos )
if ( name == (*it).name() )
return pos + 1;
return 0;
}
void ViewManager::initActions()
{
//US <ActionList name="view_loadedviews"/>
//US <Separator/>
#ifdef KAB_EMBEDDED
- QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu();
- QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu();
- QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu();
+ Q3PopupMenu *viewmenu = (Q3PopupMenu*)mCore->getViewMenu();
+ Q3PopupMenu *settingsmenu = (Q3PopupMenu*)mCore->getSettingsMenu();
+ Q3PopupMenu *filtermenu = (Q3PopupMenu*)mCore->getFilterMenu();
#endif //KAB_EMBEDDED
mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" );
#if KDE_VERSION >= 309
mActionSelectView->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectView, SIGNAL( activated( const QString& ) ),
SLOT( selectView( const QString& ) ) );
#ifdef KAB_EMBEDDED
mActionSelectView->plug(viewmenu);
viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
KAction *action;
action = new KAction( i18n( "Modify View..." ), "configure", 0, this,
SLOT( editView() ), mCore->actionCollection(), "view_modify" );
#ifndef KAB_EMBEDDED
action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) );
#else //KAB_EMBEDDED
action->plug(viewmenu);
#endif //KAB_EMBEDDED
action = new KAction( i18n( "Add View..." ), "window_new", 0, this,
SLOT( addView() ), mCore->actionCollection(), "view_add" );
#ifndef KAB_EMBEDDED
action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) );
#else //KAB_EMBEDDED
action->plug(viewmenu);
#endif //KAB_EMBEDDED
@@ -709,40 +713,40 @@ void ViewManager::initActions()
action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
SLOT( refreshView(const QString &) ), mCore->actionCollection(),
"view_refresh" );
action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) );
#else //KAB_EMBEDDED
action = new KAction( i18n( "Refresh View" ), "reload", 0, this,
SLOT( refreshView()), mCore->actionCollection(),
"view_refresh" );
action->plug(viewmenu);
//viewmenu->insertSeparator();
#endif //KAB_EMBEDDED
action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this,
SLOT( configureFilters() ), mCore->actionCollection(),
"options_edit_filters" );
mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" );
#if KDE_VERSION >= 309
mActionSelectFilter->setMenuAccelsEnabled( false );
#endif
connect( mActionSelectFilter, SIGNAL( activated( int ) ),
SLOT( setActiveFilter( int ) ) );
#ifdef KAB_EMBEDDED
action->plug(settingsmenu);
mActionSelectFilter->plug(viewmenu,0);
#endif //KAB_EMBEDDED
}
void ViewManager::initGUI()
{
- QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 );
- mViewWidgetStack = new QWidgetStack( this );
+ Q3HBoxLayout *layout = new Q3HBoxLayout( this, 0, 0 );
+ mViewWidgetStack = new Q3WidgetStack( this );
layout->addWidget( mViewWidgetStack );
}
-#ifndef KAB_EMBEDDED
-#include "viewmanager.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_viewmanager.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h
index ab5d372..4bbdbc7 100644
--- a/kaddressbook/viewmanager.h
+++ b/kaddressbook/viewmanager.h
@@ -1,69 +1,71 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef VIEWMANAGER_H
#define VIEWMANAGER_H
#include <qwidget.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <QDropEvent>
#include <kaddressbookview.h>
-#include <qdict.h>
+#include <q3dict.h>
#include "filter.h"
class KAction;
class KSelectAction;
class KABCore;
-class QWidgetStack;
+class Q3WidgetStack;
class QDropEvent;
namespace KABC { class AddressBook; }
/**
The view manager manages the views and everything related to them. The
manager will load the views at startup and display a view when told to
make one active.
The view manager will also create and manage all dialogs directly related to
views (ie: AddView, ConfigureView, DeleteView, etc).
*/
class ViewManager : public QWidget
{
Q_OBJECT
public:
ViewManager( KABCore *core, QWidget *parent, const char *name = 0 );
~ViewManager();
void restoreSettings();
void saveSettings();
void doSearch( const QString& s ,KABC::Field *field );
void unloadViews();
KSelectAction * getFilterAction() { return mActionSelectFilter; }
Filter getFilterByName( const QString &name ) const;
QStringList selectedUids() const;
QStringList selectedEmails() const;
KABC::Addressee::List selectedAddressees() const;
void setListSelected(QStringList);
void setFocusAV();
@@ -116,46 +118,46 @@ class ViewManager : public QWidget
void executed( const QString &uid );
/**
Emitted whenever the address book is modified in some way.
*/
void modified();
/**
Emitted whenever a url is dragged on a view.
*/
void urlDropped( const KURL& );
private slots:
void selectView( const QString &name );
void setActiveView( const QString &name );
void setActiveFilter( int index );
void configureFilters();
private:
void createViewFactories();
QStringList filterNames() const;
int filterPosition( const QString &name ) const;
QStringList viewNames() const;
int viewPosition( const QString &name ) const;
void initActions();
void initGUI();
KABCore *mCore;
Filter mCurrentFilter;
Filter::List mFilterList;
- QDict<KAddressBookView> mViewDict;
- QDict<ViewFactory> mViewFactoryDict;
+ Q3Dict<KAddressBookView> mViewDict;
+ Q3Dict<ViewFactory> mViewFactoryDict;
QStringList mViewNameList;
- QWidgetStack *mViewWidgetStack;
+ Q3WidgetStack *mViewWidgetStack;
KAddressBookView *mActiveView;
KAction *mActionDeleteView;
KSelectAction *mActionSelectFilter;
KSelectAction *mActionSelectView;
};
#endif
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index b6e053f..1a29f41 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -5,106 +5,114 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
//BEGIN Includes
#include "cardview.h"
#include <limits.h>
#include <qpainter.h>
#include <qtimer.h>
#include <qdatetime.h>
#include <qlabel.h>
#include <qstyle.h>
#include <qcursor.h>
#include <qtooltip.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3PtrList>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QEvent>
+#include <QWheelEvent>
#include "kabprefs.h"
#include <kdebug.h>
#include <kglobalsettings.h>
//END includes
#define MIN_ITEM_WIDTH 80
//BEGIN Helpers
//////////////////////////////////////
// CardViewTip
class CardViewTip : public QLabel {
public:
CardViewTip(QWidget *parent=0, const char *name=0) : QLabel( parent, name )
{
setPalette( QToolTip::palette() );
setFrameStyle( Panel|Plain );
setMidLineWidth(0);
setIndent(1);
}
~CardViewTip() {};
protected:
void leaveEvent( QEvent * )
{
hide();
}
};
//////////////////////////////////////
// CardViewItemList
//
// Warning: make sure you use findRef() instead of find() to find an
// item! Only the pointer value is unique in the list.
//
-class CardViewItemList : public QPtrList<CardViewItem>
+class CardViewItemList : public Q3PtrList<CardViewItem>
{
protected:
- virtual int compareItems(QPtrCollection::Item item1,
- QPtrCollection::Item item2)
+ virtual int compareItems(Q3PtrCollection::Item item1,
+ Q3PtrCollection::Item item2)
{
CardViewItem *cItem1 = (CardViewItem*)item1;
CardViewItem *cItem2 = (CardViewItem*)item2;
if ( cItem1 == cItem2 )
return 0;
if ((cItem1 == 0) || (cItem2 == 0))
return cItem1 ? -1 : 1;
if (cItem1->caption() < cItem2->caption())
return -1;
else if (cItem1->caption() > cItem2->caption())
return 1;
return 0;
}
private:
/*int find( const CardViewItem * )
{
qDebug("DON'T USE CardViewItemList::find( item )! Use findRef( item )!");
}*/
};
//////////////////////////////////////
// CardViewSeparator
class CardViewSeparator
{
friend class CardView;
@@ -132,112 +140,112 @@ class CardViewSeparator
CardView *mView;
QRect mRect;
};
//END Helpers
//BEGIN Private Data
class CardViewPrivate
{
public:
CardViewPrivate()
: mSelectionMode( CardView::Multi ),
mDrawCardBorder( true ),
mDrawFieldLabels( true ),
mDrawSeparators( true),
mSepWidth( 2 ),
mShowEmptyFields( false ),
mLayoutDirty( true ),
mLastClickOnItem( false ),
mItemMargin( 0 ),
mItemSpacing( 10 ),
mItemWidth( 200 ),
mMaxFieldLines( INT_MAX ),
mCurrentItem( 0L ),
mLastClickPos( QPoint(0, 0) ),
mResizeAnchor(0),
mRubberBandAnchor( 0 ),
mCompText( QString::null )
{};
CardViewItemList mItemList;
- QPtrList<CardViewSeparator> mSeparatorList;
+ Q3PtrList<CardViewSeparator> mSeparatorList;
QFontMetrics *mFm;
QFontMetrics *mBFm; // bold font
QFont mHeaderFont; // custom header font
CardView::SelectionMode mSelectionMode;
bool mDrawCardBorder;
bool mDrawFieldLabels;
bool mDrawSeparators;
int mSepWidth;
bool mShowEmptyFields;
bool mLayoutDirty;
bool mLastClickOnItem;
uint mItemMargin; // internal margin in items
uint mItemSpacing; // spacing between items, column seperators and border
int mItemWidth; // width of all items
uint mMaxFieldLines; // Max lines to dispaly pr field
CardViewItem *mCurrentItem;
QPoint mLastClickPos;
QTimer *mTimer; // times out if mouse rests for more than 500 msecs
CardViewTip *mTip; // passed to the item under a resting cursor to display full text
bool mOnSeparator; // set/reset on mouse movement
// for resizing by dragging the separators
int mResizeAnchor; // uint, ulong? the mouse down separator left
int mRubberBandAnchor; // for erasing rubber bands
// data used for resizing.
// as they are beeded by each mouse move while resizing, we store them here,
// saving 8 calculations in each mouse move.
int colspace; // amount of space between items pr column
uint first; // the first col to anchor at for painting rubber bands
int firstX; // X position of first in pixel
int pressed; // the colummn that was pressed on at resizing start
int span; // pressed - first
// key completion
QString mCompText; // current completion string
QDateTime mCompUpdated; // ...was updated at this time
};
class CardViewItemPrivate
{
public:
CardViewItemPrivate() :
mSelected( false ),
x( 0 ),
y( 0 ){};
QString mCaption;
- QPtrList< CardViewItem::Field > mFieldList;
+ Q3PtrList< CardViewItem::Field > mFieldList;
bool mSelected;
int x; // horizontal position, set by the view
int y; // vertical position, set by the view
int maxLabelWidth; // the width of the widest label, according to the view font.
int hcache; // height cache
};
//END Private Data
//BEGIN CardViewItem
CardViewItem::CardViewItem(CardView *parent, QString caption)
: d(new CardViewItemPrivate()), mView(parent)
{
d->mCaption = caption;
initialize();
}
CardViewItem::~CardViewItem()
{
// Remove ourself from the view
if (mView != 0)
mView->takeItem(this);
delete d;
d = 0;
}
void CardViewItem::initialize()
{
d->mSelected = false;
d->mFieldList.setAutoDelete(true);
@@ -284,65 +292,65 @@ void CardViewItem::paintCard(QPainter *p, QColorGroup &cg)
// Draw a simple box
if (isSelected())
pen = QPen(cg.highlight(), 1);
else
pen = QPen(cg.button(), 1);
p->setPen(pen);
// Draw the border - this is only draw if the user asks for it.
if (drawBorder)
p->drawRect( mg, mg, w, h );
// set the proper pen color for the caption box
if (isSelected())
brush = cg.brush(QColorGroup::Highlight);
else
brush = cg.brush(QColorGroup::Button);
p->fillRect(mg, mg, w, 4 + bFm.height(), brush);
// Now paint the caption
p->save();
QFont bFont = mView->headerFont();
//bFont.setBold(true);
p->setFont(bFont);
if (isSelected())
p->setPen(cg.highlightedText());
else
p->setPen(cg.buttonText());
p->drawText(2+mg, 2+mg + bFm.ascent()/*bFm.height()*//*-bFm.descent()*//*-bFm.leading()*/, trimString(d->mCaption, w-4, bFm));
p->restore();
// Go through the fields and draw them
- QPtrListIterator< CardViewItem::Field > iter(d->mFieldList);
+ Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList);
QString label, value;
int yPos = mg + 4 + bFm.height()/* + 1*/ + fm.height(); // why the + 1 ??? (anders)
p->setPen(cg.text());
int fh = fm.height();
int cln( 0 );
QString tmp;
int maxLines = mView->maxFieldLines();
for (iter.toFirst(); iter.current(); ++iter)
{
value = (*iter)->second;
if ( value.isEmpty() && ! mView->d->mShowEmptyFields )
continue;
if (drawLabels)
{
label = trimString((*iter)->first, labelWidth, fm);
p->drawText(labelXPos, yPos, label + ":");
}
/* US original
for (cln=0; cln <= maxLines; cln++)
{
tmp = value.section('\n',cln,cln);
if ( !tmp.isEmpty() ) p->drawText( valueXPos, yPos + cln*fh, trimString( tmp, valueWidth, fm ) );
else break;
}
*/
//US new implementation
QStringList strlst = QStringList::split('\n', value, true);
for (cln=0; cln <= maxLines && cln <= (int)strlst.count(); cln++)
@@ -379,107 +387,107 @@ void CardViewItem::paintCard(QPainter *p, QColorGroup &cg)
}
const QString &CardViewItem::caption() const
{
return d->mCaption;
}
int CardViewItem::height( bool allowCache ) const
{
// use cache
if ( allowCache && d->hcache )
return d->hcache;
// Base height:
// 2 for line width
// 2 for top caption pad
// 2 for bottom caption pad
// 2 pad for the end
// + 2 times the advised margin
int baseHeight = 8 + ( 2 * mView->itemMargin() );
// size of font for each field
// 2 pad for each field
// anders: if the view does not show empty fields, check for value
bool sef = mView->showEmptyFields();
int fh = mView->d->mFm->height();//lineSpacing(); // font height
//int sp = QMAX( 0, 2- mView->d->mFm->leading() ); // field spacing NOTE make a property
int fieldHeight = 0;
int lines;
int maxLines( mView->maxFieldLines() );
- QPtrListIterator< CardViewItem::Field > iter(d->mFieldList);
+ Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList);
for (iter.toFirst(); iter.current(); ++iter)
{
if ( !sef && (*iter)->second.isEmpty() )
continue;
- lines = QMIN( (*iter)->second.contains('\n') + 1, maxLines );
+ lines = QMIN( (*iter)->second.count('\n') + 1, maxLines );
fieldHeight += ( lines * fh ) + 2;//sp;
}
// height of caption font (bold)
fieldHeight += mView->d->mBFm->height();
d->hcache = baseHeight + fieldHeight;
return d->hcache;
}
bool CardViewItem::isSelected() const
{
return d->mSelected;
}
void CardViewItem::setSelected(bool selected)
{
d->mSelected = selected;
}
void CardViewItem::insertField(const QString &label, const QString &value)
{
CardViewItem::Field *f = new CardViewItem::Field(label, value);
d->mFieldList.append(f);
d->hcache=0;
if (mView)
{
mView->setLayoutDirty(true);
d->maxLabelWidth = QMAX( mView->d->mFm->width( label ), d->maxLabelWidth );
}
}
void CardViewItem::removeField(const QString &label)
{
CardViewItem::Field *f;
- QPtrListIterator< CardViewItem::Field > iter(d->mFieldList);
+ Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList);
for (iter.toFirst(); iter.current(); ++iter)
{
f = *iter;
if (f->first == label)
break;
}
if (*iter)
d->mFieldList.remove(*iter);
d->hcache = 0;
if (mView)
mView->setLayoutDirty(true);
}
void CardViewItem::clearFields()
{
d->mFieldList.clear();
d->hcache = 0;
if (mView)
mView->setLayoutDirty(true);
}
QString CardViewItem::trimString(const QString &text, int width,
QFontMetrics &fm)
{
if (fm.width(text) <= width)
return text;
QString dots = "...";
int dotWidth = fm.width(dots);
@@ -494,204 +502,204 @@ QString CardViewItem::trimString(const QString &text, int width,
// Now trim the last char, since it put the width over the top
trimmed = trimmed.left(trimmed.length()-1);
trimmed += dots;
return trimmed;
}
CardViewItem *CardViewItem::nextItem()
{
CardViewItem *item = 0;
if (mView)
item = mView->itemAfter(this);
return item;
}
void CardViewItem::repaintCard()
{
if (mView)
mView->repaintItem(this);
}
void CardViewItem::setCaption(const QString &caption)
{
d->mCaption = caption;
repaintCard();
}
QString CardViewItem::fieldValue(const QString &label)
{
- QPtrListIterator< CardViewItem::Field > iter(d->mFieldList);
+ Q3PtrListIterator< CardViewItem::Field > iter(d->mFieldList);
for (iter.toFirst(); iter.current(); ++iter)
if ((*iter)->first == label)
return (*iter)->second;
return QString();
}
void CardViewItem::showFullString( const QPoint &itempos, CardViewTip *tip )
{
bool trimmed( false );
QString s;
int mrg = mView->itemMargin();
int y = mView->d->mBFm->height() + 6 + mrg;
int w = mView->itemWidth() - (2*mrg);
int lw;
bool drawLabels = mView->drawFieldLabels();
bool isLabel = drawLabels && itempos.x() < w/2 ? true : false;
if ( itempos.y() < y )
{
if ( itempos.y() < 8 + mrg || itempos.y() > y - 4 )
return;
// this is the caption
s = caption();
trimmed = mView->d->mBFm->width( s ) > w - 4;
y = 2 + mrg;
lw = 0;
isLabel=true;
} else {
// find the field
Field *f = fieldAt( itempos );
if ( !f || ( !mView->showEmptyFields() && f->second.isEmpty() ) )
return;
// y position:
// header font height + 4px hader margin + 2px leading + item margin
// + actual field index * (fontheight + 2px leading)
int maxLines = mView->maxFieldLines();
bool se = mView->showEmptyFields();
int fh = mView->d->mFm->height();
// {
Field *_f;
for (_f = d->mFieldList.first(); _f != f; _f = d->mFieldList.next())
if ( se || ! _f->second.isEmpty() )
- y += ( QMIN(_f->second.contains('\n')+1, maxLines) * fh ) + 2;
+ y += ( QMIN(_f->second.count('\n')+1, maxLines) * fh ) + 2;
// }
if ( isLabel && itempos.y() > y + fh )
return;
// label or data?
s = isLabel ? f->first : f->second;
// trimmed?
int colonWidth = mView->d->mFm->width(":");
lw = drawLabels ? // label width
QMIN( w/2 - 4 - mrg, d->maxLabelWidth + colonWidth + 4 ) :
0;
int mw = isLabel ? lw - colonWidth : w - lw - (mrg*2); // max width for string
if ( isLabel )
{
trimmed = mView->d->mFm->width( s ) > mw - colonWidth;
} else {
QRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, Qt::AlignTop|Qt::AlignLeft, s ) );
- trimmed = r.width() > mw || r.height()/fh > QMIN(s.contains('\n') + 1, maxLines);
+ trimmed = r.width() > mw || r.height()/fh > QMIN(s.count('\n') + 1, maxLines);
}
}
if ( trimmed )
{
tip->setFont( (isLabel && !lw) ? mView->headerFont() : mView->font() ); // if condition is true, a header
tip->setText( s );
tip->adjustSize();
// find a proper position
int lx;
lx = isLabel || !drawLabels ? mrg : lw + mrg + 2 /*-1*/;
QPoint pnt(mView->contentsToViewport( QPoint(d->x, d->y) ));
pnt += QPoint(lx, y);
if ( pnt.x() < 0 )
pnt.setX( 0 );
if ( pnt.x() + tip->width() > mView->visibleWidth() )
pnt.setX( mView->visibleWidth() - tip->width() );
if ( pnt.y() + tip->height() > mView->visibleHeight() )
pnt.setY( QMAX( 0, mView->visibleHeight() - tip->height() ) );
// show
tip->move( pnt );
tip->show();
}
}
CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const
{
int ypos = mView->d->mBFm->height() + 7 + mView->d->mItemMargin;
int iy = itempos.y();
// skip below caption
if ( iy <= ypos )
return 0;
// try find a field
bool showEmpty = mView->showEmptyFields();
int fh = mView->d->mFm->height();
int maxLines = mView->maxFieldLines();
Field *f;
for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() )
{
if ( showEmpty || !f->second.isEmpty() )
- ypos += ( QMIN( f->second.contains('\n')+1, maxLines ) *fh)+2;
+ ypos += ( QMIN( f->second.count('\n')+1, maxLines ) *fh)+2;
if ( iy <= ypos )
break;
}
return f ? f : 0;
}
//END CardViewItem
//BEGIN CardView
CardView::CardView(QWidget *parent, const char *name)
- : QScrollView(parent, name),
+ : Q3ScrollView(parent, name),
d(new CardViewPrivate())
{
mFlagKeyPressed = false;
mFlagBlockKeyPressed = false;
d->mItemList.setAutoDelete(true);
d->mSeparatorList.setAutoDelete(true);
QFont f = font();
d->mFm = new QFontMetrics(f);
f.setBold(true);
d->mHeaderFont = f;
d->mBFm = new QFontMetrics(f);
d->mTip = ( new CardViewTip( viewport() ) ),
d->mTip->hide();
d->mTimer = ( new QTimer(this, "mouseTimer") ),
viewport()->setMouseTracking( true );
viewport()->setFocusProxy(this);
- viewport()->setFocusPolicy(WheelFocus);
- viewport()->setBackgroundMode(PaletteBase);
+ viewport()->setFocusPolicy(Qt::WheelFocus);
+ viewport()->setBackgroundMode(Qt::PaletteBase);
connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) );
//US setBackgroundMode(PaletteBackground, PaletteBase);
- setBackgroundMode(PaletteBackground);
+ setBackgroundMode(Qt::PaletteBackground);
// no reason for a vertical scrollbar
setVScrollBarMode(AlwaysOff);
}
CardView::~CardView()
{
delete d->mFm;
delete d->mBFm;
delete d;
d = 0;
}
void CardView::insertItem(CardViewItem *item)
{
d->mItemList.inSort(item);
setLayoutDirty(true);
}
void CardView::takeItem(CardViewItem *item)
{
if ( d->mCurrentItem == item )
d->mCurrentItem = item->nextItem();
d->mItemList.take(d->mItemList.findRef(item));
setLayoutDirty(true);
}
void CardView::clear()
{
d->mItemList.clear();
@@ -710,113 +718,113 @@ void CardView::setCurrentItem( CardViewItem *item )
if ( !item )
return;
else if ( item->cardView() != this )
{
kdDebug(5720)<<"CardView::setCurrentItem: Item ("<<item<<") not owned! Backing out.."<<endl;
return;
}
else if ( item == currentItem() )
{
return;
}
if ( d->mSelectionMode == Single )
{
setSelected( item, true );
}
else
{
CardViewItem *it = d->mCurrentItem;
d->mCurrentItem = item;
if ( it )
it->repaintCard();
item->repaintCard();
}
if ( ! d->mOnSeparator )
ensureItemVisible( item );
emit currentChanged( item );
}
CardViewItem *CardView::itemAt(const QPoint &viewPos)
{
CardViewItem *item = 0;
- QPtrListIterator<CardViewItem> iter(d->mItemList);
+ Q3PtrListIterator<CardViewItem> iter(d->mItemList);
bool found = false;
for (iter.toFirst(); iter.current() && !found; ++iter)
{
item = *iter;
//if (item->d->mRect.contains(viewPos))
if (QRect(item->d->x, item->d->y, d->mItemWidth, item->height()).contains(viewPos))
found = true;
}
if (found)
return item;
return 0;
}
QRect CardView::itemRect(const CardViewItem *item)
{
//return item->d->mRect;
return QRect(item->d->x, item->d->y, d->mItemWidth, item->height());
}
void CardView::ensureItemVisible(const CardViewItem *item)
{
ensureVisible(item->d->x , item->d->y, d->mItemSpacing, 0);
ensureVisible(item->d->x + d->mItemWidth, item->d->y, d->mItemSpacing, 0);
}
void CardView::repaintItem(const CardViewItem *item)
{
//repaintContents(item->d->mRect);
repaintContents( QRect(item->d->x, item->d->y, d->mItemWidth, item->height()) );
}
void CardView::setSelectionMode(CardView::SelectionMode mode)
{
selectAll(false);
d->mSelectionMode = mode;
}
CardView::SelectionMode CardView::selectionMode() const
{
return d->mSelectionMode;
}
void CardView::selectAll(bool state)
{
- QPtrListIterator<CardViewItem> iter(d->mItemList);
+ Q3PtrListIterator<CardViewItem> iter(d->mItemList);
if (!state)
{
for (iter.toFirst(); iter.current(); ++iter)
{
if ((*iter)->isSelected())
{
(*iter)->setSelected(false);
(*iter)->repaintCard();
}
}
//emit selectionChanged(); // WARNING FIXME
emit selectionChanged(0);
}
else if (d->mSelectionMode != CardView::Single)
{
for (iter.toFirst(); iter.current(); ++iter)
{
(*iter)->setSelected(true);
}
if (d->mItemList.count() > 0)
{
// emit, since there must have been at least one selected
emit selectionChanged();
//repaint();//???
viewport()->update();
}
}
}
void CardView::setSelected(CardViewItem *item, bool selected)
{
@@ -849,65 +857,65 @@ void CardView::setSelected(CardViewItem *item, bool selected)
{
emit selectionChanged();
emit selectionChanged(0);
}
}
else if (d->mSelectionMode == CardView::Multi)
{
item->setSelected(selected);
item->repaintCard();
emit selectionChanged();
}
else if (d->mSelectionMode == CardView::Extended)
{
bool b = signalsBlocked();
blockSignals(true);
selectAll(false);
blockSignals(b);
item->setSelected(selected);
item->repaintCard();
emit selectionChanged();
}
}
bool CardView::isSelected(CardViewItem *item) const
{
return (item && item->isSelected());
}
CardViewItem *CardView::selectedItem() const
{
// find the first selected item
- QPtrListIterator<CardViewItem> iter(d->mItemList);
+ Q3PtrListIterator<CardViewItem> iter(d->mItemList);
for (iter.toFirst(); iter.current(); ++iter)
{
if ((*iter)->isSelected())
return *iter;
}
return 0;
}
CardViewItem *CardView::firstItem() const
{
return d->mItemList.first();
}
int CardView::childCount() const
{
return d->mItemList.count();
}
/*US
CardViewItem *CardView::findItem(const QString &text, const QString &label,
Qt::StringComparisonMode compare)
{
// IF the text is empty, we will return null, since empty text will
// match anything!
if (text.isEmpty())
return 0;
QPtrListIterator<CardViewItem> iter(d->mItemList);
if (compare & Qt::BeginsWith)
{
QString value;
for (iter.toFirst(); iter.current(); ++iter)
@@ -926,211 +934,211 @@ CardViewItem *CardView::findItem(const QString &text, const QString &label,
}
*/
uint CardView::columnWidth()
{
return d->mDrawSeparators ?
d->mItemWidth + ( 2 * d->mItemSpacing ) + d->mSepWidth :
d->mItemWidth + d->mItemSpacing;
}
void CardView::drawContents(QPainter *p, int clipx, int clipy,
int clipw, int cliph)
{
//QScrollView::drawContents(p, clipx, clipy, clipw, cliph);
if (d->mLayoutDirty)
calcLayout();
//kdDebug() << "CardView::drawContents: " << clipx << ", " << clipy
// << ", " << clipw << ", " << cliph << endl;
QColorGroup cg = viewport()->palette().active(); // allow setting costum colors in the viewport pale
int cX, cY;
contentsToViewport ( clipx, clipy, cX, cY );
QRect clipRect(clipx, clipy, clipw, cliph);
QRect cardRect;
QRect sepRect;
CardViewItem *item;
CardViewSeparator *sep;
// make sure the viewport is a pure background
viewport()->erase( QRect ( cX, cY , clipw, cliph ) );
// Now tell the cards to draw, if they are in the clip region
- QPtrListIterator<CardViewItem> iter(d->mItemList);
+ Q3PtrListIterator<CardViewItem> iter(d->mItemList);
for (iter.toFirst(); iter.current(); ++iter)
{
item = *iter;
cardRect.setRect( item->d->x, item->d->y, d->mItemWidth, item->height() );
if (clipRect.intersects(cardRect) || clipRect.contains(cardRect))
{
//kdDebug() << "\trepainting card at: " << cardRect.x() << ", "
// << cardRect.y() << endl;
// Tell the card to paint
p->save();
p->translate(cardRect.x(), cardRect.y());
item->paintCard(p, cg);
p->restore();
}
}
// Followed by the separators if they are in the clip region
- QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList);
+ Q3PtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList);
for (sepIter.toFirst(); sepIter.current(); ++sepIter)
{
sep = *sepIter;
sepRect = sep->mRect;
if (clipRect.intersects(sepRect) || clipRect.contains(sepRect))
{
p->save();
p->translate(sepRect.x(), sepRect.y());
sep->paintSeparator(p, cg);
p->restore();
}
}
}
void CardView::resizeEvent(QResizeEvent *e)
{
- QScrollView::resizeEvent(e);
+ Q3ScrollView::resizeEvent(e);
setLayoutDirty(true);
}
void CardView::calcLayout()
{
//kdDebug() << "CardView::calcLayout:" << endl;
// Start in the upper left corner and layout all the
// cars using their height and width
int maxWidth = 0;
int maxHeight = 0;
int xPos = 0;
int yPos = 0;
int cardSpacing = d->mItemSpacing;
// delete the old separators
d->mSeparatorList.clear();
- QPtrListIterator<CardViewItem> iter(d->mItemList);
+ Q3PtrListIterator<CardViewItem> iter(d->mItemList);
CardViewItem *item = 0;
CardViewSeparator *sep = 0;
xPos += cardSpacing;
for (iter.toFirst(); iter.current(); ++iter)
{
item = *iter;
yPos += cardSpacing;
if (yPos + item->height() + cardSpacing >= height() - horizontalScrollBar()->height())
{
maxHeight = QMAX(maxHeight, yPos);
// Drawing in this column would be greater than the height
// of the scroll view, so move to next column
yPos = cardSpacing;
xPos += cardSpacing + maxWidth;
if (d->mDrawSeparators)
{
// Create a separator since the user asked
sep = new CardViewSeparator(this);
sep->mRect.moveTopLeft(QPoint(xPos, yPos+d->mItemMargin));
xPos += d->mSepWidth + cardSpacing;
d->mSeparatorList.append(sep);
}
maxWidth = 0;
}
item->d->x = xPos;
item->d->y = yPos;
yPos += item->height();
maxWidth = QMAX(maxWidth, d->mItemWidth);
}
xPos += maxWidth;
resizeContents( xPos + cardSpacing, maxHeight );
// Update the height of all the separators now that we know the
// max height of a column
- QPtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList);
+ Q3PtrListIterator<CardViewSeparator> sepIter(d->mSeparatorList);
for (sepIter.toFirst(); sepIter.current(); ++sepIter)
{
(*sepIter)->mRect.setHeight(maxHeight - 2*cardSpacing - 2*d->mItemMargin);
}
d->mLayoutDirty = false;
}
CardViewItem *CardView::itemAfter(CardViewItem *item)
{
/*int pos = */d->mItemList.findRef(item);
return d->mItemList.next();//at(pos+1);
}
uint CardView::itemMargin()
{
return d->mItemMargin;
}
void CardView::setItemMargin( uint margin )
{
if ( margin == d->mItemMargin )
return;
d->mItemMargin = margin;
setLayoutDirty( true );
}
uint CardView::itemSpacing()
{
return d->mItemSpacing;
}
void CardView::setItemSpacing( uint spacing )
{
if ( spacing == d->mItemSpacing )
return;
d->mItemSpacing = spacing;
setLayoutDirty( true );
}
void CardView::contentsMousePressEvent(QMouseEvent *e)
{
- QScrollView::contentsMousePressEvent(e);
+ Q3ScrollView::contentsMousePressEvent(e);
QPoint pos = e->pos();
d->mLastClickPos = pos;
CardViewItem *item = itemAt(pos);
if (item == 0)
{
d->mLastClickOnItem = false;
if ( d->mOnSeparator)
{
d->mResizeAnchor = e->x()+contentsX();
d->colspace = (2*d->mItemSpacing) /*+ (2*d->mItemMargin)*/;
int ccw = d->mItemWidth + d->colspace + d->mSepWidth;
d->first = (contentsX()+d->mSepWidth)/ccw;
d->pressed = (d->mResizeAnchor+d->mSepWidth)/ccw;
d->span = d->pressed - d->first;
d->firstX = d->first * ccw;
if ( d->firstX ) d->firstX -= d->mSepWidth; // (no sep in col 0)
}
else
{
selectAll(false);
}
return;
}
d->mLastClickOnItem = true;
CardViewItem *other = d->mCurrentItem;
setCurrentItem( item );
@@ -1142,413 +1150,413 @@ void CardView::contentsMousePressEvent(QMouseEvent *e)
{
// make sure it isn't already selected
if (item->isSelected())
return;
bool b = signalsBlocked();
blockSignals(true);
selectAll(false);
blockSignals(b);
item->setSelected(true);
item->repaintCard();
emit selectionChanged(item);
}
else if (d->mSelectionMode == CardView::Multi)
{
// toggle the selection
item->setSelected(!item->isSelected());
item->repaintCard();
emit selectionChanged();
}
else if (d->mSelectionMode == CardView::Extended)
{
if ((e->button() & Qt::LeftButton) &&
(e->state() & Qt::ShiftButton))
{
if ( item == other ) return;
bool s = ! item->isSelected();
- if ( s && ! (e->state() & ControlButton) )
+ if ( s && ! (e->state() & Qt::ControlButton) )
{
bool b = signalsBlocked();
blockSignals(true);
selectAll(false);
blockSignals(b);
}
int from, to, a, b;
a = d->mItemList.findRef( item );
b = d->mItemList.findRef( other );
from = a < b ? a : b;
to = a > b ? a : b;
//kdDebug()<<"selecting items "<<from<<" - "<<to<<" ( "<<s<<" )"<<endl;
CardViewItem *aItem;
for ( ; from <= to; from++ )
{
aItem = d->mItemList.at( from );
aItem->setSelected( s );
repaintItem( aItem );
}
emit selectionChanged();
}
else if ((e->button() & Qt::LeftButton) &&
(e->state() & Qt::ControlButton))
{
item->setSelected(!item->isSelected());
item->repaintCard();
emit selectionChanged();
}
else if (e->button() & Qt::LeftButton)
{
bool b = signalsBlocked();
blockSignals(true);
selectAll(false);
blockSignals(b);
item->setSelected(true);
item->repaintCard();
emit selectionChanged();
}
}
}
void CardView::contentsMouseReleaseEvent(QMouseEvent *e)
{
- QScrollView::contentsMouseReleaseEvent(e);
+ Q3ScrollView::contentsMouseReleaseEvent(e);
if ( d->mResizeAnchor )
{
// finish the resizing:
unsetCursor();
// hide rubber bands
int newiw = d->mItemWidth - ((d->mResizeAnchor - d->mRubberBandAnchor)/d->span);
drawRubberBands( 0 );
// we should move to reflect the new position if we are scrolled.
if ( contentsX() )
{
int newX = QMAX( 0, ( d->pressed * ( newiw + d->colspace + d->mSepWidth ) ) - e->x() );
setContentsPos( newX, contentsY() );
}
// set new item width
setItemWidth( newiw );
// reset anchors
d->mResizeAnchor = 0;
d->mRubberBandAnchor = 0;
return;
}
// If there are accel keys, we will not emit signals
if ((e->state() & Qt::ShiftButton) || (e->state() & Qt::ControlButton))
return;
// Get the item at this position
CardViewItem *item = itemAt(e->pos());
if (item && KABPrefs::instance()->mHonorSingleClick)
{
emit executed(item);
}
}
void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
- QScrollView::contentsMouseDoubleClickEvent(e);
+ Q3ScrollView::contentsMouseDoubleClickEvent(e);
CardViewItem *item = itemAt(e->pos());
if (item)
{
d->mCurrentItem = item;
}
if (item && !KABPrefs::instance()->mHonorSingleClick)
{
emit executed(item);
} else
emit doubleClicked(item);
}
void CardView::contentsMouseMoveEvent( QMouseEvent *e )
{
// resizing
if ( d->mResizeAnchor )
{
int x = e->x();
if ( x != d->mRubberBandAnchor )
drawRubberBands( x );
return;
}
if (d->mLastClickOnItem && (e->state() & Qt::LeftButton) &&
((e->pos() - d->mLastClickPos).manhattanLength() > 4)) {
startDrag();
return;
}
d->mTimer->start( 500 );
// see if we are over a separator
// only if we actually have them painted?
if ( d->mDrawSeparators )
{
int colcontentw = d->mItemWidth + (2*d->mItemSpacing);
int colw = colcontentw + d->mSepWidth;
int m = e->x()%colw;
if ( m >= colcontentw && m > 0 )
{
- setCursor( SplitVCursor ); // Why does this fail sometimes?
+ setCursor( Qt::SplitVCursor ); // Why does this fail sometimes?
d->mOnSeparator = true;
}
else
{
- setCursor( ArrowCursor );
+ setCursor( Qt::ArrowCursor );
d->mOnSeparator = false;
}
}
}
void CardView::enterEvent( QEvent * )
{
d->mTimer->start( 500 );
}
void CardView::leaveEvent( QEvent * )
{
d->mTimer->stop();
if (d->mOnSeparator)
{
d->mOnSeparator = false;
- setCursor( ArrowCursor );
+ setCursor( Qt::ArrowCursor );
}
}
void CardView::focusInEvent( QFocusEvent * )
{
if (!d->mCurrentItem && d->mItemList.count() )
{
setCurrentItem( d->mItemList.first() );
}
else if ( d->mCurrentItem )
{
d->mCurrentItem->repaintCard();
}
}
void CardView::focusOutEvent( QFocusEvent * )
{
if (d->mCurrentItem)
d->mCurrentItem->repaintCard();
}
void CardView::keyPressEvent( QKeyEvent *e )
{
if ( ! ( childCount() && d->mCurrentItem ) )
{
e->ignore();
return;
}
if ( mFlagBlockKeyPressed )
return;
qApp->processEvents();
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->accept();
return;
}
if (! e->isAutoRepeat() )
mFlagKeyPressed = true;
uint pos = d->mItemList.findRef( d->mCurrentItem );
CardViewItem *aItem = 0L; // item that gets the focus
CardViewItem *old = d->mCurrentItem;
switch ( e->key() )
{
- case Key_Up:
+ case Qt::Key_Up:
if ( pos > 0 )
{
aItem = d->mItemList.at( pos - 1 );
setCurrentItem( aItem );
}
break;
- case Key_Down:
+ case Qt::Key_Down:
if ( pos < d->mItemList.count() - 1 )
{
aItem = d->mItemList.at( pos + 1 );
setCurrentItem( aItem );
}
break;
- case Key_Left:
+ case Qt::Key_Left:
{
// look for an item in the previous/next column, starting from
// the vertical middle of the current item.
// FIXME use nice calculatd measures!!!
QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y );
aPoint -= QPoint( 30,-(d->mCurrentItem->height()/2) );
aItem = itemAt( aPoint );
// maybe we hit some space below an item
while ( !aItem && aPoint.y() > 27 )
{
aPoint -= QPoint( 0, 16 );
aItem = itemAt( aPoint );
}
if ( aItem )
setCurrentItem( aItem );
}
break;
- case Key_Right:
+ case Qt::Key_Right:
{
// FIXME use nice calculated measures!!!
QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y );
aPoint += QPoint( 30,(d->mCurrentItem->height()/2) );
aItem = itemAt( aPoint );
while ( !aItem && aPoint.y() > 27 )
{
aPoint -= QPoint( 0, 16 );
aItem = itemAt( aPoint );
}
if ( aItem )
setCurrentItem( aItem );
}
break;
- case Key_Home:
+ case Qt::Key_Home:
aItem = d->mItemList.first();
setCurrentItem( aItem );
break;
- case Key_End:
+ case Qt::Key_End:
aItem = d->mItemList.last();
setCurrentItem( aItem );
break;
- case Key_Prior: // PageUp
+ case Qt::Key_Prior: // PageUp
{
// QListView: "Make the item above the top visible and current"
// TODO if contentsY(), pick the top item of the leftmost visible column
if ( contentsX() <= 0 )
return;
int cw = columnWidth();
int theCol = ( QMAX( 0, ( contentsX()/cw) * cw ) ) + d->mItemSpacing;
aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) );
if ( aItem )
setCurrentItem( aItem );
}
break;
- case Key_Next: // PageDown
+ case Qt::Key_Next: // PageDown
{
// QListView: "Make the item below the bottom visible and current"
// find the first not fully visible column.
// TODO: consider if a partly visible (or even hidden) item at the
// bottom of the rightmost column exists
int cw = columnWidth();
int theCol = ( (( contentsX() + visibleWidth() )/cw) * cw ) + d->mItemSpacing + 1;
// if separators are on, we may need to we may be one column further right if only the spacing/sep is hidden
if ( d->mDrawSeparators && cw - (( contentsX() + visibleWidth() )%cw) <= int( d->mItemSpacing + d->mSepWidth ) )
theCol += cw;
// make sure this is not too far right
while ( theCol > contentsWidth() )
theCol -= columnWidth();
aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) );
if ( aItem )
setCurrentItem( aItem );
}
break;
- case Key_Space:
+ case Qt::Key_Space:
setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() );
emit selectionChanged();
break;
- case Key_Return:
- case Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
{
emit returnPressed( d->mCurrentItem );
emit executed( d->mCurrentItem );
}
break;
default:
- if ( (e->state() & ControlButton) && e->key() == Key_A )
+ if ( (e->state() & Qt::ControlButton) && e->key() == Qt::Key_A )
{
// select all
selectAll( true );
break;
}
// if we have a string, do autosearch
else if ( ! e->text().isEmpty() && e->text()[0].isPrint() )
{
}
break;
}
// handle selection
if ( aItem )
{
if ( d->mSelectionMode == CardView::Extended )
{
- if ( (e->state() & ShiftButton) )
+ if ( (e->state() & Qt::ShiftButton) )
{
// shift button: toggle range
// if control button is pressed, leave all items
// and toggle selection current->old current
// otherwise, ??????
bool s = ! aItem->isSelected();
int from, to, a, b;
a = d->mItemList.findRef( aItem );
b = d->mItemList.findRef( old );
from = a < b ? a : b;
to = a > b ? a : b;
if ( to - from > 1 )
{
bool b = signalsBlocked();
blockSignals(true);
selectAll(false);
blockSignals(b);
}
//kdDebug()<<"selecting items "<<from<<" - "<<to<<" ( "<<s<<" )"<<endl;
CardViewItem *item;
for ( ; from <= to; from++ )
{
item = d->mItemList.at( from );
item->setSelected( s );
repaintItem( item );
}
emit selectionChanged();
}
- else if ( (e->state() & ControlButton) )
+ else if ( (e->state() & Qt::ControlButton) )
{
// control button: do nothing
}
else
{
// no button: move selection to this item
bool b = signalsBlocked();
blockSignals(true);
selectAll(false);
blockSignals(b);
setSelected( aItem, true );
emit selectionChanged();
}
}
}
}
void CardView::contentsWheelEvent( QWheelEvent * e )
{
scrollBy(2*e->delta()/-3, 0);
}
void CardView::setLayoutDirty(bool dirty)
{
if (d->mLayoutDirty != dirty)
{
d->mLayoutDirty = dirty;
repaint();
}
}
@@ -1609,142 +1617,142 @@ bool CardView::showEmptyFields() const
}
void CardView::startDrag()
{
// The default implementation is a no-op. It must be
// reimplemented in a subclass to be useful
}
void CardView::tryShowFullText()
{
d->mTimer->stop();
// if we have an item
QPoint cpos = viewportToContents( viewport()->mapFromGlobal( QCursor::pos() ) );
CardViewItem *item = itemAt( cpos );
if ( item )
{
// query it for a value to display
//QString s = item ? item->caption() : "(no item)";
//kdDebug()<<"MOUSE REST: "<<s<<endl;
QPoint ipos = cpos - itemRect( item ).topLeft();
item->showFullString( ipos, d->mTip );
}
}
void CardView::drawRubberBands( int pos )
{
if ( pos && ((pos-d->firstX)/d->span) - d->colspace - d->mSepWidth < MIN_ITEM_WIDTH ) return;
int tmpcw = (d->mRubberBandAnchor-d->firstX)/d->span;
int x = d->firstX + tmpcw - d->mSepWidth - contentsX();
int h = visibleHeight();
QPainter p( viewport() );
- p.setRasterOp( XorROP );
- p.setPen( gray );
- p.setBrush( gray );
+ p.setCompositionMode( QPainter::CompositionMode_Xor );
+ p.setPen( Qt::gray );
+ p.setBrush( Qt::gray );
uint n = d->first;
// erase
if ( d->mRubberBandAnchor )
do {
p.drawRect( x, 0, 2, h );
x += tmpcw;
n++;
} while ( x < visibleWidth() && n < d->mSeparatorList.count() );
// paint new
if ( ! pos ) return;
tmpcw = (pos - d->firstX)/d->span;
n = d->first;
x = d->firstX + tmpcw - d->mSepWidth - contentsX();
do {
p.drawRect( x, 0, 2, h );
x += tmpcw;
n++;
} while ( x < visibleWidth() && n < d->mSeparatorList.count() );
d->mRubberBandAnchor = pos;
}
int CardView::itemWidth() const
{
return d->mItemWidth;
}
void CardView::setItemWidth( int w )
{
if ( w == d->mItemWidth )
return;
if ( w < MIN_ITEM_WIDTH )
w = MIN_ITEM_WIDTH;
d->mItemWidth = w;
setLayoutDirty( true );
#ifndef KAB_EMBEDDED
updateContents();
#else //KAB_EMBEDDED
//US updateContents( d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight() );
qDebug("CardView::setItemWidth has to be verified");
updateContents( contentsX(), contentsY(), visibleWidth(), visibleHeight() );
#endif //KAB_EMBEDDED
}
void CardView::setHeaderFont( const QFont &fnt )
{
d->mHeaderFont = fnt;
delete d->mBFm;
d->mBFm = new QFontMetrics( fnt );
}
QFont CardView::headerFont() const
{
return d->mHeaderFont;
}
void CardView::setFont( const QFont &fnt )
{
- QScrollView::setFont( fnt );
+ Q3ScrollView::setFont( fnt );
delete d->mFm;
d->mFm = new QFontMetrics( fnt );
}
int CardView::separatorWidth()
{
return d->mSepWidth;
}
void CardView::setSeparatorWidth( int width )
{
d->mSepWidth = width;
setLayoutDirty( true ); // hmm, actually I could just adjust the x'es...
}
int CardView::maxFieldLines() const
{
return d->mMaxFieldLines;
}
void CardView::setMaxFieldLines( int howmany )
{
d->mMaxFieldLines = howmany ? howmany : INT_MAX;
// FIXME update, forcing the items to recalc height!!
}
void CardView::keyReleaseEvent ( QKeyEvent * e )
{
if ( mFlagBlockKeyPressed )
return;
if ( !e->isAutoRepeat() ) {
mFlagBlockKeyPressed = true;
qApp->processEvents();
mFlagBlockKeyPressed = false;
mFlagKeyPressed = false;
}
- QScrollView::keyReleaseEvent ( e );
+ Q3ScrollView::keyReleaseEvent ( e );
}
//END Cardview
-#ifndef KAB_EMBEDDED
-#include "cardview.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_cardview.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/cardview.h b/kaddressbook/views/cardview.h
index 2ea3771..9c245ea 100644
--- a/kaddressbook/views/cardview.h
+++ b/kaddressbook/views/cardview.h
@@ -1,41 +1,49 @@
#ifndef CARDVIEW_H
#define CARDVIEW_H
-#include <qscrollview.h>
-#include <qptrlist.h>
+#include <q3scrollview.h>
+#include <q3ptrlist.h>
#include <qstring.h>
#include <qrect.h>
#include <qpair.h>
#include <qpoint.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QLabel>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
class QLabel;
class QPainter;
class QResizeEvent;
class QMouseEvent;
class CardView;
class CardViewPrivate;
class CardViewItemPrivate;
class CardViewTip;
/** Represents a single card (item) in the card view. A card has a caption
* and a list of fields. A Field is a label<->value pair. The labels in a
* card should be unique, since they will be used to index the values.
*/
class CardViewItem
{
friend class CardView;
public:
/** A single field in the card view. The first item is the label
* and the second item is the value.
*/
typedef QPair<QString, QString> Field;
/** Constructor.
*
* @param parent The CardView that this card should be displayed on.
* @param caption The caption of the card. This is the text that will
* appear at the top of the card. This is also the string that will
* be used to sort the cards in the view.
*/
CardViewItem(CardView *parent, QString caption = QString::null);
@@ -119,65 +127,65 @@ class CardViewItem
/** Sets the card as selected. This is usually only called from the
* card view.
*/
void setSelected(bool selected);
private:
/** Sets the default values.
*/
void initialize();
/** Trims a string to the width <i>width</i> using the font metrics
* to determine the width of each char. If the string is longer than
* <i>width</i>, then the string will be trimmed and a '...' will
* be appended.
*/
QString trimString(const QString &text, int width, QFontMetrics &fm);
CardViewItemPrivate *d;
CardView *mView;
};
/** The CardView is a method of displaying data in cards. This idea is
* similar to the idea of a rolodex or business cards. Each card has a
* caption and a list of fields, which are label<->value pairs. The CardView
* displays multiple cards in a grid. The Cards are sorted based on their
* caption.
*
* The CardView class is designed to mirror the API of the QListView or
* QIconView. The CardView is also completely independant of KAddressBook and
* can be used elsewhere. With the exception of a few simple config checks,
* the CardView is also 100% independant of KDE.
*/
-class CardView : public QScrollView
+class CardView : public Q3ScrollView
{
friend class CardViewItem;
Q_OBJECT
public:
/** Constructor.
*/
CardView(QWidget *parent, const char *name);
virtual ~CardView();
/** Inserts the item into the card view. This method does not have
* to be called if you created the item with a proper parent. Once
* inserted, the CardView takes ownership of the item.
*/
void insertItem(CardViewItem *item);
/** Takes the item from the view. The item will not be deleted and
* ownership of the item is returned to the caller.
*/
void takeItem(CardViewItem *item);
/** Clears the view and deletes all card view items
*/
void clear();
/** @return The current item, the item that has the focus.
* Whenever the view has focus, this item has a focus rectangle painted
* at it's border.
* @sa setCurrentItem()
*/
CardViewItem *currentItem();
diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp
index 2bddca6..46a59a1 100644
--- a/kaddressbook/views/colorlistbox.cpp
+++ b/kaddressbook/views/colorlistbox.cpp
@@ -1,113 +1,118 @@
/*
* kmail: KDE mail client
* This file: Copyright (C) 2000 Espen Sand, espen@kde.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <qpainter.h>
+//Added by qt3to4:
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QDragMoveEvent>
+#include <QDragLeaveEvent>
#include <kcolordialog.h>
#ifndef KAB_EMBEDDED
#include <kcolordrag.h>
#endif //KAB_EMBEDDED
#include "colorlistbox.h"
#ifdef DESKTOP_VERSION
#include <qcolordialog.h>
#endif
-ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f )
+ColorListBox::ColorListBox( QWidget *parent, const char *name, Qt::WFlags f )
:KListBox( parent, name, f ), mCurrentOnDragEnter(-1)
{
connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) );
- connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) );
+ connect( this, SIGNAL(clicked(Q3ListBoxItem *)), this, SLOT(slotNewColor(Q3ListBoxItem *)) );
setAcceptDrops( true);
}
void ColorListBox::setEnabled( bool state )
{
if( state == isEnabled() )
{
return;
}
- QListBox::setEnabled( state );
+ Q3ListBox::setEnabled( state );
for( uint i=0; i<count(); i++ )
{
updateItem( i );
}
}
void ColorListBox::setColor( uint index, const QColor &color )
{
if( index < count() )
{
ColorListItem *colorItem = (ColorListItem*)item(index);
colorItem->setColor(color);
updateItem( colorItem );
}
}
QColor ColorListBox::color( uint index ) const
{
if( index < count() )
{
ColorListItem *colorItem = (ColorListItem*)item(index);
return( colorItem->color() );
}
else
{
- return( black );
+ return( Qt::black );
}
}
-void ColorListBox::slotNewColor(QListBoxItem * i)
+void ColorListBox::slotNewColor(Q3ListBoxItem * i)
{
if ( i )
newColor( index( i ) );
}
void ColorListBox::newColor( int index )
{
if( isEnabled() == false )
{
return;
}
if( (uint)index < count() )
{
QColor c = color( index );
#ifndef KAB_EMBEDDED
if( KColorDialog::getColor( c, this ) != QDialog::Rejected )
{
setColor( index, c );
}
#else //KAB_EMBEDDED
#ifdef DESKTOP_VERSION
QColor col = QColorDialog::getColor ( c );
if ( col.isValid () ) {
setColor( index, col );
}
#else
KColorDialog* k = new KColorDialog( this );
k->setColor( c );
int res = k->exec();
if ( res ) {
setColor( index, k->getColor() );
@@ -169,77 +174,77 @@ void ColorListBox::dragMoveEvent( QDragMoveEvent *e )
#else //KAB_EMBEDDED
qDebug("ColorListBox::dragMoveEvent drag&drop currently not supported");
#endif //KAB_EMBEDDED
}
void ColorListBox::dropEvent( QDropEvent *e )
{
#ifndef KAB_EMBEDDED
QColor color;
if( KColorDrag::decode( e, color ) )
{
int index = currentItem();
if( index != -1 )
{
ColorListItem *colorItem = (ColorListItem*)item(index);
colorItem->setColor(color);
triggerUpdate( false ); // Redraw item
}
mCurrentOnDragEnter = -1;
}
#else //KAB_EMBEDDED
qDebug("ColorListBox::dropEvent drag&drop currently not supported");
#endif //KAB_EMBEDDED
}
ColorListItem::ColorListItem( const QString &text, const QColor &color )
- : QListBoxItem(), mColor( color ), mBoxWidth( 30 )
+ : Q3ListBoxItem(), mColor( color ), mBoxWidth( 30 )
{
setText( text );
}
const QColor &ColorListItem::color( void )
{
return( mColor );
}
void ColorListItem::setColor( const QColor &color )
{
mColor = color;
}
void ColorListItem::paint( QPainter *p )
{
QFontMetrics fm = p->fontMetrics();
int h = fm.height();
p->drawText( mBoxWidth+3*2, fm.ascent() + fm.leading()/2, text() );
p->setPen( Qt::black );
p->drawRect( 3, 1, mBoxWidth, h-1 );
p->fillRect( 4, 2, mBoxWidth-2, h-3, mColor );
}
-int ColorListItem::height(const QListBox *lb ) const
+int ColorListItem::height(const Q3ListBox *lb ) const
{
return( lb->fontMetrics().lineSpacing()+1 );
}
-int ColorListItem::width(const QListBox *lb ) const
+int ColorListItem::width(const Q3ListBox *lb ) const
{
return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 );
}
-#ifndef KAB_EMBEDDED
-#include "colorlistbox.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_colorlistbox.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/colorlistbox.h b/kaddressbook/views/colorlistbox.h
index bb91484..31a8085 100644
--- a/kaddressbook/views/colorlistbox.h
+++ b/kaddressbook/views/colorlistbox.h
@@ -1,77 +1,82 @@
/*
* kmail: KDE mail client
* This file: Copyright (C) 2000 Espen Sand, espen@kde.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _COLOR_LISTBOX_H_
#define _COLOR_LISTBOX_H_
#include <klistbox.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDragLeaveEvent>
+#include <QDropEvent>
+#include <QDragEnterEvent>
class QDragEnterEvent;
class QDragLeaveEvent;
class QDragMoveEvent;
class QDropEvent;
class ColorListBox : public KListBox
{
Q_OBJECT
public:
- ColorListBox( QWidget *parent=0, const char * name=0, WFlags f=0 );
+ ColorListBox( QWidget *parent=0, const char * name=0, Qt::WFlags f=0 );
void setColor( uint index, const QColor &color );
QColor color( uint index ) const;
public slots:
virtual void setEnabled( bool state );
protected:
void dragEnterEvent( QDragEnterEvent *e );
void dragLeaveEvent( QDragLeaveEvent *e );
void dragMoveEvent( QDragMoveEvent *e );
void dropEvent( QDropEvent *e );
private slots:
void newColor( int index );
- void slotNewColor(QListBoxItem * i);
+ void slotNewColor(Q3ListBoxItem * i);
private:
int mCurrentOnDragEnter;
};
-class ColorListItem : public QListBoxItem
+class ColorListItem : public Q3ListBoxItem
{
public:
ColorListItem( const QString &text, const QColor &color=Qt::black );
const QColor &color( void );
void setColor( const QColor &color );
protected:
virtual void paint( QPainter * );
- virtual int height( const QListBox * ) const;
- virtual int width( const QListBox * ) const;
+ virtual int height( const Q3ListBox * ) const;
+ virtual int width( const Q3ListBox * ) const;
private:
QColor mColor;
int mBoxWidth;
};
#endif
diff --git a/kaddressbook/views/configurecardviewdialog.cpp b/kaddressbook/views/configurecardviewdialog.cpp
index e0fbd21..b6327fe 100644
--- a/kaddressbook/views/configurecardviewdialog.cpp
+++ b/kaddressbook/views/configurecardviewdialog.cpp
@@ -1,124 +1,127 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstring.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qcheckbox.h>
-#include <qvbox.h>
-#include <qgroupbox.h>
+#include <q3vbox.h>
+#include <q3groupbox.h>
#include <qspinbox.h>
#include <qtabwidget.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3Frame>
#include <kdebug.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kconfig.h>
#include <kfontdialog.h>
#ifndef KAB_EMBEDDED
#include <kpushbutton.h>
#else //KAB_EMBEDDED
#include <qpushbutton.h>
#endif //KAB_EMBEDDED
#include "colorlistbox.h"
#include "configurecardviewdialog.h"
/////////////////////////////////
// ConfigureCardViewDialog
ConfigureCardViewWidget::ConfigureCardViewWidget( KABC::AddressBook *ab, QWidget *parent,
const char *name )
: ViewConfigureWidget( ab, parent, name )
{
#ifndef KAB_EMBEDDED
QWidget *page = addPage( i18n( "Look & Feel" ), QString::null,
DesktopIcon( "looknfeel" ) );
#else //KAB_EMBEDDED
QWidget *page = addPage( i18n( "Look & Feel" ), QString::null,
KGlobal::iconLoader()->loadIcon( "looknfeel",
KIcon::Panel ) );
#endif //KAB_EMBEDDED
mAdvancedPage = new CardViewLookNFeelPage( page );
}
ConfigureCardViewWidget::~ConfigureCardViewWidget()
{
}
void ConfigureCardViewWidget::restoreSettings( KConfig *config )
{
ViewConfigureWidget::restoreSettings( config );
mAdvancedPage->restoreSettings( config );
}
void ConfigureCardViewWidget::saveSettings( KConfig *config )
{
ViewConfigureWidget::saveSettings( config );
mAdvancedPage->saveSettings( config );
}
////////////////////////
// CardViewLookNFeelPage
CardViewLookNFeelPage::CardViewLookNFeelPage( QWidget *parent, const char *name )
- : QVBox( parent, name )
+ : Q3VBox( parent, name )
{
initGUI();
}
CardViewLookNFeelPage::~CardViewLookNFeelPage()
{
}
void CardViewLookNFeelPage::restoreSettings( KConfig *config )
{
// colors
cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) );
QColor c;
qDebug("CardViewLookNFeelPage::restoreSettings make base color configurable");
#ifndef KAB_EMBEDDED
c = KGlobalSettings::baseColor();
#else //KAB_EMBEDDED
c = QColor(0,0,0);
#endif //KAB_EMBEDDED
c = colorGroup().background();
lbColors->insertItem( new ColorListItem( i18n("Background Color"),
config->readColorEntry( "BackgroundColor", &c ) ) );
c = colorGroup().foreground();
lbColors->insertItem( new ColorListItem( i18n("Text Color"),
config->readColorEntry( "TextColor", &c ) ) );
c = colorGroup().button();
lbColors->insertItem( new ColorListItem( i18n("Header, Border and Separator Color"),
config->readColorEntry( "HeaderColor", &c ) ) );
c = colorGroup().buttonText();
lbColors->insertItem( new ColorListItem( i18n("Header Text Color"),
@@ -205,165 +208,165 @@ void CardViewLookNFeelPage::setHeaderFont()
if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
updateFontLabel( f, lHeaderFont );
#else //KAB_EMBEDDED
bool ok;
QFont fout = KFontDialog::getFont( f, ok);
if ( ok )
updateFontLabel( fout, lHeaderFont );
#endif //KAB_EMBEDDED
}
void CardViewLookNFeelPage::enableFonts()
{
vbFonts->setEnabled( cbEnableCustomFonts->isChecked() );
if ( cbEnableCustomFonts->isChecked() )
vbFonts->setFocus();
}
void CardViewLookNFeelPage::enableColors()
{
lbColors->setEnabled( cbEnableCustomColors->isChecked() );
if ( cbEnableCustomColors->isChecked() )
lbColors->setFocus();
}
void CardViewLookNFeelPage::initGUI()
{
int spacing = KDialog::spacingHint();
int margin = KDialog::marginHint();
QTabWidget *tabs = new QTabWidget( this );
// Layout
- QVBox *loTab = new QVBox( this, "layouttab" );
+ Q3VBox *loTab = new Q3VBox( this, "layouttab" );
loTab->setSpacing( spacing );
loTab->setMargin( margin );
- QGroupBox *gbGeneral = new QGroupBox( 1, Qt::Horizontal, i18n("General"), loTab );
+ Q3GroupBox *gbGeneral = new Q3GroupBox( 1, Qt::Horizontal, i18n("General"), loTab );
cbDrawSeps = new QCheckBox( i18n("Draw &separators"), gbGeneral );
- QHBox *hbSW = new QHBox( gbGeneral );
+ Q3HBox *hbSW = new Q3HBox( gbGeneral );
QLabel *lSW = new QLabel( i18n("Separator &width:"), hbSW );
sbSepWidth = new QSpinBox( 1, 50, 1, hbSW );
lSW->setBuddy( sbSepWidth);
- QHBox *hbPadding = new QHBox( gbGeneral );
+ Q3HBox *hbPadding = new Q3HBox( gbGeneral );
QLabel *lSpacing = new QLabel( i18n("&Padding:"), hbPadding );
sbSpacing = new QSpinBox( 0, 100, 1, hbPadding );
lSpacing->setBuddy( sbSpacing );
- QGroupBox *gbCards = new QGroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab );
+ Q3GroupBox *gbCards = new Q3GroupBox( 1, Qt::Horizontal, i18n("Cards"), loTab );
- QHBox *hbMargin = new QHBox( gbCards );
+ Q3HBox *hbMargin = new Q3HBox( gbCards );
QLabel *lMargin = new QLabel( i18n("&Margin:"), hbMargin );
sbMargin = new QSpinBox( 0, 100, 1, hbMargin );
lMargin->setBuddy( sbMargin );
cbDrawBorders = new QCheckBox( i18n("Draw &borders"), gbCards );
loTab->setStretchFactor( new QWidget( loTab ), 1 );
- QWhatsThis::add( sbMargin, i18n(
+ Q3WhatsThis::add( sbMargin, i18n(
"The item margin is the distance (in pixels) between the item edge and the item data. Most noticeably, "
"incrementing the item margin will add space between the focus rectangle and the item data."
) );
- QWhatsThis::add( lMargin, QWhatsThis::textFor( sbMargin ) );
- QWhatsThis::add( sbSpacing, i18n(
+ /* TODO:hacker: Q3WhatsThis::add( lMargin, Q3WhatsThis::textFor( sbMargin ) ); */
+ Q3WhatsThis::add( sbSpacing, i18n(
"The Item Spacing decides the distance (in pixels) between the items and anything else: the view "
"borders, other items or column separators."
) );
- QWhatsThis::add( lSpacing, QWhatsThis::textFor( sbSpacing ) );
- QWhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") );
- QWhatsThis::add( lSW, QWhatsThis::textFor( sbSepWidth ) );
+ /* TODO:hacker: Q3WhatsThis::add( lSpacing, Q3WhatsThis::textFor( sbSpacing ) ); */
+ Q3WhatsThis::add( sbSepWidth, i18n("Sets the width of column separators") );
+ /* TODO:hacker: Q3WhatsThis::add( lSW, Q3WhatsThis::textFor( sbSepWidth ) ); */
tabs->addTab( loTab, i18n("&Layout") );
// Colors
- QVBox *colorTab = new QVBox( this, "colortab" );
+ Q3VBox *colorTab = new Q3VBox( this, "colortab" );
colorTab->setSpacing( spacing );
colorTab->setMargin( spacing );
cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab );
connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) );
lbColors = new ColorListBox( colorTab );
tabs->addTab( colorTab, i18n("&Colors") );
- QWhatsThis::add( cbEnableCustomColors, i18n(
+ Q3WhatsThis::add( cbEnableCustomColors, i18n(
"If custom colors are enabled, you may choose the colors for the view below. "
"Otherwise colors from your current KDE color scheme are used."
) );
- QWhatsThis::add( lbColors, i18n(
+ Q3WhatsThis::add( lbColors, i18n(
"Double click or press RETURN on a item to select a color for the related strings in the view."
) );
// Fonts
- QVBox *fntTab = new QVBox( this, "fonttab" );
+ Q3VBox *fntTab = new Q3VBox( this, "fonttab" );
fntTab->setSpacing( spacing );
fntTab->setMargin( spacing );
cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab );
connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) );
vbFonts = new QWidget( fntTab );
- QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 );
+ Q3GridLayout *gFnts = new Q3GridLayout( vbFonts, 2, 3 );
gFnts->setSpacing( spacing );
gFnts->setAutoAdd( true );
gFnts->setColStretch( 1, 1 );
QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts );
lTextFont = new QLabel( vbFonts );
- lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken );
+ lTextFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken );
#ifndef KAB_EMBEDDED
btnFont = new KPushButton( i18n("Choose..."), vbFonts );
#else //KAB_EMBEDDED
btnFont = new QPushButton( i18n("Choose..."), vbFonts );
#endif //KAB_EMBEDDED
lTFnt->setBuddy( btnFont );
connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) );
QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts );
lHeaderFont = new QLabel( vbFonts );
- lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken );
+ lHeaderFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken );
#ifndef KAB_EMBEDDED
btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts );
#else //KAB_EMBEDDED
btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts );
#endif //KAB_EMBEDDED
lHFnt->setBuddy( btnHeaderFont );
connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) );
fntTab->setStretchFactor( new QWidget( fntTab ), 1 );
- QWhatsThis::add( cbEnableCustomFonts, i18n(
+ Q3WhatsThis::add( cbEnableCustomFonts, i18n(
"If custom fonts are enabled, you may choose which fonts to use for this view below. "
"Otherwise the default KDE font will be used, in bold style for the header and "
"normal style for the data."
) );
tabs->addTab( fntTab, i18n("&Fonts") );
// Behaviour
- QVBox *behaviourTab = new QVBox( this );
+ Q3VBox *behaviourTab = new Q3VBox( this );
behaviourTab->setMargin( margin );
behaviourTab->setSpacing( spacing );
cbShowEmptyFields = new QCheckBox( i18n("Show &empty fields"), behaviourTab );
cbShowFieldLabels = new QCheckBox( i18n("Show field &labels"), behaviourTab );
behaviourTab->setStretchFactor( new QWidget( behaviourTab ), 1 );
tabs->addTab( behaviourTab, i18n("Be&havior") );
}
void CardViewLookNFeelPage::updateFontLabel( QFont fnt, QLabel *l )
{
l->setFont( fnt );
l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) );
}
-#ifndef KAB_EMBEDDED
-#include "configurecardviewdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_configurecardviewdialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/configurecardviewdialog.h b/kaddressbook/views/configurecardviewdialog.h
index 7a62226..4af475d 100644
--- a/kaddressbook/views/configurecardviewdialog.h
+++ b/kaddressbook/views/configurecardviewdialog.h
@@ -1,112 +1,114 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef CONFIGURECARDVIEWDIALOG_H
#define CONFIGURECARDVIEWDIALOG_H
#include "viewconfigurewidget.h"
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qwidget.h>
#include <qfont.h>
+//Added by qt3to4:
+#include <QLabel>
class QString;
class QWidget;
class QCheckBox;
class QLabel;
class KConfig;
namespace KABC { class AddressBook; }
class CardViewLookAndFeelPage;
/**
Configure dialog for the card view. This dialog inherits from the
standard view dialog in order to add a custom page for the card
view.
*/
class ConfigureCardViewWidget : public ViewConfigureWidget
{
public:
ConfigureCardViewWidget( KABC::AddressBook *ab, QWidget *parent, const char *name );
virtual ~ConfigureCardViewWidget();
virtual void restoreSettings( KConfig* );
virtual void saveSettings( KConfig* );
private:
class CardViewLookNFeelPage *mAdvancedPage;
};
/**
Card View Advanced LookNFeel settings widget:
this is a tabbed widget with 3 tabs:
Fonts
* text font
* header font
Colors
* background color
* text color
* highlight color
* title/sep text color
* title/sep bg color
Layout
* item margin
* item spacing
*/
-class CardViewLookNFeelPage : public QVBox {
+class CardViewLookNFeelPage : public Q3VBox {
Q_OBJECT
public:
CardViewLookNFeelPage( QWidget *parent=0, const char *name=0 );
~CardViewLookNFeelPage();
void restoreSettings( KConfig* );
void saveSettings( KConfig* );
private slots:
void setTextFont();
void setHeaderFont();
void enableFonts();
void enableColors();
private:
void initGUI();
void updateFontLabel( QFont, QLabel * );
QCheckBox *cbEnableCustomFonts,
*cbEnableCustomColors,
*cbDrawSeps, *cbDrawBorders,
*cbShowFieldLabels, *cbShowEmptyFields;
class ColorListBox *lbColors;
QLabel *lTextFont, *lHeaderFont;
#ifndef KAB_EMBEDDED
class KPushButton *btnFont, *btnHeaderFont;
#else //KAB_EMBEDDED
class QPushButton *btnFont, *btnHeaderFont;
#endif //KAB_EMBEDDED
class QSpinBox *sbMargin, *sbSpacing, *sbSepWidth;
diff --git a/kaddressbook/views/configuretableviewdialog.cpp b/kaddressbook/views/configuretableviewdialog.cpp
index c329cd9..7ed897a 100644
--- a/kaddressbook/views/configuretableviewdialog.cpp
+++ b/kaddressbook/views/configuretableviewdialog.cpp
@@ -1,119 +1,122 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstring.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
+#include <q3vbox.h>
+#include <q3buttongroup.h>
#include <qtabwidget.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3Frame>
#include <kglobal.h>
#include <klocale.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <kiconloader.h>
#include <kfontdialog.h>
#ifndef KAB_EMBEDDED
#include <kimageio.h>
#else //KAB_EMBEDDED
#endif //KAB_EMBEDDED
#include <kconfig.h>
#include "colorlistbox.h"
#include "configuretableviewdialog.h"
ConfigureTableViewWidget::ConfigureTableViewWidget( KABC::AddressBook *ab,
QWidget *parent,
const char *name )
: ViewConfigureWidget( ab, parent, name )
{
QWidget *page = addPage( i18n( "Look & Feel" ), QString::null,
KGlobal::iconLoader()->loadIcon( "looknfeel",
KIcon::Panel ) );
mPage = new LookAndFeelPage( page );
}
ConfigureTableViewWidget::~ConfigureTableViewWidget()
{
}
void ConfigureTableViewWidget::restoreSettings( KConfig *config )
{
ViewConfigureWidget::restoreSettings( config );
mPage->restoreSettings( config );
}
void ConfigureTableViewWidget::saveSettings( KConfig *config )
{
ViewConfigureWidget::saveSettings( config );
mPage->saveSettings( config );
}
LookAndFeelPage::LookAndFeelPage(QWidget *parent, const char *name)
- : QVBox(parent, name)
+ : Q3VBox(parent, name)
{
initGUI();
// Set initial state
enableBackgroundToggled(mBackgroundBox->isChecked());
}
void LookAndFeelPage::restoreSettings( KConfig *config )
{
mAlternateButton->setChecked(config->readBoolEntry("ABackground", true));
mLineButton->setChecked(config->readBoolEntry("SingleLine", false));
mToolTipBox->setChecked(config->readBoolEntry("ToolTips", true));
if (!mAlternateButton->isChecked() & !mLineButton->isChecked())
mNoneButton->setChecked(true);
mBackgroundBox->setChecked(config->readBoolEntry("Background", false));
mBackgroundName->lineEdit()->setText(config->readEntry("BackgroundName"));
// colors
cbEnableCustomColors->setChecked( config->readBoolEntry( "EnableCustomColors", false ) );
QColor c;
//qDebug("LookAndFeelPage::restoreSettings make base color configurable");
#ifndef KAB_EMBEDDED
c = KGlobalSettings::baseColor();
#else //KAB_EMBEDDED
c = QColor(0,0,0);
#endif //KAB_EMBEDDED
c = colorGroup().background();
lbColors->insertItem( new ColorListItem( i18n("Background Color"),
@@ -200,146 +203,146 @@ void LookAndFeelPage::setHeaderFont()
if ( KFontDialog::getFont( f,false, this ) == QDialog::Accepted )
updateFontLabel( f, lHeaderFont );
#else //KAB_EMBEDDED
bool ok;
QFont fout = KFontDialog::getFont( f, ok);
if ( ok )
updateFontLabel( fout, lHeaderFont );
#endif //KAB_EMBEDDED
}
void LookAndFeelPage::enableFonts()
{
vbFonts->setEnabled( cbEnableCustomFonts->isChecked() );
if ( cbEnableCustomFonts->isChecked() )
vbFonts->setFocus();
}
void LookAndFeelPage::enableColors()
{
lbColors->setEnabled( cbEnableCustomColors->isChecked() );
if ( cbEnableCustomColors->isChecked() )
lbColors->setFocus();
}
void LookAndFeelPage::initGUI()
{
int spacing = KDialog::spacingHint();
int margin = KDialog::marginHint();
QTabWidget *tabs = new QTabWidget( this );
// General
- QVBox *generalTab = new QVBox( this, "generaltab" );
+ Q3VBox *generalTab = new Q3VBox( this, "generaltab" );
generalTab->setSpacing( spacing );
generalTab->setMargin( margin );
- QButtonGroup *group = new QButtonGroup(1, Qt::Horizontal,
+ Q3ButtonGroup *group = new Q3ButtonGroup(1, Qt::Horizontal,
i18n("Row Separator"), generalTab);
mAlternateButton = new QRadioButton(i18n("Alternating backgrounds"),
group, "mAlternateButton");
mLineButton = new QRadioButton(i18n("Single line"), group, "mLineButton");
mNoneButton = new QRadioButton(i18n("None"), group, "mNoneButton");
mBackgroundBox = new QCheckBox(i18n("Enable background image:"), generalTab,
"mBackgroundBox");
connect(mBackgroundBox, SIGNAL(toggled(bool)),
SLOT(enableBackgroundToggled(bool)));
// LR image not implemented
mBackgroundBox->setEnabled( false );
mBackgroundName = new KURLRequester(generalTab, "mBackgroundName");
#ifndef KAB_EMBEDDED
mBackgroundName->setMode(KFile::File | KFile::ExistingOnly |
KFile::LocalOnly);
mBackgroundName->setFilter(KImageIO::pattern(KImageIO::Reading));
#endif //KAB_EMBEDDED
// ToolTip Checkbox
mToolTipBox = new QCheckBox(i18n("Enable contact tooltips"), generalTab,
"mToolTipBox");
tabs->addTab( generalTab, i18n("&General") );
// Colors
- QVBox *colorTab = new QVBox( this, "colortab" );
+ Q3VBox *colorTab = new Q3VBox( this, "colortab" );
colorTab->setSpacing( spacing );
colorTab->setMargin( spacing );
cbEnableCustomColors = new QCheckBox( i18n("&Enable custom Colors"), colorTab );
connect( cbEnableCustomColors, SIGNAL(clicked()), this, SLOT(enableColors()) );
lbColors = new ColorListBox( colorTab );
tabs->addTab( colorTab, i18n("&Colors") );
- QWhatsThis::add( cbEnableCustomColors, i18n(
+ Q3WhatsThis::add( cbEnableCustomColors, i18n(
"If custom colors are enabled, you may choose the colors for the view below. "
"Otherwise colors from your current KDE color scheme are used."
) );
- QWhatsThis::add( lbColors, i18n(
+ Q3WhatsThis::add( lbColors, i18n(
"Double click or press RETURN on a item to select a color for the related strings in the view."
) );
// Fonts
- QVBox *fntTab = new QVBox( this, "fonttab" );
+ Q3VBox *fntTab = new Q3VBox( this, "fonttab" );
fntTab->setSpacing( spacing );
fntTab->setMargin( spacing );
cbEnableCustomFonts = new QCheckBox( i18n("&Enable custom fonts"), fntTab );
connect( cbEnableCustomFonts, SIGNAL(clicked()), this, SLOT(enableFonts()) );
vbFonts = new QWidget( fntTab );
- QGridLayout *gFnts = new QGridLayout( vbFonts, 2, 3 );
+ Q3GridLayout *gFnts = new Q3GridLayout( vbFonts, 2, 3 );
gFnts->setSpacing( spacing );
gFnts->setAutoAdd( true );
gFnts->setColStretch( 1, 1 );
QLabel *lTFnt = new QLabel( i18n("&Text font:"), vbFonts );
lTextFont = new QLabel( vbFonts );
- lTextFont->setFrameStyle( QFrame::Panel|QFrame::Sunken );
+ lTextFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken );
#ifndef KAB_EMBEDDED
btnFont = new KPushButton( i18n("Choose..."), vbFonts );
#else //KAB_EMBEDDED
btnFont = new QPushButton( i18n("Choose..."), vbFonts );
#endif //KAB_EMBEDDED
lTFnt->setBuddy( btnFont );
connect( btnFont, SIGNAL(clicked()), this, SLOT(setTextFont()) );
QLabel *lHFnt = new QLabel( i18n("&Header font:"), vbFonts );
lHeaderFont = new QLabel( vbFonts );
- lHeaderFont->setFrameStyle( QFrame::Panel|QFrame::Sunken );
+ lHeaderFont->setFrameStyle( Q3Frame::Panel|Q3Frame::Sunken );
#ifndef KAB_EMBEDDED
btnHeaderFont = new KPushButton( i18n("Choose..."), vbFonts );
#else //KAB_EMBEDDED
btnHeaderFont = new QPushButton( i18n("Choose..."), vbFonts );
#endif //KAB_EMBEDDED
lHFnt->setBuddy( btnHeaderFont );
connect( btnHeaderFont, SIGNAL(clicked()), this, SLOT(setHeaderFont()) );
fntTab->setStretchFactor( new QWidget( fntTab ), 1 );
- QWhatsThis::add( cbEnableCustomFonts, i18n(
+ Q3WhatsThis::add( cbEnableCustomFonts, i18n(
"If custom fonts are enabled, you may choose which fonts to use for this view below. "
"Otherwise the default KDE font will be used, in bold style for the header and "
"normal style for the data."
) );
tabs->addTab( fntTab, i18n("&Fonts") );
}
void LookAndFeelPage::enableBackgroundToggled(bool enabled)
{
mBackgroundName->setEnabled(enabled);
}
void LookAndFeelPage::updateFontLabel( QFont fnt, QLabel *l )
{
l->setFont( fnt );
l->setText( QString( fnt.family() + " %1" ).arg( fnt.pointSize() ) );
}
-#ifndef KAB_EMBEDDED
-#include "configuretableviewdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_configuretableviewdialog.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/configuretableviewdialog.h b/kaddressbook/views/configuretableviewdialog.h
index 003ccf8..8125fc9 100644
--- a/kaddressbook/views/configuretableviewdialog.h
+++ b/kaddressbook/views/configuretableviewdialog.h
@@ -1,98 +1,100 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef CONFIGURETABLEVIEWDIALOG_H
#define CONFIGURETABLEVIEWDIALOG_H
#include "viewconfigurewidget.h"
-#include <qvbox.h>
+#include <q3vbox.h>
+//Added by qt3to4:
+#include <QLabel>
class QString;
class QWidget;
class QRadioButton;
class QCheckBox;
class KURLRequester;
class KConfig;
class QLabel;
namespace KABC { class AddressBook; }
class LookAndFeelPage;
/**
Configure dialog for the table view. This dialog inherits from the
standard view dialog in order to add a custom page for the table
view.
*/
class ConfigureTableViewWidget : public ViewConfigureWidget
{
public:
ConfigureTableViewWidget( KABC::AddressBook *ab, QWidget *parent, const char *name );
virtual ~ConfigureTableViewWidget();
virtual void restoreSettings( KConfig* );
virtual void saveSettings( KConfig* );
private:
void initGUI();
LookAndFeelPage *mPage;
};
/**
Internal class. It is only defined here for moc
*/
-class LookAndFeelPage : public QVBox
+class LookAndFeelPage : public Q3VBox
{
Q_OBJECT
public:
LookAndFeelPage( QWidget *parent, const char *name = 0 );
~LookAndFeelPage() {}
void restoreSettings( KConfig* );
void saveSettings( KConfig* );
protected slots:
void enableBackgroundToggled( bool );
void setTextFont();
void setHeaderFont();
void enableFonts();
void enableColors();
private:
void initGUI();
void updateFontLabel( QFont, QLabel * );
QCheckBox *cbEnableCustomFonts,
*cbEnableCustomColors;
class ColorListBox *lbColors;
QLabel *lTextFont, *lHeaderFont;
class QPushButton *btnFont, *btnHeaderFont;
class QWidget* vbFonts;
QRadioButton *mAlternateButton;
QRadioButton *mLineButton;
QRadioButton *mNoneButton;
QCheckBox *mToolTipBox;
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 9accf78..227645d 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -1,98 +1,104 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qheader.h>
-#include <qiconset.h>
+#include <q3header.h>
+#include <qicon.h>
#include <qimage.h>
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include <qcombobox.h>
#include <qpainter.h>
#include <qbrush.h>
#include <qevent.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QKeyEvent>
#include <klocale.h>
#include <kglobalsettings.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kapplication.h>
#include <kurl.h>
#include "kaddressbooktableview.h"
#include "contactlistview.h"
/////////////////////////////////
// DynamicTip Methods
DynamicTip::DynamicTip( ContactListView *parent)
- : QToolTip( parent )
+ /* TODO:hacker:: QToolTip( parent ) */
{
}
void DynamicTip::maybeTip( const QPoint &pos )
{
+ /* TODO:hacker:
static bool ishidden = true;
if (!parentWidget()->inherits( "ContactListView" ))
return;
ContactListView *plv = (ContactListView*)parentWidget();
if (!plv->tooltips())
return;
QPoint posVp = plv->viewport()->pos();
- QListViewItem *lvi = plv->itemAt( pos - posVp );
+ Q3ListViewItem *lvi = plv->itemAt( pos - posVp );
if (!lvi)
return;
#ifndef KAB_EMBEDDED
ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi);
#else //KAB_EMBEDDED
ContactListViewItem *plvi = (ContactListViewItem*)(lvi);
#endif //KAB_EMBEDDED
if (!plvi)
return;
if (ishidden) {
QString s;
QRect r = plv->itemRect( lvi );
r.moveBy( posVp.x(), posVp.y() );
//kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width()
// << "," << r.height() << endl;
KABC::Addressee a = plvi->addressee();
if (a.isEmpty())
return;
s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel())
.arg(a.formattedName());
s += '\n';
s += i18n("label: value", "%1: %2").arg(a.organizationLabel())
.arg(a.organization());
QString notes = a.note().stripWhiteSpace();
@@ -122,111 +128,111 @@ void DynamicTip::maybeTip( const QPoint &pos )
linew = lastw;
}
else
i = QMAX( a, i-1 );
}
if ( notes[i] == '\n' || doBreak ) {
s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n";
a = i + 1;
lastSpace = a;
linew = 0;
}
if ( notes[i].isSpace() ) {
lastSpace = i;
lastw = linew;
}
if ( lastSpace <= a ) {
lastw = linew;
}
++i;
}
}
tip( r, s );
}
else
hide();
ishidden = !ishidden;
-
+ */
}
///////////////////////////
// ContactListViewItem Methods
ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
ContactListView *parent,
KABC::AddressBook *doc,
const KABC::Field::List &fields )
: KListViewItem(parent), mAddressee(a), mFields( fields ),
parentListView( parent ), mDocument(doc)
{
refresh();
}
QString ContactListViewItem::key(int column, bool ascending) const
{
#ifndef DESKTOP_VERSION
int lan = KGlobal::locale()->language();
//qDebug("language %d ", lan);
if ( lan == 1 ) { //GERMAN
- QString ret = QListViewItem::key(column, ascending).lower().utf8();
+ QString ret = Q3ListViewItem::key(column, ascending).lower().utf8();
int start = -1;
while ( (start = ret.find( 'ä', start+1)) > 0 ) {
ret.at(start-1) = 'a';
}
start = -1;
while ( (start = ret.find( 'ö', start+1)) > 0 ) {
ret.at(start-1) = 'o';
}
start = -1;
while ( (start = ret.find( 'ü', start+1)) > 0 ) {
ret.at(start-1) = 'o';
}
start = -1;
while ( (start = ret.find( 'ß', start+1)) > 0 ) {
ret.at(start-1) = 's';
}
//qDebug("conv string %s ", ret.latin1());
return ret;
}
else
#endif
- return QListViewItem::key(column, ascending).lower();
+ return Q3ListViewItem::key(column, ascending).lower();
}
void ContactListViewItem::paintCell(QPainter * p,
const QColorGroup & cg,
int column,
int width,
int align)
{
KListViewItem::paintCell(p, cg, column, width, align);
if ( !p )
return;
if (parentListView->singleLine()) {
p->setPen( parentListView->alternateColor() );
p->drawLine( 0, height() - 1, width, height() - 1 );
}
}
ContactListView *ContactListViewItem::parent()
{
return parentListView;
}
void ContactListViewItem::refresh()
{
// Update our addressee, since it may have changed else were
mAddressee = mDocument->findByUid(mAddressee.uid());
if (mAddressee.isEmpty())
return;
@@ -259,130 +265,130 @@ ContactListView::ContactListView(KAddressBookTableView *view,
setAlternateBackgroundEnabled(mABackground);
setAcceptDrops( true );
viewport()->setAcceptDrops( true );
setAllColumnsShowFocus( true );
setShowSortIndicator(true);
setSelectionModeExt( KListView::Extended );
setDropVisualizer(false);
// setFrameStyle(QFrame::NoFrame);
//setLineWidth ( 0 );
//setMidLineWidth ( 0 );
//setMargin ( 0 );
#ifndef KAB_EMBEDDED
connect(this, SIGNAL(dropped(QDropEvent*)),
this, SLOT(itemDropped(QDropEvent*)));
#endif //KAB_EMBEDDED
new DynamicTip( this );
}
void ContactListView::printMe()
{
#ifdef DESKTOP_VERSION
QPrinter printer;
if (!printer.setup() )
return;
QPainter p;
p.begin ( &printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
p.scale( scale, scale );
qDebug("scale %f ", scale);
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
qDebug("Why does it not print??? ");
#endif
}
void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
{
mAlternateColor = m_AlternateColor;
}
void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
{
QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
// Get the brush, which will have the background pixmap if there is one.
if (b.pixmap())
{
p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(),
*(b.pixmap()),
rect.left() + contentsX(),
rect.top() + contentsY() );
}
else
{
// Do a normal paint
KListView::paintEmptyArea(p, rect);
}
}
void ContactListView::contentsMousePressEvent(QMouseEvent* e)
{
presspos = e->pos();
KListView::contentsMousePressEvent(e);
}
// To initiate a drag operation
void ContactListView::contentsMouseMoveEvent( QMouseEvent *e )
{
- if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) {
+ if ((e->state() & Qt::LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) {
emit startAddresseeDrag();
}
else
KListView::contentsMouseMoveEvent( e );
}
bool ContactListView::acceptDrag(QDropEvent *e) const
{
#ifndef KAB_EMBEDDED
- return QTextDrag::canDecode(e);
+ return Q3TextDrag::canDecode(e);
#else //KAB_EMBEDDED
qDebug("ContactListView::acceptDrag has to be fixed");
return false;
#endif //KAB_EMBEDDED
}
void ContactListView::itemDropped(QDropEvent *e)
{
contentsDropEvent(e);
}
void ContactListView::contentsDropEvent( QDropEvent *e )
{
emit addresseeDropped(e);
}
void ContactListView::setAlternateBackgroundEnabled(bool enabled)
{
mABackground = enabled;
if (mABackground)
{
setAlternateBackground(mAlternateColor);
}
else
{
setAlternateBackground(QColor());
}
}
void ContactListView::setBackgroundPixmap(const QString &filename)
{
@@ -395,35 +401,35 @@ void ContactListView::setBackgroundPixmap(const QString &filename)
qDebug("ContactListView::setBackgroundPixmap has to be verified");
//US setPaletteBackgroundPixmap(QPixmap(filename));
KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename));
}
}
void ContactListView::keyPressEvent ( QKeyEvent * e )
{
if ( mFlagBlockKeyPressed )
return;
qApp->processEvents();
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->accept();
return;
}
if (! e->isAutoRepeat() )
mFlagKeyPressed = true;
KListView::keyPressEvent ( e );
}
void ContactListView::keyReleaseEvent ( QKeyEvent * e )
{
if ( mFlagBlockKeyPressed )
return;
if ( !e->isAutoRepeat() ) {
mFlagBlockKeyPressed = true;
qApp->processEvents();
mFlagBlockKeyPressed = false;
mFlagKeyPressed = false;
}
KListView::keyReleaseEvent ( e );
}
-#ifndef KAB_EMBEDDED
-#include "contactlistview.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_contactlistview.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h
index 46477e1..c92b002 100644
--- a/kaddressbook/views/contactlistview.h
+++ b/kaddressbook/views/contactlistview.h
@@ -1,55 +1,59 @@
#ifndef CONTACTLISTVIEW_H
#define CONTACTLISTVIEW_H
#include <qcolor.h>
#include <qpixmap.h>
#include <qtooltip.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
#include <klistview.h>
#include <kabc/field.h>
#include <kabc/addressee.h>
#include <kabc/addressbook.h>
class QDropEvent;
class KAddressBookTableView;
class ContactListView;
/** The whole tooltip design needs a lot of work. Currently it is
* hacked together to function.
*/
-class DynamicTip : public QToolTip
+class DynamicTip /* TODO:hacker: : public QToolTip */
{
public:
DynamicTip( ContactListView * parent );
protected:
void maybeTip( const QPoint & );
private:
};
class ContactListViewItem : public KListViewItem
{
public:
ContactListViewItem(const KABC::Addressee &a, ContactListView* parent,
KABC::AddressBook *doc, const KABC::Field::List &fields );
const KABC::Addressee &addressee() const { return mAddressee; }
virtual void refresh();
virtual ContactListView* parent();
virtual QString key ( int, bool ) const;
/** Adds the border around the cell if the user wants it.
* This is how the single line config option is implemented.
*/
virtual void paintCell(QPainter * p, const QColorGroup & cg,
int column, int width, int align );
private:
KABC::Addressee mAddressee;
KABC::Field::List mFields;
ContactListView *parentListView;
KABC::AddressBook *mDocument;
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index b503652..1e5a556 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -1,62 +1,67 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include <qevent.h>
-#include <qiconview.h>
+#include <q3iconview.h>
#include <qlayout.h>
#include <qstringlist.h>
#include <qregexp.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
+#include <QDragEnterEvent>
#include <kabc/addressbook.h>
#include <kabc/addressee.h>
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
#include "kabprefs.h"
#include "viewmanager.h"
#include "kaddressbookcardview.h"
#ifndef KAB_EMBEDDED
extern "C" {
void *init_libkaddrbk_cardview()
{
return ( new CardViewFactory );
}
}
#endif //KAB_EMBEDDED
////////////////////////////////
// AddresseeCardViewItem (internal class)
class AddresseeCardViewItem : public CardViewItem
{
public:
AddresseeCardViewItem(const KABC::Field::List &fields,
bool showEmptyFields,
KABC::AddressBook *doc, const KABC::Addressee &a,
CardView *parent)
: CardViewItem(parent, a.realName() ),
@@ -96,116 +101,116 @@ class AddresseeCardViewItem : public CardViewItem
// We might want to make this the first field. hmm... -mpilone
setCaption( mAddressee.realName() );
}
}
private:
KABC::Field::List mFields;
bool mShowEmptyFields;
KABC::AddressBook *mDocument;
KABC::Addressee mAddressee;
};
///////////////////////////////
// AddresseeCardView
AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name)
: CardView(parent, name)
{
setAcceptDrops(true);
}
AddresseeCardView::~AddresseeCardView()
{
}
void AddresseeCardView::printMe()
{
#ifdef DESKTOP_VERSION
QPrinter printer;
if (!printer.setup() )
return;
QPainter p;
p.begin ( &printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
p.scale( scale, scale );
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
repaint();
#endif
}
void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e)
{
#ifndef KAB_EMBEDDED
- if (QTextDrag::canDecode(e))
+ if (Q3TextDrag::canDecode(e))
e->accept();
#else //KAB_EMBEDDED
qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented");
#endif //KAB_EMBEDDED
}
void AddresseeCardView::dropEvent(QDropEvent *e)
{
emit addresseeDropped(e);
}
void AddresseeCardView::startDrag()
{
emit startAddresseeDrag();
}
///////////////////////////////
// KAddressBookCardView
KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab,
QWidget *parent, const char *name )
: KAddressBookView( ab, parent, name )
{
mShowEmptyFields = false;
// Init the GUI
- QVBoxLayout *layout = new QVBoxLayout(viewWidget());
+ Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget());
mCardView = new AddresseeCardView(viewWidget(), "mCardView");
mCardView->setSelectionMode(CardView::Extended);
layout->addWidget(mCardView);
// Connect up the signals
connect(mCardView, SIGNAL(executed(CardViewItem *)),
this, SLOT(addresseeExecuted(CardViewItem *)));
connect(mCardView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)),
this, SIGNAL(dropped(QDropEvent*)));
connect(mCardView, SIGNAL(startAddresseeDrag()),
this, SIGNAL(startDrag()));
connect(this, SIGNAL(printView()),
mCardView , SLOT(printMe()));
}
KAddressBookCardView::~KAddressBookCardView()
{
}
void KAddressBookCardView::setFocusAV()
{
if ( mCardView )
mCardView->setFocus();
}
void KAddressBookCardView::scrollUP()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mCardView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
@@ -491,35 +496,35 @@ void KAddressBookCardView::addresseeExecuted(CardViewItem *item)
emit executed(aItem->addressee().uid());
}
}
void KAddressBookCardView::addresseeSelected()
{
CardViewItem *item;
AddresseeCardViewItem *aItem;
bool found = false;
for (item = mCardView->firstItem(); item && !found;
item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeCardViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeCardViewItem*)(item);
#endif //KAB_EMBEDDED
if ( aItem )
{
emit selected(aItem->addressee().uid());
found = true;
}
}
}
if (!found)
emit selected(QString::null);
}
-#ifndef KAB_EMBEDDED
-#include "kaddressbookcardview.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kaddressbookcardview.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h
index 2a71f7e..8f8e48b 100644
--- a/kaddressbook/views/kaddressbookcardview.h
+++ b/kaddressbook/views/kaddressbookcardview.h
@@ -1,59 +1,62 @@
#ifndef KADDRESSBOOKCARDVIEW_H
#define KADDRESSBOOKCARDVIEW_H
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstring.h>
+//Added by qt3to4:
+#include <QDragEnterEvent>
+#include <QDropEvent>
#ifndef KAB_EMBEDDED
#include <kiconview.h>
#else //KAB_EMBEDDED
#include <klocale.h>
#endif //KAB_EMBEDDED
#include "cardview.h"
#include "kaddressbookview.h"
#include "configurecardviewdialog.h"
class QDragEnterEvent;
class QDragEntryEvent;
class QDropEvent;
class KConfig;
class AddresseeCardView;
/**
This view uses the CardView class to create a card view. At some
point in the future I think this will be the default view of
KAddressBook.
*/
class KAddressBookCardView : public KAddressBookView
{
Q_OBJECT
public:
KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 );
virtual ~KAddressBookCardView();
void doSearch( const QString& s,KABC::Field *field );
virtual QStringList selectedUids();
virtual QString type() const { return "Card"; }
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp
index d6ddec3..3a41a4b 100644
--- a/kaddressbook/views/kaddressbookiconview.cpp
+++ b/kaddressbook/views/kaddressbookiconview.cpp
@@ -1,165 +1,173 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KAB_EMBEDDED
-#include <qiconview.h>
+#include <q3iconview.h>
#include <qstringlist.h>
#include <kabc/addressee.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klocale.h>
#else //KAB_EMBEDDED
#endif //KAB_EMBEDDED
+//Added by qt3to4:
+#include <QDropEvent>
+#include <Q3ValueList>
+#include <QPixmap>
+#include <QKeyEvent>
+#include <QEvent>
+#include <Q3VBoxLayout>
+
#include <kabc/addressbook.h>
#include "kabprefs.h"
#include "viewmanager.h"
#include "kaddressbookiconview.h"
#include <qlayout.h>
#include <qregexp.h>
#include <qapplication.h>
#include <kglobal.h>
/*US transfered to the headerfile
class IconViewFactory : public ViewFactory
{
public:
KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name )
{
return new KAddressBookIconView( ab, parent, name );
}
QString type() const { return "Icon"; }
QString description() const { return i18n( "Icons represent contacts. Very simple view." ); }
};
*/
extern "C" {
void *init_libkaddrbk_iconview()
{
return ( new IconViewFactory );
}
}
////////////////////////////////
// AddresseeIconView (internal class)
#ifndef KAB_EMBEDDED
AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name)
: KIconView(parent, name)
#else //KAB_EMBEDDED
AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name)
- : QIconView(parent, name)
+ : Q3IconView(parent, name)
#endif //KAB_EMBEDDED
{
- setSelectionMode( QIconView::Extended );
- setResizeMode( QIconView::Adjust );
+ setSelectionMode( Q3IconView::Extended );
+ setResizeMode( Q3IconView::Adjust );
setWordWrapIconText( true );
setGridX( 100 );
setItemsMovable(false);
setSorting(true, true);
//US ??? setMode( KIconView::Select );
#ifndef KAB_EMBEDDED
- connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)),
- this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&)));
+ connect(this, SIGNAL(dropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&)),
+ this, SLOT(itemDropped(QDropEvent*, const Q3ValueList<Q3IconDragItem>&)));
#endif //KAB_EMBEDDED
}
AddresseeIconView::~AddresseeIconView()
{
}
void AddresseeIconView::itemDropped(QDropEvent *e,
- const QValueList<QIconDragItem> &)
+ const Q3ValueList<Q3IconDragItem> &)
{
emit addresseeDropped(e);
}
-QDragObject *AddresseeIconView::dragObject()
+Q3DragObject *AddresseeIconView::dragObject()
{
emit startAddresseeDrag();
// We never want IconView to start the drag
return 0;
}
////////////////////////////////
// AddresseeIconViewItem (internal class)
#ifndef KAB_EMBEDDED
class AddresseeIconViewItem : public KIconViewItem
#else //KAB_EMBEDDED
-class AddresseeIconViewItem : public QIconViewItem
+class AddresseeIconViewItem : public Q3IconViewItem
#endif //KAB_EMBEDDED
{
public:
#ifndef KAB_EMBEDDED
AddresseeIconViewItem(const KABC::Field::List &fields,
KABC::AddressBook *doc, const KABC::Addressee &a,
- QIconView *parent)
+ Q3IconView *parent)
: KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
#else //KAB_EMBEDDED
AddresseeIconViewItem(const KABC::Field::List &fields,
KABC::AddressBook *doc, const KABC::Addressee &a,
- QIconView *parent)
- : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
+ Q3IconView *parent)
+ : Q3IconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a)
#endif //KAB_EMBEDDED
{
if ( mFields.isEmpty() ) {
mFields = KABC::Field::defaultFields();
}
refresh();
}
const KABC::Addressee &addressee() const { return mAddressee; }
void refresh()
{
// Update our addressee, since it may have changed elsewhere
mAddressee = mDocument->findByUid(mAddressee.uid());
if (!mAddressee.isEmpty())
setText( mAddressee.givenName() + " " + mAddressee.familyName() );
QPixmap icon;
KABC::Picture pic = mAddressee.photo();
if ( pic.data().isNull() )
pic = mAddressee.logo();
if ( pic.isIntern() && !pic.data().isNull() ) {
QImage img = pic.data();
#ifndef KAB_EMBEDDED
if ( img.width() > img.height() )
icon = img.scaleWidth( 32 );
else
icon = img.scaleHeight( 32 );
#else //KAB_EMBEDDED
@@ -171,126 +179,126 @@ class AddresseeIconViewItem : public QIconViewItem
if ( wid > hei ) {
hei = (hei*max)/wid;
wid = max;
} else {
wid = (wid*max)/hei;
hei = max;
}
}
qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor");
icon.convertFromImage(img.smoothScale(wid, hei));
#endif //KAB_EMBEDDED
} else {
icon = KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 );
}
setPixmap( icon );
}
private:
KABC::Field::List mFields;
KABC::AddressBook *mDocument;
KABC::Addressee mAddressee;
};
///////////////////////////////
// KAddressBookView
KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab,
QWidget *parent, const char *name)
: KAddressBookView( ab, parent, name )
{
// Init the GUI
- QVBoxLayout *layout = new QVBoxLayout(viewWidget());
+ Q3VBoxLayout *layout = new Q3VBoxLayout(viewWidget());
mIconView = new AddresseeIconView(viewWidget(), "mIconView");
layout->addWidget(mIconView);
// Connect up the signals
//US method executed is part of KIconView
//US connect(mIconView, SIGNAL(executed(QIconViewItem *)),
//US this, SLOT(addresseeExecuted(QIconViewItem *)));
- connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
- this, SLOT(addresseeExecuted(QIconViewItem *)));
+ connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)),
+ this, SLOT(addresseeExecuted(Q3IconViewItem *)));
connect(mIconView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)),
this, SIGNAL(dropped(QDropEvent*)));
connect(mIconView, SIGNAL(startAddresseeDrag()),
this, SIGNAL(startDrag()));
}
KAddressBookIconView::~KAddressBookIconView()
{
}
void KAddressBookIconView::setFocusAV()
{
if ( mIconView )
mIconView->setFocus();
}
void KAddressBookIconView::scrollUP()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mIconView, ev );
}
void KAddressBookIconView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mIconView, ev );
}
void KAddressBookIconView::readConfig(KConfig *config)
{
KAddressBookView::readConfig(config);
//US method executed is part of KIconView
//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)),
//US this, SLOT(addresseeExecuted(QIconViewItem *)));
- disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
- this, SLOT(addresseeExecuted(QIconViewItem *)));
+ disconnect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)),
+ this, SLOT(addresseeExecuted(Q3IconViewItem *)));
//US method executed is part of KIconView. Use selectionChanged instead
/*US
if (KABPrefs::instance()->mHonorSingleClick)
connect(mIconView, SIGNAL(executed(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
else
connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)),
this, SLOT(addresseeExecuted(QIconViewItem *)));
*/
- connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
- this, SLOT(addresseeExecuted(QIconViewItem *)));
+ connect(mIconView, SIGNAL(selectionChanged(Q3IconViewItem *)),
+ this, SLOT(addresseeExecuted(Q3IconViewItem *)));
}
void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
{
mIconView->clear();
mIconList.clear();
if ( s.isEmpty() || s == "*" ) {
refresh();
return;
}
QRegExp re = getRegExp( s );
if (!re.isValid())
return;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
if ( field ) {
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
#if QT_VERSION >= 0x030000
if (re.search(field->value( *it ).lower()) == 0)
#else
if (re.match(field->value( *it ).lower()) == 0)
#endif
mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
}
} else {
KABC::Field::List fieldList = allFields();
KABC::Field::List::ConstIterator fieldIt;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
@@ -307,175 +315,175 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
match = true;
break;
}
}
if ( ! match ) {
if ( (*it).matchPhoneNumber( &re ) ) {
mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
match = true;
break;
}
}
if ( ! match ) {
if ( (*it).matchAddress( &re ) ) {
mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
match = true;
break;
}
}
}
}
mIconView->arrangeItemsInGrid( true );
if ( mIconView->firstItem() ) {
mIconView->setCurrentItem ( mIconView->firstItem() );
mIconView->setSelected ( mIconView->firstItem() , true );
}
else
emit selected(QString::null);
}
QStringList KAddressBookIconView::selectedUids()
{
QStringList uidList;
- QIconViewItem *item;
+ Q3IconViewItem *item;
AddresseeIconViewItem *aItem;
for (item = mIconView->firstItem(); item; item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem)
uidList << aItem->addressee().uid();
}
}
return uidList;
}
void KAddressBookIconView::refresh(QString uid)
{
- QIconViewItem *item;
+ Q3IconViewItem *item;
AddresseeIconViewItem *aItem;
if ( uid.isNull() ) {
// Rebuild the view
mIconView->clear();
mIconList.clear();
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator iter;
for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) {
if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") )
continue;
aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView );
}
mIconView->arrangeItemsInGrid( true );
for ( item = mIconView->firstItem(); item; item = item->nextItem() )
{
#ifndef KAB_EMBEDDED
AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item );
#else //KAB_EMBEDDED
AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item );
#endif //KAB_EMBEDDED
mIconList.append( aivi );
}
} else {
// Try to find the one to refresh
for ( item = mIconView->firstItem(); item; item = item->nextItem() ) {
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if ((aItem) && (aItem->addressee().uid() == uid)) {
aItem->refresh();
mIconView->arrangeItemsInGrid( true );
return;
}
}
refresh( QString::null );
}
}
void KAddressBookIconView::setSelected(QString uid, bool selected)
{
- QIconViewItem *item;
+ Q3IconViewItem *item;
AddresseeIconViewItem *aItem;
if (uid.isNull())
{
mIconView->selectAll(selected);
}
else
{
bool found = false;
for (item = mIconView->firstItem(); item && !found;
item = item->nextItem())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if ((aItem) && (aItem->addressee().uid() == uid))
{
mIconView->setSelected(aItem, selected);
mIconView->ensureItemVisible( aItem );
found = true;
}
}
}
}
-void KAddressBookIconView::addresseeExecuted(QIconViewItem *item)
+void KAddressBookIconView::addresseeExecuted(Q3IconViewItem *item)
{
#ifndef KAB_EMBEDDED
AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem) {
emit executed(aItem->addressee().uid());
}
}
void KAddressBookIconView::addresseeSelected()
{
- QIconViewItem *item;
+ Q3IconViewItem *item;
AddresseeIconViewItem *aItem;
bool found = false;
for (item = mIconView->firstItem(); item && !found;
item = item->nextItem())
{
if (item->isSelected())
{
#ifndef KAB_EMBEDDED
aItem = dynamic_cast<AddresseeIconViewItem*>(item);
#else //KAB_EMBEDDED
aItem = (AddresseeIconViewItem*)(item);
#endif //KAB_EMBEDDED
if (aItem)
{
emit selected(aItem->addressee().uid());
found = true;
}
}
}
if (!found)
emit selected(QString::null);
}
-#ifndef KAB_EMBEDDED
-#include "kaddressbookiconview.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kaddressbookiconview.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h
index b0b9fea..6fad4c6 100644
--- a/kaddressbook/views/kaddressbookiconview.h
+++ b/kaddressbook/views/kaddressbookiconview.h
@@ -1,134 +1,137 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KADDRESSBOOKICONVIEW_H
#define KADDRESSBOOKICONVIEW_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <QDropEvent>
#ifndef KAB_EMBEDDED
#include <kiconview.h>
#else //KAB_EMBEDDED
-#include <qiconview.h>
-#include <qptrlist.h>
+#include <q3iconview.h>
+#include <q3ptrlist.h>
#include <klocale.h>
#endif //KAB_EMBEDDED
#include "kaddressbookview.h"
-class QIconViewItem;
+class Q3IconViewItem;
class KConfig;
class AddresseeIconView;
class AddresseeIconViewItem;
-class QIconDragItem;
+class Q3IconDragItem;
class KAddressBookIconView;
namespace KABC { class AddressBook; }
/** This is an example kaddressbook view that is implemented using
* KIconView. This view is not the most useful view, but it displays
* how simple implementing a new view can be.
*/
class KAddressBookIconView : public KAddressBookView
{
Q_OBJECT
public:
KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 );
virtual ~KAddressBookIconView();
virtual QStringList selectedUids();
virtual QString type() const { return "Icon"; }
void doSearch( const QString& s ,KABC::Field *field );
virtual void readConfig(KConfig *config);
virtual void scrollUP();
virtual void scrollDOWN();
virtual void setFocusAV();
public slots:
void refresh(QString uid = QString::null);
#ifndef KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
void setSelected(QString uid = QString::null, bool selected = true);
-//MOC_SKIP_END
+#endif
#else //KAB_EMBEDDED
//US my MOC do not like default parameters ???
void setSelected(QString uid, bool selected);
#endif //KAB_EMBEDDED
protected slots:
- void addresseeExecuted(QIconViewItem *item);
+ void addresseeExecuted(Q3IconViewItem *item);
void addresseeSelected();
private:
AddresseeIconView *mIconView;
- QPtrList<AddresseeIconViewItem> mIconList;
+ Q3PtrList<AddresseeIconViewItem> mIconList;
};
#ifndef KAB_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class AddresseeIconView : public KIconView
-//MOC_SKIP_END
+#endif
#else //KAB_EMBEDDED
-class AddresseeIconView : public QIconView
+class AddresseeIconView : public Q3IconView
#endif //KAB_EMBEDDED
{
Q_OBJECT
public:
AddresseeIconView(QWidget *parent, const char *name);
~AddresseeIconView();
signals:
void addresseeDropped(QDropEvent *);
void startAddresseeDrag();
protected:
- virtual QDragObject *dragObject();
+ virtual Q3DragObject *dragObject();
protected slots:
- void itemDropped(QDropEvent *, const QValueList<QIconDragItem> &);
+ void itemDropped(QDropEvent *, const Q3ValueList<Q3IconDragItem> &);
};
class IconViewFactory : public ViewFactory
{
public:
KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name )
{
return new KAddressBookIconView( ab, parent, name );
}
QString type() const { return "Icon"; }
QString description() const { return i18n( "Icons represent contacts. Very simple view." ); }
};
/*
extern "C" {
void *init_libkaddrbk_iconview()
{
return ( new IconViewFactory );
}
}
*/
#endif
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index 272f2eb..7efaaa9 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -1,162 +1,166 @@
// $Id$
-#include <qvbox.h>
-#include <qlistbox.h>
+#include <q3vbox.h>
+#include <q3listbox.h>
#include <qwidget.h>
#include <qfile.h>
#include <qimage.h>
#include <qcombobox.h>
#include <qapplication.h>
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include <qevent.h>
-#include <qurl.h>
+#include <q3url.h>
#include <qpixmap.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
#include <kabc/addressbook.h>
#include <kapplication.h>
#include <kconfig.h>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kurl.h>
#include <kurlrequester.h>
//US#include "configuretableviewdialog.h"
#include "contactlistview.h"
#include "kabprefs.h"
#include "undocmds.h"
#include "viewmanager.h"
#include <qlayout.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qregexp.h>
#include "kaddressbooktableview.h"
KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab,
QWidget *parent, const char *name )
: KAddressBookView( ab, parent, name )
{
- mainLayout = new QVBoxLayout( viewWidget(), 2 );
+ mainLayout = new Q3VBoxLayout( viewWidget(), 2 );
// The list view will be created when the config is read.
mListView = 0;
}
KAddressBookTableView::~KAddressBookTableView()
{
}
void KAddressBookTableView::setFocusAV()
{
if ( mListView )
mListView->setFocus();
}
void KAddressBookTableView::scrollUP()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mListView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
QApplication::postEvent( mListView, ev );
}
void KAddressBookTableView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mListView, ev );
ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
QApplication::postEvent( mListView, ev );
}
void KAddressBookTableView::reconstructListView()
{
if (mListView)
{
disconnect(mListView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
- disconnect(mListView, SIGNAL(executed(QListViewItem*)),
- this, SLOT(addresseeExecuted(QListViewItem*)));
- disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
- this, SLOT(addresseeExecuted(QListViewItem*)));
+ disconnect(mListView, SIGNAL(executed(Q3ListViewItem*)),
+ this, SLOT(addresseeExecuted(Q3ListViewItem*)));
+ disconnect(mListView, SIGNAL(doubleClicked(Q3ListViewItem*)),
+ this, SLOT(addresseeExecuted(Q3ListViewItem*)));
disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
SIGNAL(startDrag()));
- disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
- this, SLOT(addresseeExecuted(QListViewItem*)));
+ disconnect(mListView, SIGNAL(returnPressed(Q3ListViewItem*)),
+ this, SLOT(addresseeExecuted(Q3ListViewItem*)));
disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
SIGNAL(dropped(QDropEvent*)));
delete mListView;
}
mListView = new ContactListView( this, addressBook(), viewWidget() );
connect(this, SIGNAL(printView()),
mListView , SLOT(printMe()));
//US set singleClick manually, because it is no global configparameter in embedded space
mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
// Add the columns
KABC::Field::List fieldList = fields();
KABC::Field::List::ConstIterator it;
int c = 0;
for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
mListView->addColumn( (*it)->label() );
- mListView->setColumnWidthMode(c++, QListView::Manual);
+ mListView->setColumnWidthMode(c++, Q3ListView::Manual);
//US
// qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1());
}
connect(mListView, SIGNAL(selectionChanged()),
this, SLOT(addresseeSelected()));
connect(mListView, SIGNAL(startAddresseeDrag()), this,
SIGNAL(startDrag()));
connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
SIGNAL(dropped(QDropEvent*)));
if (KABPrefs::instance()->mHonorSingleClick) {
// qDebug("KAddressBookTableView::reconstructListView single");
- connect(mListView, SIGNAL(executed(QListViewItem*)),
- this, SLOT(addresseeExecuted(QListViewItem*)));
+ connect(mListView, SIGNAL(executed(Q3ListViewItem*)),
+ this, SLOT(addresseeExecuted(Q3ListViewItem*)));
} else {
// qDebug("KAddressBookTableView::reconstructListView double");
- connect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
- this, SLOT(addresseeExecuted(QListViewItem*)));
+ connect(mListView, SIGNAL(doubleClicked(Q3ListViewItem*)),
+ this, SLOT(addresseeExecuted(Q3ListViewItem*)));
}
- connect(mListView, SIGNAL(returnPressed(QListViewItem*)),
- this, SLOT(addresseeExecuted(QListViewItem*)));
+ connect(mListView, SIGNAL(returnPressed(Q3ListViewItem*)),
+ this, SLOT(addresseeExecuted(Q3ListViewItem*)));
connect(mListView, SIGNAL(signalDelete()),
this, SLOT(addresseeDeleted()));
//US performceimprovement. Refresh is done from the outside
//US refresh();
mListView->setSorting( 0, true );
mainLayout->addWidget( mListView );
mainLayout->activate();
mListView->show();
}
void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
{
mListView->clear();
if ( s.isEmpty() || s == "*" ) {
refresh();
return;
}
QRegExp re = getRegExp( s );
if (!re.isValid())
return;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
if ( field ) {
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
#if QT_VERSION >= 0x030000
if (re.search(field->value( *it ).lower()) == 0)
#else
if (re.match(field->value( *it ).lower()) == 0)
@@ -315,178 +319,178 @@ void KAddressBookTableView::refresh(QString uid)
nextUID = nextItem->addressee().uid();
currentUID = currentItem->addressee().uid();
}
mListView->clear();
currentItem = 0;
KABC::Addressee::List addresseeList = addressees();
KABC::Addressee::List::Iterator it;
for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
continue;
ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
if ( (*it).uid() == currentUID )
currentItem = item;
else if ( (*it).uid() == nextUID && !currentItem )
currentItem = item;
}
// Sometimes the background pixmap gets messed up when we add lots
// of items.
mListView->repaint();
if ( !currentItem )
currentItem = (ContactListViewItem *)mListView->firstChild();
if ( currentItem ) {
mListView->setCurrentItem( currentItem );
mListView->ensureItemVisible( currentItem );
mListView->setSelected( currentItem, true );
}
} else {
// Only need to update on entry. Iterate through and try to find it
ContactListViewItem *ceItem;
- QListViewItemIterator it( mListView );
+ Q3ListViewItemIterator it( mListView );
while ( it.current() ) {
#ifndef KAB_EMBEDDED
ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
#else //KAB_EMBEDDED
ceItem = (ContactListViewItem*)( it.current() );
#endif //KAB_EMBEDDED
if ( ceItem && ceItem->addressee().uid() == uid ) {
ceItem->refresh();
return;
}
++it;
}
refresh( QString::null );
}
}
QStringList KAddressBookTableView::selectedUids()
{
QStringList uidList;
- QListViewItem *item;
+ Q3ListViewItem *item;
ContactListViewItem *ceItem;
for(item = mListView->firstChild(); item; item = item->itemBelow())
{
if (mListView->isSelected( item ))
{
#ifndef KAB_EMBEDDED
ceItem = dynamic_cast<ContactListViewItem*>(item);
#else //KAB_EMBEDDED
ceItem = (ContactListViewItem*)(item);
#endif //KAB_EMBEDDED
if (ceItem != 0L)
uidList << ceItem->addressee().uid();
}
}
if ( uidList.count() == 0 )
if ( mListView->currentItem() ) {
ceItem = (ContactListViewItem*)(mListView->currentItem()) ;
uidList << ceItem->addressee().uid();
}
return uidList;
}
void KAddressBookTableView::setSelected(QString uid, bool selected)
{
- QListViewItem *item;
+ Q3ListViewItem *item;
ContactListViewItem *ceItem;
if (uid.isNull())
{
mListView->selectAll(selected);
}
else
{
for(item = mListView->firstChild(); item; item = item->itemBelow())
{
#ifndef KAB_EMBEDDED
ceItem = dynamic_cast<ContactListViewItem*>(item);
#else //KAB_EMBEDDED
ceItem = (ContactListViewItem*)(item);
#endif //KAB_EMBEDDED
if ((ceItem != 0L) && (ceItem->addressee().uid() == uid))
{
mListView->setSelected(item, selected);
if (selected)
mListView->ensureItemVisible(item);
}
}
}
}
void KAddressBookTableView::addresseeSelected()
{
// We need to try to find the first selected item. This might not be the
// last selected item, but when QListView is in multiselection mode,
// there is no way to figure out which one was
// selected last.
- QListViewItem *item;
+ Q3ListViewItem *item;
bool found =false;
for (item = mListView->firstChild(); item && !found;
item = item->nextSibling())
{
if (item->isSelected())
{
found = true;
#ifndef KAB_EMBEDDED
ContactListViewItem *ceItem
= dynamic_cast<ContactListViewItem*>(item);
#else //KAB_EMBEDDED
ContactListViewItem *ceItem
= (ContactListViewItem*)(item);
#endif //KAB_EMBEDDED
if ( ceItem ) emit selected(ceItem->addressee().uid());
}
}
if (!found)
emit selected(QString::null);
}
-void KAddressBookTableView::addresseeExecuted(QListViewItem *item)
+void KAddressBookTableView::addresseeExecuted(Q3ListViewItem *item)
{
if (item)
{
#ifndef KAB_EMBEDDED
ContactListViewItem *ceItem
= dynamic_cast<ContactListViewItem*>(item);
#else //KAB_EMBEDDED
ContactListViewItem *ceItem
= (ContactListViewItem*)(item);
#endif //KAB_EMBEDDED
if (ceItem)
{
emit executed(ceItem->addressee().uid());
}
}
else
{
emit executed(QString::null);
}
}
void KAddressBookTableView::addresseeDeleted()
{
emit deleteRequest();
}
-#ifndef KAB_EMBEDDED
-#include "kaddressbooktableview.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kaddressbooktableview.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h
index 38db7b4..c3cb038 100644
--- a/kaddressbook/views/kaddressbooktableview.h
+++ b/kaddressbook/views/kaddressbooktableview.h
@@ -1,117 +1,119 @@
#ifndef KADDRESSBOOKTABLEVIEW_H
#define KADDRESSBOOKTABLEVIEW_H
#ifndef KAB_EMBEDDED
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <qwidget.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qstring.h>
#include <qdialog.h>
-#include <qtabdialog.h>
+#include <q3tabdialog.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "undo.h"
#else //KAB_EMBEDDED
#include "views/configuretableviewdialog.h"
#endif //KAB_EMBEDDED
#include "klocale.h"
#include "kaddressbookview.h"
+//Added by qt3to4:
+#include <Q3VBoxLayout>
-class QListViewItem;
-class QListBox;
-class QVBoxLayout;
+class Q3ListViewItem;
+class Q3ListBox;
+class Q3VBoxLayout;
class KConfig;
class ContactListViewItem;
class ContactListView;
namespace KABC { class AddressBook; }
/**
* This class is the table view for kaddressbook. This view is a KListView
* with multiple columns for the selected fields.
*
* @short Table View
* @author Don Sanders <dsanders@kde.org>
* @version 0.1
*/
class KAddressBookTableView : public KAddressBookView
{
friend class ContactListView;
Q_OBJECT
public:
KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 );
virtual ~KAddressBookTableView();
virtual void refresh(QString uid = QString::null);
virtual QStringList selectedUids();
virtual void setSelected(QString uid = QString::null, bool selected = false);
virtual void readConfig(KConfig *config);
virtual void writeConfig(KConfig *config);
virtual QString type() const { return "Table"; }
void doSearch( const QString& s ,KABC::Field *field );
virtual void scrollUP();
virtual void scrollDOWN();
virtual void setFocusAV();
public slots:
virtual void reconstructListView();
protected slots:
/** Called whenever the user selects an addressee in the list view.
*/
void addresseeSelected();
void addresseeDeleted();
/** Called whenever the user executes an addressee. In terms of the
* list view, this is probably a double click
*/
- void addresseeExecuted(QListViewItem*);
+ void addresseeExecuted(Q3ListViewItem*);
private:
- QVBoxLayout *mainLayout;
+ Q3VBoxLayout *mainLayout;
ContactListView *mListView;
};
class TableViewFactory : public ViewFactory
{
public:
KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name )
{
return new KAddressBookTableView( ab, parent, name );
}
QString type() const { return "Table"; }
QString description() const { return i18n( "A listing of contacts in a table. Each cell of "
"the table holds a field of the contact." ); }
ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 )
{
return new ConfigureTableViewWidget( ab, parent, name );
}
};
/*US
extern "C" {
void *init_libkaddrbk_tableview()
{
return ( new TableViewFactory );
}
}
*/
diff --git a/kaddressbook/xxport/csv_xxport.cpp b/kaddressbook/xxport/csv_xxport.cpp
index 7281003..ed5807f 100644
--- a/kaddressbook/xxport/csv_xxport.cpp
+++ b/kaddressbook/xxport/csv_xxport.cpp
@@ -1,65 +1,65 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qfile.h>
#include <qregexp.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <kfiledialog.h>
#ifndef KAB_EMBEDDED
#include <kio/netaccess.h>
#endif //KAB_EMBEDDED
#include <klocale.h>
#include <kmessagebox.h>
#include <ktempfile.h>
#include <kurl.h>
#include "csvimportdialog.h"
#include "csv_xxport.h"
#ifndef KAB_EMBEDDED
class CSVXXPortFactory : public XXPortFactory
{
public:
XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name )
{
return new CSVXXPort( ab, parent, name );
}
};
#endif //KAB_EMBEDDED
extern "C"
@@ -75,120 +75,118 @@ extern "C"
}
CSVXXPort::CSVXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
: XXPortObject( ab, parent, name )
{
createImportAction( i18n( "Import CSV List..." ) );
createExportAction( i18n( "Export CSV List..." ) );
}
bool CSVXXPort::exportContacts( const KABC::AddresseeList &list, const QString& )
{
#ifndef KAB_EMBEDDED
KURL url = KFileDialog::getSaveURL( "addressbook.csv" );
if ( url.isEmpty() )
return true;
if ( !url.isLocalFile() ) {
KTempFile tmpFile;
if ( tmpFile.status() != 0 ) {
QString txt = i18n( "<qt>Unable to open file <b>%1</b>.%2.</qt>" );
KMessageBox::error( parentWidget(), txt.arg( url.url() )
.arg( strerror( tmpFile.status() ) ) );
return false;
}
doExport( tmpFile.file(), list );
tmpFile.close();
return KIO::NetAccess::upload( tmpFile.name(), url, parentWidget() );
} else {
QFile file( url.path() );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::WriteOnly ) ) {
QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), txt.arg( url.path() ) );
return false;
}
doExport( &file, list );
file.close();
return true;
}
#else //KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( "addressbook.csv", i18n("Save file"), parentWidget() );
if ( fileName.isEmpty() )
return false;
QFile file( fileName );
- if ( !file.open( IO_WriteOnly ) ) {
+ if ( !file.open( QIODevice::WriteOnly ) ) {
QString txt = i18n( "<qt>Unable to open file <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), txt.arg( fileName ) );
return false;
}
doExport( &file, list );
file.close();
return true;
#endif //KAB_EMBEDDED
}
KABC::AddresseeList CSVXXPort::importContacts( const QString& ) const
{
CSVImportDialog dlg( addressBook(), parentWidget() );
if ( dlg.exec() )
return dlg.contacts();
else
return KABC::AddresseeList();
}
void CSVXXPort::doExport( QFile *fp, const KABC::AddresseeList &list )
{
- QTextStream t( fp );
+ Q3TextStream t( fp );
t.setCodec( QTextCodec::codecForName("utf8") );
KABC::AddresseeList::ConstIterator iter;
KABC::Field::List fields = addressBook()->fields();
KABC::Field::List::Iterator fieldIter;
bool first = true;
// First output the column headings
for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) {
if ( !first )
t << ",";
t << "\"" << (*fieldIter)->label() << "\"";
first = false;
}
t << "\n";
// Then all the addressee objects
KABC::Addressee addr;
for ( iter = list.begin(); iter != list.end(); ++iter ) {
addr = *iter;
first = true;
for ( fieldIter = fields.begin(); fieldIter != fields.end(); ++fieldIter ) {
if ( !first )
t << ",";
t << "\"" << (*fieldIter)->value( addr ) << "\"";
first = false;
}
t << "\n";
}
}
-#ifndef KAB_EMBEDDED
-#include "csv_xxport.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_csv_xxport.cpp"
#endif //KAB_EMBEDDED
-
-
diff --git a/kaddressbook/xxport/csvimportdialog.cpp b/kaddressbook/xxport/csvimportdialog.cpp
index 862241e..7959cac 100644
--- a/kaddressbook/xxport/csvimportdialog.cpp
+++ b/kaddressbook/xxport/csvimportdialog.cpp
@@ -1,91 +1,95 @@
/*
This file is part of KAddressBook.
Copyright (C) 2003 Tobias Koenig <tokoe@kde.org>
based on the code of KSpread's CSV Import Dialog
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#ifdef DESKTOP_VERSION
#include <qinputdialog.h>
#else
#include <qtcompat/qinputdialog.h>
#endif
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
-#include <qtable.h>
+#include <q3table.h>
#include <qlayout.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3ValueList>
+#include <Q3GridLayout>
#include <kapplication.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <kfiledialog.h>
#include <klineedit.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#ifdef DESKTOP_VERSION
-#include "qtable.h"
+#include "q3table.h"
#else
#include "qcombotableitem.h"
#endif
#include "csvimportdialog.h"
CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
const char * name )
: KDialogBase( Plain, i18n ( "CSV Import Dialog" ), Ok | Cancel | User1 |
User2, Ok, parent, name, true, true ),
mAdjustRows( false ),
mStartLine( 0 ),
mTextQuote( '"' ),
mDelimiter( "," ),
mAddressBook( ab )
{
initGUI();
mTypeMap.insert( i18n( "Undefined" ), Undefined );
mTypeMap.insert( KABC::Addressee::formattedNameLabel(), FormattedName );
mTypeMap.insert( KABC::Addressee::familyNameLabel(), FamilyName );
mTypeMap.insert( KABC::Addressee::givenNameLabel(), GivenName );
mTypeMap.insert( KABC::Addressee::additionalNameLabel(), AdditionalName );
mTypeMap.insert( KABC::Addressee::prefixLabel(), Prefix );
mTypeMap.insert( KABC::Addressee::suffixLabel(), Suffix );
mTypeMap.insert( KABC::Addressee::nickNameLabel(), NickName );
mTypeMap.insert( KABC::Addressee::birthdayLabel(), Birthday );
mTypeMap.insert( KABC::Addressee::homeAddressStreetLabel(), HomeAddressStreet );
mTypeMap.insert( KABC::Addressee::homeAddressLocalityLabel(),
HomeAddressLocality );
mTypeMap.insert( KABC::Addressee::homeAddressRegionLabel(), HomeAddressRegion );
mTypeMap.insert( KABC::Addressee::homeAddressPostalCodeLabel(),
@@ -132,133 +136,133 @@ CSVImportDialog::CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
for ( it = fields.begin(); it != fields.end(); ++it, ++count )
mTypeMap.insert( (*it)->label(), count );
connect( mDelimiterBox, SIGNAL( clicked( int ) ),
this, SLOT( delimiterClicked( int ) ) );
connect( mDelimiterEdit, SIGNAL( returnPressed() ),
this, SLOT( returnPressed() ) );
connect( mDelimiterEdit, SIGNAL( textChanged ( const QString& ) ),
this, SLOT( textChanged ( const QString& ) ) );
connect( mComboLine, SIGNAL( activated( const QString& ) ),
this, SLOT( lineSelected( const QString& ) ) );
connect( mComboCodec, SIGNAL( activated( const QString& ) ),
this, SLOT( codecChanged( const QString& ) ) );
connect( mComboQuote, SIGNAL( activated( const QString& ) ),
this, SLOT( textquoteSelected( const QString& ) ) );
connect( mIgnoreDuplicates, SIGNAL( stateChanged( int ) ),
this, SLOT( ignoreDuplicatesChanged( int ) ) );
connect( mUrlRequester, SIGNAL( returnPressed( const QString& ) ),
this, SLOT( setFile( const QString& ) ) );
connect( mUrlRequester, SIGNAL( urlSelected( const QString& ) ),
this, SLOT( setFile( const QString& ) ) );
connect( mUrlRequester->lineEdit(), SIGNAL( textChanged ( const QString& ) ),
this, SLOT( urlChanged( const QString& ) ) );
connect( this, SIGNAL( user1Clicked() ),
this, SLOT( applyTemplate() ) );
connect( this, SIGNAL( user2Clicked() ),
this, SLOT( saveTemplate() ) );
// if ( QApplication::desktop()->width() < 321 )
- QIconSet icon = SmallIcon("filesave");
+ QIcon icon = SmallIcon("filesave");
findButton( User2 )->setIconSet (icon ) ;
icon = SmallIcon("fileopen");
findButton( User1 )->setIconSet (icon ) ;
int wid = findButton( User2 )->sizeHint().height();
findButton( User2 )->setMaximumWidth( wid+4 );
findButton( User1 )->setMaximumWidth( wid+4 );
}
CSVImportDialog::~CSVImportDialog()
{
}
KABC::AddresseeList CSVImportDialog::contacts() const
{
KABC::AddresseeList contacts;
for ( int row = 1; row < mTable->numRows(); ++row ) {
KABC::Addressee a;
bool emptyRow = true;
KABC::Address addrHome( KABC::Address::Home );
KABC::Address addrWork( KABC::Address::Work );
for ( int col = 0; col < mTable->numCols(); ++col ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, col ) );
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, col ) );
if ( !item ) {
qDebug( "ERROR: item cast failed" );
continue;
}
QString value = mTable->text( row, col );
if ( !value.isEmpty() )
emptyRow = false;
switch ( posToType( item->currentItem() ) )
{
case Undefined:
continue;
break;
case FormattedName:
a.setFormattedName( value );
break;
case GivenName:
a.setGivenName( value );
break;
case FamilyName:
a.setFamilyName( value );
break;
case AdditionalName:
a.setAdditionalName( value );
break;
case Prefix:
a.setPrefix( value );
break;
case Suffix:
a.setSuffix( value );
break;
case NickName:
a.setNickName( value );
break;
case Birthday:
//US
//the generated code had the following format: a.setBirthday( QDate::fromString( value, Qt::ISODate ) );
// But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ?
{
QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate
- a.setBirthday(dt);
+ a.setBirthday(QDateTime(dt));
}
break;
case Email:
if ( !value.isEmpty() )
a.insertEmail( value, true );
break;
case Role:
a.setRole( value );
break;
case Title:
a.setTitle( value );
break;
case Mailer:
a.setMailer( value );
break;
case URL:
a.setUrl( value );
break;
case Organization:
a.setOrganization( value );
break;
case Note:
if ( a.note().isEmpty() )
a.setNote( value );
else {
a.setNote( a.note()+"\n"+value );
}
break;
case Categories:
a.insertCategory( value );
break;
case HomePhone:
@@ -353,332 +357,332 @@ KABC::AddresseeList CSVImportDialog::contacts() const
KABC::Field::List fields = mAddressBook->fields( KABC::Field::CustomCategory );
KABC::Field::List::Iterator it;
int counter = 0;
for ( it = fields.begin(); it != fields.end(); ++it ) {
if ( counter == (int)( posToType( item->currentItem() ) - mCustomCounter ) )
{
(*it)->setValue( a, value );
break;
}
++counter;
}
break;
}
}
if ( !addrHome.isEmpty() )
a.insertAddress( addrHome );
if ( !addrWork.isEmpty() )
a.insertAddress( addrWork );
if ( !emptyRow && !a.isEmpty() )
contacts.append( a );
}
return contacts;
}
void CSVImportDialog::initGUI()
{
QWidget* page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 1, 1, marginHintSmall(),
+ Q3GridLayout *layout = new Q3GridLayout( page, 1, 1, marginHintSmall(),
spacingHintSmall() );
- QHBoxLayout *hbox = new QHBoxLayout();
+ Q3HBoxLayout *hbox = new Q3HBoxLayout();
hbox->setSpacing( spacingHint() );
QLabel *label = new QLabel( i18n( "File to import:" ), page );
hbox->addWidget( label );
mUrlRequester = new KURLRequester( page );
mUrlRequester->setFilter( "*.csv" );
hbox->addWidget( mUrlRequester );
layout->addMultiCellLayout( hbox, 0, 0, 0, 2 );
// Delimiter: comma, semicolon, tab, space, other
- mDelimiterBox = new QButtonGroup( i18n( "Delimiter" ), page );
+ mDelimiterBox = new Q3ButtonGroup( i18n( "Delimiter" ), page );
mDelimiterBox->setColumnLayout( 0, Qt::Vertical );
mDelimiterBox->layout()->setSpacing( spacingHint() );
mDelimiterBox->layout()->setMargin( marginHint() );
- QGridLayout *delimiterLayout = new QGridLayout( mDelimiterBox->layout() );
+ Q3GridLayout *delimiterLayout = new Q3GridLayout( mDelimiterBox->layout() );
delimiterLayout->setAlignment( Qt::AlignTop );
layout->addMultiCellWidget( mDelimiterBox, 1, 1, 0, 2 );
mRadioComma = new QRadioButton( i18n( "Comma" ), mDelimiterBox );
mRadioComma->setChecked( true );
delimiterLayout->addWidget( mRadioComma, 0, 0 );
mRadioSemicolon = new QRadioButton( i18n( "Semicolon" ), mDelimiterBox );
delimiterLayout->addWidget( mRadioSemicolon, 0, 1 );
mRadioTab = new QRadioButton( i18n( "Tabulator" ), mDelimiterBox );
delimiterLayout->addWidget( mRadioTab, 1, 0 );
mRadioSpace = new QRadioButton( i18n( "Space" ), mDelimiterBox );
delimiterLayout->addWidget( mRadioSpace, 1, 1 );
mRadioOther = new QRadioButton( i18n( "Other" ), mDelimiterBox );
delimiterLayout->addWidget( mRadioOther, 0, 2 );
mDelimiterEdit = new QLineEdit( mDelimiterBox );
delimiterLayout->addWidget( mDelimiterEdit, 1, 2 );
mComboLine = new QComboBox( false, page );
mComboLine->insertItem( i18n( "1" ) );
layout->addWidget( mComboLine, 3, 1 );
mComboQuote = new QComboBox( false, page );
mComboQuote->insertItem( i18n( "\"" ), 0 );
mComboQuote->insertItem( i18n( "'" ), 1 );
mComboQuote->insertItem( i18n( "None" ), 2 );
layout->addWidget( mComboQuote, 3, 0 );
mComboCodec = new QComboBox( false, page );
mComboCodec->insertItem( i18n( "UTF8" ), 0 );
mComboCodec->insertItem( i18n( "LATIN1" ), 1 );
mComboCodec->insertItem( i18n( "LOCALE" ), 2 );
layout->addWidget( mComboCodec, 3, 2 );
label = new QLabel( i18n( "Start at line:" ), page );
layout->addWidget( label, 2, 1 );
label = new QLabel( i18n( "Textquote:" ), page );
layout->addWidget( label, 2, 0 );
label = new QLabel( i18n( "Codec:" ), page );
layout->addWidget( label, 2, 2 );
mIgnoreDuplicates = new QCheckBox( page );
mIgnoreDuplicates->setText( i18n( "Ignore duplicate delimiters" ) );
layout->addMultiCellWidget( mIgnoreDuplicates, 4, 4, 0, 2 );
- mTable = new QTable( 0, 0, page );
- mTable->setSelectionMode( QTable::NoSelection );
+ mTable = new Q3Table( 0, 0, page );
+ mTable->setSelectionMode( Q3Table::NoSelection );
//mTable->horizontalHeader()->hide();
layout->addMultiCellWidget( mTable, 5, 5, 0, 2 );
/*US
setButtonText( User1, i18n( "Apply Template" ) );
setButtonText( User2, i18n( "Save Template" ) );
*/
enableButtonOK( false );
findButton( User1 )->setEnabled( false );
findButton( User2 )->setEnabled( false );
#ifdef DESKTOP_VERSION
resize( 640, 480 );
#else
showMaximized();
#endif
}
void CSVImportDialog::fillTable()
{
int row, column;
bool lastCharDelimiter = false;
bool ignoreDups = mIgnoreDuplicates->isChecked();
enum { S_START, S_QUOTED_FIELD, S_MAYBE_END_OF_QUOTED_FIELD, S_END_OF_QUOTED_FIELD,
S_MAYBE_NORMAL_FIELD, S_NORMAL_FIELD } state = S_START;
QChar x;
QString field = "";
// store previous assignment
- QValueList<int> mTypeOld = mTypeStore;
+ Q3ValueList<int> mTypeOld = mTypeStore;
mTypeStore.clear();
for ( column = 0; column < mTable->numCols(); ++column ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0, column ) );
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0, column ) );
if ( !item || mClearTypeStore )
mTypeStore.append( typeToPos( Undefined ) );
else if ( item )
mTypeStore.append( item->currentItem() );
}
clearTable();
row = column = 1;
if ( mComboCodec->currentItem () == 0 ) {
mData = QString::fromUtf8( mFileArray.data() );
} else if ( mComboCodec->currentItem () == 1 ) {
mData = QString::fromLatin1( mFileArray.data() );
} else {
mData = QString::fromLocal8Bit( mFileArray.data() );
}
- QTextStream inputStream( mData, IO_ReadOnly );
+ Q3TextStream inputStream( mData, QIODevice::ReadOnly );
if ( mComboCodec->currentItem () == 0 ) {
- inputStream.setEncoding( QTextStream::UnicodeUTF8 );
+ inputStream.setEncoding( Q3TextStream::UnicodeUTF8 );
} else if ( mComboCodec->currentItem () == 1 ) {
- inputStream.setEncoding( QTextStream::Latin1 );
+ inputStream.setEncoding( Q3TextStream::Latin1 );
} else {
- inputStream.setEncoding( QTextStream::Locale );
+ inputStream.setEncoding( Q3TextStream::Locale );
}
int maxColumn = 0;
while ( !inputStream.atEnd() ) {
inputStream >> x; // read one char
if ( x == '\r' ) inputStream >> x; // eat '\r', to handle DOS/LOSEDOWS files correctly
switch ( state ) {
case S_START :
if ( x == mTextQuote ) {
state = S_QUOTED_FIELD;
- } else if ( x == mDelimiter ) {
+ } else if ( QString(x) == mDelimiter ) {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
} else if ( x == '\n' ) {
++row;
column = 1;
} else {
field += x;
state = S_MAYBE_NORMAL_FIELD;
}
break;
case S_QUOTED_FIELD :
if ( x == mTextQuote ) {
state = S_MAYBE_END_OF_QUOTED_FIELD;
} else if ( x == '\n' && mTextQuote.isNull() ) {
setText( row - mStartLine + 1, column, field );
field = "";
if ( x == '\n' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
field += x;
}
break;
case S_MAYBE_END_OF_QUOTED_FIELD :
if ( x == mTextQuote ) {
field += x;
state = S_QUOTED_FIELD;
- } else if ( x == mDelimiter || x == '\n' ) {
+ } else if ( QString(x) == mDelimiter || x == '\n' ) {
setText( row - mStartLine + 1, column, field );
field = "";
if ( x == '\n' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
state = S_END_OF_QUOTED_FIELD;
}
break;
case S_END_OF_QUOTED_FIELD :
- if ( x == mDelimiter || x == '\n' ) {
+ if ( QString(x) == mDelimiter || x == '\n' ) {
setText( row - mStartLine + 1, column, field );
field = "";
if ( x == '\n' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
state = S_END_OF_QUOTED_FIELD;
}
break;
case S_MAYBE_NORMAL_FIELD :
if ( x == mTextQuote ) {
field = "";
state = S_QUOTED_FIELD;
break;
}
case S_NORMAL_FIELD :
- if ( x == mDelimiter || x == '\n' ) {
+ if ( QString(x) == mDelimiter || x == '\n' ) {
setText( row - mStartLine + 1, column, field );
field = "";
if ( x == '\n' ) {
++row;
column = 1;
} else {
if ( ( ignoreDups == false ) || ( lastCharDelimiter == false ) )
++column;
lastCharDelimiter = true;
}
state = S_START;
} else {
field += x;
}
}
- if ( x != mDelimiter )
+ if ( QString(x) != mDelimiter )
lastCharDelimiter = false;
if ( column > maxColumn )
maxColumn = column;
}
// file with only one line without '\n'
if ( field.length() > 0 ) {
setText( row - mStartLine + 1, column, field );
++row;
field = "";
}
adjustRows( row - mStartLine );
mTable->setNumCols( maxColumn );
//US begin
QStringList keys;
uint iii = 0, count = mTypeMap.count();
while ( iii < count ) {
keys << "dummy";
++iii;
}
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it)
keys[( it.data() )] = it.key();
//US end
for ( column = 0; column < mTable->numCols(); ++column ) {
//US QComboTableItem *item = new QComboTableItem( mTable, mTypeMap.keys() );
- QComboTableItem *item = new QComboTableItem( mTable, keys );
+ Q3ComboTableItem *item = new Q3ComboTableItem( mTable, keys );
mTable->setItem( 0, column, item );
if ( column < mTypeStore.count() )
item->setCurrentItem( mTypeStore[ column ] );
else
item->setCurrentItem( typeToPos( Undefined ) );
mTable->adjustColumn( column );
}
}
void CSVImportDialog::clearTable()
{
for ( int row = 0; row < mTable->numRows(); ++row )
for ( int column = 0; column < mTable->numCols(); ++column )
mTable->clearCell( row, column );
}
void CSVImportDialog::fillComboBox()
{
mComboLine->clear();
for ( int row = 1; row < mTable->numRows() + 1; ++row )
mComboLine->insertItem( QString::number( row ), row - 1 );
}
void CSVImportDialog::setText( int row, int col, const QString& text )
{
if ( row < 1 ) // skipped by the user
return;
if ( mTable->numRows() < row ) {
mTable->setNumRows( row + 5000 ); // We add 5000 at a time to limit recalculations
mAdjustRows = true;
@@ -735,65 +739,65 @@ void CSVImportDialog::delimiterClicked( int id )
case 3: // space
mDelimiter = " ";
break;
case 1: // semicolon
mDelimiter = ";";
break;
}
fillTable();
}
void CSVImportDialog::textquoteSelected( const QString& mark )
{
if ( mComboQuote->currentItem() == 2 )
mTextQuote = 0;
else
mTextQuote = mark[ 0 ];
fillTable();
}
void CSVImportDialog::lineSelected( const QString& line )
{
mStartLine = line.toInt() - 1;
fillTable();
}
void CSVImportDialog::slotOk()
{
bool assigned = false;
for ( int column = 0; column < mTable->numCols(); ++column ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0,
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0,
column ) );
if ( item && posToType( item->currentItem() ) != Undefined )
assigned = true;
}
if ( assigned )
KDialogBase::slotOk();
else
KMessageBox::sorry( this, i18n( "You have to assign at least one column." ) );
}
void CSVImportDialog::applyTemplate()
{
QMap<uint,int> columnMap;
QMap<QString, QString> fileMap;
QStringList templates;
// load all template files
/*US QStringList list = KGlobal::dirs()->findAllResources( "data" , QString( kapp->name() ) +
"/csv-templates/*.desktop", true, true );
*/
QStringList list = KGlobal::dirs()->findAllResources( "data" , KGlobal::getAppName() +
"/csv-templates/*.desktop", true, true );
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
{
//US KSimpleConfig config( *it, true );
KConfig config( *it );
if ( !config.hasGroup( "csv column map" ) )
continue;
@@ -807,163 +811,163 @@ void CSVImportDialog::applyTemplate()
bool ok = false;
QString tmp;
tmp = QInputDialog::getItem( i18n( "Template Selection" ),
i18n( "Please select a template\nthat matches the CSV file." ),
templates, 0, false, &ok, this );
if ( !ok )
return;
//US KSimpleConfig config( fileMap[ tmp ], true );
KConfig config( fileMap[ tmp ] );
config.setGroup( "General" );
//US uint numColumns = config.readUnsignedNumEntry( "Columns" );
uint numColumns = (uint)config.readNumEntry( "Columns" );
mDelimiterEdit->setText( config.readEntry( "DelimiterOther" ) );
mDelimiterBox->setButton( config.readNumEntry( "DelimiterType" ) );
delimiterClicked( config.readNumEntry( "DelimiterType" ) );
int quoteType = config.readNumEntry( "QuoteType" );
mComboQuote->setCurrentItem( quoteType );
textquoteSelected( mComboQuote->currentText() );
// create the column map
config.setGroup( "csv column map" );
for ( uint i = 0; i < numColumns; ++i ) {
int col = config.readNumEntry( QString::number( i ) );
columnMap.insert( i, col );
}
// apply the column map
for ( uint column = 0; column < columnMap.count(); ++column ) {
int type = columnMap[ column ];
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0,
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0,
column ) );
if ( item )
item->setCurrentItem( typeToPos( type ) );
}
}
void CSVImportDialog::saveTemplate()
{
/*US
QString fileName = KFileDialog::getSaveFileName(
locateLocal( "data", QString( kapp->name() ) + "/csv-templates/" ),
"*.desktop", this );
*/
QString fileName = KFileDialog::getSaveFileName(
locateLocal( "data", KGlobal::getAppName() + "/csv-templates/" )+
"*.desktop",i18n("Save file name") , this );
if ( fileName.isEmpty() )
return;
if ( !fileName.contains( ".desktop" ) )
fileName += ".desktop";
QString name = QInputDialog::getText( i18n( "Template name" ), i18n( "Please enter a name for the template" ) );
if ( name.isEmpty() )
return;
KConfig config( fileName );
config.setGroup( "General" );
config.writeEntry( "Columns", mTable->numCols() );
config.writeEntry( "DelimiterType", mDelimiterBox->id( mDelimiterBox->selected() ) );
config.writeEntry( "DelimiterOther", mDelimiterEdit->text() );
config.writeEntry( "QuoteType", mComboQuote->currentItem() );
config.setGroup( "Misc" );
config.writeEntry( "Name", name );
config.setGroup( "csv column map" );
for ( uint column = 0; column < mTable->numCols(); ++column ) {
- QComboTableItem *item = static_cast<QComboTableItem*>( mTable->item( 0,
+ Q3ComboTableItem *item = static_cast<Q3ComboTableItem*>( mTable->item( 0,
column ) );
if ( item )
config.writeEntry( QString::number( column ), posToType(
item->currentItem() ) );
else
config.writeEntry( QString::number( column ), 0 );
}
config.sync();
}
QString CSVImportDialog::getText( int row, int col )
{
return mTable->text( row, col );
}
uint CSVImportDialog::posToType( int pos ) const
{
return pos;
#if 0
uint counter = 0;
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it, ++counter )
if ( counter == (uint)pos )
return it.data();
return 0;
#endif
}
int CSVImportDialog::typeToPos( uint type ) const
{
return type;
#if 0
uint counter = 0;
QMap<QString, uint>::ConstIterator it;
for ( it = mTypeMap.begin(); it != mTypeMap.end(); ++it, ++counter )
if ( it.data() == type )
return counter;
return -1;
#endif
}
void CSVImportDialog::ignoreDuplicatesChanged( int )
{
fillTable();
}
void CSVImportDialog::setFile( const QString &fileName )
{
if ( fileName.isEmpty() )
return;
QFile file( fileName );
- if ( !file.open( IO_ReadOnly ) ) {
+ if ( !file.open( QIODevice::ReadOnly ) ) {
KMessageBox::sorry( this, i18n( "Cannot open input file!" ) );
file.close();
return;
}
mFileArray = file.readAll();
file.close();
mClearTypeStore = true;
clearTable();
mTable->setNumCols( 0 );
mTable->setNumRows( 0 );
fillTable();
mClearTypeStore = false;
fillComboBox();
}
void CSVImportDialog::urlChanged( const QString &file )
{
bool state = !file.isEmpty();
enableButtonOK( state );
findButton( User1 )->setEnabled( state );
findButton( User2 )->setEnabled( state );
}
-#ifndef KAB_EMBEDDED
-#include <csvimportdialog.moc>
+#ifndef KAB_EMBEDDED_
+#include <moc_csvimportdialog.cpp>
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxport/csvimportdialog.h b/kaddressbook/xxport/csvimportdialog.h
index 2661420..520f3fa 100644
--- a/kaddressbook/xxport/csvimportdialog.h
+++ b/kaddressbook/xxport/csvimportdialog.h
@@ -4,123 +4,123 @@
based on the code of KSpread's CSV Import Dialog
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef CSV_IMPORT_DLG_H
#define CSV_IMPORT_DLG_H
#include <kabc/addressbook.h>
#include <kabc/addresseelist.h>
#include <kdialogbase.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
class KURLRequester;
-class QButtonGroup;
+class Q3ButtonGroup;
class QComboBox;
class QCheckBox;
class QLineEdit;
class QPushButton;
class QRadioButton;
-class QTable;
+class Q3Table;
class CSVImportDialog : public KDialogBase
{
Q_OBJECT
public:
CSVImportDialog( KABC::AddressBook *ab, QWidget *parent,
const char *name = 0 );
~CSVImportDialog();
KABC::AddresseeList contacts() const;
protected slots:
virtual void slotOk();
private slots:
void returnPressed();
void delimiterClicked( int id );
void lineSelected( const QString& line );
void textquoteSelected( const QString& mark );
void textChanged ( const QString & );
void ignoreDuplicatesChanged( int );
void setFile( const QString& );
void urlChanged( const QString& );
void codecChanged ( const QString& );
void applyTemplate();
void saveTemplate();
private:
enum { Undefined, FormattedName, FamilyName, GivenName, AdditionalName,
Prefix, Suffix, NickName, Birthday,
HomeAddressStreet, HomeAddressLocality, HomeAddressRegion,
HomeAddressPostalCode, HomeAddressCountry, HomeAddressLabel,
BusinessAddressStreet, BusinessAddressLocality, BusinessAddressRegion,
BusinessAddressPostalCode, BusinessAddressCountry,
BusinessAddressLabel,
HomePhone, BusinessPhone, MobilePhone, HomeFax, BusinessFax, MobileWorkPhone,
Isdn, Pager, Email, Mailer, Title, Role, Organization, Note, URL, Categories
};
- QTable* mTable;
- QButtonGroup* mDelimiterBox;
+ Q3Table* mTable;
+ Q3ButtonGroup* mDelimiterBox;
QRadioButton* mRadioComma;
QRadioButton* mRadioSemicolon;
QRadioButton* mRadioTab;
QRadioButton* mRadioSpace;
QRadioButton* mRadioOther;
QLineEdit* mDelimiterEdit;
QComboBox* mComboLine;
QComboBox* mComboQuote;
QComboBox* mComboCodec;
QCheckBox* mIgnoreDuplicates;
KURLRequester* mUrlRequester;
void initGUI();
void fillTable();
void clearTable();
void fillComboBox();
void setText( int row, int col, const QString& text );
void adjustRows( int rows );
QString getText( int row, int col );
uint posToType( int pos ) const;
int typeToPos( uint type ) const;
bool mAdjustRows;
int mStartLine;
QChar mTextQuote;
QString mDelimiter;
QString mData;
QByteArray mFileArray;
QMap<QString, uint> mTypeMap;
KABC::AddressBook *mAddressBook;
int mCustomCounter;
bool mClearTypeStore;
- QValueList<int> mTypeStore;
+ Q3ValueList<int> mTypeStore;
};
#endif
diff --git a/kaddressbook/xxport/kde2_xxport.cpp b/kaddressbook/xxport/kde2_xxport.cpp
index 03efc1b..72d3fc2 100644
--- a/kaddressbook/xxport/kde2_xxport.cpp
+++ b/kaddressbook/xxport/kde2_xxport.cpp
@@ -87,35 +87,35 @@ KABC::AddresseeList KDE2XXPort::importContacts( const QString& ) const
return KABC::AddresseeList();
}
#ifndef KAB_EMBEDDED
int result = KMessageBox::questionYesNoCancel( parentWidget(),
i18n( "Override previously imported entries?" ),
i18n( "Import KDE 2 Addressbook" ) );
#else //KAB_EMBEDDED
int result = KMessageBox::warningYesNoCancel( parentWidget(),
i18n( "Override previously imported entries?" ),
i18n( "Import KDE 2 Addressbook" ) );
#endif //KAB_EMBEDDED
if ( !result ) return KABC::AddresseeList();
KProcess proc;
if ( result == KMessageBox::Yes ) {
proc << "kab2kabc";
proc << "--override";
} else if ( result == KMessageBox::No )
proc << "kab2kabc";
else
kdDebug(5720) << "KAddressBook::importKDE2(): Unknow return value." << endl;
proc.start( KProcess::Block );
addressBook()->load();
return KABC::AddresseeList();
}
-#ifndef KAB_EMBEDDED
-#include "kde2_xxport.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_kde2_xxport.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxport/vcard_xxport.cpp b/kaddressbook/xxport/vcard_xxport.cpp
index 9a8fa68..64b9071 100644
--- a/kaddressbook/xxport/vcard_xxport.cpp
+++ b/kaddressbook/xxport/vcard_xxport.cpp
@@ -1,65 +1,67 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kabc/vcardconverter.h>
#include <kabc/vcardparser/vcardtool.h>
#include <kfiledialog.h>
#ifndef KAB_EMBEDDED
#include <kio/netaccess.h>
#endif //KAB_EMBEDDED
#include <klocale.h>
#include <kmessagebox.h>
#include <ktempfile.h>
#include <kurl.h>
#include "xxportmanager.h"
#include "vcard_xxport.h"
#ifndef KAB_EMBEDDED
class VCardXXPortFactory : public XXPortFactory
{
public:
XXPortObject *xxportObject( KABC::AddressBook *ab, QWidget *parent, const char *name )
{
return new VCardXXPort( ab, parent, name );
}
};
#endif //KAB_EMBEDDED
extern "C"
{
@@ -73,160 +75,160 @@ extern "C"
}
}
VCardXXPort::VCardXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
: XXPortObject( ab, parent, name )
{
createImportAction( i18n( "Import vCard..." ) );
//US KABC::VCardConverter does not support the export of 2.1 addressbooks.
//US createExportAction( i18n( "Export vCard 2.1..." ), "v21" );
createExportAction( i18n( "Export vCard 3.0..." ), "v30" );
}
bool VCardXXPort::exportContacts( const KABC::AddresseeList &list, const QString &data )
{
QString name;
if ( list.count() == 1 )
name = list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf";
else
name = "addressbook.vcf";
#ifndef KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name );
#else //KAB_EMBEDDED
QString fileName = KFileDialog::getSaveFileName( name, i18n("Save file"), parentWidget() );
#endif //KAB_EMBEDDED
if ( fileName.isEmpty() )
return false;
QFile outFile( fileName );
- if ( !outFile.open( IO_WriteOnly ) ) {
+ if ( !outFile.open( QIODevice::WriteOnly ) ) {
QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" );
KMessageBox::error( parentWidget(), text.arg( fileName ) );
return false;
}
- QTextStream t( &outFile );
- t.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream t( &outFile );
+ t.setEncoding( Q3TextStream::UnicodeUTF8 );
KABC::Addressee::List::ConstIterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
KABC::VCardConverter converter;
QString vcard;
KABC::VCardConverter::Version version;
if ( data == "v21" )
version = KABC::VCardConverter::v2_1;
else
version = KABC::VCardConverter::v3_0;
converter.addresseeToVCard( *it, vcard, version );
t << vcard << "\r\n\r\n";
}
outFile.close();
return true;
}
KABC::AddresseeList VCardXXPort::importContacts( const QString& ) const
{
QString fileName;
KABC::AddresseeList addrList;
KURL url;
#ifndef KAB_EMBEDDED
if ( !XXPortManager::importData.isEmpty() )
addrList = parseVCard( XXPortManager::importData );
else {
if ( XXPortManager::importURL.isEmpty() )
{
url = KFileDialog::getLoadFileName( QString::null, i18n("Select vCard to Import"), parentWidget() );
}
else
url = XXPortManager::importURL;
if ( url.isEmpty() )
return addrList;
QString caption( i18n( "vCard Import Failed" ) );
if ( KIO::NetAccess::download( url, fileName ) ) {
QFile file( fileName );
- file.open( IO_ReadOnly );
+ file.open( QIODevice::ReadOnly );
QByteArray rawData = file.readAll();
file.close();
QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
addrList = parseVCard( data );
if ( !url.isLocalFile() )
KIO::NetAccess::removeTempFile( fileName );
} else {
QString text = i18n( "<qt>Unable to access <b>%1</b>.</qt>" );
KMessageBox::error( parentWidget(), text.arg( url.url() ), caption );
}
}
#else //KAB_EMBEDDED
if ( !XXPortManager::importData.isEmpty() )
addrList = parseVCard( XXPortManager::importData );
else {
if ( XXPortManager::importURL.isEmpty() )
{
fileName = KFileDialog::getOpenFileName( QString::null, i18n("Select vCard to Import"), parentWidget() );
if ( fileName.isEmpty() )
return addrList;
QFileInfo fi ( fileName );
if ( !fi.isFile() )
return addrList;
}
else
{
//US url = XXPortManager::importURL;
qDebug("VCardXXPort::importContacts Urls at the moment not supported");
if ( url.isEmpty() )
return addrList;
}
QFile file( fileName );
- if ( file.open( IO_ReadOnly ) ) {
- QCString rawData ( file.readAll().data(),file.size()+1);
+ if ( file.open( QIODevice::ReadOnly ) ) {
+ Q3CString rawData ( file.readAll().data(),file.size()+1);
file.close();
int start = 0;
#ifndef DESKTOP_VERSION
while ( start < rawData.size()-2 ) {
if ( rawData.at( start ) == '\r' )
if ( rawData.at( start+1 ) == '\n' )
if ( rawData.at( start+2 ) == ' ' ) {
rawData.remove(start,3);
--start;
}
++start;
}
#endif
int ret = KMessageBox::warningYesNoCancel( 0, i18n("Select import format!\nDefault and standard is Utf8.\nLatin1 may be the right\nfor some West Europian languages."), i18n("Import Format"), i18n("Utf8"), i18n("Latin1") );
if ( ret == KMessageBox::Cancel )
return addrList;
if ( ret == KMessageBox::Yes )
addrList = parseVCard( QString::fromUtf8( rawData.data() ) );
else
addrList = parseVCard( QString::fromLatin1( rawData.data() ) );
}
}
#endif //KAB_EMBEDDED
return addrList;
}
KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const
{
KABC::VCardTool tool;
@@ -238,35 +240,35 @@ KABC::AddresseeList VCardXXPort::parseVCard( const QString &data ) const
QStringList dataList = QStringList::split( "\r\n\r\n", data );
for ( uint i = 0; i < numVCards && i < dataList.count(); ++i ) {
KABC::Addressee addr;
bool ok = false;
if ( dataList[ i ].contains( "VERSION:3.0" ) )
ok = converter.vCardToAddressee( dataList[ i ], addr, KABC::VCardConverter::v3_0 );
else if ( dataList[ i ].contains( "VERSION:2.1" ) )
ok = converter.vCardToAddressee( dataList[ i ], addr, KABC::VCardConverter::v2_1 );
else {
KMessageBox::sorry( parentWidget(), i18n( "Not supported vCard version." ) );
continue;
}
if ( !addr.isEmpty() && ok )
addrList.append( addr );
else {
QString text = i18n( "The selected file does not include a valid vCard. "
"Please check the file and try again." );
KMessageBox::sorry( parentWidget(), text );
}
}
*/
if ( addrList.isEmpty() ) {
QString text = i18n( "The selected file does not\ninclude a valid vCard.\nPlease check the file and try again.\n" );
KMessageBox::sorry( parentWidget(), text );
}
return addrList;
}
-#ifndef KAB_EMBEDDED
-#include "vcard_xxport.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_vcard_xxport.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp
index 405f7ec..95b240d 100644
--- a/kaddressbook/xxportmanager.cpp
+++ b/kaddressbook/xxportmanager.cpp
@@ -1,64 +1,66 @@
/*
This file is part of KAddressbook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <qlist.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kabc/addressbook.h>
#include <kabc/resource.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <klocale.h>
#include <kmessagebox.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else //KAB_EMBEDDED
extern "C"
{
void* init_microkaddrbk_csv_xxport();
void* init_microkaddrbk_kde2_xxport();
void* init_microkaddrbk_vcard_xxport();
// void* init_microkaddrbk_opie_xxport();
void* init_microkaddrbk_qtopia_xxport();
void* init_microkaddrbk_sharpdtm_xxport();
}
#endif //KAB_EMBEDDED
#include <addresseeview.h>
#include "kabcore.h"
#include "undocmds.h"
#include "xxportselectdialog.h"
#include "xxportmanager.h"
#include "nameeditdialog.h"
KURL XXPortManager::importURL = KURL();
@@ -188,83 +190,80 @@ void XXPortManager::slotExport( const QString &identifier, const QString &data )
return;
if ( !obj->exportContacts( addrList, data ) )
KMessageBox::error( mCore, i18n( "Unable to export contacts." ) );
else
KMessageBox::information( mCore, i18n( "contacts successfully exported." ) );
}
void XXPortManager::loadPlugins()
{
mXXPortObjects.clear();
#ifndef KAB_EMBEDDED
KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) )
continue;
KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() );
if ( !factory ) {
kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl;
continue;
}
XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory );
if ( !xxportFactory ) {
kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl;
continue;
}
#else //KAB_EMBEDDED
- QList<XXPortFactory> factorylist;
+ QList<XXPortFactory*> factorylist;
factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport()));
factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport()));
factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport()));
//US factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport()));
factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport()));
factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport()));
- QListIterator<XXPortFactory> it(factorylist);
- for ( ; it.current(); ++it )
- {
- XXPortFactory *xxportFactory = it.current();
+ for(QList<XXPortFactory*>::iterator it=factorylist.begin();it!=factorylist.end();++it) {
+ XXPortFactory *xxportFactory = *it;
#endif //KAB_EMBEDDED
XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore );
if ( obj ) {
mCore->addGUIClient( obj );
mXXPortObjects.insert( obj->identifier(), obj );
connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ),
this, SLOT( slotExport( const QString&, const QString& ) ) );
connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ),
this, SLOT( slotImport( const QString&, const QString& ) ) );
}
}
}
PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent,
const char *name )
: KDialogBase( Plain, i18n( "Import this contact?" ), Ok | User1| User2, Ok, parent,
name, true, true ,i18n( "Import all!" ),i18n( "No" ) )
{
QWidget *page = plainPage();
- QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( page, marginHint(), spacingHint() );
connect( this, SIGNAL( user1Clicked() ), this, SLOT ( slotClose() ) );
connect( this, SIGNAL( user2Clicked() ), this, SLOT ( slotCancel() ) );
KABC::AddresseeView *view = new KABC::AddresseeView( page );
view->setAddressee( addr );
layout->addWidget( view );
#ifdef DESKTOP_VERSION
resize( 640, 480 );
#else
showMaximized();
#endif
}
-#ifndef KAB_EMBEDDED
-#include "xxportmanager.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_xxportmanager.cpp"
#endif //KAB_EMBEDDED
-
diff --git a/kaddressbook/xxportmanager.h b/kaddressbook/xxportmanager.h
index e801d9b..0528922 100644
--- a/kaddressbook/xxportmanager.h
+++ b/kaddressbook/xxportmanager.h
@@ -3,78 +3,78 @@
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef XXPORTMANAGER_H
#define XXPORTMANAGER_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qobject.h>
#include <kurl.h>
#include "xxportobject.h"
class KABCore;
class XXPortManager : public QObject
{
Q_OBJECT
public:
XXPortManager( KABCore *core, QObject *parent, const char *name = 0 );
~XXPortManager();
void restoreSettings();
void saveSettings();
static KURL importURL;
static QString importData;
public slots:
void importVCard( const KURL &url );
void importVCard( const KURL &url, bool showPreview );
void importVCard( const QString &vCard, bool showPreview );
signals:
void modified();
protected slots:
void noPreview();
void slotImport( const QString&, const QString& );
void slotExport( const QString&, const QString& );
private:
void loadPlugins();
- QDict<XXPortObject> mXXPortObjects;
+ Q3Dict<XXPortObject> mXXPortObjects;
KABCore *mCore;
bool mShowPreview;
};
#endif
diff --git a/kaddressbook/xxportobject.cpp b/kaddressbook/xxportobject.cpp
index bd9d986..2d8d0ff 100644
--- a/kaddressbook/xxportobject.cpp
+++ b/kaddressbook/xxportobject.cpp
@@ -242,35 +242,35 @@ KABC::AddresseeList XXPortResourceObject::_importContacts( const QString& identi
KABC::Resource* mResource = (KABC::Resource*)(mFactory->resource( this->identifier(), 0 ));
if (mResource == 0)
return KABC::AddresseeList();
KABC::AddresseeList adrlst;
if (fileName != QString::null)
mResource->setFileName( fileName );
KABC::TmpAddressBook tmpAB;
bool res = tmpAB.addResource( mResource );
if (res == false)
{
delete mResource;
return KABC::AddresseeList();
}
res = tmpAB.load();
adrlst = tmpAB.allAddressees();
//remove resource deletes also the Resourceobject, if the linkcount is 0
tmpAB.removeResource( mResource );
return adrlst;
}
-#ifndef KAB_EMBEDDED
-#include "xxportobject.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_xxportobject.cpp"
#endif //KAB_EMBEDDED
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp
index 278cab0..088bffa 100644
--- a/kaddressbook/xxportselectdialog.cpp
+++ b/kaddressbook/xxportselectdialog.cpp
@@ -7,113 +7,118 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kabc/addressbook.h>
#include <kapplication.h>
#include <kcombobox.h>
#include <klocale.h>
#include <kglobal.h>
#include <qapplication.h>
-#include <qbuttongroup.h>
+#include <QDesktopWidget>
+#include <q3buttongroup.h>
#include <qcombobox.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qlabel.h>
#include <qlayout.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qstringlist.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
#include "kabcore.h"
#include "kabprefs.h"
#include "xxportselectdialog.h"
XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort,
QWidget* parent, const char* name )
: KDialogBase( Plain, i18n( "Choose contact selection" ), Help | Ok | Cancel,
Ok, parent, name, true, true ), mCore( core ),
mUseSorting( sort )
{
initGUI();
connect( mFiltersCombo, SIGNAL( activated( int ) ),
SLOT( filterChanged( int ) ) );
- connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ),
- SLOT( categoryClicked( QListViewItem* ) ) );
+ connect( mCategoriesView, SIGNAL( clicked( Q3ListViewItem* ) ),
+ SLOT( categoryClicked( Q3ListViewItem* ) ) );
// setup filters
#ifndef KAB_EMBEDDED
mFilters = Filter::restore( kapp->config(), "Filter" );
Filter::List::iterator filterIt;
#else //KAB_EMBEDDED
mFilters = Filter::restore( KGlobal::config(), "Filter" );
Filter::List::Iterator filterIt;
#endif //KAB_EMBEDDED
QStringList filters;
for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt )
filters.append( (*filterIt).name() );
mFiltersCombo->insertStringList( filters );
mUseFilters->setEnabled( filters.count() > 0 );
// setup categories
QStringList categories = KABPrefs::instance()->mCustomCategories;
QStringList::Iterator it;
for ( it = categories.begin(); it != categories.end(); ++it )
- new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox );
+ new Q3CheckListItem( mCategoriesView, *it, Q3CheckListItem::CheckBox );
mUseCategories->setEnabled( categories.count() > 0 );
int count = mCore->selectedUIDs().count();
mUseSelection->setEnabled( count != 0 );
mUseSelection->setChecked( count > 1 );
mSortTypeCombo->insertItem( i18n( "Ascending" ) );
mSortTypeCombo->insertItem( i18n( "Descending" ) );
mFields = mCore->addressBook()->fields( KABC::Field::All );
KABC::Field::List::Iterator fieldIt;
for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt )
mFieldCombo->insertItem( (*fieldIt)->label() );
}
QStringList XXPortSelectDialog::uids()
{
QStringList uidlist;
KABC::AddresseeList list = contacts();
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it )
uidlist.append((*it).uid());
return uidlist;
}
void XXPortSelectDialog::tagSelected()
{
if ( mUseSelection->isChecked() ) {
QStringList selection = mCore->selectedUIDs();
KABC::AddressBook::Iterator it;
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
if ( selection.findIndex((*it).uid()) >= 0 )
@@ -181,162 +186,160 @@ KABC::AddresseeList XXPortSelectDialog::contacts()
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) {
QStringList tmp( (*it).categories() );
QStringList::Iterator tmpIt;
for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt )
if ( categorieList.contains( *tmpIt ) ) {
if ((*it).uid().left( 19 ) != QString("last-syncAddressee-") )
list.append( *it );
break;
}
}
} else {
// create a string list of all entries:
KABC::AddressBook::Iterator it;
for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it )
if ((*it).uid().left( 19 ) != QString("last-syncAddressee-") )
list.append( *it );
}
if ( mUseSorting ) {
list.setReverseSorting( mSortTypeCombo->currentItem() == 1 );
uint pos = mFieldCombo->currentItem();
if ( pos < mFields.count() )
list.sortByField( mFields[ pos ] );
}
return list;
}
QStringList XXPortSelectDialog::categories() const
{
QStringList list;
- QListViewItemIterator it( mCategoriesView );
+ Q3ListViewItemIterator it( mCategoriesView );
for ( ; it.current(); ++it ) {
- QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current());
+ Q3CheckListItem* qcli = static_cast<Q3CheckListItem*>(it.current());
if ( qcli->isOn() )
list.append( it.current()->text( 0 ) );
}
return list;
}
void XXPortSelectDialog::filterChanged( int )
{
mUseFilters->setChecked( true );
}
-void XXPortSelectDialog::categoryClicked( QListViewItem *i )
+void XXPortSelectDialog::categoryClicked( Q3ListViewItem *i )
{
- QCheckListItem *qcli = static_cast<QCheckListItem*>( i );
+ Q3CheckListItem *qcli = static_cast<Q3CheckListItem*>( i );
if ( qcli->isOn() )
mUseCategories->setChecked( true );
}
void XXPortSelectDialog::slotHelp()
{
#ifndef KAB_EMBEDDED
kapp->invokeHelp( "import-and-export" );
#else //KAB_EMBEDDED
qDebug("XXPortSelectDialog::slotHelp is not implemented yet");
#endif //KAB_EMBEDDED
}
void XXPortSelectDialog::initGUI()
{
- QFrame *page = plainPage();
+ Q3Frame *page = plainPage();
- QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHintSmall(),
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( page, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page );
topLayout->addWidget( label );
- mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page );
+ mButtonGroup = new Q3ButtonGroup( i18n( "Contact Selection" ), page );
mButtonGroup->setColumnLayout( 0, Qt::Vertical );
mButtonGroup->layout()->setSpacing( KDialog::spacingHint() );
mButtonGroup->layout()->setMargin( KDialog::marginHint() );
- QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() );
+ Q3GridLayout *groupLayout = new Q3GridLayout( mButtonGroup->layout() );
groupLayout->setAlignment( Qt::AlignTop );
mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup );
mUseWholeBook->setChecked( true );
- QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
+ Q3WhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) );
groupLayout->addWidget( mUseWholeBook, 0, 0 );
mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup );
- QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
+ Q3WhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n"
"This option is disabled if no contacts are selected." ) );
groupLayout->addWidget( mUseSelection, 1, 0 );
mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup );
- QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
+ Q3WhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n"
"This option is disabled if you haven't defined any filters" ) );
groupLayout->addWidget( mUseFilters, 2, 0 );
mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup );
- QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
+ Q3WhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n"
"This option is disabled if you have no categories." ) );
groupLayout->addWidget( mUseCategories, 3, 0 );
mFiltersCombo = new QComboBox( false, mButtonGroup );
mFiltersCombo->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
+ Q3WhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) );
groupLayout->addWidget( mFiltersCombo, 2, 1 );
- mCategoriesView = new QListView( mButtonGroup );
+ mCategoriesView = new Q3ListView( mButtonGroup );
mCategoriesView->addColumn( "" );
mCategoriesView->header()->hide();
- QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
+ Q3WhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) );
groupLayout->addWidget( mCategoriesView, 3, 1 );
mCategoriesView->setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
//if (QApplication::desktop()->height() == 480 )
// mCategoriesView->setMaximumHeight( 240 );
topLayout->addWidget( mButtonGroup );
- QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page );
+ Q3ButtonGroup *sortingGroup = new Q3ButtonGroup( i18n( "Sorting" ), page );
sortingGroup->setColumnLayout( 0, Qt::Vertical );
- QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2,
+ Q3GridLayout *sortLayout = new Q3GridLayout( sortingGroup->layout(), 2, 2,
KDialog::spacingHint() );
sortLayout->setAlignment( Qt::AlignTop );
label = new QLabel( i18n( "Criterion:" ), sortingGroup );
sortLayout->addWidget( label, 0, 0 );
#ifndef KAB_EMBEDDED
mFieldCombo = new KComboBox( false, sortingGroup );
#else //KAB_EMBEDDED
//US Combobox is not editable anyway
mFieldCombo = new KComboBox( sortingGroup );
#endif //KAB_EMBEDDED
sortLayout->addWidget( mFieldCombo, 0, 1 );
label = new QLabel( i18n( "Order:" ), sortingGroup );
sortLayout->addWidget( label, 1, 0 );
#ifndef KAB_EMBEDDED
mSortTypeCombo = new KComboBox( false, sortingGroup );
#else //KAB_EMBEDDED
//US Combobox is not editable anyway
mSortTypeCombo = new KComboBox( sortingGroup );
#endif //KAB_EMBEDDED
sortLayout->addWidget( mSortTypeCombo, 1, 1 );
topLayout->addWidget( sortingGroup );
if ( !mUseSorting )
sortingGroup->hide();
if (QApplication::desktop()->width() <= 640 ) {
showMaximized();
#ifndef DESKTOP_VERSION
hideButtons();
#endif
}
}
-#ifndef KAB_EMBEDDED
-#include "xxportselectdialog.moc"
+#ifndef KAB_EMBEDDED_
+#include "moc_xxportselectdialog.cpp"
#endif //KAB_EMBEDDED
-
-
diff --git a/kaddressbook/xxportselectdialog.h b/kaddressbook/xxportselectdialog.h
index 28b1fef..208f4f9 100644
--- a/kaddressbook/xxportselectdialog.h
+++ b/kaddressbook/xxportselectdialog.h
@@ -1,83 +1,83 @@
/*
This file is part of KAddressBook.
Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk>
Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef XXPORTSELECTDIALOG_H
#define XXPORTSELECTDIALOG_H
#include <kabc/addresseelist.h>
#include <kabc/field.h>
#include <kdialogbase.h>
#include "filter.h"
-class QButtonGroup;
+class Q3ButtonGroup;
class QComboBox;
-class QListView;
-class QListViewItem;
+class Q3ListView;
+class Q3ListViewItem;
class QRadioButton;
class KABCore;
class KComboBox;
class XXPortSelectDialog : public KDialogBase
{
Q_OBJECT
public:
XXPortSelectDialog( KABCore *core, bool sort, QWidget* parent,
const char* name = 0 );
KABC::AddresseeList contacts();
void tagSelected();
QStringList uids();
private slots:
void filterChanged( int );
- void categoryClicked( QListViewItem * i );
+ void categoryClicked( Q3ListViewItem * i );
protected slots:
void slotHelp();
private:
void initGUI();
QStringList categories() const;
- QButtonGroup* mButtonGroup;
+ Q3ButtonGroup* mButtonGroup;
QRadioButton* mUseCategories;
QRadioButton* mUseFilters;
QRadioButton* mUseWholeBook;
QRadioButton* mUseSelection;
QComboBox* mFiltersCombo;
- QListView* mCategoriesView;
+ Q3ListView* mCategoriesView;
KComboBox *mFieldCombo;
KComboBox *mSortTypeCombo;
KABCore *mCore;
KABC::AddresseeList mAddresseeList;
Filter::List mFilters;
KABC::Field::List mFields;
bool mUseSorting;
};
#endif
diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp
index 18ce9da..467fef7 100644
--- a/kalarmd/alarmdialog.cpp
+++ b/kalarmd/alarmdialog.cpp
@@ -1,167 +1,171 @@
/*
This file is part of the KDE alarm daemon.
Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
// $Id$
-#include <qhbox.h>
-#include <qvbox.h>
-#include <qapp.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
+#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlabel.h>
#include <qlayout.h>
#include <qfile.h>
#include <qtimer.h>
#include <qsound.h>
#include <qpushbutton.h>
#include <qregexp.h>
#ifndef DESKTOP_VERSION
#define protected public
#include <qspinbox.h>
#undef protected
#else
#include <qspinbox.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#endif
#include <stdlib.h>
#ifndef _WIN32_
#include <unistd.h>
#include <sys/ioctl.h>
#endif
#include <stdio.h>
#include <fcntl.h>
#ifndef DESKTOP_VERSION
#include <qtopia/alarmserver.h>
#include <qpe/resource.h>
#include <qtopia/sound.h>
#endif
#include "alarmdialog.h"
AlarmDialog::AlarmDialog(QWidget *parent,const char *name)
: QDialog (parent, name ,false, Qt::WStyle_StaysOnTop )
{
setCaption( "KO/Pi Alarm!" );
- QVBoxLayout* layout = new QVBoxLayout( this);
+ Q3VBoxLayout* layout = new Q3VBoxLayout( this);
QLabel* l = new QLabel("The following event triggered alarm:",this);
layout->addWidget ( l );
- l->setAlignment( AlignCenter);
+ l->setAlignment( Qt::AlignCenter);
mMessage = new QLabel ( " ", this );
int fs = 18;
int fs2 = 12;
int baseSize = 6;
if ( QApplication::desktop()->width() < 480 ) {
fs2 = 10;
fs = 12;
baseSize = 4;
}
layout->setSpacing( 3 );
layout->setMargin( 3 );
QFont fo = QApplication::font();
fo.setBold( true );
fo.setPointSize( fs2 );
l->setFont( fo );
fo.setPointSize( fs );
mMessage->setFont(fo );
- mMessage->setAlignment( AlignCenter);
+ mMessage->setAlignment( Qt::AlignCenter);
layout->addWidget ( mMessage );
mMissedAlarms= new QLabel ( "(No missed Alarms)", this );
- mMissedAlarms->setAlignment( AlignCenter);
+ mMissedAlarms->setAlignment( Qt::AlignCenter);
playSoundTimer = new QTimer( this );
connect ( playSoundTimer, SIGNAL( timeout() ), this, SLOT (playSound() ) );
playSoundTimer->stop();
layout->addWidget ( mMissedAlarms );
mMissedAlarmsCombo = new QComboBox ( this );
layout->addWidget ( mMissedAlarmsCombo );
QLabel* labb = new QLabel("Suspend\nduration\n(minutes):",this);
#ifdef DESKTOP_VERSION
fo = font();
fo.setPointSize( 12 );
labb->setFont ( fo );
#endif
- labb->setAlignment(AlignCenter);
+ labb->setAlignment(Qt::AlignCenter);
//layout->addWidget ( labb );
fo = font();
int pointSize = 36;
if ( QApplication::desktop()->width() <= 320 )
pointSize = 18;
fo.setPointSize( pointSize );
mSuspendSpin = new QSpinBox(1,1440,1,this);
mSuspendSpin->setFont( fo );
mSuspendSpin->setValue(7); // default suspend duration
mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
#if QT_VERSION < 0x030000
mSuspendSpin->upButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
mSuspendSpin->downButton ()->setFixedSize( QSize( 8*baseSize, 5*baseSize ));
#endif
mSuspendSpin->setFixedSize( 18*baseSize, 10*baseSize+2 );
mSuspendSpin->setButtonSymbols( QSpinBox::PlusMinus );
- QHBoxLayout* layoutSpin = new QHBoxLayout( layout );
+ Q3HBoxLayout* layoutSpin = new Q3HBoxLayout( layout );
layoutSpin->addStretch ();
layoutSpin->addWidget ( labb );
layoutSpin->addWidget ( mSuspendSpin );
layoutSpin->addStretch ();
- QVBox * bbox = new QVBox ( this );
+ Q3VBox * bbox = new Q3VBox ( this );
layout->addWidget ( bbox );
bbox->layout()->setSpacing( 2 );
labb = new QLabel("Press \"Cancel\" or \"Esc\" to suspend!",bbox);
- labb->setAlignment(AlignCenter);
+ labb->setAlignment(Qt::AlignCenter);
mSuspendButton = new QPushButton( "Suspend", bbox);
QPushButton* silen = new QPushButton( " Stop sound ", bbox);
okbut = new QPushButton( "Ok", bbox);
mSuspendButton->setFont( fo );
silen->setFont( fo );
okbut->setFont( fo );
okbut->setDefault( true );
connect (silen , SIGNAL( clicked() ), this, SLOT (silent() ) );
connect (mSuspendButton, SIGNAL( clicked() ), this, SLOT (slotSuspend() ) );
connect (okbut , SIGNAL( clicked() ), this, SLOT (slotOk() ) );
connect (mSuspendSpin , SIGNAL( valueChanged ( int ) ), this, SLOT ( spinBoxChanged( int ) ) );
#ifndef _WIN32_
if ( QFile::exists ( "/dev/sharp_led" ) )
fd_led = open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
else
#endif
fd_led = 0;
statusLED.which = SHARP_LED_SALARM;
mSilent = false;
mSuspendCounter = 0;
setServerNotification( true );
}
void AlarmDialog::reject ()
{
QTimer::singleShot ( 3000, this, SLOT (suspend()) );
slotSuspend();
}
AlarmDialog::~AlarmDialog()
{
}
void AlarmDialog::silent ()
{
diff --git a/kalarmd/alarmdialog.h b/kalarmd/alarmdialog.h
index 52e681a..c3e0966 100644
--- a/kalarmd/alarmdialog.h
+++ b/kalarmd/alarmdialog.h
@@ -1,64 +1,66 @@
/*
This file is part of the KDE alarm daemon.
Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ALARMDIALOG_H
#define ALARMDIALOG_H
#include <qdialog.h>
#include <qdatetime.h>
#include <qstring.h>
#include <qcombobox.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <QLabel>
#include "sharp_char.h"
class QSpinBox;
class QLabel;
class QString;
class AlarmDialog : public QDialog {
Q_OBJECT
public:
AlarmDialog( QWidget *parent = 0, const char *name = 0 );
virtual ~AlarmDialog();
bool eventNotification(QString m, int replay , QString m2 , bool, int, int );
int getSuspendTime( );
void setSuspendTime( int );
void setServerNotification( bool b );
public slots:
void forceRepaint();
void spinBoxChanged( int );
void slotOk();
void slotSuspend();
void reject () ;
void silent () ;
void accept();
void suspend();
void playSound ();
signals:
// void suspendSignal(int duration);
void addAlarm(const QDateTime &, const QString & );
diff --git a/kalarmd/simplealarmdaemonimpl.cpp b/kalarmd/simplealarmdaemonimpl.cpp
index 15eff28..74a53cb 100644
--- a/kalarmd/simplealarmdaemonimpl.cpp
+++ b/kalarmd/simplealarmdaemonimpl.cpp
@@ -23,112 +23,112 @@
#include "simplealarmdaemonimpl.h"
#include "alarmdialog.h"
#include <qpopupmenu.h>
#include <qapp.h>
#include <qdir.h>
#include <qfile.h>
#include <qhbox.h>
#include <qtimer.h>
#include <qfile.h>
#include <qdatetime.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qdialog.h>
#define protected public
#include <qspinbox.h>
#undef protected
#include <qtextstream.h>
#include <qtopia/qcopenvelope_qws.h>
#include <qtopia/alarmserver.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
SimpleAlarmDaemonImpl::SimpleAlarmDaemonImpl( QWidget *parent )
: QLabel( parent )
{
mAlarmDialog = new AlarmDialog( 0 );
- mPopUp = new QPopupMenu( this );
+ mPopUp = new Q3PopupMenu( this );
mPopUp->insertItem( "What's Next?", this, SLOT ( showWN() ) );
mPopUp->insertItem( "Next Days!", this, SLOT ( showKO() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Todo List", this, SLOT ( showTodo() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Addresses", this, SLOT ( showAdd() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Edit Journal", this, SLOT ( writeJournal() ) );
mPopUp->insertItem( "New Event", this, SLOT ( newEvent() ) );
mPopUp->insertItem( "New Todo", this, SLOT ( newTodo() ) );
mPopUp->insertItem( "New Mail", this, SLOT ( newMail() ) );
mPopUp->insertSeparator();
mPopUp->insertItem( "Multi Sync", this, SLOT ( ringSync() ) );
- mTimerPopUp = new QPopupMenu( this );
+ mTimerPopUp = new Q3PopupMenu( this );
- mBeepPopUp = new QPopupMenu( this );
- mSoundPopUp = new QPopupMenu( this );
- mPausePopUp = new QPopupMenu( this );
- mFontsizePopup = new QPopupMenu( this );
+ mBeepPopUp = new Q3PopupMenu( this );
+ mSoundPopUp = new Q3PopupMenu( this );
+ mPausePopUp = new Q3PopupMenu( this );
+ mFontsizePopup = new Q3PopupMenu( this );
mFontsizePopup->insertItem( "10", 10 );
mFontsizePopup->insertItem( "12", 12 );
mFontsizePopup->insertItem( "14", 14 );
mFontsizePopup->insertItem( "16", 16 );
mFontsizePopup->insertItem( "18", 18 );
mFontsizePopup->insertItem( "20", 20 );
mFontsizePopup->insertItem( "22", 22 );
mFontsizePopup->insertItem( "24", 24 );
mFontsizePopup->insertItem( "26", 26 );
mFontsizePopup->insertItem( "28", 28 );
mFontsizePopup->insertItem( "30", 30 );
mFontsizePopup->insertItem( "32", 32 );
mFontsizePopup->insertItem( "36", 36 );
- QPopupMenu* savePopUp = new QPopupMenu( this );
+ QPopupMenu* savePopUp = new Q3PopupMenu( this );
savePopUp->insertItem( "Save", 0 );
savePopUp->insertItem( "Load", 1 );
mSoundPopUp->insertItem( "Buzzer", 0 );
mSoundPopUp->insertItem( "Wav file", 1 );
mPausePopUp->insertItem( " 1 sec", 1 );
mPausePopUp->insertItem( " 2 sec", 2 );
mPausePopUp->insertItem( " 3 sec", 3 );
mPausePopUp->insertItem( " 5 sec", 5 );
mPausePopUp->insertItem( "10 sec", 10 );
mPausePopUp->insertItem( "15 sec", 15 );
mPausePopUp->insertItem( "30 sec", 30 );
mPausePopUp->insertItem( " 1 min", 60 );
mPausePopUp->insertItem( " 5 min", 300 );
- mSuspendPopUp = new QPopupMenu( this );
+ mSuspendPopUp = new Q3PopupMenu( this );
mSuspendPopUp->insertItem( "Off", 0 );
mSuspendPopUp->insertItem( " 1x", 1 );
mSuspendPopUp->insertItem( " 2x", 2 );
mSuspendPopUp->insertItem( " 3x", 3 );
mSuspendPopUp->insertItem( " 5x", 5 );
mSuspendPopUp->insertItem( "10x", 10 );
mSuspendPopUp->insertItem( "20x", 20 );
mSuspendPopUp->insertItem( "30x", 30 );
mBeepPopUp->insertItem( "Config",savePopUp );
mBeepPopUp->insertItem( "Replay",mSoundPopUp );
mBeepPopUp->insertItem( "Font Size",mFontsizePopup );
mBeepPopUp->insertItem( "Auto suspend",mSuspendPopUp );
mBeepPopUp->insertItem( "Beep interval",mPausePopUp );
mBeepPopUp->insertItem( "100", 100 );
mBeepPopUp->insertItem( "50", 50 );
mBeepPopUp->insertItem( "25", 25 );
mBeepPopUp->insertItem( "17", 17 );
mBeepPopUp->insertItem( "10", 10 );
mBeepPopUp->insertItem( "3", 3 );
mBeepPopUp->insertItem( "1", 1 );
mBeepPopUp->insertItem( "Off", 0 );
mBeepPopUp->insertSeparator();
mBeepPopUp->insertItem( "Simulate", 1000 );
mBeepPopUp->setCheckable( true );
mPopUp->insertSeparator();
mPopUp->insertItem( "Play beeps", mBeepPopUp );
mPopUp->insertSeparator();
mPopUp->insertItem( "Timer", mTimerPopUp );
//mPopUp->insertSeparator();
//mPopUp->insertItem( "Simulate", this, SLOT ( simulate() ) );
mPopUp->resize( mPopUp->sizeHint() );
diff --git a/kalarmd/simplealarmdaemonimpl.h b/kalarmd/simplealarmdaemonimpl.h
index 06ef91b..ac65797 100644
--- a/kalarmd/simplealarmdaemonimpl.h
+++ b/kalarmd/simplealarmdaemonimpl.h
@@ -1,111 +1,110 @@
/*
This file is part of the KOrganizer alarm daemon.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef SIMPLEALARMDAEMONIMPL_H
#define SIMPLEALARMDAEMONIMPL_H
//#include "simplealarmdaemon.h"
#include <qdatetime.h>
#include <qlabel.h>
#include <qtimer.h>
class QLabel;
class QTimer;
-class QPopupMenu;
class AlarmDialog;
class SimpleAlarmDaemonImpl : public QLabel
{
Q_OBJECT
public:
SimpleAlarmDaemonImpl( QWidget *parent = 0 );
~SimpleAlarmDaemonImpl();
protected slots:
void recieve( const QCString& msg, const QByteArray& data );
void newTodo();
void newEvent();
void newCountdown();
void simulate();
void showKO();
void showWN();
void showAdd();
void newMail();
void ringSync();
void showTodo();
void writeFile();
void writeJournal();
void slotPlayBeep( int );
void showTimer( );
void confPause( int );
void confFontSize( int );
void confTimer( int );
void saveSlot( int );
void confSuspend( int );
void confSound( int num );
void startAlarm(QString mess, QString fn );
protected:
void mousePressEvent( QMouseEvent * );
private:
AlarmDialog *mAlarmDialog;
QLabel * mTimerStartLabel;
int mPlayBeeps;
int mPausePlay;
int mSuspend;
QString mAlarmMessage;
int mTimerTime;
int getFileNameLen( QString );
- QPopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp, *mFontsizePopup;
+ Q3PopupMenu* mPopUp, *mBeepPopUp, *mTimerPopUp, *mSoundPopUp,*mPausePopUp,*mSuspendPopUp, *mFontsizePopup;
QDateTime mRunningTimer;
void fillTimerPopUp();
QString timerMesssage;
QString mCustomText;
QString mRunningTimerText;
int mCustomMinutes;
int mTimerPopupConf;
int mPopupFontSize;
bool wavAlarm;
};
class KODateLabel : public QLabel
{
Q_OBJECT
public:
KODateLabel( QWidget *parent=0, const char *name=0 ) :
QLabel( parent, name )
{
hour = 0;
minutes = 0;
QTimer * ti = new QTimer( this );
connect ( ti, SIGNAL ( timeout () ), this, SLOT ( updateText() ));
ti->start( 1000 );
}
public slots:
void slot_minutes( int m )
{
minutes = m; updateText();
}
void slot_hours( int h )
{
hour = h; updateText();
diff --git a/kdepim-desktop.pro b/kdepim-desktop.pro
index 4a5ceef..05d8357 100644
--- a/kdepim-desktop.pro
+++ b/kdepim-desktop.pro
@@ -1,25 +1,27 @@
include( ./variables.pri )
TEMPLATE = subdirs
unix:{
staticlib: {
SUBDIRS += kabc/plugins/file kabc/plugins/dir kabc/plugins/qtopia
}
}
SUBDIRS += libical libkcal kabc libkdepim microkde korganizer kaddressbook
unix:{
SUBDIRS += gammu/emb/common gammu/emb/gammu
}
!staticlib: {
SUBDIRS += kabc/plugins/file kabc/plugins/dir kabc/plugins/qtopia
win32:{
#SUBDIRS += kabc/plugins/olaccess
}
}
unix:{
!staticlib: {
-SUBDIRS += libetpan kmicromail/libmailwrapper kmicromail pwmanager/libcrypt/cipher pwmanager/libcrypt/error pwmanager/libcrypt/mpi pwmanager/libcrypt/zlib pwmanager/pwmanager
+SUBDIRS += libetpan
+# kmicromail/libmailwrapper kmicromail
+SUBDIRS += pwmanager/libcrypt/cipher pwmanager/libcrypt/error pwmanager/libcrypt/mpi pwmanager/libcrypt/zlib pwmanager/pwmanager
}
}
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 985a762..9b1ea2f 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -1,220 +1,222 @@
#include "accountitem.h"
#include "accountview.h"
#include "newmaildir.h"
#include "nntpgroupsdlg.h"
#include "defines.h"
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailwrapper.h>
/* OPIE */
//#include <qpe/qpeapplication.h>
/* QT */
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kiconloader.h>
#include <klocale.h>
#define GET_NEW_MAILS 101
using namespace Opie::Core;
#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
/**
* POP3 Account stuff
*/
POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
POP3viewItem::~POP3viewItem()
{
delete wrapper;
}
AbstractMail *POP3viewItem::getWrapper()
{
return wrapper;
}
-void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & )
+void POP3viewItem::refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > & )
{
refresh();
}
void POP3viewItem::refresh()
{
if (account->getOffline()) return;
- QValueList<FolderP> *folders = wrapper->listFolders();
- QListViewItem *child = firstChild();
+ Q3ValueList<FolderP> *folders = wrapper->listFolders();
+ Q3ListViewItem *child = firstChild();
while ( child )
{
- QListViewItem *tmp = child;
+ Q3ListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
- QValueList<FolderP>::ConstIterator it;
- QListViewItem*item = 0;
+ Q3ValueList<FolderP>::ConstIterator it;
+ Q3ListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new POP3folderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
-QPopupMenu * POP3viewItem::getContextMenu()
+Q3PopupMenu * POP3viewItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
m->insertItem(i18n("Disconnect"),0);
m->insertItem(i18n("Set offline"),1);
}
else
{
m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
m->insertItem(i18n("Set online"),1);
}
}
return m;
}
void POP3viewItem::disconnect()
{
- QListViewItem *child = firstChild();
+ Q3ListViewItem *child = firstChild();
while ( child )
{
- QListViewItem *tmp = child;
+ Q3ListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
wrapper->logout();
}
void POP3viewItem::setOnOffline()
{
if (!account->getOffline())
{
disconnect();
}
account->setOffline(!account->getOffline());
account->save();
SETPIX(PIXMAP_POP3FOLDER);
refresh();
}
void POP3viewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
disconnect();
break;
case 1:
setOnOffline();
break;
case GET_NEW_MAILS: // daunlood
if (account->getOffline())
setOnOffline();
AccountView*bl = accountView();
if (!bl) return;
AccountViewItem* in = findSubItem( "inbox" , 0);
if ( ! in )
return;
bl->downloadMailsInbox(in->getFolder() ,getWrapper());
setOnOffline();
break;
}
}
POP3folderItem::~POP3folderItem()
{}
-POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after )
+POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , Q3ListViewItem*after )
: AccountViewItem(folderInit,parent,after )
{
pop3 = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_POP3FOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
-void POP3folderItem::refresh(QValueList<RecMailP>&target)
+void POP3folderItem::refresh(Q3ValueList<RecMailP>&target)
{
if (folder->may_select())
pop3->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
{
return pop3->getWrapper()->fetchBody(aMail);
}
-QPopupMenu * POP3folderItem::getContextMenu()
+Q3PopupMenu * POP3folderItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
m->insertItem(i18n("Refresh header list"),0);
m->insertItem(i18n("Delete all mails"),1);
m->insertItem(i18n("Move/Copie all mails"),2);
}
return m;
}
void POP3folderItem::downloadMails()
{
AccountView*bl = pop3->accountView();
if (!bl) return;
bl->downloadMails(folder,pop3->getWrapper());
}
void POP3folderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
switch (which)
{
case 0:
/* must be 'cause pop3 lists are cached */
pop3->getWrapper()->logout();
view->refreshCurrent();
break;
case 1:
deleteAllMail(pop3->getWrapper(),folder);
break;
case 2:
downloadMails();
@@ -232,319 +234,319 @@ void POP3folderItem::contextMenuSelected(int which)
*/
NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
//FIXME
SETPIX(PIXMAP_POP3FOLDER);
#if 0
if (!account->getOffline())
{
setPixmap( 0, );
}
else
{
setPixmap( 0, PIXMAP_OFFLINE );
}
#endif
setText( 0, account->getAccountName() );
setOpen( true );
}
NNTPviewItem::~NNTPviewItem()
{
delete wrapper;
}
AbstractMail *NNTPviewItem::getWrapper()
{
return wrapper;
}
-void NNTPviewItem::refresh( QValueList<RecMailP> & )
+void NNTPviewItem::refresh( Q3ValueList<RecMailP> & )
{
refresh();
}
void NNTPviewItem::refresh()
{
if (account->getOffline()) return;
- QValueList<FolderP> *folders = wrapper->listFolders();
+ Q3ValueList<FolderP> *folders = wrapper->listFolders();
- QListViewItem *child = firstChild();
+ Q3ListViewItem *child = firstChild();
while ( child )
{
- QListViewItem *tmp = child;
+ Q3ListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
- QValueList<FolderP>::ConstIterator it;
- QListViewItem*item = 0;
+ Q3ValueList<FolderP>::ConstIterator it;
+ Q3ListViewItem*item = 0;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
item = new NNTPfolderItem( (*it), this , item );
item->setSelectable( (*it)->may_select());
}
delete folders;
}
RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
-QPopupMenu * NNTPviewItem::getContextMenu()
+Q3PopupMenu * NNTPviewItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(i18n("Disconnect"),0);
m->insertItem(i18n("Set offline"),1);
//m->insertItem(i18n("(Un-)Subscribe groups"),2);
}
else
{
m->insertItem(i18n("Set online"),1);
}
}
return m;
}
void NNTPviewItem::subscribeGroups()
{
NNTPGroupsDlg dlg(account);
#ifndef DESKTOP_VERSION
dlg.showMaximized();
#endif
if ( dlg.exec()== QDialog::Accepted ){
refresh();
}
}
void NNTPviewItem::disconnect()
{
- QListViewItem *child = firstChild();
+ Q3ListViewItem *child = firstChild();
while ( child )
{
- QListViewItem *tmp = child;
+ Q3ListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
wrapper->logout();
}
void NNTPviewItem::setOnOffline()
{
if (!account->getOffline())
{
disconnect();
}
account->setOffline(!account->getOffline());
account->save();
//FIXME
SETPIX(PIXMAP_POP3FOLDER);
refresh();
}
void NNTPviewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
disconnect();
break;
case 1:
setOnOffline();
break;
case 2:
subscribeGroups();
break;
}
}
NNTPfolderItem::~NNTPfolderItem()
{}
-NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after )
+NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , Q3ListViewItem*after )
: AccountViewItem( folderInit, parent,after )
{
nntp = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_POP3FOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
-void NNTPfolderItem::refresh(QValueList<RecMailP>&target)
+void NNTPfolderItem::refresh(Q3ValueList<RecMailP>&target)
{
if (folder->may_select())
nntp->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
{
return nntp->getWrapper()->fetchBody(aMail);
}
-QPopupMenu * NNTPfolderItem::getContextMenu()
+Q3PopupMenu * NNTPfolderItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
m->insertItem(i18n("Refresh header list"),0);
m->insertItem(i18n("Copy all postings"),1);
}
return m;
}
void NNTPfolderItem::downloadMails()
{
AccountView*bl = nntp->accountView();
if (!bl) return;
bl->downloadMails(folder,nntp->getWrapper());
}
void NNTPfolderItem::contextMenuSelected(int which)
{
AccountView * view = (AccountView*)listView();
switch (which)
{
case 0:
/* must be 'cause pop3 lists are cached */
nntp->getWrapper()->logout();
view->refreshCurrent();
break;
case 1:
downloadMails();
break;
default:
break;
}
}
/**
* IMAP Account stuff
*/
IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent )
: AccountViewItem( parent )
{
account = a;
wrapper = AbstractMail::getWrapper( account );
SETPIX(PIXMAP_IMAPFOLDER);
setText( 0, account->getAccountName() );
setOpen( true );
}
IMAPviewItem::~IMAPviewItem()
{
delete wrapper;
}
AbstractMail *IMAPviewItem::getWrapper()
{
return wrapper;
}
-void IMAPviewItem::refresh(QValueList<RecMailP>&)
+void IMAPviewItem::refresh(Q3ValueList<RecMailP>&)
{
refreshFolders(false);
}
const QStringList&IMAPviewItem::subFolders()
{
return currentFolders;
}
void IMAPviewItem::refreshFolders(bool force)
{
if (childCount()>0 && force==false) return;
if (account->getOffline()) return;
removeChilds();
currentFolders.clear();
- QValueList<FolderP> * folders = wrapper->listFolders();
+ Q3ValueList<FolderP> * folders = wrapper->listFolders();
- QValueList<FolderP>::Iterator it;
- QListViewItem*item = 0;
- QListViewItem*titem = 0;
+ Q3ValueList<FolderP>::Iterator it;
+ Q3ListViewItem*item = 0;
+ Q3ListViewItem*titem = 0;
QString fname,del,search;
int pos;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
if ((*it)->getDisplayName().lower()=="inbox")
{
item = new IMAPfolderItem( (*it), this , item );
folders->remove(it);
break;
}
}
for ( it = folders->begin(); it!=folders->end(); ++it)
{
fname = (*it)->getDisplayName();
currentFolders.append((*it)->getName());
pos = fname.findRev((*it)->Separator());
if (pos != -1)
{
fname = fname.left(pos);
}
IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname);
if (pitem)
{
titem = item;
item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this);
/* setup the short name */
item->setText(0,(*it)->getDisplayName().mid(pos+1));
item = titem;
}
else
{
item = new IMAPfolderItem( (*it), this , item );
}
}
delete folders;
}
-QPopupMenu * IMAPviewItem::getContextMenu()
+Q3PopupMenu * IMAPviewItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
if (!account->getOffline())
{
m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
m->insertItem(i18n("Refresh folder list"),0);
m->insertItem(i18n("Create new folder"),1);
m->insertSeparator();
m->insertItem(i18n("Disconnect"),2);
m->insertItem(i18n("Set offline"),3);
m->insertSeparator();
}
else
{
m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
m->insertItem(i18n("Set online"),3);
}
}
return m;
}
void IMAPviewItem::createNewFolder()
{
Newmdirdlg ndirdlg;
#ifndef DESKTOP_VERSION
//ndirdlg.showMaximized();
#endif
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
@@ -586,171 +588,171 @@ void IMAPviewItem::contextMenuSelected(int id)
account->save();
SETPIX(PIXMAP_IMAPFOLDER);
refreshFolders(false);
break;
case GET_NEW_MAILS: // daunlood
{
if (account->getOffline()) {
contextMenuSelected( 3 );
}
AccountView*bl = accountView();
if (!bl) return;
AccountViewItem* in = findSubItem( "inbox" , 0);
if ( ! in )
return;
bl->downloadMailsInbox(in->getFolder(),getWrapper());
}
break;
default:
break;
}
}
RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
{
return new RecBody();
}
bool IMAPviewItem::offline()
{
return account->getOffline();
}
-IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after )
+IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , Q3ListViewItem*after )
: AccountViewItem( folderInit, parent , after )
{
imap = parent;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_IMAPFOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
-IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master )
+IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , Q3ListViewItem*after, IMAPviewItem *master )
: AccountViewItem(folderInit, parent,after )
{
imap = master;
if (folder->getDisplayName().lower()!="inbox")
{
setPixmap( 0, PIXMAP_IMAPFOLDER );
}
else
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
}
setText( 0, folder->getDisplayName() );
}
IMAPfolderItem::~IMAPfolderItem()
{}
const QString& IMAPfolderItem::Delemiter()const
{
return folder->Separator();
}
-void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
+void IMAPfolderItem::refresh(Q3ValueList<RecMailP>&target)
{
if (folder->may_select())
{
imap->getWrapper()->listMessages( folder->getName(),target );
}
else
{
target.clear();
}
}
RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
{
return imap->getWrapper()->fetchBody(aMail);
}
-QPopupMenu * IMAPfolderItem::getContextMenu()
+Q3PopupMenu * IMAPfolderItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
if (folder->may_select())
{
m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
m->insertItem(i18n("Refresh header list"),0);
m->insertItem(i18n("Move/Copie all mails"),4);
m->insertItem(i18n("Delete all mails"),1);
}
if (folder->no_inferior()==false)
{
m->insertItem(i18n("Create new subfolder"),2);
}
if (folder->getDisplayName().lower()!="inbox")
{
m->insertItem(i18n("Delete folder"),3);
}
}
return m;
}
void IMAPfolderItem::createNewFolder()
{
Newmdirdlg ndirdlg;
//ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
bool makesubs = ndirdlg.subpossible();
QString delemiter = Delemiter();
if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
{
imap->refreshFolders(true);
}
}
}
void IMAPfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,i18n("Delete folder"),
i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()),
i18n("Yes"),
i18n("No"),QString::null,1,1);
if (yesno == 0)
{
if (imap->getWrapper()->deleteMbox(folder))
{
- QListView*v=listView();
+ Q3ListView*v=listView();
IMAPviewItem * box = imap;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
imap->refreshFolders(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
void IMAPfolderItem::downloadMails()
{
AccountView*bl = imap->accountView();
if (!bl) return;
bl->downloadMails(folder,imap->getWrapper());
}
void IMAPfolderItem::contextMenuSelected(int id)
{
AccountView * view = (AccountView*)listView();
switch(id)
{
case 0:
view->refreshCurrent();
break;
case 1:
deleteAllMail(imap->getWrapper(),folder);
break;
case 2:
@@ -771,408 +773,408 @@ void IMAPfolderItem::contextMenuSelected(int id)
default:
break;
}
}
/**
* MH Account stuff
*/
/* MH is a little bit different - the top folder can contains messages other than in IMAP and
POP3 and MBOX */
MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
: AccountViewItem( parent )
{
m_Path = aPath;
/* be carefull - the space within settext is wanted - thats why the string twice */
wrapper = AbstractMail::getWrapper( m_Path,"Local Mailfolders");
setPixmap( 0, PIXMAP_LOCALFOLDER );
setText( 0, i18n(" Local Mailfolders") );
setOpen( true );
folder = 0;
}
MHviewItem::~MHviewItem()
{
delete wrapper;
}
AbstractMail *MHviewItem::getWrapper()
{
return wrapper;
}
-void MHviewItem::refresh( QValueList<RecMailP> & target)
+void MHviewItem::refresh( Q3ValueList<RecMailP> & target)
{
refresh(false);
getWrapper()->listMessages( "",target );
}
void MHviewItem::refresh(bool force)
{
if (childCount()>0 && force==false) return;
removeChilds();
currentFolders.clear();
- QValueList<FolderP> *folders = wrapper->listFolders();
- QValueList<FolderP>::ConstIterator it;
+ Q3ValueList<FolderP> *folders = wrapper->listFolders();
+ Q3ValueList<FolderP>::ConstIterator it;
MHfolderItem*item = 0;
MHfolderItem*pmaster = 0;
QString fname = "";
int pos;
for ( it = folders->begin(); it!=folders->end(); ++it)
{
fname = (*it)->getDisplayName();
/* this folder itself */
if (fname=="/")
{
currentFolders.append(fname);
folder = (*it);
continue;
}
currentFolders.append(fname);
pos = fname.findRev("/");
if (pos > 0)
{
fname = fname.left(pos);
pmaster = (MHfolderItem*)findSubItem(fname);
}
else
{
pmaster = 0;
}
if (pmaster)
{
item = new MHfolderItem( (*it), pmaster, item, this );
}
else
{
item = new MHfolderItem( (*it), this , item );
}
item->setSelectable((*it)->may_select());
}
delete folders;
}
RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
{
return wrapper->fetchBody( mail );
}
-QPopupMenu * MHviewItem::getContextMenu()
+Q3PopupMenu * MHviewItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
m->insertItem(i18n("Refresh folder list"),0);
m->insertItem(i18n("Create new folder"),1);
m->insertItem(i18n("Delete all mails"),2);
m->insertItem(i18n("Move/Copie all mails"),3);
}
return m;
}
void MHviewItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
//ndirdlg.showMaximized();
if ( ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
if (wrapper->createMbox(ndir))
{
refresh(true);
}
}
}
void MHviewItem::downloadMails()
{
AccountView*bl = accountView();
if (!bl) return;
bl->downloadMails(folder,getWrapper());
}
QStringList MHviewItem::subFolders()
{
return currentFolders;
}
void MHviewItem::contextMenuSelected(int which)
{
switch (which)
{
case 0:
refresh(true);
break;
case 1:
createFolder();
break;
case 2:
deleteAllMail(getWrapper(),folder);
break;
case 3:
downloadMails();
break;
default:
break;
}
}
MHfolderItem::~MHfolderItem()
{}
-MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
+MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , Q3ListViewItem*after )
: AccountViewItem(folderInit, parent,after )
{
mbox = parent;
initName();
}
-MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
+MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, Q3ListViewItem*after, MHviewItem*master)
: AccountViewItem(folderInit, parent,after )
{
folder = folderInit;
mbox = master;
initName();
}
void MHfolderItem::initName()
{
QString bName = folder->getDisplayName();
if (bName.startsWith("/")&&bName.length()>1)
{
bName.replace(0,1,"");
}
int pos = bName.findRev("/");
if (pos > 0)
{
bName.replace(0,pos+1,"");
}
if (bName.lower() == "outgoing")
{
setPixmap( 0, PIXMAP_OUTBOXFOLDER );
}
else if (bName.lower() == "inbox")
{
setPixmap( 0, PIXMAP_INBOXFOLDER);
} else if (bName.lower() == "drafts") {
setPixmap(0, SmallIcon ("edit"));
} else {
setPixmap( 0, PIXMAP_MBOXFOLDER );
}
setText( 0, bName );
}
const FolderP&MHfolderItem::getFolder()const
{
return folder;
}
-void MHfolderItem::refresh(QValueList<RecMailP>&target)
+void MHfolderItem::refresh(Q3ValueList<RecMailP>&target)
{
if (folder->may_select())
mbox->getWrapper()->listMessages( folder->getName(),target );
}
RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
{
return mbox->getWrapper()->fetchBody(aMail);
}
void MHfolderItem::deleteFolder()
{
int yesno = QMessageBox::warning(0,i18n("Delete folder"),
i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()),
i18n("Yes"),
i18n("No"),QString::null,1,1);
if (yesno == 0)
{
if (mbox->getWrapper()->deleteMbox(folder))
{
- QListView*v=listView();
+ Q3ListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
-QPopupMenu * MHfolderItem::getContextMenu()
+Q3PopupMenu * MHfolderItem::getContextMenu()
{
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
m->insertItem(i18n("Move/Copie all mails"),2);
m->insertItem(i18n("Delete all mails"),0);
m->insertItem(i18n("Create new subfolder"),3);
m->insertItem(i18n("Delete folder"),1);
}
return m;
}
void MHfolderItem::downloadMails()
{
AccountView*bl = mbox->accountView();
if (!bl) return;
bl->downloadMails(folder,mbox->getWrapper());
}
void MHfolderItem::createFolder()
{
Newmdirdlg ndirdlg(0,0,true);
//ndirdlg.showMaximized();
if (ndirdlg.exec() )
{
QString ndir = ndirdlg.Newdir();
if (mbox->getWrapper()->createMbox(ndir,folder))
{
- QListView*v=listView();
+ Q3ListView*v=listView();
MHviewItem * box = mbox;
/* be carefull - after that this object is destroyd so don't use
* any member of it after that call!!*/
mbox->refresh(true);
if (v)
{
v->setSelected(box,true);
}
}
}
}
void MHfolderItem::contextMenuSelected(int which)
{
switch(which)
{
case 0:
deleteAllMail(mbox->getWrapper(),folder);
break;
case 1:
deleteFolder();
break;
case 2:
downloadMails();
break;
case 3:
createFolder();
break;
default:
break;
}
}
bool MHfolderItem::isDraftfolder()
{
if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
return false;
}
/**
* Generic stuff
*/
const QString AccountViewItem::contextName="AccountViewItem";
AccountViewItem::AccountViewItem( AccountView *parent )
- : QListViewItem( parent )
+ : Q3ListViewItem( parent )
{
init();
m_Backlink = parent;
}
-AccountViewItem::AccountViewItem( QListViewItem *parent)
- : QListViewItem( parent),folder(0)
+AccountViewItem::AccountViewItem( Q3ListViewItem *parent)
+ : Q3ListViewItem( parent),folder(0)
{
init();
}
-AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
- :QListViewItem( parent,after ),folder(0)
+AccountViewItem::AccountViewItem( Q3ListViewItem *parent , Q3ListViewItem*after )
+ :Q3ListViewItem( parent,after ),folder(0)
{
init();
}
-AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
- :QListViewItem( parent,after ),folder(folderInit)
+AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,Q3ListViewItem *parent , Q3ListViewItem*after )
+ :Q3ListViewItem( parent,after ),folder(folderInit)
{
init();
}
void AccountViewItem::init()
{
m_Backlink = 0;
}
AccountViewItem::~AccountViewItem()
{
folder = 0;
}
AccountView*AccountViewItem::accountView()
{
return m_Backlink;
}
void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
{
if (!wrapper) return;
QString fname="";
if (folder) fname = folder->getDisplayName();
int yesno = QMessageBox::warning(0,i18n("Delete all mails"),
i18n("<center>Realy delete all mails in box <br>%1</center>").
arg(fname),
i18n("Yes"),
i18n("No"),QString::null,1,1);
if (yesno == 0)
{
if (wrapper->deleteAllMail(folder))
{
AccountView * view = (AccountView*)listView();
if (view) view->refreshCurrent();
}
}
}
void AccountViewItem::removeChilds()
{
- QListViewItem *child = firstChild();
+ Q3ListViewItem *child = firstChild();
while ( child )
{
- QListViewItem *tmp = child;
+ Q3ListViewItem *tmp = child;
child = child->nextSibling();
delete tmp;
}
}
bool AccountViewItem::matchName(const QString&name)const
{
if (!folder) return false;
return folder->getDisplayName().lower()==name.lower();
}
AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start)
{
AccountViewItem*pitem,*sitem;
if (!start) pitem = (AccountViewItem*)firstChild();
else pitem = (AccountViewItem*)start->firstChild();
while (pitem)
{
if (pitem->matchName(path))
{
break;
}
if (pitem->childCount()>0)
{
sitem = findSubItem(path,pitem);
if (sitem)
{
pitem = sitem;
break;
}
}
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h
index 4c92bfc..bbfd05f 100644
--- a/kmicromail/accountitem.h
+++ b/kmicromail/accountitem.h
@@ -1,215 +1,218 @@
#ifndef __ACCOUNT_ITEM
#define __ACCOUNT_ITEM
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PopupMenu>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailwrapper.h>
class POP3wrapper;
class RecMail;
class RecBody;
-class QPopupMenu;
+class Q3PopupMenu;
class Selectstore;
class AccountView;
class POP3account;
class NNTPaccount;
class IMAPaccount;
class AbstractMail;
class Folder;
#define RECBODYP Opie::Core::OSmartPointer<RecBody>
-class AccountViewItem : public QListViewItem
+class AccountViewItem : public Q3ListViewItem
{
public:
AccountViewItem( AccountView *parent );
- AccountViewItem( QListViewItem *parent);
- AccountViewItem( QListViewItem *parent , QListViewItem*after );
- AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after );
+ AccountViewItem( Q3ListViewItem *parent);
+ AccountViewItem( Q3ListViewItem *parent , Q3ListViewItem*after );
+ AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,Q3ListViewItem *parent , Q3ListViewItem*after );
virtual ~AccountViewItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0;
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&)=0;
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0;
- virtual QPopupMenu * getContextMenu(){return 0;};
+ virtual Q3PopupMenu * getContextMenu(){return 0;};
virtual void contextMenuSelected(int){}
virtual AccountView*accountView();
virtual bool matchName(const QString&name)const;
virtual bool isDraftfolder();
Opie::Core::OSmartPointer<Folder> getFolder() { return folder; };
protected:
AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0);
virtual void init();
virtual void removeChilds();
virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f);
static const QString contextName;
AccountView*m_Backlink;
Opie::Core::OSmartPointer<Folder> folder;
};
class POP3viewItem : public AccountViewItem
{
public:
POP3viewItem( POP3account *a, AccountView *parent );
virtual ~POP3viewItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target );
virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
POP3account *account;
virtual void refresh();
AbstractMail *wrapper;
void disconnect();
void setOnOffline();
};
class POP3folderItem : public AccountViewItem
{
public:
- POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after );
+ POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , Q3ListViewItem*after );
virtual ~POP3folderItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
void downloadMails();
POP3viewItem *pop3;
};
class NNTPviewItem : public AccountViewItem
{
public:
NNTPviewItem( NNTPaccount *a, AccountView *parent );
virtual ~NNTPviewItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target );
virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
NNTPaccount *account;
virtual void refresh();
AbstractMail *wrapper;
void disconnect();
void setOnOffline();
void subscribeGroups();
};
class NNTPfolderItem : public AccountViewItem
{
public:
- NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after );
+ NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , Q3ListViewItem*after );
virtual ~NNTPfolderItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
protected:
void downloadMails();
NNTPviewItem *nntp;
};
class IMAPviewItem : public AccountViewItem
{
friend class IMAPfolderItem;
public:
IMAPviewItem( IMAPaccount *a, AccountView *parent );
virtual ~IMAPviewItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
const QStringList&subFolders();
virtual void refreshFolders(bool force=false);
bool offline();
protected:
virtual void createNewFolder();
IMAPaccount *account;
AbstractMail *wrapper;
QStringList currentFolders;
};
class IMAPfolderItem : public AccountViewItem
{
public:
- IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after );
- IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master );
+ IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , Q3ListViewItem*after );
+ IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , Q3ListViewItem*after, IMAPviewItem *master );
virtual ~IMAPfolderItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
virtual const QString& Delemiter()const;
protected:
virtual void createNewFolder();
virtual void deleteFolder();
virtual void downloadMails();
IMAPviewItem *imap;
};
class MHviewItem : public AccountViewItem
{
friend class MHfolderItem;
public:
MHviewItem( const QString&aMboxPath, AccountView *parent );
virtual ~MHviewItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target );
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target );
virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail );
AbstractMail *getWrapper();
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
QStringList subFolders();
virtual void refresh(bool force=false);
protected:
void downloadMails();
virtual void createFolder();
QString m_Path;
AbstractMail *wrapper;
QStringList currentFolders;
};
class MHfolderItem : public AccountViewItem
{
public:
- MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after );
- MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master);
+ MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , Q3ListViewItem*after );
+ MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, Q3ListViewItem*after, MHviewItem*master);
virtual ~MHfolderItem();
- virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&);
+ virtual void refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&);
virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&);
- virtual QPopupMenu * getContextMenu();
+ virtual Q3PopupMenu * getContextMenu();
virtual void contextMenuSelected(int);
virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const;
virtual bool isDraftfolder();
protected:
void downloadMails();
virtual void createFolder();
virtual void deleteFolder();
void initName();
MHviewItem *mbox;
};
#endif
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp
index d1d4f7e..eea1f65 100644
--- a/kmicromail/accountview.cpp
+++ b/kmicromail/accountview.cpp
@@ -1,201 +1,203 @@
#include "accountview.h"
#include "accountitem.h"
#include "selectstore.h"
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qmessagebox.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcheckbox.h>
#include <qtimer.h>
#include <qspinbox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <klocale.h>
#include <kmessagebox.h>
using namespace Opie::Core;
-AccountView::AccountView( QWidget *parent, const char *name, WFlags flags )
- : QListView( parent, name, flags )
+AccountView::AccountView( QWidget *parent, const char *name, Qt::WFlags flags )
+ : Q3ListView( parent, name, flags )
{
//connect( this, SIGNAL( selectionChanged(QListViewItem*) ),
// SLOT( refresh(QListViewItem*) ) );
- connect( this, SIGNAL( clicked(QListViewItem*) ),
- SLOT( refresh(QListViewItem*) ) );
- connect( this, SIGNAL( returnPressed(QListViewItem*) ),
- SLOT( refresh(QListViewItem*) ) );
- connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
- SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) );
+ connect( this, SIGNAL( clicked(Q3ListViewItem*) ),
+ SLOT( refresh(Q3ListViewItem*) ) );
+ connect( this, SIGNAL( returnPressed(Q3ListViewItem*) ),
+ SLOT( refresh(Q3ListViewItem*) ) );
+ connect( this, SIGNAL( mouseButtonPressed(int,Q3ListViewItem*,const QPoint&,int) ),this,
+ SLOT( slotHold(int,Q3ListViewItem*,const QPoint&,int) ) );
setSorting(0);
}
AccountView::~AccountView()
{
imapAccounts.clear();
mhAccounts.clear();
}
void AccountView::slotContextMenu(int id)
{
AccountViewItem *view = static_cast<AccountViewItem *>(currentItem());
if (!view) return;
view->contextMenuSelected(id);
}
-void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
+void AccountView::slotHold(int button, Q3ListViewItem * item,const QPoint&,int)
{
if (button==1) {return;}
if (!item) return;
AccountViewItem *view = static_cast<AccountViewItem *>(item);
- QPopupMenu*m = view->getContextMenu();
+ Q3PopupMenu*m = view->getContextMenu();
if (!m) return;
connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int)));
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
void AccountView::populate( QList<Account> list )
{
clear();
imapAccounts.clear();
mhAccounts.clear();
mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
Account *it;
for ( it = list.first(); it; it = list.next() )
{
if ( it->getType() == MAILLIB::A_IMAP )
{
IMAPaccount *imap = static_cast<IMAPaccount *>(it);
imapAccounts.append(new IMAPviewItem( imap, this ));
}
else if ( it->getType() == MAILLIB::A_POP3 )
{
POP3account *pop3 = static_cast<POP3account *>(it);
/* must not be hold 'cause it isn't required */
(void) new POP3viewItem( pop3, this );
}
else if ( it->getType() == MAILLIB::A_NNTP )
{
NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
/* must not be hold 'cause it isn't required */
(void) new NNTPviewItem( nntp, this );
}
}
}
-void AccountView::refresh(QListViewItem *item)
+void AccountView::refresh(Q3ListViewItem *item)
{
if ( item )
{
bool ask = true;
//qDebug("text -%s- ",item->text( 0 ).latin1() );
if ( item->text( 0 ) == i18n (" Local Mailfolders") )
ask = false;
else {
if ( item->parent() )
if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") )
ask = false;
}
if ( ask ) {
int result = KMessageBox::warningContinueCancel(this,
i18n("Refresh\n%1\n?").arg( item->text(0) ),
i18n("Refresh"),i18n("Refresh"),i18n("Cancel"),
true);
if (result != KMessageBox::Continue) return;
}
m_currentItem = item;
topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ;
QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) );
}
}
void AccountView::refreshOutgoing()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
if ( !view->getFolder() )
return;
QString bName = view->getFolder()->getDisplayName();
if (bName.startsWith("/")&&bName.length()>1)
{
bName.replace(0,1,"");
}
int pos = bName.findRev("/");
if (pos > 0)
{
bName.replace(0,pos+1,"");
}
//qDebug("name *%s* ",bName.lower().latin1() );
if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) {
refreshCurrent();
// qDebug("refresh ");
}
}
void AccountView::refreshCurrentSelected()
{
if ( !m_currentItem ) return;
- QValueList<RecMailP> headerlist;
+ Q3ValueList<RecMailP> headerlist;
AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem);
view->refresh(headerlist);
emit refreshMailview(headerlist);
topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ;
}
void AccountView::refreshCurrent()
{
m_currentItem = currentItem();
if ( !m_currentItem ) return;
topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ;
QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) );
}
void AccountView::refreshAll()
{
}
RecBodyP AccountView::fetchBody(const RecMailP&aMail)
{
- QListViewItem*item = selectedItem ();
+ Q3ListViewItem*item = selectedItem ();
if (!item) return new RecBody();
AccountViewItem *view = static_cast<AccountViewItem *>(item);
return view->fetchBody(aMail);
}
void AccountView::setupFolderselect(Selectstore*sels)
{
#ifndef DESKTOP_VERSION
sels->showMaximized();
#else
sels->show();
#endif
QStringList sFolders;
unsigned int i = 0;
for (i=0; i < mhAccounts.count();++i)
{
mhAccounts[i]->refresh(false);
sFolders = mhAccounts[i]->subFolders();
sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders);
}
for (i=0; i < imapAccounts.count();++i)
{
if (imapAccounts[i]->offline())
continue;
imapAccounts[i]->refreshFolders(false);
sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders());
}
}
void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper)
{
#if 0
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h
index 33f3479..14b0ff9 100644
--- a/kmicromail/accountview.h
+++ b/kmicromail/accountview.h
@@ -1,48 +1,50 @@
#ifndef ACCOUNTVIEW_H
#define ACCOUNTVIEW_H
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailtypes.h>
class Selectstore;
class Folder;
class AbstractMail;
class Account;
class IMAPviewItem;
class MHviewItem;
-class AccountView : public QListView
+class AccountView : public Q3ListView
{
Q_OBJECT
public:
- AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
+ AccountView( QWidget *parent = 0, const char *name = 0, Qt::WFlags flags = 0 );
virtual ~AccountView();
virtual void populate( QList<Account> list );
virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
virtual bool currentisDraft();
- QValueList<MHviewItem*> allAccounts() { return mhAccounts;}
+ Q3ValueList<MHviewItem*> allAccounts() { return mhAccounts;}
public slots:
virtual void refreshAll();
- virtual void refresh(QListViewItem *item);
+ virtual void refresh(Q3ListViewItem *item);
virtual void refreshCurrent();
virtual void refreshCurrentSelected();
virtual void refreshOutgoing();
- virtual void slotHold(int, QListViewItem *,const QPoint&,int);
+ virtual void slotHold(int, Q3ListViewItem *,const QPoint&,int);
virtual void slotContextMenu(int id);
void setupFolderselect(Selectstore*sels);
signals:
- void refreshMailview(const QValueList<RecMailP>& );
+ void refreshMailview(const Q3ValueList<RecMailP>& );
protected:
- QListViewItem* m_currentItem;
- QValueList<IMAPviewItem*> imapAccounts;
- QValueList<MHviewItem*> mhAccounts;
+ Q3ListViewItem* m_currentItem;
+ Q3ValueList<IMAPviewItem*> imapAccounts;
+ Q3ValueList<MHviewItem*> mhAccounts;
};
#endif
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 4bc4441..81d7b52 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -9,72 +9,72 @@
#else
#include <qpe/qpeapplication.h>
#endif //DESKTOP_VERSION
#include <libkdepim/externalapphandler.h>
#include "koprefs.h"
#include <klocale.h>
#include <kglobal.h>
#ifdef MINIKDE_KDIALOG_H
#undef MINIKDE_KDIALOG_H
#endif
#include "composemail.h"
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/storemail.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailtypes.h>
/* OPIE */
//#include <opie2/ofiledialog.h>
//#include <opie2/odebug.h>
#include <kfiledialog.h>
//#include <qpe/resource.h>
#include <qpe/global.h>
//#include <qpe/contact.h>
#include <qcombobox.h>
#include <qcheckbox.h>
-#include <qiconset.h>
+#include <qicon.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
-#include <qlistview.h>
+#include <q3listview.h>
//using namespace Opie::Core;
//using namespace Opie::Ui;
ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal )
: ComposeMailUI( parent, name, modal )
{
topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") );
mPickLineEdit = 0;
mEncoding = KOPrefs::instance()->mCurrentCodeName;
//managed from opiemail now
//connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
// this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
settings = sett;
m_replyid = "";
if ( KOPrefs::instance()->mUseKapi) {
KConfig config( locateLocal("config", "kabcrc") );
config.setGroup( "General" );
QString whoami_uid = config.readEntry( "WhoAmI" );
if ( whoami_uid.isEmpty() ) {
QMessageBox::information( 0, i18n( "Hint" ),
i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
i18n( "Ok" ) );
fillSettings();
} else
ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
#ifdef DESKTOP_VERSION
@@ -96,81 +96,81 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo
}
senderNameEdit->setText(con.formattedName());
#endif
} else {
fillSettings();
}
checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
attList->addColumn( i18n( "Name" ) );
attList->addColumn( i18n( "Size" ) );
QList<Account> accounts = settings->getAccounts();
if ( QApplication::desktop()->width() < 320 )
smtpAccountBox->setMaximumWidth( 80 );
Account *it;
for ( it = accounts.first(); it; it = accounts.next() ) {
if ( it->getType()==MAILLIB::A_SMTP ) {
SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
smtpAccountBox->insertItem( smtp->getAccountName() );
smtpAccounts.append( smtp );
}
}
connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
mMail = 0;
warnAttach = true;
- QIconSet icon;
+ QIcon icon;
//icon = SmallIcon("fileexport");
icon = SmallIcon("filesave");
SaveButton->setIconSet (icon ) ;
if ( QApplication::desktop()->width() < 320 ) {
SaveButton->setText ("") ;
SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
}
else
SaveButton->setText (i18n("Save"));
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
#endif
message->setFont ( KOPrefs::instance()->mComposeFont );
- message->setWordWrap (QMultiLineEdit::WidgetWidth);
+ message->setWordWrap (Q3MultiLineEdit::WidgetWidth);
if ( smtpAccounts.count() > 0 ) {
fillValues( smtpAccountBox->currentItem() );
} else {
QMessageBox::information( 0, i18n( "Problem" ),
i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
i18n( "Ok" ) );
return;
}
connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) );
if ( smtpAccountBox->count())
fillValues(0);
#ifdef DESKTOP_VERSION
if ( QApplication::desktop()->width() <= 800 ) {
resize( QApplication::desktop()->size() );
} else
resize( 800, 600 );
if ( QApplication::desktop()->width() >= 640 )
senderNameEdit->setFixedWidth( 200 );
#endif
}
void ComposeMail::fillSettings()
{
if ( QApplication::desktop()->width() < 320 )
fromBox->setMaximumWidth( 100 );
QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
QStringList::ConstIterator sit = mailList.begin();
int pref = 0;
for (;sit!=mailList.end();++sit) {
fromBox->insertItem((*sit));
}
@@ -505,42 +505,42 @@ void ComposeMail::reject()
}
if (yesno == 2) {
qDebug("return ");
return;
}
QDialog::reject();
}
void ComposeMail::setCharset(const QString& charset)
{
if ( !charset.isEmpty() )
mEncoding = charset;
qDebug("ComposeMail::setCharset %s ", mEncoding.latin1());
}
ComposeMail::~ComposeMail()
{
}
void ComposeMail::reEditMail(const RecMailP&current)
{
RecMailP data = current;
RecBodyP body = data->Wrapper()->fetchBody(current);
message->setText(body->Bodytext());
subjectLine->setText( data->getSubject());
toLine->setText(data->To().join(","));
ccLine->setText(data->CC().join(","));
bccLine->setText(data->Bcc().join(","));
replyLine->setText(data->Replyto());
setCharset(body->getCharset());
}
-AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
- : QListViewItem( parent )
+AttachViewItem::AttachViewItem( Q3ListView *parent, Attachment *att )
+ : Q3ListViewItem( parent )
{
attachment = att;
if ( !attachment->getPixmap().isNull() )
setPixmap( 0,attachment->getPixmap() );
setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
setText( 1, QString::number( att->getSize() ) );
}
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h
index 966ac3e..9aef4e1 100644
--- a/kmicromail/composemail.h
+++ b/kmicromail/composemail.h
@@ -1,37 +1,37 @@
#ifndef COMPOSEMAIL_H
#define COMPOSEMAIL_H
#include <qlineedit.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include "composemailui.h"
//#include "addresspickerui.h"
#include <libmailwrapper/settings.h>
#include <libmailwrapper/mailwrapper.h>
class RecMail;
#include <opie2/osmartpointer.h>
#if 0
class AddressPicker : public AddressPickerUI
{
//Q_OBJECT
public:
AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false );
static QString getNames();
protected:
QString selectedNames;
void accept();
};
#endif
class RecMail;
class ComposeMail : public ComposeMailUI
{
Q_OBJECT
public:
@@ -51,44 +51,44 @@ public slots:
void setCharset(const QString&);
protected slots:
void accept();
void reject();
private slots:
void fillValues( int current );
void fillSettings();
void pickAddress();
void pickAddressTo();
void pickAddressCC();
void pickAddressBCC();
void pickAddressReply();
void saveAsDraft();
void addAttachment();
void removeAttachment();
void clearStatus();
void setStatus( QString );
void saveSig();
protected:
QLineEdit* mPickLineEdit;
Opie::Core::OSmartPointer<Mail> mMail;
Settings *settings;
QList<SMTPaccount> smtpAccounts;
QString m_replyid;
QString mEncoding;
bool warnAttach;
};
-class AttachViewItem : public QListViewItem
+class AttachViewItem : public Q3ListViewItem
{
public:
- AttachViewItem( QListView *parent, Attachment *att );
+ AttachViewItem( Q3ListView *parent, Attachment *att );
Attachment *getAttachment() { return attachment; }
private:
Attachment *attachment;
};
#endif
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 2c0f2d8..f274dc3 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,86 +1,86 @@
#include <qdialog.h>
#include "kapplication.h"
#include "defines.h"
#include "editaccounts.h"
/* OPIE */
#include <qpe/qpeapplication.h>
/* QT */
#include <qstringlist.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qspinbox.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <libmailwrapper/nntpwrapper.h>
using namespace Opie::Core;
-AccountListItem::AccountListItem( QListView *parent, Account *a)
- : QListViewItem( parent )
+AccountListItem::AccountListItem( Q3ListView *parent, Account *a)
+ : Q3ListViewItem( parent )
{
account = a;
setText( 0, account->getAccountName() );
QString ttext = "";
switch (account->getType()) {
case MAILLIB::A_NNTP:
ttext="NNTP";
break;
case MAILLIB::A_POP3:
ttext = "POP3";
break;
case MAILLIB::A_IMAP:
ttext = "IMAP";
break;
case MAILLIB::A_SMTP:
ttext = "SMTP";
break;
default:
ttext = "UNKNOWN";
break;
}
setText( 1, ttext);
}
-EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
+EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: EditAccountsUI( parent, name, modal, flags )
{
settings = s;
mailList->addColumn( i18n( "Account" ) );
mailList->addColumn( i18n( "Type" ) );
newsList->addColumn( i18n( "Account" ) );
connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
slotFillLists();
}
void EditAccounts::slotFillLists()
{
mailList->clear();
newsList->clear();
QList<Account> accounts = settings->getAccounts();
Account *it;
for ( it = accounts.first(); it; it = accounts.next() )
{
if ( it->getType()==MAILLIB::A_NNTP )
{
(void) new AccountListItem( newsList, it );
}
@@ -279,82 +279,82 @@ void EditAccounts::slotDeleteNews()
return;
}
Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
slotDeleteAccount( a );
}
void EditAccounts::slotAdjustColumns()
{
int currPage = configTab->currentPageIndex();
configTab->showPage( mailTab );
mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
mailList->setColumnWidth( 1, 50 );
configTab->showPage( newsTab );
newsList->setColumnWidth( 0, newsList->visibleWidth() );
configTab->setCurrentPage( currPage );
}
void EditAccounts::accept()
{
settings->saveAccounts();
QDialog::accept();
}
/**
* SelectMailType
*/
-SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
+SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: SelectMailTypeUI( parent, name, modal, flags )
{
selected = selection;
selected->replace( 0, selected->length(), typeBox->currentText() );
connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
}
void SelectMailType::slotSelection( const QString &sel )
{
selected->replace( 0, selected->length(), sel );
}
/**
* IMAPconfig
*/
-IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
+IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: IMAPconfigUI( parent, name, modal, flags )
{
data = account;
//fillValues();
connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
ComboBox1->insertItem( "Only if available", 0 );
ComboBox1->insertItem( "Always, Negotiated", 1 );
ComboBox1->insertItem( "Connect on secure port", 2 );
ComboBox1->insertItem( "Run command instead", 3 );
CommandEdit->hide();
fillValues();
// ComboBox1->setCurrentItem( data->ConnectionType() );
}
void IMAPconfig::slotConnectionToggle( int index )
{
if ( index == 2 )
{
portLine->setText( IMAP_SSL_PORT );
CommandEdit->hide();
}
else if ( index == 3 )
{
portLine->setText( IMAP_PORT );
CommandEdit->show();
}
else
{
portLine->setText( IMAP_PORT );
CommandEdit->hide();
@@ -379,65 +379,65 @@ void IMAPconfig::fillValues()
CheckBoxDown->setChecked( false );
SpinBoxDown->setValue ( 5 );
}
CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
}
void IMAPconfig::accept()
{
if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
QMessageBox::information( this, i18n( "Error" ),
i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
i18n( "Ok" ) );
return;
}
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setConnectionType( ComboBox1->currentItem() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
data->setPrefix(prefixLine->text());
data->setLocalFolder( localFolder->text() );
data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
QDialog::accept();
}
/**
* POP3config
*/
-POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
+POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: POP3configUI( parent, name, modal, flags )
{
data = account;
//fillValues();
connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
ComboBox1->insertItem( "Only if available", 0 );
ComboBox1->insertItem( "Always, Negotiated", 1 );
ComboBox1->insertItem( "Connect on secure port", 2 );
ComboBox1->insertItem( "Run command instead", 3 );
CommandEdit->hide();
fillValues();
//ComboBox1->setCurrentItem( data->ConnectionType() );
}
void POP3config::slotConnectionToggle( int index )
{
// 2 is ssl connection
if ( index == 2 )
{
portLine->setText( POP3_SSL_PORT );
CommandEdit->hide();
}
else if ( index == 3 )
{
portLine->setText( POP3_PORT );
CommandEdit->show();
}
else
{
portLine->setText( POP3_PORT );
CommandEdit->hide();
@@ -460,74 +460,74 @@ void POP3config::fillValues()
} else {
CheckBoxDown->setChecked( false );
SpinBoxDown->setValue ( 5 );
}
CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
}
void POP3config::accept()
{
if ( localFolder->text().contains("/") ||localFolder->text().contains("\\") ) {
QMessageBox::information( this, i18n( "Error" ),
i18n( "No paths allowed in\nlocal folder settings.\nPlease specify a folder\nname or leave empty\nto create local folder\nwith account name\nautomatically." ),
i18n( "Ok" ) );
return;
}
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setConnectionType( ComboBox1->currentItem() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
data->setLocalFolder( localFolder->text() );
data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
QDialog::accept();
}
/**
* SMTPconfig
*/
-SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
+SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: SMTPconfigUI( parent, name, modal, flags )
{
data = account;
connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
// fillValues();
- QIconSet icon;
+ QIcon icon;
//icon = SmallIcon("fileexport");
icon = SmallIcon("fileopen");
SignaturButton->setText("");
SignaturButton->setIconSet (icon ) ;
SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
ComboBox1->insertItem( "No secure connection, no TLS", 0 );
ComboBox1->insertItem( "Only if available, try TLS", 1 );
ComboBox1->insertItem( "Always, use TLS", 2 );
ComboBox1->insertItem( "Connect on secure port (SSL)", 3 );
ComboBox1->insertItem( "Run command instead", 4 );
CommandEdit->hide();
fillValues();
//ComboBox1->setCurrentItem( data->ConnectionType() );
}
void SMTPconfig::chooseSig()
{
QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
if ( !lnk.isEmpty() ) {
SignaturEdit->setText( lnk );
}
}
void SMTPconfig::slotConnectionToggle( int index )
{
// 3 is ssl connection
if ( index == 3 )
{
portLine->setText( SMTP_SSL_PORT );
CommandEdit->hide();
}
else if ( index == 4 )
@@ -543,161 +543,161 @@ void SMTPconfig::slotConnectionToggle( int index )
}
void SMTPconfig::fillValues()
{
accountLine->setText( data->getAccountName() );
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
ComboBox1->setCurrentItem( data->ConnectionType() );
loginBox->setChecked( data->getLogin() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
SignaturEdit->setText( data->getSigFile() );
}
void SMTPconfig::accept()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setConnectionType( ComboBox1->currentItem() );
data->setLogin( loginBox->isChecked() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
data->setSigFile( SignaturEdit->text() );
QDialog::accept();
}
/**
* NNTPconfig
*/
-NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
+NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: NNTPconfigUI( parent, name, modal, flags )
{
data = account;
connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
fillValues();
connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
}
void NNTPconfig::slotShowSub()
{
save();
data->save();
ListViewGroups->clear();
for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
- QCheckListItem *item;
- item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ Q3CheckListItem *item;
+ item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
item->setOn( true );
}
topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
}
void NNTPconfig::slotShowFilter()
{
save();
data->save();
ListViewGroups->clear();
int count = 0;
for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
- QCheckListItem *item;
+ Q3CheckListItem *item;
if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
- item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
++count;
if ( subscribedGroups.contains( (*it) ) >= 1 ) {
item->setOn( true );
}
}
}
topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
}
void NNTPconfig::slotGetNG() {
save();
data->save();
topLevelWidget()->setCaption( i18n("Fetching group list..."));
qApp->processEvents();
NNTPwrapper* tmp = new NNTPwrapper( data );
allGroups = tmp->listAllNewsgroups();
topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
ListViewGroups->clear();
for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
- QCheckListItem *item;
- item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ Q3CheckListItem *item;
+ item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
if ( subscribedGroups.contains( (*it) ) >= 1 ) {
item->setOn( true );
}
}
delete tmp;
}
void NNTPconfig::slotSSL( bool enabled )
{
if ( enabled )
{
portLine->setText( NNTP_SSL_PORT );
}
else
{
portLine->setText( NNTP_PORT );
}
}
void NNTPconfig::fillValues()
{
accountLine->setText( data->getAccountName() );
serverLine->setText( data->getServer() );
portLine->setText( data->getPort() );
sslBox->setChecked( data->getSSL() );
loginBox->setChecked( data->getLogin() );
userLine->setText( data->getUser() );
passLine->setText( data->getPassword() );
subscribedGroups = data->getGroups();
/* don't forget that - you will overwrite values if user clicks cancel! */
for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
- QCheckListItem *item;
- item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
+ Q3CheckListItem *item;
+ item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
item->setOn( true );
}
}
void NNTPconfig::save()
{
data->setAccountName( accountLine->text() );
data->setServer( serverLine->text() );
data->setPort( portLine->text() );
data->setSSL( sslBox->isChecked() );
data->setLogin( loginBox->isChecked() );
data->setUser( userLine->text() );
data->setPassword( passLine->text() );
- QListViewItemIterator list_it( ListViewGroups );
+ Q3ListViewItemIterator list_it( ListViewGroups );
for ( ; list_it.current(); ++list_it ) {
- if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
+ if ( ( (Q3CheckListItem*)list_it.current() )->isOn() ) {
if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
subscribedGroups.append( list_it.current()->text(0) );
} else {
if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
subscribedGroups.remove( list_it.current()->text(0) );
}
}
data->setGroups( subscribedGroups );
}
void NNTPconfig::accept()
{
save();
QDialog::accept();
}
diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h
index 465780c..3d01d23 100644
--- a/kmicromail/editaccounts.h
+++ b/kmicromail/editaccounts.h
@@ -1,157 +1,157 @@
#ifndef EDITACCOUNTS_H
#define EDITACCOUNTS_H
#include <qstring.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include "editaccountsui.h"
#include "selectmailtypeui.h"
#include "imapconfigui.h"
#include "pop3configui.h"
#include "smtpconfigui.h"
#include "nntpconfigui.h"
#include <libetpan/clist.h>
#include <libmailwrapper/settings.h>
-class AccountListItem : public QListViewItem
+class AccountListItem : public Q3ListViewItem
{
public:
- AccountListItem( QListView *parent, Account *a);
+ AccountListItem( Q3ListView *parent, Account *a);
Account *getAccount() { return account; }
private:
Account *account;
};
class EditAccounts : public EditAccountsUI
{
Q_OBJECT
public:
- EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
+ EditAccounts( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 );
public slots:
void slotNewAccount( const QString &type );
void slotEditAccount( Account *account );
void slotDeleteAccount( Account * account );
void slotAdjustColumns();
protected slots:
void slotFillLists();
void slotNewMail();
void slotEditMail();
void slotDeleteMail();
void slotNewNews();
void slotEditNews();
void slotDeleteNews();
void accept();
private:
Settings *settings;
};
class SelectMailType : public SelectMailTypeUI
{
Q_OBJECT
public:
- SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
+ SelectMailType( QString *selection = 0, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 );
private slots:
void slotSelection( const QString &sel );
private:
QString *selected;
};
class IMAPconfig : public IMAPconfigUI
{
Q_OBJECT
public:
- IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
+ IMAPconfig( IMAPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 );
public slots:
void fillValues();
protected slots:
void slotConnectionToggle( int index );
void accept();
private:
IMAPaccount *data;
};
class POP3config : public POP3configUI
{
Q_OBJECT
public:
- POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
+ POP3config( POP3account *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 );
public slots:
void fillValues();
protected slots:
void slotConnectionToggle( int index );
void accept();
private:
POP3account *data;
};
class SMTPconfig : public SMTPconfigUI
{
Q_OBJECT
public:
- SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
+ SMTPconfig( SMTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 );
public slots:
void fillValues();
protected slots:
void slotConnectionToggle( int index );
void accept();
void chooseSig();
private:
SMTPaccount *data;
};
class NNTPconfig : public NNTPconfigUI
{
Q_OBJECT
public:
- NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, WFlags flags = 0 );
+ NNTPconfig( NNTPaccount *account, QWidget *parent = 0, const char *name = 0, bool modal = 0, Qt::WFlags flags = 0 );
public slots:
void fillValues();
protected slots:
void slotSSL( bool enabled );
void accept();
void slotGetNG();
void slotShowSub();
void slotShowFilter();
private:
QStringList subscribedGroups;
QStringList allGroups;
void save();
NNTPaccount *data;
clist* list;
};
#endif
diff --git a/kmicromail/kmicromail.pro b/kmicromail/kmicromail.pro
index 9f4d4bd..ce30bbf 100644
--- a/kmicromail/kmicromail.pro
+++ b/kmicromail/kmicromail.pro
@@ -12,67 +12,73 @@ HEADERS = defines.h \
mailistviewitem.h \
settingsdialog.h \
statuswidget.h \
newmaildir.h \
selectstore.h \
selectsmtp.h \
./qpe/qdialog.h \
nntpgroups.h \
koprefs.h \
koprefsdialog.h \
nntpgroupsdlg.h
SOURCES = main.cpp \
opiemail.cpp \
mainwindow.cpp \
accountview.cpp \
accountitem.cpp \
composemail.cpp \
editaccounts.cpp \
viewmail.cpp \
viewmailbase.cpp \
mailistviewitem.cpp \
settingsdialog.cpp \
statuswidget.cpp \
newmaildir.cpp \
selectstore.cpp \
selectsmtp.cpp \
nntpgroups.cpp \
koprefs.cpp\
koprefsdialog.cpp\
nntpgroupsdlg.cpp
-INTERFACES = editaccountsui.ui \
+#The following line was changed from INTERFACES to FORMS3 by qt3to4
+FORMS3 = editaccountsui.ui \
selectmailtypeui.ui \
imapconfigui.ui \
pop3configui.ui \
nntpconfigui.ui \
smtpconfigui.ui \
composemailui.ui \
settingsdialogui.ui \
statuswidgetui.ui \
newmaildirui.ui \
selectstoreui.ui \
nntpgroupsui.ui
INCLUDEPATH += ./qpe . .. ../libkdepim ../microkde ../microkde/kdecore ../libetpan/include ../microkde/kdeui
-LIBS += -L../bin -lmicromailwrapper -lmicrolibetpan -lmicrokde -lssl -lcrypto -lmicrokdepim -lmicrokabc -lpthread
+LIBS += -L../bin -lmicromailwrapper -lxmicrolibetpan -lxmicrokde -lssl -lcrypto -lxmicrokdepim -lxmicrokabc -lpthread
DESTDIR= ../bin
TARGET = ompi
DEFINES += DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
LIBS += mfc71u.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+CONFIG += uic3
+
diff --git a/kmicromail/kmicromailE.pro b/kmicromail/kmicromailE.pro
index a5a51f7..19fa398 100644
--- a/kmicromail/kmicromailE.pro
+++ b/kmicromail/kmicromailE.pro
@@ -26,47 +26,47 @@ SOURCES = main.cpp \
accountview.cpp \
accountitem.cpp \
composemail.cpp \
editaccounts.cpp \
viewmail.cpp \
viewmailbase.cpp \
mailistviewitem.cpp \
settingsdialog.cpp \
statuswidget.cpp \
newmaildir.cpp \
selectstore.cpp \
selectsmtp.cpp \
nntpgroups.cpp \
koprefs.cpp\
koprefsdialog.cpp\
nntpgroupsdlg.cpp
INTERFACES = editaccountsui.ui \
selectmailtypeui.ui \
imapconfigui.ui \
pop3configui.ui \
nntpconfigui.ui \
smtpconfigui.ui \
composemailui.ui \
settingsdialogui.ui \
statuswidgetui.ui \
newmaildirui.ui \
selectstoreui.ui \
nntpgroupsui.ui
INCLUDEPATH += $(QPEDIR)/include . $(KDEPIMDIR) $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/libetpan/include $(KDEPIMDIR)/microkde/kdeui
-LIBS += -L$(QPEDIR)/lib -lmicromailwrapper -lqpe -lmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokdepim -lpthread
+LIBS += -L$(QPEDIR)/lib -lmicromailwrapper -lqpe -lxmicrolibetpan -lxmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lxmicrokdepim -lpthread
LIBS += $(QTOPIALIB)
#LIBS += -lqtopia
#next line for Zaurus only
#LIBS += -luuid
LIBS += $(GCC3EXTRALIB1)
LIBS += $(GCC3EXTRALIB2)
#
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
TARGET = ompi
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index e4b61dc..e2eed9a 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -1,61 +1,61 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <time.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qstring.h>
#include <qregexp.h>
#include <qfont.h>
#include <qcolor.h>
#include <qstringlist.h>
#include <stdlib.h>
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kemailsettings.h>
#include <kstaticdeleter.h>
#include <kglobalsettings.h>
#include "koprefs.h"
#include "mainwindow.h"
KOPrefs *KOPrefs::mInstance = 0;
static KStaticDeleter<KOPrefs> insd;
KOPrefs::KOPrefs() :
KPimPrefs("kopiemailrc")
{
KPrefs::setCurrentGroup("General");
addItemString("SendCodec",&mSendCodec,i18n ("userdefined") );
addItemString("SenderName",&mName,i18n ("Please set at") );
addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
addItemBool("ViewMailAsHtml",&mViewAsHtml,false);
addItemBool("SendMailLater",&mSendLater,true);
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 017f1f7..e3102a4 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -1,75 +1,80 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kdialog.h>
#include <qlayout.h>
#include <qlabel.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
+#include <q3groupbox.h>
+#include <q3buttongroup.h>
#include <qlineedit.h>
#include <qfont.h>
#include <qslider.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qcombobox.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qregexp.h>
#include <qspinbox.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
-#include <qstrlist.h>
+#include <q3strlist.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <QPixmap>
+#include <Q3Frame>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include <kemailsettings.h>
#include <kstandarddirs.h>
#include <kglobalsettings.h>
#include <klineedit.h>
#include "koprefs.h"
#include "koprefsdialog.h"
//#include <kprefswidget.h>
KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
KPrefsDialog(KOPrefs::instance(),parent,name,true)
{
setFont( KGlobalSettings::generalMaxFont() );
setCaption( i18n("Settings - some need a restart (nr)"));
setupGlobalTab();
setupMainTab();
setupMailTab();;
@@ -82,483 +87,483 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
#if 0
setupMainTab();
setupLocaleTab();
setupTimeZoneTab();
setupTimeTab();
setupLocaleDateTab();
setupFontsTab();
setupColorsTab();
setupViewsTab();
//setupSyncTab();
//setupSyncAlgTab();
//setupPrinterTab();
//setupGroupSchedulingTab();
//setupGroupAutomationTab();
#endif
}
#include "kpimglobalprefs.h"
KOPrefsDialog::~KOPrefsDialog()
{
}
void KOPrefsDialog::setupGlobalTab()
{
}
void KOPrefsDialog::setupMainTab()
{
- QFrame *topFrame = addPage(i18n("General"),0,0);
+ Q3Frame *topFrame = addPage(i18n("General"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
mNameEdit = new QLineEdit(topFrame);
mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
topLayout->addWidget(mNameLabel,0,0);
topLayout->addWidget(mNameEdit,0,1);
mEmailEdit = new QLineEdit(topFrame);
mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
topLayout->addWidget(mEmailLabel,1,0);
topLayout->addWidget(mEmailEdit,1,1);
QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
topLayout->addMultiCellWidget(lab,2,2,0,1);
KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
&(KOPrefs::instance()->mUseKapi),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
}
void KOPrefsDialog::setupMailTab()
{
- QFrame *topFrame = addPage(i18n("Mail"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Mail"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
&(KOPrefs::instance()->mViewAsHtml),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
ttt = addWidBool(i18n("Send mails later"),
&(KOPrefs::instance()->mSendLater),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
ttt = addWidBool(i18n("Show \"To\" field in list view"),
&(KOPrefs::instance()->mShowToField),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1);
int iii =3;
ttt = addWidBool(i18n("Show info fields at startup"),
&(KOPrefs::instance()->mShowInfoStart),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
++iii;
ttt = addWidBool(i18n("Show \"Subject\" info field"),
&(KOPrefs::instance()->mShowInfoSub),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
++iii;
ttt = addWidBool(i18n("Show \"From\" info field"),
&(KOPrefs::instance()->mShowInfoFrom),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
++iii;
ttt = addWidBool(i18n("Show \"To\" info field"),
&(KOPrefs::instance()->mShowInfoTo),topFrame);
topLayout->addMultiCellWidget(ttt->checkBox(),iii,iii,0,1);
++iii;
/*
mCodecEdit = new QLineEdit(topFrame);
topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1);
topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1);
topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1);
*/
}
void KOPrefsDialog::setupFontsTab()
{
- QFrame *topFrame = addPage(i18n("Fonts"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Fonts"),0,0);
// DesktopIcon("fonts",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,7,3);
topLayout->setSpacing(1);
topLayout->setMargin(3);
KPrefsDialogWidFont * tVFont;
int i = 0;
KPrefsDialogWidFont *timeLabelsFont =
addWidFont(i18n("OK"),i18n("Application(nr)"),
&(KOPrefs::instance()->mAppFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
timeLabelsFont =
addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
&(KOPrefs::instance()->mComposeFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
KPrefsDialogWidFont *timeBarFont =
addWidFont(i18n("Hello"),i18n("Read mail:"),
&(KOPrefs::instance()->mReadFont),topFrame);
topLayout->addWidget(timeBarFont->label(),i,0);
topLayout->addWidget(timeBarFont->preview(),i,1);
topLayout->addWidget(timeBarFont->button(),i,2);
++i;
topLayout->setColStretch(1,1);
topLayout->setRowStretch(4,1);
}
void KOPrefsDialog::usrReadConfig()
{
mNameEdit->setText(KOPrefs::instance()->mName);
mEmailEdit->setText(KOPrefs::instance()->mEmail);
//mCodecEdit->setText(KOPrefs::instance()->mSendCodec);
}
void KOPrefsDialog::usrWriteConfig()
{
KOPrefs::instance()->mName = mNameEdit->text();
KOPrefs::instance()->mEmail = mEmailEdit->text();
//KOPrefs::instance()->mSendCodec = mCodecEdit->text();
}
#if 0
void KOPrefsDialog::setupLocaleDateTab()
{
-QFrame *topFrame = addPage(i18n("Date Format"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
+Q3Frame *topFrame = addPage(i18n("Date Format"),0,0);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
int iii = 0;
KPrefsWidRadios *syncPrefsGroup =
addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
QString format;
if ( QApplication::desktop()->width() < 480 )
format = "(%d.%m.%Y)";
else
format = "(%d.%m.%Y|%A %d %B %Y)";
syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%m.%d.%Y)";
else
format = "(%m.%d.%Y|%A %B %d %Y)";
syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%Y-%m-%d)";
else
format = "(%Y-%m-%d|%A %Y %B %d)";
syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
syncPrefsGroup->addRadio(i18n("User defined"));
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
++iii;
QLabel * lab;
mUserDateFormatLong = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatLong,iii,1);
++iii;
mUserDateFormatShort = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatShort,iii,1);
++iii;
lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
}
void KOPrefsDialog::setupLocaleTab()
{
- QFrame *topFrame = addPage(i18n("Locale"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+ Q3Frame *topFrame = addPage(i18n("Locale"),0,0);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
int iii = 0;
KPrefsWidRadios *syncPrefsGroup =
addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
syncPrefsGroup->addRadio(i18n("English"));
syncPrefsGroup->addRadio(i18n("German"));
syncPrefsGroup->addRadio(i18n("French"));
syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
if ( QApplication::desktop()->width() < 300 )
;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
syncPrefsGroup =
addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
if ( QApplication::desktop()->width() > 300 )
syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
syncPrefsGroup->addRadio(i18n("24:00"));
syncPrefsGroup->addRadio(i18n("12:00am"));
syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
KPrefsDialogWidBool *sb;
if ( QApplication::desktop()->width() < 300 ) {
sb =
addWidBool(i18n("Week starts on Sunday"),
&(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
sb =
addWidBool(i18n("Use short date in (WN/E) view"),
&(KOPrefs::instance()->mShortDateInViewer),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
}
else {
QWidget * hb = new QWidget( topFrame );
- QHBoxLayout *hbLayout = new QHBoxLayout(hb);
+ Q3HBoxLayout *hbLayout = new Q3HBoxLayout(hb);
sb =
addWidBool(i18n("Week starts on Sunday"),
&(KOPrefs::instance()->mWeekStartsOnSunday),hb);
hbLayout->addWidget(sb->checkBox() );
sb =
addWidBool(i18n("Use short date in (WN/E) view"),
&(KOPrefs::instance()->mShortDateInViewer),hb);
hbLayout->addWidget(sb->checkBox() );
topLayout->addMultiCellWidget(hb, iii,iii,0,1);
}
//#ifndef DESKTOP_VERSION
#if 0
++iii;
sb =
addWidBool(i18n("Quick load/save (w/o Unicode)"),
&(KOPrefs::instance()->mUseQuicksave),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
#endif
}
void KOPrefsDialog::showSyncPage()
{
showPage ( 2 ) ;
}
void KOPrefsDialog::setupSyncAlgTab()
{
#if 0
QLabel * lab;
- QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Sync Prefs"),0,0);
mSetupSyncAlgTab = topFrame;
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
int iii = 0;
KPrefsDialogWidBool *sb =
addWidBool(i18n("Ask for preferences before syncing"),
&(KOPrefs::instance()->mAskForPreferences),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
KPrefsWidRadios *syncPrefsGroup =
addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
topFrame);
syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
syncPrefsGroup->addRadio(i18n("Force take local entry always"));
syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
sb =
addWidBool(i18n("Show summary after syncing"),
&(KOPrefs::instance()->mShowSyncSummary),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
#endif
}
void KOPrefsDialog::setupSyncTab()
{
#if 0
QLabel * lab;
- QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3Frame *topFrame = addPage(i18n("Sync Network"),0,0);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
int iii = 0;
topLayout->addMultiCellWidget(lab , iii,iii,0,1);
++iii;
mRemoteIPEdit = new QLineEdit(topFrame);
lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mRemoteIPEdit,iii,1);
++iii;
mRemoteUser = new QLineEdit(topFrame);
lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mRemoteUser, iii,1);
++iii;
mRemoteFile = new QLineEdit(topFrame);
lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mRemoteFile,iii,1);
++iii;
mLocalTempFile = new QLineEdit(topFrame);
lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mLocalTempFile,iii,1);
++iii;
KPrefsDialogWidBool *wb =
addWidBool(i18n("Write back synced file"),
&(KOPrefs::instance()->mWriteBackFile),topFrame);
topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
++iii;
wb =
addWidBool(i18n("Write back existing entries only"),
&(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
++iii;
#endif
}
void KOPrefsDialog::setupMainTab()
{
- QFrame *topFrame = addPage(i18n("General"),0,0);
+ Q3Frame *topFrame = addPage(i18n("General"),0,0);
// DesktopIcon("identity",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
// KPrefsDialogWidBool *emailControlCenter =
// addWidBool(i18n("&Use email settings from Control Center"),
// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
// connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
// SLOT(toggleEmailSettings(bool)));
mNameEdit = new QLineEdit(topFrame);
mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
topLayout->addWidget(mNameLabel,0,0);
topLayout->addWidget(mNameEdit,0,1);
mEmailEdit = new QLineEdit(topFrame);
mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
topLayout->addWidget(mEmailLabel,1,0);
topLayout->addWidget(mEmailEdit,1,1);
KPrefsDialogWidBool *wb;
- QHBox *dummy;
+ Q3HBox *dummy;
if ( QApplication::desktop()->width() > 480 ) {
- dummy = new QHBox(topFrame);
+ dummy = new Q3HBox(topFrame);
} else {
- dummy = new QVBox(topFrame);
+ dummy = new Q3VBox(topFrame);
}
topLayout->addMultiCellWidget(dummy, 2,2,0,1);
addWidBool(i18n("Full menu bar(nr)"),
&(KOPrefs::instance()->mShowFullMenu),dummy);
addWidBool(i18n("Mini icons in toolbar(nr)"),
&(KOPrefs::instance()->mToolBarMiniIcons),dummy);
- dummy = new QHBox(topFrame);
+ dummy = new Q3HBox(topFrame);
new QLabel(i18n("Days in What's Next:"),dummy);
mWhatsNextSpin = new QSpinBox(1,14,1,dummy);
topLayout->addMultiCellWidget(dummy,3,3,0,1);
- dummy = new QHBox(topFrame);
+ dummy = new Q3HBox(topFrame);
new QLabel(i18n("Days in Next-X-Days:"),dummy);
mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
topLayout->addMultiCellWidget(dummy,4,4,0,1);
- QHBox *prioBox = new QHBox(topFrame);
+ Q3HBox *prioBox = new Q3HBox(topFrame);
// intervalBox->setSpacing(spacingHint());
topLayout->addMultiCellWidget(prioBox,5,5,0,1);
QString messa = i18n("Show topmost todo prios in What's Next:");
if ( QApplication::desktop()->width() < 300 )
messa = i18n("Show topmost todo prios in What's N.:");
QLabel *prioLabel = new QLabel(messa, prioBox);
mPrioSpin = new QSpinBox(0,5,1,prioBox);
if ( QApplication::desktop()->width() < 300 )
mPrioSpin->setFixedWidth( 40 );
// KPrefsDialogWidBool *bcc =
// addWidBool(i18n("Send copy to owner when mailing events"),
// &(KOPrefs::instance()->mBcc),topFrame);
// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
// QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
//topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
// addWidBool(i18n("Enable automatic saving of calendar"),
// &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
- QHBox *intervalBox = new QHBox(topFrame);
+ Q3HBox *intervalBox = new Q3HBox(topFrame);
// intervalBox->setSpacing(spacingHint());
topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
/*
QHBox * agendasize = new QHBox ( topFrame );
new QLabel (i18n("AllDayAgenda Height:"), agendasize );
mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
topLayout->addMultiCellWidget(agendasize,7,7,0,1);
*/
KPrefsDialogWidBool *verticalScreen =
addWidBool(i18n("Show vertical screen (Needs restart)"),
&(KOPrefs::instance()->mVerticalScreen),topFrame);
//topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1);
KPrefsDialogWidBool *ask =
addWidBool(i18n("Ask for quit when closing KO/Pi"),
&(KOPrefs::instance()->mAskForQuit),topFrame);
topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1);
/*
KPrefsDialogWidBool *confirmCheck =
addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
topFrame);
topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
@@ -591,141 +596,141 @@ void KOPrefsDialog::setupMainTab()
topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
// Default format unconditionally is iCalendar
defaultFormatGroup->groupBox()->hide();
KPrefsWidRadios *mailClientGroup =
addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
topFrame);
mailClientGroup->addRadio(i18n("KMail"));
mailClientGroup->addRadio(i18n("Sendmail"));
topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
KPrefsDialogWidBool *htmlsave =
addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
topFrame);
topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
KPrefsWidRadios *destinationGroup =
addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
topFrame);
destinationGroup->addRadio(i18n("be added to the standard resource"));
destinationGroup->addRadio(i18n("be asked which resource to use"));
topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
topLayout->setRowStretch(14,1);
*/
}
void KOPrefsDialog::setupTimeTab()
{
- QFrame *topFrame = addPage(i18n("Time"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Time"),0,0);
// DesktopIcon("clock",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
- QHBox *dummy = new QHBox(topFrame);
+ Q3HBox *dummy = new Q3HBox(topFrame);
KPrefsWidTime *dayBegins =
addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
dummy);
//topLayout->addWidget(dayBegins->label(),2,0);
//topLayout->addWidget(dayBegins->spinBox(),2,1);
topLayout->addMultiCellWidget(dummy,0,0,0,1);
topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
topFrame),1,0);
mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
mStartTimeSpin->setSuffix(":00");
topLayout->addWidget(mStartTimeSpin,1,1);
topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
topFrame),2,0);
mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
mDefaultDurationSpin->setSuffix(":00");
topLayout->addWidget(mDefaultDurationSpin,2,1);
QStringList alarmList;
alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
<< i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
3,0);
mAlarmTimeCombo = new QComboBox(topFrame);
mAlarmTimeCombo->insertStringList(alarmList);
topLayout->addWidget(mAlarmTimeCombo,3,1);
- QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
+ Q3GroupBox *workingHoursGroup = new Q3GroupBox(1,Qt::Horizontal,
i18n("Working Hours"),
topFrame);
topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
workingHoursGroup->layout()->setSpacing( 0 );
workingHoursGroup->layout()->setMargin( 4 );
- QHBox *workStartBox = new QHBox(workingHoursGroup);
+ Q3HBox *workStartBox = new Q3HBox(workingHoursGroup);
// workStartBox->setMargin( 0 );
addWidTime(i18n("Daily starting hour:"),
&(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
- QHBox *workEndBox = new QHBox(workingHoursGroup);
+ Q3HBox *workEndBox = new Q3HBox(workingHoursGroup);
//workEndBox->setMargin( 0 );
addWidTime(i18n("Daily ending hour:"),
&(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
- QVBox *excludeBox = new QVBox(workingHoursGroup);
+ Q3VBox *excludeBox = new Q3VBox(workingHoursGroup);
//excludeBox->setMargin( 0 );
addWidBool(i18n("Exclude holidays"),
&(KOPrefs::instance()->mExcludeHolidays),excludeBox);
addWidBool(i18n("Exclude Saturdays"),
&(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
// &(KOPrefs::instance()->mMarcusBainsShowSeconds),
// topFrame);
// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
// topLayout->setRowStretch(6,1);
}
void KOPrefsDialog::setupViewsTab()
{
- QFrame *topFrame = addPage(i18n("Views"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Views"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,1);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
// topLayout->addLayout(dayBeginsLayout,0,0);
// KPrefsWidTime *dayBegins =
// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
// topFrame);
// dayBeginsLayout->addWidget(dayBegins->label());
// dayBeginsLayout->addStretch(1);
// dayBeginsLayout->addWidget(dayBegins->spinBox());
// QBoxLayout *nextDaysLayout = new QHBoxLayout;
// topLayout->addLayout(nextDaysLayout,1,0);
// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
// nextDaysLayout->addStretch(1);
// nextDaysLayout->addWidget(mNextXDaysSpin);
int ii = 0;
KPrefsDialogWidBool *dummy =
addWidBool(i18n("Edit item on doubleclick (if not, show)"),
&(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Highlight current day in agenda"),
&(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
@@ -756,145 +761,145 @@ void KOPrefsDialog::setupViewsTab()
&(KOPrefs::instance()->mWNViewShowsParents),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
passwdk =
addWidBool(i18n("Show location in What's Next view"),
&(KOPrefs::instance()->mWNViewShowLocation),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
passwdk =
addWidBool(i18n("Show Sync Events in WN/Agenda view"),
&(KOPrefs::instance()->mShowSyncEvents),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
KPrefsDialogWidBool *marcusBainsEnabled =
addWidBool(i18n("Show Marcus Bains line"),
&(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
// topLayout->addWidget(hourSizeGroup,ii++,0);
// topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
//topLayout->setRowStretch(11,1);
topFrame = addPage(i18n("ViewChange"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,6,1);
+ topLayout = new Q3GridLayout(topFrame,6,1);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
ii = 0;
dummy =
addWidBool(i18n("Hold fullscreen on view change"),
&(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Hold non-fullscreen on view change"),
&(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
KPrefsDialogWidBool *fullViewTodo =
addWidBool(i18n("Event list view uses full window"),
&(KOPrefs::instance()->mFullViewTodo),topFrame);
topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
KPrefsDialogWidBool *fullViewMonth =
addWidBool(i18n("Next days view uses full window"),
&(KOPrefs::instance()->mFullViewMonth),topFrame);
topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Set agenda to DayBeginsAt on change"),
&(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Set agenda to current time on change"),
&(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Listview uses monthly timespan"),
&(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Highlight selection in Time Edit"),
&(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
topLayout->addWidget( dummy->checkBox(), ii++,0);
topFrame = addPage(i18n("Month View"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,5,1);
+ topLayout = new Q3GridLayout(topFrame,5,1);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
ii = 0;
QLabel *lab;
- QHBox *habo = new QHBox( topFrame );
+ Q3HBox *habo = new Q3HBox( topFrame );
if ( QApplication::desktop()->width() < 320 ) {
lab = new QLabel ( i18n("Show events that recur "), topFrame );
topLayout->addMultiCellWidget(lab,ii, ii,0,1);
ii++;
} else {
new QLabel ( i18n("Show events that recur "), habo );
}
dailyRecur =
addWidBool(i18n("daily"),
&(KOPrefs::instance()->mMonthDailyRecur),habo);
// topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
weeklyRecur =
addWidBool(i18n("weekly"),
&(KOPrefs::instance()->mMonthWeeklyRecur),habo);
topLayout->addMultiCellWidget(habo,ii, ii,0,1);
ii++;
- habo = new QHBox( topFrame );
+ habo = new Q3HBox( topFrame );
if ( QApplication::desktop()->width() < 320 ) {
lab = new QLabel (i18n("Show in every cell ") , topFrame );
topLayout->addMultiCellWidget(lab,ii, ii,0,1);
ii++;
} else {
new QLabel ( i18n("Show in every cell "), habo );
}
weeklyRecur =
addWidBool(i18n("short month"),
&(KOPrefs::instance()->mMonthShowShort),habo);
weeklyRecur =
addWidBool(i18n("icons"),
&(KOPrefs::instance()->mMonthShowIcons),habo);
topLayout->addMultiCellWidget(habo,ii, ii,0,1);
ii++;
#ifdef DESKTOP_VERSION
KPrefsDialogWidBool *enableMonthScroll =
addWidBool(i18n("Enable scrollbars in month view cells"),
&(KOPrefs::instance()->mEnableMonthScroll),topFrame);
topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
#endif
dummy =
addWidBool(i18n("Show Sat/Sun together"),
&(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
KPrefsDialogWidBool *coloredCategoriesInMonthView =
addWidBool(i18n("Month view uses category colors"),
&(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
@@ -904,217 +909,217 @@ void KOPrefsDialog::setupViewsTab()
addWidBool(i18n("Categorie colors are applied to text"),
&(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
coloredCategoriesInMonthView =
addWidBool(i18n("Month view uses day colors"),
&(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
KPrefsWidColor *holidayColor =
addWidColor(i18n("Day color odd months"),
&(KOPrefs::instance()->mMonthViewOddColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
holidayColor =
addWidColor(i18n("Day color even months"),
&(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
holidayColor =
addWidColor(i18n("Color for Sundays + category \"Holiday\""),
&(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
// *********************** Todo View
topFrame = addPage(i18n("Todo View"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,4,1);
+ topLayout = new Q3GridLayout(topFrame,4,1);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
ii = 0;
KPrefsDialogWidBool *showCompletedTodo =
addWidBool(i18n("To-do view shows completed Todos"),
&(KOPrefs::instance()->mShowCompletedTodo),topFrame);
topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
dummy =
addWidBool(i18n("To-do view shows complete as 'xx %'"),
&(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Small To-do view uses smaller font"),
&(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Todo view uses category colors"),
&(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
QWidget* wid = new QWidget( topFrame );
// Todo due today color
KPrefsWidColor *todoDueTodayColor =
addWidColor(i18n("Todo due today color:"),
&(KOPrefs::instance()->mTodoDueTodayColor),wid);
- QHBoxLayout *widLayout = new QHBoxLayout(wid);
+ Q3HBoxLayout *widLayout = new Q3HBoxLayout(wid);
widLayout->addWidget( todoDueTodayColor->label() );
widLayout->addWidget( todoDueTodayColor->button() );
topLayout->addWidget(wid,ii++,0);
//topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
// Todo overdue color
wid = new QWidget( topFrame );
- widLayout = new QHBoxLayout(wid);
+ widLayout = new Q3HBoxLayout(wid);
KPrefsWidColor *todoOverdueColor =
addWidColor(i18n("Todo overdue color:"),
&(KOPrefs::instance()->mTodoOverdueColor),wid);
widLayout->addWidget(todoOverdueColor->label());
widLayout->addWidget(todoOverdueColor->button());
topLayout->addWidget(wid,ii++,0);
dummy =
addWidBool(i18n("Colors are applied to text"),
&(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Allday Agenda view shows todos"),
&(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
topFrame = addPage(i18n("Alarm"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,2,1);
+ topLayout = new Q3GridLayout(topFrame,2,1);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
int iii = 0;
dummy =
addWidBool(i18n("Use internal alarm notification"),
&(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
topLayout->addWidget(dummy->checkBox(),iii++,0);
lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
topLayout->addWidget(lab ,iii++,0);
#ifndef DESKTOP_VERSION
- lab->setAlignment( AlignLeft|WordBreak|AlignTop);
+ lab->setAlignment( Qt::AlignLeft|Qt::TextWordWrap|Qt::AlignTop);
#else
- lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
+ lab->setAlignment( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
#endif
- QHBox* dummyBox = new QHBox(topFrame);
+ Q3HBox* dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Play beeps count:"),dummyBox);
mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- dummyBox = new QHBox(topFrame);
+ dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Beeps interval in sec:"),dummyBox);
mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- dummyBox = new QHBox(topFrame);
+ dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Default suspend time in min:"),dummyBox);
mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- dummyBox = new QHBox(topFrame);
+ dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Auto suspend count:"),dummyBox);
mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- QHBox* hbo = new QHBox ( topFrame );
+ Q3HBox* hbo = new Q3HBox ( topFrame );
mDefaultAlarmFile = new QLineEdit(hbo);
QPushButton * loadTemplate = new QPushButton(hbo);
QPixmap icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileimport16");
else
icon = SmallIcon("fileimport");
loadTemplate->setIconSet (icon ) ;
connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
int size = loadTemplate->sizeHint().height();
loadTemplate->setFixedSize( size, size );
//lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
// topLayout->addWidget(lab ,iii++,0);
lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
topLayout->addWidget(lab ,iii++,0);
topLayout->addWidget(hbo,iii++,0);
// lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
// topLayout->addWidget(lab ,iii++,0);
// #ifndef DESKTOP_VERSION
// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
// #else
// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
// #endif
}
void KOPrefsDialog::selectSoundFile()
{
QString fileName = mDefaultAlarmFile->text();
fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
if ( fileName.length() > 0 )
mDefaultAlarmFile->setText( fileName );
}
void KOPrefsDialog::setupFontsTab()
{
- QFrame *topFrame = addPage(i18n("Fonts"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Fonts"),0,0);
// DesktopIcon("fonts",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,7,3);
topLayout->setSpacing(1);
topLayout->setMargin(3);
KPrefsDialogWidFont * tVFont;
int i = 0;
KPrefsDialogWidFont *timeLabelsFont =
addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
&(KOPrefs::instance()->mDateNavigatorFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
timeLabelsFont =
addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
&(KOPrefs::instance()->mTimeLabelsFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
KPrefsDialogWidFont *timeBarFont =
addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
&(KOPrefs::instance()->mTimeBarFont),topFrame);
topLayout->addWidget(timeBarFont->label(),i,0);
topLayout->addWidget(timeBarFont->preview(),i,1);
topLayout->addWidget(timeBarFont->button(),i,2);
++i;
KPrefsDialogWidFont *marcusBainsFont =
addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
@@ -1123,65 +1128,65 @@ void KOPrefsDialog::setupFontsTab()
topLayout->addWidget(marcusBainsFont->preview(),i,1);
topLayout->addWidget(marcusBainsFont->button(),i,2);
++i;
tVFont =
addWidFont(i18n("Summary"),i18n("Event Viewer:"),
&(KOPrefs::instance()->mEventViewFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
tVFont =
addWidFont(i18n("Details"),i18n("EditorBox:"),
&(KOPrefs::instance()->mEditBoxFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
topLayout->setColStretch(1,1);
topLayout->setRowStretch(4,1);
i = 0;
topFrame = addPage(i18n("View Fonts"),0,
DesktopIcon("fonts",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,7,3);
+ topLayout = new Q3GridLayout(topFrame,7,3);
topLayout->setSpacing(1);
topLayout->setMargin(3);
tVFont =
addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
&(KOPrefs::instance()->mWhatsNextFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
KPrefsDialogWidFont *agendaViewFont =
addWidFont(i18n("Event text"),i18n("Agenda view:"),
&(KOPrefs::instance()->mAgendaViewFont),topFrame);
topLayout->addWidget(agendaViewFont->label(),i,0);
topLayout->addWidget(agendaViewFont->preview(),i,1);
topLayout->addWidget(agendaViewFont->button(),i,2);
++i;
KPrefsDialogWidFont *monthViewFont =
addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
topLayout->addWidget(monthViewFont->label(),i,0);
topLayout->addWidget(monthViewFont->preview(),i,1);
topLayout->addWidget(monthViewFont->button(),i,2);
++i;
KPrefsDialogWidFont *lVFont =
addWidFont(i18n("Event"),i18n("List View:"),
&(KOPrefs::instance()->mListViewFont),topFrame);
topLayout->addWidget(lVFont->label(),i,0);
@@ -1191,78 +1196,78 @@ void KOPrefsDialog::setupFontsTab()
tVFont =
addWidFont(i18n("ToDo"),i18n("ToDoView:"),
&(KOPrefs::instance()->mTodoViewFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
tVFont =
addWidFont(i18n("Today"),i18n("JournalView:"),
&(KOPrefs::instance()->mJornalViewFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
topLayout->setColStretch(1,1);
topLayout->setRowStretch(4,1);
}
void KOPrefsDialog::setupColorsTab()
{
- QFrame *topFrame = addPage(i18n("Colors"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Colors"),0,0);
// DesktopIcon("colorize",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2);
// topLayout->setSpacing(spacingHint());
// topLayout->setMargin(marginHint());
topLayout->setSpacing(2);
topLayout->setMargin(3);
int ii = 1;
- QGroupBox *categoryGroup ;
+ Q3GroupBox *categoryGroup ;
- categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
+ categoryGroup = new Q3GroupBox(1,Qt::Vertical,i18n("Categories"),
topFrame);
topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
mCategoryCombo = new QComboBox(categoryGroup);
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
mCategoryButton = new KColorButton(categoryGroup);
connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
updateCategoryColor();
// Holiday Color
KPrefsWidColor *holidayColor =
addWidColor(i18n("Holiday color:"),
&(KOPrefs::instance()->mHolidayColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
// Highlight Color
KPrefsWidColor *highlightColor =
addWidColor(i18n("Highlight color:"),
&(KOPrefs::instance()->mHighlightColor),topFrame);
topLayout->addWidget(highlightColor->label(),ii,0);
topLayout->addWidget(highlightColor->button(),ii++,1);
// Event color
KPrefsWidColor *eventColor =
addWidColor(i18n("Default event color:"),
&(KOPrefs::instance()->mEventColor),topFrame);
topLayout->addWidget(eventColor->label(),ii,0);
@@ -1297,129 +1302,129 @@ void KOPrefsDialog::setupColorsTab()
KPrefsWidColor * workingHoursColor2 =
addWidColor(i18n("Frames, labels, etc.:"),
&(KOPrefs::instance()->mAppColor2),topFrame);
topLayout->addWidget(workingHoursColor2->label(),ii,0);
topLayout->addWidget(workingHoursColor2->button(),ii++,1);
}
void KOPrefsDialog::setCategoryColor()
{
mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
}
void KOPrefsDialog::updateCategoryColor()
{
QString cat = mCategoryCombo->currentText();
QColor *color = mCategoryDict.find(cat);
if (!color) {
color = KOPrefs::instance()->categoryColor(cat);
}
if (color) {
mCategoryButton->setColor(*color);
}
}
void KOPrefsDialog::setupPrinterTab()
{
mPrinterTab = addPage(i18n("Printing"),0,
DesktopIcon("fileprint",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(mPrinterTab,5,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
topLayout->setRowStretch(4,1);
}
void KOPrefsDialog::setupGroupSchedulingTab()
{
#if 0
- QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
+ Q3Frame *topFrame = addPage(i18n("Group Scheduling"),0,
DesktopIcon("personal",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
#if 0
KPrefsWidRadios *schedulerGroup =
addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
topFrame);
schedulerGroup->addRadio("Dummy"); // Only for debugging
schedulerGroup->addRadio(i18n("Mail client"));
topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
#endif
KPrefsWidRadios *sendGroup =
addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
topFrame);
sendGroup->addRadio(i18n("Send to outbox"));
sendGroup->addRadio(i18n("Send directly"));
topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
- mAMails = new QListView(topFrame);
+ mAMails = new Q3ListView(topFrame);
mAMails->addColumn(i18n("Email"),300);
topLayout->addMultiCellWidget(mAMails,3,3,0,1);
topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
aEmailsEdit = new QLineEdit(topFrame);
aEmailsEdit->setEnabled(false);
topLayout->addWidget(aEmailsEdit,4,1);
QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
topLayout->addWidget(add,5,0);
QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
topLayout->addWidget(del,5,1);
//topLayout->setRowStretch(2,1);
connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
- connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
+ connect(mAMails,SIGNAL(selectionChanged(Q3ListViewItem *)),SLOT(updateInput()));
#endif
}
void KOPrefsDialog::setupGroupAutomationTab()
{
return;
- QFrame *topFrame = addPage(i18n("Group Automation"),0,
+ Q3Frame *topFrame = addPage(i18n("Group Automation"),0,
DesktopIcon("personal",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,1);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
KPrefsWidRadios *autoRefreshGroup =
addWidRadios(i18n("Auto Send Refresh"),
&(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
autoRefreshGroup->addRadio(i18n("Never"));
autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
//autoRefreshGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
KPrefsWidRadios *autoInsertGroup =
addWidRadios(i18n("Auto Insert IMIP Replies"),
&(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
autoInsertGroup->addRadio(i18n("Never"));
autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
//autoInsertGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
KPrefsWidRadios *autoRequestGroup =
addWidRadios(i18n("Auto Insert IMIP Requests"),
&(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
autoRequestGroup->addRadio(i18n("Never"));
autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
//autoInsertGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
KPrefsWidRadios *autoFreeBusyGroup =
addWidRadios(i18n("Auto Send FreeBusy Information"),
&(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
autoFreeBusyGroup->addRadio(i18n("Never"));
autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
@@ -1514,65 +1519,65 @@ void KOPrefsDialog::usrWriteConfig()
//KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
//KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
KOPrefs::instance()->setFullName(mNameEdit->text());
KOPrefs::instance()->setEmail(mEmailEdit->text());
KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
QDate date;
date = mStartDateSavingEdit->date();
int sub = 0;
if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
sub = 1;
KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
date = mEndDateSavingEdit->date();
if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
sub = 1;
else
sub = 0;
KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
// KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
//KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
- QDictIterator<QColor> it(mCategoryDict);
+ Q3DictIterator<QColor> it(mCategoryDict);
while (it.current()) {
KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
++it;
}
KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
KOPrefs::instance()->mAdditionalMails.clear();
// QListViewItem *item;
// item = mAMails->firstChild();
// while (item)
// {
// KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
// item = item->nextSibling();
// }
KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
}
void KOPrefsDialog::updateCategories()
{
mCategoryCombo->clear();
mCategoryDict.clear();
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
updateCategoryColor();
}
@@ -1654,72 +1659,72 @@ void KOPrefsDialog::updateItem()
void KOPrefsDialog::updateInput()
{
// QListViewItem *item;
// item = mAMails->selectedItem();
// if (!item) return;
// aEmailsEdit->setEnabled(true);
// aEmailsEdit->setText(item->text(0));
}
void KOPrefsDialog::updateTimezoneOffset( int index )
{
/*
qDebug("updateTimezoneOffset %d ", index);
if ( index < 24 ) {
mTimezoneOffsetSpin->setEnabled ( false );
mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
} else {
if ( index == 24 ) {
mTimezoneOffsetSpin->setEnabled ( true );
mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
} else {
mTimezoneOffsetSpin->setEnabled ( false );
mTimezoneOffsetSpin->setValue( 0 );
}
}
*/
}
void KOPrefsDialog::setupTimeZoneTab()
{
- QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Time Zone"),0,0);
// DesktopIcon("clock",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
- QHBox *timeZoneBox = new QHBox( topFrame );
+ Q3HBox *timeZoneBox = new Q3HBox( topFrame );
topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
new QLabel( i18n("Timezone:"), timeZoneBox );
mTimeZoneCombo = new QComboBox( timeZoneBox );
if ( QApplication::desktop()->width() < 300 ) {
mTimeZoneCombo->setMaximumWidth(150);
}
QStringList list;
list = KGlobal::locale()->timeZoneList();
mTimeZoneCombo->insertStringList(list);
// find the currently set time zone and select it
QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
int nCurrentlySet = 11;
for (int i = 0; i < mTimeZoneCombo->count(); i++)
{
if (mTimeZoneCombo->text(i) == sCurrentlySet)
{
nCurrentlySet = i;
break;
}
}
mTimeZoneCombo->setCurrentItem(nCurrentlySet);
int iii = 1;
KPrefsDialogWidBool *sb =
addWidBool(i18n("Timezone has daylight saving"),
&(KOPrefs::instance()->mUseDaylightsaving),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
topLayout->addMultiCellWidget(lab, iii,iii,0,1);
diff --git a/kmicromail/koprefsdialog.h b/kmicromail/koprefsdialog.h
index 7fa9261..042af3f 100644
--- a/kmicromail/koprefsdialog.h
+++ b/kmicromail/koprefsdialog.h
@@ -1,61 +1,63 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOPREFSDIALOG_H
#define _KOPREFSDIALOG_H
-#include <qframe.h>
-#include <qdict.h>
+#include <q3frame.h>
+#include <q3dict.h>
#include <qcolor.h>
-#include <qlistview.h>
+#include <q3listview.h>
+//Added by qt3to4:
+#include <QLabel>
#include <kdialogbase.h>
#include <libkdepim/kprefsdialog.h>
#include <libkdepim/kdateedit.h>
#include <kcmconfigs/kdepimconfigwidget.h>
class KColorButton;
class QSpinBox;
class QSlider;
class KURLRequester;
class QComboBox;
class QLineEdit;
class QStringList;
/** Dialog to change the korganizer configuration.
*/
class KOPrefsDialog : public KPrefsDialog
{
Q_OBJECT
public:
/** Initialize dialog and pages */
KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false);
~KOPrefsDialog();
protected:
void usrReadConfig();
void usrWriteConfig();
void setupMainTab();
void setupGlobalTab();
void setupMailTab();
@@ -90,90 +92,90 @@ protected:
//additional emails
void addItem();
void removeItem();
void updateItem();
void updateInput();
*/
protected:
void usrReadConfig();
void usrWriteConfig();
void setupMainTab();
void setupTimeTab();
void setupTimeZoneTab();
void setupLocaleTab();
void setupLocaleDateTab();
void setupFontsTab();
void setupColorsTab();
void setupViewsTab();
void setupDisplayTab();
void setupPrinterTab();
void setupGroupSchedulingTab();
void setupGroupAutomationTab();
void setupSyncTab();
void setupSyncAlgTab();
void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
private:
KPrefsWidBool *mEnableGroupScheduling;
KPrefsWidBool *mEnableProjectView;
- QFrame *mPrinterTab;
+ Q3Frame *mPrinterTab;
QLineEdit *nameEdit;
QLineEdit *emailEdit;
QComboBox *timeCombo;
QComboBox *tzCombo;
// widgets holding preferences data
QLineEdit *mNameEdit;
QLineEdit *mEmailEdit;
QLabel *mNameLabel;
QLabel *mEmailLabel;
QLineEdit *mAdditionalEdit;
QSpinBox *mAutoSaveIntervalSpin;
QSpinBox *mPrioSpin;
// QListView *mAMails;
QLineEdit *aEmailsEdit;
QComboBox *mTimeZoneCombo;
QStringList tzonenames;
QSpinBox *mStartTimeSpin;
QSpinBox *mDefaultDurationSpin;
QComboBox *mAlarmTimeCombo;
QComboBox *mCategoryCombo;
KColorButton *mCategoryButton;
- QDict<QColor> mCategoryDict;
+ Q3Dict<QColor> mCategoryDict;
QSlider *mHourSizeSlider;
QSpinBox *mNextXDaysSpin;
QSpinBox *mWhatsNextSpin;
QLineEdit * mRemoteIPEdit;
QLineEdit * mRemoteUser;
QLineEdit * mRemotePassWd;
QLineEdit * mRemoteFile;
QLineEdit * mLocalTempFile;
QWidget* mSetupSyncAlgTab;
QLineEdit * mUserDateFormatLong;
QLineEdit * mUserDateFormatShort;
QSpinBox *mTimezoneOffsetSpin;
QSpinBox *mDaylightsavingStart;
QSpinBox *mDaylightsavingEnd;
KDateEdit* mStartDateSavingEdit;
KDateEdit* mEndDateSavingEdit;
QSpinBox * mAlarmPlayBeeps;
QSpinBox * mAlarmSuspendTime;
QSpinBox * mAlarmSuspendCount;
QSpinBox * mAlarmBeepInterval;
QLineEdit * mDefaultAlarmFile;
#endif
};
#endif
diff --git a/kmicromail/libetpan/libetpan.pro b/kmicromail/libetpan/libetpan.pro
index dfafa07..4b2654e 100644
--- a/kmicromail/libetpan/libetpan.pro
+++ b/kmicromail/libetpan/libetpan.pro
@@ -1,38 +1,38 @@
######################################################################
# Automatically generated by qmake (1.07a) Thu Jul 1 00:54:03 2004
######################################################################
TEMPLATE = lib
-TARGET = microlibetpan
+TARGET = xmicrolibetpan
OBJECTS_DIR = obj
MOC_DIR = moc
DESTDIR=../../bin
DEPENDPATH += generic \
imap \
imf \
maildir \
mbox \
mh \
mime \
nntp \
pop3 \
smtp \
tests \
tools \
include/libetpan
INCLUDEPATH += . \
generic \
include \
tools \
imf \
imap \
mime \
maildir \
mbox \
mh \
nntp \
pop3 \
smtp \
tests
diff --git a/kmicromail/libetpan/libetpanE.pro b/kmicromail/libetpan/libetpanE.pro
index 7f37948..ea22692 100644
--- a/kmicromail/libetpan/libetpanE.pro
+++ b/kmicromail/libetpan/libetpanE.pro
@@ -1,38 +1,38 @@
######################################################################
# Automatically generated by qmake (1.07a) Thu Jul 1 00:54:03 2004
######################################################################
TEMPLATE = lib
-TARGET = microlibetpan
+TARGET = xmicrolibetpan
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
DEPENDPATH += generic \
imap \
imf \
maildir \
mbox \
mh \
mime \
nntp \
pop3 \
smtp \
tests \
tools \
include/libetpan
INCLUDEPATH += . \
generic \
include \
tools \
imf \
imap \
mime \
maildir \
mbox \
mh \
nntp \
pop3 \
smtp \
tests
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp
index 870985e..746d2ae 100644
--- a/kmicromail/libmailwrapper/abstractmail.cpp
+++ b/kmicromail/libmailwrapper/abstractmail.cpp
@@ -1,49 +1,51 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "abstractmail.h"
#include "imapwrapper.h"
#include "pop3wrapper.h"
#include "nntpwrapper.h"
#include "mhwrapper.h"
#include "mailtypes.h"
#include <qpe/global.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qapplication.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <klocale.h>
#include <kdecore/kstandarddirs.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <stdlib.h>
#include <libetpan/mailmime_content.h>
#include <libetpan/mailmime.h>
using namespace Opie::Core;
AbstractMail* AbstractMail::getWrapper(IMAPaccount *a)
{
return new IMAPwrapper(a);
}
AbstractMail* AbstractMail::getWrapper(POP3account *a)
{
return new POP3wrapper(a);
}
AbstractMail* AbstractMail::getWrapper(NNTPaccount *a)
{
return new NNTPwrapper(a);
}
AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name)
{
return new MHwrapper(a,name);
}
AbstractMail* AbstractMail::getWrapper(Account*a)
{
if (!a) return 0;
switch (a->getType()) {
case MAILLIB::A_IMAP:
return new IMAPwrapper((IMAPaccount*)a);
break;
@@ -82,200 +84,200 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin
encodedString* result = new encodedString();
if (err == MAILIMF_NO_ERROR) {
result->setContent(result_text,target_length);
}
//odebug << "Decode string finished" << oendl;
return result;
}
QString AbstractMail::convert_String(const char*text)
{
size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString result(text);
//qDebug("convert_String %s ", text);
//err = mailmime_encoded_phrase_parse("iso-8859-1",
// text, strlen(text),&index, "iso-8859-1",&res);
err = mailmime_encoded_phrase_parse("iso-8859-1",
text, strlen(text),&index, "utf-8",&res);
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
result = QString::fromUtf8(res);
}
//qDebug("convert_String:%s ",result.latin1() );
if (res) free(res);
return result;
}
/* cp & paste from launcher */
QString AbstractMail::gen_attachment_id()
{
QFile file( "/proc/sys/kernel/random/uuid" );
- if (!file.open(IO_ReadOnly ) )
+ if (!file.open(QIODevice::ReadOnly ) )
return QString::null;
- QTextStream stream(&file);
+ Q3TextStream stream(&file);
return "{" + stream.read().stripWhiteSpace() + "}";
}
int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool)
{
return 0;
}
QString AbstractMail::defaultLocalfolder()
{
// QString f = getenv( "HOME" );
QString f = locateLocal( "data", "kopiemail/localmail");
// f += "/Applications/opiemail/localmail";
return f;
}
QString AbstractMail::draftFolder()
{
return QString("Drafts");
}
/* temporary - will be removed when implemented in all classes */
-void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &)
+void AbstractMail::deleteMails(const QString &,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &)
{
}
-void AbstractMail::deleteMailList(const QValueList<RecMailP>&target)
+void AbstractMail::deleteMailList(const Q3ValueList<RecMailP>&target)
{
//qDebug("AbstractMail::deleteMailList:: Please reimplement! ");
// this is currently re-implemented in pop3wrapper and imapwrapper
int iii = 0;
int count = target.count();
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP mail = (*target.at( iii ));
deleteMail(mail);
++iii;
}
}
void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail )
{
//qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1());
// get local folder
Account * acc = getAccount();
if ( !acc ) return;
QString lfName = acc->getLocalFolder();
if ( lfName.isEmpty() )
lfName = acc->getAccountName();
// create local folder
if ( !targetMail->createMbox(lfName))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName));
return;
}
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
listMessages(fromFolder->getName(),t,acc->getMaxMailSize() );
if ( t.count() == 0 ) {
qDebug("There are no new messages %s", fromFolder->getName().latin1());
Global::statusMessage(i18n("There are no new messages"));
return;
}
Global::statusMessage(i18n("%1 :Downloading mails..."). arg(acc->getAccountName()));
qDebug(i18n("%1 :Downloading mails..."). arg(acc->getAccountName()));
qApp->processEvents();
- QValueList<RecMailP> e;
+ Q3ValueList<RecMailP> e;
targetMail->listMessages(lfName,e,acc->getMaxMailSize() );
//qDebug("target has mails %d ", e.count());
- QValueList<RecMailP> n;
+ Q3ValueList<RecMailP> n;
int iii = 0;
int count = t.count();
while (iii < count ) {
RecMailP r = (*t.at( iii ));
bool found = false;
int jjj = 0;
int countE = e.count();
while (jjj < countE ) {
RecMailP re = (*e.at( jjj ));
if ( re->isEqual(r) ) {
found = true;
break;
}
++jjj;
}
if ( !found ) {
//qDebug("AAAdate *%s* ", r->isodate.latin1() );
n.append( r );
}
++iii;
}
qDebug("Downloaded %d messages ",n.count() );
if ( n.count() == 0 ) {
Global::statusMessage(i18n("There are no new messages"));
return;
}
mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer());
Global::statusMessage(i18n("Downloaded %1 messages").arg(n.count()));
#if 0
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
listMessages(fromFolder->getName(),t, maxSizeInKb);
mvcpMailList( t,targetFolder,targetWrapper,moveit);
#endif
}
void AbstractMail::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
{
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
listMessages(fromFolder->getName(),t, maxSizeInKb);
mvcpMailList( t,targetFolder,targetWrapper,moveit);
}
-void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t,
+void AbstractMail::mvcpMailList(const Q3ValueList<RecMailP>& t,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
int iii = 0;
int count = t.count();
if ( count == 0 )
return;
// wel, processevents is qite strange, we need a widget for getting
// Global::statusMessage(i18n("Copy2 message %1").arg(iii)); displaye
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Copying..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Copy message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP r = (*t.at( iii ));
st = fetchRawBody(r);
if (st) {
targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
delete st;
}
++iii;
}
if (moveit) {
deleteMailList( t );
//deleteAllMail(fromFolder);
}
}
void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit)
{
encodedString*st = 0;
st = fetchRawBody(mail);
if (st) {
targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder);
delete st;
}
if (moveit) {
deleteMail(mail);
}
diff --git a/kmicromail/libmailwrapper/abstractmail.h b/kmicromail/libmailwrapper/abstractmail.h
index 2069ca1..f606b1f 100644
--- a/kmicromail/libmailwrapper/abstractmail.h
+++ b/kmicromail/libmailwrapper/abstractmail.h
@@ -1,79 +1,81 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __abstract_mail_
#define __abstract_mail_
#include "maildefines.h"
#include "settings.h"
#include <qobject.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <opie2/osmartpointer.h>
#include "mailtypes.h"
#include "mailwrapper.h"
class IMAPwrapper;
class POP3wrapper;
class Folder;
class encodedString;
struct folderStat;
class AbstractMail:public QObject
{
Q_OBJECT
public:
AbstractMail(){};
virtual ~AbstractMail(){}
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0;
- virtual void listMessages(const QString & mailbox,QValueList<RecMailP>&target, int sizeInKb = 0 )=0;
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders()=0;
+ virtual void listMessages(const QString & mailbox,Q3ValueList<RecMailP>&target, int sizeInKb = 0 )=0;
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0;
virtual RecBodyP fetchBody(const RecMailP&mail)=0;
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part)=0;
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part)=0;
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part)=0;
virtual encodedString* fetchRawBody(const RecMailP&mail)=0;
virtual void deleteMail(const RecMailP&mail)=0;
- virtual void deleteMailList(const QValueList<RecMailP>&target);
+ virtual void deleteMailList(const Q3ValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail)=0;
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&)=0;
- virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> >&target);
+ virtual void deleteMails(const QString & FolderName,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&)=0;
virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0;
void downloadNewMails(const FolderP&fromFolder,AbstractMail*targetWrapper );
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int sizeInKb = 0);
- virtual void mvcpMailList(const QValueList<RecMailP>& t,
+ virtual void mvcpMailList(const Q3ValueList<RecMailP>& t,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void cleanMimeCache(){};
/* mail box methods */
/* parameter is the box to create.
* if the implementing subclass has prefixes,
* them has to be appended automatic.
*/
virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0,
const QString& delemiter="/",bool getsubfolder=false);
virtual void logout()=0;
virtual Account* getAccount() = 0;
static AbstractMail* getWrapper(IMAPaccount *a);
static AbstractMail* getWrapper(POP3account *a);
static AbstractMail* getWrapper(NNTPaccount *a);
/* mbox only! */
static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders");
static AbstractMail* getWrapper(Account*a);
static QString defaultLocalfolder();
static QString draftFolder();
virtual MAILLIB::ATYPE getType()const=0;
virtual const QString&getName()const=0;
protected:
static encodedString*decode_String(const encodedString*text,const QString&enc);
static QString convert_String(const char*text);
static QString gen_attachment_id();
diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp
index 2d213fe..ddad21b 100644
--- a/kmicromail/libmailwrapper/generatemail.cpp
+++ b/kmicromail/libmailwrapper/generatemail.cpp
@@ -1,41 +1,43 @@
#include "generatemail.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
//#include <qt.h>
#include <stdlib.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <Q3CString>
using namespace Opie::Core;
const char* Generatemail::USER_AGENT="KOpieMail 33 1/3";
Generatemail::Generatemail()
{
mCharset = "iso-8859-1";
}
Generatemail::~Generatemail()
{
}
void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) {
clistiter *it, *it2;
for ( it = clist_begin( addr_list->ad_list ); it; it = it->next ) {
mailimf_address *addr;
addr = (mailimf_address *) it->data;
if ( addr->ad_type == MAILIMF_ADDRESS_MAILBOX ) {
esmtp_address_list_add( list, addr->ad_data.ad_mailbox->mb_addr_spec, 0, NULL );
} else if ( addr->ad_type == MAILIMF_ADDRESS_GROUP ) {
clist *l = addr->ad_data.ad_group->grp_mb_list->mb_list;
for ( it2 = clist_begin( l ); it2; it2 = it2->next ) {
mailimf_mailbox *mbox;
mbox = (mailimf_mailbox *) it2->data;
esmtp_address_list_add( list, mbox->mb_addr_spec, 0, NULL );
}
}
}
}
@@ -199,89 +201,89 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
}
}
}
return filePart; // Success :)
}
void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files ) {
const Attachment *it;
unsigned int count = files.count();
for ( unsigned int i = 0; i < count; ++i ) {
mailmime *filePart;
int err;
it = ((QList<Attachment>)files).at(i);
filePart = buildFilePart( it->getFileName(), it->getMimeType(),"" );
if ( filePart == NULL ) {
continue;
}
err = mailmime_smart_add_part( message, filePart );
if ( err != MAILIMF_NO_ERROR ) {
mailmime_free( filePart );
}
}
}
mailmime *Generatemail::buildTxtPart(const QString&str ) {
mailmime *txtPart;
mailmime_fields *fields;
mailmime_content *content;
mailmime_parameter *param;
int err;
- QCString __str;
+ Q3CString __str;
//qDebug(" Generatemail::buildTxtPart %s", str.latin1());
param = mailmime_parameter_new( strdup( "charset" ),
strdup( mCharset.latin1() ) );
if ( param == NULL )
goto err_free;
content = mailmime_content_new_with_str( "text/plain" );
if ( content == NULL )
goto err_free_param;
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR )
goto err_free_content;
fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL )
goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
if ( txtPart == NULL )
goto err_free_fields;
{
//__str = str.utf8();
- __str = QCString (str.latin1());
+ __str = Q3CString (str.latin1());
err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() );
}
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
return txtPart; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_fields:
mailmime_fields_free( fields );
err_free_content:
mailmime_content_free( content );
err_free_param:
mailmime_parameter_free( param );
err_free:
;
return NULL; // Error :(
}
mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
return mailimf_mailbox_new( strdup( name.latin1() ),
strdup( mail.latin1() ) );
}
mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Mail>&mail )
{
mailimf_fields *fields = NULL;
mailimf_field *xmailer = NULL;
mailimf_mailbox *sender=0,*fromBox=0;
mailimf_mailbox_list *from=0;
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index 0b6adf7..633ab42 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -1,40 +1,42 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "genericwrapper.h"
#include <libetpan/libetpan.h>
#include "mailtypes.h"
#include <kconfig.h>
#include <kglobal.h>
#include <kstandarddirs.h>
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace Opie::Core;
Genericwrapper::Genericwrapper()
: AbstractMail()
{
bodyCache.clear();
m_storage = 0;
m_folder = 0;
}
Genericwrapper::~Genericwrapper()
{
if (m_folder) {
mailfolder_free(m_folder);
}
if (m_storage) {
mailstorage_free(m_storage);
}
cleanMimeCache();
}
const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
{
QDate da (date->dt_year,date->dt_month, date->dt_day );
QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
QDateTime dt ( da ,ti );
int addsec = -date->dt_zone*36;
//qDebug("adsec1 %d ",addsec );
dt = dt.addSecs( addsec );
int off = KGlobal::locale()->localTimeOffset( dt );
//qDebug("adsec2 %d ",off*60 );
@@ -153,185 +155,185 @@ void Genericwrapper::fillParameters(RecPartP&target,clist*parameters)
}
QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
{
QString enc="7bit";
if (!aEnc) return enc;
switch(aEnc->enc_type) {
case MAILMIME_MECHANISM_7BIT:
enc = "7bit";
break;
case MAILMIME_MECHANISM_8BIT:
enc = "8bit";
break;
case MAILMIME_MECHANISM_BINARY:
enc = "binary";
break;
case MAILMIME_MECHANISM_QUOTED_PRINTABLE:
enc = "quoted-printable";
break;
case MAILMIME_MECHANISM_BASE64:
enc = "base64";
break;
case MAILMIME_MECHANISM_TOKEN:
default:
if (aEnc->enc_token) {
enc = QString(aEnc->enc_token);
}
break;
}
return enc;
}
-void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
+void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,Q3ValueList<int>recList,unsigned int current_rec,int current_count)
{
if (current_rec >= 10) {
; // odebug << "too deep recursion!" << oendl;
}
if (!message || !mime) {
return;
}
int r;
char*data = 0;
size_t len;
clistiter * cur = 0;
QString b;
RecPartP part = new RecPart();
switch (mime->mm_type) {
case MAILMIME_SINGLE:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
countlist.append(current_count);
r = mailmessage_fetch_section(message,mime,&data,&len);
part->setSize(len);
part->setPositionlist(countlist);
b = gen_attachment_id();
part->setIdentifier(b);
fillSingleBody(part,message,mime);
if (part->Type()=="text" && target->Bodytext().isNull()) {
encodedString*rs = new encodedString();
rs->setContent(data,len);
encodedString*res = decode_String(rs,part->Encoding());
if (countlist.count()>2) {
bodyCache[b]=rs;
target->addPart(part);
} else {
delete rs;
}
b = QString(res->Content());
delete res;
size_t index = 0;
char*resu = 0;
int err = MAILIMF_NO_ERROR;
QString charset = part->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
#if 0
if (false ) {
//if ( !charset.isEmpty() ) {
target->setCharset( charset );
err = mailmime_encoded_phrase_parse(charset.latin1(),
b.latin1(), b.length(),&index, "utf-8",&resu);
if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
//qDebug("res %d %s ", index, resu);
b = QString::fromUtf8(resu);
}
if (resu) free(resu);
}
#endif
target->setBodytext(b);
target->setDescription(part);
} else {
bodyCache[b]=new encodedString(data,len);
target->addPart(part);
}
}
break;
case MAILMIME_MULTIPLE:
{
unsigned int ccount = 1;
mailmime*cbody=0;
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
cbody = (mailmime*)clist_content(cur);
if (cbody->mm_type==MAILMIME_MULTIPLE) {
RecPartP targetPart = new RecPart();
targetPart->setType("multipart");
countlist.append(current_count);
targetPart->setPositionlist(countlist);
target->addPart(targetPart);
}
traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
if (cbody->mm_type==MAILMIME_MULTIPLE) {
countlist = recList;
}
++ccount;
}
}
break;
case MAILMIME_MESSAGE:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
countlist.append(current_count);
/* the own header is always at recursion 0 - we don't need that */
if (current_rec > 0) {
part->setPositionlist(countlist);
r = mailmessage_fetch_section(message,mime,&data,&len);
part->setSize(len);
part->setPositionlist(countlist);
b = gen_attachment_id();
part->setIdentifier(b);
part->setType("message");
part->setSubtype("rfc822");
bodyCache[b]=new encodedString(data,len);
target->addPart(part);
}
if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
}
}
break;
}
}
RecBodyP Genericwrapper::parseMail( mailmessage * msg )
{
int err = MAILIMF_NO_ERROR;
//mailmime_single_fields fields;
/* is bound to msg and will be freed there */
mailmime * mime=0;
RecBodyP body = new RecBody();
//memset(&fields, 0, sizeof(struct mailmime_single_fields));
err = mailmessage_get_bodystructure(msg,&mime);
- QValueList<int>recList;
+ Q3ValueList<int>recList;
traverseBody(body,msg,mime,recList);
return body;
}
QString Genericwrapper::parseAddressList( mailimf_address_list *list )
{
QString result( "" );
bool first = true;
if (list == 0) return result;
for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
mailimf_address *addr = (mailimf_address *) current->data;
if ( !first ) {
result.append( "," );
} else {
first = false;
}
switch ( addr->ad_type ) {
case MAILIMF_ADDRESS_MAILBOX:
result.append( parseMailbox( addr->ad_data.ad_mailbox ) );
break;
case MAILIMF_ADDRESS_GROUP:
result.append( parseGroup( addr->ad_data.ad_group ) );
break;
default:
; // odebug << "Generic: unkown mailimf address type" << oendl;
break;
}
}
@@ -418,65 +420,65 @@ QString Genericwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
void Genericwrapper::cleanMimeCache()
{
QMap<QString,encodedString*>::Iterator it = bodyCache.begin();
for (;it!=bodyCache.end();++it) {
encodedString*t = it.data();
//it.setValue(0);
if (t) delete t;
}
bodyCache.clear();
; // odebug << "Genericwrapper: cache cleaned" << oendl;
}
QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies)
{
QStringList res;
if (!in_replies || !in_replies->mid_list) return res;
clistiter * current = 0;
for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) {
QString h((char*)current->data);
while (h.length()>0 && h[0]=='<') {
h.remove(0,1);
}
while (h.length()>0 && h[h.length()-1]=='>') {
h.remove(h.length()-1,1);
}
if (h.length()>0) {
res.append(h);
}
}
return res;
}
-void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb)
+void Genericwrapper::parseList(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to, int maxSizeInKb)
{
int r;
mailmessage_list * env_list = 0;
r = mailsession_get_messages_list(session,&env_list);
if (r != MAIL_NO_ERROR) {
; // odebug << "Error message list" << oendl;
return;
}
r = mailsession_get_envelopes_list(session, env_list);
if (r != MAIL_NO_ERROR) {
; // odebug << "Error filling message list" << oendl;
if (env_list) {
mailmessage_list_free(env_list);
}
return;
}
mailimf_references * refs = 0;
mailimf_in_reply_to * in_replies = 0;
uint32_t i = 0;
for(; i < carray_count(env_list->msg_tab) ; ++i) {
mailmessage * msg;
QBitArray mFlags(7);
msg = (mailmessage*)carray_get(env_list->msg_tab, i);
if (msg->msg_fields == NULL) {
//; // odebug << "could not fetch envelope of message " << i << "" << oendl;
continue;
}
RecMailP mail = new RecMail();
mail->setWrapper(this);
mail_flags * flag_result = 0;
r = mailmessage_get_flags(msg,&flag_result);
if (r == MAIL_ERROR_NOT_IMPLEMENTED) {
diff --git a/kmicromail/libmailwrapper/genericwrapper.h b/kmicromail/libmailwrapper/genericwrapper.h
index c35a6da..a50161d 100644
--- a/kmicromail/libmailwrapper/genericwrapper.h
+++ b/kmicromail/libmailwrapper/genericwrapper.h
@@ -1,68 +1,70 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __GENERIC_WRAPPER_H
#define __GENERIC_WRAPPER_H
#include "abstractmail.h"
#include <qmap.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libetpan/clist.h>
class RecMail;
class RecBody;
class encodedString;
struct mailpop3;
struct mailmessage;
struct mailmime;
struct mailmime_mechanism;
struct mailimf_mailbox_list;
struct mailimf_mailbox;
struct mailimf_date_time;
struct mailimf_group;
struct mailimf_address_list;
struct mailsession;
struct mailstorage;
struct mailfolder;
struct mailimf_in_reply_to;
/* this class hold just the funs shared between
* mbox and pop3 (later mh, too) mail access.
* it is not desigend to make a instance of it!
*/
class Genericwrapper : public AbstractMail
{
Q_OBJECT
public:
Genericwrapper();
virtual ~Genericwrapper();
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part);
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part);
virtual void cleanMimeCache();
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&){return 1;}
virtual void logout(){};
virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
static const QDateTime parseDateTime( mailimf_date_time *date );
protected:
RecBodyP parseMail( mailmessage * msg );
QString parseMailboxList( mailimf_mailbox_list *list );
QString parseMailbox( mailimf_mailbox *box );
QString parseGroup( mailimf_group *group );
QString parseAddressList( mailimf_address_list *list );
- void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);
+ void traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,Q3ValueList<int>recList,unsigned int current_rek=0,int current_count=1);
static void fillSingleBody(RecPartP&target,mailmessage*message,mailmime*mime);
static void fillParameters(RecPartP&target,clist*parameters);
static QString getencoding(mailmime_mechanism*aEnc);
- virtual void parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0);
+ virtual void parseList(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to=false, int maxSizeInKb = 0);
QStringList parseInreplies(mailimf_in_reply_to * in_replies);
QString msgTempName;
unsigned int last_msg_id;
QMap<QString,encodedString*> bodyCache;
mailstorage * m_storage;
mailfolder*m_folder;
};
#endif
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 4f0c849..f73f4cc 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -1,41 +1,43 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include <stdlib.h>
#include <libetpan/libetpan.h>
#include <qpe/global.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "imapwrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include "genericwrapper.h"
#include <kglobal.h>
using namespace Opie::Core;
int IMAPwrapper::mMax = 0;
int IMAPwrapper::mCurrent = 0;
IMAPwrapper::IMAPwrapper( IMAPaccount *a )
: AbstractMail()
{
account = a;
m_imap = 0;
m_Lastmbox = "";
mCurrent = 0;
mMax = 0;
}
IMAPwrapper::~IMAPwrapper()
{
logout();
}
/* to avoid to often select statements in loops etc.
we trust that we are logged in and connection is established!*/
int IMAPwrapper::selectMbox(const QString&mbox)
{
if (mbox == m_Lastmbox) {
return MAILIMAP_NO_ERROR;
}
int err = mailimap_select( m_imap, (char*)mbox.latin1());
if ( err != MAILIMAP_NO_ERROR ) {
m_Lastmbox = "";
@@ -210,65 +212,65 @@ void IMAPwrapper::login(bool tryTLS) // = true)
if (ok) {
err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() );
if ( err != MAILIMAP_NO_ERROR ) {
if ( tryTLS && !force_tls && !try_tls ) {
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
login( false );
return;
}
Global::statusMessage(i18n("error logging in imap server: %1").arg(m_imap->imap_response));
ok = false;
}
}
if (!ok) {
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
}
}
void IMAPwrapper::logout()
{
int err = MAILIMAP_NO_ERROR;
if (!m_imap) return;
err = mailimap_logout( m_imap );
err = mailimap_close( m_imap );
mailimap_free( m_imap );
m_imap = 0;
m_Lastmbox = "";
}
-void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb)
+void IMAPwrapper::listMessages(const QString&mailbox,Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb)
{
int tryAgain = 1;
while ( tryAgain >= 0 ) {
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current;
mailimap_fetch_type *fetchType = 0;
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
/* select mailbox READONLY for operations */
err = selectMbox(mailbox);
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
int last = m_imap->imap_selection_info->sel_exists;
if (last == 0) {
Global::statusMessage(i18n("Mailbox has no mails"));
return;
} else {
}
progress( i18n("Fetch "));
mMax = last;
//qDebug("last %d ", last);
Global::statusMessage(i18n("Fetching header list"));
qApp->processEvents();
@@ -291,74 +293,74 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
if ( err == MAILIMAP_NO_ERROR ) {
tryAgain = -1;
mailimap_msg_att * msg_att;
int i = 0;
for (current = clist_begin(result); current != 0; current=clist_next(current)) {
++i;
//qDebug("iii %d ",i);
msg_att = (mailimap_msg_att*)current->data;
RecMail*m = parse_list_result(msg_att);
if (m) {
if ( maxSizeInKb == 0 || m->Msgsize()<=(unsigned int ) maxSizeInKb*1024 ) {
m->setNumber(i);
m->setMbox(mailbox);
m->setWrapper(this);
target.append(m);
}
}
}
Global::statusMessage(i18n("Mailbox has %1 mails").arg(target.count()));
} else {
--tryAgain;
--tryAgain;//disabled tryagain by adding this line
if ( tryAgain < 0 )
Global::statusMessage(i18n("Error fetching headers: %1").arg(m_imap->imap_response));
else
qDebug("try again... ");
}
if (result) mailimap_fetch_list_free(result);
}
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders()
{
const char *path, *mask;
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current = 0;
clistcell*cur_flag = 0;
mailimap_mbx_list_flags*bflags = 0;
- QValueList<FolderP>* folders = new QValueList<FolderP>();
+ Q3ValueList<FolderP>* folders = new Q3ValueList<FolderP>();
login();
if (!m_imap) {
return folders;
}
/*
* First we have to check for INBOX 'cause it sometimes it's not inside the path.
* We must not forget to filter them out in next loop!
* it seems like ugly code. and yes - it is ugly code. but the best way.
*/
Global::statusMessage(i18n("Fetching folder list"));
qApp->processEvents();
QString temp;
mask = "INBOX" ;
mailimap_mailbox_list *list;
err = mailimap_list( m_imap, (char*)"", (char*)mask, &result );
QString del;
bool selectable = true;
bool no_inferiors = false;
if ( err == MAILIMAP_NO_ERROR ) {
current = result->first;
for ( int i = result->count; i > 0; i-- ) {
list = (mailimap_mailbox_list *) current->data;
// it is better use the deep copy mechanism of qt itself
// instead of using strdup!
temp = list->mb_name;
del = list->mb_delimiter;
current = current->next;
if ( (bflags = list->mb_flag) ) {
selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&&
bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT);
for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) {
@@ -584,116 +586,116 @@ RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
const char *mb;
int err = MAILIMAP_NO_ERROR;
clist *result = 0;
clistcell *current;
mailimap_fetch_att *fetchAtt = 0;
mailimap_fetch_type *fetchType = 0;
mailimap_set *set = 0;
mailimap_body*body_desc = 0;
mb = mail->getMbox().latin1();
login();
if (!m_imap) {
return body;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return body;
}
/* the range has to start at 1!!! not with 0!!!! */
set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() );
fetchAtt = mailimap_fetch_att_new_bodystructure();
fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
- QValueList<int> path;
+ Q3ValueList<int> path;
body_desc = item->att_data.att_static->att_data.att_body;
traverseBody(mail,body_desc,body,0,path);
} else {
qDebug("error fetching body %d (%d): %s", err, MAILIMAP_NO_ERROR, m_imap->imap_response );
}
if (result) mailimap_fetch_list_free(result);
return body;
}
QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
{
QStringList l;
QString from;
bool named_from;
clistcell *current = NULL;
mailimap_address * current_address=NULL;
if (!list) {
return l;
}
unsigned int count = 0;
for (current=clist_begin(list);current!= NULL;current=clist_next(current)) {
from = "";
named_from = false;
current_address=(mailimap_address*)current->data;
if (current_address->ad_personal_name){
from+=convert_String((const char*)current_address->ad_personal_name);
from+=" ";
named_from = true;
}
if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
from+="<";
}
if (current_address->ad_mailbox_name) {
from+=QString(current_address->ad_mailbox_name);
from+="@";
}
if (current_address->ad_host_name) {
from+=QString(current_address->ad_host_name);
}
if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
from+=">";
}
l.append(QString(from));
if (++count > 99) {
break;
}
}
return l;
}
-encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call)
+encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call)
{
encodedString*res=new encodedString;
int err;
mailimap_fetch_type *fetchType;
mailimap_set *set;
clistcell*current,*cur;
mailimap_section_part * section_part = 0;
mailimap_section_spec * section_spec = 0;
mailimap_section * section = 0;
mailimap_fetch_att * fetch_att = 0;
login();
if (!m_imap) {
return res;
}
if (!internal_call) {
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return res;
}
}
set = mailimap_set_new_single(mail->getNumber());
clist*id_list = 0;
/* if path == empty then its a request for the whole rfc822 mail and generates
a "fetch <id> (body[])" statement on imap server */
if (path.count()>0 ) {
id_list = clist_new();
for (unsigned j=0; j < path.count();++j) {
uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id));
*p_id = path[j];
@@ -709,126 +711,126 @@ encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int
clist*result = 0;
err = mailimap_fetch( m_imap, set, fetchType, &result );
mailimap_set_free( set );
mailimap_fetch_type_free( fetchType );
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
mailimap_msg_att * msg_att;
msg_att = (mailimap_msg_att*)current->data;
mailimap_msg_att_item*msg_att_item;
for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
/* detach - we take over the content */
msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length);
}
}
}
} else {
;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl;
}
if (result) mailimap_fetch_list_free(result);
return res;
}
/* current_recursion is for recursive calls.
current_count means the position inside the internal loop! */
void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,
- int current_recursion,QValueList<int>recList,int current_count)
+ int current_recursion,Q3ValueList<int>recList,int current_count)
{
if (!body || current_recursion>=10) {
return;
}
switch (body->bd_type) {
case MAILIMAP_BODY_1PART:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
countlist.append(current_count);
RecPartP currentPart = new RecPart();
mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part;
QString id("");
currentPart->setPositionlist(countlist);
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
//odebug << "ID = " << id.latin1() << "" << oendl;
currentPart->setIdentifier(id);
fillSinglePart(currentPart,part1);
/* important: Check for is NULL 'cause a body can be empty!
And we put it only into the mail if it is the FIRST part */
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) {
QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding());
size_t index = 0;
char*res = 0;
int err = MAILIMF_NO_ERROR;
QString charset = currentPart->searchParamter( "charset");
qDebug("CHARSET %s ",charset.latin1() );
if ( false ) {
//if ( !charset.isEmpty() ) {
target_body->setCharset( charset );
//err = mailmime_encoded_phrase_parse("iso-8859-1",
// text, strlen(text),&index, "iso-8859-1",&res);
err = mailmime_encoded_phrase_parse(charset.latin1(),
body_text.latin1(), body_text.length(),&index, "utf-8",&res);
if (err == MAILIMF_NO_ERROR && res && strlen(res)) {
//qDebug("res %d %s ", index, res);
body_text = QString::fromUtf8(res);
}
if (res) free(res);
}
//qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() );
target_body->setDescription(currentPart);
target_body->setBodytext(body_text);
if (countlist.count()>1) {
target_body->addPart(currentPart);
}
} else {
target_body->addPart(currentPart);
}
if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) {
traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist);
}
}
break;
case MAILIMAP_BODY_MPART:
{
- QValueList<int>countlist = recList;
+ Q3ValueList<int>countlist = recList;
clistcell*current=0;
mailimap_body*current_body=0;
unsigned int ccount = 1;
mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart;
for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) {
current_body = (mailimap_body*)current->data;
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
RecPartP targetPart = new RecPart();
targetPart->setType("multipart");
fillMultiPart(targetPart,mailDescription);
countlist.append(current_count);
targetPart->setPositionlist(countlist);
target_body->addPart(targetPart);
QString id("");
for (unsigned int j = 0; j < countlist.count();++j) {
id+=(j>0?" ":"");
id+=QString("%1").arg(countlist[j]);
}
// odebug << "ID(mpart) = " << id.latin1() << "" << oendl;
}
traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount);
if (current_body->bd_type==MAILIMAP_BODY_MPART) {
countlist = recList;
}
++ccount;
}
}
break;
default:
break;
}
}
@@ -956,85 +958,85 @@ void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which
QString encoding("");
switch (enc->enc_type) {
case MAILIMAP_BODY_FLD_ENC_7BIT:
encoding = "7bit";
break;
case MAILIMAP_BODY_FLD_ENC_8BIT:
encoding = "8bit";
break;
case MAILIMAP_BODY_FLD_ENC_BINARY:
encoding="binary";
break;
case MAILIMAP_BODY_FLD_ENC_BASE64:
encoding="base64";
break;
case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE:
encoding="quoted-printable";
break;
case MAILIMAP_BODY_FLD_ENC_OTHER:
default:
if (enc->enc_value) {
char*t=enc->enc_value;
encoding=QString(enc->enc_value);
enc->enc_value=0L;
free(t);
}
}
if (which->bd_description) {
target_part->setDescription(QString(which->bd_description));
}
target_part->setEncoding(encoding);
target_part->setSize(which->bd_size);
}
-void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target)
+void IMAPwrapper::deleteMailList(const Q3ValueList<RecMailP>&target)
{
//#if 0
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
//#endif
if (!m_imap) {
return;
}
int iii = 0;
int count = target.count();
// qDebug("imap remove count %d ", count);
mMax = count;
progress( i18n("Delete"));
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
RecMailP mail = (*target.at( iii ));
//#if 0
//qDebug("IMAP remove %d %d ", iii, mail->getNumber() );
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
store_flags = mailimap_store_att_flags_new_set_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
// odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl;
return;
}
// odebug << "deleting mail: " << m_imap->imap_response << "" << oendl;
/* should we realy do that at this moment? */
// err = mailimap_expunge(m_imap);
//if (err != MAILIMAP_NO_ERROR) {
// Global::statusMessage(i18n("Error deleting mails: %s").arg(m_imap->imap_response));
@@ -1085,65 +1087,65 @@ void IMAPwrapper::deleteMail(const RecMailP&mail)
//qDebug("IMAPwrapper::deleteMail 2");
}
void IMAPwrapper::answeredMail(const RecMailP&mail)
{
mailimap_flag_list*flist;
mailimap_set *set;
mailimap_store_att_flags * store_flags;
int err;
login();
if (!m_imap) {
return;
}
err = selectMbox(mail->getMbox());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
flist = mailimap_flag_list_new_empty();
mailimap_flag_list_add(flist,mailimap_flag_new_answered());
store_flags = mailimap_store_att_flags_new_add_flags(flist);
set = mailimap_set_new_single(mail->getNumber());
err = mailimap_store(m_imap,set,store_flags);
mailimap_set_free( set );
mailimap_store_att_flags_free(store_flags);
if (err != MAILIMAP_NO_ERROR) {
// odebug << "error marking mail: " << m_imap->imap_response << "" << oendl;
return;
}
}
-QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc)
+QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call,const QString&enc)
{
QString body("");
encodedString*res = fetchRawPart(mail,path,internal_call);
encodedString*r = decode_String(res,enc);
delete res;
if (r) {
if (r->Length()>0) {
body = r->Content();
}
delete r;
}
return body;
}
QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part)
{
return fetchTextPart(mail,part->Positionlist(),false,part->Encoding());
}
encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part)
{
encodedString*res = fetchRawPart(mail,part->Positionlist(),false);
encodedString*r = decode_String(res,part->Encoding());
delete res;
return r;
}
encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part)
{
return fetchRawPart(mail,part->Positionlist(),false);
}
@@ -1270,65 +1272,65 @@ void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox)
} else {
// odebug << "Error retrieving status" << oendl;
}
if (status) mailimap_mailbox_data_status_free(status);
if (att_list) mailimap_status_att_list_free(att_list);
}
void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder)
{
login();
if (!m_imap) return;
if (!msg) return;
int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length);
if (r != MAILIMAP_NO_ERROR) {
Global::statusMessage("Error storing mail!");
}
}
MAILLIB::ATYPE IMAPwrapper::getType()const
{
return account->getType();
}
const QString&IMAPwrapper::getName()const
{
// odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl;
return account->getAccountName();
}
encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail)
{
// dummy
- QValueList<int> path;
+ Q3ValueList<int> path;
return fetchRawPart(mail,path,false);
}
void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb)
{
if (targetWrapper != this || maxSizeInKb > 0 ) {
mMax = 0;
progress( i18n("Copy"));
AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb);
//qDebug("IMAPwrapper::mvcpAllMails::Using generic");
// odebug << "Using generic" << oendl;
return;
}
mailimap_set *set = 0;
login();
if (!m_imap) {
return;
}
int err = selectMbox(fromFolder->getName());
if ( err != MAILIMAP_NO_ERROR ) {
return;
}
Global::statusMessage( i18n("Copying mails on server...") );
int last = m_imap->imap_selection_info->sel_exists;
set = mailimap_set_new_interval( 1, last );
err = mailimap_copy(m_imap,set,targetFolder.latin1());
mailimap_set_free( set );
if ( err != MAILIMAP_NO_ERROR ) {
QString error_msg = i18n("Error copy mails: %1").arg(m_imap->imap_response);
Global::statusMessage(error_msg);
// odebug << error_msg << oendl;
diff --git a/kmicromail/libmailwrapper/imapwrapper.h b/kmicromail/libmailwrapper/imapwrapper.h
index 31c60a8..d3d3ecd 100644
--- a/kmicromail/libmailwrapper/imapwrapper.h
+++ b/kmicromail/libmailwrapper/imapwrapper.h
@@ -1,85 +1,87 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __IMAPWRAPPER
#define __IMAPWRAPPER
#include <qlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "mailwrapper.h"
#include "abstractmail.h"
#include <libetpan/clist.h>
struct mailimap;
struct mailimap_body;
struct mailimap_body_type_1part;
struct mailimap_body_type_text;
struct mailimap_body_type_basic;
struct mailimap_body_type_msg;
struct mailimap_body_type_mpart;
struct mailimap_body_fields;
struct mailimap_msg_att;
class encodedString;
class IMAPwrapper : public AbstractMail
{
Q_OBJECT
public:
IMAPwrapper( IMAPaccount *a );
virtual ~IMAPwrapper();
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
- virtual void listMessages(const QString & mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0);
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox,Q3ValueList<Opie::Core::OSmartPointer<RecMail> >&target , int sizeInKb = 0);
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
- void deleteMailList(const QValueList<RecMailP>&target);
+ void deleteMailList(const Q3ValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&folder);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit,int sizeInKb = 0);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual RecBodyP fetchBody(const RecMailP&mail);
virtual QString fetchTextPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchDecodedPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawPart(const RecMailP&mail,const RecPartP&part);
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual int createMbox(const QString&,const Opie::Core::OSmartPointer<Folder>&parentfolder=0,
const QString& delemiter="/",bool getsubfolder=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&folder);
static void imap_progress( size_t current, size_t maximum );
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return account; };
protected:
RecMail*parse_list_result(mailimap_msg_att*);
void login(bool tryTLS = true);
bool start_tls(bool force=true);
- virtual QString fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call=false,const QString&enc="");
- virtual encodedString*fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call);
+ virtual QString fetchTextPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call=false,const QString&enc="");
+ virtual encodedString*fetchRawPart(const RecMailP&mail,const Q3ValueList<int>&path,bool internal_call);
int selectMbox(const QString&mbox);
void fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description);
void fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which);
void fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which);
void fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which);
void fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which);
- void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,QValueList<int>recList,int current_count=1);
+ void traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body,int current_recursion,Q3ValueList<int>recList,int current_count=1);
/* just helpers */
static void fillBodyFields(RecPartP&target_part,mailimap_body_fields*which);
static QStringList address_list_to_stringlist(clist*list);
static void progress(QString mess = QString::null);
static int mCurrent;
static int mMax;
IMAPaccount *account;
mailimap *m_imap;
QString m_Lastmbox;
};
#endif
diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro
index 646630b..6b595ab 100644
--- a/kmicromail/libmailwrapper/libmailwrapper.pro
+++ b/kmicromail/libmailwrapper/libmailwrapper.pro
@@ -9,57 +9,63 @@ HEADERS = mailwrapper.h \
smtpwrapper.h \
genericwrapper.h \
mboxwrapper.h \
settings.h \
logindialog.h \
sendmailprogress.h \
statusmail.h \
mhwrapper.h \
nntpwrapper.h \
generatemail.h \
storemail.h \
../qpe/global.h
SOURCES = imapwrapper.cpp \
mailwrapper.cpp \
mailtypes.cpp \
pop3wrapper.cpp \
abstractmail.cpp \
smtpwrapper.cpp \
genericwrapper.cpp \
mboxwrapper.cpp \
settings.cpp \
logindialog.cpp \
sendmailprogress.cpp \
statusmail.cpp \
mhwrapper.cpp \
nntpwrapper.cpp \
generatemail.cpp \
storemail.cpp \
../qpe/qdialog_hacked.cpp \
../qpe/global.cpp
-INTERFACES = logindialogui.ui \
+#The following line was changed from INTERFACES to FORMS3 by qt3to4
+FORMS3 = logindialogui.ui \
sendmailprogressui.ui
INCLUDEPATH += ../qpe .. ../../microkde ../../microkde/kdecore ../../libetpan/include
LIBS += -lssl -lcrypto
#-lqpe -letpan
DESTDIR = ../../bin
TARGET = micromailwrapper
DEFINES += DESKTOP_VERSION
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
LIBS += mfc71u.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+CONFIG += uic3
+
diff --git a/kmicromail/libmailwrapper/logindialog.cpp b/kmicromail/libmailwrapper/logindialog.cpp
index 31b75d0..d1f4b5d 100644
--- a/kmicromail/libmailwrapper/logindialog.cpp
+++ b/kmicromail/libmailwrapper/logindialog.cpp
@@ -1,33 +1,33 @@
#include <qlineedit.h>
#include "logindialog.h"
//using namespace Opie::Core;
-LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, WFlags flags )
+LoginDialog::LoginDialog(const QString&user,const QString&pass, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
: LoginDialogUI( parent, name, modal, flags )
{
userLine->setText( (user.isEmpty()?QString(""):user) );
passLine->setText( (pass.isEmpty()?QString(""):pass) );
_user = user;
_pass = pass;
if ( user.isEmpty() ) {
userLine->setFocus();
} else {
passLine->setFocus();
}
}
void LoginDialog::accept()
{
//_user.replace( 0, _user.length(), userLine->text() );
//_pass.replace( 0, _pass.length(), passLine->text() );
_user = userLine->text();
_pass = passLine->text();
//odebug << "User im accept: |" << _user.latin1() << "|" << oendl;
QDialog::accept();
}
diff --git a/kmicromail/libmailwrapper/logindialog.h b/kmicromail/libmailwrapper/logindialog.h
index f406f2c..a18daa5 100644
--- a/kmicromail/libmailwrapper/logindialog.h
+++ b/kmicromail/libmailwrapper/logindialog.h
@@ -1,23 +1,23 @@
#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H
#include "logindialogui.h"
class LoginDialog : public LoginDialogUI
{
Q_OBJECT
public:
- LoginDialog(const QString&user,const QString&pass, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 );
+ LoginDialog(const QString&user,const QString&pass, QWidget *parent = 0, const char *name = 0, bool modal = false, Qt::WFlags flags = 0 );
QString getUser() { return _user; }
QString getPassword() { return _pass; }
protected slots:
void accept();
private:
QString _user, _pass;
};
#endif
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index 70a0ab5..84ccf9f 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -1,37 +1,39 @@
#include "mailtypes.h"
//#include <opie2/odebug.h>
#include <stdlib.h>
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace Opie::Core;
RecMail::RecMail()
:Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
{
init();
}
RecMail::RecMail(const RecMail&old)
:Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
{
init();
copy_old(old);
// odebug << "Copy constructor RecMail" << oendl;
}
RecMail::~RecMail()
{
wrapper = 0;
}
static bool stringCompareRec( const QString& s1, const QString& s2 )
{
if ( s1.isEmpty() && s2.isEmpty() )
return true;
return s1 == s2;
}
#if 0
QString RecMail::MsgsizeString() const
{
double s = msg_size;
int w = 0;
@@ -254,111 +256,111 @@ const QString& RecPart::Description()const
}
void RecPart::setDescription(const QString&desc)
{
m_description = desc;
}
void RecPart::setParameters(const part_plist_t&list)
{
m_Parameters = list;
}
const part_plist_t& RecPart::Parameters()const
{
return m_Parameters;
}
void RecPart::addParameter(const QString&key,const QString&value)
{
m_Parameters[key]=value;
}
const QString RecPart::searchParamter(const QString&key)const
{
QString value("");
part_plist_t::ConstIterator it = m_Parameters.find(key);
if (it != m_Parameters.end()) {
value = it.data();
}
return value;
}
-void RecPart::setPositionlist(const QValueList<int>&poslist)
+void RecPart::setPositionlist(const Q3ValueList<int>&poslist)
{
m_poslist = poslist;
}
-const QValueList<int>& RecPart::Positionlist()const
+const Q3ValueList<int>& RecPart::Positionlist()const
{
return m_poslist;
}
RecBody::RecBody()
: Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
{
m_PartsList.clear();
}
RecBody::RecBody(const RecBody&old)
:Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
{
m_BodyText = old.m_BodyText;
m_PartsList = old.m_PartsList;
m_description = old.m_description;
mCharset = old.mCharset;
// odebug << "Recbody copy constructor" << oendl;
}
RecBody::~RecBody()
{
}
void RecBody::setBodytext(const QString&bodyText)
{
m_BodyText = bodyText;
}
const QString& RecBody::Bodytext()const
{
return m_BodyText;
}
-void RecBody::setParts(const QValueList<RecPartP>&parts)
+void RecBody::setParts(const Q3ValueList<RecPartP>&parts)
{
m_PartsList.clear();
m_PartsList = parts;
}
-const QValueList<RecPartP>& RecBody::Parts()const
+const Q3ValueList<RecPartP>& RecBody::Parts()const
{
return m_PartsList;
}
void RecBody::addPart(const RecPartP& part)
{
m_PartsList.append(part);
}
void RecBody::setDescription(const RecPartP&des)
{
m_description = des;
}
const RecPartP& RecBody::Description()const
{
return m_description;
}
void RecBody::setCharset(const QString& str)
{
mCharset = str;
}
QString RecBody::getCharset()const
{
return mCharset;
}
/* handling encoded content */
encodedString::encodedString()
{
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index 97f10d7..ac7f8da 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -1,49 +1,49 @@
#ifndef __MAIL_TYPES_H
#define __MAIL_TYPES_H
#define FLAG_ANSWERED 0
#define FLAG_FLAGGED 1
#define FLAG_DELETED 2
#define FLAG_SEEN 3
#define FLAG_DRAFT 4
#define FLAG_RECENT 5
#include <opie2/osmartpointer.h>
#include <qbitarray.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qmap.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
class AbstractMail;
/* a class to describe mails in a mailbox */
/* Attention!
From programmers point of view it would make sense to
store the mail body into this class, too.
But: not from the point of view of the device.
Mailbodies can be real large. So we request them when
needed from the mail-wrapper class direct from the server itself
(imap) or from a file-based cache (pop3?)
So there is no interface "const QString&body()" but you should
make a request to the mailwrapper with this class as parameter to
get the body. Same words for the attachments.
*/
class RecMail:public Opie::Core::ORefCount
{
public:
RecMail();
RecMail(const RecMail&old);
virtual ~RecMail();
bool isEqual( RecMail* r1 );
const unsigned int getNumber()const{return msg_number;}
void setNumber(unsigned int number){msg_number=number;}
const QString&getDate()const{ return date; }
void setDate( const QString&a ) { date = a; }
const QString&getIsoDate()const{ return isodate; }
void setIsoDate( const QString&a ) { isodate = a; }
const QString&getFrom()const{ return from; }
void setFrom( const QString&a ) { from = a; }
const QString&getSubject()const { return subject; }
void setSubject( const QString&s ) { subject = s; }
@@ -80,119 +80,119 @@ public:
const QStringList&Inreply()const;
void setReferences(const QStringList&list);
const QStringList&References()const;
const QBitArray&getFlags()const{return msg_flags;}
void setFlags(const QBitArray&flags){msg_flags = flags;}
void setWrapper(AbstractMail*wrapper);
AbstractMail* Wrapper();
// public for debugging
QString subject,date,isodate,from,mbox,msg_id,replyto;
protected:
//QString subject,date,isodate,from,mbox,msg_id,replyto;
unsigned int msg_number,msg_size;
QBitArray msg_flags;
QStringList to,cc,bcc,in_reply_to,references;
AbstractMail*wrapper;
void init();
void copy_old(const RecMail&old);
};
typedef Opie::Core::OSmartPointer<RecMail> RecMailP;
typedef QMap<QString,QString> part_plist_t;
class RecPart:public Opie::Core::ORefCount
{
protected:
QString m_type,m_subtype,m_identifier,m_encoding,m_description;
unsigned int m_lines,m_size;
part_plist_t m_Parameters;
/* describes the position in the mail */
- QValueList<int> m_poslist;
+ Q3ValueList<int> m_poslist;
public:
RecPart();
RecPart(const RecPart&);
virtual ~RecPart();
const QString&Type()const;
void setType(const QString&type);
const QString&Subtype()const;
void setSubtype(const QString&subtype);
const QString&Identifier()const;
void setIdentifier(const QString&identifier);
const QString&Encoding()const;
void setEncoding(const QString&encoding);
const QString&Description()const;
void setDescription(const QString&desc);
void setLines(unsigned int lines);
const unsigned int Lines()const;
void setSize(unsigned int size);
const unsigned int Size()const;
void setParameters(const part_plist_t&list);
const part_plist_t&Parameters()const;
void addParameter(const QString&key,const QString&value);
const QString searchParamter(const QString&key)const;
- void setPositionlist(const QValueList<int>&poslist);
- const QValueList<int>& Positionlist()const;
+ void setPositionlist(const Q3ValueList<int>&poslist);
+ const Q3ValueList<int>& Positionlist()const;
};
typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
class RecBody:public Opie::Core::ORefCount
{
protected:
QString m_BodyText;
QString mCharset;
- QValueList<RecPartP> m_PartsList;
+ Q3ValueList<RecPartP> m_PartsList;
RecPartP m_description;
public:
RecBody();
RecBody(const RecBody&old);
virtual ~RecBody();
void setBodytext(const QString&);
const QString& Bodytext()const;
void setCharset(const QString&);
QString getCharset()const;
void setDescription(const RecPartP&des);
const RecPartP& Description()const;
- void setParts(const QValueList<RecPartP>&parts);
- const QValueList<RecPartP>& Parts()const;
+ void setParts(const Q3ValueList<RecPartP>&parts);
+ const Q3ValueList<RecPartP>& Parts()const;
void addPart(const RecPartP&part);
};
typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
class encodedString
{
public:
encodedString();
/*
creates an new content string.
it makes a deep copy of it!
*/
encodedString(const char*nContent,unsigned int length);
/*
Take over the nContent. Means: it will just copy the pointer, not the content.
so make sure: No one else frees the string, the string has allocated with
malloc for compatibility with c-based libs
*/
encodedString(char*nContent,unsigned int nSize);
/* copy construkor - makes ALWAYS a deep copy!!!! */
encodedString(const encodedString&old);
/* assign operator - makes ALWAYS a deep copy!!!! */
encodedString& operator=(const encodedString&old);
/* destructor - cleans the content */
virtual ~encodedString();
/* returns a pointer to the content - do not delete yoursel! */
const char*Content()const;
/* returns the lengths of the content 'cause it must not be a null-terminated string! */
const int Length()const;
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp
index 2ee1ab3..9c299e8 100644
--- a/kmicromail/libmailwrapper/mailwrapper.cpp
+++ b/kmicromail/libmailwrapper/mailwrapper.cpp
@@ -1,39 +1,41 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "mailwrapper.h"
//#include "logindialog.h"
//#include "defines.h"
#define UNDEFINED 64
#define MAXLINE 76
#define UTF16MASK 0x03FFUL
#define UTF16SHIFT 10
#define UTF16BASE 0x10000UL
#define UTF16HIGHSTART 0xD800UL
#define UTF16HIGHEND 0xDBFFUL
#define UTF16LOSTART 0xDC00UL
#define UTF16LOEND 0xDFFFUL
using namespace Opie::Core;
Attachment::Attachment( QString lnk )
{
doc = lnk;
size = QFileInfo( doc ).size();
mPix = SmallIcon( "files" );
}
Folder::Folder(const QString&tmp_name, const QString&sep )
{
name = tmp_name;
nameDisplay = name;
separator = sep;
prefix = "";
}
@@ -52,130 +54,130 @@ IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool
// Decode IMAP foldername
nameDisplay = IMAPFolder::decodeFolderName( t_name );
name = nameDisplay ;
/*
odebug << "folder " + name + " - displayed as " + nameDisplay << oendl;
*/
prefix = aprefix;
if (prefix.length()>0) {
if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) {
nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length());
}
}
}
IMAPFolder::~IMAPFolder()
{
}
static unsigned char base64chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
/**
* Decodes base64 encoded parts of the imapfolder name
* Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc
*/
QString IMAPFolder::decodeFolderName( const QString &name )
{
unsigned char c, i, bitcount;
unsigned long ucs4, utf16, bitbuf;
unsigned char base64[256], utf8[6];
unsigned long srcPtr = 0;
- QCString dst = "";
- QCString src = name.ascii();
+ Q3CString dst = "";
+ Q3CString src = name.ascii();
/* initialize modified base64 decoding table */
memset(base64, UNDEFINED, sizeof(base64));
for (i = 0; i < sizeof(base64chars); ++i) {
base64[(int)base64chars[i]] = i;
}
/* loop until end of string */
while (srcPtr < src.length ()) {
- c = src[srcPtr++];
+ c = src.at(srcPtr++);
/* deal with literal characters and &- */
- if (c != '&' || src[srcPtr] == '-') {
+ if (c != '&' || src.at(srcPtr) == '-') {
/* encode literally */
dst += c;
/* skip over the '-' if this is an &- sequence */
if (c == '&')
srcPtr++;
} else {
/* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */
bitbuf = 0;
bitcount = 0;
ucs4 = 0;
- while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) {
+ while ((c = base64[(unsigned char) src.at(srcPtr)]) != UNDEFINED) {
++srcPtr;
bitbuf = (bitbuf << 6) | c;
bitcount += 6;
/* enough bits for a UTF-16 character? */
if (bitcount >= 16) {
bitcount -= 16;
utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff;
/* convert UTF16 to UCS4 */
if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) {
ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT;
continue;
} else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) {
ucs4 += utf16 - UTF16LOSTART + UTF16BASE;
} else {
ucs4 = utf16;
}
/* convert UTF-16 range of UCS4 to UTF-8 */
if (ucs4 <= 0x7fUL) {
utf8[0] = ucs4;
i = 1;
} else if (ucs4 <= 0x7ffUL) {
utf8[0] = 0xc0 | (ucs4 >> 6);
utf8[1] = 0x80 | (ucs4 & 0x3f);
i = 2;
} else if (ucs4 <= 0xffffUL) {
utf8[0] = 0xe0 | (ucs4 >> 12);
utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f);
utf8[2] = 0x80 | (ucs4 & 0x3f);
i = 3;
} else {
utf8[0] = 0xf0 | (ucs4 >> 18);
utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f);
utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f);
utf8[3] = 0x80 | (ucs4 & 0x3f);
i = 4;
}
/* copy it */
for (c = 0; c < i; ++c) {
dst += utf8[c];
}
}
}
/* skip over trailing '-' in modified UTF-7 encoding */
- if (src[srcPtr] == '-')
+ if (src.at(srcPtr) == '-')
++srcPtr;
}
}
return QString::fromUtf8( dst.data() );
}
Mail::Mail()
:Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("")
{
}
MHFolder::MHFolder(const QString&disp_name,const QString&mbox)
: Folder( disp_name,"/" )
{
separator = "/";
name = mbox;
if (!disp_name.startsWith("/") && disp_name.length()>0)
name+="/";
name+=disp_name;
if (disp_name.length()==0) {
nameDisplay = separator;
}
prefix = mbox;
}
MHFolder::~MHFolder()
{
}
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h
index 3e8b51f..bebabf4 100644
--- a/kmicromail/libmailwrapper/mailwrapper.h
+++ b/kmicromail/libmailwrapper/mailwrapper.h
@@ -1,121 +1,123 @@
#ifndef MAILWRAPPER_H
#define MAILWRAPPER_H
//#include <qpe/applnk.h>
#include <qbitarray.h>
#include <qdatetime.h>
#include <qfileinfo.h>
+//Added by qt3to4:
+#include <QPixmap>
#include <kiconloader.h>
#include "settings.h"
#include <opie2/osmartpointer.h>
/*
class Attachment
{
public:
Attachment( DocLnk lnk );
virtual ~Attachment(){}
const QString getFileName()const{ return doc.file(); }
const QString getName()const{ return doc.name(); }
const QString getMimeType()const{ return doc.type(); }
const QPixmap getPixmap()const{ return doc.pixmap(); }
const int getSize()const { return size; }
DocLnk getDocLnk() { return doc; }
protected:
DocLnk doc;
int size;
};
*/
class Attachment
{
public:
Attachment( QString lnk );
virtual ~Attachment(){}
const QString getFileName()const{ return doc; }
const QString getName()const{ return QFileInfo( doc ).baseName (); }
const QString getMimeType()const{ return QFileInfo( doc ).extension(false); }
const QPixmap getPixmap()const{ return mPix; }
const int getSize()const { return size; }
QString getDocLnk() { return doc; }
protected:
QPixmap mPix;
QString doc;
int size;
};
class Mail:public Opie::Core::ORefCount
{
public:
Mail();
/* Possible that this destructor must not be declared virtual
* 'cause it seems that it will never have some child classes.
* in this case this object will not get a virtual table -> memory and
* speed will be a little bit better?
*/
virtual ~Mail(){}
void addAttachment( Attachment *att ) { attList.append( att ); }
- const QList<Attachment>& getAttachments()const { return attList; }
+ const QList<Attachment*>& getAttachments()const { return attList; }
void removeAttachment( Attachment *att ) { attList.remove( att ); }
const QString&getName()const { return name; }
void setName( QString s ) { name = s; }
const QString&getMail()const{ return mail; }
void setMail( const QString&s ) { mail = s; }
const QString&getTo()const{ return to; }
void setTo( const QString&s ) { to = s; }
const QString&getCC()const{ return cc; }
void setCC( const QString&s ) { cc = s; }
const QString&getBCC()const { return bcc; }
void setBCC( const QString&s ) { bcc = s; }
const QString&getMessage()const { return message; }
void setMessage( const QString&s ) { message = s; }
const QString&getSubject()const { return subject; }
void setSubject( const QString&s ) { subject = s; }
const QString&getReply()const{ return reply; }
void setReply( const QString&a ) { reply = a; }
void setInreply(const QStringList&list){m_in_reply_to = list;}
const QStringList&Inreply()const{return m_in_reply_to;}
void setCharset( const QString&a ) { charset= a; }
const QString& getCharset() const { return charset; }
private:
- QList<Attachment> attList;
+ QList<Attachment*> attList;
QString name, mail, to, cc, bcc, reply, subject, message, charset;
QStringList m_in_reply_to;
};
class Folder:public Opie::Core::ORefCount
{
public:
Folder( const QString&init_name,const QString&sep );
virtual ~Folder();
const QString&getDisplayName()const { return nameDisplay; }
const QString&getName()const { return name; }
const QString&getPrefix()const{return prefix; }
virtual bool may_select()const{return true;}
virtual bool no_inferior()const{return true;}
const QString&Separator()const;
protected:
QString nameDisplay, name, separator,prefix;
};
typedef Opie::Core::OSmartPointer<Folder> FolderP;
class MHFolder : public Folder
{
public:
MHFolder(const QString&disp_name,const QString&mbox);
virtual ~MHFolder();
};
class IMAPFolder : public Folder
{
public:
diff --git a/kmicromail/libmailwrapper/mboxwrapper.cpp b/kmicromail/libmailwrapper/mboxwrapper.cpp
index 87f8c8a..888cae2 100644
--- a/kmicromail/libmailwrapper/mboxwrapper.cpp
+++ b/kmicromail/libmailwrapper/mboxwrapper.cpp
@@ -1,85 +1,87 @@
#include "mboxwrapper.h"
#include "mailtypes.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <klocale.h>
#include <qpe/global.h>
using namespace Opie::Core;
MBOXwrapper::MBOXwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MBOXPath(mbox_dir),MBOXName(mbox_name)
{
QDir dir(MBOXPath);
if (!dir.exists()) {
dir.mkdir(MBOXPath);
}
}
MBOXwrapper::~MBOXwrapper()
{
}
-void MBOXwrapper::listMessages(const QString & mailbox, QValueList<RecMailP> &target )
+void MBOXwrapper::listMessages(const QString & mailbox, Q3ValueList<RecMailP> &target )
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mailbox;
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
//odebug << "Error initializing mbox" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return;
}
parseList(target,folder->fld_session,mailbox);
mailfolder_disconnect(folder);
mailfolder_free(folder);
mailstorage_free(storage);
Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* MBOXwrapper::listFolders()
{
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
QDir dir(MBOXPath);
if (!dir.exists()) return folders;
dir.setFilter(QDir::Files|QDir::Writable|QDir::Readable);
QStringList entries = dir.entryList();
QStringList::ConstIterator it = entries.begin();
for (;it!=entries.end();++it) {
FolderP inb=new Folder(*it,"/");
folders->append(inb);
}
return folders;
}
void MBOXwrapper::deleteMail(const RecMailP & mail)
{
mailstorage*storage = mailstorage_new(NULL);
QString p = MBOXPath+"/";
p+=mail->getMbox();
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
; // << "Error initializing mbox" << oendl;
mailfolder_free(folder);
mailstorage_free(storage);
return;
}
r = mailsession_remove_message(folder->fld_session,mail->getNumber());
if (r != MAIL_NO_ERROR) {
; // << "error deleting mail" << oendl;
}
mailfolder_free(folder);
@@ -188,83 +190,83 @@ encodedString* MBOXwrapper::fetchRawBody(const RecMailP&mail)
mailfolder*folder;
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error initializing mbox"));
mailfolder_free(folder);
mailstorage_free(storage);
return 0;
}
r = mailsession_get_message(folder->fld_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return 0;
}
encodedString*result = new encodedString(data,size);
mailfolder_free(folder);
mailstorage_free(storage);
mailmessage_free(msg);
return result;
}
-void MBOXwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
+void MBOXwrapper::deleteMails(const QString & mailbox,const Q3ValueList<RecMailP> &target)
{
QString p = MBOXPath+"/";
p+=mailbox;
mailmbox_folder*f = 0;
int r = mailmbox_init(p.latin1(),0,1,0,&f);
if (r != MAIL_NO_ERROR) {
; // << "Error init folder" << oendl;
return;
}
deleteMails(f,target);
mailmbox_done(f);
}
-void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target)
+void MBOXwrapper::deleteMails(mailmbox_folder*f,const Q3ValueList<RecMailP> &target)
{
if (!f) return;
int r;
- QValueList<RecMailP>::ConstIterator it;
+ Q3ValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it != target.end();++it) {
r = mailmbox_delete_msg(f,(*it)->getNumber());
if (r!=MAILMBOX_NO_ERROR) {
; // << "error delete mail" << oendl;
}
}
r = mailmbox_expunge(f);
if (r != MAILMBOX_NO_ERROR) {
; // << "error expunge mailbox" << oendl;
}
}
int MBOXwrapper::deleteAllMail(const FolderP&tfolder)
{
if (!tfolder) return 0;
QString p = MBOXPath+"/"+tfolder->getDisplayName();
int res = 1;
mailfolder*folder = 0;
mailmessage_list*l=0;
mailstorage*storage = mailstorage_new(NULL);
int r = mbox_mailstorage_init(storage,(char*)p.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error initializing mbox"));
res = 0;
}
if (res) {
folder = mailfolder_new( storage,(char*)p.latin1(),NULL);
r = mailfolder_connect(folder);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error initializing mbox"));
res = 0;
diff --git a/kmicromail/libmailwrapper/mboxwrapper.h b/kmicromail/libmailwrapper/mboxwrapper.h
index d03940f..e658a71 100644
--- a/kmicromail/libmailwrapper/mboxwrapper.h
+++ b/kmicromail/libmailwrapper/mboxwrapper.h
@@ -1,47 +1,49 @@
#ifndef __MBOX_WRAPPER_H
#define __MBOX_WRAPPER_H
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class encodedString;
struct mailmbox_folder;
class MBOXwrapper : public Genericwrapper
{
Q_OBJECT
public:
MBOXwrapper(const QString & dir,const QString&name);
virtual ~MBOXwrapper();
- virtual void listMessages(const QString & mailbox, QValueList<RecMailP>&target );
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, Q3ValueList<RecMailP>&target );
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
virtual void answeredMail(const RecMailP&mail);
virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0,
const QString&d="",bool s=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual RecBodyP fetchBody( const RecMailP &mail );
static void mbox_progress( size_t current, size_t maximum );
virtual encodedString* fetchRawBody(const RecMailP&mail);
- virtual void deleteMails(const QString & FolderName,const QValueList<RecMailP> &target);
+ virtual void deleteMails(const QString & FolderName,const Q3ValueList<RecMailP> &target);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return 0; };
protected:
- static void deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target);
+ static void deleteMails(mailmbox_folder*f,const Q3ValueList<RecMailP> &target);
QString MBOXPath;
QString MBOXName;
};
#endif
diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp
index 787e85d..4cd7a94 100644
--- a/kmicromail/libmailwrapper/mhwrapper.cpp
+++ b/kmicromail/libmailwrapper/mhwrapper.cpp
@@ -1,117 +1,119 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "mhwrapper.h"
#include "mailtypes.h"
#include "mailwrapper.h"
#include <libetpan/libetpan.h>
#include <qdir.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <qpe/global.h>
#include <klocale.h>
#include <kglobal.h>
//#include <opie2/odebug.h>
using namespace Opie::Core;
MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name)
: Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name)
{
if (MHPath.length()>0) {
if (MHPath[MHPath.length()-1]=='/') {
MHPath=MHPath.left(MHPath.length()-1);
}
//odebug << MHPath << oendl;
QDir dir(MHPath);
if (!dir.exists()) {
dir.mkdir(MHPath);
}
init_storage();
}
}
void MHwrapper::init_storage()
{
int r;
QString pre = MHPath;
if (!m_storage) {
m_storage = mailstorage_new(NULL);
r = mh_mailstorage_init(m_storage,(char*)pre.latin1(),0,0,0);
if (r != MAIL_NO_ERROR) {
qDebug(" error init storage ");
mailstorage_free(m_storage);
m_storage = 0;
return;
}
}
r = mailstorage_connect(m_storage);
if (r!=MAIL_NO_ERROR) {
qDebug("error connecting storage ");
mailstorage_free(m_storage);
m_storage = 0;
}
}
void MHwrapper::clean_storage()
{
if (m_storage) {
mailstorage_disconnect(m_storage);
mailstorage_free(m_storage);
m_storage = 0;
}
}
MHwrapper::~MHwrapper()
{
clean_storage();
}
-void MHwrapper::listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
+void MHwrapper::listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
{
init_storage();
if (!m_storage) {
return;
}
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("listMessages: error selecting folder! ");
return;
}
parseList(target,m_storage->sto_session,f, false, maxSizeInKb );
Global::statusMessage(i18n("Mailbox has %1 mail(s)").arg(target.count()));
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* MHwrapper::listFolders()
{
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
/* this is needed! */
if (m_storage) mailstorage_disconnect(m_storage);
init_storage();
if (!m_storage) {
return folders;
}
mail_list*flist = 0;
clistcell*current=0;
int r = mailsession_list_folders(m_storage->sto_session,NULL,&flist);
if (r != MAIL_NO_ERROR || !flist) {
qDebug("error getting folder list ");
return folders;
}
for (current=clist_begin(flist->mb_list);current!=0;current=clist_next(current)) {
QString t = (char*)current->data;
t.replace(0,MHPath.length(),"");
folders->append(new MHFolder(t,MHPath));
}
mail_list_free(flist);
return folders;
}
void MHwrapper::deleteMail(const RecMailP&mail)
{
init_storage();
if (!m_storage) {
return;
}
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder! ");
return;
@@ -226,73 +228,73 @@ void MHwrapper::storeMessage(const char*msg,size_t length, const QString&Folder)
encodedString* MHwrapper::fetchRawBody(const RecMailP&mail)
{
encodedString*result = 0;
init_storage();
if (!m_storage) {
return result;
}
mailmessage * msg = 0;
char*data=0;
size_t size;
int r = mailsession_select_folder(m_storage->sto_session,(char*)mail->getMbox().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder! ");
return result;
}
r = mailsession_get_message(m_storage->sto_session, mail->getNumber(), &msg);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
return 0;
}
r = mailmessage_fetch(msg,&data,&size);
if (r != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error fetching mail %i").arg(mail->getNumber()));
if (msg) mailmessage_free(msg);
return 0;
}
result = new encodedString(data,size);
if (msg) mailmessage_free(msg);
return result;
}
-void MHwrapper::deleteMails(const QString & mailbox,const QValueList<RecMailP> &target)
+void MHwrapper::deleteMails(const QString & mailbox,const Q3ValueList<RecMailP> &target)
{
QString f = buildPath(mailbox);
int r = mailsession_select_folder(m_storage->sto_session,(char*)f.latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("deleteMails: error selecting folder! ");
return;
}
- QValueList<RecMailP>::ConstIterator it;
+ Q3ValueList<RecMailP>::ConstIterator it;
for (it=target.begin(); it!=target.end();++it) {
r = mailsession_remove_message(m_storage->sto_session,(*it)->getNumber());
if (r != MAIL_NO_ERROR) {
qDebug("error deleting mail ");
break;
}
}
}
int MHwrapper::deleteAllMail(const FolderP&tfolder)
{
init_storage();
if (!m_storage) {
return 0;
}
int res = 1;
if (!tfolder) return 0;
int r = mailsession_select_folder(m_storage->sto_session,(char*)tfolder->getName().latin1());
if (r!=MAIL_NO_ERROR) {
qDebug("error selecting folder! ");
return 0;
}
mailmessage_list*l=0;
r = mailsession_get_messages_list(m_storage->sto_session,&l);
if (r != MAIL_NO_ERROR) {
qDebug("Error message list ");
res = 0;
}
unsigned j = 0;
for(unsigned int i = 0 ; l!= 0 && res==1 && i < carray_count(l->msg_tab) ; ++i) {
mailmessage * msg;
msg = (mailmessage*)carray_get(l->msg_tab, i);
diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h
index 36a443a..6151ff1 100644
--- a/kmicromail/libmailwrapper/mhwrapper.h
+++ b/kmicromail/libmailwrapper/mhwrapper.h
@@ -1,59 +1,61 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __MH_WRAPPER_H
#define __MH_WRAPPER_H
#include "maildefines.h"
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class encodedString;
struct mailmbox_folder;
class MHwrapper : public Genericwrapper
{
Q_OBJECT
public:
MHwrapper(const QString & dir,const QString&name);
virtual ~MHwrapper();
- virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
virtual void answeredMail(const RecMailP&mail);
virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,
const QString&targetFolder,AbstractMail*targetWrapper,bool moveit);
virtual int createMbox(const QString&folder,const Opie::Core::OSmartPointer<Folder>&f=0,
const QString&d="",bool s=false);
virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&);
virtual void storeMessage(const char*msg,size_t length, const QString&folder);
virtual RecBodyP fetchBody( const RecMailP &mail );
static void mbox_progress( size_t current, size_t maximum );
virtual encodedString* fetchRawBody(const RecMailP&mail);
- virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target);
+ virtual void deleteMails(const QString & FolderName,const Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
virtual Account* getAccount() { return 0; };
public slots:
protected:
QString buildPath(const QString&p);
QString MHPath;
QString MHName;
void init_storage();
void clean_storage();
bool rmDir(QString folderabspath);
bool removeMboxfailed;
};
#endif
diff --git a/kmicromail/libmailwrapper/nntpwrapper.cpp b/kmicromail/libmailwrapper/nntpwrapper.cpp
index 93cd2b5..b328ecd 100644
--- a/kmicromail/libmailwrapper/nntpwrapper.cpp
+++ b/kmicromail/libmailwrapper/nntpwrapper.cpp
@@ -1,134 +1,136 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include "nntpwrapper.h"
#include "logindialog.h"
#include "mailtypes.h"
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#include <libetpan/libetpan.h>
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
NNTPwrapper::NNTPwrapper( NNTPaccount *a )
: Genericwrapper() {
account = a;
m_nntp = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
NNTPwrapper::~NNTPwrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
}
void NNTPwrapper::nntp_progress( size_t current, size_t maximum ) {
; // << "NNTP: " << current << " of " << maximum << "" << oendl;
}
RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) {
int err = NEWSNNTP_NO_ERROR;
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_nntp ) {
return body;
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
; // << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
- msg_cache.open(IO_ReadWrite|IO_Truncate);
+ msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_nntp->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
- msg_cache.open(IO_ReadOnly);
+ msg_cache.open(QIODevice::ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
}
delete message;
message = (char*)malloc(msg.length()+1*sizeof(char));
memset(message,0,msg.length()+1);
memcpy(message,msg.latin1(),msg.length());
/* transform to libetpan stuff */
mailmsg = mailmessage_new();
mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
generic_message_t * msg_data;
msg_data = (generic_message_t *)mailmsg->msg_data;
msg_data->msg_fetched = 1;
msg_data->msg_message = message;
msg_data->msg_length = strlen(message);
}
body = parseMail(mailmsg);
/* clean up */
if (mailmsg)
mailmessage_free(mailmsg);
if (message)
free(message);
return body;
}
-void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb)
+void NNTPwrapper::listMessages(const QString & which, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb)
{
login();
if (!m_nntp)
return;
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen);
parseList(target,m_nntp->sto_session,which,true, maxSizeInKb);
}
void NNTPwrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_nntp != NULL )
return;
QString server;
QString User,Pass;
uint16_t port;
int err = NEWSNNTP_NO_ERROR;
server = account->getServer();
port = account->getPort().toUInt();
if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
User = login.getUser();
Pass = login.getPassword();
@@ -157,67 +159,67 @@ void NNTPwrapper::login()
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
nntp_mailstorage_init(m_nntp,(char*)server.latin1(), port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
(char*)User.latin1(),(char*)Pass.latin1(),0,0,0);
err = mailstorage_connect( m_nntp );
if (err != NEWSNNTP_NO_ERROR) {
; // << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
// Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_nntp);
m_nntp = 0;
} else {
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
news->nntp_progr_fun = &nntp_progress;
}
}
void NNTPwrapper::logout()
{
int err = NEWSNNTP_NO_ERROR;
if ( m_nntp == NULL )
return;
mailstorage_free(m_nntp);
m_nntp = 0;
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* NNTPwrapper::listFolders() {
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<Opie::Core::OSmartPointer<Folder> >();
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<Opie::Core::OSmartPointer<Folder> >();
QStringList groups;
if (account) {
groups = account->getGroups();
}
for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) {
folders->append(new Folder((*it),"."));
}
return folders;
}
/* we made this method in raw nntp access of etpan and not via generic interface
* 'cause in that case there will be doubled copy operations. eg. the etpan would
* copy that stuff into its own structures and we must copy it into useable c++
* structures for our frontend. this would not make sense, so it is better to reimplement
* the stuff from generic interface of etpan but copy it direct to qt classes.
*/
QStringList NNTPwrapper::listAllNewsgroups(const QString&mask) {
login();
QStringList res;
clist *result = 0;
clistcell *current = 0;
newsnntp_group_description *group;
if ( m_nntp ) {
mailsession * session = m_nntp->sto_session;
newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session;
int err = NEWSNNTP_NO_ERROR;
if (mask.isEmpty()) {
err = newsnntp_list(news, &result);
} else {
/* taken from generic wrapper of etpan */
QString nmask = mask+".*";
diff --git a/kmicromail/libmailwrapper/nntpwrapper.h b/kmicromail/libmailwrapper/nntpwrapper.h
index 8c54f12..7c8e671 100644
--- a/kmicromail/libmailwrapper/nntpwrapper.h
+++ b/kmicromail/libmailwrapper/nntpwrapper.h
@@ -1,50 +1,52 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __NNTPWRAPPER
#define __NNTPWRAPPER
#include "mailwrapper.h"
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libetpan/clist.h>
class encodedString;
struct mailstorage;
struct mailfolder;
class NNTPwrapper : public Genericwrapper
{
Q_OBJECT
public:
NNTPwrapper( NNTPaccount *a );
virtual ~NNTPwrapper();
/* mailbox will be ignored */
- virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
+ virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
/* should only get the subscribed one */
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
QStringList listAllNewsgroups(const QString&mask = QString::null);
virtual void deleteMail(const RecMailP&mail);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual RecBodyP fetchBody( const RecMailP &mail );
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void nntp_progress( size_t current, size_t maximum );
virtual Account* getAccount() { return account; };
protected:
void login();
NNTPaccount *account;
mailstorage* m_nntp;
};
#endif
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 2888f7c..ebeed71 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -1,135 +1,137 @@
// CHANGED 2004-09-31 Lutz Rogowski
#include <stdlib.h>
#include "pop3wrapper.h"
#include "mailtypes.h"
#include "logindialog.h"
#include <libetpan/libetpan.h>
#include <klocale.h>
#include <qpe/global.h>
#include <qfile.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3ValueList>
/* we don't fetch messages larger than 5 MB */
#define HARD_MSG_SIZE_LIMIT 5242880
using namespace Opie::Core;
POP3wrapper::POP3wrapper( POP3account *a )
: Genericwrapper() {
account = a;
m_pop3 = NULL;
msgTempName = a->getFileName()+"_msg_cache";
last_msg_id = 0;
}
POP3wrapper::~POP3wrapper() {
logout();
QFile msg_cache(msgTempName);
if (msg_cache.exists()) {
msg_cache.remove();
}
}
void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
; // odebug << "POP3: " << current << " of " << maximum << "" << oendl;
}
RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
int err = MAILPOP3_NO_ERROR;
char *message = 0;
size_t length = 0;
RecBodyP body = new RecBody();
login();
if ( !m_pop3 ) {
return body;
}
mailmessage * mailmsg;
if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
return body;
}
QFile msg_cache(msgTempName);
cleanMimeCache();
if (mail->getNumber()!=last_msg_id) {
if (msg_cache.exists()) {
msg_cache.remove();
}
- msg_cache.open(IO_ReadWrite|IO_Truncate);
+ msg_cache.open(QIODevice::ReadWrite|QIODevice::Truncate);
last_msg_id = mail->getNumber();
err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
err = mailmessage_fetch(mailmsg,&message,&length);
msg_cache.writeBlock(message,length);
} else {
QString msg="";
- msg_cache.open(IO_ReadOnly);
+ msg_cache.open(QIODevice::ReadOnly);
message = new char[4096];
memset(message,0,4096);
while (msg_cache.readBlock(message,4095)>0) {
msg+=message;
memset(message,0,4096);
}
delete message;
message = (char*)malloc(msg.length()+1*sizeof(char));
memset(message,0,msg.length()+1);
memcpy(message,msg.latin1(),msg.length());
/* transform to libetpan stuff */
mailmsg = mailmessage_new();
mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
generic_message_t * msg_data;
msg_data = (generic_message_t *)mailmsg->msg_data;
msg_data->msg_fetched = 1;
msg_data->msg_message = message;
msg_data->msg_length = strlen(message);
}
body = parseMail(mailmsg);
/* clean up */
if (mailmsg)
mailmessage_free(mailmsg);
if (message)
free(message);
return body;
}
-void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
+void POP3wrapper::listMessages(const QString &, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
{
login();
if (!m_pop3)
return;
uint32_t res_messages,res_recent,res_unseen;
mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb);
Global::statusMessage( i18n("Mailbox contains %1 mail(s)").arg(res_messages));
}
void POP3wrapper::login()
{
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_pop3 != NULL )
return;
QString server,user, pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
qApp->processEvents();
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser();
@@ -158,124 +160,124 @@ void POP3wrapper::login()
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
//(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
(char*)user.latin1(),(char*)pass.latin1(),0,0,0);
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(i18n("Error %1 initializing folder").arg( err ));
mailstorage_free(m_pop3);
m_pop3 = 0;
} else {
mailsession * session = m_pop3->sto_session;
mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
if (mail) {
mail->pop3_progr_fun = &pop3_progress;
}
}
}
void POP3wrapper::logout()
{
if ( m_pop3 == NULL )
return;
mailstorage_free(m_pop3);
m_pop3 = 0;
}
-QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
- QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
+Q3ValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
+ Q3ValueList<Opie::Core::OSmartPointer<Folder> >* folders = new Q3ValueList<FolderP>();
FolderP inb=new Folder("INBOX","/");
folders->append(inb);
return folders;
}
-void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
+void POP3wrapper::deleteMailList(const Q3ValueList<RecMailP>&target)
{
login();
if (!m_pop3)
return;
int iii = 0;
int count = target.count();
- QProgressBar wid ( count );
+ Q3ProgressBar wid ( count );
wid.setCaption( i18n("Deleting ..."));
wid.show();
while (iii < count ) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(iii).arg(count));
wid.setProgress( iii );
wid.raise();
qApp->processEvents();
//qDebug("delete ");
RecMailP mail = (*target.at( iii ));
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error deleting mail"));
}
++iii;
}
}
void POP3wrapper::deleteMail(const RecMailP&mail) {
login();
if (!m_pop3)
return;
int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("error deleting mail"));
}
}
void POP3wrapper::answeredMail(const RecMailP&) {}
int POP3wrapper::deleteAllMail(const FolderP&) {
login();
if (!m_pop3)
return 0;
int res = 1;
uint32_t result = 0;
int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error getting folder info"));
return 0;
}
- QProgressBar wid ( result );
+ Q3ProgressBar wid ( result );
wid.setCaption( i18n("Deleting ..."));
wid.show();
for (unsigned int i = 0; i < result; ++i) {
Global::statusMessage(i18n("Delete message %1 of %2").arg(i).arg(result));
wid.setProgress( i );
wid.raise();
qApp->processEvents();
err = mailsession_remove_message(m_pop3->sto_session,i+1);
if (err != MAIL_NO_ERROR) {
Global::statusMessage(i18n("Error deleting mail %1").arg(i+1));
res=0;
}
break;
}
return res;
}
void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) {
login();
target_stat.message_count = 0;
target_stat.message_unseen = 0;
target_stat.message_recent = 0;
if (!m_pop3)
return;
int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count,
&target_stat.message_recent,&target_stat.message_unseen);
if (r != MAIL_NO_ERROR) {
; // odebug << "error getting folter status." << oendl;
}
}
diff --git a/kmicromail/libmailwrapper/pop3wrapper.h b/kmicromail/libmailwrapper/pop3wrapper.h
index ebc2fc7..a077877 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.h
+++ b/kmicromail/libmailwrapper/pop3wrapper.h
@@ -1,44 +1,46 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef __POP3WRAPPER
#define __POP3WRAPPER
#include "mailwrapper.h"
#include "genericwrapper.h"
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class encodedString;
struct mailstorage;
struct mailfolder;
class POP3wrapper : public Genericwrapper
{
Q_OBJECT
public:
POP3wrapper( POP3account *a );
virtual ~POP3wrapper();
/* mailbox will be ignored */
- virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
- virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
+ virtual void listMessages(const QString & mailbox, Q3ValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 );
+ virtual Q3ValueList<Opie::Core::OSmartPointer<Folder> >* listFolders();
/* mailbox will be ignored */
virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX");
virtual void deleteMail(const RecMailP&mail);
- virtual void deleteMailList(const QValueList<RecMailP>&target);
+ virtual void deleteMailList(const Q3ValueList<RecMailP>&target);
virtual void answeredMail(const RecMailP&mail);
virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&);
virtual RecBodyP fetchBody( const RecMailP &mail );
virtual encodedString* fetchRawBody(const RecMailP&mail);
virtual void logout();
virtual MAILLIB::ATYPE getType()const;
virtual const QString&getName()const;
static void pop3_progress( size_t current, size_t maximum );
virtual Account* getAccount() { return account; };
protected:
void login();
POP3account *account;
mailstorage*m_pop3;
};
#endif
diff --git a/kmicromail/libmailwrapper/sendmailprogress.cpp b/kmicromail/libmailwrapper/sendmailprogress.cpp
index 20dfe9b..6cd6409 100644
--- a/kmicromail/libmailwrapper/sendmailprogress.cpp
+++ b/kmicromail/libmailwrapper/sendmailprogress.cpp
@@ -1,34 +1,34 @@
#include "sendmailprogress.h"
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qlabel.h>
#include <klocale.h>
progressMailSend::progressMailSend(QWidget*parent, const char * name)
:progressMailSendUI(parent,name,true),m_current_mail(0),m_current_single(0),m_max_mail(0),m_max_single(0)
{
}
progressMailSend::~progressMailSend()
{
}
void progressMailSend::setMaxMails(unsigned int aMaxMails)
{
m_max_mail = aMaxMails;
allMailProgressBar->setTotalSteps(aMaxMails);
setMails();
}
void progressMailSend::setCurrentMails(unsigned int aCurrent)
{
m_current_mail = aCurrent;
allMailProgressBar->setProgress(aCurrent);
setMails();
}
void progressMailSend::setSingleMail(unsigned int aCurrent,unsigned int aMax)
{
m_current_single = aCurrent;
m_max_single = aMax;
setSingle();
}
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index 9436d43..fc01528 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -1,37 +1,37 @@
#include <stdlib.h>
#include <qdir.h>
#include <qtextcodec.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qfile.h>
//#include <opie2/odebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include "settings.h"
//#include "defines.h"
#define IMAP_PORT "143"
#define IMAP_SSL_PORT "993"
#define SMTP_PORT "25"
#define SMTP_SSL_PORT "465"
#define POP3_PORT "110"
#define POP3_SSL_PORT "995"
#define NNTP_PORT "119"
#define NNTP_SSL_PORT "563"
Settings::Settings()
: QObject()
{
accounts.setAutoDelete( true ); ;
updateAccounts();
//qDebug("++++++++++++++++++new settings ");
}
void Settings::checkDirectory()
{
return;
locateLocal("data", "kopiemail" );
/*
@@ -347,92 +347,92 @@ SMTPaccount::SMTPaccount()
{
file = SMTPaccount::getUniqueFileName();
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
useCC = false;
useBCC = false;
useReply = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
SMTPaccount::SMTPaccount( QString filename )
: Account()
{
file = filename;
accountName = "New SMTP Account";
ssl = false;
connectionType = 1;
login = false;
type = MAILLIB::A_SMTP;
port = SMTP_PORT;
}
QString SMTPaccount::getSignature()
{
QFileInfo fi ( signature );
if ( ! fi.exists() )
return QString();
QFile file( signature );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return QString();
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
QString text = ts.read();
file.close();
return text;
}
void SMTPaccount::setSignature( QString b )
{
QFileInfo fi ( signature );
if ( ! fi.exists() ) {
QString filedir( locateLocal("data", "kopiemail" ) );
signature = filedir+ "/" + getAccountName() +".sig";
qDebug("new sig %s ", signature.latin1());
save();
}
QFile fileIn( signature );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
qDebug("OM: Cannot write signature file %s ", signature.latin1() );
return ;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << b ;
fileIn.close();
}
QString SMTPaccount::getUniqueFileName()
{
int num = 0;
QString unique;
QDir dir( locateLocal("data", "kopiemail" ) );
QStringList imap = dir.entryList( "smtp-*" );
do {
unique.setNum( num++ );
} while ( imap.contains( "smtp-" + unique ) > 0 );
return unique;
}
void SMTPaccount::read()
{
KConfig *conf = new KConfig( getFileName() );
conf->setGroup( "SMTP Account" );
accountName = conf->readEntry( "Account" );
server = conf->readEntry( "Server" );
port = conf->readEntry( "Port" );
ssl = conf->readBoolEntry( "SSL" );
connectionType = conf->readNumEntry( "ConnectionType" );
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
signature = conf->readEntry( "SigFile" );
setPasswordList( conf->readListEntry( "FolderHistory"));
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 7c813cc..2df55ff 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -1,43 +1,45 @@
#include "smtpwrapper.h"
#include "mailwrapper.h"
#include "abstractmail.h"
#include "logindialog.h"
#include "mailtypes.h"
#include "sendmailprogress.h"
//#include <opie2/odebug.h>
//#include <qt.h>
#include <qapplication.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <stdlib.h>
#ifndef DESKTOP_VERSION
//#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#endif
#include <libetpan/libetpan.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
using namespace Opie::Core;
progressMailSend*SMTPwrapper::sendProgress = 0;
SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
: Generatemail()
{
m_SmtpAccount = aSmtp;
KConfig cfg( locateLocal("config", "kopiemailrc" ) );
cfg.setGroup( "Status" );
m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
emit queuedMails( m_queuedMail );
connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
m_smtp = 0;
}
SMTPwrapper::~SMTPwrapper()
{
disc_server();
}
void SMTPwrapper::emitQCop( int queued ) {
@@ -405,66 +407,66 @@ int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
fields = 0;
}
if (data) {
delete data;
}
if (from) {
free(from);
}
if (rcpts) {
smtp_address_list_free( rcpts );
}
return res;
}
/* this is a special fun */
bool SMTPwrapper::flushOutbox() {
bool returnValue = true;
; // odebug << "Sending the queue" << oendl;
if (!m_SmtpAccount) {
; // odebug << "No smtp account given" << oendl;
return false;
}
bool reset_user_value = false;
QString localfolders = AbstractMail::defaultLocalfolder();
AbstractMail*wrap = AbstractMail::getWrapper(localfolders);
if (!wrap) {
; // odebug << "memory error" << oendl;
return false;
}
QString oldPw, oldUser;
- QValueList<RecMailP> mailsToSend;
- QValueList<RecMailP> mailsToRemove;
+ Q3ValueList<RecMailP> mailsToSend;
+ Q3ValueList<RecMailP> mailsToRemove;
QString mbox("Outgoing");
wrap->listMessages(mbox,mailsToSend);
if (mailsToSend.count()==0) {
delete wrap;
; // odebug << "No mails to send" << oendl;
return false;
}
oldPw = m_SmtpAccount->getPassword();
oldUser = m_SmtpAccount->getUser();
if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
// get'em
QString user,pass;
LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
reset_user_value = true;
m_SmtpAccount->setUser(user);
m_SmtpAccount->setPassword(pass);
} else {
return true;
}
}
sendProgress = new progressMailSend();
sendProgress->show();
sendProgress->setMaxMails(mailsToSend.count());
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 41cee52..d8eee7d 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,41 +1,41 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include "mailistviewitem.h"
#include <libmailwrapper/abstractmail.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <kiconloader.h>
#include "koprefs.h"
//#include <qpe/resource.h>
-MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
+MailListViewItem::MailListViewItem(Q3ListView * parent, MailListViewItem * item )
:KListViewItem(parent,item),mail_data()
{
}
void MailListViewItem::showEntry()
{
if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
setPixmap( 0, SmallIcon ( "kmmsgreplied") );
mKeyMap.insert(0, "r" );
} else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
/* I think it looks nicer if there are not such a log of icons but only on mails
replied or new - Alwin*/
//setPixmap( 0,SmallIcon ("kmmsgunseen") );
mKeyMap.insert(0, "s" );
} else {
setPixmap( 0,SmallIcon ( "kmmsgnew") );
mKeyMap.insert(0, "u" );
}
QString fsize = mail_data->MsgsizeString();
// 1.23
// 11.23
// 111.23
// 999.23 maxlen
QString fsort;
switch(fsize.length() ) {
case 6:
fsort = "00" + fsize ;
break;
case 7:
fsort = "0" + fsize ;
break;
default:
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h
index b409c9d..ecc01ba 100644
--- a/kmicromail/mailistviewitem.h
+++ b/kmicromail/mailistviewitem.h
@@ -1,27 +1,27 @@
// CHANGED 2004-08-06 Lutz Rogowski
#ifndef __MAILLISTVIEWITEM_H
#define __MAILLISTVIEWITEM_H
#include <klistview.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/maildefines.h>
class MailListViewItem:public KListViewItem
{
public:
- MailListViewItem(QListView * parent, MailListViewItem * after );
+ MailListViewItem(Q3ListView * parent, MailListViewItem * after );
virtual ~MailListViewItem(){}
void storeData(const RecMailP&data);
const RecMailP&data()const;
void showEntry();
MAILLIB::ATYPE wrapperType();
QString key(int column, bool) const;
void setSortKey(int column,const QString &key);
protected:
RecMailP mail_data;
private:
QMap<int,QString> mKeyMap;
};
#endif
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp
index fe4bc76..dc73455 100644
--- a/kmicromail/main.cpp
+++ b/kmicromail/main.cpp
@@ -1,69 +1,72 @@
// CHANGED 2004-08-06 Lutz Rogowski
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <libkdepim/externalapphandler.h>
#include <stdlib.h>
#else
#include <qapplication.h>
#include <qstring.h>
#include <qwindowsstyle.h>
#include <qplatinumstyle.h>
#include <qsgistyle.h>
#endif
#include "opiemail.h"
#include <qdir.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <stdio.h>
#include "mainwindow.h"
#include "koprefs.h"
#include <libkdepim/kpimglobalprefs.h>
void dumpMissing();
//using namespace Opie::Core;
int main( int argc, char **argv ) {
+ if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi");
#ifndef DESKTOP_VERSION
QPEApplication a( argc, argv );
a.setKeepRunning ();
#else
QApplication a( argc, argv );
QApplication::setStyle( new QPlatinumStyle ());
#endif
//a.setFont( KOPrefs::instance()->mAppFont );
KGlobal::setAppName( "kopiemail" );
QString fileName ;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
if ( QApplication::desktop()->width() > 320 )
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/");
else
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/");
#else
fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/";
KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail")));
KPimGlobalPrefs::instance()->setGlobalConfig();
QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
QApplication::setFont( KOPrefs::instance()->mAppFont );
OpieMail mw;
#ifndef DESKTOP_VERSION
//qDebug("CONNECT ");
- QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& )));
+ QObject::connect( &a, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )),&mw, SLOT(message( const Q3CString&, const QByteArray& )));
// QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
a.showMainWidget(&mw );
#else
a.setMainWidget(&mw );
mw.show();
//m.resize( 800, 600 );
QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
#endif
int rv = a.exec();
dumpMissing();
KPimGlobalPrefs::instance()->writeConfig();
return rv;
}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index d547dda..627d92e 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,75 +1,81 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include <qlabel.h>
-#include <qvbox.h>
-#include <qheader.h>
+#include <q3vbox.h>
+#include <q3header.h>
#include <qtimer.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3GridLayout>
+#include <Q3ValueList>
+#include <QPixmap>
+#include <Q3PopupMenu>
//#include <kdialog.h>
#include <kiconloader.h>
#include <kapplication.h>
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#include <qstatusbar.h>
#include <kabc/stdaddressbook.h>
extern QStatusBar* globalSstatusBarMainWindow;
#else
#include <qpe/qpeapplication.h>
#include <klocale.h>
#endif
#include "defines.h"
#include "koprefs.h"
#include "mainwindow.h"
#include "mailistviewitem.h"
#include <KDGanttMinimizeSplitter.h>
#include <libkdepim/kpimglobalprefs.h>
#include "koprefs.h"
-MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
- : QMainWindow( parent, name ) //, flags )
+MainWindow::MainWindow( QWidget *parent, const char *name, Qt::WFlags flags )
+ : Q3MainWindow( parent, name ) //, flags )
{
#ifdef DESKTOP_VERSION
globalSstatusBarMainWindow = statusBar();
#endif
setCaption( i18n( "KOpieMail/Pi" ) );
setToolBarsMovable( false );
//KABC::StdAddressBook::self();
- toolBar = new QToolBar( this );
+ toolBar = new Q3ToolBar( this );
menuBar = new QPEMenuBar( toolBar );
- mailMenu = new QPopupMenu( menuBar );
+ mailMenu = new Q3PopupMenu( menuBar );
menuBar->insertItem( i18n( "Mail" ), mailMenu );
- settingsMenu = new QPopupMenu( menuBar );
+ settingsMenu = new Q3PopupMenu( menuBar );
menuBar->insertItem( i18n( "Settings" ), settingsMenu );
addToolBar( toolBar );
toolBar->setHorizontalStretchable( true );
QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
0, 0, this );
connect(getMail, SIGNAL( activated() ),
SLOT( slotGetAllMail() ) );
getMail->addTo( mailMenu );
getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
0, 0, this );
getMail->addTo( toolBar );
getMail->addTo( mailMenu );
connect(getMail, SIGNAL( activated() ),
SLOT( slotGetMail() ) );
composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
0, 0, this );
composeMail->addTo( toolBar );
composeMail->addTo( mailMenu );
sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
0, 0, this );
sendQueued->addTo( toolBar );
sendQueued->addTo( mailMenu );
/*
syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
0, 0, this );
syncFolders->addTo( toolBar );
syncFolders->addTo( mailMenu );
@@ -85,210 +91,210 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
/*
searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
0, 0, this );
searchMails->kopddTo( toolBar );
searchMails->addTo( mailMenu );
*/
deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
deleteMails->addTo( toolBar );
deleteMails->addTo( mailMenu );
connect( deleteMails, SIGNAL( activated() ),
SLOT( slotDeleteAllMail() ) );
editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") ,
0, 0, this );
editSettings->addTo( settingsMenu );
connect( editSettings, SIGNAL( activated() ),
SLOT( slotEditSettings() ) );
QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") ,
0, 0, this );
editSettings2->addTo( settingsMenu );
connect( editSettings2, SIGNAL( activated() ),
SLOT( slotEditGlobalSettings() ) );
editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
0, 0, this );
editAccounts->addTo( settingsMenu );
- codecMenu = new QPopupMenu( menuBar );
+ codecMenu = new Q3PopupMenu( menuBar );
codecMenu->insertItem( "Western (iso-8859-1)",0,0);
codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
codecMenu->insertItem( "Western (iso-8859-15)",2,2);
codecMenu->insertItem( "Chinese (big-5)",3,3);
codecMenu->insertItem( "Unicode (utf-8)",4,4);
codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
//disabled
//settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
//setCentralWidget( view );
- QVBox* wrapperBox = new QVBox( this );
+ Q3VBox* wrapperBox = new Q3VBox( this );
setCentralWidget( wrapperBox );
// QWidget *view = new QWidget( wrapperBox );
KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox);
splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down);
KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor);
split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
//layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
subLE = 0;
fromLE = 0;
toLE = 0;
if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) {
QWidget* infoBox = new QWidget( splithor );
- QGridLayout *griLay = new QGridLayout( infoBox, 2,2);
+ Q3GridLayout *griLay = new Q3GridLayout( infoBox, 2,2);
if ( KOPrefs::instance()->mShowInfoSub ) {
griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 );
griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ;
}
if ( KOPrefs::instance()->mShowInfoFrom ) {
griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 );
griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ;
}
if ( KOPrefs::instance()->mShowInfoTo ) {
griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 );
griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ;
}
infoBox->setMaximumHeight( infoBox->sizeHint().height() );
if ( !KOPrefs::instance()->mShowInfoStart ) {
QTimer::singleShot( 1,splithor, SLOT ( toggle() ) );
}
}
folderView = new AccountView( split );
folderView->header()->hide();
folderView->setRootIsDecorated( false );
folderView->addColumn( i18n( "Mailbox" ) );
//layout->addWidget( folderView );
mailView = new KListView( split );
mailView->addColumn( i18n( " " ) );
- mailView->addColumn( i18n( "Subject" ),QListView::Manual );
- mailView->addColumn( i18n( "Sender" ),QListView::Manual );
- mailView->addColumn( i18n( "Size" ),QListView::Manual);
- mailView->addColumn( i18n( "Date" ),QListView::Manual);
+ mailView->addColumn( i18n( "Subject" ),Q3ListView::Manual );
+ mailView->addColumn( i18n( "Sender" ),Q3ListView::Manual );
+ mailView->addColumn( i18n( "Size" ),Q3ListView::Manual);
+ mailView->addColumn( i18n( "Date" ),Q3ListView::Manual);
if ( KOPrefs::instance()->mShowToField )
- mailView->addColumn( i18n( "To" ),QListView::Manual);
+ mailView->addColumn( i18n( "To" ),Q3ListView::Manual);
mailView->setAllColumnsShowFocus(true);
//mailView->setSorting(-1);
mailView->setRootIsDecorated( false );
statusWidget = new StatusWidget( wrapperBox );
statusWidget->hide();
- mailView->setSelectionMode( QListView::Multi );
+ mailView->setSelectionMode( Q3ListView::Multi );
mailView->setMultiSelection( true);
mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor );
//layout->addWidget( mailView );
//layout->setStretchFactor( folderView, 1 );
//layout->setStretchFactor( mailView, 2 );
slotAdjustLayout();
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
if ( subLE )
QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold);
if ( fromLE )
QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold);
if ( toLE )
QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold);
#endif
- connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
- SLOT( mailLeftClicked(QListViewItem*) ) );
- connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
- SLOT( mailLeftClicked(QListViewItem*) ) );
- connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
- SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
- connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
- this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
-
- connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this,
- SLOT( setInfoFields(QListViewItem*) ) );
+ connect( mailView, SIGNAL( doubleClicked (Q3ListViewItem* )),this,
+ SLOT( mailLeftClicked(Q3ListViewItem*) ) );
+ connect( mailView, SIGNAL( returnPressed (Q3ListViewItem* )),this,
+ SLOT( mailLeftClicked(Q3ListViewItem*) ) );
+ connect( mailView, SIGNAL( mouseButtonPressed(int,Q3ListViewItem*,const QPoint&,int) ),this,
+ SLOT( mailHold(int,Q3ListViewItem*,const QPoint&,int) ) );
+ connect(folderView, SIGNAL(refreshMailview(const Q3ValueList<RecMailP>&)),
+ this,SLOT(refreshMailView(const Q3ValueList<RecMailP>&)));
+
+ connect( mailView, SIGNAL( currentChanged (Q3ListViewItem* )),this,
+ SLOT( setInfoFields(Q3ListViewItem*) ) );
connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
//mailView->setMultiSelection ( true );
//mailView->setSelectionMode( QListView::Extended );
- QValueList<int> list;
+ Q3ValueList<int> list;
int fw = 100;
if ( QApplication::desktop()->width() > 320 )
fw = 50;
list.append( fw );
list.append( 100 );
split->setSizes( list );
QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) );
mailView->setShowSortIndicator ( true );
QLabel *spacer = new QLabel( toolBar );
spacer->setBackgroundMode( QWidget::PaletteButton );
toolBar->setStretchableWidget( spacer );
QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
if ( QApplication::desktop()->width() > 320 )
closeMail->addTo(toolBar);
closeMail->addTo(mailMenu);
- QPopupMenu* helpMenu = new QPopupMenu( menuBar );
+ Q3PopupMenu* helpMenu = new Q3PopupMenu( menuBar );
menuBar->insertItem( i18n( "Help" ), helpMenu );
QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
li->addTo(helpMenu);
li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
li->addTo(helpMenu);
li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
li->addTo(helpMenu);
connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
slotSetCodec( KOPrefs::instance()->mCurrentCodec );
menuBar->setMaximumWidth( menuBar->sizeHint().width());
//menuBar->setMaximumSize( menuBar->sizeHint());
#ifdef DESKTOP_VERSION
resize ( 640, 480 );
#endif
}
MainWindow::~MainWindow()
{
}
-void MainWindow::setInfoFields(QListViewItem* item )
+void MainWindow::setInfoFields(Q3ListViewItem* item )
{
if ( item == 0) {
if ( subLE ) subLE->setText("");
if ( fromLE ) fromLE->setText("");
if ( toLE ) toLE->setText("");
return;
}
RecMailP mail = ((MailListViewItem*)item)->data();
if ( subLE ) subLE->setText(mail->getSubject());
if ( fromLE ) fromLE->setText(mail->getFrom());
if ( toLE ) toLE->setText(mail->To().join(";" ));
if ( subLE ) subLE->setCursorPosition(0);
if ( fromLE ) fromLE->setCursorPosition(0);
if ( toLE ) toLE->setCursorPosition(0);
}
void MainWindow::slotSetCodec( int codec )
{
codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
//qDebug("codec %d ", codec);
KOPrefs::instance()->mCurrentCodec = codec;
KOPrefs::instance()->isDirty = true;
QString name;
switch ( codec ) {
case 0:
name = "iso-8859-1";
break;
case 1:
name = "iso-8859-5";
break;
case 2:
name = "iso-8859-15";
@@ -316,131 +322,131 @@ void MainWindow::showAbout()
QString version;
#include <../version>
QString cap = "About KOpieMail/Pi";
QString text = i18n("KOpieMail/Platform-independent\n") +
"(OM/Pi) " + version + " - "
#ifdef DESKTOP_VERSION
"Desktop Edition\n"
#else
"PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
#endif
"www.pi-sync.info\n\n"
"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n"
"KOpieMail/Pi is based on Opie Mail\n"
"Copyright (c) Rajko Albrecht and the Opie team\n"
"KOpieMail/Pi is licensed under the GPL\n"
"\n"
"KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
"Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
"libEtPan has its own licence - see LibEtPan licence\n";
KApplication::showText( cap, text );
}
void MainWindow::showEtpanLicence()
{
KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
}
-void MainWindow::appMessage(const QCString &, const QByteArray &)
+void MainWindow::appMessage(const Q3CString &, const QByteArray &)
{
qDebug("appMessage implemented by subclass");
}
void MainWindow::slotAdjustLayout() {
/*
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
layout->setDirection( QBoxLayout::TopToBottom );
} else {
layout->setDirection( QBoxLayout::LeftToRight );
}
*/
}
void MainWindow::slotAdjustColumns()
{
if ( !folderView->isHidden() )
folderView->setColumnWidth( 0, folderView->visibleWidth() );
mailView->setColumnWidth( 0, 10 );
mailView->setColumnWidth( 1, 100 );
mailView->setColumnWidth( 2, 100 );
mailView->setColumnWidth( 3, 70 );
mailView->setColumnWidth( 4, 180 );
if ( KOPrefs::instance()->mShowToField )
mailView->setColumnWidth( 5, 100 );
mailView->setColumnAlignment( 3, AlignRight);
}
void MainWindow::slotAdjustColumnsWide()
{
if ( !folderView->isHidden() )
folderView->setColumnWidth( 0, folderView->visibleWidth() );
mailView->setColumnWidth( 0, 10 );
mailView->setColumnWidth( 1, 200 );
mailView->setColumnWidth( 2, 200 );
mailView->setColumnWidth( 3, 70 );
mailView->setColumnWidth( 4, 180 );
if ( KOPrefs::instance()->mShowToField )
mailView->setColumnWidth( 5, 100 );
mailView->setColumnAlignment( 3, AlignRight);
}
void MainWindow::slotEditSettings()
{
}
void MainWindow::slotEditGlobalSettings()
{
}
void MainWindow::slotShowFolders( bool )
{
qDebug("not implemented: ");
}
-void MainWindow::refreshMailView(const QValueList<RecMailP>&)
+void MainWindow::refreshMailView(const Q3ValueList<RecMailP>&)
{
qDebug("not implemented: ");
}
-void MainWindow::mailLeftClicked(QListViewItem * )
+void MainWindow::mailLeftClicked(Q3ListViewItem * )
{
qDebug("not implemented: ");
}
void MainWindow::displayMail()
{
qDebug("not implemented: ");
}
void MainWindow::slotDeleteMail()
{
qDebug("not implemented: ");
}
-void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
+void MainWindow::mailHold(int, Q3ListViewItem *,const QPoint&,int )
{
qDebug("not implemented: ");
}
void MainWindow::slotSendQueued()
{
qDebug("not implemented: ");
}
void MainWindow::slotEditAccounts()
{
qDebug("not implemented: ");
}
void MainWindow::slotComposeMail()
{
qDebug("not implemented: ");
}
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h
index f65f3b4..1ccadc2 100644
--- a/kmicromail/mainwindow.h
+++ b/kmicromail/mainwindow.h
@@ -1,75 +1,79 @@
// CHANGED 2004-08-06 Lutz Rogowski
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <qmainwindow.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3ValueList>
+#include <Q3PopupMenu>
#include <klistview.h>
#include <qaction.h>
#include <qlineedit.h>
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#ifdef DESKTOP_VERSION
#include <qmenubar.h>
#define QPEMenuBar QMenuBar
#else
#include <qpe/qpemenubar.h>
#endif
#include "accountview.h"
#include "statuswidget.h"
#include <libmailwrapper/mailtypes.h>
#include <opie2/osmartpointer.h>
class RecMail;
-class MainWindow : public QMainWindow
+class MainWindow : public Q3MainWindow
{
Q_OBJECT
public:
- MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
+ MainWindow( QWidget *parent = 0, const char *name = 0, Qt::WFlags flags = 0 );
virtual ~MainWindow();
public slots:
virtual void slotAdjustColumns();
virtual void slotAdjustColumnsWide();
- virtual void appMessage(const QCString &msg, const QByteArray &data);
+ virtual void appMessage(const Q3CString &msg, const QByteArray &data);
virtual void slotComposeMail();
protected slots:
- virtual void setInfoFields(QListViewItem* );
+ virtual void setInfoFields(Q3ListViewItem* );
virtual void slotSendQueued();
virtual void slotEditAccounts();
virtual void slotShowFolders( bool show );
- virtual void refreshMailView(const QValueList<RecMailP>&);
+ virtual void refreshMailView(const Q3ValueList<RecMailP>&);
virtual void displayMail();
virtual void slotGetMail() = 0;
virtual void slotGetAllMail() = 0;
virtual void slotDeleteMail();
virtual void slotDeleteAllMail() = 0;
virtual void slotSetCodec(int);
- virtual void mailHold(int, QListViewItem *,const QPoint&,int);
+ virtual void mailHold(int, Q3ListViewItem *,const QPoint&,int);
virtual void slotAdjustLayout();
virtual void slotEditSettings();
virtual void slotEditGlobalSettings();
- virtual void mailLeftClicked( QListViewItem * );
+ virtual void mailLeftClicked( Q3ListViewItem * );
void showLicence();
void showAbout();
void showEtpanLicence();
protected:
- QToolBar *toolBar;
+ Q3ToolBar *toolBar;
StatusWidget *statusWidget;
QPEMenuBar *menuBar;
- QPopupMenu *mailMenu, *settingsMenu, *codecMenu;
+ Q3PopupMenu *mailMenu, *settingsMenu, *codecMenu;
QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails,
*editSettings, *editAccounts, *syncFolders;
AccountView *folderView;
KListView *mailView;
QLineEdit* toLE,*fromLE,*subLE;
//QBoxLayout *layout;
};
#endif
diff --git a/kmicromail/nntpgroups.cpp b/kmicromail/nntpgroups.cpp
index c729f79..d2213d4 100644
--- a/kmicromail/nntpgroups.cpp
+++ b/kmicromail/nntpgroups.cpp
@@ -1,62 +1,62 @@
#include "nntpgroups.h"
#include <libmailwrapper/settings.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlineedit.h>
using namespace Opie::Core;
-NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, WFlags fl)
+NNTPGroups::NNTPGroups(NNTPaccount *account, QWidget* parent, const char* name, Qt::WFlags fl)
: NNTPGroupsUI(parent,name,fl),subscribedGroups()
{
m_Account = account;
fillGroups();
}
NNTPGroups::~NNTPGroups()
{
}
void NNTPGroups::slotGetNG()
{
if (!m_Account) return;
GroupListView->clear();
NNTPwrapper tmp( m_Account );
QString filter = Groupfilteredit->text();
QStringList list = tmp.listAllNewsgroups(filter);
subscribedGroupsNotListed = subscribedGroups;
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
- QCheckListItem *item;
- item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
+ Q3CheckListItem *item;
+ item = new Q3CheckListItem( GroupListView, (*it), Q3CheckListItem::CheckBox );
if ( subscribedGroups.contains( (*it) ) >= 1 ) {
item->setOn( true );
subscribedGroupsNotListed.remove((*it));
}
}
}
void NNTPGroups::fillGroups()
{
if (!m_Account) return;
subscribedGroups = m_Account->getGroups();
for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
- QCheckListItem *item;
- item = new QCheckListItem( GroupListView, (*it), QCheckListItem::CheckBox );
+ Q3CheckListItem *item;
+ item = new Q3CheckListItem( GroupListView, (*it), Q3CheckListItem::CheckBox );
item->setOn( true );
}
}
void NNTPGroups::storeValues()
{
if (!m_Account) return;
- QListViewItemIterator list_it( GroupListView );
+ Q3ListViewItemIterator list_it( GroupListView );
subscribedGroups.clear();
for ( ; list_it.current(); ++list_it ) {
- if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
+ if ( ( (Q3CheckListItem*)list_it.current() )->isOn() ) {
subscribedGroups.append( list_it.current()->text(0) );
}
}
subscribedGroups+=subscribedGroupsNotListed;
m_Account->setGroups( subscribedGroups );
}
diff --git a/kmicromail/nntpgroups.h b/kmicromail/nntpgroups.h
index e5b7c35..80cc329 100644
--- a/kmicromail/nntpgroups.h
+++ b/kmicromail/nntpgroups.h
@@ -1,33 +1,33 @@
#ifndef __NNTPGROUPS_WINDOW__
#define __NNTPGROUPS_WINDOW__
#include "nntpgroupsui.h"
#include <libmailwrapper/nntpwrapper.h>
class NNTPaccount;
class QStringList;
class NNTPGroups:public NNTPGroupsUI
{
Q_OBJECT
public:
- NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ NNTPGroups(NNTPaccount *account, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~NNTPGroups();
/* must be called from external.
* it will store the new subscription list into the account
* but don't save them, this must be done by the calling class.
*/
void storeValues();
protected slots:
virtual void slotGetNG();
protected:
virtual void fillGroups();
NNTPaccount*m_Account;
QStringList subscribedGroups,subscribedGroupsNotListed;
};
#endif
diff --git a/kmicromail/nntpgroupsdlg.cpp b/kmicromail/nntpgroupsdlg.cpp
index f564b10..bfe1d35 100644
--- a/kmicromail/nntpgroupsdlg.cpp
+++ b/kmicromail/nntpgroupsdlg.cpp
@@ -1,30 +1,32 @@
#include "nntpgroupsdlg.h"
#include "nntpgroups.h"
#include <klocale.h>
#include <libmailwrapper/settings.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name)
: QDialog(parent,name,true,0)
{
setCaption(i18n("Subscribed newsgroups"));
m_Account = account;
- QVBoxLayout*dlglayout = new QVBoxLayout(this);
+ Q3VBoxLayout*dlglayout = new Q3VBoxLayout(this);
dlglayout->setSpacing(2);
dlglayout->setMargin(1);
groupsWidget = new NNTPGroups(account,this);
dlglayout->addWidget(groupsWidget);
}
NNTPGroupsDlg::~NNTPGroupsDlg()
{
}
void NNTPGroupsDlg::accept()
{
groupsWidget->storeValues();
m_Account->save();
QDialog::accept();
}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 75a75b9..f453be5 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,135 +1,140 @@
// CHANGED 2004-09-31 Lutz Rogowski
// CHANGED 2004-08-06 Lutz Rogowski
#define protected public
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3CString>
+#include <QPixmap>
+#include <Q3PopupMenu>
#undef protected
#include "koprefsdialog.h"
#include <kapplication.h>
#include <libkdepim/externalapphandler.h>
#include <libkdepim/kpimglobalprefs.h>
#ifdef MINIKDE_KDIALOG_H
#undef MINIKDE_KDIALOG_H
#endif
#include "settingsdialog.h"
#include "opiemail.h"
#include "editaccounts.h"
#include "composemail.h"
#include "mailistviewitem.h"
#include "viewmail.h"
#include "selectstore.h"
#include "selectsmtp.h"
#include "accountitem.h"
#include "accountview.h"
#include "klocale.h"
#include <qmessagebox.h>
#include <qtimer.h>
#include <qcursor.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qregexp.h>
#include <qpe/global.h>
#ifdef DESKTOP_VERSION
#include <qapplication.h>
#else
#include <qpe/qpeapplication.h>
#endif
#include <libmailwrapper/smtpwrapper.h>
#include <libmailwrapper/mailtypes.h>
#include <libmailwrapper/abstractmail.h>
#include "koprefs.h"
//using namespace Opie::Core;
OpieMail::OpieMail( QWidget *parent, const char *name )
: MainWindow( parent, name) //, WStyle_ContextHelp )
{
mCurrentComposer = 0;
settings = new Settings();
tb = 0;
setIcon(SmallIcon( "kmicromail" ) );
folderView->populate( settings->getAccounts() );
connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
folderView->setFocus();
}
OpieMail::~OpieMail()
{
if (settings) delete settings;
if ( tb )
delete tb;
}
-void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
+void OpieMail::appMessage(const Q3CString &msg, const QByteArray &data)
{
}
#include <stdlib.h>
-void OpieMail::message(const QCString &msg, const QByteArray &data)
+void OpieMail::message(const Q3CString &msg, const QByteArray &data)
{
// copied from old mail2
static int ii = 0;
//qDebug("QCOP CALL ############################# %d ", ii);
//QString mess ( msg );
//qDebug("Message = %s ",mess.latin1());
++ii;
//qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
mPendingEmail = QString::null;
mPendingName = QString::null;
if (msg == "writeMail(QString,QString)")
{
//qDebug("writeMail(QString,QString) ");
- QDataStream stream(data,IO_ReadOnly);
+ QDataStream stream(data,QIODevice::ReadOnly);
stream >> mPendingName >> mPendingEmail;
// removing the whitespaces at beginning and end is needed!
QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
}
else if (msg == "newMail()")
{
//qDebug("slotComposeMail() ");
// we cannot call slotComposeMail(); directly, because may be executing a QCOP call
// and a QCOP call does not like a processevents in his execution
// with the Qtimer we call slotComposeMail() after we reached the main event loop
QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
// slotComposeMail();
}
else if (msg == "newMail(QString)")
{
//qDebug(" newMail(QString)");
- QDataStream stream(data,IO_ReadOnly);
+ QDataStream stream(data,QIODevice::ReadOnly);
stream >> mPendingName;
// the format is
// NAME <EMAIL>:SUBJECT
QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
} else {
mPendingData = data;
mPendingMessage = msg;
QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
}
//qDebug("END OpieMail::message ");
}
void OpieMail::slotExtAppHandler()
{
ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
}
void OpieMail::slotwriteMail2(const QString& namemail )
{
//qDebug("OpieMail::slotwriteMail2 ");
//qApp->processEvents();
ComposeMail compose( settings, this, 0, true );
if ( !namemail.isEmpty() ) {
QString to = namemail;
if ( namemail.find( " <") > 1 ) {
to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
} else
if ( namemail.find( "<") > 1 ) {
to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
}
int sub = to.find( ">:");
if ( sub > 0 ) {
compose.setTo( to.left(sub+1) );
@@ -250,400 +255,400 @@ void OpieMail::slotEditGlobalSettings()
gc.exec();
}
void OpieMail::slotEditSettings()
{
KOPrefsDialog settingsDialog( this, "koprefs", true );
#ifndef DESKTOP_VERSION
settingsDialog.showMaximized();
#endif
settingsDialog.exec();
slotSetCodec( KOPrefs::instance()->mCurrentCodec );
// KApplication::execDialog(settingsDialog);
}
void OpieMail::slotEditAccounts()
{
EditAccounts eaDialog( settings, this, 0, true );
eaDialog.slotAdjustColumns();
#ifndef DESKTOP_VERSION
eaDialog.showMaximized();
#endif
eaDialog.exec();
if ( settings ) delete settings;
settings = new Settings();
folderView->populate( settings->getAccounts() );
}
void OpieMail::replyMail()
{
- QListViewItem*item = mailView->currentItem();
+ Q3ListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
QString rtext;
rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
.arg( mail->getFrom())
.arg( mail->getDate());
QString text = body->Bodytext();
QStringList lines = QStringList::split(QRegExp("\\n"), text);
QStringList::Iterator it;
for (it = lines.begin(); it != lines.end(); it++)
{
rtext += "> " + *it + "\n";
}
rtext += "\n";
QString prefix;
if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
else prefix = "Re: "; // no i18n on purpose
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
if (mail->Replyto().isEmpty()) {
composer.setTo( mail->getFrom());
} else {
composer.setTo( mail->Replyto());
}
composer.setSubject( prefix + mail->getSubject());
composer.setMessage( rtext );
composer.setInReplyTo( mail->Msgid());
composer.setCharset( body->getCharset() );
mCurrentComposer = &composer;
if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
{
mail->Wrapper()->answeredMail(mail);
}
mCurrentComposer = 0;
folderView->refreshOutgoing();
delete settings;
}
void OpieMail::closeViewMail(ViewMail * vm)
{
vm->hide();
}
void OpieMail::slotDownloadMail( )
{
- QListViewItem*item = mailView->currentItem();
+ Q3ListViewItem*item = mailView->currentItem();
if (!item ) {
Global::statusMessage("Error: No item slected!");
return;
}
RecMailP mail = ((MailListViewItem*)item)->data();
Account * acc = mail->Wrapper()->getAccount();
if ( !acc ) {
Global::statusMessage("Mail is already stored locally!");
return;
}
QString lfName = acc->getLocalFolder();
//qDebug("local folder " + lfName );
if ( lfName.isEmpty() )
lfName = acc->getAccountName();
AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
//qDebug("target %d %d ",targetMail,mail->Wrapper() );
if ( targetMail == mail->Wrapper() ) {
Global::statusMessage("Mail is already locally stored!");
return;
}
if ( !targetMail->createMbox(lfName)) {
Global::statusMessage("Error creating folder!");
return;
}
Global::statusMessage("Fetching mail...please wait!");
qApp->processEvents();
encodedString*st = 0;
st = mail->Wrapper()->fetchRawBody(mail);
if ( st ) {
targetMail->storeMessage(st->Content(),st->Length(),lfName);
Global::statusMessage("Mail stored in "+ lfName);
delete st;
} else {
Global::statusMessage("Error: Cannot fetch mail!");
}
}
void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
{
- QListViewItem*item = mailView->currentItem();
+ Q3ListViewItem*item = mailView->currentItem();
if (!item ) {
closeViewMail(vm);
return;
}
RecMailP mail = ((MailListViewItem*)item)->data();
mail->Wrapper()->deleteMail( mail );
item = item->itemBelow();
if (!item ) {
closeViewMail(vm);
return;
}
mailView->setCurrentItem(item);
mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
vm->setBody( body );
vm->setMail( mail );
}
void OpieMail::displayNextMail(ViewMail * vm)
{
- QListViewItem*item = mailView->currentItem();
+ Q3ListViewItem*item = mailView->currentItem();
if (!item) return;
( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
item = item->itemBelow();
if (!item) {
vm->setCaption(i18n("End of List" ));
return;
}
mailView->setCurrentItem(item);
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
vm->setBody( body );
vm->setMail( mail );
}
void OpieMail::displayMail()
{
- QListViewItem*item = mailView->currentItem();
+ Q3ListViewItem*item = mailView->currentItem();
if (!item) return;
RecMailP mail = ((MailListViewItem*)item)->data();
RecBodyP body = folderView->fetchBody(mail);
ViewMail readMail( this,"", Qt::WType_Modal );
readMail.setBody( body );
readMail.setMail( mail );
#ifndef DESKTOP_VERSION
readMail.showMaximized();
#else
readMail.resize( 640, 480);
#endif
connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
readMail.exec();
if ( readMail.deleted )
{
folderView->refreshCurrent();
}
else
{
- QListViewItem*item = mailView->currentItem();
+ Q3ListViewItem*item = mailView->currentItem();
if (item)
( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
}
}
void OpieMail::slotGetAllMail()
{
- QListViewItem * item = folderView->firstChild();
+ Q3ListViewItem * item = folderView->firstChild();
while ( item ){
((AccountViewItem *)item)->contextMenuSelected( 101 );
item = item->nextSibling ();
}
}
void OpieMail::slotGetMail()
{
- QListViewItem * item = folderView->currentItem();
+ Q3ListViewItem * item = folderView->currentItem();
if ( ! item ) return;
((AccountViewItem *)item)->contextMenuSelected( 101 );
}
void OpieMail::slotDeleteMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
mail->Wrapper()->deleteMail( mail );
folderView->refreshCurrent();
}
}
void OpieMail::slotDeleteAllMail()
{
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
else
return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
mail->Wrapper()->deleteMailList(t);
folderView->refreshCurrent();
}
void OpieMail::clearSelection()
{
mailView->clearSelection();
}
void OpieMail::selectAll()
{
- QListViewItem* item = mailView->firstChild ();
+ Q3ListViewItem* item = mailView->firstChild ();
while ( item ) {
mailView->setSelected ( item, true );
item = item->nextSibling();
}
}
-void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
+void OpieMail::mailHold(int button, Q3ListViewItem *item,const QPoint&,int )
{
if (!mailView->currentItem()) return;
MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
/* just the RIGHT button - or hold on pda */
if (button!=2) {return;}
if (!item) return;
- QPopupMenu *m = new QPopupMenu(0);
+ Q3PopupMenu *m = new Q3PopupMenu(0);
if (m)
{
if (mailtype==MAILLIB::A_NNTP) {
m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
m->insertSeparator();
m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
} else {
if (folderView->currentisDraft()) {
m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
}
m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
m->insertSeparator();
m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
m->insertSeparator();
m->insertItem(i18n("Select all"),this,SLOT(selectAll()));
m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
}
m->setFocus();
m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
delete m;
}
}
void OpieMail::slotShowFolders( bool show )
{
if ( show && folderView->isHidden() )
{
slotAdjustColumns();
folderView->show();
//slotAdjustColumns();
}
else if ( !show && !folderView->isHidden() )
{
slotAdjustColumnsWide();
folderView->hide();
//slotAdjustColumnsWide();
}
}
-void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
+void OpieMail::refreshMailView(const Q3ValueList<RecMailP>&list)
{
MailListViewItem*item = 0;
mailView->clear();
- QValueList<RecMailP>::ConstIterator it;
+ Q3ValueList<RecMailP>::ConstIterator it;
for (it = list.begin(); it != list.end();++it)
{
item = new MailListViewItem(mailView,item);
item->storeData((*it));
item->showEntry();
}
mailView->setSorting ( 4, false );
}
-void OpieMail::mailLeftClicked( QListViewItem *item )
+void OpieMail::mailLeftClicked( Q3ListViewItem *item )
{
mailView->clearSelection();
/* just LEFT button - or tap with stylus on pda */
//if (button!=1) return;
if (!item) return;
if (folderView->currentisDraft()) {
reEditMail();
} else {
displayMail();
}
}
void OpieMail::slotMoveCopyMail()
{
if (!mailView->currentItem()) return;
RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));
return;
}
sels.hide();
qApp->processEvents();
// qDebug("hiding sels ");
mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
folderView->refreshCurrent();
}
void OpieMail::slotMoveCopyAllMail()
{
if (!mailView->currentItem()) return;
- QValueList<RecMailP> t;
+ Q3ValueList<RecMailP> t;
// if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
t.append( item->data() );
}
item = (MailListViewItem*)item->nextSibling();
}
}
// else
// return;
if ( t.count() == 0 )
return;
RecMailP mail = t.first();
AbstractMail*targetMail = 0;
QString targetFolder = "";
Selectstore sels;
folderView->setupFolderselect(&sels);
if (!sels.exec()) return;
targetMail = sels.currentMail();
targetFolder = sels.currentFolder();
if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
targetFolder.isEmpty())
{
return;
}
if (sels.newFolder() && !targetMail->createMbox(targetFolder))
{
QMessageBox::critical(0,i18n("Error creating new Folder"),
i18n("<center>Error while creating<br>new folder - breaking.</center>"));
return;
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index bdd9058..ea64dc4 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -1,68 +1,71 @@
// CHANGED 2004-09-31 Lutz Rogowski
#ifndef OPIEMAIL_H
#define OPIEMAIL_H
#include "mainwindow.h"
#include <libmailwrapper/settings.h>
#include <opie2/osmartpointer.h>
#include <libmailwrapper/mailtypes.h>
#include <viewmail.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3ValueList>
class ComposeMail;
class OpieMail : public MainWindow
{
Q_OBJECT
public:
OpieMail( QWidget *parent = 0, const char *name = 0 );
virtual ~OpieMail();
static QString appName() { return QString::fromLatin1("kopiemail"); }
public slots:
virtual void slotwriteMail(const QString&name,const QString&email);
virtual void slotwriteMail2(const QString&nameemail);
virtual void slotComposeMail();
virtual void slotExtAppHandler();
- virtual void appMessage(const QCString &msg, const QByteArray &data);
- virtual void message(const QCString &msg, const QByteArray &data);
+ virtual void appMessage(const Q3CString &msg, const QByteArray &data);
+ virtual void message(const Q3CString &msg, const QByteArray &data);
void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
protected slots:
virtual void deleteAndDisplayNextMail(ViewMail * vm);
virtual void displayNextMail(ViewMail * vm);
virtual void slotSendQueued();
virtual void slotSearchMails();
virtual void slotEditSettings();
virtual void slotEditGlobalSettings();
virtual void slotEditAccounts();
virtual void displayMail();
virtual void replyMail();
virtual void slotDeleteMail();
virtual void slotGetMail();
virtual void slotGetAllMail();
virtual void slotDeleteAllMail();
- virtual void mailHold(int, QListViewItem *,const QPoint&,int);
+ virtual void mailHold(int, Q3ListViewItem *,const QPoint&,int);
virtual void slotShowFolders( bool show );
- virtual void refreshMailView(const QValueList<RecMailP>&);
- virtual void mailLeftClicked( QListViewItem * );
+ virtual void refreshMailView(const Q3ValueList<RecMailP>&);
+ virtual void mailLeftClicked( Q3ListViewItem * );
virtual void slotMoveCopyMail();
virtual void slotMoveCopyAllMail();
virtual void reEditMail();
void clearSelection();
void selectAll();
void slotDownloadMail();
private:
ComposeMail* mCurrentComposer;
void closeViewMail(ViewMail * vm);
QString mPendingEmail;
QString mPendingName;
QByteArray mPendingData;
- QCString mPendingMessage;
+ Q3CString mPendingMessage;
Settings *settings;
- QTextBrowser * tb;
+ Q3TextBrowser * tb;
};
#endif
diff --git a/kmicromail/qpe/qdialog.h b/kmicromail/qpe/qdialog.h
index c63133d..3720182 100644
--- a/kmicromail/qpe/qdialog.h
+++ b/kmicromail/qpe/qdialog.h
@@ -1,29 +1,29 @@
#ifndef MINIKDE_KDIALOG_H
#ifndef DEFINE_QDIALOG_HACK
#define DEFINE_QDIALOG_HACK
#warning call of include <qdialog.h>
#warning including /usr/local/qt/include/qdialog.h
#warning if you get a compiling error
#warning please adjust your path here!
#include "/usr/local/qt/include/qdialog.h"
class QDialog_hacked : public QDialog
{
//Q__OBJECT
public:
- QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, WFlags f=0 );
+ QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, Qt::WFlags f=0 );
};
#define QDialog QDialog_hacked
#endif
#else
#warning "/usr/local/qt/include/qdialog.h" for KDialog
#include "/usr/local/qt/include/qdialog.h"
#endif
diff --git a/kmicromail/qpe/qdialog_hacked.cpp b/kmicromail/qpe/qdialog_hacked.cpp
index 0a34cec..5d4d353 100644
--- a/kmicromail/qpe/qdialog_hacked.cpp
+++ b/kmicromail/qpe/qdialog_hacked.cpp
@@ -1,27 +1,27 @@
#include <qdialog.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qpushbutton.h>
#include <klocale.h>
#ifdef QDialog
#undef QDialog
#endif
- QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f )
+ QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, Qt::WFlags f )
: QDialog( parent,name,modal, f)
{
qDebug("New hacked QDialog for ompi desktop");
//QTimer::singleShot( 1, this,SLOT(addaddbuttons()) );
setOrientation ( Vertical );
- QHBox * hb = new QHBox ( this );
+ Q3HBox * hb = new Q3HBox ( this );
QPushButton *ok = new QPushButton( i18n("OK"), hb );
QPushButton *cancel = new QPushButton( i18n("Cancel"), hb );
setExtension ( hb );
showExtension ( true );
connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) );
connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) );
//setWFlags(WStyle_MinMax );
}
diff --git a/kmicromail/selectsmtp.cpp b/kmicromail/selectsmtp.cpp
index 10b6d79..ead723c 100644
--- a/kmicromail/selectsmtp.cpp
+++ b/kmicromail/selectsmtp.cpp
@@ -1,45 +1,45 @@
#include "selectsmtp.h"
#include <libmailwrapper/mailwrapper.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qtabwidget.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <klocale.h>
-selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, WFlags fl)
+selectsmtp::selectsmtp(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
: selectstoreui(parent,name,modal,fl)
{
//m_smtpList.setAutoDelete(false);
m_smtpList = 0;
//headlabel->setText(i18n("<center>Select SMTP account to use</center>"));
headlabel->hide();
folderSelection->hide();
folderLabel->hide();
//accountlabel->setText(i18n("SMTP\nAccount:"));
Line1->hide();
newFoldersel->hide();
newFolderedit->hide();
newFolderLabel->hide();
Line2->hide();
selMove->hide();
m_current_smtp = 0;
setCaption(i18n("Select SMTP Account"));
}
selectsmtp::~selectsmtp()
{
}
void selectsmtp::slotAccountselected(int which)
{
if (!m_smtpList || (unsigned)which>=m_smtpList->count() || which < 0) {
m_current_smtp = 0;
return;
}
m_current_smtp = m_smtpList->at(which);
}
diff --git a/kmicromail/selectsmtp.h b/kmicromail/selectsmtp.h
index 9157ddf..d7accf6 100644
--- a/kmicromail/selectsmtp.h
+++ b/kmicromail/selectsmtp.h
@@ -1,27 +1,27 @@
#ifndef __selectsmtp_h
#define __selectstmp_h
#include "selectstoreui.h"
#include <qlist.h>
class SMTPaccount;
class selectsmtp : public selectstoreui
{
Q_OBJECT
public:
- selectsmtp(QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0 );
+ selectsmtp(QWidget* parent = 0, const char* name = 0, bool modal = TRUE, Qt::WFlags fl = 0 );
virtual ~selectsmtp();
void setSelectionlist(QList<SMTPaccount>*list);
SMTPaccount*selected_smtp();
protected:
QList<SMTPaccount>*m_smtpList;
SMTPaccount*m_current_smtp;
protected slots:
virtual void slotAccountselected(int);
};
#endif
diff --git a/kmicromail/selectstore.h b/kmicromail/selectstore.h
index 447a6ae..d312c1d 100644
--- a/kmicromail/selectstore.h
+++ b/kmicromail/selectstore.h
@@ -1,33 +1,33 @@
#ifndef _SELECTSTORE_H
#define _SELECTSTORE_H
#include "selectstoreui.h"
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qmap.h>
#include <qstringlist.h>
class AbstractMail;
class Selectstore:public selectstoreui
{
Q_OBJECT
public:
Selectstore(QWidget* parent = 0, const char* name = 0);
virtual ~Selectstore();
virtual void addAccounts(AbstractMail*mail,const QStringList&folders);
virtual QString currentFolder();
virtual AbstractMail*currentMail();
bool newFolder();
bool moveMails();
protected slots:
virtual void slotCreateNewFolder();
virtual void slotMoveMail();
virtual void slotAccountselected(int);
protected:
QMap<int,QStringList> folderMap;
QMap<int,AbstractMail*> mailMap;
AbstractMail*cMail;
};
#endif
diff --git a/kmicromail/settingsdialog.cpp b/kmicromail/settingsdialog.cpp
index c593b48..889c490 100644
--- a/kmicromail/settingsdialog.cpp
+++ b/kmicromail/settingsdialog.cpp
@@ -1,53 +1,55 @@
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qtabwidget.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <kconfig.h>
#include <kprefs.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include "settingsdialog.h"
-SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
: SettingsDialogUI( parent, name, modal, fl ) {
#if 0
QTabWidget *topFrame = TabWidget2;
- QGridLayout *topLayout = new QGridLayout(topFrame,3,3);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,3);
topLayout->setSpacing(2);
topLayout->setMargin(3);
KPrefsWidFont * tVFont;
int i = 0;
KPrefsWidFont *timeLabelsFont =
addWidFont(i18n("OK"),i18n("Application(nr):"),
&(mAppFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
timeLabelsFont =
addWidFont(i18n("Mon 15"),i18n("Compose Mail:"),
&(mComposeFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
KPrefsWidFont *timeBarFont =
addWidFont(i18n("Mon 15"),i18n("Read Mail:"),
&(mReadFont),topFrame);
topLayout->addWidget(timeBarFont->label(),i,0);
topLayout->addWidget(timeBarFont->preview(),i,1);
topLayout->addWidget(timeBarFont->button(),i,2);
++i;
readConfig();
#endif
}
diff --git a/kmicromail/settingsdialog.h b/kmicromail/settingsdialog.h
index 042b69f..b168226 100644
--- a/kmicromail/settingsdialog.h
+++ b/kmicromail/settingsdialog.h
@@ -1,30 +1,30 @@
#ifndef SETTINGS_DIALOG_H
#define SETTINGS_DIALOG_H
#include <qwidget.h>
#include <qfont.h>
#include "settingsdialogui.h"
class SettingsDialog : public SettingsDialogUI {
Q_OBJECT
public:
- SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~SettingsDialog();
private:
void readConfig();
void writeConfig();
QFont mAppFont, mComposeFont, mReadFont;
private slots:
void accept();
};
#endif
diff --git a/kmicromail/statuswidget.cpp b/kmicromail/statuswidget.cpp
index 19cf635..6da6f54 100644
--- a/kmicromail/statuswidget.cpp
+++ b/kmicromail/statuswidget.cpp
@@ -1,33 +1,33 @@
#include <qtimer.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
#include <qlabel.h>
#include "statuswidget.h"
// the current problem I see is "locking": used exclusive by one sender
-StatusWidget::StatusWidget( QWidget* parent, const char* name,WFlags fl )
+StatusWidget::StatusWidget( QWidget* parent, const char* name,Qt::WFlags fl )
: StatusWidgetUI( parent, name, fl ) {
setMaximumHeight( 15 );
// hide for now since nothing reports decent progress data yet.
statusProgress->hide();
}
StatusWidget::~StatusWidget() {
}
void StatusWidget::setText( const QString& text ) {
show();
statusText->setText( text );
QTimer::singleShot( 5000, this, SLOT( hide() ) );
}
void StatusWidget::setProgress( int progress ) {
show();
statusProgress->setProgress( progress );
if ( progress == 100 ) {
hide();
}
}
diff --git a/kmicromail/statuswidget.h b/kmicromail/statuswidget.h
index 73f0d75..1d29daf 100644
--- a/kmicromail/statuswidget.h
+++ b/kmicromail/statuswidget.h
@@ -1,24 +1,24 @@
#ifndef STATUS_WIDGET_H
#define STATUS_WIDGET_H
#include <qwidget.h>
#include "statuswidgetui.h"
class StatusWidget : public StatusWidgetUI {
Q_OBJECT
public:
- StatusWidget( QWidget* parent = 0, const char* name = 0,WFlags fl = 0 );
+ StatusWidget( QWidget* parent = 0, const char* name = 0,Qt::WFlags fl = 0 );
~StatusWidget();
public slots:
void setText( const QString& text );
void setProgress( int progress );
};
#endif
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 685b4e4..c9dedb0 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,107 +1,110 @@
// CHANGED 2004-08-06 Lutz Rogowski
#include <kfiledialog.h>
#include "koprefs.h"
#include <klocale.h>
#include <kglobal.h>
#include <kapplication.h>
#ifdef MINIKDE_KDIALOG_H
#undef MINIKDE_KDIALOG_H
#endif
#include "composemail.h"
#include "viewmail.h"
#include <libmailwrapper/settings.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailtypes.h>
#include <qdialog.h>
#include <qpe/qpeapplication.h>
/* QT */
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qmessagebox.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qaction.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qfile.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3VBoxLayout>
//using namespace Opie::Ui;
//using namespace Opie::Core;
-AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
- const QString&fsize,int num,const QValueList<int>&path)
- : QListViewItem(parent,after),_partNum(num)
+AttachItem::AttachItem(Q3ListView * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file,
+ const QString&fsize,int num,const Q3ValueList<int>&path)
+ : Q3ListViewItem(parent,after),_partNum(num)
{
_path=path;
setText(0, mime);
setText(1, desc);
setText(2, file);
setText(3, fsize);
}
-AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
- const QString&fsize,int num,const QValueList<int>&path)
- : QListViewItem(parent,after),_partNum(num)
+AttachItem::AttachItem(Q3ListViewItem * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file,
+ const QString&fsize,int num,const Q3ValueList<int>&path)
+ : Q3ListViewItem(parent,after),_partNum(num)
{
_path=path;
setText(0, mime);
setText(1, desc);
setText(2, file);
setText(3, fsize);
}
-bool AttachItem::isParentof(const QValueList<int>&path)
+bool AttachItem::isParentof(const Q3ValueList<int>&path)
{
/* if not set, then no parent */
if (path.count()==0||_path.count()==0) return false;
/* the parent must have one digit less then a child */
if (path.count()!=_path.count()+1) return false;
for (unsigned int i=0; i < _path.count();++i)
{
if (_path[i]!=path[i]) return false;
}
return true;
}
-AttachItem* ViewMail::searchParent(const QValueList<int>&path)
+AttachItem* ViewMail::searchParent(const Q3ValueList<int>&path)
{
- QListViewItemIterator it( attachments );
+ Q3ListViewItemIterator it( attachments );
for ( ; it.current(); ++it )
{
AttachItem*ati = (AttachItem*)it.current();
if (ati->isParentof(path)) return ati;
}
return 0;
}
AttachItem* ViewMail::lastChild(AttachItem*parent)
{
if (!parent) return 0;
AttachItem* item = (AttachItem*)parent->firstChild();
if (!item) return item;
AttachItem*temp=0;
while( (temp=(AttachItem*)item->nextSibling()))
{
item = temp;
}
return item;
}
void ViewMail::setBody(const RecBodyP&body )
{
m_body = body;
m_mail[2] = body->Bodytext();
m_showHtml = KOPrefs::instance()->mViewAsHtml;
if ( m_showHtml ) {
if ( m_mail[2].find ("<html>",0,false ) > -1 ) {
qDebug("html mail ");
} else {
qDebug("no html mail ");
@@ -125,280 +128,280 @@ void ViewMail::setBody(const RecBodyP&body )
double s = body->Description()->Size();
int w;
w=0;
while (s>1024)
{
s/=1024;
++w;
if (w>=2) break;
}
QString q="";
switch(w)
{
case 1:
q="k";
break;
case 2:
q="M";
break;
default:
break;
}
{
/* I did not found a method to make a CONTENT reset on a QTextStream
so I use this construct that the stream will re-constructed in each
loop. To let it work, the textstream is packed into a own area of
code is it will be destructed after finishing its small job.
*/
QTextOStream o(&fsize);
if (w>0) o.precision(2); else o.precision(0);
- o.setf(QTextStream::fixed);
+ o.setf(Q3TextStream::fixed);
o << s << " " << q << "Byte";
}
curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
QString filename = "";
for (unsigned int i = 0; i < body->Parts().count();++i)
{
filename = "";
type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
for (;it!=body->Parts()[i]->Parameters().end();++it)
{
if (it.key().lower()=="name")
{
filename=it.data();
}
}
s = body->Parts()[i]->Size();
w = 0;
while (s>1024)
{
s/=1024;
++w;
if (w>=2) break;
}
switch(w)
{
case 1:
q="k";
break;
case 2:
q="M";
break;
default:
q="";
break;
}
QTextOStream o(&fsize);
if (w>0) o.precision(2); else o.precision(0);
- o.setf(QTextStream::fixed);
+ o.setf(Q3TextStream::fixed);
o << s << " " << q << "Byte";
desc = body->Parts()[i]->Description();
parentItem = searchParent(body->Parts()[i]->Positionlist());
if (parentItem)
{
AttachItem*temp = lastChild(parentItem);
if (temp) curItem = temp;
curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
attachments->setRootIsDecorated(true);
curItem = parentItem;
}
else
{
curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
}
}
}
void ViewMail::slotViewSource()
{
if ( !sourceOn ) {
sourceOn = true;
viewSource->setText(i18n("View Body Text"));
encodedString*st = 0;
st = m_recMail->Wrapper()->fetchRawBody(m_recMail);
if ( st ) {
QString source = QString::fromUtf8( st->Content(), st->Length());
browser->setText( source );
delete st;
}
} else
setText();
}
void ViewMail::slotShowHtml( bool state )
{
m_showHtml = state;
setText();
}
-void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
+void ViewMail::slotItemClicked( Q3ListViewItem * item , const QPoint & point, int )
{
if (!item )
return;
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
setText();
return;
}
- QPopupMenu *menu = new QPopupMenu();
+ Q3PopupMenu *menu = new Q3PopupMenu();
int ret=0;
if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
{
menu->insertItem( i18n( "Show Text" ), 1 );
}
if (item->text(0).left(6)=="image/") {
menu->insertItem(i18n("Display image preview"),2);
}
menu->insertItem( i18n( "Save Attachment" ), 0 );
menu->insertSeparator(1);
ret = menu->exec( point, 0 );
switch(ret)
{
case 0:
{
//MimeTypes types;
//types.insert( "all", "*" );
QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
if( !str.isEmpty() )
{
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content)
{
QFile output(str);
- output.open(IO_WriteOnly);
+ output.open(QIODevice::WriteOnly);
output.writeBlock(content->Content(),content->Length());
output.close();
delete content;
}
}
}
break ;
case 2:
{
#ifdef DESKTOP_VERSION
QString tmpfile = locateLocal( "tmp", "opiemail-image");
#else
QString tmpfile = "/tmp/opiemail-image";
#endif
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content) {
QFile output(tmpfile);
- output.open(IO_WriteOnly);
+ output.open(QIODevice::WriteOnly);
output.writeBlock(content->Content(),content->Length());
output.close();
delete content;
MailImageDlg iview("");
iview.setName(tmpfile);
KApplication::execDialog(&iview);
output.remove();
}
}
break;
case 1:
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
setText();
}
else
{
if ( m_recMail->Wrapper() != 0l )
{ // make sure that there is a wrapper , even after delete or simular actions
browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
}
}
break;
}
delete menu;
}
void ViewMail::setMail(const RecMailP&mail )
{
m_recMail = mail;
m_mail[0] = mail->getFrom();
m_mail[1] = mail->getSubject();
m_mail[3] = mail->getDate();
m_mail[4] = mail->Msgid();
m_mail2[0] = mail->To();
m_mail2[1] = mail->CC();
m_mail2[2] = mail->Bcc();
setText();
}
void ViewMail::slotNextMail()
{
nextMail->blockSignals( true );
setCaption(i18n("Displaying next mail...please wait!"));
qApp->processEvents();
emit showNextMail(this);
nextMail->blockSignals( false );
}
-ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
+ViewMail::ViewMail( QWidget *parent, const char *name, Qt::WFlags fl)
: ViewMailBase(parent, name, fl), _inLoop(false)
{
m_gotBody = false;
deleted = false;
sourceOn = false;
readConfig();
connect( reply, SIGNAL(activated()), SLOT(slotReply()));
connect( forward, SIGNAL(activated()), SLOT(slotForward()));
connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) );
connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) );
connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) );
attachments->setEnabled(m_gotBody);
- connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
+ connect( attachments, SIGNAL( clicked(Q3ListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(Q3ListViewItem*,const QPoint&, int) ) );
attachments->setSorting(-1);
}
void ViewMail::readConfig()
{
setFont ( KOPrefs::instance()->mReadFont );
m_showHtml = KOPrefs::instance()->mViewAsHtml;
showHtml->setOn( m_showHtml );
}
void ViewMail::setText()
{
viewSource->setText(i18n("View Source"));
sourceOn = false;
QString toString;
QString ccString;
QString bccString;
toString = m_mail2[0].join(",");
ccString = m_mail2[1].join(",");
bccString = m_mail2[2].join(",");
#ifdef DESKTOP_VERSION
setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) );
#else
setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] );
#endif
@@ -528,52 +531,52 @@ void ViewMail::slotForward()
if (!m_mail[0].isNull())
ftext += QString("From: %1\n")
.arg( m_mail[0] );
if (!m_mail[1].isNull())
ftext += QString("Subject: %1\n")
.arg( m_mail[1] );
ftext += QString("\n%1\n")
.arg( m_mail[2]);
ftext += QString("----- End forwarded message -----\n");
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
composer.setSubject( "Fwd: " + m_mail[1] );
composer.setMessage( ftext );
if ( QDialog::Accepted == KApplication::execDialog( &composer ))
{
}
}
void ViewMail::slotDeleteMail( )
{
if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
emit deleteAndDisplayNextMail( this);
//m_recMail->Wrapper()->deleteMail( m_recMail );
//hide();
deleted = true;
}
}
-MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
+MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, Qt::WFlags f)
: QDialog(parent,name,modal)
{
- QVBoxLayout*dlglayout = new QVBoxLayout(this);
+ Q3VBoxLayout*dlglayout = new Q3VBoxLayout(this);
dlglayout->setSpacing(2);
dlglayout->setMargin(1);
//m_imageview = new Opie::MM::OImageScrollView(this);
//dlglayout->addWidget(m_imageview);
}
MailImageDlg::~MailImageDlg()
{
}
void MailImageDlg::setName(const QString&fname)
{
qDebug("viewmail.cpp: MailImageDlg::setName Pending");
// m_imageview->setImage(fname);
}
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index bb5b685..6cf6efb 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,93 +1,93 @@
#ifndef VIEWMAIL_H
#define VIEWMAIL_H
#include "viewmailbase.h"
#include <libmailwrapper/mailtypes.h>
#include <qdialog.h>
#include <qapplication.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qmap.h>
#include <klocale.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
//namespace Opie { namespace MM { class OImageScrollView; } }
-class AttachItem : public QListViewItem
+class AttachItem : public Q3ListViewItem
{
public:
- AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
- const QString&fsize,int num,const QValueList<int>&path);
- AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
- const QString&fsize,int num,const QValueList<int>&path);
+ AttachItem(Q3ListView * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file,
+ const QString&fsize,int num,const Q3ValueList<int>&path);
+ AttachItem(Q3ListViewItem * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file,
+ const QString&fsize,int num,const Q3ValueList<int>&path);
int Partnumber() { return _partNum; }
- bool isParentof(const QValueList<int>&path);
+ bool isParentof(const Q3ValueList<int>&path);
private:
int _partNum;
/* needed for a better display of attachments */
- QValueList<int> _path;
+ Q3ValueList<int> _path;
};
class ViewMail : public ViewMailBase
{
Q_OBJECT
public:
- ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
+ ViewMail( QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0);
~ViewMail();
void hide();
void exec();
void setMail(const RecMailP&mail );
void setBody(const RecBodyP&body);
bool deleted;
signals:
void showNextMail(ViewMail*);
void deleteAndDisplayNextMail(ViewMail *);
void signalDownloadMail();
protected:
QString deHtml(const QString &string);
- AttachItem* searchParent(const QValueList<int>&path);
+ AttachItem* searchParent(const Q3ValueList<int>&path);
AttachItem* lastChild(AttachItem*parent);
protected slots:
void slotNextMail();
void slotReply();
void slotForward();
void setText();
- void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
+ void slotItemClicked( Q3ListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
void slotShowHtml( bool );
void slotViewSource();
private:
void readConfig();
bool sourceOn;;
bool _inLoop;
QString m_mailHtml;
bool m_gotBody;
RecBodyP m_body;
RecMailP m_recMail;
bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;
// 0 to 1 cc 2 bcc
QMap <int,QStringList> m_mail2;
};
class MailImageDlg:public QDialog
{
Q_OBJECT
public:
- MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
+ MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, Qt::WFlags f = 0);
~MailImageDlg();
void setName(const QString&);
protected:
//Opie::MM::OImageScrollView*m_imageview;
};
#endif
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index 3bb964e..371ee91 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -1,109 +1,112 @@
// CHANGED 2004-08-06 Lutz Rogowski
-#include <qtextbrowser.h>
-#include <qlistview.h>
+#include <q3textbrowser.h>
+#include <q3listview.h>
#include <qaction.h>
#include <qlabel.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qapplication.h>
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#include <qmenubar.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3PopupMenu>
#include <kiconloader.h>
//#include <qpe/resource.h>
#include <klocale.h>
#include "viewmailbase.h"
//#include "opendiag.h"
-ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
- : QMainWindow(parent, name, fl)
+ViewMailBase::ViewMailBase(QWidget *parent, const char *name, Qt::WFlags fl)
+ : Q3MainWindow(parent, name, fl)
{
setToolBarsMovable(false);
- toolbar = new QToolBar(this);
+ toolbar = new Q3ToolBar(this);
menubar = new QMenuBar( toolbar );
- mailmenu = new QPopupMenu( menubar );
+ mailmenu = new Q3PopupMenu( menubar );
menubar->insertItem( i18n( "Mail" ), mailmenu );
toolbar->setHorizontalStretchable(true);
addToolBar(toolbar);
viewSource = new QAction(i18n("View Source"), 0, 0, this);
viewSource->addTo(mailmenu);
downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this);
downloadMail->addTo(toolbar);
downloadMail->addTo(mailmenu);
reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this);
reply->addTo(toolbar);
reply->addTo(mailmenu);
forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this);
forward->addTo(toolbar);
forward->addTo(mailmenu);
attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true);
attachbutton->addTo(toolbar);
attachbutton->addTo(mailmenu);
connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true );
showHtml->addTo( toolbar );
showHtml->addTo( mailmenu );
deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this);
deleteMail->addTo(toolbar);
deleteMail->addTo(mailmenu);
nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this);
QLabel *spacer = new QLabel(toolbar);
nextMail->addTo(toolbar);
nextMail->addTo(mailmenu);
closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
//QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
toolbar->setStretchableWidget(spacer);
closeMail->addTo(toolbar);
closeMail->addTo(mailmenu);
- QVBox *view = new QVBox(this);
+ Q3VBox *view = new Q3VBox(this);
setCentralWidget(view);
- attachments = new QListView(view);
+ attachments = new Q3ListView(view);
int fixh = 100;
if ( QApplication::desktop()->width() > 320 )
fixh = 200;
attachments->setFixedHeight(fixh);
attachments->setAllColumnsShowFocus(true);
attachments->addColumn("Mime Type", fixh-30);
attachments->addColumn(i18n("Description"), 100);
attachments->addColumn(i18n("Filename"), 80);
attachments->addColumn(i18n("Size"), 80);
attachments->setSorting(-1);
attachments->hide();
- browser = new QTextBrowser(view);
+ browser = new Q3TextBrowser(view);
// openDiag = new OpenDiag(view);
// openDiag->hide();
}
void ViewMailBase::slotChangeAttachview(bool state)
{
if (state) attachments->show();
else attachments->hide();
}
void ViewMailBase::keyPressEvent ( QKeyEvent * e )
{
if( e->key()==Qt::Key_Escape ) {
close();
e->accept();
return;
}
QWidget::keyPressEvent(e);
}
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h
index 7c075eb..3f1dead 100644
--- a/kmicromail/viewmailbase.h
+++ b/kmicromail/viewmailbase.h
@@ -1,44 +1,47 @@
// CHANGED 2004-08-06 Lutz Rogowski
#ifndef VIEWMAILBASE_H
#define VIEWMAILBASE_H
-#include <qmainwindow.h>
+#include <q3mainwindow.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
+#include <QKeyEvent>
#ifndef DESKTOP_VERSION
#include <qpe/qpemenubar.h>
#define QMenuBar QPEMenuBar
#endif
class QAction;
class OpenDiag;
-class QListView;
-class QToolBar;
-class QTextBrowser;
+class Q3ListView;
+class Q3ToolBar;
+class Q3TextBrowser;
class QMenuBar;
-class QPopupMenu;
+class Q3PopupMenu;
-class ViewMailBase : public QMainWindow
+class ViewMailBase : public Q3MainWindow
{
Q_OBJECT
public:
- ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
+ ViewMailBase(QWidget *parent = 0, const char *name = 0, Qt::WFlags fl = 0);
protected:
QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource;
- QListView *attachments;
- QToolBar *toolbar;
- QTextBrowser *browser;
+ Q3ListView *attachments;
+ Q3ToolBar *toolbar;
+ Q3TextBrowser *browser;
OpenDiag *openDiag;
QMenuBar *menubar;
- QPopupMenu *mailmenu;
+ Q3PopupMenu *mailmenu;
protected slots:
void slotChangeAttachview(bool state);
virtual void keyPressEvent ( QKeyEvent * e );
};
#endif
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8385bcc..c1a2f76 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3,80 +3,86 @@
Requires the Qt and KDE widget libraries, available at no cost at
http://www.troll.no and http://www.kde.org respectively
Copyright (c) savecale1997, 1998, 1999
Preston Brown (preton.brown@yale.edu)
Fester Zigterman (F.J.F.ZigtermanRustenburg@student.utwente.nl)
Ian Dawes (iadawes@globalserve.net)
Laszlo Boloni (boloni@cs.purdue.edu)
Copyright (c) 2000, 2001, 2002
Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <qapplication.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qlayout.h>
#include <qclipboard.h>
#include <qcursor.h>
#include <qmessagebox.h>
-#include <qprogressbar.h>
-#include <qmultilineedit.h>
+#include <q3progressbar.h>
+#include <q3multilineedit.h>
#include <qtimer.h>
-#include <qwidgetstack.h>
-#include <qptrlist.h>
+#include <q3widgetstack.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qfile.h>
#include <qdir.h>
#ifndef KORG_NOSPLITTER
#include <qsplitter.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <QKeyEvent>
+#include <Q3Frame>
+#include <QLabel>
+#include <Q3ValueList>
#endif
#include <kglobal.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <knotifyclient.h>
#include <kconfig.h>
#include <libkdepim/ksyncprefsdialog.h>
#include <krun.h>
#include <kdirwatch.h>
#include <libkdepim/kdatepicker.h>
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/kpimglobalprefs.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/icaldrag.h>
#include <libkcal/icalformat.h>
#include <libkcal/vcalformat.h>
#include <libkcal/scheduler.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/journal.h>
#include <libkcal/calfilter.h>
#include <libkcal/attendee.h>
#include <libkcal/dndfactory.h>
#include <libkcal/freebusy.h>
#include <libkcal/filestorage.h>
#include <libkcal/calendarresources.h>
#include <libkcal/qtopiaformat.h>
#include "../kalarmd/alarmdialog.h"
@@ -99,77 +105,77 @@
#include "kotodoeditor.h"
#include "koprefs.h"
#include "koeventviewerdialog.h"
#include "publishdialog.h"
#include "kofilterview.h"
#include "koglobals.h"
#include "koviewmanager.h"
#include "koagendaview.h"
#include "koagenda.h"
#include "kodialogmanager.h"
#include "outgoingdialog.h"
#include "incomingdialog.h"
#include "datenavigatorcontainer.h"
#include "statusdialog.h"
#include "kdatenavigator.h"
#include "kotodoview.h"
#include "datenavigator.h"
#include "resourceview.h"
#include "navigatorbar.h"
#include "searchdialog.h"
#include "mainwindow.h"
#include "categoryeditdialog.h"
#include "calendarview.h"
#ifndef DESKTOP_VERSION
#include <qtopia/alarmserver.h>
#endif
#ifndef _WIN32_
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#else
-#include <qprocess.h>
+#include <q3process.h>
#endif
#ifdef DESKTOP_VERSION
#include <kabc/stdaddressbook.h>
#endif
using namespace KOrg;
using namespace KCal;
extern int globalFlagBlockAgenda;
extern int globalFlagBlockStartup;
-MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
+MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, Q3PtrList<Incidence> alarms,QDateTime start ) : Q3TextBrowser(parent)
{
mAlarms = alarms;
viewport()->setBackgroundColor( QColor( 255, 255, 255 ) );
QString mText = "<table width=\"100%\">\n";
//mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h3>";
#endif
// mText += "<img src=\"";
// mText += ipath;
// mText += "\">";
//mEventDate = QDate::currentDate();
#ifdef DESKTOP_VERSION
mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
#else
mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h3>";
#endif
//mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
Incidence * inc = getNextInc( start );
int time = 0;
//mText += "<table>";
while ( inc ) {
QDateTime dt ;
QString tempText = "<a ";
bool ok;
dt = inc->getNextOccurence( start, &ok );
if ( !ok ) continue;
if ( inc->typeID() == eventID ) {
@@ -248,290 +254,290 @@ Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
}
mAlarms.remove( retInc );
return retInc;
}
void MissedAlarmTextBrowser::setSource(const QString & n)
{
if (n.startsWith("event:")) {
#ifdef DESKTOP_VERSION
emit showIncidence(n.mid(8));
#else
emit showIncidence(n.mid(6));
#endif
return;
} else if (n.startsWith("todo:")) {
#ifdef DESKTOP_VERSION
emit showIncidence(n.mid(7));
#else
emit showIncidence(n.mid(5));
#endif
return;
}
}
class KOBeamPrefs : public QDialog
{
public:
KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Beam Options") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("File format"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
- QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
+ Q3ButtonGroup* time = new Q3ButtonGroup(1, Qt::Horizontal, i18n("Time format"), this );
lay->addWidget( time ); time->setExclusive ( true ) ;
vcal = new QRadioButton(" vCalendar ", format );
ical = new QRadioButton(" iCalendar ", format );
vcal->setChecked( true );
tz = new QRadioButton(i18n(" With timezone "), time );
local = new QRadioButton(i18n(" Local time "), time );
tz->setChecked( true );
QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
bool beamVcal() { return vcal->isChecked(); }
bool beamLocal() { return local->isChecked(); }
private:
QRadioButton* vcal, *ical, *local, *tz;
};
class KOCatPrefs : public QDialog
{
public:
KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Manage new Categories") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
lay->addWidget( lab );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("New categories not in list:"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
addCatBut = new QRadioButton(i18n("Add to category list"), format );
new QRadioButton(i18n("Remove from Events/Todos"), format );
addCatBut->setChecked( true );
QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
bool addCat() { return addCatBut->isChecked(); }
private:
QRadioButton* addCatBut;
};
CalendarView::CalendarView( CalendarResources *calendar,
QWidget *parent, const char *name )
: CalendarViewBase( parent, name ),
mCalendar( calendar ),
mResourceManager( calendar->resourceManager() )
{
mEventEditor = 0;
mTodoEditor = 0;
init();
}
CalendarView::CalendarView( Calendar *calendar,
QWidget *parent, const char *name )
: CalendarViewBase( parent, name ),
mCalendar( calendar ),
mResourceManager( 0 )
{
mEventEditor = 0;
mTodoEditor = 0;
init();
}
void CalendarView::init()
{
mMultiResourceSync = false;
flag_blockConflict = false;
flag_blockScrollBar = false;
flag_checkFileFirsttime = true;
flag_clearallviewsEventDisplay = false;
flag_clearallviewsupdateView = false;
mNextAlarmDateTime = QDateTime::currentDateTime();
- setFocusPolicy (NoFocus );
+ setFocusPolicy (Qt::NoFocus );
mViewerCallerIsSearchDialog = false;
mBlockShowDates = false;
mConflictingEvent = 0;
mDatePickerMode = 0;
mCurrentSyncDevice = "";
mViewManager = new KOViewManager( this );
mDialogManager = new KODialogManager( this );
mEventViewerDialog = 0;
mModified = false;
mReadOnly = false;
mSelectedIncidence = 0;
mCalPrinter = 0;
mFilters.setAutoDelete(true);
mCalendar->registerObserver( this );
// TODO: Make sure that view is updated, when calendar is changed.
mStorage = new FileStorage( mCalendar );
mNavigator = new DateNavigator( this, "datevav", mViewManager );
- QBoxLayout *topLayout = (QBoxLayout*)layout();
+ Q3BoxLayout *topLayout = (Q3BoxLayout*)layout();
#ifndef KORG_NOSPLITTER
// create the main layout frames.
mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
topLayout->addWidget(mPanner);
mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
"CalendarView::LeftFrame");
mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
"CalendarView::DateNavigator" );
mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
mTodoList->setNavigator( mNavigator );
mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
#ifdef KORG_NORESOURCEVIEW
mResourceView = 0;
#else
if ( mResourceManager ) {
mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
mResourceView->updateView();
connect( mResourceView, SIGNAL( resourcesChanged() ),
SLOT( updateView() ) );
} else {
mResourceView = 0;
}
#endif
QWidget *rightBox = new QWidget( mPanner );
- QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
+ Q3BoxLayout *rightLayout = new Q3VBoxLayout( rightBox );
- mRightFrame = new QWidgetStack( rightBox );
+ mRightFrame = new Q3WidgetStack( rightBox );
rightLayout->addWidget( mRightFrame, 1 );
mLeftFrame = mLeftSplitter;
#else
//QWidget *mainBox = new QWidget( this );
//QWidget *leftFrame = new QWidget( mainBox );
//QBoxLayout * mainBoxLayout;
if ( KOPrefs::instance()->mVerticalScreen ) {
//mainBoxLayout = new QVBoxLayout(mainBox);
//leftFrameLayout = new QHBoxLayout(leftFrame );
mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
} else {
//mainBoxLayout = new QHBoxLayout(mainBox);
//leftFrameLayout = new QVBoxLayout(leftFrame );
mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
}
mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
//QBoxLayout * leftFrameLayout;
topLayout->addWidget( mMainFrame );
#ifdef DESKTOP_VERSION
- mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this );
+ mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,Qt::Horizontal, this );
topLayout->addWidget( mDateScrollBar );
connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
if ( QApplication::desktop()->width() < 800 )
mDateScrollBar->hide();
#endif
//mainBoxLayout->addWidget (mLeftFrame);
mDateNavigator = new DateNavigatorContainer( mLeftFrame,
"CalendarView::DateNavigator" );
#if 0
// FIXME
mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
"CalendarView::DateNavigator", QDate::currentDate());
#endif
// mDateNavigator->blockSignals( true );
//leftFrameLayout->addWidget( mDateNavigator );
mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) );
connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() ));
connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
connect( mCalEditView, SIGNAL( requestCalendarInfo( int ) ),this, SLOT( displayCalendarInfo( int ) ) );
mTodoList->setNavigator( mNavigator );
#if 0
if ( QApplication::desktop()->width() < 480 ) {
leftFrameLayout->addWidget(mFilterView);
leftFrameLayout->addWidget(mTodoList, 2 );
} else {
leftFrameLayout->addWidget(mTodoList,2 );
leftFrameLayout->addWidget(mFilterView );
}
#endif
mFilterView->hide();
mCalEditView->hide();
QWidget *rightBox = new QWidget( mMainFrame );
//mainBoxLayout->addWidget ( rightBox, 10 );
- QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
- mRightFrame = new QWidgetStack( rightBox );
+ Q3BoxLayout *rightLayout = new Q3VBoxLayout( rightBox );
+ mRightFrame = new Q3WidgetStack( rightBox );
rightLayout->addWidget( mRightFrame, 10 );
//mLeftFrame = (QWidget *)leftFrame;
if ( KOPrefs::instance()->mVerticalScreen ) {
//mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
//mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
//mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
//leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
} else {
//mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
//mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
//leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
}
if ( !KOPrefs::instance()->mShowDateNavigator)
mDateNavigator->hide();
//qDebug("Calendarview Size %d %d ", width(), height());
#endif
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
SLOT( showDates( const KCal::DateList & ) ) );
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ),
mViewManager, SLOT( showMonth( const QDate & ) ) );
connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
mNavigator, SLOT( selectWeek( const QDate & ) ) );
@@ -587,134 +593,134 @@ void CalendarView::init()
this, SLOT ( moveIncidence( Incidence * ) ) );
connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
this, SLOT ( beamIncidence( Incidence * ) ) );
connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
this, SLOT ( todo_unsub( Todo * ) ) );
connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
this, SLOT ( todo_resub( Todo *,Todo * ) ) );
connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
SLOT( updateTodo( Todo *, int ) ) );
connect( this, SIGNAL( todoModified( Todo *, int )), this,
SLOT( changeTodoDisplay( Todo *, int ) ) );
connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
connect(QApplication::clipboard(),SIGNAL(dataChanged()),
SLOT(checkClipboard()));
connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
SLOT( processTodoListSelection( Incidence * ) ) );
connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
// kdDebug() << "CalendarView::CalendarView() done" << endl;
- mDateFrame = new QVBox(0,0,WType_Popup);
+ mDateFrame = new Q3VBox(0,0,Qt::WType_Popup);
//mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
- mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
+ mDateFrame->setFrameStyle( Q3Frame::WinPanel |Q3Frame::Raised );
mDateFrame->setLineWidth(3);
mDateFrame->hide();
mDateFrame->setCaption( i18n( "Pick a date to display"));
mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
mEventEditor = mDialogManager->getEventEditor();
mTodoEditor = mDialogManager->getTodoEditor();
mFlagEditDescription = false;
mSuspendTimer = new QTimer( this );
mAlarmTimer = new QTimer( this );
mRecheckAlarmTimer = new QTimer( this );
connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
mAlarmDialog = new AlarmDialog( this );
connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
mAlarmDialog->setServerNotification( false );
mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
#ifndef DESKTOP_VERSION
//US listen for arriving address resultsets
connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
#endif
mDateNavigator->setCalendar( mCalendar );
}
CalendarView::~CalendarView()
{
// kdDebug() << "~CalendarView()" << endl;
//qDebug("CalendarView::~CalendarView() ");
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
void CalendarView::nextConflict( bool all, bool allday )
{
if ( flag_blockConflict ) return;
flag_blockConflict = true;
- QPtrList<Event> testlist = mCalendar->events();
+ Q3PtrList<Event> testlist = mCalendar->events();
Event * test = testlist.first();
while ( test ) {
test->setTagged( false );
test = testlist.next();
}
QTime st ( 0,0,0);
if ( mViewManager->currentView() == mViewManager->agendaView() )
st = mViewManager->agendaView()->agenda()->getEndTime();
//qDebug("time %s ", st.toString().latin1());
QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st);
QDateTime conflict;
QDateTime retVal;
bool found = false;
Event * cE = 0;
Event * cE2 = 0;
- QPtrList<Event> testlist2 = testlist;
+ Q3PtrList<Event> testlist2 = testlist;
test = testlist.first();
bool skip = false;
topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
//QTime tm;
//tm.start();
while ( test ) {
qApp->processEvents();
skip = false;
if ( !all ) skip = ( allday != test->doesFloat() );
if ( !skip ) {
if ( found )
skip = !test->matchTime( &startDT, &conflict );
else
skip = !test->matchTime( &startDT, 0 );
}
if ( !skip ) {
Event * test2 = testlist2.first();
while ( test2 ) {
skip = test2->isTagged();
if ( !skip && !all ) skip = ( allday != test2->doesFloat() );
if ( !skip ) {
if ( found )
skip = !test2->matchTime( &startDT, &conflict );
else
skip = !test2->matchTime( &startDT, 0 );
}
if ( !skip ) {
if ( test->isOverlapping ( test2, &retVal, &startDT ) ) {
//qDebug("overlap ");
if ( ! found ) {
if ( retVal >= startDT ) {
conflict = retVal;
@@ -806,118 +812,118 @@ void CalendarView::scrollBarValue(int val )
int year = mNavigator->selectedDates().first().year();
QDate d ( year,1,1 );
mNavigator->selectDates( d.addDays( stepdays-1) , count );
flag_blockScrollBar = false;
#else
Q_UNUSED( val );
#endif
}
void CalendarView::updateView(const QDate &start, const QDate &end)
{
#ifdef DESKTOP_VERSION
if ( ! mDateScrollBar->draggingSlider () ) {
int dof = start.dayOfYear();
//qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() );
if ( dof != mDateScrollBar->value() ) {
mDateScrollBar->blockSignals( true );
mDateScrollBar->setValue( start.dayOfYear());
mDateScrollBar->blockSignals( false );
}
}
#endif
mTodoList->updateView();
mViewManager->updateView(start, end);
//mDateNavigator->updateView();
}
void CalendarView::checkFiles()
{
QString message;
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
while ( cal ) {
if ( cal->mErrorOnLoad ) {
message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
}
cal = calendars.next();
}
if ( !message.isEmpty() ) {
message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
KMessageBox::error(this,message, i18n("Loading of calendar(s) failed"));
}
if ( flag_checkFileFirsttime ) {
flag_checkFileFirsttime = false;
QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
}
}
void CalendarView::checkAlarms()
{
KConfig *config = KOGlobals::config();
config->setGroup( "AppRun" );
QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
- int daysto = dt.daysTo( QDate::currentDate() );
+ int daysto = dt.daysTo( (QDateTime)QDate::currentDate() );
int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
dt = dt.addDays( days );
int secto = dt.secsTo( QDateTime::currentDateTime() );
int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
//qDebug("KO: Reading program stop %d ", secs);
//secs -= ( 3600 * 24*3 ); // debug only
QDateTime latest = dt.addSecs ( secs );
qDebug("KO: Last termination on %s ", latest.toString().latin1());
//qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
- QPtrList<Incidence> el = mCalendar->rawIncidences();
- QPtrList<Incidence> al;
+ Q3PtrList<Incidence> el = mCalendar->rawIncidences();
+ Q3PtrList<Incidence> al;
Incidence* inL = el.first();
QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
while ( inL ) {
bool ok = false;
int offset = 0;
QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
if ( ok ) {
//qDebug("OK %s",next.toString().latin1());
if ( next < cur ) {
al.append( inL );
//qDebug("found missed alarm: %s ", inL->summary().latin1() );
}
}
inL = el.next();
}
if ( al.count() ) {
- QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
+ QDialog* dia = new QDialog( this, "huhu", false, Qt::WDestructiveClose | Qt::WStyle_StaysOnTop );
dia->setCaption( i18n("KO/Pi: Missing alarms!") );
- QVBoxLayout* lay = new QVBoxLayout( dia );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( dia );
lay->setSpacing( 0 );
lay->setMargin( 0 );
MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
lay->addWidget( matb );
if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
int wid = 210;
int x = QApplication::desktop()->width() - wid - 7;
int y = QApplication::desktop()->height() - wid - 70;
dia->setGeometry ( x,y,wid,wid);
} else {
int si = 220;
if ( QApplication::desktop()->width() > 470 )
si = 400;
dia->resize(si,si/2);
}
dia->setBackgroundColor( QColor( 255, 255, 255 ) );
dia->show();
}
#if 0
// for creating timetracker test data
qDebug("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCc ");
Todo * nt;
mCalendar->close();
{
Todo * root1 = new Todo;
mCalendar->addTodo( root1 );
root1->setSummary( "Project1");
root1->setPriority( 1 );
root1->setCategories( QString( "Cat_Pro1") );
root1->setDescription( "This is a test description of a root Project" );
@@ -1187,146 +1193,146 @@ void CalendarView::computeAlarm( QString msg )
mAlarmMessage = mess.mid( 13+len+3 );
//qDebug("suspend file %s ",tempfilename.latin1() );
startAlarm( mAlarmMessage, filename);
return;
}
if ( mess.left( 11 ) == "timer_alarm") {
//mTimerTime = 0;
startAlarm( mess.mid( 11 ), filename );
return;
}
if ( mess.left( 10 ) == "proc_alarm") {
bool error = false;
int len = mess.mid( 10 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 10, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( error ) {
mAlarmMessage = "Procedure Alarm\nError - File not found\n";
mAlarmMessage += mess.mid( 10+len+3+9 );
} else {
//QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
//qDebug("-----system command %s ",tempfilename.latin1() );
#ifndef _WIN32_
if ( vfork () == 0 ) {
execl ( tempfilename.latin1(), 0 );
return;
}
#else
- QProcess* p = new QProcess();
+ Q3Process* p = new Q3Process();
p->addArgument( tempfilename.latin1() );
p->start();
return;
#endif
return;
}
//qDebug("+++++++system command %s ",tempfilename.latin1() );
}
if ( mess.left( 11 ) == "audio_alarm") {
bool error = false;
int len = mess.mid( 11 ).find("+++");
if ( len < 2 )
error = true;
else {
tempfilename = mess.mid( 11, len );
if ( !QFile::exists( tempfilename ) )
error = true;
}
if ( ! error ) {
filename = tempfilename;
}
mAlarmMessage = mess.mid( 11+len+3+9 );
//qDebug("audio file command %s ",tempfilename.latin1() );
}
if ( mess.left( 9 ) == "cal_alarm") {
mAlarmMessage = mess.mid( 9 ) ;
}
startAlarm( mAlarmMessage, filename );
}
void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
{
//qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
mSuspendAlarmNotification = noti;
int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
//qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
mSuspendTimer->start( ms , true );
#ifdef DESKTOP_VERSION
if ( QApplication::desktop()->width() < 1024 ) {
QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti;
//qDebug("nextsuspendalarm = \n%s ",mess.latin1() );
QString fn = QDir::homeDirPath() + "/.kopi_suspend_alarm";
QFile file( fn );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
qDebug("KO: Error writing next suspend alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1());
} else {
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << mess;
file.close();
}
}
#endif
}
void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
{
mNextAlarmDateTime = qdt;
//qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
#ifndef DESKTOP_VERSION
AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
#endif
return;
}
#ifdef DESKTOP_VERSION
if ( QApplication::desktop()->width() < 1024 ) {
QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti;
//qDebug("nextalarm = \n%s ",mess.latin1() );
QString fn = QDir::homeDirPath() + "/.kopi_next_alarm";
QFile file( fn );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
qDebug("KO: Error writing next alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1());
} else {
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << mess;
file.close();
}
}
#endif
int maxSec;
//maxSec = 5; //testing only
maxSec = 86400+3600; // one day+1hour
mAlarmNotification = noti;
int sec = QDateTime::currentDateTime().secsTo( qdt );
if ( sec > maxSec ) {
mRecheckAlarmTimer->start( maxSec * 1000 );
// qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
return;
} else {
mRecheckAlarmTimer->stop();
}
//qDebug("Alarm timer started with secs: %d ", sec);
mAlarmTimer->start( sec * 1000 , true );
}
// called by mRecheckAlarmTimer to get next alarm
// we need this, because a QTimer has only a max range of 25 days
void CalendarView::recheckTimerAlarm()
{
mAlarmTimer->stop();
mRecheckAlarmTimer->stop();
mCalendar->checkAlarmForIncidence( 0, true );
}
#ifndef DESKTOP_VERSION
void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
#else
@@ -1541,182 +1547,182 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
}
return 0;
}
Event* CalendarView::getLastSyncEvent()
{
Event* lse;
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
mCalendar->setSyncEventsEnabled();
lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
if (!lse) {
qDebug("KO: New last Syncevent created for local: %s",mCurrentSyncDevice.latin1() );
lse = new Event();
lse->setUid( "last-syncEvent-"+mCurrentSyncDevice );
QString sum = "";
if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) )
sum = "E: ";
lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event"));
lse->setDtStart( mLastCalendarSync );
lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
lse->setCategories( i18n("SyncEvent") );
lse->setReadOnly( true );
lse->setCalID( 1 );
mCalendar->addEvent( lse );
} else
qDebug("KO: Last Syncevent on local found");
return lse;
}
// we check, if the to delete event has a id for a profile
// if yes, we set this id in the profile to delete
-void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete )
+void CalendarView::checkExternSyncEvent( Q3PtrList<Event> lastSync , Incidence* toDelete )
{
if ( lastSync.count() == 0 ) {
//qDebug(" lastSync.count() == 0");
return;
}
if ( toDelete->typeID() == journalID )
return;
Event* eve = lastSync.first();
while ( eve ) {
QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name
if ( !id.isEmpty() ) {
QString des = eve->description();
QString pref = "e";
if ( toDelete->typeID() == todoID )
pref = "t";
des += pref+ id + ",";
eve->setReadOnly( false );
eve->setDescription( des );
//qDebug("setdes %s ", des.latin1());
eve->setReadOnly( true );
}
eve = lastSync.next();
}
}
void CalendarView::checkExternalId( Incidence * inc )
{
- QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
+ Q3PtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ;
checkExternSyncEvent( lastSync, inc );
}
// SSSSSSSSSSSSSSSSSSSSSS
bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
{
bool syncOK = true;
int addedEvent = 0;
int addedEventR = 0;
int deletedEventR = 0;
int deletedEventL = 0;
int changedLocal = 0;
int changedRemote = 0;
int filteredIN = 0;
int filteredOUT = 0;
//QPtrList<Event> el = local->rawEvents();
Event* eventR;
QString uid;
int take;
Event* eventRSync;
Event* eventLSync;
clearAllViews();
- QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
- QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
+ Q3PtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents();
+ Q3PtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents();
bool fullDateRange = false;
local->resetTempSyncStat();
mLastCalendarSync = QDateTime::currentDateTime();
if ( mSyncManager->syncWithDesktop() ) {
remote->resetPilotStat(1);
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
mLastCalendarSync = KSyncManager::mRequestedSyncEvent;
qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() );
} else {
qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
}
}
QDateTime modifiedCalendar = mLastCalendarSync;
eventLSync = getLastSyncEvent();
eventR = remote->event("last-syncEvent-"+mCurrentSyncName );
if ( eventR ) {
qDebug("KO: Last-syncEvent on remote found ");
eventRSync = (Event*) eventR->clone();
remote->deleteEvent(eventR );
} else {
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) {
eventRSync = (Event*)eventLSync->clone();
} else {
fullDateRange = true;
eventRSync = new Event();
eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
eventRSync->setUid("last-syncEvent-"+mCurrentSyncName );
eventRSync->setDtStart( mLastCalendarSync );
eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
eventRSync->setCategories( i18n("SyncEvent") );
}
}
if ( eventLSync->dtStart() == mLastCalendarSync )
fullDateRange = true;
if ( ! fullDateRange ) {
if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
qDebug("KO: Sync: Set fulldate to true! Local: %s --- Remote: %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
//qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
fullDateRange = true;
}
}
if ( mSyncManager->syncWithDesktop() ) {
fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync );
}
if ( fullDateRange )
mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
else
mLastCalendarSync = eventLSync->dtStart();
// for resyncing if own file has changed
if ( mCurrentSyncDevice == "deleteaftersync" ) {
mLastCalendarSync = loadedFileVersion;
//qDebug("setting mLastCalendarSync ");
}
//qDebug("*************************** ");
qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange);
- QPtrList<Incidence> er = remote->rawIncidences();
+ Q3PtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
Incidence* inL;
- QProgressBar bar( er.count(),0 );
+ Q3ProgressBar bar( er.count(),0 );
bar.setCaption (i18n("Syncing - close to abort!") );
// ************** setting up filter *************
CalFilter *filterIN = 0;
CalFilter *filterOUT = 0;
CalFilter *filter = mFilters.first();
while(filter) {
if ( filter->name() == mSyncManager->mFilterInCal )
filterIN = filter;
if ( filter->name() == mSyncManager->mFilterOutCal )
filterOUT = filter;
filter = mFilters.next();
}
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
int modulo = (er.count()/10)+1;
int incCounter = 0;
while ( inR ) {
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inR->uid();
bool skipIncidence = false;
if ( uid.left(15) == QString("last-syncEvent-") )
@@ -1802,65 +1808,65 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
inL = inR->clone();
inL->setIDStr( ":" );
inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) );
inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) );
inL->setCalID_block( 0 );// add to default cal
local->addIncidence( inL );
++addedEvent;
}
} else {
if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
inR->setLastModified( modifiedCalendar );
inL = inR->clone();
inL->setIDStr( ":" );
inL->setCalID_block( 0 );// add to default cal
local->addIncidence( inL );
++addedEvent;
} else {
checkExternSyncEvent(eventRSyncSharp, inR);
remote->deleteIncidence( inR );
++deletedEventR;
}
}
} else {
++filteredIN;
}
}
}
inR = er.next();
}
- QPtrList<Incidence> el = local->rawIncidences();
+ Q3PtrList<Incidence> el = local->rawIncidences();
inL = el.first();
modulo = (el.count()/10)+1;
bar.setCaption (i18n("Add / remove events") );
bar.setTotalSteps ( el.count() ) ;
bar.show();
incCounter = 0;
while ( inL ) {
qApp->processEvents();
if ( ! bar.isVisible() )
return false;
if ( incCounter % modulo == 0 )
bar.setProgress( incCounter );
++incCounter;
uid = inL->uid();
bool skipIncidence = false;
if ( uid.left(15) == QString("last-syncEvent-") )
skipIncidence = true;
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID )
skipIncidence = true;
if ( !skipIncidence ) {
inR = remote->incidenceForUid( uid , true, true );
if ( ! inR ) {
if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){
// no conflict ********** add or delete local
if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
checkExternSyncEvent(eventLSyncSharp, inL);
local->deleteIncidence( inL );
++deletedEventL;
} else {
@@ -2019,65 +2025,65 @@ void CalendarView::syncExternal( int mode )
calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
bool syncOK = false;
bool loadSuccess = false;
PhoneFormat* phoneFormat = 0;
emit tempDisableBR(true);
#ifndef DESKTOP_VERSION
SharpFormat* sharpFormat = 0;
if ( mode == 0 ) { // sharp
sharpFormat = new SharpFormat () ;
loadSuccess = sharpFormat->load( calendar, mCalendar );
} else
#endif
if ( mode == 1 ) { // phone
phoneFormat = new PhoneFormat (mCurrentSyncDevice,
mSyncManager->mPhoneDevice,
mSyncManager->mPhoneConnection,
mSyncManager->mPhoneModel);
loadSuccess = phoneFormat->load( calendar,mCalendar);
} else {
emit tempDisableBR(false);
return;
}
if ( loadSuccess ) {
getEventViewerDialog()->setSyncMode( true );
syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( mSyncManager->mWriteBackFile )
{
- QPtrList<Incidence> iL = mCalendar->rawIncidences();
+ Q3PtrList<Incidence> iL = mCalendar->rawIncidences();
Incidence* inc = iL.first();
if ( phoneFormat ) {
while ( inc ) {
inc->removeID(mCurrentSyncDevice);
inc = iL.next();
}
}
#ifndef DESKTOP_VERSION
if ( sharpFormat )
sharpFormat->save(calendar);
#endif
if ( phoneFormat )
phoneFormat->save(calendar);
iL = calendar->rawIncidences();
inc = iL.first();
Incidence* loc;
while ( inc ) {
if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
loc = mCalendar->incidence(inc->uid() );
if ( loc ) {
loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
}
}
inc = iL.next();
}
Incidence* lse = getLastSyncEvent();
if ( lse ) {
lse->setReadOnly( false );
lse->setDescription( "" );
lse->setReadOnly( true );
}
@@ -2086,65 +2092,65 @@ void CalendarView::syncExternal( int mode )
topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
}
setModified( true );
} else {
QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
question, i18n("Ok")) ;
}
delete calendar;
updateView();
emit tempDisableBR(false);
return ;//syncOK;
}
bool CalendarView::importBday()
{
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
int curCal = mCalendar->defaultCalendar();
int bd = mCalEditView->getBirtdayID();
if ( bd == 0 )
return false;
mCalendar->setDefaultCalendar( bd );
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
int count = 0;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
++count;
}
- QProgressBar bar(count,0 );
+ Q3ProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
bar.setCaption (i18n("Reading addressbook - close to abort!") );
qApp->processEvents();
count = 0;
int addCount = 0;
KCal::Attendee* a = 0;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
if ( ! bar.isVisible() )
return false;
bar.setProgress( count++ );
qApp->processEvents();
//qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
if ( (*it).birthday().date().isValid() ){
a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
++addCount;
}
QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
if ( anni.isValid() ){
a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
++addCount;
}
}
mCalendar->setDefaultCalendar( curCal );
@@ -2157,65 +2163,65 @@ bool CalendarView::importBday()
#endif //DESKTOP_VERSION
#endif //KORG_NOKABC
return true;
}
// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
const QStringList& anniversaryList, const QStringList& realNameList,
const QStringList& emailList, const QStringList& assembledNameList,
const QStringList& uidList)
{
//qDebug("KO::CalendarView::insertBirthdays");
if (uid == this->name())
{
int curCal = mCalendar->defaultCalendar();
int bd = mCalEditView->getBirtdayID();
if ( bd == 0 )
return;
mCalendar->setDefaultCalendar( bd );
int count = birthdayList.count();
int addCount = 0;
KCal::Attendee* a = 0;
//qDebug("CalView 1 %i", count);
- QProgressBar bar(count,0 );
+ Q3ProgressBar bar(count,0 );
int w = 300;
if ( QApplication::desktop()->width() < 320 )
w = 220;
int h = bar.sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
bar.setCaption (i18n("inserting birthdays - close to abort!") );
qApp->processEvents();
QDate birthday;
QDate anniversary;
QString realName;
QString email;
QString assembledName;
QString uid;
bool ok = true;
for ( int i = 0; i < count; i++)
{
if ( ! bar.isVisible() )
return;
bar.setProgress( i );
qApp->processEvents();
birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok);
if (!ok) {
;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1());
}
anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok);
if (!ok) {
@@ -2321,79 +2327,79 @@ bool CalendarView::importQtopia( const QString &categories,
syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
getEventViewerDialog()->setSyncMode( false );
qApp->processEvents();
if ( syncOK ) {
if ( mSyncManager->mWriteBackFile )
{
// write back XML file
}
setModified( true );
}
} else {
QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
question, i18n("Ok")) ;
}
delete calendar;
updateView();
return syncOK;
#endif
}
void CalendarView::setSyncEventsReadOnly()
{
mCalendar->setSyncEventsReadOnly();
}
bool CalendarView::loadCalendars()
{
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
mCalendar->setDefaultCalendar( 1 );
openCalendar( MainWindow::defaultFileName(), false );
cal = calendars.next();
while ( cal ) {
addCalendar( cal );
cal = calendars.next();
}
restoreCalendarSettings();
return true;
}
bool CalendarView::restoreCalendarSettings()
{
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
while ( cal ) {
mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
if ( cal->isStandard )
mCalendar->setDefaultCalendar( cal->mCalNumber );
cal = calendars.next();
}
setSyncEventsReadOnly();
mCalendar->reInitAlarmSettings();
updateUnmanagedViews();
updateView();
return true;
}
void CalendarView::addCalendarId( int id )
{
KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
if ( cal )
addCalendar( cal );
}
bool CalendarView::addCalendar( KopiCalendarFile * cal )
{
cal->mErrorOnLoad = false;
if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) {
cal->mLoadDt = QDateTime::currentDateTime();
return true;
}
qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() );
cal->mErrorOnLoad = true;
return false;
}
@@ -2500,127 +2506,127 @@ void CalendarView::showOpenError()
KMessageBox::error(this,i18n("Couldn't load calendar\n."));
}
void CalendarView::setLoadedFileVersion(QDateTime dt)
{
loadedFileVersion = dt;
}
bool CalendarView::checkFileChanged(QString fn)
{
QFileInfo finf ( fn );
if ( !finf.exists() )
return true;
QDateTime dt = finf.lastModified ();
if ( dt <= loadedFileVersion )
return false;
return true;
}
void CalendarView::watchSavedFile()
{
QFileInfo finf ( MainWindow::defaultFileName());
if ( !finf.exists() )
return;
QDateTime dt = finf.lastModified ();
if ( dt < loadedFileVersion ) {
//qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
return;
}
loadedFileVersion = dt;
}
bool CalendarView::checkAllFileVersions()
{
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
mCalendar->setDefaultCalendar( 1 );
mCalendar->setDefaultCalendarEnabledOnly();
if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
if ( !checkFileVersion(MainWindow::defaultFileName())) {
restoreCalendarSettings();
return false;
}
}
cal = calendars.next();
QDateTime storeTemp = loadedFileVersion;
while ( cal ) {
if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
mCalendar->setDefaultCalendar( cal->mCalNumber );
mCalendar->setDefaultCalendarEnabledOnly();
loadedFileVersion = cal->mLoadDt.addSecs( 15 );
if ( !checkFileVersion(cal->mFileName )) {
loadedFileVersion = storeTemp;
restoreCalendarSettings();
return false;
}
}
cal = calendars.next();
}
loadedFileVersion = storeTemp;
return true;
}
bool CalendarView::checkFileVersion(QString fn)
{
QFileInfo finf ( fn );
if ( !finf.exists() )
return true;
QDateTime dt = finf.lastModified ();
//qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
//qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
if ( dt <= loadedFileVersion )
return true;
int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
i18n("KO/Pi Warning"),i18n("Overwrite"),
i18n("Sync+save"));
if ( km == KMessageBox::Cancel )
return false;
if ( km == KMessageBox::Yes )
return true;
setSyncDevice("deleteaftersync" );
mSyncManager->mAskForPreferences = true;
mSyncManager->mSyncAlgoPrefs = 3;
mSyncManager->mWriteBackFile = false;
mSyncManager->mWriteBackExistingOnly = false;
mSyncManager->mShowSyncSummary = false;
mMultiResourceSync = false;
syncCalendar( fn, 3 );
Event * e = getLastSyncEvent();
if ( e )
mCalendar->deleteEvent( e );
return true;
}
bool CalendarView::saveCalendars()
{
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
mCalendar->setDefaultCalendar( 1 );
mCalendar->setDefaultCalendarEnabledOnly();
QString saveError;
if ( !saveCalendar( MainWindow::defaultFileName() ) )
saveError = cal->mName +"\n";
cal = calendars.next();
while ( cal ) {
if ( !cal->isReadOnly && !cal->mErrorOnLoad ) {
mCalendar->setDefaultCalendar( cal->mCalNumber );
mCalendar->setDefaultCalendarEnabledOnly();
if ( saveCalendar( cal->mFileName ) )
cal->mLoadDt = QDateTime::currentDateTime();
else
saveError += cal->mName + "\n";
}
cal = calendars.next();
}
restoreCalendarSettings();
//saveError = "test error";
if ( !saveError.isEmpty() ) {
saveError = KGlobal::formatMessage( i18n("Calendar(s) not saved:"),0 )+"\n" + saveError;
KMessageBox::error(this, saveError, i18n("Error saving data"));
return false;
}
return true;
}
bool CalendarView::saveCalendarResource(QString filename, QString resource)
{
if ( resource == "ALL" ) {
mCalendar->setAllCalendarEnabled( true );
bool retval = saveCalendar( filename );
@@ -2666,65 +2672,65 @@ bool CalendarView::saveCalendar( QString filename )
void CalendarView::closeCalendar()
{
// child windows no longer valid
clearAllViews();
emit closingDown();
mCalendar->close();
setModified(false);
updateView();
}
void CalendarView::archiveCalendar()
{
mDialogManager->showArchiveDialog();
}
void CalendarView::readSettings()
{
// mViewManager->showAgendaView();
QString str;
//qDebug("CalendarView::readSettings() ");
// read settings from the KConfig, supplying reasonable
// defaults where none are to be found
KConfig *config = KOGlobals::config();
#ifndef KORG_NOSPLITTER
config->setGroup("KOrganizer Geometry");
- QValueList<int> sizes = config->readIntListEntry("Separator1");
+ Q3ValueList<int> sizes = config->readIntListEntry("Separator1");
if (sizes.count() != 2) {
sizes << mDateNavigator->minimumSizeHint().width();
sizes << 300;
}
mPanner->setSizes(sizes);
sizes = config->readIntListEntry("Separator2");
if ( ( mResourceView && sizes.count() == 4 ) ||
( !mResourceView && sizes.count() == 3 ) ) {
mLeftSplitter->setSizes(sizes);
}
#endif
globalFlagBlockAgenda = 1;
mViewManager->showAgendaView();
//mViewManager->readSettings( config );
mTodoList->restoreLayout(config,QString("Todo Layout"));
readFilterSettings(config);
#ifdef DESKTOP_VERSION
config->setGroup("WidgetLayout");
QStringList list;
list = config->readListEntry("MainLayout");
int x,y,w,h;
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
topLevelWidget()->setGeometry(x,y,w,h);
} else {
@@ -2734,65 +2740,65 @@ void CalendarView::readSettings()
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
mEventEditor->setGeometry(x,y,w,h);
}
list = config->readListEntry("EditTodoLayout");
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
mTodoEditor->setGeometry(x,y,w,h);
}
list = config->readListEntry("ViewerLayout");
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
getEventViewerDialog()->setGeometry(x,y,w,h);
}
#endif
config->setGroup( "Views" );
int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
- QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
+ Q3ValueList<int> sizes = config->readIntListEntry("Left Splitter Frame");
int resetval = 0;
int maxVal = 0;
if (sizes.count() != 3) {
if ( KOPrefs::instance()->mVerticalScreen ) {
resetval = mDateNavigator->sizeHint().width()+2;
} else {
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( resetval ) {
sizes.clear();
if ( KOPrefs::instance()->mVerticalScreen ) {
maxVal = QApplication::desktop()->width() -10;
} else {
maxVal = QApplication::desktop()->height()-10;
}
sizes << resetval;
if ( maxVal < resetval + resetval)
resetval = maxVal - resetval;
sizes << resetval;
sizes << 100;
}
mLeftFrame->setSizes(sizes);
sizes = config->readIntListEntry("Main Splitter Frame");
resetval = 0;
maxVal = 0;
if (sizes.count() != 2) {
if ( !KOPrefs::instance()->mVerticalScreen ) {
resetval = mDateNavigator->sizeHint().width()+2;
} else {
resetval = mDateNavigator->sizeHint().height()+2;
@@ -2813,94 +2819,94 @@ void CalendarView::readSettings()
mMainFrame->setSizes(sizes);
if ( dateCount == 5 ) mNavigator->selectWorkWeek();
else if ( dateCount == 7 ) mNavigator->selectWeek();
else mNavigator->selectDates( dateCount );
// mViewManager->readSettings( config );
updateConfig();
globalFlagBlockAgenda = 2;
mViewManager->readSettings( config );
QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
}
void CalendarView::checkSuspendAlarm()
{
if ( mSuspendTimer->isActive() ) {
KMessageBox::information( this, i18n("<b>WARNING:</b> There is a pending suspended alarm!"), i18n("Pending Suspend Alarm"));
}
}
void CalendarView::writeSettings()
{
// kdDebug() << "CalendarView::writeSettings" << endl;
KConfig *config = KOGlobals::config();
mViewManager->writeSettings( config );
mTodoList->saveLayout(config,QString("Todo Layout"));
mDialogManager->writeSettings( config );
//KOPrefs::instance()->usrWriteConfig();
KOPrefs::instance()->writeConfig();
writeFilterSettings(config);
config->setGroup( "AppRun" );
QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
- int days = dt.daysTo( QDate::currentDate() );
+ int days = dt.daysTo( (QDateTime)QDate::currentDate() );
dt = dt.addDays( days );
int secs = dt.secsTo( QDateTime::currentDateTime() );
config->writeEntry( "LatestProgramStopDays", days );
config->writeEntry( "LatestProgramStopSecs", secs );
//qDebug("KO: Writing stop time: %d ", secs);
//qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
//QDateTime latest = dt.addSecs ( secs );
//qDebug("KO: Termination on %s ", latest.toString().latin1());
config->setGroup( "Views" );
config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
#if 0
qDebug("********************* ");
qDebug("Testcode secsto ");
QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
int secsto = dt_nodaylight.secsTo( dt_daylight );
QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
qDebug("********************* testcode end");
#endif
- QValueList<int> listINT = mLeftFrame->sizes();
+ Q3ValueList<int> listINT = mLeftFrame->sizes();
config->writeEntry("Left Splitter Frame",listINT);
- QValueList<int> listINT2 = mMainFrame->sizes();
+ Q3ValueList<int> listINT2 = mMainFrame->sizes();
config->writeEntry("Main Splitter Frame",listINT2);
#ifdef DESKTOP_VERSION
config->setGroup("WidgetLayout");
QStringList list ;//= config->readListEntry("MainLayout");
int x,y,w,h;
QWidget* wid;
wid = topLevelWidget();
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("MainLayout",list );
wid = mEventEditor;
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("EditEventLayout",list );
wid = mTodoEditor;
x = wid->geometry().x();
@@ -3137,65 +3143,65 @@ void CalendarView::changeEventDisplay(Event *which, int action)
// }
} else {
mViewManager->currentView()->updateView();
}
}
void CalendarView::checkConflictForEvent()
{
if (!KOPrefs::instance()->mConfirm)
return;
if ( ! mConflictingEvent ) return;
Event * conflictingEvent = mConflictingEvent;
mConflictingEvent = 0;
QDateTime current = QDateTime::currentDateTime();
if ( ! conflictingEvent->matchTime( &current, 0 ) ) {
return;
}
CalFilter *filterIN = 0;
CalFilter *filterALL = 0;
CalFilter *filter = mFilters.first();
while(filter) {
if ( filter->name() == KOPrefs::instance()->mFilterConflictEditItem)
filterIN = filter;
if ( filter->name() == KOPrefs::instance()->mFilterConflictAllItem )
filterALL = filter;
filter = mFilters.next();
}
if ( filterIN ) {
if ( !filterIN->filterCalendarItem( conflictingEvent ) ) {
return;
}
}
- QPtrList<Event> testlist = mCalendar->events();
+ Q3PtrList<Event> testlist = mCalendar->events();
Event * test = testlist.first();
QDateTime conflict;
QDateTime retVal;
bool found = false;
Event * cE = 0;
bool chAD = KOPrefs::instance()->mCheckConflictsAllDayAllDay;
bool chNad = KOPrefs::instance()->mCheckConflictsAllDayNonAD;
if ( !conflictingEvent->doesFloat() ) {
chAD = KOPrefs::instance()->mCheckConflictsNonADAllDay;
chNad = KOPrefs::instance()->mCheckConflictsNonADNonAD;
}
topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") );
while ( test ) {
qApp->processEvents();
bool skip = ( test->doesFloat() && !chAD ) || ( !test->doesFloat() && !chNad );
if ( !skip ) {
if ( !KOPrefs::instance()->mIncludeFree && test->transparency() == KCal::Event::Transparent )
skip = true;
}
if ( !skip ) {
if ( filterALL ) {
if ( !filterALL->filterCalendarItem( test ) ) {
skip = true;
}
}
if ( !skip ) {
if ( found )
skip = !test->matchTime( &current, &conflict );
else
skip = !test->matchTime( &current, 0 );
if ( !skip ) {
@@ -3399,160 +3405,160 @@ void CalendarView::slotSelectPickerDate( QDate d)
} else if ( mMoveIncidence->typeID() == eventID ) {
if ( mMoveIncidence->doesRecur() ) {
#if 0
// PENDING implement this
Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
mCalendar()->addIncidence( newInc );
if ( mMoveIncidence->typeID() == todoID )
emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
else
emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
mMoveIncidence = newInc;
#endif
}
QTime tim = mMoveIncidence->dtStart().time();
int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
QDateTime dt ( d,tim );
mMoveIncidence->setDtStart( dt );
((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
} else if ( mMoveIncidence->typeID() == journalID ) {
QTime tim = mMoveIncidence->dtStart().time();
QDateTime dt ( d,tim );
mMoveIncidence->setDtStart( dt );
updateView();
}
mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
}
}
void CalendarView::removeCategories()
{
- QPtrList<Incidence> incList = mCalendar->rawIncidences();
+ Q3PtrList<Incidence> incList = mCalendar->rawIncidences();
QStringList catList = KOPrefs::instance()->mCustomCategories;
QStringList catIncList;
QStringList newCatList;
Incidence* inc = incList.first();
uint i;
while ( inc ) {
newCatList.clear();
catIncList = inc->categories() ;
for( i = 0; i< catIncList.count(); ++i ) {
if ( catList.contains (catIncList[i]))
newCatList.append( catIncList[i] );
}
newCatList.sort();
inc->setCategories( newCatList.join(",") );
inc = incList.next();
}
}
int CalendarView::addCategories()
{
- QPtrList<Incidence> incList = mCalendar->rawIncidences();
+ Q3PtrList<Incidence> incList = mCalendar->rawIncidences();
QStringList catList = KOPrefs::instance()->mCustomCategories;
QStringList catIncList;
Incidence* inc = incList.first();
uint i;
int count = 0;
while ( inc ) {
catIncList = inc->categories() ;
for( i = 0; i< catIncList.count(); ++i ) {
if ( !catList.contains (catIncList[i])) {
catList.append( catIncList[i] );
//qDebug("add cat %s ", catIncList[i].latin1());
++count;
}
}
inc = incList.next();
}
catList.sort();
KOPrefs::instance()->mCustomCategories = catList;
return count;
}
void CalendarView::editCategories()
{
qDebug("CalendarView::editCategories() ");
KPIM::CategoryEditDialog ced (KOPrefs::instance(),this );
ced.exec();
}
void CalendarView::manageCategories()
{
KOCatPrefs* cp = new KOCatPrefs();
cp->show();
int w =cp->sizeHint().width() ;
int h = cp->sizeHint().height() ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
if ( !cp->exec() ) {
delete cp;
return;
}
int count = 0;
if ( cp->addCat() ) {
count = addCategories();
if ( count ) {
topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
writeSettings();
} else
topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! "));
} else {
removeCategories();
updateView();
}
delete cp;
}
void CalendarView::beamIncidence(Incidence * Inc)
{
- QPtrList<Incidence> delSel ;
+ Q3PtrList<Incidence> delSel ;
delSel.append(Inc);
beamIncidenceList( delSel );
}
void CalendarView::beamCalendar()
{
- QPtrList<Incidence> delSel = mCalendar->rawIncidences();
+ Q3PtrList<Incidence> delSel = mCalendar->rawIncidences();
//qDebug("beamCalendar() ");
beamIncidenceList( delSel );
}
void CalendarView::beamFilteredCalendar()
{
- QPtrList<Incidence> delSel = mCalendar->incidences();
+ Q3PtrList<Incidence> delSel = mCalendar->incidences();
//qDebug("beamFilteredCalendar() ");
beamIncidenceList( delSel );
}
-void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
+void CalendarView::beamIncidenceList(Q3PtrList<Incidence> delSel )
{
KOBeamPrefs beamDialog;
if ( beamDialog.exec () == QDialog::Rejected )
return;
#ifdef DESKTOP_VERSION
QString fn = locateLocal( "tmp", "kopibeamfile" );
#else
QString fn = "/tmp/kopibeamfile";
#endif
QString mes;
bool createbup = true;
if ( createbup ) {
QString description = "\n";
CalendarLocal* cal = new CalendarLocal();
if ( beamDialog.beamLocal() )
cal->setLocalTime();
else
cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
Incidence *incidence = delSel.first();
bool addText = false;
if ( delSel.count() < 10 )
addText = true;
else {
description.sprintf(i18n(" %d items?"),delSel.count() );
}
while ( incidence ) {
Incidence *in = incidence->clone();
if ( ! in->summary().isEmpty() ) {
in->setDescription("");
} else {
in->setSummary( in->description().left(20));
@@ -4286,65 +4292,65 @@ void CalendarView::action_mail()
mailobject.emailEvent(anEvent);
#endif
}
void CalendarView::schedule_publish(Incidence *incidence)
{
Event *event = 0;
Todo *todo = 0;
if (incidence == 0) {
incidence = mViewManager->currentView()->selectedIncidences().first();
if (incidence == 0) {
incidence = mTodoList->selectedIncidences().first();
}
}
if ( incidence && incidence->typeID() == eventID ) {
event = static_cast<Event *>(incidence);
} else {
if ( incidence && incidence->typeID() == todoID ) {
todo = static_cast<Todo *>(incidence);
}
}
if (!event && !todo) {
KMessageBox::sorry(this,i18n("No event selected."));
return;
}
PublishDialog *publishdlg = new PublishDialog();
if (incidence->attendeeCount()>0) {
- QPtrList<Attendee> attendees = incidence->attendees();
+ Q3PtrList<Attendee> attendees = incidence->attendees();
attendees.first();
while ( attendees.current()!=0 ) {
publishdlg->addAttendee(attendees.current());
attendees.next();
}
}
bool send = true;
if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) {
if ( publishdlg->exec() != QDialog::Accepted )
send = false;
}
if ( send ) {
OutgoingDialog *dlg = mDialogManager->outgoingDialog();
if ( event ) {
Event *ev = new Event(*event);
ev->registerObserver(0);
ev->clearAttendees();
if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
delete(ev);
}
} else {
if ( todo ) {
Todo *ev = new Todo(*todo);
ev->registerObserver(0);
ev->clearAttendees();
if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) {
delete(ev);
}
}
}
}
delete publishdlg;
@@ -4695,106 +4701,106 @@ void CalendarView::showDates(const DateList &selectedDates)
QDate date = selectedDates.first();
if ( ! date.isValid() ) {
topLevelWidget()->setCaption("");
return;
}
QString selDates;
selDates = KGlobal::locale()->formatDate( date, true);
if (selectedDates.first() < selectedDates.last() )
selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
else {
QString addString;
if ( date == QDateTime::currentDateTime().date() )
addString = i18n("Today");
else if ( date == QDateTime::currentDateTime().date().addDays(1) )
addString = i18n("Tomorrow");
else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
addString = i18n("Yesterday");
else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
addString = i18n("Day before yesterday");
else if ( date == QDateTime::currentDateTime().date().addDays(2) )
addString = i18n("Day after tomorrow");
if ( !addString.isEmpty() ) {
topLevelWidget()->setCaption( addString+", " + selDates );
return;
}
}
topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
}
-QPtrList<CalFilter> CalendarView::filters()
+Q3PtrList<CalFilter> CalendarView::filters()
{
return mFilters;
}
void CalendarView::editFilters()
{
// kdDebug() << "CalendarView::editFilters()" << endl;
CalFilter *filter = mFilters.first();
while(filter) {
filter = mFilters.next();
}
mDialogManager->showFilterEditDialog(&mFilters);
updateFilter();
}
void CalendarView::toggleFilter()
{
if ( mLeftFrame->isHidden() ) {
toggleExpand();
showFilter( true );
} else
showFilter(! mCalEditView->isVisible());
}
KOFilterView *CalendarView::filterView()
{
return mFilterView;
}
void CalendarView::selectFilter( int fil )
{
mFilterView->setSelectedFilter( fil );
updateUnmanagedViews();
}
void CalendarView::showFilter(bool visible)
{
#if 1
if (visible) {
mCalEditView->readConfig();
mCalEditView->show();
- QValueList<int> sizes;
+ Q3ValueList<int> sizes;
sizes = mLeftFrame->sizes();
if ( sizes.count() == 4 && sizes[3] < 20 ) {
sizes.clear();
sizes << 100;
sizes << 0;
sizes << 0;
sizes << 100;
mLeftFrame->setSizes(sizes);
}
#if 0
sizes = mLeftFrame->sizes();
int ccc = 0;
while ( ccc < sizes.count()) {
qDebug("size %d %d ", ccc, sizes[ccc]);
++ccc;
}
#endif
}
else {
mCalEditView->hide();
}
#else
if (visible) mFilterView->show();
else mFilterView->hide();
#endif
}
void CalendarView::toggleFilerEnabled( )
{
mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
if ( !mFilterView->filtersEnabled() )
topLevelWidget()->setCaption( i18n("Filter disabled ") );
@@ -4817,94 +4823,94 @@ void CalendarView::updateFilter()
topLevelWidget()->setCaption( mess );
}
emit filtersUpdated();
}
void CalendarView::filterEdited()
{
mFilterView->updateFilters();
updateFilter();
writeSettings();
}
void CalendarView::takeOverEvent()
{
Incidence *incidence = currentSelection();
if (!incidence) return;
incidence->setOrganizer(KOPrefs::instance()->email());
incidence->recreate();
incidence->setReadOnly(false);
updateView();
}
void CalendarView::takeOverCalendar()
{
// TODO: Create Calendar::allIncidences() function and use it here
clearAllViews();
- QPtrList<Event> events = mCalendar->events();
+ Q3PtrList<Event> events = mCalendar->events();
for(uint i=0; i<events.count(); ++i) {
events.at(i)->setOrganizer(KOPrefs::instance()->email());
events.at(i)->recreate();
events.at(i)->setReadOnly(false);
}
- QPtrList<Todo> todos = mCalendar->todos();
+ Q3PtrList<Todo> todos = mCalendar->todos();
for(uint i=0; i<todos.count(); ++i) {
todos.at(i)->setOrganizer(KOPrefs::instance()->email());
todos.at(i)->recreate();
todos.at(i)->setReadOnly(false);
}
- QPtrList<Journal> journals = mCalendar->journals();
+ Q3PtrList<Journal> journals = mCalendar->journals();
for(uint i=0; i<journals.count(); ++i) {
journals.at(i)->setOrganizer(KOPrefs::instance()->email());
journals.at(i)->recreate();
journals.at(i)->setReadOnly(false);
}
updateView();
}
void CalendarView::showIntro()
{
kdDebug() << "To be implemented." << endl;
}
-QWidgetStack *CalendarView::viewStack()
+Q3WidgetStack *CalendarView::viewStack()
{
return mRightFrame;
}
QWidget *CalendarView::leftFrame()
{
return ( QWidget *)mLeftFrame;
}
DateNavigator *CalendarView::dateNavigator()
{
return mNavigator;
}
KDateNavigator* CalendarView::dateNavigatorWidget()
{
return mDateNavigator->navigatorView();
}
void CalendarView::toggleDateNavigatorWidget()
{
KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
if (!KOPrefs::instance()->mShowDateNavigator )
mDateNavigator->hide();
else
mDateNavigator->show();
}
void CalendarView::addView(KOrg::BaseView *view)
{
mViewManager->addView(view);
}
@@ -5031,92 +5037,92 @@ void CalendarView::editIncidence(Incidence *incidence)
}
void CalendarView::deleteIncidence(Incidence *incidence)
{
//qDebug(" CalendarView::deleteIncidence ");
if ( incidence == 0 ) {
updateView();
emit updateSearchDialog();
return;
}
if ( incidence ) {
DeleteIncidenceVisitor v;
v.act( incidence, this );
}
}
void CalendarView::lookForOutgoingMessages()
{
OutgoingDialog *ogd = mDialogManager->outgoingDialog();
ogd->loadMessages();
}
void CalendarView::lookForIncomingMessages()
{
IncomingDialog *icd = mDialogManager->incomingDialog();
icd->retrieve();
}
bool CalendarView::removeCompletedSubTodos( Todo* t )
{
bool deleteTodo = true;
- QPtrList<Incidence> subTodos;
+ Q3PtrList<Incidence> subTodos;
Incidence *aTodo;
subTodos = t->relations();
for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
if (! removeCompletedSubTodos( (Todo*) aTodo ))
deleteTodo = false;
}
if ( deleteTodo ) {
if ( t->isCompleted() && !t->doesRecur()) {
checkExternalId( t );
mCalendar->deleteTodo( t );
changeTodoDisplay( t,KOGlobals::EVENTDELETED );
}
else
deleteTodo = false;
}
return deleteTodo;
}
void CalendarView::purgeCompleted()
{
int result = KMessageBox::warningContinueCancel(this,
i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
if (result == KMessageBox::Continue) {
- QPtrList<Todo> todoCal;
- QPtrList<Todo> rootTodos;
+ Q3PtrList<Todo> todoCal;
+ Q3PtrList<Todo> rootTodos;
//QPtrList<Incidence> rel;
Todo *aTodo;
todoCal = calendar()->todos();
for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
if ( !aTodo->relatedTo() )
rootTodos.append( aTodo );
}
for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
removeCompletedSubTodos( aTodo );
}
updateView();
}
}
void CalendarView::slotCalendarChanged()
{
;
}
void CalendarView::keyPressEvent ( QKeyEvent *e)
{
//qDebug("CalendarView::keyPressEvent ");
e->ignore();
}
void CalendarView::multiResourceSyncStart( bool start )
{
mMultiResourceSync = start;
}
bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource)
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 60b1276..b4eada7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,162 +1,164 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000, 2001
Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef CALENDARVIEW_H
#define CALENDARVIEW_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qlayout.h>
#include <qwidget.h>
-#include <qptrlist.h>
-#include <qvbox.h>
+#include <q3ptrlist.h>
+#include <q3vbox.h>
#include <qmap.h>
#include <qscrollbar.h>
+//Added by qt3to4:
+#include <QKeyEvent>
#ifndef DESKTOP_VERSION
#include <qtopia/ir.h>
#else
#define Ir char
#endif
#include <libkcal/calendar.h>
#include <libkcal/scheduler.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <KDGanttMinimizeSplitter.h>
#include <korganizer/calendarviewbase.h>
#include <ksyncmanager.h>
//#include <koprefs.h>
-class QWidgetStack;
+class Q3WidgetStack;
class QSplitter;
class KopiCalendarFile;
class CalPrinter;
class KOFilterView;
class KOCalEditView;
class KOViewManager;
class KODialogManager;
class KOTodoView;
class KDateNavigator;
class DateNavigatorContainer;
class DateNavigator;
class KOIncidenceEditor;
class KDatePicker;
class ResourceView;
class KOEventEditor;
class KOTodoEditor ;
class KOEventViewerDialog;
class KOBeamPrefs;
class KSyncProfile;
class AlarmDialog;
class KCal::Attendee;
namespace KCal { class FileStorage; }
using namespace KCal;
/**
This is the main calendar widget. It provides the different vies on t he
calendar data as well as the date navigator. It also handles synchronisation
of the different views and controls the different dialogs like preferences,
event editor, search dialog etc.
@short main calendar view widget
@author Cornelius Schumacher
*/
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qtextcodec.h>
-class MissedAlarmTextBrowser : public QTextBrowser {
+class MissedAlarmTextBrowser : public Q3TextBrowser {
Q_OBJECT
public:
- MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
+ MissedAlarmTextBrowser(QWidget *parent, Q3PtrList<Incidence> alarms ,QDateTime start);
~MissedAlarmTextBrowser();
void setSource(const QString & n);
private:
Incidence * getNextInc(QDateTime start );
- QPtrList<Incidence> mAlarms;
+ Q3PtrList<Incidence> mAlarms;
signals:
void showIncidence( QString uid);
};
class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
{
Q_OBJECT
public:
/**
Constructs a new calendar view widget.
@param calendar calendar document
@param parent parent window
@param name Qt internal widget object name
*/
CalendarView( CalendarResources *calendar, QWidget *parent = 0,
const char *name = 0 );
CalendarView( Calendar *calendar, QWidget *parent = 0,
const char *name = 0 );
virtual ~CalendarView();
Calendar *calendar() { return mCalendar; }
KOViewManager *viewManager();
KODialogManager *dialogManager();
QDate startDate();
QDate endDate();
- QWidgetStack *viewStack();
+ Q3WidgetStack *viewStack();
QWidget *leftFrame();
DateNavigator *dateNavigator();
KDateNavigator *dateNavigatorWidget();
void addView(KOrg::BaseView *);
void showView(KOrg::BaseView *);
KOEventViewerDialog* getEventViewerDialog();
Incidence *currentSelection();
void checkSuspendAlarm();
void mergeFile( QString fn );
void mergeFileResource( QString fn ,QString res);
signals:
void save ();
void saveStopTimer ();
void tempDisableBR(bool);
/** This todo has been modified */
void todoModified(Todo *, int);
/** when change is made to options dialog, the topwidget will catch this
* and emit this signal which notifies all widgets which have registered
* for notification to update their settings. */
void configChanged();
/** emitted when the topwidget is closing down, so that any attached
child windows can also close. */
void closingDown();
/** emitted right before we die */
void closed(QWidget *);
/** Emitted when state of modified flag changes */
void modifiedChanged(bool);
@@ -412,119 +414,119 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void takeOverEvent();
/** Take ownership of all events in calendar. */
void takeOverCalendar();
/** query whether or not the calendar is "dirty". */
bool isModified();
/** set the state of calendar. Modified means "dirty", i.e. needing a save. */
void setModified(bool modified=true);
/** query if the calendar is read-only. */
bool isReadOnly();
/** set state of calendar to read-only */
void setReadOnly(bool readOnly=true);
void eventUpdated(Incidence *);
/* iTIP scheduling actions */
void schedule_publish(Incidence *incidence = 0);
void schedule_request(Incidence *incidence = 0);
void schedule_refresh(Incidence *incidence = 0);
void schedule_cancel(Incidence *incidence = 0);
void schedule_add(Incidence *incidence = 0);
void schedule_reply(Incidence *incidence = 0);
void schedule_counter(Incidence *incidence = 0);
void schedule_declinecounter(Incidence *incidence = 0);
void schedule_publish_freebusy(int daysToPublish = 30);
void openAddressbook();
void editFilters();
void toggleFilerEnabled();
- QPtrList<CalFilter> filters();
+ Q3PtrList<CalFilter> filters();
void toggleFilter();
void showFilter(bool visible);
void updateFilter();
void filterEdited();
void selectFilter( int );
KOFilterView *filterView();
void showIntro();
/** Move the curdatepient view date to today */
void goToday();
/** Move to the next date(s) in the current view */
void goNext();
/** Move to the previous date(s) in the current view */
void goPrevious();
/** Move to the next date(s) in the current view */
void goNextMonth();
/** Move to the previous date(s) in the current view */
void goPreviousMonth();
void toggleExpand();
void toggleDateNavigatorWidget();
void toggleAllDaySize();
/** Look for new messages in the inbox */
void lookForIncomingMessages();
/** Look for new messages in the outbox */
void lookForOutgoingMessages();
void processMainViewSelection( Incidence * );
void processTodoListSelection( Incidence * );
void processIncidenceSelection( Incidence * );
void purgeCompleted();
bool removeCompletedSubTodos( Todo* );
void slotCalendarChanged();
bool importBday();
bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
bool importQtopia( const QString &categoriesFile,
const QString &datebookFile,
const QString &tasklistFile );
void syncExternal( int mode );
void slotSelectPickerDate( QDate ) ;
void showDatePicker() ;
void showDatePickerPopup() ;
void moveIncidence(Incidence *) ;
void beamIncidence(Incidence *) ;
void beamCalendar() ;
void beamFilteredCalendar() ;
- void beamIncidenceList(QPtrList<Incidence>) ;
+ void beamIncidenceList(Q3PtrList<Incidence>) ;
void manageCategories();
void editCategories();
int addCategories();
void removeCategories();
void setSyncDevice( QString );
void setSyncName( QString );
void showDay( QDate );
void undo_delete();
protected slots:
void resetFocus();
void scrollBarValue(int);
void slotViewerClosed();
void timerAlarm();
void suspendAlarm();
void beamDone( Ir *ir );
/** Select a view or adapt the current view to display the specified dates. */
void showDates( const KCal::DateList & );
void selectWeekNum ( int );
void checkConflictForEvent();
public:
void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval );
// show a standard warning
// returns KMsgBox::yesNoCancel()
int msgCalModified();
virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource);
virtual bool syncExternal(KSyncManager* manager, QString resource);
virtual void removeSyncInfo( QString syncProfile);
void setSyncManager(KSyncManager* manager);
void setLoadedFileVersion(QDateTime);
bool checkFileVersion(QString fn);
@@ -546,108 +548,108 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
Event *mConflictingEvent;
void schedule(Scheduler::Method, Incidence *incidence = 0);
// returns KMsgBox::OKCandel()
int msgItemDelete(const QString name);
void showEventEditor();
void showTodoEditor();
Todo *selectedTodo();
private:
#ifdef DESKTOP_VERSION
QScrollBar * mDateScrollBar;
#endif
bool flag_blockConflict;
bool flag_blockScrollBar;
bool flag_checkFileFirsttime;
bool flag_clearallviewsEventDisplay;
bool flag_clearallviewsupdateView;
QDateTime mNextAlarmDateTime;
bool mViewerCallerIsSearchDialog;
bool mBlockShowDates;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
QString mAlarmNotification;
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
void setSyncEventsReadOnly();
QDateTime loadedFileVersion;
- void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
+ void checkExternSyncEvent( Q3PtrList<Event> lastSync , Incidence* toDelete );
void checkExternalId( Incidence * inc );
int mGlobalSyncMode;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
void init();
int mDatePickerMode;
bool mFlagEditDescription;
QDateTime mLastCalendarSync;
void createPrinter();
void calendarModified( bool, Calendar * );
CalPrinter *mCalPrinter;
QSplitter *mPanner;
QSplitter *mLeftSplitter;
KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
- QWidgetStack *mRightFrame;
+ Q3WidgetStack *mRightFrame;
KDatePicker* mDatePicker;
- QVBox* mDateFrame;
+ Q3VBox* mDateFrame;
DateNavigatorContainer *mDateNavigator; // widget showing small month view.
KOFilterView *mFilterView;
KOCalEditView *mCalEditView;
ResourceView *mResourceView;
// calendar object for this viewing instance
Calendar *mCalendar;
CalendarResourceManager *mResourceManager;
FileStorage *mStorage;
DateNavigator *mNavigator;
KOViewManager *mViewManager;
KODialogManager *mDialogManager;
// Calendar filters
- QPtrList<CalFilter> mFilters;
+ Q3PtrList<CalFilter> mFilters;
// various housekeeping variables.
bool mModified; // flag indicating if calendar is modified
bool mReadOnly; // flag indicating if calendar is read-only
QDate mSaveSingleDate;
Incidence *mSelectedIncidence;
Incidence *mMoveIncidence;
QDate mMoveIncidenceOldDate;
KOTodoView *mTodoList;
KOEventEditor * mEventEditor;
KOTodoEditor * mTodoEditor;
KOEventViewerDialog * mEventViewerDialog;
void keyPressEvent ( QKeyEvent *e) ;
//QMap<Incidence*,KOIncidenceEditor*> mDialogList;
};
class CalendarViewVisitor : public Incidence::Visitor
{
public:
CalendarViewVisitor() : mView( 0 ) {}
bool act( Incidence *incidence, CalendarView *view )
{
mView = view;
return incidence->accept( *this );
}
protected:
CalendarView *mView;
};
diff --git a/korganizer/calprintbase.cpp b/korganizer/calprintbase.cpp
index 7b7d54c..ecb9e03 100644
--- a/korganizer/calprintbase.cpp
+++ b/korganizer/calprintbase.cpp
@@ -1,64 +1,66 @@
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qpainter.h>
#include <qlayout.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
-#include <qptrlist.h>
-#include <qintdict.h>
+#include <q3ptrlist.h>
+#include <q3intdict.h>
#include <qfontmetrics.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kcalendarsystem.h>
#include <kprinter.h>
#include <libkcal/todo.h>
#include <libkcal/event.h>
#include <libkcal/calendar.h>
#include "koprefs.h"
#include "koglobals.h"
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include "cellitem.h"
#include "calprintbase.h"
#ifndef KORG_NOPRINTER
//#include "calprintbase.moc"
int CalPrintBase::mHeaderHeight=90;
int CalPrintBase::mSubHeaderHeight=20;
int CalPrintBase::mMargin=36;
class CalPrintBase::TodoParentStart
{
@@ -116,66 +118,66 @@ class PrintCellItem : public KOrg::CellItem
QDate mDay;
};
void setCategoryColors( QPainter &p, Incidence *incidence)
{
QColor bgColor;
QStringList categories = incidence->categories();
QString cat = categories.first();
if (cat.isEmpty())
bgColor = KOPrefs::instance()->mEventColor;
else
bgColor = *(KOPrefs::instance()->categoryColor(cat));
QColor textColor = Qt::black;//getTextColor(bgColor);
p.setPen( textColor );
p.setBrush( bgColor );
}
CalPrintBase::CalPrintBase( KPrinter *printer, Calendar *cal, KConfig *cfg )
: QObject(), mPrinter( printer ), mCalendar( cal ), mConfig( cfg )
{
}
CalPrintBase::~CalPrintBase()
{
}
QWidget *CalPrintBase::configWidget( QWidget *w )
{
- QFrame *wdg = new QFrame( w );
- QVBoxLayout *layout = new QVBoxLayout( wdg );
+ Q3Frame *wdg = new Q3Frame( w );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( wdg );
QLabel *title = new QLabel( description(), wdg );
QFont titleFont( title->font() );
titleFont.setPointSize( 20 );
titleFont.setBold( true );
title->setFont( titleFont );
layout->addWidget( title );
layout->addWidget( new QLabel( longDescription(), wdg ) );
layout->addSpacing( 20 );
layout->addWidget( new QLabel( i18n("This printing style does not "
"have any configuration options."),
wdg ) );
layout->addStretch();
return wdg;
}
#include <qapplication.h>
void CalPrintBase::doPrint()
{
QPainter p;
mPrinter->setColorMode( (mUseColors)?(KPrinter::Color):(KPrinter::GrayScale));
//#define DUMMY_PRINTER
#ifdef DUMMY_PRINTER
static QWidget* dummy = 0;
if ( ! dummy )
dummy = new QWidget( );
else {
delete dummy;
dummy = new QWidget( );
@@ -256,273 +258,273 @@ void CalPrintBase::drawHeader( QPainter &p, QString title,
right -= (10+smallMonthWidth);
drawSmallMonth(p, QDate(month2.year(), month2.month(), 1),
right, y+2, smallMonthWidth, height-4);
right-=10;
}
if (month1.isValid()) {
right -= (10+smallMonthWidth);
drawSmallMonth(p, QDate(month1.year(), month1.month(), 1),
right, y+2, smallMonthWidth, height-4);
right-=10;
}
// Print the titles...
QFont font("helvetica", 18, QFont::Bold);
p.setFont(font);
QRect textRect( x+5, y+5, right-10-x, height-10 );
p.drawText( textRect, Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak, title );
}
void CalPrintBase::drawSmallMonth(QPainter &p, const QDate &qd,
int x, int y, int width, int height)
{
bool firstCol = true;
QDate monthDate(QDate(qd.year(), qd.month(), 1));
QDate monthDate2;
int month = monthDate.month();
// draw the title
p.setFont(QFont("helvetica", 7, QFont::Bold));
// int lineSpacing = p.fontMetrics().lineSpacing();
const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
- p.drawText(x, y, width, height/4, AlignCenter, calSys->monthName( qd ) );
+ p.drawText(x, y, width, height/4, Qt::AlignCenter, calSys->monthName( qd ) );
int cellWidth = width/7;
int cellHeight = height/8;
QString tmpStr;
// correct begin of week
int weekdayCol = weekdayColumn( qd.dayOfWeek() );
monthDate2 = monthDate.addDays(-weekdayCol);
// draw days of week
p.setFont(QFont("helvetica", 7, QFont::Bold));
for (int col = 0; col < 7; col++) {
// tmpStr.sprintf("%c",(const char*)monthDate2.dayName(monthDate2.dayOfWeek()));
tmpStr=calSys->weekDayName( monthDate2 )[0].upper();
p.drawText(x+col*cellWidth, y+height/4, cellWidth, cellHeight,
- AlignCenter, tmpStr);
+ Qt::AlignCenter, tmpStr);
monthDate2 = monthDate2.addDays(1);
}
// draw separator line
p.drawLine(x, y+height/4+cellHeight, x+width, y+height/4+cellHeight);
for (int row = 0; row < 5; row++) {
for (int col = 0; col < 7; col++) {
if (monthDate.month() != month)
break;
if (firstCol) {
firstCol = true;
col = weekdayColumn( monthDate.dayOfWeek() );
}
p.drawText( x+col*cellWidth,
y+height/4+cellHeight+(row*cellHeight),
- cellWidth, cellHeight, AlignCenter,
+ cellWidth, cellHeight, Qt::AlignCenter,
tmpStr.setNum(monthDate.day()) );
monthDate = monthDate.addDays(1);
}
}
}
///////////////////////////////////////////////////////////////////////////////
/*
* This routine draws a header box over the main part of the calendar
* containing the days of the week.
*/
void CalPrintBase::drawDaysOfWeek(QPainter &p,
const QDate &fromDate, const QDate &toDate,
int x, int y, int width, int height)
{
int cellWidth = width/(fromDate.daysTo( toDate )+1);
int currx=x;
QDate cellDate(fromDate);
while (cellDate<=toDate) {
drawDaysOfWeekBox(p, cellDate, currx, y, cellWidth, height);
currx+=cellWidth;
cellDate = cellDate.addDays(1);
}
}
void CalPrintBase::drawDaysOfWeekBox(QPainter &p, const QDate &qd,
int x, int y, int width, int height)
{
const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
p.setFont( QFont( "helvetica", 10, QFont::Bold ) );
p.drawRect( x, y, width, height );
// p.fillRect( x+1, y+1,
// width-2, height-2,
// QBrush( Dense7Pattern ) );
- p.drawText( x+5, y, width-10, height, AlignCenter | AlignVCenter,
+ p.drawText( x+5, y, width-10, height, Qt::AlignCenter | Qt::AlignVCenter,
calSys->weekDayName( qd ) );
}
void CalPrintBase::drawTimeLine(QPainter &p,
const QTime &fromTime, const QTime &toTime,
int x, int y, int width, int height)
{
p.drawRect(x, y, width, height);
int totalsecs=fromTime.secsTo(toTime);
float minlen=(float)height*60./(float)totalsecs;
float cellHeight=(60.*(float)minlen);
float currY=y;
QTime curTime( fromTime );
QTime endTime( toTime );
if ( fromTime.minute() > 30 )
curTime = QTime( fromTime.hour()+1, 0, 0 );
else if ( fromTime.minute() > 0 ) {
curTime = QTime( fromTime.hour(), 30, 0 );
float yy = currY + minlen*(float)fromTime.secsTo( curTime )/60.;
p.drawLine( x+width/2, (int)yy, x+width, (int)yy );
curTime = QTime( fromTime.hour()+1, 0, 0 );
}
currY += ( fromTime.secsTo(curTime)*minlen/60 );
while ( curTime < endTime ) {
p.drawLine( x, (int)currY, x+width, (int)currY );
int newY=(int)(currY+cellHeight/2.);
QString numStr;
if (newY < y+height) {
p.drawLine(x+width/2, (int)newY, x+width, (int)newY);
// draw the time:
if ( !KGlobal::locale()->use12Clock() ) {
numStr.setNum(curTime.hour());
if (cellHeight > 30) {
p.setFont(QFont("helvetica", 16, QFont::Bold));
} else {
p.setFont(QFont("helvetica", 12, QFont::Bold));
}
p.drawText(x+2, (int)currY+2, width/2-2, (int)cellHeight,
- AlignTop|AlignRight, numStr);
+ Qt::AlignTop|Qt::AlignRight, numStr);
p.setFont(QFont("helvetica", 10, QFont::Normal));
p.drawText(x+width/2, (int)currY+2, width/2+2, (int)(cellHeight/2)-3,
- AlignTop | AlignLeft, "00");
+ Qt::AlignTop | Qt::AlignLeft, "00");
} else {
QTime time( curTime.hour(), 0 );
numStr = KGlobal::locale()->formatTime( time );
p.setFont(QFont("helvetica", 14, QFont::Bold));
p.drawText(x+2, (int)currY+2, width-4, (int)cellHeight/2-3,
- AlignTop|AlignLeft, numStr);
+ Qt::AlignTop|Qt::AlignLeft, numStr);
}
currY+=cellHeight;
} // enough space for half-hour line and time
if (curTime.secsTo(endTime)>3600)
curTime=curTime.addSecs(3600);
else curTime=endTime;
} // currTime<endTime
}
///////////////////////////////////////////////////////////////////////////////
/** prints the all-day box for the agenda print view. if expandable is set,
height is the cell height of a single cell, and the returned height will
be the total height used for the all-day events. If !expandable, only one
cell will be used, and multiple events are concatenated using ", ".
*/
void CalPrintBase::drawAllDayBox(QPainter &p, Event::List &eventList,
const QDate &qd, bool expandable,
int x, int y, int width, int &height)
{
Event::List::Iterator it, itold;
int offset=y;
//p.setBrush(QBrush(Dense7Pattern));
QPen oldPen(p.pen());
QColor oldBgColor(p.backgroundColor());
QBrush oldBrush(p.brush());
QString multiDayStr;
it = eventList.begin();
#ifndef KORG_NOPLUGINS
QString hstring(KOCore::self()->holiday(qd));
if (!hstring.isEmpty()) {
Event*holiday=new Event();
holiday->setDtStart(qd);
holiday->setDtEnd(qd);
holiday->setFloats(true);
holiday->setCategories(i18n("Holiday"));
eventList.prepend(holiday);
}
#endif
Event *currEvent = 0;
// First, print all floating events
while( it!=eventList.end() ) {
currEvent=*it;
itold=it;
++it;
if ( currEvent->doesFloat() ) {
// set the colors according to the categories
QString text = currEvent->summary() ;
if ( ! currEvent->location().isEmpty() )
text += " ("+currEvent->location()+")";
if (expandable) {
if (mUseColors)
setCategoryColors(p, currEvent);
p.drawRect( x, offset, width, height );
p.drawText( x+5, offset+5, width-10, height-10,
- AlignCenter | AlignVCenter | AlignJustify | WordBreak,
+ Qt::AlignCenter | Qt::AlignVCenter | Qt::AlignJustify | Qt::WordBreak,
text );
// reset the colors
p.setBrush( oldBrush );
p.setPen( oldPen );
p.setBackgroundColor(oldBgColor);
offset += height;
} else {
//if (!multiDayStr.isEmpty()) multiDayStr+=", ";
multiDayStr += text+"\n";
}
eventList.remove( itold );
}
}
if (!expandable) {
p.drawRect(x, offset, width, height);
if (!multiDayStr.isEmpty()) {
// p.fillRect(x+1, offset+1, width-2, height-2, QBrush(Dense5Pattern) );
p.drawText( x+5, offset+5, width-10, height-10,
- AlignLeft | AlignTop | AlignJustify ,
+ Qt::AlignLeft | Qt::AlignTop | Qt::AlignJustify ,
multiDayStr);
}
} else {
height=offset-y;
}
}
void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events,
const QDate &qd, bool expandable,
QTime &fromTime, QTime &toTime,
int x, int y, int width, int height )
{
p.drawRect( x, y, width, height );
Event *event;
if ( expandable ) {
// Adapt start/end times to include complete events
Event::List::ConstIterator it;
for ( it = events.begin(); it != events.end(); ++it ) {
event = *it;
if ( event->dtStart().time() < fromTime )
fromTime = event->dtStart().time();
if ( event->dtEnd().time() > toTime )
toTime = event->dtEnd().time();
}
}
// Show at least one hour
if ( fromTime.secsTo( toTime ) < 3600 ) {
fromTime = QTime( fromTime.hour(), 0, 0 );
@@ -531,248 +533,248 @@ void CalPrintBase::drawAgendaDayBox( QPainter &p, Event::List &events,
// calculate the height of a cell and of a minute
int totalsecs = fromTime.secsTo( toTime );
float minlen = height * 60. / totalsecs;
float cellHeight = 60. * minlen;
float currY = y;
// print grid:
QTime curTime( QTime( fromTime.hour(), 0, 0 ) );
currY += fromTime.secsTo( curTime ) * minlen / 60;
while ( curTime < toTime && curTime.isValid() ) {
if ( currY > y ) p.drawLine( x, int( currY ), x + width, int( currY ) );
currY += cellHeight / 2;
if ( ( currY > y ) && ( currY < y + height ) ) {
QPen oldPen( p.pen() );
p.setPen( QColor( 192, 192, 192 ) );
p.drawLine( x, int( currY ), x + width, int( currY ) );
p.setPen( oldPen );
} // enough space for half-hour line
if ( curTime.secsTo( toTime ) > 3600 )
curTime = curTime.addSecs( 3600 );
else curTime = toTime;
currY += cellHeight / 2;
}
QDateTime startPrintDate = QDateTime( qd, fromTime );
QDateTime endPrintDate = QDateTime( qd, toTime );
// Calculate horizontal positions and widths of events taking into account
// overlapping events
- QPtrList<KOrg::CellItem> cells;
+ Q3PtrList<KOrg::CellItem> cells;
cells.setAutoDelete( true );
Event::List::ConstIterator itEvents;
for( itEvents = events.begin(); itEvents != events.end(); ++itEvents ) {
cells.append( new PrintCellItem( *itEvents, qd ) );
}
- QPtrListIterator<KOrg::CellItem> it1( cells );
+ Q3PtrListIterator<KOrg::CellItem> it1( cells );
for( it1.toFirst(); it1.current(); ++it1 ) {
KOrg::CellItem *placeItem = it1.current();
KOrg::CellItem::placeItem( cells, placeItem );
}
QPen oldPen = p.pen();
QColor oldBgColor = p.backgroundColor();
QBrush oldBrush = p.brush();
p.setFont( QFont( "helvetica", 10 ) );
//p.setBrush( QBrush( Dense7Pattern ) );
for( it1.toFirst(); it1.current(); ++it1 ) {
PrintCellItem *placeItem = static_cast<PrintCellItem *>( it1.current() );
drawAgendaItem( placeItem, p, qd, startPrintDate, endPrintDate, minlen, x,
y, width );
p.setBrush( oldBrush );
p.setPen( oldPen );
p.setBackgroundColor( oldBgColor );
}
- p.setBrush( QBrush( NoBrush ) );
+ p.setBrush( QBrush( Qt::NoBrush ) );
}
void CalPrintBase::drawAgendaItem( PrintCellItem *item, QPainter &p,
const QDate &qd,
const QDateTime &startPrintDate,
const QDateTime &endPrintDate,
float minlen, int x, int y, int width )
{
Event *event = item->event();
// set the colors according to the categories
if ( mUseColors ) setCategoryColors( p, event );
else p.setBrush( Qt::white );
// start/end of print area for event
QDateTime startTime = event->dtStart();
QDateTime endTime = event->dtEnd();
if ( event->doesRecur() ) {
startTime.setDate( qd );
endTime.setDate( qd );
}
if ( ( startTime < endPrintDate && endTime > startPrintDate ) ||
( endTime > startPrintDate && startTime < endPrintDate ) ) {
if ( startTime < startPrintDate ) startTime = startPrintDate;
if ( endTime > endPrintDate ) endTime = endPrintDate;
int eventLength = int( startTime.secsTo( endTime ) / 60. * minlen );
int currentyPos = int( y + startPrintDate.secsTo( startTime ) *
minlen / 60. );
int currentWidth = width / item->subCells();
int currentX = x + item->subCell() * currentWidth;
QString text = KGlobal::locale()->formatTime(event->dtStart().time())+
"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+
" "+event->summary();
if ( !event->location().isEmpty() )
text += " (" +event->location()+")";
// p.save();
QPen pe = p.pen();
pe.setWidth( 2 );
p.setPen( pe );
p.drawRect( currentX, currentyPos+1, currentWidth+1, eventLength+1 );
p.drawText( currentX+3, currentyPos+2, currentWidth-5, eventLength-3,
- AlignLeft | AlignTop | AlignJustify | WordBreak,
+ Qt::AlignLeft | Qt::AlignTop | Qt::AlignJustify | Qt::TextWordWrap,
text);
// p.restore();
}
}
void CalPrintBase::drawDayBox(QPainter &p, const QDate &qd,
int x, int y, int width, int height,
bool fullDate)
{
QString dayNumStr;
QString ampm;
const KLocale*local = KGlobal::locale();
// This has to be localized
if (fullDate) {
dayNumStr = local->formatDate(qd);
} else {
dayNumStr = QString::number( qd.day() );
}
p.eraseRect( x, y, width, height );
p.drawRect( x, y, width, height );
// p.fillRect( x+1, y+1, width-2,height, QBrush(Dense7Pattern) );
p.drawRect( x, y, width, mSubHeaderHeight );
//p.fillRect( x+1, y+1, width-2, mSubHeaderHeight-2, QBrush(Dense7Pattern) );
QString hstring;
#ifndef KORG_NOPLUGINS
hstring=KOCore::self()->holiday(qd);
#endif
if (!hstring.isEmpty()) {
p.setFont( QFont( "helvetica", 8, QFont::Bold, true ) );
- p.drawText( x+5, y, width-25, mSubHeaderHeight, AlignLeft | AlignVCenter,
+ p.drawText( x+5, y, width-25, mSubHeaderHeight, Qt::AlignLeft | Qt::AlignVCenter,
hstring );
}
p.setFont(QFont("helvetica", 10, QFont::Bold));
if ( fullDate) {
// use short date format, if long date is too long
QFontMetrics fm ( p.font() );
if ( fm.width( dayNumStr ) > width -10 )
dayNumStr = local->formatDate(qd, true);
}
- p.drawText(x+5, y, width-10, mSubHeaderHeight, AlignRight | AlignVCenter,
+ p.drawText(x+5, y, width-10, mSubHeaderHeight, Qt::AlignRight | Qt::AlignVCenter,
dayNumStr);
Event::List eventList;
eventList.fill( mCalendar->events( qd, true ));
Todo::List todos;
todos.fill( mCalendar->todos( qd ));
QString outStr;
p.setFont( QFont( "helvetica", 8 ) );
int lineSpacing = p.fontMetrics().lineSpacing();
int textY=mSubHeaderHeight+3; // gives the relative y-coord of the next printed entry
Event::List::ConstIterator it;
int entryCount = eventList.count() +todos.count();
if ( p.fontMetrics().lineSpacing()* entryCount > height-textY ) {
if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY ) {
p.setFont( QFont( "helvetica", 7 ) );
if ( (p.fontMetrics().lineSpacing()-1) * entryCount > height-textY )
p.setFont( QFont( "helvetica", 6 ) );
}
lineSpacing = p.fontMetrics().lineSpacing()-1;
}
// qDebug("fm %d %d %d ",p.fontMetrics().height(), eventList.count() , height-textY );
for( it = eventList.begin(); it != eventList.end() && textY<height; ++it ) {
Event *currEvent = *it;
if (currEvent->doesFloat() || currEvent->isMultiDay())
outStr = currEvent->summary();
else {
if ( fullDate ) {
outStr = KGlobal::locale()->formatTime( currEvent->dtStart().time())+
"-"+KGlobal::locale()->formatTime( currEvent->dtEnd().time())+
" "+ currEvent->summary();
if ( ! currEvent->location().isEmpty() )
outStr += " (" + currEvent->location()+")";
} else {
QTime t1 = currEvent->dtStart().time();
outStr = local->formatTime(t1);
outStr += " " + currEvent->summary();
}
} // doesFloat
p.drawText(x+5, y+textY, width-10, lineSpacing,
- AlignLeft|AlignBottom, outStr);
+ Qt::AlignLeft|Qt::AlignBottom, outStr);
textY+=lineSpacing;
}
if ( textY<height ) {
Todo::List::ConstIterator it2;
for( it2 = todos.begin(); it2 != todos.end() && textY<height; ++it2 ) {
Todo *todo = *it2;
QString text;
if (todo->hasDueDate()) {
if (!todo->doesFloat()) {
text += KGlobal::locale()->formatTime(todo->dtDue().time());
text += " ";
}
}
text += i18n("To-Do: %1").arg(todo->summary());
p.drawText(x+5, y+textY, width-10, lineSpacing,
- AlignLeft|AlignBottom, text);
+ Qt::AlignLeft|Qt::AlignBottom, text);
textY+=lineSpacing;
}
}
}
///////////////////////////////////////////////////////////////////////////////
void CalPrintBase::drawWeek(QPainter &p, const QDate &qd,
int x, int y, int width, int height)
{
QDate weekDate = qd;
bool portrait = ( mPrinter->orientation() == KPrinter::Portrait );
int cellWidth, cellHeight;
int vcells;
if (portrait) {
cellWidth = width/2;
vcells=3;
} else {
cellWidth = width/6;
vcells=1;
}
cellHeight = height/vcells;
// correct begin of week
int weekdayCol = weekdayColumn( qd.dayOfWeek() );
weekDate = qd.addDays( -weekdayCol );
for (int i = 0; i < 7; i++, weekDate = weekDate.addDays(1)) {
if (i<5) {
drawDayBox(p, weekDate, x+cellWidth*(int)(i/vcells), y+cellHeight*(i%vcells),
cellWidth, cellHeight, true);
@@ -820,233 +822,231 @@ void CalPrintBase::drawTimeTable(QPainter &p,
///////////////////////////////////////////////////////////////////////////////
void CalPrintBase::drawMonth(QPainter &p, const QDate &qd, bool weeknumbers,
int x, int y, int width, int height)
{
int yoffset = mSubHeaderHeight;
int xoffset = 0;
QDate monthDate(QDate(qd.year(), qd.month(), 1));
QDate monthFirst(monthDate);
QDate monthLast(monthDate.addMonths(1).addDays(-1));
int weekdayCol = weekdayColumn( monthDate.dayOfWeek() );
monthDate = monthDate.addDays(-weekdayCol);
int rows=(weekdayCol + qd.daysInMonth() - 1)/7 +1;
int cellHeight = (height-yoffset) / rows;
if (weeknumbers) {
QFont oldFont(p.font());
QFont newFont(p.font());
newFont.setPointSize(7);
p.setFont(newFont);
xoffset += 18;
QDate weekDate(monthDate);
for (int row = 0; row<rows; row++) {
int calWeek = weekDate.weekNumber();
QRect rc(x, y+yoffset+cellHeight*row, xoffset-1, cellHeight);
- p.drawText( rc, AlignRight|AlignVCenter, QString::number(calWeek) );
+ p.drawText( rc, Qt::AlignRight|Qt::AlignVCenter, QString::number(calWeek) );
weekDate = weekDate.addDays(7);
}
p.setFont(oldFont);
}
drawDaysOfWeek( p, monthDate, monthDate.addDays(6), x+xoffset, y, width-xoffset, mSubHeaderHeight );
int cellWidth = (width-xoffset) / 7;
QColor back = p.backgroundColor();
bool darkbg = false;
for (int row = 0; row < rows; row++) {
for (int col = 0; col < 7; col++) {
// show days from previous/next month with a grayed background
if ( (monthDate < monthFirst) || (monthDate > monthLast) ) {
p.setBackgroundColor( QColor( 240, 240, 240) );
darkbg = true;
}
drawDayBox(p, monthDate, x+xoffset+col*cellWidth, y+yoffset+row*cellHeight, cellWidth, cellHeight);
if ( darkbg ) {
p.setBackgroundColor( back );
darkbg = false;
}
monthDate = monthDate.addDays(1);
}
}
}
///////////////////////////////////////////////////////////////////////////////
void CalPrintBase::drawTodo( bool completed, int &count, Todo * item, QPainter &p, bool connectSubTodos,
bool desc, int pospriority, int possummary, int posDueDt, int level,
int x, int &y, int width, int &height, int pageHeight,
TodoParentStart *r )
{
if ( !completed && item->isCompleted() )
return;
QString outStr;
// int fontHeight = 10;
const KLocale *local = KGlobal::locale();
int priority=item->priority();
int posdue=posDueDt;
if (posdue<0) posdue=x+width;
QRect rect;
TodoParentStart startpt;
// This list keeps all starting points of the parent todos so the connection
// lines of the tree can easily be drawn (needed if a new page is started)
- static QPtrList<TodoParentStart> startPoints;
+ static Q3PtrList<TodoParentStart> startPoints;
if (level<1) {
startPoints.clear();
}
// size of item
outStr=item->summary();
if ( ! item->location().isEmpty() )
outStr += " ("+item->location()+")";
if ( item->hasDueDate() && posDueDt>=0 ) {
outStr += " [" +local->formatDate(item->dtDue().date(),true)+"]";
}
int left = possummary+(level*10);
- rect = p.boundingRect(left, y, (posdue-left-5),-1, WordBreak, outStr);
+ rect = p.boundingRect(left, y, (posdue-left-5),-1, Qt::WordBreak, outStr);
//qDebug("bottom1 %d ", rect.bottom() );
if ( !item->description().isEmpty() && desc ) {
outStr = item->description();
rect = p.boundingRect( left+20, rect.bottom()+5, width-(left+10-x), -1,
- WordBreak, outStr );
+ Qt::WordBreak, outStr );
}
//qDebug("bottom2 %d y+h %d y %d ph %d", rect.bottom(), y+height, y , pageHeight );
// if too big make new page
if ( rect.bottom() > y+height) {
// first draw the connection lines from parent todos:
if (level > 0 && connectSubTodos) {
TodoParentStart *rct;
for ( rct = startPoints.first(); rct; rct = startPoints.next() ) {
int start;
int center = rct->mRect.left() + (rct->mRect.width()/2);
int to = p.viewport().bottom();
// draw either from start point of parent or from top of the page
if (rct->mSamePage)
start = rct->mRect.bottom() + 1;
else
start = p.viewport().top();
- p.moveTo( center, start );
- p.lineTo( center, to );
+ p.drawLine( center, start, center, to );
rct->mSamePage=false;
}
}
y=0;
height=pageHeight-y;
mPrinter->newPage();
}
// If this is a sub-item, r will not be 0, and we want the LH side of the priority line up
//to the RH side of the parent item's priority
if (r && pospriority >= 0 ) {
pospriority = r->mRect.right() + 1;
}
// Priority
outStr.setNum(priority);
- rect = p.boundingRect(pospriority, y + 10, 5, -1, AlignCenter, outStr);
+ rect = p.boundingRect(pospriority, y + 10, 5, -1, Qt::AlignCenter, outStr);
// Make it a more reasonable size
rect.setWidth(19);
rect.setHeight(19);
if ( priority > 0 && pospriority>=0 ) {
- p.drawText(rect, AlignCenter, outStr);
+ p.drawText(rect, Qt::AlignCenter, outStr);
p.drawRect(rect);
// cross out the rectangle for completed items
if ( item->isCompleted() ) {
p.drawLine( rect.topLeft(), rect.bottomRight() );
p.drawLine( rect.topRight(), rect.bottomLeft() );
} else if (item->cancelled() ) {
QPen pen = p.pen();
- p.setPen ( QPen ( black, 2) );
+ p.setPen ( QPen ( Qt::black, 2) );
p.drawLine( rect.left()+2,rect.top()+rect.height()/2, rect.right()-2, +rect.top()+rect.height()/2 );
p.setPen( pen );
}
}
startpt.mRect = rect; //save for later
// Connect the dots
if (level > 0 && connectSubTodos) {
int bottom;
int center( r->mRect.left() + (r->mRect.width()/2)+1 );
if (r->mSamePage )
bottom = r->mRect.bottom();//lutz + 1;
else
bottom = 0;
int to( rect.top() + (rect.height()/2)+1 );
int endx( rect.left() );
- p.moveTo(center, bottom);
- p.lineTo(center, to);
- p.lineTo(endx, to);
+ p.drawLine(center,bottom, center,to);
+ p.drawLine(center,to, endx,to);
}
// if completed, use strike out font
// LR does not work - font is underlined, not striked out
//QFont ft=p.font();
//ft.setStrikeOut( item->isCompleted() );
//p.setFont( ft );
// summary
outStr=item->summary();
if ( ! item->location().isEmpty() )
outStr += " ("+item->location()+")";
if ( item->hasDueDate() && posDueDt>=0 ) {
outStr += " [" +item->dtDueStr(true)+"]";
}
rect = p.boundingRect( left, rect.top(), (posdue-(left + rect.width() + 5)),
- -1, WordBreak, outStr);
+ -1, Qt::WordBreak, outStr);
QRect newrect;
- p.drawText( rect, WordBreak, outStr, -1, &newrect );
+ p.drawText( rect, Qt::WordBreak, outStr, -1, &newrect );
//ft.setStrikeOut(false);
// p.setFont(ft);
// due
// if ( item->hasDueDate() && posDueDt>=0 ) {
// outStr = local->formatDate(item->dtDue().date(),true);
// rect = p.boundingRect(posdue, y, x+width, -1, AlignTop|AlignLeft, outStr);
// p.drawText(rect, AlignTop|AlignLeft, outStr);
// }
if ( !item->description().isEmpty() && desc ) {
y=newrect.bottom() + 5;
outStr = item->description();
rect = p.boundingRect( left+20, y, x+width-(left+10), -1,
- WordBreak, outStr );
- p.drawText( rect, WordBreak, outStr, -1, &newrect );
+ Qt::WordBreak, outStr );
+ p.drawText( rect, Qt::WordBreak, outStr, -1, &newrect );
}
// Set the new line position
y=newrect.bottom() + 10; //set the line position
// If the item has subitems, we need to call ourselves recursively
Incidence::List l;l.fill( item->relations());
Incidence::List::ConstIterator it;
startPoints.append( &startpt );
for( it = l.begin(); it != l.end(); ++it ) {
count++;
drawTodo( completed, count, static_cast<Todo *>( *it ), p, connectSubTodos,
desc, pospriority, possummary, posDueDt, level+1,
x, y, width, height, pageHeight, &startpt);
}
startPoints.remove(&startpt);
}
int CalPrintBase::weekdayColumn( int weekday )
{
return ( weekday + 7 - KGlobal::locale()->weekStartDay() ) % 7;
}
void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd,
const QDate &td )
{
QDate curDay, fromDay, toDay, curWeek, fromWeek, toWeek;
mPrinter->setOrientation(KPrinter::Portrait);
int minus = 0;
if (KGlobal::locale()->weekStartsMonday()) {
@@ -1109,198 +1109,198 @@ void CalPrintBase::drawSplitWeek( QPainter &p, const QDate &fd,
drawSplitDay( p, curDay, columnWidth, pageHeight,
int( columnWidth * 0.5 ) );
drawSplitHeaderRight( p, curWeek.addDays( -6 ), curWeek,
curWeek, pageWidth, mHeaderHeight );
break;
case 5:
drawSplitDay( p, curDay, columnWidth, pageHeight,
int( columnWidth * 1.5 ) );
break;
case 6:
drawSplitDay( p, curDay, columnWidth, pageHeight,
int( columnWidth * 2.5 ) );
if ( curDay < toDay )
mPrinter->newPage();
curWeek = curWeek.addDays( 7 );
break;
}
curDay = curDay.addDays(1);
} while (curDay <= toDay);
}
void CalPrintBase::drawSplitHeaderRight( QPainter &p, const QDate &fd,
const QDate &td,
const QDate &,
int width, int )
{
int tempStore = mSubHeaderHeight;
mSubHeaderHeight+= mSubHeaderHeight;
KLocale *local = KGlobal::locale();
QFont font("helvetica", 18, QFont::Bold);
- QPen penA( black,0);
- QPen penB( black,3);
+ QPen penA( Qt::black,0);
+ QPen penB( Qt::black,3);
p.setFont(font);
int lineSpacing = p.fontMetrics().lineSpacing();
QString title;
QString myOwner(mCalendar->getOwner());
if ( fd.month() == td.month() ) {
title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' '
+ '-' + ' ' + QString::number(td.day());
} else {
title = local->monthName(fd.month(), false) + ' ' + QString::number(fd.day()) + ' '
+ '-' + ' ' + local->monthName(td.month(), false) + ' ' + QString::number(td.day());
}
// Grrrrrrr! why can't I set the font to a serif font?!?!?
QFont serifFont("Helvetica", 30);
// serifFont.setFamily("Serif");
// serifFont.setWeight(87);
// serifFont.setItalic(true);
p.setFont(serifFont);
QFontInfo info(p.font());
lineSpacing = p.fontMetrics().lineSpacing();
- p.drawText(0, lineSpacing * 0, width, lineSpacing, AlignRight |AlignTop, title );
+ p.drawText(0, lineSpacing * 0, width, lineSpacing, Qt::AlignRight |Qt::AlignTop, title );
title.truncate(0);
p.setPen(penB );
p.drawLine(200, lineSpacing * 1, width, lineSpacing * 1);
p.setPen(penA );
p.setFont(QFont("Helvetica", 20, QFont::Bold, TRUE));
title += QString::number(fd.year());
- p.drawText(0, lineSpacing * 1, width, lineSpacing, AlignRight |AlignTop, title );
+ p.drawText(0, lineSpacing * 1, width, lineSpacing, Qt::AlignRight |Qt::AlignTop, title );
mSubHeaderHeight = tempStore ;
}
void CalPrintBase::drawSplitDay( QPainter &p, const QDate &qd, int width,
int height, int offsetLeft )
{
int tempStore = mSubHeaderHeight;
mSubHeaderHeight+= mSubHeaderHeight;
int startHour = KOPrefs::instance()->mDayBegins;
int endHour = 20;
int offset = mHeaderHeight + mSubHeaderHeight + 10;
Event::List eventList; eventList.fill( mCalendar->events( qd, true ));
Event::List::Iterator it;
Event *currEvent;
KLocale *local = KGlobal::locale();
QString dayName;
dayName = local->weekDayName(qd.dayOfWeek()) + ' ' + ' ' + QString::number(qd.day());
//p.setBrush(QBrush(black));
// width+1 to make sure there's a continuous, black bar across the top.
p.setPen( QPen(Qt::black,2));
p.drawRect(offsetLeft, mHeaderHeight + 5, width +1, mSubHeaderHeight);
p.setPen( Qt::black);
p.setFont(QFont("helvetica", 12, QFont::Bold, true));
p.drawText(offsetLeft, mHeaderHeight + 5,
- width, mSubHeaderHeight, AlignHCenter | AlignVCenter,
+ width, mSubHeaderHeight, Qt::AlignHCenter | Qt::AlignVCenter,
dayName);
p.setPen( QPen(Qt::black,2));
p.setFont(QFont("helvetica", 12));
p.setBrush(Qt::white);
it = eventList.begin();
int allDays = 0;
/*
while( it != eventList.end() ) {
Event *currEvent = *it;
if ( currEvent->doesFloat() ) {
p.drawRect( offsetLeft, offset, width, 35 );
p.drawText( offsetLeft + 5, offset + 10, width - 10, 30,
AlignLeft | AlignTop, currEvent->summary() );
offset += 40;
allDays++;
it = eventList.remove( it );
} else {
++it;
}
}
*/
//p.setBrush(QBrush());
int tmpEnd;
for ( it = eventList.begin(); it != eventList.end(); ++it ) {
Event *currEvent = *it;
tmpEnd = currEvent->dtEnd().time().hour();
if (currEvent->dtEnd().time().minute() > 0)
tmpEnd++;
if (tmpEnd > endHour)
endHour = tmpEnd;
}
int hours = endHour - startHour;
int cellHeight = (height-offset) / hours; // hour increments.
p.setFont(QFont("helvetica", 12));
//p.setBrush(QBrush(Dense7Pattern));
p.setBrush(Qt::white);
for ( it = eventList.begin(); it != eventList.end(); ++it ) {
Event *currEvent = *it;
int startTime = currEvent->dtStart().time().hour();
int endTime = currEvent->dtEnd().time().hour();
float minuteInc = cellHeight / 60.0;
if ((startTime >= startHour) && (endTime <= (startHour + hours))) {
startTime -= startHour;
int startMinuteOff = (int) (minuteInc *
currEvent->dtStart().time().minute());
QString text = currEvent->summary() ;
if ( ! currEvent->location().isEmpty() )
text += "\n("+currEvent->location()+")";
int endMinuteOff = (int) (minuteInc * currEvent->dtEnd().time().minute());
int cheight = (int) (minuteInc *
currEvent->dtStart().secsTo(currEvent->dtEnd()) / 60 );
p.drawRect(offsetLeft+2, 1+offset+startMinuteOff+startTime*cellHeight,
width-4, cheight);
p.drawText(offsetLeft+12, offset+startMinuteOff+startTime*cellHeight+5, width-24,
- cheight-10, AlignHCenter | AlignTop, text);
+ cheight-10, Qt::AlignHCenter | Qt::AlignTop, text);
}
}
- p.setBrush(QBrush(NoBrush));
+ p.setBrush(QBrush(Qt::NoBrush));
mSubHeaderHeight = tempStore ;
}
void CalPrintBase::drawSplitTimes( QPainter &p, int width, int timeWidth,
int height )
{
int tempStore = mSubHeaderHeight;
mSubHeaderHeight+= mSubHeaderHeight;
int startHour = KOPrefs::instance()->mDayBegins;
int endHour = 20;
int offset = mHeaderHeight + mSubHeaderHeight + 10;
int hours = endHour - startHour;
int cellHeight = (height-offset) / hours; // hour increments.
QString numStr;
for (int i = 0; i < hours; i++) {
- p.setPen(QPen(black,1));
+ p.setPen(QPen(Qt::black,1));
p.drawLine(0, offset+i*cellHeight, width, offset+i*cellHeight);
- p.setPen(QPen(gray,0));
+ p.setPen(QPen(Qt::gray,0));
p.drawLine(37, offset+i*cellHeight+(cellHeight/2),
width, offset+i*cellHeight+(cellHeight/2));
- p.setPen(QPen(black,0));
+ p.setPen(QPen(Qt::black,0));
if ( !KGlobal::locale()->use12Clock() ) {
numStr.setNum(i+startHour);
if (cellHeight > 40) {
p.setFont(QFont("helvetica", 16, QFont::Bold));
} else {
p.setFont(QFont("helvetica", 14, QFont::Bold));
}
p.drawText(0, offset+i*cellHeight, 33, cellHeight/2,
- AlignTop|AlignRight, numStr);
+ Qt::AlignTop|Qt::AlignRight, numStr);
p.setFont(QFont("helvetica", 12, QFont::Bold));
p.drawText(37, offset+i*cellHeight, 45, cellHeight/2,
- AlignTop | AlignLeft, "00");
+ Qt::AlignTop | Qt::AlignLeft, "00");
} else {
QTime time( i + startHour, 0 );
numStr = KGlobal::locale()->formatTime( time );
p.setFont(QFont("helvetica", 12, QFont::Bold));
p.drawText(4, offset+i*cellHeight, 70, cellHeight/2,
- AlignTop|AlignLeft, numStr);
+ Qt::AlignTop|Qt::AlignLeft, numStr);
}
} mSubHeaderHeight = tempStore ;
}
#endif
diff --git a/korganizer/calprinter.cpp b/korganizer/calprinter.cpp
index 0cdf28e..d4bf988 100644
--- a/korganizer/calprinter.cpp
+++ b/korganizer/calprinter.cpp
@@ -1,64 +1,67 @@
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qvbuttongroup.h>
-#include <qwidgetstack.h>
+// #include <qvbuttongroup.h>
+#include <q3widgetstack.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlabel.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qsplitter.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3PtrList>
#include <kprinter.h>
#include <kglobal.h>
#include <ksimpleconfig.h>
#include <kmessagebox.h>
#include <kdebug.h>
//#include <kdeversion.h>
#include "koprefsdialog.h"
#include "calprinter.h"
#ifndef KORG_NOPRINTER
//#include "calprinter.moc"
#include "calprintplugins.h"
CalPrinter::CalPrinter( QWidget *parent, Calendar *calendar )
: QObject( parent, "CalPrinter" )
{
mCalendar = calendar;
mParent = parent;
mPrinter = new KPrinter;
mPrinter->setOrientation( KPrinter::Portrait );
mConfig = new KConfig(locateLocal("config","korganizer_printing.rc" ));
//KSimpleConfig( "korganizer_printing.rc" );
init( mPrinter, calendar );
}
CalPrinter::~CalPrinter()
{
kdDebug() << "~CalPrinter()" << endl;
@@ -145,95 +148,95 @@ void CalPrinter::doPrint( CalPrintBase *selectedStyle, bool preview )
{
// FIXME: add a better caption to the Printingdialog
//mPrinter->setPreviewOnly( preview );
if ( preview || mPrinter->setup( mParent ) ) {
switch ( mPrintDialog->orientation() ) {
case eOrientPlugin:
mPrinter->setOrientation( selectedStyle->orientation());
break;
case eOrientPortrait:
mPrinter->setOrientation( KPrinter::Portrait );
break;
case eOrientLandscape:
mPrinter->setOrientation( KPrinter::Landscape );
break;
case eOrientPrinter:
default:
break;
}
selectedStyle->doPrint();
}
//mPrinter->setPreviewOnly( false );
}
///////////////////////////////////////////////////////////////////////////////
void CalPrinter::updateConfig()
{
}
/****************************************************************************/
-CalPrintDialog::CalPrintDialog( QPtrList<CalPrintBase> plugins, KPrinter *p,
+CalPrintDialog::CalPrintDialog( Q3PtrList<CalPrintBase> plugins, KPrinter *p,
QWidget *parent, const char *name )
: KDialogBase( parent, name, /*modal*/true, i18n("Print"), Ok | Cancel ),
mPrinter( p ), mPrintPlugins( plugins )
{
- QVBox *page = new QVBox(this);//makeVBoxMainWidget();
+ Q3VBox *page = new Q3VBox(this);//makeVBoxMainWidget();
setMainWidget( page );
- QHBox *printerLayout = new QHBox( page );
+ Q3HBox *printerLayout = new Q3HBox( page );
mPrinterLabel = new QLabel( printerLayout );
QPushButton *setupButton = new QPushButton( i18n("&Setup Printer..."),
printerLayout );
setupButton->setSizePolicy( QSizePolicy(
(QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0,
0, 0, setupButton->sizePolicy().hasHeightForWidth() ) );
QSplitter *splitter = new QSplitter( page );
- splitter->setOrientation( QSplitter::Horizontal );
+ splitter->setOrientation( Qt::Horizontal );
- mTypeGroup = new QVButtonGroup( i18n("View Type"), splitter, "buttonGroup" );
+ mTypeGroup = new Q3VButtonGroup( i18n("View Type"), splitter, "buttonGroup" );
// use the minimal width possible = max width of the radio buttons, not extensible
/* mTypeGroup->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4,
(QSizePolicy::SizeType)5, 0, 0,
mTypeGroup->sizePolicy().hasHeightForWidth() ) );*/
QWidget *splitterRight = new QWidget( splitter, "splitterRight" );
- QGridLayout *splitterRightLayout = new QGridLayout( splitterRight );
+ Q3GridLayout *splitterRightLayout = new Q3GridLayout( splitterRight );
splitterRightLayout->setMargin( marginHint() );
splitterRightLayout->setSpacing( spacingHint() );
- mConfigArea = new QWidgetStack( splitterRight, "configWidgetStack" );
+ mConfigArea = new Q3WidgetStack( splitterRight, "configWidgetStack" );
splitterRightLayout->addMultiCellWidget( mConfigArea, 0,0, 0,1 );
QLabel *orientationLabel = new QLabel( i18n("Page &orientation:"),
splitterRight, "orientationLabel" );
splitterRightLayout->addWidget( orientationLabel, 1, 0 );
mOrientationSelection = new QComboBox( splitterRight, "orientationCombo" );
mOrientationSelection->insertItem( i18n("Use Default of Selected Style") );
mOrientationSelection->insertItem( i18n("Use Default Setting of Printer") );
mOrientationSelection->insertItem( i18n("Portrait") );
mOrientationSelection->insertItem( i18n("Landscape") );
splitterRightLayout->addWidget( mOrientationSelection, 1, 1 );
// signals and slots connections
connect( setupButton, SIGNAL( clicked() ), SLOT( setupPrinter() ) );
connect( mTypeGroup, SIGNAL( clicked( int ) ), SLOT( setPrintType( int ) ) );
// buddies
orientationLabel->setBuddy( mOrientationSelection );
CalPrintBase *plug = mPrintPlugins.first();
QRadioButton *radioButton;
int id = 0;
while ( plug ) {
radioButton = new QRadioButton( plug->description(), mTypeGroup );
mTypeGroup->insert( radioButton, id );
//radioButton->setMinimumHeight( radioButton->sizeHint().height() - 5 );
mConfigArea->addWidget( plug->configWidget( mConfigArea ), id );
plug = mPrintPlugins.next();
id++;
diff --git a/korganizer/calprinter.h b/korganizer/calprinter.h
index 7b58f4f..e065779 100644
--- a/korganizer/calprinter.h
+++ b/korganizer/calprinter.h
@@ -1,142 +1,144 @@
+//Added by qt3to4:
+#include <QLabel>
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _CALPRINTER_H
#define _CALPRINTER_H
// #define KORG_NOPRINTER
#ifndef KORG_NOPRINTER
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdialogbase.h>
#include <korganizer/baseview.h>
#include "calprintbase.h"
using namespace KCal;
-class QVButtonGroup;
-class QWidgetStack;
+class Q3VButtonGroup;
+class Q3WidgetStack;
class KPrinter;
class CalPrintDialog;
class KConfig;
class QComboBox;
class QLabel;
/**
CalPrinter is a class for printing Calendars. It can print in several
different formats (day, week, month). It also provides a way for setting
up the printer and remembering these preferences.
*/
class CalPrinter : public QObject, public KOrg::CalPrinterBase
{
Q_OBJECT
public:
enum ePrintOrientation {
eOrientPlugin=0,
eOrientPrinter,
eOrientPortrait,
eOrientLandscape
};
public:
/**
\param par parent widget for dialogs
\param cal calendar to be printed
*/
CalPrinter( QWidget *par, Calendar *cal );
virtual ~CalPrinter();
void init( KPrinter *printer, Calendar *calendar );
void setupPrinter();
/**
Set date range to be printed.
\param start Start date
\param end End date
*/
void setDateRange( const QDate &start, const QDate &end );
public slots:
void updateConfig();
private slots:
void doPrint( CalPrintBase *selectedStyle, bool preview );
public:
void preview( PrintType type, const QDate &fd, const QDate &td );
void print( PrintType type, const QDate &fd, const QDate &td );
protected:
- QPtrList<CalPrintBase> mPrintPlugins;
+ Q3PtrList<CalPrintBase> mPrintPlugins;
private:
KPrinter *mPrinter;
Calendar *mCalendar;
QWidget *mParent;
KConfig *mConfig;
CalPrintDialog *mPrintDialog;
};
class CalPrintDialog : public KDialogBase
{
Q_OBJECT
public:
- CalPrintDialog( QPtrList<CalPrintBase> plugins, KPrinter *p,
+ CalPrintDialog( Q3PtrList<CalPrintBase> plugins, KPrinter *p,
QWidget *parent = 0, const char *name = 0 );
virtual ~CalPrintDialog();
CalPrintBase *selectedPlugin();
CalPrinter::ePrintOrientation orientation() { return mOrientation; }
public slots:
void setPrintType( int );
void setPreview( bool );
protected slots:
void slotOk();
void setupPrinter();
void setPrinterLabel();
signals:
void okClicked();
private:
KPrinter *mPrinter;
- QVButtonGroup *mTypeGroup;
- QWidgetStack *mConfigArea;
- QPtrList<CalPrintBase> mPrintPlugins;
+ Q3VButtonGroup *mTypeGroup;
+ Q3WidgetStack *mConfigArea;
+ Q3PtrList<CalPrintBase> mPrintPlugins;
QLabel *mPrinterLabel;
QString mPreviewText;
QComboBox *mOrientationSelection;
CalPrinter::ePrintOrientation mOrientation;
};
#endif
#endif
diff --git a/korganizer/calprintplugins.cpp b/korganizer/calprintplugins.cpp
index bc35ca4..9b6dc6e 100644
--- a/korganizer/calprintplugins.cpp
+++ b/korganizer/calprintplugins.cpp
@@ -1,64 +1,64 @@
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
Copyright (c) 2003 Reinhold Kainhofer <reinhold@kainhofer.com>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qpainter.h>
-#include <qdatetimeedit.h>
+#include <q3datetimeedit.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qlineedit.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kprinter.h>
#include <kconfig.h>
#include <kcalendarsystem.h>
#include <libkcal/todo.h>
#include <libkcal/calendar.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "koglobals.h"
#include "calprintplugins.h"
#ifndef KORG_NOPRINTER
//#include "calprintplugins.moc"
#define LEFT_DISTANCE 45
/**************************************************************
* Print Day
**************************************************************/
CalPrintDay::CalPrintDay( KPrinter *printer, Calendar *cal, KConfig *cfg )
: CalPrintBase( printer, cal, cfg )
{
}
CalPrintDay::~CalPrintDay()
diff --git a/korganizer/cellitem.cpp b/korganizer/cellitem.cpp
index 61d06ac..1fd703c 100644
--- a/korganizer/cellitem.cpp
+++ b/korganizer/cellitem.cpp
@@ -1,98 +1,100 @@
/*
This file is part of KOrganizer.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include "cellitem.h"
#include <klocale.h>
#include <kdebug.h>
-#include <qintdict.h>
+#include <q3intdict.h>
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KOrg;
QString CellItem::label() const
{
return i18n("<undefined>");
}
-QPtrList<CellItem> CellItem::placeItem( QPtrList<CellItem> cells,
+Q3PtrList<CellItem> CellItem::placeItem( Q3PtrList<CellItem> cells,
CellItem *placeItem )
{
kdDebug(5855) << "Placing " << placeItem->label() << endl;
- QPtrList<KOrg::CellItem> conflictItems;
+ Q3PtrList<KOrg::CellItem> conflictItems;
int maxSubCells = 0;
- QIntDict<KOrg::CellItem> subCellDict;
+ Q3IntDict<KOrg::CellItem> subCellDict;
// Find all items which are in same cell
- QPtrListIterator<KOrg::CellItem> it2( cells );
+ Q3PtrListIterator<KOrg::CellItem> it2( cells );
for( it2.toFirst(); it2.current(); ++it2 ) {
KOrg::CellItem *item = it2.current();
if ( item == placeItem ) continue;
if ( item->overlaps( placeItem ) ) {
kdDebug(5855) << " Overlaps: " << item->label() << endl;
conflictItems.append( item );
if ( item->subCells() > maxSubCells ) maxSubCells = item->subCells();
subCellDict.insert( item->subCell(), item );
}
}
if ( conflictItems.count() > 0 ) {
// Look for unused sub cell and insert item
int i;
for( i = 0; i < maxSubCells; ++i ) {
kdDebug(5855) << " Trying subcell " << i << endl;
if ( !subCellDict.find( i ) ) {
kdDebug(5855) << " Use subcell " << i << endl;
placeItem->setSubCell( i );
break;
}
}
if ( i == maxSubCells ) {
kdDebug(5855) << " New subcell " << i << endl;
placeItem->setSubCell( maxSubCells );
maxSubCells++; // add new item to number of sub cells
}
kdDebug(5855) << " Sub cells: " << maxSubCells << endl;
// Write results to item to be placed
conflictItems.append( placeItem );
placeItem->setSubCells( maxSubCells );
- QPtrListIterator<KOrg::CellItem> it3( conflictItems );
+ Q3PtrListIterator<KOrg::CellItem> it3( conflictItems );
for( it3.toFirst(); it3.current(); ++it3 ) {
(*it3)->setSubCells( maxSubCells );
}
// Todo: Adapt subCells of items conflicting with conflicting items
} else {
kdDebug(5855) << " no conflicts" << endl;
placeItem->setSubCell( 0 );
placeItem->setSubCells( 1 );
}
return conflictItems;
}
diff --git a/korganizer/cellitem.h b/korganizer/cellitem.h
index 72773d0..b917bd5 100644
--- a/korganizer/cellitem.h
+++ b/korganizer/cellitem.h
@@ -1,66 +1,66 @@
/*
This file is part of KOrganizer.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KORG_CELLITEM_H
#define KORG_CELLITEM_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
namespace KOrg {
class CellItem
{
public:
CellItem()
: mSubCells( 0 ), mSubCell( -1 )
{
}
void setSubCells( int v ) { mSubCells = v; }
int subCells() const { return mSubCells; }
void setSubCell( int v ) { mSubCell = v; }
int subCell() const { return mSubCell; }
virtual bool overlaps( CellItem *other ) const = 0;
virtual QString label() const;
/**
Place item \arg placeItem into stripe containing items \arg cells in a
way that items don't overlap.
\return Placed items
*/
- static QPtrList<CellItem> placeItem( QPtrList<CellItem> cells,
+ static Q3PtrList<CellItem> placeItem( Q3PtrList<CellItem> cells,
CellItem *placeItem );
private:
int mSubCells;
int mSubCell;
};
}
#endif
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index ea510f1..53507d3 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -5,64 +5,66 @@
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <kdebug.h>
#include <klocale.h>
//#include "koglobals.h"
#include "navigatorbar.h"
#include "kdatenavigator.h"
#include <kcalendarsystem.h>
#include "datenavigatorcontainer.h"
#include "koprefs.h"
+//Added by qt3to4:
+#include <QResizeEvent>
DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
const char *name )
: QWidget( parent, name ), mCalendar( 0 ),
mHorizontalCount( 1 ), mVerticalCount( 1 )
{
mResizeEnabled = false;
mExtraViews.setAutoDelete( true );
mNavigatorView = new KDateNavigator( this, name );
mNavigatorView->hide();
connectNavigatorView( mNavigatorView );
//setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
mLastDisplayedDN = 0;
mUpdateTimer = new QTimer( this );
connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
mFirstSelectedDate = QDate::currentDate();
mSelectedDateCount = 1;
}
DateNavigatorContainer::~DateNavigatorContainer()
{
}
void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
{
connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
SIGNAL( datesSelected( const KCal::DateList & ) ) );
#if 0
connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
index 87cc59f..75d387c 100644
--- a/korganizer/datenavigatorcontainer.h
+++ b/korganizer/datenavigatorcontainer.h
@@ -1,32 +1,35 @@
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <Q3PtrList>
/*
This file is part of KOrganizer.
Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef DATENAVIGATORCONTAINER_H
#define DATENAVIGATORCONTAINER_H
class KDateNavigator;
#include <qwidget.h>
#include <qtimer.h>
#include <libkcal/calendar.h>
@@ -71,39 +74,39 @@ class DateNavigatorContainer: public QWidget
void incidenceDroppedMove( Incidence *, const QDate & );
void weekClicked( const QDate &);
void goPrevious();
void goNext();
void goNextMonth();
void goPrevMonth();
void goNextYear();
void goPrevYear();
void showMonth( const QDate & );
void monthSelected( int month );
protected:
void computeMonthSelected( int month , bool forceEmit );
void jumpMonth( int month );
void resizeEvent( QResizeEvent * );
void setBaseDates();
void connectNavigatorView( KDateNavigator *v );
private:
bool mResizeEnabled;
QTimer* mUpdateTimer;
int mLastDisplayedDN;
QDate mFirstSelectedDate;
int mSelectedDateCount;
KDateNavigator *mNavigatorView;
KCal::Calendar *mCalendar;
- QPtrList<KDateNavigator> mExtraViews;
+ Q3PtrList<KDateNavigator> mExtraViews;
int mHorizontalCount;
int mVerticalCount;
};
#endif
diff --git a/korganizer/filteredit_base.cpp b/korganizer/filteredit_base.cpp
index 505edf6..9425963 100644
--- a/korganizer/filteredit_base.cpp
+++ b/korganizer/filteredit_base.cpp
@@ -1,144 +1,148 @@
/****************************************************************************
** Form implementation generated from reading ui file 'filteredit_base.ui'
**
** Created: Fr Jan 21 21:25:30 2005
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "filteredit_base.h"
#include <qvariant.h>
#include <qpushbutton.h>
-#include <qframe.h>
-#include <qbuttongroup.h>
+#include <q3frame.h>
+#include <q3buttongroup.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qradiobutton.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include "tr.h"
/*
* Constructs a FilterEdit_base as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*/
-FilterEdit_base::FilterEdit_base( QWidget* parent, const char* name, WFlags fl )
+FilterEdit_base::FilterEdit_base( QWidget* parent, const char* name, Qt::WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "FilterEdit_base" );
- FilterEdit_baseLayout = new QVBoxLayout( this, 0, 0, "FilterEdit_baseLayout");
+ FilterEdit_baseLayout = new Q3VBoxLayout( this, 0, 0, "FilterEdit_baseLayout");
- mCriteriaFrame = new QFrame( this, "mCriteriaFrame" );
- mCriteriaFrame->setFrameShape( QFrame::StyledPanel );
- mCriteriaFrame->setFrameShadow( QFrame::Raised );
- mCriteriaFrameLayout = new QVBoxLayout( mCriteriaFrame, 3, 2, "mCriteriaFrameLayout");
+ mCriteriaFrame = new Q3Frame( this, "mCriteriaFrame" );
+ mCriteriaFrame->setFrameShape( Q3Frame::StyledPanel );
+ mCriteriaFrame->setFrameShadow( Q3Frame::Raised );
+ mCriteriaFrameLayout = new Q3VBoxLayout( mCriteriaFrame, 3, 2, "mCriteriaFrameLayout");
- ButtonGroup1 = new QButtonGroup( mCriteriaFrame, "ButtonGroup1" );
+ ButtonGroup1 = new Q3ButtonGroup( mCriteriaFrame, "ButtonGroup1" );
ButtonGroup1->setColumnLayout(0, Qt::Vertical );
ButtonGroup1->layout()->setSpacing( 6 );
ButtonGroup1->layout()->setMargin( 6 );
- ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() );
+ ButtonGroup1Layout = new Q3GridLayout( ButtonGroup1->layout() );
ButtonGroup1Layout->setAlignment( Qt::AlignTop );
- layout4 = new QHBoxLayout( 0, 0, 6, "layout4");
+ layout4 = new Q3HBoxLayout( 0, 0, 6, "layout4");
mCatShowCheck = new QRadioButton( ButtonGroup1, "mCatShowCheck" );
layout4->addWidget( mCatShowCheck );
mCatHideCheck = new QRadioButton( ButtonGroup1, "mCatHideCheck" );
layout4->addWidget( mCatHideCheck );
mCatEditButton = new QPushButton( ButtonGroup1, "mCatEditButton" );
layout4->addWidget( mCatEditButton );
ButtonGroup1Layout->addLayout( layout4, 0, 0 );
- mCatList = new QListBox( ButtonGroup1, "mCatList" );
+ mCatList = new Q3ListBox( ButtonGroup1, "mCatList" );
ButtonGroup1Layout->addWidget( mCatList, 1, 0 );
mCriteriaFrameLayout->addWidget( ButtonGroup1 );
- layout7 = new QHBoxLayout( 0, 0, 6, "layout7");
+ layout7 = new Q3HBoxLayout( 0, 0, 6, "layout7");
textLabel1 = new QLabel( mCriteriaFrame, "textLabel1" );
layout7->addWidget( textLabel1 );
mRecurringCheck = new QCheckBox( mCriteriaFrame, "mRecurringCheck" );
layout7->addWidget( mRecurringCheck );
mCompletedCheck = new QCheckBox( mCriteriaFrame, "mCompletedCheck" );
layout7->addWidget( mCompletedCheck );
mCriteriaFrameLayout->addLayout( layout7 );
- layout9 = new QHBoxLayout( 0, 0, 6, "layout9");
+ layout9 = new Q3HBoxLayout( 0, 0, 6, "layout9");
textLabel1_2 = new QLabel( mCriteriaFrame, "textLabel1_2" );
layout9->addWidget( textLabel1_2 );
mEventCheck = new QCheckBox( mCriteriaFrame, "mEventCheck" );
layout9->addWidget( mEventCheck );
mTodoCheck = new QCheckBox( mCriteriaFrame, "mTodoCheck" );
layout9->addWidget( mTodoCheck );
mJournalCheck = new QCheckBox( mCriteriaFrame, "mJournalCheck" );
layout9->addWidget( mJournalCheck );
mCriteriaFrameLayout->addLayout( layout9 );
- layout2 = new QHBoxLayout( 0, 0, 0, "layout2");
+ layout2 = new Q3HBoxLayout( 0, 0, 0, "layout2");
textLabel2 = new QLabel( mCriteriaFrame, "textLabel2" );
layout2->addWidget( textLabel2 );
mPublicCheck = new QCheckBox( mCriteriaFrame, "mPublicCheck" );
layout2->addWidget( mPublicCheck );
mPrivateCheck = new QCheckBox( mCriteriaFrame, "mPrivateCheck" );
layout2->addWidget( mPrivateCheck );
mConfidentialCheck = new QCheckBox( mCriteriaFrame, "mConfidentialCheck" );
mConfidentialCheck->setChecked( FALSE );
layout2->addWidget( mConfidentialCheck );
mCriteriaFrameLayout->addLayout( layout2 );
FilterEdit_baseLayout->addWidget( mCriteriaFrame );
languageChange();
resize( QSize(300, 200).expandedTo(minimumSizeHint()) );
- clearWState( WState_Polished );
}
/*
* Destroys the object and frees any allocated resources
*/
FilterEdit_base::~FilterEdit_base()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void FilterEdit_base::languageChange()
{
setCaption( tr( "FilterEditor" ) );
ButtonGroup1->setTitle( tr( "Categories" ) );
mCatShowCheck->setText( tr( "Include" ) );
mCatHideCheck->setText( tr( "Exclude" ) );
mCatEditButton->setText( tr( "Edit Selection..." ) );
textLabel1->setText( tr( "Exclude" ) );
if (QApplication::desktop()->width() > 480 ) {
mCompletedCheck->setText( tr( "completed to-dos" ) );
mRecurringCheck->setText( tr( "recurring events" ) );
}
else {
mCompletedCheck->setText( tr( "compl.todos" ) );
mRecurringCheck->setText( tr( "recurr. events" ) );
}
textLabel1_2->setText( tr( "Exclude" ) );
mEventCheck->setText( tr( "events" ) );
diff --git a/korganizer/filteredit_base.h b/korganizer/filteredit_base.h
index 13a02c3..135f6fa 100644
--- a/korganizer/filteredit_base.h
+++ b/korganizer/filteredit_base.h
@@ -1,69 +1,75 @@
/****************************************************************************
** Form interface generated from reading ui file 'filteredit_base.ui'
**
** Created: Fr Jan 21 21:25:30 2005
** by: The User Interface Compiler ($Id$)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef FILTEREDIT_BASE_H
#define FILTEREDIT_BASE_H
#include <qvariant.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <QLabel>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
class QSpacerItem;
-class QFrame;
-class QButtonGroup;
+class Q3Frame;
+class Q3ButtonGroup;
class QRadioButton;
class QPushButton;
-class QListBox;
-class QListBoxItem;
+class Q3ListBox;
+class Q3ListBoxItem;
class QLabel;
class QCheckBox;
class FilterEdit_base : public QWidget
{
Q_OBJECT
public:
- FilterEdit_base( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ FilterEdit_base( QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0 );
~FilterEdit_base();
- QFrame* mCriteriaFrame;
- QButtonGroup* ButtonGroup1;
+ Q3Frame* mCriteriaFrame;
+ Q3ButtonGroup* ButtonGroup1;
QRadioButton* mCatShowCheck;
QRadioButton* mCatHideCheck;
QPushButton* mCatEditButton;
- QListBox* mCatList;
+ Q3ListBox* mCatList;
QLabel* textLabel1;
QCheckBox* mRecurringCheck;
QCheckBox* mCompletedCheck;
QLabel* textLabel1_2;
QCheckBox* mEventCheck;
QCheckBox* mTodoCheck;
QCheckBox* mJournalCheck;
QLabel* textLabel2;
QCheckBox* mPublicCheck;
QCheckBox* mPrivateCheck;
QCheckBox* mConfidentialCheck;
protected:
- QVBoxLayout* FilterEdit_baseLayout;
- QVBoxLayout* mCriteriaFrameLayout;
- QGridLayout* ButtonGroup1Layout;
- QHBoxLayout* layout4;
- QHBoxLayout* layout7;
- QHBoxLayout* layout9;
- QHBoxLayout* layout2;
+ Q3VBoxLayout* FilterEdit_baseLayout;
+ Q3VBoxLayout* mCriteriaFrameLayout;
+ Q3GridLayout* ButtonGroup1Layout;
+ Q3HBoxLayout* layout4;
+ Q3HBoxLayout* layout7;
+ Q3HBoxLayout* layout9;
+ Q3HBoxLayout* layout2;
protected slots:
virtual void languageChange();
};
#endif // FILTEREDIT_BASE_H
diff --git a/korganizer/filtereditdialog.cpp b/korganizer/filtereditdialog.cpp
index df84911..a3cff49 100644
--- a/korganizer/filtereditdialog.cpp
+++ b/korganizer/filtereditdialog.cpp
@@ -1,115 +1,120 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3PtrList>
+
+#include <QDesktopWidget>
#include <kdebug.h>
#include <klocale.h>
#include <klineeditdlg.h>
#include <kmessagebox.h>
#include <libkdepim/categoryselectdialog.h>
#include "koprefs.h"
#include "filteredit_base.h"
#include "filtereditdialog.h"
//#include "filtereditdialog.moc"
// TODO: Make dialog work on a copy of the filters objects.
class ComboFilterBox: public QComboBox
{
public:
ComboFilterBox( QWidget *parent=0, const char *name=0) :
QComboBox( parent,name ) { }
void popupBox() { popup(); }
};
-FilterEditDialog::FilterEditDialog(QPtrList<CalFilter> *filters,QWidget *parent,
+FilterEditDialog::FilterEditDialog(Q3PtrList<CalFilter> *filters,QWidget *parent,
const char *name) :
KDialogBase(parent,name,true,i18n("Edit Calendar Filters"),
Ok|Apply|Cancel)
{
mFilters = filters;
QWidget *mainWidget = new QWidget(this);
setMainWidget(mainWidget);
mSelectionCombo = new ComboFilterBox(mainWidget);
connect(mSelectionCombo,SIGNAL(activated(int)),SLOT(filterSelected()));
// mSelectionCombo->setEditable ( true );
QPushButton *addButton = new QPushButton(i18n("Add Filter"),mainWidget);
connect(addButton,SIGNAL(clicked()),SLOT(slotAdd()));
addButton->setMaximumSize( addButton->sizeHint());
mRemoveButton = new QPushButton( i18n("Remove"), mainWidget );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT( slotRemove() ) );
mRemoveButton->setMaximumSize( mRemoveButton->sizeHint());
QPushButton *upButton = new QPushButton(i18n("Up"),mainWidget);
upButton->setMaximumSize( upButton->sizeHint());
connect(upButton,SIGNAL(clicked()),SLOT(slotUp()));
mEditor = new FilterEdit_base(mainWidget);
- QGridLayout *topLayout = new QGridLayout(mainWidget,2,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(mainWidget,2,2);
topLayout->setSpacing(spacingHint());
topLayout->addWidget(mSelectionCombo,0,0);
topLayout->addWidget(upButton,0,1);
topLayout->addWidget(addButton,0,2);
topLayout->addWidget(mRemoveButton,0,3);
topLayout->addMultiCellWidget(mEditor,1,1,0,3);
mSelectionCombo->setMaximumWidth ( QApplication::desktop()->width() -
addButton->maximumWidth() -
mRemoveButton->maximumWidth() -
upButton->maximumWidth() -
spacingHint() * 5 );
connect(mEditor->mCatEditButton,SIGNAL(clicked()),
SLOT(editCategorySelection()));
// Clicking cancel exits the dialog without saving
connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
updateFilterList();
}
FilterEditDialog::~FilterEditDialog()
{
}
void FilterEditDialog::slotUp()
{
if ( mFilters->count() <= 1 ) return;
if ( mSelectionCombo->currentItem() == 0 ) return;
int num = mSelectionCombo->currentItem();
CalFilter* f = new CalFilter( );
*f = *(mFilters->at( num ));
mFilters->remove( num );
mFilters->insert( num-1, f );
diff --git a/korganizer/filtereditdialog.h b/korganizer/filtereditdialog.h
index 42aa3da..c1a52ed 100644
--- a/korganizer/filtereditdialog.h
+++ b/korganizer/filtereditdialog.h
@@ -1,86 +1,86 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _FILTEREDITDIALOG_H
#define _FILTEREDITDIALOG_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdialogbase.h>
#include <libkcal/calfilter.h>
class QComboBox;
class ComboFilterBox;
class QPushButton;
class FilterEdit_base;
using namespace KCal;
/**
This is the class to add/edit a calendar filter.
@short Creates a dialog box to create/edit a calendar filter
@author Cornelius Schumacher
*/
class FilterEditDialog : public KDialogBase
{
Q_OBJECT
public:
- FilterEditDialog(QPtrList<CalFilter> *,QWidget *parent=0, const char *name=0);
+ FilterEditDialog(Q3PtrList<CalFilter> *,QWidget *parent=0, const char *name=0);
virtual ~FilterEditDialog();
public slots:
void updateFilterList();
signals:
void filterChanged();
protected slots:
void slotDefault();
void slotApply();
void slotOk();
void accept();
void slotAdd();
void slotUp();
void slotRemove();
void filterSelected();
void editCategorySelection();
void updateCategorySelection(const QStringList &categories);
protected:
void readFilter(CalFilter *);
void writeFilter(CalFilter *);
private:
- QPtrList<CalFilter> *mFilters;
+ Q3PtrList<CalFilter> *mFilters;
ComboFilterBox *mSelectionCombo;
QPushButton *mRemoveButton;
FilterEdit_base *mEditor;
QStringList mCategories;
};
#endif
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp
index fe78356..c2402d4 100644
--- a/korganizer/incomingdialog.cpp
+++ b/korganizer/incomingdialog.cpp
@@ -1,93 +1,95 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qfile.h>
#include <qdir.h>
#include <qmap.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <libkcal/incidence.h>
#include <libkcal/event.h>
#include <libkcal/calendar.h>
#include <libkcal/freebusy.h>
#include <libkcal/attendee.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#ifndef KORG_NOMAIL
#include "mailscheduler.h"
#else
#include <libkcal/dummyscheduler.h>
#endif
#include "incomingdialog.h"
#include "koeventviewerdialog.h"
#include "kocounterdialog.h"
#include "koprefs.h"
#ifndef KORG_NOKABC
#define KORG_NOKABC
//#include <kabc/stdaddressbook.h>
#define size count
#endif
-ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev,
+ScheduleItemIn::ScheduleItemIn(Q3ListView *parent,IncidenceBase *ev,
Scheduler::Method method,ScheduleMessage::Status status)
- : QListViewItem(parent)
+ : Q3ListViewItem(parent)
{
mIncidence = ev;
mMethod = method;
mStatus = status;
setText(6,Scheduler::translatedMethodName(mMethod)+" ");
setText(7,ScheduleMessage::statusName(status));
}
/* Visitor */
ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item)
{
mItem = item;
}
ScheduleItemVisitor::~ScheduleItemVisitor()
{
}
bool ScheduleItemVisitor::visit(Event *e)
{
mItem->setText(0,e->summary());
mItem->setText(1,e->dtStartDateStr());
if (e->doesFloat()) {
mItem->setText(2,i18n("no time "));
mItem->setText(4,i18n("no time "));
}
else {
mItem->setText(2,e->dtStartTimeStr());
mItem->setText(4,e->dtEndTimeStr());
}
if (e->hasEndDate()) {
@@ -106,99 +108,99 @@ bool ScheduleItemVisitor::visit(Todo *e)
mItem->setText(0,e->summary());
if (e->hasStartDate()) {
mItem->setText(1,e->dtStartDateStr());
if (!e->doesFloat()) {
mItem->setText(2,e->dtStartTimeStr());
}
}
if (e->hasDueDate()) {
mItem->setText(1,e->dtDueDateStr());
if (!e->doesFloat()) {
mItem->setText(2,e->dtDueTimeStr());
}
}
mItem->setText(5,e->organizer()+" ");
return true;
}
bool ScheduleItemVisitor::visit(Journal *)
{
return false;
}
/*
* Constructs a IncomingDialog which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing,
- QWidget* parent,const char* name,bool modal,WFlags fl) :
+ QWidget* parent,const char* name,bool modal,Qt::WFlags fl) :
IncomingDialog_base(parent,name,modal,fl)
{
mCalendar = calendar;
mOutgoing = outgoing;
#ifndef KORG_NOMAIL
mScheduler = new MailScheduler(mCalendar);
#else
mScheduler = new DummyScheduler(mCalendar);
#endif
- mMessageListView->setColumnAlignment(1,AlignHCenter);
- mMessageListView->setColumnAlignment(2,AlignHCenter);
- mMessageListView->setColumnAlignment(3,AlignHCenter);
- mMessageListView->setColumnAlignment(4,AlignHCenter);
- QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)),
- this,SLOT(showEvent(QListViewItem *)));
+ mMessageListView->setColumnAlignment(1,Qt::AlignHCenter);
+ mMessageListView->setColumnAlignment(2,Qt::AlignHCenter);
+ mMessageListView->setColumnAlignment(3,Qt::AlignHCenter);
+ mMessageListView->setColumnAlignment(4,Qt::AlignHCenter);
+ QObject::connect(mMessageListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this,SLOT(showEvent(Q3ListViewItem *)));
retrieve();
}
/*
* Destroys the object and frees any allocated resources
*/
IncomingDialog::~IncomingDialog()
{
// no need to delete child widgets, Qt does it all for us
}
void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing)
{
mOutgoing = outgoing;
}
void IncomingDialog::retrieve()
{
- QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions();
+ Q3PtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions();
ScheduleMessage *message;
for(message = messages.first();message;message = messages.next()) {
IncidenceBase *inc = message->event();
Scheduler::Method method = (Scheduler::Method)message->method();
ScheduleMessage::Status status = message->status();
ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status);
if(inc->typeID() != freebusyID ) {
Incidence *incidence = static_cast<Incidence *>(inc);
ScheduleItemVisitor v(item);
if (!incidence->accept(v)) delete item;
} else {
FreeBusy *fb = static_cast<FreeBusy *>(item->event());
item->setText(0, "FreeBusy");
item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) );
item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) );
item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) );
item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) );
item->setText(5, fb->organizer());
}
automaticAction(item);
}
emit numMessagesChanged(mMessageListView->childCount());
}
void IncomingDialog::acceptAllMessages()
{
bool success = false;
ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild();
while(item) {
@@ -223,82 +225,82 @@ bool IncomingDialog::acceptMessage(ScheduleItemIn *item)
switch (item->method()) {
case Scheduler::Refresh:
return incomeRefresh(item);
break;
case Scheduler::Counter:
return incomeCounter(item);
break;
case Scheduler::Declinecounter:
return incomeDeclineCounter(item);
break;
case Scheduler::Add:
return incomeAdd(item);
break;
case Scheduler::Request:
return incomeRequest(item);
break;
default:
return incomeDefault(item);
}
return false;
}
void IncomingDialog::rejectMessage()
{
ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem();
if (item) {
mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
}
}
-void IncomingDialog::showEvent(QListViewItem *item)
+void IncomingDialog::showEvent(Q3ListViewItem *item)
{
IncidenceBase *incidence = ((ScheduleItemIn *)item)->event();
if( incidence && incidence->typeID() == eventID ) {
Event *event = static_cast<Event *>(incidence);
KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this);
eventViewer->setEvent(event);
eventViewer->show();
}
}
bool IncomingDialog::incomeRefresh(ScheduleItemIn *item)
{
Event *ev = mCalendar->event(item->event()->uid());
if (ev) {
//user interaction before??
Attendee *att;
- QPtrList<Attendee> attlist = ev->attendees();
+ Q3PtrList<Attendee> attlist = ev->attendees();
for (att=attlist.first(); att; att=attlist.next()) {
Event *event = new Event(*ev);
mOutgoing->addMessage(event,Scheduler::Request,att->email());
delete(event);
}
mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return true;
}
mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return false;
}
bool IncomingDialog::incomeCounter(ScheduleItemIn *item)
{
IncidenceBase *incidence = ((ScheduleItemIn *)item)->event();
// currently only events supportet - attetion at insertion below!
if ( incidence->typeID() != eventID ) return false;
Event *counterEvent = static_cast<Event *>( incidence );
Event *even = mCalendar->event(counterEvent->uid());
KOCounterDialog *eventViewer = new KOCounterDialog(this);
eventViewer->addText(i18n("counter proposal event","<b>Counter-event:</b><p>"));
eventViewer->addEvent(counterEvent);
eventViewer->addText("<hr>");
eventViewer->addText(i18n("<b>Original event:</b><p>"));
if (even) eventViewer->addEvent(even);
@@ -485,44 +487,44 @@ bool IncomingDialog::automaticAction(ScheduleItemIn *item)
if ( method==Scheduler::Refresh ) {
if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) {
// send refresh-information
if ( checkAttendeesInAddressbook(inc) )
autoAction = acceptMessage(item);
else return false;
} else return false;
} else return false;
}
}
}
return autoAction;
}
bool IncomingDialog::checkOrganizerInAddressbook(QString organizer)
{
bool inBook = false;
#ifndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(organizer);
if ( addressList.size()>0 ) inBook = true;
#endif
return inBook;
}
bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc)
{
bool inBook = false;
#ifndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
- QPtrList <Attendee> attendees;
+ Q3PtrList <Attendee> attendees;
Attendee *att;
attendees = inc->attendees();
for (att=attendees.first();att;att=attendees.next()) {
addressList = add_book->findByEmail(att->email());
if (addressList.size()>0 ) inBook = true;
}
#endif
return inBook;
}
//#include "incomingdialog.moc"
diff --git a/korganizer/incomingdialog.h b/korganizer/incomingdialog.h
index 413ce6a..e002b25 100644
--- a/korganizer/incomingdialog.h
+++ b/korganizer/incomingdialog.h
@@ -1,110 +1,110 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef INCOMINGDIALOG_H
#define INCOMINGDIALOG_H
-#include <qlistview.h>
+#include <q3listview.h>
#include <libkcal/calendar.h>
#include <libkcal/scheduler.h>
#include "incomingdialog_base.h"
#include "outgoingdialog.h"
using namespace KCal;
-class ScheduleItemIn : public QListViewItem
+class ScheduleItemIn : public Q3ListViewItem
{
public:
- ScheduleItemIn(QListView *parent,IncidenceBase *ev,Scheduler::Method method,
+ ScheduleItemIn(Q3ListView *parent,IncidenceBase *ev,Scheduler::Method method,
ScheduleMessage::Status status);
virtual ~ScheduleItemIn() {}
IncidenceBase *event() { return mIncidence; }
Scheduler::Method method() { return mMethod; }
ScheduleMessage::Status status() { return mStatus; }
private:
IncidenceBase *mIncidence;
Scheduler::Method mMethod;
ScheduleMessage::Status mStatus;
};
/**
This class provides the initialisation of a ScheduleItemIn for calendar
components using the Incidence::Visitor.
*/
class ScheduleItemVisitor : public Incidence::Visitor
{
public:
ScheduleItemVisitor(ScheduleItemIn *);
~ScheduleItemVisitor();
bool visit(Event *);
bool visit(Todo *);
bool visit(Journal *);
private:
ScheduleItemIn *mItem;
};
class IncomingDialog : public IncomingDialog_base
{
Q_OBJECT
public:
IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing,
- QWidget* parent=0,const char* name=0,bool modal=false,WFlags fl=0);
+ QWidget* parent=0,const char* name=0,bool modal=false,Qt::WFlags fl=0);
~IncomingDialog();
void setOutgoingDialog(OutgoingDialog *outgoing);
signals:
void calendarUpdated();
void numMessagesChanged(int);
public slots:
void retrieve();
protected slots:
void acceptAllMessages();
void acceptMessage();
void rejectMessage();
- void showEvent(QListViewItem *);
+ void showEvent(Q3ListViewItem *);
protected:
bool acceptMessage(ScheduleItemIn *item);
bool incomeRefresh(ScheduleItemIn *item);
bool incomeCounter(ScheduleItemIn *item);
bool incomeDeclineCounter(ScheduleItemIn *item);
bool incomeAdd(ScheduleItemIn *item);
bool incomeRequest(ScheduleItemIn *item);
bool incomeDefault(ScheduleItemIn *item);
bool automaticAction(ScheduleItemIn *item);
private:
bool checkAttendeesInAddressbook(IncidenceBase *inc);
bool checkOrganizerInAddressbook(QString organizer);
Calendar *mCalendar;
Scheduler *mScheduler;
OutgoingDialog *mOutgoing;
};
#endif // INCOMINGDIALOG_H
diff --git a/korganizer/incomingdialog_base.cpp b/korganizer/incomingdialog_base.cpp
index 8589803..5c5ace4 100644
--- a/korganizer/incomingdialog_base.cpp
+++ b/korganizer/incomingdialog_base.cpp
@@ -1,77 +1,79 @@
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/incomingdialog_base.ui'
**
** Created: Sat Mar 29 22:31:27 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "incomingdialog_base.h"
#include <qvariant.h>
-#include <qheader.h>
-#include <qlistview.h>
+#include <q3header.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
/*
* Constructs a IncomingDialog_base as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
-IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
+IncomingDialog_base::IncomingDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "IncomingDialog_base" );
- IncomingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout");
+ IncomingDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "IncomingDialog_baseLayout");
PushButton4 = new QPushButton( this, "PushButton4" );
IncomingDialog_baseLayout->addWidget( PushButton4, 0, 1 );
PushButton7 = new QPushButton( this, "PushButton7" );
PushButton7->setDefault( TRUE );
IncomingDialog_baseLayout->addWidget( PushButton7, 5, 1 );
- mMessageListView = new QListView( this, "mMessageListView" );
+ mMessageListView = new Q3ListView( this, "mMessageListView" );
mMessageListView->addColumn( tr2i18n( "Summary" ) );
mMessageListView->addColumn( tr2i18n( "Start Date" ) );
mMessageListView->addColumn( tr2i18n( "Start Time" ) );
mMessageListView->addColumn( tr2i18n( "End Date" ) );
mMessageListView->addColumn( tr2i18n( "End Time" ) );
mMessageListView->addColumn( tr2i18n( "Organizer" ) );
mMessageListView->addColumn( tr2i18n( "Method" ) );
mMessageListView->addColumn( tr2i18n( "Status" ) );
mMessageListView->setAllColumnsShowFocus( FALSE );
IncomingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 5, 0, 0 );
PushButton7_2 = new QPushButton( this, "PushButton7_2" );
IncomingDialog_baseLayout->addWidget( PushButton7_2, 3, 1 );
PushButton8 = new QPushButton( this, "PushButton8" );
IncomingDialog_baseLayout->addWidget( PushButton8, 1, 1 );
PushButton9 = new QPushButton( this, "PushButton9" );
IncomingDialog_baseLayout->addWidget( PushButton9, 2, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 70, QSizePolicy::Minimum, QSizePolicy::Expanding );
IncomingDialog_baseLayout->addItem( spacer, 4, 1 );
languageChange();
resize( QSize(525, 262).expandedTo(minimumSizeHint()) );
// signals and slots connections
connect( PushButton7, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( PushButton4, SIGNAL( clicked() ), this, SLOT( retrieve() ) );
connect( PushButton7_2, SIGNAL( clicked() ), this, SLOT( acceptAllMessages() ) );
diff --git a/korganizer/incomingdialog_base.h b/korganizer/incomingdialog_base.h
index 7732384..537ef86 100644
--- a/korganizer/incomingdialog_base.h
+++ b/korganizer/incomingdialog_base.h
@@ -1,51 +1,55 @@
/****************************************************************************
** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/incomingdialog_base.ui'
**
** Created: Sat Mar 29 22:24:26 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef INCOMINGDIALOG_BASE_H
#define INCOMINGDIALOG_BASE_H
#include <qvariant.h>
#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QListView;
-class QListViewItem;
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class Q3ListView;
+class Q3ListViewItem;
class QPushButton;
class IncomingDialog_base : public QDialog
{
Q_OBJECT
public:
- IncomingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ IncomingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~IncomingDialog_base();
QPushButton* PushButton4;
QPushButton* PushButton7;
- QListView* mMessageListView;
+ Q3ListView* mMessageListView;
QPushButton* PushButton7_2;
QPushButton* PushButton8;
QPushButton* PushButton9;
protected:
- QGridLayout* IncomingDialog_baseLayout;
+ Q3GridLayout* IncomingDialog_baseLayout;
protected slots:
virtual void languageChange();
virtual void acceptAllMessages();
virtual void acceptMessage();
virtual void rejectMessage();
virtual void retrieve();
};
#endif // INCOMINGDIALOG_BASE_H
diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h
index 2ac9de1..c828573 100644
--- a/korganizer/interfaces/korganizer/baseview.h
+++ b/korganizer/interfaces/korganizer/baseview.h
@@ -1,188 +1,188 @@
/*
This file is part of the KOrganizer interfaces.
Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KORG_BASEVIEW_H
#define KORG_BASEVIEW_H
// $Id$
// KOBaseView is the abstract base class of all calendar views.
#include <qwidget.h>
-#include <qptrlist.h>
-#include <qvaluelist.h>
+#include <q3ptrlist.h>
+#include <q3valuelist.h>
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <libkcal/event.h>
#include <libkcal/calendar.h>
using namespace KCal;
class CalPrinter;
namespace KOrg {
class CalPrinterBase
{
public:
enum PrintType { Day, Week, Month, Todolist };
};
/**
This class provides an interface for all views being displayed within the main
calendar view. It has functions to update the view, to specify date range and
other display parameter and to return selected objects. An important class,
which inherits KOBaseView is KOEventView, which provides the interface for all
views of event data like the agenda or the month view.
@short Base class for calendar views
@author Preston Brown, Cornelius Schumacher
@see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView
*/
class BaseView : public QWidget
{
Q_OBJECT
public:
/**
Constructs a view.
@param cal Pointer to the calendar object from which events
will be retrieved for display.
@param parent parent widget.
@param name name of this widget.
*/
BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) :
QWidget(parent, name), mCalendar(cal) {}
/**
Destructor. Views will do view-specific cleanups here.
*/
virtual ~BaseView() {}
/**
Return calendar object of this view.
*/
Calendar *calendar() { return mCalendar; }
/**
@return a list of selected events. Most views can probably only
select a single event at a time, but some may be able to select
more than one.
*/
- virtual QPtrList<Incidence> selectedIncidences() = 0;
+ virtual Q3PtrList<Incidence> selectedIncidences() = 0;
/**
@return a list of the dates of selected events. Most views can probably only
select a single event at a time, but some may be able to select
more than one.
*/
virtual DateList selectedDates() = 0;
/**
Generate a print preview of this event view.
@param calPrinter Calendar printer object used for printing
@param fd from date
@param td to date
*/
/*
The date parameters should be determined by the view itself and not given as
parameters. At the moment I just move the code from the topwidget to the
individual views.
*/
virtual void printPreview(CalPrinter *,
const QDate &, const QDate &)
{
KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
"that view yet.\n"));
}
/**
Print this view.
@param calPrinter Calendar printer object used for printing
*/
virtual void print(CalPrinter *)
{
KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
"that view yet.\n"));
}
/**
Return number of currently shown dates. A return value of 0 means no idea.
*/
virtual int currentDateCount() = 0;
/** Return if this view is a view for displaying events. */
virtual bool isEventView() { return false; }
virtual bool isMonthView() { return false; }
public slots:
/**
Show incidences for the given date range. The date range actually shown may be
different from the requested range, depending on the particular requirements
of the view.
@param start Start of date range.
@param end End of date range.
*/
virtual void showDates( const QDate &start, const QDate &end ) = 0;
/**
Show given events. Depending on the actual view it might not be possible to
show all given events.
@param eventList a list of events to show.
*/
- virtual void showEvents(QPtrList<Event> eventList) = 0;
+ virtual void showEvents(Q3PtrList<Event> eventList) = 0;
/**
Updates the current display to reflect changes that may have happened
in the calendar since the last display refresh.
*/
virtual void updateView() = 0;
/**
Write all unsaved data back to calendar store.
*/
virtual void flushView() {}
/**
Updates the current display to reflect the changes to one particular event.
*/
virtual void changeEventDisplay(Event *, int) = 0;
/**
Re-reads the KOrganizer configuration and picks up relevant
changes which are applicable to the view.
*/
virtual void updateConfig() {}
/**
Clear selection. The incidenceSelected signal is not emitted.
*/
virtual void clearSelection() {}
signals:
void incidenceSelected( Incidence * );
protected:
diff --git a/korganizer/interfaces/korganizer/calendarviewbase.h b/korganizer/interfaces/korganizer/calendarviewbase.h
index 3c715b1..1f49357 100644
--- a/korganizer/interfaces/korganizer/calendarviewbase.h
+++ b/korganizer/interfaces/korganizer/calendarviewbase.h
@@ -1,65 +1,67 @@
/*
This file is part of the KOrganizer interfaces.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KORG_CALENDARVIEWBASE_H
#define KORG_CALENDARVIEWBASE_H
// $Id$
#include <qwidget.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <libkcal/calendar.h>
#include <korganizer/baseview.h>
namespace KOrg {
/**
@short interface for main calendar view widget
@author Cornelius Schumacher
*/
class CalendarViewBase : public QWidget
{
Q_OBJECT
public:
CalendarViewBase(QWidget *parent, const char *name) :
- QWidget(parent,name) {new QVBoxLayout(this);}
+ QWidget(parent,name) {new Q3VBoxLayout(this);}
virtual ~CalendarViewBase() {};
virtual KCal::Calendar *calendar() = 0;
virtual QDate startDate() = 0;
virtual QDate endDate() = 0;
virtual Incidence *currentSelection() = 0;
virtual void addView(KOrg::BaseView *) = 0;
/** changes the view to be the currently selected view */
virtual void showView(KOrg::BaseView *) = 0;
public slots:
virtual void updateView() = 0;
};
}
#endif
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 5269af7..2814c61 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,248 +1,255 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
//
// Journal Entry
#include <qlabel.h>
#include <qlayout.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qfile.h>
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qpixmap.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <Q3Frame>
+#include <QKeyEvent>
+#include <QEvent>
+#include <Q3VBoxLayout>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <ktextedit.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include "koprefs.h"
#include <klineedit.h>
#include <kdialog.h>
#include "kolocationbox.h"
#include <libkcal/journal.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include "journalentry.h"
//#include "journalentry.moc"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
- QFrame(parent)
+ Q3Frame(parent)
{
int fac = 5;
heiHint = QApplication::desktop()->height();
if ( heiHint > 800 )
fac += 2;
heiHint = heiHint / fac;
showOnlyMode = false;
mCalendar = calendar;
mJournal = 0;
visibleMode = true;
- QHBox * vb = new QHBox ( this );
+ Q3HBox * vb = new Q3HBox ( this );
QPixmap iconp;
vb->setMargin ( KDialog::marginHint()-1 );
QPushButton * toggleJournal = new QPushButton( vb );
iconp = SmallIcon("1updownarrow");
toggleJournal->setPixmap (iconp ) ;
QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb);
mTitle = new KOLocationBox(TRUE, vb, 30);
mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
mCalendarBox = new QComboBox(vb);
mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
#ifndef DESKTOP_VERSION
mTitle->setSizeLimit( 8 );
mCalendarBox->setSizeLimit( 8 );
#endif
vb->setStretchFactor ( mTitle, 8 );
int limit = 3;
if ( QApplication::desktop()->width() < 640 )
limit = 6;
vb->setStretchFactor ( mCalendarBox, limit );
//mTitleLabel->setMargin(0);
//mTitleLabel->setAlignment(AlignCenter);
QPushButton * loadTemplate = new QPushButton( vb );
QPushButton * saveTemplate = new QPushButton( vb );
if ( QApplication::desktop()->width() < 321 )
iconp = SmallIcon("fileexport16");
else
iconp = SmallIcon("fileexport");
saveTemplate->setPixmap (iconp ) ;
int size = saveTemplate->sizeHint().height();
if ( QApplication::desktop()->width() < 321 )
iconp = SmallIcon("fileimport16");
else
iconp = SmallIcon("fileimport");
loadTemplate->setPixmap (iconp ) ;
loadTemplate->setFixedSize( size, size );
saveTemplate->setFixedSize( size, size );
int widwid = size;
if ( QApplication::desktop()->width() < 320 )
widwid = size/2+1;
toggleJournal->setFixedSize( widwid , size );
mTitle->setFixedHeight( size+4);
mCalendarBox->setFixedHeight( size+4);
mEditor = new KTextEdit(this);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
#endif
mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width();
mDeskWid = QApplication::desktop()->width();
int maxwid = mDeskWid - mMaxWidDiff;
if ( QApplication::desktop()->width() < 640 ) {
mTitle->setMaximumWidth( maxwid/2 +20 );
mCalendarBox->setMaximumWidth( maxwid/2 -20);
} else {
mTitle->setMaximumWidth( (maxwid/4)*3);
mCalendarBox->setMaximumWidth( maxwid/2 );
}
//mCalendarBox->setMaximumWidth( maxwid/2 -20 );
mEditor->setWordWrap( KTextEdit::WidgetWidth );
- QBoxLayout *topLayout = new QVBoxLayout(this);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
topLayout->addWidget(vb);
topLayout->addWidget(mEditor);
mEditor->installEventFilter(this);
installEventFilter(this);
mTitle->installEventFilter(this);
- setFocusPolicy (QWidget::NoFocus);
+ setFocusPolicy (Qt::NoFocus);
connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
mTitle->load( KOLocationBox::SUMMARYJOURNAL );
mTitle->lineEdit ()->setText("");
}
JournalEntry::~JournalEntry()
{
//qDebug("JournalEntry::~JournalEntry() ");
}
void JournalEntry::resizeEvent(QResizeEvent* e )
{
#ifndef DESKTOP_VERSION
if ( mDeskWid != QApplication::desktop()->width() ) {
mDeskWid == QApplication::desktop()->width();
int maxwid = mDeskWid - mMaxWidDiff;
if ( QApplication::desktop()->width() < 640 ) {
mTitle->setMaximumWidth( maxwid/2 +20 );
mCalendarBox->setMaximumWidth( maxwid/2 -20);
}
else {
mTitle->setMaximumWidth( (maxwid/4)*3);
mCalendarBox->setMaximumWidth( maxwid/2 );
}
//mCalendarBox->setMaximumWidth( maxwid/2 -20 );
}
//setMaximumWidth( QApplication::desktop()->width() );
//qDebug("MAXXX %d ", QApplication::desktop()->width());
#endif
- QFrame::resizeEvent( e );
+ Q3Frame::resizeEvent( e );
}
QSize JournalEntry::sizeHint() const
{
return QSize ( 240, heiHint );
}
void JournalEntry::slotSaveTemplate()
{
QString fileName =locateLocal( "templates", "journals" );
QDir t_dir;
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/journal";
fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
if ( fileName.length() == 0 )
return;
QFile fileIn( fileName );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
.arg( fileName ) );
return;
}
// QString text;
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << mEditor->text();
fileIn.close();
}
void JournalEntry::slotLoadTemplate()
{
QString fileName =locateLocal( "templates", "journals" );
QDir t_dir;
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/journal";
fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
if ( fileName.length() == 0 )
return;
QFile fileIn( fileName );
- if (!fileIn.open( IO_ReadOnly ) ) {
+ if (!fileIn.open( QIODevice::ReadOnly ) ) {
KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
.arg( fileName ) );
return;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
QString text = tsIn.read();
fileIn.close();
int line, col;
mEditor->getCursorPosition (& line, & col );
mEditor-> insertAt ( text, line, col, true );
//mEditor->setIgnoreMark( true );
}
void JournalEntry::setDate(const QDate &date)
{
showOnlyMode = false;
writeJournal();
mDate = date;
fillCalendar( mCalendar->defaultCalendar() );
}
void JournalEntry::fillCalendar( int setToID )
{
mCalendarBox->clear();
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
int std = 0;
int count = 0;
while ( kkf ) {
if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) {
if ( setToID ) {
if ( kkf->mCalNumber == setToID )
std = count;
} else {
if ( kkf->isStandard ) {
std = count;
}
}
++count;
@@ -287,84 +294,84 @@ void JournalEntry::setJournal(Journal *journal, bool saveJournal )
mTitle->load( KOLocationBox::SUMMARYJOURNAL );
mJournal = journal;
if ( journal->isReadOnly() )
mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")");
else
mTitle->lineEdit ()->setText(mJournal->summary());
mEditor->setText(mJournal->description());
mTitle->setEnabled (!journal->isReadOnly() );
mEditor->setReadOnly ( journal->isReadOnly() );
mCalendarBox->setEnabled (!journal->isReadOnly() );
fillCalendar( mJournal->calID() );
}
Journal *JournalEntry::journal() const
{
return mJournal;
}
void JournalEntry::clear()
{
mJournal = 0;
mEditor->setText("");
mTitle->load( KOLocationBox::SUMMARYJOURNAL );
mTitle->lineEdit ()->setText("");
}
bool JournalEntry::eventFilter( QObject *o, QEvent *e )
{
// kdDebug() << "JournalEntry::event received " << e->type() << endl;
if ( isVisible() ) {
- mEditor->setFocusPolicy (QWidget::StrongFocus);
- mTitle->setFocusPolicy (QWidget::StrongFocus);
+ mEditor->setFocusPolicy (Qt::StrongFocus);
+ mTitle->setFocusPolicy (Qt::StrongFocus);
} else {
- mEditor->setFocusPolicy (QWidget::NoFocus);
- mTitle->setFocusPolicy (QWidget::NoFocus);
+ mEditor->setFocusPolicy (Qt::NoFocus);
+ mTitle->setFocusPolicy (Qt::NoFocus);
}
if ( e->type() == QEvent::FocusOut ) {
writeJournal();
}
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent * k = (QKeyEvent *) e;
if ( !isVisible() )
return true;
if ( k->state() == Qt::ControlButton ) {
k->ignore();
//return true;
}
}
- return QFrame::eventFilter( o, e ); // standard event processing
+ return Q3Frame::eventFilter( o, e ); // standard event processing
}
void JournalEntry::writeJournal()
{
if ( !visibleMode ) return;
if ( !mTitle->isEnabled() ) return;
if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
if ( mJournal ) {
Journal* j = mJournal;
mJournal = 0;
bool conf = KOPrefs::instance()->mConfirm;
KOPrefs::instance()->mConfirm = false;
emit deleteJournal(j);
KOPrefs::instance()->mConfirm = conf;
}
return;
}
// kdDebug() << "JournalEntry::writeJournal()..." << endl;
if (!mJournal) {
mJournal = new Journal;
mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
mCalendar->addJournal(mJournal);
}
if ( mJournal->description() != mEditor->text() ) {
mJournal->setDescription(mEditor->text());
}
if ( mJournal->summary() != mTitle->currentText() ) {
mJournal->setSummary(mTitle->currentText());
mTitle->save(KOLocationBox::SUMMARYJOURNAL);
}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index ee17da8..0adebe9 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -1,72 +1,77 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef JOURNALENTRY_H
#define JOURNALENTRY_H
//
// Widget showing one Journal entry
-#include <qframe.h>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QEvent>
+#include <QLabel>
+#include <QKeyEvent>
#include <libkcal/calendar.h>
class QLabel;
class KTextEdit;
class QComboBox;
class KLineEdit;
class KOLocationBox;
using namespace KCal;
-class JournalEntry : public QFrame {
+class JournalEntry : public Q3Frame {
Q_OBJECT
public:
JournalEntry(Calendar *,QWidget *parent);
virtual ~JournalEntry();
void setJournal(Journal *, bool saveJournal = true );
Journal *journal() const;
void setDate(const QDate &);
void clear();
void flushEntry();
void setShowOnly();
QSize sizeHint() const;
void setVisibleMode( bool b ) { visibleMode = b;}
void fillCalendar( int id = 0 );
void resizeEvent(QResizeEvent* e ) ;
KTextEdit * editor() {return mEditor;};
protected slots:
void slotSaveTemplate();
void slotLoadTemplate();
void toggleShowJournal();
void setVisibleOn();
signals:
void deleteJournal(Journal *);
void newJournal();
void showJournalOnly( Journal * );
protected:
bool eventFilter( QObject *o, QEvent *e );
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 6697602..ecc7a2f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -1,136 +1,140 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstring.h>
-#include <qkeycode.h>
+#include <qnamespace.h>
#include <qlayout.h>
#include <qtimer.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <Q3GridLayout>
+#include <QEvent>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include "koglobals.h"
#include "koprefs.h"
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include <kcalendarsystem.h>
#include "navigatorbar.h"
#include "kdatenavigator.h"
KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
- : QFrame(parent, name),
+ : Q3Frame(parent, name),
updateTimer(0L)
{
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
QDate startDate = QDate::currentDate();
- QGridLayout *topLayout = new QGridLayout(this,8,8);
+ Q3GridLayout *topLayout = new Q3GridLayout(this,8,8);
if (! startDate.isValid()) {
qDebug("KDateNavigator::invalid startdate ");
startDate = QDate::currentDate();
}
mMonthSignalOffset = 0;
mSelectedDates.append(startDate);
m_MthYr = startDate;
m_bShowWeekNums = true;
setFont( KOPrefs::instance()->mDateNavigatorFont );
mNavigatorBar = new NavigatorBar( startDate, this );
topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
//mNavigatorBar->resize( 1,1);
connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
// get the day of the week on the first day
QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
m_fstDayOfWk = dayone.dayOfWeek();
int i;
// Set up the heading fields.
for( i = 0; i < 7; i++ ) {
headings[i] = new QLabel("",this);
//headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
- headings[i]->setAlignment(AlignCenter);
+ headings[i]->setAlignment(Qt::AlignCenter);
headings[i]->installEventFilter(this);
topLayout->addWidget(headings[i],1,i+1);
}
// Create the weeknumber labels
for( i = 0; i < 6; i++ ) {
weeknos[i] = new QLabel(this);
- weeknos[i]->setAlignment(AlignCenter );
+ weeknos[i]->setAlignment(Qt::AlignCenter );
//weeknos[i]->setFont(QFont("Arial", 10));
if(!m_bShowWeekNums) {
weeknos[i]->hide();
}
weeknos[i]->installEventFilter(this);
topLayout->addWidget(weeknos[i],i+2,0);
}
daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
- daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
+ daymatrix->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken);
daymatrix->setLineWidth(1);
connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
SIGNAL( datesSelected( const KCal::DateList & ) ) );
connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
SIGNAL( eventDropped( Event * ) ) );
topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
// read settings from configuration file.
updateConfig();
enableRollover(FollowMonth);
mySizeHint = sizeHintTwoButtons();
myFullSizeHint = sizeHintTwoButtons( 4 );
mFontChanged = false;
//resize ( 3,3 );
}
void KDateNavigator::changeFont ( QFont fo )
{
setFont( fo );
mNavigatorBar->resetFont( fo );
}
QFont KDateNavigator::yourFontHint( QSize si , bool *b)
{
QFont fo = KOPrefs::instance()->mDateNavigatorFont;
*b = false;
int fontPoint = fo.pointSize();
while ( fontPoint > 5 ) {
--fontPoint;
fo.setPointSize( fontPoint );
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 780ebb8..2cbca76 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -1,73 +1,76 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KDATENAVIGATOR_H
#define KDATENAVIGATOR_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qdatetime.h>
#include <qlabel.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QEvent>
#include <libkcal/calendar.h>
#include "kodaymatrix.h"
class QPushButton;
class QTimer;
class KCalendarSystem;
class NavigatorBar;
-class KDateNavigator: public QFrame
+class KDateNavigator: public Q3Frame
{
Q_OBJECT
public:
KDateNavigator( QWidget *parent = 0,const char *name = 0 );
~KDateNavigator();
/** The DateNavigator automatically checks for
* the passage of midnight. If rollover type is
* set to None, no signals are emitted and no
* processing is done. With rollover set to
* FollowDay, the day highlighter changes at
* midnight and dayPassed() is emitted.
* With FollowMonth, it has the same effect
* as FollowDay but also adjusts the month that is
* visible and emits monthPassed() when the month changes.
*/
enum RolloverType { None, FollowDay, FollowMonth } ;
void enableRollover( RolloverType );
void setShowWeekNums( bool enabled );
void setCalendar( Calendar * );
void setBaseDate( const QDate & , bool doRepaint = true );
QDate baseDate() const { return m_MthYr;}
KCal::DateList selectedDates() const { return mSelectedDates; }
NavigatorBar *navigatorBar() const { return mNavigatorBar; }
void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;}
QSize yourSizeHint()const { return mySizeHint; };
QSize yourFullSizeHint() const { return myFullSizeHint;};
QFont yourFontHint( QSize , bool * b);
bool fontChanged() {return mFontChanged; }
@@ -104,64 +107,64 @@ class KDateNavigator: public QFrame
protected slots:
/**
* Called regularly to see if we need to update the view
* wrt. the today box and the month box. Only important
* if you leave KOrganizer idle for long periods of time.
*
* Until we have a reliable way of setting QTimers to go
* off at a particular wall-clock time, we need this,
* which calls passedMidnight() at the right moments.
*/
void possiblyPastMidnight();
/** handles updating the view when midnight has come by due to idle time.
*
*/
void passedMidnight();
void slotMonthSelected( int m );
protected:
void updateDates();
void wheelEvent (QWheelEvent *);
bool eventFilter (QObject *,QEvent *);
private:
QSize mySizeHint;
QSize myFullSizeHint;
bool mFontChanged;
int mMonthSignalOffset;
NavigatorBar *mNavigatorBar;
- QFrame *headingSep;
- QFrame *weeknumSep;
+ Q3Frame *headingSep;
+ Q3Frame *weeknumSep;
QLabel *headings[7];
QLabel *weeknos[7];
KODayMatrix *daymatrix;
KCal::DateList mSelectedDates;
QDate m_MthYr;
int m_fstDayOfWk;
bool m_bShowWeekNums;
int dayNum(int row, int col);
int dayToIndex(int dayNum);
Calendar *mCalendar;
KCalendarSystem *mCalendarSystem;
const QString *curHeaders;
/** used to update the day view periodically, in particular every
* midnight to move the "today" rectangle.
*/
QTimer *updateTimer;
QDate lastDayChecked;
RolloverType updateRollover;
// Disabling copy constructor and assignment operator
KDateNavigator(const KDateNavigator & );
KDateNavigator &operator=(const KDateNavigator &);
};
#endif
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 1d4d6de..fe59787 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1,98 +1,109 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Marcus Bains line.
Copyright (c) 2001 Ali Rahimi
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _WIN32_
#define protected public
#include <qwidget.h>
#undef protected
#endif
-#include <qintdict.h>
+#include <q3intdict.h>
#include <qdatetime.h>
#include <qapplication.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcursor.h>
#include <qpainter.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <Q3MemArray>
+#include <QEvent>
+#include <Q3Frame>
+#include <Q3PtrList>
#include <kdebug.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kglobal.h>
#include "koagendaitem.h"
#include "koprefs.h"
#include "koglobals.h"
#include "koagenda.h"
#include <libkcal/event.h>
#include <libkcal/todo.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
//extern bool globalFlagBlockPainting;
extern int globalFlagBlockAgenda;
extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
extern int globalFlagBlockStartup;
////////////////////////////////////////////////////////////////////////////
MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name)
- : QFrame(_agenda->viewport(),name), agenda(_agenda)
+ : Q3Frame(_agenda->viewport(),name), agenda(_agenda)
{
setLineWidth(0);
setMargin(0);
setBackgroundColor(Qt::red);
minutes = new QTimer(this);
connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc()));
minutes->start(0, true);
mTimeBox = new QLabel(this);
mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom);
QPalette pal = mTimeBox->palette();
pal.setColor(QColorGroup::Foreground, Qt::red);
mTimeBox->setPalette(pal);
//mTimeBox->setAutoMask(true);
agenda->addChild(mTimeBox);
oldToday = -1;
}
MarcusBains::~MarcusBains()
{
//delete minutes;
}
void MarcusBains::hideMe()
{
hide(); mTimeBox->hide();
}
int MarcusBains::todayColumn()
{
QDate currentDate = QDate::currentDate();
DateList dateList = agenda->dateList();
@@ -140,159 +151,159 @@ void MarcusBains::updateLocation(bool recalculate)
if(recalculate)
setFixedSize(agenda->gridSpacingX(),1);
agenda->moveChild(this, x, y);
raise();
if(recalculate)
//mTimeBox->setFont(QFont("helvetica",10));
mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont);
mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds));
mTimeBox->adjustSize();
// the -2 below is there because there is a bug in this program
// somewhere, where the last column of this widget is a few pixels
// narrower than the other columns.
int offs = (today==agenda->columns()-1) ? -4 : 0;
agenda->moveChild(mTimeBox,
x+agenda->gridSpacingX()-mTimeBox->width()+offs-1,
y-mTimeBox->height());
mTimeBox->raise();
//mTimeBox->setAutoMask(true);
int secs = QTime::currentTime().second();
minutes->start( (60 - secs +1)*1000 ,true);
}
////////////////////////////////////////////////////////////////////////////
/*
Create an agenda widget with rows rows and columns columns.
*/
KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
- const char *name,WFlags f) :
- QScrollView(parent,name,f)
+ const char *name,Qt::WFlags f) :
+ Q3ScrollView(parent,name,f)
{
mAllAgendaPopup = 0;
mColumns = columns;
mRows = rows;
mGridSpacingY = rowSize;
mAllDayMode = false;
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
mHolidayMask = 0;
init();
connect ( this, SIGNAL (contentsMoving ( int , int ) ), this, SLOT ( slotContentMove(int,int)) );
}
/*
Create an agenda widget with columns columns and one row. This is used for
all-day events.
*/
-KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
- QScrollView(parent,name,f)
+KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,Qt::WFlags f) :
+ Q3ScrollView(parent,name,f)
{
mAllAgendaPopup = 0;
blockResize = false;
mColumns = columns;
mRows = 1;
//qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize);
mGridSpacingY = KOPrefs::instance()->mAllDaySize;
mAllDayMode = true;
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
mHolidayMask = 0;
init();
}
KOAgenda::~KOAgenda()
{
if(mMarcusBains) delete mMarcusBains;
}
Incidence *KOAgenda::selectedIncidence() const
{
return (mSelectedItem ? mSelectedItem->incidence() : 0);
}
QDate KOAgenda::selectedIncidenceDate() const
{
return (mSelectedItem ? mSelectedItem->itemDate() : QDate());
}
void KOAgenda::init()
{
mPopupTimer = new QTimer(this);
connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
- mNewItemPopup = new QPopupMenu( this );
+ mNewItemPopup = new Q3PopupMenu( this );
connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) );
QString pathString = "";
if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
if ( QApplication::desktop()->width() < 480 )
pathString += "icons16/";
} else
pathString += "iconsmini/";
- mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
mNewItemPopup->insertSeparator ( );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("This month"),6 );
- mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"day" ), i18n("Day view"),3 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"xdays" ), i18n("Next days"),8 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next week"),4 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"month" ), i18n("This month"),6 );
+ mNewItemPopup->insertItem ( (QIcon)SmallIcon( pathString +"journal" ), i18n("Journal view"),7 );
#ifndef _WIN32_
- int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase
- viewport()->setWFlags ( wflags);
+ Qt::WindowFlags wflags = viewport()-> windowFlags() |Qt::WRepaintNoErase;//WResizeNoErase
+ viewport()->setWindowFlags ( wflags);
#endif
mGridSpacingX = 80;
mResizeBorderWidth = 8;
mScrollBorderWidth = 8;
mScrollDelay = 30;
mScrollOffset = 10;
mPaintPixmap.resize( 20,20);
//enableClipper(true);
// Grab key strokes for keyboard navigation of agenda. Seems to have no
// effect. Has to be fixed.
- setFocusPolicy(WheelFocus);
+ setFocusPolicy(Qt::WheelFocus);
connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp()));
connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown()));
connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize()));
mStartCellX = 0;
mStartCellY = 0;
mCurrentCellX = 0;
mCurrentCellY = 0;
mSelectionCellX = 0;
mSelectionYTop = 0;
mSelectionHeight = 0;
mOldLowerScrollValue = -1;
mOldUpperScrollValue = -1;
mClickedItem = 0;
mActionItem = 0;
mActionType = NOP;
mItemMoved = false;
mSelectedItem = 0;
// mItems.setAutoDelete(true);
resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
viewport()->update();
setMinimumSize(30, 1);
@@ -366,69 +377,69 @@ void KOAgenda::marcus_bains()
if(mMarcusBains) mMarcusBains->updateLocation(true);
}
void KOAgenda::changeColumns(int columns)
{
if (columns == 0) {
qDebug("KOAgenda::changeColumns() called with argument 0 ");
return;
}
clear();
mColumns = columns;
computeSizes();
if(mMarcusBains) mMarcusBains->hideMe();
}
/*
This is the eventFilter function, which gets all events from the KOAgendaItems
contained in the agenda. It has to handle moving and resizing for all items.
*/
bool KOAgenda::eventFilter ( QObject *object, QEvent *event )
{
// kdDebug() << "KOAgenda::eventFilter" << endl;
switch(event->type()) {
case QEvent::MouseButtonPress:
case QEvent::MouseButtonDblClick:
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
return eventFilter_mouse(object, static_cast<QMouseEvent *>(event));
case (QEvent::Leave):
if (!mActionItem)
- setCursor(arrowCursor);
+ setCursor(Qt::arrowCursor);
return true;
default:
- return QScrollView::eventFilter(object,event);
+ return Q3ScrollView::eventFilter(object,event);
}
}
void KOAgenda::popupMenu()
{
mPopupTimer->stop();
if ( mPopupKind == 1 || mPopupKind == 3 ) {
if (mActionItem ) {
endItemAction();
}
mLeftMouseDown = false; // no more leftMouse computation
if (mPopupItem) {
//mClickedItem = mPopupItem;
selectItem(mPopupItem);
if ( mAllAgendaPopup && KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 1 )
mAllAgendaPopup->installEventFilter( this );
emit showIncidencePopupSignal(mPopupItem->incidence());
}
} else if ( mPopupKind == 2 || mPopupKind == 4 ) {
if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action
endSelectAction( false ); // do not emit new event signal
mLeftMouseDown = false; // no more leftMouse computation
}
if ( KOPrefs::instance()->mBlockPopupMenu && mPopupKind == 2 )
mNewItemPopup->installEventFilter( this );
mNewItemPopup->popup( mPopupPos);
}
mLeftMouseDown = false;
mPopupItem = 0;
mPopupKind = 0;
}
@@ -476,69 +487,69 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
if ( dX > blockmoveDist || dY > blockmoveDist ) {
mNewItemPopup->hide();
}
}
return true;
}
if ( object == mAllAgendaPopup ) {
//qDebug(" mAllAgendaPopup ");
if ( me->type() == QEvent::MouseButtonRelease ) {
mAllAgendaPopup->removeEventFilter( this );
int dX = me->globalPos().x() - mPopupPos.x();;
if ( dX < 0 )
dX = -dX;
int dY = me->globalPos().y() - mPopupPos.y();
if ( dY < 0 )
dY = -dY;
if ( dX > blockmoveDist || dY > blockmoveDist ) {
mAllAgendaPopup->hide();
}
}
return true;
}
QPoint viewportPos;
if (object != viewport()) {
blockmoveDist = blockmoveDist*2;
viewportPos = ((QWidget *)object)->mapToParent(me->pos());
} else {
viewportPos = me->pos();
}
bool objIsNotViewport = (object != viewport());
bool leftButt = false;
#ifdef DESKTOP_VERSION
- leftButt = (me->button() == LeftButton);
+ leftButt = (me->button() == Qt::LeftButton);
#endif
switch (me->type()) {
case QEvent::MouseButtonPress:
- if (me->button() == LeftButton) {
+ if (me->button() == Qt::LeftButton) {
mPopupTimer->start( 600 );
mLeftMouseDown = true;
}
blockMoving = true;
startX = viewportPos.x();
startY = viewportPos.y();
mPopupPos = me->globalPos();
if ( objIsNotViewport && !leftButt ) {
KOAgendaItem * tempItem = (KOAgendaItem *)object;
if (mAllDayMode) {
if ( tempItem->height() > 10 ) {
int minV = tempItem->height()/4;
if ( minV > (blockmoveDist/2)-2 ) {
if ( minV > blockmoveDist )
minV = blockmoveDist;
else
minV = (blockmoveDist/2);
}
bool border = false;
int diff = tempItem->y() - viewportPos.y();
if ( diff < 0 )
diff *= -1;
if ( diff < minV ) {
border = true;
objIsNotViewport = false;
}
if ( ! border ) {
diff = tempItem->y() + tempItem->height()- viewportPos.y();
if ( diff < 0 )
diff *= -1;
if ( diff < minV ) {
border = true;
@@ -549,136 +560,136 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
} else { // not allday
if ( tempItem->width() > 10 ) {
int minH = tempItem->width()/4;
if ( minH > (blockmoveDist/2)-2 ) {
if ( minH > blockmoveDist )
minH = blockmoveDist;
else
minH = (blockmoveDist/2);
}
bool border = false;
int diff = tempItem->x() - viewportPos.x();
if ( diff < 0 )
diff *= -1;
if ( diff < minH ) {
border = true;
objIsNotViewport = false;
}
if ( ! border ) {
diff = tempItem->x() + tempItem->width() - viewportPos.x();
if ( diff < 0 )
diff *= -1;
if ( diff < minH ) {
border = true;
objIsNotViewport = false;
}
}
}
}
}
if ( objIsNotViewport ) {
mPopupItem = (KOAgendaItem *)object;
mPopupKind = 1;
- if (me->button() == RightButton) {
+ if (me->button() == Qt::RightButton) {
mPopupKind = 3;
popupMenu();
- } else if (me->button() == LeftButton) {
+ } else if (me->button() == Qt::LeftButton) {
mActionItem = (KOAgendaItem *)object;
if (mActionItem) {
emit signalClearSelection();
slotClearSelection();
selectItem(mActionItem);
Incidence *incidence = mActionItem->incidence();
if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) {
mActionItem = 0;
} else {
startItemAction(viewportPos);
}
}
}
} else { // ---------- viewport()
mPopupItem = 0;
mPopupKind = 2;
selectItem(0);
mActionItem = 0;
- if (me->button() == RightButton) {
+ if (me->button() == Qt::RightButton) {
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
mCurrentCellX = gx;
mCurrentCellY = gy;
mStartCellX = gx;
mStartCellY = gy;
mPopupKind = 4;
popupMenu();
- } else if (me->button() == LeftButton) {
- setCursor(arrowCursor);
+ } else if (me->button() == Qt::LeftButton) {
+ setCursor(Qt::arrowCursor);
startSelectAction(viewportPos);
}
}
break;
case QEvent::MouseButtonRelease:
- if (me->button() == LeftButton ) {
+ if (me->button() == Qt::LeftButton ) {
mPopupTimer->stop();
}
if (object != viewport()) {
- if (me->button() == LeftButton && mLeftMouseDown) {
+ if (me->button() == Qt::LeftButton && mLeftMouseDown) {
if (mActionItem) {
QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos));
//qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 );
if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) {
mScrollUpTimer.stop();
mScrollDownTimer.stop();
mActionItem->resetMove();
placeSubCells( mActionItem );
// emit startDragSignal( mActionItem->incidence() );
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
mActionItem = 0;
mActionType = NOP;
mItemMoved = 0;
mLeftMouseDown = false;
return true;
}
endItemAction();
}
}
} else { // ---------- viewport()
- if (me->button() == LeftButton && mLeftMouseDown ) { //left click
+ if (me->button() == Qt::LeftButton && mLeftMouseDown ) { //left click
endSelectAction( true ); // emit new event signal
}
}
- if (me->button() == LeftButton)
+ if (me->button() == Qt::LeftButton)
mLeftMouseDown = false;
break;
case QEvent::MouseMove:
//qDebug("mm ");
if ( !mLeftMouseDown )
return false;
if ( blockMoving ) {
int dX, dY;
dX = startX - viewportPos.x();
if ( dX < 0 )
dX = -dX;
dY = viewportPos.y() - startY;
if ( dY < 0 )
dY = -dY;
//qDebug("%d %d %d ", dX, dY , blockmoveDist );
if ( dX > blockmoveDist || dY > blockmoveDist ) {
blockMoving = false;
}
}
if ( ! blockMoving )
mPopupTimer->stop();
if (object != viewport()) {
KOAgendaItem *moveItem = (KOAgendaItem *)object;
if (!moveItem->incidence()->isReadOnly() ) {
if (!mActionItem)
setNoActionCursor(moveItem,viewportPos);
else {
if ( !blockMoving )
performItemAction(viewportPos);
}
@@ -821,234 +832,234 @@ void KOAgenda::performSelectAction(QPoint viewportPos)
}
void KOAgenda::endSelectAction( bool emitNewEvent )
{
mActionType = NOP;
mScrollUpTimer.stop();
mScrollDownTimer.stop();
emit newTimeSpanSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
if ( emitNewEvent && mStartCellY < mCurrentCellY ) {
emit newEventSignal(mStartCellX,mStartCellY,mCurrentCellX,mCurrentCellY);
}
}
void KOAgenda::startItemAction(QPoint viewportPos)
{
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
int gx,gy;
contentsToGrid(x,y,gx,gy);
mStartCellX = gx;
mStartCellY = gy;
mCurrentCellX = gx;
mCurrentCellY = gy;
bool allowResize = ( mActionItem->incidence()->typeID() != todoID );
if (mAllDayMode) {
int gridDistanceX = (x - gx * mGridSpacingX);
if ( allowResize && gridDistanceX < mResizeBorderWidth &&
mActionItem->cellX() == mCurrentCellX) {
mActionType = RESIZELEFT;
- setCursor(sizeHorCursor);
+ setCursor(Qt::sizeHorCursor);
} else if ( allowResize && (mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
mActionItem->cellXWidth() == mCurrentCellX) {
mActionType = RESIZERIGHT;
- setCursor(sizeHorCursor);
+ setCursor(Qt::sizeHorCursor);
} else {
mActionType = MOVE;
mActionItem->startMove();
- setCursor(sizeAllCursor);
+ setCursor(Qt::sizeAllCursor);
}
} else {
int gridDistanceY = (y - gy * mGridSpacingY);
if (allowResize && gridDistanceY < mResizeBorderWidth &&
mActionItem->cellYTop() == mCurrentCellY &&
!mActionItem->firstMultiItem()) {
mActionType = RESIZETOP;
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else if (allowResize &&(mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
mActionItem->cellYBottom() == mCurrentCellY &&
!mActionItem->lastMultiItem()) {
mActionType = RESIZEBOTTOM;
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else {
mActionType = MOVE;
mActionItem->startMove();
- setCursor(sizeAllCursor);
+ setCursor(Qt::sizeAllCursor);
}
}
}
void KOAgenda::performItemAction(QPoint viewportPos)
{
// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
// QPoint point = viewport()->mapToGlobal(viewportPos);
// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
// point = clipper()->mapFromGlobal(point);
// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
// kdDebug() << "visible height: " << visibleHeight() << endl;
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
int gx,gy;
contentsToGrid(x,y,gx,gy);
QPoint clipperPos = clipper()->
mapFromGlobal(viewport()->mapToGlobal(viewportPos));
// Cursor left active agenda area.
// This starts a drag.
if ( /*clipperPos.y() < 0 || clipperPos.y() > visibleHeight() ||*/
clipperPos.x() < 0 || clipperPos.x() > visibleWidth() ) {
if ( mActionType == MOVE ) {
mScrollUpTimer.stop();
mScrollDownTimer.stop();
mActionItem->resetMove();
placeSubCells( mActionItem );
// emit startDragSignal( mActionItem->incidence() );
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
mActionItem = 0;
mActionType = NOP;
mItemMoved = 0;
return;
}
} else {
switch ( mActionType ) {
case MOVE:
- setCursor( sizeAllCursor );
+ setCursor( Qt::sizeAllCursor );
break;
case RESIZETOP:
case RESIZEBOTTOM:
- setCursor( sizeVerCursor );
+ setCursor( Qt::sizeVerCursor );
break;
case RESIZELEFT:
case RESIZERIGHT:
- setCursor( sizeHorCursor );
+ setCursor( Qt::sizeHorCursor );
break;
default:
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
}
}
// Scroll if item was moved to upper or lower end of agenda.
if (clipperPos.y() < mScrollBorderWidth) {
mScrollUpTimer.start(mScrollDelay);
} else if (visibleHeight() - clipperPos.y() <
mScrollBorderWidth) {
mScrollDownTimer.start(mScrollDelay);
} else {
mScrollUpTimer.stop();
mScrollDownTimer.stop();
}
// Move or resize item if necessary
if (mCurrentCellX != gx || mCurrentCellY != gy) {
mItemMoved = true;
mActionItem->raise();
if (mActionType == MOVE) {
// Move all items belonging to a multi item
KOAgendaItem *moveItem = mActionItem->firstMultiItem();
bool isMultiItem = (moveItem || mActionItem->lastMultiItem());
if (!moveItem) moveItem = mActionItem;
while (moveItem) {
int dy;
if (isMultiItem) dy = 0;
else dy = gy - mCurrentCellY;
moveItem->moveRelative(gx - mCurrentCellX,dy);
int x,y;
gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y);
int diff = moveItem->resizeMe(mGridSpacingX, mGridSpacingX* moveItem->cellWidth(),
mGridSpacingY * moveItem->cellHeight());
moveItem->raise();
moveChild(moveItem,x+diff,y);
moveItem = moveItem->nextMultiItem();
}
} else if (mActionType == RESIZETOP) {
if (mCurrentCellY <= mActionItem->cellYBottom()) {
mActionItem->expandTop(gy - mCurrentCellY);
mActionItem->resize(mActionItem->width(),
mGridSpacingY * mActionItem->cellHeight());
int x,y;
gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y);
//moveChild(mActionItem,childX(mActionItem),y);
- QScrollView::moveChild( mActionItem,childX(mActionItem),y );
+ Q3ScrollView::moveChild( mActionItem,childX(mActionItem),y );
}
} else if (mActionType == RESIZEBOTTOM) {
if (mCurrentCellY >= mActionItem->cellYTop()) {
mActionItem->expandBottom(gy - mCurrentCellY);
mActionItem->resize(mActionItem->width(),
mGridSpacingY * mActionItem->cellHeight());
}
} else if (mActionType == RESIZELEFT) {
if (mCurrentCellX <= mActionItem->cellXWidth()) {
mActionItem->expandLeft(gx - mCurrentCellX);
int diff = mActionItem->resizeMe(mGridSpacingX ,
mGridSpacingX * mActionItem->cellWidth(),
mActionItem->height());
int x,y;
gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y);
moveChild(mActionItem,x+diff,childY(mActionItem));
}
} else if (mActionType == RESIZERIGHT) {
if (mCurrentCellX >= mActionItem->cellX()) {
mActionItem->expandRight(gx - mCurrentCellX);
mActionItem->resizeMe(mGridSpacingX, mGridSpacingX * mActionItem->cellWidth(),
mActionItem->height());
}
}
mCurrentCellX = gx;
mCurrentCellY = gy;
}
}
void KOAgenda::endItemAction()
{
if ( mItemMoved ) {
KOAgendaItem *placeItem = mActionItem->firstMultiItem();
if ( !placeItem ) {
placeItem = mActionItem;
}
if ( placeItem->incidence()->doesRecur() ) {
Incidence* oldInc = placeItem->incidence();
placeItem->recreateIncidence();
emit addToCalSignal(placeItem->incidence(), oldInc );
}
int type = mActionType;
if ( mAllDayMode )
type = -1;
KOAgendaItem *modifiedItem = placeItem;
//emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */);
- QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
+ Q3PtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems();
KOAgendaItem *item;
if ( placeItem->incidence()->typeID() == todoID ) {
mSelectedItem = 0;
//qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth());
modifiedItem->mLastMoveXPos = mCurrentCellX;
emit itemModified( modifiedItem, mActionType );
}
else {
globalFlagBlockAgendaItemPaint = 1;
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
placeSubCells(item);
}
while ( placeItem ) {
//qDebug("placeItem %s ", placeItem->incidence()->summary().latin1());
oldconflictItems = placeItem->conflictItems();
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
placeSubCells(item);
}
placeSubCells( placeItem );
placeItem = placeItem->nextMultiItem();
}
globalFlagBlockAgendaItemPaint = 0;
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
item->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
@@ -1081,195 +1092,195 @@ void KOAgenda::endItemAction()
placeItem = modifiedItem;
while ( placeItem ) {
oldconflictItems = placeItem->conflictItems();
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
item->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
item->repaint(false);
}
placeItem = placeItem->nextMultiItem();
}
/*
oldconflictItems = modifiedItem->conflictItems();
for ( item=oldconflictItems.first(); item != 0;
item=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
item->paintMe(false);
globalFlagBlockAgendaItemUpdate = 1;
item->repaint(false);
}
*/
}
}
if ( mActionItem )
emit incidenceSelected( mActionItem->incidence() );
mScrollUpTimer.stop();
mScrollDownTimer.stop();
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
mActionItem = 0;
mActionType = NOP;
mItemMoved = 0;
}
void KOAgenda::setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos)
{
// kdDebug() << "viewportPos: " << viewportPos.x() << "," << viewportPos.y() << endl;
// QPoint point = viewport()->mapToGlobal(viewportPos);
// kdDebug() << "Global: " << point.x() << "," << point.y() << endl;
// point = clipper()->mapFromGlobal(point);
// kdDebug() << "clipper: " << point.x() << "," << point.y() << endl;
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
// kdDebug() << "contents: " << x << "," << y << "\n" << endl;
int gx,gy;
contentsToGrid(x,y,gx,gy);
// Change cursor to resize cursor if appropriate
if (mAllDayMode) {
int gridDistanceX = (x - gx * mGridSpacingX);
if (gridDistanceX < mResizeBorderWidth &&
moveItem->cellX() == gx) {
- setCursor(sizeHorCursor);
+ setCursor(Qt::sizeHorCursor);
} else if ((mGridSpacingX - gridDistanceX) < mResizeBorderWidth &&
moveItem->cellXWidth() == gx) {
- setCursor(sizeHorCursor);
+ setCursor(Qt::sizeHorCursor);
} else {
- setCursor(arrowCursor);
+ setCursor(Qt::arrowCursor);
}
} else {
int gridDistanceY = (y - gy * mGridSpacingY);
if (gridDistanceY < mResizeBorderWidth &&
moveItem->cellYTop() == gy &&
!moveItem->firstMultiItem()) {
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else if ((mGridSpacingY - gridDistanceY) < mResizeBorderWidth &&
moveItem->cellYBottom() == gy &&
!moveItem->lastMultiItem()) {
- setCursor(sizeVerCursor);
+ setCursor(Qt::sizeVerCursor);
} else {
- setCursor(arrowCursor);
+ setCursor(Qt::arrowCursor);
}
}
}
/*
Place item in cell and take care that multiple items using the same cell do
not overlap. This method is not yet optimal. It doesn´t use the maximum space
it can get in all cases.
At the moment the method has a bug: When an item is placed only the sub cell
widths of the items are changed, which are within the Y region the item to
place spans. When the sub cell width change of one of this items affects a
cell, where other items are, which do not overlap in Y with the item to place,
the display gets corrupted, although the corruption looks quite nice.
*/
void KOAgenda::placeSubCells(KOAgendaItem *placeItem)
{
- QPtrList<KOAgendaItem> conflictItems;
+ Q3PtrList<KOAgendaItem> conflictItems;
int maxSubCells = 0;
- QIntDict<KOAgendaItem> subCellDict(7);
+ Q3IntDict<KOAgendaItem> subCellDict(7);
KOAgendaItem *item;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if (item != placeItem) {
if (placeItem->cellX() <= item->cellXWidth() &&
placeItem->cellXWidth() >= item->cellX()) {
if ((placeItem->cellYTop() <= item->cellYBottom()) &&
(placeItem->cellYBottom() >= item->cellYTop())) {
conflictItems.append(item);
if (item->subCells() > maxSubCells)
maxSubCells = item->subCells();
subCellDict.insert(item->subCell(),item);
}
}
}
}
if (conflictItems.count() > 0) {
// Look for unused sub cell and insert item
int i;
for(i=0;i<maxSubCells;++i) {
if (!subCellDict.find(i)) {
placeItem->setSubCell(i);
break;
}
}
if (i == maxSubCells) {
placeItem->setSubCell(maxSubCells);
maxSubCells++; // add new item to number of sub cells
}
// Prepare for sub cell geometry adjustment
int newSubCellWidth;
if (mAllDayMode) newSubCellWidth = mGridSpacingY / maxSubCells;
else newSubCellWidth = mGridSpacingX / maxSubCells;
conflictItems.append(placeItem);
// Adjust sub cell geometry of all direct conflict items
for ( item=conflictItems.first(); item != 0;
item=conflictItems.next() ) {
item->setSubCells(maxSubCells);
int diff = 0;
if (mAllDayMode) {
diff = item->resizeMe( mGridSpacingX, item->cellWidth() * mGridSpacingX, newSubCellWidth);
} else {
item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item->cellX(),item->cellYTop(),x,y);
if (mAllDayMode) {
y += item->subCell() * newSubCellWidth;
} else {
x += item->subCell() * newSubCellWidth;
}
moveChild(item,x+diff,y);
// qDebug("moveChild %s %d %d ", item->incidence()->summary().latin1() ,x,y);
//item->updateItem();
}
// Adjust sub cell geometry of all conflict items of all conflict items
for ( item=conflictItems.first(); item != 0;
item=conflictItems.next() ) {
if ( placeItem != item ) {
KOAgendaItem *item2;
- QPtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
+ Q3PtrList<KOAgendaItem> conflictItems2 = item->conflictItems();
for ( item2=conflictItems2.first(); item2 != 0;
item2=conflictItems2.next() ) {
if ( item2->subCells() != maxSubCells) {
item2->setSubCells(maxSubCells);
int diff = 0;
if (mAllDayMode) {
diff = item2->resizeMe(mGridSpacingX, item2->cellWidth() * mGridSpacingX, newSubCellWidth);
} else {
item2->resize(newSubCellWidth, item2->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item2->cellX(),item2->cellYTop(),x,y);
if (mAllDayMode) {
y += item2->subCell() * newSubCellWidth;
} else {
x += item2->subCell() * newSubCellWidth;
}
moveChild(item2,x+diff,y);
//qDebug("setttttt %d %s",maxSubCells, item2->text().latin1() );
}
}
}
}
} else {
placeItem->setSubCell(0);
placeItem->setSubCells(1);
int diff = 0;
if (mAllDayMode) diff = placeItem->resizeMe( mGridSpacingX, placeItem->width(),mGridSpacingY);
else placeItem->resize(mGridSpacingX,placeItem->height());
int x,y;
gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
moveChild(placeItem,x+diff,y);
@@ -1296,119 +1307,119 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
return;
}
//qDebug("KOAgenda::drawContents %s", QDateTime::currentDateTime().toString().latin1());
if ( ! mAllDayMode ) {
// currently not working for
//qDebug("KOAgenda::drawContents ");
#if 0
if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
qDebug("WAU ");
drawContentsToPainter();
}
#endif
QPaintDevice* pd = p->device();
p->end();
int vx, vy;
int selectionX = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - mSelectionCellX) * mGridSpacingX :
mSelectionCellX * mGridSpacingX;
contentsToViewport ( cx, cy, vx,vy);
//qDebug(" %d %d %d %d %d", cx, cy, cw,ch,mGridSpacingX-1) ;
if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) {
if ( mGridSpacingX == cw && mSelectionHeight > 0 && ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) ) {
int vxSel, vySel;
contentsToViewport ( selectionX, mSelectionYTop, vxSel,vySel);
int off = mSelectionHeight;
if ( vySel < 0 )
off += vySel;
//qDebug("OFF %d %d %d", off,vySel, vy );
- bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,CopyROP);
+ bitBlt ( pd, vx, vy+off, &mPaintPixmap, cx, cy+off, cw , ch-off ,QPainter::CompositionMode_Source);
} else {
- bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
+ bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source);
}
}
if ( mSelectionHeight > 0 ) {
//qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
// bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
int hei = mSelectionHeight;
int offset = 0;
while ( hei > 0 ) {
int p_hei = 5;
if ( hei < 5 ) p_hei = hei;
hei -= 5;
- bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP);
+ bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source);
offset += 5;
}
}
}
p->begin( pd );
} else {
#if 0
qDebug("mCurPixWid %d %d ",mCurPixWid, contentsWidth() );
if ( mCurPixWid != contentsWidth() || mCurPixHei != contentsHeight() ) {
qDebug("WAUWAU ");
drawContentsToPainter();
}
#endif
QPaintDevice* pd = p->device();
p->end();
int vx, vy;
int selectionX = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - mSelectionCellX) * mGridSpacingX :
mSelectionCellX * mGridSpacingX;
contentsToViewport ( cx, cy, vx,vy);
// qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
- bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
+ bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,QPainter::CompositionMode_Source);
if ( mSelectionHeight > 0 ) {
//qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
//bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
int hei = mSelectionHeight;
int offset = 0;
while ( hei > 0 ) {
int p_hei = 5;
if ( hei < 5 ) p_hei = hei;
hei -= 5;
- bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,CopyROP);
+ bitBlt ( pd, vx+1, vy+offset, &mHighlightPixmap, 0, 0, mGridSpacingX-1, p_hei ,QPainter::CompositionMode_Source);
offset += 5;
}
}
}
p->begin( pd );
}
}
void KOAgenda::finishUpdate()
{
KOAgendaItem *item;
globalFlagBlockAgendaItemPaint = 1;
// Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if ( !item->checkLayout() ) {
//qDebug(" conflictitem found ");
int newSubCellWidth;
int diff = 0;
if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells();
else newSubCellWidth = mGridSpacingX / item->subCells();
if (mAllDayMode) {
diff = item->resizeMe(mGridSpacingX, item->cellWidth() * mGridSpacingX, newSubCellWidth);
} else {
item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item->cellX(),item->cellYTop(),x,y);
if (mAllDayMode) {
y += item->subCell() * newSubCellWidth;
@@ -1547,72 +1558,72 @@ void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// i
}
}
++gxStart;
}
}
}
/*
int selectionX = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - mSelectionCellX) * mGridSpacingX :
mSelectionCellX * mGridSpacingX;
// Draw selection
if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
// TODO: paint only part within cx,cy,cw,ch
p->fillRect( selectionX, mSelectionYTop, mGridSpacingX,
mSelectionHeight, KOPrefs::instance()->mHighlightColor );
}
*/
// Draw vertical lines of grid
int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
if ( mGridSpacingX > 0 ) {
while (x < cx + cw) {
p->drawLine(x,cy,x,cy+ch);
x+=mGridSpacingX;
}
}
// Draw horizontal lines of grid
int y = ((int)(cy/lGridSpacingY))*lGridSpacingY;
if ( lGridSpacingY > 0 ) {
while (y < cy + ch) {
- p->setPen( SolidLine );
+ p->setPen( Qt::SolidLine );
p->drawLine(cx,y,cx+cw,y);
y+=lGridSpacingY;
- p->setPen( DotLine );
+ p->setPen( Qt::DotLine );
p->drawLine(cx,y,cx+cw,y);
y+=lGridSpacingY;
}
- p->setPen( SolidLine );
+ p->setPen( Qt::SolidLine );
}
mPixPainter.end() ;
}
/*
Convert srcollview contents coordinates to agenda grid coordinates.
*/
void KOAgenda::contentsToGrid (int x, int y, int& gx, int& gy)
{
gx = KOGlobals::self()->reverseLayout() ? mColumns - 1 - x/mGridSpacingX :
x/mGridSpacingX;
gy = y/mGridSpacingY;
}
/*
Convert agenda grid coordinates to scrollview contents coordinates.
*/
void KOAgenda::gridToContents (int gx, int gy, int& x, int& y)
{
x = KOGlobals::self()->reverseLayout() ? (mColumns - 1 - gx)*mGridSpacingX:
gx*mGridSpacingX;
y = gy*mGridSpacingY;
}
/*
Return Y coordinate corresponding to time. Coordinates are rounded to fit into
the grid.
*/
int KOAgenda::timeToY(const QTime &time)
{
int minutesPerCell = 24 * 60 / mRows;
@@ -1688,127 +1699,127 @@ KOAgendaItem *KOAgenda::getNewItem(Incidence * event,QDate qd, QWidget* view)
KOAgendaItem* agendaItem = new KOAgendaItem( event, qd, view, mAllDayMode );
agendaItem->installEventFilter(this);
addChild(agendaItem,0,0);
return agendaItem;
}
KOAgendaItem * KOAgenda::getItemForTodo ( Todo * todo )
{
KOAgendaItem *item;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
if ( item->incidence() == todo ) {
mItems.remove();
return item;
}
}
return 0;
}
void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
{
// ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
KOAgendaItem *item;
item = getItemForTodo ( todo );
//qDebug("KOAgenda::updateTodo %d %d %d %d", this, todo, days, remove);
if ( item ) {
blockSignals( true );
//qDebug("item found ");
item->hide();
item->setCellX(-2, -1 );
item->select(false);
mUnusedItems.append( item );
mItems.remove( item );
- QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
+ Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
KOAgendaItem *itemit;
//globalFlagBlockAgendaItemPaint = 1;
for ( itemit=oldconflictItems.first(); itemit != 0;
itemit=oldconflictItems.next() ) {
if ( itemit != item )
placeSubCells(itemit);
}
qApp->processEvents();
//globalFlagBlockAgendaItemPaint = 0;
for ( itemit=oldconflictItems.first(); itemit != 0;
itemit=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
if ( itemit != item )
itemit->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
//qDebug("sigleshot ");
QTimer::singleShot( 0, itemit, SLOT ( repaintItem() ));
//itemit->repaint( false ); repaintItem()
}
blockSignals( false );
}
if ( remove ) {
//qDebug("remove****************************************** ");
return;
}
if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda )
return;
//qDebug("updateTodo+++++++++++++++++++++++++++++++++++++ ");
QDate currentDate = QDate::currentDate();
- bool overdue = (!todo->isCompleted()) && (todo->dtDue() < currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda );
+ bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)currentDate)&& ( KOPrefs::instance()->mShowTodoInAgenda );
QDateTime dt;
if ( todo->hasCompletedDate() )
dt = todo->completed();
else
dt = todo->dtDue();
if ( overdue ) {
days += todo->dtDue().date().daysTo( currentDate );
}
else
currentDate = dt.date();
if (( todo->doesFloat() || overdue) && !todo->hasCompletedDate() ) {
if ( ! mAllDayMode ) return;
// aldayagenda
globalFlagBlockAgendaItemPaint = 1;
item = insertAllDayItem(todo, currentDate,days, days);
item->show();
}
else {
if ( mAllDayMode ) return;
// mAgenda
globalFlagBlockAgendaItemPaint = 1;
int endY = timeToY(dt.time()) - 1;
int hi = 12/KOPrefs::instance()->mHourSize;
int startY = endY - 1-hi;
item = insertItem(todo,currentDate,days,startY,endY);
item->show();
}
qApp->processEvents();
globalFlagBlockAgendaItemPaint = 0;
- QPtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
+ Q3PtrList<KOAgendaItem> oldconflictItems = item->conflictItems();
KOAgendaItem *itemit;
for ( itemit=oldconflictItems.first(); itemit != 0;
itemit=oldconflictItems.next() ) {
globalFlagBlockAgendaItemUpdate = 0;
itemit->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
itemit->repaint();
}
globalFlagBlockAgendaItemUpdate = 0;
item->repaintMe();
globalFlagBlockAgendaItemUpdate = 1;
item->repaint();
}
/*
Insert KOAgendaItem into agenda.
*/
KOAgendaItem *KOAgenda::insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom)
{
if (mAllDayMode) {
qDebug("KOAgenda: calling insertItem in all-day mode is illegal. ");
return 0;
}
KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
//agendaItem->setFrameStyle(WinPanel|Raised);
int YSize = YBottom - YTop + 1;
if (YSize < 0) {
YSize = 1;
}
int iheight = mGridSpacingY * YSize;
@@ -1838,125 +1849,125 @@ KOAgendaItem *KOAgenda::insertAllDayItem (Incidence *event,QDate qd,int XBegin,i
}
//qDebug("insertallday %s -- %d - %d ",qd.toString().latin1(), XBegin, XEnd );
KOAgendaItem *agendaItem = getNewItem(event,qd,viewport());
agendaItem->setCellXY(XBegin,0,0);
agendaItem->setCellXWidth(XEnd);
agendaItem->resizeMe(mGridSpacingX, mGridSpacingX * agendaItem->cellWidth(),mGridSpacingY, true );
//addChild(agendaItem,XBegin*mGridSpacingX,0);
mItems.append(agendaItem);
placeSubCells(agendaItem);
//agendaItem->show();
return agendaItem;
}
void KOAgenda::insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
int YTop,int YBottom)
{
if (mAllDayMode) {
;
return;
}
int cellX,cellYTop,cellYBottom;
QString newtext;
int width = XEnd - XBegin + 1;
int count = 0;
KOAgendaItem *current = 0;
- QPtrList<KOAgendaItem> multiItems;
+ Q3PtrList<KOAgendaItem> multiItems;
for (cellX = XBegin;cellX <= XEnd;++cellX) {
if (cellX == XBegin) cellYTop = YTop;
else cellYTop = 0;
if (cellX == XEnd) cellYBottom = YBottom;
else cellYBottom = rows() - 1;
newtext = QString("(%1/%2): ").arg(++count).arg(width);
newtext.append(event->summary());
current = insertItem(event,qd,cellX,cellYTop,cellYBottom);
current->setText(newtext);
multiItems.append(current);
}
KOAgendaItem *next = 0;
KOAgendaItem *last = multiItems.last();
KOAgendaItem *first = multiItems.first();
KOAgendaItem *setFirst,*setLast;
current = first;
while (current) {
next = multiItems.next();
if (current == first) setFirst = 0;
else setFirst = first;
if (current == last) setLast = 0;
else setLast = last;
current->setMultiItem(setFirst,next,setLast);
current = next;
}
}
//QSizePolicy KOAgenda::sizePolicy() const
//{
// Thought this would make the all-day event agenda minimum size and the
// normal agenda take the remaining space. But it doesn´t work. The QSplitter
// don´t seem to think that an Expanding widget needs more space than a
// Preferred one.
// But it doesn´t hurt, so it stays.
// if (mAllDayMode) {
// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
// } else {
// return QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
// }
//}
void KOAgenda::finishResize ( )
{
//qDebug("finishResize+++++++++++++++++++++++++++++++ ( ) ");
if ( globalFlagBlockAgenda == 0 ) {
finishUpdate();
//qDebug("finishUpdate() called ");
}
}
/*
Overridden from QScrollView to provide proper resizing of KOAgendaItems.
*/
void KOAgenda::resizeEvent ( QResizeEvent *ev )
{
mSelectionHeight = 0;
mResizeTimer.start( 150 , true );
computeSizes();
- QScrollView::resizeEvent( ev );
+ Q3ScrollView::resizeEvent( ev );
return;
}
void KOAgenda::computeSizes()
{
if ( globalFlagBlockStartup )
return;
int frameOffset = frameWidth() * 2 +1;
if (mAllDayMode) {
mGridSpacingX = (width()-frameOffset) / mColumns;
mGridSpacingY = height() - 2 * frameWidth() - 1;
resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
// mGridSpacingY = height();
// resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
KOAgendaItem *item;
int subCellWidth;
for ( item=mItems.first(); item != 0; item=mItems.next() ) {
subCellWidth = mGridSpacingY / item->subCells();
int diff = 0;
diff = item->resizeMe(mGridSpacingX ,mGridSpacingX * item->cellWidth(),subCellWidth);
moveChild(item,(KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - item->cellX()) * mGridSpacingX :
item->cellX() * mGridSpacingX) + diff,
item->subCell() * subCellWidth);
}
KOPrefs::instance()->mAllDaySize = mGridSpacingY;
} else {
mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns;
if (height() > mGridSpacingY * mRows + 1 ) {
KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
mGridSpacingY = KOPrefs::instance()->mHourSize ;
@@ -1987,65 +1998,65 @@ void KOAgenda::computeSizes()
} else {
QPixmap* paintPix = KOAgendaItem::paintPix();
if ( paintPix->width() < cw || paintPix->height() < ch ) {
//qDebug("paintPix->resize ");
paintPix->resize( cw , ch );
}
}
checkScrollBoundaries();
drawContentsToPainter();
viewport()->repaint(false);
}
void KOAgenda::scrollUp()
{
scrollBy(0,-mScrollOffset);
}
void KOAgenda::scrollDown()
{
scrollBy(0,mScrollOffset);
}
void KOAgenda::popupAlarm()
{
if (!mClickedItem) {
qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
return;
}
// TODO: deal correctly with multiple alarms
Alarm* alarm;
- QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
+ Q3PtrList<Alarm> list(mClickedItem->incidence()->alarms());
for(alarm=list.first();alarm;alarm=list.next()) {
alarm->toggleAlarm();
}
emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
mClickedItem->paintMe( true );
mClickedItem->repaint( false );
}
/*
Calculates the minimum width
*/
int KOAgenda::minimumWidth() const
{
// TODO:: develop a way to dynamically determine the minimum width
int min = 100;
return min;
}
void KOAgenda::updateConfig()
{
if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor)
viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
if ( mAllDayMode ) {
mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize;
//mGridSpacingY = KOPrefs::instance()->mAllDaySize;
resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 );
// setMaximumHeight( mGridSpacingY+1 );
viewport()->repaint( false );
//setFixedHeight( mGridSpacingY+1 );
//qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize);
}
@@ -2078,189 +2089,189 @@ void KOAgenda::checkScrollBoundaries(int v)
emit lowerYChanged(yMin);
}
if (yMax != mOldUpperScrollValue) {
mOldUpperScrollValue = yMax;
emit upperYChanged(yMax);
}
}
void KOAgenda::deselectItem()
{
if (mSelectedItem.isNull()) return;
mSelectedItem->select(false);
mSelectedItem = 0;
}
void KOAgenda::selectItem(KOAgendaItem *item)
{
if ((KOAgendaItem *)mSelectedItem == item) return;
deselectItem();
if (item == 0) {
emit incidenceSelected( 0 );
return;
}
mSelectedItem = item;
mSelectedItem->select();
emit incidenceSelected( mSelectedItem->incidence() );
}
// This function seems never be called.
void KOAgenda::keyPressEvent( QKeyEvent *kev )
{
switch(kev->key()) {
- case Key_PageDown:
+ case Qt::Key_PageDown:
verticalScrollBar()->addPage();
break;
- case Key_PageUp:
+ case Qt::Key_PageUp:
verticalScrollBar()->subtractPage();
break;
- case Key_Down:
+ case Qt::Key_Down:
verticalScrollBar()->addLine();
break;
- case Key_Up:
+ case Qt::Key_Up:
verticalScrollBar()->subtractLine();
break;
default:
;
}
}
void KOAgenda::calculateWorkingHours()
{
// mWorkingHoursEnable = KOPrefs::instance()->mEnableWorkingHours;
mWorkingHoursEnable = !mAllDayMode;
mWorkingHoursYTop = mGridSpacingY *
KOPrefs::instance()->mWorkingHoursStart * 4;
mWorkingHoursYBottom = mGridSpacingY *
KOPrefs::instance()->mWorkingHoursEnd * 4 - 1;
}
DateList KOAgenda::dateList() const
{
return mSelectedDates;
}
void KOAgenda::setDateList(const DateList &selectedDates)
{
mSelectedDates = selectedDates;
}
-void KOAgenda::setHolidayMask(QMemArray<bool> *mask)
+void KOAgenda::setHolidayMask(Q3MemArray<bool> *mask)
{
mHolidayMask = mask;
/*
kdDebug() << "HolidayMask: ";
for(uint i=0;i<mask->count();++i) {
kdDebug() << (mask->at(i) ? "*" : "o");
}
kdDebug() << endl;
*/
}
void KOAgenda::contentsMousePressEvent ( QMouseEvent *event )
{
- QScrollView::contentsMousePressEvent(event);
+ Q3ScrollView::contentsMousePressEvent(event);
}
void KOAgenda::storePosition()
{
//mContentPosition
int max = mGridSpacingY*4*24;
if ( contentsY() < 5 && max > viewport()->height()*3/2 )
mContentPosition = 0;
else if ( contentsY() + viewport()->height() > max - 5 && max > viewport()->height()*3/2)
mContentPosition = -1.0;
else
mContentPosition = ((float) max)/ ((float)(contentsY()+ ( viewport()->height()/2)));
//qDebug("mContentPosition %f %d %d %d",mContentPosition , max, contentsY() ,viewport()->height());
}
void KOAgenda::restorePosition()
{
int posY;
int max = mGridSpacingY*4*24;
if ( mContentPosition < 0 )
posY = max-viewport()->height();
else
if ( mContentPosition == 0 )
posY = 0;
else
posY = (int) ((max/mContentPosition)-(viewport()->height()/2));
setContentsPos (0, posY );
//qDebug("posY %d hei %d", posY, max);
}
void KOAgenda::moveChild( QWidget *w, int x , int y )
{
++x;
- QScrollView::moveChild( w, x , y );
+ Q3ScrollView::moveChild( w, x , y );
}
#include <qmessagebox.h>
#ifdef DESKTOP_VERSION
#include <qprinter.h>
#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#endif
void KOAgenda::printSelection()
{
#ifdef DESKTOP_VERSION
if ( mStartCellY == mCurrentCellY ) {
QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("Nothing selected!\n\nThis prints the full width of the Agenda view as you see it!\n\nTo determine the vertical range of the printing, please select\na vertical range (with the left mouse button down) in one column. "),
i18n("OK"), 0, 0,
0, 1 );
return;
}
float dx, dy;
int x,y,w,h;
x= 0;
w= contentsWidth()+2;
// h= contentsHeight();
y = mGridSpacingY*mStartCellY;
h = mGridSpacingY*(mCurrentCellY+1)-y+2;
//return;
QPrinter* printer = new QPrinter();
if ( !printer->setup()) {
delete printer;
return;
}
QPainter p( printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( printer );
QString date = i18n("Date range: ")+KGlobal::locale()->formatDate( mSelectedDates.first() )+" - "+KGlobal::locale()->formatDate( mSelectedDates.last() );
//date += " --- printing time: " + KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), true );
int hei = p.boundingRect(0,0, 5, 5, Qt::AlignLeft, date ).height();
// p.drawText( 0, 0, date );
int offset = m.width()/8;
// compute the scale
dx = ((float) m.width()-offset) / (float)w;
dy = (float)(m.height() - ( 2 * hei )-offset ) / (float)h;
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
// set the scale
p.drawText( (int) (offset* scale), (int) (offset* scale*3/4), date );
uint selDay;
float widOffset = ((float) m.width()-offset) / ((float)(mSelectedDates.count()));
float startX = 1;
for ( selDay = 0; selDay < mSelectedDates.count(); ++selDay)
{
QString text = KGlobal::locale()->formatDate( mSelectedDates[selDay],true );
p.setClipRect((int) (offset* scale+startX) , 0, (int) (widOffset-4), (int) (offset* scale+(2*hei* scale)) );
p.drawText( (int) (offset* scale+startX), (int) ((offset+hei)* scale), text );
startX += widOffset;
}
p.translate( (int) (offset* scale),(int) (offset* scale+ (-y * scale)+(2*hei* scale)));
p.scale( scale, scale );
p.setClipRect( (int) (offset* scale), (int) (offset* scale+(2*hei* scale)), (int) (w*scale), (int) (h*scale) );
// now printing with y offset: 2 hei
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 380ce62..0708341 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -1,152 +1,161 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOAGENDA_H
#define KOAGENDA_H
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include <qtimer.h>
-#include <qmemarray.h>
+#include <q3memarray.h>
#include <qpainter.h>
#include <qpixmap.h>
-#include <qguardedptr.h>
+#include <qpointer.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <Q3Frame>
+#include <QLabel>
+#include <QMouseEvent>
+#include <Q3PtrList>
+#include <Q3PopupMenu>
+#include <QKeyEvent>
+#include <QEvent>
#include "koagendaitem.h"
#include "koeventview.h"
-class QPopupMenu;
+class Q3PopupMenu;
class QTime;
class KConfig;
-class QFrame;
+class Q3Frame;
class KOAgenda;
class KCal::Event;
class KCal::Todo;
using namespace KCal;
-class MarcusBains : public QFrame {
+class MarcusBains : public Q3Frame {
Q_OBJECT
public:
MarcusBains(KOAgenda *agenda=0,const char *name=0);
virtual ~MarcusBains();
void hideMe();
public slots:
void updateLocation(bool recalculate=false);
void updateLoc();
private:
int todayColumn();
QTimer *minutes;
QLabel *mTimeBox;
KOAgenda *agenda;
QTime oldTime;
int oldToday;
};
-class KOAgenda : public QScrollView
+class KOAgenda : public Q3ScrollView
{
Q_OBJECT
public:
enum MouseActionType { NOP, MOVE, SELECT,
RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
- const char * name=0, WFlags f=0 );
+ const char * name=0, Qt::WFlags f=0 );
KOAgenda ( int columns, QWidget * parent=0,
- const char * name=0, WFlags f=0 );
+ const char * name=0, Qt::WFlags f=0 );
virtual ~KOAgenda();
bool mInvalidPixmap;
Incidence *selectedIncidence() const;
QDate selectedIncidenceDate() const;
virtual bool eventFilter ( QObject *, QEvent * );
void contentsToGrid (int x, int y, int& gx, int& gy);
void gridToContents (int gx, int gy, int& x, int& y);
int timeToY (const QTime &time);
QTime gyToTime (int y);
void setStartHour(int startHour);
KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom);
KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd);
void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
int YTop,int YBottom);
void changeColumns(int columns);
int columns() { return mColumns; }
int rows() { return mRows; }
int gridSpacingX() const { return mGridSpacingX; }
int gridSpacingY() const { return mGridSpacingY; }
// virtual QSizePolicy sizePolicy() const;
void clear();
void clearSelection();
void hideUnused();
/** Calculates the minimum width */
virtual int minimumWidth() const;
/** Update configuration from preference settings */
void updateConfig();
void checkScrollBoundaries();
- void setHolidayMask(QMemArray<bool> *);
+ void setHolidayMask(Q3MemArray<bool> *);
void setDateList(const DateList &selectedDates);
DateList dateList() const;
void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
void finishUpdate();
void printSelection();
void storePosition();
void restorePosition();
void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
void shrinkPixmap();
QTime getEndTime();
bool invalidPixmap();
public slots:
void slotContentMove(int,int);
void categoryChanged(Incidence * inc);
void slotClearSelection();
void popupMenu();
void newItem( int );
void moveChild( QWidget *, int, int );
void scrollUp();
void scrollDown();
void updateTodo( Todo * t, int , bool );
void popupAlarm();
void checkScrollBoundaries(int);
/** Deselect selected items. This function does not emit any signals. */
void deselectItem();
/** Select item. If the argument is 0, the currently selected item gets
deselected. This function emits the itemSelected(bool) signal to inform
about selection/deseelction of events. */
void selectItem(KOAgendaItem *);
@@ -248,61 +257,61 @@ class KOAgenda : public QScrollView
int mScrollOffset;
QTimer mScrollUpTimer;
QTimer mScrollDownTimer;
// Number of Columns/Rows of agenda grid
int mColumns;
int mRows;
// Cells to store Move and Resize coordiantes
int mStartCellX;
int mStartCellY;
int mCurrentCellX;
int mCurrentCellY;
// Working Hour coordiantes
bool mWorkingHoursEnable;
int mWorkingHoursYTop;
int mWorkingHoursYBottom;
// Selection
int mSelectionCellX;
int mSelectionYTop;
int mSelectionHeight;
// List of dates to be displayed
DateList mSelectedDates;
// The KOAgendaItem, which has been right-clicked last
KOAgendaItem *mClickedItem;
// The KOAgendaItem, which is being moved/resized
- QGuardedPtr<KOAgendaItem> mActionItem;
+ QPointer<KOAgendaItem> mActionItem;
// Currently selected item
- QGuardedPtr<KOAgendaItem> mSelectedItem;
+ QPointer<KOAgendaItem> mSelectedItem;
// The Marcus Bains Line widget.
MarcusBains *mMarcusBains;
void computeSizes();
MouseActionType mActionType;
bool mItemMoved;
// List of all Items contained in agenda
- QPtrList<KOAgendaItem> mItems;
- QPtrList<KOAgendaItem> mUnusedItems;
+ Q3PtrList<KOAgendaItem> mItems;
+ Q3PtrList<KOAgendaItem> mUnusedItems;
KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport);
- QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
- QPopupMenu *mNewItemPopup;
+ Q3PopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
+ Q3PopupMenu *mNewItemPopup;
int mOldLowerScrollValue;
int mOldUpperScrollValue;
KOAgendaItem * getItemForTodo ( Todo * todo );
- QMemArray<bool> *mHolidayMask;
+ Q3MemArray<bool> *mHolidayMask;
int mCurPixWid;
int mCurPixHei;
};
#endif // KOAGENDA_H
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 407424d..0f9a38f 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,167 +1,177 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <qlabel.h>
#include <qlayout.h>
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qdragobject.h>
+#include <q3whatsthis.h>
+#include <q3dragobject.h>
#include <qdrawutil.h>
#include <qpainter.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3PtrList>
+#include <QPixmap>
+#include <QDragEnterEvent>
+#include <QDropEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QEvent>
+#include <QPaintEvent>
#include <kiconloader.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#define AGENDA_ICON_SIZE 5
#else
#include <qapplication.h>
#define AGENDA_ICON_SIZE 7
#endif
#include <libkcal/icaldrag.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/kincidenceformatter.h>
extern int globalFlagBlockAgenda;
extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
#include "koprefs.h"
#include "koagendaitem.h"
//#include "koagendaitem.moc"
//--------------------------------------------------------------------------
QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
//--------------------------------------------------------------------------
-class KOAgendaItemWhatsThis :public QWhatsThis
+class KOAgendaItemWhatsThis :public Q3WhatsThis
{
public:
- KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
+ KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { };
protected:
virtual QString text( const QPoint& )
{
return _view->getWhatsThisText() ;
}
private:
KOAgendaItem * _view;
};
KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
- const char *name,WFlags) :
+ const char *name,Qt::WFlags) :
QWidget(parent, name), mIncidence(incidence), mDate(qd)
{
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
- int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
- setWFlags ( wflags);
+ Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase
+ setWindowFlags ( wflags);
mAllDay = allday;
init ( incidence, qd );
//setMouseTracking(true);
//setAcceptDrops(true);
xPaintCoord = -1;
yPaintCoord = -1;
}
QString KOAgendaItem::getWhatsThisText()
{
if ( mIncidence )
return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
return "KOAgendaItem::getWhatsThisText()::internal error";
}
void KOAgendaItem::initColor ()
{
if ( (mIncidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
- if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date())
+ if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
else
mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
}
else {
QStringList categories = mIncidence->categories();
QString cat = categories.first();
if (cat.isEmpty()) {
if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
else
mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() );
} else {
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
}
}
}
QColor BackgroundColor ( mBackgroundColor );
if ( mIncidence->calID() > 1 ) {
//BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
}
mColorGroup = QColorGroup( BackgroundColor.light(),
BackgroundColor.dark(),BackgroundColor.light(),
- BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ;
+ BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ;
setBackgroundColor( mBackgroundColor );
mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
}
void KOAgendaItem::init ( Incidence *incidence, QDate qd )
{
mIncidence = incidence;
mDate = qd;
mFirstMultiItem = 0;
mNextMultiItem = 0;
mLastMultiItem = 0;
computeText();
initColor();
mConflictItems.clear();
setCellXY(0,0,1);
setCellXWidth(0);
setSubCell(0);
setSubCells(1);
setMultiItem(0,0,0);
startMove();
mSelected = true;
select(false);
QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
mFontPixelSize = fontinf.height();;
hide();
xPaintCoord = -1;
yPaintCoord = -1;
}
KOAgendaItem::~KOAgendaItem()
{
#if QT_VERSION >= 0x030000
@@ -199,114 +209,114 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
if ( x < 0 ) x = 0;
x += 3;
int y;
if ( mAllDay )
y = pos().y()+3;
else
y = mCellYTop * ( height() / cellHeight() ) +3;
if ( mIncidence->calID() > 1 ) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 );
if ( horLayout ){
++xOff;
++x;
}
else {
++yOff;
++y;
}
}
if (mIncidence->cancelled() && height() < 20 ) {
int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::red );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->doesRecur()) {
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::blue );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->description().length() > 0) {
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkGreen );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->isReadOnly()) {
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::white );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->attendeeCount()>0) {
if (mIncidence->organizer() == KOPrefs::instance()->email()) {
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::black );
if ( horLayout )
++xOff;
else
++yOff;
} else {
Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
} else {
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::yellow );
if ( horLayout )
++xOff;
else
++yOff;
}
- p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
+ p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkYellow );
if ( horLayout )
++xOff;
else
++yOff;
}
}
return ( yOff || xOff );
}
void KOAgendaItem::select(bool selected)
{
//qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
if (mSelected == selected) return;
mSelected = selected;
if ( ! isVisible() )
return;
if ( firstMultiItem() )
firstMultiItem()->select( selected );
if ( !firstMultiItem() && nextMultiItem() ) {
KOAgendaItem * placeItem = nextMultiItem();
while ( placeItem ) {
placeItem->select( selected );
placeItem = placeItem->nextMultiItem();
}
}
globalFlagBlockAgendaItemUpdate = 0;
paintMe( selected );
globalFlagBlockAgendaItemUpdate = 1;
repaint( false );
@@ -391,91 +401,91 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
if ( mIncidence->typeID() == todoID ) {
Todo* tempTodo = static_cast<Todo*>(mIncidence);
int xx = pos().x()+(width()-completedPxmp.width()-3 );
int yyy = yy+3;
if ( tempTodo->isCompleted() )
paint->drawPixmap ( xx, yyy, completedPxmp );
else {
paint->drawPixmap ( xx, yyy, overduePxmp );
}
}
bool addIcon = false;
if ( ! small || w > 3 * h || h > 3* w )
addIcon = updateIcons( paint, horLayout );
//qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
//qDebug("draw rect %d %d %d %d ",x, yy, w, h );
if ( ! small ) {
x += 3; yy += 3;w -= 6; h-= 5;
} else {
x += 2; yy += 1;w -= 4; h-= 4;
if ( nfh < 6.01 ) {
yy -= 2;
h += 4;
}
else
if ( nfh < h -2 )
++yy;
}
int align;
#ifndef DESKTOP_VERSION
- align = ( AlignLeft|WordBreak|AlignTop);
+ align = ( Qt::AlignLeft|Qt::TextWordWrap|Qt::AlignTop);
#else
- align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
+ align = ( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
#endif
if ( addIcon ) {
if ( ! horLayout ) {
x += AGENDA_ICON_SIZE+3;
w -= (AGENDA_ICON_SIZE+3);
}
else {
yy+= AGENDA_ICON_SIZE+2;
h -=(AGENDA_ICON_SIZE+3);
}
}
if ( mWhiteText )
- paint->setPen ( white);
+ paint->setPen ( Qt::white);
if ( x < 0 ) {
w = w+x-3;
x = 3;
if ( !horLayout && addIcon )
x += AGENDA_ICON_SIZE+3;
if ( w > parentWidget()->width() ){
w = parentWidget()->width() - 6;
#ifndef DESKTOP_VERSION
- align = ( AlignHCenter|WordBreak|AlignTop);
+ align = ( Qt::AlignHCenter|Qt::TextWordWrap|Qt::AlignTop);
#else
- align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
+ align = ( Qt::AlignHCenter|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
#endif
}
}
QRect dr;
if ( w + x > parentWidget()->width() )
w = parentWidget()->width()-x;
paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
//qDebug("%d %d %d %d ", x, yy, w, h );
if ( mIncidence->cancelled() ){
small = ( height() < 20 );
if ( ! small ) {
QFontMetrics fm ( paint->font() );
paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
}
}
pa.end();
}
QPixmap * KOAgendaItem::paintPix()
{
static QPixmap* mPaintPix = 0;
if ( ! mPaintPix ) {
int w = QApplication::desktop()->width();
int h = QApplication::desktop()->height();
mPaintPix = new QPixmap(w,h);
}
@@ -532,65 +542,65 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e )
rh = e->rect().height();
//qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
QPixmap* paintFrom ;
if ( mSelected ) {
paintMe( mSelected );
return;
} else {
if ( mAllDay )
paintFrom = paintPixAllday();
else
paintFrom = paintPix();
}
xx += rx;
if ( xx < 0 ) {
rw = rw + xx;
rx -= xx;
xx = 0;
if ( rw <= 1 ) {
//qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
return;
}
}
if ( paintFrom->width() < xx+rw ) {
rw = paintFrom->width() - xx;
if ( rw <= 1 ) {
//qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
return;
}
}
//qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
- bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
+ bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,QPainter::CompositionMode_Source);
}
void KOAgendaItem::computeText()
{
mDisplayedText = mIncidence->summary();
if ( (mIncidence->typeID() == todoID ) ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
else if ( !(mIncidence->doesFloat()))
mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
}
} else {
if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
if ( mAllDay ) {
if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
int dur = 1+ (static_cast<Event*>(mIncidence))->dtStart().date().daysTo( (static_cast<Event*>(mIncidence))->dtEnd().date() );
mDisplayedText += " ("+QString::number( dur )+i18n(" days") +")" ;
if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
if ( mIncidence->doesRecur() ) {
mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
} else {
mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true);
}
}
}
}
}
if ( !mIncidence->location().isEmpty() ) {
if ( mAllDay )
@@ -599,65 +609,65 @@ void KOAgendaItem::computeText()
mDisplayedText += "\n(";
mDisplayedText += mIncidence->location() +")";
}
#ifdef DESKTOP_VERSION
QString tipText = mIncidence->summary();
if ( !mIncidence->doesFloat() ) {
if ( mIncidence->typeID() == eventID ) {
if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
}
else {
tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
}
}
else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
}
} else if ( mIncidence->typeID() == todoID ) {
if (mIncidence->hasStartDate())
tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
if (((Todo*)mIncidence)->hasDueDate())
tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
}
if (!mIncidence->location().isEmpty()) {
tipText += "\n"+i18n("Location: ")+mIncidence->location();
}
- QToolTip::add(this,tipText,toolTipGroup(),"");
+ QToolTip::add(this,tipText /*TODO:hacker: ,toolTipGroup(),"" */);
#endif
}
void KOAgendaItem::updateItem()
{
computeText();
//qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
paintMe( mSelected );
repaint( false);
}
void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
{
//qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
paintMe( mSelected );
repaint( false );
}
/*
Return height of item in units of agenda cells
*/
int KOAgendaItem::cellHeight()
{
int ret = mCellYBottom - mCellYTop + 1;
if ( ret <= 0 ) {
ret = 1;
mCellYBottom = 0;
mCellYTop = 0;
}
return ret;
}
// it may be that allday agenda items have a needed width > 32000
@@ -766,108 +776,108 @@ void KOAgendaItem::expandTop(int dy)
int newYTop = cellYTop() + dy;
int newYBottom = cellYBottom();
if (newYTop > newYBottom) newYTop = newYBottom;
setCellY(newYTop, newYBottom);
}
void KOAgendaItem::expandBottom(int dy)
{
int newYTop = cellYTop();
int newYBottom = cellYBottom() + dy;
if (newYBottom < newYTop) newYBottom = newYTop;
setCellY(newYTop, newYBottom);
}
void KOAgendaItem::expandLeft(int dx)
{
int newX = cellX() + dx;
int newXWidth = cellXWidth();
if (newX > newXWidth) newX = newXWidth;
setCellX(newX,newXWidth);
}
void KOAgendaItem::expandRight(int dx)
{
int newX = cellX();
int newXWidth = cellXWidth() + dx;
if (newXWidth < newX) newXWidth = newX;
setCellX(newX,newXWidth);
}
QToolTipGroup *KOAgendaItem::toolTipGroup()
{
- if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
+ /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
return mToolTipGroup;
}
void KOAgendaItem::dragEnterEvent( QDragEnterEvent *e )
{
#ifndef KORG_NODND
if ( ICalDrag::canDecode( e ) || VCalDrag::canDecode( e ) ||
- !QTextDrag::canDecode( e ) ) {
+ !Q3TextDrag::canDecode( e ) ) {
e->ignore();
return;
}
e->accept();
#endif
}
void KOAgendaItem::dropEvent( QDropEvent *e )
{
#ifndef KORG_NODND
QString text;
- if(QTextDrag::decode(e,text))
+ if(Q3TextDrag::decode(e,text))
{
kdDebug() << "Dropped : " << text << endl;
QStringList emails = QStringList::split(",",text);
for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
kdDebug() << " Email: " << (*it) << endl;
int pos = (*it).find("<");
QString name = (*it).left(pos);
QString email = (*it).mid(pos);
if (!email.isEmpty()) {
mIncidence->addAttendee(new Attendee(name,email));
}
}
}
#endif
}
-QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
+Q3PtrList<KOAgendaItem> KOAgendaItem::conflictItems()
{
return mConflictItems;
}
-void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
+void KOAgendaItem::setConflictItems(Q3PtrList<KOAgendaItem> ci)
{
mConflictItems = ci;
KOAgendaItem *item;
for ( item=mConflictItems.first(); item != 0;
item=mConflictItems.next() ) {
item->addConflictItem(this);
}
}
void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
{
if (mConflictItems.find(ci)<0)
mConflictItems.append(ci);
}
bool KOAgendaItem::checkLayout()
{
if ( !mConflictItems.count() )
return true;
int max = 0;
KOAgendaItem *item;
for ( item=mConflictItems.first(); item != 0;
item=mConflictItems.next() ) {
if ( item->subCells() > max )
max = item->subCells();
}
if ( max > subCells() ) {
setSubCells( max );
return false;
}
return true;
}
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 27ee720..17cf975 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -1,167 +1,174 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOAGENDAITEM_H
#define KOAGENDAITEM_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qpixmap.h>
#include <qdatetime.h>
#include <qpalette.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <Q3PtrList>
+#include <QEvent>
+#include <QDragEnterEvent>
#include <libkcal/incidence.h>
class KOAgendaItemWhatsThis;
class QToolTipGroup;
class QDragEnterEvent;
class QDropEvent;
using namespace KCal;
/*
The KOAgendaItem has to make sure that it receives all mouse events, which are
to be used for dragging and resizing. That means it has to be installed as
eventfiler for its children, if it has children, and it has to pass mouse
events from the cildren to itself. See eventFilter().
*/
class KOAgendaItem : public QWidget
{
Q_OBJECT
public:
KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0,
- WFlags f=0 );
+ Qt::WFlags f=0 );
~KOAgendaItem();
QString getWhatsThisText();
void init ( Incidence *incidence, QDate qd );
int cellX() { return mCellX; }
int cellXWidth() { return mCellXWidth; }
int cellYTop() { return mCellYTop; }
int cellYBottom() { return mCellYBottom; }
int cellHeight();
int cellWidth();
int subCell() { return mSubCell; }
int subCells() { return mSubCells; }
void setCellXY(int X, int YTop, int YBottom);
void setCellY(int YTop, int YBottom);
void setCellX(int XLeft, int XRight);
void setCellXWidth(int xwidth);
void setSubCell(int subCell);
void setSubCells(int subCells);
/** Start movement */
void startMove();
/** Reset to original values */
void resetMove();
void moveRelative(int dx,int dy);
void expandTop(int dy);
void expandBottom(int dy);
void expandLeft(int dx);
void expandRight(int dx);
int mLastMoveXPos;
void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
KOAgendaItem *last);
KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
Incidence *incidence() const { return mIncidence; }
QDate itemDate() { return mDate; }
/** Update the date of this item's occurence (not in the event) */
void setItemDate(QDate qd);
void setText ( const QString & text ) { mDisplayedText = text; }
QString text () { return mDisplayedText; }
virtual bool eventFilter ( QObject *, QEvent * );
static QToolTipGroup *toolTipGroup();
- QPtrList<KOAgendaItem> conflictItems();
- void setConflictItems(QPtrList<KOAgendaItem>);
+ Q3PtrList<KOAgendaItem> conflictItems();
+ void setConflictItems(Q3PtrList<KOAgendaItem>);
void addConflictItem(KOAgendaItem *ci);
void paintMe( bool, QPainter* painter = 0 );
void repaintMe();
static QPixmap * paintPix();
static QPixmap * paintPixAllday();
void updateItem();
void computeText();
void recreateIncidence();
bool checkLayout();
void initColor ();
bool isAllDay() { return mAllDay; }
int resizeMe( int grid, int wid, int hei, bool invalidWidth = false );
public slots:
bool updateIcons( QPainter *, bool );
void select(bool=true);
void repaintItem();
protected:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void paintEvent ( QPaintEvent * );
void resizeEvent ( QResizeEvent *ev );
private:
KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis;
bool mAllDay;
bool mWhiteText;
int mCellX;
int mCellXWidth;
int mCellYTop,mCellYBottom;
int mSubCell; // subcell number of this item
int mSubCells; // Total number of subcells in cell of this item
int xPaintCoord;
int yPaintCoord;
int wPaintCoord;
int hPaintCoord;
// Variables to remember start position
int mStartCellX;
int mStartCellXWidth;
int mStartCellYTop,mStartCellYBottom;
int mLastMovePos;
// Multi item pointers
KOAgendaItem *mFirstMultiItem;
KOAgendaItem *mNextMultiItem;
KOAgendaItem *mLastMultiItem;
int mFontPixelSize;
Incidence *mIncidence; // corresponding event or todo
QDate mDate; //date this events occurs (for recurrence)
//void showIcon( QLabel*, int );
//QLabel *mTodoIconLabel;
//QLabel *mItemLabel;
//QWidget *mIconBox;
//QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
//QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
//QLabel *mIconMoreInfo;
static QToolTipGroup *mToolTipGroup;
QColor mBackgroundColor;
QColorGroup mColorGroup;
QString mDisplayedText;
bool mSelected;
- QPtrList<KOAgendaItem> mConflictItems;
+ Q3PtrList<KOAgendaItem> mConflictItems;
};
#endif // KOAGENDAITEM_H
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 6e65a03..87993ae 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1,130 +1,142 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qlabel.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlayout.h>
#ifndef KORG_NOSPLITTER
#include <qsplitter.h>
#endif
#include <qfont.h>
#include <qfontmetrics.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qtooltip.h>
#include <qpainter.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QPixmap>
+#include <QMouseEvent>
+#include <Q3GridLayout>
+#include <Q3ValueList>
+#include <QKeyEvent>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <QPaintEvent>
+#include <Q3PtrList>
#include <kapplication.h>
#include <KDGanttMinimizeSplitter.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kconfig.h>
#include <kglobal.h>
#include "calendarview.h"
#include "koviewmanager.h"
#include <libkcal/calendar.h>
#include <libkcal/icaldrag.h>
#include <libkcal/dndfactory.h>
#include <kcalendarsystem.h>
#include "koglobals.h"
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include "koprefs.h"
#include "koagenda.h"
#include "koagendaitem.h"
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "koagendaview.h"
//#include "koagendaview.moc"
//extern bool globalFlagBlockPainting;
extern int globalFlagBlockAgenda;
extern int globalFlagBlockStartup;
extern int globalFlagBlockAgendaItemPaint;
extern int globalFlagBlockAgendaItemUpdate;
extern int globalFlagBlockLabel;
using namespace KOrg;
#define IDLETIMEOUT 45
-TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) :
- QScrollView(parent,name,f)
+TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,Qt::WFlags f) :
+ Q3ScrollView(parent,name,f)
{
myPix.resize( 1, 1 );
mRows = rows;
mRedrawNeeded = true;
setMinimumHeight( 20 );
mCellHeight = KOPrefs::instance()->mHourSize*4;
enableClipper(true);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
resizeContents(50,mRows * mCellHeight);
- viewport()->setBackgroundMode( PaletteBackground );
+ viewport()->setBackgroundMode( Qt::PaletteBackground );
}
void TimeLabels::setCellHeight(int height)
{
mCellHeight = height;
}
/*
Optimization so that only the "dirty" portion of the scroll view
is redrawn. Unfortunately, this is not called by default paintEvent() method.
*/
void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
{
cx = contentsX() + frameWidth()*2;
cw = contentsWidth() ;
// end of workaround
int cell = ((int)(cy/mCellHeight));
int y = cell * mCellHeight;
QFontMetrics fm = fontMetrics();
QString hour;
QString suffix = "am";
int timeHeight = fm.ascent();
QFont nFont = font();
p->setFont( font());
if (!KGlobal::locale()->use12Clock()) {
suffix = "00";
} else
if (cell > 11) suffix = "pm";
@@ -254,65 +266,65 @@ void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
{
topLevelWidget()->setCaption( mOrgCap );
int diff = mMouseDownY - e->pos().y();
if ( diff < 10 && diff > -10 )
return;
int tSize = KOPrefs::instance()->mHourSize + (diff/10);
if ( tSize < 4 )
tSize = 4;
if ( tSize > 22 )
tSize = 22;
tSize = (tSize/2)*2;
if ( tSize == KOPrefs::instance()->mHourSize )
return;
KOPrefs::instance()->mHourSize = tSize;
emit scaleChanged();
}
/** This is called in response to repaint() */
void TimeLabels::paintEvent(QPaintEvent*)
{
// kdDebug() << "paintevent..." << endl;
// this is another hack!
// QPainter painter(this);
//QString c
repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
}
////////////////////////////////////////////////////////////////////////////
EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
- : QFrame(parent,name)
+ : Q3Frame(parent,name)
{
mColumns = 1;
mTopBox = 0;
mLocation = loc;
mTopLayout = 0;
mPaintWidget = 0;
mXOffset = 0;
if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
else mPixmap = SmallIcon("1downarrow");
mEnabled.resize(mColumns);
mEnabled.fill( false );
setMinimumHeight(mPixmap.height());
}
EventIndicator::~EventIndicator()
{
}
void EventIndicator::drawContents(QPainter *p)
{
// kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
KDGanttSplitterHandle* han = 0;
if ( mPaintWidget )
han = mPaintWidget->firstHandle();
if ( ! han ) {
int i;
for(i=0;i<mColumns;++i) {
if (mEnabled[i]) {
int cellWidth = contentsRect().right()/mColumns;
int xOffset = KOGlobals::self()->reverseLayout() ?
(mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 :
@@ -364,137 +376,137 @@ void EventIndicator::changeColumns(int columns)
update();
}
void EventIndicator::enableColumn(int column, bool enable)
{
mEnabled[column] = enable;
}
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
KOEventView (cal,parent,name)
{
flag_blockfillAgenda = false;
mBlockUpdating = true;
mStartHour = 8;
mSelectedDates.append(QDate::currentDate());
mLayoutDayLabels = 0;
mDayLabelsFrame = 0;
mDayLabels = 0;
bool isRTL = KOGlobals::self()->reverseLayout();
QPixmap expandPix;
if ( KOPrefs::instance()->mVerticalScreen ) {
expandPix = SmallIcon( "1updownarrow" );
} else {
expandPix = SmallIcon("1leftrightarrow" );
}
- QBoxLayout *topLayout = new QVBoxLayout(this);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
// Create day name labels for agenda columns
// Create agenda splitter
mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
topLayout->addWidget( mSplitterAgenda );
- mAllDayFrame = new QHBox(mSplitterAgenda);
- mAllDayFrame->setFocusPolicy(NoFocus);
+ mAllDayFrame = new Q3HBox(mSplitterAgenda);
+ mAllDayFrame->setFocusPolicy(Qt::NoFocus);
QWidget *agendaFrame = new QWidget(mSplitterAgenda);
- agendaFrame->setFocusPolicy(NoFocus);
+ agendaFrame->setFocusPolicy(Qt::NoFocus);
// Create all-day agenda widget
- mDummyAllDayLeft = new QVBox( mAllDayFrame );
+ mDummyAllDayLeft = new Q3VBox( mAllDayFrame );
mExpandButton = new QPushButton(mDummyAllDayLeft);
mExpandButton->setPixmap( expandPix );
int widebut = mExpandButton->sizeHint().width()+4;
int heibut = mExpandButton->sizeHint().height()+4;
if ( heibut > widebut )
widebut = heibut ;
//mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
// QSizePolicy::Fixed ) );
mExpandButton->setFixedSize( widebut, widebut);
connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
- mExpandButton->setFocusPolicy(NoFocus);
+ mExpandButton->setFocusPolicy(Qt::NoFocus);
mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
- mAllDayAgenda->setFocusPolicy(NoFocus);
+ mAllDayAgenda->setFocusPolicy(Qt::NoFocus);
QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
// Create event context menu for all day agenda
//mAllDayAgendaPopup = eventPopup();
// Create agenda frame
- QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
+ Q3GridLayout *agendaLayout = new Q3GridLayout(agendaFrame,4,3);
// QHBox *agendaFrame = new QHBox(splitterAgenda);
// create event indicator bars
mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
#ifndef DESKTOP_VERSION
mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
#endif
- mDayLabelsFrame = new QHBox(agendaFrame);
+ mDayLabelsFrame = new Q3HBox(agendaFrame);
//topLayout->addWidget(mDayLabelsFrame);
- mDayLabels = new QFrame (mDayLabelsFrame);
- mLayoutDayLabels = new QHBoxLayout(mDayLabels);
+ mDayLabels = new Q3Frame (mDayLabelsFrame);
+ mLayoutDayLabels = new Q3HBoxLayout(mDayLabels);
agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2);
agendaLayout->addWidget(mEventIndicatorTop,1,1);
mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
agendaFrame);
agendaLayout->addWidget(mEventIndicatorBottom,3,1);
QWidget *dummyAgendaRight = new QWidget(agendaFrame);
agendaLayout->addWidget(dummyAgendaRight,1,2);
// Create time labels
mTimeLabels = new TimeLabels(24,agendaFrame);
agendaLayout->addWidget(mTimeLabels,2,0);
connect(mTimeLabels,SIGNAL( scaleChanged()),
this,SLOT(updateConfig()));
// Create agenda
mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
agendaLayout->setColStretch(1,1);
- mAgenda->setFocusPolicy(NoFocus);
+ mAgenda->setFocusPolicy(Qt::NoFocus);
// Create event context menu for agenda
mAllAgendaPopup = eventPopup();
#if 0
- mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
+ mAllAgendaPopup->addAdditionalItem(QIcon(SmallIcon("bell")),
i18n("Toggle Alarm"),mAgenda,
SLOT(popupAlarm()),true);
#endif
connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
connect(mAllAgendaPopup,SIGNAL(categoryChanged(Incidence *)),
this,SLOT(categoryChanged(Incidence *)));
mAgenda->setPopup( mAllAgendaPopup );
mAllDayAgenda->setPopup( mAllAgendaPopup );
// make connections between dependent widgets
mTimeLabels->setAgenda(mAgenda);
// Update widgets to reflect user preferences
// updateConfig();
// createDayLabels();
// these blank widgets make the All Day Event box line up with the agenda
dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
// Scrolling
connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
mTimeLabels, SLOT(positionChanged()));
@@ -889,67 +901,67 @@ void KOAgendaView::createDayLabels()
dayLabel->setText(">");
dayLabel->setFont( dlf );
dayLabel->setAutoRepeat( true );
dayLabel->show();
dayLabel->setNum( -2 );
dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ widModulo );
//mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2);
if ( !appendLabels ) {
dayLabel = mDayLabelsList.next();
while ( dayLabel ) {
//qDebug("!dayLabel %d",dayLabel );
dayLabel->hide();
dayLabel = mDayLabelsList.next();
}
}
mDayLabelsFrame->setFixedHeight( newHight + 4 );
}
int KOAgendaView::maxDatesHint()
{
// Not sure about the max number of events, so return 0 for now.
return 0;
}
int KOAgendaView::currentDateCount()
{
return mSelectedDates.count();
}
-QPtrList<Incidence> KOAgendaView::selectedIncidences()
+Q3PtrList<Incidence> KOAgendaView::selectedIncidences()
{
- QPtrList<Incidence> selected;
+ Q3PtrList<Incidence> selected;
Incidence *incidence;
incidence = mAgenda->selectedIncidence();
if (incidence) selected.append(incidence);
incidence = mAllDayAgenda->selectedIncidence();
if (incidence) selected.append(incidence);
return selected;
}
DateList KOAgendaView::selectedDates()
{
DateList selected;
QDate qd;
qd = mAgenda->selectedIncidenceDate();
if (qd.isValid()) selected.append(qd);
qd = mAllDayAgenda->selectedIncidenceDate();
if (qd.isValid()) selected.append(qd);
return selected;
}
void KOAgendaView::updateView()
{
if ( mBlockUpdating )
return;
// kdDebug() << "KOAgendaView::updateView()" << endl;
fillAgenda();
@@ -958,66 +970,66 @@ void KOAgendaView::updateView()
/*
Update configuration settings for the agenda view. This method is not
complete.
*/
void KOAgendaView::updateConfig()
{
if ( mBlockUpdating )
return;
if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) {
int old = KOPrefs::instance()->mHourSize;
KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1;
//qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize );
}
// update config for children
mTimeLabels->updateConfig();
mAgenda->storePosition();
mAgenda->updateConfig();
mAllDayAgenda->updateConfig();
// widget synchronization
//TODO: find a better way, maybe signal/slot
mTimeLabels->positionChanged();
// for some reason, this needs to be called explicitly
mTimeLabels->repaint();
mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
// ToolTips displaying summary of events
- KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
- ->mEnableToolTips);
+ /* TODO:hacker: KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance()
+ ->mEnableToolTips); */
//setHolidayMasks();
//createDayLabels(); called by via updateView();
mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth());
updateView();
mAgenda->restorePosition();
}
void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
{
int xxx = item->cellX();
//qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() );
if ( xxx >= 0 && xxx < mMinY.count() && !item->isAllDay() ) {
if ( mMinY.at(xxx) > item->cellYTop() )
mMinY.at(xxx) = item->cellYTop();
if ( mMaxY.at(xxx) < item->cellYBottom() )
mMaxY.at(xxx) = item->cellYBottom();
}
QDateTime startDt,endDt;
QDate startDate;
int lenInSecs;
// if ( type == KOAgenda::RESIZETOP )
// qDebug("RESIZETOP ");
// if ( type == KOAgenda::RESIZEBOTTOM )
// qDebug("RESIZEBOTTOM ");
// if ( type == KOAgenda::MOVE )
// qDebug("MOVE ");
if ( item->incidence()->typeID() == eventID ) {
@@ -1088,117 +1100,117 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
}
//qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
item->incidence()->setRevision(item->incidence()->revision()+1);
item->setItemDate(startDt.date());
//item->updateItem();
if ( item->incidence()->typeID() == todoID ) {
emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
}
else
emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
item->updateItem();
}
void KOAgendaView::showDates( const QDate &start, const QDate &end )
{
// kdDebug() << "KOAgendaView::selectDates" << endl;
mSelectedDates.clear();
// qDebug("KOAgendaView::showDates ");
QDate d = start;
while (d <= end) {
mSelectedDates.append(d);
d = d.addDays( 1 );
}
// and update the view
fillAgenda();
}
-void KOAgendaView::showEvents(QPtrList<Event>)
+void KOAgendaView::showEvents(Q3PtrList<Event>)
{
kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
}
void KOAgendaView::changeEventDisplay(Event *, int)
{
// qDebug("KOAgendaView::changeEventDisplay ");
// kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
// this should be re-written to be MUCH smarter. Right now we
// are just playing dumb.
fillAgenda();
}
void KOAgendaView::fillAgenda(const QDate &)
{
// qDebug("KOAgendaView::fillAgenda ");
fillAgenda();
}
void KOAgendaView::fillAgenda()
{
if ( globalFlagBlockStartup )
return;
if ( globalFlagBlockAgenda == 1 )
return;
if ( flag_blockfillAgenda )
return;
flag_blockfillAgenda = true;
//if ( globalFlagBlockAgenda == 2 )
//globalFlagBlockAgenda = 0;
// globalFlagBlockPainting = false;
if ( globalFlagBlockAgenda == 0 )
globalFlagBlockAgenda = 1;
// clearView();
//qDebug("fillAgenda()++++ ");
globalFlagBlockAgendaItemPaint = 1;
mAllDayAgenda->changeColumns(mSelectedDates.count());
mAgenda->changeColumns(mSelectedDates.count());
qApp->processEvents();
mEventIndicatorTop->changeColumns(mSelectedDates.count());
mEventIndicatorBottom->changeColumns(mSelectedDates.count());
setHolidayMasks();
mMinY.resize(mSelectedDates.count());
mMaxY.resize(mSelectedDates.count());
- QPtrList<Event> dayEvents;
+ Q3PtrList<Event> dayEvents;
// ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
// Therefore, gtodoset all of them.
- QPtrList<Todo> todos = calendar()->todos();
+ Q3PtrList<Todo> todos = calendar()->todos();
mAgenda->setDateList(mSelectedDates);
QDate today = QDate::currentDate();
DateList::ConstIterator dit;
int curCol = 0;
int maxCol = mSelectedDates.count()-1;
for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
QDate currentDate = *dit;
// kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
// << endl;
dayEvents = calendar()->events(currentDate,false);
// Default values, which can never be reached
mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
unsigned int numEvent;
//qDebug("+++++NUMEVENT %d", dayEvents.count());
for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
Event *event = dayEvents.at(numEvent);
if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
if ( event->uid().left(15) == QString("last-syncEvent-") )
continue;
// kdDebug() << " Event: " << event->summary() << endl;
int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
// kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
@@ -1271,65 +1283,65 @@ void KOAgendaView::fillAgenda()
//qDebug("insert!!! ");
mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
}
if (beginX == curCol) {
mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
if (startY < mMinY[curCol]) mMinY[curCol] = startY;
} else if (endX == curCol) {
mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
} else {
mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
}
} else {
int startY = mAgenda->timeToY(event->dtStart().time());
int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
if (endY < startY) endY = startY;
mAgenda->insertItem(event,currentDate,curCol,startY,endY);
if (startY < mMinY[curCol]) mMinY[curCol] = startY;
if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
}
}
// ---------- [display Todos --------------
unsigned int numTodo;
for (numTodo = 0; numTodo < todos.count(); ++numTodo) {
Todo *todo = todos.at(numTodo);
if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date
if ( todo->hasCompletedDate() && !KOPrefs::instance()->mShowCompletedTodoInAgenda ) continue;
// ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
// Already completed items can be displayed on their original due date
//if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda
- bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
+ bool overdue = (!todo->isCompleted()) && (todo->dtDue() < (QDateTime)today) && KOPrefs::instance()->mShowTodoInAgenda;
bool fillIn = false;
if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
fillIn = true;
if ( ! fillIn && !todo->hasCompletedDate() )
fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
if ( fillIn ) {
if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
if ( KOPrefs::instance()->mShowTodoInAgenda )
mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
}
else {
QDateTime dt;
if ( todo->hasCompletedDate() )
dt = todo->completed();
else
dt = todo->dtDue();;
int endY = mAgenda->timeToY(dt.time()) - 1;
int hi = (18/KOPrefs::instance()->mHourSize);
//qDebug("hei %d ",KOPrefs::instance()->mHourSize);
int startY = endY -hi;
mAgenda->insertItem(todo,currentDate,curCol,startY,endY);
if (startY < mMinY[curCol]) mMinY[curCol] = startY;
if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
}
}
}
// ---------- display Todos] --------------
@@ -1474,103 +1486,103 @@ void KOAgendaView::updateEventIndicatorBottom(int newY)
uint i;
for(i=0;i<mMaxY.size();++i) {
if (newY <= mMaxY.at(i)) mEventIndicatorBottom->enableColumn(i,true);
else mEventIndicatorBottom->enableColumn(i,false);
}
mEventIndicatorBottom->update();
}
void KOAgendaView::startDrag(Event *event)
{
#ifndef KORG_NODND
DndFactory factory( calendar() );
ICalDrag *vd = factory.createDrag(event,this);
if (vd->drag()) {
kdDebug() << "KOAgendaView::startDrag(): Delete drag source" << endl;
}
#endif
}
void KOAgendaView::readSettings()
{
readSettings(KOGlobals::config());
}
void KOAgendaView::readSettings(KConfig *config)
{
// kdDebug() << "KOAgendaView::readSettings()" << endl;
config->setGroup("Views");
//#ifndef KORG_NOSPLITTER
- QValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
+ Q3ValueList<int> sizes = config->readIntListEntry("Separator AgendaView");
if (sizes.count() == 2) {
if ( sizes[0] < 20 ) {
sizes[1] = sizes[1] +20 - sizes[0];
sizes[0] = 20;
}
mSplitterAgenda->setSizes(sizes);
// qDebug("read %d %d ",sizes[0],sizes[1] );
}
//#endif
// updateConfig();
}
void KOAgendaView::writeSettings(KConfig *config)
{
// kdDebug() << "KOAgendaView::writeSettings()" << endl;
config->setGroup("Views");
//#ifndef KORG_NOSPLITTER
- QValueList<int> list = mSplitterAgenda->sizes();
+ Q3ValueList<int> list = mSplitterAgenda->sizes();
config->writeEntry("Separator AgendaView",list);
//qDebug("write %d %d ", list[0],list[1] );
//#endif
}
void KOAgendaView::setHolidayMasks()
{
mHolidayMask.resize(mSelectedDates.count());
uint i;
for(i=0;i<mSelectedDates.count();++i) {
QDate date = mSelectedDates[i];
bool showSaturday = KOPrefs::instance()->mExcludeSaturdays && (date.dayOfWeek() == 6);
bool showSunday = KOPrefs::instance()->mExcludeHolidays && (date.dayOfWeek() == 7);
bool showHoliday = false;
if ( KOPrefs::instance()->mExcludeHolidays ) {
- QPtrList<Event> events = calendar()->events( date, true );
+ Q3PtrList<Event> events = calendar()->events( date, true );
Event *event;
for( event = events.first(); event; event = events.next() ) {
if ( event->isHoliday()) {
showHoliday = true;
break;
}
}
}
#ifndef KORG_NOPLUGINS
bool showHoliday = KOPrefs::instance()->mExcludeHolidays &&
!KOCore::self()->holiday(date).isEmpty();
#endif
bool showDay = showSaturday || showSunday || showHoliday;
if (showDay) {
mHolidayMask.at(i) = true;
} else {
mHolidayMask.at(i) = false;
}
}
mAgenda->setHolidayMask(&mHolidayMask);
mAllDayAgenda->setHolidayMask(&mHolidayMask);
}
void KOAgendaView::setContentsPos(int y)
{
mAgenda->setContentsPos(0,y);
}
@@ -1634,59 +1646,59 @@ void KOAgendaView::scrollOneHourDown()
void KOAgendaView::setStartHour( int h )
{
mAgenda->setStartHour( h );
}
void KOAgendaView::setInitStartHour()
{
if ( KOPrefs::instance()->mCenterOnCurrentTime )
setStartHour( QTime::currentTime ().hour() );
else
setStartHour( KOPrefs::instance()->mDayBegins );
}
void KOAgendaView::updateTodo( Todo * t, int )
{
if ( !isVisible() )
return;
bool remove = false;
bool removeAD = false;
QDate da;
if ( t->hasCompletedDate() )
da = t->completed().date();
else
da = t->dtDue().date();
if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
remove = true;
removeAD = true;
}
else {
- bool overdue = (!t->isCompleted()) && (t->dtDue() < QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
+ bool overdue = (!t->isCompleted()) && (t->dtDue() < (QDateTime)QDate::currentDate()) && KOPrefs::instance()->mShowTodoInAgenda ;
if ( overdue &&
QDate::currentDate() >= mSelectedDates.first() &&
QDate::currentDate() <= mSelectedDates.last()) {
removeAD = false;
remove = true;
}
else {
if ( da < mSelectedDates.first() ||
da > mSelectedDates.last() ) {
remove = true;
removeAD = true;
} else {
remove = t->doesFloat() && !t->hasCompletedDate();
removeAD = !remove;
}
}
}
int days = mSelectedDates.first().daysTo( da );
//qDebug("daysto %d %d %d", days, remove,removeAD );
mAgenda->updateTodo( t , days, remove);
if ( KOPrefs::instance()->mShowTodoInAgenda )
mAllDayAgenda->updateTodo( t , days, removeAD);
//qDebug("KOAgendaView::updateTodo( Todo *, int ) ");
}
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 5e68146..3b871d9 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -1,220 +1,230 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOAGENDAVIEW_H
#define KOAGENDAVIEW_H
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include <qdatetime.h>
#include <qpushbutton.h>
#include <qlayout.h>
+#include <Q3BoxLayout>
#ifndef DESKTOP_VERSION
#include <qksplitter.h>
#else
#include <qsplitter.h>
#endif
-#include <qmemarray.h>
+#include <q3memarray.h>
+//Added by qt3to4:
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <Q3Frame>
+#include <QPixmap>
+#include <QLabel>
+#include <QMouseEvent>
+#include <Q3PtrList>
+#include <QKeyEvent>
#include "koeventview.h"
-class QHBox;
-class QFrame;
+class Q3HBox;
+class Q3Frame;
class QLabel;
class QPushButton;
class CalendarView;
class KOAgenda;
class KOAgendaItem;
class KConfig;
class KDGanttMinimizeSplitter;
class KOAgendaButton : public QPushButton
{
Q_OBJECT
public:
KOAgendaButton( QWidget *parent=0, const char *name=0 ) :
QPushButton( parent, name )
{
mNum = -3;
setFlat( true );
- setFocusPolicy(NoFocus);
+ setFocusPolicy(Qt::NoFocus);
setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding ));
connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) );
};
QSize sizeHint () const { return QSize( 5,5) ;}
void setNum( int n) { mNum = n; }
private slots:
void bClicked() {emit numClicked( mNum);}
signals:
void numClicked( int );
private:
int mNum;
};
-class TimeLabels : public QScrollView {
+class TimeLabels : public Q3ScrollView {
Q_OBJECT
public:
- TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0);
+ TimeLabels(int rows,QWidget *parent=0,const char *name=0,Qt::WFlags f=0);
void setCellHeight(int height);
/** Calculates the minimum width */
virtual int minimumWidth() const;
/** updates widget's internal state */
void updateConfig();
/** */
void setAgenda(KOAgenda* agenda);
/** */
virtual void paintEvent(QPaintEvent* e);
void contentsMousePressEvent ( QMouseEvent * ) ;
void contentsMouseReleaseEvent ( QMouseEvent * );
void contentsMouseMoveEvent ( QMouseEvent * );
public slots:
/** update time label positions */
void positionChanged();
signals:
void scaleChanged();
protected:
void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
private:
QPixmap myPix;
bool mRedrawNeeded;
int mMiniWidth;
int mMouseDownY;
QString mOrgCap;
int mRows;
int mCellHeight;
/** */
KOAgenda* mAgenda;
};
-class EventIndicator : public QFrame {
+class EventIndicator : public Q3Frame {
Q_OBJECT
public:
enum Location { Top, Bottom };
EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
virtual ~EventIndicator();
void changeColumns(int columns);
void setPaintWidget( KDGanttMinimizeSplitter* );
void setXOffset( int );
void enableColumn(int column, bool enable);
protected:
void drawContents(QPainter *);
private:
int mXOffset;
KDGanttMinimizeSplitter* mPaintWidget;
int mColumns;
- QHBox *mTopBox;
- QBoxLayout *mTopLayout;
+ Q3HBox *mTopBox;
+ Q3BoxLayout *mTopLayout;
Location mLocation;
QPixmap mPixmap;
- QMemArray<bool> mEnabled;
+ Q3MemArray<bool> mEnabled;
};
/**
KOAgendaView is the agenda-like view used to display events in an one or
multi-day view.
*/
class KOAgendaView : public KOEventView {
Q_OBJECT
public:
KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
virtual ~KOAgendaView();
void setStartHour( int );
void toggleAllDay();
/** Returns maximum number of days supported by the koagendaview */
virtual int maxDatesHint();
/** Returns number of currently shown dates. */
virtual int currentDateCount();
/** returns the currently selected events */
- virtual QPtrList<Incidence> selectedIncidences();
+ virtual Q3PtrList<Incidence> selectedIncidences();
/** returns the currently selected events */
virtual DateList selectedDates();
/** Remove all events from view */
void clearView();
void clearList();
KOAgenda *agenda() { return mAgenda;}
virtual void printPreview(CalPrinter *calPrinter,
const QDate &, const QDate &);
/** start-datetime of selection */
QDateTime selectionStart() {return mTimeSpanBegin;}
/** end-datetime of selection */
QDateTime selectionEnd() {return mTimeSpanEnd;}
/** returns true if selection is for whole day */
bool selectedIsAllDay() {return mTimeSpanInAllDay;}
/** make selected start/end invalid */
void deleteSelectedDateTime();
void repaintAgenda();
public slots:
void setInitStartHour();
virtual void updateView();
virtual void updateConfig();
virtual void showDates(const QDate &start, const QDate &end);
- virtual void showEvents(QPtrList<Event> eventList);
+ virtual void showEvents(Q3PtrList<Event> eventList);
void updateTodo( Todo *, int );
void changeEventDisplay(Event *, int);
void clearSelection();
void newTodo(int gx,int gy);
void newEvent(int gx,int gy);
void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd);
void newEventAllDay(int gx, int gy);
void newTodoAllDay(int gx, int gy);
void startDrag(Event *);
void readSettings();
void readSettings(KConfig *);
void writeSettings(KConfig *);
void setContentsPos(int y);
void scrollOneHourUp();
void scrollOneHourDown();
void addToCalSlot(Incidence *, Incidence *);
void slotShowDateView( int, int );
void fillAgenda();
void startIdleTimeout();
signals:
void showDateView( int, QDate );
void newTodoSignal( QDateTime ,bool );
void toggleExpand();
void selectWeekNum( int );
@@ -231,69 +241,69 @@ class KOAgendaView : public KOEventView {
void resizeEvent( QResizeEvent* e );
/** Fill agenda using the current set value for the start date */
/** Create labels for the selected dates. */
void createDayLabels();
/**
Set the masks on the agenda widgets indicating, which days are holidays.
*/
void setHolidayMasks();
protected slots:
void slotIdleTimeout();
void categoryChanged( Incidence * );
void slotDaylabelClicked( int );
/** Update event belonging to agenda item */
void updateEventDates(KOAgendaItem *item, int mode = -1);
//void updateMovedTodo();
void updateEventIndicatorTop(int newY);
void updateEventIndicatorBottom(int newY);
/** Updates data for selected timespan */
void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
/** Updates data for selected timespan for all day event*/
void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
private:
bool flag_blockfillAgenda;
QTimer* mIdleTimer;
QDateTime mIdleStart;
// view widgets
- QFrame *mDayLabels;
- QHBox *mDayLabelsFrame;
- QBoxLayout *mLayoutDayLabels;
- QFrame *mAllDayFrame;
+ Q3Frame *mDayLabels;
+ Q3HBox *mDayLabelsFrame;
+ Q3BoxLayout *mLayoutDayLabels;
+ Q3Frame *mAllDayFrame;
KOAgenda *mAllDayAgenda;
KOAgenda *mAgenda;
TimeLabels *mTimeLabels;
QWidget *mDummyAllDayLeft;
KDGanttMinimizeSplitter* mSplitterAgenda;
QPushButton *mExpandButton;
DateList mSelectedDates; // List of dates to be displayed
int mViewType;
bool mWeekStartsMonday;
int mStartHour;
KOEventPopupMenu *mAllAgendaPopup;
//KOEventPopupMenu *mAllDayAgendaPopup;
EventIndicator *mEventIndicatorTop;
EventIndicator *mEventIndicatorBottom;
- QMemArray<int> mMinY;
- QMemArray<int> mMaxY;
+ Q3MemArray<int> mMinY;
+ Q3MemArray<int> mMaxY;
- QMemArray<bool> mHolidayMask;
+ Q3MemArray<bool> mHolidayMask;
- QPtrList<KOAgendaButton> mDayLabelsList;
+ Q3PtrList<KOAgendaButton> mDayLabelsList;
QDateTime mTimeSpanBegin;
QDateTime mTimeSpanEnd;
bool mTimeSpanInAllDay;
void keyPressEvent ( QKeyEvent * e );
};
#endif // KOAGENDAVIEW_H
diff --git a/korganizer/kocounterdialog.h b/korganizer/kocounterdialog.h
index c8dcf45..493d9e1 100644
--- a/korganizer/kocounterdialog.h
+++ b/korganizer/kocounterdialog.h
@@ -1,50 +1,50 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOCOUNTERDIALOG_H
#define KOCOUNTERDIALOG_H
//
// Viewer dialog for counter events.
//
-#include <qtextview.h>
+#include <q3textview.h>
#include <kdialogbase.h>
#include <libkcal/event.h>
using namespace KCal;
class KOEventViewer;
class KOCounterDialog : public KDialogBase {
Q_OBJECT
public:
KOCounterDialog(QWidget *parent=0,const char *name=0);
virtual ~KOCounterDialog();
void setEvent(Event *event);
void addEvent(Event *event);
void setTodo(Todo *event);
void addText(QString text);
private:
KOEventViewer *mEventViewer;
};
#endif
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 52fd1e8..4f681b3 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,255 +1,264 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
Parts of the source code have been copied from kdpdatebutton.cpp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source ode for Qt in the source distribution.
*/
#include <qevent.h>
#include <qpainter.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qtimer.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <QDragLeaveEvent>
+#include <Q3Frame>
+#include <QDragEnterEvent>
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QPaintEvent>
#include <kglobal.h>
#include <kdebug.h>
#include <klocale.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/icaldrag.h>
#include <libkcal/dndfactory.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include <kcalendarsystem.h>
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include "koprefs.h"
#include "koglobals.h"
#include "kodaymatrix.h"
// ============================================================================
// D Y N A M I C T I P
// ============================================================================
DynamicTip::DynamicTip( QWidget * parent )
- : QToolTip( parent )
+ /* TODO:hacker: : QToolTip( parent ) */
{
matrix = (KODayMatrix*)parent;
}
-class KODaymatrixWhatsThis :public QWhatsThis
+class KODaymatrixWhatsThis :public Q3WhatsThis
{
public:
- KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;};
+ KODaymatrixWhatsThis( KODayMatrix* view ) : Q3WhatsThis( view ),_view (view) { ;};
~KODaymatrixWhatsThis() { ; };
protected:
virtual QString text( const QPoint& p )
{
return _view->getWhatsThisText( p ) ;
}
private:
KODayMatrix * _view;
};
void DynamicTip::maybeTip( const QPoint &pos )
{
//calculate which cell of the matrix the mouse is in
QRect sz = matrix->frameRect();
int dheight = sz.height()*7 / 42;
int dwidth = sz.width() / 7;
int row = pos.y()/dheight;
int col = pos.x()/dwidth;
QRect rct(col*dwidth, row*dheight, dwidth, dheight);
// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
// col << "][" << row << "] => " <<(col+row*7) << endl;
//show holiday names only
QString str = matrix->getHolidayLabel(col+row*7);
if (str.isEmpty()) return;
- tip(rct, str);
+ /* TODO:hacker: tip(rct, str);*/
}
// ============================================================================
// K O D A Y M A T R I X
// ============================================================================
const int KODayMatrix::NOSELECTION = -1000;
const int KODayMatrix::NUMDAYS = 42;
KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
- : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
+ : Q3Frame( parent, name , Qt::WNoAutoErase ), mCalendar( 0 )
{
mLastView = -1;
oldW = 0;
oldH = 0;
myPix.resize( 150, 120 );
mRedrawNeeded = true;
mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
mPendingUpdateBeforeRepaint = false;
mouseDown = false;
// initialize dynamic arrays
bDays.resize ( NUMDAYS );
pDays.resize ( NUMDAYS );
hDays.resize ( NUMDAYS );
eDays.resize ( NUMDAYS );
days = new QDate[NUMDAYS];
daylbls = new QString[NUMDAYS];
//events = new int[NUMDAYS];
mToolTip = new DynamicTip(this);
// set default values used for drawing the matrix
mDefaultBackColor = palette().active().base();
mDefaultTextColor = palette().active().foreground();
mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
mSelectedDaysColor = QColor("white");
mTodayMarginWidth = 2;
mSelEnd = mSelStart = NOSELECTION;
setAcceptDrops(true);
//setFont( QFont("Arial", 10) );
mUpdateTimer = new QTimer( this );
connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
mRepaintTimer = new QTimer( this );
connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
mDayChanged = false;
updateView();
}
QString KODayMatrix::getWhatsThisText( QPoint p )
{
int tmp = getDayIndexFrom(p.x(), p.y());
if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
return QString();
QDate mDate = days[tmp];
- QPtrList<Event> eventlist = mCalendar->events(mDate);
+ Q3PtrList<Event> eventlist = mCalendar->events(mDate);
Event *event;
QStringList mToolTip;
for(event=eventlist.first();event != 0;event=eventlist.next()) {
QString mToolTipText;
QString text;
int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
if (event->isMultiDay()) {
QString prefix = "<->";multiday = 2;
QString time;
if ( event->doesRecur() ) {
if ( event->recursOn( mDate) ) {
prefix ="->" ;multiday = 1;
}
else {
int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
if ( event->recursOn( mDate.addDays( -days)) ) {
prefix ="<-" ;multiday = 3;
}
}
} else {
if (mDate == event->dtStart().date()) {
prefix ="->" ;multiday = 1;
} else if (mDate == event->dtEnd().date()) {
prefix ="<-" ;multiday = 3;
}
}
if ( !event->doesFloat() ) {
if ( mDate == event->dtStart().date () )
time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
else if ( mDate == event->dtEnd().date () )
time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
}
text = time + event->summary();
mToolTipText += prefix + text;
} else {
if (event->doesFloat()) {
text = event->summary();
mToolTipText += text;
}
else {
text = KGlobal::locale()->formatTime(event->dtStart().time());
text += " " + event->summary();
mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
}
}
if ( !event->location().isEmpty() )
mToolTipText += " (" + event->location() + ")";
//qDebug("TTT: %s ", mToolTipText.latin1());
mToolTip.append( deTag( mToolTipText ) );
}
mToolTip.sort();
if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
- QPtrList<Todo> todolist = mCalendar->todos(mDate);
+ Q3PtrList<Todo> todolist = mCalendar->todos(mDate);
Todo *todo;
for(todo=todolist.first();todo != 0;todo=todolist.next()) {
QString mToolTipText;
if ( !todo->doesFloat() )
mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
mToolTipText += todo->summary();
if ( !todo->location().isEmpty() )
mToolTipText += " (" + todo->location() + ")";
mToolTipText = deTag( mToolTipText);
mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
mToolTip.append( mToolTipText );
}
}
if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
- QPtrList<Journal> j_list = mCalendar->journals4Date( mDate );
+ Q3PtrList<Journal> j_list = mCalendar->journals4Date( mDate );
Journal *j = j_list.first();
while ( j ) {
QString mToolTipText;
if ( !j->summary().isEmpty() ) {
mToolTipText = j->summary().left(30);
if ( j->summary().length() > 30 )
mToolTipText += " ...";
} else {
mToolTipText = j->description().left(25);
if ( j->description().length() > 25 )
mToolTipText += " ...";
mToolTipText = deTag( mToolTipText);
}
mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
mToolTip.append( mToolTipText );
j = j_list.next();
}
}
return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
}
QString KODayMatrix::deTag( QString mToolTipText )
{
#if QT_VERSION >= 0x030000
mToolTipText.replace( '<' , "&lt;" );
mToolTipText.replace( '>' , "&gt;" );
#else
if ( mToolTipText.find ('<') >= 0 ) {
mToolTipText.replace( QRegExp("<") , "&lt;" );
}
@@ -412,65 +421,65 @@ void KODayMatrix::computeEvent(Event *event, int i )
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
mHolidays[i] =holiStr ;
eDays.setBit(i);
}
if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) {
if ( event->isBirthday()) {
pDays.setBit(i);
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += i18n("Birthday") + ": "+event->summary();
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
bDays.setBit(i);
mHolidays[i] =holiStr ;
}
}
if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW )
eDays.setBit(i);
}
void KODayMatrix::updateViewTimed()
{
mUpdateTimer->stop();
if ( !mCalendar ) {
qDebug("NOT CAL ");
return;
}
#if 1
int i;
int timeSpan = NUMDAYS-1;
- QPtrList<Event> events = mCalendar->events();
+ Q3PtrList<Event> events = mCalendar->events();
Event *event;
QDateTime dt;
bool ok;
bDays.fill( false);
pDays.fill( false);
hDays.fill( false);
eDays.fill( false);
mHolidays.clear();
QDate mStartDate = days[0];
QDate endDate = mStartDate.addDays( timeSpan );
for( event = events.first(); event; event = events.next() ) { // for event
ushort recurType = event->doesRecur();
if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
(recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
continue;
}
if ( !KOPrefs::instance()->mLongAllday && event->doesFloat()&& event->isMultiDay() ) {
continue;
}
if ( event->doesRecur() ) {
bool last;
QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
QDateTime incidenceEnd;
int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
bool invalid = false;
while( true ) {
if ( incidenceStart.isValid() ) {
incidenceEnd = incidenceStart.addDays( eventlen );
int st = incidenceStart.date().daysTo( endDate );
if ( st >= 0 ) { // start before timeend
int end = mStartDate.daysTo( incidenceEnd.date() );
if ( end >= 0 ) { // end after timestart --- got one!
@@ -497,114 +506,114 @@ void KODayMatrix::updateViewTimed()
bool ok;
incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
if ( ! ok )
break;
if ( incidenceStart.date() > endDate )
break;
}
} else { // no recur
int st = event->dtStart().date().daysTo( endDate );
if ( st >= 0 ) { // start before timeend
int end = mStartDate.daysTo( event->dtEnd().date() );
if ( end >= 0 ) { // end after timestart --- got one!
//normalize
st = timeSpan - st;
if ( st < 0 ) st = 0;
if ( end > timeSpan ) end = timeSpan;
int iii;
for ( iii = st;iii<= end;++iii)
computeEvent( event, iii );
}
}
}
}
int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
for(i = 0; i < NUMDAYS; i++) {
if ( ( (i+startDay) % 7 == 0 ) ) {
pDays.setBit(i);
}
}
if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
bDays.fill( false);
// insert due todos
- QPtrList<Todo> todos = mCalendar->todos( );
+ Q3PtrList<Todo> todos = mCalendar->todos( );
Todo *todo;
for(todo = todos.first(); todo; todo = todos.next()) {
//insertTodo( todo );
if ( todo->hasDueDate() ) {
int day = mStartDate.daysTo( todo->dtDue().date() );
if ( day >= 0 && day < timeSpan + 1) {
int i = day;
QString holiStr = mHolidays[i];
pDays.setBit(i);
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += i18n("Todo") + ": "+todo->summary();
if ( !todo->location().isEmpty() )
holiStr += " (" + todo->location() + ")";
bDays.setBit(i);
mHolidays[i] =holiStr ;
eDays.setBit(i);
}
}
}
}
if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
bDays.fill( false);
// insert due todos
- QPtrList<Journal> todos = mCalendar->journals( );
+ Q3PtrList<Journal> todos = mCalendar->journals( );
Journal *todo;
for(todo = todos.first(); todo; todo = todos.next()) {
int day = mStartDate.daysTo( todo->dtStart().date() );
if ( day >= 0 && day < timeSpan + 1) {
int i = day;
QString holiStr = mHolidays[i];
pDays.setBit(i);
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += i18n("Journal: ")+todo->summary().left(25);
if ( todo->summary().length() > 25 )
holiStr +="...";
bDays.setBit(i);
mHolidays[i] =holiStr ;
eDays.setBit(i);
}
}
}
#else
//qDebug("KODayMatrix::updateViewTimed ");
for(int i = 0; i < NUMDAYS; i++) {
// if events are set for the day then remember to draw it bold
- QPtrList<Event> eventlist = mCalendar->events(days[i]);
+ Q3PtrList<Event> eventlist = mCalendar->events(days[i]);
Event *event;
int numEvents = eventlist.count();
QString holiStr = "";
bDays.clearBit(i);
hDays.clearBit(i);
eDays.clearBit(i);
for(event=eventlist.first();event != 0;event=eventlist.next()) {
ushort recurType = event->recurrence()->doesRecur();
if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
(recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
numEvents--;
}
if ( event->isHoliday()) {
hDays.setBit(i);
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += event->summary();
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
}
if ( event->isBirthday()) {
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += i18n("Birthday") + ": "+event->summary();
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
bDays.setBit(i);
}
}
if ( numEvents )
eDays.setBit(i);
//if it is a holy day then draw it red. Sundays are consider holidays, too
@@ -646,142 +655,142 @@ void KODayMatrix::updateView(QDate actdate)
// otherwise, for month forward and backward, it must be avoided
if( mSelStart > NUMDAYS || mSelStart < 0 )
mSelStart = mSelStart + tmp;
if( mSelEnd > NUMDAYS || mSelEnd < 0 )
mSelEnd = mSelEnd + tmp;
}
}
startdate = actdate;
mDayChanged = true;
recalculateToday();
mRedrawNeeded = true;
}
//qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
if ( !isVisible() ) {
mPendingUpdateBeforeRepaint = true;
} else {
#ifdef DESKTOP_VERSION
//mRepaintTimer->start( 100 );
//updateViewTimed();
mUpdateTimer->start( 50 );
#else
mRepaintTimer->start( 250 );
mUpdateTimer->start( 500 );
#endif
}
}
void KODayMatrix::updateEvents()
{
if ( !mCalendar ) return;
for( int i = 0; i < NUMDAYS; i++ ) {
// if events are set for the day then remember to draw it bold
- QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
+ Q3PtrList<Event> eventlist = mCalendar->events( days[ i ] );
int numEvents = eventlist.count();
Event *event;
for( event = eventlist.first(); event != 0;event=eventlist.next()) {
ushort recurType = event->doesRecur();
if ( ( recurType == Recurrence::rDaily &&
!KOPrefs::instance()->mDailyRecur ) ||
( recurType == Recurrence::rWeekly &&
!KOPrefs::instance()->mWeeklyRecur ) ) {
numEvents--;
}
if ( !KOPrefs::instance()->mLongAllday && event->doesFloat()&& event->isMultiDay() ) {
numEvents--;
}
}
if ( numEvents )
eDays.setBit(i);
else
eDays.clearBit(i);
}
}
const QDate& KODayMatrix::getDate(int offset)
{
if (offset < 0 || offset > NUMDAYS-1) {
qDebug("Wrong offset2 %d", offset);
return days[0];
}
return days[offset];
}
QString KODayMatrix::getHolidayLabel(int offset)
{
if (offset < 0 || offset > NUMDAYS-1) {
qDebug("Wrong offset1 %d", offset);
return QString();
}
return mHolidays[offset];
}
int KODayMatrix::getDayIndexFrom(int x, int y)
{
int colModulo = (width()-2) % 7;
int rowModulo = (height()-2) % 6;
#if 0
return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ?
6 - x/daysize.width() : x/daysize.width());
#endif
int xVal = (x-colModulo/2-2)/daysize.width();
int yVal = (y-rowModulo/2-2)/daysize.height();
return 7*(yVal) + xVal;
}
// ----------------------------------------------------------------------------
// M O U S E E V E N T H A N D L I N G
// ----------------------------------------------------------------------------
void KODayMatrix::mousePressEvent (QMouseEvent* e)
{
- if ( e->button() == LeftButton )
+ if ( e->button() == Qt::LeftButton )
mouseDown = true;
mSelStart = getDayIndexFrom(e->x(), e->y());
if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1;
mSelInit = mSelStart;
mSelEnd = mSelStart;
mRedrawNeeded = true;
repaint(false);
}
void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
{
mRedrawNeeded = true;
- if ( e->button() == LeftButton )
+ if ( e->button() == Qt::LeftButton )
if ( ! mouseDown ) {
return;
}
else
mouseDown = false;
int tmp = getDayIndexFrom(e->x(), e->y());
if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
if (mSelInit > tmp) {
mSelEnd = mSelInit;
if (tmp != mSelStart) {
mSelStart = tmp;
repaint(false);
}
} else {
mSelStart = mSelInit;
//repaint only if selection has changed
if (tmp != mSelEnd) {
mSelEnd = tmp;
repaint(false);
}
}
DateList daylist;
if ( mSelStart < 0 )
mSelStart = 0;
for (int i = mSelStart; i <= mSelEnd; i++) {
daylist.append(days[i]);
}
emit selected((const DateList)daylist);
@@ -1166,58 +1175,58 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
if ( colModulo ) {
if ( col >= 7 - colModulo )
addCol = col - 7 + colModulo;
}
if ( rowModulo ) {
if ( row >= 6 - rowModulo )
addRow = row - 5 + rowModulo;
}
//qDebug("add %d %d -- %d %d ", col, addCol, row, addRow);
++addCol;//++addCol;
if ( row == 0)
addRow = 1;
p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight,
Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]);
// reset color to actual color
if (pDays.testBit(i)) {
p.setPen(actcol);
}
// reset bold font to plain font
if ( eDays.testBit(i)) {
QFont myFont = font();
myFont.setBold(false);
p.setFont(myFont);
}
}
p.setPen(mDefaultTextColor);
p.drawRect(0, 0, width(), height());
} else {
//qDebug("NO redraw ");
}
- bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,CopyROP);
+ bitBlt (this, pevent->rect().topLeft(), &myPix , pevent->rect() ,QPainter::CompositionMode_Source);
mRedrawNeeded = false;
}
// ----------------------------------------------------------------------------
// R E SI Z E E V E N T H A N D L I N G
// ----------------------------------------------------------------------------
void KODayMatrix::resizeEvent(QResizeEvent * e)
{
QRect sz = frameRect();
daysize.setHeight(sz.height()*7 / NUMDAYS);
daysize.setWidth(sz.width() / 7);
- QFrame::resizeEvent( e );
+ Q3Frame::resizeEvent( e );
}
QSize KODayMatrix::sizeHint() const
{
QFontMetrics fm ( font() );
int wid = fm.width( "30") *7+3;
int hei = fm.height() * 6+3;
//qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei);
return QSize ( wid, hei );
}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index b96e08f..6edf7cd 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -1,138 +1,146 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KODAYMAT_H
#define _KODAYMAT_H
#include <libkcal/calendar.h>
#include <qstring.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qcolor.h>
#include <qpen.h>
#include <qdatetime.h>
#include <qtooltip.h>
#include <qpixmap.h>
#include <qbitarray.h>
#include <qmap.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QDragLeaveEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QDragEnterEvent>
class QDragEnterEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;
class KODayMatrix;
class KODaymatrixWhatsThis;
using namespace KCal;
/**
* small helper class to dynamically show tooltips inside the day matrix.
* This class asks the day matrix object for a appropriate label which
* is in our special case the name of the holiday or null if this day is no holiday.
*/
-class DynamicTip : public QToolTip
+class DynamicTip /* TODO:hacker: : public QToolTip */
{
public:
/**
* Constructor that expects a KODayMatrix object as parent.
*
* @param parent the parent KODayMatrix control.
*/
DynamicTip(QWidget* parent );
protected:
/**
* Qt's callback to ask the object to provide an approrpiate text for the
* tooltip to be shown.
*
* @param pos coordinates of the mouse.
*/
void maybeTip( const QPoint & pos);
private:
/** the parent control this tooltip is designed for. */
KODayMatrix* matrix;
};
/**
* replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed.
* Cornelius thought this was a waste of memory and a lot of overhead.
* In addition the selection was not very intuitive so I decided to rewrite it using a QFrame
* that draws the labels and allows for dragging selection while maintaining nearly full
* compatibility in behaviour with its predecessor.
*
* The following functionality has been changed:
*
* o when shifting events in the agenda view from one day to another the day matrix is updated now
* o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date.
* o no support for Ctrl+click to create groups of dates
* (This has not really been supported in the predecessor. It was not very intuitive nor was it
* user friendly.)
* This feature has been replaced with dragging a selection on the matrix. The matrix will
* automatically choose the appropriate selection (e.g. you are not any longer able to select
* two distinct groups of date selections as in the old class)
* o now that you can select more then a week it can happen that not all selected days are
* displayed in the matrix. However this is preferred to the alternative which would mean to
* adjust the selection and leave some days undisplayed while scrolling through the months
*
* @short day matrix widget of the KDateNavigator
*
* @author Eitzenberger Thomas
*/
-class KODayMatrix: public QFrame {
+class KODayMatrix: public Q3Frame {
Q_OBJECT
public:
/** constructor to create a day matrix widget.
*
* @param parent widget that is the parent of the day matrix. Normally this should
* be a KDateNavigator
* @param calendar instance of a calendar on which all calculations are based
* @param date start date of the matrix (is expected to be already fixed). It is
* assumed that this date is the first week day to be shown in the matrix.
* @param name name of the widget
*/
KODayMatrix( QWidget *parent, const char *name );
//KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
/** destructor that deallocates all dynamically allocated private members.
*/
~KODayMatrix();
/** updates the day matrix to start with the given date. Does all the necessary
* checks for holidays or events on a day and stores them for display later on.
* Does NOT update the view visually. Call repaint() for this.
*
* @param actdate recalculates the day matrix to show NUMDAYS starting from this
* date.
*/
void updateView(QDate actdate);
void updateEvents();
/** returns the QDate object associated with day indexed by the
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp
index ea30fac..deb1e46 100644
--- a/korganizer/kodialogmanager.cpp
+++ b/korganizer/kodialogmanager.cpp
@@ -12,64 +12,66 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <libkdepim/categoryeditdialog.h>
#include "calendarview.h"
#include "incomingdialog.h"
#include "outgoingdialog.h"
#include "koprefsdialog.h"
#include "koeventeditor.h"
#include "koprefs.h"
#include "datenavigator.h"
#include "kotodoeditor.h"
#include "searchdialog.h"
#include "filtereditdialog.h"
#ifndef KORG_NOPLUGINS
#include "plugindialog.h"
#endif
#ifndef KORG_NOARCHIVE
#include "archivedialog.h"
#endif
#include "kconfig.h"
#include "kodialogmanager.h"
#include <kapplication.h>
+//Added by qt3to4:
+#include <Q3PtrList>
KODialogManager::KODialogManager( CalendarView *mainView ) :
QObject(), mMainView( mainView )
{
mOutgoingDialog = 0;
mIncomingDialog = 0;
mOptionsDialog = 0;
mSearchDialog = 0;
mArchiveDialog = 0;
mFilterEditDialog = 0;
mPluginDialog = 0;
// mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView);
//KOGlobals::fitDialogToScreen( mCategoryEditDialog );
}
KODialogManager::~KODialogManager()
{
delete mOutgoingDialog;
delete mIncomingDialog;
delete mOptionsDialog;
delete mSearchDialog;
#ifndef KORG_NOARCHIVE
delete mArchiveDialog;
#endif
delete mFilterEditDialog;
#ifndef KORG_NOPLUGINS
delete mPluginDialog;
#endif
}
OutgoingDialog *KODialogManager::outgoingDialog()
@@ -159,123 +161,123 @@ void KODialogManager::showIncomingDialog()
mIncomingDialog->raise();
}
/*
void KODialogManager::showCategoryEditDialog()
{
mCategoryEditDialog->show();
}
*/
void KODialogManager::hideSearchDialog()
{
if (mSearchDialog)
mSearchDialog->hide();
}
void KODialogManager::showSearchDialog()
{
if (!mSearchDialog) {
mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView);
KOListView * lview = mSearchDialog->listview();
connect(lview, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(lview, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)),
mMainView, SLOT(cloneIncidence(Incidence *)));
connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)),
mMainView, SLOT(beamIncidence(Incidence *)));
connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)),
mMainView, SLOT(moveIncidence(Incidence *)));
- connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )),
- mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> )));
+ connect(lview, SIGNAL(beamIncidenceList(Q3PtrList<Incidence> )),
+ mMainView, SLOT(beamIncidenceList(Q3PtrList<Incidence> )));
connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig()));
connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList()));
// connect( lview, SIGNAL( incidenceSelected( Incidence * ) ),
// mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
#ifndef DESKTOP_VERSION
mSearchDialog->setMaximumSize( QApplication::desktop()->size());
mSearchDialog->showMaximized();
#else
KConfig *config = KOGlobals::config();
config->setGroup("WidgetLayout");
QStringList list;
list = config->readListEntry("SearchLayout");
int x,y,w,h;
if ( ! list.isEmpty() ) {
x = list[0].toInt();
y = list[1].toInt();
w = list[2].toInt();
h = list[3].toInt();
KApplication::testCoords( &x,&y,&w,&h );
mSearchDialog->setGeometry(x,y,w,h);
}
#endif
}
// make sure the widget is on top again
#ifdef DESKTOP_VERSION
mSearchDialog->show();
#else
mSearchDialog->setMaximumSize( QApplication::desktop()->size());
mSearchDialog->showMaximized();
#endif
mSearchDialog->raiseAndSelect();
}
SearchDialog * KODialogManager::getSearchDialog()
{
return mSearchDialog;
}
void KODialogManager::showArchiveDialog()
{
#ifndef KORG_NOARCHIVE
if (!mArchiveDialog) {
mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView);
connect(mArchiveDialog,SIGNAL(eventsDeleted()),
mMainView,SLOT(updateView()));
}
mArchiveDialog->show();
mArchiveDialog->raise();
// Workaround.
QApplication::restoreOverrideCursor();
#endif
}
-void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters)
+void KODialogManager::showFilterEditDialog(Q3PtrList<CalFilter> *filters)
{
if (!mFilterEditDialog) {
mFilterEditDialog = new FilterEditDialog(filters,mMainView);
connect(mFilterEditDialog,SIGNAL(filterChanged()),
mMainView,SLOT(filterEdited()));
}
#ifndef DESKTOP_VERSION
mFilterEditDialog->showMaximized();
#else
mFilterEditDialog->show();
#endif
mFilterEditDialog->raise();
}
void KODialogManager::showPluginDialog()
{
#ifndef KORG_NOPLUGINS
if (!mPluginDialog) {
mPluginDialog = new PluginDialog(mMainView);
connect(mPluginDialog,SIGNAL(configChanged()),
mMainView,SLOT(updateConfig()));
}
mPluginDialog->show();
mPluginDialog->raise();
#endif
}
KOEventEditor *KODialogManager::getEventEditor()
{
KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(),
diff --git a/korganizer/kodialogmanager.h b/korganizer/kodialogmanager.h
index b68ddc2..00ad1df 100644
--- a/korganizer/kodialogmanager.h
+++ b/korganizer/kodialogmanager.h
@@ -1,101 +1,101 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001
Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KODIALOGMANAGER_H
#define KODIALOGMANAGER_H
#include <qobject.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <libkcal/calfilter.h>
class CalendarView;
class OutgoingDialog;
class IncomingDialog;
class KOPrefsDialog;
//namespace KPIM { class CategoryEditDialog; }
class KOEventEditor;
class KOTodoEditor;
class SearchDialog;
class ArchiveDialog;
class PluginDialog;
class KConfig;
class FilterEditDialog;
using namespace KCal;
/**
This class manages the dialogs used by the calendar view. It owns the objects
and handles creation and selection.
*/
class KODialogManager : public QObject
{
Q_OBJECT
public:
KODialogManager( CalendarView * );
virtual ~KODialogManager();
/** Get an editor dialog for an Event. */
KOEventEditor *getEventEditor();
/** Get an editor dialog for a Todo. */
KOTodoEditor *getTodoEditor();
OutgoingDialog *outgoingDialog();
IncomingDialog *incomingDialog();
void writeSettings( KConfig *config);
void updateSearchDialog();
SearchDialog * getSearchDialog();
void setDocumentId( const QString &id );
public slots:
void showOptionsDialog( bool showSync = false);
void showGlobalOptionsDialog(bool showSync = false);
void showSyncOptions();
void showIncomingDialog();
void showOutgoingDialog();
// void showCategoryEditDialog();
void showSearchDialog();
void showArchiveDialog();
- void showFilterEditDialog(QPtrList<CalFilter> *filters);
+ void showFilterEditDialog(Q3PtrList<CalFilter> *filters);
void showPluginDialog();
void hideSearchDialog();
private:
void createOutgoingDialog();
void createIncomingDialog();
CalendarView *mMainView;
OutgoingDialog *mOutgoingDialog;
IncomingDialog *mIncomingDialog;
KOPrefsDialog *mOptionsDialog;
// KPIM::CategoryEditDialog *mCategoryEditDialog;
SearchDialog *mSearchDialog;
ArchiveDialog *mArchiveDialog;
FilterEditDialog *mFilterEditDialog;
PluginDialog *mPluginDialog;
};
#endif
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 9a4b4ec..a01c838 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -1,175 +1,181 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in thse hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qfiledialog.h>
+#include <q3filedialog.h>
#include <qlayout.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qvgroupbox.h>
-#include <qwidgetstack.h>
+#include <q3vbox.h>
+#include <q3buttongroup.h>
+#include <q3vgroupbox.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
-#include <qapp.h>
+#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <QLabel>
+#include <Q3PtrList>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kglobal.h>
#include <kdialog.h>
#include <kiconloader.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
#include <kabc/addresseedialog.h>
#else //DESKTOP_VERSION
#include <externalapphandler.h>
#endif //DESKTOP_VERSION
#endif
#include <libkcal/incidence.h>
#include "koprefs.h"
#include "koeditordetails.h"
template <>
CustomListViewItem<Attendee *>::~CustomListViewItem()
{
delete mData;
}
template <>
void CustomListViewItem<Attendee *>::updateItem()
{
setText(0,mData->name());
setText(1,mData->email());
setText(2,mData->roleStr());
setText(3,mData->statusStr());
if (mData->RSVP() && !mData->email().isEmpty()) {
setPixmap(4,SmallIcon("mailappt"));
setSortKey(4,"j");
}
else {
setPixmap(4,SmallIcon("nomailappt"));
setSortKey(4,"n");
}
}
KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
: QWidget( parent, name), mDisableItemUpdate( false )
{
- QGridLayout *topLayout = new QGridLayout(this);
+ Q3GridLayout *topLayout = new Q3GridLayout(this);
topLayout->setSpacing(spacing);
topLayout->setMargin(KDialog::marginHint()-2);
QString organizer = KOPrefs::instance()->email();
mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
mListView = new KListView(this,"mListView");
mListView->addColumn(i18n("Name"),180);
mListView->addColumn(i18n("Email"),180);
mListView->addColumn(i18n("Role"),60);
mListView->addColumn(i18n("Status"),100);
mListView->addColumn(i18n("RSVP"),35);
if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) {
int hei = 80;
if ( QApplication::desktop()->height() <= 240 )
hei = 60;
mListView->setFixedHeight(hei);
}
mListView->setAllColumnsShowFocus (true );
//mListView->setSingleClick( true );
- connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
+ connect(mListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
SLOT(updateAttendeeInput()));
- connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )),
- SLOT(itemClicked(QListViewItem * ,const QPoint& , int )));
+ connect(mListView,SIGNAL(executed(Q3ListViewItem * ,const QPoint&, int )),
+ SLOT(itemClicked(Q3ListViewItem * ,const QPoint& , int )));
mRsvpButton = new QCheckBox(this);
mRsvpButton->setText(i18n("Request response"));
mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
QLabel *attendeeLabel = new QLabel(this);
attendeeLabel->setText(i18n("Name:"));
attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
mNameEdit = new QLineEdit(this);
connect(mNameEdit,SIGNAL(textChanged(const QString &)),
SLOT(updateAttendeeItem()));
QLabel *emailLabel = new QLabel(this);
emailLabel->setText(i18n("Email:"));
mEmailEdit = new QLineEdit(this);
connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
SLOT(updateAttendeeItem()));
QLabel *attendeeRoleLabel = new QLabel(this);
attendeeRoleLabel->setText(i18n("Role:"));
mRoleCombo = new QComboBox(false,this);
mRoleCombo->insertStringList(Attendee::roleList());
connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
QLabel *statusLabel = new QLabel(this);
statusLabel->setText( i18n("Status:") );
mStatusCombo = new QComboBox(false,this);
mStatusCombo->insertStringList(Attendee::statusList());
connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
QWidget *buttonBox = new QWidget(this);
- QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
+ Q3VBoxLayout *buttonLayout = new Q3VBoxLayout(buttonBox);
QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
buttonLayout->addWidget(newButton);
connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
buttonLayout->addWidget(mRemoveButton);
connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
// buttonLayout->addWidget(mAddressBookButton);
connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
//mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
if ( QApplication::desktop()->height() <= 240 ) {
mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
topLayout->addMultiCellWidget(mListView,1,1,0,5);
topLayout->addWidget(attendeeLabel,3,0);
topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
topLayout->addWidget(emailLabel,4,0);
topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
topLayout->addWidget(attendeeRoleLabel,5,0);
topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
topLayout->addWidget(statusLabel,5,3);
topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5);
topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
topLayout->setRowStretch(1,5);
topLayout->setColStretch(0,0);
} else {
if (qApp->desktop()->width() < 640 ) {
@@ -336,145 +342,145 @@ void KOEditorDetails::insertAttendee(Attendee *a)
AttendeeListItem *first = (AttendeeListItem*) mListView->firstChild();
while (first) {
if ( first->data()->name() == a->name() && first->data()->email() == a->email() )
return;
first = (AttendeeListItem*) first->nextSibling();
}
AttendeeListItem *item = new AttendeeListItem(a,mListView);
mListView->setSelected( item, true );
}
void KOEditorDetails::setDefaults()
{
mRsvpButton->setChecked(true);
mListView->clear();
mdelAttendees.clear();
clearAttendeeInput();
mOrganizerLabel->setText(i18n("Organizer: %1").arg(KOPrefs::instance()->email()));
mNameEdit->setText("");
mUidEdit = "";
mEmailEdit->setText("");
mRoleCombo->setCurrentItem( 0 );
mStatusCombo->setCurrentItem( 0 );
}
void KOEditorDetails::readEvent(Incidence *event)
{
setDefaults();
//mListView->clear();
//mdelAttendees.clear();
- QPtrList<Attendee> tmpAList = event->attendees();
+ Q3PtrList<Attendee> tmpAList = event->attendees();
Attendee *a;
for (a = tmpAList.first(); a; a = tmpAList.next())
insertAttendee(new Attendee(*a));
mListView->setSelected( mListView->firstChild(), true );
mOrganizerLabel->setText(i18n("Organizer: %1").arg(event->organizer()));
}
void KOEditorDetails::writeEvent(Incidence *event)
{
event->clearAttendees();
- QListViewItem *item;
+ Q3ListViewItem *item;
AttendeeListItem *a;
for (item = mListView->firstChild(); item;
item = item->nextSibling()) {
a = (AttendeeListItem *)item;
event->addAttendee(new Attendee(*(a->data())));
}
event->setOrganizer(KOPrefs::instance()->email());
}
void KOEditorDetails::cancelAttendeeEvent(Incidence *event)
{
event->clearAttendees();
Attendee * att;
for (att=mdelAttendees.first();att;att=mdelAttendees.next()) {
event->addAttendee(new Attendee(*att));
}
mdelAttendees.clear();
}
bool KOEditorDetails::validateInput()
{
return true;
}
void KOEditorDetails::updateAttendeeInput()
{
- QListViewItem *item = mListView->selectedItem();
+ Q3ListViewItem *item = mListView->selectedItem();
AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
if (aItem) {
fillAttendeeInput( aItem );
} else {
clearAttendeeInput();
}
}
void KOEditorDetails::clearAttendeeInput()
{
mNameEdit->setText("");
mUidEdit = "";
mEmailEdit->setText("");
mRoleCombo->setCurrentItem(0);
mStatusCombo->setCurrentItem(0);
mRsvpButton->setChecked(true);
setEnabledAttendeeInput( false );
}
void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
{
Attendee *a = aItem->data();
mDisableItemUpdate = true;
mNameEdit->setText(a->name());
mUidEdit = a->uid();
mEmailEdit->setText(a->email());
mRoleCombo->setCurrentItem(a->role());
mStatusCombo->setCurrentItem(a->status());
mRsvpButton->setChecked(a->RSVP());
mDisableItemUpdate = false;
setEnabledAttendeeInput( true );
}
void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
{
mNameEdit->setEnabled( enabled );
mEmailEdit->setEnabled( enabled );
mRoleCombo->setEnabled( enabled );
mStatusCombo->setEnabled( enabled );
mRsvpButton->setEnabled( enabled );
mRemoveButton->setEnabled( enabled );
}
-void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c )
+void KOEditorDetails::itemClicked(Q3ListViewItem * item ,const QPoint & pnt, int c )
{
if ( item && c == 4 ) {
mRsvpButton->setChecked( !mRsvpButton->isChecked() );
updateAttendeeItem();
}
}
void KOEditorDetails::updateAttendeeItem()
{
if (mDisableItemUpdate) return;
- QListViewItem *item = mListView->selectedItem();
+ Q3ListViewItem *item = mListView->selectedItem();
AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
if ( !aItem ) return;
Attendee *a = aItem->data();
a->setName( mNameEdit->text() );
a->setUid( mUidEdit );
a->setEmail( mEmailEdit->text() );
if ( mEmailEdit->text().isEmpty() )
mRsvpButton->setChecked( false );
a->setRSVP( mRsvpButton->isChecked() );
a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
aItem->updateItem();
}
diff --git a/korganizer/koeditordetails.h b/korganizer/koeditordetails.h
index 5f8f6f2..40e896c 100644
--- a/korganizer/koeditordetails.h
+++ b/korganizer/koeditordetails.h
@@ -1,109 +1,109 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOEDITORDETAILS_H
#define _KOEDITORDETAILS_H
#include <qmap.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#include <klistview.h>
#include <qradiobutton.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kapplication.h>
#include <libkcal/event.h>
#include "ktimeedit.h"
#include "customlistviewitem.h"
class KDateEdit;
using namespace KCal;
typedef CustomListViewItem<Attendee *> AttendeeListItem;
class KOEditorDetails : public QWidget
{
Q_OBJECT
public:
KOEditorDetails (int spacing = 8,QWidget* parent = 0, const char* name = 0);
virtual ~KOEditorDetails();
/** Set widgets to default values */
void setDefaults();
/** Read event object and setup widgets accordingly */
void readEvent(Incidence *);
/** Write event settings to event object */
void writeEvent(Incidence *);
/** return a clone of the event with attendees to be canceld*/
void cancelAttendeeEvent(Incidence *);
/** Check if the input is valid. */
bool validateInput();
public slots:
void insertAttendee(Attendee *);
// called when the app recieves a list of name/email/uid (=addresses) from another app. Usually Ka/Pi
// The first parameter is a uniqueid. It can be used to identify if event
void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist);
protected slots:
void addNewAttendee();
void removeAttendee();
void openAddressBook();
void updateAttendeeInput();
void clearAttendeeInput();
void fillAttendeeInput(AttendeeListItem *);
- void itemClicked(QListViewItem *,const QPoint & pnt, int c);
+ void itemClicked(Q3ListViewItem *,const QPoint & pnt, int c);
void updateAttendeeItem();
void setEnabledAttendeeInput(bool);
private:
bool mDisableItemUpdate;
QLineEdit *mNameEdit;
QString mUidEdit;
QLineEdit *mEmailEdit;
KListView *mListView;
QComboBox* mRoleCombo;
QCheckBox* mRsvpButton;
QComboBox* mStatusCombo;
QLabel *mOrganizerLabel;
QPushButton* mAddButton;
QPushButton* mRemoveButton;
QPushButton* mAddressBookButton;
- QPtrList<Attendee> mdelAttendees;
+ Q3PtrList<Attendee> mdelAttendees;
};
#endif
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 21f220c..8105432 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,106 +1,113 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qwidget.h>
#include <qtooltip.h>
#include <qlayout.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qvgroupbox.h>
-#include <qwidgetstack.h>
+#include <q3vbox.h>
+#include <q3buttongroup.h>
+#include <q3vgroupbox.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
#include <qtimer.h>
#include <qfile.h>
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QLabel>
+#include <Q3GridLayout>
+#include <Q3PtrList>
+#include <Q3PopupMenu>
+#include <QDesktopWidget>
#include <kglobal.h>
#include <kdialog.h>
#include <kdebug.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kstandarddirs.h>
#include <libkcal/todo.h>
#include <libkcal/event.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "koglobals.h"
#include "koeditorgeneral.h"
#include "kolocationbox.h"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
QObject( parent, name)
{
mNextFocus = 0;
}
KOEditorGeneral::~KOEditorGeneral()
{
}
-void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneral::initHeader(QWidget *parent,Q3BoxLayout *topLayout)
{
- QGridLayout *headerLayout = new QGridLayout(topLayout);
+ Q3GridLayout *headerLayout = new Q3GridLayout(topLayout);
#if 0
mOwnerLabel = new QLabel(i18n("Owner:"),parent);
headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
#endif
// 1 on pda
// 11 on desktop
headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
headerLayout->addWidget(summaryLabel,0,0);
mSummaryEdit = new KOLocationBox(TRUE,parent, 50);
mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
//mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
//qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
if ( QApplication::desktop()->width() > 320 )
mSummaryEdit->setMaximumHeight( hei +6 );
//qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
// SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
// mSummaryEdit = new QLineEdit(parent);
if ( QApplication::desktop()->height() < 320 )
headerLayout->addWidget(mSummaryEdit,0,1);
else
headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
if ( QApplication::desktop()->height() < 320 )
headerLayout->addWidget(locationLabel,0,2);
else
headerLayout->addWidget(locationLabel,1,0);
@@ -166,115 +173,115 @@ void KOEditorGeneral::editCategories()
void KOEditorGeneral::showCatPopup()
{
mCatPopup->clear();
QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
int index = 0;
for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
it != KOPrefs::instance()->mCustomCategories.end ();
++it) {
mCatPopup->insertItem (*it, index );
//mCategory[index] = *it;
if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
++index;
}
}
void KOEditorGeneral::selectedCatPopup( int index )
{
QStringList categories = QStringList::split (",", mCategoriesLabel->text());
QString colcat = categories.first();
if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
categories.remove (KOPrefs::instance()->mCustomCategories[index]);
else
categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
categories.sort ();
if ( !colcat.isEmpty() ) {
if ( categories.find ( colcat ) != categories.end () ) {
categories.remove( colcat );
categories.prepend( colcat );
}
}
setCategories( categories.join(",") );
}
-void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
+void KOEditorGeneral::initCategories(QWidget *parent, Q3BoxLayout *topLayout)
{
- QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
- mCatPopup = new QPopupMenu ( parent );
+ Q3BoxLayout *categoriesLayout = new Q3HBoxLayout( topLayout );
+ mCatPopup = new Q3PopupMenu ( parent );
mCatPopup->setCheckable (true);
connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
mCategoriesButton = new QPushButton(parent);
mCategoriesButton->setText(i18n("Categories..."));
connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
//connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
categoriesLayout->addWidget(mCategoriesButton);
mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
mCategoriesLabel->setPopup( mCatPopup );
//mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
categoriesLayout->addWidget(mCategoriesLabel,1);
}
-void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
+void KOEditorGeneral::initSecrecy(QWidget *parent, Q3BoxLayout *topLayout)
{
- QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *secrecyLayout = new Q3HBoxLayout( topLayout );
QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
secrecyLayout->addWidget(mCancelBox);
secrecyLayout->addWidget(secrecyLabel);
mSecrecyCombo = new QComboBox(parent);
mSecrecyCombo->insertStringList(Incidence::secrecyList());
secrecyLayout->addWidget(mSecrecyCombo);
}
-void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneral::initDescription(QWidget *parent,Q3BoxLayout *topLayout)
{
mDescriptionEdit = new KTextEdit(parent);
mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
mDescriptionEdit->append("");
mDescriptionEdit->setReadOnly(false);
mDescriptionEdit->setOverwriteMode(false);
mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
topLayout->addWidget(mDescriptionEdit);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
#endif
}
-void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneral::initAlarm(QWidget *parent,Q3BoxLayout *topLayout)
{
- QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *alarmLayout = new Q3HBoxLayout(topLayout);
//mAlarmBell = new QLabel(parent);
//mAlarmBell->setPixmap(SmallIcon("bell"));
//alarmLayout->addWidget(mAlarmBell);
if ( QApplication::desktop()->width() < 320 )
mAlarmButton = new QCheckBox(i18n("Rem."),parent);
else
mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
alarmLayout->addWidget(mAlarmButton);
mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
alarmLayout->addWidget(mAlarmTimeEdit);
mAlarmIncrCombo = new QComboBox(false, parent);
if ( QApplication::desktop()->width() < 320 ) {
mAlarmIncrCombo->insertItem(i18n("min"));
mAlarmIncrCombo->insertItem(i18n("hou"));
mAlarmIncrCombo->insertItem(i18n("day"));
mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
} else {
mAlarmIncrCombo->insertItem(i18n("minute(s)"));
mAlarmIncrCombo->insertItem(i18n("hour(s)"));
mAlarmIncrCombo->insertItem(i18n("day(s)"));
}
// mAlarmIncrCombo->setMinimumHeight(20);
alarmLayout->addWidget(mAlarmIncrCombo);
mAlarmSoundButton = new QPushButton(parent);
mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
@@ -499,127 +506,127 @@ void KOEditorGeneral::readIncidence(Incidence *event)
mAlarmMessage += " ("+event->location()+")";
mAlarmIncrCombo->setCurrentItem(0);
mSummaryEdit->setEditText(event->summary());
mLocationEdit->setEditText(event->location());
mDescriptionEdit->setText(event->description());
#if 0
// organizer information
mOwnerLabel->setText(i18n("Owner: ") + event->organizer());
#endif
enableAlarmEdit( event->isAlarmEnabled() );
//qDebug("KOEditorGeneral::readIncidence(Incidence *event) ");
if(!event->isAlarmEnabled()) {
// TODO: Implement a KPrefsComboItem to solve this in a clean way.
int alarmTime;
int a[] = { 1,5,10,15,30,60,180, 1440 };
int index = KOPrefs::instance()->mAlarmTime;
if (index < 0 || index > 7) {
alarmTime = 15;
} else {
alarmTime = a[index];
}
mAlarmTimeEdit->setValue(alarmTime);
}
mAlarmButton->setChecked( event->isAlarmEnabled() );
mSecrecyCombo->setCurrentItem(event->secrecy());
mCancelBox->setChecked( event->cancelled() );
mAlarmProgramButton->setOn(false);
mAlarmSoundButton->setOn(false);
// set up alarm stuff
- QPtrList<Alarm> alarms = event->alarms();
+ Q3PtrList<Alarm> alarms = event->alarms();
Alarm* alarm;
mAlarmIncrCombo->setCurrentItem(0);
for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) {
int offset;
if ( alarm->hasTime() ) {
QDateTime t = alarm->time();
offset = event->dtStart().secsTo( t );
} else {
offset = alarm->startOffset().asSeconds();
}
if ( offset != 0 ) {
offset = offset / -60; // make minutes
if (offset % 60 == 0) { // divides evenly into hours?
offset = offset / 60;
mAlarmIncrCombo->setCurrentItem(1);
if (offset % 24 == 0) { // divides evenly into days?
offset = offset / 24;
mAlarmIncrCombo->setCurrentItem(2);
}
}
}
mAlarmTimeEdit->setValue( offset );
if (alarm->type() == Alarm::Procedure) {
mAlarmProgram = alarm->programFile();
mAlarmProgramButton->setOn(true);
QString dispStr = i18n("Running '%1'").arg(mAlarmProgram);
QToolTip::add(mAlarmProgramButton, dispStr);
}
else if (alarm->type() == Alarm::Audio) {
mAlarmSound = alarm->audioFile();
if ( ! QFile::exists( mAlarmSound ) )
mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
mAlarmSoundButton->setOn(true);
QString dispStr = i18n("Playing '%1'").arg(mAlarmSound);
QToolTip::add(mAlarmSoundButton, dispStr);
}
mAlarmButton->setChecked(alarm->enabled());
enableAlarmEdit( alarm->enabled() );
//qDebug("nableAlarmEdit( alarm->enabled() )********* ");
// TODO: Deal with multiple alarms
break; // For now, stop after the first alarm
}
setCategories(event->categoriesStr());
}
void KOEditorGeneral::writeIncidence(Incidence *event)
{
// kdDebug() << "KOEditorGeneral::writeEvent()" << endl;
mLocationEdit->save(KOLocationBox::LOCATION);
event->setSummary(mSummaryEdit->currentText());
event->setLocation(mLocationEdit->currentText());
event->setDescription(mDescriptionEdit->text());
event->setCategories(mCategoriesLabel->text());
event->setSecrecy(mSecrecyCombo->currentItem());
event->setCancelled(mCancelBox->isChecked() );;
// alarm stuff
if (mAlarmButton->isChecked()) {
if (event->alarms().count() == 0)
event->newAlarm();
- QPtrList<Alarm> alarms = event->alarms();
+ Q3PtrList<Alarm> alarms = event->alarms();
Alarm *alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
alarm->setEnabled(true);
int j = mAlarmTimeEdit->value()* -60;
if (mAlarmIncrCombo->currentItem() == 1)
j = j * 60;
else if (mAlarmIncrCombo->currentItem() == 2)
j = j * (60 * 24);
alarm->setStartOffset( j );
if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) {
alarm->setProcedureAlarm(mAlarmProgram);
}
else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn())
alarm->setAudioAlarm(mAlarmSound);
else
alarm->setType(Alarm::Invalid);
//alarm->setAudioAlarm("default");
// TODO: Deal with multiple alarms
break; // For now, stop after the first alarm
}
} else {
Alarm* alarm = event->alarms().first();
if ( alarm ) {
alarm->setEnabled(false);
alarm->setType(Alarm::Invalid);
}
}
int id = getCalendarID();
event->setCalID( id );
event->setAlarmEnabled( KOPrefs::instance()->getCalendar( id )->isAlarmEnabled );
}
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h
index b10a5d4..45f26fd 100644
--- a/korganizer/koeditorgeneral.h
+++ b/korganizer/koeditorgeneral.h
@@ -1,125 +1,126 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOEDITORGENERAL_H
#define KOEDITORGENERAL_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qpopupmenu.h>
-#include <qgroupbox.h>
+#include <q3popupmenu.h>
+#include <q3groupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qspinbox.h>
#include <qcombobox.h>
+#include <Q3BoxLayout>
#include <ktextedit.h>
#include <krestrictedline.h>
#include <libkcal/incidence.h>
#include "ktimeedit.h"
class KDateEdit;
class KOLocationBox;
using namespace KCal;
class KOEditorGeneral : public QObject
{
Q_OBJECT
public:
KOEditorGeneral (QObject* parent=0,const char* name=0);
virtual ~KOEditorGeneral();
void setFocusOn( int i );
- void initHeader(QWidget *,QBoxLayout *);
- void initDescription(QWidget *,QBoxLayout *);
- void initSecrecy(QWidget *,QBoxLayout *);
- void initCategories(QWidget *,QBoxLayout *);
- void initAlarm(QWidget *,QBoxLayout *);
+ void initHeader(QWidget *,Q3BoxLayout *);
+ void initDescription(QWidget *,Q3BoxLayout *);
+ void initSecrecy(QWidget *,Q3BoxLayout *);
+ void initCategories(QWidget *,Q3BoxLayout *);
+ void initAlarm(QWidget *,Q3BoxLayout *);
/** Set widgets to default values */
void setDefaults(bool allDay);
/** Read event object and setup widgets accordingly */
void readIncidence(Incidence *);
/** Write event settings to event object */
void writeIncidence(Incidence *);
/** Check if the input is valid. */
bool validateInput() { return true; }
void enableAlarm( bool enable );
void setSecrecy( int num );
int getCalendarID();
public slots:
void setCategories(const QString &);
void editCategories();
protected slots:
void enableAlarmEdit( bool enable );
void disableAlarmEdit( bool disable );
void alarmDisable( bool disable );
void pickAlarmSound();
void pickAlarmProgram();
void slotSetFocusOn();
void showCatPopup();
void selectedCatPopup( int );
signals:
void openCategoryDialog();
void allAccepted();
void dateTimesChanged(QDateTime,QDateTime);
protected:
void fillCalCombo( int setToID = 0 );
int mNextFocus;
//QLineEdit *mSummaryEdit;
//QLineEdit *mLocationEdit;
KOLocationBox *mSummaryEdit;
KOLocationBox *mLocationEdit;
QComboBox *mCalendarBox;
QLabel *mAlarmBell;
QCheckBox *mAlarmButton;
QSpinBox *mAlarmTimeEdit;
QPushButton *mAlarmSoundButton;
QPushButton *mAlarmProgramButton;
QComboBox *mAlarmIncrCombo;
KTextEdit *mDescriptionEdit;
QLabel *mOwnerLabel;
QComboBox *mSecrecyCombo;
QCheckBox *mCancelBox;
QPushButton *mCategoriesButton;
QPushButton *mCategoriesLabel;
private:
- QPopupMenu * mCatPopup;
+ Q3PopupMenu * mCatPopup;
QString getFittingPath( const QString &) ;
QString mAlarmSound;
QString mAlarmProgram;
QString mAlarmMessage;
};
#endif
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 2c6ed9f..73a4139 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -1,184 +1,190 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
#include <qlayout.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qvgroupbox.h>
-#include <qwidgetstack.h>
+#include <q3vbox.h>
+#include <q3buttongroup.h>
+#include <q3vgroupbox.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <QLabel>
+#include <Q3VBoxLayout>
#include <kdebug.h>
#include <kglobal.h>
#include <kdialog.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kstandarddirs.h>
#include <libkcal/event.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "koeditorgeneralevent.h"
#include "kolocationbox.h"
KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent,
const char* name) :
KOEditorGeneral( parent, name)
{
mTemplate = false;
connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
SLOT(setDuration()));
connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
SLOT(emitDateTimeStr()));
}
KOEditorGeneralEvent::~KOEditorGeneralEvent()
{
}
void KOEditorGeneralEvent::finishSetup()
{
//disabled
// QWidget::setTabOrder( mSummaryEdit, mLocationEdit );
// QWidget::setTabOrder( mLocationEdit, mStartDateEdit );
// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit );
// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit );
// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit );
// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton );
// QWidget::setTabOrder( mNoTimeButton, mAlarmButton );
// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit );
// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton );
// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo );
// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit );
mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
mSummaryEdit->setFocus();
}
-void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneralEvent::initTime(QWidget *parent,Q3BoxLayout *topLayout)
{
- QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
+ Q3BoxLayout *timeLayout = new Q3VBoxLayout(topLayout);
- QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
+ Q3GroupBox *timeGroupBox = new Q3GroupBox(1,Qt::Horizontal,
i18n("Date && Time"),parent);
timeLayout->addWidget(timeGroupBox);
timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
timeGroupBox->layout()->setMargin( KDialog::marginHint() );
- QFrame *timeBoxFrame = new QFrame(timeGroupBox);
+ Q3Frame *timeBoxFrame = new Q3Frame(timeGroupBox);
- QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3);
+ Q3GridLayout *layoutTimeBox = new Q3GridLayout(timeBoxFrame,2,3);
layoutTimeBox->setSpacing(topLayout->spacing());
mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame);
layoutTimeBox->addWidget(mStartDateLabel,0,0);
mStartDateEdit = new KDateEdit(timeBoxFrame);
layoutTimeBox->addWidget(mStartDateEdit,0,1);
mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
layoutTimeBox->addWidget(mStartTimeEdit,0,2);
mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame);
layoutTimeBox->addWidget(mEndDateLabel,1,0);
mEndDateEdit = new KDateEdit(timeBoxFrame);
layoutTimeBox->addWidget(mEndDateEdit,1,1);
mEndTimeEdit = new KOTimeEdit(timeBoxFrame);
layoutTimeBox->addWidget(mEndTimeEdit,1,2);
QWidget* duration = new QWidget( timeBoxFrame );
- QHBoxLayout *flagsBox = new QHBoxLayout( duration );
+ Q3HBoxLayout *flagsBox = new Q3HBoxLayout( duration );
mNoTimeButton = new QCheckBox(i18n("All day event"),duration);
flagsBox->addWidget(mNoTimeButton);
connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool)));
mDurationLabel = new QLabel( duration );
// if ( KOPrefs::instance()->mCompactDialogs ) {
//layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 );
//} else {
flagsBox->addWidget( mDurationLabel );
//}
flagsBox->setStretchFactor(mDurationLabel, 10 );
- mDurationLabel->setAlignment( AlignRight | AlignVCenter);
+ mDurationLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter);
layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 );
// time widgets are checked if they contain a valid time
connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
this, SLOT(startTimeChanged(QTime)));
connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
this, SLOT(endTimeChanged(QTime)));
// date widgets are checked if they contain a valid date
connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
this, SLOT(startDateChanged(QDate)));
connect(mEndDateEdit, SIGNAL(dateChanged(QDate)),
this, SLOT(endDateChanged(QDate)));
connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime)));
connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime)));
}
-void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneralEvent::initClass(QWidget *parent,Q3BoxLayout *topLayout)
{
- QBoxLayout *classLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *classLayout = new Q3HBoxLayout(topLayout);
QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
classLayout->addWidget(freeTimeLabel);
mFreeTimeCombo = new QComboBox(false, parent);
mFreeTimeCombo->insertItem(i18n("Busy"));
mFreeTimeCombo->insertItem(i18n("Free"));
classLayout->addWidget(mFreeTimeCombo);
}
void KOEditorGeneralEvent::timeStuffDisable(bool disable)
{
mStartTimeEdit->setEnabled( !disable );
mEndTimeEdit->setEnabled( !disable );
setDuration();
emitDateTimeStr();
}
void KOEditorGeneralEvent::dontAssociateTime(bool noTime)
{
timeStuffDisable(noTime);
//if(alarmButton->isChecked()) alarmStuffDisable(noTime);
allDayChanged(noTime);
}
void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
{
// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl;
if ( !mTemplate )
mStartDateEdit->setDate(start.date());
// KTimeEdit seems to emit some signals when setTime() is called.
diff --git a/korganizer/koeditorgeneralevent.h b/korganizer/koeditorgeneralevent.h
index d798905..5d97a5c 100644
--- a/korganizer/koeditorgeneralevent.h
+++ b/korganizer/koeditorgeneralevent.h
@@ -1,87 +1,87 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOEDITORGENERALEVENT_H
#define _KOEDITORGENERALEVENT_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
-#include <qmultilineedit.h>
-#include <qlistview.h>
+#include <q3multilineedit.h>
+#include <q3listview.h>
#include <qradiobutton.h>
#include <krestrictedline.h>
#include "koeditorgeneral.h"
#include "ktimeedit.h"
class KDateEdit;
using namespace KCal;
class KOEditorGeneralEvent : public KOEditorGeneral
{
Q_OBJECT
public:
KOEditorGeneralEvent (QObject* parent=0,const char* name=0);
virtual ~KOEditorGeneralEvent();
- void initTime(QWidget *,QBoxLayout *);
- void initClass(QWidget *,QBoxLayout *);
+ void initTime(QWidget *,Q3BoxLayout *);
+ void initClass(QWidget *,Q3BoxLayout *);
void finishSetup();
/** Set widgets to default values */
void setDefaults(QDateTime from,QDateTime to,bool allDay);
/**
Read event object and setup widgets accordingly. If templ is true, the
event is read as template, i.e. the time and date information isn't set.
*/
void readEvent( Event *, bool tmpl = false );
/** Write event settings to event object */
void writeEvent(Event *);
/** Check if the input is valid. */
bool validateInput();
public slots:
void setDateTimes(QDateTime start, QDateTime end);
void setDuration();
protected slots:
void timeStuffDisable(bool disable);
void dontAssociateTime(bool noTime);
void startTimeChanged(QTime);
void startDateChanged(QDate);
void endTimeChanged(QTime);
void endDateChanged(QDate);
void emitDateTimeStr();
void sTimeChanged(QTime);
void eTimeChanged(QTime);
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index d32d5a5..baee9fc 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -1,226 +1,233 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qfiledialog.h>
+#include <q3filedialog.h>
#include <qlayout.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qvgroupbox.h>
-#include <qwidgetstack.h>
+#include <q3vbox.h>
+#include <q3buttongroup.h>
+#include <q3vgroupbox.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <QLabel>
+#include <Q3VBoxLayout>
#include <kglobal.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <krestrictedline.h>
#include <kstandarddirs.h>
#include <kfiledialog.h>
#include <kdialog.h>
#include <libkcal/todo.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "ktimeedit.h"
#include "koeditorgeneraltodo.h"
#include "kolocationbox.h"
KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent,
const char* name)
: KOEditorGeneral( parent, name)
{
}
KOEditorGeneralTodo::~KOEditorGeneralTodo()
{
}
void KOEditorGeneralTodo::finishSetup()
{
// QWidget::setTabOrder(mSummaryEdit, mLocationEdit);
// QWidget::setTabOrder(mLocationEdit, mDueCheck);
// QWidget::setTabOrder(mDueCheck, mDueDateEdit);
// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit);
// QWidget::setTabOrder(mDueTimeEdit, mStartCheck);
// QWidget::setTabOrder(mStartCheck, mStartDateEdit);
// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit);
// QWidget::setTabOrder(mStartTimeEdit, mTimeButton);
// QWidget::setTabOrder(mTimeButton, mCompletedCombo);
// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo);
// QWidget::setTabOrder(mPriorityCombo, mAlarmButton);
// QWidget::setTabOrder(mAlarmButton, mCategoriesButton);
// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo);
// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit);
mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
mSummaryEdit->setFocus();
}
-void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneralTodo::initTime(QWidget *parent,Q3BoxLayout *topLayout)
{
- QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
+ Q3BoxLayout *timeLayout = new Q3VBoxLayout(topLayout);
- QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
+ Q3GroupBox *timeGroupBox = new Q3GroupBox(1,Qt::Horizontal,
i18n("Date && Time"),parent);
timeLayout->addWidget(timeGroupBox);
timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 );
timeGroupBox->layout()->setMargin( KDialog::marginHint() );
- QFrame *timeBoxFrame = new QFrame(timeGroupBox);
+ Q3Frame *timeBoxFrame = new Q3Frame(timeGroupBox);
- QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
+ Q3GridLayout *layoutTimeBox = new Q3GridLayout(timeBoxFrame,3,3);
layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
layoutTimeBox->setColStretch( 1, 1 );
mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
layoutTimeBox->addWidget(mStartCheck,0,0);
connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
mStartDateEdit = new KDateEdit(timeBoxFrame);
layoutTimeBox->addWidget(mStartDateEdit,0,1);
mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
layoutTimeBox->addWidget(mStartTimeEdit,0,2);
mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
layoutTimeBox->addWidget(mDueCheck,1,0);
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
mDueDateEdit = new KDateEdit(timeBoxFrame);
layoutTimeBox->addWidget(mDueDateEdit,1,1);
mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
layoutTimeBox->addWidget(mDueTimeEdit,1,2);
mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
this, SLOT(startDateChanged(QDate)));
// some more layouting
//layoutTimeBox->setColStretch(3,1);
}
-void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
+void KOEditorGeneralTodo::initCompletion(QWidget *parent, Q3BoxLayout *topLayout)
{
mCompletedCombo = new QComboBox(parent);
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 0 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 20 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 40 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 60 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n(" 80 %"));
// xgettext:no-c-format
mCompletedCombo->insertItem(i18n("100 %"));
connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
topLayout->addWidget(mCompletedCombo);
mCompletedLabel = new QLabel(i18n("completed"),parent);
topLayout->addWidget(mCompletedLabel);
mCompleteDateEdit = new KDateEdit(parent);
topLayout->addWidget(mCompleteDateEdit );
mCompleteTimeEdit = new KOTimeEdit(parent);
topLayout->addWidget( mCompleteTimeEdit);
mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) );
mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) );
connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime)));
if ( QApplication::desktop()->width() <= 480 ) {
if ( QApplication::desktop()->width() < 320 )
mCompleteDateEdit->setMaximumWidth( 85 );
else
mCompleteDateEdit->setMaximumWidth( 140 );
topLayout->setSpacing( 0 );
}
}
-void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
+void KOEditorGeneralTodo::initPriority(QWidget *parent, Q3BoxLayout *topLayout)
{
- QHBox* h = new QHBox ( parent );
+ Q3HBox* h = new Q3HBox ( parent );
topLayout->addWidget( h );
QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
// topLayout->addWidget(priorityLabel);
mPriorityCombo = new QComboBox( h );
mPriorityCombo->insertItem(i18n("1 (high)"));
mPriorityCombo->insertItem(i18n("2"));
mPriorityCombo->insertItem(i18n("3"));
mPriorityCombo->insertItem(i18n("4"));
mPriorityCombo->insertItem(i18n("5 (low)"));
//topLayout->addWidget(mPriorityCombo);
}
-void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout)
+void KOEditorGeneralTodo::initStatus(QWidget *parent,Q3BoxLayout *topLayout)
{
- QBoxLayout *statusLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *statusLayout = new Q3HBoxLayout(topLayout);
initCompletion( parent, statusLayout );
statusLayout->addStretch( 1 );
initPriority( parent, statusLayout );
}
void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay)
{
mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
mLocationEdit->load(KOLocationBox::LOCATION);
KOEditorGeneral::setDefaults(allDay);
mTimeButton->setChecked( !allDay );
mTimeButton->setEnabled( !allDay );
enableTimeEdits( !allDay );
if ( due.isValid() ) {
mDueCheck->setChecked(true);
enableDueEdit(true);
alarmDisable(false);
} else {
mDueCheck->setChecked(false);
enableDueEdit(false);
due = QDateTime::currentDateTime().addDays(7);
alarmDisable(true);
}
mStartCheck->setChecked(false);
@@ -367,65 +374,65 @@ void KOEditorGeneralTodo::enableDueEdit(bool enable)
}
if (enable) {
mDueTimeEdit->setEnabled( mTimeButton->isChecked() );
} else {
mDueTimeEdit->setEnabled( false );
}
emit datesChecked();
}
void KOEditorGeneralTodo::enableStartEdit( bool enable )
{
mStartDateEdit->setEnabled( enable );
if(mDueCheck->isChecked() || mStartCheck->isChecked()) {
mTimeButton->setEnabled(true);
}
else {
mTimeButton->setEnabled(false);
mTimeButton->setChecked(false);
}
if (enable) {
mStartTimeEdit->setEnabled( mTimeButton->isChecked() );
} else {
mStartTimeEdit->setEnabled( false );
}
emit datesChecked();
}
void KOEditorGeneralTodo::startDateChanged(QDate newdate)
{
if ( mDueCheck->isChecked() )
- emit dateTimesChanged(newdate,mDueDateEdit->date());
+ emit dateTimesChanged((QDateTime)newdate,(QDateTime)mDueDateEdit->date());
}
void KOEditorGeneralTodo::enableTimeEdits(bool enable)
{
if(mStartCheck->isChecked()) {
mStartTimeEdit->setEnabled( enable );
}
if(mDueCheck->isChecked()) {
mDueTimeEdit->setEnabled( enable );
}
}
void KOEditorGeneralTodo::showAlarm()
{
if ( mDueCheck->isChecked() ) {
alarmDisable(false);
}
else {
alarmDisable(true);
}
}
bool KOEditorGeneralTodo::validateInput()
{
if (mDueCheck->isChecked()) {
if (!mDueDateEdit->inputIsValid()) {
KMessageBox::sorry(0,i18n("Please specify a valid due date."));
return false;
}
}
if (mStartCheck->isChecked()) {
if (!mStartDateEdit->inputIsValid()) {
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index 2e56a7a..2e97ff5 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -1,88 +1,88 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOEDITORGENERALTODO_H
#define _KOEDITORGENERALTODO_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
-#include <qmultilineedit.h>
-#include <qlistview.h>
+#include <q3multilineedit.h>
+#include <q3listview.h>
#include <qradiobutton.h>
#include "koeditorgeneral.h"
#include "koglobals.h"
class KRestrictedLine;
class KDateEdit;
using namespace KCal;
class KOEditorGeneralTodo : public KOEditorGeneral
{
Q_OBJECT
public:
KOEditorGeneralTodo (QObject* parent=0,const char* name=0);
virtual ~KOEditorGeneralTodo();
- void initTime(QWidget *, QBoxLayout *);
- void initStatus(QWidget *, QBoxLayout *);
- void initCompletion(QWidget *, QBoxLayout *);
- void initPriority(QWidget *, QBoxLayout *);
+ void initTime(QWidget *, Q3BoxLayout *);
+ void initStatus(QWidget *, Q3BoxLayout *);
+ void initCompletion(QWidget *, Q3BoxLayout *);
+ void initPriority(QWidget *, Q3BoxLayout *);
void finishSetup();
/** Set widgets to default values */
void setDefaults(QDateTime due,bool allDay);
/** Read todo object and setup widgets accordingly */
void readTodo(Todo *);
/** Write todo settings to event object */
void writeTodo(Todo *);
/** Check if the input is valid. */
bool validateInput();
/** The todo has been modified externally */
void modified (Todo*, int);
signals:
void openCategoryDialog();
void datesChecked();
protected slots:
void startDateChanged(QDate newdate);
void completedChanged(int);
void enableDueEdit( bool enable );
void enableStartEdit( bool enable );
void enableTimeEdits( bool enable );
void showAlarm();
protected:
void setCompletedDate();
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index e0380c4..e0ae3a0 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -1,224 +1,232 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qfiledialog.h>
+#include <q3filedialog.h>
#include <qlayout.h>
-#include <qvbox.h>
-#include <qbuttongroup.h>
-#include <qvgroupbox.h>
-#include <qwidgetstack.h>
+#include <q3vbox.h>
+#include <q3buttongroup.h>
+#include <q3vgroupbox.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QLabel>
+#include <Q3GridLayout>
+#include <Q3PtrList>
+#include <Q3Frame>
+#include <Q3VBoxLayout>
#include <kdialog.h>
#include <kglobal.h>
#include <klocale.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <knumvalidator.h>
#include <libkcal/event.h>
#include <libkcal/todo.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "koeditorrecurrence.h"
/////////////////////////// RecurBase ///////////////////////////////
RecurBase::RecurBase( QWidget *parent, const char *name ) :
QWidget( parent, name )
{
mFrequencyEdit = new QSpinBox( 1, 9999, 1, this );
mFrequencyEdit->setValue( 1 );
}
QWidget *RecurBase::frequencyEdit()
{
return mFrequencyEdit;
}
void RecurBase::setFrequency( int f )
{
if ( f < 1 ) f = 1;
mFrequencyEdit->setValue( f );
}
int RecurBase::frequency()
{
return mFrequencyEdit->value();
}
/////////////////////////// RecurDaily ///////////////////////////////
RecurDaily::RecurDaily( QWidget *parent, const char *name ) :
RecurBase( parent, name )
{
- QBoxLayout *topLayout = new QHBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3HBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHintSmall() );
QLabel *preLabel = new QLabel( i18n("Recur every"), this );
topLayout->addWidget( preLabel );
topLayout->addWidget( frequencyEdit() );
QLabel *postLabel = new QLabel( i18n("day(s)"), this );
topLayout->addWidget( postLabel );
}
/////////////////////////// RecurWeekly ///////////////////////////////
RecurWeekly::RecurWeekly( QWidget *parent, const char *name ) :
RecurBase( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHintSmall() );
//topLayout->addStretch( 1 );
- QBoxLayout *weeksLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *weeksLayout = new Q3HBoxLayout( topLayout );
QLabel *preLabel = new QLabel( i18n("Recur every"), this );
weeksLayout->addWidget( preLabel );
weeksLayout->addWidget( frequencyEdit() );
QLabel *postLabel = new QLabel( i18n("week(s) on:"), this );
weeksLayout->addWidget( postLabel );
- QHBox *dayBox = new QHBox( this );
- topLayout->addWidget( dayBox, 1, AlignVCenter );
+ Q3HBox *dayBox = new Q3HBox( this );
+ topLayout->addWidget( dayBox, 1, Qt::AlignVCenter );
// TODO: Respect start of week setting
for ( int i = 0; i < 7; ++i ) {
QString weekDayName = KGlobal::locale()->weekDayName( i + 1, true );
int left = 1;
if ( QApplication::desktop()->width() > 480 ) {
++left;
if ( QApplication::desktop()->width() > 640 )
++left;
}
mDayBoxes[ i ] = new QCheckBox( weekDayName.left( left ), dayBox );
}
topLayout->addStretch( );
}
void RecurWeekly::setDays( const QBitArray &days )
{
for ( int i = 0; i < 7; ++i ) {
mDayBoxes[ i ]->setChecked( days.testBit( i ) );
}
}
QBitArray RecurWeekly::days()
{
QBitArray days( 7 );
for ( int i = 0; i < 7; ++i ) {
days.setBit( i, mDayBoxes[ i ]->isChecked() );
}
return days;
}
/////////////////////////// RecurMonthly ///////////////////////////////
RecurMonthly::RecurMonthly( QWidget *parent, const char *name ) :
RecurBase( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHintSmall() );
- QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *freqLayout = new Q3HBoxLayout( topLayout );
QLabel *preLabel = new QLabel( i18n("every"), this );
freqLayout->addWidget( preLabel );
freqLayout->addWidget( frequencyEdit() );
QLabel *postLabel = new QLabel( i18n("month(s)"), this );
freqLayout->addWidget( postLabel );
- QButtonGroup *buttonGroup = new QButtonGroup( this );
- buttonGroup->setFrameStyle( QFrame::NoFrame );
- topLayout->addWidget( buttonGroup, 1, AlignVCenter );
+ Q3ButtonGroup *buttonGroup = new Q3ButtonGroup( this );
+ buttonGroup->setFrameStyle( Q3Frame::NoFrame );
+ topLayout->addWidget( buttonGroup, 1, Qt::AlignVCenter );
- QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 3, 2 );
+ Q3GridLayout *buttonLayout = new Q3GridLayout( buttonGroup, 3, 2 );
buttonLayout->setSpacing( KDialog::spacingHint() );
buttonLayout->setMargin( KDialog::marginHintSmall() );
QString recurOnText;
if ( QApplication::desktop()->width() > 320 ) {
recurOnText = i18n("Recur on the");
}
mByDayRadio = new QRadioButton( recurOnText, buttonGroup );
buttonLayout->addWidget( mByDayRadio, 0, 0 );
- mByDayCombo = new QComboBox( buttonGroup );
+ mByDayCombo = new Q3ComboBox( buttonGroup );
mByDayCombo->setSizeLimit( 7 );
mByDayCombo->insertItem( i18n("1st") );
mByDayCombo->insertItem( i18n("2nd") );
mByDayCombo->insertItem( i18n("3rd") );
mByDayCombo->insertItem( i18n("4th") );
mByDayCombo->insertItem( i18n("5th") );
mByDayCombo->insertItem( i18n("6th") );
mByDayCombo->insertItem( i18n("7th") );
mByDayCombo->insertItem( i18n("8th") );
mByDayCombo->insertItem( i18n("9th") );
mByDayCombo->insertItem( i18n("10th") );
mByDayCombo->insertItem( i18n("11th") );
mByDayCombo->insertItem( i18n("12th") );
mByDayCombo->insertItem( i18n("13th") );
mByDayCombo->insertItem( i18n("14th") );
mByDayCombo->insertItem( i18n("15th") );
mByDayCombo->insertItem( i18n("16th") );
mByDayCombo->insertItem( i18n("17th") );
mByDayCombo->insertItem( i18n("18th") );
mByDayCombo->insertItem( i18n("19th") );
mByDayCombo->insertItem( i18n("20th") );
mByDayCombo->insertItem( i18n("21st") );
mByDayCombo->insertItem( i18n("22nd") );
mByDayCombo->insertItem( i18n("23rd") );
mByDayCombo->insertItem( i18n("24th") );
mByDayCombo->insertItem( i18n("25th") );
mByDayCombo->insertItem( i18n("26th") );
mByDayCombo->insertItem( i18n("27th") );
mByDayCombo->insertItem( i18n("28th") );
mByDayCombo->insertItem( i18n("29th") );
mByDayCombo->insertItem( i18n("30th") );
mByDayCombo->insertItem( i18n("31st") );
@@ -264,175 +272,175 @@ void RecurMonthly::setByPos( int count, int weekday )
}
bool RecurMonthly::byDay()
{
return mByDayRadio->isChecked();
}
bool RecurMonthly::byPos()
{
return mByPosRadio->isChecked();
}
int RecurMonthly::day()
{
return mByDayCombo->currentItem() + 1;
}
int RecurMonthly::count()
{
return mByPosCountCombo->currentItem() + 1;
}
int RecurMonthly::weekday()
{
return mByPosWeekdayCombo->currentItem();
}
/////////////////////////// RecurYearly ///////////////////////////////
RecurYearly::RecurYearly( QWidget *parent, const char *name ) :
RecurBase( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHintSmall() );
- QBoxLayout *freqLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *freqLayout = new Q3HBoxLayout( topLayout );
QLabel *preLabel = new QLabel( i18n("every"), this );
freqLayout->addWidget( preLabel );
freqLayout->addWidget( frequencyEdit() );
QLabel *postLabel = new QLabel( i18n("year(s)"), this );
freqLayout->addWidget( postLabel );
- QButtonGroup *buttonGroup = new QButtonGroup( this );
- buttonGroup->setFrameStyle( QFrame::NoFrame );
- topLayout->addWidget( buttonGroup, 1, AlignVCenter );
+ Q3ButtonGroup *buttonGroup = new Q3ButtonGroup( this );
+ buttonGroup->setFrameStyle( Q3Frame::NoFrame );
+ topLayout->addWidget( buttonGroup, 1, Qt::AlignVCenter );
- QGridLayout *buttonLayout = new QGridLayout( buttonGroup, 2, 3 );
+ Q3GridLayout *buttonLayout = new Q3GridLayout( buttonGroup, 2, 3 );
mByMonthRadio = new QRadioButton( i18n("On day "), buttonGroup);
buttonLayout->addWidget( mByMonthRadio, 0, 0 , Qt::AlignRight);
mByDayLabel = new QLabel( i18n("%1 of ").arg(1), buttonGroup );
buttonLayout->addWidget( mByDayLabel, 0, 1 );
- mByMonthCombo = new QComboBox( buttonGroup );
+ mByMonthCombo = new Q3ComboBox( buttonGroup );
mByMonthCombo->insertItem( i18n("January") );
mByMonthCombo->insertItem( i18n("February") );
mByMonthCombo->insertItem( i18n("March") );
mByMonthCombo->insertItem( i18n("April") );
mByMonthCombo->insertItem( i18n("May") );
mByMonthCombo->insertItem( i18n("June") );
mByMonthCombo->insertItem( i18n("July") );
mByMonthCombo->insertItem( i18n("August") );
mByMonthCombo->insertItem( i18n("September") );
mByMonthCombo->insertItem( i18n("October") );
mByMonthCombo->insertItem( i18n("November") );
mByMonthCombo->insertItem( i18n("December") );
buttonLayout->addWidget( mByMonthCombo, 0, 2,Qt::AlignLeft );
if ( QApplication::desktop()->width() <= 640 ) {
mByMonthCombo->setSizeLimit( 6 );
}
mByDayRadio = new QRadioButton( i18n("On day "), buttonGroup);
buttonLayout->addWidget( mByDayRadio, 1, 0 , Qt::AlignRight);
mDayOfLabel = new QLabel( i18n("%1 of the year").arg(1), buttonGroup );
buttonLayout->addMultiCellWidget( mDayOfLabel, 1, 1, 1,3 );
}
void RecurYearly::setByDay( int doy )
{
mByDayRadio->setChecked( true );
mDayOfLabel->setText(i18n("%1 of the year").arg( doy ) );
}
void RecurYearly::setByMonth( int month, int day )
{
mByMonthRadio->setChecked( true );
mByMonthCombo->setCurrentItem( month - 1 );
mByDayLabel->setText(i18n("%1 of ").arg( day ) );
mDay = day;
}
bool RecurYearly::byMonth()
{
return mByMonthRadio->isChecked();
}
bool RecurYearly::byDay()
{
return mByDayRadio->isChecked();
}
int RecurYearly::month()
{
return mByMonthCombo->currentItem() + 1;
}
int RecurYearly::day()
{
return mDay;//mByDayCombo->currentItem() + 1;
}
//////////////////////////// ExceptionsWidget //////////////////////////
ExceptionsWidget::ExceptionsWidget( QWidget *parent, const char *name ) :
QWidget( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
- QGroupBox *groupBox = new QGroupBox( 1, Horizontal, i18n("Exceptions"),
+ Q3GroupBox *groupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Exceptions"),
this );
topLayout->addWidget( groupBox );
QWidget *box = new QWidget( groupBox );
- QGridLayout *boxLayout = new QGridLayout( box );
+ Q3GridLayout *boxLayout = new Q3GridLayout( box );
mExceptionDateEdit = new KDateEdit( box );
boxLayout->addWidget( mExceptionDateEdit, 0, 0 );
QPushButton *addExceptionButton = new QPushButton( i18n("Add"), box );
boxLayout->addWidget( addExceptionButton, 1, 0 );
QPushButton *changeExceptionButton = new QPushButton( i18n("Change"), box );
boxLayout->addWidget( changeExceptionButton, 2, 0 );
QPushButton *deleteExceptionButton = new QPushButton( i18n("Delete"), box );
boxLayout->addWidget( deleteExceptionButton, 3, 0 );
- mExceptionList = new QListBox( box );
+ mExceptionList = new Q3ListBox( box );
boxLayout->addMultiCellWidget( mExceptionList, 0, 3, 1, 1 );
boxLayout->setRowStretch( 4, 1 );
boxLayout->setColStretch( 1, 3 );
connect( addExceptionButton, SIGNAL( clicked() ),
SLOT( addException() ) );
connect( changeExceptionButton, SIGNAL( clicked() ),
SLOT( changeException() ) );
connect( deleteExceptionButton, SIGNAL( clicked() ),
SLOT( deleteException() ) );
if ( QApplication::desktop()->width() < 480 ) {
setMinimumWidth( 220 );
} else {
setMinimumWidth( 440 );
mExceptionDateEdit->setMinimumWidth( 200 );
}
}
void ExceptionsWidget::setDefaults( const QDateTime &from )
{
mExceptionList->clear();
mExceptionDates.clear();
mExceptionDateEdit->setDate( from.date() );
}
void ExceptionsWidget::addException()
{
QDate date = mExceptionDateEdit->date();
QString dateStr = KGlobal::locale()->formatDate( date );
if( !mExceptionList->findItem( dateStr ) ) {
mExceptionDates.append( date );
@@ -477,98 +485,98 @@ DateList ExceptionsWidget::dates()
///////////////////////// ExceptionsDialog ///////////////////////////
ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) :
KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel )
{
mExceptions = new ExceptionsWidget( this );
setMainWidget( mExceptions );
resize(220,10);
}
void ExceptionsDialog::setDefaults( const QDateTime &from )
{
mExceptions->setDefaults( from );
}
void ExceptionsDialog::setDates( const DateList &dates )
{
mExceptions->setDates( dates );
}
DateList ExceptionsDialog::dates()
{
return mExceptions->dates();
}
///////////////////////// RecurrenceRangeWidget ///////////////////////////
RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
const char *name )
: QWidget( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
- mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
+ mRangeGroupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Recurrence Range"),
this );
topLayout->addWidget( mRangeGroupBox );
QWidget *rangeBox = new QWidget( mRangeGroupBox );
- QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
+ Q3VBoxLayout *rangeLayout = new Q3VBoxLayout( rangeBox );
rangeLayout->setSpacing( KDialog::spacingHint() );
rangeLayout->setMargin( KDialog::marginHintSmall() );
mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
rangeLayout->addWidget( mStartDateLabel );
- mRangeButtonGroup = new QButtonGroup;
+ mRangeButtonGroup = new Q3ButtonGroup;
mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
mRangeButtonGroup->insert( mNoEndDateButton );
rangeLayout->addWidget( mNoEndDateButton );
- QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
+ Q3BoxLayout *durationLayout = new Q3HBoxLayout( rangeLayout );
durationLayout->setSpacing( KDialog::spacingHint() );
mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
mRangeButtonGroup->insert( mEndDurationButton );
durationLayout->addWidget( mEndDurationButton );
mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
durationLayout->addWidget( mEndDurationEdit );
QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
durationLayout ->addWidget( endDurationLabel );
- QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
+ Q3BoxLayout *endDateLayout = new Q3HBoxLayout( rangeLayout );
endDateLayout->setSpacing( KDialog::spacingHint() );
mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
mRangeButtonGroup->insert( mEndDateButton );
endDateLayout->addWidget( mEndDateButton );
mEndDateEdit = new KDateEdit( rangeBox );
endDateLayout->addWidget( mEndDateEdit );
//endDateLayout->addStretch( 1 );
connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
SLOT( showCurrentRange() ) );
connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
SLOT( showCurrentRange() ) );
connect( mEndDateButton, SIGNAL( toggled( bool ) ),
SLOT( showCurrentRange() ) );
}
RecurrenceRangeWidget::~RecurrenceRangeWidget()
{
delete mRangeButtonGroup;
}
void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
{
mNoEndDateButton->setChecked( true );
setDateTimes( from );
mEndDateEdit->setDate( from.date() );
}
void RecurrenceRangeWidget::setDuration( int duration )
@@ -637,158 +645,158 @@ void RecurrenceRangeDialog::setDefaults( const QDateTime &from )
void RecurrenceRangeDialog::setDuration( int duration )
{
mRecurrenceRangeWidget->setDuration( duration );
}
int RecurrenceRangeDialog::duration()
{
return mRecurrenceRangeWidget->duration();
}
void RecurrenceRangeDialog::setEndDate( const QDate &date )
{
mRecurrenceRangeWidget->setEndDate( date );
}
QDate RecurrenceRangeDialog::endDate()
{
return mRecurrenceRangeWidget->endDate();
}
void RecurrenceRangeDialog::setDateTimes( const QDateTime &start,
const QDateTime &end )
{
mRecurrenceRangeWidget->setDateTimes( start, end );
}
//////////////////////////// RecurrenceChooser ////////////////////////
RecurrenceChooser::RecurrenceChooser( QWidget *parent, const char *name ) :
QWidget( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
mTypeCombo = new QComboBox( this );
mTypeCombo->insertItem( i18n("Daily") );
mTypeCombo->insertItem( i18n("Weekly") );
mTypeCombo->insertItem( i18n("Monthly") );
mTypeCombo->insertItem( i18n("Yearly") );
topLayout->addWidget( mTypeCombo );
connect( mTypeCombo, SIGNAL( activated( int ) ), SLOT( emitChoice() ) );
}
int RecurrenceChooser::type()
{
if ( mTypeCombo ) {
return mTypeCombo->currentItem();
} else {
if ( mDailyButton->isChecked() ) return Daily;
else if ( mWeeklyButton->isChecked() ) return Weekly;
else if ( mMonthlyButton->isChecked() ) return Monthly;
else return Yearly;
}
}
void RecurrenceChooser::setType( int type )
{
if ( mTypeCombo ) {
mTypeCombo->setCurrentItem( type );
} else {
switch ( type ) {
case Daily:
mDailyButton->setChecked( true );
break;
case Weekly:
mWeeklyButton->setChecked( true );
break;
case Monthly:
mMonthlyButton->setChecked( true );
break;
case Yearly:
default:
mYearlyButton->setChecked( true );
break;
}
}
}
void RecurrenceChooser::emitChoice()
{
emit chosen ( type() );
}
/////////////////////////////// Main Widget /////////////////////////////
KOEditorRecurrence::KOEditorRecurrence( QWidget* parent, const char *name ) :
QWidget( parent, name )
{
- QGridLayout *topLayout = new QGridLayout( this, 2,2 );
+ Q3GridLayout *topLayout = new Q3GridLayout( this, 2,2 );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHintSmall() );
mEnabledCheck = new QCheckBox( i18n("Enable Recurrence"), this );
connect( mEnabledCheck, SIGNAL( toggled( bool ) ),
SLOT( setEnabled( bool ) ) );
topLayout->addMultiCellWidget( mEnabledCheck, 0, 0, 0, 1 );
- mTimeGroupBox = new QGroupBox( 1, Horizontal, i18n("Time"),
+ mTimeGroupBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Time"),
this );
topLayout->addMultiCellWidget( mTimeGroupBox, 1, 1 , 0 , 1 );
if ( QApplication::desktop()->width() <= 640 ) {
mTimeGroupBox->hide();
}
// QFrame *timeFrame = new QFrame( mTimeGroupBox );
// QBoxLayout *layoutTimeFrame = new QHBoxLayout( timeFrame );
// layoutTimeFrame->setSpacing( KDialog::spacingHint() );
mDateTimeLabel = new QLabel( mTimeGroupBox );
// mDateTimeLabel = new QLabel( timeFrame );
// layoutTimeFrame->addWidget( mDateTimeLabel );
//mTimeGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ) );
//mDateTimeLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum) );
- mRuleBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Rule"), this );
+ mRuleBox = new Q3GroupBox( 1, Qt::Horizontal, i18n("Recurrence Rule"), this );
topLayout->addMultiCellWidget( mRuleBox, 2, 2, 0, 1 );
mRecurrenceChooser = new RecurrenceChooser( mRuleBox );
connect( mRecurrenceChooser, SIGNAL( chosen( int ) ),
SLOT( showCurrentRule( int ) ) );
- mRuleStack = new QWidgetStack( mRuleBox );
+ mRuleStack = new Q3WidgetStack( mRuleBox );
mDaily = new RecurDaily( mRuleStack );
mRuleStack->addWidget( mDaily, 0 );
mWeekly = new RecurWeekly( mRuleStack );
mRuleStack->addWidget( mWeekly, 0 );
mMonthly = new RecurMonthly( mRuleStack );
mRuleStack->addWidget( mMonthly, 0 );
mYearly = new RecurYearly( mRuleStack );
mRuleStack->addWidget( mYearly, 0 );
showCurrentRule( mRecurrenceChooser->type() );
mRecurrenceRangeWidget = 0;
mRecurrenceRangeDialog = new RecurrenceRangeDialog( this );
mRecurrenceRange = mRecurrenceRangeDialog;
mRecurrenceRangeButton = new QPushButton( i18n("Recurrence Range..."),
this );
connect( mRecurrenceRangeButton, SIGNAL( clicked() ),
SLOT( showRecurrenceRangeDialog() ) );
mExceptionsWidget = 0;
mExceptionsDialog = new ExceptionsDialog( this );
mExceptions = mExceptionsDialog;
mExceptionsButton = new QPushButton( i18n("Exceptions..."), this );
if ( QApplication::desktop()->width() < 320 ) {
topLayout->addMultiCellWidget( mRecurrenceRangeButton, 3, 3, 0, 1 );
topLayout->addMultiCellWidget( mExceptionsButton, 4, 4, 0, 1 );
} else {
topLayout->addWidget( mRecurrenceRangeButton, 3, 0 );
@@ -867,66 +875,66 @@ void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to )
// qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() );
//setDateTimes( from, to );
bool enabled = false;
mEnabledCheck->setChecked( enabled );
setEnabled( enabled );
mExceptions->setDefaults( to );
mRecurrenceRange->setDefaults( to );
mRecurrenceChooser->setType( RecurrenceChooser::Weekly );
showCurrentRule( mRecurrenceChooser->type() );
mDaily->setFrequency( 1 );
mWeekly->setFrequency( 1 );
mMonthly->setFrequency( 1 );
mYearly->setFrequency( 1 );
setDefaultsDates( from, to );
}
void KOEditorRecurrence::readEvent(Incidence *event)
{
QDateTime dtEnd;
if ( event->typeID() == eventID )
dtEnd = ((Event*)event)->dtEnd();
else
dtEnd = ((Todo*)event)->dtDue();
setDefaults( event->dtStart(), dtEnd );
QBitArray rDays( 7 );
- QPtrList<Recurrence::rMonthPos> rmp;
- QPtrList<int> rmd;
+ Q3PtrList<Recurrence::rMonthPos> rmp;
+ Q3PtrList<int> rmd;
int day = 0;
int count = 0;
int month = 0;
setDateTimes( event->dtStart(), dtEnd );
int recurs = event->doesRecur();
mEnabledCheck->setChecked( recurs );
setEnabled( recurs );
int recurrenceType = RecurrenceChooser::Weekly;
if ( recurs ) {
Recurrence *r = event->recurrence();
int f = r->frequency();
switch ( recurs ) {
case Recurrence::rNone:
setDefaults( event->dtStart(), dtEnd );
break;
case Recurrence::rDaily:
recurrenceType = RecurrenceChooser::Daily;
mDaily->setFrequency( f );
break;
case Recurrence::rWeekly:
recurrenceType = RecurrenceChooser::Weekly;
mWeekly->setFrequency( f );
mWeekly->setDays( r->days() );
break;
case Recurrence::rMonthlyPos:
// we only handle one possibility in the list right now,
// so I have hardcoded calls with first(). If we make the GUI
@@ -939,65 +947,65 @@ void KOEditorRecurrence::readEvent(Incidence *event)
else
count = rmp.first()->rPos - 1;
day = 0;
while ( !rmp.first()->rDays.testBit( day ) ) ++day;
mMonthly->setByPos( count, day );
mMonthly->setFrequency( f );
break;
case Recurrence::rMonthlyDay:
recurrenceType = RecurrenceChooser::Monthly;
rmd = r->monthDays();
day = *rmd.first() - 1;
mMonthly->setByDay( day );
mMonthly->setFrequency( f );
break;
case Recurrence::rYearlyMonth:
{
recurrenceType = RecurrenceChooser::Yearly;
//qDebug("Recurrence::rYearlyMonth: ");
day = event->dtStart().date().day();
rmd = r->yearNums();
if ( rmd.count() > 0 )
month = *rmd.first();
else
month = event->dtStart().date().month() ;
mYearly->setByMonth( month, day );
#if 0
//qDebug("2day = %d ",day );
- QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
+ Q3PtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions();
int month;
if ( !monthlist.isEmpty() ) {
month = monthlist.first()->rPos ;
} else {
month = event->dtStart().date().month() ;
}
mYearly->setByMonth( day, month );
#endif
mYearly->setFrequency( f );
}
break;
case Recurrence::rYearlyDay:
//qDebug("Recurrence::rYearlyDay: ");
recurrenceType = RecurrenceChooser::Yearly;
mYearly->setByDay( event->dtStart().date().dayOfYear() );
mYearly->setFrequency( f );
break;
default:
setDefaults( event->dtStart(), dtEnd );
break;
}
}
mRecurrenceChooser->setType( recurrenceType );
showCurrentRule( recurrenceType );
mRecurrenceRange->setDateTimes( event->dtStart() );
if ( event->doesRecur() ) {
Recurrence *r = event->recurrence();
mRecurrenceRange->setDuration( r->duration() );
if ( r->duration() == 0 )
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index 75e0c73..6c012bd 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -1,327 +1,329 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOEDITORRECURRENCE_H
#define _KOEDITORRECURRENCE_H
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
-#include <qmultilineedit.h>
-#include <qlistview.h>
+#include <q3multilineedit.h>
+#include <q3listview.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
+#include <Q3ListBox>
+#include <Q3ComboBox>
#include <kdialogbase.h>
#include <libkcal/event.h>
#include "ktimeedit.h"
-class QWidgetStack;
+class Q3WidgetStack;
class QSpinBox;
class KDateEdit;
using namespace KCal;
class RecurBase : public QWidget
{
public:
RecurBase( QWidget *parent = 0, const char *name = 0 );
void setFrequency( int );
int frequency();
QWidget *frequencyEdit();
private:
QSpinBox *mFrequencyEdit;
};
class RecurDaily : public RecurBase
{
public:
RecurDaily( QWidget *parent = 0, const char *name = 0 );
};
class RecurWeekly : public RecurBase
{
public:
RecurWeekly( QWidget *parent = 0, const char *name = 0 );
void setDays( const QBitArray & );
QBitArray days();
private:
QCheckBox *mDayBoxes[7];
};
class RecurMonthly : public RecurBase
{
public:
RecurMonthly( QWidget *parent = 0, const char *name = 0 );
void setByDay( int day );
void setByPos( int count, int weekday );
bool byDay();
bool byPos();
int day();
int count();
int weekday();
private:
QRadioButton *mByDayRadio;
- QComboBox *mByDayCombo;
+ Q3ComboBox *mByDayCombo;
QRadioButton *mByPosRadio;
QComboBox *mByPosCountCombo;
QComboBox *mByPosWeekdayCombo;
};
class RecurYearly : public RecurBase
{
public:
RecurYearly( QWidget *parent = 0, const char *name = 0 );
void setByDay( int doy );
void setByMonth( int month, int day );
bool byMonth();
bool byDay();
int month();
int day();
private:
int mDay;
QRadioButton *mByMonthRadio;
- QComboBox *mByMonthCombo;
+ Q3ComboBox *mByMonthCombo;
QLabel* mByDayLabel;
QLabel* mDayOfLabel;
QRadioButton *mByDayRadio;
};
class RecurrenceChooser : public QWidget
{
Q_OBJECT
public:
RecurrenceChooser( QWidget *parent = 0, const char *name = 0 );
enum { Daily, Weekly, Monthly, Yearly };
void setType( int );
int type();
signals:
void chosen( int );
protected slots:
void emitChoice();
private:
QComboBox *mTypeCombo;
QRadioButton *mDailyButton;
QRadioButton *mWeeklyButton;
QRadioButton *mMonthlyButton;
QRadioButton *mYearlyButton;
};
class ExceptionsBase
{
public:
virtual void setDefaults( const QDateTime &from ) = 0;
virtual void setDates( const DateList & ) = 0;
virtual DateList dates() = 0;
};
class ExceptionsWidget : public QWidget, public ExceptionsBase
{
Q_OBJECT
public:
ExceptionsWidget( QWidget *parent = 0, const char *name = 0 );
void setDefaults( const QDateTime &from );
void setDates( const DateList & );
DateList dates();
protected slots:
void addException();
void changeException();
void deleteException();
private:
KDateEdit *mExceptionDateEdit;
- QListBox *mExceptionList;
+ Q3ListBox *mExceptionList;
DateList mExceptionDates;
};
class ExceptionsDialog : public KDialogBase, public ExceptionsBase
{
public:
ExceptionsDialog( QWidget *parent, const char *name = 0 );
void setDefaults( const QDateTime &from );
void setDates( const DateList & );
DateList dates();
private:
ExceptionsWidget *mExceptions;
};
class RecurrenceRangeBase
{
public:
virtual void setDefaults( const QDateTime &from ) = 0;
virtual void setDuration( int ) = 0;
virtual int duration() = 0;
virtual void setEndDate( const QDate & ) = 0;
virtual QDate endDate() = 0;
virtual void setDateTimes( const QDateTime &start,
const QDateTime &end = QDateTime() ) = 0;
};
class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase
{
Q_OBJECT
public:
RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 );
~RecurrenceRangeWidget();
void setDefaults( const QDateTime &from );
void setDuration( int );
int duration();
void setEndDate( const QDate & );
QDate endDate();
void setDateTimes( const QDateTime &start,
const QDateTime &end = QDateTime() );
protected slots:
void showCurrentRange();
private:
- QButtonGroup *mRangeButtonGroup;
- QGroupBox *mRangeGroupBox;
+ Q3ButtonGroup *mRangeButtonGroup;
+ Q3GroupBox *mRangeGroupBox;
QLabel *mStartDateLabel;
QRadioButton *mNoEndDateButton;
QRadioButton *mEndDurationButton;
QSpinBox *mEndDurationEdit;
QRadioButton *mEndDateButton;
KDateEdit *mEndDateEdit;
};
class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase
{
public:
RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 );
void setDefaults( const QDateTime &from );
void setDuration( int );
int duration();
void setEndDate( const QDate & );
QDate endDate();
void setDateTimes( const QDateTime &start,
const QDateTime &end = QDateTime() );
private:
RecurrenceRangeWidget *mRecurrenceRangeWidget;
};
class KOEditorRecurrence : public QWidget
{
Q_OBJECT
public:
KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 );
virtual ~KOEditorRecurrence();
enum { Daily, Weekly, Monthly, Yearly };
/** Read event object and setup widgets accordingly */
void readEvent( Incidence * );
/** Write event settings to event object */
void writeEvent( Incidence * );
/** Check if the input is valid. */
bool validateInput();
public slots:
void setDefaultsDates( QDateTime from, QDateTime to );
void setDefaults( QDateTime from, QDateTime to );
void setEnabled( bool );
void setDateTimes( QDateTime start, QDateTime end );
void setDateTimeStr( const QString & );
signals:
void dateTimesChanged( QDateTime start, QDateTime end );
protected slots:
void showCurrentRule( int );
void showExceptionsDialog();
void showRecurrenceRangeDialog();
private:
QCheckBox *mEnabledCheck;
- QGroupBox *mTimeGroupBox;
+ Q3GroupBox *mTimeGroupBox;
QLabel *mDateTimeLabel;
- QGroupBox *mRuleBox;
- QWidgetStack *mRuleStack;
+ Q3GroupBox *mRuleBox;
+ Q3WidgetStack *mRuleStack;
RecurrenceChooser *mRecurrenceChooser;
RecurDaily *mDaily;
RecurWeekly *mWeekly;
RecurMonthly *mMonthly;
RecurYearly *mYearly;
RecurrenceRangeBase *mRecurrenceRange;
RecurrenceRangeWidget *mRecurrenceRangeWidget;
RecurrenceRangeDialog *mRecurrenceRangeDialog;
QPushButton *mRecurrenceRangeButton;
ExceptionsBase *mExceptions;
ExceptionsDialog *mExceptionsDialog;
ExceptionsWidget *mExceptionsWidget;
QPushButton *mExceptionsButton;
};
#endif
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 3e87197..62ad250 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -1,64 +1,69 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qpixmap.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qtimer.h>
#include <qdir.h>
#include <qlayout.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3PtrList>
+#include <Q3VBoxLayout>
#include <kiconloader.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
#include "koprefs.h"
#include "koeventeditor.h"
extern int globalFlagBlockAgenda;
KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
{
mEvent = 0;
init();
if ( QApplication::desktop()->height() <= 240 )
hideButtons();
}
KOEventEditor::~KOEventEditor()
{
//emit dialogClose( mEvent );
@@ -76,143 +81,143 @@ void KOEventEditor::init()
mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
mRecurrence,SLOT(setDateTimeStr(const QString &)));
// Category dialog
// connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
//connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
// mGeneral,SLOT(setCategories(const QString &)));
}
void KOEventEditor::reload()
{
if ( mEvent ) readEvent( mEvent );
}
void KOEventEditor::setSecrecy( int sec )
{
mGeneral->setSecrecy( sec );
}
void KOEventEditor::setCategories( QString s )
{
mGeneral->setCategories(s);
}
void KOEventEditor::setupGeneral()
{
mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
if( KOPrefs::instance()->mCompactDialogs ) {
- QFrame *topFrame = addPage(i18n("General"));
- QBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ Q3Frame *topFrame = addPage(i18n("General"));
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
topLayout->setSpacing(spacingHint()-1);
topLayout->setMargin(marginHint()-1);
topLayout->addStretch ( 1 );
mGeneral->initHeader(topFrame,topLayout);
topLayout->addStretch ( 1 );
mGeneral->initTime(topFrame,topLayout);
topLayout->addStretch ( 1 );
// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
mGeneral->initAlarm(topFrame,topLayout);
topLayout->addStretch ( 1 );
mGeneral->enableAlarm( false );
- QBoxLayout *buttonLayout;
+ Q3BoxLayout *buttonLayout;
if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 )
- buttonLayout = new QVBoxLayout( topLayout );
+ buttonLayout = new Q3VBoxLayout( topLayout );
else
- buttonLayout = new QHBoxLayout( topLayout );
- QHBox* buttonWidget = new QHBox (topFrame);
- QIconSet icon;
+ buttonLayout = new Q3HBoxLayout( topLayout );
+ Q3HBox* buttonWidget = new Q3HBox (topFrame);
+ QIcon icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileexport16");
else
icon = SmallIcon("fileexport");
QPushButton * loadTemplate = new QPushButton( buttonWidget);
QPushButton * saveTemplate = new QPushButton( buttonWidget);
saveTemplate->setIconSet (icon ) ;
int size = saveTemplate->sizeHint().height();
saveTemplate->setFixedSize( size, size );
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileimport16");
else
icon = SmallIcon("fileimport");
loadTemplate->setIconSet (icon ) ;
loadTemplate->setFixedSize( size, size );
buttonLayout->addWidget( buttonWidget );
mGeneral->initCategories( topFrame, buttonLayout );
topLayout->addStretch( 1 );
- QFrame *topFrame2 = addPage(i18n("Details"));
+ Q3Frame *topFrame2 = addPage(i18n("Details"));
- QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
+ Q3BoxLayout *topLayout2 = new Q3VBoxLayout(topFrame2);
topLayout2->setSpacing(spacingHint()-1);
topLayout2->setMargin(marginHint()-1);
topLayout2->setSpacing(spacingHint());
mGeneral->initClass(topFrame2,topLayout2);
mGeneral->initSecrecy( topFrame2, topLayout2 );
mGeneral->initDescription(topFrame2,topLayout2);
connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
} else {
- QFrame *topFrame = addPage(i18n("General"));
+ Q3Frame *topFrame = addPage(i18n("General"));
- QBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
topLayout->setSpacing(spacingHint());
mGeneral->initHeader(topFrame,topLayout);
mGeneral->initTime(topFrame,topLayout);
- QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *alarmLineLayout = new Q3HBoxLayout(topLayout);
mGeneral->initAlarm(topFrame,alarmLineLayout);
mGeneral->initClass(topFrame,alarmLineLayout);
mGeneral->initDescription(topFrame,topLayout);
- QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *detailsLayout = new Q3HBoxLayout(topLayout);
mGeneral->initCategories( topFrame, detailsLayout );
mGeneral->initSecrecy( topFrame, detailsLayout );
}
mGeneral->finishSetup();
}
void KOEventEditor::setupRecurrence()
{
- QFrame *topFrame = addPage( i18n("Recurrence") );
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = addPage( i18n("Recurrence") );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
mRecurrence = new KOEditorRecurrence( topFrame );
topLayout->addWidget( mRecurrence );
}
void KOEventEditor::editEvent(Event *event, bool showDescription)
{
// init();
mEvent = event;
readEvent(mEvent);
if ( showDescription ) {
showPage( 1 );
mGeneral->setFocusOn( 1 );
} else {
showPage( 0 );
mGeneral->setFocusOn( 2 );
}
}
void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
{
// init();
mEvent = 0;
setDefaults(from,to,allDay);
}
void KOEventEditor::loadDefaults()
{
int fmt = KOPrefs::instance()->mStartTime;
@@ -327,62 +332,62 @@ bool KOEventEditor::validateInput()
{
if (!mGeneral->validateInput()) return false;
if (!mDetails->validateInput()) return false;
if (!mRecurrence->validateInput()) return false;
return true;
}
int KOEventEditor::msgItemDelete()
{
return KMessageBox::warningContinueCancel(this,
i18n("This item will be permanently deleted."),
i18n("KOrganizer Confirmation"),i18n("Delete"));
}
void KOEventEditor::slotLoadTemplate()
{
QString fileName =locateLocal( "templates", "events" );
QDir t_dir;
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/event";
fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this );
if ( fileName.length() == 0 )
return;
CalendarLocal cal;
ICalFormat format;
if ( !format.load( &cal, fileName ) ) {
KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
.arg( fileName ) );
return ;
}
- QPtrList<Event> events = cal.events();
+ Q3PtrList<Event> events = cal.events();
Event* event = events.first();
if ( !event ) {
KMessageBox::error( this,
i18n("Template does not contain\na valid Event."));
} else {
kdDebug() << "KOEventEditor::slotLoadTemplate(): readTemplate" << endl;
readEvent( event, true );
}
}
void KOEventEditor::slotSaveTemplate()
{
QString fileName =locateLocal( "templates", "events" );
QDir t_dir;
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/event";
fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Event template"), this );
if ( fileName.length() > 0 )
saveTemplate( fileName );
}
void KOEventEditor::saveTemplate( const QString &templateName )
{
Event *event = new Event;
writeEvent( event );
saveAsTemplate( event, templateName );
}
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index fc4d9a4..81047c1 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -1,109 +1,112 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcursor.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PopupMenu>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <libkcal/event.h>
#include "koeventpopupmenu.h"
#include "koprefs.h"
-KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu()
+KOEventPopupMenu::KOEventPopupMenu(): Q3PopupMenu()
{
mCurrentIncidence = 0;
mHasAdditionalItems = false;
mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow())));
mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit())));
mEditOnlyItems.append(insertItem (i18n("&Delete..."),
this,SLOT(popupDelete())));
mEditOnlyItems.append(insertItem (i18n("&Clone..."),
this,SLOT(popupClone())));
mEditOnlyItems.append(insertItem (i18n("&Move..."),
this,SLOT(popupMove())));
#ifndef DESKTOP_VERSION
mEditOnlyItems.append(insertItem (i18n("&Beam..."),
this,SLOT(popupBeam())));
#endif
mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"),
this,SLOT(popupCancel())));
isDisabled = false;
- mCatPopup = new QPopupMenu ( this );
+ mCatPopup = new Q3PopupMenu ( this );
mCatPopup->setCheckable (true);
connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup()));
connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int )));
- mCalPopup = new QPopupMenu ( this );
+ mCalPopup = new Q3PopupMenu ( this );
mCalPopup->setCheckable (true);
connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup()));
connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int )));
//mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup ));
//mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup ));
insertItem (i18n("Categories"),mCatPopup );
insertItem (i18n("Calendar"),mCalPopup );
- QValueList<int>::Iterator it;
+ Q3ValueList<int>::Iterator it;
for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
mSingleOnlyItems.append(*it);
}
}
void KOEventPopupMenu::enableDefault( bool enable )
{
isDisabled = !enable;
- QValueList<int>::Iterator it;
+ Q3ValueList<int>::Iterator it;
for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) {
setItemEnabled(*it,enable);
}
}
void KOEventPopupMenu::fillCalPopup() // CAL
{
mCalPopup->clear();
if (!mCurrentIncidence) return;
bool readO = mCurrentIncidence->isReadOnly()|| isDisabled;
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber);
if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO )
mCalPopup->setItemEnabled( index, false );
mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID());
kkf = KOPrefs::instance()->mCalendars.next();
}
}
void KOEventPopupMenu::computeCalPopup( int index ) // CAL
{
if (!mCurrentIncidence) return;
mCurrentIncidence->setCalID( index );
emit categoryChanged( mCurrentIncidence );
}
void KOEventPopupMenu::fillCatPopup()
{
mCatPopup->clear();
if (!mCurrentIncidence) return;
bool readO = mCurrentIncidence->isReadOnly() || isDisabled;
QStringList checkedCategories = mCurrentIncidence->categories();
int index = 0;
@@ -117,74 +120,74 @@ void KOEventPopupMenu::fillCatPopup()
if ( readO )
mCatPopup->setItemEnabled( index, false );
++index;
}
}
void KOEventPopupMenu::computeCatPopup( int index )
{
if (!mCurrentIncidence) return;
QStringList categories = mCurrentIncidence->categories();
QString colcat = categories.first();
if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
categories.remove (KOPrefs::instance()->mCustomCategories[index]);
else
categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
categories.sort ();
if ( !colcat.isEmpty() ) {
if ( categories.find ( colcat ) != categories.end () ) {
categories.remove( colcat );
categories.prepend( colcat );
}
}
mCurrentIncidence->setCategories( categories );
emit categoryChanged( mCurrentIncidence );
}
void KOEventPopupMenu::showIncidencePopup(Incidence *incidence)
{
if ( !incidence) return;
mCurrentIncidence = incidence;
if (mCurrentIncidence) {
// Enable/Disabled menu items only valid for editable events.
if ( !isDisabled ) {
- QValueList<int>::Iterator it;
+ Q3ValueList<int>::Iterator it;
for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) {
setItemEnabled(*it,!mCurrentIncidence->isReadOnly());
}
}
popup(QCursor::pos());
}
}
-void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text,
+void KOEventPopupMenu::addAdditionalItem(const QIcon &icon,const QString &text,
const QObject *receiver, const char *member,
bool editOnly)
{
if (!mHasAdditionalItems) {
mHasAdditionalItems = true;
insertSeparator();
}
int id = insertItem(icon,text,receiver,member);
if (editOnly) mEditOnlyItems.append(id);
}
void KOEventPopupMenu::popupShow()
{
if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence);
}
void KOEventPopupMenu::popupEdit()
{
if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence);
}
void KOEventPopupMenu::popupDelete()
{
if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence);
}
void KOEventPopupMenu::popupClone()
{
if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence);
}
void KOEventPopupMenu::popupCancel()
{
if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence);
diff --git a/korganizer/koeventpopupmenu.h b/korganizer/koeventpopupmenu.h
index e28745b..de5220b 100644
--- a/korganizer/koeventpopupmenu.h
+++ b/korganizer/koeventpopupmenu.h
@@ -1,83 +1,85 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOEVENTPOPUPMENU_H
#define KOEVENTPOPUPMENU_H
//
// Context menu for event views with standard event actions
//
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libkcal/incidence.h>
using namespace KCal;
-class KOEventPopupMenu : public QPopupMenu {
+class KOEventPopupMenu : public Q3PopupMenu {
Q_OBJECT
public:
KOEventPopupMenu();
- void addAdditionalItem(const QIconSet &icon,const QString &text,
+ void addAdditionalItem(const QIcon &icon,const QString &text,
const QObject *receiver, const char *member,
bool editOnly=false);
public slots:
void showIncidencePopup(Incidence *);
void enableDefault( bool );
protected slots:
void popupShow();
void popupEdit();
void popupDelete();
void popupClone();
void popupCancel();
void popupMove();
void popupBeam();
void fillCatPopup();
void computeCatPopup( int );
void fillCalPopup();
void computeCalPopup( int );
signals:
void editIncidenceSignal(Incidence *);
void showIncidenceSignal(Incidence *);
void deleteIncidenceSignal(Incidence *);
void cloneIncidenceSignal(Incidence *);
void cancelIncidenceSignal(Incidence *);
void moveIncidenceSignal(Incidence *);
void beamIncidenceSignal(Incidence *);
void categoryChanged( Incidence * );
private:
Incidence *mCurrentIncidence;
bool mHasAdditionalItems;
- QValueList<int> mEditOnlyItems;
- QValueList<int> mSingleOnlyItems;
+ Q3ValueList<int> mEditOnlyItems;
+ Q3ValueList<int> mSingleOnlyItems;
bool isDisabled;
- QPopupMenu *mCatPopup;
- QPopupMenu *mCalPopup;
+ Q3PopupMenu *mCatPopup;
+ Q3PopupMenu *mCalPopup;
};
#endif
diff --git a/korganizer/koeventview.cpp b/korganizer/koeventview.cpp
index 1d26930..a4ba85e 100644
--- a/korganizer/koeventview.cpp
+++ b/korganizer/koeventview.cpp
@@ -1,108 +1,108 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcursor.h>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <libkcal/calendar.h>
#include "koprefs.h"
#include "koeventview.h"
using namespace KOrg;
//---------------------------------------------------------------------------
KOEventView::KOEventView(Calendar *cal,QWidget *parent,const char *name)
: KOrg::BaseView(cal,parent,name)
{
}
//---------------------------------------------------------------------------
KOEventView::~KOEventView()
{
}
//---------------------------------------------------------------------------
KOEventPopupMenu *KOEventView::eventPopup()
{
KOEventPopupMenu *eventPopup = new KOEventPopupMenu;
connect(eventPopup,SIGNAL(editIncidenceSignal(Incidence *)),
SIGNAL(editIncidenceSignal(Incidence *)));
connect(eventPopup,SIGNAL(showIncidenceSignal(Incidence *)),
SIGNAL(showIncidenceSignal(Incidence *)));
connect(eventPopup,SIGNAL(deleteIncidenceSignal(Incidence *)),
SIGNAL(deleteIncidenceSignal(Incidence *)));
connect(eventPopup,SIGNAL(cancelIncidenceSignal(Incidence *)),
SIGNAL(cancelIncidenceSignal(Incidence *)));
connect(eventPopup,SIGNAL(cloneIncidenceSignal(Incidence *)),
SIGNAL(cloneIncidenceSignal(Incidence *)));
connect(eventPopup,SIGNAL(beamIncidenceSignal(Incidence *)),
SIGNAL(beamIncidenceSignal(Incidence *)));
connect(eventPopup,SIGNAL(moveIncidenceSignal(Incidence *)),
SIGNAL(moveIncidenceSignal(Incidence *)));
return eventPopup;
}
//---------------------------------------------------------------------------
-void KOEventView::showIncidencePopup(QPopupMenu *popup,Incidence *event)
+void KOEventView::showIncidencePopup(Q3PopupMenu *popup,Incidence *event)
{
mCurrentIncidence = event;
if (event) popup->popup(QCursor::pos());
}
//---------------------------------------------------------------------------
void KOEventView::popupShow()
{
emit showIncidenceSignal(mCurrentIncidence);
}
//---------------------------------------------------------------------------
void KOEventView::popupEdit()
{
emit editIncidenceSignal(mCurrentIncidence);
}
//---------------------------------------------------------------------------
void KOEventView::popupDelete()
{
emit deleteIncidenceSignal(mCurrentIncidence);
}
void KOEventView::popupClone()
{
emit cloneIncidenceSignal(mCurrentIncidence);
}
void KOEventView::popupCancel()
{
emit cancelIncidenceSignal(mCurrentIncidence);
diff --git a/korganizer/koeventview.h b/korganizer/koeventview.h
index 77ec111..f28e68b 100644
--- a/korganizer/koeventview.h
+++ b/korganizer/koeventview.h
@@ -1,122 +1,124 @@
/*
This file is part of KOrganizer.
Copyright (c) 1999 Preston Brown <pbrown@kde.org>
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOEVENTVIEW_H
#define _KOEVENTVIEW_H
#include <libkcal/calendar.h>
#include <libkcal/event.h>
#include <korganizer/baseview.h>
#include "koeventpopupmenu.h"
+//Added by qt3to4:
+#include <Q3PopupMenu>
using namespace KCal;
class CalPrinter;
/**
KOEventView is the abstract base class from which all other
calendar views for event data are derived. It provides methods for
displaying
appointments and events on one or more days. The actual number of
days that a view actually supports is not defined by this abstract class;
that is up to the classes that inherit from it. It also provides
methods for updating the display, retrieving the currently selected
event (or events), and the like.
@short Abstract class from which all event views are derived.
@author Preston Brown <pbrown@kde.org>
@see KOListView, KOAgendaView, KOWeekView, KOMonthView
*/
class KOEventView : public KOrg::BaseView
{
Q_OBJECT
public:
/**
* Constructs a view.
* @param cal is a pointer to the calendar object from which events
* will be retrieved for display.
*/
KOEventView(Calendar *cal,QWidget *parent=0,const char *name=0);
/**
* Destructor. Views will do view-specific cleanups here.
*/
virtual ~KOEventView();
/**
* provides a hint back to the caller on the maximum number of dates
* that the view supports. A return value of 0 means no maximum.
*/
virtual int maxDatesHint() = 0;
/**
* Construct a standard context menu for an event.
*/
KOEventPopupMenu *eventPopup();
/** This view is an view for displaying events. */
bool isEventView() { return true; }
public slots:
/**
* Show context menu for event.
* @param event event, which is to be manipulated by the menu actions
* @param popup a popop menu created with eventPopup()
*/
- void showIncidencePopup(QPopupMenu *popup, Incidence *event);
+ void showIncidencePopup(Q3PopupMenu *popup, Incidence *event);
/**
Perform the default action for an incidence, e.g. open the event editor,
when double-clicking an event in the agenda view.
*/
void defaultAction( Incidence * );
signals:
/**
* when the view changes the dates that are selected in one way or
* another, this signal is emitted. It should be connected back to
* the @see KDateNavigator object so that it changes appropriately,
* and any other objects that need to be aware that the list of
* selected dates has changed.
*/
void datesSelected(const DateList);
/**
* instructs the receiver to show the incidence in read-only mode.
*/
void showIncidenceSignal(Incidence *);
/**
* instructs the receiver to begin editing the incidence specified in
* some manner. Doesn't make sense to connect to more than one
* receiver.
*/
void editIncidenceSignal(Incidence *);
void cloneIncidenceSignal(Incidence *);
void cancelIncidenceSignal(Incidence *);
void beamIncidenceSignal(Incidence *);
void moveIncidenceSignal(Incidence *);
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index c0acf34..4df26a9 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,295 +1,300 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <qcstring.h>
-#include <qwhatsthis.h>
+#include <q3cstring.h>
+#include <q3whatsthis.h>
#include <qdialog.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlabel.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3PtrList>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kapplication.h>
#include <libkcal/event.h>
#include <libkcal/todo.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <krun.h>
#include <kglobal.h>
#include <kprocess.h>
#include "koprefs.h"
#include <kabc/stdaddressbook.h>
#ifndef KORG_NODCOP
#include <dcopclient.h>
#include "korganizer.h"
#include "koprefs.h"
#include "actionmanager.h"
#endif
#include "koeventviewer.h"
//#ifndef KORG_NOKABC
//#include <kabc/stdaddressbook.h>
//#define size count
//#endif
#ifdef DESKTOP_VERSION
#include <kabc/addresseedialog.h>
#include <kabc/addresseeview.h>
#include <qprinter.h>
#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#else //DESKTOP_VERSION
#include <qtopia/qcopenvelope_qws.h>
#endif //DESKTOP_VERSION
#include <externalapphandler.h>
KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
- : QTextBrowser(parent,name)
+ : Q3TextBrowser(parent,name)
{
mSyncMode = false;
mColorMode = 0;
}
KOEventViewer::~KOEventViewer()
{
}
void KOEventViewer::printMe()
{
#ifdef DESKTOP_VERSION
KOPrintPrefs pp ( this );
if (!pp.exec() )
return;
int scaleval = pp.printMode() ;
QPrinter printer;
if (!printer.setup() )
return;
QPainter p;
p.begin ( &printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
p.scale( scale, scale );
}
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
#endif
}
void KOEventViewer::setSource(const QString& n)
{
if ( n.left(8) == "todo_uid" ) {
int midstr = 9;
#ifdef DESKTOP_VERSION
midstr = 11;
#endif
//qDebug("-%s- ", n.mid(midstr).latin1());
emit showIncidence( n.mid(midstr) );
return;
}
if ( n.left(3) == "uid" )
#ifdef DESKTOP_VERSION
{
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
// LR I do not understand, why the uid string is different on zaurus and desktop
QString uid = "uid://"+(*it).uid();
//qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
if (n == uid ) {
//qDebug("found %s ",(*it).mobileHomePhone().latin1() );
QDialog dia( this,"dia123", true );
dia.setCaption( i18n("Details of attendee") );
- QVBoxLayout lay ( &dia );
+ Q3VBoxLayout lay ( &dia );
KABC::AddresseeView av ( &dia );
av.setAddressee( (*it) );
lay.addWidget( &av );
if ( QApplication::desktop()->width() < 480 )
dia.resize( 220, 240);
else {
dia.resize( 400,400);
}
dia.exec();
break;
}
}
return;
}
#else
{
if ( "uid:organizer" == n ) {
ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
return;
}
- QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
+ Q3PtrList<Attendee> attendees = mCurrentIncidence->attendees();
if (attendees.count()) {
Attendee *a;
for(a=attendees.first();a;a=attendees.next()) {
if ( "uid:"+a->uid() == n ) {
bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
return;
}
}
}
return;
}
//requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
// the result should now arrive through method insertAttendees
//QString uid = "uid:"+(*it).uid();
#endif
if ( n.left(6) == "mailto" ) {
// qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
//#ifndef DESKTOP_VERSION
if ( n.mid(7,3) == "ALL" ) {
mailToAttendees( true );
} else if ( n.mid(7,4) == "RSVP" ) {
mailToAttendees( false );
} else {
ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
//QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
//e << n.mid(7);
}
//#endif
}
#ifndef KORG_NODCOP
kdDebug() << "KOEventViewer::setSource(): " << n << endl;
QString tmpStr;
if (n.startsWith("mailto:")) {
KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
//emit showIncidence(n);
return;
} else if (n.startsWith("uid:")) {
DCOPClient *client = KApplication::kApplication()->dcopClient();
const QByteArray noParamData;
const QByteArray paramData;
QByteArray replyData;
- QCString replyTypeStr;
+ Q3CString replyTypeStr;
#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
bool foundAbbrowser = PING_ABBROWSER;
if (foundAbbrowser) {
//KAddressbook is already running, so just DCOP to it to bring up the contact editor
//client->send("kaddressbook","KAddressBookIface",
- QDataStream arg(paramData, IO_WriteOnly);
+ QDataStream arg(paramData, QIODevice::WriteOnly);
arg << n.mid(6);
client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
return;
} else {
/*
KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
We start it without its main interface
*/
KIconLoader* iconLoader = new KIconLoader();
QString iconPath = iconLoader->iconPath("go",KIcon::Small);
ActionManager::setStartedKAddressBook(true);
tmpStr = "kaddressbook --editor-only --uid ";
tmpStr += KProcess::quote(n.mid(6));
KRun::runCommand(tmpStr,"KAddressBook",iconPath);
return;
}
} else {
//QTextBrowser::setSource(n);
}
#endif
}
void KOEventViewer::mailToAttendees( bool all )
{
- QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
+ Q3PtrList<Attendee> attendees = mCurrentIncidence->attendees();
if (attendees.count() == 0) return;
QStringList nameList;
QStringList emailList;
QStringList uidList;
Attendee* a;
for(a=attendees.first();a;a=attendees.next()) {
if ( !all && !a->RSVP() ) continue;
if (!a->email().isEmpty()) {
#ifndef DESKTOP_VERSION
nameList.append (a->realName() );
emailList.append (a->email() );
uidList.append (a->uid() );
#else
emailList.append(a->realName() +" <" + a->email() +">");
#endif
}
}
#ifndef DESKTOP_VERSION
QString uid = "ComposeMailUIpick2"+mMailSubject;
bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
#else
ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject );
#endif
}
void KOEventViewer::addTag(const QString & tag,const QString & text)
{
- int number=text.contains("\n");
+ int number=text.count("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
void KOEventViewer::setColorMode( int m )
{
mColorMode = m;
}
void KOEventViewer::appendEvent(Event *event, int mode )
{
@@ -558,182 +563,182 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
if ( KOPrefs::instance()->mEVshowCreated ) {
if(wideScreen ){
addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
} else {
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
}
}
if ( KOPrefs::instance()->mEVshowChanged ) {
if(wideScreen ){
addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) );
} else {
addTag("p",i18n("<b>Last modified: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
}
}
if ( event->relatedTo() ) {
addTag("b",i18n("Parent todo:<br>"));
QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary());
mText += t_name;
mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">";
mText += deTag(event->relatedTo()->summary());
mText += "</a><br>";
// mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>");
}
- QPtrList<Incidence> Relations = event->relations();
+ Q3PtrList<Incidence> Relations = event->relations();
Incidence *to;
if ( Relations.first() )
addTag("b",i18n("Sub todos:<br>"));
for (to=Relations.first();to;to=Relations.next()) {
QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary());
mText += t_name;
mText += "<a href=\"todo_uid:" + to->uid() + "\">";
mText += deTag(to->summary());
mText += "</a><br>";
}
if ( KOPrefs::instance()->mEVshowDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",deTag(event->description()));
}
}
setText(mText);
}
void KOEventViewer::formatCategories(Incidence *event)
{
if (!event->categoriesStr().isEmpty()) {
if (event->categories().count() == 1) {
addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace());
} else {
addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ;
}
}
}
void KOEventViewer::formatAttendees(Incidence *event)
{
- QPtrList<Attendee> attendees = event->attendees();
+ Q3PtrList<Attendee> attendees = event->attendees();
if (attendees.count()) {
QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
addTag("h3",i18n("Organizer"));
mText.append("<ul><li>");
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(event->organizer());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText.append(event->organizer());
}
#else //DESKTOP_VERSION
mText += "<a href=\"uid:organizer\">";
mText += event->organizer();
mText += "</a>\n";
#endif //DESKTOP_VERSION
#else
mText.append(event->organizer());
#endif
- if (iconPath) {
+ if (!iconPath.isEmpty()) {
mText += " <a href=\"mailto:" + event->organizer() + "\">";
mText += "<IMG src=\"" + iconPath + "\">";
mText += "</a>\n";
}
mText.append("</li></ul>");
addTag("h3",i18n("Attendees"));
Attendee *a;
mText.append("<ul>");
int a_count = 0;
int a_count_nr = 0;
for(a=attendees.first();a;a=attendees.next()) {
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
if (a->name().isEmpty()) {
addressList = add_book->findByEmail(a->email());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText += "<li>";
mText.append(a->email());
mText += "\n";
}
} else {
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
}
#else //DESKTOP_VERSION
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
#endif //DESKTOP_VERSION
#else
//qDebug("nokabc ");
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
#endif
if (!a->email().isEmpty()) {
- if (iconPath) {
+ if (!iconPath.isEmpty()) {
mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">";
if ( a->RSVP() ) {
++a_count_nr;
mText += "<IMG src=\"" + iconPath + "\">";
}
else {
++a_count;
mText += "<IMG src=\"" + NOiconPath + "\">";
}
mText += "</a>\n";
}
}
if (a->status() != Attendee::NeedsAction )
mText +="[" + a->statusStr() + "] ";
if (a->role() == Attendee::Chair )
mText +="(" + a->roleStr().left(1) + ".)";
}
mText.append("</li></ul>");
if ( (a_count+a_count_nr) > 1 ) {
mText += "<a href=\"mailto:ALL\">";
mText += i18n( "Mail to all" );
mText += "</a> ( ";
mText += "<IMG src=\"" + iconPath + "\">";
mText += i18n( " and " );
mText += "<IMG src=\"" + NOiconPath + "\"> )";
mText += "<br>\n";
}
if ( a_count_nr > 1 ) {
mText += "<a href=\"mailto:RSVP\">";
mText += i18n( "Mail to selected" );
@@ -833,36 +838,36 @@ void KOEventViewer::clearEvents(bool now)
mText = "";
if (now) setText(mText);
}
void KOEventViewer::addText(QString text)
{
mText.append(text);
setText(mText);
}
QString KOEventViewer::deTag(QString text)
{
#if QT_VERSION >= 0x030000
text.replace( '<' , "&lt;" );
text.replace( '>' , "&gt;" );
#else
if ( text.find ('<') >= 0 ) {
text.replace( QRegExp("<") , "&lt;" );
}
if ( text.find ('>') >= 0 ) {
text.replace( QRegExp(">") , "&gt;" );
}
#endif
return text;
}
void KOEventViewer::keyPressEvent ( QKeyEvent * e )
{
switch ( e->key() ) {
case Qt::Key_Return:
case Qt::Key_Enter :
e->ignore();
break;
default:
- QTextBrowser::keyPressEvent ( e );
+ Q3TextBrowser::keyPressEvent ( e );
break;
}
}
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 64eb4ff..3df667f 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -1,132 +1,135 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOEVENTVIEWER_H
#define KOEVENTVIEWER_H
//
// Viewer widget for events.
//
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <QKeyEvent>
#include <libkcal/event.h>
#include <libkcal/journal.h>
using namespace KCal;
#ifdef DESKTOP_VERSION
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qlabel.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <kglobal.h>
class KOPrintPrefs : public QDialog
{
public:
KOPrintPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("KO/Pi Printout") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 9 );
lay->setMargin( 9 );
QLabel * lab = new QLabel( i18n("This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n"), this );
lay->addWidget( lab );
- lab->setAlignment( AlignCenter );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Printout Mode"), this );
+ lab->setAlignment( Qt::AlignCenter );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Printout Mode"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
pmNo = new QRadioButton(i18n("Print unscaled"), format );
pmScaledDown = new QRadioButton(i18n("Print scaled down to fit one page"), format );
new QRadioButton(i18n("Print scaled up/down to fit one page"), format );
pmScaledDown->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
}
int printMode()
{
if ( pmNo->isChecked() )
return 0;
if ( pmScaledDown->isChecked() )
return 1;
return 2;
}
private:
QRadioButton* pmNo;
QRadioButton* pmScaledDown;
};
#endif
-class KOEventViewer : public QTextBrowser {
+class KOEventViewer : public Q3TextBrowser {
Q_OBJECT
public:
KOEventViewer(QWidget *parent=0,const char *name=0);
virtual ~KOEventViewer();
void setSource(const QString &);
void setEvent(Event *event);
void addEvent(Event *event);
void setTodo(Todo *event, bool clearV = true );
void setJournal(Journal *jour, bool clearV = true );
void appendEvent(Event *event, int mode = 0 );
void appendTodo(Todo *event, int mode = 0 );
void appendJournal(Journal *jour, int mode = 0 );
void clearEvents(bool now=false);
void addText(QString text);
void setSyncMode( bool );
void setColorMode( int );
void mailToAttendees( bool all );
void printMe();
protected:
int mColorMode;
void addTag(const QString & tag,const QString & text);
void formatCategories(Incidence *event);
void formatAttendees(Incidence *event);
void formatReadOnly(Incidence *event);
void keyPressEvent ( QKeyEvent * e );
private:
- QTextBrowser *mEventTextView;
+ Q3TextBrowser *mEventTextView;
bool mSyncMode;
QString deTag(QString text);
QString mText;
QString mMailSubject;
Incidence* mCurrentIncidence;
signals:
void launchaddressbook(QString uid);
void showIncidence(QString uid);
};
#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 2e936f3..3a37852 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -1,62 +1,65 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <klocale.h>
#include <libkcal/event.h>
#include <qtimer.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <QHideEvent>
+#include <QKeyEvent>
#include "koeventviewer.h"
#include <kmessagebox.h>
#include "koprefs.h"
#include <libkcal/todo.h>
-#include "qapp.h"
+#include "qapplication.h"
#include "koeventviewerdialog.h"
extern int globalFlagBlockAgenda;
KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
: KDialogBase(parent,name,
#ifndef DESKTOP_VERSION
true ,
#else
false,
#endif
i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
{
sendSignalViewerClosed = true;
mEventViewer = new KOEventViewer(this);
mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
setMainWidget(mEventViewer);
setButtonText(Ok, i18n("Edit") );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),
SLOT(editIncidence()));
QObject::connect(this,SIGNAL(user1Clicked()),
SLOT(showIncidence()));
connect( mEventViewer, SIGNAL( showIncidence( QString ) ),SIGNAL( showIncidence( QString ) ));
mIncidence = 0;
// TODO: Set a sensible size (based on the content?).
//showMaximized();
//qDebug("++++++++++++KOEventViewerDialog() ");
// if ( KOPrefs::instance()->mCompactDialogs ) {
// setFixedSize( 240,284 );
// move( 0, 15 );
// } else {
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h
index 71696f4..947c10b 100644
--- a/korganizer/koeventviewerdialog.h
+++ b/korganizer/koeventviewerdialog.h
@@ -1,57 +1,60 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOEVENTVIEWERDIALOG_H
#define KOEVENTVIEWERDIALOG_H
//
// Viewer dialog for events.
//
-#include <qtextview.h>
+#include <q3textview.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <QHideEvent>
#include <kdialogbase.h>
#include <libkcal/event.h>
using namespace KCal;
class KOEventViewer;
class KOEventViewerDialog : public KDialogBase {
Q_OBJECT
public:
KOEventViewerDialog(QWidget *parent=0,const char *name=0);
virtual ~KOEventViewerDialog();
void setEvent(Event *event);
void addEvent(Event *event);
void setTodo(Todo *event);
void setJournal(Journal *journal);
void setIncidence(Incidence *inc);
void addIncidence(Incidence *inc);
void addText(QString text);
void showMe();
void setSyncMode( bool );
void setColorMode( int m );
int executeS( bool );
public slots:
void updateConfig();
void print();
void setMyFocus();
signals:
void showIncidence( QString );
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index ee9c9f6..8335ba9 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -1,83 +1,87 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qdialog.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3Frame>
+#include <Q3PtrList>
#include <libkcal/calfilter.h>
#include "kofilterview.h"
#include "koprefs.h"
#include <kiconloader.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kcolorbutton.h>
#include <kmessagebox.h>
-KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
- const char* name,WFlags fl )
+KOFilterView::KOFilterView(Q3PtrList<CalFilter> *filterList,QWidget* parent,
+ const char* name,Qt::WFlags fl )
: KOFilterView_base(parent,name,fl)
{
mFilters = filterList;
connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
}
KOFilterView::~KOFilterView()
{
// no need to delete child widgets, Qt does it all for us
}
bool KOFilterView::filtersEnabled()
{
return mEnabledCheck->isChecked();
}
void KOFilterView::setFiltersEnabled(bool set)
{
mEnabledCheck->setChecked(set);
emit filterChanged();
}
void KOFilterView::updateFilters()
{
mSelectionCombo->clear();
CalFilter *filter = mFilters->first();
while(filter) {
@@ -85,72 +89,72 @@ void KOFilterView::updateFilters()
filter = mFilters->next();
}
}
CalFilter *KOFilterView::selectedFilter()
{
CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
return f;
}
void KOFilterView::setSelectedFilter(QString filterName)
{
int filter_num = mSelectionCombo->count();
int i;
for (i=0;i<filter_num;i++) {
if (mSelectionCombo->text(i)==filterName)
mSelectionCombo->setCurrentItem(i);
}
emit filterChanged();
}
void KOFilterView::setSelectedFilter( int fil )
{
if ( fil >= mSelectionCombo->count() )
return;
mSelectionCombo->setCurrentItem( fil );
emit filterChanged();
}
KOCalEditView::KOCalEditView(QWidget* parent,
const char* name )
- : QScrollView(parent,name)
+ : Q3ScrollView(parent,name)
{
mw = 0;
setResizePolicy( AutoOneFit );
- setFrameStyle ( QFrame::Panel | QFrame::Plain );
+ setFrameStyle ( Q3Frame::Panel | Q3Frame::Plain );
setLineWidth ( 1 );
setMidLineWidth ( 1 );
- setFocusPolicy(NoFocus);
+ setFocusPolicy(Qt::NoFocus);
}
KOCalEditView::~KOCalEditView()
{
// no need to delete child widgets, Qt does it all for us
}
void KOCalEditView::selectCal(int id ,bool b)
{
KOPrefs::instance()->getCalendar( id )->isEnabled = b;
emit calendarEnabled ( id, b );
emit needsUpdate();
}
void KOCalEditView::selectStdCal( int id )
{
KOCalRadioButton* it = mStdandardB.first();
while ( it ) {
it->blockSignals( true );
it->setChecked( it->num() == id );
it->blockSignals( false );
it = mStdandardB.next();
}
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
kkf->isStandard = (kkf->mCalNumber == id );
kkf = KOPrefs::instance()->mCalendars.next();
}
emit setCalendarDefault ( id );
}
void KOCalEditView::selectCalAlarm(int id ,bool b )
{
@@ -218,113 +222,113 @@ void KOCalEditView::deleteCal( int id )
emit needsUpdate();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
}
void KOCalEditView::infoCal( int id )
{
QString name = KOPrefs::instance()->getCalendar( id )->mName;
QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
emit calendarAdded( id );
emit needsUpdate();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
}
}
else {
emit requestCalendarInfo( id );
}
}
void KOCalEditView::readConfig()
{
mStdandardB.clear();
mEnabledB.clear();
mAlarmB.clear();
mROB.clear();
if ( mw ) delete mw;
mw = new QWidget ( viewport() );
addChild(mw);
int ii = 0;
- mainLayout = new QGridLayout ( mw , 2, 8 );
+ mainLayout = new Q3GridLayout ( mw , 2, 8 );
mainLayout->setMargin( 2 );
mainLayout->setSpacing( 2 );
QPushButton * addButT = new QPushButton ( mw );
- addButT->setFocusPolicy(NoFocus);
+ addButT->setFocusPolicy(Qt::NoFocus);
mainLayout->addWidget( addButT,0,0 );
addButT->setText( "D");
connect(addButT,SIGNAL(clicked()),SLOT(defaultInfo()));
- QWhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
+ Q3WhatsThis::add( addButT, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") );
//addBut->setPixmap ( SmallIcon("greenhook16"));
QPushButton *addBut = new QPushButton ( mw );
- addBut->setFocusPolicy(NoFocus);
+ addBut->setFocusPolicy(Qt::NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("eye"));
- QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") );
+ Q3WhatsThis::add( addBut, i18n("In this column you can <b>set a calendar to be visible</b>. If a calendar is not visible its entries are not displayed in the views. You can add items to it and it is loaded/saved as usual.") );
connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
int max = addBut->sizeHint().height();
addBut->setMaximumWidth( max );
addButT->setFixedSize( QSize( max, max ) );
QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
mainLayout->addWidget( lab,0,++ii );
- QWhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") );
+ Q3WhatsThis::add( lab, i18n("In this column you can see the <b>name of the calendar</b>. If you click on the name button you will get an information box about the loaded calendar file. If the file was not loaded at startup you can try to load it here again.") );
//lab = new QLabel ( i18n(" "), mw );
//mainLayout->addWidget( lab,0,++ii );
//lab->setFixedWidth( 1 );
addBut = new QPushButton ( mw );
- addBut->setFocusPolicy(NoFocus);
+ addBut->setFocusPolicy(Qt::NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("bell"));
- QWhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") );
+ Q3WhatsThis::add( addBut, i18n("In this column you can <b>disable the alarms of a calendar all together</b>. The alarm data in the calendar itself is not changed, the alarms are marked internally as \"do not use\". Useful if you load a calendar of another person but do not want to get notified about alarms of that person.") );
connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
addBut = new QPushButton ( mw );
- addBut->setFocusPolicy(NoFocus);
+ addBut->setFocusPolicy(Qt::NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("pencil"));
- QWhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") );
+ Q3WhatsThis::add( addBut, i18n("In this column you can <b>set a calendar and all entries of the calendar to read only</b>. If a calendar is readonly the entries cannot be edited and no items can be added to the calendar. If you change a setting of a calendar to readonly in this column all data will be saved because the data of a readonly calendar is not saved later.") );
connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
addBut->setMaximumWidth( addBut->sizeHint().height() );
lab = new QLabel ( "", mw );
mainLayout->addWidget( lab,0,++ii );
addBut = new QPushButton ( mw );
- addBut->setFocusPolicy(NoFocus);
+ addBut->setFocusPolicy(Qt::NoFocus);
mainLayout->addWidget( addBut,0,++ii );
addBut->setPixmap ( SmallIcon("plus"));
connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
- QWhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") );
+ Q3WhatsThis::add( addBut, i18n("Click this button to <b>add a calendar</b>. You can add an existing calendar file or you can add a new calendar and KO/Pi creates a new empty calendar file for you.") );
lab = new QLabel ( " ", mw );
mainLayout->addWidget( lab,0,++ii );
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
int row = 1;
bool errorLoadStandard = false;
while ( kkf ) {
int iii = 0;
KOCalRadioButton* rb = new KOCalRadioButton( mw );
mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb );
rb->setChecked( kkf->isStandard );
if ( kkf->isStandard && ( kkf->mErrorOnLoad || kkf->isReadOnly ) )
errorLoadStandard = true;
rb->setNum( kkf->mCalNumber );
connect (rb, SIGNAL (selectNum(int)), SLOT ( selectStdCal(int) ) );
if ( kkf->mErrorOnLoad || kkf->isReadOnly )
rb->setEnabled( false );
KOCalCheckButton* cb = new KOCalCheckButton( mw );
mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
cb->setChecked( kkf->isEnabled && !kkf->mErrorOnLoad );
cb->setNum( kkf->mCalNumber );
if ( kkf->mErrorOnLoad )
cb->setEnabled( false );
connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
KOCalButton* name = new KOCalButton( mw );
name->setNum( kkf->mCalNumber );
name->setText( kkf->mName );
mainLayout->addWidget( name,row,++iii );
connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
//lab = new QLabel (" ", mw );
//mainLayout->addWidget( lab,row,++iii );
@@ -402,98 +406,98 @@ void KOCalEditView::addCal()
}
QFileInfo fi ( file );
if ( fi.isDir() ) {
tryagain = true;
}
}
addCalendar ( name, file );
QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) );
}
int KOCalEditView::addCalendar( QString name, QString file, bool ask )
{
file = QDir::convertSeparators( file );
QFileInfo fi ( file );
QString absFile = file;
bool isRelative = false;
if ( fi.isRelative() ) {
isRelative = true;
absFile = QDir::convertSeparators( KGlobalSettings::calendarDir()+file );
fi.setFile( absFile );
} else {
QString cd = QDir::convertSeparators( KGlobalSettings::calendarDir() );
if ( file.left( cd.length() ) == cd ) {
isRelative = true;
file = fi.fileName ();
fi.setFile( absFile );
}
}
if (!fi.exists() ) {
if ( ask )
if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No )
return 0;
QFile fileIn( absFile );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
return 0;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
fileIn.close();
}
KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
kkf->mName = name;
kkf->mFileName = absFile;
kkf->mSavedFileName = file;
kkf->isRelative = isRelative;
emit calendarAdded( kkf->mCalNumber );
if ( ask )
emit needsUpdate();
QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
return kkf->mCalNumber;
}
int KOCalEditView::getBirtdayID()
{
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
if ( kkf->mName == i18n("Birthdays") )
return kkf->mCalNumber;
kkf = KOPrefs::instance()->mCalendars.next();
}
QString file = locateLocal( "data", "korganizer/birthdays.ics" );
return addCalendar( i18n("Birthdays"), file, false );
}
void KOCalEditView::enableAll()
{
toggleList( mEnabledB );
}
void KOCalEditView::enableAlarm()
{
toggleList( mAlarmB );
}
void KOCalEditView::disableRO()
{
toggleList( mROB, false );
}
-void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list , bool enable )
+void KOCalEditView::toggleList ( Q3PtrList<KOCalCheckButton> list , bool enable )
{
bool dis = !enable;
KOCalCheckButton* it = list.first();
while ( it ) {
if ( !it->isChecked() == enable && it->isEnabled() ) {
dis = !dis;
break;
}
it = list.next();
}
it = list.first();
while ( it ) {
if ( it->isEnabled() )
it->setChecked(dis);
it = list.next();
}
}
void KOCalEditView::deleteAll()
{
qDebug("delteAll");
}
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 0dd423a..f1bbab4 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -1,257 +1,263 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOFILTERVIEW_H
#define KOFILTERVIEW_H
#include <qstring.h>
#include <qcheckbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qdialog.h>
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3PtrList>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
#include <kconfig.h>
#include "kofilterview_base.h"
#include <libkcal/calfilter.h>
#include <kurlrequester.h>
#include <klineedit.h>
#include <kglobal.h>
#include <kmessagebox.h>
-class QGridLayout;
+class Q3GridLayout;
using namespace KCal;
class KONewCalPrefs : public QDialog
{
Q_OBJECT
public:
KONewCalPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Add new Calendar") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this );
lay->addWidget( lab );
nameE = new KLineEdit( this );
lay->addWidget( nameE );
lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this );
lay->addWidget( lab );
url = new KURLRequester ( this );
lay->addWidget( url );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) );
connect (cancel, SIGNAL( clicked() ), this, SLOT ( reject()) );
int minwid = 440;
if ( QApplication::desktop()->width() < 480 ) minwid = 220;
setMinimumWidth( minwid );
resize(sizeHint() );
}
QString calName() { return nameE->text(); }
QString calFileName() { return url->url(); }
public slots:
void checkValid() {
if ( nameE->text().isEmpty() ) {
KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") );
nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () ));
return;
}
if ( url->url().isEmpty() ) {
KMessageBox::information( this, i18n("Sorry, the file name is empty!") );
url->setURL( nameE->text() + ".ics" );
return;
}
accept();
}
public:
KLineEdit* nameE;
KURLRequester *url;
};
class KOCalButton : public QPushButton
{
Q_OBJECT
public:
KOCalButton( QWidget *parent=0, const char *name=0 ) :
QPushButton( parent, name)
{
connect( this, SIGNAL( clicked() ),
SLOT( bottonClicked() ));
mNumber = -1;
- setFocusPolicy(NoFocus);
+ setFocusPolicy(Qt::NoFocus);
}
void setNum ( int num ) {mNumber = num; }
signals:
void selectNum ( int );
private:
int mNumber;
void keyPressEvent ( QKeyEvent * e )
{
e->ignore();
}
private slots :
void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); }
};
class KOCalCheckButton : public QCheckBox
{
Q_OBJECT
public:
KOCalCheckButton( QWidget *parent=0, const char *name=0 ) :
QCheckBox( parent, name)
{
connect( this, SIGNAL( toggled ( bool ) ),
SLOT( bottonClicked( bool ) ));
mNumber = -1;
- setFocusPolicy(NoFocus);
+ setFocusPolicy(Qt::NoFocus);
//setMaximumWidth( 10 );
}
void setNum ( int num ) {mNumber = num; }
signals:
void selectNum ( int, bool );
private:
int mNumber;
void keyPressEvent ( QKeyEvent * e )
{
e->ignore();
}
private slots :
void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
};
class KOCalRadioButton : public QRadioButton
{
Q_OBJECT
public:
KOCalRadioButton( QWidget *parent=0, const char *name=0 ) :
QRadioButton( parent, name)
{
connect( this, SIGNAL( toggled ( bool ) ),
SLOT( bottonClicked( bool ) ));
mNumber = -1;
- setFocusPolicy(NoFocus);
+ setFocusPolicy(Qt::NoFocus);
//setMaximumWidth( 10 );
}
int num() { return mNumber;}
void setNum ( int num ) {mNumber = num; }
signals:
void selectNum ( int );
private:
int mNumber;
void keyPressEvent ( QKeyEvent * e )
{
e->ignore();
}
private slots :
void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); }
};
class KOFilterView : public KOFilterView_base
{
Q_OBJECT
public:
- KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
+ KOFilterView(Q3PtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, Qt::WFlags fl=0);
~KOFilterView();
void updateFilters();
bool filtersEnabled();
void setFiltersEnabled(bool);
CalFilter *selectedFilter();
void setSelectedFilter(QString);
void setSelectedFilter( int );
signals:
void filterChanged();
void editFilters();
private:
- QPtrList<CalFilter> *mFilters;
+ Q3PtrList<CalFilter> *mFilters;
};
-class KOCalEditView : public QScrollView
+class KOCalEditView : public Q3ScrollView
{
Q_OBJECT
public:
KOCalEditView( QWidget* parent=0,const char* name=0);
~KOCalEditView();
int addCalendar( QString calName, QString fileName, bool ask = true );
int getBirtdayID();
public slots:
void addCal();
void enableAll();
void enableAlarm();
void disableRO();
void deleteAll();
void selectStdCal(int);
void selectCal(int,bool );
void selectCalAlarm(int,bool );
void selectReadOnly(int,bool );
void setColor(const QColor &,int) ;
void deleteCal(int) ;
void infoCal(int) ;
void readConfig();
void defaultInfo();
void findNewStandard();
signals:
void alarmEnabled ( int cal, bool enable );
void calendarEnabled ( int cal, bool enable );
void calendarReadonly ( int cal, bool readonly );
void setCalendarDefault ( int cal );
void removeCalendar ( int cal );
void calendarAdded( int );
void needsUpdate();
void checkCalendar();
void requestCalendarInfo( int id );
private:
QWidget *mw;
- void toggleList ( QPtrList<KOCalCheckButton> , bool b = true );
- QPtrList<KOCalRadioButton> mStdandardB;
- QPtrList<KOCalCheckButton> mEnabledB;
- QPtrList<KOCalCheckButton> mAlarmB;
- QPtrList<KOCalCheckButton> mROB;
- QGridLayout* mainLayout;
+ void toggleList ( Q3PtrList<KOCalCheckButton> , bool b = true );
+ Q3PtrList<KOCalRadioButton> mStdandardB;
+ Q3PtrList<KOCalCheckButton> mEnabledB;
+ Q3PtrList<KOCalCheckButton> mAlarmB;
+ Q3PtrList<KOCalCheckButton> mROB;
+ Q3GridLayout* mainLayout;
};
#endif // KOFILTERVIEW_H
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
index 79b97e8..63d044c 100644
--- a/korganizer/koimportoldialog.cpp
+++ b/korganizer/koimportoldialog.cpp
@@ -1,126 +1,126 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qpixmap.h>
#include <qlayout.h>
-#include <qprogressbar.h>
-#include <qprogressdialog.h>
-#include <qwidgetstack.h>
+#include <q3progressbar.h>
+#include <q3progressdialog.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qapplication.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qregexp.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qdatetime.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kinputdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
#include <kabc/stdaddressbook.h>
#include "koprefs.h"
#include "koglobals.h"
#include "koimportoldialog.h"
#include "../outport/msoutl9.h"
#include <ole2.h>
#include <comutil.h>
_Application gOlApp;
QDateTime mDdate2Qdtr( DATE dt)
{
COleDateTime odt;
SYSTEMTIME st;
odt = dt;
odt.GetAsSystemTime(st);
QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
return qdt;
}
-class OLEListViewItem : public QCheckListItem
+class OLEListViewItem : public Q3CheckListItem
{
public:
- OLEListViewItem( QListView *parent, QString text ) :
- QCheckListItem( parent, text, QCheckListItem::CheckBox ) { mData = 0; };
- OLEListViewItem( QListViewItem *after, QString text ) :
- QCheckListItem( after, text, QCheckListItem::CheckBox ) { mData = 0; };
+ OLEListViewItem( Q3ListView *parent, QString text ) :
+ Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox ) { mData = 0; };
+ OLEListViewItem( Q3ListViewItem *after, QString text ) :
+ Q3CheckListItem( after, text, Q3CheckListItem::CheckBox ) { mData = 0; };
~OLEListViewItem() {};
void setData( DWORD data ) {mData= data; };
DWORD data() { return mData ;};
private:
DWORD mData;
};
KOImportOLdialog::KOImportOLdialog( const QString &caption,
Calendar *calendar, QWidget *parent ) :
KDialogBase( Plain, caption, User1 | Close, Ok,
parent, caption, true, false, i18n("Import!") )
{
- QHBox * mw = new QHBox( this );
+ Q3HBox * mw = new Q3HBox( this );
setMainWidget( mw );
- mListView = new QListView( mw );
+ mListView = new Q3ListView( mw );
mListView->addColumn(i18n("Select Folder to import"));
mListView->addColumn(i18n("Content Type"));
mCalendar = calendar;
connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
setupFolderView();
resize( sizeHint().width()+50, sizeHint().height()+50 );
}
KOImportOLdialog::~KOImportOLdialog()
{
}
void KOImportOLdialog::setupFolderView()
{
SCODE sc = ::OleInitialize(NULL);
if ( FAILED ( sc ) ) {
KMessageBox::information(this,"OLE initialisation failed");
return;
}
if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){
KMessageBox::information(this,"Sorry, cannot access Outlook");
return ;
}
MAPIFolder mfInbox;
MAPIFolder mfRoot;
CString szName;
_NameSpace olNS;
olNS = gOlApp.GetNamespace(_T("MAPI"));
mfInbox = olNS.GetDefaultFolder(6);
@@ -183,65 +183,65 @@ void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent
}
hChild->setText( 1,ts);
hChild->setData( (DWORD) mfChild.m_lpDispatch );
mfChild.m_lpDispatch->AddRef();
addFolder(hChild, mfChild.m_lpDispatch);
}
}
void KOImportOLdialog::slotApply()
{
importedItems = 0;
OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
while ( child ) {
if ( child->isOn()&& child->data() )
readCalendarData( child->data() );
child = (OLEListViewItem*) child->itemBelow();
}
QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
KMessageBox::information(this,mes);
}
void KOImportOLdialog::readCalendarData( DWORD folder )
{
LPDISPATCH dispItem = (LPDISPATCH)folder;
dispItem->AddRef();
MAPIFolder mf(dispItem);
mf.m_lpDispatch->AddRef();
_Items folderItems;
_variant_t indx((long)0);
LPDISPATCH itm;
int i;
folderItems = mf.GetItems();
- QProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this );
+ Q3ProgressDialog bar( i18n("Importing calendar data"),i18n("Abort"), folderItems.GetCount(),this );
bar.setCaption (i18n("Importing!") );
int h = bar.sizeHint().height() ;
int w = 300;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
//bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
for(i=1; i <= folderItems.GetCount(); ++i)
{
qApp->processEvents();
if ( ! bar.isVisible() )
return ;
bar.setProgress( i );
bar.raise();
indx = (long)i;
itm = folderItems.Item(indx.Detach());
_AppointmentItem * pItem = (_AppointmentItem *)&itm;
ol2kopiCalendar( pItem );
itm->Release();
}
}
void KOImportOLdialog::slotOk()
{
QDialog::accept();
}
void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence )
{
KCal::Event* event = new KCal::Event();
if ( aItem->GetAllDayEvent() ){
event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) ));
event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1));
diff --git a/korganizer/koimportoldialog.h b/korganizer/koimportoldialog.h
index c8847c5..d66f099 100644
--- a/korganizer/koimportoldialog.h
+++ b/korganizer/koimportoldialog.h
@@ -2,83 +2,83 @@
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOINCIDENCEEDITOR_H
#define KOINCIDENCEEDITOR_H
#include <kdialogbase.h>
#include <afxdisp.h>
#include <libkcal/calendar.h>
#include <libkcal/event.h>
class QDateTime;
-class QListView;
+class Q3ListView;
class OLEListViewItem;
class _AppointmentItem;
namespace KPIM { class CategorySelectDialog; }
using namespace KCal;
/**
This is the base class for the calendar component editors.
*/
class KOImportOLdialog : public KDialogBase
{
Q_OBJECT
public:
/**
Construct new IncidenceEditor.
*/
KOImportOLdialog( const QString &caption, Calendar *calendar,
QWidget *parent );
virtual ~KOImportOLdialog();
/** Initialize editor. This function creates the tab widgets. */
void init();
public slots:
signals:
protected slots:
void slotApply();
void slotOk();
void slotCancel();
protected:
void setupFolderView();
void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
void readCalendarData( DWORD folder );
void ol2kopiCalendar( _AppointmentItem * , bool computeRecurrence = true );
Calendar *mCalendar;
- QListView * mListView;
+ Q3ListView * mListView;
QString getUidByEmail( QString email );
private:
int importedItems;
};
#endif
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 236f6f9..2060ea1 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -1,119 +1,121 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qpixmap.h>
#include <qlayout.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkdepim/kinputdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
#include "koprefs.h"
#include "koincidenceeditor.h"
KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
Calendar *calendar, QWidget *parent ) :
KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
parent, caption, true, false ),
mSaveTemplateDialog( 0 )
{
mCalendar = calendar;
setButtonText( Default, i18n("Template...") );
QString saveTemplateText;
// if ( KOPrefs::instance()->mCompactDialogs ) {
// showButton( User1, false );
// showButton( Apply, false );
// } else {
showButton( Apply, false );
saveTemplateText = i18n("Ok+Agenda");
// }
setButtonText( User1, saveTemplateText );
//mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
// KOGlobals::fitDialogToScreen( mCategoryDialog );
//connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
//connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
// connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
}
KOIncidenceEditor::~KOIncidenceEditor()
{
//delete mCategoryDialog;
}
void KOIncidenceEditor::setupAttendeesTab()
{
- QFrame *topFrame = addPage(i18n("Attendees"));
+ Q3Frame *topFrame = addPage(i18n("Attendees"));
- QBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
mDetails = new KOEditorDetails(spacingHint()-2,topFrame);
topLayout->addWidget(mDetails);
}
void KOIncidenceEditor::alarmWarning()
{
KMessageBox::information( 0, i18n("The alarm for this calendar\nis currently disabled!\nEnable it in resource settings."), i18n("Alarm disabled warning"));
}
void KOIncidenceEditor::slotApply()
{
processInput( false );
}
void KOIncidenceEditor::accept()
{
slotOk();
}
void KOIncidenceEditor::slotOk()
{
if ( processInput( false ) ) QDialog::accept();
}
void KOIncidenceEditor::updateCategoryConfig()
{
qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! ");
//mCategoryDialog->updateCategoryConfig();
}
void KOIncidenceEditor::slotCancel()
{
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 406df5a..51594ff 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,250 +1,256 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
//
// View of Journal entries
#include <qlayout.h>
-#include <qscrollview.h>
-#include <qpopupmenu.h>
-#include <qhbox.h>
+#include <q3scrollview.h>
+#include <q3popupmenu.h>
+#include <q3hbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3PtrList>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kdebug.h>
#include "koprefs.h"
#include <kglobal.h>
#include <ktextedit.h>
#include <libkcal/calendar.h>
#include "journalentry.h"
#include "kojournalview.h"
using namespace KOrg;
KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
const char *name)
: KOrg::BaseView(calendar, parent, name)
{
mCalendar = calendar;
- QHBox * vb = new QHBox ( this );
+ Q3HBox * vb = new Q3HBox ( this );
QPushButton * newJournal = new QPushButton( vb );
QPixmap icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("ko16old");
else
icon = SmallIcon("ko24old");
newJournal->setPixmap (icon ) ;
int size = newJournal->sizeHint().height();
newJournal->setFixedSize( size, size );
mDateLabel = new QLabel ( vb );
mDateLabel->setMargin(1);
- mDateLabel->setAlignment(AlignCenter);
- QScrollView * sv = new QScrollView( this );
- QVBoxLayout * hbl = new QVBoxLayout( this );
+ mDateLabel->setAlignment(Qt::AlignCenter);
+ Q3ScrollView * sv = new Q3ScrollView( this );
+ Q3VBoxLayout * hbl = new Q3VBoxLayout( this );
hbl->addWidget( vb );
hbl->addWidget( sv );
parWid = new QWidget( sv->viewport() );
sv->addChild(parWid);
- sv->setResizePolicy( QScrollView:: AutoOneFit );
- mTopLayout = new QVBoxLayout(parWid);
+ sv->setResizePolicy( Q3ScrollView:: AutoOneFit );
+ mTopLayout = new Q3VBoxLayout(parWid);
connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
getNewEntry();
}
KOJournalView::~KOJournalView()
{
}
int KOJournalView::currentDateCount()
{
return 0;
}
JournalEntry* KOJournalView::getNewEntry()
{
JournalEntry* Entry = new JournalEntry(mCalendar,parWid);
jEntries.append( Entry );
mTopLayout->addWidget(Entry);
Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
return Entry;
}
-QPtrList<Incidence> KOJournalView::selectedIncidences()
+Q3PtrList<Incidence> KOJournalView::selectedIncidences()
{
- QPtrList<Incidence> eventList;
+ Q3PtrList<Incidence> eventList;
return eventList;
}
void KOJournalView::updateConfig()
{
JournalEntry* mEntry = jEntries.first();
while ( mEntry ) {
mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
mEntry = jEntries.next();
}
}
void KOJournalView::updateView()
{
JournalEntry* mEntry = jEntries.first();
while ( mEntry ) {
mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
mEntry = jEntries.next();
}
showDates( mDate, QDate() );
}
void KOJournalView::checkModified()
{
flushView();
}
void KOJournalView::flushView()
{
static bool ff = false;
if ( ff ) return;
ff = true;
JournalEntry* mEntry = jEntries.first();
while ( mEntry ) {
mEntry->flushEntry();
mEntry = jEntries.next();
}
ff = false;
}
void KOJournalView::clearList()
{
JournalEntry* mEntry = jEntries.first();
while ( mEntry ) {
mEntry->clear();
mEntry = jEntries.next();
}
}
void KOJournalView::newJournal()
{
//qDebug(" KOJournalView::newJournal()");
flushView();
Journal* mJournal = new Journal;
mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
mCalendar->addJournal(mJournal);
showDates( mDate, QDate() );
}
void KOJournalView::showOnly ( Journal* j )
{
//qDebug("showOnly %x ", j);
flushView();
if ( j == 0 ) {
showDates( mDate, QDate() );
return;
}
- QPtrList<Journal> jl;
+ Q3PtrList<Journal> jl;
jl.append ( j );
showList( jl );
JournalEntry* mEntry = jEntries.first();
mEntry->setShowOnly();
}
-void KOJournalView::showList(QPtrList<Journal> jl)
+void KOJournalView::showList(Q3PtrList<Journal> jl)
{
static bool ff = false;
if ( ff ) return;
ff = true;
//qDebug("KOJournalView::showList %d",jl.count() );
JournalEntry* mEntry = jEntries.first();
JournalEntry* firstEntry = mEntry;
int count = jl.count();
int iii = 0;
QWidget* fw = qApp->focusWidget ();
while ( iii < count ) {
if ( !mEntry ) {
mEntry = getNewEntry();
mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii), false);
mEntry->setVisibleMode( true );
mEntry->show();
mEntry = 0;
} else {
int xxx = -1, yyy = -1;
if ( ((QWidget*) mEntry->editor() ) == fw ) {
mEntry->editor()->getCursorPosition( &xxx,&yyy);
}
mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii), false);
mEntry->setVisibleMode( true );
mEntry->show();
if ( xxx > -1 && yyy > -1 ) {
mEntry->editor()->setCursorPosition( xxx, yyy );
}
mEntry = jEntries.next();
}
++iii;
}
while ( mEntry ) {
mEntry->setDate(mDate);
mEntry->clear();
if ( mEntry != firstEntry ) {
mEntry->hide();
mEntry->setVisibleMode( false );
}
else {
mEntry->setVisibleMode( true );
mEntry->show();
}
mEntry = jEntries.next();
}
ff = false;
}
void KOJournalView::showDates(const QDate &start, const QDate &)
{
mDate = start;
mDateLabel->setText(KGlobal::locale()->formatDate(mDate));
- QPtrList<Journal> jl = calendar()->journals4Date( start );
+ Q3PtrList<Journal> jl = calendar()->journals4Date( start );
showList( jl );
}
-void KOJournalView::showEvents(QPtrList<Event>)
+void KOJournalView::showEvents(Q3PtrList<Event>)
{
// After new creation of list view no events are selected.
// emit incidenceSelected( 0 );
}
void KOJournalView::changeEventDisplay(Event *, int /*action*/)
{
updateView();
}
void KOJournalView::keyPressEvent ( QKeyEvent * e )
{
//qDebug("keyPressEven ");
if ( e->state() == Qt::ControlButton ) {
if ( e->key () == Qt::Key_Right || e->key () == Qt::Key_Left )
e->ignore();
}
}
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index 7fa94ae..22f26cd 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -1,80 +1,85 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOJOURNALVIEW_H
#define _KOJOURNALVIEW_H
#include <korganizer/baseview.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <Q3PtrList>
+#include <QLabel>
+#include <Q3BoxLayout>
class JournalEntry;
class QLabel;
/**
* This class provides a journal view.
* @short View for Journal components.
* @author Cornelius Schumacher <schumacher@kde.org>
* @see KOBaseView
*/
class KOJournalView : public KOrg::BaseView
{
Q_OBJECT
public:
KOJournalView(Calendar *calendar, QWidget *parent = 0,
const char *name = 0);
~KOJournalView();
virtual int currentDateCount();
void clearList();
- virtual QPtrList<Incidence> selectedIncidences();
+ virtual Q3PtrList<Incidence> selectedIncidences();
DateList selectedDates()
{DateList q;
return q;};
void checkModified();
signals:
void deleteJournal(Journal *);
public slots:
void showOnly ( Journal* );
void newJournal();
void updateView();
void flushView();
void updateConfig();
void showDates( const QDate &start, const QDate &end );
- void showEvents(QPtrList<Event> eventList);
+ void showEvents(Q3PtrList<Event> eventList);
void changeEventDisplay(Event *, int);
private:
- void showList(QPtrList<Journal> jl);
+ void showList(Q3PtrList<Journal> jl);
Calendar *mCalendar;
JournalEntry* getNewEntry();
- QPtrList<JournalEntry> jEntries;
+ Q3PtrList<JournalEntry> jEntries;
void keyPressEvent ( QKeyEvent * ) ;
- QBoxLayout *mTopLayout;
+ Q3BoxLayout *mTopLayout;
QWidget *parWid;
QLabel * mDateLabel;
QDate mDate;
};
#endif
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 192f8c0..0ea1d50 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,108 +1,117 @@
/*
This file is part of KOrganizer.
Copyright (c) 1999 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlayout.h>
#include <qlabel.h>
-#include <qpopupmenu.h>
-#include <qprogressbar.h>
+#include <q3popupmenu.h>
+#include <q3progressbar.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#include <qdialog.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qdir.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
#include <qregexp.h>
#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <Q3VBoxLayout>
+#include <Q3PtrList>
+
+#include<QDesktopWidget>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kglobal.h>
#include <libkdepim/kpimglobalprefs.h>
#include <libkcal/calendar.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/icalformat.h>
#include <libkcal/vcalformat.h>
#include <libkcal/recurrence.h>
#include <libkcal/filestorage.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkcal/kincidenceformatter.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "koglobals.h"
#include "koprefs.h"
#include "kfiledialog.h"
#include "kolistview.h"
#include "koeventviewer.h"
extern QPixmap* sgListViewCompletedPix[6];
extern QPixmap* sgListViewJournalPix;
-class KOListViewWhatsThis :public QWhatsThis
+class KOListViewWhatsThis :public Q3WhatsThis
{
public:
- KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
+ KOListViewWhatsThis( QWidget *wid, KOListView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { };
protected:
virtual QString text( const QPoint& p)
{
return _view->getWhatsThisText(p) ;
}
private:
QWidget* _wid;
KOListView * _view;
};
ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
{
mItem = item;
mDate = date;
}
ListItemVisitor::~ListItemVisitor()
{
}
bool ListItemVisitor::visit(Event *e)
{
bool ok = false;
QString start, end;
QDate ds, de;
if ( e->doesRecur() ) {
ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
if ( ok ) {
int days = e->dtStart().date().daysTo(e->dtEnd().date() );
start = KGlobal::locale()->formatDate(ds,true);
@@ -245,521 +254,521 @@ bool ListItemVisitor::visit(Journal * j)
mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true ));
mItem->setSortKey(11,j->lastModifiedSortKey());
QString key;
QDate d;
d = j->dtStart().date();
key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
mItem->setSortKey(1,key);
return true;
}
KOListView::KOListView(Calendar *calendar, QWidget *parent,
const char *name)
: KOEventView(calendar, parent, name)
{
mActiveItem = 0;
mForceShowCompletedTodos = false;
mListView = new KOListViewListView(this);
mListView->addColumn(i18n("Summary"));
mListView->addColumn(i18n("Start Date"));
mListView->addColumn(i18n("Start Time"));
mListView->addColumn(i18n("End/Due Date"));
mListView->addColumn(i18n("End/Due Time"));
mListView->addColumn(i18n("Duration"));
mListView->addColumn(i18n("Alarm")); // alarm set?
mListView->addColumn(i18n("Recurs")); // recurs?
mListView->addColumn(i18n("Cancelled"));
mListView->addColumn(i18n("Categories"));
mListView->addColumn(i18n("Calendar"));
mListView->addColumn(i18n("Last Modified"));
- mListView->setColumnAlignment(0,AlignLeft);
- mListView->setColumnAlignment(1,AlignLeft);
- mListView->setColumnAlignment(2,AlignHCenter);
- mListView->setColumnAlignment(3,AlignLeft);
- mListView->setColumnAlignment(4,AlignHCenter);
- mListView->setColumnAlignment(5,AlignLeft);
- mListView->setColumnAlignment(6,AlignLeft);
- mListView->setColumnAlignment(7,AlignLeft);
- mListView->setColumnAlignment(8,AlignLeft);
- mListView->setColumnAlignment(9,AlignLeft);
- mListView->setColumnAlignment(10,AlignLeft);
- mListView->setColumnAlignment(11,AlignLeft);
+ mListView->setColumnAlignment(0,Qt::AlignLeft);
+ mListView->setColumnAlignment(1,Qt::AlignLeft);
+ mListView->setColumnAlignment(2,Qt::AlignHCenter);
+ mListView->setColumnAlignment(3,Qt::AlignLeft);
+ mListView->setColumnAlignment(4,Qt::AlignHCenter);
+ mListView->setColumnAlignment(5,Qt::AlignLeft);
+ mListView->setColumnAlignment(6,Qt::AlignLeft);
+ mListView->setColumnAlignment(7,Qt::AlignLeft);
+ mListView->setColumnAlignment(8,Qt::AlignLeft);
+ mListView->setColumnAlignment(9,Qt::AlignLeft);
+ mListView->setColumnAlignment(10,Qt::AlignLeft);
+ mListView->setColumnAlignment(11,Qt::AlignLeft);
mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
int iii = 0;
for ( iii = 0; iii< 12 ; ++iii )
- mListView->setColumnWidthMode( iii, QListView::Manual );
+ mListView->setColumnWidthMode( iii, Q3ListView::Manual );
- QBoxLayout *layoutTop = new QVBoxLayout(this);
+ Q3BoxLayout *layoutTop = new Q3VBoxLayout(this);
layoutTop->addWidget(mListView);
mListView->setFont ( KOPrefs::instance()->mListViewFont );
mPopupMenu = eventPopup();
- QPopupMenu* selPopup = new QPopupMenu ( this );
+ Q3PopupMenu* selPopup = new Q3PopupMenu ( this );
mPopupMenu->insertSeparator();
selPopup->insertItem(i18n("All"),this,
SLOT(allSelection()));
selPopup->insertItem(i18n("None"),this,
SLOT(clearSelection()));
selPopup->insertItem(i18n("Delete selected..."),this,
SLOT(deleteAll()));
mPopupMenu->insertItem(i18n("Selection"), selPopup );
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("Hide all selected"),this,
SLOT(hideAll()),true);
selPopup->insertSeparator();
- QPopupMenu * exportPO = new QPopupMenu ( this );
+ Q3PopupMenu * exportPO = new Q3PopupMenu ( this );
selPopup->insertItem( i18n("Export"), exportPO );
#ifdef DESKTOP_VERSION
mPopupMenu->insertSeparator();
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("Print complete list..."),this,
SLOT(printList()),true);
#endif
- mCalPopup = new QPopupMenu ( this );
+ mCalPopup = new Q3PopupMenu ( this );
selPopup->insertItem( i18n("Set Calendar"), mCalPopup );
selPopup->insertItem(i18n("Set categories")+"...",this,
SLOT(setCat()) );
selPopup->insertItem( i18n("Set alarm..."),this,
SLOT(setAlarm()));
#if 0
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("Set categories")+"...",this,
SLOT(setCat()),true);
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("Set alarm..."),this,
SLOT(setAlarm()),true);
#endif
QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
SLOT( populateCalPopup() ));
QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
SLOT( setCalendar( int ) ));
QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this,
SLOT( catChanged( Incidence * ) ));
exportPO->insertItem( i18n("As iCal (ics) file..."),this,
SLOT(saveToFile()));
exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
SLOT(saveToFileVCS()));
exportPO->insertItem( i18n("Journal/Details..."),this,
SLOT(saveDescriptionToFile()));
// mPopupMenu->insertSeparator();
// mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
// i18n("Add Categ. to selected..."),this,
// SLOT(addCat()),true);
//mPopupMenu->insertSeparator();
#ifndef DESKTOP_VERSION
selPopup->insertSeparator();
selPopup->insertItem( i18n("Beam via IR..."),this,
SLOT(beamSelected()));
#if 0
- mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mPopupMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("Beam via IR"),this,
SLOT(beamSelected()),true);
#endif
#endif
/*
mPopupMenu = new QPopupMenu;
mPopupMenu->insertItem(i18n("Edit Event"), this,
SLOT (editEvent()));
mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
SLOT (deleteEvent()));
mPopupMenu->insertSeparator();
mPopupMenu->insertItem(i18n("Show Dates"), this,
SLOT(showDates()));
mPopupMenu->insertItem(i18n("Hide Dates"), this,
SLOT(hideDates()));
*/
QObject::connect(mListView,SIGNAL( newEvent()),
this,SIGNAL(signalNewEvent()));
- QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
- this,SLOT(defaultItemAction(QListViewItem *)));
- QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
+ QObject::connect(mListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this,SLOT(defaultItemAction(Q3ListViewItem *)));
+ QObject::connect(mListView,SIGNAL(rightButtonPressed( Q3ListViewItem *,
const QPoint &, int )),
- this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
- QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
- SLOT(processSelectionChange(QListViewItem *)));
+ this,SLOT(popupMenu(Q3ListViewItem *,const QPoint &,int)));
+ QObject::connect(mListView,SIGNAL(currentChanged(Q3ListViewItem *)),
+ SLOT(processSelectionChange(Q3ListViewItem *)));
QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
SIGNAL(showIncidenceSignal(Incidence *)) );
readSettings(KOGlobals::config(),"KOListView Layout");
}
KOListView::~KOListView()
{
delete mPopupMenu;
#if QT_VERSION >= 0x030000
#else
delete mKOListViewWhatsThis;
#endif
}
void KOListView::catChanged( Incidence* inc)
{
KOListViewItem* item = getItemForEvent(inc);
if (item) {
ListItemVisitor v(item, mStartDate );
inc->accept(v);
}
}
QString KOListView::getWhatsThisText(QPoint p)
{
KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
if ( item )
return KIncidenceFormatter::instance()->getFormattedText( item->data(),
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
return i18n("That is the list view" );
}
void KOListView::setCalendar( int c )
{
int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ),
i18n("Continue"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
return;
}
- QPtrList<Incidence> delSel = getSelectedIncidences() ;
+ Q3PtrList<Incidence> delSel = getSelectedIncidences() ;
int icount = delSel.count();
if ( icount ) {
Incidence *incidence = delSel.first();
while ( incidence ) {
incidence->setCalID( c );
KOListViewItem * item = getItemForEvent( incidence );
if ( item ) {
ListItemVisitor v(item, mStartDate );
incidence->accept(v);
}
incidence = delSel.next();
}
}
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
while ( cal ) {
mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
if ( cal->isStandard )
mCalendar->setDefaultCalendar( cal->mCalNumber );
cal = calendars.next();
}
mCalendar->setSyncEventsReadOnly();
mCalendar->reInitAlarmSettings();
}
void KOListView::populateCalPopup()
{
mCalPopup->clear();
KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
while ( kkf ) {
int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber);
if ( kkf->mErrorOnLoad || kkf->isReadOnly )
mCalPopup->setItemEnabled( index, false );
kkf = KOPrefs::instance()->mCalendars.next();
}
}
void KOListView::updateList()
{
// qDebug(" KOListView::updateList() ");
}
void KOListView::clearList()
{
clear ();
}
void KOListView::setCat()
{
bool set = true;
int result = KMessageBox::warningYesNoCancel(this,
i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"),
i18n("Set categories"),
i18n("Add"),
i18n("Reset"));
if (result == KMessageBox::Cancel) return;
if (result == KMessageBox::Yes) set = false;
setCategories( set );
}
void KOListView::setAlarm()
{
KOAlarmPrefs kap( this);
if ( !kap.exec() )
return;
- QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos
+ Q3PtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos
Incidence* inc = delSel.first();
int count = 0;
while ( inc ) {
++count;
if (kap.mAlarmButton->isChecked()) {
if (inc->alarms().count() == 0)
inc->newAlarm();
Alarm *alarm = inc->alarms().first();
alarm->setEnabled(true);
int j = kap.mAlarmTimeEdit->value()* -60;
if (kap.mAlarmIncrCombo->currentItem() == 1)
j = j * 60;
else if (kap.mAlarmIncrCombo->currentItem() == 2)
j = j * (60 * 24);
alarm->setStartOffset( j );
if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
alarm->setProcedureAlarm(kap.mAlarmProgram);
}
else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
alarm->setAudioAlarm(kap.mAlarmSound);
else
alarm->setType(Alarm::Invalid);
} else {
- QPtrList<Alarm> alarms = inc->alarms();
+ Q3PtrList<Alarm> alarms = inc->alarms();
Alarm *alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
alarm->setEnabled(false);
alarm->setType(Alarm::Invalid);
}
}
KOListViewItem* item = getItemForEvent(inc);
if (item) {
ListItemVisitor v(item, mStartDate );
inc->accept(v);
}
inc = delSel.next();
}
topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
qDebug("KO: Set alarm for %d items", count);
calendar()->reInitAlarmSettings();
QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
}
void KOListView::setCategories( bool removeOld )
{
KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
csd->setColorEnabled();
if (! csd->exec()) {
delete csd;
return;
}
QStringList catList = csd->selectedCategories();
delete csd;
- QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
+ Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
Incidence* inc = delSel.first();
while ( inc ) {
if ( removeOld ) {
inc->setCategories( catList, false );
} else {
inc->addCategories( catList, false );
}
KOListViewItem* item = getItemForEvent(inc);
if (item) {
ListItemVisitor v(item, mStartDate );
inc->accept(v);
}
inc = delSel.next();
}
QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
}
void KOListView::beamSelected()
{
- QPtrList<Incidence> delSel = getSelectedIncidences() ;
+ Q3PtrList<Incidence> delSel = getSelectedIncidences() ;
if ( delSel.count() )
emit beamIncidenceList( delSel );
}
void KOListView::saveDescriptionToFile()
{
int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
i18n("Continue"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
return;
}
- QPtrList<Incidence> delSel = getSelectedIncidences() ;
+ Q3PtrList<Incidence> delSel = getSelectedIncidences() ;
int icount = delSel.count();
if ( icount ) {
QString fn = KOPrefs::instance()->mLastSaveFile;
fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
if ( fn == "" )
return;
QFileInfo info;
info.setFile( fn );
QString mes;
bool createbup = true;
if ( info. exists() ) {
mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
i18n("Overwrite!"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
createbup = false;
}
}
if ( createbup ) {
QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
Incidence *incidence = delSel.first();
icount = 0;
while ( incidence ) {
if ( incidence->typeID() == journalID ) {
text += "\n************************************\n";
if ( !incidence->summary().isEmpty() )
text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false );
else
text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
if ( !incidence->location().isEmpty() )
text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
++icount;
} else {
if ( !incidence->description().isEmpty() ) {
text += "\n************************************\n";
if ( incidence->typeID() == todoID )
text += i18n("To-Do: ");
text += incidence->summary();
if ( !incidence->location().isEmpty() )
text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
if ( incidence->hasStartDate() )
text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
text += "\n" + i18n("Description: ") + "\n" + incidence->description();
++icount;
}
}
incidence = delSel.next();
}
QFile file( fn );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
return;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << text;
file.close();
//qDebug("%s ", text.latin1());
mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
KOPrefs::instance()->mLastSaveFile = fn;
topLevelWidget()->setCaption(mes);
}
}
}
void KOListView::saveToFileVCS()
{
writeToFile( false );
}
void KOListView::saveToFile()
{
writeToFile( true );
}
-QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
+Q3PtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
{
- QPtrList<Incidence> delSel ;
+ Q3PtrList<Incidence> delSel ;
bool addSubTodos = false;
bool askSubTodos = true;
- QListViewItem *item = mListView->firstChild ();
+ Q3ListViewItem *item = mListView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
Incidence* inc = ((KOListViewItem *)item)->data();
if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) {
if ( (inc->typeID() == todoID && includeTodos) ||
(inc->typeID() == eventID && includeEvents) ||
(inc->typeID() == journalID && includeJournals) ) {
if ( inc->typeID() == todoID && onlyDueTodos ) {
if ( ((Todo*)inc)->hasDueDate() )
delSel.append( inc );
} else
delSel.append( inc );
}
}
if ( inc->typeID() == todoID ) {
Todo * todo = (Todo*) inc;
if ( todo->relations().count() ) {
if ( askSubTodos ) {
int result = KMessageBox::warningYesNoCancel(this,
i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"),
i18n("Todo has subtodos"),
i18n("Yes"),
i18n("No"));
if ( result == KMessageBox::Cancel ) {
delSel.clear();
return delSel;
}
if (result == KMessageBox::Yes)
addSubTodos = true;
askSubTodos = false;
}
if ( addSubTodos ) {
- QPtrList<Incidence> tempSel ;
+ Q3PtrList<Incidence> tempSel ;
inc->addRelationsToList( &tempSel );
Incidence* tempinc = tempSel.first();
while ( tempinc ) {
if ( delSel.findRef( tempinc ) == -1 ) {
if ( tempinc->typeID() == todoID && onlyDueTodos ) {
if ( ((Todo*)tempinc)->hasDueDate() )
delSel.append( tempinc );
} else
delSel.append( tempinc );
}
tempinc = tempSel.next();
}
}
}
}
}
item = item->nextSibling();
}
return delSel;
}
void KOListView::writeToFile( bool iCal )
{
- QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
+ Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
if ( !iCal ) {
bool journal = false;
Incidence *incidence = delSel.first();
while ( incidence ) {
if ( incidence->typeID() == journalID ) {
journal = true;
break;
}
incidence = delSel.next();
}
if ( journal ) {
int result = KMessageBox::warningContinueCancel(this,
i18n("The journal entries can not be\nexported to a vCalendar file."),
i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
true);
if (result != KMessageBox::Continue) return;
}
}
if ( delSel.count() ) {
QString fn = KOPrefs::instance()->mLastSaveFile;
QString extension;
if ( iCal ) {
if ( fn.right( 4 ).lower() == ".vcs" ) {
fn = fn.left( fn.length() -3) + "ics";
}
} else {
if ( fn.right( 4 ).lower() == ".ics" ) {
fn = fn.left( fn.length() -3) + "vcs";
}
}
fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
@@ -774,149 +783,149 @@ void KOListView::writeToFile( bool iCal )
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
i18n("Overwrite!"), i18n("Cancel"), 0,
0, 1 );
if ( result != 0 ) {
createbup = false;
}
}
if ( createbup ) {
CalendarLocal cal;
cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
Incidence *incidence = delSel.first();
while ( incidence ) {
cal.addIncidence( incidence->clone() );
incidence = delSel.next();
}
if ( iCal ) {
ICalFormat format;
format.save( &cal, fn );
} else {
VCalFormat format;
format.save( &cal, fn );
}
mes = i18n("KO/Pi:Saved %1").arg(fn );
KOPrefs::instance()->mLastSaveFile = fn;
topLevelWidget()->setCaption(mes);
}
}
QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
}
void KOListView::hideAll()
{
- QPtrList<QListViewItem> delSel ;
- QListViewItem *item = mListView->firstChild ();
+ Q3PtrList<Q3ListViewItem> delSel ;
+ Q3ListViewItem *item = mListView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
delSel.append(item);
}
item = item->nextSibling();
}
item = delSel.first() ;
while ( item ) {
- QListViewItem * del = item;
+ Q3ListViewItem * del = item;
item = delSel.next();
delete del;
}
}
void KOListView::printList()
{
mListView->printList();
}
void KOListView::deleteAll()
{
- QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
+ Q3PtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
if ( delSel.count() ) {
int icount = delSel.count();
Incidence *incidence = delSel.first();
Incidence *toDelete;
KOPrefs *p = KOPrefs::instance();
bool confirm = p->mConfirm;
QString mess;
mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
p->mConfirm = false;
int delCounter = 0;
QDialog dia ( this, "p-dialog", true );
QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
- QProgressBar bar( icount, &dia );
+ Q3ProgressBar bar( icount, &dia );
lay.addWidget( &bar);
int w = 220;
int h = 50;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
//dia.resize( 240,50 );
dia.show();
KOPrefs::instance()->mGlobalUpdateDisabled = true;
while ( incidence ) {
bar.setProgress( delCounter );
mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
dia.setCaption( mess );
qApp->processEvents();
toDelete = (incidence);
incidence = delSel.next();
emit deleteIncidenceSignal(toDelete );
if ( dia.result() != 0 )
break;
}
KOPrefs::instance()->mGlobalUpdateDisabled = false;
emit deleteIncidenceSignal( 0 );
mess = mess.sprintf( i18n("%d items remaining in list."), count() );
topLevelWidget ()->setCaption( mess );
p->mConfirm = confirm;
}
}
}
int KOListView::maxDatesHint()
{
return 0;
}
int KOListView::currentDateCount()
{
return 0;
}
-QPtrList<Incidence> KOListView::selectedIncidences()
+Q3PtrList<Incidence> KOListView::selectedIncidences()
{
- QPtrList<Incidence> eventList;
- QListViewItem *item = mListView->firstChild ();
+ Q3PtrList<Incidence> eventList;
+ Q3ListViewItem *item = mListView->firstChild ();
while ( item ) {
if ( item->isSelected() ) {
eventList.append(((KOListViewItem *)item)->data());
}
item = item->nextSibling();
}
// // QListViewItem *item = mListView->selectedItem();
//if (item) eventList.append(((KOListViewItem *)item)->data());
return eventList;
}
DateList KOListView::selectedDates()
{
DateList eventList;
return eventList;
}
void KOListView::showDates(bool show)
{
// Shouldn't we set it to a value greater 0? When showDates is called with
// show == true at first, then the columnwidths are set to zero.
static int oldColWidth1 = 0;
static int oldColWidth3 = 0;
if (!show) {
oldColWidth1 = mListView->columnWidth(1);
oldColWidth3 = mListView->columnWidth(3);
mListView->setColumnWidth(1, 0);
mListView->setColumnWidth(3, 0);
@@ -958,501 +967,501 @@ void KOListView::updateView()
mListView->setCurrentItem( mListView->firstChild () );
}
processSelectionChange( mListView->firstChild () );
}
void KOListView::updateConfig()
{
mListView->setFont ( KOPrefs::instance()->mListViewFont );
updateView();
}
void KOListView::setStartDate(const QDate &start)
{
mStartDate = start;
}
void KOListView::showDates(const QDate &start, const QDate &end)
{
clear();
mStartDate = start;
QDate date = start;
while( date <= end ) {
addEvents(calendar()->events(date));
addTodos(calendar()->todos(date));
addJournals( calendar()->journals4Date(date) );
date = date.addDays( 1 );
}
//emit incidenceSelected( 0 );
updateView();
}
-void KOListView::addEvents(QPtrList<Event> eventList)
+void KOListView::addEvents(Q3PtrList<Event> eventList)
{
Event *ev;
for(ev = eventList.first(); ev; ev = eventList.next()) {
addIncidence(ev);
}
if ( !mListView->currentItem() ){
updateView();
}
}
-void KOListView::addTodos(QPtrList<Todo> eventList)
+void KOListView::addTodos(Q3PtrList<Todo> eventList)
{
Todo *ev;
for(ev = eventList.first(); ev; ev = eventList.next()) {
addIncidence(ev);
}
if ( !mListView->currentItem() ){
updateView();
}
}
-void KOListView::addJournals(QPtrList<Journal> eventList)
+void KOListView::addJournals(Q3PtrList<Journal> eventList)
{
Journal *ev;
for(ev = eventList.first(); ev; ev = eventList.next()) {
addIncidence(ev);
}
if ( !mListView->currentItem() ){
updateView();
}
}
void KOListView::showCompletedTodos()
{
mForceShowCompletedTodos = true;
}
void KOListView::addIncidence(Incidence *incidence)
{
if ( mUidDict.find( incidence->uid() ) ) return;
// mListView->setFont ( KOPrefs::instance()->mListViewFont );
if ( incidence->typeID() == todoID ) {
if ( ! mForceShowCompletedTodos ) {
if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() )
return;
}
}
mUidDict.insert( incidence->uid(), incidence );
KOListViewItem *item = new KOListViewItem( incidence, mListView );
ListItemVisitor v(item, mStartDate );
if (incidence->accept(v)) {
return;
}
else delete item;
}
-void KOListView::showEvents(QPtrList<Event> eventList)
+void KOListView::showEvents(Q3PtrList<Event> eventList)
{
clear();
addEvents(eventList);
// After new creation of list view no events are selected.
emit incidenceSelected( 0 );
}
int KOListView::count()
{
return mListView->childCount();
}
void KOListView::changeEventDisplay(Event *event, int action)
{
KOListViewItem *item;
switch(action) {
case KOGlobals::EVENTADDED:
addIncidence( event );
break;
case KOGlobals::EVENTEDITED:
item = getItemForEvent(event);
if (item) {
ListItemVisitor v(item, mStartDate );
((Incidence*)event)->accept(v);
}
break;
case KOGlobals::EVENTDELETED:
item = getItemForEvent(event);
if (item) {
mUidDict.remove( event->uid() );
delete item;
}
break;
default:
;
}
}
KOListViewItem *KOListView::getItemForEvent(Incidence *event)
{
KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
while (item) {
if (item->data() == event) return item;
item = (KOListViewItem *)item->nextSibling();
}
return 0;
}
-void KOListView::defaultItemAction(QListViewItem *i)
+void KOListView::defaultItemAction(Q3ListViewItem *i)
{
KOListViewItem *item = static_cast<KOListViewItem *>( i );
if ( item ) defaultAction( item->data() );
}
-void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
+void KOListView::popupMenu(Q3ListViewItem *item,const QPoint &,int)
{
mActiveItem = (KOListViewItem *)item;
if (mActiveItem) {
Incidence *incidence = mActiveItem->data();
mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) );
mPopupMenu->showIncidencePopup(incidence);
/*
if ( incidence && incidence->type() == "Event" ) {
Event *event = static_cast<Event *>( incidence );
mPopupMenu->showEventPopup(event);
}
*/
}
}
void KOListView::readSettings(KConfig *config, QString setting)
{
// qDebug("KOListView::readSettings ");
mListView->restoreLayout(config,setting);
}
void KOListView::writeSettings(KConfig *config, QString setting)
{
// qDebug("KOListView::writeSettings ");
mListView->saveLayout(config, setting);
}
-void KOListView::processSelectionChange(QListViewItem *)
+void KOListView::processSelectionChange(Q3ListViewItem *)
{
KOListViewItem *item =
static_cast<KOListViewItem *>( mListView->currentItem() );
if ( !item ) {
emit incidenceSelected( 0 );
} else {
emit incidenceSelected( item->data() );
}
}
void KOListView::clearSelection()
{
mListView->selectAll( false );
}
void KOListView::allSelection()
{
mListView->selectAll( true );
}
void KOListView::clear()
{
mListView->clear();
mUidDict.clear();
}
Incidence* KOListView::currentItem()
{
if ( mListView->currentItem() )
return ((KOListViewItem*) mListView->currentItem())->data();
return 0;
}
void KOListView::keyPressEvent ( QKeyEvent *e)
{
if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
deleteAll();
return;
}
e->ignore();
}
void KOListViewListView::keyPressEvent ( QKeyEvent *e)
{
switch ( e->key() ) {
case Qt::Key_Down:
- if ( e->state() == ShiftButton ) {
- QListViewItem* cn = currentItem();
+ if ( e->state() == Qt::ShiftButton ) {
+ Q3ListViewItem* cn = currentItem();
if ( !cn )
cn = firstChild();
if ( !cn )
return;
while ( cn->nextSibling() )
cn = cn->nextSibling();
setCurrentItem ( cn );
ensureItemVisible ( cn );
e->accept();
return;
}
- if ( e->state() == ControlButton ) {
+ if ( e->state() == Qt::ControlButton ) {
int count = childCount ();
int jump = count / 5;
- QListViewItem* cn;
+ Q3ListViewItem* cn;
cn = currentItem();
if ( ! cn )
return;
if ( jump == 0 )
jump = 1;
while ( jump && cn->nextSibling() ) {
cn = cn->nextSibling();
--jump;
}
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else
- QListView::keyPressEvent ( e ) ;
+ Q3ListView::keyPressEvent ( e ) ;
e->accept();
break;
case Qt::Key_Up:
- if ( e->state() == ShiftButton ) {
- QListViewItem* cn = firstChild();
+ if ( e->state() == Qt::ShiftButton ) {
+ Q3ListViewItem* cn = firstChild();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
e->accept();
return;
}
- if ( e->state() == ControlButton ) {
+ if ( e->state() == Qt::ControlButton ) {
int count = childCount ();
int jump = count / 5;
- QListViewItem* cn;
+ Q3ListViewItem* cn;
cn = currentItem();
if ( ! cn )
return;
if ( jump == 0 )
jump = 1;
while ( jump && cn->itemAbove ()) {
cn = cn->itemAbove ();
--jump;
}
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else
- QListView::keyPressEvent ( e ) ;
+ Q3ListView::keyPressEvent ( e ) ;
e->accept();
break;
case Qt::Key_I: {
- QListViewItem* cn;
+ Q3ListViewItem* cn;
cn = currentItem();
if ( cn ) {
KOListViewItem* ci = (KOListViewItem*)( cn );
if ( ci ){
//emit showIncidence( ci->data());
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
emit showIncidence( ci->data());
}
}
e->accept();
}
break;
case Qt::Key_Return:
case Qt::Key_Enter:
{
- QListViewItem* cn;
+ Q3ListViewItem* cn;
cn = currentItem();
if ( cn ) {
KOListViewItem* ci = (KOListViewItem*)( cn );
if ( ci ){
- if ( e->state() == ShiftButton )
+ if ( e->state() == Qt::ShiftButton )
ci->setSelected( false );
else
ci->setSelected( true );
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
} else {
emit currentChanged( ci );
}
}
}
e->accept();
}
break;
default:
e->ignore();
}
}
KOListViewListView::KOListViewListView(KOListView * lv )
: KListView( lv, "kolistlistview", false )
{
mYMousePos = 0;
setAllColumnsShowFocus( true );
mPopupTimer = new QTimer(this);
connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
- setSelectionMode( QListView::Multi );
+ setSelectionMode( Q3ListView::Multi );
setMultiSelection( true);
}
-bool KOListViewListView::hasMultiSelection(QListViewItem* item)
+bool KOListViewListView::hasMultiSelection(Q3ListViewItem* item)
{
- QListViewItem *qitem = firstChild ();
+ Q3ListViewItem *qitem = firstChild ();
while ( qitem ) {
if ( qitem->isSelected() && item != qitem )
return true;
qitem = qitem->nextSibling();
}
return false;
}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
if (!e) return;
QPoint vp = contentsToViewport(e->pos());
- QListViewItem *item = itemAt(vp);
+ Q3ListViewItem *item = itemAt(vp);
if (!item) {
emit newEvent();
return;
}
KListView::contentsMouseDoubleClickEvent(e);
}
#if 0
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ ");
KListView::contentsMousePressEvent( e );
- if ( e->button() == RightButton ) {
- QListViewItem* ci = currentItem();
+ if ( e->button() == Qt::RightButton ) {
+ Q3ListViewItem* ci = currentItem();
clearSelection () ;
if ( ci )
ci->setSelected( true );
}
}
void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
KListView::contentsMouseReleaseEvent(e);
}
void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
{
KListView::contentsMouseMoveEvent(e);
}
#endif
void KOListViewListView::popupMenu()
{
mPopupTimer->stop();
- QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
+ QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, Qt::RightButton , Qt::RightButton );
QApplication::postEvent( this->viewport(), e );
}
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
mYMousePos = mapToGlobal( (e->pos())).y();
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
mPopupTimer->start( 600 );
mEventPos = contentsToViewport(e->pos());
mEventGlobalPos = e->globalPos();
}
KListView::contentsMousePressEvent( e );
- if ( e->button() == RightButton ) {
- QListViewItem* ci = currentItem();
+ if ( e->button() == Qt::RightButton ) {
+ Q3ListViewItem* ci = currentItem();
//clearSelection();
if ( ci )
ci->setSelected( true );
}
}
void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
mPopupTimer->stop();
KListView::contentsMouseReleaseEvent(e);
}
void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
{
// qDebug("contentsMouseMoveEv....... ");
// qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
int diff = mYMousePos - mapToGlobal( (e->pos())).y();
if ( diff < 0 ) diff = -diff;
if ( diff > 15 )
mPopupTimer->stop();
else {
mEventPos = contentsToViewport(e->pos());
mEventGlobalPos = e->globalPos();
}
KListView::contentsMouseMoveEvent(e);
}
#define protected public
-#include <qheader.h>
+#include <q3header.h>
#undef protected
void KOListViewListView::printList()
{
#ifdef DESKTOP_VERSION
KOPrintPrefs pp ( this );
if (!pp.exec() )
return;
int scaleval = pp.printMode() ;
QPrinter printer;
if (!printer.setup() )
return;
clearSelection ();
QPainter p;
p.begin ( &printer );
p.setFont(font());
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,m.width()/10 );
if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
p.scale( scale, scale );
}
int cou = header()->count();
int iii;
QRect rect ( 0,0,0, header()->height());
for ( iii = 0; iii < cou; ++iii ) {
rect.setLeft ( header()->sectionPos( iii ) );
rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
header()->paintSection ( & p, header()->mapToIndex (iii), rect );
}
p.translate( 0, header()->height());
//drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
const QColorGroup &cg = colorGroup();
KOListViewItem* item = (KOListViewItem* )firstChild();
int yOff = 0;
while ( item ) {
p.translate( 0, yOff );
p.save();
for ( iii = 0; iii < cou; ++iii ) {
int align = columnAlignment( iii );
- if ( align == AlignAuto ) align = AlignLeft;
+ if ( align == Qt::AlignLeft ) align = Qt::AlignLeft;
p.restore();
p.save();
p.translate( header()->sectionPos( iii ), 0);
item->paintCell( &p, cg, iii, header()->sectionSize (iii), align );
}
yOff = item->height();
item = (KOListViewItem* )(item->itemBelow());
p.restore();
}
p.end();
#endif
}
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 99d0561..9fb0b00 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -1,109 +1,115 @@
/*
This file is part of KOrganizer.
Copyright (c) 1999 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOLISTVIEW_H
#define _KOLISTVIEW_H
-#include <qlistview.h>
+#include <q3listview.h>
#include <qmap.h>
-#include <qdict.h>
+#include <q3dict.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <Q3PtrList>
+#include <Q3PopupMenu>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
#include <klistview.h>
#include <libkcal/incidence.h>
#include "koeventview.h"
#include "customlistviewitem.h"
using namespace KCal;
class KOListViewWhatsThis;
#include <qpushbutton.h>
#include <qlayout.h>
#include <qdialog.h>
#include <qtimer.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qtooltip.h>
#include <qcheckbox.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qlabel.h>
#include <kiconloader.h>
#include "kfiledialog.h"
#include "koprefs.h"
class KOAlarmPrefs : public QDialog
{
Q_OBJECT
public:
KOAlarmPrefs( QWidget *par=0, const char *name=0 ) :
QDialog( par, name, true )
{
setCaption( i18n("Alarm Options") );
- QVBoxLayout* alarmLayout = new QVBoxLayout( this );
+ Q3VBoxLayout* alarmLayout = new Q3VBoxLayout( this );
alarmLayout->setSpacing( 3 );
alarmLayout->setMargin( 3 );
QWidget *parent = this;
mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent);
alarmLayout->addWidget(mAlarmButton);
mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
mAlarmTimeEdit->setValue( 15 );
alarmLayout->addWidget(mAlarmTimeEdit);
mAlarmIncrCombo = new QComboBox(false, parent);
mAlarmIncrCombo->insertItem(i18n("minute(s)"));
mAlarmIncrCombo->insertItem(i18n("hour(s)"));
mAlarmIncrCombo->insertItem(i18n("day(s)"));
alarmLayout->addWidget(mAlarmIncrCombo);
- QHBox * hb = new QHBox ( parent );
+ Q3HBox * hb = new Q3HBox ( parent );
alarmLayout->addWidget(hb);
mAlarmSoundButton = new QPushButton(hb);
mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
mAlarmSoundButton->setToggleButton(true);
connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
mAlarmProgramButton = new QPushButton(hb);
mAlarmProgramButton->setPixmap(SmallIcon("run"));
mAlarmProgramButton->setToggleButton(true);
connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
mAlarmLabel = new QLabel( this );
alarmLayout->addWidget( mAlarmLabel );
mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) );
mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
mAlarmSoundButton->setOn( true );
QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this );
alarmLayout->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
alarmLayout->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
QString mAlarmSound, mAlarmProgram ;
QCheckBox* mAlarmButton;
QSpinBox* mAlarmTimeEdit;
QLabel* mAlarmLabel;
@@ -181,137 +187,137 @@ typedef CustomListViewItem<Incidence *> KOListViewItem;
class ListItemVisitor : public Incidence::Visitor
{
public:
ListItemVisitor(KOListViewItem *, QDate d);
~ListItemVisitor();
bool visit(Event *);
bool visit(Todo *);
bool visit(Journal *);
private:
KOListViewItem *mItem;
QDate mDate;
};
/**
This class provides a multi-column list view of events. It can
display events from one particular day or several days, it doesn't
matter. To use a view that only handles one day at a time, use
KODayListView.
@short multi-column list view of various events.
@author Preston Brown <pbrown@kde.org>
@see KOBaseView, KODayListView
*/
class KOListView;
class KOListViewListView : public KListView
{
Q_OBJECT
public:
KOListViewListView(KOListView * lv );
- bool hasMultiSelection(QListViewItem*);
+ bool hasMultiSelection(Q3ListViewItem*);
void printList();
signals:
void newEvent();
void showIncidence( Incidence* );
public slots:
void popupMenu();
private:
QPoint mEventPos;
QPoint mEventGlobalPos;
QTimer* mPopupTimer;
int mYMousePos;
void keyPressEvent ( QKeyEvent * ) ;
void contentsMouseDoubleClickEvent(QMouseEvent *e);
void contentsMousePressEvent(QMouseEvent *e);
void contentsMouseReleaseEvent(QMouseEvent *e);
void contentsMouseMoveEvent(QMouseEvent *e);
bool mMouseDown;
};
class KOListView : public KOEventView
{
Q_OBJECT
public:
KOListView(Calendar *calendar, QWidget *parent = 0,
const char *name = 0);
~KOListView();
virtual int maxDatesHint();
virtual int currentDateCount();
- virtual QPtrList<Incidence> selectedIncidences();
+ virtual Q3PtrList<Incidence> selectedIncidences();
virtual DateList selectedDates();
void showDates(bool show);
Incidence* currentItem();
- void addTodos(QPtrList<Todo> eventList);
- void addJournals(QPtrList<Journal> eventList);
+ void addTodos(Q3PtrList<Todo> eventList);
+ void addJournals(Q3PtrList<Journal> eventList);
virtual void printPreview(CalPrinter *calPrinter,
const QDate &, const QDate &);
void readSettings(KConfig *config, QString setting = "KOListView Layout");
void writeSettings(KConfig *config, QString setting = "KOListView Layout");
void updateList();
void clearList();
void setStartDate(const QDate &start);
int count();
QString getWhatsThisText(QPoint p);
- QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false );
+ Q3PtrList<Incidence> getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false );
void showCompletedTodos();
signals:
void signalNewEvent();
- void beamIncidenceList(QPtrList<Incidence>);
+ void beamIncidenceList(Q3PtrList<Incidence>);
public slots:
void hideAll();
void printList();
void resetFocus();
virtual void updateView();
virtual void showDates(const QDate &start, const QDate &end);
- virtual void showEvents(QPtrList<Event> eventList);
+ virtual void showEvents(Q3PtrList<Event> eventList);
void clearSelection();
void allSelection();
void clear();
void showDates();
void hideDates();
void deleteAll();
void saveToFile();
void saveToFileVCS();
void saveDescriptionToFile();
void beamSelected();
void updateConfig();
void setCat();
void setAlarm();
void setCategories( bool removeOld );
void changeEventDisplay(Event *, int);
- void defaultItemAction(QListViewItem *item);
- void popupMenu(QListViewItem *item,const QPoint &,int);
+ void defaultItemAction(Q3ListViewItem *item);
+ void popupMenu(Q3ListViewItem *item,const QPoint &,int);
void setCalendar( int c );
void populateCalPopup();
protected slots:
- void processSelectionChange(QListViewItem *);
+ void processSelectionChange(Q3ListViewItem *);
void catChanged( Incidence* );
protected:
void writeToFile( bool iCal );
- void addEvents(QPtrList<Event> eventList);
+ void addEvents(Q3PtrList<Event> eventList);
void addIncidence(Incidence *);
KOListViewItem *getItemForEvent(Incidence *event);
private:
bool mForceShowCompletedTodos;
- QPopupMenu* mCalPopup;
+ Q3PopupMenu* mCalPopup;
KOListViewWhatsThis *mKOListViewWhatsThis;
KOListViewListView *mListView;
KOEventPopupMenu *mPopupMenu;
KOListViewItem *mActiveItem;
- QDict<Incidence> mUidDict;
+ Q3Dict<Incidence> mUidDict;
QDate mStartDate;
void keyPressEvent ( QKeyEvent * ) ;
};
#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 85e9166..ca55c43 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,319 +1,331 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qfont.h>
#include <qfontmetrics.h>
-#include <qkeycode.h>
-#include <qhbox.h>
-#include <qvbox.h>
-#include <qwidgetstack.h>
+#include <qnamespace.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
+#include <q3widgetstack.h>
#include <qpushbutton.h>
#include <qtooltip.h>
#include <qpainter.h>
#include <qtimer.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
+#include <QPixmap>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3PointArray>
+#include <Q3PtrList>
#endif
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kiconloader.h>
#include <kcalendarsystem.h>
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "koprefs.h"
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include "koglobals.h"
#include <libkcal/kincidenceformatter.h>
#include "komonthview.h"
#define PIXMAP_SIZE 5
#ifdef DESKTOP_VERSION
QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
#endif
-class KNOWhatsThis :public QWhatsThis
+class KNOWhatsThis :public Q3WhatsThis
{
public:
- KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
+ KNOWhatsThis( KNoScrollListBox* sbox ) : Q3WhatsThis( sbox ), _wid( sbox) { };
//~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
protected:
virtual QString text( const QPoint& p)
{
return _wid->getWhatsThisText(p) ;
};
private:
KNoScrollListBox* _wid;
};
KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
- : QListBox(parent, name, WRepaintNoErase)
+ : Q3ListBox(parent, name, Qt::WNoAutoErase)
{
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
mBlockDeselect = false;
mWT = new KNOWhatsThis(this);
resetOnFocusIn = true;
- setVScrollBarMode(QScrollView::AlwaysOff);
- setHScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ setHScrollBarMode(Q3ScrollView::AlwaysOff);
}
KNoScrollListBox::~KNoScrollListBox()
{
#if QT_VERSION >= 0x030000
#else
delete mWT;
#endif
}
void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
{
- QListBox::focusInEvent ( e );
+ Q3ListBox::focusInEvent ( e );
if ( count() ){
int ci = currentItem();
if ( ci < 0 ) ci = 0;
setCurrentItem( ci );
setSelected ( ci, true );
emit highlighted( item ( ci ) );
resetOnFocusIn = true;
if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
- QListBoxItem *fi = firstItem ();
+ Q3ListBoxItem *fi = firstItem ();
if (fi ) {
int ihei = fi->height( this );
int hei = numRows () * ihei;
if ( hei < height() - horizontalScrollBar()->height () ) {
- setVScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(Q3ScrollView::AlwaysOff);
}
else
- setVScrollBarMode(QScrollView::Auto);
+ setVScrollBarMode(Q3ScrollView::Auto);
if ( ihei *3 > height() ) {
- setHScrollBarMode(QScrollView::AlwaysOff);
+ setHScrollBarMode(Q3ScrollView::AlwaysOff);
}
else {
- setHScrollBarMode(QScrollView::Auto);
+ setHScrollBarMode(Q3ScrollView::Auto);
}
} else {
- setVScrollBarMode(QScrollView::Auto);
- setHScrollBarMode(QScrollView::Auto);
+ setVScrollBarMode(Q3ScrollView::Auto);
+ setHScrollBarMode(Q3ScrollView::Auto);
}
}
}
}
void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
{
if ( ! mBlockDeselect ) {
int i = currentItem ();
if ( i >= 0 ) {
setSelected ( i, false );
}
- QListBox::focusOutEvent ( e );
+ Q3ListBox::focusOutEvent ( e );
}
- setVScrollBarMode(QScrollView::AlwaysOff);
- setHScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ setHScrollBarMode(Q3ScrollView::AlwaysOff);
if ( ! mBlockDeselect )
emit highlightIncidence( 0, (MonthViewCell*)this, 0 );
mBlockDeselect = false;
}
QString KNoScrollListBox::getWhatsThisText(QPoint p)
{
- QListBoxItem* item = itemAt ( p );
+ Q3ListBoxItem* item = itemAt ( p );
if ( ! item ) {
return i18n("Click in the cell\nto add an event!");
}
return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
}
void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
{
//qDebug("KNoScrollListBox::keyPressEvent ");
switch(e->key()) {
- case Key_Right:
+ case Qt::Key_Right:
if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
{
e->ignore();
return;
}
scrollBy(10,0);
break;
- case Key_Left:
+ case Qt::Key_Left:
if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
{
e->ignore();
return;
}
scrollBy(-10,0);
break;
- case Key_Up:
+ case Qt::Key_Up:
if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
e->ignore();
break;
}
if ( count() ) {
if ( currentItem() == 0 ) {
emit prevCell();
} else {
setCurrentItem((currentItem()+count()-1)%count());
if(!itemVisible(currentItem())) {
if((unsigned int) currentItem() == (count()-1)) {
setTopItem(currentItem()-numItemsVisible()+1);
} else {
setTopItem(topItem()-1);
}
}
}
}
break;
- case Key_Down:
+ case Qt::Key_Down:
if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
e->ignore();
break;
}
if ( count () ) {
if ( ((uint)currentItem()+1) == count () ) {
emit nextCell();
} else {
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
setTopItem(0);
} else {
setTopItem(topItem()+1);
}
}
}
}
break;
- case Key_I:
+ case Qt::Key_I:
QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
e->ignore();
break;
- case Key_Return:
- case Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
{
if ( currentItem() >= 0 ) {
emit doubleClicked( item( currentItem() ) );
e->accept();
} else {
e->ignore();
}
}
break;
- case Key_Shift:
+ case Qt::Key_Shift:
emit shiftDown();
break;
default:
e->ignore();
break;
}
}
void KNoScrollListBox::oneDown()
{
if ( count () ) {
if ( ((uint)currentItem()+1) == count () ) {
emit nextCell();
} else {
resetOnFocusIn = false;
setCurrentItem((currentItem()+1)%count());
if(!itemVisible(currentItem())) {
if(currentItem() == 0) {
setTopItem(0);
} else {
setTopItem(topItem()+1);
}
}
}
}
}
void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
{
switch(e->key()) {
- case Key_Shift:
+ case Qt::Key_Shift:
emit shiftUp();
break;
default:
break;
}
}
void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
{
- QListBox::mousePressEvent(e);
+ Q3ListBox::mousePressEvent(e);
- if(e->button() == RightButton) {
+ if(e->button() == Qt::RightButton) {
emit rightClick();
}
}
MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s)
- : QListBoxItem()
+ : Q3ListBoxItem()
{
mblockRepaint = true;
isWeekItem = KOPrefs::instance()->mMonthViewWeek;
recycle( incidence, s );
}
void MonthViewItem::recycle( Incidence *incidence, const QString & s)
{
mDisplayHighlighted = false;
setText( s );
mMultiday = 0;
mIncidence = incidence;
mRecur = false;
mAlarm = false;
mReply = false;
mInfo = false;
mdayPos = 0;
}
bool MonthViewItem::setHighlightedFalse()
{
if ( !mDisplayHighlighted )
return false;
mDisplayHighlighted = false;
return true;
}
bool MonthViewItem::setHighlighted( Incidence * inc )
{
if ( inc == mIncidence ) {
if ( mDisplayHighlighted )
return false;
mDisplayHighlighted = true;
@@ -366,215 +378,215 @@ void MonthViewItem::paint(QPainter *p)
p->fillRect ( x, y,size,size, Qt::blue );
x += size + 1;
}
if ( mAlarm ) {
p->fillRect ( x, y,size,size, Qt::red );
x += size + 1;
}
if ( mReply ) {
p->fillRect ( x, y,size,size, Qt::yellow );
x += size + 1;
}
}
if ( sel ) p->setPen( Qt::white );
else p->setPen( palette().color( QPalette::Normal,QColorGroup::Foreground ) );
#if 0
p->setPen( palette().color( QPalette::Normal, sel ? \
QColorGroup::HighlightedText : QColorGroup::Foreground ) );
#endif
QColor textColor = p->pen().color();
if ( mMultiday ) {
int yyy = y+(size/2);
int sizeM = size+2;
p->setBrush( QBrush( textColor ) );
p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
if ( mMultiday == 2 || mMultiday == 3 ) {
- QPointArray pa ( 3 );
+ Q3PointArray pa ( 3 );
pa.setPoint (0, x, yyy );
pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
p->drawPolygon( pa );
}
if ( mMultiday == 2 || mMultiday == 1 ) {
- QPointArray pa ( 3 );
+ Q3PointArray pa ( 3 );
pa.setPoint (0, x+sizeM +sizeM/2, yyy );
pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
p->drawPolygon( pa );
}
if ( mMultiday == 1 ) {
// p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
}
if ( mMultiday == 3 ) {
// p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
}
x += sizeM/2 + 1;
x += sizeM + 1;
}
if ( mIncidence->typeID() == todoID ){
Todo* td = ( Todo* ) mIncidence;
if ( td->isCompleted() ) {
int half = size/2;
p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
x += half+half + 4;
} else {
int val = td->percentComplete()/20;
p->fillRect ( x+1, y-2, val ,size+4,textColor );
p->drawRect ( x, y-2,7,size+4);
x += size + 3;
}
}
QFontMetrics fm = p->fontMetrics();
int yPos;
int pmheight = size;
if( pmheight < fm.height() )
yPos = fm.ascent() + fm.leading()/2;
else
yPos = pmheight/2 - fm.height()/2 + fm.ascent();
if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
p->drawText( x, yPos, text() );
if ( mIncidence->cancelled() ) {
int wid = fm.width( text() );
p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
}
} else {
QString pText = text();
if( pText.mid(2,1) == ":" )
pText = pText.mid( 6 );
p->drawText( x, yPos, pText );
if ( mIncidence->cancelled() ) {
int wid = fm.width( pText );
p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
}
}
}
-int MonthViewItem::height(const QListBox *lb) const
+int MonthViewItem::height(const Q3ListBox *lb) const
{
int ret = 10;
if ( lb )
ret = lb->fontMetrics().lineSpacing()+1;
return ret;
}
-int MonthViewItem::width(const QListBox *lb) const
+int MonthViewItem::width(const Q3ListBox *lb) const
{
if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
int size = PIXMAP_SIZE;
if ( QApplication::desktop()->width() < 300 )
size = 3;
int x = 1;
if ( KOPrefs::instance()->mMonthShowIcons ) {
if ( mInfo ) {
x += size + 1;
}
if( mRecur ) {
x += size+1;
}
if( mAlarm ) {
x += size+1;
}
if( mReply ) {
x += size+1;
}
}
if( mMultiday ) {
x += size+1+2+size/2;
}
return( x + lb->fontMetrics().width( text() ) + 1 );
}
if ( ! lb )
return 10;
return lb->width();
}
MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
: KNoScrollListBox( par ),
mMonthView( parent )
{
//QVBoxLayout *topLayout = new QVBoxLayout( this );
currentPalette = 0;
// mLabel = new QLabel( this );QPushButton
mLabel = new QPushButton( this );
//mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
//mLabel->setLineWidth( 1 );
//mLabel->setAlignment( AlignCenter );
mLabel->setFlat( true );
- mLabel->setFocusPolicy(NoFocus);
+ mLabel->setFocusPolicy(Qt::NoFocus);
//mItemList = new KNoScrollListBox( this );
setMinimumSize( 10, 10 );
- setFrameStyle( QFrame::Panel | QFrame::Plain );
+ setFrameStyle( Q3Frame::Panel | Q3Frame::Plain );
setLineWidth( 1 );
//topLayout->addWidget( mItemList );
mLabel->raise();
// QColor( 0,0,255 ) QColor( 160,1600,255 )
mStandardPalette = palette();
mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
enableScrollBars( false );
updateConfig();
//connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
- connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
- SLOT( defaultAction( QListBoxItem * ) ) );
- connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
+ connect( this , SIGNAL( doubleClicked( Q3ListBoxItem *) ),
+ SLOT( defaultAction( Q3ListBoxItem * ) ) );
+ connect( this, SIGNAL( rightButtonPressed( Q3ListBoxItem *,
const QPoint &) ),
- SLOT( contextMenu( QListBoxItem * ) ) );
- connect( this, SIGNAL( highlighted( QListBoxItem *) ),
- SLOT( selection( QListBoxItem * ) ) );
+ SLOT( contextMenu( Q3ListBoxItem * ) ) );
+ connect( this, SIGNAL( highlighted( Q3ListBoxItem *) ),
+ SLOT( selection( Q3ListBoxItem * ) ) );
/*
connect( this, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( selection( QListBoxItem * ) ) );
*/
}
#ifdef DESKTOP_VERSION
QToolTipGroup *MonthViewCell::toolTipGroup()
{
- if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
+ /* TODO:hacker: if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); */
return mToolTipGroup;
}
#endif
void MonthViewCell::setDate( const QDate &date )
{
// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
mDate = date;
//resizeEvent( 0 );
}
QDate MonthViewCell::date() const
{
return mDate;
}
void MonthViewCell::setPrimary( bool primary )
{
mPrimary = primary;
//setMyPalette();
}
void MonthViewCell::setMyPalette()
{
if ( mHoliday) {
if ( currentPalette == 1 ) return;
mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
setPalette( mHolidayPalette );
//mLabel->setPalette( mHolidayPalette );
@@ -608,120 +620,120 @@ QPalette MonthViewCell::getPalette ()
return mHolidayPalette ;
} else {
if ( mPrimary ) {
return mPrimaryPalette ;
}
}
return mNonPrimaryPalette;
}
bool MonthViewCell::isPrimary() const
{
return mPrimary;
}
void MonthViewCell::setHoliday( bool holiday )
{
mHoliday = holiday;
//setMyPalette();
}
void MonthViewCell::setHoliday( const QString &holiday )
{
mHolidayString = holiday;
if ( !holiday.isEmpty() ) {
setHoliday( true );
}
}
void MonthViewCell::startUpdateCell()
{
blockSignals( true );
mdayCount = 0;
- setFocusPolicy(NoFocus);
+ setFocusPolicy(Qt::NoFocus);
if ( !mMonthView->isUpdatePossible() )
return;
MonthViewItem *mitem = (MonthViewItem*) firstItem ();
while ( mitem ) {
mitem->setBlockRepaint( true );
mitem = (MonthViewItem *)mitem->next();
}
if ( mAvailItemList.count() > 20 ) {
mAvailItemList.setAutoDelete( true );
mAvailItemList.clear();
mAvailItemList.setAutoDelete( false );
clear();
}
setPrimary( mDate.month()%2 );
setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
if ( mDate == QDate::currentDate() ) {
setLineWidth( 3 );
} else {
setLineWidth( 1 );
}
MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
//clear();
while ( CurrentAvailItem ) {
MonthViewItem *item = CurrentAvailItem;
//item->setHighlightedFalse();
item->recycle( 0, "");
CurrentAvailItem = (MonthViewItem *)item->next();
mAvailItemList.append( item );
takeItem ( item );
}
#ifdef DESKTOP_VERSION
QToolTip::remove(this);
#endif
mToolTip.clear();
//qApp->processEvents();
#if 0
if ( !mHolidayString.isEmpty() ) {
MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
item->setPalette( mHolidayPalette );
insertItem( item );
mToolTip.append ( mHolidayString );
}
#endif
}
int MonthViewCell::insertEvent(Event *event)
{
bool useToolTips = true;
#ifndef DESKTOP_VERSION
useToolTips = false;
#endif
QString mToolTipText;
- setFocusPolicy(WheelFocus);
+ setFocusPolicy(Qt::WheelFocus);
if ( !(event->doesRecur() == Recurrence::rNone) ) {
if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
return mdayCount;
else
if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
return mdayCount;
}
if ( event->isHoliday()) {
setHoliday( true );
if ( mDate.dayOfWeek() == 7 )
setLineWidth( 3 );
}
QString text;
int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
if (event->isMultiDay()) {
QString prefix = "<->";multiday = 2;
QString time;
if ( event->doesRecur() ) {
if ( event->recursOn( mDate) ) {
prefix ="->" ;multiday = 1;
}
else {
int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
if ( event->recursOn( mDate.addDays( -days)) ) {
prefix ="<-" ;multiday = 3;
}
}
} else {
if (mDate == event->dtStart().date()) {
prefix ="->" ;multiday = 1;
@@ -805,81 +817,81 @@ int MonthViewCell::insertEvent(Event *event)
}
pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
item->setPalette( pal );
item->setRecur( event->doesRecur() );
item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
item->setMoreInfo( event->description().length() > 0 );
#ifdef DESKTOP_VERSION
Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
KOPrefs::instance()->email());
if ( me != 0 ) {
if ( me->status() == Attendee::NeedsAction && me->RSVP())
item->setReply(true && multiday < 2);
else
item->setReply(false);
} else
item->setReply(false);
#endif
item->setMultiDay( multiday );
if ( multiday ) {
insertItem( item ,mdayCount);
++mdayCount;
} else {
uint i = mdayCount;
uint pos = mdayCount;
uint itcount = count();
if ( itcount > 1000 ) {
qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount);
itcount = 0;
}
for ( i = pos; i < itcount;++i ) {
// qDebug("i %d mday %u count %d ",i,itcount,mdayCount );
- QListBoxItem* it = this->item ( i );
+ Q3ListBoxItem* it = this->item ( i );
if ( it && text < it->text() ) {
pos = i;
break;
}
++pos;
}
insertItem( item ,pos);
}
if ( useToolTips ) {
mToolTip.append( mToolTipText );
}
return mdayCount;
}
void MonthViewCell::insertTodo(Todo *todo)
{
- setFocusPolicy(WheelFocus);
+ setFocusPolicy(Qt::WheelFocus);
QString text;
if (todo->hasDueDate()) {
if (!todo->doesFloat()) {
text += KGlobal::locale()->formatTime(todo->dtDue().time());
text += " ";
}
}
text += todo->summary();
MonthViewItem *item ;
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
item->recycle( todo, text );
} else {
item = new MonthViewItem( todo, text );
}
//MonthViewItem *item = new MonthViewItem( todo, mDate, text );
//item->setPalette( mStandardPalette );
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
QStringList categories = todo->categories();
QString cat = categories.first();
if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
pal = getPalette();
if (cat.isEmpty()) {
//pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() ));
} else {
pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
}
} else {
@@ -893,156 +905,156 @@ void MonthViewCell::insertTodo(Todo *todo)
} else {
pal = mStandardPalette ;
}
pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
item->setPalette( pal );
item->setRecur( todo->doesRecur() );
item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
item->setMoreInfo( todo->description().length() > 0 );
insertItem( item , count());
#ifdef DESKTOP_VERSION
mToolTip.append( text );
#endif
}
void MonthViewCell::repaintfinishUpdateCell()
{
MonthViewItem *mitem = (MonthViewItem*) firstItem ();
while ( mitem ) {
mitem->setBlockRepaint( false );
updateItem ( mitem );
mitem = (MonthViewItem *)mitem->next();
}
blockSignals( false );
}
void MonthViewCell::finishUpdateCell()
{
#ifdef DESKTOP_VERSION
if (mToolTip.count() > 0 ) {
mToolTip.sort();
- QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
+ /* TODO: hacker: QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); */
}
#endif
//sort();
//setMyPalette();
setMyPalette();
resizeEvent( 0 );
}
void MonthViewCell::updateCell()
{
if ( !mMonthView->isUpdatePossible() )
return;
startUpdateCell();
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
- QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
+ Q3PtrList<Event> events = mMonthView->calendar()->events( mDate, true );
Event *event;
for( event = events.first(); event; event = events.next() ) { // for event
insertEvent(event);
}
// insert due todos
- QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
+ Q3PtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
Todo *todo;
for(todo = todos.first(); todo; todo = todos.next()) {
insertTodo( todo );
}
finishUpdateCell();
// if ( isVisible())
//qApp->processEvents();
}
void MonthViewCell::updateConfig( bool bigFont ) // = false
{
if ( bigFont ) {
QFont fo = KOPrefs::instance()->mMonthViewFont;
int ps = fo.pointSize() + 2;
if ( ps < 18 )
ps += 2;
fo.setPointSize( ps );
setFont( fo );
} else
setFont( KOPrefs::instance()->mMonthViewFont );
QFontMetrics fm( font() );
mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
mHolidayPalette = mStandardPalette;
mPrimaryPalette = mStandardPalette;
mNonPrimaryPalette = mStandardPalette;
if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
}
//updateCell();
}
void MonthViewCell::enableScrollBars( bool enabled )
{
return;
if ( enabled ) {
- QListBoxItem *fi = firstItem ();
+ Q3ListBoxItem *fi = firstItem ();
if (fi ) {
int ihei = fi->height( this );
int hei = numRows () * ihei;
if ( hei < height() - horizontalScrollBar()->height () ) {
- setVScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(Q3ScrollView::AlwaysOff);
}
else
- setVScrollBarMode(QScrollView::Auto);
+ setVScrollBarMode(Q3ScrollView::Auto);
if ( ihei *3 > height() ) {
- setHScrollBarMode(QScrollView::AlwaysOff);
+ setHScrollBarMode(Q3ScrollView::AlwaysOff);
}
else {
- setHScrollBarMode(QScrollView::Auto);
+ setHScrollBarMode(Q3ScrollView::Auto);
}
} else {
- setVScrollBarMode(QScrollView::Auto);
- setHScrollBarMode(QScrollView::Auto);
+ setVScrollBarMode(Q3ScrollView::Auto);
+ setHScrollBarMode(Q3ScrollView::Auto);
}
} else {
- setVScrollBarMode(QScrollView::AlwaysOff);
- setHScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(Q3ScrollView::AlwaysOff);
+ setHScrollBarMode(Q3ScrollView::AlwaysOff);
}
}
Incidence *MonthViewCell::selectedIncidence()
{
int index = currentItem();
if ( index < 0 ) return 0;
MonthViewItem *mitem =
static_cast<MonthViewItem *>( item( index ) );
if ( !mitem ) return 0;
return mitem->incidence();
}
QDate MonthViewCell::selectedIncidenceDate()
{
QDate qd;
int index = currentItem();
if ( index < 0 ) return qd;
return mDate;
}
void MonthViewCell::deselect()
{
clearSelection();
enableScrollBars( false );
// updateCell();
}
void MonthViewCell::select()
{
@@ -1054,307 +1066,307 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
if ( !mMonthView->isUpdatePossible() )
return;
//qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
deselect();
mLabel->setMaximumHeight( height() - lineWidth()*2 );
QString text;
//mLabel->setText( text );
bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() );
mLabel->resize( mLabelBigSize );
} else {
mLabel->resize( mLabelSize );
text = QString::number( mDate.day() );
}
mLabel->setText( text );
int size = height() - mLabel->height() - lineWidth()-1;
//qDebug("LW %d ", lineWidth());
if ( size > 0 )
verticalScrollBar()->setMaximumHeight( size );
size = width() - mLabel->width() -lineWidth()-1;
if ( size > 0 )
horizontalScrollBar()->setMaximumWidth( size );
mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
// mItemList->resize ( width(), height () );
if ( e )
KNoScrollListBox::resizeEvent ( e );
}
-void MonthViewCell::defaultAction( QListBoxItem *item )
+void MonthViewCell::defaultAction( Q3ListBoxItem *item )
{
if ( !item ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
return;
}
MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
Incidence *incidence = eventItem->incidence();
if ( incidence ) mMonthView->defaultAction( incidence );
}
void MonthViewCell::showDay()
{
emit showDaySignal( date() );
}
void MonthViewCell::newEvent()
{
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
}
-void MonthViewCell::cellClicked( QListBoxItem *item )
+void MonthViewCell::cellClicked( Q3ListBoxItem *item )
{
mMonthView->setSelectedCell( this );
if ( item == 0 ) {
QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newEventSignal( dt );
return;
}
}
-void MonthViewCell::contextMenu( QListBoxItem *item )
+void MonthViewCell::contextMenu( Q3ListBoxItem *item )
{
mMonthView->setPopupCell( this );
if ( !item ) {
mMonthView->showContextMenu( 0 );
return;
}
//selection( item );
//qApp->processEvents();
MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
Incidence *incidence = eventItem->incidence();
if ( incidence ) {
mBlockDeselect = true;
mMonthView->showContextMenu( incidence );
}
}
-void MonthViewCell::selection( QListBoxItem *item )
+void MonthViewCell::selection( Q3ListBoxItem *item )
{
if ( !item ) {
emit highlightIncidence( 0 , this, 0 );
return;
}
MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
emit highlightIncidence( it->incidence(), this, it->multiDay() );
mMonthView->setSelectedCell( this );
}
void MonthViewCell::deHighLight()
{
MonthViewItem *mitem = (MonthViewItem*) firstItem ();
while ( mitem ) {
if ( mitem->setHighlightedFalse() )
updateItem ( mitem );
mitem = (MonthViewItem *)mitem->next();
}
}
// returns true if no inc found
bool MonthViewCell::doHighLight( Incidence * inc )
{
MonthViewItem *mitem = (MonthViewItem*) firstItem ();
while ( mitem ) {
if ( mitem->incidence() == inc ) {
if ( mitem->setHighlighted( inc ) )
updateItem ( mitem );
return false;
}
mitem = (MonthViewItem *)mitem->next();
}
return true;
}
// *******************************************************************************
// *******************************************************************************
// *******************************************************************************
KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
: KOEventView( calendar, parent, name ),
mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
{
mFlagKeyPressed = false;
mShortDayLabelsM = false;
mShortDayLabelsW = false;
skipResize = false;
clPending = true;
mPopupCell = 0;
mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
- mWidStack = new QWidgetStack( this );
- QVBoxLayout* hb = new QVBoxLayout( this );
+ mWidStack = new Q3WidgetStack( this );
+ Q3VBoxLayout* hb = new Q3VBoxLayout( this );
mMonthView = new QWidget( mWidStack );
mWeekView = new QWidget( mWidStack );
#if QT_VERSION >= 0x030000
mWidStack->addWidget(mMonthView );
mWidStack->addWidget(mWeekView );
#else
mWidStack->addWidget( mMonthView, 1 );
mWidStack->addWidget( mWeekView , 1 );
#endif
hb->addWidget( mNavigatorBar );
hb->addWidget( mWidStack );
mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
updatePossible = false;
//updatePossible = true;
mCells.setAutoDelete( true );
mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
mDayLabels.resize( mDaysPerWeek );
mDayLabelsW.resize( mDaysPerWeek );
QFont bfont = font();
if ( QApplication::desktop()->width() < 650 ) {
bfont.setPointSize( bfont.pointSize() - 2 );
}
bfont.setBold( true );
int i;
for( i = 0; i < mDaysPerWeek; i++ ) {
QLabel *label = new QLabel( mMonthView );
label->setFont(bfont);
- label->setFrameStyle(QFrame::Panel|QFrame::Raised);
+ label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
label->setLineWidth(1);
- label->setAlignment(AlignCenter);
+ label->setAlignment(Qt::AlignCenter);
mDayLabels.insert( i, label );
label = new QLabel( mWeekView );
label->setFont(bfont);
- label->setFrameStyle(QFrame::Panel|QFrame::Raised);
+ label->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
label->setLineWidth(1);
- label->setAlignment(AlignCenter);
+ label->setAlignment(Qt::AlignCenter);
mDayLabelsW.insert( i, label );
}
bfont.setBold( false );
mWeekLabels.resize( mNumWeeks+1 );
mWeekLabelsW.resize( 2 );
for( i = 0; i < mNumWeeks+1; i++ ) {
KOWeekButton *label = new KOWeekButton( mMonthView );
- label->setFocusPolicy(NoFocus);
+ label->setFocusPolicy(Qt::NoFocus);
label->setFont(bfont);
connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
label->setFlat(true);
- QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
+ Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
//label->setFrameStyle(QFrame::Panel|QFrame::Raised);
//label->setLineWidth(1);
//label->setAlignment(AlignCenter);
mWeekLabels.insert( i, label );
}
mWeekLabels[mNumWeeks]->setText( i18n("W"));
- mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
- QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
+ mWeekLabels[mNumWeeks]->setFocusPolicy(Qt::WheelFocus);
+ Q3WhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
for( i = 0; i < 1+1; i++ ) {
KOWeekButton *label = new KOWeekButton( mWeekView );
- label->setFocusPolicy(NoFocus);
+ label->setFocusPolicy(Qt::NoFocus);
label->setFont(bfont);
connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
label->setFlat(true);
- QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
+ Q3WhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
//label->setFrameStyle(QFrame::Panel|QFrame::Raised);
//label->setLineWidth(1);
//label->setAlignment(AlignCenter);
mWeekLabelsW.insert( i, label );
}
mWeekLabelsW[1]->setText( i18n("W"));
- mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
+ mWeekLabelsW[1]->setFocusPolicy(Qt::WheelFocus);
int row, col;
mCells.resize( mNumCells );
for( row = 0; row < mNumWeeks; ++row ) {
for( col = 0; col < mDaysPerWeek; ++col ) {
MonthViewCell *cell = new MonthViewCell( this, mMonthView );
mCells.insert( row * mDaysPerWeek + col, cell );
connect( cell, SIGNAL( defaultAction( Incidence * ) ),
SLOT( defaultAction( Incidence * ) ) );
connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
SIGNAL( newEventSignal( QDateTime ) ) );
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
connect( cell, SIGNAL( nextCell() ),
SLOT( nextCell() ) );
connect( cell, SIGNAL( prevCell() ),
SLOT( prevCell() ) );
connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ),
SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
}
}
mCellsW.resize( mDaysPerWeek );
for( col = 0; col < mDaysPerWeek; ++col ) {
MonthViewCell *cell = new MonthViewCell( this, mWeekView );
mCellsW.insert( col, cell );
connect( cell, SIGNAL( defaultAction( Incidence * ) ),
SLOT( defaultAction( Incidence * ) ) );
connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
SIGNAL( newEventSignal( QDateTime ) ) );
connect( cell, SIGNAL( showDaySignal( QDate ) ),
SIGNAL( showDaySignal( QDate ) ) );
connect( cell, SIGNAL( nextCell() ),
SLOT( nextCell() ) );
connect( cell, SIGNAL( prevCell() ),
SLOT( prevCell() ) );
connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ),
SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
}
//connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
mContextMenu = eventPopup();
- mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mContextMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("New Event..."),this,
SLOT(slotNewEvent()),false);
- mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mContextMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("New Todo..."),this,
SLOT(slotNewTodo()),false);
- mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
+ mContextMenu->addAdditionalItem(QIcon(QPixmap()),
i18n("Journal"),this,
SLOT(slotEditJournal()),false);
connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this,
SLOT( catChanged( Incidence * ) ));
QString pathString = "";
if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
if ( QApplication::desktop()->width() < 480 )
pathString += "icons16/";
} else
pathString += "iconsmini/";
- mNewItemMenu = new QPopupMenu( this );
+ mNewItemMenu = new Q3PopupMenu( this );
mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
// updateConfig(); //useless here...
// ... but we need mWidthLongDayLabel computed
QFontMetrics fontmetric(mDayLabels[0]->font());
mWidthLongDayLabel = 0;
for (int i = 0; i < 7; i++) {
int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
}
//mWeekLabels[mNumWeeks]->setText( i18n("W"));
#if 0
if ( mShowWeekView )
mWidStack->raiseWidget( mWeekView );
else
mWidStack->raiseWidget( mMonthView );
#endif
emit incidenceSelected( 0 );
mComputeLayoutTimer = new QTimer( this );
connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
#ifndef DESKTOP_VERSION
resize( QApplication::desktop()->size() );
#else
resize(640, 480 );
@@ -1368,65 +1380,65 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mWidStack->raiseWidget( mMonthView );
}
KOMonthView::~KOMonthView()
{
delete mContextMenu;
}
void KOMonthView::catChanged( Incidence * )
{
updateView();
}
void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday )
{
static Incidence * lastInc = 0;
static MonthViewCell * lastCell = 0;
if ( lastInc == inc && lastCell == mc )
return;
lastInc = inc;
lastCell = mc;
//qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
bool weekview = false;
uint index = 0;
for (uint i = 0; i < mCellsW.count(); ++i) {
if ( mCellsW[i] == mc ) {
weekview = true;
index = i;
break;
}
}
- QPtrVector<MonthViewCell> *cells;
+ Q3PtrVector<MonthViewCell> *cells;
if ( weekview )
cells = &mCellsW;
else {
for (uint i = 0; i < mCells.count(); ++i) {
if ( mCells[i] == mc ) {
index = i;
break;
}
}
cells = &mCells;
}
for (uint i = 0; i < (*cells).count(); ++i) {
(*cells)[i]->deHighLight();
}
if ( ! inc )
return;
uint count = (*cells).count();
bool goLeft = (mday > 1 && index > 0);
bool goRight = (mday < 3 && mday > 0 && index < count -1);
for (uint iii = 1; iii < count; ++iii) {
if ( goLeft ) {
int left = index - iii;
if ( left >= 0 ) {
if ( (*cells)[(uint)left]->doHighLight(inc) )
goLeft = false;
} else
goLeft = false;
}
if ( goRight ) {
uint right = index + iii;
if ( right < count ) {
@@ -1466,339 +1478,339 @@ int KOMonthView::currentWeek()
{
if ( mShowWeekView )
return mWeekLabelsW[0]->getWeekNum();
return mWeekLabels[0]->getWeekNum();
}
void KOMonthView::switchView()
{
if ( selectedCell( ) )
selectedCell()->deselect();
mShowWeekView = !mShowWeekView;
KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
if ( clPending ) {
computeLayout();
updateConfig();
}
if ( mShowWeekView )
mWidStack->raiseWidget( mWeekView );
else
mWidStack->raiseWidget( mMonthView );
clPending = false;
}
int KOMonthView::maxDatesHint()
{
return mNumCells;
}
int KOMonthView::currentDateCount()
{
return mNumCells;
}
-QPtrList<Incidence> KOMonthView::selectedIncidences()
+Q3PtrList<Incidence> KOMonthView::selectedIncidences()
{
- QPtrList<Incidence> selected;
+ Q3PtrList<Incidence> selected;
if ( mSelectedCell ) {
Incidence *incidence = mSelectedCell->selectedIncidence();
if ( incidence ) selected.append( incidence );
}
return selected;
}
DateList KOMonthView::selectedDates()
{
DateList selected;
if ( mSelectedCell ) {
QDate qd = mSelectedCell->selectedIncidenceDate();
if ( qd.isValid() ) selected.append( qd );
}
return selected;
}
#if 0
void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Month, fd, td);
#endif
}
#endif
void KOMonthView::updateConfig()
{
int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
mWeekStartsMonday = true;
}
QFontMetrics fontmetric(mDayLabels[0]->font());
mWidthLongDayLabel = 0;
for (int i = 0; i < 7; i++) {
int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
}
bool temp = mShowSatSunComp ;
mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
if ( ! mShowWeekView ) {
if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
computeLayout();
} else
doComputeLayoutWeek();
updateDayLabels();
//qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
//int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
//resizeEvent( 0 );
for (uint i = 0; i < mCells.count(); ++i) {
mCells[i]->updateConfig();
}
for (uint i = 0; i < mCellsW.count(); ++i) {
mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
}
#ifdef DESKTOP_VERSION
- MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
+ /* TODO:hacker: MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); */
#endif
updateView();
}
void KOMonthView::updateDayLabels()
{
- QPtrVector<QLabel> *mDayLabelsT;
+ Q3PtrVector<QLabel> *mDayLabelsT;
mDayLabelsT = &mDayLabelsW;
for (int i = 0; i < 7; i++) {
{
bool show = mShortDayLabelsW;
if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
show = true;
(*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
}
}
mDayLabelsT = &mDayLabels;
for (int i = 0; i < 7; i++) {
if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
bool show = mShortDayLabelsM;
if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
show = true;
(*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
} else {
if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
}
}
}
void KOMonthView::clearList()
{
unsigned int i;
for( i = 0; i < mCells.size(); ++i ) {
mCells[i]->clear();
}
for( i = 0; i < mCellsW.size(); ++i ) {
mCellsW[i]->clear();
}
}
void KOMonthView::showDates(const QDate &start, const QDate &)
{
// kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
- QPtrVector<MonthViewCell> *cells;
- QPtrVector<QLabel> *dayLabels;
- QPtrVector<KOWeekButton> *weekLabels;
+ Q3PtrVector<MonthViewCell> *cells;
+ Q3PtrVector<QLabel> *dayLabels;
+ Q3PtrVector<KOWeekButton> *weekLabels;
uint weekNum = 6;
mStartDate = start;
if ( mShowWeekView ) {
weekNum = 1;
cells = &mCellsW;
dayLabels = &mDayLabelsW;
weekLabels = &mWeekLabelsW;
if ( !KGlobal::locale()->weekStartsMonday() ) {
mStartDate = mStartDate.addDays( 1 );
}
} else {
cells = &mCells;
dayLabels = &mDayLabels;
weekLabels = &mWeekLabels;
}
int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
mWeekStartsMonday = true;
}
int startWeekDay = mWeekStartsMonday ? 1 : 7;
while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
mStartDate = mStartDate.addDays( -1 );
}
uint i;
for( i = 0; i < (*cells).size(); ++i ) {
QDate date = mStartDate.addDays( i );
(*cells)[i]->setDate( date );
#ifndef KORG_NOPLUGINS
// add holiday, if present
QString hstring(KOCore::self()->holiday(date));
(*cells)[i]->setHoliday( hstring );
#endif
}
QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
for( i = 0; i < weekNum; ++i ) {
int wno;
// remember, according to ISO 8601, the first week of the year is the
// first week that contains a thursday. Thus we must subtract off 4,
// not just 1.
int dayOfYear = date.dayOfYear();
if (dayOfYear % 7 != 0)
wno = dayOfYear / 7 + 1;
else
wno =dayOfYear / 7;
(*weekLabels)[i]->setWeekNum( wno );
date = date.addDays( 7 );
}
updateView();
}
-void KOMonthView::showEvents(QPtrList<Event>)
+void KOMonthView::showEvents(Q3PtrList<Event>)
{
qDebug("KOMonthView::selectEvents is not implemented yet. ");
}
void KOMonthView::changeEventDisplay(Event *, int)
{
// this should be re-written to be much more efficient, but this
// quick-and-dirty-hack gets the job done for right now.
//qDebug("KOMonthView::changeEventDisplay ");
updateView();
}
void KOMonthView::updateView()
{
if ( !updatePossible )
return;
//qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
//QTime ti;
//ti.start();
clearSelection();
- QPtrVector<MonthViewCell> *cells;
+ Q3PtrVector<MonthViewCell> *cells;
if ( mShowWeekView ) {
cells = &mCellsW;
} else {
cells = &mCells;
}
#if 1
int i;
int timeSpan = (*cells).size()-1;
if ( KOPrefs::instance()->mMonthViewWeek )
timeSpan = 6;
for( i = 0; i < timeSpan + 1; ++i ) {
(*cells)[i]->startUpdateCell();
}
- QPtrList<Event> events = calendar()->events();
+ Q3PtrList<Event> events = calendar()->events();
Event *event;
QDateTime dt;
QDate endDate = mStartDate.addDays( timeSpan );
for( event = events.first(); event; event = events.next() ) { // for event
if ( event->doesRecur() ) {
bool last;
QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
QDateTime incidenceEnd;
int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
bool invalid = false;
while( true ) {
if ( incidenceStart.isValid() ) {
incidenceEnd = incidenceStart.addDays( eventlen );
int st = incidenceStart.date().daysTo( endDate );
if ( st >= 0 ) { // start before timeend
int end = mStartDate.daysTo( incidenceEnd.date() );
if ( end >= 0 ) { // end after timestart --- got one!
//normalize
st = timeSpan - st;
if ( st < 0 ) st = 0;
if ( end > timeSpan ) end = timeSpan;
int iii;
//qDebug("found %s %d %d ",event->summary().latin1(), st, end );
for ( iii = st;iii<= end;++iii)
(*cells)[iii]->insertEvent( event );
}
}
} else {
if ( invalid )
break;
invalid = true;
//qDebug("invalid %s", event->summary().latin1());
incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
}
if ( last )
break;
bool ok;
incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
if ( ! ok )
break;
if ( incidenceStart.date() > endDate )
break;
}
} else { // no recur
if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
if ( event->uid().left(15) == QString("last-syncEvent-") )
continue;
int st = event->dtStart().date().daysTo( endDate );
if ( st >= 0 ) { // start before timeend
int end = mStartDate.daysTo( event->dtEnd().date() );
if ( end >= 0 ) { // end after timestart --- got one!
//normalize
st = timeSpan - st;
if ( st < 0 ) st = 0;
if ( end > timeSpan ) end = timeSpan;
int iii;
for ( iii = st;iii<= end;++iii)
(*cells)[iii]->insertEvent( event );
}
}
}
}
// insert due todos
- QPtrList<Todo> todos = calendar()->todos( );
+ Q3PtrList<Todo> todos = calendar()->todos( );
Todo *todo;
for(todo = todos.first(); todo; todo = todos.next()) {
//insertTodo( todo );
if ( todo->hasDueDate() ) {
int day = mStartDate.daysTo( todo->dtDue().date() );
if ( day >= 0 && day < timeSpan + 1) {
(*cells)[day]->insertTodo( todo );
}
}
}
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->finishUpdateCell();
}
processSelectionChange();
//qApp->processEvents();
for( i = 0; i < timeSpan+1; ++i ) {
//(*cells)[i]->repaintfinishUpdateCell();
QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) );
}
setKeyBFocus();
#else
// old code
//qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
int i;
for( i = 0; i < (*cells).count(); ++i ) {
(*cells)[i]->updateCell();
}
//qDebug("KOMonthView::updateView() ");
processSelectionChange();
// qDebug("---------------------------------------------------------------------+ ");
@@ -2196,131 +2208,131 @@ void KOMonthView::showContextMenu( Incidence *incidence )
/*
if( incidence && incidence->typeID() == eventID ) {
Event *event = static_cast<Event *>(incidence);
mContextMenu->showEventPopup(event);
} else {
kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
}
*/
}
MonthViewCell * KOMonthView::selectedCell( )
{
return mSelectedCell;
}
void KOMonthView::setSelectedCell( MonthViewCell *cell )
{
//qDebug("KOMonthView::setSelectedCell %d", cell);
if ( mSelectedCell && mSelectedCell != cell ) {
MonthViewCell * mvc = mSelectedCell;
mSelectedCell = cell;
mvc->deselect();
} else
mSelectedCell = cell;
// if ( mSelectedCell )
// mSelectedCell->select();
if ( !mSelectedCell )
emit incidenceSelected( 0 );
else
emit incidenceSelected( mSelectedCell->selectedIncidence() );
}
void KOMonthView::processSelectionChange()
{
- QPtrList<Incidence> incidences = selectedIncidences();
+ Q3PtrList<Incidence> incidences = selectedIncidences();
if (incidences.count() > 0) {
emit incidenceSelected( incidences.first() );
} else {
emit incidenceSelected( 0 );
clearSelection();
}
}
void KOMonthView::clearSelection()
{
if ( mSelectedCell ) {
mSelectedCell->deselect();
mSelectedCell = 0;
}
}
void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
}
}
void KOMonthView::keyPressEvent ( QKeyEvent * e )
{
qApp->processEvents();
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
//e->ignore();
e->accept();
return;
}
if (! e->isAutoRepeat() )
mFlagKeyPressed = true;
switch(e->key()) {
- case Key_Up:
+ case Qt::Key_Up:
{
if ( mShowWeekView ) {
emit selectWeekNum ( currentWeek() - 1 );
}
else {
emit prevMonth();
}
}
e->accept();
break;
- case Key_Down:
+ case Qt::Key_Down:
{
if ( mShowWeekView ) {
emit selectWeekNum ( currentWeek() +1);
}
else {
emit nextMonth();
}
}
e->accept();
break;
- case Key_Return:
- case Key_Enter:
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
{
selectInternalWeekNum ( currentWeek() );
}
e->accept();
break;
- case Key_D:
+ case Qt::Key_D:
if ( mSelectedCell ) {
mSelectedCell->showDay();
e->accept();
} else {
e->ignore();
}
break;
default:
e->ignore();
break;
}
}
void KOMonthView::nextCell()
{
focusNextPrevChild ( true );
}
void KOMonthView::prevCell()
{
focusNextPrevChild ( false );
}
void KOMonthView::slotNewTodo()
{
//qDebug("KOMonthView::slotNewTodo() ");
if ( mPopupCell ){
QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
emit newTodoSignal(dt,true);
}
mPopupCell = 0;
}
void KOMonthView::slotNewEvent()
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 1a9d16d..bca76e5 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,162 +1,169 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _KOMONTHVIEW_H
#define _KOMONTHVIEW_H
#include <qlabel.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qdatetime.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qpoint.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
#include <qlayout.h>
#include <qtimer.h>
-#include <qintdict.h>
+#include <q3intdict.h>
#include <qpushbutton.h>
-#include <qvaluelist.h>
-#include <qptrvector.h>
+#include <q3valuelist.h>
+#include <q3ptrvector.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <Q3PtrList>
+#include <Q3PopupMenu>
+#include <QKeyEvent>
#include <libkcal/calendar.h>
#include <libkcal/event.h>
#include "koeventview.h"
#include "navigatorbar.h"
#ifdef DESKTOP_VERSION
class QToolTipGroup;
#endif
class KNOWhatsThis;
class MonthViewCell;
class KOWeekButton : public QPushButton
{
Q_OBJECT
public:
KOWeekButton( QWidget *parent=0, const char *name=0 ) :
QPushButton( parent, name)
{
connect( this, SIGNAL( clicked() ),
SLOT( bottonClicked() ));
mNumber = -1;
}
void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
int getWeekNum() { return mNumber;}
signals:
void selectWeekNum ( int );
private:
void focusInEvent ( QFocusEvent * ){;}
int mNumber;
void keyPressEvent ( QKeyEvent * e )
{
e->ignore();
}
private slots :
void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
};
-class KNoScrollListBox: public QListBox
+class KNoScrollListBox: public Q3ListBox
{
Q_OBJECT
public:
KNoScrollListBox(QWidget *parent=0, const char *name=0);
~KNoScrollListBox();
QString getWhatsThisText(QPoint p) ;
signals:
void shiftDown();
void shiftUp();
void rightClick();
void nextCell();
void prevCell();
void highlightIncidence( Incidence * , MonthViewCell*, int );
protected:
bool mBlockDeselect;
protected slots:
void oneDown();
void keyPressEvent(QKeyEvent *);
void keyReleaseEvent(QKeyEvent *);
void mousePressEvent(QMouseEvent *);
void focusInEvent ( QFocusEvent * );
void focusOutEvent ( QFocusEvent * );
private:
bool resetOnFocusIn;
KNOWhatsThis * mWT;
};
-class MonthViewItem: public QListBoxItem
+class MonthViewItem: public Q3ListBoxItem
{
public:
MonthViewItem( Incidence *,const QString & title );
void recycle( Incidence *incidence, const QString & s);
void setRecur(bool on) { mRecur = on; }
void setAlarm(bool on) { mAlarm = on; }
void setReply(bool on) { mReply = on; }
void setMoreInfo(bool on) { mInfo = on; }
void setMultiDay(int type) { mMultiday = type; }
int multiDay() { return mMultiday; }
void setMultiDayPos(int type) { mdayPos = type; }
int gettMultiDayPos() { return mdayPos; }
void setBlockRepaint(bool on) { mblockRepaint = on; }
bool setHighlighted( Incidence * );
void setPalette(const QPalette &p) { mPalette = p; }
QPalette palette() const { return mPalette; }
bool setHighlightedFalse();
Incidence *incidence() const { return mIncidence; }
protected:
virtual void paint(QPainter *);
- virtual int height(const QListBox *) const;
- virtual int width(const QListBox *) const;
+ virtual int height(const Q3ListBox *) const;
+ virtual int width(const Q3ListBox *) const;
private:
int mdayPos;
bool isWeekItem;
bool mblockRepaint;
int mMultiday;
bool mRecur;
bool mAlarm;
bool mReply;
bool mInfo;
bool mDisplayHighlighted;
QPalette mPalette;
QDate mDate;
Incidence *mIncidence;
};
class KOMonthView;
class MonthViewCell : public KNoScrollListBox
{
Q_OBJECT
public:
MonthViewCell(KOMonthView *,QWidget* );
~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
void setDate( const QDate & );
QDate date() const;
void setPrimary( bool );
@@ -169,183 +176,183 @@ class MonthViewCell : public KNoScrollListBox
void startUpdateCell();
void finishUpdateCell();
int insertEvent(Event *);
void insertTodo(Todo *);
void updateConfig( bool bigFont = false );
void enableScrollBars( bool );
Incidence *selectedIncidence();
QDate selectedIncidenceDate();
QPushButton * dateLabel() { return mLabel; }
bool doHighLight( Incidence *);
void deselect();
void select();
#ifdef DESKTOP_VERSION
static QToolTipGroup *toolTipGroup();
#endif
signals:
void defaultAction( Incidence * );
void newEventSignal( QDateTime );
void showDaySignal( QDate );
protected:
QStringList mToolTip;
void resizeEvent( QResizeEvent * );
public slots:
void showDay();
void deHighLight();
void repaintfinishUpdateCell();
protected slots:
- void defaultAction( QListBoxItem * );
- void contextMenu( QListBoxItem * );
- void selection( QListBoxItem * );
- void cellClicked( QListBoxItem * );
+ void defaultAction( Q3ListBoxItem * );
+ void contextMenu( Q3ListBoxItem * );
+ void selection( Q3ListBoxItem * );
+ void cellClicked( Q3ListBoxItem * );
void newEvent();
private:
int mdayCount;
- QPtrList <MonthViewItem> mAvailItemList;
+ Q3PtrList <MonthViewItem> mAvailItemList;
KOMonthView *mMonthView;
int currentPalette;
QDate mDate;
bool mPrimary;
bool mHoliday;
QString mHolidayString;
//QLabel *mLabel;
QPushButton *mLabel;
//QListBox *mItemList;
#ifdef DESKTOP_VERSION
static QToolTipGroup *mToolTipGroup;
#endif
QSize mLabelSize;
QSize mLabelBigSize;
QPalette mHolidayPalette;
QPalette mStandardPalette;
QPalette mPrimaryPalette;
QPalette mNonPrimaryPalette;
void setMyPalette();
QPalette getPalette ();
};
class KOMonthView: public KOEventView
{
Q_OBJECT
public:
KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
~KOMonthView();
/** Returns maximum number of days supported by the komonthview */
virtual int maxDatesHint();
/** Returns number of currently shown dates. */
virtual int currentDateCount();
/** returns the currently selected events */
- virtual QPtrList<Incidence> selectedIncidences();
+ virtual Q3PtrList<Incidence> selectedIncidences();
/** returns dates of the currently selected events */
virtual DateList selectedDates();
#if 0
virtual void printPreview(CalPrinter *calPrinter,
const QDate &, const QDate &);
#endif
bool isMonthView() { return !mShowWeekView; }
bool isUpdatePossible() { return updatePossible; }
MonthViewCell * selectedCell();
bool skipResize;
NavigatorBar* navigatorBar() { return mNavigatorBar ;}
void clearList();
public slots:
void incidenceHighlighted( Incidence *, MonthViewCell*, int );
void nextCell();
void prevCell();
virtual void updateView();
virtual void updateConfig();
virtual void showDates(const QDate &start, const QDate &end);
- virtual void showEvents(QPtrList<Event> eventList);
+ virtual void showEvents(Q3PtrList<Event> eventList);
void changeEventDisplay(Event *, int);
void clearSelection();
void showContextMenu( Incidence * );
void setSelectedCell( MonthViewCell * );
void setPopupCell( MonthViewCell * );
void switchView();
void setKeyBFocus();
protected slots:
void catChanged( Incidence * );
void setKeyBoardFocus();
void slotNewTodo();
void slotNewEvent();
void slotEditJournal();
void slotComputeLayout();
void selectInternalWeekNum ( int );
void processSelectionChange();
signals:
void nextMonth();
void prevMonth();
void selectWeekNum ( int );
void selectMonth ();
void showDaySignal( QDate );
void newTodoSignal( QDateTime, bool );
void showJournalSignal( int,QDate );
protected:
void resizeEvent(QResizeEvent *);
void viewChanged();
void updateDayLabels();
int mapWeekLayout( int, bool );
private:
int mKBFcounter;
QTimer* mComputeLayoutTimer;
NavigatorBar* mNavigatorBar;
int currentWeek();
bool clPending;
- QWidgetStack * mWidStack;
+ Q3WidgetStack * mWidStack;
QWidget* mMonthView;
QWidget* mWeekView;
bool mShowWeekView;
bool updatePossible;
int mDaysPerWeek;
int mNumWeeks;
int mNumCells;
//bool mWeekStartsMonday;
bool mShowSatSunComp;
void computeLayout();
void computeLayoutWeek();
void doComputeLayoutWeek();
- QPtrVector<MonthViewCell> mCells;
- QPtrVector<QLabel> mDayLabels;
- QPtrVector<KOWeekButton> mWeekLabels;
- QPtrVector<MonthViewCell> mCellsW;
- QPtrVector<QLabel> mDayLabelsW;
- QPtrVector<KOWeekButton> mWeekLabelsW;
+ Q3PtrVector<MonthViewCell> mCells;
+ Q3PtrVector<QLabel> mDayLabels;
+ Q3PtrVector<KOWeekButton> mWeekLabels;
+ Q3PtrVector<MonthViewCell> mCellsW;
+ Q3PtrVector<QLabel> mDayLabelsW;
+ Q3PtrVector<KOWeekButton> mWeekLabelsW;
bool mShortDayLabelsM;
bool mShortDayLabelsW;
int mWidthLongDayLabel;
QDate mStartDate;
MonthViewCell *mSelectedCell;
MonthViewCell *mPopupCell;
bool mFlagKeyPressed;
KOEventPopupMenu *mContextMenu;
- QPopupMenu *mNewItemMenu;
+ Q3PopupMenu *mNewItemMenu;
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
};
#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 5078c57..0bd46ea 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -1,61 +1,61 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <time.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qstring.h>
#include <qregexp.h>
#include <qfont.h>
#include <qcolor.h>
#include <qstringlist.h>
#include <stdlib.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kemailsettings.h>
#include <kstaticdeleter.h>
#include <libkdepim/kpimglobalprefs.h>
#include "koprefs.h"
#include "mainwindow.h"
KOPrefs *KOPrefs::mInstance = 0;
static KStaticDeleter<KOPrefs> insd;
KOPrefs::KOPrefs() :
KPimPrefs("korganizerrc")
{
mGlobalUpdateDisabled = false;
mCategoryColors.setAutoDelete(true);
fillMailDefaults();
mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
QColor defaultHolidayColor = QColor(255,0,0);
QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
@@ -276,71 +276,71 @@ KOPrefs::KOPrefs() :
addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
addItemBool("MonthViewWeekRowlayout",&mMonthViewWeekRowlayout,false);
addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
#ifdef DESKTOP_VERSION
addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
#else
addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
#endif
addItemInt("Day Begins",&mDayBegins,7);
addItemInt("Working Hours Start",&mWorkingHoursStart,8);
addItemInt("Working Hours End",&mWorkingHoursEnd,17);
addItemBool("Exclude Holidays",&mExcludeHolidays,true);
addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
addItemBool("Full View Month",&mFullViewMonth,true);
addItemBool("Full View Todo",&mFullViewTodo,true);
addItemBool("Quick Todo",&mEnableQuickTodo,false);
addItemInt("Next X Days",&mNextXDays,3);
KPrefs::setCurrentGroup("Printer");
KPrefs::setCurrentGroup("Layout");
addItemBool("CompactDialogs",&mCompactDialogs,false);
addItemBool("VerticalScreen",&mVerticalScreen,true);
KPrefs::setCurrentGroup("KOrganizer Plugins");
- addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
+ addItemStringList("SelectedPlugins",&mSelectedPlugins,QStringList("holidays"));
KPrefs::setCurrentGroup("Group Scheduling");
addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
- addItemStringList("AdditionalMails",&mAdditionalMails,"");
+ addItemStringList("AdditionalMails",&mAdditionalMails,QStringList());
addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
KPrefs::setCurrentGroup( "Editors" );
addItemStringList( "EventTemplates", &mEventTemplates );
addItemStringList( "TodoTemplates", &mTodoTemplates );
addItemInt("DestinationPolicy",&mDestination,standardDestination);
KPrefs::setCurrentGroup( "ViewOptions" );
addItemBool("EVshowDetails",&mEVshowDetails,true);
addItemBool("EVshowCreated",&mEVshowCreated,true);
addItemBool("EVshowChanged",&mEVshowChanged,true);
addItemBool("WTshowDetails",&mWTshowDetails,false);
addItemBool("WTshowCreated",&mWTshowCreated,false);
addItemBool("WTshowChanged",&mWTshowChanged,false);
mCalendars.setAutoDelete( true );
}
KOPrefs::~KOPrefs()
{
if (mInstance == this)
mInstance = insd.setObject(0);
mCalendars.setAutoDelete( true );
mCalendars.clear();
//qDebug("KOPrefs::~KOPrefs() ");
}
@@ -537,65 +537,65 @@ int KOPrefs::getFuzzyCalendarID( const QString & name )
return kkf->mCalNumber;
kkf = mCalendars.next();
}
QString name2 = name;
name2.replace (QRegExp ("_")," " );
kkf = mCalendars.first();
while ( kkf ) {
if ( name2.lower() == kkf->mName.lower())
return kkf->mCalNumber;
kkf = mCalendars.next();
}
return 0;
}
QString KOPrefs::calName( int calNum) const
{
return (mDefCalColors[calNum-1])->mName;
}
QColor KOPrefs::defaultColor( int calNum ) const
{
if ( calNum == 1 ) return mEventColor;
return (mDefCalColors[calNum-1])->mDefaultColor;
}
void KOPrefs::usrWriteConfig()
{
config()->setGroup("General");
config()->writeEntry("Custom Categories",mCustomCategories);
config()->setGroup("Personal Settings");
config()->writeEntry("user_name",mName);
config()->writeEntry("user_email",mEmail);
config()->setGroup("Category Colors");
- QDictIterator<QColor> it(mCategoryColors);
+ Q3DictIterator<QColor> it(mCategoryColors);
while (it.current()) {
config()->writeEntry(it.currentKey(),*(it.current()));
++it;
}
KConfig fc (locateLocal("config","kopicalendarrc"));
fc.setGroup("CC");
fc.deleteGroup( "CC");
fc.setGroup("CC");
fc.writeEntry("NumberCalendars",mCalendars.count());
int numCal = 1;
int writeCal = 0;
while ( numCal < mNextAvailableCalendar ) {
KopiCalendarFile * kkf = mCalendars.first();
while ( kkf ) {
//qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
if ( kkf->mCalNumber == numCal ) {
++writeCal;
//qDebug("Write calendar %d %d ", numCal , writeCal);
QString prefix = "Cal_" + QString::number( writeCal );
fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
fc.writeEntry( prefix+"_isRelative", kkf->isRelative );
fc.writeEntry( prefix+"_Name", kkf->mName);
fc.writeEntry( prefix+"_FileName", kkf->mFileName);
fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName);
fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
}
kkf = mCalendars.next();
}
++numCal;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 94bdd33..35c6110 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -1,62 +1,65 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOPREFS_H
#define KOPREFS_H
#include <libkdepim/kpimprefs.h>
-#include <qdict.h>
+#include <q3dict.h>
#include <qdir.h>
#include <qobject.h>
+#include <QDateTime>
+//Added by qt3to4:
+#include <Q3PtrList>
class KConfig;
class QFont;
class QColor;
class QStringList;
#define VIEW_WN_VIEW 1
#define VIEW_NX_VIEW 2
#define VIEW_J_VIEW 3
#define VIEW_A_VIEW 4
#define VIEW_ML_VIEW 5
#define VIEW_M_VIEW 6
#define VIEW_L_VIEW 7
#define VIEW_T_VIEW 8
class KopiCalendarFile : public QObject
{
public:
KopiCalendarFile( ) : QObject( )
{
isStandard = false;
isEnabled = true;
isAlarmEnabled = true;
isReadOnly = false;
mErrorOnLoad = false;
isRelative = false;
mCalNumber = 0;
mDefaultColor = Qt::red;
mName = "Calendar";
mFileName = QDir::homeDirPath() + "/icalfile.ics";
mSavedFileName = "icalfile.ics";
}
@@ -318,60 +321,60 @@ class KOPrefs : public KPimPrefs
bool mHightlightDateTimeEdit;
bool mShortDateInViewer;
bool mShowDateNavigator;
QStringList mLocationDefaults;
QStringList mEventSummaryUser;
QStringList mTodoSummaryUser;
QStringList mJournalSummaryUser;
bool mUseInternalAlarmNotification;
int mAlarmPlayBeeps;
int mAlarmSuspendTime;
int mAlarmSuspendCount;
int mAlarmBeepInterval;
int mOldLanguage;
int mOldLoadedLanguage;
QString mActiveSyncPort;
QString mActiveSyncIP;
// settings for eventviewer
bool mEVshowDetails;
bool mEVshowCreated;
bool mEVshowChanged;
bool mWTshowDetails;
bool mWTshowCreated;
bool mWTshowChanged;
int mCurrentDisplayedView;
- QPtrList<KopiCalendarFile> mCalendars;
+ Q3PtrList<KopiCalendarFile> mCalendars;
int mNextAvailableCalendar;
bool mGlobalUpdateDisabled;
bool mDetectConflicts;
bool mIncludeFree;
bool mCheckConflictsAllDayAllDay;
bool mCheckConflictsAllDayNonAD;
bool mCheckConflictsNonADAllDay;
bool mCheckConflictsNonADNonAD;
QString mFilterConflictEditItem;
QString mFilterConflictAllItem;
private:
- QDict<QColor> mCategoryColors;
- QArray<KopiCalendarFile*> mDefCalColors;
+ Q3Dict<QColor> mCategoryColors;
+ QVector<KopiCalendarFile*> mDefCalColors;
QColor mDefaultCategoryColor;
QFont mDefaultTimeBarFont;
QFont mDefaultViewFont;
QFont mDefaultMonthViewFont;
QString mName;
QString mEmail;
};
#endif
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index f1a6c3d..43c488f 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,75 +1,81 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qlabel.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
+#include <q3groupbox.h>
+#include <q3buttongroup.h>
#include <qlineedit.h>
#include <qfont.h>
#include <qslider.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qcombobox.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qregexp.h>
#include <qspinbox.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
-#include <qstrlist.h>
+#include <q3strlist.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <QPixmap>
+#include <Q3Frame>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include <kemailsettings.h>
#include <kstandarddirs.h>
#include <kglobalsettings.h>
#include <kurlrequester.h>
#include <klineedit.h>
#if defined(USE_SOLARIS)
#include <sys/param.h>
#define ZONEINFODIR "/usr/share/lib/zoneinfo"
#define INITFILE "/etc/default/init"
#endif
#include "koprefs.h"
#include "koprefsdialog.h"
#include "kpimglobalprefs.h"
KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
KPrefsDialog(KOPrefs::instance(),parent,name,true)
@@ -87,262 +93,262 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
hideButtons();
#endif
setupMainTab();
// setupLocaleTab();
//setupTimeZoneTab();
setupTimeTab();
//setupLocaleDateTab();
setupFontsTab();
setupColorsTab();
setupViewsTab();
//setupSyncTab();
//setupSyncAlgTab();
//setupPrinterTab();
//setupGroupSchedulingTab();
//setupGroupAutomationTab();
}
KOPrefsDialog::~KOPrefsDialog()
{
}
void KOPrefsDialog::setupGlobalTab()
{
}
void KOPrefsDialog::setupLocaleDateTab()
{
#if 0
-QFrame *topFrame = addPage(i18n("Date Format"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
+Q3Frame *topFrame = addPage(i18n("Date Format"),0,0);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,3,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
KPrefsDialogWidRadios *syncPrefsGroup =
addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
QString format;
if ( QApplication::desktop()->width() < 480 )
format = "(%d.%m.%Y)";
else
format = "(%d.%m.%Y|%A %d %B %Y)";
syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%m.%d.%Y)";
else
format = "(%m.%d.%Y|%A %B %d %Y)";
syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%Y-%m-%d)";
else
format = "(%Y-%m-%d|%A %Y %B %d)";
syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
syncPrefsGroup->addRadio(i18n("User defined"));
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
++iii;
QLabel * lab;
mUserDateFormatLong = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatLong,iii,1);
++iii;
mUserDateFormatShort = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatShort,iii,1);
++iii;
lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
#endif
}
void KOPrefsDialog::setupLocaleTab()
{
#if 0
- QFrame *topFrame = addPage(i18n("Locale"),0,0);
- QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+ Q3Frame *topFrame = addPage(i18n("Locale"),0,0);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
KPrefsDialogWidRadios *syncPrefsGroup =
addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
syncPrefsGroup->addRadio(i18n("English"));
syncPrefsGroup->addRadio(i18n("German"));
syncPrefsGroup->addRadio(i18n("French"));
syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
if ( QApplication::desktop()->width() < 300 )
;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
syncPrefsGroup =
addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
if ( QApplication::desktop()->width() > 300 )
syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
syncPrefsGroup->addRadio(i18n("24:00"));
syncPrefsGroup->addRadio(i18n("12:00am"));
syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
KPrefsDialogWidBool *sb;
if ( QApplication::desktop()->width() < 300 ) {
sb =
addWidBool(i18n("Week starts on Sunday"),
&(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
++iii;
sb =
addWidBool(i18n("Use short date in (WN/E) view"),
&(KOPrefs::instance()->mShortDateInViewer),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
}
else {
QWidget * hb = new QWidget( topFrame );
- QHBoxLayout *hbLayout = new QHBoxLayout(hb);
+ Q3HBoxLayout *hbLayout = new Q3HBoxLayout(hb);
sb =
addWidBool(i18n("Week starts on Sunday"),
&(KOPrefs::instance()->mWeekStartsOnSunday),hb);
hbLayout->addWidget(sb->checkBox() );
sb =
addWidBool(i18n("Use short date in (WN/E) view"),
&(KOPrefs::instance()->mShortDateInViewer),hb);
hbLayout->addWidget(sb->checkBox() );
topLayout->addMultiCellWidget(hb, iii,iii,0,1);
}
// KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
#if 0
++iii;
sb =
addWidBool(i18n("Quick load/save (w/o Unicode)"),
&(KOPrefs::instance()->mUseQuicksave),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
#endif
#endif
}
void KOPrefsDialog::setupMainTab()
{
- QFrame *topFrame = addPage(i18n("General"),0,0);
+ Q3Frame *topFrame = addPage(i18n("General"),0,0);
// DesktopIcon("identity",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
// KPrefsDialogWidBool *emailControlCenter =
// addWidBool(i18n("&Use email settings from Control Center"),
// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
// connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
// SLOT(toggleEmailSettings(bool)));
mNameEdit = new QLineEdit(topFrame);
mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
topLayout->addWidget(mNameLabel,0,0);
topLayout->addWidget(mNameEdit,0,1);
mEmailEdit = new QLineEdit(topFrame);
mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
topLayout->addWidget(mEmailLabel,1,0);
topLayout->addWidget(mEmailEdit,1,1);
KPrefsDialogWidBool *wb;
KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"),
&(KOPrefs::instance()->mShowFullMenu),topFrame);
topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1);
widbool = addWidBool(i18n("Mini icons in toolbar(nr)"),
&(KOPrefs::instance()->mToolBarMiniIcons),topFrame);
topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1);
KPrefsDialogWidBool *verticalScreen =
addWidBool(i18n("Vertical screen layout(Needs restart)"),
&(KOPrefs::instance()->mVerticalScreen),topFrame);
//topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1);
int iii = 5;
widbool = addWidBool(i18n("Block popup until mouse button release"),
&(KOPrefs::instance()->mBlockPopupMenu),topFrame);
topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1);
++iii;
if ( QApplication::desktop()->height() <= 240 ) {
topFrame = addPage(i18n("General") +" 2",0,0);
- topLayout = new QGridLayout(topFrame,4,2);
+ topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(2);
topLayout->setMargin(3);
iii = 0;
}
- QHBox *dummy = new QHBox(topFrame);
+ Q3HBox *dummy = new Q3HBox(topFrame);
new QLabel(i18n("Days in Next-X-Days:"),dummy);
mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
topLayout->addMultiCellWidget(dummy,iii,iii,0,1);
++iii;
// KPrefsDialogWidBool *bcc =
// addWidBool(i18n("Send copy to owner when mailing events"),
// &(KOPrefs::instance()->mBcc),topFrame);
// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
// QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
//topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
// addWidBool(i18n("Enable automatic saving of calendar"),
// &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
- QHBox *intervalBox = new QHBox(topFrame);
+ Q3HBox *intervalBox = new Q3HBox(topFrame);
// intervalBox->setSpacing(mSpacingHint);
topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1);
++iii;
QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
/*
QHBox * agendasize = new QHBox ( topFrame );
new QLabel (i18n("AllDayAgenda Height:"), agendasize );
mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
topLayout->addMultiCellWidget(agendasize,7,7,0,1);
*/
KPrefsDialogWidBool *ask =
addWidBool(i18n("Ask for quit when closing KO/Pi"),
&(KOPrefs::instance()->mAskForQuit),topFrame);
topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1);
++iii;
/*
KPrefsDialogWidBool *confirmCheck =
addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
topFrame);
topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
mEnableGroupScheduling =
@@ -373,721 +379,721 @@ void KOPrefsDialog::setupMainTab()
topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
// Default format unconditionally is iCalendar
defaultFormatGroup->groupBox()->hide();
KPrefsDialogWidRadios *mailClientGroup =
addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
topFrame);
mailClientGroup->addRadio(i18n("KMail"));
mailClientGroup->addRadio(i18n("Sendmail"));
topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
KPrefsDialogWidBool *htmlsave =
addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
topFrame);
topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
KPrefsDialogWidRadios *destinationGroup =
addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
topFrame);
destinationGroup->addRadio(i18n("be added to the standard resource"));
destinationGroup->addRadio(i18n("be asked which resource to use"));
topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
topLayout->setRowStretch(14,1);
*/
}
void KOPrefsDialog::setupTimeTab()
{
- QFrame *topFrame = addPage(i18n("Time"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Time"),0,0);
// DesktopIcon("clock",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
- QHBox *dummy = new QHBox(topFrame);
+ Q3HBox *dummy = new Q3HBox(topFrame);
KPrefsDialogWidTime *dayBegins =
addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
dummy);
//topLayout->addWidget(dayBegins->label(),2,0);
//topLayout->addWidget(dayBegins->spinBox(),2,1);
topLayout->addMultiCellWidget(dummy,0,0,0,1);
topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
topFrame),1,0);
mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
mStartTimeSpin->setSuffix(":00");
topLayout->addWidget(mStartTimeSpin,1,1);
topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
topFrame),2,0);
mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
mDefaultDurationSpin->setSuffix(":00");
topLayout->addWidget(mDefaultDurationSpin,2,1);
QStringList alarmList;
alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
<< i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
3,0);
mAlarmTimeCombo = new QComboBox(topFrame);
mAlarmTimeCombo->insertStringList(alarmList);
topLayout->addWidget(mAlarmTimeCombo,3,1);
int iii = 4;
if ( QApplication::desktop()->height() <= 240 ) {
topFrame = addPage(i18n("Time") +" 2",0,0);
- topLayout = new QGridLayout(topFrame,1,2);
+ topLayout = new Q3GridLayout(topFrame,1,2);
topLayout->setSpacing(2);
topLayout->setMargin(3);
iii = 0;
}
- QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
+ Q3GroupBox *workingHoursGroup = new Q3GroupBox(1,Qt::Horizontal,
i18n("Working Hours"),
topFrame);
topLayout->addMultiCellWidget(workingHoursGroup,iii,iii,0,1);
workingHoursGroup->layout()->setSpacing( 0 );
workingHoursGroup->layout()->setMargin( 4 );
- QHBox *workStartBox = new QHBox(workingHoursGroup);
+ Q3HBox *workStartBox = new Q3HBox(workingHoursGroup);
// workStartBox->setMargin( 0 );
addWidTime(i18n("Daily starting hour:"),
&(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
- QHBox *workEndBox = new QHBox(workingHoursGroup);
+ Q3HBox *workEndBox = new Q3HBox(workingHoursGroup);
//workEndBox->setMargin( 0 );
addWidTime(i18n("Daily ending hour:"),
&(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
- QVBox *excludeBox = new QVBox(workingHoursGroup);
+ Q3VBox *excludeBox = new Q3VBox(workingHoursGroup);
//excludeBox->setMargin( 0 );
addWidBool(i18n("Exclude holidays"),
&(KOPrefs::instance()->mExcludeHolidays),excludeBox);
addWidBool(i18n("Exclude Saturdays"),
&(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
// &(KOPrefs::instance()->mMarcusBainsShowSeconds),
// topFrame);
// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
// topLayout->setRowStretch(6,1);
}
void KOPrefsDialog::setupViewsTab()
{
- QFrame *topFrame = addPage(i18n("Views"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Views"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
// topLayout->addLayout(dayBeginsLayout,0,0);
// KPrefsDialogWidTime *dayBegins =
// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
// topFrame);
// dayBeginsLayout->addWidget(dayBegins->label());
// dayBeginsLayout->addStretch(1);
// dayBeginsLayout->addWidget(dayBegins->spinBox());
// QBoxLayout *nextDaysLayout = new QHBoxLayout;
// topLayout->addLayout(nextDaysLayout,1,0);
// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
// nextDaysLayout->addStretch(1);
// nextDaysLayout->addWidget(mNextXDaysSpin);
int ii = 0;
KPrefsDialogWidBool *dummy =
addWidBool(i18n("Edit item on doubleclick (if not, show)"),
&(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
// topLayout->addWidget(hourSizeGroup,ii++,0);
// topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
//topLayout->setRowStretch(11,1);
#if 0
topFrame = addPage(i18n("ViewChange"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,6,1);
+ topLayout = new Q3GridLayout(topFrame,6,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
#endif
dummy =
addWidBool(i18n("Hold fullscreen on view change"),
&(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Hold non-fullscreen on view change"),
&(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
KPrefsDialogWidBool *fullViewMonth =
addWidBool(i18n("Next days view uses full window"),
&(KOPrefs::instance()->mFullViewMonth),topFrame);
topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
KPrefsDialogWidBool *fullViewTodo =
addWidBool(i18n("Event list view uses full window"),
&(KOPrefs::instance()->mFullViewTodo),topFrame);
topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Listview uses monthly timespan"),
&(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Highlight selection in Time Edit"),
&(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
topLayout->addWidget( dummy->checkBox(), ii++,0);
KPrefsDialogWidBool *dailyRecur =
addWidBool(i18n("Show events that recur daily in date nav."),
&(KOPrefs::instance()->mDailyRecur),topFrame);
topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
KPrefsDialogWidBool *weeklyRecur =
addWidBool(i18n("Show ev. that recur weekly in date nav."),
&(KOPrefs::instance()->mWeeklyRecur),topFrame);
topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
weeklyRecur =
addWidBool(i18n("Show multiday allday ev. in date nav."),
&(KOPrefs::instance()->mLongAllday),topFrame);
topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
#ifdef DESKTOP_VERSION
KPrefsDialogWidBool *enableToolTips =
addWidBool(i18n("Enable tooltips displaying summary of ev."),
&(KOPrefs::instance()->mEnableToolTips),topFrame);
topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
#endif
// *********************************************************
topFrame = addPage(i18n("Agenda View"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,5,1);
+ topLayout = new Q3GridLayout(topFrame,5,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
dummy =
addWidBool(i18n("Show time in agenda items"),
&(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Highlight current day in agenda"),
&(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Use light color for highlight current day"),
&(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
KPrefsDialogWidBool *marcusBainsEnabled =
addWidBool(i18n("Show current time"),
&(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Set agenda to DayBeginsAt on change"),
&(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Set agenda to current time on change"),
&(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Allday Agenda view shows todos"),
&(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Agenda view shows completed todos"),
&(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
topFrame = addPage(i18n("Month View"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,5,1);
+ topLayout = new Q3GridLayout(topFrame,5,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
QLabel *lab;
- QHBox *habo = new QHBox( topFrame );
+ Q3HBox *habo = new Q3HBox( topFrame );
if ( QApplication::desktop()->width() <= 480 ) {
lab = new QLabel ( i18n("Show events that recur "), topFrame );
topLayout->addMultiCellWidget(lab,ii, ii,0,1);
ii++;
} else {
new QLabel ( i18n("Show events that recur "), habo );
}
dailyRecur =
addWidBool(i18n("daily"),
&(KOPrefs::instance()->mMonthDailyRecur),habo);
// topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
weeklyRecur =
addWidBool(i18n("weekly"),
&(KOPrefs::instance()->mMonthWeeklyRecur),habo);
topLayout->addMultiCellWidget(habo,ii, ii,0,1);
ii++;
- habo = new QHBox( topFrame );
+ habo = new Q3HBox( topFrame );
if ( QApplication::desktop()->width() <= 480 ) {
lab = new QLabel (i18n("Show in every cell ") , topFrame );
topLayout->addMultiCellWidget(lab,ii, ii,0,1);
ii++;
} else {
new QLabel ( i18n("Show in every cell "), habo );
}
weeklyRecur =
addWidBool(i18n("short month"),
&(KOPrefs::instance()->mMonthShowShort),habo);
weeklyRecur =
addWidBool(i18n("icons"),
&(KOPrefs::instance()->mMonthShowIcons),habo);
weeklyRecur =
addWidBool(i18n("times"),
&(KOPrefs::instance()->mMonthShowTimes),habo);
topLayout->addMultiCellWidget(habo,ii, ii,0,1);
ii++;
#ifdef DESKTOP_VERSION
KPrefsDialogWidBool *enableMonthScroll =
addWidBool(i18n("Enable scrollbars in month view cells"),
&(KOPrefs::instance()->mEnableMonthScroll),topFrame);
topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
#endif
dummy =
addWidBool(i18n("Week view mode uses bigger font"),
&(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Week view mode uses row layout"),
&(KOPrefs::instance()->mMonthViewWeekRowlayout),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Show Sat/Sun together"),
&(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
KPrefsDialogWidBool *coloredCategoriesInMonthView =
addWidBool(i18n("Month view uses category colors"),
&(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Category colors are applied to text"),
&(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
if ( QApplication::desktop()->height() <= 240 ) {
topFrame = addPage(i18n("Month View") +" 2",0,0);
- topLayout = new QGridLayout(topFrame,4,1);
+ topLayout = new Q3GridLayout(topFrame,4,1);
topLayout->setSpacing(2);
topLayout->setMargin(1);
ii = 0;
}
coloredCategoriesInMonthView =
addWidBool(i18n("Month view uses day colors"),
&(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
KPrefsDialogWidColor *holidayColor =
addWidColor(i18n("Day color odd months"),
&(KOPrefs::instance()->mMonthViewOddColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
holidayColor =
addWidColor(i18n("Day color even months"),
&(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
holidayColor =
addWidColor(i18n("Color for Sundays + category \"Holiday\""),
&(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
// *********************** What'sNext View
topFrame = addPage(i18n("What's Next View"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,4,1);
+ topLayout = new Q3GridLayout(topFrame,4,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
- QHBox* hdummy = new QHBox(topFrame);
+ Q3HBox* hdummy = new Q3HBox(topFrame);
new QLabel(i18n("Days in What's Next:"),hdummy);
mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
topLayout->addWidget(hdummy,ii++,0);
- QHBox *prioBox = new QHBox(topFrame);
+ Q3HBox *prioBox = new Q3HBox(topFrame);
// intervalBox->setSpacing(mSpacingHint);
topLayout->addWidget(prioBox,ii++,0);
QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
mPrioSpin = new QSpinBox(0,5,1,prioBox);
if ( QApplication::desktop()->width() < 300 )
mPrioSpin->setFixedWidth( 40 );
KPrefsDialogWidBool *passwdk =
addWidBool(i18n("Show times on two lines"),
&(KOPrefs::instance()->mWhatsNextTime2Lines),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
passwdk =
addWidBool(i18n("Show events that are done"),
&(KOPrefs::instance()->mWNViewShowsPast),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
passwdk =
addWidBool(i18n("Show parent To-Do's"),
&(KOPrefs::instance()->mWNViewShowsParents),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
passwdk =
addWidBool(i18n("Show location"),
&(KOPrefs::instance()->mWNViewShowLocation),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
passwdk =
addWidBool(i18n("Use short date in WN+Event view"),
&(KOPrefs::instance()->mShortDateInViewer),topFrame);
topLayout->addWidget(passwdk->checkBox(), ii++,0);
// *********************** Todo View
topFrame = addPage(i18n("Todo View"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,4,1);
+ topLayout = new Q3GridLayout(topFrame,4,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
dummy =
addWidBool(i18n("Hide not running Todos in To-do view"),
&(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
KPrefsDialogWidBool *showCompletedTodo =
addWidBool(i18n("To-do view shows completed Todos"),
&(KOPrefs::instance()->mShowCompletedTodo),topFrame);
topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
dummy =
addWidBool(i18n("To-do view shows complete as 'xx %'"),
&(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Small To-do view uses smaller font"),
&(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy =
addWidBool(i18n("Todo view uses category colors"),
&(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
QWidget* wid = new QWidget( topFrame );
// Todo run today color
KPrefsDialogWidColor *todoRunColor =
addWidColor(i18n("Color for running todos:"),
&(KOPrefs::instance()->mTodoRunColor),wid);
- QHBoxLayout *widLayout = new QHBoxLayout(wid);
+ Q3HBoxLayout *widLayout = new Q3HBoxLayout(wid);
widLayout->addWidget( todoRunColor->label() );
widLayout->addWidget( todoRunColor->button() );
topLayout->addWidget(wid,ii++,0);
wid = new QWidget( topFrame );
// Todo due today color
KPrefsDialogWidColor *todoDueTodayColor =
addWidColor(i18n("Todo due today color:"),
&(KOPrefs::instance()->mTodoDueTodayColor),wid);
- widLayout = new QHBoxLayout(wid);
+ widLayout = new Q3HBoxLayout(wid);
widLayout->addWidget( todoDueTodayColor->label() );
widLayout->addWidget( todoDueTodayColor->button() );
topLayout->addWidget(wid,ii++,0);
//topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
// Todo overdue color
wid = new QWidget( topFrame );
- widLayout = new QHBoxLayout(wid);
+ widLayout = new Q3HBoxLayout(wid);
KPrefsDialogWidColor *todoOverdueColor =
addWidColor(i18n("Todo overdue color:"),
&(KOPrefs::instance()->mTodoOverdueColor),wid);
widLayout->addWidget(todoOverdueColor->label());
widLayout->addWidget(todoOverdueColor->button());
topLayout->addWidget(wid,ii++,0);
dummy =
addWidBool(i18n("Colors are applied to text"),
&(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
topFrame = addPage(i18n("View Options"),0,0);
- topLayout = new QGridLayout(topFrame,4,1);
+ topLayout = new Q3GridLayout(topFrame,4,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
dummy =
addWidBool(i18n("Show Sync Events"),
&(KOPrefs::instance()->mShowSyncEvents),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
topLayout->addWidget(lab ,ii++,0);
dummy = addWidBool(i18n("Details"),
&(KOPrefs::instance()->mEVshowDetails),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy = addWidBool(i18n("Created time"),
&(KOPrefs::instance()->mEVshowCreated),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy = addWidBool(i18n("Last modified time"),
&(KOPrefs::instance()->mEVshowChanged),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
topLayout->addWidget(lab ,ii++,0);
dummy = addWidBool(i18n("Details"),
&(KOPrefs::instance()->mWTshowDetails),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy = addWidBool(i18n("Created time"),
&(KOPrefs::instance()->mWTshowCreated),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
dummy = addWidBool(i18n("Last modified time"),
&(KOPrefs::instance()->mWTshowChanged),topFrame);
topLayout->addWidget(dummy->checkBox(),ii++,0);
topFrame = addPage(i18n("Conflict detection"),0,0);
- topLayout = new QGridLayout(topFrame,2,1);
+ topLayout = new Q3GridLayout(topFrame,2,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
ii = 0;
dummy = addWidBool(i18n("Enable conflict detection"),
&(KOPrefs::instance()->mDetectConflicts),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
- topFrame = new QFrame( topFrame );
+ topFrame = new Q3Frame( topFrame );
topLayout->addWidget(topFrame ,ii++,0);
- topLayout = new QGridLayout(topFrame,4,1);
+ topLayout = new Q3GridLayout(topFrame,4,1);
connect ( dummy->checkBox(), SIGNAL( toggled( bool ) ), topFrame, SLOT ( setEnabled( bool ) ) );
dummy = addWidBool(i18n("Include events which \"show as free\""),
&(KOPrefs::instance()->mIncludeFree),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
topLayout->addWidget( new QLabel ( i18n("Conflict detection checks an <b>edited event</b> with <b>other events</b> for overlapping."), topFrame ) , ii++,0);
topLayout->addWidget( new QLabel ( i18n("Filter for the edited event"), topFrame ) , ii++,0);
mFilterEditItem = new QComboBox( topFrame );
topLayout->addWidget(mFilterEditItem,ii++,0);
topLayout->addWidget( new QLabel ( i18n("Filter for other events"), topFrame ) , ii++,0);
mFilterAllItem = new QComboBox( topFrame );
topLayout->addWidget(mFilterAllItem,ii++,0);
dummy = addWidBool(i18n("Check Allday with Allday"),
&(KOPrefs::instance()->mCheckConflictsAllDayAllDay),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
dummy = addWidBool(i18n("Check Allday with NonAllday"),
&(KOPrefs::instance()->mCheckConflictsAllDayNonAD),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
dummy = addWidBool(i18n("Check NonAllday with Allday"),
&(KOPrefs::instance()->mCheckConflictsNonADAllDay),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
dummy = addWidBool(i18n("Check NonAllday with NonAllday"),
&(KOPrefs::instance()->mCheckConflictsNonADNonAD),topFrame);
topLayout->addWidget(dummy->checkBox(), ii++,0);
topFrame = addPage(i18n("Alarm"),0,0);
// DesktopIcon("viewmag",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,2,1);
+ topLayout = new Q3GridLayout(topFrame,2,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
int iii = 0;
dummy =
addWidBool(i18n("Use internal alarm notification"),
&(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
topLayout->addWidget(dummy->checkBox(),iii++,0);
if ( QApplication::desktop()->height() > 240 ) {
lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
topLayout->addWidget(lab ,iii++,0);
}
#ifndef DESKTOP_VERSION
lab->setAlignment( AlignLeft|WordBreak|AlignTop);
#else
- lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
+ lab->setAlignment( Qt::AlignLeft|Qt::TextWrapAnywhere|Qt::TextWordWrap|Qt::AlignTop);
lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
#endif
- QHBox* dummyBox = new QHBox(topFrame);
+ Q3HBox* dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Play beeps count:"),dummyBox);
mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- dummyBox = new QHBox(topFrame);
+ dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Beeps interval in sec:"),dummyBox);
mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- dummyBox = new QHBox(topFrame);
+ dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Default suspend time in min:"),dummyBox);
mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- dummyBox = new QHBox(topFrame);
+ dummyBox = new Q3HBox(topFrame);
new QLabel(i18n("Auto suspend count:"),dummyBox);
mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
topLayout->addWidget(dummyBox,iii++,0);
- QHBox* hbo = new QHBox ( topFrame );
+ Q3HBox* hbo = new Q3HBox ( topFrame );
mDefaultAlarmFile = new QLineEdit(hbo);
QPushButton * loadTemplate = new QPushButton(hbo);
QPixmap icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileimport16");
else
icon = SmallIcon("fileimport");
loadTemplate->setIconSet (icon ) ;
connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
int size = loadTemplate->sizeHint().height();
loadTemplate->setFixedSize( size, size );
//lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
// topLayout->addWidget(lab ,iii++,0);
lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
topLayout->addWidget(lab ,iii++,0);
topLayout->addWidget(hbo,iii++,0);
// lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
// topLayout->addWidget(lab ,iii++,0);
// #ifndef DESKTOP_VERSION
// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
// #else
// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
// #endif
}
void KOPrefsDialog::selectSoundFile()
{
QString fileName = mDefaultAlarmFile->text();
fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
if ( fileName.length() > 0 )
mDefaultAlarmFile->setText( fileName );
}
void KOPrefsDialog::setupFontsTab()
{
- QFrame *topFrame = addPage(i18n("Fonts"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Fonts"),0,0);
// DesktopIcon("fonts",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,7,3);
topLayout->setSpacing(1);
topLayout->setMargin(3);
KPrefsDialogWidFont * tVFont;
int i = 0;
KPrefsDialogWidFont *timeLabelsFont =
addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
&(KOPrefs::instance()->mDateNavigatorFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
timeLabelsFont =
addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
&(KOPrefs::instance()->mTimeLabelsFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
++i;
KPrefsDialogWidFont *timeBarFont =
addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
&(KOPrefs::instance()->mTimeBarFont),topFrame);
topLayout->addWidget(timeBarFont->label(),i,0);
topLayout->addWidget(timeBarFont->preview(),i,1);
topLayout->addWidget(timeBarFont->button(),i,2);
++i;
KPrefsDialogWidFont *marcusBainsFont =
addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
@@ -1096,65 +1102,65 @@ void KOPrefsDialog::setupFontsTab()
topLayout->addWidget(marcusBainsFont->preview(),i,1);
topLayout->addWidget(marcusBainsFont->button(),i,2);
++i;
tVFont =
addWidFont(i18n("Summary"),i18n("Event Viewer:"),
&(KOPrefs::instance()->mEventViewFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
tVFont =
addWidFont(i18n("Details"),i18n("EditorBox:"),
&(KOPrefs::instance()->mEditBoxFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
topLayout->setColStretch(1,1);
topLayout->setRowStretch(4,1);
i = 0;
topFrame = addPage(i18n("View Fonts"),0,
DesktopIcon("fonts",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,7,3);
+ topLayout = new Q3GridLayout(topFrame,7,3);
topLayout->setSpacing(1);
topLayout->setMargin(3);
tVFont =
addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
&(KOPrefs::instance()->mWhatsNextFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
KPrefsDialogWidFont *agendaViewFont =
addWidFont(i18n("Event text"),i18n("Agenda view:"),
&(KOPrefs::instance()->mAgendaViewFont),topFrame);
topLayout->addWidget(agendaViewFont->label(),i,0);
topLayout->addWidget(agendaViewFont->preview(),i,1);
topLayout->addWidget(agendaViewFont->button(),i,2);
++i;
KPrefsDialogWidFont *monthViewFont =
addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
topLayout->addWidget(monthViewFont->label(),i,0);
topLayout->addWidget(monthViewFont->preview(),i,1);
topLayout->addWidget(monthViewFont->button(),i,2);
++i;
KPrefsDialogWidFont *lVFont =
addWidFont(i18n("Event"),i18n("List View:"),
&(KOPrefs::instance()->mListViewFont),topFrame);
topLayout->addWidget(lVFont->label(),i,0);
@@ -1164,122 +1170,122 @@ void KOPrefsDialog::setupFontsTab()
tVFont =
addWidFont(i18n("ToDo"),i18n("ToDoView:"),
&(KOPrefs::instance()->mTodoViewFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
tVFont =
addWidFont(i18n("Today"),i18n("JournalView:"),
&(KOPrefs::instance()->mJornalViewFont),topFrame);
topLayout->addWidget(tVFont->label(),i,0);
topLayout->addWidget(tVFont->preview(),i,1);
topLayout->addWidget(tVFont->button(),i,2);
++i;
topLayout->setColStretch(1,1);
topLayout->setRowStretch(4,1);
}
void KOPrefsDialog::setupColorsTab()
{
- QFrame *topFrame = addPage(i18n("Colors"),0,0);
+ Q3Frame *topFrame = addPage(i18n("Colors"),0,0);
// DesktopIcon("colorize",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,2);
// topLayout->setSpacing(mSpacingHint);
// topLayout->setMargin(mMarginHint);
topLayout->setSpacing(2);
topLayout->setMargin(3);
int ii = 1;
- QGroupBox *categoryGroup ;
+ Q3GroupBox *categoryGroup ;
- categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
+ categoryGroup = new Q3GroupBox(1,Qt::Vertical,i18n("Categories"),
topFrame);
topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
mCategoryCombo = new QComboBox(categoryGroup);
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
mCategoryButton = new KColorButton(categoryGroup);
connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
updateCategoryColor();
// Holiday Color
KPrefsDialogWidColor *holidayColor =
addWidColor(i18n("Holiday color:"),
&(KOPrefs::instance()->mHolidayColor),topFrame);
topLayout->addWidget(holidayColor->label(),ii,0);
topLayout->addWidget(holidayColor->button(),ii++,1);
// Highlight Color
KPrefsDialogWidColor *highlightColor =
addWidColor(i18n("Highlight color:"),
&(KOPrefs::instance()->mHighlightColor),topFrame);
topLayout->addWidget(highlightColor->label(),ii,0);
topLayout->addWidget(highlightColor->button(),ii++,1);
// Event color
KPrefsDialogWidColor *eventColor =
addWidColor(i18n("Default event color:"),
&(KOPrefs::instance()->mEventColor),topFrame);
topLayout->addWidget(eventColor->label(),ii,0);
topLayout->addWidget(eventColor->button(),ii++,1);
eventColor =
addWidColor(i18n("Default todo done color:"),
&(KOPrefs::instance()->mTodoDoneColor),topFrame);
topLayout->addWidget(eventColor->label(),ii,0);
topLayout->addWidget(eventColor->button(),ii++,1);
if ( QApplication::desktop()->height() <= 240 ) {
topFrame = addPage(i18n("Colors") +" 2",0,0);
// DesktopIcon("colorize",KIcon::SizeMedium));
- topLayout = new QGridLayout(topFrame,5,2);
+ topLayout = new Q3GridLayout(topFrame,5,2);
// topLayout->setSpacing(mSpacingHint);
// topLayout->setMargin(mMarginHint);
topLayout->setSpacing(2);
topLayout->setMargin(3);
}
// agenda view background color
KPrefsDialogWidColor *agendaBgColor =
addWidColor(i18n("Agenda view background color:"),
&(KOPrefs::instance()->mAgendaBgColor),topFrame);
topLayout->addWidget(agendaBgColor->label(),ii,0);
topLayout->addWidget(agendaBgColor->button(),ii++,1);
// working hours color
KPrefsDialogWidColor *workingHoursColor =
addWidColor(i18n("Working hours color:"),
&(KOPrefs::instance()->mWorkingHoursColor),topFrame);
topLayout->addWidget(workingHoursColor->label(),ii,0);
topLayout->addWidget(workingHoursColor->button(),ii++,1);
KPrefsDialogWidBool *sb =
addWidBool(i18n("Use colors for application:"),
&(KOPrefs::instance()->mUseAppColors),topFrame);
topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
ii++;
KPrefsDialogWidColor * workingHoursColor1 =
addWidColor(i18n("Buttons, menus, etc.:"),
&(KOPrefs::instance()->mAppColor1),topFrame);
topLayout->addWidget(workingHoursColor1->label(),ii,0);
@@ -1288,129 +1294,129 @@ void KOPrefsDialog::setupColorsTab()
KPrefsDialogWidColor * workingHoursColor2 =
addWidColor(i18n("Frames, labels, etc.:"),
&(KOPrefs::instance()->mAppColor2),topFrame);
topLayout->addWidget(workingHoursColor2->label(),ii,0);
topLayout->addWidget(workingHoursColor2->button(),ii++,1);
}
void KOPrefsDialog::setCategoryColor()
{
mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
}
void KOPrefsDialog::updateCategoryColor()
{
QString cat = mCategoryCombo->currentText();
QColor *color = mCategoryDict.find(cat);
if (!color) {
color = KOPrefs::instance()->categoryColor(cat);
}
if (color) {
mCategoryButton->setColor(*color);
}
}
void KOPrefsDialog::setupPrinterTab()
{
mPrinterTab = addPage(i18n("Printing"),0,
DesktopIcon("fileprint",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(mPrinterTab,5,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
topLayout->setRowStretch(4,1);
}
void KOPrefsDialog::setupGroupSchedulingTab()
{
#if 0
- QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
+ Q3Frame *topFrame = addPage(i18n("Group Scheduling"),0,
DesktopIcon("personal",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
#if 0
KPrefsDialogWidRadios *schedulerGroup =
addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
topFrame);
schedulerGroup->addRadio("Dummy"); // Only for debugging
schedulerGroup->addRadio(i18n("Mail client"));
topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
#endif
KPrefsDialogWidRadios *sendGroup =
addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
topFrame);
sendGroup->addRadio(i18n("Send to outbox"));
sendGroup->addRadio(i18n("Send directly"));
topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
- mAMails = new QListView(topFrame);
+ mAMails = new Q3ListView(topFrame);
mAMails->addColumn(i18n("Email"),300);
topLayout->addMultiCellWidget(mAMails,3,3,0,1);
topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
aEmailsEdit = new QLineEdit(topFrame);
aEmailsEdit->setEnabled(false);
topLayout->addWidget(aEmailsEdit,4,1);
QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
topLayout->addWidget(add,5,0);
QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
topLayout->addWidget(del,5,1);
//topLayout->setRowStretch(2,1);
connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
- connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
+ connect(mAMails,SIGNAL(selectionChanged(Q3ListViewItem *)),SLOT(updateInput()));
#endif
}
void KOPrefsDialog::setupGroupAutomationTab()
{
return;
- QFrame *topFrame = addPage(i18n("Group Automation"),0,
+ Q3Frame *topFrame = addPage(i18n("Group Automation"),0,
DesktopIcon("personal",KIcon::SizeMedium));
- QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,5,1);
topLayout->setSpacing(mSpacingHint);
topLayout->setMargin(mMarginHint);
KPrefsDialogWidRadios *autoRefreshGroup =
addWidRadios(i18n("Auto Send Refresh"),
&(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
autoRefreshGroup->addRadio(i18n("Never"));
autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
//autoRefreshGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
KPrefsDialogWidRadios *autoInsertGroup =
addWidRadios(i18n("Auto Insert IMIP Replies"),
&(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
autoInsertGroup->addRadio(i18n("Never"));
autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
//autoInsertGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
KPrefsDialogWidRadios *autoRequestGroup =
addWidRadios(i18n("Auto Insert IMIP Requests"),
&(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
autoRequestGroup->addRadio(i18n("Never"));
autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
//autoInsertGroup->addRadio(i18n("selected emails"));
topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
KPrefsDialogWidRadios *autoFreeBusyGroup =
addWidRadios(i18n("Auto Send FreeBusy Information"),
&(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
autoFreeBusyGroup->addRadio(i18n("Never"));
autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
@@ -1486,65 +1492,65 @@ void KOPrefsDialog::usrReadConfig()
QStringList temp = cfgko.readListEntry("CalendarFilters");
temp.prepend(i18n("No Filter") );
mFilterEditItem->insertStringList( temp );
mFilterAllItem->insertStringList( temp );
int index = temp.findIndex( KOPrefs::instance()->mFilterConflictEditItem );
if ( index >= 0 )
mFilterEditItem->setCurrentItem( index );
index = temp.findIndex( KOPrefs::instance()->mFilterConflictAllItem );
if ( index >= 0 )
mFilterAllItem->setCurrentItem( index );
}
void KOPrefsDialog::usrWriteConfig()
{
KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
KOPrefs::instance()->setFullName(mNameEdit->text());
KOPrefs::instance()->setEmail(mEmailEdit->text());
KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
if ( mCatDefaultColor != KOPrefs::instance()->mEventColor ) {
QStringList cat = KOPrefs::instance()->mCustomCategories;
int iii = 0;
while ( iii < cat.count() ) {
if ( *KOPrefs::instance()->categoryColor( cat[ iii ] ) == mCatDefaultColor )
KOPrefs::instance()->setCategoryColor( cat[ iii ], KOPrefs::instance()->mEventColor );
++iii;
}
}
- QDictIterator<QColor> it(mCategoryDict);
+ Q3DictIterator<QColor> it(mCategoryDict);
while (it.current()) {
KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
++it;
}
KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
KOPrefs::instance()->mAdditionalMails.clear();
// QListViewItem *item;
// item = mAMails->firstChild();
// while (item)
// {
// KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
// item = item->nextSibling();
// }
KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
KOPrefs::instance()->mFilterConflictEditItem = mFilterEditItem->currentText();
KOPrefs::instance()->mFilterConflictAllItem = mFilterAllItem->currentText();
}
void KOPrefsDialog::updateCategories()
{
mCategoryCombo->clear();
mCategoryDict.clear();
mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
updateCategoryColor();
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h
index ee7a7aa..ccc1726 100644
--- a/korganizer/koprefsdialog.h
+++ b/korganizer/koprefsdialog.h
@@ -1,61 +1,63 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KOPREFSDIALOG_H
#define _KOPREFSDIALOG_H
-#include <qframe.h>
-#include <qdict.h>
+#include <q3frame.h>
+#include <q3dict.h>
#include <qcolor.h>
-#include <qlistview.h>
+#include <q3listview.h>
+//Added by qt3to4:
+#include <QLabel>
#include <kdialogbase.h>
#include <libkdepim/kprefsdialog.h>
#include <libkdepim/kdateedit.h>
#include <kcmconfigs/kdepimconfigwidget.h>
class KColorButton;
class QSpinBox;
class QSlider;
class KURLRequester;
class QComboBox;
class QLineEdit;
class QStringList;
/** Dialog to change the korganizer configuration.
*/
class KOPrefsDialog : public KPrefsDialog
{
Q_OBJECT
public:
/** Initialize dialog and pages */
KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false);
~KOPrefsDialog();
public slots:
void showPrinterTab();
/** Update controls for categories */
void updateCategories();
protected slots:
void selectSoundFile();
@@ -65,92 +67,92 @@ class KOPrefsDialog : public KPrefsDialog
//additional emails
void addItem();
void removeItem();
void updateItem();
void updateInput();
protected:
void usrReadConfig();
void usrWriteConfig();
void setupGlobalTab();
void setupMainTab();
void setupTimeTab();
void setupLocaleTab();
void setupLocaleDateTab();
void setupFontsTab();
void setupColorsTab();
void setupViewsTab();
void setupDisplayTab();
void setupPrinterTab();
void setupGroupSchedulingTab();
void setupGroupAutomationTab();
void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
private:
QColor mCatDefaultColor;
KPrefsDialogWidBool *mEnableGroupScheduling;
KPrefsDialogWidBool *mEnableProjectView;
- QFrame *mPrinterTab;
+ Q3Frame *mPrinterTab;
QLineEdit *nameEdit;
QLineEdit *emailEdit;
QComboBox *timeCombo;
QComboBox *tzCombo;
// widgets holding preferences data
QLineEdit *mNameEdit;
QLineEdit *mEmailEdit;
QLabel *mNameLabel;
QLabel *mEmailLabel;
QLineEdit *mAdditionalEdit;
QSpinBox *mAutoSaveIntervalSpin;
QSpinBox *mPrioSpin;
// QListView *mAMails;
QLineEdit *aEmailsEdit;
QComboBox *mTimeZoneCombo;
QStringList tzonenames;
QSpinBox *mStartTimeSpin;
QSpinBox *mDefaultDurationSpin;
QComboBox *mAlarmTimeCombo;
QComboBox *mCategoryCombo;
KColorButton *mCategoryButton;
- QDict<QColor> mCategoryDict;
+ Q3Dict<QColor> mCategoryDict;
QSlider *mHourSizeSlider;
QSpinBox *mNextXDaysSpin;
QSpinBox *mWhatsNextSpin;
QLineEdit * mRemoteIPEdit;
QLineEdit * mRemoteUser;
QLineEdit * mRemotePassWd;
QLineEdit * mRemoteFile;
QLineEdit * mLocalTempFile;
QWidget* mSetupSyncAlgTab;
QLineEdit * mUserDateFormatLong;
QLineEdit * mUserDateFormatShort;
QSpinBox *mTimezoneOffsetSpin;
QSpinBox *mDaylightsavingStart;
QSpinBox *mDaylightsavingEnd;
KDateEdit* mStartDateSavingEdit;
KDateEdit* mEndDateSavingEdit;
QSpinBox * mAlarmPlayBeeps;
QSpinBox * mAlarmSuspendTime;
QSpinBox * mAlarmSuspendCount;
QSpinBox * mAlarmBeepInterval;
QComboBox * mFilterEditItem, *mFilterAllItem;
QLineEdit * mDefaultAlarmFile;
int mSpacingHint;
int mMarginHint;
};
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index df8f8d7..0f3b328 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,120 +1,121 @@
TEMPLATE = app
-CONFIG = qt warn_on
+CONFIG += qt warn_on
TARGET = kopi
OBJECTS_DIR = _obj/
MOC_DIR = _moc
DESTDIR= ../bin
include( ../variables.pri )
INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim
#../qtcompat
DEFINES += KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
#KORG_NOPRINTER KORG_NOKABC KORG_NODND
DEFINES += KORG_NOLVALTERNATION
DEFINES += DESKTOP_VERSION
unix : {
staticlib: {
TARGET = kopi_linux
-LIBS += ../bin/libmicrokabc_qtopia.a
-LIBS += ../bin/libmicrokabc_file.a
-LIBS += ../bin/libmicrokabc_dir.a
-LIBS += ../bin/libmicrokdepim.a
-LIBS += ../bin/libmicrokcal.a
-LIBS += ../bin/libmicrokabc.a
-LIBS += ../bin/libmicrokde.a
-LIBS += ../bin/libmicrokabc_qtopia.a
-LIBS += ../bin/libmicrokabc_file.a
-LIBS += ../bin/libmicrokabc_dir.a
-LIBS += ../bin/libmicrokdepim.a
-LIBS += ../bin/libmicrokcal.a
-LIBS += ../bin/libmicrokabc.a
-LIBS += ../bin/libmicrokde.a
+LIBS += ../bin/libxmicrokabc_qtopia.a
+LIBS += ../bin/libxmicrokabc_file.a
+LIBS += ../bin/libxmicrokabc_dir.a
+LIBS += ../bin/libxmicrokdepim.a
+LIBS += ../bin/libxmicrokcal.a
+LIBS += ../bin/libxmicrokabc.a
+LIBS += ../bin/libxmicrokde.a
+LIBS += ../bin/libxmicrokabc_qtopia.a
+LIBS += ../bin/libxmicrokabc_file.a
+LIBS += ../bin/libxmicrokabc_dir.a
+LIBS += ../bin/libxmicrokdepim.a
+LIBS += ../bin/libxmicrokcal.a
+LIBS += ../bin/libxmicrokabc.a
+LIBS += ../bin/libxmicrokde.a
LIBS += ../libical/lib/libical.a
LIBS += ../libical/lib/libicalss.a
} else {
-LIBS += ../bin/libmicrokdepim.so
-LIBS += ../bin/libmicrokcal.so
-LIBS += ../bin/libmicrokde.so
-LIBS += ../bin/libmicrokabc.so
+LIBS += ../bin/libxmicrokdepim.so
+LIBS += ../bin/libxmicrokcal.so
+LIBS += ../bin/libxmicrokde.so
+LIBS += ../bin/libxmicrokabc.so
#LIBS += -lbluetooth
#LIBS += -lsdp
#LIBS += -lldap
}
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
RC_FILE = winicons.rc
DEFINES += _WIN32_
-LIBS += ../bin/microkdepim.lib
-LIBS += ../bin/microkcal.lib
-LIBS += ../bin/microkde.lib
-LIBS += ../bin/microkabc.lib
+LIBS += ../bin/xmicrokdepim.lib
+LIBS += ../bin/xmicrokcal.lib
+LIBS += ../bin/xmicrokde.lib
+LIBS += ../bin/xmicrokabc.lib
LIBS += ../libical/lib/ical.lib
LIBS += ../libical/lib/icalss.lib
#LIBS += atls.lib
QMAKE_LINK += /NODEFAULTLIB:LIBC
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
#olimport section
importol: {
debug: {
LIBS += mfc71ud.lib
QMAKE_LINK += /NODEFAULTLIB:MSVCRT
QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
}
release: {
LIBS += mfc71u.lib
}
DEFINES += _OL_IMPORT_
HEADERS += ../outport/msoutl9.h \
koimportoldialog.h
SOURCES += ../outport/msoutl9.cpp \
koimportoldialog.cpp
#olimport section end
TARGET = kopi_xp
} else {
TARGET = kopi_me
}
}
-INTERFACES = kofilterview_base.ui
+#The following line was changed from INTERFACES to FORMS3 by qt3to4
+FORMS3 = kofilterview_base.ui
#filteredit_base.ui
# kdateedit.h \
HEADERS += datenavigatorcontainer.h \
filteredit_base.h \
alarmclient.h \
calendarview.h \
customlistviewitem.h \
datenavigator.h \
docprefs.h \
filtereditdialog.h \
incomingdialog.h \
incomingdialog_base.h \
interfaces/korganizer/baseview.h \
interfaces/korganizer/calendarviewbase.h \
journalentry.h \
kdatenavigator.h \
koagenda.h \
koagendaitem.h \
koagendaview.h \
kocounterdialog.h \
kodaymatrix.h \
kodialogmanager.h \
koeditordetails.h \
koeditorgeneral.h \
koeditorgeneralevent.h \
koeditorgeneraltodo.h \
koeditorrecurrence.h \
koeventeditor.h \
koeventpopupmenu.h \
koeventview.h \
@@ -181,38 +182,44 @@ filteredit_base.cpp \
kofilterview.cpp \
koglobals.cpp \
koincidenceeditor.cpp \
kojournalview.cpp \
kolistview.cpp \
kolocationbox.cpp \
komonthview.cpp \
koprefs.cpp \
koprefsdialog.cpp \
kotimespanview.cpp \
kotodoeditor.cpp \
kotodoview.cpp \
kotodoviewitem.cpp \
koviewmanager.cpp \
kowhatsnextview.cpp \
ktimeedit.cpp \
lineview.cpp \
main.cpp \
mainwindow.cpp \
navigatorbar.cpp \
outgoingdialog.cpp \
outgoingdialog_base.cpp \
publishdialog.cpp \
publishdialog_base.cpp \
savetemplatedialog.cpp \
searchdialog.cpp \
statusdialog.cpp \
timeline.cpp \
timespanview.cpp \
../kalarmd/alarmdialog.cpp
HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
-INTERFACES += calprintdayconfig_base.ui \
+#The following line was changed from INTERFACES to FORMS3 by qt3to4
+FORMS3 += calprintdayconfig_base.ui \
calprintmonthconfig_base.ui \
calprinttodoconfig_base.ui \
calprintweekconfig_base.ui
SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+CONFIG += uic3
+
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index 553c265..2c1cd42 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -1,48 +1,48 @@
TEMPLATE = app
CONFIG += qt warn_on
TARGET = kopi
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include
DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
DEFINES += KORG_NOLVALTERNATION
#KORG_NOKABC
-LIBS += -lmicrokdepim
-LIBS += -lmicrokcal
-LIBS += -lmicrokde
+LIBS += -lxmicrokdepim
+LIBS += -lxmicrokcal
+LIBS += -lxmicrokde
LIBS += -lmicroqtcompat
LIBS += $(GCC3EXTRALIB1)
LIBS += $(GCC3EXTRALIB2)
LIBS += -lqpe
LIBS += -ljpeg
LIBS += $(QTOPIALIB)
LIBS += -L$(QPEDIR)/lib
INTERFACES = kofilterview_base.ui
#filteredit_base.ui
HEADERS = datenavigatorcontainer.h \
wordsgerman.h \
filteredit_base.h \
alarmclient.h \
calendarview.h \
customlistviewitem.h \
datenavigator.h \
docprefs.h \
filtereditdialog.h \
incomingdialog.h \
incomingdialog_base.h \
interfaces/korganizer/baseview.h \
interfaces/korganizer/calendarviewbase.h \
journalentry.h \
kdateedit.h \
kdatenavigator.h \
koagenda.h \
koagendaitem.h \
diff --git a/korganizer/kotimespanview.cpp b/korganizer/kotimespanview.cpp
index 3265a3a..a214720 100644
--- a/korganizer/kotimespanview.cpp
+++ b/korganizer/kotimespanview.cpp
@@ -1,109 +1,113 @@
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3ValueList>
+#include <Q3PtrList>
#include <kconfig.h>
#include "timespanview.h"
#include "koglobals.h"
#include "kotimespanview.h"
KOTimeSpanView::KOTimeSpanView(Calendar *calendar, QWidget *parent,
const char *name) :
KOEventView( calendar, parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
mTimeSpanView = new TimeSpanView( this );
topLayout->addWidget( mTimeSpanView );
connect( mTimeSpanView, SIGNAL( dateRangeChanged() ), SLOT( updateView() ) );
}
KOTimeSpanView::~KOTimeSpanView()
{
}
void KOTimeSpanView::readSettings()
{
readSettings(KOGlobals::config());
}
void KOTimeSpanView::readSettings(KConfig *config)
{
// kdDebug() << "KOTimeSpanView::readSettings()" << endl;
config->setGroup("Views");
- QValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView");
+ Q3ValueList<int> sizes = config->readIntListEntry("Separator TimeSpanView");
if (sizes.count() == 2) {
mTimeSpanView->setSplitterSizes(sizes);
}
}
void KOTimeSpanView::writeSettings(KConfig *config)
{
// kdDebug() << "KOTimeSpanView::writeSettings()" << endl;
config->setGroup("Views");
- QValueList<int> list = mTimeSpanView->splitterSizes();
+ Q3ValueList<int> list = mTimeSpanView->splitterSizes();
config->writeEntry("Separator TimeSpanView",list);
}
int KOTimeSpanView::maxDatesHint()
{
return 0;
}
int KOTimeSpanView::currentDateCount()
{
return 0;
}
-QPtrList<Incidence> KOTimeSpanView::selectedIncidences()
+Q3PtrList<Incidence> KOTimeSpanView::selectedIncidences()
{
- QPtrList<Incidence> selected;
+ Q3PtrList<Incidence> selected;
return selected;
}
void KOTimeSpanView::updateView()
{
insertItems( mTimeSpanView->startDateTime().date(),
mTimeSpanView->endDateTime().date() );
}
void KOTimeSpanView::showDates(const QDate &start, const QDate &end)
{
QDate s = start.addDays( -2 );
QDate e = end.addDays( 2 );
insertItems( s, e );
}
void KOTimeSpanView::insertItems(const QDate &start, const QDate &end)
{
mTimeSpanView->clear();
- mTimeSpanView->setDateRange( start, end );
+ mTimeSpanView->setDateRange( (QDateTime)start, (QDateTime)end );
- QPtrList<Event> events = calendar()->events( start, end );
+ Q3PtrList<Event> events = calendar()->events( start, end );
Event *event = events.first();
while( event ) {
// kdDebug() << "KOTimeSpanView::showDates() add event: " << event->summary()
// << endl;
mTimeSpanView->addItem( event );
event = events.next();
}
mTimeSpanView->updateView();
}
-void KOTimeSpanView::showEvents(QPtrList<Event> eventList)
+void KOTimeSpanView::showEvents(Q3PtrList<Event> eventList)
{
}
void KOTimeSpanView::changeEventDisplay(Event *, int)
{
}
diff --git a/korganizer/kotimespanview.h b/korganizer/kotimespanview.h
index c682ed8..c3e4b41 100644
--- a/korganizer/kotimespanview.h
+++ b/korganizer/kotimespanview.h
@@ -1,41 +1,43 @@
#ifndef KOTIMESPANVIEW_H
#define KOTIMESPANVIEW_H
#include "koeventview.h"
+//Added by qt3to4:
+#include <Q3PtrList>
class KConfig;
class TimeSpanView;
class KOTimeSpanView : public KOEventView
{
Q_OBJECT
public:
KOTimeSpanView(Calendar *calendar, QWidget *parent = 0,
const char *name = 0);
~KOTimeSpanView();
virtual int maxDatesHint();
virtual int currentDateCount();
- virtual QPtrList<Incidence> selectedIncidences();
+ virtual Q3PtrList<Incidence> selectedIncidences();
DateList selectedDates()
{DateList q;
return q;}
void readSettings();
void readSettings( KConfig * );
void writeSettings( KConfig * );
public slots:
virtual void updateView();
virtual void showDates(const QDate &start, const QDate &end);
- virtual void showEvents(QPtrList<Event> eventList);
+ virtual void showEvents(Q3PtrList<Event> eventList);
void changeEventDisplay(Event *, int);
private:
void insertItems( const QDate &start, const QDate & end );
TimeSpanView *mTimeSpanView;
};
#endif
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 20a35d2..aeab92a 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -1,231 +1,236 @@
/*
This file is part of KOrganizer.
Copyright (c) 1997, 1998 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qpixmap.h>
#include <qlayout.h>
-#include <qhbox.h>
+#include <q3hbox.h>
#include <qtimer.h>
#include <qdir.h>
#include <qdatetime.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qtabwidget.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3PtrList>
+#include <Q3VBoxLayout>
#include <kiconloader.h>
#include <klocale.h>
#include <kfiledialog.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <libkdepim/categoryselectdialog.h>
#include <libkcal/calendarlocal.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <libkcal/icalformat.h>
#include <kresources/resourceselectdialog.h>
#include <libkdepim/kdateedit.h>
#include "koprefs.h"
#include "kolocationbox.h"
#include "kotodoeditor.h"
extern int globalFlagBlockAgenda;
KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
{
mTodo = 0;
mRelatedTodo = 0;
findButton(User1)->hide();
init();
if ( QApplication::desktop()->height() <= 240 )
hideButtons();
}
KOTodoEditor::~KOTodoEditor()
{
emit dialogClose( mTodo );
}
void KOTodoEditor::init()
{
setupGeneral();
setupAttendeesTab();
setupRecurrence();
connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
}
void KOTodoEditor::setupRecurrence()
{
- QFrame *topFrame = addPage( i18n("Recurrence") );
- QBoxLayout *topLayout = new QVBoxLayout( topFrame );
+ Q3Frame *topFrame = addPage( i18n("Recurrence") );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame );
mRecurrence = new KOEditorRecurrence( topFrame );
topLayout->addWidget( mRecurrence );
}
void KOTodoEditor::setCategories( QString s )
{
mGeneral->setCategories(s);
}
void KOTodoEditor::setSecrecy( int sec )
{
mGeneral->setSecrecy( sec );
}
void KOTodoEditor::reload()
{
if ( mTodo ) readTodo( mTodo );
}
void KOTodoEditor::setupGeneral()
{
mGeneral = new KOEditorGeneralTodo(this);
connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
// connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
//connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
// mGeneral,SLOT(setCategories(const QString &)));
if (KOPrefs::instance()->mCompactDialogs) {
- QFrame *topFrame = addPage(i18n("General"));
+ Q3Frame *topFrame = addPage(i18n("General"));
- QBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
if ( QApplication::desktop()->width() < 480 ) {
topLayout->setMargin(marginHintSmall());
topLayout->setSpacing(spacingHintSmall());
} else {
topLayout->setMargin(marginHint());
topLayout->setSpacing(spacingHint());
}
topLayout->addStretch( 1 );
mGeneral->initHeader(topFrame,topLayout);
topLayout->addStretch( 1 );
mGeneral->initTime(topFrame,topLayout);
topLayout->addStretch( 1 );
mGeneral->initAlarm(topFrame,topLayout);
topLayout->addStretch( 1 );
mGeneral->enableAlarm( false );
- QBoxLayout *priorityLayout;
+ Q3BoxLayout *priorityLayout;
if ( QApplication::desktop()->width() < 500 )
- priorityLayout = new QVBoxLayout( topLayout );
+ priorityLayout = new Q3VBoxLayout( topLayout );
else
- priorityLayout = new QHBoxLayout( topLayout );
+ priorityLayout = new Q3HBoxLayout( topLayout );
QWidget* prioWidget = new QWidget (topFrame);
priorityLayout->addWidget( prioWidget );
- QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget);
+ Q3HBoxLayout* priorityLayout2 = new Q3HBoxLayout( prioWidget);
- QIconSet icon;
+ QIcon icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileimport16");
else
icon = SmallIcon("fileimport");
QPushButton * loadTemplate = new QPushButton( prioWidget);
loadTemplate->setIconSet (icon ) ;
int size = loadTemplate->sizeHint().height();
loadTemplate->setFixedSize( size, size );
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("fileexport16");
else
icon = SmallIcon("fileexport");
QPushButton * saveTemplate = new QPushButton( prioWidget);
saveTemplate->setIconSet (icon ) ;
saveTemplate->setFixedSize( size, size );
priorityLayout2->addWidget(loadTemplate);
priorityLayout2->addWidget(saveTemplate);
mGeneral->initPriority(prioWidget,priorityLayout2);
mGeneral->initCategories( topFrame, priorityLayout );
topLayout->addStretch(1);
- QFrame *topFrame2 = addPage(i18n("Details"));
+ Q3Frame *topFrame2 = addPage(i18n("Details"));
- QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
+ Q3BoxLayout *topLayout2 = new Q3VBoxLayout(topFrame2);
topLayout2->setMargin(marginHint());
topLayout2->setSpacing(spacingHint());
- QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 );
+ Q3HBoxLayout *completionLayout = new Q3HBoxLayout( topLayout2 );
mGeneral->initCompletion(topFrame2,completionLayout);
mGeneral->initSecrecy( topFrame2, topLayout2 );
mGeneral->initDescription(topFrame2,topLayout2);
// QHBox * hb = new QHBox ( topFrame2 );
// topLayout2->addWidget(hb);
// hb->setSpacing( 3 );
connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
} else {
- QFrame *topFrame = addPage(i18n("General"));
+ Q3Frame *topFrame = addPage(i18n("General"));
- QBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(topFrame);
topLayout->setSpacing(spacingHint());
mGeneral->initHeader(topFrame,topLayout);
mGeneral->initTime(topFrame,topLayout);
mGeneral->initStatus(topFrame,topLayout);
- QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *alarmLineLayout = new Q3HBoxLayout(topLayout);
mGeneral->initAlarm(topFrame,alarmLineLayout);
mGeneral->initDescription(topFrame,topLayout);
- QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
+ Q3BoxLayout *detailsLayout = new Q3HBoxLayout(topLayout);
mGeneral->initCategories( topFrame, detailsLayout );
mGeneral->initSecrecy( topFrame, detailsLayout );
}
mGeneral->finishSetup();
}
void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
{
//init();
mTodo = todo;
readTodo(mTodo);
if ( editDescription ) {
showPage( 1 );
mGeneral->setFocusOn( 1 );
} else {
showPage( 0 );
mGeneral->setFocusOn( 2 );
}
checkRecurrence();
}
void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
{
//init();
mTodo = 0;
setDefaults(due,relatedTodo,allDay);
}
void KOTodoEditor::loadDefaults()
@@ -398,61 +403,61 @@ int KOTodoEditor::msgItemDelete()
return KMessageBox::warningContinueCancel(this,
i18n("This item will be permanently deleted."),
i18n("KOrganizer Confirmation"),i18n("Delete"));
}
void KOTodoEditor::modified (int modification)
{
if (modification == KOGlobals::CATEGORY_MODIFIED ||
KOGlobals::UNKNOWN_MODIFIED == modification )
// mCategoryDialog->setSelected (mTodo->categories ());
mGeneral->modified (mTodo, modification);
}
void KOTodoEditor::slotLoadTemplate()
{
QString fileName =locateLocal( "templates", "todos" );
QDir t_dir;
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/todo";
fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this );
if ( fileName.length() == 0 )
return;
CalendarLocal cal;
ICalFormat format;
if ( !format.load( &cal, fileName ) ) {
KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
.arg( fileName ) );
return ;
}
- QPtrList<Todo> todos = cal.todos();
+ Q3PtrList<Todo> todos = cal.todos();
Todo * todo = todos.first();
if ( !todo ) {
KMessageBox::error( this,
i18n("Template does not\ncontain a valid Todo."));
} else {
readTodo( todo );
}
}
void KOTodoEditor::slotSaveTemplate()
{
QString fileName =locateLocal( "templates", "todos" );
QDir t_dir;
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/todo";
fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this );
if ( fileName.length() > 0 )
saveTemplate( fileName );
}
void KOTodoEditor::saveTemplate( const QString &templateName )
{
Todo *todo = new Todo;
writeTodo( todo );
saveAsTemplate( todo, templateName );
}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index ba94057..2b8fbd3 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -1,812 +1,828 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
+#include <QDesktopWidget>
+
#include <qlayout.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qcursor.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qinputdialog.h>
-#include <qvbox.h>
+#include <q3vbox.h>
+//Added by qt3to4:
+#include <QWheelEvent>
+#include <QFocusEvent>
+#include <QDragLeaveEvent>
+#include <QMouseEvent>
+#include <QDragEnterEvent>
+#include <QKeyEvent>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <QDropEvent>
+#include <QDragMoveEvent>
+#include <QPaintEvent>
+#include <Q3PopupMenu>
+#include <Q3PtrList>
#include <kdebug.h>
#include "koprefs.h"
#include <klocale.h>
#include <kglobal.h>
#include <kdateedit.h>
#include "ktimeedit.h"
#include <kiconloader.h>
#include <kmessagebox.h>
#include <libkcal/icaldrag.h>
#include <libkcal/vcaldrag.h>
#include <libkcal/calfilter.h>
#include <libkcal/dndfactory.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <kresources/resourceselectdialog.h>
#include <libkcal/kincidenceformatter.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "docprefs.h"
#include "kotodoview.h"
using namespace KOrg;
KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) :
QDialog( parent, name, true )
{
mStopAll = true;
setCaption( i18n("Start todo") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this );
lay->addWidget( lab );
- lab->setAlignment( AlignCenter );
+ lab->setAlignment( Qt::AlignCenter );
QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this );
lay->addWidget( ok );
ok->setDefault( true );
QPushButton * start = new QPushButton( i18n("Start todo"), this );
lay->addWidget( start );
QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( sizeHint() );
}
void KOStartTodoPrefs::doStop()
{
mStopAll = false;
accept();
}
KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
QDialog( parent, name, true )
{
mTodo = todo;
setCaption( i18n("Stop todo") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( todo->summary() ), this );
lay->addWidget( lab );
- lab->setAlignment( AlignHCenter );
+ lab->setAlignment( Qt::AlignHCenter );
lab = new QLabel( i18n("Additional Comment:"), this );
lay->addWidget( lab );
mComment = new QLineEdit( this );
lay->addWidget( mComment );
- QHBox * start = new QHBox ( this );
+ Q3HBox * start = new Q3HBox ( this );
lay->addWidget( start );
lab = new QLabel( i18n("Start:"), start );
- QHBox * end = new QHBox ( this );
+ Q3HBox * end = new Q3HBox ( this );
lay->addWidget( end );
lab = new QLabel( i18n("End:"), end );
sde = new KDateEdit( start );
ste = new KOTimeEdit( start );
connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
ede = new KDateEdit( end );
ete = new KOTimeEdit(end );
connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
sde->setDate( mTodo->runStart().date() );
ste->setTime( mTodo->runStart().time() );
mStop = QDateTime::currentDateTime();
ede->setDate( mStop.date());
ete->setTime( mStop.time() );
QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
lay->addWidget( ok );
ok->setDefault( true );
QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
ok = new QPushButton( i18n("Stop - do not save"), this );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
lay->addWidget( ok );
if (QApplication::desktop()->width() < 320 )
resize( 240, sizeHint().height() );
else
resize( 320, sizeHint().height() );
}
void KOStopTodoPrefs::accept()
{
QDateTime start = QDateTime( sde->date(), ste->getTime() );
QDateTime stop = QDateTime( ede->date(), ete->getTime() );
if ( start > stop ) {
KMessageBox::sorry(this,
i18n("The start time is\nafter the end time!"),
i18n("Time mismatch!"));
return;
}
// restoring the seconds
if ( start == QDateTime( mTodo->runStart().date(),
QTime(mTodo->runStart().time().hour() , mTodo->runStart().time().minute() ) ) )
start = mTodo->runStart();
if ( stop == QDateTime( mStop.date(),
QTime( mStop.time().hour() , mStop.time().minute() ) ) )
stop = mStop;
mTodo->saveRunningInfo( mComment->text(), start, stop );
QDialog::accept();
}
void KOStopTodoPrefs::doNotSave()
{
int result = KMessageBox::warningContinueCancel(this,
i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
if (result != KMessageBox::Continue) return;
mTodo->stopRunning();
QDialog::accept();
}
-class KOTodoViewWhatsThis :public QWhatsThis
+class KOTodoViewWhatsThis :public Q3WhatsThis
{
public:
- KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
+ KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : Q3WhatsThis( wid ), _wid(wid),_view (view) { };
protected:
virtual QString text( const QPoint& p)
{
return _view->getWhatsThisText(p) ;
}
private:
QWidget* _wid;
KOTodoView * _view;
};
KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
const char *name) :
KListView(parent,name)
{
mName = QString ( name );
mCalendar = calendar;
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
mOldCurrent = 0;
mMousePressed = false;
setAcceptDrops(true);
viewport()->setAcceptDrops(true);
int size = 16;
if (qApp->desktop()->width() < 300 )
size = 12;
setTreeStepSize( size + 6 );
}
void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
- !QTextDrag::canDecode( e ) ) {
+ !Q3TextDrag::canDecode( e ) ) {
e->ignore();
return;
}
mOldCurrent = currentItem();
#endif
}
void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
- !QTextDrag::canDecode( e ) ) {
+ !Q3TextDrag::canDecode( e ) ) {
e->ignore();
return;
}
e->accept();
#endif
}
void KOTodoListView::contentsDragLeaveEvent(QDragLeaveEvent *)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDragLeaveEvent" << endl;
setCurrentItem(mOldCurrent);
setSelected(mOldCurrent,true);
#endif
}
void KOTodoListView::contentsDropEvent(QDropEvent *e)
{
#ifndef KORG_NODND
// kdDebug() << "KOTodoListView::contentsDropEvent" << endl;
if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
- !QTextDrag::canDecode( e ) ) {
+ !Q3TextDrag::canDecode( e ) ) {
e->ignore();
return;
}
DndFactory factory( mCalendar );
Todo *todo = factory.createDropTodo(e);
if (todo) {
e->acceptAction();
KOTodoViewItem *destination =
(KOTodoViewItem *)itemAt(contentsToViewport(e->pos()));
Todo *destinationEvent = 0;
if (destination) destinationEvent = destination->todo();
Todo *existingTodo = mCalendar->todo(todo->uid());
if(existingTodo) {
Incidence *to = destinationEvent;
while(to) {
if (to->uid() == todo->uid()) {
KMessageBox::sorry(this,
i18n("Cannot move Todo to itself\nor a child of itself"),
i18n("Drop Todo"));
delete todo;
return;
}
to = to->relatedTo();
}
internalDrop = true;
if ( destinationEvent )
reparentTodoSignal( destinationEvent, existingTodo );
else
unparentTodoSignal(existingTodo);
delete todo;
} else {
mCalendar->addTodo(todo);
emit todoDropped(todo, KOGlobals::EVENTADDED);
if ( destinationEvent )
reparentTodoSignal( destinationEvent, todo );
}
}
else {
QString text;
- if (QTextDrag::decode(e,text)) {
+ if (Q3TextDrag::decode(e,text)) {
//QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
qDebug("Dropped : " + text);
QStringList emails = QStringList::split(",",text);
for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
int pos = (*it).find("<");
QString name = (*it).left(pos);
QString email = (*it).mid(pos);
if (!email.isEmpty() && todoi) {
todoi->todo()->addAttendee(new Attendee(name,email));
}
}
}
else {
qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
e->ignore();
}
}
#endif
}
void KOTodoListView::wheelEvent (QWheelEvent *e)
{
- QListView::wheelEvent (e);
+ Q3ListView::wheelEvent (e);
}
void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
{
QPoint p(contentsToViewport(e->pos()));
- QListViewItem *i = itemAt(p);
+ Q3ListViewItem *i = itemAt(p);
bool rootClicked = true;
if (i) {
// if the user clicked into the root decoration of the item, don't
// try to start a drag!
int X = p.x();
//qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
if (X > header()->sectionPos(0) +
treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
itemMargin() +i->height()||
X < header()->sectionPos(0)) {
rootClicked = false;
}
} else {
rootClicked = false;
}
#ifndef KORG_NODND
mMousePressed = false;
- if (! rootClicked && !( e->button() == RightButton) ) {
+ if (! rootClicked && !( e->button() == Qt::RightButton) ) {
mPressPos = e->pos();
mMousePressed = true;
} else {
mMousePressed = false;
}
#endif
//qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
#ifndef DESKTOP_VERSION
if (!( e->button() == RightButton && rootClicked) )
- QListView::contentsMousePressEvent(e);
+ Q3ListView::contentsMousePressEvent(e);
#else
- QListView::contentsMousePressEvent(e);
+ Q3ListView::contentsMousePressEvent(e);
#endif
}
void KOTodoListView::paintEvent(QPaintEvent* e)
{
emit paintNeeded();
- QListView::paintEvent( e);
+ Q3ListView::paintEvent( e);
}
void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
{
#ifndef KORG_NODND
//QListView::contentsMouseMoveEvent(e);
if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
QApplication::startDragDistance()*3) {
mMousePressed = false;
- QListViewItem *item = itemAt(contentsToViewport(mPressPos));
+ Q3ListViewItem *item = itemAt(contentsToViewport(mPressPos));
if (item) {
DndFactory factory( mCalendar );
ICalDrag *vd = factory.createDrag(
((KOTodoViewItem *)item)->todo(),viewport());
internalDrop = false;
// we cannot do any senseful here, because the DnD is still broken in Qt
if (vd->drag()) {
if ( !internalDrop ) {
//emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
qDebug("Dnd: External move: Delete drag source ");
} else
qDebug("Dnd: Internal move ");
} else {
if ( !internalDrop ) {
qDebug("Dnd: External Copy");
} else
qDebug("DnD: Internal copy: Copy pending");
}
}
}
#endif
}
void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
}
}
void KOTodoListView::keyPressEvent ( QKeyEvent * e )
{
qApp->processEvents();
if ( !isVisible() ) {
e->ignore();
return;
}
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->ignore();
// qDebug(" ignore %d",e->isAutoRepeat() );
return;
}
if (! e->isAutoRepeat() )
mFlagKeyPressed = true;
- QListViewItem* cn;
+ Q3ListViewItem* cn;
if ( (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) && mName != "todolistsmall") {
cn = currentItem();
if ( cn ) {
KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
if ( ci ){
- if ( e->state() == ShiftButton )
+ if ( e->state() == Qt::ShiftButton )
ci->setOn( false );
else
ci->setOn( true );
cn = cn->itemBelow();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
}
}
e->accept();
return;
}
if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
switch ( e->key() ) {
case Qt::Key_Down:
case Qt::Key_Up:
- QListView::keyPressEvent ( e );
+ Q3ListView::keyPressEvent ( e );
e->accept();
break;
case Qt::Key_Left:
case Qt::Key_Right:
- QListView::keyPressEvent ( e );
+ Q3ListView::keyPressEvent ( e );
e->accept();
return;
break;
default:
e->ignore();
break;
}
return;
}
e->ignore();
}
void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
- QListView::contentsMouseReleaseEvent(e);
+ Q3ListView::contentsMouseReleaseEvent(e);
mMousePressed = false;
}
void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
if (!e) return;
QPoint vp = contentsToViewport(e->pos());
- QListViewItem *item = itemAt(vp);
+ Q3ListViewItem *item = itemAt(vp);
emit double_Clicked(item);
if (!item) return;
emit doubleClicked(item,vp,0);
}
/////////////////////////////////////////////////////////////////////////////
KOQuickTodo::KOQuickTodo(QWidget *parent) :
QLineEdit(parent)
{
setText(i18n("Click to add new Todo"));
- setFocusPolicy ( QWidget::ClickFocus );
+ setFocusPolicy ( Qt::ClickFocus );
}
void KOQuickTodo::focusInEvent(QFocusEvent *ev)
{
if ( text()==i18n("Click to add new Todo") )
setText("");
QLineEdit::focusInEvent(ev);
}
void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
{
setText(i18n("Click to add new Todo"));
QLineEdit::focusOutEvent(ev);
}
/////////////////////////////////////////////////////////////////////////////
KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
KOrg::BaseView(calendar,parent,name)
{
mIsActiveWindow = false;
mCurItem = 0;
mCurItemRootParent = 0;
mCurItemParent = 0;
mCurItemAbove = 0;
mActiveItem = 0;
mCategoryPopupMenu = 0;
mPendingUpdateBeforeRepaint = false;
isFlatDisplay = false;
mNavigator = 0;
- QBoxLayout *topLayout = new QVBoxLayout(this);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
mName = QString ( name );
mBlockUpdate = false;
mQuickBar = new QWidget( this );
topLayout->addWidget(mQuickBar);
mQuickAdd = new KOQuickTodo(mQuickBar);
- QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar);
+ Q3BoxLayout *quickLayout = new Q3HBoxLayout(mQuickBar);
quickLayout->addWidget( mQuickAdd );
mNewSubBut = new QPushButton( "sub",mQuickBar );
QPushButton * s_done = new QPushButton( "D",mQuickBar );
QPushButton * s_run = new QPushButton( "R",mQuickBar );
QPushButton * allopen = new QPushButton( "O",mQuickBar );
QPushButton * allclose = new QPushButton( "C",mQuickBar );
QPushButton * flat = new QPushButton( "F",mQuickBar );
int fixwid = mQuickAdd->sizeHint().height();
int fixhei = fixwid;
if ( QApplication::desktop()->width() > 800 )
fixwid = (fixwid*3)/2;
connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat()));
connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen()));
connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose()));
s_done->setPixmap( SmallIcon("greenhook16"));
connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted()));
s_run->setPixmap( SmallIcon("ko16old"));
connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning()));
connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo()));
mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() );
mNewSubBut->setEnabled( false );
flat->setFixedWidth( fixwid );
s_done->setFixedWidth( fixwid );
allopen->setFixedWidth( fixwid );
allclose->setFixedWidth( fixwid );
s_run->setFixedWidth( fixwid );
flat->setFixedHeight(fixhei );
s_done->setFixedHeight(fixhei );
allopen->setFixedHeight(fixhei );
allclose->setFixedHeight(fixhei );
s_run->setFixedHeight(fixhei );
mNewSubBut->setFixedHeight(fixhei );
- flat->setFocusPolicy( NoFocus );
- s_done->setFocusPolicy( NoFocus );
- allopen->setFocusPolicy( NoFocus );
- allclose->setFocusPolicy( NoFocus );
- s_run->setFocusPolicy( NoFocus );
- mNewSubBut->setFocusPolicy( NoFocus );
+ flat->setFocusPolicy( Qt::NoFocus );
+ s_done->setFocusPolicy( Qt::NoFocus );
+ allopen->setFocusPolicy( Qt::NoFocus );
+ allclose->setFocusPolicy( Qt::NoFocus );
+ s_run->setFocusPolicy( Qt::NoFocus );
+ mNewSubBut->setFocusPolicy( Qt::NoFocus );
- QWhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) );
- QWhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) );
- QWhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) );
- QWhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) );
- QWhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) );
- QWhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) );
+ Q3WhatsThis::add( flat, i18n("Click this button to display all todos in a <b>flat</b> hierarchy" ) );
+ Q3WhatsThis::add( allopen, i18n("Click this button to display all todos <b>openend</b>" ) );
+ Q3WhatsThis::add( allclose, i18n("Click this button to display all todos <b>closed</b>" ) );
+ Q3WhatsThis::add( s_run, i18n("Click this button to toggle show/hide <b>running</b> todos" ) );
+ Q3WhatsThis::add( mNewSubBut, i18n("Click this button to add a new subtodo to the currently selected todo" ) );
+ Q3WhatsThis::add( s_done, i18n("Click this button to toggle show/hide <b>completed</b> todos" ) );
quickLayout->addWidget( mNewSubBut );
quickLayout->addWidget( s_done );
quickLayout->addWidget( s_run );
quickLayout->addWidget( allopen );
quickLayout->addWidget( allclose );
quickLayout->addWidget( flat );
if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide();
mTodoListView = new KOTodoListView(calendar,this, name );
topLayout->addWidget(mTodoListView);
//mTodoListView->header()->setMaximumHeight(30);
mTodoListView->setRootIsDecorated(true);
mTodoListView->setAllColumnsShowFocus(true);
mTodoListView->setShowSortIndicator(true);
mTodoListView->addColumn(i18n("Todo"));
mTodoListView->addColumn(i18n("Prio"));
- mTodoListView->setColumnAlignment(1,AlignHCenter);
+ mTodoListView->setColumnAlignment(1,Qt::AlignHCenter);
mTodoListView->addColumn(i18n("Complete"));
- mTodoListView->setColumnAlignment(2,AlignCenter);
+ mTodoListView->setColumnAlignment(2,Qt::AlignCenter);
mTodoListView->addColumn(i18n("Due Date"));
- mTodoListView->setColumnAlignment(3,AlignLeft);
+ mTodoListView->setColumnAlignment(3,Qt::AlignLeft);
mTodoListView->addColumn(i18n("Due Time"));
- mTodoListView->setColumnAlignment(4,AlignHCenter);
+ mTodoListView->setColumnAlignment(4,Qt::AlignHCenter);
mTodoListView->addColumn(i18n("Start Date"));
- mTodoListView->setColumnAlignment(5,AlignLeft);
+ mTodoListView->setColumnAlignment(5,Qt::AlignLeft);
mTodoListView->addColumn(i18n("Start Time"));
- mTodoListView->setColumnAlignment(6,AlignHCenter);
+ mTodoListView->setColumnAlignment(6,Qt::AlignHCenter);
//mTodoListView->addColumn(i18n("Cancelled"));
mTodoListView->addColumn(i18n("Categories"));
mTodoListView->addColumn(i18n("Calendar"));
mTodoListView->addColumn(i18n("Last Modified"));
mTodoListView->addColumn(i18n("Created"));
mTodoListView->addColumn(i18n("Last Modified Sub"));
#if 0
mTodoListView->addColumn(i18n("Sort Id"));
- mTodoListView->setColumnAlignment(4,AlignHCenter);
+ mTodoListView->setColumnAlignment(4,Qt::AlignHCenter);
#endif
mTodoListView->setMinimumHeight( 60 );
mTodoListView->setItemsRenameable( true );
mTodoListView->setRenameable( 0 );
mTodoListView->setColumnWidth( 0, 120 );
int iii = 0;
for ( iii = 0; iii< 12 ; ++iii )
- mTodoListView->setColumnWidthMode( iii, QListView::Manual );
+ mTodoListView->setColumnWidthMode( iii, Q3ListView::Manual );
mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
- mPriorityPopupMenu = new QPopupMenu(this);
+ mPriorityPopupMenu = new Q3PopupMenu(this);
for (int i = 1; i <= 5; i++) {
QString label = QString ("%1").arg (i);
mPriority[mPriorityPopupMenu->insertItem (label)] = i;
}
connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
- mPercentageCompletedPopupMenu = new QPopupMenu(this);
+ mPercentageCompletedPopupMenu = new Q3PopupMenu(this);
for (int i = 0; i <= 100; i+=20) {
QString label = QString ("%1 %").arg (i);
mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
}
connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
- mCategoryPopupMenu = new QPopupMenu (this);
+ mCategoryPopupMenu = new Q3PopupMenu (this);
mCategoryPopupMenu->setCheckable (true);
connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
- mCalPopupMenu = new QPopupMenu (this);
+ mCalPopupMenu = new Q3PopupMenu (this);
mCalPopupMenu->setCheckable (true);
connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
- mItemPopupMenu = new QPopupMenu(this);
+ mItemPopupMenu = new Q3PopupMenu(this);
mItemPopupMenu->insertItem(i18n("Show"), this,
SLOT (showTodo()));
mItemPopupMenu->insertItem(i18n("Edit..."), this,
SLOT (editTodo()));
mItemPopupMenu->insertItem( i18n("Delete..."), this,
SLOT (deleteTodo()));
mItemPopupMenu->insertItem( i18n("Clone..."), this,
SLOT (cloneTodo()));
mItemPopupMenu->insertItem( i18n("Move..."), this,
SLOT (moveTodo()));
#ifndef DESKTOP_VERSION
mItemPopupMenu->insertItem( i18n("Beam..."), this,
SLOT (beamTodo()));
#endif
mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
SLOT (cancelTodo()));
mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu);
mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu);
mItemPopupMenu->insertSeparator();
mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
SLOT (toggleRunningItem()));
mItemPopupMenu->insertSeparator();
/*
mItemPopupMenu->insertItem( i18n("New Todo..."), this,
SLOT (newTodo()));
*/
mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
SLOT (newSubTodo()));
mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
SLOT (unparentTodo()),0,21);
mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
SLOT (reparentTodo()),0,22);
mItemPopupMenu->insertSeparator();
#if 0
mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."),
this, SLOT( purgeCompleted() ) );
mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
this, SLOT( toggleCompleted() ),0, 33 );
mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
this, SLOT( toggleQuickTodo() ),0, 34 );
mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
this, SLOT( toggleRunning() ),0, 35 );
#endif
- mPopupMenu = new QPopupMenu(this);
+ mPopupMenu = new Q3PopupMenu(this);
mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
SLOT (newTodo()),0,1);
mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."),
this, SLOT(purgeCompleted()),0,2);
mPopupMenu->insertItem(i18n("Show Completed"),
this, SLOT( toggleCompleted() ),0,3 );
mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
this, SLOT( toggleRunning() ),0,5 );
mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
this, SLOT( setAllOpen() ),0,6 );
mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
this, SLOT( setAllClose() ),0,7 );
mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
this, SLOT( setAllFlat() ),0,8 );
mPopupMenu->insertSeparator();
mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
this, SLOT( toggleQuickTodo() ),0,4 );
mDocPrefs = new DocPrefs( name );
mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
mPopupMenu->setCheckable( true );
mItemPopupMenu->setCheckable( true );
mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
// Double clicking conflicts with opening/closing the subtree
- connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
- SLOT( editItem( QListViewItem *) ) );
+ connect( mTodoListView, SIGNAL( doubleClicked( Q3ListViewItem *) ),
+ SLOT( editItem( Q3ListViewItem *) ) );
/*
connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
const QPoint &,int ) ),
SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
*/
- connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
+ connect( mTodoListView, SIGNAL( contextRequest ( Q3ListViewItem *,
const QPoint &,int ) ),
- SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
- connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
- SLOT( itemClicked( QListViewItem * ) ) );
- connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
- SLOT( itemDoubleClicked( QListViewItem * ) ) );
+ SLOT( popupMenu( Q3ListViewItem *, const QPoint & ,int) ) );
+ connect( mTodoListView, SIGNAL( clicked( Q3ListViewItem * ) ),
+ SLOT( itemClicked( Q3ListViewItem * ) ) );
+ connect( mTodoListView, SIGNAL( double_Clicked( Q3ListViewItem * ) ),
+ SLOT( itemDoubleClicked( Q3ListViewItem * ) ) );
connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
SLOT( updateView() ) );
connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
SLOT( todoModified(Todo *, int) ) );
- connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
- SLOT( itemStateChanged( QListViewItem * ) ) );
- connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
- SLOT( itemStateChanged( QListViewItem * ) ) );
+ connect( mTodoListView, SIGNAL( expanded( Q3ListViewItem * ) ),
+ SLOT( itemStateChanged( Q3ListViewItem * ) ) );
+ connect( mTodoListView, SIGNAL( collapsed( Q3ListViewItem * ) ),
+ SLOT( itemStateChanged( Q3ListViewItem * ) ) );
connect( mTodoListView, SIGNAL( paintNeeded() ),
SLOT( paintNeeded()) );
#if 0
- connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
- SLOT(selectionChanged(QListViewItem *)));
- connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
- SLOT(selectionChanged(QListViewItem *)));
- connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
- SLOT(selectionChanged(QListViewItem *)));
+ connect(mTodoListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
+ SLOT(selectionChanged(Q3ListViewItem *)));
+ connect(mTodoListView,SIGNAL(clicked(Q3ListViewItem *)),
+ SLOT(selectionChanged(Q3ListViewItem *)));
+ connect(mTodoListView,SIGNAL(pressed(Q3ListViewItem *)),
+ SLOT(selectionChanged(Q3ListViewItem *)));
#endif
connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
connect( mTodoListView, SIGNAL(selectionChanged() ),
SLOT( processSelectionChange() ) );
connect( mQuickAdd, SIGNAL( returnPressed () ),
SLOT( addQuickTodo() ) );
}
KOTodoView::~KOTodoView()
{
#if QT_VERSION >= 0x030000
#else
delete mKOTodoViewWhatsThis;
#endif
delete mDocPrefs;
}
QString KOTodoView::getWhatsThisText(QPoint p)
{
KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
if ( item )
return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
@@ -852,65 +868,65 @@ void KOTodoView::updateView()
pendingSubtodo = 0;
if ( mBlockUpdate ) {
return;
}
if ( !isVisible() ) {
clearList ();
mPendingUpdateBeforeRepaint = true;
return;
}
//qDebug("KOTodoView::updateView() %x", this);
if ( isFlatDisplay ) {
displayAllFlat();
return;
}
//qDebug("update ");
// kdDebug() << "KOTodoView::updateView()" << endl;
QFont fo = KOPrefs::instance()->mTodoViewFont;
clearList ();
if ( mName == "todolistsmall" ) {
if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
int ps = fo.pointSize() -2;
if ( ps > 12 )
ps -= 2;
fo.setPointSize( ps );
}
}
mTodoListView->setFont( fo );
// QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
//mTodoListView->header()->setMaximumHeight(fm.height());
- QPtrList<Todo> todoList = calendar()->todos();
+ Q3PtrList<Todo> todoList = calendar()->todos();
/*
kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
Event *t;
for(t = todoList.first(); t; t = todoList.next()) {
kdDebug() << " " << t->getSummary() << endl;
if (t->getRelatedTo()) {
kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
}
QPtrList<Event> l = t->getRelations();
Event *c;
for(c=l.first();c;c=l.next()) {
kdDebug() << " - relation: " << c->getSummary() << endl;
}
}
*/
// Put for each Event a KOTodoViewItem in the list view. Don't rely on a
// specific order of events. That means that we have to generate parent items
// recursively for proper hierarchical display of Todos.
Todo *todo;
todo = todoList.first();// todo; todo = todoList.next()) {
while ( todo ) {
bool next = true;
// qDebug("todo %s ", todo->summary().latin1());
Incidence *incidence = todo->relatedTo();
while ( incidence ) {
if ( incidence->typeID() == todoID ) {
//qDebug("related %s ",incidence->summary().latin1() );
if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
@@ -1015,173 +1031,173 @@ void KOTodoView::resetCurrentItem()
}
processSelectionChange();
if ( mName != "todolistsmall" )
QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
}
void KOTodoView::resetFocusToList()
{
if ( mIsActiveWindow )
topLevelWidget()->setActiveWindow();
mTodoListView->setFocus();
}
//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
bool KOTodoView::checkTodo( Todo * todo )
{
if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
return false;
if ( !todo->isCompleted() ) {
if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
return true;
}
if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
if ( todo->hasStartDate() )
if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
return false;
if ( todo->hasDueDate() )
if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
return false;
}
return true;
}
-void KOTodoView::restoreItemState( QListViewItem *item )
+void KOTodoView::restoreItemState( Q3ListViewItem *item )
{
pendingSubtodo = 0;
while( item ) {
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) );
if( item->childCount() > 0 ) restoreItemState( item->firstChild() );
item = item->nextSibling();
}
}
QMap<Todo *,KOTodoViewItem *>::ConstIterator
KOTodoView::insertTodoItem(Todo *todo)
{
// kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl;
// TODO: Check, if dynmaic cast is necessary
pendingSubtodo = 0;
Incidence *incidence = todo->relatedTo();
while ( incidence && !incidence->calEnabled() )
incidence = incidence->relatedTo();
if (incidence && incidence->typeID() == todoID ) {
Todo *relatedTodo = static_cast<Todo *>(incidence);
// kdDebug() << " has Related" << endl;
QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator;
itemIterator = mTodoMap.find(relatedTodo);
if (itemIterator == mTodoMap.end()) {
// kdDebug() << " related not yet in list" << endl;
itemIterator = insertTodoItem (relatedTodo);
}
// isn't this pretty stupid? We give one Todo to the KOTodoViewItem
// and one into the map. Sure finding is more easy but why? -zecke
KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this);
return mTodoMap.insert(todo,todoItem);
} else {
// kdDebug() << " no Related" << endl;
// see above -zecke
KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
return mTodoMap.insert(todo,todoItem);
}
}
void KOTodoView::updateConfig()
{
updateView();
mTodoListView->repaintContents();
}
-QPtrList<Incidence> KOTodoView::selectedIncidences()
+Q3PtrList<Incidence> KOTodoView::selectedIncidences()
{
- QPtrList<Incidence> selected;
+ Q3PtrList<Incidence> selected;
KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
// if (!item) item = mActiveItem;
if (item) selected.append(item->todo());
return selected;
}
-QPtrList<Todo> KOTodoView::selectedTodos()
+Q3PtrList<Todo> KOTodoView::selectedTodos()
{
- QPtrList<Todo> selected;
+ Q3PtrList<Todo> selected;
KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem());
// if (!item) item = mActiveItem;
if (item) selected.append(item->todo());
return selected;
}
void KOTodoView::changeEventDisplay(Event *, int)
{
updateView();
}
void KOTodoView::showDates(const QDate &, const QDate &)
{
}
-void KOTodoView::showEvents(QPtrList<Event>)
+void KOTodoView::showEvents(Q3PtrList<Event>)
{
kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl;
}
void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Todolist, fd, td);
#endif
}
-void KOTodoView::editItem(QListViewItem *item )
+void KOTodoView::editItem(Q3ListViewItem *item )
{
if ( item )
emit editTodoSignal(((KOTodoViewItem *)item)->todo());
}
-void KOTodoView::showItem(QListViewItem *item,const QPoint &,int)
+void KOTodoView::showItem(Q3ListViewItem *item,const QPoint &,int)
{
if ( item )
emit showTodoSignal(((KOTodoViewItem *)item)->todo());
}
-void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column)
+void KOTodoView::popupMenu(Q3ListViewItem *item,const QPoint &p,int column)
{
pendingSubtodo = 0;
mActiveItem = (KOTodoViewItem *)item;
if (item) {
switch (column){
case 1:
mPriorityPopupMenu->popup(QCursor::pos ()); break;
case 2:
mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break;
case 3:
moveTodo();
break;
case 7:
mCategoryPopupMenu->popup(QCursor::pos ()); break;
case 8:
mCalPopupMenu->popup(QCursor::pos ()); break;
default:
mItemPopupMenu->popup(QCursor::pos());
}
} else mPopupMenu->popup(QCursor::pos());
}
void KOTodoView::newTodo()
{
emit newTodoSignal();
}
void KOTodoView::newSubTodo()
{
mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
if (mActiveItem) {
if ( mQuickAdd->isVisible() && !mQuickAdd->text().isEmpty() && mQuickAdd->text() != i18n("Click to add new Todo") ) {
addQuickTodoPar( mActiveItem->todo());
@@ -1332,65 +1348,65 @@ void KOTodoView::changedCategories(int index)
if ( !colcat.isEmpty() ) {
if ( categories.find ( colcat ) != categories.end () ) {
categories.remove( colcat );
categories.prepend( colcat );
}
}
mActiveItem->todo()->setCategories (categories);
mActiveItem->construct();
mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
}
}
void KOTodoView::toggleRunningItemQuick()
{
if ( !mActiveItem ) return;
Todo * t = mActiveItem->todo();
if ( t->isRunning() ) {
if ( t->runTime() < 15) {
t->stopRunning();
mActiveItem->construct();
topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!"));
return;
}
else
toggleRunningItem();
return;
} else {
t->setRunning( true );
mActiveItem->construct();
topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!"));
}
}
-void KOTodoView::itemDoubleClicked(QListViewItem *item)
+void KOTodoView::itemDoubleClicked(Q3ListViewItem *item)
{
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
//int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
//qDebug("ROW %d ", row);
if (!item) {
newTodo();
return;
} else {
if ( row == 1 ) {
mActiveItem = (KOTodoViewItem *) item;
newSubTodo();
return;
}
if ( row == 5 || row == 6 || row == 2) {
mActiveItem = (KOTodoViewItem *) item;
toggleRunningItemQuick();
return;
}
}
if ( KOPrefs::instance()->mEditOnDoubleClick )
editItem( item );
else
showItem( item , QPoint(), 0 );
}
void KOTodoView::toggleRunningItem()
{
// qDebug("KOTodoView::toggleRunning() ");
if ( ! mActiveItem )
@@ -1399,106 +1415,106 @@ void KOTodoView::toggleRunningItem()
if ( t->isRunning() ) {
KOStopTodoPrefs tp ( t, this );
if (QApplication::desktop()->width() <= 800 ){
int wid = tp.width();
int hei = tp.height();
int xx = (QApplication::desktop()->width()-wid)/2;
int yy = (QApplication::desktop()->height()-hei)/2;
tp.setGeometry( xx,yy,wid,hei );
}
tp.exec();
updateTodo ( t, KOGlobals::EVENTEDITED );
} else {
KOStartTodoPrefs tp ( t->summary(), this );
if (QApplication::desktop()->width() <= 800 ){
int wid = tp.width();
int hei = tp.height();
int xx = (QApplication::desktop()->width()-wid)/2;
int yy = (QApplication::desktop()->height()-hei)/2;
tp.setGeometry( xx,yy,wid,hei );
}
if ( !tp.exec() ) return;
if ( tp.stopAll() ) {
mCalendar->stopAllTodos();
t->setRunning( true );
updateView();
} else {
t->setRunning( true );
updateTodo ( t, KOGlobals::EVENTEDITED );
}
}
}
-void KOTodoView::itemClicked(QListViewItem *item)
+void KOTodoView::itemClicked(Q3ListViewItem *item)
{
//qDebug("KOTodoView::itemClicked %d", item);
if (!item) {
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
return;
}
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
if ( pendingSubtodo != 0 ) {
bool allowReparent = true;
- QListViewItem *par = item;
+ Q3ListViewItem *par = item;
while ( par ) {
if ( par == pendingSubtodo ) {
allowReparent = false;
break;
}
par = par->parent();
}
if ( !allowReparent ) {
topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
pendingSubtodo = 0;
} else {
Todo* newParent = todoItem->todo();
Todo* newSub = pendingSubtodo->todo();
pendingSubtodo = 0;
emit reparentTodoSignal( newParent,newSub );
return;
}
}
}
void KOTodoView::setDocumentId( const QString &id )
{
mDocPrefs->setDoc( id );
}
-void KOTodoView::itemStateChanged( QListViewItem *item )
+void KOTodoView::itemStateChanged( Q3ListViewItem *item )
{
if (!item) return;
KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
}
void KOTodoView::saveLayout(KConfig *config, const QString &group) const
{
mTodoListView->saveLayout(config,group);
}
void KOTodoView::restoreLayout(KConfig *config, const QString &group)
{
mTodoListView->restoreLayout(config,group);
}
void KOTodoView::processSelectionChange()
{
// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
KOTodoViewItem *item =
static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
if ( !item ) {
emit incidenceSelected( 0 );
mNewSubBut->setEnabled( false );
} else {
emit incidenceSelected( item->todo() );
@@ -1513,86 +1529,86 @@ void KOTodoView::modified(bool b)
void KOTodoView::setTodoModified( Todo* todo )
{
todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
}
void KOTodoView::clearSelection()
{
mTodoListView->selectAll( false );
}
void KOTodoView::setAllOpen()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
} else {
storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), true);
resetCurrentItem();
}
void KOTodoView::setAllClose()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
} else {
storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), false);
resetCurrentItem();
}
-void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
+void KOTodoView::setOpen( Q3ListViewItem* item, bool setOpenI)
{
while ( item ) {
setOpen( item->firstChild(), setOpenI );
item->setOpen( setOpenI );
item = item->nextSibling();
}
}
void KOTodoView::displayAllFlat()
{
mActiveItem = 0;
pendingSubtodo = 0;
if ( mBlockUpdate ) {
return;
}
clearList ();
mPopupMenu->setItemChecked( 8,true );
isFlatDisplay = true;
- QPtrList<Todo> todoList = calendar()->todos();
+ Q3PtrList<Todo> todoList = calendar()->todos();
Todo *todo;
for(todo = todoList.first(); todo; todo = todoList.next()) {
if ( checkTodo( todo ) ) {
KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
mTodoMap.insert(todo,todoItem);
}
}
resetCurrentItem();
}
void KOTodoView::setAllFlat()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
return;
}
displayAllFlat();
}
void KOTodoView::purgeCompleted()
{
emit purgeCompletedSignal();
}
void KOTodoView::toggleQuickTodo()
{
if ( mQuickBar->isVisible() ) {
mQuickBar->hide();
KOPrefs::instance()->mEnableQuickTodo = false;
}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 0cbc087..a9e7f30 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -1,69 +1,79 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOTODOVIEW_H
#define KOTODOVIEW_H
#include <qfont.h>
#include <qfontmetrics.h>
#include <qlineedit.h>
-#include <qptrlist.h>
-#include <qstrlist.h>
-#include <qlistbox.h>
-#include <qpopupmenu.h>
+#include <q3ptrlist.h>
+#include <q3strlist.h>
+#include <q3listbox.h>
+#include <q3popupmenu.h>
#include <qlabel.h>
#include <qmap.h>
#include <qdialog.h>
#include <qlabel.h>
-#include <qlistview.h>
+#include <q3listview.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QDragLeaveEvent>
+#include <QWheelEvent>
+#include <QPaintEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QDragEnterEvent>
#include <klistview.h>
#include <libkcal/calendar.h>
#include <libkcal/todo.h>
#include <korganizer/baseview.h>
#include "kotodoviewitem.h"
#include "koprefs.h"
#include "koglobals.h"
#include "datenavigator.h"
class QDragEnterEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;
class KOTodoViewWhatsThis;
class KDateEdit;
class KOTimeEdit;
class DocPrefs;
class KOStopTodoPrefs : public QDialog
{
Q_OBJECT
public:
KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ;
private slots:
void doNotSave();
@@ -72,240 +82,240 @@ private:
Todo* mTodo;
QLineEdit* mComment;
QDateTime mStop;
KDateEdit *sde, *ede;
KOTimeEdit *ste, *ete;
};
class KOStartTodoPrefs : public QDialog
{
Q_OBJECT
public:
KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
bool stopAll() { return mStopAll; }
private slots:
void doStop();
private:
bool mStopAll;
};
class KOTodoListView : public KListView
{
Q_OBJECT
public:
KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
virtual ~KOTodoListView() {}
signals:
void paintNeeded();
void todoDropped(Todo *, int);
- void double_Clicked(QListViewItem *item);
+ void double_Clicked(Q3ListViewItem *item);
void reparentTodoSignal( Todo *,Todo * );
void unparentTodoSignal(Todo *);
void deleteTodo( Todo * );
protected:
void wheelEvent (QWheelEvent *e);
void contentsDragEnterEvent(QDragEnterEvent *);
void contentsDragMoveEvent(QDragMoveEvent *);
void contentsDragLeaveEvent(QDragLeaveEvent *);
void contentsDropEvent(QDropEvent *);
void contentsMousePressEvent(QMouseEvent *);
void contentsMouseMoveEvent(QMouseEvent *);
void contentsMouseReleaseEvent(QMouseEvent *);
void contentsMouseDoubleClickEvent(QMouseEvent *);
private:
void paintEvent(QPaintEvent * pevent);
bool internalDrop;
QString mName;
Calendar *mCalendar;
QPoint mPressPos;
bool mMousePressed;
- QListViewItem *mOldCurrent;
+ Q3ListViewItem *mOldCurrent;
bool mFlagKeyPressed;
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
};
/**
This is the line-edit on top of the todoview for fast addition of new todos
*/
class KOQuickTodo : public QLineEdit
{
public:
KOQuickTodo(QWidget *parent=0);
protected:
void focusInEvent(QFocusEvent *ev);
void focusOutEvent(QFocusEvent *ev);
};
/**
This class provides a multi-column list view of todo events.
@short multi-column list view of todo events.
@author Cornelius Schumacher <schumacher@kde.org>
*/
class KOTodoView : public KOrg::BaseView
{
Q_OBJECT
public:
KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
~KOTodoView();
- QPtrList<Incidence> selectedIncidences();
- QPtrList<Todo> selectedTodos();
+ Q3PtrList<Incidence> selectedIncidences();
+ Q3PtrList<Todo> selectedTodos();
DateList selectedDates()
{DateList q;
return q;}
/** Return number of shown dates. TodoView does not show dates, */
int currentDateCount() { return 0; }
void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
void setDocumentId( const QString & );
void saveLayout(KConfig *config, const QString &group) const;
void restoreLayout(KConfig *config, const QString &group);
void setNavigator( DateNavigator* nav ) {mNavigator = nav;}
QString getWhatsThisText(QPoint p);
void clearList( bool saveCurrentItem = true );
public slots:
void updateView();
void updateConfig();
void changeEventDisplay(Event *, int);
void showDates(const QDate &start, const QDate &end);
- void showEvents(QPtrList<Event> eventList);
+ void showEvents(Q3PtrList<Event> eventList);
void clearSelection();
void jumpToDate ();
- void editItem(QListViewItem *item);
- void showItem(QListViewItem *item,const QPoint &,int);
- void popupMenu(QListViewItem *item,const QPoint &,int);
+ void editItem(Q3ListViewItem *item);
+ void showItem(Q3ListViewItem *item,const QPoint &,int);
+ void popupMenu(Q3ListViewItem *item,const QPoint &,int);
void newTodo();
void newSubTodo();
void unparentTodo();
void reparentTodo();
void showTodo();
void editTodo();
void cloneTodo();
void cancelTodo();
void moveTodo();
void beamTodo();
void deleteTodo();
void setNewPriority(int);
void setNewPercentage(int);
void changedCategories(int);
void setAllOpen();
void setAllClose();
void setAllFlat();
void displayAllFlat();
void purgeCompleted();
void toggleCompleted();
void toggleRunning();
void toggleQuickTodo();
void updateTodo( Todo *, int );
- void itemClicked(QListViewItem *);
- void itemStateChanged(QListViewItem *);
+ void itemClicked(Q3ListViewItem *);
+ void itemStateChanged(Q3ListViewItem *);
void modified(bool);
- void itemDoubleClicked(QListViewItem *item);
+ void itemDoubleClicked(Q3ListViewItem *item);
void resetFocusToList();
void fillCategories ();
void fillCal ();
void changedCal (int);
signals:
void newTodoSignal();
void newSubTodoSignal(Todo *);
void unparentTodoSignal(Todo *);
void reparentTodoSignal( Todo *,Todo * );
void showTodoSignal(Todo *);
void editTodoSignal(Todo *);
void deleteTodoSignal(Todo *);
void todoModifiedSignal (Todo *, int);
void isModified(bool);
void cloneTodoSignal( Incidence * );
void cancelTodoSignal( Incidence * );
void moveTodoSignal( Incidence * );
void beamTodoSignal( Incidence * );
void purgeCompletedSignal();
protected slots:
void toggleRunningItem();
void toggleRunningItemQuick();
void paintNeeded();
void processSelectionChange();
void addQuickTodo();
void setTodoModified( Todo* );
void todoModified(Todo *, int );
private:
bool mIsActiveWindow;
void addQuickTodoPar( Todo * parentTodo);
/*
* the TodoEditor approach is rather unscaling in the long
* run.
* Korganizer keeps it in memory and we need to update
* 1. make KOTodoViewItem a QObject again?
* 2. add a public method for setting one todo modified?
* 3. add a private method for setting a todo modified + friend here?
* -- zecke 2002-07-08
*/
KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
friend class KOTodoListView;
void paintEvent(QPaintEvent * pevent);
bool mPendingUpdateBeforeRepaint;
friend class KOTodoViewItem;
QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
- void restoreItemState( QListViewItem * );
+ void restoreItemState( Q3ListViewItem * );
bool checkTodo( Todo * );
bool isFlatDisplay;
- void setOpen( QListViewItem*, bool setOpen);
+ void setOpen( Q3ListViewItem*, bool setOpen);
KOTodoListView *mTodoListView;
- QPopupMenu *mItemPopupMenu;
- QPopupMenu *mPopupMenu;
- QPopupMenu *mPriorityPopupMenu;
- QPopupMenu *mPercentageCompletedPopupMenu;
- QPopupMenu *mCategoryPopupMenu;
- QPopupMenu *mCalPopupMenu;
+ Q3PopupMenu *mItemPopupMenu;
+ Q3PopupMenu *mPopupMenu;
+ Q3PopupMenu *mPriorityPopupMenu;
+ Q3PopupMenu *mPercentageCompletedPopupMenu;
+ Q3PopupMenu *mCategoryPopupMenu;
+ Q3PopupMenu *mCalPopupMenu;
QMap<int, int> mPercentage;
QMap<int, int> mPriority;
QMap<int, QString> mCategory;
KOTodoViewItem *mActiveItem;
QMap<Todo *,KOTodoViewItem *> mTodoMap;
QString mName;
QWidget* mQuickBar;
DocPrefs *mDocPrefs;
QString mCurrentDoc;
KOQuickTodo *mQuickAdd;
bool mBlockUpdate;
void keyPressEvent ( QKeyEvent * ) ;
KOTodoViewItem * pendingSubtodo;
DateNavigator* mNavigator;
void storeCurrentItem();
void resetCurrentItem();
Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove;
QPushButton * mNewSubBut;
};
#endif
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 519bb16..c21816d 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -1,115 +1,119 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <klocale.h>
#include <kdebug.h>
-#include <qapp.h>
+#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPixmap>
#include <kglobal.h>
#include <kiconloader.h>
#include "kotodoviewitem.h"
#include "kotodoview.h"
#include "koprefs.h"
-KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
- : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
+KOTodoViewItem::KOTodoViewItem( Q3ListView *parent, Todo *todo, KOTodoView *kotodo)
+ : Q3CheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
{
construct();
}
KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo )
- : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
+ : Q3CheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
{
construct();
}
QString KOTodoViewItem::key(int column,bool) const
{
if ( column == 0 )
return text(0).lower();
if ( column == 1 ) {
if ( mTodo->isCompleted() ) {
return "6"+QString::number(mTodo->priority())+text(0).lower();
}
return QString::number(mTodo->priority())+text(0).lower();
}
QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
if (it == mKeyMap.end()) {
return text(column).lower();
} else {
if ( column == 2 ) {
return *it+text(0).lower();
}
return *it;
}
}
void KOTodoViewItem:: setup()
{
int h = 20;
if ( listView () ) {
QFontMetrics fm ( listView ()->font () );
h = fm.height();
}
setHeight( h );
}
void KOTodoViewItem::setSortKey(int column,const QString &key)
{
mKeyMap.insert(column,key);
}
#if QT_VERSION >= 0x030000
void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w,
int y,int h)
{
- QListViewItem::paintBranches(p,cg,w,y,h);
+ Q3ListViewItem::paintBranches(p,cg,w,y,h);
}
#else
#endif
void KOTodoViewItem::construct()
{
// qDebug("KOTodoViewItem::construct() ");
m_init = true;
QString keyd = "==";
QString keyt = "==";
QString skeyd = "==";
QString skeyt = "==";
setOn(mTodo->isCompleted());
setText(0,mTodo->summary());
setText(1,QString::number(mTodo->priority()));
setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
if (mTodo->percentComplete()<100) {
setSortKey(2,QString::number(mTodo->percentComplete()));
}
else {
setSortKey(2,"999");
}
if (mTodo->hasDueDate()) {
setText(3, mTodo->dtDueDateStr());
QDate d = mTodo->dtDue().date();
keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
// setSortKey(3,keyd);
if (mTodo->doesFloat()) {
setText(4,"");
}
else {
@@ -287,137 +291,137 @@ void KOTodoViewItem::stateChange(bool state)
if (mTodo->hasStartDate()) {
QString skeyt = "==";
QString skeyd = "==";
setText(5, mTodo->dtStartDateStr());
QDate d = mTodo->dtStart().date();
skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
if (mTodo->doesFloat()) {
setText(6,"");
}
else {
setText(6,mTodo->dtStartTimeStr());
QTime t = mTodo->dtStart().time();
skeyt.sprintf("%02d%02d",t.hour(),t.minute());
}
setSortKey(5,skeyd);
setSortKey(6,skeyt);
}
if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));
if (mTodo->percentComplete()<100) {
if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
else setSortKey(2,QString::number(mTodo->percentComplete()));
}
else {
if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
else setSortKey(2,QString::number(99));
}
if ( state ) {
- QListViewItem * myChild = firstChild();
+ Q3ListViewItem * myChild = firstChild();
KOTodoViewItem *item;
while( myChild ) {
//qDebug("stateCH ");
item = static_cast<KOTodoViewItem*>(myChild);
item->stateChange(state);
myChild = myChild->nextSibling();
}
} else {
- QListViewItem * myChild = parent();
+ Q3ListViewItem * myChild = parent();
if ( myChild )
(static_cast<KOTodoViewItem*>(myChild))->stateChange(state);
}
mTodoView->modified(true);
setMyPixmap();
mTodoView->setTodoModified( mTodo );
}
bool KOTodoViewItem::isAlternate()
{
#if 0
//if ( m_known ) return m_odd;
//qDebug("test ");
KOTodoViewItem *item = static_cast<KOTodoViewItem *>(itemAbove());
if ( item ) {
m_known = item->m_known;
if ( m_known ) {
m_odd = !item->m_odd ;
return m_odd;
}
} else {
item = static_cast<KOTodoViewItem *>(itemBelow());
if ( item ) {
m_known = item->m_known;
if ( m_known ) {
m_odd = !item->m_odd ;
return m_odd;
}
}
}
KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
item = static_cast<KOTodoViewItem *>(lv->firstChild());
bool previous = true;
qDebug("WHILE ");
while ( item ) {
item->m_odd = !previous;
item->m_known = true;
previous = !previous;
item = static_cast<KOTodoViewItem *>(item->itemBelow());
}
return m_odd;
#else
//KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
//if (lv && lv->alternateBackground().isValid())
{
KOTodoViewItem *above = static_cast<KOTodoViewItem *>(itemAbove());
m_known = above ? above->m_known : true;
if (m_known)
{
m_odd = above ? !above->m_odd : false;
}
else
{
KOTodoViewItem *item;
bool previous = true;
- if (QListViewItem::parent())
+ if (Q3ListViewItem::parent())
{
- item = static_cast<KOTodoViewItem *>(QListViewItem::parent());
+ item = static_cast<KOTodoViewItem *>(Q3ListViewItem::parent());
if (item)
previous = item->m_odd;
- item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
+ item = static_cast<KOTodoViewItem *>(Q3ListViewItem::parent()->firstChild());
}
else
{
KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
item = static_cast<KOTodoViewItem *>(lv->firstChild());
}
while(item)
{
item->m_odd = previous = !previous;
item->m_known = true;
item = static_cast<KOTodoViewItem *>(item->nextSibling());
}
}
return m_odd;
}
return false;
#endif
}
void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
{
QColorGroup _cg = cg;
QColorGroup::ColorRole role;
if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning())
role = QColorGroup::Text;
else
role = QColorGroup::Base;
//#ifndef KORG_NOLVALTERNATION
if (isAlternate())
_cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
@@ -447,133 +451,133 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
int odue = mTodo->hasDueSubTodo( openMode );
if (odue == 2) {
colorToSet = KOPrefs::instance()->mTodoOverdueColor;
setColor = true;
} else if ( odue == 1 ) {
colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
setColor = true;
}
}
if ( setColor ) {
_cg.setColor(role,colorToSet );
if ( role == QColorGroup::Base) {
int rgb = colorToSet.red();
rgb += colorToSet.blue()/2;
rgb += colorToSet.green();
if ( rgb < 200 )
_cg.setColor(QColorGroup::Text,Qt::white );
}
}
//#endif
if ( column > 0 ){
if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
p->save();
int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
p->fillRect( 0, 0, width, height(), _cg.base() ); // background
// p->setPen(Qt::black ); //border
// p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
QColor fc = KOPrefs::instance()->mHighlightColor;
if ( mTodo->percentComplete() == 100 )
- fc = darkGreen;
+ fc = Qt::darkGreen;
p->drawRect( 2, 2, width-4, height()-4);
p->fillRect( 3, 3, progress, height()-6,
fc );
p->restore();
} else {
- QCheckListItem::paintCell(p, _cg, column, width, alignment);
+ Q3CheckListItem::paintCell(p, _cg, column, width, alignment);
}
return;
}
int align = alignment;
if ( !p )
return;
p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
- QListView *lv = listView();
+ Q3ListView *lv = listView();
if ( !lv )
return;
int marg = 2;//lv->itemMargin();
int r = 0;
- QCheckListItem::Type myType = QCheckListItem::CheckBox;
+ Q3CheckListItem::Type myType = Q3CheckListItem::CheckBox;
int BoxSize = 20;
int boxOffset = 2;
int xOffset = 2;
if (qApp->desktop()->width() < 300 ) {
BoxSize = 14;
boxOffset = -1;
xOffset = 1;
// marg = 0;
}
if ( height() < BoxSize ) {
boxOffset = boxOffset - ((BoxSize - height())/2) ;
// qDebug("boxOffset %d height %d", boxOffset, height() );
BoxSize = height();
}
//bool winStyle = lv->style() == WindowsStyle;
int lineStart = 5;
if ( myType == Controller ) {
if ( !pixmap( 0 ) )
r += BoxSize + 4;
} else {
- ASSERT( lv ); //###
+ Q_ASSERT( lv ); //###
// QFontMetrics fm( lv->font() );
// int d = fm.height();
int x = 0;
int y = (height() - BoxSize) / 2;
// p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) );
if ( myType == CheckBox ) {
if ( isEnabled() )
p->setPen( QPen( _cg.text(), 1 ) );
else
p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) );
p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 );
lineStart = x+marg;
/////////////////////
x++;
y++;
if ( isOn() ) {
- QPointArray a( 7*2 );
+ Q3PointArray a( 7*2 );
int i, xx, yy;
xx = x+xOffset+marg+(boxOffset/2);
yy = y+5+boxOffset;
for ( i=0; i<3; i++ ) {
a.setPoint( 2*i, xx, yy );
a.setPoint( 2*i+1, xx, yy+2 );
// qDebug(" ");
xx++; yy++;
}
yy -= 2;
for ( i=3; i<7; i++ ) {
a.setPoint( 2*i, xx, yy );
a.setPoint( 2*i+1, xx, yy+2 );
xx++; yy--;
}
- p->setPen( darkGreen );
+ p->setPen( Qt::darkGreen );
p->drawLineSegments( a );
}
////////////////////////
}
r += BoxSize + 4;
}
p->translate( r, 0 );
p->setPen( QPen( _cg.text() ) );
- QListViewItem::paintCell( p, _cg, column, width - r, align );
+ Q3ListViewItem::paintCell( p, _cg, column, width - r, align );
if ( mTodo->cancelled () ) {
- p->setPen( black );
+ p->setPen( Qt::black );
QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() );
int wid = br.width() +lineStart;
if ( wid > width-3 )
wid = width-3;
p->drawLine( lineStart, height()/2+1, wid, height()/2+1 );
}
}
diff --git a/korganizer/kotodoviewitem.h b/korganizer/kotodoviewitem.h
index bd024c8..62a635c 100644
--- a/korganizer/kotodoviewitem.h
+++ b/korganizer/kotodoviewitem.h
@@ -1,89 +1,89 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOTODOVIEWITEM_H
#define KOTODOVIEWITEM_H
#include <qfont.h>
#include <qfontmetrics.h>
#include <qlineedit.h>
-#include <qptrlist.h>
-#include <qstrlist.h>
-#include <qlistbox.h>
-#include <qpopupmenu.h>
+#include <q3ptrlist.h>
+#include <q3strlist.h>
+#include <q3listbox.h>
+#include <q3popupmenu.h>
#include <qlabel.h>
#include <qmap.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpainter.h>
#include <libkcal/calendar.h>
#include <libkcal/todo.h>
using namespace KCal;
class KOTodoView;
/**
This class provides a way of displaying a single Event of Todo-Type in a
KTodoView.
@author Cornelius Schumacher <schumacher@kde.org>
@see KOTodoView
*/
-class KOTodoViewItem : public QCheckListItem
+class KOTodoViewItem : public Q3CheckListItem
{
public:
/**
Constructor.
@param parent is the list view to which this item belongs.
@param ev is the event to have the item display information for.
*/
- KOTodoViewItem(QListView *parent, Todo *todo, KOTodoView *kotodo);
+ KOTodoViewItem(Q3ListView *parent, Todo *todo, KOTodoView *kotodo);
KOTodoViewItem(KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo);
//~KOTodoViewItem() { qDebug("~KOTodoViewItem() %s ", text(0).latin1() );}
void construct();
Todo *todo() { return mTodo; }
QString key(int, bool) const;
void setSortKey(int column,const QString &key);
bool isAlternate();
virtual void paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int alignment);
virtual void setup();
protected:
#if QT_VERSION >= 0x030000
void paintBranches(QPainter *p,const QColorGroup & cg,int w,int y,int h);
#else
#endif
virtual void stateChange(bool);
void setMyPixmap();
private:
Todo *mTodo;
KOTodoView *mTodoView;
QMap<int,QString> mKeyMap;
uint m_odd : 1;
uint m_known : 1;
uint m_unused : 30;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 4057ae0..07c4295 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -1,58 +1,60 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001
Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <kconfig.h>
#include <kglobal.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
#endif
#include <qdatetime.h>
#include "calendarview.h"
#include "datenavigator.h"
#include "kotodoview.h"
#include "koagendaview.h"
#include "kodialogmanager.h"
#include "komonthview.h"
#include "kolistview.h"
#include "kowhatsnextview.h"
#include "kojournalview.h"
#include "kotimespanview.h"
#include "koprefs.h"
#include "navigatorbar.h"
#include "kdatenavigator.h"
#include "koviewmanager.h"
//extern bool externFlagMonthviewBlockPainting;
//bool globalFlagBlockPainting = false;
int globalFlagBlockAgenda = 0;
int globalFlagBlockLabel = 0;
int globalFlagBlockAgendaItemPaint = 1;
int globalFlagBlockAgendaItemUpdate = 1;
@@ -428,66 +430,66 @@ void KOViewManager::showWhatsNextView()
void KOViewManager::slotprintWNV()
{
if (!mWhatsNextView)
showWhatsNextView();
emit printWNV();
}
void KOViewManager::showListView()
{
if (!mListView) {
mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
addView(mListView);
connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
mMainView, SLOT(showIncidence(Incidence *)));
connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
mMainView, SLOT(editIncidence(Incidence *)));
connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
mMainView, SLOT(deleteIncidence(Incidence *)));
connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
connect( mListView, SIGNAL( signalNewEvent() ),
mMainView, SLOT( newEvent() ) );
connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( moveIncidence( Incidence * ) ) );
connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
mMainView, SLOT ( beamIncidence( Incidence * ) ) );
- connect( mListView, SIGNAL( beamIncidenceList( QPtrList<Incidence> ) ),
- mMainView, SLOT ( beamIncidenceList( QPtrList<Incidence> ) ) );
+ connect( mListView, SIGNAL( beamIncidenceList( Q3PtrList<Incidence> ) ),
+ mMainView, SLOT ( beamIncidenceList( Q3PtrList<Incidence> ) ) );
}
// bool temp = mFlagShowNextxDays;
//globalFlagBlockPainting = true;
globalFlagBlockAgenda = 1;
if ( KOPrefs::instance()->mListViewMonthTimespan ) {
mMainView->setBlockShowDates( true );
mMainView->dateNavigator()->selectMonth();
mMainView->setBlockShowDates( false );
}
KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
showView(mListView, KOPrefs::instance()->mFullViewTodo);
//mFlagShowNextxDays = temp;
KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
mMainView->setScrollBarStep( 7 );
}
void KOViewManager::showAgendaView( bool fullScreen )
{
mMainView->dialogManager()->hideSearchDialog();
// qDebug("KOViewManager::showAgendaView ");
bool full;
full = fullScreen;
if (!mAgendaView) {
full = false;
mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
addView(mAgendaView);
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
#endif
connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index f88403c..bfe930f 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -1,181 +1,187 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qtextcodec.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#ifdef DESKTOP_VERSION
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
+//Added by qt3to4:
+#include <Q3PtrList>
+#include <QHideEvent>
+#include <Q3VBoxLayout>
+#include <QShowEvent>
#endif
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <libkcal/calendar.h>
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "koglobals.h"
#include "koprefs.h"
#include "koeventviewerdialog.h"
#include "koeventviewer.h"
-#include <qstylesheet.h>
+#include <q3stylesheet.h>
#include "kowhatsnextview.h"
using namespace KOrg;
void WhatsNextTextBrowser::setSource(const QString& n)
{
if (n.startsWith("event:")) {
emit showIncidence(n);
return;
} else if (n.startsWith("todo:")) {
emit showIncidence(n);
return;
} else {
- QTextBrowser::setSource(n);
+ Q3TextBrowser::setSource(n);
}
}
void WhatsNextTextBrowser::printMe()
{
#ifdef DESKTOP_VERSION
KOPrintPrefs pp ( this );
if (!pp.exec() )
return;
int scaleval = pp.printMode() ;
QPrinter printer;
if (!printer.setup() )
return;
QPainter p;
p.begin ( &printer );
- QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer );
float dx, dy;
int wid = (m.width() * 9)/10;
dx = (float) wid/(float)contentsWidth ();
dy = (float)(m.height()) / (float)contentsHeight ();
float scale;
// scale to fit the width or height of the paper
if ( dx < dy )
scale = dx;
else
scale = dy;
p.translate( m.width()/10,0 );
if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
p.scale( scale, scale );
}
drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
p.end();
#endif
}
KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
const char *name)
: KOrg::BaseView(calendar, parent, name)
{
// mDateLabel =
// new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
// mDateLabel->setMargin(2);
// mDateLabel->setAlignment(AlignCenter);
setFont( KOPrefs::instance()->mWhatsNextFont );
mView = new WhatsNextTextBrowser(this);
connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
- QStyleSheet* stsh = mView->styleSheet();
- QStyleSheetItem * style ;
+ Q3StyleSheet* stsh = mView->styleSheet();
+ Q3StyleSheetItem * style ;
style = stsh->item ("h2" );
if ( style ) {
- style->setMargin(QStyleSheetItem::MarginAll,0);
+ style->setMargin(Q3StyleSheetItem::MarginAll,0);
}
style = stsh->item ("h3" );
if ( style ) {
- style->setMargin(QStyleSheetItem::MarginAll,0);
+ style->setMargin(Q3StyleSheetItem::MarginAll,0);
}
mEventViewer = 0;
- QBoxLayout *topLayout = new QVBoxLayout(this);
+ Q3BoxLayout *topLayout = new Q3VBoxLayout(this);
// topLayout->addWidget(mDateLabel);
topLayout->addWidget(mView);
mTimer = new QTimer( this );
connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
}
KOWhatsNextView::~KOWhatsNextView()
{
}
int KOWhatsNextView::maxDatesHint()
{
return 0;
}
int KOWhatsNextView::currentDateCount()
{
return 0;
}
void KOWhatsNextView::clearList()
{
mTimer->stop();
mView->setText(" ");
}
-QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
+Q3PtrList<Incidence> KOWhatsNextView::selectedIncidences()
{
- QPtrList<Incidence> eventList;
+ Q3PtrList<Incidence> eventList;
return eventList;
}
void KOWhatsNextView::printMe()
{
#ifdef DESKTOP_VERSION
mView->printMe();
#endif
}
void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Day, fd, td);
#endif
}
void KOWhatsNextView::updateConfig()
{
setFont( KOPrefs::instance()->mWhatsNextFont );
updateView();
}
void KOWhatsNextView::showEvent ( QShowEvent * e )
{
//qDebug("KOWhatsNextView::showEvent ");
restartTimer();
QWidget::showEvent ( e );
}
void KOWhatsNextView::hideEvent ( QHideEvent * e)
{
//qDebug(" KOWhatsNextView::hideEvent");
@@ -190,66 +196,66 @@ void KOWhatsNextView::restartTimer()
}
void KOWhatsNextView::updateView()
{
//qDebug("KOWhatsNextView::updateView() ");
if ( mTimer->isActive() )
restartTimer();
mCurrentMaxPrio = 5;
//qDebug("KOWhatsNextView::updateView() ");
// mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
KIconLoader kil("korganizer");
QString ipath;// = new QString();
// kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
//<big><big><strong>" + date + "</strong></big></big>\n";
mText = "<table width=\"100%\">\n";
//mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
#ifdef DESKTOP_VERSION
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
#else
mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
#endif
// mText += "<img src=\"";
// mText += ipath;
// mText += "\">";
mEventDate = QDate::currentDate();
#ifdef DESKTOP_VERSION
mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>";
#else
mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>";
#endif
mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
int iii;
mTodos.clear();
- QPtrList<Event> events;
- QPtrList<Todo> todos = calendar()->todos();
+ Q3PtrList<Event> events;
+ Q3PtrList<Todo> todos = calendar()->todos();
Todo * todo;
//mText += "<h2>" + i18n("Events: ") + "</h2>\n";
int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
bool itemAdded = false;
for ( iii = 0; iii < daysToShow; ++iii ) {
QString date;
itemAdded = false;
events = calendar()->events( mEventDate, true );
if ( iii == 0 ) { // today !!!
todo = todos.first();
while(todo) {
if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
if ( ! itemAdded ) {
appendDay ( iii, mEventDate );
//itemAdded = true;
} //bool reply=false, bool notRed = true, bool appendTable = false);
appendEvent(todo, false, false, !itemAdded );
itemAdded = true;
}
todo = todos.next();
}
}
if (events.count() > 0) {
// mText += "<p></p>";
// kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
// mText += "<h2>";
//mText += " <img src=\"";
//mText += ipath;
@@ -425,65 +431,65 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate )
} else {
if ( i == 0 ) {
//mText += "<table>\n";
return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
}
#ifdef DESKTOP_VERSION
else if ( i == 1 ) {
date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
}
else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>";
#else
else if ( i == 1 ) {
date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
}
else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>";
#endif
mText += "<h2>" + date + "</h2>\n";
//mText += "<big><big><strong>" + date + "</strong></big></big>\n";
mText += "<table>\n";
}
}
void KOWhatsNextView::showDates(const QDate &, const QDate &)
{
updateView();
}
-void KOWhatsNextView::showEvents(QPtrList<Event>)
+void KOWhatsNextView::showEvents(Q3PtrList<Event>)
{
}
void KOWhatsNextView::changeEventDisplay(Event *, int action)
{
switch(action) {
case KOGlobals::EVENTADDED:
updateView();
break;
case KOGlobals::EVENTEDITED:
updateView();
break;
case KOGlobals::EVENTDELETED:
updateView();
break;
default:
updateView();
kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
}
}
bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
{
if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
return false;
QDateTime cdt = QDateTime::currentDateTime();
QDateTime noc;
QString tempText;
if ( appendTable && !notRed ) {
tempText = "<table>";
}
bool ok = true;
@@ -712,65 +718,65 @@ bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
if ( needClose )
mText += "] ";
if ( ev->cancelled() )
mText += "</font>";
mText += "<a href=\"todo:" + ev->uid() + "\">";
if ( ev->summary().length() > 0 )
mText += ev->summary();
else
mText += i18n("-no summary-");
mText += "</a>";
if ( ((Todo*)ev)->hasDueDate () ) {
QString year = "";
int ye = ((Todo*)ev)->dtDue().date().year();
if ( QDateTime::currentDateTime().date().year() != ye )
year = QString::number( ye );
QString dfs = KGlobal::locale()->dateFormatShort();
KGlobal::locale()->setDateFormatShort("%d.%b");
mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>";
KGlobal::locale()->setDateFormatShort(dfs);
}
if ( KOPrefs::instance()->mWNViewShowLocation )
if ( !ev->location().isEmpty() )
mText += " ("+ev->location() +")";
if ( !isSub ) {
if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents)
mText += " ["+ev->relatedTo()->summary() +"]";
mText += "</p>\n";
}
else {
ind += "-";
mText += "</li>\n";
}
- QPtrList<Incidence> Relations = ev->relations();
+ Q3PtrList<Incidence> Relations = ev->relations();
Incidence *to;
for (to=Relations.first();to;to=Relations.next()) {
if (!((Todo*)to)->isCompleted() && ((Todo*)to)->priority() <= mCurrentMaxPrio )
appendTodo( to, ind , true );
}
return true;
}
/*
void KOWhatsNextView::createEventViewer()
{
if (!mEventViewer) {
mEventViewer = new KOEventViewerDialog(this);
}
}
*/
void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v )
{
mEventViewer = v;
}
// TODO: Create this function in CalendarView and remove it from here
void KOWhatsNextView::showIncidence(const QString &uid)
{
if ( !mEventViewer ) {
qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set ");
return;
}
//kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl;
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 93574ef..49fc448 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -1,102 +1,108 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef KOWHATSNEXTVIEW_H
#define KOWHATSNEXTVIEW_H
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <QShowEvent>
+#include <QHideEvent>
+#include <QLabel>
+#include <Q3ValueList>
+#include <Q3PtrList>
#include <korganizer/baseview.h>
-class QListView;
+class Q3ListView;
class QLabel;
class KOEventViewerDialog;
#include <qpainter.h>
#include <qwidget.h>
-class WhatsNextTextBrowser : public QTextBrowser {
+class WhatsNextTextBrowser : public Q3TextBrowser {
Q_OBJECT
public:
- WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
+ WhatsNextTextBrowser(QWidget *parent) : Q3TextBrowser(parent) {};
void setSource(const QString &);
void printMe();
signals:
void showIncidence(const QString &uid);
};
/**
This class provides a view of the next events and todos
*/
class KOWhatsNextView : public KOrg::BaseView
{
Q_OBJECT
public:
KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
const char *name = 0);
~KOWhatsNextView();
virtual int maxDatesHint();
virtual int currentDateCount();
void setEventViewer(KOEventViewerDialog* v );
- virtual QPtrList<Incidence> selectedIncidences();
+ virtual Q3PtrList<Incidence> selectedIncidences();
void clearList();
DateList selectedDates()
{DateList q;
return q;}
virtual void printPreview(CalPrinter *calPrinter,
const QDate &, const QDate &);
public slots:
virtual void updateView();
void printMe();
virtual void showDates(const QDate &start, const QDate &end);
- virtual void showEvents(QPtrList<Event> eventList);
+ virtual void showEvents(Q3PtrList<Event> eventList);
void updateConfig();
void changeEventDisplay(Event *, int);
protected:
bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false);
bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
void appendDay( int i, QDate date );
QDate mEventDate;
virtual void showEvent ( QShowEvent * );
virtual void hideEvent ( QHideEvent * );
private slots:
void showIncidence(const QString &);
void restartTimer();
private:
int mCurrentMaxPrio;
//void createEventViewer();
QTimer* mTimer;
WhatsNextTextBrowser *mView;
QString mText;
// QLabel *mDateLabel;
KOEventViewerDialog *mEventViewer;
- QValueList<Incidence *> mTodos;
+ Q3ValueList<Incidence *> mTodos;
};
#endif
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index df9b2fc..e2ae4a6 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -1,104 +1,107 @@
/*
This file is part of KOrganizer.
Copyright (c) 1999 Preston Brown, Ian Dawes
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qkeycode.h>
+#include <qnamespace.h>
#include <qcombobox.h>
#include <qdatetime.h>
#include <qlineedit.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QKeyEvent>
#include <kmessagebox.h>
#include <kglobal.h>
#include <kdebug.h>
#include <klocale.h>
#include <kpimglobalprefs.h>
#include "ktimeedit.h"
#include "koprefs.h"
#include <qvalidator.h>
// Validator for a time value with only hours and minutes (no seconds)
// Mostly locale aware. Author: David Faure <faure@kde.org>
// KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox.
// Difficult to get all in one...
// But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help.
KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
- : QComboBox(TRUE, parent, name)
+ : Q3ComboBox(TRUE, parent, name)
{
setInsertionPolicy(NoInsertion);
mFlagKeyPressed = false;
if ( QApplication::desktop()->height() <= 480 ) {
setSizeLimit ( 6 );
} else {
setSizeLimit ( 12 );
}
mTime = qt;
// mNoTimeString = i18n("No Time");
// insertItem( mNoTimeString );
// Fill combo box with selection of times in localized format.
QTime timeEntry(0,0,0);
do {
insertItem(KGlobal::locale()->formatTime(timeEntry));
timeEntry = timeEntry.addSecs(60*15);
- } while (!timeEntry.isNull());
+ } while ( !( timeEntry.hour() || timeEntry.minute() ) );
// Add end of day.
insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
updateText();
- setFocusPolicy(QWidget::StrongFocus);
+ setFocusPolicy(Qt::StrongFocus);
connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int)));
connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText()));
QFontMetrics fm ( font() );
QString timeString = "24:00";
if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 )
timeString = "02:00pm";
int addSpace = 32;
if ( QApplication::desktop()->width() > 320 )
timeString += ":00";
setFixedWidth(fm.width( timeString ) + 32 );
// Highlight Background and Textcolor change from default
QPalette palette = QWidget::palette();
unsigned char red, green, blue;
red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
setPalette( palette );
}
KOTimeEdit::~KOTimeEdit()
{
}
bool KOTimeEdit::hasTime() const
{
// Can't happen
if ( currentText().isEmpty() ) return false;
@@ -179,288 +182,288 @@ void KOTimeEdit::subTime(QTime qt, bool update)
// qDebug("focusInEvent ( QFocusEvent * ) ");
// }
void KOTimeEdit::keyReleaseEvent(QKeyEvent *e)
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
}
}
void KOTimeEdit::setSelect( int from, int to )
{
if ( KOPrefs::instance()->mHightlightDateTimeEdit)
lineEdit()->setSelection( from , to );
}
void KOTimeEdit::keyPressEvent(QKeyEvent *e)
{
qApp->processEvents();
bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 );
int maxpos = hour12Format?7:5;
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->ignore();
// qDebug(" ignore %d",e->isAutoRepeat() );
return;
}
if (! e->isAutoRepeat() ) {
mFlagKeyPressed = true;
}
// Tap -> Focus Next Widget
- if ( e->key() == Key_Tab ) {
- QComboBox::keyPressEvent(e);
+ if ( e->key() == Qt::Key_Tab ) {
+ Q3ComboBox::keyPressEvent(e);
return;
}
// save Text from QLineEdit and CursorPosition
QString text = lineEdit()->text();
int cpos = lineEdit()->cursorPosition();
// qDebug("cpos %d ", cpos);
// Switch for arrows, backspace and escape
switch(e->key()) {
- case Key_Escape:
+ case Qt::Key_Escape:
lineEdit()->deselect();
- case Key_Tab:
- QComboBox::keyPressEvent(e);
+ case Qt::Key_Tab:
+ Q3ComboBox::keyPressEvent(e);
break;
- case Key_Up:
+ case Qt::Key_Up:
if ( e->state () == Qt::ControlButton ) {
addTime(QTime(0,15,0), false );
lineEdit()->setCursorPosition(3);
setSelect( 3 , 2 );
}
else
if ( e->state () == Qt::ShiftButton ) {
addTime(QTime(1,0,0), false );
lineEdit()->setCursorPosition(0);
setSelect( 0 , 2 );
}
else
// switch time up, cursor location depend
switch (cpos) {
case 7:
case 6:
case 5:
if(!hour12Format) {
lineEdit()->setCursorPosition(cpos = 4);
} else {
addTime(QTime(12,0,0), false );
setSelect ( 5 , 2 );
break;
}
case 4:
addTime(QTime(0,1,0), false );
setSelect ( cpos , 1 );
break;
case 3:
addTime(QTime(0,10,0), false );
setSelect ( cpos , 1 );
break;
case 2:
lineEdit()->setCursorPosition(--cpos);
case 1:
case 0:
addTime(QTime(1,0,0), false );
setSelect ( 0, 2 );
break;
}
break;
- case Key_Down:
+ case Qt::Key_Down:
if ( e->state () == Qt::ControlButton ) {
subTime(QTime(0,15,0), false );
lineEdit()->setCursorPosition(3);
setSelect( 3 , 2 );
}
else
if ( e->state () == Qt::ShiftButton ) {
subTime(QTime(1,0,0), false );
lineEdit()->setCursorPosition(0);
setSelect( 0 , 2 );
}
else
// switch time down, cursor location depend
switch (cpos) {
case 7:
case 6:
case 5:
if(!hour12Format) {
lineEdit()->setCursorPosition(cpos = 4);
} else {
subTime(QTime(12,0,0), false );
setSelect ( 5 , 2 );
break;
}
case 4:
subTime(QTime(0,1,0), false );
setSelect ( cpos , 1 );
break;
case 3:
subTime(QTime(0,10,0), false );
setSelect ( cpos , 1 );
break;
case 2:
lineEdit()->setCursorPosition(--cpos);
case 1:
case 0:
subTime(QTime(1,0,0), false );
setSelect ( 0 , 2 );
break;
}
break;
// set cursor to correct place
- case Key_Left:
+ case Qt::Key_Left:
if ( cpos == 3 )
--cpos;
if ( cpos > 0) {
lineEdit()->setCursorPosition(--cpos);
setSelect ( cpos , 1 );
}
else
setSelect ( 0 , 1 );
break;
// set cursor to correct place
- case Key_Right:
+ case Qt::Key_Right:
if ( cpos == 1 )
++cpos;
if ( cpos < maxpos ) {
lineEdit()->setCursorPosition(++cpos);
setSelect ( cpos , 1 );
}
break;
// rest
- case Key_Prior:
+ case Qt::Key_Prior:
subTime(QTime(1,0,0));
break;
- case Key_Next:
+ case Qt::Key_Next:
addTime(QTime(1,0,0));
break;
- case Key_Backspace:
+ case Qt::Key_Backspace:
if ( cpos > 0) {
if ( cpos == 3 )
--cpos;
if ( cpos > 5)
cpos = 5;
- text.at( cpos-1 ) = '0';
+ text[ cpos-1 ] = '0';
lineEdit()->setText( text );
lineEdit()->setCursorPosition(--cpos);
setSelect ( cpos , 1 );
changedText();
}
break;
} // switch arrows
// if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos
- if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) {
+ if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Qt::Key_Left ) {
lineEdit()->deselect();
cpos = 0;
lineEdit()->setCursorPosition(cpos);
setSelect(cpos , 1);
}
if ( cpos == 2 ) {
lineEdit()->setCursorPosition(++cpos);
}
// num keys when cursorPos preEnd
if ( cpos < 5 ) {
// switch another keys
switch(e->key()) {
- case Key_Delete:
- text.at( cpos ) = '0';
+ case Qt::Key_Delete:
+ text[ cpos ] = '0';
lineEdit()->setText( text );
lineEdit()->setCursorPosition(cpos);
setSelect ( cpos , 1 );
changedText();
break;
- case Key_9:
- case Key_8:
- case Key_7:
- case Key_6:
+ case Qt::Key_9:
+ case Qt::Key_8:
+ case Qt::Key_7:
+ case Qt::Key_6:
if ( !(cpos == 1 || cpos == 4) )
return;
if ( cpos == 1 && text.at( 0 ) > '1')
- text.at( 0 ) = '1';
- case Key_5:
- case Key_4:
- case Key_3:
+ text[ 0 ] = '1';
+ case Qt::Key_5:
+ case Qt::Key_4:
+ case Qt::Key_3:
if ( cpos < 1 )
return;
if ( hour12Format && cpos == 1 )
return;
- case Key_2:
+ case Qt::Key_2:
if ( hour12Format && cpos == 0 )
return;
if ( cpos == 0 && text.at( 1 ) > '3')
- text.at( 1 ) = '3';
- case Key_1:
- case Key_0:
+ text[ 1 ] = '3';
+ case Qt::Key_1:
+ case Qt::Key_0:
if ( hour12Format ) {
- if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' )
+ if ( e->key() == Qt::Key_0 && cpos == 1 && text.at( 0 ) == '0' )
return;
- if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' )
- text.at( 1 ) = '1';
+ if ( e->key() == Qt::Key_0 && cpos == 0 && text.at( 1 ) == '0' )
+ text[ 1 ] = '1';
}
- text.at( cpos ) = QChar ( e->key() );
+ text[ cpos ] = QChar ( e->key() );
lineEdit()->setText( text );
if ( cpos == 1 )
++cpos;
if ( cpos < 5)
lineEdit()->setCursorPosition(++cpos);
setSelect( cpos , 1 );
changedText();
break;
- case Key_Home:
+ case Qt::Key_Home:
lineEdit()->setCursorPosition(0);
setSelect( cpos , 1 );
break;
- case Key_End:
+ case Qt::Key_End:
lineEdit()->setCursorPosition(5);
lineEdit()->deselect();
break;
default:
// QComboBox::keyPressEvent(e);
break;
} // switch num keys
} else if ( cpos == 5 ) {// if cpos < 5
if ( hour12Format ) {
- if ( e->key() == Key_A ) {
- text.at( 5 ) = 'a';
+ if ( e->key() == Qt::Key_A ) {
+ text[ 5 ] = 'a';
lineEdit()->setText( text );
lineEdit()->setCursorPosition(5);
- } else if ( e->key() == Key_P ) {
- text.at( 5 ) = 'p';
+ } else if ( e->key() == Qt::Key_P ) {
+ text[ 5 ] = 'p';
lineEdit()->setText( text );
lineEdit()->setCursorPosition(5);
}
}
}
}
void KOTimeEdit::updateText()
{
listBox()->blockSignals( true );
blockSignals( true );
QString s = KGlobal::locale()->formatTime(mTime);
// Set the text but without emitting signals, nor losing the cursor position
QLineEdit *line = lineEdit();
line->blockSignals(true);
int pos = line->cursorPosition();
setCurrentItem((mTime.hour()*4)+(mTime.minute()/15));
line->setText(s);
line->setCursorPosition(pos);
line->blockSignals(false);
blockSignals( false );
listBox()->blockSignals( false );
}
void KOTimeEdit::changedText()
{
int pos = lineEdit()->cursorPosition();
mTime = getTime();
diff --git a/korganizer/ktimeedit.h b/korganizer/ktimeedit.h
index b3d842d..1c7d18d 100644
--- a/korganizer/ktimeedit.h
+++ b/korganizer/ktimeedit.h
@@ -1,73 +1,76 @@
/*
This file is part of KOrganizer.
Copyright (c) 1999 Preston Brown, Ian Dawes
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KTIMEEDIT_H
#define _KTIMEEDIT_H
#include <qevent.h>
-#include <qkeycode.h>
+#include <qnamespace.h>
#include <qstring.h>
#include <qdatetime.h>
#include <qcombobox.h>
+#include <Q3ComboBox>
+//Added by qt3to4:
+#include <QKeyEvent>
#include <kapplication.h>
/**
This is a class that provides an easy, user friendly way to edit times.
up/down/ increase or decrease time, respectively.
@short Provides a way to edit times in a user-friendly manner.
@author Preston Brown, Ian Dawes
*/
-class KOTimeEdit : public QComboBox
+class KOTimeEdit : public Q3ComboBox
{
Q_OBJECT
public:
/** constructs a new time edit. */
KOTimeEdit(QWidget *parent=0, QTime qt=QTime(12,0), const char *name=0);
virtual ~KOTimeEdit();
/**
Returns, if a time is selected. Can not return false anymore....
*/
bool hasTime() const;
/** returns the time that is currently set in the timeLineEdit. */
QTime getTime() const;
/** returns the prefered size policy of the KOTimeEdit */
//QSizePolicy sizePolicy() const;
signals:
/**
Emitted every time the time displayed changes. "newt" is the new
time.
*/
void timeChanged(QTime newt);
public slots:
/** used to set the time which is displayed to a specific value. */
void setTime(QTime qt);
protected slots:
void activ(int);
diff --git a/korganizer/lineview.cpp b/korganizer/lineview.cpp
index e72e41c..012455e 100644
--- a/korganizer/lineview.cpp
+++ b/korganizer/lineview.cpp
@@ -1,42 +1,42 @@
#include <qpainter.h>
#include <kdebug.h>
#include "koprefs.h"
#include "lineview.h"
LineView::LineView( QWidget *parent, const char *name ) :
- QScrollView( parent, name )
+ Q3ScrollView( parent, name )
{
mPixelWidth = 1000;
mLines.setAutoDelete( true );
resizeContents( mPixelWidth, contentsHeight() );
viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
}
LineView::~LineView()
{
}
int LineView::pixelWidth()
{
return mPixelWidth;
}
void LineView::addLine( int start, int end )
{
int count = mLines.count();
if( start < 0 ) start = 0;
if( end > mPixelWidth) end = mPixelWidth;
kdDebug() << "LineView::addLine() col: " << count << " start: " << start
<< " end: " << end << endl;
mLines.append( new Line( count, start, end ) );
}
diff --git a/korganizer/lineview.h b/korganizer/lineview.h
index aa34dbc..52ae9cf 100644
--- a/korganizer/lineview.h
+++ b/korganizer/lineview.h
@@ -1,36 +1,36 @@
#ifndef LINEVIEW_H
#define LINEVIEW_H
-#include <qscrollview.h>
-#include <qptrlist.h>
+#include <q3scrollview.h>
+#include <q3ptrlist.h>
-class LineView : public QScrollView
+class LineView : public Q3ScrollView
{
Q_OBJECT
public:
LineView( QWidget *parent = 0, const char *name = 0 );
virtual ~LineView();
int pixelWidth();
void addLine( int start, int end );
void clear();
protected:
void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
private:
struct Line {
Line( int c, int s, int e ) : column( c ), start( s ), end( e ) {}
int column;
int start;
int end;
};
- QPtrList<Line> mLines;
+ Q3PtrList<Line> mLines;
int mPixelWidth;
};
#endif
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 4a0e24f..211fde6 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,117 +1,117 @@
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <qcopchannel_qws.h>
#include <qpe/global.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <stdlib.h>
#else
#include <qapplication.h>
#include <qstring.h>
#include <qwindowsstyle.h>
-#include <qplatinumstyle.h>
-#include <qsgistyle.h>
#include <stdlib.h>
#endif
#include <qtextcodec.h>
#include <qdir.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <stdio.h>
#include "mainwindow.h"
#include <libkdepim/kpimglobalprefs.h>
void dumpMissing();
int main( int argc, char **argv )
{
+ if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi");
#ifndef DESKTOP_VERSION
QPEApplication a( argc, argv );
a.setKeepRunning ();
#else
QApplication a( argc, argv );
- QApplication::setStyle( new QPlatinumStyle ());
#ifdef _WIN32_
QString hdir ( getenv( "HOME") );
if ( hdir.isEmpty() ) {
QString hd ("C:/" );
//QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
if ( QDir::homeDirPath().lower() == hd.lower() ) {
_putenv( "HOME=C:");
//QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
}
} else {
QDir app_dir;
if ( !app_dir.exists(hdir) )
app_dir.mkdir (hdir);
}
#endif
#endif
bool exitHelp = false;
if ( argc > 1 ) {
QString command = argv[1];
if ( command == "-help" ){
printf("KO/Pi command line commands:\n");
printf(" no command: Start KO/Pi in usual way\n");
printf(" -help: This output\n");
printf("Next Option: Open or Show after start:\n");
printf(" -newTodo: New Todo dialog\n");
printf(" -newEvent: New Event dialog\n");
printf(" -showList: List view\n");
printf(" -showDay: Day view\n");
printf(" -showWWeek: Work Week view\n");
printf(" -showWeek: Week view\n");
printf(" -showTodo: Todo view\n");
printf(" -showJournal: Journal view\n");
printf(" -showKO: Next Days view\n");
printf(" -showWNext: What's Next view\n");
printf(" -showNextXView: Next X View\n");
printf(" -new[Y] and -show[X] may be used togehther\n");
printf(" KO/Pi is exiting now. Bye!\n");
exitHelp = true;
}
}
if ( ! exitHelp ) {
KGlobal::setAppName( "korganizer" );
QString fileName ;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
#else
fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
#endif
KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
KPimGlobalPrefs::instance()->setGlobalConfig();
MainWindow m;
#ifndef DESKTOP_VERSION
- QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(receiveStart( const QCString&, const QByteArray& )));
+ QObject::connect( &a, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )),&m, SLOT(receiveStart( const Q3CString&, const QByteArray& )));
a.showMainWidget(&m );
#else
a.setMainWidget(&m );
m.show();
//m.resize( 800, 600 );
//QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
#endif
if ( argc > 1 ) {
- QCString command = argv[1];
+ Q3CString command = argv[1];
if ( argc > 2 )
command += argv[2];
m.recieve(command, QByteArray() );
}
#ifndef DESKTOP_VERSION
// QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable );
#endif
a.exec();
dumpMissing();
KPimGlobalPrefs::instance()->writeConfig();
}
qDebug("KO: Bye! ");
}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 69ccde1..2004939 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,316 +1,326 @@
#include <stdlib.h>
#include <qaction.h>
-#include <qpopupmenu.h>
+#include <Q3Action>
+#include <q3popupmenu.h>
#include <qpainter.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qtextcodec.h>
#include <qfile.h>
#include <qdir.h>
-#include <qapp.h>
+#include <qapplication.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qmap.h>
-#include <qwmatrix.h>
-#include <qtextbrowser.h>
-#include <qtextstream.h>
+#include <qmatrix.h>
+#include <q3textbrowser.h>
+#include <q3textstream.h>
#ifndef DESKTOP_VERSION
#include <qpe/global.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qtopia/alarmserver.h>
#include <qtopia/qcopenvelope_qws.h>
//#include <unistd.h> // for sleep
#else
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QPixmap>
+#include <QCloseEvent>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
+#include <QHideEvent>
+#include <Q3CString>
+#include <Q3PtrList>
//#include <resource.h>
#endif
#include <libkcal/calendarlocal.h>
#include <libkcal/todo.h>
#include <libkcal/phoneformat.h>
#include <libkdepim/ksyncprofile.h>
#include <libkdepim/phoneaccess.h>
#include <libkcal/kincidenceformatter.h>
#include <libkdepim/kpimglobalprefs.h>
#include "calendarview.h"
#include "koviewmanager.h"
#include "datenavigator.h"
#include "koagendaview.h"
#include "kojournalview.h"
#include "koagenda.h"
#include "kodialogmanager.h"
#include "kdialogbase.h"
#include "kapplication.h"
#include "kofilterview.h"
#include "kstandarddirs.h"
#include "koprefs.h"
#include "kfiledialog.h"
#include "koglobals.h"
#include "kglobal.h"
#include "ktoolbar.h"
#include "klocale.h"
#include "kconfig.h"
#include "externalapphandler.h"
#include <kglobalsettings.h>
using namespace KCal;
#ifndef _WIN32_
#include <unistd.h>
#else
#ifdef _OL_IMPORT_
#include "koimportoldialog.h"
#endif
#endif
#include "mainwindow.h"
class KOex2phonePrefs : public QDialog
{
public:
KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Export to phone options") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel *lab;
lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
- lab->setAlignment (AlignHCenter );
- QHBox* temphb;
- temphb = new QHBox( this );
+ lab->setAlignment (Qt::AlignHCenter );
+ Q3HBox* temphb;
+ temphb = new Q3HBox( this );
new QLabel( i18n("I/O device: "), temphb );
mPhoneDevice = new QLineEdit( temphb);
lay->addWidget( temphb );
- temphb = new QHBox( this );
+ temphb = new Q3HBox( this );
new QLabel( i18n("Connection: "), temphb );
mPhoneConnection = new QLineEdit( temphb);
lay->addWidget( temphb );
- temphb = new QHBox( this );
+ temphb = new Q3HBox( this );
new QLabel( i18n("Model(opt.): "), temphb );
mPhoneModel = new QLineEdit( temphb);
lay->addWidget( temphb );
mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
mWriteBackFuture->setChecked( true );
lay->addWidget( mWriteBackFuture );
- temphb = new QHBox( this );
+ temphb = new Q3HBox( this );
new QLabel( i18n("Max. weeks in future: ") , temphb );
mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
mWriteBackFutureWeeks->setValue( 8 );
lay->addWidget( temphb );
lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
- lab->setAlignment (AlignHCenter );
+ lab->setAlignment (Qt::AlignHCenter );
QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 220, 240 );
qApp->processEvents();
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
move( (dw-width())/2, (dh - height() )/2 );
}
public:
QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
QCheckBox* mWriteBackFuture;
QSpinBox* mWriteBackFutureWeeks;
};
QPixmap* sgListViewCompletedPix[6];
QPixmap* sgListViewJournalPix;
int globalFlagBlockStartup;
MainWindow::MainWindow( QWidget *parent, const char *name ) :
- QMainWindow( parent, name )
+ Q3MainWindow( parent, name )
{
sgListViewCompletedPix[5] = &listviewPix;
sgListViewCompletedPix[0] = &listviewPix0;
sgListViewCompletedPix[1] = &listviewPix20;
sgListViewCompletedPix[2] = &listviewPix40;
sgListViewCompletedPix[3] = &listviewPix60;
sgListViewCompletedPix[4] = &listviewPix80;
//int size = 12;
{
sgListViewCompletedPix[5]->resize( 11, 11 );
sgListViewCompletedPix[5]->fill( Qt::white );
QPainter p ( sgListViewCompletedPix[5] );
p.drawRect( 0,0,11,11);
p.drawLine ( 2, 5, 4 , 7 ) ;
p.drawLine ( 4 , 7 , 8, 3) ;
int iii = 0;
for ( iii = 0; iii < 5; ++iii ) {
sgListViewCompletedPix[iii]->resize( 11, 11 );
sgListViewCompletedPix[iii]->fill( Qt::white );
QPainter p ( sgListViewCompletedPix[iii] );
p.drawRect( 0,0,11,11);
if ( iii )
p.fillRect( 1,1,iii*2,9,Qt::gray );
}
sgListViewJournalPix = &journalPix;
sgListViewJournalPix->resize( 11, 11 );
sgListViewJournalPix->fill( Qt::white );
{
QPainter p ( sgListViewJournalPix );
p.drawRect( 0,0,11,11);
p.drawLine( 2,3,5,3);
p.drawLine( 2,5,8,5);
p.drawLine( 2,7,6,7);
}
}
mAutoSaveDisabled = false;
mClosed = false;
//QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
QString confFile = locateLocal("config","korganizerrc");
QFileInfo finf ( confFile );
bool showWarning = !finf.exists();
setIcon(SmallIcon( "ko24" ) );
mBlockAtStartup = true;
mFlagKeyPressed = false;
setCaption("KO/Pi");
KOPrefs *p = KOPrefs::instance();
//KPimGlobalPrefs::instance()->setGlobalConfig();
p->mCurrentDisplayedView = 0;
if ( p->mHourSize > 22 )
p->mHourSize = 22;
- QMainWindow::ToolBarDock tbd;
+ Qt::ToolBarDock tbd;
if ( p->mToolBarHor ) {
if ( p->mToolBarUp )
- tbd = Bottom;
+ tbd = Qt::Bottom;
else
- tbd = Top;
+ tbd = Qt::Top;
}
else {
if ( p->mToolBarUp )
- tbd = Right;
+ tbd = Qt::Right;
else
- tbd = Left;
+ tbd = Qt::Left;
}
if ( KOPrefs::instance()->mUseAppColors )
QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
globalFlagBlockStartup = 1;
iconToolBar = new QPEToolBar( this );
addToolBar (iconToolBar , tbd );
#ifdef DESKTOP_VERSION
if ( KOPrefs::instance()->mShowIconFilter )
#else
if ( KOPrefs::instance()->mShowIconFilter || ( !p->mShowIconOnetoolbar &&!p->mShowIconFilterview ) )
#endif
{
if ( p->mToolBarHorF ) {
if ( p->mToolBarUpF )
- tbd = Bottom;
+ tbd = Qt::Bottom;
else
- tbd = Top;
+ tbd = Qt::Top;
}
else {
if ( p->mToolBarUpF )
- tbd = Right;
+ tbd = Qt::Right;
else
- tbd = Left;
+ tbd = Qt::Left;
}
filterToolBar = new QPEToolBar ( this );
filterMenubar = new KMenuBar( 0 );
QFontMetrics fm ( filterMenubar->font() );
#ifndef DESKTOP_VERSION
filterToolBar->setFocusPolicy( NoFocus );
filterMenubar->setFocusPolicy( NoFocus );
#endif
- filterPopupMenu = new QPopupMenu( this );
+ filterPopupMenu = new Q3PopupMenu( this );
filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
QString addTest = "A";
filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
#ifdef DESKTOP_VERSION
addTest = "AAAAAABBBCCCx";
#else
addTest = "AAAAAx";
#endif
filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
addToolBar (filterToolBar , tbd );
connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
filterToolBar->hide();
} else {
filterToolBar = 0;
filterMenubar = 0;
filterPopupMenu = 0;
}
if ( p->mShowIconOnetoolbar ) {
viewToolBar = iconToolBar ;
navigatorToolBar = iconToolBar ;
} else {
#ifndef DESKTOP_VERSION
setToolBarsMovable( false );
#endif
if ( p->mToolBarHorV ) {
if ( p->mToolBarUpV )
- tbd = Bottom;
+ tbd = Qt::Bottom;
else
- tbd = Top;
+ tbd = Qt::Top;
}
else {
if ( p->mToolBarUpV )
- tbd = Right;
+ tbd = Qt::Right;
else
- tbd = Left;
+ tbd = Qt::Left;
}
viewToolBar = new QPEToolBar( this );
addToolBar (viewToolBar , tbd );
if ( p->mToolBarHorN ) {
if ( p->mToolBarUpN )
- tbd = Bottom;
+ tbd = Qt::Bottom;
else
- tbd = Top;
+ tbd = Qt::Top;
}
else {
if ( p->mToolBarUpN )
- tbd = Right;
+ tbd = Qt::Right;
else
- tbd = Left;
+ tbd = Qt::Left;
}
navigatorToolBar = new QPEToolBar( this );
addToolBar (navigatorToolBar , tbd );
}
mCalendarModifiedFlag = false;
// QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
//splash->setAlignment ( AlignCenter );
//setCentralWidget( splash );
#ifndef DESKTOP_VERSION
//showMaximized();
#endif
//qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
setDefaultPreferences();
mCalendar = new CalendarLocal();
mView = new CalendarView( mCalendar, this,"mCalendar " );
setCentralWidget( mView );
//mView->hide();
//mView->resize(splash->size() );
initActions();
mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
mSyncManager->setBlockSave(false);
mView->setSyncManager(mSyncManager);
#ifndef DESKTOP_VERSION
iconToolBar->show();
qApp->processEvents();
#endif
//qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
int vh = height() ;
@@ -411,67 +421,67 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) :
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
delete mSyncManager;
#ifndef DESKTOP_VERSION
if ( infrared )
delete infrared;
#endif
}
void MainWindow::loadDataAfterStart()
{
qDebug("KO: Start loading files..." );
QTime neededSaveTime = QDateTime::currentDateTime().time();
mView->loadCalendars();
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
qDebug("KO: Calendar loading time: %d ms",msNeeded );
//QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
mView->setModified( false );
mBlockAtStartup = false;
mView->setModified( false );
connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
processIncidenceSelection( 0 );
connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
SLOT( processIncidenceSelection( Incidence * ) ) );
connect( mView, SIGNAL( modifiedChanged( bool ) ),
SLOT( slotModifiedChanged( bool ) ) );
#ifndef DESKTOP_VERSION
- connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
- connect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(recieve( const QCString&, const QByteArray& )));
- disconnect( qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT(receiveStart( const QCString&, const QByteArray& )));
+ connect(qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const Q3CString &, const QByteArray & )));
+ connect( qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT(recieve( const Q3CString&, const QByteArray& )));
+ disconnect( qApp, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )), this, SLOT(receiveStart( const Q3CString&, const QByteArray& )));
if ( !mCStringMess.isEmpty() )
recieve( mCStringMess, mByteData );
#endif
QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
}
void MainWindow::slotResetFocus()
{
//qDebug(" CalendarView::slotResetFocus() %x %x %x %x", qApp->focusWidget(), menuBar1, mView,iconToolBar);
mFocusLoop = 3;
QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
}
void MainWindow::slotResetFocusLoop()
{
--mFocusLoop;
QWidget* fw = mView->viewManager()->currentView();
if ( fw ) {
//qDebug("loop ");
fw->setFocus();
if ( qApp->focusWidget() != fw && mFocusLoop > 0 )
QTimer::singleShot( 0, this, SLOT(slotResetFocusLoop() ));
}
}
void MainWindow::disableBR(bool b)
{
#ifndef DESKTOP_VERSION
if ( b ) {
if ( infrared ) {
toggleBeamReceive();
mBRdisabled = true;
}
@@ -480,65 +490,65 @@ void MainWindow::disableBR(bool b)
if ( mBRdisabled ) {
mBRdisabled = false;
//makes no sense,because other cal ap is probably running
// toggleBeamReceive();
}
}
#endif
}
bool MainWindow::beamReceiveEnabled()
{
#ifndef DESKTOP_VERSION
return ( infrared != 0 );
#endif
return false;
}
void MainWindow::toggleBeamReceive()
{
if ( mBRdisabled )
return;
#ifndef DESKTOP_VERSION
if ( infrared ) {
qDebug("KO: Disable BeamReceive ");
delete infrared;
infrared = 0;
brAction->setOn(false);
return;
}
qDebug("KO: Enable BeamReceive ");
brAction->setOn(true);
infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
- QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
+ QObject::connect( infrared, SIGNAL (received ( const Q3CString &, const QByteArray & )),this, SLOT(recieve( const Q3CString&, const QByteArray& )));
#endif
}
void MainWindow::showMaximized ()
{
#ifndef DESKTOP_VERSION
if ( ! globalFlagBlockStartup )
if ( mClosed )
mView->goToday();
#endif
QWidget::showMaximized () ;
mClosed = false;
}
bool MainWindow::askForQuitOnSaveError()
{
bool retval = false;
switch( QMessageBox::information( this, "KO/Pi",
i18n("Error saving data") + "!\n" +
i18n("You can save all data\nto another file via\nFile->Export->Export All Data") + "!\n" +
i18n("Do you really want\nto close KO/Pi?"),
i18n(" Yes, close "), i18n("No"),
0, 1 ) ) {
case 0:
retval = true;
break;
default:
break;
}
return retval;
}
bool MainWindow::checkAutosave()
{
@@ -571,80 +581,80 @@ void MainWindow::closeEvent( QCloseEvent* ce )
mClosed = true;
ce->accept();
return;
}
switch( QMessageBox::information( this, "KO/Pi",
i18n("Do you really want\nto close KO/Pi?"),
i18n("Close"), i18n("No"),
0, 0 ) ) {
case 0:
if ( checkAutosave() ) {
saveOnClose();
if ( mCalendarModifiedFlag && !askForQuitOnSaveError() ) {
ce->ignore();
return;
}
}
mClosed = true;
ce->accept();
break;
case 1:
ce->ignore();
break;
case 2:
default:
break;
}
}
-void MainWindow::receiveStart( const QCString& cmsg, const QByteArray& data )
+void MainWindow::receiveStart( const Q3CString& cmsg, const QByteArray& data )
{
qDebug("KO: QCOP start message received: %s ", cmsg.data() );
mCStringMess = cmsg;
mByteData = data;
}
-void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
+void MainWindow::recieve( const Q3CString& cmsg, const QByteArray& data )
{
- QDataStream stream( data, IO_ReadOnly );
+ QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
// QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
//QString datamess;
//qDebug("message ");
qDebug("KO: QCOP message received: %s ", cmsg.data() );
if ( cmsg == "setDocument(QString)" ) {
- QDataStream stream( data, IO_ReadOnly );
+ QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
QString fileName;
stream >> fileName;
//qDebug("filename %s ", fileName.latin1());
showMaximized();
raise();
KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
mSyncManager->slotSyncMenu( 1002 );
return;
}
if ( cmsg == "-writeFile" ) {
// I made from the "-writeFile" an "-writeAlarm"
mView->viewManager()->showWhatsNextView();
mCalendar->checkAlarmForIncidence( 0, true);
showMaximized();
raise();
return;
}
if ( cmsg == "-writeFileSilent" ) {
// I made from the "-writeFile" an "-writeAlarm"
// mView->viewManager()->showWhatsNextView();
mCalendar->checkAlarmForIncidence( 0, true);
//showMaximized();
//raise();
//hide();
return;
}
if ( cmsg == "-newCountdown" ) {
qDebug("newCountdown ");
}
@@ -715,730 +725,730 @@ void MainWindow::startMultiSync()
{
QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
question,
i18n("Yes"), i18n("No"),
0, 0 ) != 0 ) {
setCaption(i18n("Aborted! Nothing synced!"));
return;
}
mSyncManager->multiSync( false );
#ifndef DESKTOP_VERSION
QCopEnvelope e("QPE/Application/kapi", "doRingSync");
#endif
}
QPixmap MainWindow::loadPixmap( QString name )
{
return SmallIcon( name );
}
void MainWindow::setUsesBigPixmaps ( bool b )
{
qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
if ( b )
qDebug("KO: BigPixmaps are not supported ");
}
void MainWindow::initActions()
{
//KOPrefs::instance()->mShowFullMenu
iconToolBar->clear();
KOPrefs *p = KOPrefs::instance();
//QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
- QPopupMenu *viewMenu = new QPopupMenu( this );
- QPopupMenu *actionMenu = new QPopupMenu( this );
- mCurrentItemMenu = new QPopupMenu ( this );
- QPopupMenu *nextConflictMenu = new QPopupMenu ( this );
- QPopupMenu *importMenu = new QPopupMenu( this );
- QPopupMenu *importMenu_X = new QPopupMenu( this );
- QPopupMenu *exportMenu_X = new QPopupMenu( this );
- QPopupMenu *beamMenu_X = new QPopupMenu( this );
- selectFilterMenu = new QPopupMenu( this );
+ Q3PopupMenu *viewMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *actionMenu = new Q3PopupMenu( this );
+ mCurrentItemMenu = new Q3PopupMenu ( this );
+ Q3PopupMenu *nextConflictMenu = new Q3PopupMenu ( this );
+ Q3PopupMenu *importMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *importMenu_X = new Q3PopupMenu( this );
+ Q3PopupMenu *exportMenu_X = new Q3PopupMenu( this );
+ Q3PopupMenu *beamMenu_X = new Q3PopupMenu( this );
+ selectFilterMenu = new Q3PopupMenu( this );
selectFilterMenu->setCheckable( true );
- syncMenu = new QPopupMenu( this );
- configureAgendaMenu = new QPopupMenu( this );
- configureToolBarMenu = new QPopupMenu( this );
- QPopupMenu *helpMenu = new QPopupMenu( this );
- QIconSet icon;
+ syncMenu = new Q3PopupMenu( this );
+ configureAgendaMenu = new Q3PopupMenu( this );
+ configureToolBarMenu = new Q3PopupMenu( this );
+ Q3PopupMenu *helpMenu = new Q3PopupMenu( this );
+ QIcon icon;
int pixWid = 22, pixHei = 22;
QString pathString = "";
if ( !p->mToolBarMiniIcons ) {
if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
pathString += "icons16/";
pixWid = 18; pixHei = 16;
}
} else {
pathString += "iconsmini/";
pixWid = 18; pixHei = 16;
}
if ( KOPrefs::instance()->mShowFullMenu ) {
menuBar1 = new KMenuBar( this );//menuBar();
//setMenuBar( menuBar1 );
menuBar1->show();
menuBar1->insertItem( i18n("File"), importMenu );
menuBar1->insertItem( i18n("View"), viewMenu );
menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
menuBar1->insertItem( i18n("Action"), actionMenu );
#ifdef DESKTOP_VERSION
menuBar1->insertItem( i18n("Synchronize"), syncMenu );
menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
#else
menuBar1->insertItem( i18n("Sync"), syncMenu );
menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
#endif
//menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
menuBar1->insertItem( i18n("Help"), helpMenu );
} else {
menuBar1 = new KMenuBar( iconToolBar );
- QPopupMenu *menuBar = new QPopupMenu( this );
+ Q3PopupMenu *menuBar = new Q3PopupMenu( this );
icon = loadPixmap( pathString + "z_menu" );
menuBar1->insertItem( icon.pixmap(), menuBar);
//menuBar1->insertItem( i18n("ME"), menuBar);
menuBar->insertItem( i18n("File"), importMenu );
menuBar->insertItem( i18n("View"), viewMenu );
menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
menuBar->insertItem( i18n("Action"), actionMenu );
menuBar->insertItem( i18n("Synchronize"), syncMenu );
menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
menuBar->insertItem( i18n("Filter"),selectFilterMenu );
menuBar->insertItem( i18n("Help"), helpMenu );
//menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
menuBar1->setMaximumSize( menuBar1->sizeHint( ));
connect ( menuBar, SIGNAL( aboutToHide () ), this, SLOT ( slotResetFocus() ) );
}
connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
//connect ( menuBar1, SIGNAL( lostFocus () ), this, SLOT ( slotResetFocus() ) );
connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
mWeekBgColor = iconToolBar->backgroundColor();
mWeekPixmap.resize( pixWid , pixHei );
mWeekPixmap.fill( mWeekBgColor );
icon = mWeekPixmap;
- mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
+ mWeekAction = new Q3Action( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
if ( p-> mShowIconWeekNum )
mWeekAction->addTo( iconToolBar );
mWeekFont = font();
int fontPoint = mWeekFont.pointSize();
QFontMetrics f( mWeekFont );
int fontWid = f.width( "30" );
while ( fontWid > pixWid ) {
--fontPoint;
mWeekFont.setPointSize( fontPoint );
QFontMetrics f( mWeekFont );
fontWid = f.width( "30" );
//qDebug("dec-- ");
}
connect( mWeekAction, SIGNAL( activated() ),
this, SLOT( weekAction() ) );
connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
if ( p->mShowIconFilterview ) {
icon = loadPixmap( pathString + "filter" );
- actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
+ actionFilterMenuTB = new Q3Action( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
connect( actionFilterMenuTB, SIGNAL( activated() ),
this, SLOT( fillFilterMenuTB() ) );
actionFilterMenuTB->addTo( iconToolBar );
- selectFilterMenuTB = new QPopupMenu( this );
+ selectFilterMenuTB = new Q3PopupMenu( this );
selectFilterMenuTB->setCheckable( true );
connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
}
//#endif
// ******************
- QAction *action;
+ Q3Action *action;
// QPopupMenu *configureMenu= new QPopupMenu( menuBar );
configureToolBarMenu->setCheckable( true );
configureAgendaMenu->setCheckable( true );
int iii ;
for ( iii = 1;iii<= 10 ;++iii ){
configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
}
//configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
connect( configureAgendaMenu, SIGNAL( aboutToShow()),
this, SLOT( showConfigureAgenda( ) ) );
icon = loadPixmap( pathString + "today" );
- QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
+ Q3Action* today_action = new Q3Action( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
today_action->addTo( actionMenu );
connect( today_action, SIGNAL( activated() ),
mView, SLOT( goToday() ) );
icon = loadPixmap( pathString + "picker" );
- QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
+ Q3Action* dPickerAction = new Q3Action( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
dPickerAction->addTo( actionMenu );
connect( dPickerAction, SIGNAL( activated() ),
mView, SLOT( showDatePicker() ) );
icon = loadPixmap( pathString + "search" );
- QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
+ Q3Action* search_action = new Q3Action( i18n("Search"), icon, i18n("Search..."), 0, this );
search_action->addTo( actionMenu );
connect( search_action, SIGNAL( activated() ),
mView->dialogManager(), SLOT( showSearchDialog() ) );
actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu );
- action = new QAction( "Undo Delete", i18n("All events"), 0, this );
+ action = new Q3Action( "Undo Delete", i18n("All events"), 0, this );
action->addTo( nextConflictMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( conflictAll() ) );
- action = new QAction( "Undo Delete", i18n("Allday events"), 0, this );
+ action = new Q3Action( "Undo Delete", i18n("Allday events"), 0, this );
action->addTo( nextConflictMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( conflictAllday() ) );
- action = new QAction( "Undo Delete", i18n("Events with time"), 0, this );
+ action = new Q3Action( "Undo Delete", i18n("Events with time"), 0, this );
action->addTo( nextConflictMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( conflictNotAll() ) );
actionMenu->insertSeparator();
icon = loadPixmap( pathString + "newevent" );
- QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
+ Q3Action* ne_action = new Q3Action( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
ne_action->addTo( mCurrentItemMenu );
connect( ne_action, SIGNAL( activated() ),
mView, SLOT( newEvent() ) );
icon = loadPixmap( pathString + "newtodo" );
- QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
+ Q3Action* nt_action = new Q3Action( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
nt_action->addTo( mCurrentItemMenu );
connect( nt_action, SIGNAL( activated() ),
mView, SLOT( newTodo() ) );
- mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
+ mNewSubTodoAction = new Q3Action( "new_subtodo", i18n("New Sub-Todo..."), 0,
this );
mNewSubTodoAction->addTo( mCurrentItemMenu );
connect( mNewSubTodoAction, SIGNAL( activated() ),
mView, SLOT( newSubTodo() ) );
mCurrentItemMenu->insertSeparator();
icon = loadPixmap( pathString + "newevent" );
configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
configureToolBarMenu->insertSeparator();
configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
configureToolBarMenu->insertSeparator();
configureToolBarMenu->insertItem(i18n("Week Number"), 400);
configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
icon = loadPixmap( pathString + "newtodo" );
configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
//actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
- mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
+ mShowAction = new Q3Action( "show_incidence", i18n("Show"), 0, this );
mShowAction->addTo( mCurrentItemMenu );
connect( mShowAction, SIGNAL( activated() ),
mView, SLOT( showIncidence() ) );
- mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
+ mEditAction = new Q3Action( "edit_incidence", i18n("Edit..."), 0, this );
mEditAction->addTo( mCurrentItemMenu );
connect( mEditAction, SIGNAL( activated() ),
mView, SLOT( editIncidence() ) );
- mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
+ mDeleteAction = new Q3Action( "delete_incidence", i18n("Delete..."), 0, this );
mDeleteAction->addTo( mCurrentItemMenu );
connect( mDeleteAction, SIGNAL( activated() ),
mView, SLOT( deleteIncidence() ) );
- mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
+ mCloneAction = new Q3Action( "clone_incidence", i18n("Clone..."), 0, this );
mCloneAction->addTo( mCurrentItemMenu );
connect( mCloneAction, SIGNAL( activated() ),
mView, SLOT( cloneIncidence() ) );
- mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
+ mMoveAction = new Q3Action( "Move_incidence", i18n("Move..."), 0, this );
mMoveAction->addTo( mCurrentItemMenu );
connect( mMoveAction, SIGNAL( activated() ),
mView, SLOT( moveIncidence() ) );
#ifndef DESKTOP_VERSION
- mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
+ mBeamAction = new Q3Action( "Beam_incidence", i18n("Beam..."), 0, this );
mBeamAction->addTo(mCurrentItemMenu );
connect( mBeamAction, SIGNAL( activated() ),
mView, SLOT( beamIncidence() ) );
#endif
- mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
+ mCancelAction = new Q3Action( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
mCancelAction->addTo( mCurrentItemMenu );
connect( mCancelAction, SIGNAL( activated() ),
mView, SLOT( toggleCancelIncidence() ) );
mCurrentItemMenu->insertSeparator();
- action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
+ action = new Q3Action( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
action->addTo( mCurrentItemMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( undo_delete() ) );
// ***********************
if ( KOPrefs::instance()->mVerticalScreen ) {
icon = SmallIcon( "1updownarrow" );
} else {
icon = SmallIcon("1leftrightarrow" );
}
configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
- QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
+ Q3Action* FSaction = new Q3Action( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
FSaction->addTo( viewMenu );
connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
icon = loadPixmap( pathString + "filter" );
configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
icon = loadPixmap( pathString + "configure" );
- action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
+ action = new Q3Action( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleFilter() ) );
mToggleFilter = action;
icon = loadPixmap( pathString + "navi" );
configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
- action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
+ action = new Q3Action( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleDateNavigatorWidget() ) );
mToggleNav = action ;
icon = loadPixmap( pathString + "allday" );
configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
- action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
+ action = new Q3Action( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleAllDaySize() ) );
mToggleAllday = action;
connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
mToggleNav, SLOT( setEnabled ( bool ) ) );
//connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
// mToggleFilter, SLOT( setEnabled ( bool ) ) );
connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
mToggleAllday, SLOT( setEnabled ( bool ) ) );
// connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
// configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
dPickerAction->addTo( iconToolBar );
viewMenu->insertSeparator();
if ( p-> mShowIconToggleFull )
FSaction->addTo( iconToolBar );
if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
//********************
if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
icon = loadPixmap( pathString + "whatsnext" );
configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
- QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
+ Q3Action* whatsnext_action = new Q3Action( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
whatsnext_action->addTo( viewMenu );
connect( whatsnext_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showWhatsNextView() ) );
icon = loadPixmap( pathString + "xdays" );
configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
- QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
+ Q3Action* xdays_action = new Q3Action( i18n("Next days"), icon, i18n("Next days"), 0, this );
xdays_action->addTo( viewMenu );
connect( xdays_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showNextXView() ) );
icon = loadPixmap( pathString + "journal" );
configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
- QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
+ Q3Action* viewjournal_action = new Q3Action( i18n("Journal"), icon, i18n("Journal"), 0, this );
viewjournal_action->addTo( viewMenu );
connect( viewjournal_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showJournalView() ) );
icon = loadPixmap( pathString + "day" );
configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
- QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
+ Q3Action* day1_action = new Q3Action( i18n("Day View"), icon, i18n("Day View"), 0, this );
day1_action->addTo( viewMenu );
// action->addTo( toolBar );
connect( day1_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showDayView() ) );
icon = loadPixmap( pathString + "workweek" );
configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
- QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
+ Q3Action* day5_action = new Q3Action( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
day5_action->addTo( viewMenu );
connect( day5_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showWorkWeekView() ) );
icon = loadPixmap( pathString + "week" );
configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
- QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
+ Q3Action* day7_action = new Q3Action( i18n("Week"), icon, i18n("Week"), 0, this );
day7_action->addTo( viewMenu );
connect( day7_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showWeekView() ) );
icon = loadPixmap( pathString + "workweek2" );
configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
- QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
+ Q3Action* day6_action = new Q3Action( i18n("List week"), icon, i18n("List week"), 0, this );
day6_action->addTo( viewMenu );
connect( day6_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showMonthViewWeek() ) );
icon = loadPixmap( pathString + "month" );
configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
- QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
+ Q3Action* month_action = new Q3Action( i18n("Month"), icon, i18n("Month"), 0, this );
month_action->addTo( viewMenu );
connect( month_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showMonthView() ) );
icon = loadPixmap( pathString + "list" );
configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
- QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
+ Q3Action* showlist_action = new Q3Action( i18n("List View"), icon, i18n("List View"), 0, this );
showlist_action->addTo( viewMenu );
connect( showlist_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showListView() ) );
icon = loadPixmap( pathString + "todo" );
configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
- QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
+ Q3Action* todoview_action = new Q3Action( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
todoview_action->addTo( viewMenu );
connect( todoview_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showTodoView() ) );
#if 0
- action = new QAction( "view_timespan", "Time Span", 0, this );
+ action = new Q3Action( "view_timespan", "Time Span", 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showTimeSpanView() ) );
#endif
- action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
+ action = new Q3Action( "purge_completed", i18n("Purge Completed..."), 0,
this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
icon = loadPixmap( pathString + "search" );
configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
actionMenu->insertSeparator();
- action = new QAction( "manage cat", i18n("Edit category list..."), 0,
+ action = new Q3Action( "manage cat", i18n("Edit category list..."), 0,
this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
- action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
+ action = new Q3Action( "manage cat", i18n("Manage new categories..."), 0,
this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
actionMenu->insertSeparator();
icon = loadPixmap( pathString + "configure" );
- action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
+ action = new Q3Action( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( edit_options() ) );
- action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
+ action = new Q3Action( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
this, SLOT( calHint() ) );
- action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
+ action = new Q3Action( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
action->addTo( actionMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( edit_global_options() ) );
if ( KOPrefs::instance()->mShowFullMenu ) {
actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
}
// actionMenu->insertSeparator();
- action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
+ action = new Q3Action( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
this );
action->addTo( importMenu_X );
connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
- action = new QAction( "import_quick", i18n("Import last file"), 0,
+ action = new Q3Action( "import_quick", i18n("Import last file"), 0,
this );
action->addTo( importMenu_X );
connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
importMenu_X->insertSeparator();
- action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
+ action = new Q3Action( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
this );
action->addTo( importMenu_X );
connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
//#ifndef DESKTOP_VERSION
importMenu_X->insertSeparator();
- action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
+ action = new Q3Action( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
this );
action->addTo( importMenu_X );
connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
//#else
#ifdef _OL_IMPORT_
importMenu_X->insertSeparator();
- action = new QAction( "import_ol", i18n("Import from OL"), 0,
+ action = new Q3Action( "import_ol", i18n("Import from OL"), 0,
this );
action->addTo( importMenu_X );
connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
#endif
//#endif
//importMenu->insertSeparator();
#if 0
- action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
+ action = new Q3Action( "load_cal", i18n("Load Calendar Backup"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
#endif
- action = new QAction( "save_cal", i18n("Save Backup..."), 0,
+ action = new Q3Action( "save_cal", i18n("Save Backup..."), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
importMenu->insertSeparator();
importMenu->insertItem( i18n("Import"), importMenu_X );
//importMenu->insertSeparator();
- action = new QAction( "export ical", i18n("Export All Data"), 0,
+ action = new Q3Action( "export ical", i18n("Export All Data"), 0,
this );
action->addTo( exportMenu_X );
connect( action, SIGNAL( activated() ), SLOT( exportICalendar() ) );
- action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
+ action = new Q3Action( "import_qtopia", i18n("Export VCalendar"), 0,
this );
action->addTo( exportMenu_X );
connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
//LR
- QPopupMenu *ex2phone = new QPopupMenu( this );
+ Q3PopupMenu *ex2phone = new Q3PopupMenu( this );
ex2phone->insertItem(i18n("Complete calendar..."), 1 );
ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
importMenu->insertItem( i18n("Export"), exportMenu_X );
mPrintSelAction = 0;
#ifndef DESKTOP_VERSION
//importMenu->insertSeparator();
- brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
+ brAction = new Q3Action( "beam toggle", i18n("Beam receive enabled"), 0,
this );
brAction->addTo( beamMenu_X );
brAction->setToggleAction (true ) ;
connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
- action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
+ action = new Q3Action( "beam all", i18n("Beam complete calendar..."), 0,
this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
- action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
+ action = new Q3Action( "beam all", i18n("Beam filtered calendar..."), 0,
this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
importMenu->insertItem( i18n("Beam"), beamMenu_X );
#else
//importMenu->insertSeparator();
icon = loadPixmap( pathString + "print" );
- action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
+ action = new Q3Action( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ),
this, SLOT( printCal() ) );
icon = loadPixmap( pathString + "week" );
- action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
+ action = new Q3Action( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ),
this, SLOT( printSel() ) );
icon = loadPixmap( pathString + "whatsnext" );
- action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
+ action = new Q3Action( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ),
mView->viewManager(), SLOT( slotprintWNV() ) );
icon = loadPixmap( pathString + "list" );
- action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
+ action = new Q3Action( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ),
this, SLOT( printListView() ) );
icon = loadPixmap( pathString + "newevent" );
- action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
+ action = new Q3Action( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
action->addTo( beamMenu_X );
connect( action, SIGNAL( activated() ),
mView, SLOT( slotprintSelInc() ) );
mPrintSelAction = action;
importMenu->insertItem( i18n("Print"), beamMenu_X );
#endif
importMenu->insertSeparator();
- action = new QAction( "beam all", i18n("Save"), 0,
+ action = new Q3Action( "beam all", i18n("Save"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
- action = new QAction( "beam all", i18n("Exit (+save)"), 0,
+ action = new Q3Action( "beam all", i18n("Exit (+save)"), 0,
this );
action->addTo( importMenu );
connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
//menuBar->insertItem( "Configure",configureMenu );
//configureMenu->insertItem( "Toolbar",configureToolBarMenu );
icon = loadPixmap( "korganizer/korganizer" );
- action = new QAction( "Whats New", i18n("What's new?"), 0,this );
+ action = new Q3Action( "Whats New", i18n("What's new?"), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( whatsNew() ) );
- action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
+ action = new Q3Action( "featureHowto", i18n("Features + hints..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( features() ) );
- action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
+ action = new Q3Action( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( keyBindings() ) );
- action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
+ action = new Q3Action( "Storage Howto", i18n("Storage HowTo..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( storagehowto() ) );
- action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
+ action = new Q3Action( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( timetrackinghowto() ) );
- action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
+ action = new Q3Action( "Sync Howto", i18n("Sync HowTo..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( synchowto() ) );
- action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
+ action = new Q3Action( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( kdesynchowto() ) );
- action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
+ action = new Q3Action( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( multisynchowto() ) );
- action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
+ action = new Q3Action( "Auto saving", i18n("Auto saving..."), 0, this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( aboutAutoSaving() ) );
- action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
+ action = new Q3Action( "Problemd", i18n("Known Problems..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( aboutKnownBugs() ) );
- action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
+ action = new Q3Action( "Translate Howto", i18n("User translation..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( usertrans() ) );
- action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
+ action = new Q3Action( "Frequently asked questions", i18n("FAQ..."), 0,this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( faq() ) );
- action = new QAction( "licence", i18n("Licence..."), 0, this );
+ action = new Q3Action( "licence", i18n("Licence..."), 0, this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( licence() ) );
- action = new QAction( "about", i18n("About..."), 0, this );
+ action = new Q3Action( "about", i18n("About..."), 0, this );
action->addTo( helpMenu );
connect( action, SIGNAL( activated() ),
SLOT( about() ) );
//menuBar->insertSeparator();
// ******************************************************
// menubar icons
//menuBar->insertItem( iconToolBar );
//xdays_action
if (p-> mShowIconNewEvent)
ne_action->addTo( iconToolBar );
if (p->mShowIconNewTodo )
nt_action->addTo( iconToolBar );
if (p-> mShowIconSearch)
search_action->addTo( iconToolBar );
if (p-> mShowIconWhatsThis)
- QWhatsThis::whatsThisButton ( iconToolBar );
+ Q3WhatsThis::whatsThisButton ( iconToolBar );
if (p-> mShowIconNext)
whatsnext_action->addTo( viewToolBar );
if (p-> mShowIconNextDays)
xdays_action->addTo( viewToolBar );
if (p-> mShowIconJournal)
viewjournal_action->addTo( viewToolBar );
if (p-> mShowIconDay1)
day1_action->addTo( viewToolBar );
if (p-> mShowIconDay5)
day5_action->addTo( viewToolBar );
if (p-> mShowIconDay7)
day7_action->addTo( viewToolBar );
if (p-> mShowIconDay6)
day6_action->addTo( viewToolBar );
if (p-> mShowIconMonth)
month_action->addTo( viewToolBar );
if (p-> mShowIconList)
showlist_action->addTo( viewToolBar );
if (p-> mShowIconTodoview)
todoview_action->addTo( viewToolBar );
icon = loadPixmap( pathString + "2leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
if (p-> mShowIconBackFast) {
- action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
+ action = new Q3Action( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goPreviousMonth() ) );
action->addTo( navigatorToolBar );
}
icon = loadPixmap( pathString + "1leftarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
if (p-> mShowIconBack) {
- action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
+ action = new Q3Action( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goPrevious() ) );
action->addTo( navigatorToolBar );
}
icon = loadPixmap( pathString + "today" );
configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
if (p-> mShowIconToday)
today_action->addTo( navigatorToolBar );
icon = loadPixmap( pathString + "1rightarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
if (p-> mShowIconForward) {
- action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
+ action = new Q3Action( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goNext() ) );
action->addTo( navigatorToolBar );
}
icon = loadPixmap( pathString + "2rightarrowB" );
configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
if (p-> mShowIconForwardFast) {
- action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
+ action = new Q3Action( i18n("Next month"), icon, i18n("Next month"),0 , this );
connect( action, SIGNAL( activated() ),
mView, SLOT( goNextMonth() ) );
action->addTo( navigatorToolBar );
}
configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
if (p-> mShowIconNewEvent)
configureToolBarMenu->setItemChecked( 10, true );
if (p->mShowIconNewTodo )
configureToolBarMenu->setItemChecked( 20, true );
if (p-> mShowIconSearch)
configureToolBarMenu->setItemChecked( 120, true );
if (p-> mShowIconList)
configureToolBarMenu->setItemChecked( 30, true );
if (p-> mShowIconDay1)
configureToolBarMenu->setItemChecked( 40, true );
if (p-> mShowIconDay5)
configureToolBarMenu->setItemChecked( 50, true );
if (p-> mShowIconDay6)
configureToolBarMenu->setItemChecked( 75, true );
if (p-> mShowIconDay7)
configureToolBarMenu->setItemChecked( 60, true );
if (p-> mShowIconMonth)
configureToolBarMenu->setItemChecked( 70, true );
@@ -1495,65 +1505,65 @@ void MainWindow::initActions()
}
void MainWindow::calHint()
{
QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.");
KMessageBox::information( this, message);
}
void MainWindow::exportToPhone( int mode )
{
//ex2phone->insertItem(i18n("Complete calendar..."), 1 );
//ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
KOex2phonePrefs ex2phone;
ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
if ( mode == 1 )
ex2phone.setCaption(i18n("Export complete calendar"));
if ( mode == 2 )
ex2phone.setCaption(i18n("Export filtered calendar"));
if ( !ex2phone.exec() ) {
return;
}
KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
int inFuture = 0;
if ( ex2phone.mWriteBackFuture->isChecked() )
inFuture = ex2phone.mWriteBackFutureWeeks->value();
- QPtrList<Incidence> delSel;
+ Q3PtrList<Incidence> delSel;
if ( mode == 1 )
delSel = mCalendar->rawIncidences();
if ( mode == 2 )
delSel = mCalendar->incidences();
CalendarLocal* cal = new CalendarLocal();
cal->setLocalTime();
Incidence *incidence = delSel.first();
QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
while ( incidence ) {
if ( incidence->typeID() != journalID ) {
bool add = true;
if ( inFuture ) {
QDateTime dt;
if ( incidence->typeID() == todoID ) {
Todo * t = (Todo*)incidence;
if ( t->hasDueDate() )
dt = t->dtDue();
else
dt = cur.addSecs( 62 );
}
else {
bool ok;
dt = incidence->getNextOccurence( cur, &ok );
if ( !ok )
dt = cur.addSecs( -62 );
}
if ( dt < cur || dt > end ) {
add = false;
}
}
if ( add ) {
@@ -1566,68 +1576,68 @@ void MainWindow::exportToPhone( int mode )
PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
KPimGlobalPrefs::instance()->mEx2PhoneConnection,
KPimGlobalPrefs::instance()->mEx2PhoneModel );
setCaption( i18n("Writing to phone..."));
if ( PhoneFormat::writeToPhone( cal ) )
setCaption( i18n("Export to phone successful!"));
else
setCaption( i18n("Error exporting to phone!"));
delete cal;
}
void MainWindow::setDefaultPreferences()
{
KOPrefs *p = KOPrefs::instance();
p->mCompactDialogs = true;
p->mConfirm = true;
// p->mEnableQuickTodo = false;
}
QString MainWindow::resourcePath()
{
return KGlobal::iconLoader()->iconPath();
}
void MainWindow::displayText( QString text ,QString cap )
{
QDialog dia( this, "name", true ); ;
dia.setCaption( cap );
- QVBoxLayout* lay = new QVBoxLayout( &dia );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
- QTextBrowser tb ( &dia );
+ Q3TextBrowser tb ( &dia );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
void MainWindow::features()
{
KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
}
void MainWindow::usertrans()
{
KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
}
void MainWindow::storagehowto()
{
KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
}
void MainWindow::timetrackinghowto()
{
KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
}
void MainWindow::kdesynchowto()
{
@@ -1748,140 +1758,140 @@ void MainWindow::aboutKnownBugs()
i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
i18n("\nor report them in the bugtracker on\n") +
i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
QMessageBox::NoIcon,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton);
msg->exec();
delete msg;
}
QString MainWindow::defaultFileName()
{
return QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) );
}
QString MainWindow::syncFileName()
{
#ifdef DESKTOP_VERSION
return QDir::convertSeparators( locateLocal( "tmp", "synccalendar.ics" ) );
#else
return QString( "/tmp/synccalendar.ics" );
#endif
}
#include "koglobals.h"
#include <kcalendarsystem.h>
void MainWindow::updateWeek(QDate seda)
{
int weekNum = KGlobal::locale()->weekNum ( seda );
mWeekPixmap.fill( mWeekBgColor );
QPainter p ( &mWeekPixmap );
p.setFont( mWeekFont );
- p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
+ p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),Qt::AlignCenter, QString::number( weekNum) );
p.end();
- QIconSet icon3 ( mWeekPixmap );
+ QIcon icon3 ( mWeekPixmap );
mWeekAction->setIconSet ( icon3 );
}
void MainWindow::updateWeekNum(const DateList &selectedDates)
{
updateWeek( selectedDates.first() );
}
void MainWindow::processIncidenceSelection( Incidence *incidence )
{
if ( !incidence ) {
mShowAction->setMenuText( i18n("Show") );
enableIncidenceActions( false );
mNewSubTodoAction->setEnabled( false );
setCaptionToDates();
return;
}
QString startString = "";
if ( incidence->typeID() != todoID ) {
if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
if ( incidence->doesFloat() ) {
startString += ": "+incidence->dtStartDateStr( true );
startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
} else {
startString = ": "+incidence->dtStartStr(true);
startString += " --- "+((Event*)incidence)->dtEndStr(true);
}
} else {
if ( incidence->dtStart().time() != incidence->dtEnd().time() )
startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
"-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
if ( incidence->isBirthday() || incidence->isAnniversary() ) {
bool ok;
- QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
+ QDateTime noc = incidence->getNextOccurence( (QDateTime)mView->startDate().addDays(-1), &ok );
if ( ok ) {
int years = noc.date().year() - incidence->dtStart().date().year();
startString += i18n(" (%1 y.)"). arg( years );
}
}
else
startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
}
}
else {
if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
else
startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
}
if ( !incidence->location().isEmpty() )
startString += " (" +incidence->location()+")";
setCaption( incidence->summary()+startString);
enableIncidenceActions( true );
if ( incidence->typeID() == eventID ) {
mShowAction->setMenuText( i18n("Show Event") );
mNewSubTodoAction->setEnabled( false );
} else if ( incidence->typeID() == todoID ) {
mShowAction->setMenuText( i18n("Show Todo") );
mNewSubTodoAction->setEnabled( true );
} else {
mShowAction->setMenuText( i18n("Show") );
mNewSubTodoAction->setEnabled( false );
}
#ifdef DESKTOP_VERSION
static QPixmap jP = SmallIcon( "journal" );
static QPixmap eP = SmallIcon( "newevent" );
static QPixmap tP = SmallIcon( "newtodo" );
- QIconSet icon;
+ QIcon icon;
if ( incidence->typeID() == todoID )
- icon = QIconSet ( tP );
+ icon = QIcon ( tP );
else if ( incidence->typeID() == eventID )
- icon = QIconSet ( eP );
+ icon = QIcon ( eP );
else if ( incidence->typeID() == journalID )
- icon = QIconSet ( jP );
+ icon = QIcon ( jP );
mPrintSelAction->setIconSet ( icon );
#endif
}
void MainWindow::enableIncidenceActions( bool enabled )
{
mShowAction->setEnabled( enabled );
mEditAction->setEnabled( enabled );
mDeleteAction->setEnabled( enabled );
mCloneAction->setEnabled( enabled );
mMoveAction->setEnabled( enabled );
#ifndef DESKTOP_VERSION
mBeamAction->setEnabled( enabled );
#else
mPrintSelAction->setEnabled( enabled );
#endif
mCancelAction->setEnabled( enabled );
}
void MainWindow::importOL()
{
#ifdef _OL_IMPORT_
mView->clearAllViews();
KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
id->exec();
delete id;
mView->calendar()->checkAlarmForIncidence( 0, true );
mView->updateView();
#endif
}
void MainWindow::importBday()
@@ -2016,65 +2026,65 @@ void MainWindow::slotModifiedChanged( bool )
mSaveTimerStart = QDateTime::currentDateTime();
mSaveDelay = msec/1000;
qDebug("KO: Saving File in %d secs!", msec/1000);
}
void MainWindow::autoSaveWarning()
{
setCaption(i18n("Autosave disabled!" ));
}
void MainWindow::saveStopTimer()
{
mSaveTimer.stop();
mSaveDelay = 0;
}
void MainWindow::backupAllFiles()
{
QDate reference ( 2000,1,1);
int daysTo = reference.daysTo ( QDate::currentDate() );
setCaption(i18n("Creating backup ... please wait ..." ));
qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
// we need the file path, the backup dir and the number of bups as param
QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
bupDir = KGlobalSettings::backupDataDir();
int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
if ( retval == 0 ) {
setCaption(i18n("Backup cancelled" ));
qDebug("KO: Backup cancelled. Will try again tomorrow ");
// retval == 0 : backup skipped for today, try again tomorrow
KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
} else if ( retval == 1 ){
qDebug("KO: Backup created.");
// backup ok
- QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
+ Q3PtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
cal = calendars.next();
while ( cal ) {
if ( !cal->mErrorOnLoad ) {
KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
}
cal = calendars.next();
}
KOPrefs::instance()->mLastBackupDate = daysTo;
setCaption(i18n("Backup succesfully finished" ));
} else if ( retval == 2 ){
setCaption(i18n("Backup globally disabled" ));
qDebug("KO: Backup globally cancelled.");
// backup globally cancelled
KPimGlobalPrefs::instance()->mBackupEnabled = false;
}
// retval == 3: do nothing, try again later
}
void MainWindow::save()
{
if ( mSaveDelay ) {
int elapsed = mSaveTimerStart.secsTo( QDateTime::currentDateTime() );
if ( mSaveDelay < elapsed ) {
qDebug("KO: Pending save after wakeup from suspend detected.");
qDebug("KO: Save delay %d sec. Elapsed save time %d sec.", mSaveDelay, elapsed );
qDebug("KO: Restarting save timer to save in 10 sec.");
int msec = 10000;
mSaveTimer.start( msec, true );
mSaveTimerStart = QDateTime::currentDateTime();
mSaveDelay = msec/1000;
return;
}
@@ -2312,131 +2322,131 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
break;
case Qt::Key_Plus:
size = p->mHourSize +2;
if ( size <= 22 )
configureAgenda( size );
break;
case Qt::Key_Minus:
size = p->mHourSize - 2;
if ( size >= 4 )
configureAgenda( size );
break;
default:
e->ignore();
}
if ( pro > 0 ) {
selectFilter( pro+1 );
}
if ( showSelectedDates ) {
;// setCaptionToDates();
}
}
void MainWindow::fillFilterMenuTB()
{
selectFilterMenuTB->clear();
selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
selectFilterMenuTB->insertSeparator();
selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
selectFilterMenuTB->insertSeparator();
- QPtrList<CalFilter> fili = mView->filters();
+ Q3PtrList<CalFilter> fili = mView->filters();
CalFilter *curfilter = mView->filterView()->selectedFilter();
CalFilter *filter = fili.first();
int iii = 2;
bool checkitem = mView->filterView()->filtersEnabled();
while(filter) {
selectFilterMenuTB->insertItem( filter->name(), iii );
if ( filter == curfilter)
selectFilterMenuTB->setItemChecked( iii, checkitem );
filter = fili.next();
++iii;
}
if ( !checkitem )
selectFilterMenuTB->setItemChecked( 1, true );
int x = 0;
int y = iconToolBar->height();
int dX = 0;
int dY = 0;
if ( iconToolBar->orientation () == Qt:: Horizontal ) {
if ( iconToolBar->y() > height()/2 ) {
dY = selectFilterMenuTB->sizeHint().height()+8;
y = 0;
}
} else {
if ( iconToolBar->x() > width()/2 ) { // right side
x=0;
dX= selectFilterMenuTB->sizeHint().width()+8;
y = 0;
} else {
x= iconToolBar->width();
y = 0;
}
}
//qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
}
void MainWindow::fillFilterMenu()
{
selectFilterMenu->clear();
selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
selectFilterMenu->insertSeparator();
selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
selectFilterMenu->insertSeparator();
- QPtrList<CalFilter> fili = mView->filters();
+ Q3PtrList<CalFilter> fili = mView->filters();
CalFilter *curfilter = mView->filterView()->selectedFilter();
CalFilter *filter = fili.first();
int iii = 2;
bool checkitem = mView->filterView()->filtersEnabled();
while(filter) {
selectFilterMenu->insertItem( filter->name(), iii );
if ( filter == curfilter)
selectFilterMenu->setItemChecked( iii, checkitem );
filter = fili.next();
++iii;
}
if ( !checkitem )
selectFilterMenu->setItemChecked( 1, true );
}
void MainWindow::fillFilterMenuPopup()
{
filterPopupMenu->clear();
filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
filterPopupMenu->insertSeparator();
- QPtrList<CalFilter> fili = mView->filters();
+ Q3PtrList<CalFilter> fili = mView->filters();
CalFilter *curfilter = mView->filterView()->selectedFilter();
CalFilter *filter = fili.first();
int iii = 1;
bool checkitem = mView->filterView()->filtersEnabled();
while(filter) {
filterPopupMenu->insertItem( filter->name(), iii );
if ( filter == curfilter)
filterPopupMenu->setItemChecked( iii, checkitem );
filter = fili.next();
++iii;
}
if ( !checkitem )
filterPopupMenu->setItemChecked( 0, true );
}
void MainWindow::selectFilter( int fil )
{
if ( fil == 0 ) {
mView->editFilters( );
} else if ( fil == 1 ){
if ( mView->filterView()->filtersEnabled() )
mView->toggleFilerEnabled( );
} else {
if ( !mView->filterView()->filtersEnabled() ) {
mView->filterView()->blockSignals( true );
mView->toggleFilerEnabled( );
mView->filterView()->blockSignals( false );
}
mView->selectFilter( fil-2 );
}
}
void MainWindow::updateFilterToolbar()
@@ -2790,34 +2800,34 @@ void MainWindow::weekAction()
{
month = picker->getResult();
emit selectWeek ( month );
//qDebug("weekSelected %d ", month);
}
delete popup;
}
void MainWindow::hideEvent ( QHideEvent * )
{
QString message;
QDateTime nextA = mCalendar->nextAlarmEventDateTime();
if ( nextA.isValid() ) {
QString sum = mCalendar->nextSummary();
message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
setCaption( message );
}
}
void MainWindow::resizeEvent( QResizeEvent* e)
{
#ifndef DESKTOP_VERSION
if ( filterToolBar ) {
if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
if (QApplication::desktop()->width() > QApplication::desktop()->height() )
filterToolBar->hide();
else
filterToolBar->show();
}
}
#endif
- QMainWindow::resizeEvent( e);
+ Q3MainWindow::resizeEvent( e);
}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index a533d8b..6756216 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,85 +1,93 @@
#ifndef KORGE_MAINWINDOW_H
#define KORGE_MAINWINDOW_H
-#include <qmainwindow.h>
+#include <q3mainwindow.h>
#include <qtimer.h>
-#include <qdict.h>
+#include <q3dict.h>
#include <qfile.h>
#include <qmenubar.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qregexp.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <QCloseEvent>
+#include <QResizeEvent>
+#include <QPixmap>
+#include <Q3PopupMenu>
+#include <QHideEvent>
+#include <QKeyEvent>
#include <libkcal/incidence.h>
#include <ksyncmanager.h>
#include <kpopupmenu.h>
#ifndef DESKTOP_VERSION
#include <qcopchannel_qws.h>
#endif
-class QAction;
+class Q3Action;
class CalendarView;
class KSyncProfile;
#ifdef DESKTOP_VERSION
-#define QPEToolBar QToolBar
+#define QPEToolBar Q3ToolBar
#endif
class QPEToolBar;
namespace KCal {
class CalendarLocal;
}
using namespace KCal;
-class MainWindow : public QMainWindow
+class MainWindow : public Q3MainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0 );
~MainWindow();
bool beamReceiveEnabled();
static QString defaultFileName();
static QString syncFileName();
static QString resourcePath();
public slots:
void setUsesBigPixmaps ( bool );
void setCaption ( const QString & );
void updateWeekNum(const KCal::DateList &);
void updateWeek(QDate);
void updateFilterToolbar();
virtual void showMaximized ();
void configureAgenda( int );
- void recieve( const QCString& msg, const QByteArray& data );
- void receiveStart( const QCString& msg, const QByteArray& data );
+ void recieve( const Q3CString& msg, const QByteArray& data );
+ void receiveStart( const Q3CString& msg, const QByteArray& data );
protected slots:
void autoSaveWarning();
void loadDataAfterStart();
void calHint();
void startMultiSync();
void setCaptionToDates();
void weekAction();
void about();
void licence();
void faq();
void usertrans();
void features();
void synchowto();
void storagehowto();
void timetrackinghowto();
void kdesynchowto();
void multisynchowto();
void whatsNew();
void keyBindings();
void aboutAutoSaving();;
void aboutKnownBugs();
void processIncidenceSelection( Incidence * );
void importQtopia();
void importBday();
void importOL();
void importIcal();
void importFile( QString, bool );
void quickImportIcal();
void slotModifiedChanged( bool );
@@ -95,97 +103,97 @@ class MainWindow : public QMainWindow
void loadCalendar();
void exportVCalendar();
void exportICalendar();
void exportCalendar( bool );
void fillFilterMenu();
void fillFilterMenuTB();
void selectFilter( int );
void fillFilterMenuPopup();
void selectFilterPopup( int );
void exportToPhone( int );
void toggleBeamReceive();
void disableBR(bool);
signals:
void selectWeek ( int );
private slots:
void slotResetFocus();
void slotResetFocusLoop();
void showConfigureAgenda();
void getFile( bool ,const QString &);
void syncFileRequest(const QString &);
protected:
int mFocusLoop;
void hideEvent ( QHideEvent * );
QString sentSyncFile();
void displayText( QString, QString);
void enableIncidenceActions( bool );
bool askForQuitOnSaveError();
private:
bool mAutoSaveDisabled;
bool checkAutosave();
- QCString mCStringMess;
+ Q3CString mCStringMess;
QByteArray mByteData;
//void setMenuBar( QMenuBar * );
bool mBRdisabled;
#ifndef DESKTOP_VERSION
QCopChannel* infrared;
#endif
- QAction* brAction;
+ Q3Action* brAction;
KSyncManager* mSyncManager;
bool mClosed;
void saveOnClose();
bool mFlagKeyPressed;
bool mBlockAtStartup;
KMenuBar *menuBar1;
QPEToolBar *iconToolBar;
QPEToolBar *viewToolBar;
QPEToolBar *navigatorToolBar;
QPEToolBar *filterToolBar;
KMenuBar *filterMenubar;
- QPopupMenu * filterPopupMenu;
- QPopupMenu * mCurrentItemMenu;
+ Q3PopupMenu * filterPopupMenu;
+ Q3PopupMenu * mCurrentItemMenu;
void initActions();
void setDefaultPreferences();
void resizeEvent( QResizeEvent* e);
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
- QPopupMenu *configureToolBarMenu;
- QPopupMenu *selectFilterMenu;
- QPopupMenu *selectFilterMenuTB;
- QPopupMenu *configureAgendaMenu, *syncMenu;
+ Q3PopupMenu *configureToolBarMenu;
+ Q3PopupMenu *selectFilterMenu;
+ Q3PopupMenu *selectFilterMenuTB;
+ Q3PopupMenu *configureAgendaMenu, *syncMenu;
CalendarLocal *mCalendar;
CalendarView *mView;
- QAction *mNewSubTodoAction;
- QAction *mWeekAction;
+ Q3Action *mNewSubTodoAction;
+ Q3Action *mWeekAction;
QFont mWeekFont;
QPixmap mWeekPixmap;
QColor mWeekBgColor;
- QAction *mShowAction;
- QAction *mEditAction;
- QAction *mDeleteAction;
- QAction *mCloneAction;
- QAction *mMoveAction;
- QAction *mBeamAction;
- QAction *mCancelAction;
- QAction *mPrintSelAction;
+ Q3Action *mShowAction;
+ Q3Action *mEditAction;
+ Q3Action *mDeleteAction;
+ Q3Action *mCloneAction;
+ Q3Action *mMoveAction;
+ Q3Action *mBeamAction;
+ Q3Action *mCancelAction;
+ Q3Action *mPrintSelAction;
- QAction *mToggleNav;
- QAction *mToggleFilter;
- QAction *mToggleAllday;
- QAction *actionFilterMenuTB;
+ Q3Action *mToggleNav;
+ Q3Action *mToggleFilter;
+ Q3Action *mToggleAllday;
+ Q3Action *actionFilterMenuTB;
void closeEvent( QCloseEvent* ce );
QTimer mSaveTimer;
QDateTime mSaveTimerStart;
int mSaveDelay;
//bool mBlockSaveFlag;
bool mCalendarModifiedFlag;
QPixmap loadPixmap( QString );
QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix;
};
#endif
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index f6a1a6a..59c3e45 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -1,92 +1,95 @@
/*
This file is part of KOrganizer.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstring.h>
#include <qtooltip.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qlabel.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kiconloader.h>
#include "libkdepim/kdatepicker.h"
#include <knotifyclient.h>
#include "kdatetbl.h"
#include "koglobals.h"
#include <kglobalsettings.h>
#include "koprefs.h"
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include <kcalendarsystem.h>
#include "navigatorbar.h"
NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
: QWidget( parent, name )
{
- QBoxLayout *topLayout = new QHBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3HBoxLayout( this );
// Set up the control buttons and date label
- mCtrlFrame = new QFrame( this );
- mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised);
+ mCtrlFrame = new Q3Frame( this );
+ mCtrlFrame->setFrameStyle(Q3Frame::Panel|Q3Frame::Raised);
mCtrlFrame->setLineWidth(1);
topLayout->addWidget( mCtrlFrame );
bool isRTL = KOGlobals::self()->reverseLayout();
#ifndef DESKTOP_VERSION
bool isDesktop = false;
#else
bool isDesktop = true;
#endif
if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
isDesktop = true;
// Create backward navigation buttons
mPrevYear = new QPushButton( mCtrlFrame );
mPrevYear->setPixmap( SmallIcon( isDesktop ? "3leftarrowB" : "3leftarrow" ) );
QToolTip::add( mPrevYear, i18n("Previous Year") );
mPrevMonth = new QPushButton( mCtrlFrame );
mPrevMonth->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow") );
QToolTip::add( mPrevMonth, i18n("Previous Month") );
// Create forward navigation buttons
mNextMonth = new QPushButton( mCtrlFrame );
mNextMonth->setPixmap( SmallIcon( isDesktop ? "2rightarrowB" : "2rightarrow") );
QToolTip::add( mNextMonth, i18n("Next Month") );
mPrevWeek = new QPushButton( mCtrlFrame );
mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
QToolTip::add( mPrevWeek, i18n("Previous Week") );
@@ -100,92 +103,92 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
QToolTip::add( mNextYear, i18n("Next Year") );
mSelectMonth = new QPushButton( mCtrlFrame );
// Create month name label
//selectMonth->setFont( tfont );
// selectMonth->setAlignment( AlignCenter );
//mDateLabel = new QLabel( selectMonth );
//mDateLabel->setFont( tfont );
//mDateLabel->setAlignment( AlignCenter );
if ( QString ( name ) == QString("useBigPixmaps") ) {
mNextMonth->setFlat( true);
mNextWeek->setFlat( true);
mNextYear->setFlat( true);
mSelectMonth->setFlat( true);
mPrevYear->setFlat( true);
mPrevMonth->setFlat( true);
mPrevWeek->setFlat( true);
mPrevYear->setAutoRepeat( true );
mPrevMonth->setAutoRepeat( true );
mNextMonth->setAutoRepeat( true );
mPrevWeek->setAutoRepeat( true );
mNextWeek->setAutoRepeat( true );
mNextYear->setAutoRepeat( true );
} else {
mPrevWeek->hide();
mNextWeek->hide();
}
resetFont( font() );
// set up control frame layout
- QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
+ Q3BoxLayout *ctrlLayout = new Q3HBoxLayout( mCtrlFrame, 1 );
ctrlLayout->addWidget( mPrevYear, 3 );
ctrlLayout->addWidget( mPrevMonth, 3 );
ctrlLayout->addWidget( mPrevWeek, 3 );
//ctrlLayout->addStretch( 1 );
// ctrlLayout->addSpacing( 1 );
// ctrlLayout->addWidget( mDateLabel );
ctrlLayout->addWidget( mSelectMonth );
// ctrlLayout->addSpacing( 1 );
// ctrlLayout->addStretch( 1 );
ctrlLayout->addWidget( mNextWeek, 3 );
ctrlLayout->addWidget( mNextMonth, 3 );
ctrlLayout->addWidget( mNextYear, 3 );
connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
- mPrevYear->setFocusPolicy(NoFocus);
- mPrevMonth->setFocusPolicy(NoFocus);
- mNextMonth->setFocusPolicy(NoFocus);
- mPrevWeek->setFocusPolicy(NoFocus);
- mNextWeek->setFocusPolicy(NoFocus);
- mNextYear->setFocusPolicy(NoFocus);
- mSelectMonth->setFocusPolicy(NoFocus);
+ mPrevYear->setFocusPolicy(Qt::NoFocus);
+ mPrevMonth->setFocusPolicy(Qt::NoFocus);
+ mNextMonth->setFocusPolicy(Qt::NoFocus);
+ mPrevWeek->setFocusPolicy(Qt::NoFocus);
+ mNextWeek->setFocusPolicy(Qt::NoFocus);
+ mNextYear->setFocusPolicy(Qt::NoFocus);
+ mSelectMonth->setFocusPolicy(Qt::NoFocus);
setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
}
NavigatorBar::~NavigatorBar()
{
}
QSize NavigatorBar::sizeHint() const
{
int wid = mCurrentMinWid ;
if ( mPrevYear->isVisible() )
wid += mCurrentButtonMinWid;
if ( mPrevMonth->isVisible() )
wid += mCurrentButtonMinWid;
if ( mPrevWeek->isVisible() )
wid += mCurrentButtonMinWid;
if ( mNextMonth->isVisible() )
wid += mCurrentButtonMinWid;
if ( mNextWeek->isVisible() )
wid += mCurrentButtonMinWid;
if ( mNextYear->isVisible() )
wid += mCurrentButtonMinWid;
//qDebug("ret %d %d ", wid, mCurrentHei);
return QSize ( wid, mCurrentHei );
}
QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const
{
return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei );
}
void NavigatorBar::resetFont ( QFont fo )
{
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 9ccef14..a1880f5 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -1,76 +1,79 @@
/*
This file is part of KOrganizer.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef NAVIGATORBAR_H
#define NAVIGATORBAR_H
#include <libkcal/incidencebase.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3Frame>
+#include <QLabel>
class QPushButton;
-class QFrame;
+class Q3Frame;
class QLabel;
class NavigatorBar: public QWidget
{
Q_OBJECT
public:
NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
~NavigatorBar();
void showButtons( bool left, bool right );
void resetFont ( QFont fo );
QSize sizeHint() const;
QSize sizeHintTwoButtons( int butNum = 2 ) const;
public slots:
void selectDates( const KCal::DateList & );
void selectMonth();
signals:
void goNextMonth();
void goPrevMonth();
void goNextWeek();
void goPrevWeek();
void goNextYear();
void goPrevYear();
void monthSelected( int );
private:
int mCurrentHei;
int mCurrentMinWid;
int mCurrentButtonMinWid;
- QFrame *mCtrlFrame;
+ Q3Frame *mCtrlFrame;
QPushButton *mPrevYear;
QPushButton *mPrevMonth;
QPushButton *mNextMonth;
QPushButton *mPrevWeek;
QPushButton *mNextWeek;
QPushButton *mNextYear;
QPushButton *mSelectMonth;
//QLabel *mDateLabel;
};
#endif
diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp
index 7253c8e..ab31274 100644
--- a/korganizer/outgoingdialog.cpp
+++ b/korganizer/outgoingdialog.cpp
@@ -1,82 +1,82 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include <qfile.h>
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <kglobal.h>
#include <klocale.h>
#include <ktempfile.h>
#include <kstandarddirs.h>
#include <libkcal/event.h>
#include <libkcal/freebusy.h>
//#include <libkcal/imipscheduler.h>
#include <libkcal/dummyscheduler.h>
#include <libkcal/icalformat.h>
#include <libkcal/calendar.h>
#ifndef KORG_NOMAIL
#include "mailscheduler.h"
#endif
#include "koprefs.h"
#include "outgoingdialog.h"
#include "koeventviewerdialog.h"
#include "docprefs.h"
-ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev,
+ScheduleItemOut::ScheduleItemOut(Q3ListView *parent,IncidenceBase *ev,
Scheduler::Method method,
const QString &recipients)
- : QListViewItem(parent)
+ : Q3ListViewItem(parent)
{
mIncidence = ev;
mMethod = method;
mRecipients = recipients;
// kdDebug() << "ScheduleItemOut: setting the summary" << endl;
//Set the summary
if(ev->typeID() != freebusyID ) {
Incidence *incidence = static_cast<Incidence *>(ev);
setText(0,incidence->summary());
} else {
setText(0,i18n("Free Busy Object"));
}
// kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl;
//If the object is an event
if(ev->typeID()== eventID ) {
Event *event = static_cast<Event *>(ev);
setText(1,event->dtStartDateStr());
if (event->doesFloat()) { //If the event floats set the start and end times to no time
setText(2,i18n("no time"));
setText(4,i18n("no time"));
} else { //If it does not float
setText(2,event->dtStartTimeStr());
if (event->hasDuration()) {
setText(4,event->dtEndTimeStr());
} else {
setText(4,i18n("no time"));
}
}
if (event->hasEndDate()) {
@@ -94,86 +94,86 @@ ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev,
setText(1,event->dtStartDateStr());
if (!event->doesFloat()) {
setText(2,event->dtStartTimeStr());
}
}
if (event->hasDueDate()) {
setText(3,event->dtDueDateStr());
if (!event->doesFloat()) {
setText(4,event->dtDueTimeStr());
}
}
}
// kdDebug() << "ScheduleItemOut: checking if the object is a FreeBusy object" << endl;
//If the object is a freebusy object
if(ev->typeID() == freebusyID ) {
FreeBusy *freebusy = static_cast<FreeBusy *>(ev);
setText(1,freebusy->dtStartDateStr());
setText(2,freebusy->dtStartTimeStr());
//Must try and get this to the users local settings
setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) );
setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) );
}
// kdDebug() << "ScheduleItemOut: Setting the method" << endl;
//Set the Method
setText(5,Scheduler::translatedMethodName(mMethod));
}
OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent,
const char* name,bool modal,
- WFlags fl)
+ Qt::WFlags fl)
: OutgoingDialog_base(parent,name,modal,fl)
{
mCalendar = calendar;
mFormat = new ICalFormat;
if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) {
mScheduler = new DummyScheduler(mCalendar);
} else {
#ifndef KORG_NOMAIL
mScheduler = new MailScheduler(mCalendar);
#else
mScheduler = new DummyScheduler(mCalendar);
#endif
}
- mMessageListView->setColumnAlignment(1,AlignHCenter);
- mMessageListView->setColumnAlignment(2,AlignHCenter);
- mMessageListView->setColumnAlignment(3,AlignHCenter);
- mMessageListView->setColumnAlignment(4,AlignHCenter);
- QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)),
- this,SLOT(showEvent(QListViewItem *)));
+ mMessageListView->setColumnAlignment(1,Qt::AlignHCenter);
+ mMessageListView->setColumnAlignment(2,Qt::AlignHCenter);
+ mMessageListView->setColumnAlignment(3,Qt::AlignHCenter);
+ mMessageListView->setColumnAlignment(4,Qt::AlignHCenter);
+ QObject::connect(mMessageListView,SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this,SLOT(showEvent(Q3ListViewItem *)));
mDocPrefs = new DocPrefs("groupschedule");
loadMessages();
}
OutgoingDialog::~OutgoingDialog()
{
delete mDocPrefs;
delete mFormat;
}
bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method)
{
kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl;
if (method == Scheduler::Publish) return false;
if( mDocPrefs ) {
if (method != Scheduler::Cancel) {
mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true );
} else {
if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") )
return true;
}
}
if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) {
new ScheduleItemOut(mMessageListView,incidence,method);
saveMessage(incidence,method);
emit numMessagesChanged(mMessageListView->childCount());
}
else {
mScheduler->performTransaction(incidence,method);
}
return true;
@@ -207,163 +207,163 @@ void OutgoingDialog::send()
kdDebug() << "OutgoingDialog::send" << endl;
ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild());
while(item) {
bool success;
if (item->method() == Scheduler::Publish) {
success = mScheduler->publish(item->event(),item->recipients());
} else {
success = mScheduler->performTransaction(item->event(),item->method());
}
ScheduleItemOut *oldItem = item;
item = (ScheduleItemOut *)(item->nextSibling());
if (success) {
deleteMessage(oldItem->event());
delete (oldItem->event());
delete oldItem;
}
}
emit numMessagesChanged(mMessageListView->childCount());
}
void OutgoingDialog::deleteItem()
{
ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem());
if(!item)
return;
deleteMessage(item->event());
delete(item->event());
mMessageListView->takeItem(item);
emit numMessagesChanged(mMessageListView->childCount());
}
-void OutgoingDialog::showEvent(QListViewItem *qitem)
+void OutgoingDialog::showEvent(Q3ListViewItem *qitem)
{
ScheduleItemOut *item = (ScheduleItemOut *)qitem;
Event *event = 0;
Todo *todo = 0;
if ( item->event()->typeID() == eventID ) {
event = static_cast<Event *>(item->event());
}
if ( item->event()->typeID() == todoID ) {
todo = static_cast<Todo *>(item->event());
}
QString sendText;
if (event || todo) {
KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this);
if (event) eventViewer->setEvent(event);
if (todo) eventViewer->setTodo(todo);
sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>";
switch (item->method()) {
case Scheduler::Publish: {
sendText += item->recipients();
break; }
case Scheduler::Request: {
sendText += i18n("All attendees");
break; }
case Scheduler::Refresh: {
sendText += i18n("All attendees");
break; }
case Scheduler::Cancel: {
sendText += i18n("All attendees");
break; }
case Scheduler::Add: {
sendText += i18n("All attendees");
break; }
case Scheduler::Reply: {
sendText += i18n("The organizer %1").arg(item->event()->organizer());
break; }
case Scheduler::Counter: {
sendText += i18n("The organizer %1").arg(item->event()->organizer());
break; }
case Scheduler::Declinecounter: {
sendText += i18n("All attendees");
break; }
case Scheduler::NoMethod: {
sendText += "";
break; }
default:
sendText = "";
}
eventViewer->addText(sendText);
eventViewer->show();
}
}
bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method,
const QString &recipients)
{
KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics");
QString messageText = mFormat->createScheduleMessage(incidence,method);
- QTextStream *qts = ktfile.textStream();
+ Q3TextStream *qts = ktfile.textStream();
*qts << messageText;
*qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl;
*qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl;
mMessageMap[incidence]=ktfile.name();
return true;
}
bool OutgoingDialog::deleteMessage(IncidenceBase *incidence)
{
QFile f( mMessageMap[incidence] );
mMessageMap.remove(incidence);
if ( !f.exists() ) return false;
else
return f.remove();
}
void OutgoingDialog::loadMessages()
{
Scheduler::Method method;
QString recipients;
QString outgoingDirName = locateLocal("data","korganizer/outgoing");
QDir outgoingDir(outgoingDirName);
QStringList outgoing = outgoingDir.entryList(QDir::Files);
QStringList::ConstIterator it;
for(it = outgoing.begin(); it != outgoing.end(); ++it) {
kdDebug() << "-- File: " << (*it) << endl;
QFile f(outgoingDirName + "/" + (*it));
bool inserted = false;
QMap<IncidenceBase*, QString>::Iterator iter;
for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) {
if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true;
}
if (!inserted) {
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
kdDebug() << "OutgoingDialog::loadMessage(): Can't open file'"
<< (*it) << "'" << endl;
} else {
- QTextStream t(&f);
+ Q3TextStream t(&f);
QString messageString = t.read();
ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar,
messageString);
int begin_pos = messageString.find("METHOD-BEGIN:");
begin_pos = messageString.find('\n',begin_pos)+1;
QString meth = messageString.mid(begin_pos,1);
switch (meth.toInt()) {
case 0:method=Scheduler::Publish; break;
case 1:method=Scheduler::Request; break;
case 2:method=Scheduler::Refresh; break;
case 3:method=Scheduler::Cancel; break;
case 4:method=Scheduler::Add; break;
case 5:method=Scheduler::Reply; break;
case 6:method=Scheduler::Counter; break;
case 7:method=Scheduler::Declinecounter; break;
default :method=Scheduler::NoMethod; break;
}
begin_pos = messageString.find("RECIPIENTS-BEGIN:");
begin_pos = messageString.find('\n',begin_pos)+1;
int end_pos = messageString.find(":RECIPIENTS-END",begin_pos)-1;
recipients = messageString.mid(begin_pos, end_pos-begin_pos);
kdDebug() << "Outgoing::loadMessage(): Recipients: " << recipients << endl;
if (message) {
bool inserted = false;
QMap<IncidenceBase*, QString>::Iterator iter;
for ( iter = mMessageMap.begin(); iter != mMessageMap.end(); ++iter ) {
if (iter.data() == outgoingDirName + "/" + (*it)) inserted = true;
}
if (!inserted) {
kdDebug() << "OutgoingDialog::loadMessage(): got message '"
<< (*it) << "'" << endl;
diff --git a/korganizer/outgoingdialog.h b/korganizer/outgoingdialog.h
index a3d561a..e727087 100644
--- a/korganizer/outgoingdialog.h
+++ b/korganizer/outgoingdialog.h
@@ -1,88 +1,88 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef OUTGOINGDIALOG_H
#define OUTGOINGDIALOG_H
-#include <qlistview.h>
+#include <q3listview.h>
#include <qmap.h>
#include <qstring.h>
#include <libkcal/scheduler.h>
#include "docprefs.h"
#include "outgoingdialog_base.h"
using namespace KCal;
-class ScheduleItemOut : public QListViewItem
+class ScheduleItemOut : public Q3ListViewItem
{
public:
- ScheduleItemOut(QListView *parent,IncidenceBase *ev,
+ ScheduleItemOut(Q3ListView *parent,IncidenceBase *ev,
Scheduler::Method method, const QString &recipients=QString::null);
virtual ~ScheduleItemOut() {}
IncidenceBase *event() { return mIncidence; }
Scheduler::Method method() { return mMethod; }
QString recipients() { return mRecipients; }
private:
IncidenceBase *mIncidence;
Scheduler::Method mMethod;
QString mRecipients;
};
class OutgoingDialog : public OutgoingDialog_base
{
Q_OBJECT
public:
OutgoingDialog(Calendar *,QWidget* parent=0,const char* name=0,
- bool modal=false,WFlags fl=0);
+ bool modal=false,Qt::WFlags fl=0);
~OutgoingDialog();
bool addMessage(IncidenceBase *,Scheduler::Method);
bool addMessage(IncidenceBase *,Scheduler::Method,const QString &recipients);
void setDocumentId( const QString &id );
public slots:
void loadMessages();
signals:
void numMessagesChanged(int);
protected slots:
void send();
void deleteItem();
- void showEvent(QListViewItem *);
+ void showEvent(Q3ListViewItem *);
private:
bool saveMessage(IncidenceBase *,Scheduler::Method,const QString &recipients=0);
bool deleteMessage(IncidenceBase *);
Calendar *mCalendar;
ICalFormat *mFormat;
Scheduler *mScheduler;
QMap<IncidenceBase*, QString> mMessageMap;
DocPrefs *mDocPrefs;
};
#endif // OUTGOINGDIALOG_H
diff --git a/korganizer/outgoingdialog_base.cpp b/korganizer/outgoingdialog_base.cpp
index 1873b44..be8a870 100644
--- a/korganizer/outgoingdialog_base.cpp
+++ b/korganizer/outgoingdialog_base.cpp
@@ -1,76 +1,78 @@
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui'
**
** Created: Sat Mar 29 22:31:21 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "outgoingdialog_base.h"
#include <qvariant.h>
-#include <qheader.h>
-#include <qlistview.h>
+#include <q3header.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
/*
* Constructs a OutgoingDialog_base as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
-OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
+OutgoingDialog_base::OutgoingDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "OutgoingDialog_base" );
- OutgoingDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout");
+ OutgoingDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "OutgoingDialog_baseLayout");
- mMessageListView = new QListView( this, "mMessageListView" );
+ mMessageListView = new Q3ListView( this, "mMessageListView" );
mMessageListView->addColumn( tr2i18n( "Summary" ) );
mMessageListView->addColumn( tr2i18n( "Start Date" ) );
mMessageListView->addColumn( tr2i18n( "Start Time" ) );
mMessageListView->addColumn( tr2i18n( "End Date" ) );
mMessageListView->addColumn( tr2i18n( "End Time" ) );
mMessageListView->addColumn( tr2i18n( "Method" ) );
- mMessageListView->setFrameShape( QListView::StyledPanel );
- mMessageListView->setFrameShadow( QListView::Sunken );
+ mMessageListView->setFrameShape( Q3ListView::StyledPanel );
+ mMessageListView->setFrameShadow( Q3ListView::Sunken );
mMessageListView->setAllColumnsShowFocus( TRUE );
OutgoingDialog_baseLayout->addMultiCellWidget( mMessageListView, 0, 3, 0, 0 );
PushButton5 = new QPushButton( this, "PushButton5" );
PushButton5->setDefault( FALSE );
OutgoingDialog_baseLayout->addWidget( PushButton5, 0, 1 );
PushButton7 = new QPushButton( this, "PushButton7" );
OutgoingDialog_baseLayout->addWidget( PushButton7, 1, 1 );
PushButton6 = new QPushButton( this, "PushButton6" );
PushButton6->setDefault( TRUE );
OutgoingDialog_baseLayout->addWidget( PushButton6, 3, 1 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
OutgoingDialog_baseLayout->addItem( spacer, 2, 1 );
languageChange();
resize( QSize(582, 274).expandedTo(minimumSizeHint()) );
// signals and slots connections
connect( PushButton6, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( PushButton5, SIGNAL( clicked() ), this, SLOT( send() ) );
connect( PushButton7, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
OutgoingDialog_base::~OutgoingDialog_base()
diff --git a/korganizer/outgoingdialog_base.h b/korganizer/outgoingdialog_base.h
index af71bb1..5e81725 100644
--- a/korganizer/outgoingdialog_base.h
+++ b/korganizer/outgoingdialog_base.h
@@ -1,47 +1,51 @@
/****************************************************************************
** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/outgoingdialog_base.ui'
**
** Created: Sat Mar 29 22:24:26 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef OUTGOINGDIALOG_BASE_H
#define OUTGOINGDIALOG_BASE_H
#include <qvariant.h>
#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QListView;
-class QListViewItem;
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class Q3ListView;
+class Q3ListViewItem;
class QPushButton;
class OutgoingDialog_base : public QDialog
{
Q_OBJECT
public:
- OutgoingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ OutgoingDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~OutgoingDialog_base();
- QListView* mMessageListView;
+ Q3ListView* mMessageListView;
QPushButton* PushButton5;
QPushButton* PushButton7;
QPushButton* PushButton6;
protected:
- QGridLayout* OutgoingDialog_baseLayout;
+ Q3GridLayout* OutgoingDialog_baseLayout;
protected slots:
virtual void languageChange();
virtual void send();
virtual void deleteItem();
};
#endif // OUTGOINGDIALOG_BASE_H
diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp
index 2ae6720..ede9840 100644
--- a/korganizer/publishdialog.cpp
+++ b/korganizer/publishdialog.cpp
@@ -6,146 +6,146 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlineedit.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#ifndef KORG_NOKABC
#define KORG_NOKABC
//#include <kabc/addresseedialog.h>
#endif
#include "koprefs.h"
#include "publishdialog.h"
PublishDialog::PublishDialog(QWidget* parent, const char* name,
- bool modal, WFlags fl)
+ bool modal, Qt::WFlags fl)
: PublishDialog_base(parent,name,modal,fl)
{
setCaption(i18n("Select Addresses"));
mNameLineEdit->setEnabled(false);
mEmailLineEdit->setEnabled(false);
- connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)),
+ connect(mAddressListView,SIGNAL(selectionChanged(Q3ListViewItem *)),
SLOT(updateInput()));
}
PublishDialog::~PublishDialog()
{
}
void PublishDialog::addAttendee(Attendee *attendee)
{
mNameLineEdit->setEnabled(true);
mEmailLineEdit->setEnabled(true);
- QListViewItem *item = new QListViewItem(mAddressListView);
+ Q3ListViewItem *item = new Q3ListViewItem(mAddressListView);
item->setText(0,attendee->name());
item->setText(1,attendee->email());
mAddressListView->insertItem(item);
}
QString PublishDialog::addresses()
{
QString to = "";
- QListViewItem *item;
+ Q3ListViewItem *item;
int i, count;
count = mAddressListView->childCount();
for (i=0;i<count;i++) {
item = mAddressListView->firstChild();
mAddressListView->takeItem(item);
to += item->text(1);
if (i<count-1) {
to += ", ";
}
}
return to;
}
void PublishDialog::addItem()
{
mNameLineEdit->setEnabled(true);
mEmailLineEdit->setEnabled(true);
- QListViewItem *item = new QListViewItem(mAddressListView);
+ Q3ListViewItem *item = new Q3ListViewItem(mAddressListView);
mAddressListView->insertItem(item);
mAddressListView->setSelected(item,true);
mNameLineEdit->setText(i18n("(EmptyName)"));
mEmailLineEdit->setText(i18n("(EmptyEmail)"));
}
void PublishDialog::removeItem()
{
- QListViewItem *item;
+ Q3ListViewItem *item;
item = mAddressListView->selectedItem();
if (!item) return;
mAddressListView->takeItem(item);
item = mAddressListView->selectedItem();
if (!item) {
mNameLineEdit->setText("");
mEmailLineEdit->setText("");
mNameLineEdit->setEnabled(false);
mEmailLineEdit->setEnabled(false);
}
if (mAddressListView->childCount() == 0) {
mNameLineEdit->setEnabled(false);
mEmailLineEdit->setEnabled(false);
}
}
void PublishDialog::openAddressbook()
{
#ifndef KORG_NOKABC
KABC::Addressee::List addressList;
addressList = KABC::AddresseeDialog::getAddressees(this);
//KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
KABC::Addressee a = addressList.first();
if (!a.isEmpty()) {
uint i;
for (i=0;i<addressList.count();i++) {
a = addressList[i];
mNameLineEdit->setEnabled(true);
mEmailLineEdit->setEnabled(true);
- QListViewItem *item = new QListViewItem(mAddressListView);
+ Q3ListViewItem *item = new Q3ListViewItem(mAddressListView);
mAddressListView->setSelected(item,true);
mNameLineEdit->setText(a.realName());
mEmailLineEdit->setText(a.preferredEmail());
mAddressListView->insertItem(item);
}
}
#endif
}
void PublishDialog::updateItem()
{
- QListViewItem *item;
+ Q3ListViewItem *item;
item = mAddressListView->selectedItem();
if (!item) return;
item->setText(0,mNameLineEdit->text());
item->setText(1,mEmailLineEdit->text());
}
void PublishDialog::updateInput()
{
- QListViewItem *item;
+ Q3ListViewItem *item;
item = mAddressListView->selectedItem();
if (!item) return;
mNameLineEdit->setEnabled(true);
mEmailLineEdit->setEnabled(true);
QString mail = item->text(1);
mNameLineEdit->setText(item->text(0));
mEmailLineEdit->setText(mail);
}
diff --git a/korganizer/publishdialog.h b/korganizer/publishdialog.h
index 338603c..3ffeec4 100644
--- a/korganizer/publishdialog.h
+++ b/korganizer/publishdialog.h
@@ -1,55 +1,55 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef PUBLISHDIALOG_H
#define PUBLISHDIALOG_H
-#include <qlistview.h>
+#include <q3listview.h>
#include <libkcal/attendee.h>
#include "publishdialog_base.h"
using namespace KCal;
class PublishDialog : public PublishDialog_base
{
Q_OBJECT
public:
PublishDialog(QWidget* parent=0,const char* name=0,
- bool modal=true,WFlags fl=0);
+ bool modal=true,Qt::WFlags fl=0);
~PublishDialog();
void addAttendee(Attendee *attendee);
QString addresses();
signals:
void numMessagesChanged(int);
protected slots:
void addItem();
void removeItem();
void openAddressbook();
void updateItem();
void updateInput();
};
#endif // OUTGOINGDIALOG_H
diff --git a/korganizer/publishdialog_base.cpp b/korganizer/publishdialog_base.cpp
index 683f7e9..ce5c542 100644
--- a/korganizer/publishdialog_base.cpp
+++ b/korganizer/publishdialog_base.cpp
@@ -1,114 +1,117 @@
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/publishdialog_base.ui'
**
** Created: Sat Mar 29 22:31:35 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "publishdialog_base.h"
#include <qvariant.h>
-#include <qframe.h>
-#include <qheader.h>
+#include <q3frame.h>
+#include <q3header.h>
#include <qlabel.h>
#include <qlineedit.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
/*
* Constructs a PublishDialog_base as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
-PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
+PublishDialog_base::PublishDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "PublishDialog_base" );
- PublishDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout");
+ PublishDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "PublishDialog_baseLayout");
- mAddressListView = new QListView( this, "mAddressListView" );
+ mAddressListView = new Q3ListView( this, "mAddressListView" );
mAddressListView->addColumn( tr2i18n( "Name" ) );
mAddressListView->addColumn( tr2i18n( "Email" ) );
PublishDialog_baseLayout->addMultiCellWidget( mAddressListView, 0, 3, 0, 1 );
TextLabel1 = new QLabel( this, "TextLabel1" );
PublishDialog_baseLayout->addWidget( TextLabel1, 4, 0 );
TextLabel2 = new QLabel( this, "TextLabel2" );
PublishDialog_baseLayout->addWidget( TextLabel2, 5, 0 );
mEmailLineEdit = new QLineEdit( this, "mEmailLineEdit" );
PublishDialog_baseLayout->addWidget( mEmailLineEdit, 5, 1 );
mNameLineEdit = new QLineEdit( this, "mNameLineEdit" );
PublishDialog_baseLayout->addWidget( mNameLineEdit, 4, 1 );
PushButton10 = new QPushButton( this, "PushButton10" );
PublishDialog_baseLayout->addWidget( PushButton10, 0, 2 );
PushButton12 = new QPushButton( this, "PushButton12" );
PublishDialog_baseLayout->addWidget( PushButton12, 2, 2 );
PushButton11 = new QPushButton( this, "PushButton11" );
PublishDialog_baseLayout->addWidget( PushButton11, 1, 2 );
QSpacerItem* spacer = new QSpacerItem( 20, 241, QSizePolicy::Minimum, QSizePolicy::Expanding );
PublishDialog_baseLayout->addMultiCell( spacer, 3, 5, 2, 2 );
- Line2 = new QFrame( this, "Line2" );
- Line2->setFrameShape( QFrame::HLine );
- Line2->setFrameShadow( QFrame::Sunken );
- Line2->setFrameShape( QFrame::HLine );
+ Line2 = new Q3Frame( this, "Line2" );
+ Line2->setFrameShape( Q3Frame::HLine );
+ Line2->setFrameShadow( Q3Frame::Sunken );
+ Line2->setFrameShape( Q3Frame::HLine );
PublishDialog_baseLayout->addMultiCellWidget( Line2, 6, 6, 0, 2 );
- layout95 = new QHBoxLayout( 0, 0, 6, "layout95");
+ layout95 = new Q3HBoxLayout( 0, 0, 6, "layout95");
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout95->addItem( spacer_2 );
PushButton9 = new QPushButton( this, "PushButton9" );
PushButton9->setDefault( TRUE );
layout95->addWidget( PushButton9 );
PushButton8 = new QPushButton( this, "PushButton8" );
layout95->addWidget( PushButton8 );
PublishDialog_baseLayout->addMultiCellLayout( layout95, 7, 7, 0, 2 );
languageChange();
resize( QSize(420, 379).expandedTo(minimumSizeHint()) );
// signals and slots connections
connect( PushButton10, SIGNAL( clicked() ), this, SLOT( addItem() ) );
connect( PushButton11, SIGNAL( clicked() ), this, SLOT( removeItem() ) );
connect( PushButton12, SIGNAL( clicked() ), this, SLOT( openAddressbook() ) );
connect( PushButton9, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( mNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) );
connect( mEmailLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( updateItem() ) );
connect( PushButton8, SIGNAL( clicked() ), this, SLOT( reject() ) );
// tab order
setTabOrder( mAddressListView, mNameLineEdit );
setTabOrder( mNameLineEdit, mEmailLineEdit );
setTabOrder( mEmailLineEdit, PushButton10 );
setTabOrder( PushButton10, PushButton11 );
setTabOrder( PushButton11, PushButton12 );
setTabOrder( PushButton12, PushButton9 );
setTabOrder( PushButton9, PushButton8 );
}
diff --git a/korganizer/publishdialog_base.h b/korganizer/publishdialog_base.h
index 932474e..d1b40ae 100644
--- a/korganizer/publishdialog_base.h
+++ b/korganizer/publishdialog_base.h
@@ -1,60 +1,66 @@
/****************************************************************************
** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/korganizer/publishdialog_base.ui'
**
** Created: Sat Mar 29 22:24:27 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef PUBLISHDIALOG_BASE_H
#define PUBLISHDIALOG_BASE_H
#include <qvariant.h>
#include <qdialog.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <QLabel>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QFrame;
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class Q3Frame;
class QLabel;
class QLineEdit;
-class QListView;
-class QListViewItem;
+class Q3ListView;
+class Q3ListViewItem;
class QPushButton;
class PublishDialog_base : public QDialog
{
Q_OBJECT
public:
- PublishDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ PublishDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~PublishDialog_base();
- QListView* mAddressListView;
+ Q3ListView* mAddressListView;
QLabel* TextLabel1;
QLabel* TextLabel2;
QLineEdit* mEmailLineEdit;
QLineEdit* mNameLineEdit;
QPushButton* PushButton10;
QPushButton* PushButton12;
QPushButton* PushButton11;
- QFrame* Line2;
+ Q3Frame* Line2;
QPushButton* PushButton9;
QPushButton* PushButton8;
protected:
- QGridLayout* PublishDialog_baseLayout;
- QHBoxLayout* layout95;
+ Q3GridLayout* PublishDialog_baseLayout;
+ Q3HBoxLayout* layout95;
protected slots:
virtual void languageChange();
virtual void addItem();
virtual void removeItem();
virtual void openAddressbook();
virtual void updateItem();
};
#endif // PUBLISHDIALOG_BASE_H
diff --git a/korganizer/savetemplatedialog.cpp b/korganizer/savetemplatedialog.cpp
index 3544081..35bedba 100644
--- a/korganizer/savetemplatedialog.cpp
+++ b/korganizer/savetemplatedialog.cpp
@@ -1,71 +1,74 @@
/*
This file is part of KOrganizer.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
#include <keditlistbox.h>
#include <klocale.h>
#include "koprefs.h"
#include "savetemplatedialog.h"
SaveTemplateDialog::SaveTemplateDialog( IncidenceType type, QWidget *parent )
: KDialogBase( Plain, i18n("Save Template"), Ok | Cancel, Ok, parent, 0,
true, false ),
mType( type )
{
- QFrame *topFrame = plainPage();
- QVBoxLayout *topLayout = new QVBoxLayout( topFrame, 0, spacingHint() );
+ Q3Frame *topFrame = plainPage();
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( topFrame, 0, spacingHint() );
mEditListBox = new KEditListBox( i18n("Select Template Name"), topFrame,
0, false, KEditListBox::Add |
KEditListBox::Remove );
topLayout->addWidget( mEditListBox );
connect( mEditListBox, SIGNAL( changed() ), SLOT( slotChanged() ) );
QStringList templates;
if ( mType == EventType ) {
templates = KOPrefs::instance()->mEventTemplates;
} else if( mType == TodoType ) {
templates = KOPrefs::instance()->mTodoTemplates;
}
mEditListBox->insertStringList( templates );
}
SaveTemplateDialog::~SaveTemplateDialog()
{
}
void SaveTemplateDialog::slotOk()
{
emit templateSelected( mEditListBox->currentText() );
accept();
}
void SaveTemplateDialog::slotChanged()
{
if ( mType == EventType ) {
KOPrefs::instance()->mEventTemplates = mEditListBox->items();
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 9cfdc35..105b844 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,170 +1,177 @@
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qcheckbox.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlabel.h>
-#include <qlistview.h>
-#include <qwhatsthis.h>
+#include <q3listview.h>
+#include <q3whatsthis.h>
#include <qlineedit.h>
#include <qpushbutton.h>
-#include <qhbuttongroup.h>
+//#include <qhbuttongroup.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3Frame>
+#include <Q3PtrList>
+#include <QKeyEvent>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kmessagebox.h>
#include <libkdepim/kdateedit.h>
#include "koglobals.h"
#include "koprefs.h"
#include "klineedit.h"
#include "calendarview.h"
#include "koviewmanager.h"
#include "searchdialog.h"
SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
- : QVBox( 0 )
+ : Q3VBox( 0 )
{
mCalendar = calendar;
- QFrame *topFrame = new QFrame( this ) ;//plainPage();
- QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
+ Q3Frame *topFrame = new Q3Frame( this ) ;//plainPage();
+ Q3VBoxLayout *layout = new Q3VBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
// Search expression
- QHBoxLayout *subLayout = new QHBoxLayout();
+ Q3HBoxLayout *subLayout = new Q3HBoxLayout();
layout->addLayout(subLayout);
/*
searchLabel = new QLabel(topFrame);
searchLabel->setText(i18n("Search for:"));
subLayout->addWidget(searchLabel);
*/
QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame );
//OkButton->setDefault( true );
connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
subLayout->addWidget(OkButton);
searchEdit = new KLineEdit(topFrame);
subLayout->addWidget(searchEdit);
mAddItems = new QRadioButton( "+ ", topFrame );
mSubItems = new QRadioButton( "- ", topFrame );
mRefineItems = new QRadioButton( "< ", topFrame );
subLayout->addWidget( mAddItems );
subLayout->addWidget( mSubItems );
subLayout->addWidget( mRefineItems );
QFont fo ( mAddItems->font() );
fo.setBold( true );
fo.setPointSize( fo.pointSize() + 2 );
mAddItems->setFont( fo );
mSubItems->setFont( fo );
mRefineItems->setFont( fo );
connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool )));
connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool )));
connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool )));
QPushButton *togButton = new QPushButton( "", topFrame );
subLayout->addWidget(togButton);
connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes()));
togButton->setPixmap(SmallIcon("1updownarrow"));
togButton->setMinimumWidth( togButton->sizeHint().height() );
searchEdit->setText("*"); // Find all events by default
searchEdit->setFocus();
connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
// Subjects to search
// QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
// topFrame);
- incidenceGroup = new QHBox( topFrame );
+ incidenceGroup = new Q3HBox( topFrame );
layout->addWidget(incidenceGroup);
mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
//mSearchEvent->setChecked(true);
mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
- subjectGroup = new QHBox( topFrame );
+ subjectGroup = new Q3HBox( topFrame );
layout->addWidget(subjectGroup);
mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
mSummaryCheck->setChecked(true);
mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
- attendeeGroup = new QHBox( topFrame );
+ attendeeGroup = new Q3HBox( topFrame );
layout->addWidget(attendeeGroup );
new QLabel( i18n("Attendee:"),attendeeGroup );
mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
// Date range
// QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
// topFrame);
// layout->addWidget(rangeGroup);
QWidget *rangeWidget = new QWidget(topFrame);
int space = KDialog::spacingHint();
if ( QApplication::desktop()->width() <= 240 ) space = 1;
- QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space);
+ Q3HBoxLayout *rangeLayout = new Q3HBoxLayout(rangeWidget,0,space);
rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
mStartDate = new KDateEdit(rangeWidget);
rangeLayout->addWidget(mStartDate);
rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
mEndDate = new KDateEdit(rangeWidget);
mEndDate->setDate(QDate::currentDate().addDays(365));
rangeLayout->addWidget(mEndDate);
- QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
+ QToolButton *wt = Q3WhatsThis::whatsThisButton ( rangeWidget );
rangeLayout->addWidget( (QWidget*)wt );
layout->addWidget(rangeWidget);
// Results list view
listView = new KOListView(mCalendar,topFrame);
layout->addWidget(listView);
listView->showCompletedTodos();
//layout->setStretchFactor( listView, 333 );
//listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) );
//listView->setMaximumHeight( 50 );
listView->readSettings(KOGlobals::config(),"SearchListView Layout");
connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList()));
setCaption( i18n("KO/Pi Find: "));
#ifdef DESKTOP_VERSION
OkButton = new QPushButton( i18n("Close"), this );
connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
#endif
}
SearchDialog::~SearchDialog()
{
}
void SearchDialog::slot_add( bool b )
{
if ( b ) {
if ( mSubItems->isOn() ) mSubItems->toggle();
if ( mRefineItems->isOn() ) mRefineItems->toggle();
setCaption( i18n("Matching items will be added to list"));
} else
setCaption( i18n("List will be cleared before search"));
}
@@ -312,65 +319,65 @@ void SearchDialog::doSearch()
}
searchEdit->setFocus();
}
void SearchDialog::updateConfig()
{
listView->updateConfig();
}
void SearchDialog::updateView()
{
//qDebug("SearchDialog::updateView() %d ", isVisible());
QRegExp re;
re.setWildcard(true); // most people understand these better.
re.setCaseSensitive(false);
QString st = searchEdit->text();
if ( st.right(1) != "*")
st += "*";
re.setPattern(st);
mMatchedEvents.clear();
mMatchedTodos.clear();
mMatchedJournals.clear();
if (re.isValid()) {
search(re);
}
listView->setStartDate( mStartDate->date() );
listView->showEvents(mMatchedEvents);
listView->addTodos(mMatchedTodos);
listView->addJournals(mMatchedJournals);
}
void SearchDialog::search(const QRegExp &re)
{
- QPtrList<Event> events;
+ Q3PtrList<Event> events;
if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
if ( mRefineItems->isChecked() ) events = mMatchedEvents;
mMatchedEvents.clear();
}
if ( mSearchEvent->isChecked() ) {
if ( !mRefineItems->isChecked() )
events = mCalendar->events( mStartDate->date(),
mEndDate->date(),
false /*mInclusiveCheck->isChecked()*/ );
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
if (mSummaryCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(ev->summary()) != -1)
#else
if (re.match(ev->summary()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else {
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
continue;
}
#if QT_VERSION >= 0x030000
if (re.search(ev->location()) != -1)
#else
if (re.match(ev->location()) != -1)
@@ -390,194 +397,194 @@ void SearchDialog::search(const QRegExp &re)
if (re.search(ev->description()) != -1)
#else
if (re.match(ev->description()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else{
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
continue;
}
}
if (mCategoryCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(ev->categoriesStr()) != -1)
#else
if (re.match(ev->categoriesStr()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else{
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
continue;
}
}
if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
- QPtrList<Attendee> tmpAList = ev->attendees();
+ Q3PtrList<Attendee> tmpAList = ev->attendees();
Attendee *a;
for (a = tmpAList.first(); a; a = tmpAList.next()) {
if (mSearchAName->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(a->name()) != -1)
#else
if (re.match(a->name()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else{
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
break;
}
}
if (mSearchAEmail->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(a->email()) != -1)
#else
if (re.match(a->email()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedEvents.remove(ev);
else{
if ( !mMatchedEvents.contains( ev ) )
mMatchedEvents.append(ev);
}
break;
}
}
}
}
}
}
- QPtrList<Todo> todos;
+ Q3PtrList<Todo> todos;
if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
if ( mRefineItems->isChecked() ) todos = mMatchedTodos ;
mMatchedTodos.clear();
}
if ( mSearchTodo->isChecked() ) {
if ( !mRefineItems->isChecked() ) todos = mCalendar->todos( );
Todo *tod;
for(tod=todos.first();tod;tod=todos.next()) {
if (mSummaryCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(tod->summary()) != -1)
#else
if (re.match(tod->summary()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
continue;
}
}
if (mDescriptionCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(tod->description()) != -1)
#else
if (re.match(tod->description()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
continue;
}
}
if (mCategoryCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(tod->categoriesStr()) != -1)
#else
if (re.match(tod->categoriesStr()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
continue;
}
}
if ( mSearchAName->isChecked() || mSearchAEmail->isChecked() ) {
- QPtrList<Attendee> tmpAList = tod->attendees();
+ Q3PtrList<Attendee> tmpAList = tod->attendees();
Attendee *a;
for (a = tmpAList.first(); a; a = tmpAList.next()) {
if (mSearchAName->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(a->name()) != -1)
#else
if (re.match(a->name()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
break;
}
}
if (mSearchAEmail->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(a->email()) != -1)
#else
if (re.match(a->email()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedTodos.remove(tod);
else if (!mMatchedTodos.contains( tod ))
mMatchedTodos.append(tod);
break;
}
}
}
}
}
}
- QPtrList<Journal> journals;
+ Q3PtrList<Journal> journals;
if ( !mAddItems->isChecked() && !mSubItems->isChecked() ) {
if ( mRefineItems->isChecked() ) journals = mMatchedJournals ;
mMatchedJournals.clear();
}
if (mSearchJournal->isChecked() ) {
if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals();
Journal* journ;
for(journ=journals.first();journ;journ=journals.next()) {
if ( journ->dtStart().date() <= mEndDate->date()
&&journ->dtStart().date() >= mStartDate->date()) {
if (mDescriptionCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(journ->description()) != -1)
#else
if (re.match(journ->description()) != -1)
#endif
{
if ( mSubItems->isChecked() )
mMatchedJournals.remove(journ);
else if (!mMatchedJournals.contains( journ ))
mMatchedJournals.append(journ);
continue;
}
}
if (mSummaryCheck->isChecked()) {
#if QT_VERSION >= 0x030000
if (re.search(journ->summary()) != -1)
#else
if (re.match(journ->summary()) != -1)
#endif
{
diff --git a/korganizer/searchdialog.h b/korganizer/searchdialog.h
index 945ff65..5df6116 100644
--- a/korganizer/searchdialog.h
+++ b/korganizer/searchdialog.h
@@ -1,102 +1,106 @@
/*
This file is part of KOrganizer.
Copyright (c) 1998 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef SEARCHDIALOG_H
#define SEARCHDIALOG_H
#include <qregexp.h>
#include <qradiobutton.h>
+//Added by qt3to4:
+#include <QLabel>
+#include <QKeyEvent>
+#include <Q3PtrList>
#include <kdialogbase.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <libkcal/calendar.h>
#include "kolistview.h"
class KDateEdit;
class QCheckBox;
class QLineEdit;
class KLineEdit;
class QLabel;
class CalendarView;
using namespace KCal;
-class SearchDialog : public QVBox
+class SearchDialog : public Q3VBox
{
Q_OBJECT
public:
SearchDialog(Calendar *calendar,CalendarView *parent=0);
virtual ~SearchDialog();
KOListView *listview(){ return listView;}
void updateView();
void raiseAndSelect();
public slots:
void changeEventDisplay(Event *, int) { updateView(); }
void updateConfig();
void updateList();
protected slots:
void setFocusToList();
void accept();
void doSearch();
void searchTextChanged( const QString &_text );
void toggleCheckboxes();
void slot_add( bool );
void slot_sub( bool );
void slot_refine( bool );
signals:
void showEventSignal(Event *);
void editEventSignal(Event *);
void deleteEventSignal(Event *);
private:
- QHBox *incidenceGroup ,*subjectGroup ,*attendeeGroup;
+ Q3HBox *incidenceGroup ,*subjectGroup ,*attendeeGroup;
void search(const QRegExp &);
Calendar *mCalendar;
- QPtrList<Event> mMatchedEvents;
- QPtrList<Todo> mMatchedTodos;
- QPtrList<Journal> mMatchedJournals;
+ Q3PtrList<Event> mMatchedEvents;
+ Q3PtrList<Todo> mMatchedTodos;
+ Q3PtrList<Journal> mMatchedJournals;
QLabel *searchLabel;
KLineEdit *searchEdit;
KOListView *listView;
KDateEdit *mStartDate;
KDateEdit *mEndDate;
QCheckBox *mSummaryCheck;
QCheckBox *mDescriptionCheck;
QCheckBox *mCategoryCheck;
QCheckBox *mSearchEvent;
QCheckBox *mSearchTodo;
QCheckBox *mSearchJournal;
QCheckBox *mSearchAName;
QCheckBox *mSearchAEmail;
QRadioButton *mAddItems, *mSubItems, *mRefineItems;
void keyPressEvent ( QKeyEvent *e) ;
};
#endif
diff --git a/korganizer/statusdialog.cpp b/korganizer/statusdialog.cpp
index 7137c49..8186ebb 100644
--- a/korganizer/statusdialog.cpp
+++ b/korganizer/statusdialog.cpp
@@ -1,66 +1,69 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <qlabel.h>
#include <qpushbutton.h>
#include <qstringlist.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3HBoxLayout>
#include <kdebug.h>
#include <klocale.h>
#include "statusdialog.h"
StatusDialog::StatusDialog(QWidget* parent, const char* name) :
KDialog(parent,name,true)
{
setCaption(i18n("Set Your Status"));
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
topLayout->setSpacing( spacingHint() );
topLayout->setMargin( marginHint() );
- QBoxLayout *statusLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *statusLayout = new Q3HBoxLayout( topLayout );
QLabel *text = new QLabel(i18n("Set your status"),this);
statusLayout->addWidget( text );
mStatus = new QComboBox(false,this);
mStatus->insertStringList(Attendee::statusList());
statusLayout->addWidget( mStatus );
- QBoxLayout *buttonLayout = new QHBoxLayout( topLayout );
+ Q3BoxLayout *buttonLayout = new Q3HBoxLayout( topLayout );
QPushButton *ok = new QPushButton(i18n("&OK"), this);
connect ( ok,SIGNAL(clicked()), this,SLOT(accept()) );
buttonLayout->addWidget( ok );
QPushButton *cancel = new QPushButton(i18n("&Cancel"), this);
connect ( cancel,SIGNAL(clicked()), this,SLOT(reject()) );
buttonLayout->addWidget( cancel );
}
StatusDialog::~StatusDialog()
{
}
Attendee::PartStat StatusDialog::status()
{
return Attendee::PartStat( mStatus->currentItem() ) ;
}
diff --git a/korganizer/timeline.cpp b/korganizer/timeline.cpp
index 11be432..a6c3cdc 100644
--- a/korganizer/timeline.cpp
+++ b/korganizer/timeline.cpp
@@ -1,62 +1,62 @@
#include <qpainter.h>
#include <kdebug.h>
#include "timeline.h"
TimeLine::TimeLine( QWidget *parent, const char *name ) :
- QScrollView( parent, name )
+ Q3ScrollView( parent, name )
{
mPixelWidth = 1000;
resizeContents( mPixelWidth, 20 );
- viewport()->setBackgroundMode( PaletteBackground );
+ viewport()->setBackgroundMode( Qt::PaletteBackground );
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
}
TimeLine::~TimeLine()
{
}
void TimeLine::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
{
int spacingX = mDaySpacing;
int offsetX = mDayOffset;
// Draw vertical lines of grid
// kdDebug() << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl;
int cell = int( (cx - ( spacingX - offsetX ) ) / spacingX );
int x = cell * spacingX + ( spacingX - offsetX );
// kdDebug() << " x: " << x << endl;
while (x < cx + cw) {
// kdDebug() << " x: " << x << endl;
p->drawLine(x,cy,x,cy+ch);
p->drawText( x + 5, 15, QString::number( mStartDate.addDays( cell + 1 ).date().day() ) );
x += spacingX;
cell++;
}
}
void TimeLine::setDateRange( const QDateTime &start, const QDateTime &end )
{
mStartDate = start;
mEndDate = end;
mSecsPerPixel = mStartDate.secsTo( mEndDate ) / mPixelWidth;
mDaySpacing = 60 * 60 * 24 / mSecsPerPixel;
mDayOffset = QDateTime( mStartDate.date() ).secsTo( mStartDate ) / mSecsPerPixel;
kdDebug() << "TimeLines::setDateRange(): mDaySpacing: " << mDaySpacing << " mDayOffset: "
<< mDayOffset << " mSecsPerPixel: " << mSecsPerPixel << endl;
}
void TimeLine::setContentsPos( int pos )
{
- QScrollView::setContentsPos ( pos, 0 );
+ Q3ScrollView::setContentsPos ( pos, 0 );
}
diff --git a/korganizer/timeline.h b/korganizer/timeline.h
index ab3e5d3..bf301fa 100644
--- a/korganizer/timeline.h
+++ b/korganizer/timeline.h
@@ -1,33 +1,33 @@
#ifndef TIMELINE_H
#define TIMELINE_H
-#include <qscrollview.h>
+#include <q3scrollview.h>
#include <qdatetime.h>
-class TimeLine : public QScrollView
+class TimeLine : public Q3ScrollView
{
Q_OBJECT
public:
TimeLine( QWidget *parent = 0, const char *name = 0 );
virtual ~TimeLine();
void setDateRange( const QDateTime &start, const QDateTime &end );
public slots:
void setContentsPos( int pos );
protected:
void drawContents(QPainter* p, int cx, int cy, int cw, int ch);
private:
QDateTime mStartDate;
QDateTime mEndDate;
int mPixelWidth;
int mDaySpacing;
int mDayOffset;
int mSecsPerPixel;
};
#endif
diff --git a/korganizer/timespanview.cpp b/korganizer/timespanview.cpp
index df8ff88..0908056 100644
--- a/korganizer/timespanview.cpp
+++ b/korganizer/timespanview.cpp
@@ -1,111 +1,115 @@
#ifndef DESKTOP_VERSION
#include <qksplitter.h>
#else
#include <qsplitter.h>
#endif
-#include <qlistview.h>
+#include <q3listview.h>
#include <qlayout.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
+#include <Q3ValueList>
#include <klocale.h>
#include <kdebug.h>
#include "lineview.h"
#include "timeline.h"
#include "timespanview.h"
TimeSpanView::TimeSpanView( QWidget *parent, const char *name ) :
QWidget( parent, name )
{
- QBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3BoxLayout *topLayout = new Q3VBoxLayout( this );
#ifndef DESKTOP_VERSION
mSplitter = new QKSplitter( this );
#else
mSplitter = new QSplitter( this );
#endif
topLayout->addWidget( mSplitter );
- mList = new QListView( mSplitter );
+ mList = new Q3ListView( mSplitter );
mList->addColumn( i18n("Summary") );
QWidget *rightPane = new QWidget( mSplitter );
- QBoxLayout *rightPaneLayout = new QVBoxLayout( rightPane );
+ Q3BoxLayout *rightPaneLayout = new Q3VBoxLayout( rightPane );
mTimeLine = new TimeLine( rightPane );
mTimeLine->setFixedHeight( mList->header()->height() );
rightPaneLayout->addWidget( mTimeLine );
mLineView = new LineView( rightPane );
rightPaneLayout->addWidget( mLineView );
- QBoxLayout *buttonLayout = new QHBoxLayout( rightPaneLayout );
+ Q3BoxLayout *buttonLayout = new Q3HBoxLayout( rightPaneLayout );
QPushButton *zoomInButton = new QPushButton( i18n("Zoom In"), rightPane );
connect( zoomInButton, SIGNAL( clicked() ), SLOT( zoomIn() ) );
buttonLayout->addWidget( zoomInButton );
QPushButton *zoomOutButton = new QPushButton( i18n("Zoom Out"), rightPane );
connect( zoomOutButton, SIGNAL( clicked() ), SLOT( zoomOut() ) );
buttonLayout->addWidget( zoomOutButton );
QPushButton *centerButton = new QPushButton( i18n("Center View"), rightPane );
connect( centerButton, SIGNAL( clicked() ), SLOT( centerView() ) );
buttonLayout->addWidget( centerButton );
connect(mLineView->horizontalScrollBar(),SIGNAL(valueChanged(int)),
mTimeLine,SLOT(setContentsPos(int)));
}
TimeSpanView::~TimeSpanView()
{
}
-QValueList<int> TimeSpanView::splitterSizes()
+Q3ValueList<int> TimeSpanView::splitterSizes()
{
return mSplitter->sizes();
}
-void TimeSpanView::setSplitterSizes( QValueList<int> sizes )
+void TimeSpanView::setSplitterSizes( Q3ValueList<int> sizes )
{
mSplitter->setSizes( sizes );
}
void TimeSpanView::addItem( KCal::Event *event )
{
- new QListViewItem( mList, event->summary() );
+ new Q3ListViewItem( mList, event->summary() );
QDateTime startDt = event->dtStart();
QDateTime endDt = event->dtEnd();
// kdDebug() << "TimeSpanView::addItem(): start: " << startDt.toString()
// << " end: " << endDt.toString() << endl;
int startSecs = mStartDate.secsTo( startDt );
int durationSecs = startDt.secsTo( endDt );
// kdDebug() << "--- startSecs: " << startSecs << " dur: " << durationSecs << endl;
int startX = mStartDate.secsTo( startDt ) / mSecsPerPixel;
int endX = startX + startDt.secsTo( endDt ) / mSecsPerPixel;
// kdDebug() << "TimeSpanView::addItem(): s: " << startX << " e: " << endX << endl;
mLineView->addLine( startX, endX );
}
void TimeSpanView::clear()
{
mList->clear();
mLineView->clear();
}
void TimeSpanView::updateView()
{
#if QT_VERSION >= 0x030000
mLineView->updateContents();
mTimeLine->updateContents();
#else
diff --git a/korganizer/timespanview.h b/korganizer/timespanview.h
index 34cb1f7..f652374 100644
--- a/korganizer/timespanview.h
+++ b/korganizer/timespanview.h
@@ -1,60 +1,62 @@
#ifndef TIMESPANVIEW_H
#define TIMESPANVIEW_H
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <libkcal/event.h>
//class QSplitter;
#ifndef DESKTOP_VERSION
class QKSplitter;
#else
class QSplitter;
#define QKSplitter QSplitter
#endif
-class QListView;
+class Q3ListView;
class LineView;
class TimeLine;
class TimeSpanView : public QWidget
{
Q_OBJECT
public:
TimeSpanView( QWidget *parent=0, const char *name=0 );
virtual ~TimeSpanView();
void addItem( KCal::Event * );
- QValueList<int> splitterSizes();
- void setSplitterSizes( QValueList<int> );
+ Q3ValueList<int> splitterSizes();
+ void setSplitterSizes( Q3ValueList<int> );
void clear();
void setDateRange( const QDateTime &start, const QDateTime &end );
QDateTime startDateTime();
QDateTime endDateTime();
public slots:
void updateView();
void zoomIn();
void zoomOut();
void centerView();
signals:
void dateRangeChanged();
private:
QKSplitter *mSplitter;
- QListView *mList;
+ Q3ListView *mList;
TimeLine *mTimeLine;
LineView *mLineView;
QDateTime mStartDate;
QDateTime mEndDate;
int mSecsPerPixel;
};
#endif
diff --git a/libetpan/libetpan.pro b/libetpan/libetpan.pro
index 10f51da..909d064 100644
--- a/libetpan/libetpan.pro
+++ b/libetpan/libetpan.pro
@@ -1,38 +1,39 @@
+include( ../variables.pri )
######################################################################
# Automatically generated by qmake (1.07a) Fri Mar 18 19:27:39 2005
######################################################################
TEMPLATE = lib
-TARGET = microlibetpan
+TARGET = xmicrolibetpan
OBJECTS_DIR = obj
MOC_DIR = moc
DESTDIR=../bin
DEPENDPATH += include/libetpan \
src/data-types \
src/engine \
src/main \
src/driver/interface \
src/driver/tools \
src/low-level/imap \
src/low-level/imf \
src/low-level/maildir \
src/low-level/mbox \
src/low-level/mh \
src/low-level/mime \
src/low-level/nntp \
src/low-level/pop3 \
src/low-level/smtp \
src/driver/implementation/data-message \
src/driver/implementation/db \
src/driver/implementation/hotmail \
src/driver/implementation/imap \
src/driver/implementation/maildir \
src/driver/implementation/mbox \
src/driver/implementation/mh \
src/driver/implementation/mime-message \
src/driver/implementation/nntp \
src/driver/implementation/pop3
INCLUDEPATH += . \
./include \
src/data-types \
src/engine \
@@ -419,32 +420,34 @@ SOURCES += src/data-types/base64.c \
src/driver/implementation/imap/imapstorage.c \
src/driver/implementation/maildir/maildirdriver.c \
src/driver/implementation/maildir/maildirdriver_cached.c \
src/driver/implementation/maildir/maildirdriver_cached_message.c \
src/driver/implementation/maildir/maildirdriver_message.c \
src/driver/implementation/maildir/maildirdriver_tools.c \
src/driver/implementation/maildir/maildirstorage.c \
src/driver/implementation/mbox/mboxdriver.c \
src/driver/implementation/mbox/mboxdriver_cached.c \
src/driver/implementation/mbox/mboxdriver_cached_message.c \
src/driver/implementation/mbox/mboxdriver_message.c \
src/driver/implementation/mbox/mboxdriver_tools.c \
src/driver/implementation/mbox/mboxstorage.c \
src/driver/implementation/mh/mhdriver.c \
src/driver/implementation/mh/mhdriver_cached.c \
src/driver/implementation/mh/mhdriver_cached_message.c \
src/driver/implementation/mh/mhdriver_message.c \
src/driver/implementation/mh/mhdriver_tools.c \
src/driver/implementation/mh/mhstorage.c \
src/driver/implementation/mime-message/mime_message_driver.c \
src/driver/implementation/nntp/nntpdriver.c \
src/driver/implementation/nntp/nntpdriver_cached.c \
src/driver/implementation/nntp/nntpdriver_cached_message.c \
src/driver/implementation/nntp/nntpdriver_message.c \
src/driver/implementation/nntp/nntpdriver_tools.c \
src/driver/implementation/nntp/nntpstorage.c \
src/driver/implementation/pop3/pop3driver.c \
src/driver/implementation/pop3/pop3driver_cached.c \
src/driver/implementation/pop3/pop3driver_cached_message.c \
src/driver/implementation/pop3/pop3driver_message.c \
src/driver/implementation/pop3/pop3driver_tools.c \
src/driver/implementation/pop3/pop3storage.c
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/libetpan/libetpanE.pro b/libetpan/libetpanE.pro
index 4b82196..9ba1a6d 100644
--- a/libetpan/libetpanE.pro
+++ b/libetpan/libetpanE.pro
@@ -1,38 +1,38 @@
######################################################################
# Automatically generated by qmake (1.07a) Fri Mar 18 19:27:39 2005
######################################################################
TEMPLATE = lib
-TARGET = microlibetpan
+TARGET = xmicrolibetpan
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
DEPENDPATH += include/libetpan \
src/data-types \
src/engine \
src/main \
src/driver/interface \
src/driver/tools \
src/low-level/imap \
src/low-level/imf \
src/low-level/maildir \
src/low-level/mbox \
src/low-level/mh \
src/low-level/mime \
src/low-level/nntp \
src/low-level/pop3 \
src/low-level/smtp \
src/driver/implementation/data-message \
src/driver/implementation/db \
src/driver/implementation/hotmail \
src/driver/implementation/imap \
src/driver/implementation/maildir \
src/driver/implementation/mbox \
src/driver/implementation/mh \
src/driver/implementation/mime-message \
src/driver/implementation/nntp \
src/driver/implementation/pop3
INCLUDEPATH += . \
./include \
src/data-types \
src/engine \
diff --git a/libical/src/libical/libical.pro b/libical/src/libical/libical.pro
index b794f04..24f02af 100644
--- a/libical/src/libical/libical.pro
+++ b/libical/src/libical/libical.pro
@@ -40,32 +40,34 @@ HEADERS += astime.h \
icalvalueimpl.h \
icalversion.h \
pvl.h \
sspm.h
SOURCES += caldate.c \
icalarray.c \
icalattach.c \
icalcomponent.c \
icalderivedparameter.c \
icalderivedproperty.c \
icalderivedvalue.c \
icalduration.c \
icalenums.c \
icalerror.c \
icallangbind.c \
icalmemory.c \
icalmime.c \
icalparameter.c \
icalparser.c \
icalperiod.c \
icalproperty.c \
icalrecur.c \
icalrestriction.c \
icaltime.c \
icaltimezone.c \
icaltypes.c \
icalvalue.c \
pvl.c \
sspm.c
# vsnprintf.c
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/libical/src/libicalss/libicalss.pro b/libical/src/libicalss/libicalss.pro
index 7fb8a64..27170bf 100644
--- a/libical/src/libicalss/libicalss.pro
+++ b/libical/src/libicalss/libicalss.pro
@@ -13,32 +13,34 @@ include( ../../../variables.pri )
INCLUDEPATH += . ../libical
# Input
win32 {
DEFINES += YY_NO_UNISTD_H
}
HEADERS += icalcalendar.h \
icalclassify.h \
icalcluster.h \
icalclusterimpl.h \
icaldirset.h \
icaldirsetimpl.h \
icalfileset.h \
icalfilesetimpl.h \
icalgauge.h \
icalgaugeimpl.h \
icalmessage.h \
icalset.h \
icalspanlist.h \
icalss.h \
icalssyacc.h
SOURCES += icalcalendar.c \
icalclassify.c \
icalcluster.c \
icaldirset.c \
icalfileset.c \
icalgauge.c \
icalmessage.c \
icalset.c \
icalspanlist.c \
icalsslexer.c \
icalssyacc.c
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 3157214..3c4a81c 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -1,60 +1,62 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include <klocale.h>
#include "incidence.h"
#include "todo.h"
#include "alarm.h"
+//Added by qt3to4:
+#include <Q3ValueList>
using namespace KCal;
#include <qwidget.h>
Alarm::Alarm(Incidence *parent)
: mParent(parent),
mType(Audio),
mDescription(""), // to make operator==() not fail
mFile(""), // to make operator==() not fail
mMailSubject(""), // to make operator==() not fail
mAlarmSnoozeTime(5),
mAlarmRepeatCount(0),
mEndOffset(false),
mHasTime(false),
mAlarmEnabled(false)
{
}
Alarm::~Alarm()
{
}
bool Alarm::operator==( const Alarm& rhs ) const
{
if ( mType != rhs.mType ||
mAlarmSnoozeTime != rhs.mAlarmSnoozeTime ||
mAlarmRepeatCount != rhs.mAlarmRepeatCount ||
mAlarmEnabled != rhs.mAlarmEnabled ||
mHasTime != rhs.mHasTime)
return false;
@@ -183,102 +185,102 @@ void Alarm::setProcedureAlarm(const QString &programFile, const QString &argumen
mFile = programFile;
mDescription = arguments;
mParent->updated();
}
void Alarm::setProgramFile(const QString &programFile)
{
if (mType == Procedure) {
mFile = programFile;
mParent->updated();
}
}
QString Alarm::programFile() const
{
return (mType == Procedure) ? mFile : QString::null;
}
void Alarm::setProgramArguments(const QString &arguments)
{
if (mType == Procedure) {
mDescription = arguments;
mParent->updated();
}
}
QString Alarm::programArguments() const
{
return (mType == Procedure) ? mDescription : QString::null;
}
void Alarm::setEmailAlarm(const QString &subject, const QString &text,
- const QValueList<Person> &addressees, const QStringList &attachments)
+ const Q3ValueList<Person> &addressees, const QStringList &attachments)
{
mType = Email;
mMailSubject = subject;
mDescription = text;
mMailAddresses = addressees;
mMailAttachFiles = attachments;
mParent->updated();
}
void Alarm::setMailAddress(const Person &mailAddress)
{
if (mType == Email) {
mMailAddresses.clear();
mMailAddresses += mailAddress;
mParent->updated();
}
}
-void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses)
+void Alarm::setMailAddresses(const Q3ValueList<Person> &mailAddresses)
{
if (mType == Email) {
mMailAddresses = mailAddresses;
mParent->updated();
}
}
void Alarm::addMailAddress(const Person &mailAddress)
{
if (mType == Email) {
mMailAddresses += mailAddress;
mParent->updated();
}
}
-QValueList<Person> Alarm::mailAddresses() const
+Q3ValueList<Person> Alarm::mailAddresses() const
{
- return (mType == Email) ? mMailAddresses : QValueList<Person>();
+ return (mType == Email) ? mMailAddresses : Q3ValueList<Person>();
}
void Alarm::setMailSubject(const QString &mailAlarmSubject)
{
if (mType == Email) {
mMailSubject = mailAlarmSubject;
mParent->updated();
}
}
QString Alarm::mailSubject() const
{
return (mType == Email) ? mMailSubject : QString::null;
}
void Alarm::setMailAttachment(const QString &mailAttachFile)
{
if (mType == Email) {
mMailAttachFiles.clear();
mMailAttachFiles += mailAttachFile;
mParent->updated();
}
}
void Alarm::setMailAttachments(const QStringList &mailAttachFiles)
{
if (mType == Email) {
mMailAttachFiles = mailAttachFiles;
mParent->updated();
}
}
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index ac6ea0d..b24f0f7 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -1,74 +1,74 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_ALARM_H
#define KCAL_ALARM_H
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include "customproperties.h"
#include "duration.h"
#include "person.h"
namespace KCal {
class Incidence;
/**
This class represents an alarm notification.
*/
class Alarm : public CustomProperties
{
public:
enum Type { Invalid, Display, Procedure, Email, Audio };
- typedef QValueList<Alarm *> List;
+ typedef Q3ValueList<Alarm *> List;
/** Construct a new alarm with variables initialized to "sane" values. */
explicit Alarm(Incidence *parent);
/** Destruct Alarm object. */
~Alarm();
/** Compare this alarm with another one. */
bool operator==(const Alarm &) const;
bool operator!=(const Alarm &a) const { return !operator==(a); }
/** Set the type of the alarm.
If the specified type is different from the current type of the alarm,
the alarm's type-specific properties are initialised to null.
@param type type of alarm.
*/
void setType(Type type);
/** Return the type of the alarm */
Type type() const;
int offset();
QString offsetText();
/** Set the alarm to be a display alarm.
@param text text to display when the alarm is triggered.
*/
void setDisplayAlarm(const QString &text);
/** Set the text to be displayed when the alarm is triggered.
Ignored if the alarm is not a display alarm.
*/
void setText(const QString &text);
/** Return the text string that displays when the alarm is triggered. */
QString text() const;
/** Set the alarm to be an audio alarm.
@@ -83,81 +83,81 @@ class Alarm : public CustomProperties
@return The audio file for the alarm, or QString::null if not an audio alarm.
*/
QString audioFile() const;
/** Set the alarm to be a procedure alarm.
@param programFile program to execute when the alarm is triggered.
@param arguments arguments to supply to programFile.
*/
void setProcedureAlarm(const QString &programFile, const QString &arguments = QString::null);
/** Set the program file to execute when the alarm is triggered.
Ignored if the alarm is not a procedure alarm.
*/
void setProgramFile(const QString &programFile);
/** Return the name of the program file to execute when the alarm is triggered.
@return the program file name, or QString::null if not a procedure alarm.
*/
QString programFile() const;
/** Set the arguments to the program to execute when the alarm is triggered.
Ignored if the alarm is not a procedure alarm.
*/
void setProgramArguments(const QString &arguments);
/** Return the arguments to the program to run when the alarm is triggered.
@return the program arguments, or QString::null if not a procedure alarm.
*/
QString programArguments() const;
/** Set the alarm to be an email alarm.
@param subject subject line of email.
@param text body of email.
@param addressees email addresses of recipient(s).
@param attachments optional names of files to attach to the email.
*/
- void setEmailAlarm(const QString &subject, const QString &text, const QValueList<Person> &addressees,
+ void setEmailAlarm(const QString &subject, const QString &text, const Q3ValueList<Person> &addressees,
const QStringList &attachments = QStringList());
/** Send mail to this address when the alarm is triggered.
Ignored if the alarm is not an email alarm.
*/
void setMailAddress(const Person &mailAlarmAddress);
/** Send mail to these addresses when the alarm is triggered.
Ignored if the alarm is not an email alarm.
*/
- void setMailAddresses(const QValueList<Person> &mailAlarmAddresses);
+ void setMailAddresses(const Q3ValueList<Person> &mailAlarmAddresses);
/** Add this address to the list of addresses to send mail to when the alarm is triggered.
Ignored if the alarm is not an email alarm.
*/
void addMailAddress(const Person &mailAlarmAddress);
/** return the addresses to send mail to when an alarm goes off */
- QValueList<Person> mailAddresses() const;
+ Q3ValueList<Person> mailAddresses() const;
/** Set the subject line of the mail.
Ignored if the alarm is not an email alarm.
*/
void setMailSubject(const QString &mailAlarmSubject);
/** return the subject line of the mail */
QString mailSubject() const;
/** Attach this filename to the email.
Ignored if the alarm is not an email alarm.
*/
void setMailAttachment(const QString &mailAttachFile);
/** Attach these filenames to the email.
Ignored if the alarm is not an email alarm.
*/
void setMailAttachments(const QStringList &mailAttachFiles);
/** Add this filename to the list of files to attach to the email.
Ignored if the alarm is not an email alarm.
*/
void addMailAttachment(const QString &mailAttachFile);
/** return the filenames to attach to the email */
QStringList mailAttachments() const;
/** Set the email body text.
Ignored if the alarm is not an email alarm.
*/
void setMailText(const QString &text);
/** Return the email body text.
@return the body text, or QString::null if not an email alarm.
*/
QString mailText() const;
@@ -197,50 +197,50 @@ class Alarm : public CustomProperties
*/
void setSnoozeTime(int alarmSnoozeTime);
/** Get how long the alarm snooze interval is.
@return the number of minutes between snoozes.
*/
int snoozeTime() const;
/** set how many times an alarm is to repeat itself (w/snoozes) */
void setRepeatCount(int alarmRepeatCount);
/** get how many times an alarm repeats */
int repeatCount() const;
/** toggles the value of alarm to be either on or off.
set's the alarm time to be x minutes before dtStart time. */
void toggleAlarm();
/** set the alarm enabled status */
void setEnabled(bool enable);
/** get the alarm enabled status */
bool enabled() const;
/** Set the alarm's parent incidence */
void setParent( Incidence * );
/** get the alarm's parent incidence */
Incidence *parent() const { return mParent; }
private:
Incidence *mParent; // the incidence which this alarm belongs to
Type mType; // type of alarm
QString mDescription; // text to display/email body/procedure arguments
QString mFile; // procedure program to run/optional audio file to play
QStringList mMailAttachFiles; // filenames to attach to email
- QValueList<Person> mMailAddresses; // who to mail for reminder
+ Q3ValueList<Person> mMailAddresses; // who to mail for reminder
QString mMailSubject; // subject of email
int mAlarmSnoozeTime; // number of minutes after alarm to
// snooze before ringing again
int mAlarmRepeatCount; // number of times for alarm to repeat
// after the initial time
QDateTime mAlarmTime; // time at which to trigger the alarm
Duration mOffset; // time relative to incidence DTSTART to trigger the alarm
bool mEndOffset; // if true, mOffset relates to DTEND, not DTSTART
bool mHasTime; // use mAlarmTime, not mOffset
bool mAlarmEnabled;
};
}
#endif
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp
index 9b38d3f..bf095cf 100644
--- a/libkcal/calendar.cpp
+++ b/libkcal/calendar.cpp
@@ -1,64 +1,66 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <time.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include "exceptions.h"
#include "calfilter.h"
#include "calendar.h"
#include "syncdefines.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
Calendar::Calendar()
{
init();
setTimeZoneId( " 00:00 Europe/London(UTC)" );
}
Calendar::Calendar( const QString &timeZoneId )
{
init();
setTimeZoneId(timeZoneId);
}
void Calendar::init()
{
mObserver = 0;
mNewObserver = false;
mUndoIncidence = 0;
mDeleteIncidencesOnClose = true;
mModified = false;
mDefaultCalendar = 1;
// Setup default filter, which does nothing
mDefaultFilter = new CalFilter;
mFilter = mDefaultFilter;
mFilter->setEnabled(false);
// initialize random numbers. This is a hack, and not
// even that good of one at that.
@@ -242,281 +244,281 @@ void Calendar::setLocalTime()
mTimeZoneId = "";
setModified( true );
}
bool Calendar::isLocalTime() const
{
return mLocalTime;
}
const QString &Calendar::getEmail()
{
return mOwnerEmail;
}
void Calendar::setEmail(const QString &e)
{
mOwnerEmail = e;
setModified( true );
}
void Calendar::setFilter(CalFilter *filter)
{
mFilter = filter;
}
CalFilter *Calendar::filter()
{
return mFilter;
}
-QPtrList<Incidence> Calendar::incidences()
+Q3PtrList<Incidence> Calendar::incidences()
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = events();
+ Q3PtrList<Event> e = events();
for( i = e.first(); i; i = e.next() ) incidences.append( i );
- QPtrList<Todo> t = todos();
+ Q3PtrList<Todo> t = todos();
for( i = t.first(); i; i = t.next() ) incidences.append( i );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) incidences.append( i );
return incidences;
}
void Calendar::resetPilotStat(int id )
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = rawEvents();
+ Q3PtrList<Event> e = rawEvents();
for( i = e.first(); i; i = e.next() ) i->setPilotId( id );
- QPtrList<Todo> t = rawTodos();
+ Q3PtrList<Todo> t = rawTodos();
for( i = t.first(); i; i = t.next() ) i->setPilotId( id );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) i->setPilotId( id );
}
void Calendar::resetTempSyncStat()
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = rawEvents();
+ Q3PtrList<Event> e = rawEvents();
for( i = e.first(); i; i = e.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
- QPtrList<Todo> t = rawTodos();
+ Q3PtrList<Todo> t = rawTodos();
for( i = t.first(); i; i = t.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) i->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
}
-QPtrList<Incidence> Calendar::rawIncidences()
+Q3PtrList<Incidence> Calendar::rawIncidences()
{
- QPtrList<Incidence> incidences;
+ Q3PtrList<Incidence> incidences;
Incidence *i;
- QPtrList<Event> e = rawEvents();
+ Q3PtrList<Event> e = rawEvents();
for( i = e.first(); i; i = e.next() ) incidences.append( i );
- QPtrList<Todo> t = rawTodos();
+ Q3PtrList<Todo> t = rawTodos();
for( i = t.first(); i; i = t.next() ) incidences.append( i );
- QPtrList<Journal> j = journals();
+ Q3PtrList<Journal> j = journals();
for( i = j.first(); i; i = j.next() ) incidences.append( i );
return incidences;
}
-QPtrList<Event> Calendar::events( const QDate &date, bool sorted )
+Q3PtrList<Event> Calendar::events( const QDate &date, bool sorted )
{
- QPtrList<Event> el = rawEventsForDate(date,sorted);
+ Q3PtrList<Event> el = rawEventsForDate(date,sorted);
mFilter->apply(&el);
return el;
}
-QPtrList<Event> Calendar::events( const QDateTime &qdt )
+Q3PtrList<Event> Calendar::events( const QDateTime &qdt )
{
- QPtrList<Event> el = rawEventsForDate(qdt);
+ Q3PtrList<Event> el = rawEventsForDate(qdt);
mFilter->apply(&el);
return el;
}
-QPtrList<Event> Calendar::events( const QDate &start, const QDate &end,
+Q3PtrList<Event> Calendar::events( const QDate &start, const QDate &end,
bool inclusive)
{
- QPtrList<Event> el = rawEvents(start,end,inclusive);
+ Q3PtrList<Event> el = rawEvents(start,end,inclusive);
mFilter->apply(&el);
return el;
}
-QPtrList<Event> Calendar::events()
+Q3PtrList<Event> Calendar::events()
{
- QPtrList<Event> el = rawEvents();
+ Q3PtrList<Event> el = rawEvents();
mFilter->apply(&el);
return el;
}
void Calendar::addIncidenceBranch(Incidence *i)
{
addIncidence( i );
Incidence * inc;
- QPtrList<Incidence> Relations = i->relations();
+ Q3PtrList<Incidence> Relations = i->relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
addIncidenceBranch( inc );
}
}
bool Calendar::addIncidence(Incidence *i)
{
Incidence::AddVisitor<Calendar> v(this);
if ( i->calID() == 0 )
i->setCalID_block( mDefaultCalendar );
i->setCalEnabled( true );
return i->accept(v);
}
void Calendar::deleteIncidence(Incidence *in)
{
if ( in->typeID() == eventID )
deleteEvent( (Event*) in );
else if ( in->typeID() == todoID )
deleteTodo( (Todo*) in);
else if ( in->typeID() == journalID )
deleteJournal( (Journal*) in );
}
Incidence* Calendar::incidence( const QString& uid )
{
Incidence* i;
if( (i = todo( uid )) != 0 )
return i;
if( (i = event( uid )) != 0 )
return i;
if( (i = journal( uid )) != 0 )
return i;
return 0;
}
-QPtrList<Todo> Calendar::todos()
+Q3PtrList<Todo> Calendar::todos()
{
- QPtrList<Todo> tl = rawTodos();
+ Q3PtrList<Todo> tl = rawTodos();
mFilter->apply( &tl );
return tl;
}
// When this is called, the todo have already been added to the calendar.
// This method is only about linking related todos
void Calendar::setupRelations( Incidence *incidence )
{
QString uid = incidence->uid();
qDebug("Calendar::setupRelations %s", incidence->summary().latin1());
// First, go over the list of orphans and see if this is their parent
while( Incidence* i = mOrphans[ uid ] ) {
mOrphans.remove( uid );
i->setRelatedTo( incidence );
qDebug("Add child %s ti inc %s", i->summary().latin1(),incidence->summary().latin1());
incidence->addRelation( i );
mOrphanUids.remove( i->uid() );
}
// Now see about this incidences parent
if( !incidence->relatedTo() && !incidence->relatedToUid().isEmpty() ) {
// This incidence has a uid it is related to, but is not registered to it yet
// Try to find it
qDebug("Test parent for %s", incidence->summary().latin1());
Incidence* parent = this->incidenceForUid( incidence->relatedToUid(), true );
if( parent ) {
// Found it
qDebug("parent found for for %s", incidence->summary().latin1());
incidence->setRelatedTo( parent );
parent->addRelation( incidence );
} else {
qDebug("NO parent found for for %s", incidence->summary().latin1());
// Not found, put this in the mOrphans list
mOrphans.insert( incidence->relatedToUid(), incidence );
mOrphanUids.insert( incidence->uid(), incidence );
}
}
}
// If a task with subtasks is deleted, move it's subtasks to the orphans list
void Calendar::removeRelations( Incidence *incidence )
{
// qDebug("Calendar::removeRelations ");
QString uid = incidence->uid();
- QPtrList<Incidence> relations = incidence->relations();
+ Q3PtrList<Incidence> relations = incidence->relations();
for( Incidence* i = relations.first(); i; i = relations.next() )
if( !mOrphanUids.find( i->uid() ) ) {
mOrphans.insert( uid, i );
mOrphanUids.insert( i->uid(), i );
i->setRelatedTo( 0 );
i->setRelatedToUid( uid );
}
// If this incidence is related to something else, tell that about it
if( incidence->relatedTo() )
incidence->relatedTo()->removeRelation( incidence );
// Remove this one from the orphans list
if( mOrphanUids.remove( uid ) ) {
QString r2uid = incidence->relatedToUid();
- QPtrList<Incidence> tempList;
+ Q3PtrList<Incidence> tempList;
while( Incidence* i = mOrphans[ r2uid ] ) {
mOrphans.remove( r2uid );
if ( i != incidence ) tempList.append( i );
}
Incidence* inc = tempList.first();
while ( inc ) {
mOrphans.insert( r2uid, inc );
inc = tempList.next();
}
}
// LR: and another big bad bug found
#if 0
// This incidence is located in the orphans list - it should be removed
if( !( incidence->relatedTo() != 0 && mOrphans.remove( incidence->relatedTo()->uid() ) ) ) {
// Removing wasn't that easy
- for( QDictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
+ for( Q3DictIterator<Incidence> it( mOrphans ); it.current(); ++it ) {
if( it.current()->uid() == uid ) {
mOrphans.remove( it.currentKey() );
break;
}
}
}
#endif
}
void Calendar::registerObserver( Observer *observer )
{
mObserver = observer;
mNewObserver = true;
}
void Calendar::setModified( bool modified )
{
if ( mObserver ) mObserver->calendarModified( modified, this );
if ( modified != mModified || mNewObserver ) {
mNewObserver = false;
// if ( mObserver ) mObserver->calendarModified( modified, this );
mModified = modified;
}
}
void Calendar::setLoadedProductId( const QString &id )
{
mLoadedProductId = id;
}
QString Calendar::loadedProductId()
{
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index fbc40ad..5845f44 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -1,123 +1,123 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef CALENDAR_H
#define CALENDAR_H
#include <qobject.h>
#include <qstring.h>
#include <qdatetime.h>
-#include <qptrlist.h>
-#include <qdict.h>
+#include <q3ptrlist.h>
+#include <q3dict.h>
#include "customproperties.h"
#include "event.h"
#include "todo.h"
#include "journal.h"
#include "calfilter.h"
//#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */
class KConfig;
namespace KCal {
/**
This is the main "calendar" object class for KOrganizer. It holds
information like all appointments/events, user information, etc. etc.
one calendar is associated with each CalendarView (@see calendarview.h).
This is an abstract base class defining the interface to a calendar. It is
implemented by subclasses like @see CalendarLocal, which use different
methods to store and access the data.
Ownership of events etc. is handled by the following policy: As soon as an
event (or any other subclass of IncidenceBase) object is added to the
Calendar by addEvent() it is owned by the Calendar object. The Calendar takes
care of deleting it. All Events returned by the query functions are returned
as pointers, that means all changes to the returned events are immediately
visible in the Calendar. You shouldn't delete any Event object you get from
Calendar.
*/
class Calendar : public QObject, public CustomProperties,
public IncidenceBase::Observer
{
Q_OBJECT
public:
Calendar();
Calendar(const QString &timeZoneId);
virtual ~Calendar();
Incidence * undoIncidence() { return mUndoIncidence; };
bool undoDeleteIncidence();
void deleteIncidence(Incidence *in);
void resetTempSyncStat();
void resetPilotStat(int id);
/**
Clears out the current calendar, freeing all used memory etc.
*/
virtual void close() = 0;
virtual void addCalendar( Calendar* ) = 0;
virtual bool addCalendarFile( QString name, int id ) = 0;
virtual bool mergeCalendarFile( QString name ) = 0;
virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates , bool enabledOnly = false ,int * isDup = 0 ) = 0;
virtual Todo* todoForUid( const QString& uid, bool doNotCheckDuplicates = true, bool enabledOnly = false ,int * isDup = 0) = 0;
virtual void setSyncEventsReadOnly() = 0;
virtual void setSyncEventsEnabled() = 0;
virtual void stopAllTodos() = 0;
virtual void clearUndo( Incidence * newUndo );
/**
Sync changes in memory to persistant storage.
*/
virtual void save() = 0;
- virtual QPtrList<Event> getExternLastSyncEvents() = 0;
+ virtual Q3PtrList<Event> getExternLastSyncEvents() = 0;
virtual void removeSyncInfo( QString syncProfile) = 0;
virtual bool isSaving() { return false; }
/**
Return the owner of the calendar's full name.
*/
const QString &getOwner() const;
/**
Set the owner of the calendar. Should be owner's full name.
*/
void setOwner( const QString &os );
/**
Return the email address of the calendar owner.
*/
const QString &getEmail();
/**
Set the email address of the calendar owner.
*/
void setEmail( const QString & );
/**
Set time zone from a timezone string (e.g. -2:00)
*/
void setTimeZone( const QString &tz );
/**
Set time zone from a minutes value (e.g. -60)
*/
void setTimeZone( int tz );
/**
Return time zone as offest in minutes.
*/
int getTimeZone() const;
@@ -126,166 +126,166 @@ public:
*/
QString getTimeZoneStr() const;
/**
Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal
values).
*/
void setTimeZoneId( const QString & );
/**
Return time zone id.
*/
QString timeZoneId() const;
/**
Use local time, not UTC or a time zone.
*/
void setLocalTime();
/**
Return whether local time is being used.
*/
bool isLocalTime() const;
/**
Add an incidence to calendar.
@return true on success, false on error.
*/
virtual bool addIncidence( Incidence * );
// Adds an incidence and all relatedto incidences to the cal
void addIncidenceBranch( Incidence * );
/**
Return filtered list of all incidences of this calendar.
*/
- virtual QPtrList<Incidence> incidences();
+ virtual Q3PtrList<Incidence> incidences();
/**
Return unfiltered list of all incidences of this calendar.
*/
- virtual QPtrList<Incidence> rawIncidences();
+ virtual Q3PtrList<Incidence> rawIncidences();
/**
Adds a Event to this calendar object.
@param anEvent a pointer to the event to add
@return true on success, false on error.
*/
virtual bool addEventNoDup( Event *event ) = 0;
virtual bool addAnniversaryNoDup( Event *event ) = 0;
virtual bool addEvent( Event *anEvent ) = 0;
/**
Delete event from calendar.
*/
virtual void deleteEvent( Event * ) = 0;
/**
Retrieves an event on the basis of the unique string ID.
*/
virtual Event *event( const QString &UniqueStr ) = 0;
virtual Event *event( QString, QString ) = 0;
/**
Builds and then returns a list of all events that match for the
date specified. useful for dayView, etc. etc.
The calendar filter is applied.
*/
- QPtrList<Event> events( const QDate &date, bool sorted = false);
+ Q3PtrList<Event> events( const QDate &date, bool sorted = false);
/**
Get events, which occur on the given date.
The calendar filter is applied.
*/
- QPtrList<Event> events( const QDateTime &qdt );
+ Q3PtrList<Event> events( const QDateTime &qdt );
/**
Get events in a range of dates. If inclusive is set to true, only events
are returned, which are completely included in the range.
The calendar filter is applied.
*/
- QPtrList<Event> events( const QDate &start, const QDate &end,
+ Q3PtrList<Event> events( const QDate &start, const QDate &end,
bool inclusive = false);
/**
Return filtered list of all events in calendar.
*/
- virtual QPtrList<Event> events();
+ virtual Q3PtrList<Event> events();
/**
Return unfiltered list of all events in calendar.
*/
- virtual QPtrList<Event> rawEvents() = 0;
+ virtual Q3PtrList<Event> rawEvents() = 0;
/**
Add a todo to the todolist.
@return true on success, false on error.
*/
virtual bool addTodo( Todo *todo ) = 0;
virtual bool addTodoNoDup( Todo *todo ) = 0;
/**
Remove a todo from the todolist.
*/
virtual void deleteTodo( Todo * ) = 0;
virtual void deleteJournal( Journal * ) = 0;
/**
Return filterd list of todos.
*/
- virtual QPtrList<Todo> todos();
+ virtual Q3PtrList<Todo> todos();
/**
Searches todolist for an event with this unique string identifier,
returns a pointer or null.
*/
virtual Todo *todo( const QString &uid ) = 0;
virtual Todo *todo( QString, QString ) = 0;
/**
Returns list of todos due on the specified date.
*/
- virtual QPtrList<Todo> todos( const QDate &date ) = 0;
+ virtual Q3PtrList<Todo> todos( const QDate &date ) = 0;
/**
Return unfiltered list of todos.
*/
- virtual QPtrList<Todo> rawTodos() = 0;
+ virtual Q3PtrList<Todo> rawTodos() = 0;
/**
Add a Journal entry to calendar.
@return true on success, false on error.
*/
virtual bool addJournal( Journal * ) = 0;
/**
Return Journal for given date.
*/
virtual Journal *journal( const QDate & ) = 0;
- virtual QPtrList<Journal> journals4Date( const QDate & ) = 0;
+ virtual Q3PtrList<Journal> journals4Date( const QDate & ) = 0;
/**
Return Journal with given UID.
*/
virtual Journal *journal( const QString &UID ) = 0;
/**
Return list of all Journal entries.
*/
- virtual QPtrList<Journal> journals() = 0;
+ virtual Q3PtrList<Journal> journals() = 0;
/**
Searches all incidence types for an incidence with this unique
string identifier, returns a pointer or null.
*/
Incidence* incidence( const QString&UID );
/**
Setup relations for an incidence.
*/
virtual void setupRelations( Incidence * );
/**
Remove all relations to an incidence
*/
virtual void removeRelations( Incidence * );
/**
Set calendar filter, which filters events for the events() functions.
The Filter object is owned by the caller.
*/
void setFilter( CalFilter * );
/**
Return calendar filter.
*/
CalFilter *filter();
virtual QDateTime nextAlarm( int daysTo ) = 0;
virtual QString nextSummary( ) const = 0;
virtual void reInitAlarmSettings() = 0;
virtual QDateTime nextAlarmEventDateTime() const = 0;
virtual void checkAlarmForIncidence( Incidence *, bool ) = 0;
/**
Return all alarms, which ocur in the given time interval.
@@ -306,80 +306,80 @@ public:
Set product id returned by loadedProductId(). This function is only
useful for the calendar loading code.
*/
void setLoadedProductId( const QString & );
/**
Return product id taken from file that has been loaded. Returns
QString::null, if no calendar has been loaded.
*/
QString loadedProductId();
int defaultCalendar();
void setDontDeleteIncidencesOnClose ();
public slots:
void setDefaultCalendar( int );
virtual void setCalendarEnabled( int id, bool enable ) = 0;
virtual void setAllCalendarEnabled( bool enable ) = 0;
virtual void setAlarmEnabled( int id, bool enable ) = 0;
virtual void setReadOnly( int id, bool enable ) = 0;
virtual void setDefaultCalendarEnabledOnly() = 0;
virtual void setCalendarRemove( int id ) = 0;
virtual void getIncidenceCount( int calId, int& events, int & todos, int & journals) = 0;
signals:
void calendarChanged();
void calendarSaved();
void calendarLoaded();
void addAlarm(const QDateTime &qdt, const QString &noti );
void removeAlarm(const QDateTime &qdt, const QString &noti );
protected:
/**
Get unfiltered events, which occur on the given date.
*/
- virtual QPtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
+ virtual Q3PtrList<Event> rawEventsForDate( const QDateTime &qdt ) = 0;
/**
Get unfiltered events, which occur on the given date.
*/
- virtual QPtrList<Event> rawEventsForDate( const QDate &date,
+ virtual Q3PtrList<Event> rawEventsForDate( const QDate &date,
bool sorted = false ) = 0;
/**
Get events in a range of dates. If inclusive is set to true, only events
are returned, which are completely included in the range.
*/
- virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
+ virtual Q3PtrList<Event> rawEvents( const QDate &start, const QDate &end,
bool inclusive = false ) = 0;
Incidence *mNextAlarmIncidence;
Incidence *mUndoIncidence;
int mDefaultCalendar;
bool mDeleteIncidencesOnClose;
private:
void init();
QString mOwner; // who the calendar belongs to
QString mOwnerEmail; // email address of the owner
int mTimeZone; // timezone OFFSET from GMT (MINUTES)
bool mLocalTime; // use local time, not UTC or a time zone
CalFilter *mFilter;
CalFilter *mDefaultFilter;
QString mTimeZoneId;
Observer *mObserver;
bool mNewObserver;
bool mModified;
QString mLoadedProductId;
// This list is used to put together related todos
- QDict<Incidence> mOrphans;
- QDict<Incidence> mOrphanUids;
+ Q3Dict<Incidence> mOrphans;
+ Q3Dict<Incidence> mOrphanUids;
};
}
#endif
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index ce3cd09..cb52b7c 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -1,57 +1,57 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kglobal.h>
#include <klocale.h>
#include "vcaldrag.h"
#include "vcalformat.h"
#include "icalformat.h"
#include "exceptions.h"
#include "incidence.h"
#include "journal.h"
#include "filestorage.h"
#include "calfilter.h"
#include "calendarlocal.h"
// #ifndef DESKTOP_VERSION
// #include <qtopia/alarmserver.h>
// #endif
using namespace KCal;
CalendarLocal::CalendarLocal()
: Calendar()
{
init();
}
CalendarLocal::CalendarLocal(const QString &timeZoneId)
: Calendar(timeZoneId)
{
init();
@@ -163,172 +163,172 @@ Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckD
continue;
}
else {
if ( enabledOnly ) {
if ( !it->calEnabled() ) {
if ( isDup )
*isDup = it->calID();
continue;
}
}
}
if ( doNotCheckDuplicates ) return it;
if ( retVal ) {
if ( retVal->calID() > it->calID() ) {
if ( isDup )
*isDup = retVal->calID();
retVal = it;
}
} else {
retVal = it;
}
}
return retVal;
}
bool CalendarLocal::mergeCalendar( Calendar* remote )
{
// 1 look for raw inc in local
// if inc not in remote, delete in local
// 2 look for raw inc in remote
// if inc in local, replace it
// if not in local, add it to default calendar
- QPtrList<Incidence> localInc = rawIncidences();
+ Q3PtrList<Incidence> localInc = rawIncidences();
Incidence* inL = localInc.first();
while ( inL ) {
if ( ! inL->isReadOnly () )
if ( !remote->incidenceForUid( inL->uid(), true ))
deleteIncidence( inL );
inL = localInc.next();
}
- QPtrList<Incidence> er = remote->rawIncidences();
+ Q3PtrList<Incidence> er = remote->rawIncidences();
Incidence* inR = er.first();
while ( inR ) {
inL = incidenceForUid( inR->uid(),false );
if ( inL ) {
if ( ! inL->isReadOnly () || inL->uid().left(15) == QString("last-syncEvent-") ) {
int calID = inL->calID();
deleteIncidence( inL );
inL = inR->clone();
inL->setCalID_block( calID );
addIncidence( inL );
}
} else {
inL = inR->clone();
inL->setCalID_block( 0 );// add to default cal
addIncidence( inL );
}
inR = er.next();
}
return true;
}
bool CalendarLocal::addCalendarFile( QString name, int id )
{
CalendarLocal calendar( timeZoneId() );
calendar.setDefaultCalendar( id );
if ( calendar.load( name ) ) {
addCalendar( &calendar );
return true;
}
return false;
}
void CalendarLocal::setSyncEventsEnabled()
{
Event * ev;
ev = mEventList.first();
while ( ev ) {
if ( ev->uid().left(15) == QString("last-syncEvent-") )
ev->setCalEnabled( true );
ev = mEventList.next();
}
}
void CalendarLocal::setSyncEventsReadOnly()
{
Event * ev;
ev = mEventList.first();
while ( ev ) {
if ( ev->uid().left(15) == QString("last-syncEvent-") ) {
ev->setReadOnly( true );
}
ev = mEventList.next();
}
}
void CalendarLocal::addCalendar( Calendar* cal )
{
cal->setDontDeleteIncidencesOnClose();
setSyncEventsEnabled();
- QPtrList<Incidence> incList;
+ Q3PtrList<Incidence> incList;
{
- QPtrList<Event> EventList = cal->rawEvents();
+ Q3PtrList<Event> EventList = cal->rawEvents();
Event * ev = EventList.first();
while ( ev ) {
if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) {
ev->setCalID_block( 1 );
}
Event * se = event( ev->uid() );
if ( se )
incList.append( se );
ev->unRegisterObserver( cal );
ev->registerObserver( this );
mEventList.append( ev );
ev = EventList.next();
}
}
{
- QPtrList<Todo> TodoList = cal->rawTodos();
+ Q3PtrList<Todo> TodoList = cal->rawTodos();
Todo * ev = TodoList.first();
while ( ev ) {
ev->resetRelatedTo();
Todo * se = todo( ev->uid() );
if ( se )
deleteTodo( se );
ev = TodoList.next();
}
//TodoList = cal->rawTodos();
ev = TodoList.first();
while ( ev ) {
ev->unRegisterObserver( cal );
ev->registerObserver( this );
mTodoList.append( ev );
setupRelations( ev );
ev = TodoList.next();
}
}
{
- QPtrList<Journal> JournalList = cal->journals();
+ Q3PtrList<Journal> JournalList = cal->journals();
Journal * ev = JournalList.first();
while ( ev ) {
Journal * se = journal( ev->uid() );
if ( se )
incList.append( se );
ev->unRegisterObserver( cal );
ev->registerObserver( this );
mJournalList.append( ev );
ev = JournalList.next();
}
}
{
for (Incidence * inc = incList.first(); inc; inc = incList.next() ) {
deleteIncidence ( inc );
}
}
setModified( true );
}
bool CalendarLocal::load( const QString &fileName )
{
FileStorage storage( this, fileName );
return storage.load();
}
bool CalendarLocal::save( const QString &fileName, CalFormat *format )
{
FileStorage storage( this, fileName, format );
return storage.save();
}
void CalendarLocal::stopAllTodos()
{
@@ -452,106 +452,106 @@ bool CalendarLocal::addTodoNoDup( Todo *todo )
}
bool CalendarLocal::addTodo( Todo *todo )
{
mTodoList.append( todo );
todo->registerObserver( this );
// Set up subtask relations
setupRelations( todo );
setModified( true );
if ( todo->calID() == 0 )
todo->setCalID_block( mDefaultCalendar );
todo->setCalEnabled( true );
return true;
}
void CalendarLocal::deleteTodo( Todo *todo )
{
QString uid = todo->uid();
// Handle orphaned children
removeRelations( todo );
clearUndo(todo);
if ( mTodoList.removeRef( todo ) ) {
setModified( true );
}
Todo* dup = todoForUid( uid );
if ( dup )
setupRelations( dup );
}
-QPtrList<Todo> CalendarLocal::rawTodos()
+Q3PtrList<Todo> CalendarLocal::rawTodos()
{
- QPtrList<Todo> el;
+ Q3PtrList<Todo> el;
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
if ( it->calEnabled() ) el.append( it );
return el;
}
Todo *CalendarLocal::todo( QString syncProf, QString id )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo;
}
return 0;
}
void CalendarLocal::removeSyncInfo( QString syncProfile)
{
- QPtrList<Incidence> all = rawIncidences() ;
+ Q3PtrList<Incidence> all = rawIncidences() ;
Incidence *inc;
for ( inc = all.first(); inc; inc = all.next() ) {
inc->removeID( syncProfile );
}
if ( syncProfile.isEmpty() ) {
- QPtrList<Event> el;
+ Q3PtrList<Event> el;
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
el.append( todo );
}
for ( todo = el.first(); todo; todo = el.next() ) {
deleteIncidence ( todo );
}
} else {
Event *lse = event( "last-syncEvent-"+ syncProfile);
if ( lse )
deleteIncidence ( lse );
}
}
-QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
+Q3PtrList<Event> CalendarLocal::getExternLastSyncEvents()
{
- QPtrList<Event> el;
+ Q3PtrList<Event> el;
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->uid().left( 15 ) == QString("last-syncEvent-") )
if ( todo->summary().left(3) == "E: " )
el.append( todo );
}
return el;
}
Event *CalendarLocal::event( QString syncProf, QString id )
{
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo;
}
return 0;
}
Todo *CalendarLocal::todo( const QString &uid )
{
Todo *todo;
Todo *retVal = 0;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->calEnabled() && todo->uid() == uid ) {
if ( retVal ) {
if ( retVal->calID() > todo->calID() ) {
retVal = todo;
}
} else {
retVal = todo;
}
@@ -656,67 +656,67 @@ QString CalendarLocal:: getAlarmNotification()
ret = "proc_alarm" + alarm->programFile()+"+++";
} else {
ret = "audio_alarm" +alarm->audioFile() +"+++";
}
ret += "cal_alarm"+ mNextSummary.left( 25 );
if ( mNextSummary.length() > 25 )
ret += "\n" + mNextSummary.mid(25, 25 );
ret+= "\n"+mNextAlarmEventDateTimeString;
return ret;
}
void CalendarLocal::registerAlarm()
{
mLastAlarmNotificationString = getAlarmNotification();
// qDebug("++ register Alarm %s %s",mNextAlarmDateTime.toString().latin1(), mLastAlarmNotificationString.latin1() );
emit addAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
// #ifndef DESKTOP_VERSION
// AlarmServer::addAlarm ( mNextAlarmDateTime,"koalarm", mLastAlarmNotificationString.latin1() );
// #endif
}
void CalendarLocal::deRegisterAlarm()
{
if ( mLastAlarmNotificationString.isNull() )
return;
//qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
mNextAlarmEventDateTime = QDateTime();
// #ifndef DESKTOP_VERSION
// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
// #endif
}
-QPtrList<Todo> CalendarLocal::todos( const QDate &date )
+Q3PtrList<Todo> CalendarLocal::todos( const QDate &date )
{
- QPtrList<Todo> todos;
+ Q3PtrList<Todo> todos;
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( !todo->calEnabled() ) continue;
if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
todos.append( todo );
}
}
filter()->apply( &todos );
return todos;
}
void CalendarLocal::reInitAlarmSettings()
{
if ( !mNextAlarmIncidence ) {
nextAlarm( 1000 );
}
deRegisterAlarm();
mNextAlarmIncidence = 0;
checkAlarmForIncidence( 0, false );
}
QDateTime CalendarLocal::nextAlarm( int daysTo )
{
QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo );
QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
QDateTime next;
Event *e;
bool ok;
@@ -757,349 +757,349 @@ QDateTime CalendarLocal::nextAlarm( int daysTo )
return nextA;
}
Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
{
return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
}
Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
{
Alarm::List alarms;
Event *e;
for( e = mEventList.first(); e; e = mEventList.next() ) {
if ( !e->calEnabled() ) continue;
if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
else appendAlarms( alarms, e, from, to );
}
Todo *t;
for( t = mTodoList.first(); t; t = mTodoList.next() ) {
if ( !t->calEnabled() ) continue;
appendAlarms( alarms, t, from, to );
}
return alarms;
}
void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to )
{
- QPtrList<Alarm> alarmList = incidence->alarms();
+ Q3PtrList<Alarm> alarmList = incidence->alarms();
Alarm *alarm;
for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
// kdDebug(5800) << "CalendarLocal::appendAlarms() '" << alarm->text()
// << "': " << alarm->time().toString() << " - " << alarm->enabled() << endl;
if ( alarm->enabled() ) {
if ( alarm->time() >= from && alarm->time() <= to ) {
alarms.append( alarm );
}
}
}
}
void CalendarLocal::appendRecurringAlarms( Alarm::List &alarms,
Incidence *incidence,
const QDateTime &from,
const QDateTime &to )
{
- QPtrList<Alarm> alarmList = incidence->alarms();
+ Q3PtrList<Alarm> alarmList = incidence->alarms();
Alarm *alarm;
QDateTime qdt;
for( alarm = alarmList.first(); alarm; alarm = alarmList.next() ) {
if (incidence->recursOn(from.date())) {
qdt.setTime(alarm->time().time());
qdt.setDate(from.date());
}
else qdt = alarm->time();
// qDebug("1 %s %s %s", qdt.toString().latin1(), from.toString().latin1(), to.toString().latin1());
if ( alarm->enabled() ) {
if ( qdt >= from && qdt <= to ) {
alarms.append( alarm );
}
}
}
}
/****************************** PROTECTED METHODS ****************************/
// after changes are made to an event, this should be called.
void CalendarLocal::update( IncidenceBase *incidence )
{
incidence->setSyncStatus( Event::SYNCMOD );
incidence->setLastModified( QDateTime::currentDateTime() );
// we should probably update the revision number here,
// or internally in the Event itself when certain things change.
// need to verify with ical documentation.
setModified( true );
}
void CalendarLocal::insertEvent( Event *event )
{
if ( mEventList.findRef( event ) < 0 ) mEventList.append( event );
}
-QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
+Q3PtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted )
{
- QPtrList<Event> eventList;
+ Q3PtrList<Event> eventList;
Event *event;
for( event = mEventList.first(); event; event = mEventList.next() ) {
if ( !event->calEnabled() ) continue;
if ( event->doesRecur() ) {
if ( event->isMultiDay() ) {
int extraDays = event->dtStart().date().daysTo( event->dtEnd().date() );
int i;
for ( i = 0; i <= extraDays; i++ ) {
if ( event->recursOn( qd.addDays( -i ) ) ) {
eventList.append( event );
break;
}
}
} else {
if ( event->recursOn( qd ) )
eventList.append( event );
}
} else {
if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) {
eventList.append( event );
}
}
}
if ( !sorted ) {
return eventList;
}
// kdDebug(5800) << "Sorting events for date\n" << endl;
// now, we have to sort it based on dtStart.time()
- QPtrList<Event> eventListSorted;
+ Q3PtrList<Event> eventListSorted;
Event *sortEvent;
for ( event = eventList.first(); event; event = eventList.next() ) {
sortEvent = eventListSorted.first();
int i = 0;
while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() )
{
i++;
sortEvent = eventListSorted.next();
}
eventListSorted.insert( i, event );
}
return eventListSorted;
}
-QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
+Q3PtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
bool inclusive )
{
Event *event = 0;
- QPtrList<Event> eventList;
+ Q3PtrList<Event> eventList;
// Get non-recurring events
for( event = mEventList.first(); event; event = mEventList.next() ) {
if ( !event->calEnabled() ) continue;
if ( event->doesRecur() ) {
QDate rStart = event->dtStart().date();
bool found = false;
if ( inclusive ) {
if ( rStart >= start && rStart <= end ) {
// Start date of event is in range. Now check for end date.
// if duration is negative, event recurs forever, so do not include it.
if ( event->recurrence()->duration() == 0 ) { // End date set
QDate rEnd = event->recurrence()->endDate();
if ( rEnd >= start && rEnd <= end ) { // End date within range
found = true;
}
} else if ( event->recurrence()->duration() > 0 ) { // Duration set
// TODO: Calculate end date from duration. Should be done in Event
// For now exclude all events with a duration.
}
}
} else {
bool founOne;
- QDate next = event->getNextOccurence( start, &founOne ).date();
+ QDate next = event->getNextOccurence( (QDateTime)start, &founOne ).date();
if ( founOne ) {
if ( next <= end ) {
found = true;
}
}
/*
// crap !!!
if ( rStart <= end ) { // Start date not after range
if ( rStart >= start ) { // Start date within range
found = true;
} else if ( event->recurrence()->duration() == -1 ) { // Recurs forever
found = true;
} else if ( event->recurrence()->duration() == 0 ) { // End date set
QDate rEnd = event->recurrence()->endDate();
if ( rEnd >= start && rEnd <= end ) { // End date within range
found = true;
}
} else { // Duration set
// TODO: Calculate end date from duration. Should be done in Event
// For now include all events with a duration.
found = true;
}
}
*/
}
if ( found ) eventList.append( event );
} else {
QDate s = event->dtStart().date();
QDate e = event->dtEnd().date();
if ( inclusive ) {
if ( s >= start && e <= end ) {
eventList.append( event );
}
} else {
if ( ( e >= start && s <= end ) ) {
eventList.append( event );
}
}
}
}
return eventList;
}
-QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
+Q3PtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
{
return rawEventsForDate( qdt.date() );
}
-QPtrList<Event> CalendarLocal::rawEvents()
+Q3PtrList<Event> CalendarLocal::rawEvents()
{
- QPtrList<Event> el;
+ Q3PtrList<Event> el;
for ( Event *it = mEventList.first(); it; it = mEventList.next() )
if ( it->calEnabled() ) el.append( it );
return el;
}
bool CalendarLocal::addJournal(Journal *journal)
{
mJournalList.append(journal);
journal->registerObserver( this );
setModified( true );
if ( journal->calID() == 0 )
journal->setCalID_block( mDefaultCalendar );
journal->setCalEnabled( true );
return true;
}
void CalendarLocal::deleteJournal( Journal *journal )
{
clearUndo(journal);
if ( mJournalList.removeRef(journal) ) {
setModified( true );
}
}
-QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
+Q3PtrList<Journal> CalendarLocal::journals4Date( const QDate & date )
{
- QPtrList<Journal> el;
+ Q3PtrList<Journal> el;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() && it->dtStart().date() == date) el.append( it );
return el;
}
Journal *CalendarLocal::journal( const QDate &date )
{
// kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() && it->dtStart().date() == date )
return it;
return 0;
}
Journal *CalendarLocal::journal( const QString &uid )
{
Journal * retVal = 0;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() && it->uid() == uid ) {
if ( retVal ) {
if ( retVal->calID() > it->calID() ) {
retVal = it;
}
} else {
retVal = it;
}
}
return retVal;
}
-QPtrList<Journal> CalendarLocal::journals()
+Q3PtrList<Journal> CalendarLocal::journals()
{
- QPtrList<Journal> el;
+ Q3PtrList<Journal> el;
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calEnabled() ) el.append( it );
return el;
}
void CalendarLocal::setCalendarRemove( int id )
{
{
- QPtrList<Event> EventList = mEventList;
+ Q3PtrList<Event> EventList = mEventList;
Event * ev = EventList.first();
while ( ev ) {
if ( ev->calID() == id && ev->uid().left( 15 ) != QString("last-syncEvent-") )
deleteEvent( ev );
ev = EventList.next();
}
}
{
- QPtrList<Todo> TodoList = mTodoList;
+ Q3PtrList<Todo> TodoList = mTodoList;
Todo * ev = TodoList.first();
while ( ev ) {
if ( ev->calID() == id )
deleteTodo( ev );
ev = TodoList.next();
}
}
{
- QPtrList<Journal> JournalList = mJournalList;
+ Q3PtrList<Journal> JournalList = mJournalList;
Journal * ev = JournalList.first();
while ( ev ) {
if ( ev->calID() == id )
deleteJournal( ev );
ev = JournalList.next();
}
}
clearUndo(0);
}
void CalendarLocal::setAllCalendarEnabled( bool enable )
{
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
it->setCalEnabled( enable );
for ( Event *it = mEventList.first(); it; it = mEventList.next() )
it->setCalEnabled( enable );
for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
it->setCalEnabled( enable );
}
void CalendarLocal::setCalendarEnabled( int id, bool enable )
{
for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
if ( it->calID() == id ) it->setCalEnabled( enable );
for ( Event *it = mEventList.first(); it; it = mEventList.next() )
if ( it->calID() == id ) it->setCalEnabled( enable );
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 1ceabce..1df65c7 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -1,57 +1,59 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_CALENDARLOCAL_H
#define KCAL_CALENDARLOCAL_H
#include "calendar.h"
+//Added by qt3to4:
+#include <Q3PtrList>
namespace KCal {
class CalFormat;
/**
This class provides a calendar stored as a local file.
*/
class CalendarLocal : public Calendar
{
public:
/**
Constructs a new calendar, with variables initialized to sane values.
*/
CalendarLocal();
/**
Constructs a new calendar, with variables initialized to sane values.
*/
CalendarLocal( const QString &timeZoneId );
~CalendarLocal();
void addCalendar( Calendar* );
bool addCalendarFile( QString name, int id );
bool mergeCalendarFile( QString name );
bool mergeCalendar( Calendar* cal );
Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates, bool enabledOnly = false,int * isDup = 0 );
Todo* todoForUid( const QString& uid, bool doNotCheckDuplicates = true, bool enabledOnly = false ,int * isDup = 0 );
void setSyncEventsReadOnly();
void setSyncEventsEnabled();
void stopAllTodos();
/**
Loads a calendar on disk in vCalendar or iCalendar format into the current
calendar. Any information already present is lost.
@@ -64,171 +66,171 @@ class CalendarLocal : public Calendar
CalendarLocal takes ownership of the CalFormat object.
@return true, if successfull, false on error.
@param fileName the name of the file
*/
bool save( const QString &fileName, CalFormat *format = 0 );
/**
Clears out the current calendar, freeing all used memory etc. etc.
*/
void close();
void save() {}
/**
Add Event to calendar.
*/
void removeSyncInfo( QString syncProfile);
bool addAnniversaryNoDup( Event *event );
bool addEventNoDup( Event *event );
bool addEvent( Event *event );
/**
Deletes an event from this calendar.
*/
void deleteEvent( Event *event );
/**
Retrieves an event on the basis of the unique string ID.
*/
Event *event( const QString &uid );
/**
Return unfiltered list of all events in calendar.
*/
- QPtrList<Event> rawEvents();
- QPtrList<Event> getExternLastSyncEvents();
+ Q3PtrList<Event> rawEvents();
+ Q3PtrList<Event> getExternLastSyncEvents();
/**
Add a todo to the todolist.
*/
bool addTodo( Todo *todo );
bool addTodoNoDup( Todo *todo );
/**
Remove a todo from the todolist.
*/
void deleteTodo( Todo * );
/**
Searches todolist for an event with this unique string identifier,
returns a pointer or null.
*/
Todo *todo( const QString &uid );
/**
Return list of all todos.
*/
- QPtrList<Todo> rawTodos();
+ Q3PtrList<Todo> rawTodos();
/**
Returns list of todos due on the specified date.
*/
- QPtrList<Todo> todos( const QDate &date );
+ Q3PtrList<Todo> todos( const QDate &date );
/**
Return list of all todos.
Workaround because compiler does not recognize function of base class.
*/
- QPtrList<Todo> todos() { return Calendar::todos(); }
+ Q3PtrList<Todo> todos() { return Calendar::todos(); }
/**
Add a Journal entry to calendar.
*/
bool addJournal( Journal * );
/**
Remove a Journal from the calendar.
*/
void deleteJournal( Journal * );
/**
Return Journal for given date.
*/
Journal *journal( const QDate & );
- QPtrList<Journal> journals4Date( const QDate & );
+ Q3PtrList<Journal> journals4Date( const QDate & );
/**
Return Journal with given UID.
*/
Journal *journal( const QString &uid );
/**
Return list of all Journals stored in calendar.
*/
- QPtrList<Journal> journals();
+ Q3PtrList<Journal> journals();
/**
Return all alarms, which ocur in the given time interval.
*/
Alarm::List alarms( const QDateTime &from, const QDateTime &to );
/**
Return all alarms, which ocur before given date.
*/
Alarm::List alarmsTo( const QDateTime &to );
QDateTime nextAlarm( int daysTo ) ;
QDateTime nextAlarmEventDateTime() const;
void checkAlarmForIncidence( Incidence *, bool deleted ) ;
void registerAlarm();
void deRegisterAlarm();
QString getAlarmNotification();
QString nextSummary() const ;
/**
This method should be called whenever a Event is modified directly
via it's pointer. It makes sure that the calendar is internally
consistent.
*/
void update( IncidenceBase *incidence );
/**
Builds and then returns a list of all events that match for the
date specified. useful for dayView, etc. etc.
*/
- QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
+ Q3PtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
/**
Get unfiltered events for date \a qdt.
*/
- QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
+ Q3PtrList<Event> rawEventsForDate( const QDateTime &qdt );
/**
Get unfiltered events in a range of dates. If inclusive is set to true,
only events are returned, which are completely included in the range.
*/
- QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
+ Q3PtrList<Event> rawEvents( const QDate &start, const QDate &end,
bool inclusive = false );
Todo *todo( QString, QString );
Event *event( QString, QString );
void getIncidenceCount( int calId, int& events, int & todos, int & journals);
public slots:
void setCalendarEnabled( int id, bool enable );
void setAlarmEnabled( int id, bool enable );
void setReadOnly( int id, bool enable );
void setDefaultCalendarEnabledOnly();
void setCalendarRemove( int id );
void setAllCalendarEnabled( bool enable );
protected:
// Event* mNextAlarmEvent;
QString mNextSummary;
QString mNextAlarmEventDateTimeString;
QString mLastAlarmNotificationString;
QDateTime mNextAlarmEventDateTime;
QDateTime mNextAlarmDateTime;
void reInitAlarmSettings();
/** Notification function of IncidenceBase::Observer. */
void incidenceUpdated( IncidenceBase *i ) { update( i ); }
/** inserts an event into its "proper place" in the calendar. */
void insertEvent( Event *event );
/** Append alarms of incidence in interval to list of alarms. */
void appendAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to );
/** Append alarms of recurring events in interval to list of alarms. */
void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to );
private:
void init();
- QPtrList<Event> mEventList;
- QPtrList<Todo> mTodoList;
- QPtrList<Journal> mJournalList;
+ Q3PtrList<Event> mEventList;
+ Q3PtrList<Todo> mTodoList;
+ Q3PtrList<Journal> mJournalList;
};
}
#endif
diff --git a/libkcal/calfilter.cpp b/libkcal/calfilter.cpp
index 72f70c2..fa1dbd5 100644
--- a/libkcal/calfilter.cpp
+++ b/libkcal/calfilter.cpp
@@ -1,96 +1,98 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include "calfilter.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
CalFilter::CalFilter()
{
mEnabled = true;
mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
CalFilter::CalFilter(const QString &name)
{
mName = name;
mEnabled = true;
mCriteria = ShowPublic | ShowPrivate| ShowConfidential ;
}
CalFilter::~CalFilter()
{
}
-void CalFilter::apply(QPtrList<Event> *eventlist)
+void CalFilter::apply(Q3PtrList<Event> *eventlist)
{
if (!mEnabled) return;
// kdDebug(5800) << "CalFilter::apply()" << endl;
Event *event = eventlist->first();
while(event) {
if (!filterEvent(event)) {
eventlist->remove();
event = eventlist->current();
} else {
event = eventlist->next();
}
}
// kdDebug(5800) << "CalFilter::apply() done" << endl;
}
// TODO: avoid duplicating apply() code
-void CalFilter::apply(QPtrList<Todo> *eventlist)
+void CalFilter::apply(Q3PtrList<Todo> *eventlist)
{
if (!mEnabled) return;
Todo *event = eventlist->first();
while(event) {
if (!filterTodo(event)) {
eventlist->remove();
event = eventlist->current();
} else {
event = eventlist->next();
}
}
// kdDebug(5800) << "CalFilter::apply() done" << endl;
}
bool CalFilter::filterCalendarItem(Incidence *in)
{
if ( !in->calEnabled() )
return false;
if ( in->typeID() == eventID )
return filterEvent( (Event*) in );
else if ( in->typeID() == todoID )
return filterTodo( (Todo*) in);
else if ( in->typeID () == journalID )
return filterJournal( (Journal*) in );
return false;
}
bool CalFilter::filterEvent(Event *event)
{
if ( !event->calEnabled() )
return false;
if (mCriteria & HideEvents)
diff --git a/libkcal/calfilter.h b/libkcal/calfilter.h
index e349770..821149f 100644
--- a/libkcal/calfilter.h
+++ b/libkcal/calfilter.h
@@ -1,98 +1,98 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _CALFILTER_H
#define _CALFILTER_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "event.h"
#include "todo.h"
#include "journal.h"
namespace KCal {
/**
Filter for calendar objects.
*/
class CalFilter {
public:
/** Construct filter. */
CalFilter();
/** Construct filter with name */
CalFilter(const QString &name);
/** Destruct filter. */
~CalFilter();
/**
Set name of filter.
*/
void setName(const QString &name) { mName = name; }
/**
Return name of filter.
*/
QString name() const { return mName; }
/**
Apply filter to eventlist, all events not matching filter criterias are
removed from the list.
*/
- void apply(QPtrList<Event> *eventlist);
+ void apply(Q3PtrList<Event> *eventlist);
/**
Apply filter to todolist, all todos not matching filter criterias are
removed from the list.
*/
- void apply(QPtrList<Todo> *todolist);
- bool CalFilter::filterCalendarItem(Incidence *in);
- bool CalFilter::filterJournal(Journal *in);
+ void apply(Q3PtrList<Todo> *todolist);
+ bool filterCalendarItem(Incidence *in);
+ bool filterJournal(Journal *in);
/**
Apply filter criteria on the specified event. Return true, if event passes
criteria, otherwise return false.
*/
bool filterEvent(Event *);
/**
Apply filter criteria on the specified todo. Return true, if event passes
criteria, otherwise return false.
*/
bool filterTodo(Todo *);
/**
Apply filter criteria on the specified incidence. Return true, if event passes
criteria, otherwise return false.
*/
bool filterIncidence(Incidence *);
/**
Enable or disable filter.
*/
void setEnabled(bool);
/**
Return wheter the filter is enabled or not.
*/
bool isEnabled();
bool showCategories();
int getSecrecy();
/**
Set list of categories, which is used for showing/hiding categories of
events.
See related functions.
diff --git a/libkcal/customproperties.cpp b/libkcal/customproperties.cpp
index adc1710..16f4a28 100644
--- a/libkcal/customproperties.cpp
+++ b/libkcal/customproperties.cpp
@@ -1,114 +1,116 @@
/*
This file is part of libkcal.
Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "customproperties.h"
+//Added by qt3to4:
+#include <Q3CString>
using namespace KCal;
CustomProperties::CustomProperties()
{
}
CustomProperties::CustomProperties(const CustomProperties &cp)
: mProperties(cp.mProperties)
{
}
CustomProperties::~CustomProperties()
{
}
-void CustomProperties::setCustomProperty(const QCString &app, const QCString &key,
+void CustomProperties::setCustomProperty(const Q3CString &app, const Q3CString &key,
const QString &value)
{
if (value.isNull() || key.isEmpty() || app.isEmpty())
return;
- QCString property = "X-KDE-" + app + "-" + key;
+ Q3CString property = "X-KDE-" + app + "-" + key;
if (!checkName(property))
return;
mProperties[property] = value;
}
-void CustomProperties::removeCustomProperty(const QCString &app, const QCString &key)
+void CustomProperties::removeCustomProperty(const Q3CString &app, const Q3CString &key)
{
- removeNonKDECustomProperty(QCString("X-KDE-" + app + "-" + key));
+ removeNonKDECustomProperty(Q3CString("X-KDE-" + app + "-" + key));
}
-QString CustomProperties::customProperty(const QCString &app, const QCString &key) const
+QString CustomProperties::customProperty(const Q3CString &app, const Q3CString &key) const
{
- return nonKDECustomProperty(QCString("X-KDE-" + app + "-" + key));
+ return nonKDECustomProperty(Q3CString("X-KDE-" + app + "-" + key));
}
-void CustomProperties::setNonKDECustomProperty(const QCString &name, const QString &value)
+void CustomProperties::setNonKDECustomProperty(const Q3CString &name, const QString &value)
{
if (value.isNull() || !checkName(name))
return;
mProperties[name] = value;
}
-void CustomProperties::removeNonKDECustomProperty(const QCString &name)
+void CustomProperties::removeNonKDECustomProperty(const Q3CString &name)
{
- QMap<QCString, QString>::Iterator it = mProperties.find(name);
+ QMap<Q3CString, QString>::Iterator it = mProperties.find(name);
if (it != mProperties.end())
mProperties.remove(it);
}
-QString CustomProperties::nonKDECustomProperty(const QCString &name) const
+QString CustomProperties::nonKDECustomProperty(const Q3CString &name) const
{
- QMap<QCString, QString>::ConstIterator it = mProperties.find(name);
+ QMap<Q3CString, QString>::ConstIterator it = mProperties.find(name);
if (it == mProperties.end())
return QString::null;
return it.data();
}
-void CustomProperties::setCustomProperties(const QMap<QCString, QString> &properties)
+void CustomProperties::setCustomProperties(const QMap<Q3CString, QString> &properties)
{
- for (QMap<QCString, QString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) {
+ for (QMap<Q3CString, QString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) {
// Validate the property name and convert any null string to empty string
if (checkName(it.key())) {
mProperties[it.key()] = it.data().isNull() ? QString("") : it.data();
}
}
}
-QMap<QCString, QString> CustomProperties::customProperties() const
+QMap<Q3CString, QString> CustomProperties::customProperties() const
{
return mProperties;
}
-bool CustomProperties::checkName(const QCString &name)
+bool CustomProperties::checkName(const Q3CString &name)
{
// Check that the property name starts with 'X-' and contains
// only the permitted characters
const char* n = name;
int len = name.length();
if (len < 2 || n[0] != 'X' || n[1] != '-')
return false;
for (int i = 2; i < len; ++i) {
char ch = n[i];
if (ch >= 'A' && ch <= 'Z'
|| ch >= 'a' && ch <= 'z'
|| ch >= '0' && ch <= '9'
|| ch == '-')
continue;
return false; // invalid character found
}
return true;
}
diff --git a/libkcal/customproperties.h b/libkcal/customproperties.h
index 0cbfdcd..75eb3ad 100644
--- a/libkcal/customproperties.h
+++ b/libkcal/customproperties.h
@@ -1,97 +1,99 @@
/*
This file is part of libkcal.
Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_CUSTOM_PROPERTIES_H
#define KCAL_CUSTOM_PROPERTIES_H
#include <qstring.h>
#include <qmap.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class represents custom calendar properties.
It is used as a base class for classes which represent calendar components.
A custom property name written by libkcal has the form X-KDE-APP-KEY where
APP represents the application name, and KEY distinguishes individual
properties for the application.
In keeping with RFC2445, property names must be composed only of the
characters A-Z, a-z, 0-9 and '-'.
*/
class CustomProperties
{
public:
/** Construct a new empty custom properties instance */
CustomProperties();
CustomProperties(const CustomProperties &);
~CustomProperties();
/** Create or modify a custom calendar property.
@param app Application name as it appears in the custom property name.
@param key Property identifier specific to the application.
@param value The property's value. A call with a value of QString::null
will be ignored.
*/
- void setCustomProperty(const QCString &app, const QCString &key,
+ void setCustomProperty(const Q3CString &app, const Q3CString &key,
const QString &value);
/** Delete a custom calendar property.
@param app Application name as it appears in the custom property name.
@param key Property identifier specific to the application.
*/
- void removeCustomProperty(const QCString &app, const QCString &key);
+ void removeCustomProperty(const Q3CString &app, const Q3CString &key);
/** Return the value of a custom calendar property.
@param app Application name as it appears in the custom property name.
@param key Property identifier specific to the application.
@return Property value, or QString::null if (and only if) the property does not exist.
*/
- QString customProperty(const QCString &app, const QCString &key) const;
+ QString customProperty(const Q3CString &app, const Q3CString &key) const;
/** Create or modify a non-KDE or non-standard custom calendar property.
@param name Full property name
@param value The property's value. A call with a value of QString::null
will be ignored.
*/
- void setNonKDECustomProperty(const QCString &name, const QString &value);
+ void setNonKDECustomProperty(const Q3CString &name, const QString &value);
/** Delete a non-KDE or non-standard custom calendar property.
@param name Full property name
*/
- void removeNonKDECustomProperty(const QCString &name);
+ void removeNonKDECustomProperty(const Q3CString &name);
/** Return the value of a non-KDE or non-standard custom calendar property.
@param name Full property name
@return Property value, or QString::null if (and only if) the property does not exist.
*/
- QString nonKDECustomProperty(const QCString& name) const;
+ QString nonKDECustomProperty(const Q3CString& name) const;
/** Initialise the alarm's custom calendar properties to the specified
key/value pairs.
*/
- void setCustomProperties(const QMap<QCString, QString> &properties);
+ void setCustomProperties(const QMap<Q3CString, QString> &properties);
/** Return all custom calendar property key/value pairs. */
- QMap<QCString, QString> customProperties() const;
+ QMap<Q3CString, QString> customProperties() const;
private:
- static bool checkName(const QCString& name);
+ static bool checkName(const Q3CString& name);
- QMap<QCString, QString> mProperties; // custom calendar properties
+ QMap<Q3CString, QString> mProperties; // custom calendar properties
};
}
#endif
diff --git a/libkcal/dndfactory.cpp b/libkcal/dndfactory.cpp
index cdcfae4..ca7e212 100644
--- a/libkcal/dndfactory.cpp
+++ b/libkcal/dndfactory.cpp
@@ -1,168 +1,171 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brwon
Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qapplication.h>
#include <qclipboard.h>
+//Added by qt3to4:
+#include <QDropEvent>
+#include <Q3PtrList>
#include <kiconloader.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>
#include "vcaldrag.h"
#include "icaldrag.h"
#include "calendar.h"
#include "vcalformat.h"
#include "icalformat.h"
#include "calendarlocal.h"
#include "dndfactory.h"
using namespace KCal;
DndFactory::DndFactory( Calendar *cal ) :
mCalendar( cal )
{
}
ICalDrag *DndFactory::createDrag( Incidence *incidence, QWidget *owner )
{
CalendarLocal cal( mCalendar->timeZoneId() );
Incidence *i = incidence->clone();
cal.addIncidence( i );
ICalDrag *icd = new ICalDrag( &cal, owner );
if ( i->type() == "Event" )
icd->setPixmap( BarIcon( "appointment" ) );
else if ( i->type() == "Todo" )
icd->setPixmap( BarIcon( "todo" ) );
return icd;
}
Event *DndFactory::createDrop(QDropEvent *de)
{
kdDebug(5800) << "DndFactory::createDrop()" << endl;
CalendarLocal cal( mCalendar->timeZoneId() );
if ( ICalDrag::decode( de, &cal ) || VCalDrag::decode( de, &cal ) ) {
de->accept();
- QPtrList<Event> events = cal.events();
+ Q3PtrList<Event> events = cal.events();
if ( !events.isEmpty() ) {
Event *event = new Event( *events.first() );
return event;
}
}
return 0;
}
Todo *DndFactory::createDropTodo(QDropEvent *de)
{
kdDebug(5800) << "VCalFormat::createDropTodo()" << endl;
CalendarLocal cal( mCalendar->timeZoneId() );
if ( ICalDrag::decode( de, &cal ) || VCalDrag::decode( de, &cal ) ) {
de->accept();
- QPtrList<Todo> todos = cal.todos();
+ Q3PtrList<Todo> todos = cal.todos();
if ( !todos.isEmpty() ) {
Todo *todo = new Todo( *todos.first() );
return todo;
}
}
return 0;
}
void DndFactory::cutIncidence( Incidence *selectedInc )
{
if ( copyIncidence( selectedInc ) ) {
mCalendar->deleteIncidence( selectedInc );
}
}
bool DndFactory::copyIncidence( Incidence *selectedInc )
{
if ( !selectedInc )
return false;
QClipboard *cb = QApplication::clipboard();
CalendarLocal cal( mCalendar->timeZoneId() );
Incidence *inc = selectedInc->clone();
cal.addIncidence( inc );
cb->setData( new ICalDrag( &cal ) );
return true;
}
Incidence *DndFactory::pasteIncidence(const QDate &newDate, const QTime *newTime)
{
// kdDebug(5800) << "DnDFactory::pasteEvent()" << endl;
CalendarLocal cal( mCalendar->timeZoneId() );
QClipboard *cb = QApplication::clipboard();
if ( !ICalDrag::decode( cb->data(), &cal ) &&
!VCalDrag::decode( cb->data(), &cal ) ) {
kdDebug(5800) << "Can't parse clipboard" << endl;
return 0;
}
- QPtrList<Incidence> incList = cal.incidences();
+ Q3PtrList<Incidence> incList = cal.incidences();
Incidence *inc = incList.first();
if ( !incList.isEmpty() && inc ) {
inc = inc->clone();
inc->recreate();
if ( inc->type() == "Event" ) {
Event *anEvent = static_cast<Event*>( inc );
// Calculate length of event
int daysOffset = anEvent->dtStart().date().daysTo(
anEvent->dtEnd().date() );
// new end date if event starts at the same time on the new day
QDateTime endDate( newDate.addDays(daysOffset), anEvent->dtEnd().time() );
if ( newTime ) {
// additional offset for new time of day
int addSecsOffset( anEvent->dtStart().time().secsTo( *newTime ));
endDate=endDate.addSecs( addSecsOffset );
anEvent->setDtStart( QDateTime( newDate, *newTime ) );
} else {
anEvent->setDtStart( QDateTime( newDate, anEvent->dtStart().time() ) );
}
anEvent->setDtEnd( endDate );
} else if ( inc->type() == "Todo" ) {
Todo *anTodo = static_cast<Todo*>( inc );
if ( newTime ) {
anTodo->setDtDue( QDateTime( newDate, *newTime ) );
} else {
anTodo->setDtDue( QDateTime( newDate, anTodo->dtDue().time() ) );
diff --git a/libkcal/dndfactory.h b/libkcal/dndfactory.h
index 2df5259..a873c37 100644
--- a/libkcal/dndfactory.h
+++ b/libkcal/dndfactory.h
@@ -1,32 +1,34 @@
+//Added by qt3to4:
+#include <QDropEvent>
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifdef DESKTOP_VERSION
#ifndef KCAL_DNDFACTORY_H
#define KCAL_DNDFACTORY_H
//#include "libkcal_export.h"
namespace KCal {
diff --git a/libkcal/dndfactory_dummy.h b/libkcal/dndfactory_dummy.h
index 44cc114..3ab6adf 100644
--- a/libkcal/dndfactory_dummy.h
+++ b/libkcal/dndfactory_dummy.h
@@ -1,59 +1,61 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#ifndef KCAL_DNDFACTORY_H
#define KCAL_DNDFACTORY_H
#include "vcalformat.h"
+//Added by qt3to4:
+#include <QDropEvent>
class QDropEvent;
namespace KCal {
/**
This class implements functions to create Drag and Drop objects used for
Drag-and-Drop and Copy-and-Paste.
@short vCalendar Drag-and-Drop object factory.
*/
class DndFactory {
public:
DndFactory( Calendar * ) {}
/** create an object to be used with the Xdnd Drag And Drop protocol. */
ICalDrag *createDrag(Event *, QWidget *) { return 0; }
/** create an object to be used with the Xdnd Drag And Drop protocol. */
ICalDrag *createDragTodo(Todo *, QWidget *) { return 0; }
/** Create Todo object from drop event */
Todo *createDropTodo(QDropEvent *) { return 0; }
/** Create Event object from drop event */
Event *createDrop(QDropEvent *) { return 0; }
/** cut event to clipboard */
void cutEvent(Event *) {}
/** cut, copy, and paste operations follow. */
bool copyEvent(Event *) { return false; }
/** pastes the event and returns a pointer to the new event pasted. */
Event *pasteEvent(const QDate &, const QTime *newTime = 0) {
Q_UNUSED( newTime );
return 0;
diff --git a/libkcal/dummyscheduler.cpp b/libkcal/dummyscheduler.cpp
index ae40e6d..73eb3d0 100644
--- a/libkcal/dummyscheduler.cpp
+++ b/libkcal/dummyscheduler.cpp
@@ -1,119 +1,121 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//
// DummyScheduler - iMIP implementation of iTIP methods
//
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <kdebug.h>
#include "event.h"
#include "icalformat.h"
#include "dummyscheduler.h"
using namespace KCal;
DummyScheduler::DummyScheduler(Calendar *calendar)
: Scheduler(calendar)
{
}
DummyScheduler::~DummyScheduler()
{
}
bool DummyScheduler::publish (IncidenceBase *incidence,const QString &recipients)
{
QString messageText = mFormat->createScheduleMessage(incidence,
Scheduler::Publish);
return saveMessage(messageText);
}
bool DummyScheduler::performTransaction(IncidenceBase *incidence,Method method,const QString &recipients)
{
QString messageText = mFormat->createScheduleMessage(incidence,method);
return saveMessage(messageText);
}
bool DummyScheduler::performTransaction(IncidenceBase *incidence,Method method)
{
QString messageText = mFormat->createScheduleMessage(incidence,method);
return saveMessage(messageText);
}
bool DummyScheduler::saveMessage(const QString &message)
{
QFile f("dummyscheduler.store");
- if (f.open(IO_WriteOnly | IO_Append)) {
- QTextStream t(&f);
+ if (f.open(QIODevice::WriteOnly | QIODevice::Append)) {
+ Q3TextStream t(&f);
t << message << endl;
f.close();
return true;
} else {
return false;
}
}
-QPtrList<ScheduleMessage> DummyScheduler::retrieveTransactions()
+Q3PtrList<ScheduleMessage> DummyScheduler::retrieveTransactions()
{
- QPtrList<ScheduleMessage> messageList;
+ Q3PtrList<ScheduleMessage> messageList;
QFile f("dummyscheduler.store");
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
kdDebug(5800) << "DummyScheduler::retrieveTransactions(): Can't open file"
<< endl;
} else {
- QTextStream t(&f);
+ Q3TextStream t(&f);
QString messageString;
QString messageLine = t.readLine();
while (!messageLine.isNull()) {
// kdDebug(5800) << "++++++++" << messageLine << endl;
messageString += messageLine + "\n";
if (messageLine.find("END:VCALENDAR") >= 0) {
kdDebug(5800) << "---------------" << messageString << endl;
ScheduleMessage *message = mFormat->parseScheduleMessage(mCalendar,
messageString);
kdDebug(5800) << "--Parsed" << endl;
if (message) {
messageList.append(message);
} else {
QString errorMessage;
if (mFormat->exception()) {
errorMessage = mFormat->exception()->message();
}
kdDebug(5800) << "DummyScheduler::retrieveTransactions() Error parsing "
"message: " << errorMessage << endl;
}
messageString="";
}
messageLine = t.readLine();
}
f.close();
}
return messageList;
}
diff --git a/libkcal/dummyscheduler.h b/libkcal/dummyscheduler.h
index df42153..f86d583 100644
--- a/libkcal/dummyscheduler.h
+++ b/libkcal/dummyscheduler.h
@@ -1,51 +1,53 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef DUMMYSCHEDULER_H
#define DUMMYSCHEDULER_H
//
// Dummy implementation of iTIP methods
//
#include "scheduler.h"
+//Added by qt3to4:
+#include <Q3PtrList>
namespace KCal {
/**
This class implements the iTIP interface as a primitive local version for
testing. It uses a file dummyscheduler.store as inbox/outbox.
*/
class DummyScheduler : public Scheduler {
public:
DummyScheduler(Calendar *);
virtual ~DummyScheduler();
bool publish (IncidenceBase *incidence,const QString &recipients);
bool performTransaction(IncidenceBase *incidence,Method method);
bool performTransaction(IncidenceBase *incidence,Method method,const QString &recipients);
- QPtrList<ScheduleMessage> retrieveTransactions();
+ Q3PtrList<ScheduleMessage> retrieveTransactions();
protected:
bool saveMessage(const QString &);
};
}
#endif // DUMMYSCHEDULER_H
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index fdf5657..060df81 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -355,65 +355,65 @@ bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime*
if ( *overlapDT >= *startDT )
return true;
} else
return true;
}
computeThis = ( incidenceStart < testincidenceStart );
}
}
//qDebug("%d rec counter stopped at %d - %s %s", ok ,count, summary().latin1(),testEvent->summary().latin1() );
return false;
}
QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
*ok = false;
if ( !alarmEnabled() )
return QDateTime ();
bool yes;
QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
if ( ! yes || cancelled() ) {
*ok = false;
return QDateTime ();
}
bool enabled = false;
Alarm* alarm;
int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
if ( alarmStart > start_dt ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
}
QString Event::durationText()
{
diff --git a/libkcal/event.h b/libkcal/event.h
index 6a58618..da44f81 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -1,75 +1,77 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef EVENT_H
#define EVENT_H
//
// Event component, representing a VEVENT object
//
#include "incidence.h"
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class provides an Event in the sense of RFC2445.
*/
class Event : public Incidence
{
public:
enum Transparency { Opaque, Transparent };
typedef ListBase<Event> List;
Event();
Event(const Event &);
~Event();
bool matchTime(QDateTime*startDT, QDateTime* endDT);
- QCString type() const { return "Event"; }
+ Q3CString type() const { return "Event"; }
IncTypeID typeID() const { return eventID; }
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
/** for setting an event's ending date/time with a QDateTime. */
void setDtEnd(const QDateTime &dtEnd);
/** Return the event's ending date/time as a QDateTime. */
virtual QDateTime dtEnd() const;
/** returns an event's end time as a string formatted according to the
users locale settings */
QString dtEndTimeStr() const;
/** returns an event's end date as a string formatted according to the
users locale settings */
QString dtEndDateStr(bool shortfmt=true) const;
/** returns an event's end date and time as a string formatted according
to the users locale settings */
QString dtEndStr(bool shortfmt=true) const;
void setHasEndDate(bool);
/** Return whether the event has an end date/time. */
bool hasEndDate() const;
/** Return true if the event spans multiple days, otherwise return false. */
bool isMultiDay() const;
/** set the event's time transparency level. */
void setTransparency(Transparency transparency);
/** get the event's time transparency level. */
Transparency transparency() const;
void setDuration(int seconds);
diff --git a/libkcal/filestorage.cpp b/libkcal/filestorage.cpp
index a139124..3d1309f 100644
--- a/libkcal/filestorage.cpp
+++ b/libkcal/filestorage.cpp
@@ -1,57 +1,57 @@
/*
This file is part of libkcal.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <stdlib.h>
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdebug.h>
#include "calendar.h"
#include "vcaldrag.h"
#include "vcalformat.h"
#include "icalformat.h"
#include "filestorage.h"
using namespace KCal;
FileStorage::FileStorage( Calendar *cal, const QString &fileName,
CalFormat *format )
: CalStorage( cal ),
mFileName( fileName ),
mSaveFormat( format )
{
}
FileStorage::~FileStorage()
{
delete mSaveFormat;
}
void FileStorage::setFileName( const QString &fileName )
{
mFileName = fileName;
}
QString FileStorage::fileName()const
{
diff --git a/libkcal/freebusy.cpp b/libkcal/freebusy.cpp
index ba15d6d..e4e9ec9 100644
--- a/libkcal/freebusy.cpp
+++ b/libkcal/freebusy.cpp
@@ -1,78 +1,81 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include "freebusy.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
using namespace KCal;
FreeBusy::FreeBusy()
{
}
FreeBusy::FreeBusy(const QDateTime &start, const QDateTime &end)
{
setDtStart(start);
setDtEnd(end);
}
FreeBusy::FreeBusy( Calendar *calendar, const QDateTime &start, const QDateTime &end )
{
kdDebug() << "FreeBusy::FreeBusy" << endl;
mCalendar = calendar;
setDtStart(start);
setDtEnd(end);
//Gets all the events in the calendar
- QPtrList<Event> eventList = mCalendar->events();
+ Q3PtrList<Event> eventList = mCalendar->events();
Event *event;
int extraDays, i, x, duration;
duration = start.daysTo(end);
QDate day;
QDateTime tmpStart;
QDateTime tmpEnd;
//Loops through every event in the calendar
for( event = eventList.first(); event; event = eventList.next() ) {
//This whole for loop is for recurring events, it loops through
//each of the days of the freebusy request
//First check if this is transparent. If it is, it shouldn't be in the
//freebusy list
if ( event->transparency() == Event::Transparent )
// Transparent
continue;
for(i=0; i<=duration; i++) {
day=(start.addDays(i).date());
tmpStart.setDate(day);
tmpEnd.setDate(day);
if( (*(event->recurrence())).doesRecur() ) {
if ( event->isMultiDay() ) {
extraDays = event->dtStart().date().daysTo(event->dtEnd().date());
for (x=0; x<=extraDays; x++) {
if ( event->recursOn(day.addDays(-x))) {
tmpStart.setDate(day.addDays(-x));
tmpStart.setTime(event->dtStart().time());
tmpEnd=tmpStart.addSecs( (event->duration()) );
@@ -84,101 +87,101 @@ FreeBusy::FreeBusy( Calendar *calendar, const QDateTime &start, const QDateTime
if (event->recursOn(day)) {
tmpStart.setTime(event->dtStart().time());
tmpEnd.setTime(event->dtEnd().time());
addLocalPeriod (tmpStart, tmpEnd);
}
}
}
}
//Non-reocurring events
addLocalPeriod(event->dtStart(), event->dtEnd());
}
sortList();
}
FreeBusy::~FreeBusy()
{
}
bool FreeBusy::setDtEnd( const QDateTime &end )
{
mDtEnd = end;
return true;
}
QDateTime FreeBusy::dtEnd() const
{
return mDtEnd;
}
-QValueList<Period> FreeBusy::busyPeriods() const
+Q3ValueList<Period> FreeBusy::busyPeriods() const
{
return mBusyPeriods;
}
bool FreeBusy::addLocalPeriod(const QDateTime &eventStart, const QDateTime &eventEnd ) {
QDateTime tmpStart;
QDateTime tmpEnd;
//Check to see if the start *or* end of the event is
//between the start and end of the freebusy dates.
if (!((((this->dtStart()).secsTo(eventStart)>=0)&&(eventStart.secsTo(this->dtEnd())>=0))
||(((this->dtStart()).secsTo(eventEnd) >= 0)&&(eventEnd.secsTo(this->dtEnd()) >= 0))))
return false;
if ( eventStart.secsTo(this->dtStart())>=0) {
tmpStart = this->dtStart();
} else {
tmpStart = eventStart;
}
if ( eventEnd.secsTo(this->dtEnd())<=0 ) {
tmpEnd = this->dtEnd();
} else {
tmpEnd = eventEnd;
}
Period p(tmpStart, tmpEnd);
mBusyPeriods.append( p );
return true;
}
-FreeBusy::FreeBusy(QValueList<Period> busyPeriods)
+FreeBusy::FreeBusy(Q3ValueList<Period> busyPeriods)
{
mBusyPeriods = busyPeriods;
}
void FreeBusy::sortList()
{
- typedef QValueList<Period> PeriodList;
+ typedef Q3ValueList<Period> PeriodList;
PeriodList::Iterator tmpPeriod, earlyPeriod;
PeriodList sortedList;
QDateTime earlyTime;
while( mBusyPeriods.count() > 0 ) {
earlyTime=(*mBusyPeriods.begin()).start();
for (tmpPeriod=mBusyPeriods.begin(); tmpPeriod!=mBusyPeriods.end(); tmpPeriod++) {
if (earlyTime.secsTo((*tmpPeriod).start()) <= 0) {
earlyTime=(*tmpPeriod).start();
earlyPeriod=tmpPeriod;
}
}
//Move tmpPeriod to sortedList
Period tmpPeriod( (*earlyPeriod).start(), (*earlyPeriod).end() );
sortedList.append( tmpPeriod );
mBusyPeriods.remove( earlyPeriod );
}
mBusyPeriods=sortedList;
}
void FreeBusy::addPeriod(const QDateTime &start, const QDateTime &end)
{
Period p(start, end);
mBusyPeriods.append( p );
sortList();
}
diff --git a/libkcal/freebusy.h b/libkcal/freebusy.h
index d741c72..bd14cb7 100644
--- a/libkcal/freebusy.h
+++ b/libkcal/freebusy.h
@@ -1,73 +1,75 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_FREEBUSY_H
#define KCAL_FREEBUSY_H
//
// FreeBusy - information about free/busy times
//
#include <qdatetime.h>
-#include <qvaluelist.h>
-#include <qptrlist.h>
+#include <q3valuelist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "period.h"
#include "calendar.h"
#include "incidencebase.h"
namespace KCal {
/**
This class provides information about free/busy time of a calendar user.
*/
class FreeBusy : public IncidenceBase
{
public:
FreeBusy();
FreeBusy(const QDateTime &start, const QDateTime &end);
FreeBusy(Calendar *calendar, const QDateTime &start, const QDateTime &end);
- FreeBusy(QValueList<Period> busyPeriods);
+ FreeBusy(Q3ValueList<Period> busyPeriods);
~FreeBusy();
- QCString type() const { return "FreeBusy"; }
+ Q3CString type() const { return "FreeBusy"; }
IncTypeID typeID() const { return freebusyID; }
virtual QDateTime dtEnd() const;
bool setDtEnd( const QDateTime &end );
- QValueList<Period> busyPeriods() const;
+ Q3ValueList<Period> busyPeriods() const;
void addPeriod(const QDateTime &start, const QDateTime &end);
void sortList();
private:
//This is used for creating a freebusy object for the current user
bool addLocalPeriod(const QDateTime &start, const QDateTime &end);
QDateTime mDtEnd;
- QValueList<Period> mBusyPeriods;
+ Q3ValueList<Period> mBusyPeriods;
Calendar *mCalendar;
};
}
#endif
diff --git a/libkcal/icaldrag.cpp b/libkcal/icaldrag.cpp
index 446a115..7f5a796 100644
--- a/libkcal/icaldrag.cpp
+++ b/libkcal/icaldrag.cpp
@@ -1,58 +1,58 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "icaldrag.h"
#include "icalformat.h"
#include <kdebug.h>
using namespace KCal;
ICalDrag::ICalDrag( Calendar *cal, QWidget *parent, const char *name )
- : QStoredDrag( "text/calendar", parent, name )
+ : Q3StoredDrag( "text/calendar", parent, name )
{
ICalFormat icf;
QString scal = icf.toString( cal );
setEncodedData( scal.utf8() );
}
bool ICalDrag::canDecode( QMimeSource *me )
{
return me->provides( "text/calendar" );
}
bool ICalDrag::decode( QMimeSource *de, Calendar *cal )
{
bool success = false;
QByteArray payload = de->encodedData( "text/calendar" );
if ( payload.size() ) {
QString txt = QString::fromUtf8( payload.data() );
ICalFormat icf;
success = icf.fromString( cal, txt );
}
return success;
}
diff --git a/libkcal/icaldrag.h b/libkcal/icaldrag.h
index fdf32b7..c1f73f4 100644
--- a/libkcal/icaldrag.h
+++ b/libkcal/icaldrag.h
@@ -1,46 +1,46 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ICALDRAG_H
#define ICALDRAG_H
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include "calendar.h"
namespace KCal {
/** iCalendar drag&drop class. */
-class ICalDrag : public QStoredDrag
+class ICalDrag : public Q3StoredDrag
{
public:
/** Create a drag&drop object for iCalendar component \a ical. */
ICalDrag( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
~ICalDrag() {};
/** Return, if drag&drop object can be decode to iCalendar. */
static bool canDecode( QMimeSource * );
/** Decode drag&drop object to iCalendar component \a cal. */
static bool decode( QMimeSource *e, Calendar *cal );
};
}
#endif
diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp
index 6f3a799..3829bc1 100644
--- a/libkcal/icalformat.cpp
+++ b/libkcal/icalformat.cpp
@@ -1,242 +1,242 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <stdlib.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
extern "C" {
#include <ical.h>
#include <icalss.h>
#include <icalparser.h>
#include <icalrestriction.h>
}
#include "calendar.h"
#include "calendarlocal.h"
#include "journal.h"
#include "icalformat.h"
#include "icalformatimpl.h"
#define _ICAL_VERSION "2.0"
using namespace KCal;
ICalFormat::ICalFormat( bool pe )
{
mProcessEvents = pe;
mImpl = new ICalFormatImpl( this );
tzOffsetMin = 0;
//qDebug("new ICalFormat() ");
}
ICalFormat::~ICalFormat()
{
delete mImpl;
//qDebug("delete ICalFormat ");
}
bool ICalFormat::load( Calendar *calendar, const QString &fileName)
{
clearException();
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
setException(new ErrorFormat(ErrorFormat::LoadError));
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
QString text;
- ts.setEncoding( QTextStream::Latin1 );
+ ts.setEncoding( Q3TextStream::Latin1 );
text = ts.read();
file.close();
return fromString( calendar, text );
}
//#include <qdatetime.h>
bool ICalFormat::save( Calendar *calendar, const QString &fileName )
{
//kdDebug(5800) << "ICalFormat::save(): " << fileName << endl;
//qDebug("ICalFormat::save ");
clearException();
QString text = toString( calendar );
//return false;
// qDebug("to string takes ms: %d ",is.elapsed() );
if ( text.isNull() ) return false;
// TODO: write backup file
//is.restart();
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("Could not open file '%1'").arg(fileName)));
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ ts.setEncoding( Q3TextStream::Latin1 );
ts << text;
file.close();
//qDebug("saving file takes ms: %d ", is.elapsed() );
return true;
}
bool ICalFormat::fromString( Calendar *cal, const QString &text )
{
setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
// qDebug("ICalFormat::fromString tz: %s ", cal->timeZoneId().latin1());
// Get first VCALENDAR component.
// TODO: Handle more than one VCALENDAR or non-VCALENDAR top components
icalcomponent *calendar;
//calendar = icalcomponent_new_from_string( text.local8Bit().data());
// good calendar = icalcomponent_new_from_string( text.utf8().data());
calendar = icalcomponent_new_from_string( (char*)text.latin1());
if (!calendar) {
setException(new ErrorFormat(ErrorFormat::ParseErrorIcal));
return false;
}
bool success = true;
if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) {
setException(new ErrorFormat(ErrorFormat::NoCalendar));
success = false;
} else {
// put all objects into their proper places
if ( !mImpl->populate( cal, calendar ) ) {
if ( !exception() ) {
setException(new ErrorFormat(ErrorFormat::ParseErrorKcal));
}
success = false;
} else
mLoadedProductId = mImpl->loadedProductId();
}
icalcomponent_free( calendar );
icalmemory_free_ring();
return success;
}
Incidence *ICalFormat::fromString( const QString &text )
{
CalendarLocal cal( mTimeZoneId );
fromString(&cal, text);
Incidence *ical = 0;
- QPtrList<Event> elist = cal.events();
+ Q3PtrList<Event> elist = cal.events();
if ( elist.count() > 0 ) {
ical = elist.first();
} else {
- QPtrList<Todo> tlist = cal.todos();
+ Q3PtrList<Todo> tlist = cal.todos();
if ( tlist.count() > 0 ) {
ical = tlist.first();
} else {
- QPtrList<Journal> jlist = cal.journals();
+ Q3PtrList<Journal> jlist = cal.journals();
if ( jlist.count() > 0 ) {
ical = jlist.first();
}
}
}
return ical;
}
-#include <qapp.h>
+#include <qapplication.h>
QString ICalFormat::toString( Calendar *cal )
{
setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
icalcomponent *calendar = mImpl->createCalendarComponent(cal);
icalcomponent *component;
// todos
- QPtrList<Todo> todoList = cal->rawTodos();
- QPtrListIterator<Todo> qlt(todoList);
+ Q3PtrList<Todo> todoList = cal->rawTodos();
+ Q3PtrListIterator<Todo> qlt(todoList);
for (; qlt.current(); ++qlt) {
component = mImpl->writeTodo(qlt.current());
icalcomponent_add_component(calendar,component);
//qDebug(" todos ");
if ( mProcessEvents ) {
//qDebug("mProcessEvents ");
qApp->processEvents();
}
}
// events
- QPtrList<Event> events = cal->rawEvents();
+ Q3PtrList<Event> events = cal->rawEvents();
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
component = mImpl->writeEvent(ev);
icalcomponent_add_component(calendar,component);
//qDebug("events ");
if ( mProcessEvents )
qApp->processEvents();
}
// journals
- QPtrList<Journal> journals = cal->journals();
+ Q3PtrList<Journal> journals = cal->journals();
Journal *j;
for(j=journals.first();j;j=journals.next()) {
component = mImpl->writeJournal(j);
icalcomponent_add_component(calendar,component);
//qDebug("journals ");
if ( mProcessEvents )
qApp->processEvents();
}
const char *text;
QString ret ="";
text = icalcomponent_as_ical_string( calendar );
if ( mProcessEvents )
qApp->processEvents();
// text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n";
if ( text ) {
ret = QString ( text );
}
icalcomponent_free( calendar );
if (!text) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("libical error")));
icalmemory_free_ring();
return QString::null;
}
icalmemory_free_ring();
return ret;
}
diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h
index a770dbb..a454b35 100644
--- a/libkcal/icalformat.h
+++ b/libkcal/icalformat.h
@@ -1,55 +1,57 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ICALFORMAT_H
#define ICALFORMAT_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "scheduler.h"
#include "calformat.h"
namespace KCal {
class ICalFormatImpl;
/**
This class implements the iCalendar format. It provides methods for
loading/saving/converting iCalendar format data into the internal KOrganizer
representation as Calendar and Events.
@short iCalendar format implementation
*/
class ICalFormat : public CalFormat {
public:
/** Create new iCalendar format. */
ICalFormat( bool pe = true);
virtual ~ICalFormat();
/**
Loads a calendar on disk in iCalendar format into calendar.
Returns true if successful, else returns false. Provides more error
information by exception().
@param calendar Calendar object to be filled.
@param fileName The name of the calendar file on disk.
*/
bool load( Calendar *, const QString &fileName );
/**
Writes out the calendar to disk in iCalendar format. Returns true if
@@ -77,40 +79,40 @@ class ICalFormat : public CalFormat {
*/
QString toICalString( Incidence * );
/**
Return incidence as iCalendar formatted text.
*/
QString toString( Incidence * );
/**
Return recurrence as iCalendar formatted text.
*/
QString toString( Recurrence * );
/**
Parse string and fill recurrence object with
that information
*/
//bool fromString ( Recurrence *, const QString& );
/** Create a scheduling message for event \a e using method \m */
QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m);
/** Parse scheduling message provided as string \s */
ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s);
/** Set id of used time zone and whether this time zone is UTC or not. */
void setTimeZone( const QString &id, bool utc );
QString timeZoneId() const;
int timeOffset();
const char * tzString();
bool utc() const;
private:
bool mProcessEvents;
ICalFormatImpl *mImpl;
QString mTimeZoneId;
- QCString mTzString;
+ Q3CString mTzString;
int tzOffsetMin;
bool mUtc;
};
}
#endif
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 65eabc8..ea144ee 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -1,56 +1,59 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3CString>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
extern "C" {
#include <ical.h>
#include <icalss.h>
#include <icalparser.h>
#include <icalrestriction.h>
}
#include "calendar.h"
#include "journal.h"
#include "icalformat.h"
#include "icalformatimpl.h"
#include "compat.h"
#define _ICAL_VERSION "2.0"
using namespace KCal;
const int gSecondsPerMinute = 60;
const int gSecondsPerHour = gSecondsPerMinute * 60;
const int gSecondsPerDay = gSecondsPerHour * 24;
const int gSecondsPerWeek = gSecondsPerDay * 7;
ICalFormatImpl::ICalFormatImpl( ICalFormat *parent ) :
mParent( parent ), mCalendarVersion( 0 )
{
mCompat = new Compat;
}
@@ -192,66 +195,66 @@ icalcomponent *ICalFormatImpl::writeEvent(Event *event)
case Event::Transparent:
icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_TRANSPARENT));
break;
case Event::Opaque:
icalcomponent_add_property(vevent, icalproperty_new_transp(ICAL_TRANSP_OPAQUE));
break;
}
return vevent;
}
icalcomponent *ICalFormatImpl::writeFreeBusy(FreeBusy *freebusy,
Scheduler::Method method)
{
icalcomponent *vfreebusy = icalcomponent_new(ICAL_VFREEBUSY_COMPONENT);
writeIncidenceBase(vfreebusy,freebusy);
icalcomponent_add_property(vfreebusy, icalproperty_new_dtstart(
writeICalDateTime(freebusy->dtStart())));
icalcomponent_add_property(vfreebusy, icalproperty_new_dtend(
writeICalDateTime(freebusy->dtEnd())));
if (method == Scheduler::Request) {
icalcomponent_add_property(vfreebusy,icalproperty_new_uid(
freebusy->uid().utf8()));
}
//Loops through all the periods in the freebusy object
- QValueList<Period> list = freebusy->busyPeriods();
- QValueList<Period>::Iterator it;
+ Q3ValueList<Period> list = freebusy->busyPeriods();
+ Q3ValueList<Period>::Iterator it;
icalperiodtype period;
for (it = list.begin(); it!= list.end(); ++it) {
period.start = writeICalDateTime((*it).start());
period.end = writeICalDateTime((*it).end());
icalcomponent_add_property(vfreebusy, icalproperty_new_freebusy(period) );
}
return vfreebusy;
}
icalcomponent *ICalFormatImpl::writeJournal(Journal *journal)
{
icalcomponent *vjournal = icalcomponent_new(ICAL_VJOURNAL_COMPONENT);
writeIncidence(vjournal,journal);
// start time
if (journal->dtStart().isValid()) {
icaltimetype start;
if (journal->doesFloat()) {
// kdDebug(5800) << "§§ Incidence " << event->summary() << " floats." << endl;
start = writeICalDate(journal->dtStart().date());
} else {
// kdDebug(5800) << "§§ incidence " << event->summary() << " has time." << endl;
start = writeICalDateTime(journal->dtStart());
}
icalcomponent_add_property(vjournal,icalproperty_new_dtstart(start));
}
return vjournal;
}
@@ -355,118 +358,118 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
tmpStr += catStr;
// this must be a ';' character as the vCalendar specification requires!
// vcc.y has been hacked to translate the ';' to a ',' when the vcal is
// read in.
tmpStr += ";";
}
if (!tmpStr.isEmpty()) {
tmpStr.truncate(tmpStr.length()-1);
icalcomponent_add_property(parent,icalproperty_new_categories(
writeText(incidence->getCategories().join(";"))));
}
*/
// related event
if (!incidence->relatedToUid().isEmpty()) {
icalcomponent_add_property(parent,icalproperty_new_relatedto(
incidence->relatedToUid().utf8()));
}
// recurrence rule stuff
if (incidence->doesRecur()) {
icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence()));
// recurrence excpetion dates
DateList dateList = incidence->exDates();
DateList::ConstIterator exIt;
for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
icalcomponent_add_property(parent,icalproperty_new_exdate(
writeICalDate(*exIt)));
}
}
// attachments
- QPtrList<Attachment> attachments = incidence->attachments();
+ Q3PtrList<Attachment> attachments = incidence->attachments();
for (Attachment *at = attachments.first(); at; at = attachments.next())
icalcomponent_add_property(parent,writeAttachment(at));
// alarms
- QPtrList<Alarm> alarms = incidence->alarms();
+ Q3PtrList<Alarm> alarms = incidence->alarms();
Alarm* alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
if (alarm->enabled()) {
kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
icalcomponent_add_component(parent,writeAlarm(alarm));
}
}
if( incidence->hasRecurrenceID() ) {
icalcomponent_add_property(parent,
icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
}
// duration
// turned off as it always is set to PTS0 (and must not occur together with DTEND
if (incidence->hasDuration()) {
icaldurationtype duration;
duration = writeICalDuration(incidence->duration());
icalcomponent_add_property(parent,icalproperty_new_duration(duration));
}
}
void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
{
icalcomponent_add_property(parent,icalproperty_new_dtstamp(
writeICalDateTime(QDateTime::currentDateTime())));
// organizer stuff
icalcomponent_add_property(parent,icalproperty_new_organizer(
("MAILTO:" + incidenceBase->organizer()).utf8()));
// attendees
if (incidenceBase->attendeeCount() != 0) {
- QPtrList<Attendee> al = incidenceBase->attendees();
- QPtrListIterator<Attendee> ai(al);
+ Q3PtrList<Attendee> al = incidenceBase->attendees();
+ Q3PtrListIterator<Attendee> ai(al);
for (; ai.current(); ++ai) {
icalcomponent_add_property(parent,writeAttendee(ai.current()));
}
}
// custom properties
writeCustomProperties(parent, incidenceBase);
}
void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties)
{
- QMap<QCString, QString> custom = properties->customProperties();
- for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
+ QMap<Q3CString, QString> custom = properties->customProperties();
+ for (QMap<Q3CString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
icalproperty *p = icalproperty_new_x(c.data().utf8());
icalproperty_set_x_name(p,c.key());
icalcomponent_add_property(parent,p);
}
}
icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee)
{
icalproperty *p = icalproperty_new_attendee("mailto:" + attendee->email().utf8());
if (!attendee->name().isEmpty()) {
icalproperty_add_parameter(p,icalparameter_new_cn(attendee->name().utf8()));
}
icalproperty_add_parameter(p,icalparameter_new_rsvp(
attendee->RSVP() ? ICAL_RSVP_TRUE : ICAL_RSVP_FALSE ));
icalparameter_partstat status = ICAL_PARTSTAT_NEEDSACTION;
switch (attendee->status()) {
default:
case Attendee::NeedsAction:
status = ICAL_PARTSTAT_NEEDSACTION;
break;
case Attendee::Accepted:
status = ICAL_PARTSTAT_ACCEPTED;
break;
case Attendee::Declined:
status = ICAL_PARTSTAT_DECLINED;
break;
case Attendee::Tentative:
status = ICAL_PARTSTAT_TENTATIVE;
@@ -517,66 +520,66 @@ icalproperty *ICalFormatImpl::writeAttachment(Attachment *att)
if (att->isUri())
icalattachtype_set_url(attach, att->uri().utf8().data());
else
icalattachtype_set_base64(attach, att->data(), 0);
#endif
icalattach *attach;
if (att->isUri())
attach = icalattach_new_from_url( att->uri().utf8().data());
else
attach = icalattach_new_from_data ( (unsigned char *)att->data(), 0, 0);
icalproperty *p = icalproperty_new_attach(attach);
if (!att->mimeType().isEmpty())
icalproperty_add_parameter(p,icalparameter_new_fmttype(att->mimeType().utf8().data()));
if (att->isBinary()) {
icalproperty_add_parameter(p,icalparameter_new_value(ICAL_VALUE_BINARY));
icalproperty_add_parameter(p,icalparameter_new_encoding(ICAL_ENCODING_BASE64));
}
return p;
}
icalproperty *ICalFormatImpl::writeRecurrenceRule(Recurrence *recur)
{
// kdDebug(5800) << "ICalFormatImpl::writeRecurrenceRule()" << endl;
icalrecurrencetype r;
icalrecurrencetype_clear(&r);
int index = 0;
int index2 = 0;
- QPtrList<Recurrence::rMonthPos> tmpPositions;
- QPtrList<int> tmpDays;
+ Q3PtrList<Recurrence::rMonthPos> tmpPositions;
+ Q3PtrList<int> tmpDays;
int *tmpDay;
Recurrence::rMonthPos *tmpPos;
bool datetime = false;
int day;
int i;
switch(recur->doesRecur()) {
case Recurrence::rMinutely:
r.freq = ICAL_MINUTELY_RECURRENCE;
datetime = true;
break;
case Recurrence::rHourly:
r.freq = ICAL_HOURLY_RECURRENCE;
datetime = true;
break;
case Recurrence::rDaily:
r.freq = ICAL_DAILY_RECURRENCE;
break;
case Recurrence::rWeekly:
r.freq = ICAL_WEEKLY_RECURRENCE;
r.week_start = static_cast<icalrecurrencetype_weekday>(recur->weekStart()%7 + 1);
for (i = 0; i < 7; i++) {
if (recur->days().testBit(i)) {
day = (i + 1)%7 + 1; // convert from Monday=0 to Sunday=1
r.by_day[index++] = icalrecurrencetype_day_day_of_week(day);
}
}
// r.by_day[index] = ICAL_RECURRENCE_ARRAY_MAX;
break;
case Recurrence::rMonthlyPos:
r.freq = ICAL_MONTHLY_RECURRENCE;
@@ -675,125 +678,125 @@ icalproperty *ICalFormatImpl::writeRecurrenceRule(Recurrence *recur)
#endif
return icalproperty_new_rrule(r);
}
icalcomponent *ICalFormatImpl::writeAlarm(Alarm *alarm)
{
icalcomponent *a = icalcomponent_new(ICAL_VALARM_COMPONENT);
icalproperty_action action;
icalattach *attach = 0;
switch (alarm->type()) {
case Alarm::Procedure:
action = ICAL_ACTION_PROCEDURE;
attach = icalattach_new_from_url( QFile::encodeName(alarm->programFile()).data() );
icalcomponent_add_property(a,icalproperty_new_attach(attach));
if (!alarm->programArguments().isEmpty()) {
icalcomponent_add_property(a,icalproperty_new_description(alarm->programArguments().utf8()));
}
icalattach_unref( attach );
break;
case Alarm::Audio:
action = ICAL_ACTION_AUDIO;
if (!alarm->audioFile().isEmpty()) {
attach = icalattach_new_from_url(QFile::encodeName( alarm->audioFile() ).data());
icalcomponent_add_property(a,icalproperty_new_attach(attach));
icalattach_unref( attach );
}
break;
case Alarm::Email: {
action = ICAL_ACTION_EMAIL;
- QValueList<Person> addresses = alarm->mailAddresses();
- for (QValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
+ Q3ValueList<Person> addresses = alarm->mailAddresses();
+ for (Q3ValueList<Person>::Iterator ad = addresses.begin(); ad != addresses.end(); ++ad) {
icalproperty *p = icalproperty_new_attendee("MAILTO:" + (*ad).email().utf8());
if (!(*ad).name().isEmpty()) {
icalproperty_add_parameter(p,icalparameter_new_cn((*ad).name().utf8()));
}
icalcomponent_add_property(a,p);
}
icalcomponent_add_property(a,icalproperty_new_summary(alarm->mailSubject().utf8()));
icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8()));
QStringList attachments = alarm->mailAttachments();
if (attachments.count() > 0) {
for (QStringList::Iterator at = attachments.begin(); at != attachments.end(); ++at) {
attach = icalattach_new_from_url(QFile::encodeName( *at ).data());
icalcomponent_add_property(a,icalproperty_new_attach(attach));
icalattach_unref( attach );
}
}
break;
}
case Alarm::Display:
action = ICAL_ACTION_DISPLAY;
icalcomponent_add_property(a,icalproperty_new_description(alarm->text().utf8()));
break;
case Alarm::Invalid:
default:
kdDebug(5800) << "Unknown type of alarm" << endl;
action = ICAL_ACTION_NONE;
break;
}
icalcomponent_add_property(a,icalproperty_new_action(action));
// Trigger time
icaltriggertype trigger;
if ( alarm->hasTime() ) {
trigger.time = writeICalDateTime(alarm->time());
trigger.duration = icaldurationtype_null_duration();
} else {
trigger.time = icaltime_null_time();
Duration offset;
if ( alarm->hasStartOffset() )
offset = alarm->startOffset();
else
offset = alarm->endOffset();
trigger.duration = icaldurationtype_from_int( offset.asSeconds() );
}
icalproperty *p = icalproperty_new_trigger(trigger);
if ( alarm->hasEndOffset() )
icalproperty_add_parameter(p,icalparameter_new_related(ICAL_RELATED_END));
icalcomponent_add_property(a,p);
// Repeat count and duration
if (alarm->repeatCount()) {
icalcomponent_add_property(a,icalproperty_new_repeat(alarm->repeatCount()));
icalcomponent_add_property(a,icalproperty_new_duration(
icaldurationtype_from_int(alarm->snoozeTime()*60)));
}
// Custom properties
- QMap<QCString, QString> custom = alarm->customProperties();
- for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
+ QMap<Q3CString, QString> custom = alarm->customProperties();
+ for (QMap<Q3CString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) {
icalproperty *p = icalproperty_new_x(c.data().utf8());
icalproperty_set_x_name(p,c.key());
icalcomponent_add_property(a,p);
}
return a;
}
Todo *ICalFormatImpl::readTodo(icalcomponent *vtodo)
{
Todo *todo = new Todo;
readIncidence(vtodo,todo);
icalproperty *p = icalcomponent_get_first_property(vtodo,ICAL_ANY_PROPERTY);
// int intvalue;
icaltimetype icaltime;
QStringList categories;
while (p) {
icalproperty_kind kind = icalproperty_isa(p);
switch (kind) {
case ICAL_DUE_PROPERTY: // due date
icaltime = icalproperty_get_due(p);
if (icaltime.is_date) {
todo->setDtDue(QDateTime(readICalDate(icaltime),QTime(0,0,0)));
todo->setFloats(true);
} else {
@@ -1310,65 +1313,65 @@ void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *inci
{
icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY);
while (p) {
icalproperty_kind kind = icalproperty_isa(p);
switch (kind) {
case ICAL_UID_PROPERTY: // unique id
incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p)));
break;
case ICAL_ORGANIZER_PROPERTY: // organizer
incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p)));
break;
case ICAL_ATTENDEE_PROPERTY: // attendee
incidenceBase->addAttendee(readAttendee(p));
break;
default:
break;
}
p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY);
}
// custom properties
readCustomProperties(parent, incidenceBase);
}
void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties)
{
- QMap<QCString, QString> customProperties;
+ QMap<Q3CString, QString> customProperties;
icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY);
while (p) {
QString value = QString::fromUtf8(icalproperty_get_x(p));
customProperties[icalproperty_get_x_name(p)] = value;
//qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) );
p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY);
}
properties->setCustomProperties(customProperties);
}
void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence)
{
// kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl;
Recurrence *recur = incidence->recurrence();
recur->setCompatVersion(mCalendarVersion);
recur->unsetRecurs();
struct icalrecurrencetype r = rrule;
dumpIcalRecurrence(r);
readRecurrence( r, recur, incidence);
}
void ICalFormatImpl::readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur, Incidence *incidence)
{
int wkst;
int index = 0;
diff --git a/libkcal/icalformatimpl.h b/libkcal/icalformatimpl.h
index 203c302..3a35b4c 100644
--- a/libkcal/icalformatimpl.h
+++ b/libkcal/icalformatimpl.h
@@ -1,55 +1,57 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef ICALFORMATIMPL_H
#define ICALFORMATIMPL_H
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "scheduler.h"
#include "freebusy.h"
extern "C" {
#include <ical.h>
#include <icalss.h>
}
namespace KCal {
class Compat;
/**
This class provides the libical dependent functions for ICalFormat.
*/
class ICalFormatImpl {
public:
/** Create new iCal format for calendar object */
ICalFormatImpl( ICalFormat *parent );
virtual ~ICalFormatImpl();
bool populate( Calendar *, icalcomponent *fs);
icalcomponent *writeIncidence(Incidence *incidence);
icalcomponent *writeTodo(Todo *todo);
icalcomponent *writeEvent(Event *event);
icalcomponent *writeFreeBusy(FreeBusy *freebusy,
Scheduler::Method method);
icalcomponent *writeJournal(Journal *journal);
void writeIncidence(icalcomponent *parent,Incidence *incidence);
icalproperty *writeAttendee(Attendee *attendee);
@@ -64,46 +66,46 @@ class ICalFormatImpl {
Journal *readJournal(icalcomponent *vjournal);
Attendee *readAttendee(icalproperty *attendee);
Attachment *readAttachment(icalproperty *attach);
void readIncidence(icalcomponent *parent,Incidence *incidence);
void readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *event);
void readRecurrence( const struct icalrecurrencetype &r, Recurrence* recur,Incidence *event );
void readAlarm(icalcomponent *alarm,Incidence *incidence);
/** Return the PRODID string loaded from calendar file */
const QString &loadedProductId() { return mLoadedProductId; }
icaltimetype writeICalDate(const QDate &);
QDate readICalDate(icaltimetype);
icaltimetype writeICalDateTime(const QDateTime &);
QDateTime readICalDateTime(icaltimetype);
icaldurationtype writeICalDuration(int seconds);
int readICalDuration(icaldurationtype);
icalcomponent *createCalendarComponent(Calendar * = 0);
icalcomponent *createScheduleComponent(IncidenceBase *,Scheduler::Method);
private:
void writeIncidenceBase(icalcomponent *parent,IncidenceBase *);
void readIncidenceBase(icalcomponent *parent,IncidenceBase *);
void writeCustomProperties(icalcomponent *parent,CustomProperties *);
void readCustomProperties(icalcomponent *parent,CustomProperties *);
void dumpIcalRecurrence(icalrecurrencetype);
ICalFormat *mParent;
Calendar *mCalendar;
QString mLoadedProductId; // PRODID string loaded from calendar file
int mCalendarVersion; // determines backward compatibility mode on read
- QPtrList<Event> mEventsRelate; // events with relations
- QPtrList<Todo> mTodosRelate; // todos with relations
+ Q3PtrList<Event> mEventsRelate; // events with relations
+ Q3PtrList<Todo> mTodosRelate; // todos with relations
static const int mSecondsPerWeek;
static const int mSecondsPerDay;
static const int mSecondsPerHour;
static const int mSecondsPerMinute;
Compat *mCompat;
};
}
#endif
diff --git a/libkcal/imipscheduler.cpp b/libkcal/imipscheduler.cpp
index e186f8e..e6d56a6 100644
--- a/libkcal/imipscheduler.cpp
+++ b/libkcal/imipscheduler.cpp
@@ -1,58 +1,60 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//
// IMIPScheduler - iMIP implementation of iTIP methods
//
#include "event.h"
#include "icalformat.h"
#include "imipscheduler.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
IMIPScheduler::IMIPScheduler(Calendar *calendar)
: Scheduler(calendar)
{
}
IMIPScheduler::~IMIPScheduler()
{
}
bool IMIPScheduler::publish (IncidenceBase *incidence,const QString &recipients)
{
return false;
}
bool IMIPScheduler::performTransaction(IncidenceBase *incidence,Method method)
{
mFormat->createScheduleMessage(incidence,method);
return false;
}
-QPtrList<ScheduleMessage> IMIPScheduler::retrieveTransactions()
+Q3PtrList<ScheduleMessage> IMIPScheduler::retrieveTransactions()
{
- QPtrList<ScheduleMessage> messageList;
+ Q3PtrList<ScheduleMessage> messageList;
return messageList;
}
diff --git a/libkcal/imipscheduler.h b/libkcal/imipscheduler.h
index f142060..5a2d38e 100644
--- a/libkcal/imipscheduler.h
+++ b/libkcal/imipscheduler.h
@@ -1,49 +1,49 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef IMIPSCHEDULER_H
#define IMIPSCHEDULER_H
//
// iMIP implementation of iTIP methods
//
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include "scheduler.h"
namespace KCal {
/*
This class implements the iTIP interface using the email interface specified
as iMIP.
*/
class IMIPScheduler : public Scheduler {
public:
IMIPScheduler(Calendar *);
virtual ~IMIPScheduler();
bool publish (IncidenceBase *incidence,const QString &recipients);
bool performTransaction(IncidenceBase *incidence,Method method);
- QPtrList<ScheduleMessage> retrieveTransactions();
+ Q3PtrList<ScheduleMessage> retrieveTransactions();
};
}
#endif // IMIPSCHEDULER_H
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 7dd9bd2..8fcdc69 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -1,133 +1,135 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include "calformat.h"
#include "incidence.h"
#include "todo.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
Incidence::Incidence() :
IncidenceBase(),
mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3)
{
mRecurrence = 0;//new Recurrence(this);
mCancelled = false;
recreate();
mHasStartDate = true;
mAlarms.setAutoDelete(true);
mAttachments.setAutoDelete(true);
mHasRecurrenceID = false;
mHoliday = false;
mBirthday = false;
mAnniversary = false;
}
Incidence::Incidence( const Incidence &i ) : IncidenceBase( i )
{
// TODO: reenable attributes currently commented out.
mRevision = i.mRevision;
mCreated = i.mCreated;
mDescription = i.mDescription;
mSummary = i.mSummary;
mCategories = i.mCategories;
// Incidence *mRelatedTo; Incidence *mRelatedTo;
mRelatedTo = 0;
mRelatedToUid = i.mRelatedToUid;
// QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations;
mExDates = i.mExDates;
- QPtrListIterator<Attachment> itat( i.mAttachments );
+ Q3PtrListIterator<Attachment> itat( i.mAttachments );
Attachment *at;
while( (at = itat.current()) ) {
Attachment *a = new Attachment( *at );
mAttachments.append( a );
++itat;
}
mAttachments.setAutoDelete( true );
mResources = i.mResources;
mSecrecy = i.mSecrecy;
mPriority = i.mPriority;
mLocation = i.mLocation;
mCancelled = i.mCancelled;
mHasStartDate = i.mHasStartDate;
- QPtrListIterator<Alarm> it( i.mAlarms );
+ Q3PtrListIterator<Alarm> it( i.mAlarms );
const Alarm *a;
while( (a = it.current()) ) {
Alarm *b = new Alarm( *a );
b->setParent( this );
mAlarms.append( b );
++it;
}
mAlarms.setAutoDelete(true);
mHasRecurrenceID = i.mHasRecurrenceID;
mRecurrenceID = i.mRecurrenceID;
if ( i.mRecurrence )
mRecurrence = new Recurrence( *(i.mRecurrence), this );
else
mRecurrence = 0;
mHoliday = i.mHoliday ;
mBirthday = i.mBirthday;
mAnniversary = i.mAnniversary;
}
Incidence::~Incidence()
{
Incidence *ev;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (ev=Relations.first();ev;ev=Relations.next()) {
if (ev->relatedTo() == this) ev->setRelatedTo(0);
}
if (relatedTo()) relatedTo()->removeRelation(this);
if ( mRecurrence )
delete mRecurrence;
}
QString Incidence::durationText()
{
return "---";
}
QString Incidence::durationText4Time( int offset )
{
int min = offset/60;
int hours = min /60;
min = min % 60;
int days = hours /24;
hours = hours % 24;
if ( doesFloat() || ( min == 0 && hours == 0 ) ) {
if ( days == 1 )
return "1" + i18n(" day");
else
return QString::number( days )+ i18n(" days");
}
QString message = QString::number ( hours ) +":";
if ( min < 10 ) message += "0";
message += QString::number ( min );
if ( days > 0 ) {
if ( days == 1 )
@@ -187,66 +189,66 @@ bool Incidence::hasStartDate() const
return mHasStartDate;
}
void Incidence::setHasStartDate(bool f)
{
if (mReadOnly) return;
mHasStartDate = f;
updated();
}
// A string comparison that considers that null and empty are the same
static bool stringCompare( const QString& s1, const QString& s2 )
{
if ( s1.isEmpty() && s2.isEmpty() )
return true;
return s1 == s2;
}
bool KCal::operator==( const Incidence& i1, const Incidence& i2 )
{
if( i1.alarms().count() != i2.alarms().count() ) {
return false; // no need to check further
}
if ( i1.alarms().count() > 0 ) {
if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) )
{
qDebug("alarm not equal ");
return false;
}
}
#if 0
- QPtrListIterator<Alarm> a1( i1.alarms() );
- QPtrListIterator<Alarm> a2( i2.alarms() );
+ Q3PtrListIterator<Alarm> a1( i1.alarms() );
+ Q3PtrListIterator<Alarm> a2( i2.alarms() );
for( ; a1.current() && a2.current(); ++a1, ++a2 ) {
if( *a1.current() == *a2.current() ) {
continue;
}
else {
return false;
}
}
#endif
if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) {
if ( i1.hasRecurrenceID() ) {
if ( i1.recurrenceID() != i2.recurrenceID() )
return false;
}
} else {
return false;
}
if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) )
return false;
if ( i1.hasStartDate() == i2.hasStartDate() ) {
if ( i1.hasStartDate() ) {
if ( i1.dtStart() != i2.dtStart() )
return false;
}
} else {
return false;
}
if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) {
if (!( *i1.mRecurrence == *i2.mRecurrence) ) {
@@ -293,99 +295,99 @@ Incidence* Incidence::recreateCloneException( QDate d )
if ( typeID() == eventID ) {
int len = dtStart().secsTo( ((Event*)this)->dtEnd());
QTime tim = dtStart().time();
newInc->setDtStart( QDateTime(d, tim) );
((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
} else {
int len = dtStart().secsTo( ((Todo*)this)->dtDue());
QTime tim = ((Todo*)this)->dtDue().time();
((Todo*)newInc)->setDtDue( QDateTime(d, tim) );
((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) );
((Todo*)this)->setRecurDates();
}
newInc->setExDates( DateList () );
}
return newInc;
}
void Incidence::recreate()
{
setCreated(QDateTime::currentDateTime());
setUid(CalFormat::createUniqueId());
setRevision(0);
setIDStr( ":" );
setLastModified(QDateTime::currentDateTime());
}
void Incidence::cloneRelations( Incidence * newInc )
{
// newInc is already a clone of this incidence
Incidence * inc;
Incidence * cloneInc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
cloneInc = inc->clone();
cloneInc->recreate();
cloneInc->setRelatedTo( newInc );
inc->cloneRelations( cloneInc );
}
}
void Incidence::setReadOnly( bool readOnly )
{
IncidenceBase::setReadOnly( readOnly );
if ( mRecurrence )
mRecurrence->setRecurReadOnly( readOnly);
}
void Incidence::setLastModifiedSubInvalid()
{
mLastModifiedSub = QDateTime();
if ( mRelatedTo )
mRelatedTo->setLastModifiedSubInvalid();
}
QString Incidence::lastModifiedSubSortKey() const
{
if ( mLastModifiedSubSortKey.isEmpty() )
return lastModifiedSortKey();
return mLastModifiedSubSortKey;
}
QDateTime Incidence::lastModifiedSub()
{
if ( !mRelations.count() )
return lastModified();
if ( mLastModifiedSub.isValid() )
return mLastModifiedSub;
mLastModifiedSub = lastModified();
Incidence * inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
if ( inc->lastModifiedSub() > mLastModifiedSub )
mLastModifiedSub = inc->lastModifiedSub();
}
mLastModifiedSubSortKey.sprintf("%04d%02d%02d%02d%02d%02d",
mLastModifiedSub.date().year(),
mLastModifiedSub.date().month(),
mLastModifiedSub.date().day(),
mLastModifiedSub.time().hour(),
mLastModifiedSub.time().minute(),
mLastModifiedSub.time().second() );
return mLastModifiedSub;
}
void Incidence::setCreated(QDateTime created)
{
if (mReadOnly) return;
mCreated = getEvenTime(created);
}
QDateTime Incidence::created() const
{
return mCreated;
}
void Incidence::setRevision(int rev)
{
if (mReadOnly) return;
mRevision = rev;
updated();
}
@@ -418,80 +420,80 @@ QString Incidence::description() const
void Incidence::setSummary(const QString &summary)
{
if (mReadOnly) return;
mSummary = summary;
updated();
}
QString Incidence::summary() const
{
return mSummary;
}
void Incidence::checkCategories()
{
mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday"));
mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday"));
mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary"));
}
void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false
{
if (mReadOnly) return;
int i;
for( i = 0; i < categories.count(); ++i ) {
if ( !mCategories.contains (categories[i]))
mCategories.append( categories[i] );
}
checkCategories();
updated();
if ( addToRelations ) {
Incidence * inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
inc->addCategories( categories, true );
}
}
}
void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false
{
if (mReadOnly) return;
mCategories = categories;
checkCategories();
updated();
if ( setForRelations ) {
Incidence * inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
inc->setCategories( categories, true );
}
}
}
// TODO: remove setCategories(QString) function
void Incidence::setCategories(const QString &catStr)
{
if (mReadOnly) return;
mCategories.clear();
if (catStr.isEmpty()) return;
mCategories = QStringList::split(",",catStr);
QStringList::Iterator it;
for(it = mCategories.begin();it != mCategories.end(); ++it) {
*it = (*it).stripWhiteSpace();
}
checkCategories();
updated();
}
// using this makes filtering 3 times faster
QStringList* Incidence::categoriesP()
{
return &mCategories;
}
QStringList Incidence::categories() const
{
return mCategories;
@@ -521,73 +523,73 @@ QString Incidence::relatedToUid() const
return mRelatedToUid;
}
void Incidence::resetRelatedTo()
{
QString store = mRelatedToUid;
setRelatedTo( 0 );
mRelatedToUid = store;
}
void Incidence::setRelatedTo(Incidence *relatedTo)
{
//qDebug("Incidence::setRelatedTo %d ", relatedTo);
//qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() );
if (mReadOnly || mRelatedTo == relatedTo) return;
if(mRelatedTo) {
// updated();
mRelatedTo->removeRelation(this);
}
mRelatedTo = relatedTo;
if (mRelatedTo) {
mRelatedTo->addRelation(this);
mRelatedToUid = mRelatedTo->uid();
} else {
mRelatedToUid = "";
}
}
Incidence *Incidence::relatedTo() const
{
return mRelatedTo;
}
-QPtrList<Incidence> Incidence::relations() const
+Q3PtrList<Incidence> Incidence::relations() const
{
return mRelations;
}
-void Incidence::addRelationsToList(QPtrList<Incidence> *rel)
+void Incidence::addRelationsToList(Q3PtrList<Incidence> *rel)
{
Incidence* inc;
- QPtrList<Incidence> Relations = relations();
+ Q3PtrList<Incidence> Relations = relations();
for (inc=Relations.first();inc;inc=Relations.next()) {
inc->addRelationsToList( rel );
}
if ( rel->findRef( this ) == -1 )
rel->append( this );
}
void Incidence::addRelation(Incidence *event)
{
setLastModifiedSubInvalid();
if( mRelations.findRef( event ) == -1 ) {
mRelations.append(event);
//updated();
}
}
void Incidence::removeRelation(Incidence *event)
{
setLastModifiedSubInvalid();
mRelations.removeRef(event);
// if (event->getRelatedTo() == this) event->setRelatedTo(0);
}
bool Incidence::recursOn(const QDate &qd) const
{
if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true;
else return false;
}
void Incidence::setExDates(const DateList &exDates)
{
if (mReadOnly) return;
@@ -618,73 +620,73 @@ bool Incidence::isException(const QDate &date) const
for( it = mExDates.begin(); it != mExDates.end(); ++it ) {
if ( (*it) == date ) {
return true;
}
}
return false;
}
void Incidence::addAttachment(Attachment *attachment)
{
if (mReadOnly || !attachment) return;
mAttachments.append(attachment);
updated();
}
void Incidence::deleteAttachment(Attachment *attachment)
{
mAttachments.removeRef(attachment);
}
void Incidence::deleteAttachments(const QString& mime)
{
Attachment *at = mAttachments.first();
while (at) {
if (at->mimeType() == mime)
mAttachments.remove();
else
at = mAttachments.next();
}
}
-QPtrList<Attachment> Incidence::attachments() const
+Q3PtrList<Attachment> Incidence::attachments() const
{
return mAttachments;
}
-QPtrList<Attachment> Incidence::attachments(const QString& mime) const
+Q3PtrList<Attachment> Incidence::attachments(const QString& mime) const
{
- QPtrList<Attachment> attachments;
- QPtrListIterator<Attachment> it( mAttachments );
+ Q3PtrList<Attachment> attachments;
+ Q3PtrListIterator<Attachment> it( mAttachments );
Attachment *at;
while ( (at = it.current()) ) {
if (at->mimeType() == mime)
attachments.append(at);
++it;
}
return attachments;
}
void Incidence::setResources(const QStringList &resources)
{
if (mReadOnly) return;
mResources = resources;
updated();
}
QStringList Incidence::resources() const
{
return mResources;
}
void Incidence::setPriority(int priority)
{
if (mReadOnly) return;
mPriority = priority;
updated();
}
int Incidence::priority() const
{
@@ -708,99 +710,99 @@ QString Incidence::secrecyStr() const
return secrecyName(mSecrecy);
}
QString Incidence::secrecyName(int secrecy)
{
switch (secrecy) {
case SecrecyPublic:
return i18n("Public");
break;
case SecrecyPrivate:
return i18n("Private");
break;
case SecrecyConfidential:
return i18n("Confidential");
break;
default:
return i18n("Undefined");
break;
}
}
QStringList Incidence::secrecyList()
{
QStringList list;
list << secrecyName(SecrecyPublic);
list << secrecyName(SecrecyPrivate);
list << secrecyName(SecrecyConfidential);
return list;
}
-QPtrList<Alarm> Incidence::alarms() const
+Q3PtrList<Alarm> Incidence::alarms() const
{
return mAlarms;
}
Alarm* Incidence::newAlarm()
{
Alarm* alarm = new Alarm(this);
mAlarms.append(alarm);
// updated();
return alarm;
}
void Incidence::addAlarm(Alarm *alarm)
{
mAlarms.append(alarm);
updated();
}
void Incidence::removeAlarm(Alarm *alarm)
{
mAlarms.removeRef(alarm);
updated();
}
void Incidence::clearAlarms()
{
mAlarms.clear();
updated();
}
bool Incidence::isAlarmEnabled() const
{
Alarm* alarm;
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled())
return true;
}
return false;
}
#include <stdlib.h>
Recurrence *Incidence::recurrence()
{
if ( ! mRecurrence ) {
mRecurrence = new Recurrence(this);
mRecurrence->setRecurStart( dtStart() );
mRecurrence->setRecurReadOnly( isReadOnly());
//qDebug("creating new recurence ");
//abort();
}
return mRecurrence;
}
void Incidence::setRecurrence( Recurrence * r)
{
if ( mRecurrence )
delete mRecurrence;
mRecurrence = r;
}
void Incidence::setLocation(const QString &location)
{
if (mReadOnly) return;
mLocation = location;
updated();
}
QString Incidence::location() const
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index f89942f..2940129 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -1,60 +1,62 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef INCIDENCE_H
#define INCIDENCE_H
//
// Incidence - base class of calendaring components
//
#include <qdatetime.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "recurrence.h"
#include "alarm.h"
#include "attachment.h"
#include "listbase.h"
#include "incidencebase.h"
namespace KCal {
class Event;
class Todo;
class Journal;
/**
This class provides the base class common to all calendar components.
*/
class Incidence : public IncidenceBase
{
public:
/**
This class provides the interface for a visitor of calendar components. It
serves as base class for concrete visitors, which implement certain actions on
calendar components. It allows to add functions, which operate on the concrete
types of calendar components, without changing the calendar component classes.
*/
class Visitor
{
public:
/** Destruct Incidence::Visitor */
virtual ~Visitor() {}
/**
@@ -84,244 +86,244 @@ class Incidence : public IncidenceBase
*/
template<class T>
class AddVisitor : public Visitor
{
public:
AddVisitor( T *r ) : mResource( r ) {}
bool visit( Event *e ) { return mResource->addEvent( e ); }
bool visit( Todo *t ) { return mResource->addTodo( t ); }
bool visit( Journal *j ) { return mResource->addJournal( j ); }
private:
T *mResource;
};
/** enumeration for describing an event's secrecy. */
enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
typedef ListBase<Incidence> List;
Incidence();
Incidence(const Incidence &);
~Incidence();
/**
Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
provide this implementation:
<pre>
bool accept(Visitor &v) { return v.visit(this); }
</pre>
*/
virtual bool accept(Visitor &) { return false; }
virtual Incidence *clone() = 0;
virtual void cloneRelations( Incidence * );
- void addRelationsToList(QPtrList<Incidence> *rel);
+ void addRelationsToList(Q3PtrList<Incidence> *rel);
void clearRelations();
virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
void setReadOnly( bool );
/**
Recreate event. The event is made a new unique event, but already stored
event information is preserved. Sets uniquie id, creation date, last
modification date and revision number.
*/
void recreate();
Incidence* recreateCloneException(QDate);
/** set creation date */
void setCreated(QDateTime);
/** return time and date of creation. */
QDateTime created() const;
/** set the number of revisions this event has seen */
void setRevision(int rev);
/** return the number of revisions this event has seen */
int revision() const;
/** Set starting date/time. */
virtual void setDtStart(const QDateTime &dtStart);
/** Return the incidence's ending date/time as a QDateTime. */
virtual QDateTime dtEnd() const { return QDateTime(); }
/** sets the event's lengthy description. */
void setDescription(const QString &description);
/** returns a reference to the event's description. */
QString description() const;
/** sets the event's short summary. */
void setSummary(const QString &summary);
/** returns a reference to the event's summary. */
QString summary() const;
/** set event's applicable categories */
void setCategories(const QStringList &categories, bool setForRelations = false);
void addCategories(const QStringList &categories, bool addToRelations = false);
/** set event's categories based on a comma delimited string */
void setCategories(const QString &catStr);
/** return categories in a list */
QStringList categories() const;
QStringList* categoriesP();
/** return categories as a comma separated string */
QString categoriesStr();
QString categoriesStrWithSpace();
/** point at some other event to which the event relates. This function should
* only be used when constructing a calendar before the related Event
* exists. */
void setRelatedToUid(const QString &);
/** what event does this one relate to? This function should
* only be used when constructing a calendar before the related Event
* exists. */
QString relatedToUid() const;
/** point at some other event to which the event relates */
void setRelatedTo(Incidence *relatedTo);
void resetRelatedTo();
/** what event does this one relate to? */
Incidence *relatedTo() const;
/** All events that are related to this event */
- QPtrList<Incidence> relations() const;
+ Q3PtrList<Incidence> relations() const;
/** Add an event which is related to this event */
void addRelation(Incidence *);
/** Remove event that is related to this event */
void removeRelation(Incidence *);
/** returns the list of dates which are exceptions to the recurrence rule */
DateList exDates() const;
/** sets the list of dates which are exceptions to the recurrence rule */
void setExDates(const DateList &_exDates);
void setExDates(const char *dates);
/** Add a date to the list of exceptions of the recurrence rule. */
void addExDate(const QDate &date);
/** returns true if there is an exception for this date in the recurrence
rule set, or false otherwise. */
bool isException(const QDate &qd) const;
/** add attachment to this event */
void addAttachment(Attachment *attachment);
/** remove and delete a specific attachment */
void deleteAttachment(Attachment *attachment);
/** remove and delete all attachments with this mime type */
void deleteAttachments(const QString& mime);
/** return list of all associated attachments */
- QPtrList<Attachment> attachments() const;
+ Q3PtrList<Attachment> attachments() const;
/** find a list of attachments with this mime type */
- QPtrList<Attachment> attachments(const QString& mime) const;
+ Q3PtrList<Attachment> attachments(const QString& mime) const;
/** sets the event's status the value specified. See the enumeration
* above for possible values. */
void setSecrecy(int);
/** return the event's secrecy. */
int secrecy() const;
/** return the event's secrecy in string format. */
QString secrecyStr() const;
/** return list of all availbale secrecy classes */
static QStringList secrecyList();
/** return human-readable name of secrecy class */
static QString secrecyName(int);
/** returns TRUE if the date specified is one on which the event will
* recur. */
bool recursOn(const QDate &qd) const;
// VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
/** set resources used, such as Office, Car, etc. */
void setResources(const QStringList &resources);
/** return list of current resources */
QStringList resources() const;
/** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
void setPriority(int priority);
/** get the event's priority */
int priority() const;
/** All alarms that are associated with this incidence */
- QPtrList<Alarm> alarms() const;
+ Q3PtrList<Alarm> alarms() const;
/** Create a new alarm which is associated with this incidence */
Alarm* newAlarm();
/** Add an alarm which is associated with this incidence */
void addAlarm(Alarm*);
/** Remove an alarm that is associated with this incidence */
void removeAlarm(Alarm*);
/** Remove all alarms that are associated with this incidence */
void clearAlarms();
/** return whether any alarm associated with this incidence is enabled */
bool isAlarmEnabled() const;
/**
Return the recurrence rule associated with this incidence. If there is
none, returns an appropriate (non-0) object.
*/
Recurrence *recurrence();
void setRecurrence(Recurrence * r);
/**
Forward to Recurrence::doesRecur().
*/
ushort doesRecur() const;
/** set the event's/todo's location. Do _not_ use it with journal */
void setLocation(const QString &location);
/** return the event's/todo's location. Do _not_ use it with journal */
QString location() const;
/** returns TRUE or FALSE depending on whether the todo has a start date */
bool hasStartDate() const;
/** sets the event's hasStartDate value. */
void setHasStartDate(bool f);
QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
bool cancelled() const;
void setCancelled( bool b );
bool hasRecurrenceID() const;
void setHasRecurrenceID( bool b );
void setRecurrenceID(QDateTime);
QDateTime recurrenceID () const;
QDateTime dtStart() const;
bool isHoliday() const;
bool isBirthday() const;
bool isAnniversary() const;
QDateTime lastModifiedSub();
QString lastModifiedSubSortKey() const;
QString recurrenceText() const;
void setLastModifiedSubInvalid();
virtual QString durationText();
QString durationText4Time( int secs );
Recurrence *mRecurrence;
protected:
- QPtrList<Alarm> mAlarms;
- QPtrList<Incidence> mRelations;
+ Q3PtrList<Alarm> mAlarms;
+ Q3PtrList<Incidence> mRelations;
QDateTime mRecurrenceID;
bool mHasRecurrenceID;
private:
void checkCategories();
QString mLastModifiedSubSortKey;
bool mHoliday, mBirthday, mAnniversary;
int mRevision;
bool mCancelled;
// base components of jounal, event and todo
QDateTime mCreated;
QDateTime mLastModifiedSub;
QString mDescription;
QString mSummary;
QStringList mCategories;
Incidence *mRelatedTo;
QString mRelatedToUid;
DateList mExDates;
- QPtrList<Attachment> mAttachments;
+ Q3PtrList<Attachment> mAttachments;
QStringList mResources;
bool mHasStartDate; // if todo has associated start date
int mSecrecy;
int mPriority; // 1 = highest, 2 = less, etc.
//QPtrList<Alarm> mAlarms;
QString mLocation;
};
bool operator==( const Incidence&, const Incidence& );
}
#endif
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 56c0560..f11ec54 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -1,99 +1,101 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kidmanager.h>
#include "calformat.h"
#include "syncdefines.h"
#include "incidencebase.h"
+//Added by qt3to4:
+#include <Q3PtrList>
using namespace KCal;
IncidenceBase::IncidenceBase() :
mReadOnly(false), mFloats(true), mDuration(0), mHasDuration(false),
mPilotId(0), mSyncStatus(SYNCMOD)
{
blockLastModified = false;
setUid(CalFormat::createUniqueId());
mOrganizer = "";
mFloats = false;
mDuration = 0;
mHasDuration = false;
mPilotId = 0;
mExternalId = ":";
mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
mSyncStatus = 0;
mAttendees.setAutoDelete( true );
mCalEnabled = true;
mAlarmEnabled = true;
mCalID = 0;
}
IncidenceBase::IncidenceBase(const IncidenceBase &i) :
CustomProperties( i )
{
blockLastModified = false;
mReadOnly = i.mReadOnly;
mDtStart = i.mDtStart;
mDuration = i.mDuration;
mHasDuration = i.mHasDuration;
mOrganizer = i.mOrganizer;
mUid = i.mUid;
mCalEnabled = i.mCalEnabled;
mAlarmEnabled = i.mAlarmEnabled;
mCalID = i.mCalID;
- QPtrList<Attendee> attendees = i.attendees();
+ Q3PtrList<Attendee> attendees = i.attendees();
for( Attendee *a = attendees.first(); a; a = attendees.next() ) {
mAttendees.append( new Attendee( *a ) );
}
mFloats = i.mFloats;
mLastModified = i.mLastModified;
mPilotId = i.mPilotId;
mTempSyncStat = i.mTempSyncStat;
mSyncStatus = i.mSyncStatus;
mExternalId = i.mExternalId;
// The copied object is a new one, so it isn't observed by the observer
// of the original object.
mObservers.clear();
mAttendees.setAutoDelete( true );
}
IncidenceBase::~IncidenceBase()
{
}
bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
{
// do not compare mSyncStatus and mExternalId
if( i1.attendees().count() != i2.attendees().count() ) {
return false; // no need to check further
}
if ( i1.attendees().count() > 0 ) {
Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
while ( a1 ) {
if ( !( (*a1) == (*a2)) )
{
@@ -271,135 +273,135 @@ QString IncidenceBase::dtStartTimeStr() const
QString IncidenceBase::dtStartDateStr(bool shortfmt) const
{
return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
}
QString IncidenceBase::dtStartStr(bool shortfmt) const
{
if ( doesFloat() )
return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
return KGlobal::locale()->formatDateTime(dtStart(), shortfmt);
}
bool IncidenceBase::doesFloat() const
{
return mFloats;
}
void IncidenceBase::setFloats(bool f)
{
if (mReadOnly) return;
mFloats = f;
updated();
}
bool IncidenceBase::addAttendee(Attendee *a, bool doupdate)
{
if (mReadOnly) return false;
if (a->name().left(7).upper() == "MAILTO:")
a->setName(a->name().remove(0,7));
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (*qli.current() == *a)
return false;
++qli;
}
mAttendees.append(a);
if (doupdate) updated();
return true;
}
#if 0
void IncidenceBase::removeAttendee(Attendee *a)
{
if (mReadOnly) return;
mAttendees.removeRef(a);
updated();
}
void IncidenceBase::removeAttendee(const char *n)
{
Attendee *a;
if (mReadOnly) return;
for (a = mAttendees.first(); a; a = mAttendees.next())
if (a->getName() == n) {
mAttendees.remove();
break;
}
}
#endif
void IncidenceBase::clearAttendees()
{
if (mReadOnly) return;
mAttendees.clear();
}
#if 0
Attendee *IncidenceBase::getAttendee(const char *n) const
{
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (qli.current()->getName() == n)
return qli.current();
++qli;
}
return 0L;
}
#endif
Attendee *IncidenceBase::attendeeByMail(const QString &email)
{
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
qli.toFirst();
while (qli) {
if (qli.current()->email().lower() == email.lower())
return qli.current();
++qli;
}
return 0L;
}
Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QString& email)
{
- QPtrListIterator<Attendee> qli(mAttendees);
+ Q3PtrListIterator<Attendee> qli(mAttendees);
QStringList mails = emails;
if (!email.isEmpty()) {
mails.append(email);
}
qli.toFirst();
while (qli) {
for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) {
if (qli.current()->email().lower() == (*it).lower())
return qli.current();
}
++qli;
}
return 0L;
}
void IncidenceBase::setDuration(int seconds)
{
mDuration = seconds;
setHasDuration(true);
}
int IncidenceBase::duration() const
{
return mDuration;
}
void IncidenceBase::setHasDuration(bool b)
{
mHasDuration = b;
}
@@ -462,39 +464,39 @@ QString IncidenceBase::getID( const QString & prof)
// format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0
void IncidenceBase::setCsum( const QString & prof , const QString & id )
{
mExternalId = KIdManager::setCsum ( mExternalId, prof, id );
}
QString IncidenceBase::getCsum( const QString & prof)
{
return KIdManager::getCsum ( mExternalId, prof );
}
void IncidenceBase::setIDStr( const QString & s )
{
if (mReadOnly) return;
mExternalId = s;
}
QString IncidenceBase::IDStr() const
{
return mExternalId ;
}
void IncidenceBase::registerObserver( IncidenceBase::Observer *observer )
{
if( !mObservers.contains(observer) ) mObservers.append( observer );
}
void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer )
{
mObservers.remove( observer );
}
void IncidenceBase::updated()
{
- QPtrListIterator<Observer> it(mObservers);
+ Q3PtrListIterator<Observer> it(mObservers);
while( it.current() ) {
Observer *o = it.current();
++it;
o->incidenceUpdated( this );
}
}
diff --git a/libkcal/incidencebase.h b/libkcal/incidencebase.h
index 3edc03b..d97f524 100644
--- a/libkcal/incidencebase.h
+++ b/libkcal/incidencebase.h
@@ -1,190 +1,192 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_INCIDENCEBASE_H
#define KCAL_INCIDENCEBASE_H
//
// Incidence - base class of calendaring components
//
#include <qdatetime.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
-#include <qptrlist.h>
+#include <q3valuelist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "customproperties.h"
#include "attendee.h"
namespace KCal {
-typedef QValueList<QDate> DateList;
+typedef Q3ValueList<QDate> DateList;
enum IncTypeID { eventID,todoID,journalID,freebusyID };
/**
This class provides the base class common to all calendar components.
*/
class IncidenceBase : public CustomProperties
{
public:
class Observer {
public:
virtual void incidenceUpdated( IncidenceBase * ) = 0;
};
IncidenceBase();
IncidenceBase(const IncidenceBase &);
virtual ~IncidenceBase();
- virtual QCString type() const = 0;
+ virtual Q3CString type() const = 0;
virtual IncTypeID typeID() const = 0;
/** Set the unique id for the event */
void setUid(const QString &);
/** Return the unique id for the event */
QString uid() const;
/** Sets the time the incidence was last modified. */
void setLastModified(const QDateTime &lm);
/** Return the time the incidence was last modified. */
QDateTime lastModified() const;
QString lastModifiedSortKey() const;
/** sets the organizer for the event */
void setOrganizer(const QString &o);
QString organizer() const;
/** Set readonly status. */
virtual void setReadOnly( bool );
/** Return if the object is read-only. */
bool isReadOnly() const { return mReadOnly; }
/** for setting the event's starting date/time with a QDateTime. */
virtual void setDtStart(const QDateTime &dtStart);
/** returns an event's starting date/time as a QDateTime. */
virtual QDateTime dtStart() const;
/** returns an event's starting time as a string formatted according to the
users locale settings */
QString dtStartTimeStr() const;
/** returns an event's starting date as a string formatted according to the
users locale settings */
QString dtStartDateStr(bool shortfmt=true) const;
/** returns an event's starting date and time as a string formatted according
to the users locale settings */
QString dtStartStr(bool shortfmt=true) const;
virtual void setDuration(int seconds);
int duration() const;
void setHasDuration(bool);
bool hasDuration() const;
/** Return true or false depending on whether the incidence "floats,"
* i.e. has a date but no time attached to it. */
bool doesFloat() const;
/** Set whether the incidence floats, i.e. has a date but no time attached to it. */
void setFloats(bool f);
/**
Add Attendee to this incidence. IncidenceBase takes ownership of the
Attendee object.
*/
bool addAttendee(Attendee *a, bool doupdate=true );
// void removeAttendee(Attendee *a);
// void removeAttendee(const char *n);
/** Remove all Attendees. */
void clearAttendees();
/** Return list of attendees. */
- QPtrList<Attendee> attendees() const { return mAttendees; };
+ Q3PtrList<Attendee> attendees() const { return mAttendees; };
/** Return number of attendees. */
int attendeeCount() const { return mAttendees.count(); };
/** Return the Attendee with this email */
Attendee* attendeeByMail(const QString &);
/** Return first Attendee with one of this emails */
Attendee* attendeeByMails(const QStringList &, const QString& email = QString::null);
/** pilot syncronization states */
enum { SYNCNONE = 0, SYNCMOD = 1, SYNCDEL = 3 };
/** Set synchronisation satus. */
void setSyncStatus(int stat);
/** Return synchronisation status. */
int syncStatus() const;
/** Set Pilot Id. */
void setPilotId(int id);
/** Return Pilot Id. */
int pilotId() const;
void setTempSyncStat(int id);
int tempSyncStat() const;
void setIDStr( const QString & );
QString IDStr() const;
void setID( const QString &, const QString & );
QString getID( const QString & );
void setCsum( const QString &, const QString & );
QString getCsum( const QString & );
void removeID(const QString &);
void registerObserver( Observer * );
void unRegisterObserver( Observer * );
void updated();
void setCalID( int id );
void setCalID_block( int id );
int calID() const;
void setCalEnabled( bool );
bool calEnabled() const;
void setAlarmEnabled( bool );
bool alarmEnabled() const;
bool isTagged() const;
void setTagged( bool );
virtual void setLastModifiedSubInvalid();
protected:
bool blockLastModified;
bool mIsTagged;
QDateTime mDtStart;
bool mReadOnly;
QDateTime getEvenTime( QDateTime );
private:
// base components
QString mOrganizer;
QString mLastModifiedKey;
QString mUid;
int mCalID;
bool mCalEnabled;
bool mAlarmEnabled;
QDateTime mLastModified;
- QPtrList<Attendee> mAttendees;
+ Q3PtrList<Attendee> mAttendees;
bool mFloats;
int mDuration;
bool mHasDuration;
QString mExternalId;
int mTempSyncStat;
// PILOT SYNCHRONIZATION STUFF
int mPilotId; // unique id for pilot sync
int mSyncStatus; // status (for sync)
- QPtrList<Observer> mObservers;
+ Q3PtrList<Observer> mObservers;
};
bool operator==( const IncidenceBase&, const IncidenceBase& );
}
#endif
diff --git a/libkcal/journal.h b/libkcal/journal.h
index 1cd0a22..c83356f 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -1,51 +1,53 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef JOURNAL_H
#define JOURNAL_H
//
// Journal component, representing a VJOURNAL object
//
#include "incidence.h"
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class provides a Journal in the sense of RFC2445.
*/
class Journal : public Incidence
{
public:
Journal();
~Journal();
- QCString type() const { return "Journal"; }
+ Q3CString type() const { return "Journal"; }
IncTypeID typeID() const { return journalID; }
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
private:
bool accept(Visitor &v) { return v.visit(this); }
};
bool operator==( const Journal&, const Journal& );
}
#endif
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 733b897..bce68b0 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -1,38 +1,40 @@
#include "kincidenceformatter.h"
#include <kstaticdeleter.h>
#include <kglobal.h>
#include <klocale.h>
#ifdef DEKTOP_VERSION
#include <kabc/stdaddressbook.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#define size count
#endif
KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
static KStaticDeleter<KIncidenceFormatter> insd;
QString KIncidenceFormatter::getFormattedText( Incidence * inc, bool details, bool created , bool modified )
{
// #ifndef QT_NO_INPUTDIALOG
// return QInputDialog::getItem( caption, label, items, current, editable );
// #else
// return QString::null;
// #endif
mDetails = details;
mCreated = created ;
mModified = modified;
mText = "";
if ( inc->typeID() == eventID )
setEvent((Event *) inc );
else if ( inc->typeID() == todoID )
setTodo((Todo *) inc );
return mText;
}
KIncidenceFormatter* KIncidenceFormatter::instance()
{
if (!mInstance) {
mInstance = insd.setObject(new KIncidenceFormatter());
}
return mInstance;
}
KIncidenceFormatter::~KIncidenceFormatter()
@@ -281,157 +283,157 @@ void KIncidenceFormatter::setTodo(Todo *event )
}
if ( mModified ) {
#ifdef DESKTOP_VERSION
addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
#else
addTag("p",i18n("<b>Last modified: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
#endif
}
if ( mDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",deTag(event->description()));
}
}
}
void KIncidenceFormatter::setJournal(Journal* )
{
}
void KIncidenceFormatter::formatCategories(Incidence *event)
{
if (!event->categoriesStr().isEmpty()) {
addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() );
//mText.append(event->categoriesStr());
}
}
void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
{
- int number=text.contains("\n");
+ int number=text.count("\n");
QString str = "<" + tag + ">";
QString tmpText=text;
QString tmpStr=str;
if(number !=-1)
{
if (number > 0) {
int pos=0;
QString tmp;
for(int i=0;i<=number;i++) {
pos=tmpText.find("\n");
tmp=tmpText.left(pos);
tmpText=tmpText.right(tmpText.length()-pos-1);
tmpStr+=tmp+"<br>";
}
}
else tmpStr += tmpText;
tmpStr+="</" + tag + ">";
mText.append(tmpStr);
}
else
{
str += text + "</" + tag + ">";
mText.append(str);
}
}
void KIncidenceFormatter::formatAttendees(Incidence *event)
{
- QPtrList<Attendee> attendees = event->attendees();
+ Q3PtrList<Attendee> attendees = event->attendees();
if (attendees.count()) {
QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
addTag("h3",i18n("Organizer"));
mText.append("<ul><li>");
#if 0
//ndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(event->organizer());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText.append(event->organizer());
}
#else
mText.append(event->organizer());
#endif
- if (iconPath) {
+ if (!iconPath.isEmpty()) {
mText += " <a href=\"mailto:" + event->organizer() + "\">";
mText += "<IMG src=\"" + iconPath + "\">";
mText += "</a>\n";
}
mText.append("</li></ul>");
addTag("h3",i18n("Attendees"));
Attendee *a;
mText.append("<ul>");
for(a=attendees.first();a;a=attendees.next()) {
#if 0
//ndef KORG_NOKABC
if (a->name().isEmpty()) {
addressList = add_book->findByEmail(a->email());
KABC::Addressee o = addressList.first();
if (!o.isEmpty() && addressList.size()<2) {
mText += "<a href=\"uid:" + o.uid() + "\">";
mText += o.formattedName();
mText += "</a>\n";
} else {
mText += "<li>";
mText.append(a->email());
mText += "\n";
}
} else {
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
}
#else
//qDebug("nokabc ");
mText += "<li><a href=\"uid:" + a->uid() + "\">";
if (!a->name().isEmpty()) mText += a->name();
else mText += a->email();
mText += "</a>\n";
#endif
if (!a->email().isEmpty()) {
- if (iconPath) {
+ if (!iconPath.isEmpty()) {
mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
if ( a->RSVP() )
mText += "<IMG src=\"" + iconPath + "\">";
else
mText += "<IMG src=\"" + NOiconPath + "\">";
mText += "</a>\n";
}
}
if (a->status() != Attendee::NeedsAction )
mText +="[" + a->statusStr() + "] ";
if (a->role() == Attendee::Chair )
mText +="(" + a->roleStr().left(1) + ".)";
}
mText.append("</li></ul>");
}
}
void KIncidenceFormatter::formatReadOnly(Incidence *event)
{
if (event->isReadOnly()) {
addTag("p","<em>(" + i18n("read-only") + ")</em>");
}
}
QString KIncidenceFormatter::deTag(QString text)
{
#if QT_VERSION >= 0x030000
text.replace( '<' , "&lt;" );
text.replace( '>' , "&gt;" );
#else
if ( text.find ('<') >= 0 ) {
text.replace( QRegExp("<") , "&lt;" );
}
diff --git a/libkcal/libkcal.pro b/libkcal/libkcal.pro
index 33c63c3..1f43b10 100644
--- a/libkcal/libkcal.pro
+++ b/libkcal/libkcal.pro
@@ -1,35 +1,35 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkcal
+TARGET = xmicrokcal
include( ../variables.pri )
INCLUDEPATH += ../libkdepim ../microkde versit ../microkde/kdecore
#../qtcompat
INCLUDEPATH += ../libical/src/libical
INCLUDEPATH += ../libical/src/libicalss
DESTDIR = ../bin
DEFINES += DESKTOP_VERSION
unix: {
LIBS += ../libical/lib/libical.a
LIBS += ../libical/lib/libicalss.a
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
LIBS += ../libical/lib/ical.lib
LIBS += ../libical/lib/icalss.lib
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
alarm.h \
attachment.h \
attendee.h \
calendar.h \
@@ -77,32 +77,36 @@ SOURCES = \
calendarlocal.cpp \
calfilter.cpp \
calformat.cpp \
compat.cpp \
customproperties.cpp \
dummyscheduler.cpp \
kincidenceformatter.cpp \
duration.cpp \
event.cpp \
exceptions.cpp \
filestorage.cpp \
freebusy.cpp \
icaldrag.cpp \
icalformat.cpp \
icalformatimpl.cpp \
imipscheduler.cpp \
incidence.cpp \
incidencebase.cpp \
journal.cpp \
period.cpp \
person.cpp \
qtopiaformat.cpp \
recurrence.cpp \
scheduler.cpp \
todo.cpp \
dndfactory.cpp \
vcaldrag.cpp \
vcalformat.cpp \
versit/vcc.c \
versit/vobject.c \
phoneformat.cpp \
+#The following line was inserted by qt3to4
+QT += xml qt3support
+#The following line was inserted by qt3to4
+QT +=
diff --git a/libkcal/libkcalE.pro b/libkcal/libkcalE.pro
index 737be53..fe46656 100644
--- a/libkcal/libkcalE.pro
+++ b/libkcal/libkcalE.pro
@@ -1,35 +1,35 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkcal
+TARGET = xmicrokcal
INCLUDEPATH += ../libkdepim ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include
INCLUDEPATH += ../libical/src/libical
INCLUDEPATH += ../libical/src/libicalss
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR = $(QPEDIR)/lib
#LIBS += ../libical/lib/$(PLATFORM)/libical.a
#LIBS += ../libical/lib/$(PLATFORM)/libicalss.a
LIBS += ../dest$(LIBICAL_PATH)/libical.a
LIBS += ../dest$(LIBICAL_PATH)/libicalss.a
INTERFACES = \
HEADERS = \
alarm.h \
attachment.h \
attendee.h \
calendar.h \
calendarlocal.h \
calfilter.h \
calformat.h \
calstorage.h \
compat.h \
customproperties.h \
dummyscheduler.h \
duration.h \
event.h \
exceptions.h \
filestorage.h \
freebusy.h \
icaldrag.h \
diff --git a/libkcal/listbase.h b/libkcal/listbase.h
index 085b13d..6c942ef 100644
--- a/libkcal/listbase.h
+++ b/libkcal/listbase.h
@@ -1,97 +1,99 @@
/*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_LISTBASE_H
#define KCAL_LISTBASE_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <Q3PtrList>
namespace KCal {
class Event;
class Todo;
/**
This class provides a template for lists of pointers. It extends QValueList<T
*> by auto delete funtionality known from QPtrList.
*/
template<class T>
-class ListBase : public QValueList<T *>
+class ListBase : public Q3ValueList<T *>
{
public:
ListBase()
- : QValueList<T *>(), mAutoDelete( false )
+ : Q3ValueList<T *>(), mAutoDelete( false )
{
}
ListBase( const ListBase &l )
- : QValueList<T *>( l ), mAutoDelete( false )
+ : Q3ValueList<T *>( l ), mAutoDelete( false )
{
}
~ListBase()
{
if ( mAutoDelete ) {
- QValueListIterator<T *> it;
- for( it = QValueList<T*>::begin(); it != QValueList<T*>::end(); ++it ) {
+ Q3ValueListIterator<T *> it;
+ for( it = Q3ValueList<T*>::begin(); it != Q3ValueList<T*>::end(); ++it ) {
delete *it;
}
}
}
ListBase &operator=( const ListBase &l )
{
if ( this == &l ) return *this;
- QValueList<T *>::operator=( l );
+ Q3ValueList<T *>::operator=( l );
return *this;
}
void setAutoDelete( bool autoDelete )
{
mAutoDelete = autoDelete;
}
bool removeRef( T *t )
{
- QValueListIterator<T *> it = find( t );
- if ( it == QValueList<T*>::end() ) {
+ Q3ValueListIterator<T *> it = find( t );
+ if ( it == Q3ValueList<T*>::end() ) {
return false;
} else {
if ( mAutoDelete ) delete t;
remove( it );
return true;
}
}
- void fill ( QPtrList<T> list ) {
- QPtrListIterator<T> it (list);
+ void fill ( Q3PtrList<T> list ) {
+ Q3PtrListIterator<T> it (list);
T *item;
while ( (item = it.current()) != 0 ) {
append( item );
++it;
}
}
private:
bool mAutoDelete;
};
}
#endif
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 900fc04..794e4b4 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -1,65 +1,66 @@
/*
This file is part of libkcal.
Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qstring.h>
#include <qapplication.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qdir.h>
#include <qlabel.h>
+#include <QDesktopWidget>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <phoneaccess.h>
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "phoneformat.h"
#include "syncdefines.h"
using namespace KCal;
class PhoneParser : public QObject
{
public:
PhoneParser( ) {
;
}
static QString dtToString( const QDateTime& dti, bool useTZ = false )
{
QString datestr;
QString timestr;
int offset = KGlobal::locale()->localTimeOffset( dti );
QDateTime dt;
if (useTZ)
dt = dti.addSecs ( -(offset*60));
else
@@ -172,204 +173,204 @@ ulong PhoneFormat::getCsumEvent( Event* event )
list.append( "0" );
list.append( QString::number( rec->frequency() ));//12
list.append( "0" );
list.append( "0" );
writeEndDate = true;
break;
case Recurrence::rWeekly:// 1
list.append( "1" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
{
int days = 0;
QBitArray weekDays = rec->days();
int i;
for( i = 1; i <= 7; ++i ) {
if ( weekDays[i-1] ) {
days += 1 << (i-1);
}
}
list.append( QString::number( days ) );
}
//pending weekdays
writeEndDate = true;
break;
case Recurrence::rMonthlyPos:// 2
list.append( "2" );
list.append( QString::number( rec->frequency()) );//12
writeEndDate = true;
{
int count = 1;
- QPtrList<Recurrence::rMonthPos> rmp;
+ Q3PtrList<Recurrence::rMonthPos> rmp;
rmp = rec->monthPositions();
if ( rmp.first()->negative )
count = 5 - rmp.first()->rPos - 1;
else
count = rmp.first()->rPos - 1;
list.append( QString::number( count ) );
}
list.append( "0" );
break;
case Recurrence::rMonthlyDay:// 3
list.append( "3" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
list.append( "0" );
writeEndDate = true;
break;
case Recurrence::rYearlyMonth://4
list.append( "4" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
list.append( "0" );
writeEndDate = true;
break;
default:
list.append( "255" );
list.append( QString() );
list.append( "0" );
list.append( QString() );
list.append( "0" );
list.append( "20991231T000000" );
break;
}
if ( writeEndDate ) {
if ( rec->endDate().isValid() ) { // 15 + 16
list.append( "1" );
- list.append( PhoneParser::dtToString( rec->endDate()) );
+ list.append( PhoneParser::dtToString( (QDateTime)rec->endDate()) );
} else {
list.append( "0" );
list.append( "20991231T000000" );
}
}
attList << list.join("");
attList << event->categoriesStr();
//qDebug("csum cat %s", event->categoriesStr().latin1());
attList << event->secrecyStr();
return PhoneFormat::getCsum(attList );
}
ulong PhoneFormat::getCsum( const QStringList & attList)
{
int max = attList.count();
ulong cSum = 0;
int j,k,i;
int add;
for ( i = 0; i < max ; ++i ) {
QString s = attList[i];
if ( ! s.isEmpty() ){
j = s.length();
for ( k = 0; k < j; ++k ) {
int mul = k +1;
add = s[k].unicode ();
if ( k < 16 )
mul = mul * mul;
int ii = i+1;
add = add * mul *ii*ii*ii;
cSum += add;
}
}
}
//QString dump = attList.join(",");
//qDebug("csum: %d %s", cSum,dump.latin1());
return cSum;
}
//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
#include <stdlib.h>
#define DEBUGMODE false
bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
{
QString fileName;
#ifdef DESKTOP_VERSION
fileName = locateLocal("tmp", "phonefile.vcs");
#else
fileName = "/tmp/phonefile.vcs";
#endif
QString command;
if ( ! PhoneAccess::readFromPhone( fileName )) {
return false;
}
VCalFormat vfload;
vfload.setLocalTime ( true );
qDebug("loading file ...");
if ( ! vfload.load( calendar, fileName ) )
return false;
- QPtrList<Event> er = calendar->rawEvents();
+ Q3PtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
qDebug("reading events... ");
while ( ev ) {
QStringList cat = ev->categories();
if ( cat.contains( "MeetingDEF" )) {
ev->setCategories( QStringList() );
} else
if ( cat.contains( "Birthday" )) {
ev->setFloats( true );
QDate da = ev->dtStart().date();
ev->setDtStart( QDateTime( da) );
ev->setDtEnd( QDateTime( da.addDays(1)) );
}
uint cSum;
cSum = PhoneFormat::getCsumEvent( ev );
int id = ev->pilotId();
Event *event;
event = existingCal->event( mProfileName ,QString::number( id ) );
if ( event ) {
event = (Event*)event->clone();
copyEvent( event, ev );
calendar->deleteEvent( ev );
calendar->addEvent( event);
}
else
event = ev;
event->setCsum( mProfileName, QString::number( cSum ));
event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
event->setID( mProfileName,QString::number( id ) );
ev = er.next();
}
{
qDebug("reading todos... ");
- QPtrList<Todo> tr = calendar->rawTodos();
+ Q3PtrList<Todo> tr = calendar->rawTodos();
Todo* ev = tr.first();
while ( ev ) {
QStringList cat = ev->categories();
if ( cat.contains( "MeetingDEF" )) {
ev->setCategories( QStringList() );
}
int id = ev->pilotId();
uint cSum;
cSum = PhoneFormat::getCsumTodo( ev );
Todo *event;
event = existingCal->todo( mProfileName ,QString::number( id ) );
if ( event ) {
//qDebug("copy todo %s ", event->summary().latin1());
event = (Todo*)event->clone();
copyTodo( event, ev );
calendar->deleteTodo( ev );
calendar->addTodo( event);
}
else
event = ev;
event->setCsum( mProfileName, QString::number( cSum ));
event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
event->setID( mProfileName,QString::number( id ) );
ev = tr.next();
}
}
return true;
}
void PhoneFormat::copyEvent( Event* to, Event* from )
{
@@ -436,180 +437,180 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from )
b->setStartOffset(Duration( a->offset() ) );
}
QStringList cat = to->categories();
QStringList catFrom = from->categories();
QString nCat;
int iii;
for ( iii = 0; iii < catFrom.count();++iii ) {
nCat = catFrom[iii];
if ( !nCat.isEmpty() )
if ( !cat.contains( nCat )) {
cat << nCat;
}
}
to->setCategories( cat );
if ( from->isCompleted() ) {
to->setCompleted( true );
if( from->completed().isValid() )
to->setCompleted( from->completed() );
} else {
// set percentcomplete only, if to->isCompleted()
if ( to->isCompleted() )
to->setPercentComplete(from->percentComplete());
}
if( to->priority() == 2 && from->priority() == 1 )
; //skip
else if (to->priority() == 4 && from->priority() == 5 )
;
else
to->setPriority(from->priority());
}
-#include <qcstring.h>
+#include <q3cstring.h>
void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
{
inc->setID( mProfileName, id );
inc->setCsum( mProfileName, csum);
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
bool PhoneFormat::writeToPhone( Calendar * calendar)
{
#ifdef DESKTOP_VERSION
QString fileName = locateLocal("tmp", "phonefile.vcs");
#else
QString fileName = "/tmp/phonefile.vcs";
#endif
VCalFormat vfsave;
vfsave.setLocalTime ( true );
QString id = calendar->timeZoneId();
calendar->setLocalTime();
if ( ! vfsave.save( calendar, fileName ) )
return false;
calendar->setTimeZoneId( id );
return PhoneAccess::writeToPhone( fileName );
}
bool PhoneFormat::save( Calendar *calendar)
{
// 1 remove events which should be deleted
- QPtrList<Event> er = calendar->rawEvents();
+ Q3PtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
while ( ev ) {
if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
calendar->deleteEvent( ev );
} else {
}
ev = er.next();
}
// 2 remove todos which should be deleted
- QPtrList<Todo> tl = calendar->rawTodos();
+ Q3PtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
while ( to ) {
if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
calendar->deleteTodo( to );
} else {
if ( to->isCompleted()) {
calendar->deleteTodo( to );
}
}
to = tl.next();
}
// 3 save file
if ( !writeToPhone( calendar ) )
return false;
QLabel status ( i18n(" Opening device ..."), 0 );
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 230;
int h = status.sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Writing to phone...") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
QString message;
status.show();
status.raise();
qApp->processEvents();
// 5 reread data
message = i18n(" Rereading all data ... ");
status.setText ( message );
qApp->processEvents();
CalendarLocal* calendarTemp = new CalendarLocal();
calendarTemp->setTimeZoneId( calendar->timeZoneId());
if ( ! load( calendarTemp,calendar) ){
qDebug("error reloading calendar ");
delete calendarTemp;
return false;
}
// 6 compare data
//algo 6 compare event
er = calendar->rawEvents();
ev = er.first();
message = i18n(" Comparing event # ");
- QPtrList<Event> er1 = calendarTemp->rawEvents();
+ Q3PtrList<Event> er1 = calendarTemp->rawEvents();
Event* ev1;
int procCount = 0;
while ( ev ) {
//qDebug("event new ID %s",ev->summary().latin1());
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
ev1 = er1.first();
while ( ev1 ) {
if ( ev->contains( ev1 ) ) {
afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName));
er1.remove( ev1 );
break;
}
ev1 = er1.next();
}
if ( ! ev1 ) {
// ev->removeID(mProfileName);
qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
}
ev = er.next();
}
//algo 6 compare todo
tl = calendar->rawTodos();
to = tl.first();
procCount = 0;
- QPtrList<Todo> tl1 = calendarTemp->rawTodos();
+ Q3PtrList<Todo> tl1 = calendarTemp->rawTodos();
Todo* to1 ;
message = i18n(" Comparing todo # ");
while ( to ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
Todo* to1 = tl1.first();
while ( to1 ) {
if ( to->contains( to1 ) ) {
afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName));
tl1.remove( to1 );
break;
}
to1 = tl1.next();
}
if ( ! to1 ) {
//to->removeID(mProfileName);
qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1());
}
to = tl.next();
}
delete calendarTemp;
return true;
}
QString PhoneFormat::toString( Calendar * )
{
return QString::null;
diff --git a/libkcal/qtopiaformat.cpp b/libkcal/qtopiaformat.cpp
index 0a4a031..2dfe1a4 100644
--- a/libkcal/qtopiaformat.cpp
+++ b/libkcal/qtopiaformat.cpp
@@ -1,60 +1,60 @@
/*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qxml.h>
#include <kdebug.h>
#include <klocale.h>
#include "calendar.h"
#include "calendarlocal.h"
#include "qtopiaformat.h"
using namespace KCal;
class QtopiaParser : public QXmlDefaultHandler
{
public:
QtopiaParser( Calendar *calendar ) : mCalendar( calendar ) {
oldCategories = 0;
}
bool startElement( const QString &, const QString &, const QString & qName,
const QXmlAttributes &attributes )
{
if ( qName == "event" ) {
Event *event = new Event;
QString uid = "Qtopia" + attributes.value( "uid" );
// event->setUid( uid );
event->setSummary( attributes.value( "description" ) );
event->setLocation( attributes.value( "location" ) );
event->setDescription( attributes.value( "note" ) );
event->setDtStart( toDateTime( attributes.value( "start" ) ) );
event->setDtEnd( toDateTime( attributes.value( "end" ) ) );
@@ -280,54 +280,54 @@ QtopiaFormat::QtopiaFormat()
mCategories = 0;
}
QtopiaFormat::~QtopiaFormat()
{
}
#include <qdom.h>
bool QtopiaFormat::load( Calendar *calendar, const QString &fileName )
{
clearException();
// qDebug("load QtopiaFormat: %s ",fileName.latin1() );
QtopiaParser handler( calendar );
handler.setCategoriesList( mCategories );
QFile xmlFile( fileName );
QXmlInputSource source( xmlFile );
QXmlSimpleReader reader;
reader.setContentHandler( &handler );
return reader.parse( source );
}
bool QtopiaFormat::save( Calendar *calendar, const QString &fileName )
{
clearException();
QString text = toString( calendar );
if ( text.isNull() ) return false;
// TODO: write backup file
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
setException(new ErrorFormat(ErrorFormat::SaveError,
i18n("Could not open file '%1'").arg(fileName)));
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << text;
file.close();
return true;
}
bool QtopiaFormat::fromString( Calendar *, const QString & )
{
return false;
}
QString QtopiaFormat::toString( Calendar * )
{
return QString::null;
}
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index 6ee5499..9a4e540 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -1,198 +1,201 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <limits.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include "incidence.h"
#include "recurrence.h"
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
using namespace KCal;
Recurrence::Feb29Type Recurrence::mFeb29YearlyDefaultType = Recurrence::rMar1;
Recurrence::Recurrence(Incidence *parent, int compatVersion)
: recurs(rNone), // by default, it's not a recurring event
rWeekStart(1), // default is Monday
rDays(7),
mFloats(parent ? parent->doesFloat() : false),
mRecurReadOnly(false),
mRecurExDatesCount(0),
mFeb29YearlyType(mFeb29YearlyDefaultType),
mCompatVersion(compatVersion ? compatVersion : INT_MAX),
mCompatRecurs(rNone),
mCompatDuration(0),
mParent(parent)
{
rMonthDays.setAutoDelete( true );
rMonthPositions.setAutoDelete( true );
rYearNums.setAutoDelete( true );
}
Recurrence::Recurrence(const Recurrence &r, Incidence *parent)
: recurs(r.recurs),
rWeekStart(r.rWeekStart),
- rDays(r.rDays.copy()),
+ rDays(r.rDays),
rFreq(r.rFreq),
rDuration(r.rDuration),
rEndDateTime(r.rEndDateTime),
mRecurStart(r.mRecurStart),
mFloats(r.mFloats),
mRecurReadOnly(r.mRecurReadOnly),
mRecurExDatesCount(r.mRecurExDatesCount),
mFeb29YearlyType(r.mFeb29YearlyType),
mCompatVersion(r.mCompatVersion),
mCompatRecurs(r.mCompatRecurs),
mCompatDuration(r.mCompatDuration),
mParent(parent)
{
- for (QPtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) {
+ for (Q3PtrListIterator<rMonthPos> mp(r.rMonthPositions); mp.current(); ++mp) {
rMonthPos *tmp = new rMonthPos;
tmp->rPos = mp.current()->rPos;
tmp->negative = mp.current()->negative;
- tmp->rDays = mp.current()->rDays.copy();
+ tmp->rDays = mp.current()->rDays;
rMonthPositions.append(tmp);
}
- for (QPtrListIterator<int> md(r.rMonthDays); md.current(); ++md) {
+ for (Q3PtrListIterator<int> md(r.rMonthDays); md.current(); ++md) {
int *tmp = new int;
*tmp = *md.current();
rMonthDays.append(tmp);
}
- for (QPtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) {
+ for (Q3PtrListIterator<int> yn(r.rYearNums); yn.current(); ++yn) {
int *tmp = new int;
*tmp = *yn.current();
rYearNums.append(tmp);
}
rMonthDays.setAutoDelete( true );
rMonthPositions.setAutoDelete( true );
rYearNums.setAutoDelete( true );
}
Recurrence::~Recurrence()
{
}
bool Recurrence::operator==( const Recurrence& r2 ) const
{
// the following line is obvious
if ( recurs == rNone && r2.recurs == rNone )
return true;
// we need the above line, because two non recurring events may
// differ in the other settings, because one (or both)
// may be not initialized properly
if ( recurs != r2.recurs
|| rFreq != r2.rFreq
|| rDuration != r2.rDuration
|| !rDuration && rEndDateTime != r2.rEndDateTime
|| mRecurStart != r2.mRecurStart
|| mFloats != r2.mFloats
|| mRecurReadOnly != r2.mRecurReadOnly
|| mRecurExDatesCount != r2.mRecurExDatesCount )
return false;
// no need to compare mCompat* and mParent
// OK to compare the pointers
switch ( recurs )
{
case rWeekly:
return rDays == r2.rDays
&& rWeekStart == r2.rWeekStart;
case rMonthlyPos: {
- QPtrList<rMonthPos> MonthPositions = rMonthPositions;
- QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions = rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
if ( !MonthPositions.count() )
return false;
if ( !MonthPositions2.count() )
return false;
return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
}
case rMonthlyDay: {
- QPtrList<int> MonthDays = rMonthDays ;
- QPtrList<int> MonthDays2 = r2.rMonthDays ;
+ Q3PtrList<int> MonthDays = rMonthDays ;
+ Q3PtrList<int> MonthDays2 = r2.rMonthDays ;
if ( !MonthDays.count() )
return false;
if ( !MonthDays2.count() )
return false;
return *MonthDays.first() == *MonthDays2.first() ;
}
case rYearlyPos: {
- QPtrList<int> YearNums = rYearNums;
- QPtrList<int> YearNums2 = r2.rYearNums;
+ Q3PtrList<int> YearNums = rYearNums;
+ Q3PtrList<int> YearNums2 = r2.rYearNums;
if ( *YearNums.first() != *YearNums2.first() )
return false;
- QPtrList<rMonthPos> MonthPositions = rMonthPositions;
- QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions = rMonthPositions;
+ Q3PtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions;
if ( !MonthPositions.count() )
return false;
if ( !MonthPositions2.count() )
return false;
return MonthPositions.first()->rPos == MonthPositions2.first()->rPos;
}
case rYearlyMonth: {
- QPtrList<int> YearNums = rYearNums;
- QPtrList<int> YearNums2 = r2.rYearNums;
+ Q3PtrList<int> YearNums = rYearNums;
+ Q3PtrList<int> YearNums2 = r2.rYearNums;
return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType);
}
case rYearlyDay: {
- QPtrList<int> YearNums = rYearNums;
- QPtrList<int> YearNums2 = r2.rYearNums;
+ Q3PtrList<int> YearNums = rYearNums;
+ Q3PtrList<int> YearNums2 = r2.rYearNums;
return ( *YearNums.first() == *YearNums2.first() );
}
case rNone:
case rMinutely:
case rHourly:
case rDaily:
default:
return true;
}
}
/*
bool Recurrence::compareLists( const QPtrList<int> &l1 ,const QPtrList<int> &l2)
{
if ( l1.count() != l2.count() )
return false;
int count = l1.count();
int i;
for ( i = 0; i < count ; ++i ) {
// if ( l1.at(i) != l2.at(i) )
return false;
qDebug("compüare ");
}
return true;
}
*/
QString Recurrence::recurrenceText() const
{
QString recurText;
if ( recurs == Recurrence::rMinutely )
recurText = i18n("minutely");
else if ( recurs == Recurrence::rHourly )
recurText = i18n("hourly");
@@ -328,65 +331,65 @@ QDate Recurrence::endDate() const
count = yearlyPosCalc(END_DATE_AND_COUNT, end);
break;
default:
// catch-all. Should never get here.
kdDebug(5800) << "Control should never reach here in endDate()!" << endl;
break;
}
}
if (!count)
return QDate(); // error - there is no recurrence
return end;
}
QDateTime Recurrence::endDateTime() const
{
int count = 0;
QDate end;
if (recurs != rNone) {
if (rDuration < 0)
return QDateTime(); // infinite recurrence
if (rDuration == 0)
return rEndDateTime;
// The end date is determined by the recurrence count
QDate dStart = mRecurStart.date();
switch (recurs)
{
case rMinutely:
return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*60);
case rHourly:
return mRecurStart.addSecs((rDuration-1+mRecurExDatesCount)*rFreq*3600);
case rDaily:
- return dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
+ return (QDateTime)dStart.addDays((rDuration-1+mRecurExDatesCount)*rFreq);
case rWeekly:
count = weeklyCalc(END_DATE_AND_COUNT, end);
break;
case rMonthlyPos:
case rMonthlyDay:
count = monthlyCalc(END_DATE_AND_COUNT, end);
break;
case rYearlyMonth:
count = yearlyMonthCalc(END_DATE_AND_COUNT, end);
break;
case rYearlyDay:
count = yearlyDayCalc(END_DATE_AND_COUNT, end);
break;
case rYearlyPos:
count = yearlyPosCalc(END_DATE_AND_COUNT, end);
break;
default:
// catch-all. Should never get here.
kdDebug(5800) << "Control should never reach here in endDate()!" << endl;
break;
}
}
if (!count)
return QDateTime(); // error - there is no recurrence
return QDateTime(end, mRecurStart.time());
}
int Recurrence::durationTo(const QDate &date) const
{
QDate d = date;
return recurCalc(COUNT_TO_DATE, d);
@@ -477,75 +480,75 @@ void Recurrence::setFloats(bool f)
int Recurrence::frequency() const
{
return rFreq;
}
int Recurrence::duration() const
{
return rDuration;
}
void Recurrence::setDuration(int _rDuration)
{
if (mRecurReadOnly) return;
if (_rDuration > 0) {
rDuration = _rDuration;
// Compatibility mode is only needed when reading the calendar in ICalFormatImpl,
// so explicitly setting the duration means no backwards compatibility is needed.
mCompatDuration = 0;
}
}
QString Recurrence::endDateStr(bool shortfmt) const
{
return KGlobal::locale()->formatDate(rEndDateTime.date(),shortfmt);
}
const QBitArray &Recurrence::days() const
{
return rDays;
}
-const QPtrList<Recurrence::rMonthPos> &Recurrence::monthPositions() const
+const Q3PtrList<Recurrence::rMonthPos> &Recurrence::monthPositions() const
{
return rMonthPositions;
}
-const QPtrList<Recurrence::rMonthPos> &Recurrence::yearMonthPositions() const
+const Q3PtrList<Recurrence::rMonthPos> &Recurrence::yearMonthPositions() const
{
return rMonthPositions;
}
-const QPtrList<int> &Recurrence::monthDays() const
+const Q3PtrList<int> &Recurrence::monthDays() const
{
return rMonthDays;
}
void Recurrence::setMinutely(int _rFreq, int _rDuration)
{
if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
return;
setDailySub(rMinutely, _rFreq, _rDuration);
}
void Recurrence::setMinutely(int _rFreq, const QDateTime &_rEndDateTime)
{
if (mRecurReadOnly) return;
rEndDateTime = _rEndDateTime;
setDailySub(rMinutely, _rFreq, 0);
}
void Recurrence::setHourly(int _rFreq, int _rDuration)
{
if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
return;
setDailySub(rHourly, _rFreq, _rDuration);
}
void Recurrence::setHourly(int _rFreq, const QDateTime &_rEndDateTime)
{
if (mRecurReadOnly) return;
rEndDateTime = _rEndDateTime;
setDailySub(rHourly, _rFreq, 0);
}
@@ -730,65 +733,65 @@ void Recurrence::setYearly(int type, int _rFreq, const QDate &_rEndDate)
{
if (mRecurReadOnly) return;
rEndDateTime.setDate(_rEndDate);
rEndDateTime.setTime(mRecurStart.time());
mCompatDuration = 0;
setYearly_(type, mFeb29YearlyDefaultType, _rFreq, 0);
}
void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, int _rDuration)
{
if (mRecurReadOnly || _rDuration == 0 || _rDuration < -1)
return;
if (mCompatVersion < 310)
mCompatDuration = (_rDuration > 0) ? _rDuration : 0;
setYearly_(rYearlyMonth, type, _rFreq, _rDuration);
}
void Recurrence::setYearlyByDate(Feb29Type type, int _rFreq, const QDate &_rEndDate)
{
if (mRecurReadOnly) return;
rEndDateTime.setDate(_rEndDate);
rEndDateTime.setTime(mRecurStart.time());
mCompatDuration = 0;
setYearly_(rYearlyMonth, type, _rFreq, 0);
}
void Recurrence::addYearlyMonthPos(short _rPos, const QBitArray &_rDays)
{
if (recurs == rYearlyPos)
addMonthlyPos_(_rPos, _rDays);
}
-const QPtrList<int> &Recurrence::yearNums() const
+const Q3PtrList<int> &Recurrence::yearNums() const
{
return rYearNums;
}
void Recurrence::addYearlyMonth(short _rPos )
{
if (mRecurReadOnly || recurs != rYearlyMonth) // invalid day/month number
return;
rMonthPos *tmpPos = new rMonthPos;
if ( _rPos > 0) {
tmpPos->rPos = _rPos;
tmpPos->negative = false;
} else {
tmpPos->rPos = -_rPos; // take abs()
tmpPos->negative = true;
}
rMonthPositions.append(tmpPos);
}
void Recurrence::addYearlyNum(short _rNum)
{
if (mRecurReadOnly
|| (recurs != rYearlyMonth && recurs != rYearlyDay && recurs != rYearlyPos)
|| _rNum <= 0) // invalid day/month number
return;
if (mCompatVersion < 310 && mCompatRecurs == rYearlyDay) {
// Backwards compatibility for KDE < 3.1.
// Dates were stored as day numbers, with a fiddle to take account of leap years.
// Convert the day number to a month.
if (_rNum <= 0 || _rNum > 366 || (_rNum == 366 && mRecurStart.date().daysInYear() < 366))
return; // invalid day number
_rNum = QDate(mRecurStart.date().year(), 1, 1).addDays(_rNum - 1).month();
} else
@@ -1018,175 +1021,175 @@ bool Recurrence::recursWeekly(const QDate &qd) const
if ((dStart.daysTo(qd)/7) % rFreq == 0) {
// The date is in a week which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
// check if the bits set match today.
int i = qd.dayOfWeek()-1;
if (rDays.testBit((uint) i))
return true;
}
}
return false;
}
bool Recurrence::recursMonthly(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
int year = qd.year();
int month = qd.month();
int day = qd.day();
// calculate how many months ahead this date is from the original
// event's date
int monthsAhead = (year - dStart.year()) * 12 + (month - dStart.month());
if ((monthsAhead % rFreq) == 0) {
// The date is in a month which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
- QValueList<int> days;
+ Q3ValueList<int> days;
int daysInMonth = qd.daysInMonth();
if (recurs == rMonthlyDay)
getMonthlyDayDays(days, daysInMonth);
else if (recurs == rMonthlyPos)
getMonthlyPosDays(days, daysInMonth, QDate(year, month, 1).dayOfWeek());
- for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
+ for (Q3ValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
if (*it == day)
return true;
}
// no dates matched
}
}
return false;
}
bool Recurrence::recursYearlyByMonth(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
int startDay = dStart.day();
int qday = qd.day();
int qmonth = qd.month();
int qyear = qd.year();
bool match = (qday == startDay);
if (!match && startDay == 29 && dStart.month() == 2) {
// It's a recurrence on February 29th
switch (mFeb29YearlyType) {
case rFeb28:
if (qday == 28 && qmonth == 2 && !QDate::leapYear(qyear))
match = true;
break;
case rMar1:
if (qday == 1 && qmonth == 3 && !QDate::leapYear(qyear)) {
qmonth = 2;
match = true;
}
break;
case rFeb29:
break;
}
}
if (match) {
// The day of the month matches. Calculate how many years ahead
// this date is from the original event's date.
int yearsAhead = (qyear - dStart.year());
if (yearsAhead % rFreq == 0) {
// The date is in a year which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
int i = qmonth;
- for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
+ for (Q3PtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
if (i == *qlin.current())
return true;
}
}
}
}
return false;
}
bool Recurrence::recursYearlyByPos(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
int year = qd.year();
int month = qd.month();
int day = qd.day();
// calculate how many years ahead this date is from the original
// event's date
int yearsAhead = (year - dStart.year());
if (yearsAhead % rFreq == 0) {
// The date is in a year which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
- for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
+ for (Q3PtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
if (month == *qlin.current()) {
// The month recurs
- QValueList<int> days;
+ Q3ValueList<int> days;
getMonthlyPosDays(days, qd.daysInMonth(), QDate(year, month, 1).dayOfWeek());
- for (QValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
+ for (Q3ValueList<int>::Iterator it = days.begin(); it != days.end(); ++it) {
if (*it == day)
return true;
}
}
}
}
}
return false;
}
bool Recurrence::recursYearlyByDay(const QDate &qd) const
{
QDate dStart = mRecurStart.date();
// calculate how many years ahead this date is from the original
// event's date
int yearsAhead = (qd.year() - dStart.year());
if (yearsAhead % rFreq == 0) {
// The date is in a year which recurs
if (qd >= dStart
&& ((rDuration > 0 && qd <= endDate()) ||
(rDuration == 0 && qd <= rEndDateTime.date()) ||
rDuration == -1)) {
// The date queried falls within the range of the event.
int i = qd.dayOfYear();
- for (QPtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
+ for (Q3PtrListIterator<int> qlin(rYearNums); qlin.current(); ++qlin) {
if (i == *qlin.current())
return true;
}
}
}
return false;
}
/* Get the date of the next recurrence, after the specified date.
* If 'last' is non-null, '*last' is set to true if the next recurrence is the
* last recurrence, else false.
* Reply = date of next recurrence, or invalid date if none.
*/
QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
{
if (last)
*last = false;
QDate dStart = mRecurStart.date();
if (preDate < dStart)
return dStart;
QDate earliestDate = preDate.addDays(1);
QDate nextDate;
switch (recurs) {
case rDaily:
nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq);
break;
case rWeekly: {
QDate start = dStart.addDays(-((dStart.dayOfWeek() - rWeekStart + 7)%7)); // start of week for dStart
int earliestDayOfWeek = earliestDate.dayOfWeek();
@@ -1520,65 +1523,65 @@ int Recurrence::recurCalc(PeriodFunc func, QDate &enddate) const
break;
case rHourly:
timed = true;
count = secondlyCalc(func, endtime, rFreq*3600);
break;
case rDaily:
count = dailyCalc(func, enddate);
break;
case rWeekly:
count = weeklyCalc(func, enddate);
break;
case rMonthlyPos:
case rMonthlyDay:
count = monthlyCalc(func, enddate);
break;
case rYearlyMonth:
count = yearlyMonthCalc(func, enddate);
break;
case rYearlyPos:
count = yearlyPosCalc(func, enddate);
break;
case rYearlyDay:
count = yearlyDayCalc(func, enddate);
break;
default:
break;
}
switch (func) {
case END_DATE_AND_COUNT:
case NEXT_AFTER_DATE:
if (count == 0)
- endtime = QDate();
+ endtime = QDateTime();
else if (timed)
enddate = endtime.date();
break;
case COUNT_TO_DATE:
break;
}
return count;
}
/* Find count and, depending on 'func', the end date/time of a secondly recurrence.
* Reply = total number of occurrences up to 'endtime', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'endtime' is updated to the
* recurrence end date/time.
*/
int Recurrence::secondlyCalc(PeriodFunc func, QDateTime &endtime, int freq) const
{
switch (func) {
case END_DATE_AND_COUNT:
endtime = mRecurStart.addSecs((rDuration + mRecurExDatesCount - 1) * freq);
return rDuration + mRecurExDatesCount;
case COUNT_TO_DATE: {
int n = mRecurStart.secsTo(endtime)/freq + 1;
if (rDuration > 0 && n > rDuration + mRecurExDatesCount)
return rDuration + mRecurExDatesCount;
return n;
}
case NEXT_AFTER_DATE: {
int count = mRecurStart.secsTo(endtime) / freq + 2;
if (rDuration > 0 && count > rDuration)
return 0;
endtime = mRecurStart.addSecs((count - 1)*freq);
return count;
@@ -1764,242 +1767,242 @@ int Recurrence::weeklyCalcNextAfter(QDate &enddate, int daysPerWeek) const
// Check the last week or two in the recurrence
for ( ; ; ) {
for (int i = rWeekStart - 1; ; i = (i + 1) % 7) {
++daysGone;
if (rDays.testBit((uint)i)) {
++countGone;
if (daysGone > totalDays)
goto ex;
if (--countTogo == 0)
return 0;
}
}
daysGone += 7 * (rFreq - 1);
}
ex:
enddate = dStart.addDays(daysGone);
return countGone;
}
/* Find count and, depending on 'func', the end date of a monthly recurrence.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
*/
struct Recurrence::MonthlyData {
const Recurrence *recurrence;
int year; // current year
int month; // current month 0..11
int day; // current day of month 1..31
bool varies; // true if recurring days vary between different months
private:
- QValueList<int> days28, days29, days30, days31; // recurring days in months of each length
- QValueList<int> *recurDays[4];
+ Q3ValueList<int> days28, days29, days30, days31; // recurring days in months of each length
+ Q3ValueList<int> *recurDays[4];
public:
MonthlyData(const Recurrence* r, const QDate &date)
: recurrence(r), year(date.year()), month(date.month()-1), day(date.day())
{ recurDays[0] = &days28;
recurDays[1] = &days29;
recurDays[2] = &days30;
recurDays[3] = &days31;
varies = (recurrence->recurs == rMonthlyPos)
? true : recurrence->getMonthlyDayDays(days31, 31);
}
- const QValueList<int>* dayList() const {
+ const Q3ValueList<int>* dayList() const {
if (!varies)
return &days31;
QDate startOfMonth(year, month + 1, 1);
int daysInMonth = startOfMonth.daysInMonth();
- QValueList<int>* days = recurDays[daysInMonth - 28];
+ Q3ValueList<int>* days = recurDays[daysInMonth - 28];
if (recurrence->recurs == rMonthlyPos)
recurrence->getMonthlyPosDays(*days, daysInMonth, startOfMonth.dayOfWeek());
else if (days->isEmpty())
recurrence->getMonthlyDayDays(*days, daysInMonth);
return days;
}
int yearMonth() const { return year*12 + month; }
void addMonths(int diff) { month += diff; year += month / 12; month %= 12; }
QDate date() const { return QDate(year, month + 1, day); }
};
int Recurrence::monthlyCalc(PeriodFunc func, QDate &enddate) const
{
if (recurs == rMonthlyPos && rMonthPositions.isEmpty()
|| recurs == rMonthlyDay && rMonthDays.isEmpty())
return 0;
MonthlyData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return monthlyCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return monthlyCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return monthlyCalcNextAfter(enddate, data);
}
return 0;
}
int Recurrence::monthlyCalcEndDate(QDate &enddate, MonthlyData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* days = data.dayList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* days = data.dayList();
if (data.day > 1) {
// Check what remains of the start month
for (it = days->begin(); it != days->end(); ++it) {
if (*it >= data.day) {
++countGone;
if (--countTogo == 0) {
data.day = *it;
break;
}
}
}
if (countTogo) {
data.day = 1;
data.addMonths(rFreq);
}
}
if (countTogo) {
if (data.varies) {
// The number of recurrence days varies from month to month,
// so we need to check month by month.
for ( ; ; ) {
days = data.dayList();
uint n = days->count(); // number of recurrence days in this month
if (n >= countTogo)
break;
countTogo -= n;
countGone += n;
data.addMonths(rFreq);
}
} else {
// The number of recurrences is the same every month,
// so skip the month-by-month check.
// Skip the remaining whole months, but leave at least
// 1 recurrence remaining, in order to get its date.
int daysPerMonth = days->count();
int wholeMonths = (countTogo - 1) / daysPerMonth;
data.addMonths(wholeMonths * rFreq);
countGone += wholeMonths * daysPerMonth;
countTogo -= wholeMonths * daysPerMonth;
}
if (countTogo) {
// Check the last month in the recurrence
for (it = days->begin(); it != days->end(); ++it) {
++countGone;
if (--countTogo == 0) {
data.day = *it;
break;
}
}
}
}
enddate = data.date();
return countGone;
}
int Recurrence::monthlyCalcToDate(const QDate &enddate, MonthlyData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endMonth = enddate.month() - 1; // zero-based
int endDay = enddate.day();
int endYearMonth = endYear*12 + endMonth;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* days = data.dayList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* days = data.dayList();
if (data.day > 1) {
// Check what remains of the start month
for (it = days->begin(); it != days->end(); ++it) {
if (*it >= data.day) {
if (data.yearMonth() == endYearMonth && *it > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
data.day = 1;
data.addMonths(rFreq);
}
if (data.varies) {
// The number of recurrence days varies from month to month,
// so we need to check month by month.
while (data.yearMonth() < endYearMonth) {
countGone += data.dayList()->count();
if (countGone >= countMax)
return countMax;
data.addMonths(rFreq);
}
days = data.dayList();
} else {
// The number of recurrences is the same every month,
// so skip the month-by-month check.
// Skip the remaining whole months.
int daysPerMonth = days->count();
int wholeMonths = endYearMonth - data.yearMonth();
countGone += (wholeMonths / rFreq) * daysPerMonth;
if (countGone >= countMax)
return countMax;
if (wholeMonths % rFreq)
return countGone; // end year isn't a recurrence year
data.year = endYear;
data.month = endMonth;
}
// Check the last month in the recurrence
for (it = days->begin(); it != days->end(); ++it) {
if (*it > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
return countGone;
}
int Recurrence::monthlyCalcNextAfter(QDate &enddate, MonthlyData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endDay = enddate.day();
int endYearMonth = endYear*12 + enddate.month() - 1;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* days = data.dayList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* days = data.dayList();
if (data.day > 1) {
// Check what remains of the start month
for (it = days->begin(); it != days->end(); ++it) {
if (*it >= data.day) {
++countGone;
if (data.yearMonth() == endYearMonth && *it > endDay) {
data.day = *it;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
data.day = 1;
data.addMonths(rFreq);
}
if (data.varies) {
// The number of recurrence days varies from month to month,
// so we need to check month by month.
while (data.yearMonth() <= endYearMonth) {
days = data.dayList();
uint n = days->count(); // number of recurrence days in this month
if (data.yearMonth() == endYearMonth && days->last() > endDay)
break;
if (n >= countTogo)
return 0;
countGone += n;
countTogo -= n;
data.addMonths(rFreq);
}
@@ -2023,102 +2026,102 @@ int Recurrence::monthlyCalcNextAfter(QDate &enddate, MonthlyData &data) const
}
}
// Check the last month in the recurrence
for (it = days->begin(); it != days->end(); ++it) {
++countGone;
if (data.yearMonth() > endYearMonth || *it > endDay) {
data.day = *it;
break;
}
if (--countTogo == 0)
return 0;
}
ex:
enddate = data.date();
return countGone;
}
/* Find count and, depending on 'func', the end date of an annual recurrence by date.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
*/
struct Recurrence::YearlyMonthData {
const Recurrence *recurrence;
int year; // current year
int month; // current month 1..12
int day; // current day of month 1..31
bool leapyear; // true if February 29th recurs and current year is a leap year
bool feb29; // true if February 29th recurs
private:
- QValueList<int> months; // recurring months in non-leap years 1..12
- QValueList<int> leapMonths; // recurring months in leap years 1..12
+ Q3ValueList<int> months; // recurring months in non-leap years 1..12
+ Q3ValueList<int> leapMonths; // recurring months in leap years 1..12
public:
YearlyMonthData(const Recurrence* r, const QDate &date)
: recurrence(r), year(date.year()), month(date.month()), day(date.day())
{ feb29 = recurrence->getYearlyMonthMonths(day, months, leapMonths);
leapyear = feb29 && QDate::leapYear(year);
}
- const QValueList<int>* monthList() const
+ const Q3ValueList<int>* monthList() const
{ return leapyear ? &leapMonths : &months; }
- const QValueList<int>* leapMonthList() const { return &leapMonths; }
+ const Q3ValueList<int>* leapMonthList() const { return &leapMonths; }
QDate date() const { return QDate(year, month, day); }
};
int Recurrence::yearlyMonthCalc(PeriodFunc func, QDate &enddate) const
{
if (rYearNums.isEmpty())
return 0;
YearlyMonthData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return yearlyMonthCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return yearlyMonthCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return yearlyMonthCalcNextAfter(enddate, data);
}
return 0;
}
// Find total count and end date of an annual recurrence by date.
// Reply = total number of occurrences.
int Recurrence::yearlyMonthCalcEndDate(QDate &enddate, YearlyMonthData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
- QValueList<int>::ConstIterator it;
- const QValueList<int>* mons = data.monthList(); // get recurring months for this year
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* mons = data.monthList(); // get recurring months for this year
if (data.month > 1) {
// Check what remains of the start year
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it >= data.month) {
++countGone;
if (--countTogo == 0) {
data.month = *it;
if (data.month == 2 && data.feb29 && !data.leapyear) {
// The recurrence should end on February 29th, but it's a non-leap year
switch (mFeb29YearlyType) {
case rFeb28:
data.day = 28;
break;
case rMar1:
data.month = 3;
data.day = 1;
break;
case rFeb29:
break;
}
}
break;
}
}
}
if (countTogo) {
data.month = 1;
data.year += rFreq;
}
}
if (countTogo) {
@@ -2170,66 +2173,66 @@ int Recurrence::yearlyMonthCalcEndDate(QDate &enddate, YearlyMonthData &data) co
}
}
}
enddate = data.date();
return countGone;
}
// Find count of an annual recurrence by date.
// Reply = total number of occurrences up to 'enddate'.
int Recurrence::yearlyMonthCalcToDate(const QDate &enddate, YearlyMonthData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
if (endDay < data.day) {
/* The end day of the month is earlier than the recurrence day of the month.
* If Feb 29th recurs and:
* 1) it recurs on Feb 28th in non-leap years, don't adjust the end month
* if enddate is Feb 28th on a non-leap year.
* 2) it recurs on Mar 1st in non-leap years, allow the end month to be
* adjusted to February, to simplify calculations.
*/
if (data.feb29 && !QDate::leapYear(endYear)
&& mFeb29YearlyType == rFeb28 && endDay == 28 && endMonth == 2) {
}
else if (--endMonth == 0) {
endMonth = 12;
--endYear;
}
}
- QValueList<int>::ConstIterator it;
- const QValueList<int>* mons = data.monthList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* mons = data.monthList();
if (data.month > 1) {
// Check what remains of the start year
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it >= data.month) {
if (data.year == endYear && *it > endMonth)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
data.month = 1;
data.year += rFreq;
}
if (data.feb29 && mFeb29YearlyType == rFeb29) {
// The number of recurrences is different on leap years,
// so check year-by-year.
while (data.year < endYear) {
countGone += data.monthList()->count();
if (countGone >= countMax)
return countMax;
data.year += rFreq;
}
mons = data.monthList();
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years.
int monthsPerYear = mons->count();
int wholeYears = endYear - data.year;
countGone += (wholeYears / rFreq) * monthsPerYear;
if (countGone >= countMax)
@@ -2241,66 +2244,66 @@ int Recurrence::yearlyMonthCalcToDate(const QDate &enddate, YearlyMonthData &dat
// Check the last year in the recurrence
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it > endMonth)
return countGone;
if (++countGone >= countMax)
return countMax;
}
return countGone;
}
// Find count and date of first recurrence after 'enddate' of an annual recurrence by date.
// Reply = total number of occurrences up to 'enddate'.
int Recurrence::yearlyMonthCalcNextAfter(QDate &enddate, YearlyMonthData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
bool mar1TooEarly = false;
bool feb28ok = false;
if (endDay < data.day) {
if (data.feb29 && mFeb29YearlyType == rMar1 && endMonth == 3)
mar1TooEarly = true;
if (data.feb29 && mFeb29YearlyType == rFeb28 && endMonth == 2 && endDay == 28)
feb28ok = true;
else if (--endMonth == 0) {
endMonth = 12;
--endYear;
}
}
- QValueList<int>::ConstIterator it;
- const QValueList<int>* mons = data.monthList();
+ Q3ValueList<int>::ConstIterator it;
+ const Q3ValueList<int>* mons = data.monthList();
if (data.month > 1) {
// Check what remains of the start year
for (it = mons->begin(); it != mons->end(); ++it) {
if (*it >= data.month) {
++countGone;
if (data.year == endYear
&& ( *it > endMonth && (*it > 3 || !mar1TooEarly)
|| *it == 2 && feb28ok && data.leapyear)) {
if (*it == 2 && data.feb29 && !data.leapyear) {
// The next recurrence should be on February 29th, but it's a non-leap year
switch (mFeb29YearlyType) {
case rFeb28:
data.month = 2;
data.day = 28;
break;
case rMar1:
data.month = 3;
data.day = 1;
break;
case rFeb29: // impossible in this context!
break;
}
}
else
data.month = *it;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
@@ -2361,409 +2364,409 @@ int Recurrence::yearlyMonthCalcNextAfter(QDate &enddate, YearlyMonthData &data)
break;
case rFeb29: // impossible in this context!
break;
}
}
else
data.month = *it;
break;
}
if (--countTogo == 0)
return 0;
}
ex:
enddate = data.date();
return countGone;
}
/* Find count and, depending on 'func', the end date of an annual recurrence by date.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
*/
struct Recurrence::YearlyPosData {
const Recurrence *recurrence;
int year; // current year
int month; // current month 1..12
int day; // current day of month 1..31
int daysPerMonth; // number of days which recur each month, or -1 if variable
int count; // number of days which recur each year, or -1 if variable
bool varies; // true if number of days varies from year to year
private:
- mutable QValueList<int> days;
+ mutable Q3ValueList<int> days;
public:
YearlyPosData(const Recurrence* r, const QDate &date)
: recurrence(r), year(date.year()), month(date.month()), day(date.day()), count(-1)
{ if ((daysPerMonth = r->countMonthlyPosDays()) > 0)
count = daysPerMonth * r->rYearNums.count();
varies = (daysPerMonth < 0);
}
- const QValueList<int>* dayList() const {
+ const Q3ValueList<int>* dayList() const {
QDate startOfMonth(year, month, 1);
recurrence->getMonthlyPosDays(days, startOfMonth.daysInMonth(), startOfMonth.dayOfWeek());
return &days;
}
int yearMonth() const { return year*12 + month - 1; }
void addMonths(int diff) { month += diff - 1; year += month / 12; month = month % 12 + 1; }
QDate date() const { return QDate(year, month, day); }
};
int Recurrence::yearlyPosCalc(PeriodFunc func, QDate &enddate) const
{
if (rYearNums.isEmpty() || rMonthPositions.isEmpty())
return 0;
YearlyPosData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return yearlyPosCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return yearlyPosCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return yearlyPosCalcNextAfter(enddate, data);
}
return 0;
}
int Recurrence::yearlyPosCalcEndDate(QDate &enddate, YearlyPosData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
- QValueList<int>::ConstIterator id;
- const QValueList<int>* days;
+ Q3ValueList<int>::ConstIterator id;
+ const Q3ValueList<int>* days;
if (data.month > 1 || data.day > 1) {
// Check what remains of the start year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
// Check what remains of the start month
if (data.day > 1 || data.varies
|| static_cast<uint>(data.daysPerMonth) >= countTogo) {
data.month = *im.current();
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
++countGone;
if (--countTogo == 0) {
data.month = *im.current();
data.day = *id;
goto ex;
}
}
}
data.day = 1;
} else {
// The number of days per month is constant, so skip
// the whole month.
countTogo -= data.daysPerMonth;
countGone += data.daysPerMonth;
}
}
}
data.month = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences varies from year to year.
for ( ; ; ) {
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
days = data.dayList();
int n = days->count();
if (static_cast<uint>(n) >= countTogo) {
// Check the last month in the recurrence
for (id = days->begin(); id != days->end(); ++id) {
++countGone;
if (--countTogo == 0) {
data.day = *id;
goto ex;
}
}
}
countTogo -= n;
countGone += n;
}
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years, but leave at least
// 1 recurrence remaining, in order to get its date.
int wholeYears = (countTogo - 1) / data.count;
data.year += wholeYears * rFreq;
countGone += wholeYears * data.count;
countTogo -= wholeYears * data.count;
// Check the last year in the recurrence.
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (static_cast<uint>(data.daysPerMonth) >= countTogo) {
// Check the last month in the recurrence
data.month = *im.current();
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
++countGone;
if (--countTogo == 0) {
data.day = *id;
goto ex;
}
}
}
countTogo -= data.daysPerMonth;
countGone += data.daysPerMonth;
}
data.year += rFreq;
}
ex:
enddate = data.date();
return countGone;
}
int Recurrence::yearlyPosCalcToDate(const QDate &enddate, YearlyPosData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
if (endDay < data.day && --endMonth == 0) {
endMonth = 12;
--endYear;
}
int endYearMonth = endYear*12 + endMonth;
- QValueList<int>::ConstIterator id;
- const QValueList<int>* days;
+ Q3ValueList<int>::ConstIterator id;
+ const Q3ValueList<int>* days;
if (data.month > 1 || data.day > 1) {
// Check what remains of the start year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
data.month = *im.current();
if (data.yearMonth() > endYearMonth)
return countGone;
// Check what remains of the start month
bool lastMonth = (data.yearMonth() == endYearMonth);
if (lastMonth || data.day > 1 || data.varies) {
days = data.dayList();
if (lastMonth || data.day > 1) {
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
if (lastMonth && *id > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
} else {
countGone += days->count();
if (countGone >= countMax)
return countMax;
}
data.day = 1;
} else {
// The number of days per month is constant, so skip
// the whole month.
countGone += data.daysPerMonth;
if (countGone >= countMax)
return countMax;
}
}
}
data.month = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences varies from year to year.
for ( ; ; ) {
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
days = data.dayList();
if (data.yearMonth() >= endYearMonth) {
if (data.yearMonth() > endYearMonth)
return countGone;
// Check the last month in the recurrence
for (id = days->begin(); id != days->end(); ++id) {
if (*id > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
} else {
countGone += days->count();
if (countGone >= countMax)
return countMax;
}
}
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years, but leave at least
// 1 recurrence remaining, in order to get its date.
int wholeYears = endYear - data.year;
countGone += (wholeYears / rFreq) * data.count;
if (countGone >= countMax)
return countMax;
if (wholeYears % rFreq)
return countGone; // end year isn't a recurrence year
data.year = endYear;
// Check the last year in the recurrence.
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
if (data.month >= endMonth) {
if (data.month > endMonth)
return countGone;
// Check the last month in the recurrence
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
if (*id > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
} else {
countGone += data.daysPerMonth;
if (countGone >= countMax)
return countMax;
}
}
}
return countGone;
}
int Recurrence::yearlyPosCalcNextAfter(QDate &enddate, YearlyPosData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endMonth = enddate.month();
int endDay = enddate.day();
if (endDay < data.day && --endMonth == 0) {
endMonth = 12;
--endYear;
}
int endYearMonth = endYear*12 + endMonth;
- QValueList<int>::ConstIterator id;
- const QValueList<int>* days;
+ Q3ValueList<int>::ConstIterator id;
+ const Q3ValueList<int>* days;
if (data.varies) {
// The number of recurrences varies from year to year.
for ( ; ; ) {
// Check the next year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
// Check the next month
data.month = *im.current();
int ended = data.yearMonth() - endYearMonth;
days = data.dayList();
if (ended >= 0 || data.day > 1) {
// This is the start or end month, so check each day
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
++countGone;
if (ended > 0 || (ended == 0 && *id > endDay)) {
data.day = *id;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
} else {
// Skip the whole month
uint n = days->count();
if (n >= countTogo)
return 0;
countGone += n;
}
data.day = 1; // we've checked the start month now
}
}
data.month = 1; // we've checked the start year now
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year.
if (data.month > 1 || data.day > 1) {
// Check what remains of the start year
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
if (*im.current() >= data.month) {
// Check what remains of the start month
data.month = *im.current();
int ended = data.yearMonth() - endYearMonth;
if (ended >= 0 || data.day > 1) {
// This is the start or end month, so check each day
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
if (*id >= data.day) {
++countGone;
if (ended > 0 || (ended == 0 && *id > endDay)) {
data.day = *id;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
data.day = 1; // we've checked the start month now
} else {
// Skip the whole month.
if (static_cast<uint>(data.daysPerMonth) >= countTogo)
return 0;
countGone += data.daysPerMonth;
}
}
}
data.year += rFreq;
}
// Skip the remaining whole years to at least endYear.
int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
if ((endYear - data.year)%rFreq == 0
&& *rYearNums.getLast() <= endMonth)
++recurYears; // required year is after endYear
if (recurYears) {
int n = recurYears * data.count;
if (static_cast<uint>(n) > countTogo)
return 0; // reached end of recurrence
countTogo -= n;
countGone += n;
data.year += recurYears * rFreq;
}
// Check the last year in the recurrence
- for (QPtrListIterator<int> im(rYearNums); im.current(); ++im) {
+ for (Q3PtrListIterator<int> im(rYearNums); im.current(); ++im) {
data.month = *im.current();
int ended = data.yearMonth() - endYearMonth;
if (ended >= 0) {
// This is the end month, so check each day
days = data.dayList();
for (id = days->begin(); id != days->end(); ++id) {
++countGone;
if (ended > 0 || (ended == 0 && *id > endDay)) {
data.day = *id;
goto ex;
}
if (--countTogo == 0)
return 0;
}
} else {
// Skip the whole month.
if (static_cast<uint>(data.daysPerMonth) >= countTogo)
return 0;
countGone += data.daysPerMonth;
}
}
}
ex:
enddate = data.date();
return countGone;
}
/* Find count and, depending on 'func', the end date of an annual recurrence by day.
* Reply = total number of occurrences up to 'enddate', or 0 if error.
* If 'func' = END_DATE_AND_COUNT or NEXT_AFTER_DATE, 'enddate' is updated to the
* recurrence end date.
@@ -2779,368 +2782,368 @@ struct Recurrence::YearlyDayData {
: year(date.year()), day(date.dayOfYear()), varies(*r->rYearNums.getLast() == 366),
daycount(r->rYearNums.count()) { }
bool leapYear() const { return QDate::leapYear(year); }
int dayCount() const { return daycount - (varies && !QDate::leapYear(year) ? 1 : 0); }
bool isMaxDayCount() const { return !varies || QDate::leapYear(year); }
QDate date() const { return QDate(year, 1, 1).addDays(day - 1); }
};
int Recurrence::yearlyDayCalc(PeriodFunc func, QDate &enddate) const
{
if (rYearNums.isEmpty())
return 0;
YearlyDayData data(this, mRecurStart.date());
switch (func) {
case END_DATE_AND_COUNT:
return yearlyDayCalcEndDate(enddate, data);
case COUNT_TO_DATE:
return yearlyDayCalcToDate(enddate, data);
case NEXT_AFTER_DATE:
return yearlyDayCalcNextAfter(enddate, data);
}
return 0;
}
int Recurrence::yearlyDayCalcEndDate(QDate &enddate, YearlyDayData &data) const
{
uint countTogo = rDuration + mRecurExDatesCount;
int countGone = 0;
if (data.day > 1) {
// Check what remains of the start year
bool leapOK = data.isMaxDayCount();
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int d = *it.current();
if (d >= data.day && (leapOK || d < 366)) {
++countGone;
if (--countTogo == 0) {
data.day = d;
goto ex;
}
}
}
data.day = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences is different in leap years,
// so check year-by-year.
for ( ; ; ) {
uint n = data.dayCount();
if (n >= countTogo)
break;
countTogo -= n;
countGone += n;
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years, but leave at least
// 1 recurrence remaining, in order to get its date.
int daysPerYear = rYearNums.count();
int wholeYears = (countTogo - 1) / daysPerYear;
data.year += wholeYears * rFreq;
countGone += wholeYears * daysPerYear;
countTogo -= wholeYears * daysPerYear;
}
if (countTogo) {
// Check the last year in the recurrence
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
++countGone;
if (--countTogo == 0) {
data.day = *it.current();
break;
}
}
}
ex:
enddate = data.date();
return countGone;
}
int Recurrence::yearlyDayCalcToDate(const QDate &enddate, YearlyDayData &data) const
{
int countGone = 0;
int countMax = (rDuration > 0) ? rDuration + mRecurExDatesCount : INT_MAX;
int endYear = enddate.year();
int endDay = enddate.dayOfYear();
if (data.day > 1) {
// Check what remains of the start year
bool leapOK = data.isMaxDayCount();
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int d = *it.current();
if (d >= data.day && (leapOK || d < 366)) {
if (data.year == endYear && d > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
data.day = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences is different in leap years,
// so check year-by-year.
while (data.year < endYear) {
uint n = data.dayCount();
countGone += n;
if (countGone >= countMax)
return countMax;
data.year += rFreq;
}
if (data.year > endYear)
return countGone;
} else {
// The number of recurrences is the same every year.
// Skip the remaining whole years.
int wholeYears = endYear - data.year;
countGone += (wholeYears / rFreq) * rYearNums.count();
if (countGone >= countMax)
return countMax;
if (wholeYears % rFreq)
return countGone; // end year isn't a recurrence year
data.year = endYear;
}
if (data.year <= endYear) {
// Check the last year in the recurrence
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
if (*it.current() > endDay)
return countGone;
if (++countGone >= countMax)
return countMax;
}
}
return countGone;
}
int Recurrence::yearlyDayCalcNextAfter(QDate &enddate, YearlyDayData &data) const
{
uint countTogo = (rDuration > 0) ? rDuration + mRecurExDatesCount : UINT_MAX;
int countGone = 0;
int endYear = enddate.year();
int endDay = enddate.dayOfYear();
if (data.day > 1) {
// Check what remains of the start year
bool leapOK = data.isMaxDayCount();
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int d = *it.current();
if (d >= data.day && (leapOK || d < 366)) {
++countGone;
if (data.year == endYear && d > endDay) {
data.day = d;
goto ex;
}
if (--countTogo == 0)
return 0;
}
}
data.day = 1;
data.year += rFreq;
}
if (data.varies) {
// The number of recurrences is different in leap years,
// so check year-by-year.
while (data.year <= endYear) {
uint n = data.dayCount();
if (data.year == endYear && *rYearNums.getLast() > endDay)
break;
if (n >= countTogo)
break;
countTogo -= n;
countGone += n;
data.year += rFreq;
}
} else {
// The number of recurrences is the same every year,
// so skip the year-by-year check.
// Skip the remaining whole years to at least endYear.
int daysPerYear = rYearNums.count();
int recurYears = (endYear - data.year + rFreq - 1) / rFreq;
if ((endYear - data.year)%rFreq == 0
&& *rYearNums.getLast() <= endDay)
++recurYears; // required year is after endYear
if (recurYears) {
int n = recurYears * daysPerYear;
if (static_cast<uint>(n) > countTogo)
return 0; // reached end of recurrence
countTogo -= n;
countGone += n;
data.year += recurYears * rFreq;
}
}
// Check the last year in the recurrence
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
++countGone;
int d = *it.current();
if (data.year > endYear || d > endDay) {
data.day = d;
break;
}
if (--countTogo == 0)
return 0;
}
ex:
enddate = data.date();
return countGone;
}
// Get the days in this month which recur, in numerical order.
// Parameters: daysInMonth = number of days in this month
// startDayOfWeek = day of week for first day of month.
-void Recurrence::getMonthlyPosDays(QValueList<int> &list, int daysInMonth, int startDayOfWeek) const
+void Recurrence::getMonthlyPosDays(Q3ValueList<int> &list, int daysInMonth, int startDayOfWeek) const
{
list.clear();
int endDayOfWeek = (startDayOfWeek + daysInMonth - 2) % 7 + 1;
// Go through the list, compiling a bit list of actual day numbers
Q_UINT32 days = 0;
- for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
+ for (Q3PtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
int weeknum = pos.current()->rPos - 1; // get 0-based week number
QBitArray &rdays = pos.current()->rDays;
if (pos.current()->negative) {
// nth days before the end of the month
for (uint i = 1; i <= 7; ++i) {
if (rdays.testBit(i - 1)) {
int day = daysInMonth - weeknum*7 - (endDayOfWeek - i + 7) % 7;
if (day > 0)
days |= 1 << (day - 1);
}
}
} else {
// nth days after the start of the month
for (uint i = 1; i <= 7; ++i) {
if (rdays.testBit(i - 1)) {
int day = 1 + weeknum*7 + (i - startDayOfWeek + 7) % 7;
if (day <= daysInMonth)
days |= 1 << (day - 1);
}
}
}
}
// Compile the ordered list
Q_UINT32 mask = 1;
for (int i = 0; i < daysInMonth; mask <<= 1, ++i) {
if (days & mask)
list.append(i + 1);
}
}
// Get the number of days in the month which recur.
// Reply = -1 if the number varies from month to month.
int Recurrence::countMonthlyPosDays() const
{
int count = 0;
Q_UINT8 positive[5] = { 0, 0, 0, 0, 0 };
Q_UINT8 negative[4] = { 0, 0, 0, 0 };
- for (QPtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
+ for (Q3PtrListIterator<rMonthPos> pos(rMonthPositions); pos.current(); ++pos) {
int weeknum = pos.current()->rPos;
Q_UINT8* wk;
if (pos.current()->negative) {
// nth days before the end of the month
if (weeknum > 4)
return -1; // days in 5th week are often missing
wk = &negative[4 - weeknum];
} else {
// nth days after the start of the month
if (weeknum > 4)
return -1; // days in 5th week are often missing
wk = &positive[weeknum - 1];
}
QBitArray &rdays = pos.current()->rDays;
for (uint i = 0; i < 7; ++i) {
if (rdays.testBit(i)) {
++count;
*wk |= (1 << i);
}
}
}
// Check for any possible days which could be duplicated by
// a positive and a negative position.
for (int i = 0; i < 4; ++i) {
if (negative[i] & (positive[i] | positive[i+1]))
return -1;
}
return count;
}
// Get the days in this month which recur, in numerical order.
// Reply = true if day numbers varies from month to month.
-bool Recurrence::getMonthlyDayDays(QValueList<int> &list, int daysInMonth) const
+bool Recurrence::getMonthlyDayDays(Q3ValueList<int> &list, int daysInMonth) const
{
list.clear();
bool variable = false;
Q_UINT32 days = 0;
- for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rMonthDays); it.current(); ++it) {
int day = *it.current();
if (day > 0) {
// date in the month
if (day <= daysInMonth)
days |= 1 << (day - 1);
if (day > 28 && day <= 31)
variable = true; // this date does not appear in some months
} else if (day < 0) {
// days before the end of the month
variable = true; // this date varies depending on the month length
day = daysInMonth + day; // zero-based day of month
if (day >= 0)
days |= 1 << day;
}
}
// Compile the ordered list
Q_UINT32 mask = 1;
for (int i = 0; i < daysInMonth; mask <<= 1, ++i) {
if (days & mask)
list.append(i + 1);
}
return variable;
}
// Get the months which recur, in numerical order, for both leap years and non-leap years.
// N.B. If February 29th recurs on March 1st in non-leap years, February (not March) is
// included in the non-leap year month list.
// Reply = true if February 29th also recurs.
-bool Recurrence::getYearlyMonthMonths(int day, QValueList<int> &list, QValueList<int> &leaplist) const
+bool Recurrence::getYearlyMonthMonths(int day, Q3ValueList<int> &list, Q3ValueList<int> &leaplist) const
{
list.clear();
leaplist.clear();
bool feb29 = false;
- for (QPtrListIterator<int> it(rYearNums); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rYearNums); it.current(); ++it) {
int month = *it.current();
if (month == 2) {
if (day <= 28) {
list.append(month); // date appears in February
leaplist.append(month);
}
else if (day == 29) {
// February 29th
leaplist.append(month);
switch (mFeb29YearlyType) {
case rFeb28:
case rMar1:
list.append(2);
break;
case rFeb29:
break;
}
feb29 = true;
}
}
else if (day <= 30 || QDate(2000, month, 1).daysInMonth() == 31) {
list.append(month); // date appears in every month
leaplist.append(month);
}
}
return feb29;
}
/* From the recurrence day of the week list, get the earliest day in the
* specified week which is >= the startDay.
* Parameters: startDay = 1..7 (Monday..Sunday)
* useWeekStart = true to end search at day before next rWeekStart
@@ -3158,244 +3161,244 @@ int Recurrence::getFirstDayInWeek(int startDay, bool useWeekStart) const
}
}
/* From the recurrence day of the week list, get the latest day in the
* specified week which is <= the endDay.
* Parameters: endDay = 1..7 (Monday..Sunday)
* useWeekStart = true to end search at rWeekStart
* = false to search for a full 7 days
* Reply = day of the week (1..7), or 0 if none found.
*/
int Recurrence::getLastDayInWeek(int endDay, bool useWeekStart) const
{
int last = useWeekStart ? rWeekStart - 1 : endDay%7;
for (int i = endDay - 1; ; i = (i + 6)%7) {
if (rDays.testBit(i))
return i + 1;
if (i == last)
return 0;
}
}
/* From the recurrence monthly day number list or monthly day of week/week of
* month list, get the earliest day in the specified month which is >= the
* earliestDate.
*/
QDate Recurrence::getFirstDateInMonth(const QDate &earliestDate) const
{
int earliestDay = earliestDate.day();
int daysInMonth = earliestDate.daysInMonth();
switch (recurs) {
case rMonthlyDay: {
int minday = daysInMonth + 1;
- for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rMonthDays); it.current(); ++it) {
int day = *it.current();
if (day < 0)
day = daysInMonth + day + 1;
if (day >= earliestDay && day < minday)
minday = day;
}
if (minday <= daysInMonth)
return earliestDate.addDays(minday - earliestDay);
break;
}
case rMonthlyPos:
case rYearlyPos: {
QDate monthBegin(earliestDate.addDays(1 - earliestDay));
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
if (*id >= earliestDay)
return monthBegin.addDays(*id - 1);
}
break;
}
}
return QDate();
}
/* From the recurrence monthly day number list or monthly day of week/week of
* month list, get the latest day in the specified month which is <= the
* latestDate.
*/
QDate Recurrence::getLastDateInMonth(const QDate &latestDate) const
{
int latestDay = latestDate.day();
int daysInMonth = latestDate.daysInMonth();
switch (recurs) {
case rMonthlyDay: {
int maxday = -1;
- for (QPtrListIterator<int> it(rMonthDays); it.current(); ++it) {
+ for (Q3PtrListIterator<int> it(rMonthDays); it.current(); ++it) {
int day = *it.current();
if (day < 0)
day = daysInMonth + day + 1;
if (day <= latestDay && day > maxday)
maxday = day;
}
if (maxday > 0)
return QDate(latestDate.year(), latestDate.month(), maxday);
break;
}
case rMonthlyPos:
case rYearlyPos: {
QDate monthBegin(latestDate.addDays(1 - latestDay));
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
getMonthlyPosDays(dayList, daysInMonth, monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
if (*id <= latestDay)
return monthBegin.addDays(*id - 1);
}
break;
}
}
return QDate();
}
/* From the recurrence yearly month list or yearly day list, get the earliest
* month or day in the specified year which is >= the earliestDate.
* Note that rYearNums is sorted in numerical order.
*/
QDate Recurrence::getFirstDateInYear(const QDate &earliestDate) const
{
- QPtrListIterator<int> it(rYearNums);
+ Q3PtrListIterator<int> it(rYearNums);
switch (recurs) {
case rYearlyMonth: {
int day = recurStart().date().day();
int earliestYear = earliestDate.year();
int earliestMonth = earliestDate.month();
int earliestDay = earliestDate.day();
if (earliestDay > day) {
// The earliest date is later in the month than the recurrence date,
// so skip to the next month before starting to check
if (++earliestMonth > 12)
return QDate();
}
for ( ; it.current(); ++it) {
int month = *it.current();
if (month >= earliestMonth) {
if (day <= 28 || QDate::isValid(earliestYear, month, day))
return QDate(earliestYear, month, day);
if (day == 29 && month == 2) {
// It's a recurrence on February 29th, in a non-leap year
switch (mFeb29YearlyType) {
case rMar1:
return QDate(earliestYear, 3, 1);
case rFeb28:
if (earliestDay <= 28)
return QDate(earliestYear, 2, 28);
break;
case rFeb29:
break;
}
}
}
}
break;
}
case rYearlyPos: {
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
int earliestYear = earliestDate.year();
int earliestMonth = earliestDate.month();
int earliestDay = earliestDate.day();
for ( ; it.current(); ++it) {
int month = *it.current();
if (month >= earliestMonth) {
QDate monthBegin(earliestYear, month, 1);
getMonthlyPosDays(dayList, monthBegin.daysInMonth(), monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.begin(); id != dayList.end(); ++id) {
if (*id >= earliestDay)
return monthBegin.addDays(*id - 1);
}
earliestDay = 1;
}
}
break;
}
case rYearlyDay: {
int earliestDay = earliestDate.dayOfYear();
for ( ; it.current(); ++it) {
int day = *it.current();
if (day >= earliestDay && (day <= 365 || day <= earliestDate.daysInYear()))
return earliestDate.addDays(day - earliestDay);
}
break;
}
}
return QDate();
}
/* From the recurrence yearly month list or yearly day list, get the latest
* month or day in the specified year which is <= the latestDate.
* Note that rYearNums is sorted in numerical order.
*/
QDate Recurrence::getLastDateInYear(const QDate &latestDate) const
{
- QPtrListIterator<int> it(rYearNums);
+ Q3PtrListIterator<int> it(rYearNums);
switch (recurs) {
case rYearlyMonth: {
int day = recurStart().date().day();
int latestYear = latestDate.year();
int latestMonth = latestDate.month();
if (latestDate.day() > day) {
// The latest date is earlier in the month than the recurrence date,
// so skip to the previous month before starting to check
if (--latestMonth <= 0)
return QDate();
}
for (it.toLast(); it.current(); --it) {
int month = *it.current();
if (month <= latestMonth) {
if (day <= 28 || QDate::isValid(latestYear, month, day))
return QDate(latestYear, month, day);
if (day == 29 && month == 2) {
// It's a recurrence on February 29th, in a non-leap year
switch (mFeb29YearlyType) {
case rMar1:
if (latestMonth >= 3)
return QDate(latestYear, 3, 1);
break;
case rFeb28:
return QDate(latestYear, 2, 28);
case rFeb29:
break;
}
}
}
}
break;
}
case rYearlyPos: {
- QValueList<int> dayList;
+ Q3ValueList<int> dayList;
int latestYear = latestDate.year();
int latestMonth = latestDate.month();
int latestDay = latestDate.day();
for (it.toLast(); it.current(); --it) {
int month = *it.current();
if (month <= latestMonth) {
QDate monthBegin(latestYear, month, 1);
getMonthlyPosDays(dayList, monthBegin.daysInMonth(), monthBegin.dayOfWeek());
- for (QValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
+ for (Q3ValueList<int>::ConstIterator id = dayList.fromLast(); id != dayList.end(); --id) {
if (*id <= latestDay)
return monthBegin.addDays(*id - 1);
}
latestDay = 31;
}
}
break;
}
case rYearlyDay: {
int latestDay = latestDate.dayOfYear();
for (it.toLast(); it.current(); --it) {
int day = *it.current();
if (day <= latestDay)
return latestDate.addDays(day - latestDay);
}
break;
}
}
return QDate();
}
void Recurrence::dump() const
{
;
}
diff --git a/libkcal/recurrence.h b/libkcal/recurrence.h
index b13d14f..5b5aab1 100644
--- a/libkcal/recurrence.h
+++ b/libkcal/recurrence.h
@@ -1,59 +1,61 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCAL_RECURRENCE_H
#define KCAL_RECURRENCE_H
#include <qstring.h>
#include <qbitarray.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
namespace KCal {
class Incidence;
/**
This class represents a recurrence rule for a calendar incidence.
*/
class Recurrence
{
public:
/** enumeration for describing how an event recurs, if at all. */
enum { rNone = 0, rMinutely = 0x001, rHourly = 0x0002, rDaily = 0x0003,
rWeekly = 0x0004, rMonthlyPos = 0x0005, rMonthlyDay = 0x0006,
rYearlyMonth = 0x0007, rYearlyDay = 0x0008, rYearlyPos = 0x0009 };
/** Enumeration for specifying what date yearly recurrences of February 29th occur
* in non-leap years. */
enum Feb29Type {
rMar1, // recur on March 1st (default)
rFeb28, // recur on February 28th
rFeb29 // only recur on February 29th, i.e. don't recur in non-leap years
};
/** structure for Recurs rMonthlyPos */
struct rMonthPos {
QBitArray rDays;
short rPos;
bool negative;
};
Recurrence(Incidence *parent, int compatVersion = 0);
@@ -219,183 +221,183 @@ class Recurrence
* @var _rDays a 7 bit array indicating which days on which to recur (bit 0 = Monday).
* @var endDate the date on which to stop recurring.
* @var weekStart the first day of the week (Monday=1 .. Sunday=7, default is Monday).
*/
void setWeekly(int _rFreq, const QBitArray &_rDays, const QDate &endDate, int weekStart = 1);
/** Returns the first day of the week. Monday=1 .. Sunday=7. */
int weekStart() const { return rWeekStart; }
/** Returns week day mask (bit 0 = Monday). */
const QBitArray &days() const;
/** Sets an event to recur monthly.
* @var type rMonthlyPos or rMonthlyDay
* @var _rFreq the frequency to recur, e.g. 3 for every third month.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setMonthly(short type, int _rFreq, int duration);
/** same as above, but with ending date not number of recurrences */
void setMonthly(short type, int _rFreq, const QDate &endDate);
/** Adds a position to the recursMonthlyPos recurrence rule, if it is
* set.
* @var _rPos the position in the month for the recurrence, with valid
* values being 1-5 (5 weeks max in a month).
* @var _rDays the days for the position to recur on (bit 0 = Monday).
* Example: _rPos = 2, and bits 0 and 2 are set in _rDays:
* the rule is to repeat every 2nd Monday and Wednesday in the month.
*/
void addMonthlyPos(short _rPos, const QBitArray &_rDays);
/** Adds a position the the recursMonthlyDay list.
* @var _rDay the date in the month to recur.
*/
void addMonthlyDay(short _rDay);
/** Returns list of day positions in months. */
- const QPtrList<rMonthPos> &monthPositions() const;
+ const Q3PtrList<rMonthPos> &monthPositions() const;
/** Returns list of day numbers of a month. */
- const QPtrList<int> &monthDays() const;
+ const Q3PtrList<int> &monthDays() const;
/** Sets an event to recur yearly.
* @var type rYearlyMonth, rYearlyPos or rYearlyDay
* @var freq the frequency to recur, e.g. 3 for every third year.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setYearly(int type, int freq, int duration);
/** Sets an event to recur yearly ending at \a endDate. */
void setYearly(int type, int freq, const QDate &endDate);
/** Sets an event to recur yearly on specified dates.
* The dates must be specified by calling addYearlyNum().
* @var type the way recurrences of February 29th are to be handled in non-leap years.
* @var freq the frequency to recur, e.g. 3 for every third year.
* @var duration the number of times the event is to occur, or -1 to recur indefinitely.
*/
void setYearlyByDate(Feb29Type type, int freq, int duration);
/** Sets an event to recur yearly ending at \a endDate. */
void setYearlyByDate(Feb29Type type, int freq, const QDate &endDate);
/** Adds position of day or month in year.
* N.B. for recursYearlyPos, addYearlyMonthPos() must also be called
* to add positions within the month. */
void addYearlyNum(short _rNum);
/** Adds a position to the recursYearlyPos recurrence rule, if it is set.
* N.B. addYearlyNum() must also be called to add recurrence months.
* Parameters are the same as for addMonthlyPos().
*/
void addYearlyMonthPos(short _rPos, const QBitArray &_rDays);
/** Returns positions of days or months in year. */
- const QPtrList<int> &yearNums() const;
+ const Q3PtrList<int> &yearNums() const;
/** Returns list of day positions in months, for a recursYearlyPos recurrence rule. */
- const QPtrList<rMonthPos> &yearMonthPositions() const;
+ const Q3PtrList<rMonthPos> &yearMonthPositions() const;
/** Returns how yearly recurrences of February 29th are handled. */
Feb29Type feb29YearlyType() const { return mFeb29YearlyType; }
/** Sets the default method for handling yearly recurrences of February 29th. */
static void setFeb29YearlyTypeDefault(Feb29Type t) { mFeb29YearlyDefaultType = t; }
/** Returns the default method for handling yearly recurrences of February 29th. */
static Feb29Type setFeb29YearlyTypeDefault() { return mFeb29YearlyDefaultType; }
void addYearlyMonth(short _rPos ); // added LR
/**
Debug output.
*/
void dump() const;
QString recurrenceText() const;
- bool getYearlyMonthMonths(int day, QValueList<int>&,
- QValueList<int> &leaplist) const;
+ bool getYearlyMonthMonths(int day, Q3ValueList<int>&,
+ Q3ValueList<int> &leaplist) const;
protected:
enum PeriodFunc { END_DATE_AND_COUNT, COUNT_TO_DATE, NEXT_AFTER_DATE };
struct MonthlyData; friend struct MonthlyData;
struct YearlyMonthData; friend struct YearlyMonthData;
struct YearlyPosData; friend struct YearlyPosData;
struct YearlyDayData; friend struct YearlyDayData;
bool recursSecondly(const QDate &, int secondFreq) const;
bool recursMinutelyAt(const QDateTime &dt, int minuteFreq) const;
bool recursDaily(const QDate &) const;
bool recursWeekly(const QDate &) const;
bool recursMonthly(const QDate &) const;
bool recursYearlyByMonth(const QDate &) const;
bool recursYearlyByPos(const QDate &) const;
bool recursYearlyByDay(const QDate &) const;
QDate getNextDateNoTime(const QDate& preDate, bool* last) const;
QDate getPreviousDateNoTime(const QDate& afterDate, bool* last) const;
void addMonthlyPos_(short _rPos, const QBitArray &_rDays);
void setDailySub(short type, int freq, int duration);
void setYearly_(short type, Feb29Type, int freq, int duration);
int recurCalc(PeriodFunc, QDate &enddate) const;
int recurCalc(PeriodFunc, QDateTime &endtime) const;
int secondlyCalc(PeriodFunc, QDateTime& endtime, int freq) const;
int dailyCalc(PeriodFunc, QDate &enddate) const;
int weeklyCalc(PeriodFunc, QDate &enddate) const;
int weeklyCalcEndDate(QDate& enddate, int daysPerWeek) const;
int weeklyCalcToDate(const QDate& enddate, int daysPerWeek) const;
int weeklyCalcNextAfter(QDate& enddate, int daysPerWeek) const;
int monthlyCalc(PeriodFunc, QDate &enddate) const;
int monthlyCalcEndDate(QDate& enddate, MonthlyData&) const;
int monthlyCalcToDate(const QDate& enddate, MonthlyData&) const;
int monthlyCalcNextAfter(QDate& enddate, MonthlyData&) const;
int yearlyMonthCalc(PeriodFunc, QDate &enddate) const;
int yearlyMonthCalcEndDate(QDate& enddate, YearlyMonthData&) const;
int yearlyMonthCalcToDate(const QDate& enddate, YearlyMonthData&) const;
int yearlyMonthCalcNextAfter(QDate& enddate, YearlyMonthData&) const;
int yearlyPosCalc(PeriodFunc, QDate &enddate) const;
int yearlyPosCalcEndDate(QDate& enddate, YearlyPosData&) const;
int yearlyPosCalcToDate(const QDate& enddate, YearlyPosData&) const;
int yearlyPosCalcNextAfter(QDate& enddate, YearlyPosData&) const;
int yearlyDayCalc(PeriodFunc, QDate &enddate) const;
int yearlyDayCalcEndDate(QDate& enddate, YearlyDayData&) const;
int yearlyDayCalcToDate(const QDate& enddate, YearlyDayData&) const;
int yearlyDayCalcNextAfter(QDate& enddate, YearlyDayData&) const;
int countMonthlyPosDays() const;
- void getMonthlyPosDays(QValueList<int>&, int daysInMonth,
+ void getMonthlyPosDays(Q3ValueList<int>&, int daysInMonth,
int startDayOfWeek) const;
- bool getMonthlyDayDays(QValueList<int>&, int daysInMonth) const;
+ bool getMonthlyDayDays(Q3ValueList<int>&, int daysInMonth) const;
int getFirstDayInWeek(int startDay, bool useWeekStart = true) const;
int getLastDayInWeek(int endDay, bool useWeekStart = true) const;
QDate getFirstDateInMonth(const QDate& earliestDate) const;
QDate getLastDateInMonth(const QDate& latestDate) const;
QDate getFirstDateInYear(const QDate& earliestDate) const;
QDate getLastDateInYear(const QDate& latestDate) const;
private:
// Prohibit copying
Recurrence(const Recurrence&);
Recurrence &operator=(const Recurrence&);
short recurs; // should be one of the enums.
int rWeekStart; // day which starts the week, Monday=1 .. Sunday=7
QBitArray rDays; // array of days during week it recurs
- QPtrList<rMonthPos> rMonthPositions; // list of positions during a month
+ Q3PtrList<rMonthPos> rMonthPositions; // list of positions during a month
// on which an event recurs
- QPtrList<int> rMonthDays; // list of days during a month on
+ Q3PtrList<int> rMonthDays; // list of days during a month on
// which the event recurs
- QPtrList<int> rYearNums; // either months/days to recur on for rYearly,
+ Q3PtrList<int> rYearNums; // either months/days to recur on for rYearly,
// sorted in numerical order
int rFreq; // frequency of period
// one of the following must be specified
int rDuration; // num times to recur (inc. first occurrence), -1 = infinite
QDateTime rEndDateTime; // date/time at which to end recurrence
QDateTime mRecurStart; // date/time of first recurrence
bool mFloats; // the recurrence has no time, just a date
bool mRecurReadOnly;
int mRecurExDatesCount; // number of recurrences (in addition to rDuration) which are excluded
Feb29Type mFeb29YearlyType; // how to handle yearly recurrences of February 29th
static Feb29Type mFeb29YearlyDefaultType; // default value for mFeb29YearlyType
// Backwards compatibility for KDE < 3.1.
int mCompatVersion; // calendar file version for backwards compatibility
short mCompatRecurs; // original 'recurs' in old calendar format, or rNone
int mCompatDuration; // original 'rDuration' in old calendar format, or 0
Incidence *mParent;
};
}
#endif
diff --git a/libkcal/scheduler.cpp b/libkcal/scheduler.cpp
index 253d8b7..234cfcf 100644
--- a/libkcal/scheduler.cpp
+++ b/libkcal/scheduler.cpp
@@ -1,55 +1,57 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdir.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <klocale.h>
#include <kdebug.h>
#include <kstandarddirs.h>
#include "event.h"
#include "todo.h"
#include "freebusy.h"
#include "icalformat.h"
#include "calendar.h"
#include "scheduler.h"
using namespace KCal;
ScheduleMessage::ScheduleMessage(IncidenceBase *incidence,int method,ScheduleMessage::Status status)
{
mIncidence = incidence;
mMethod = method;
mStatus = status;
}
QString ScheduleMessage::statusName(ScheduleMessage::Status status)
{
switch (status) {
case PublishNew:
return i18n("Publish");
case Obsolete:
return i18n("Obsolete");
case RequestNew:
return i18n("New Request");
case RequestUpdate:
@@ -235,66 +237,66 @@ bool Scheduler::acceptCancel(IncidenceBase *incidence,ScheduleMessage::Status st
if (todo) {
mCalendar->deleteTodo(todo);
ret = true;
}
}
deleteTransaction(incidence);
return ret;
}
bool Scheduler::acceptDeclineCounter(IncidenceBase *incidence,ScheduleMessage::Status status)
{
deleteTransaction(incidence);
return false;
}
//bool Scheduler::acceptFreeBusy(Incidence *incidence,ScheduleMessage::Status status)
//{
// deleteTransaction(incidence);
// return false;
//}
bool Scheduler::acceptReply(IncidenceBase *incidence,ScheduleMessage::Status status, Method method)
{
if(incidence->type()=="FreeBusy") {
return acceptFreeBusy(incidence, method);
}
bool ret = false;
Event *ev = mCalendar->event(incidence->uid());
Todo *to = mCalendar->todo(incidence->uid());
if (ev || to) {
//get matching attendee in calendar
kdDebug(5800) << "Scheduler::acceptTransaction match found!" << endl;
- QPtrList<Attendee> attendeesIn = incidence->attendees();
- QPtrList<Attendee> attendeesEv;
+ Q3PtrList<Attendee> attendeesIn = incidence->attendees();
+ Q3PtrList<Attendee> attendeesEv;
if (ev) attendeesEv = ev->attendees();
if (to) attendeesEv = to->attendees();
Attendee *attIn;
Attendee *attEv;
for ( attIn = attendeesIn.first(); attIn; attIn = attendeesIn.next() ) {
for ( attEv = attendeesEv.first(); attEv; attEv = attendeesEv.next() ) {
if (attIn->email()==attEv->email()) {
//update attendee-info
kdDebug(5800) << "Scheduler::acceptTransaction update attendee" << endl;
attEv->setStatus(attIn->status());
attEv->setRSVP(false);
// better to not update the sequence number with replys
//if (ev) ev->setRevision(ev->revision()+1);
//if (to) to->setRevision(to->revision()+1);
ret = true;
}
}
}
}
if (ret) deleteTransaction(incidence);
return ret;
}
bool Scheduler::acceptRefresh(IncidenceBase *incidence,ScheduleMessage::Status status)
{
// handled in korganizer's IncomingDialog
deleteTransaction(incidence);
return false;
}
bool Scheduler::acceptCounter(IncidenceBase *incidence,ScheduleMessage::Status status)
{
@@ -313,43 +315,43 @@ bool Scheduler::acceptFreeBusy(IncidenceBase *incidence, Method method)
if(method == Scheduler::Publish) {
from = freebusy->organizer();
}
if((method == Scheduler::Reply) && (freebusy->attendeeCount() == 1)) {
Attendee *attendee = freebusy->attendees().first();
from = attendee->email();
}
QDir freeBusyDir(freeBusyDirName);
if (!freeBusyDir.exists()) {
kdDebug() << "Directory " << freeBusyDirName << " does not exist!" << endl;
kdDebug() << "Creating directory: " << freeBusyDirName << endl;
if(!freeBusyDir.mkdir(freeBusyDirName, TRUE)) {
kdDebug() << "Could not create directory: " << freeBusyDirName << endl;
return false;
}
}
QString filename(freeBusyDirName);
filename += "/";
filename += from;
filename += ".ifb";
QFile f(filename);
kdDebug() << "acceptFreeBusy: filename" << filename << endl;
freebusy->clearAttendees();
freebusy->setOrganizer(from);
QString messageText = mFormat->createScheduleMessage(freebusy, Publish);
- if (!f.open(IO_ReadWrite)) {
+ if (!f.open(QIODevice::ReadWrite)) {
kdDebug() << "acceptFreeBusy: Can't open:" << filename << " for writing" << endl;
return false;
}
- QTextStream t(&f);
+ Q3TextStream t(&f);
t << messageText;
f.close();
deleteTransaction(incidence);
return true;
}
diff --git a/libkcal/scheduler.h b/libkcal/scheduler.h
index a9f43b9..357e98e 100644
--- a/libkcal/scheduler.h
+++ b/libkcal/scheduler.h
@@ -1,58 +1,58 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef SCHEDULER_H
#define SCHEDULER_H
// iTIP transactions base class
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
namespace KCal {
class IncidenceBase;
class Event;
class Calendar;
class ICalFormat;
/**
This class provides an encapsulation of a scheduling message. It associates an
incidence with a method and status information. This class is used by the
Scheduler class.
@short A Scheduling message
*/
class ScheduleMessage {
public:
/** Message status. */
enum Status { PublishNew, Obsolete, RequestNew, RequestUpdate, Unknown };
/**
Create a scheduling message with method as defined in Scheduler::Method
and a status.
*/
ScheduleMessage(IncidenceBase *,int method,Status status);
~ScheduleMessage() {};
/** Return event associated with this message. */
IncidenceBase *event() { return mIncidence; }
/** Return iTIP method associated with this message. */
int method() { return mMethod; }
/** Return status of this message. */
@@ -66,65 +66,65 @@ class ScheduleMessage {
private:
IncidenceBase *mIncidence;
int mMethod;
Status mStatus;
QString mError;
};
/**
This class provides an encapsulation of iTIP transactions. It is an abstract
base class for inheritance by implementations of the iTIP scheme like iMIP or
iRIP.
*/
class Scheduler {
public:
/** iTIP methods. */
enum Method { Publish,Request,Refresh,Cancel,Add,Reply,Counter,
Declinecounter,NoMethod };
/** Create scheduler for calendar specified as argument. */
Scheduler(Calendar *calendar);
virtual ~Scheduler();
/** iTIP publish action */
virtual bool publish (IncidenceBase *incidence,const QString &recipients) = 0;
/** Perform iTIP transaction on incidence. The method is specified as the
method argumanet and can be any valid iTIP method. */
virtual bool performTransaction(IncidenceBase *incidence,Method method) = 0;
/** Perform iTIP transaction on incidence to specified recipient(s). The
method is specified as the method argumanet and can be any valid iTIP
method. */
virtual bool performTransaction(IncidenceBase *incidence,Method method,const QString &recipients) = 0;
/** Retrieve incoming iTIP transactions */
- virtual QPtrList<ScheduleMessage> retrieveTransactions() = 0;
+ virtual Q3PtrList<ScheduleMessage> retrieveTransactions() = 0;
/**
Accept transaction. The incidence argument specifies the iCal compoennt
on which the transaction acts. The status is the result of processing a
iTIP message with the current calendar and specifies the action to be
taken for this incidence.
*/
bool acceptTransaction(IncidenceBase *,Method method,ScheduleMessage::Status status);
/** Return a machine-readable name for a iTIP method. */
static QString methodName(Method);
/** Return a translated and human-readable name for a iTIP method. */
static QString translatedMethodName(Method);
virtual bool deleteTransaction(IncidenceBase *incidence);
protected:
bool acceptPublish(IncidenceBase *,ScheduleMessage::Status status, Method method);
bool acceptRequest(IncidenceBase *,ScheduleMessage::Status status);
bool acceptAdd(IncidenceBase *,ScheduleMessage::Status status);
bool acceptCancel(IncidenceBase *,ScheduleMessage::Status status);
bool acceptDeclineCounter(IncidenceBase *,ScheduleMessage::Status status);
bool acceptReply(IncidenceBase *,ScheduleMessage::Status status, Method method);
bool acceptRefresh(IncidenceBase *,ScheduleMessage::Status status);
bool acceptCounter(IncidenceBase *,ScheduleMessage::Status status);
bool acceptFreeBusy(IncidenceBase *,Method method);
Calendar *mCalendar;
ICalFormat *mFormat;
};
diff --git a/libkcal/sharpformat.cpp b/libkcal/sharpformat.cpp
index 9b757f7..b8c2aa7 100644
--- a/libkcal/sharpformat.cpp
+++ b/libkcal/sharpformat.cpp
@@ -1,62 +1,62 @@
/*
This file is part of libkcal.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qdatetime.h>
#include <qstring.h>
#include <qapplication.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qmessagebox.h>
#include <qclipboard.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qxml.h>
#include <qlabel.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include "calendar.h"
#include "alarm.h"
#include "recurrence.h"
#include "calendarlocal.h"
#include "sharpformat.h"
#include "syncdefines.h"
using namespace KCal;
//CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//ARSD silentalarm = 0
// 11 RTYP 225 no /0 dialy/ 1 weekly/ 3 month by date/ 2 month by day(pos)/ yearly
// 12 RFRQ
// 13 RPOS pos = 4. monday in month
// 14 RDYS days: 1 mon/ 2 tue .. 64 sun
// 15 REND 0 = no end/ 1 = end
// 16 REDT rec end dt
//ALSD
//ALED
//MDAY
@@ -337,87 +337,87 @@ ulong SharpFormat::getCsum( const QStringList & attList)
#include <stdlib.h>
#define DEBUGMODE false
//#define DEBUGMODE true
bool SharpFormat::load( Calendar *calendar, Calendar *existngCal )
{
bool debug = DEBUGMODE;
QString text;
QString codec = "utf8";
QLabel status ( i18n("Reading events ..."), 0 );
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 200;
int h = status.sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Reading DTM Data") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status.show();
status.raise();
qApp->processEvents();
QString fileName;
if ( ! debug ) {
fileName = "/tmp/kopitempout";
QString command ="db2file datebook -r -c "+ codec + " > " + fileName;
system ( command.latin1() );
} else {
fileName = "/tmp/events.txt";
}
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
text = ts.read();
file.close();
status.setText( i18n("Processing events ...") );
status.raise();
qApp->processEvents();
fromString2Cal( calendar, existngCal, text, "Event" );
status.setText( i18n("Reading todos ...") );
qApp->processEvents();
if ( ! debug ) {
fileName = "/tmp/kopitempout";
QString command = "db2file todo -r -c " + codec+ " > " + fileName;
system ( command.latin1() );
} else {
fileName = "/tmp/todo.txt";
}
file.setName( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
ts.setDevice( &file );
text = ts.read();
file.close();
status.setText( i18n("Processing todos ...") );
status.raise();
qApp->processEvents();
fromString2Cal( calendar, existngCal, text, "Todo" );
return true;
}
int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
{
int retval = -1;
QStringList templist;
QString tempString;
int start = 0;
int len = answer.length();
int end = answer.find ("\n",start)+1;
bool ok = true;
start = end;
int ccc = 0;
while ( start > 0 ) {
templist.clear();
ok = true;
int loopCount = 0;
while ( ok ) {
++loopCount;
if ( loopCount > 25 ) {
qDebug("KO: Error in while loop");
@@ -446,254 +446,254 @@ int SharpFormat::getNumFromRecord( QString answer, Incidence* inc )
inc->setID( "Sharp_DTM",templist[0] );
inc->setCsum( "Sharp_DTM", QString::number( getCsum( templist ) ));
inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
}
if ( ok && newnum == -1 ) {
qDebug("Error writing back %s ", inc->summary().latin1());
}
}
}
//qDebug("getNumFromRecord returning : %d ", retval);
return retval;
}
bool SharpFormat::save( Calendar *calendar)
{
QLabel status ( i18n("Processing/adding events ..."), 0 );
int w = status.sizeHint().width()+20 ;
if ( w < 200 ) w = 200;
int h = status.sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
status.setCaption(i18n("Writing DTM Data") );
status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status.show();
status.raise();
qApp->processEvents();
bool debug = DEBUGMODE;
QString codec = "utf8";
QString answer;
QString ePrefix = "CARDID,CATEGORY,DSRP,PLCE,MEM1,TIM1,TIM2,ADAY,ARON,ARMN,ARSD,RTYP,RFRQ,RPOS,RDYS,REND,REDT,ALSD,ALED,MDAY\n";
QString tPrefix = "CARDID,CATEGORY,ETDY,LTDY,FNDY,MARK,PRTY,TITL,MEM1\n";
QString command;
- QPtrList<Event> er = calendar->rawEvents();
+ Q3PtrList<Event> er = calendar->rawEvents();
Event* ev = er.first();
QString fileName = "/tmp/kopitempout";
int i = 0;
QString changeString = ePrefix;
QString deleteString = ePrefix;
bool deleteEnt = false;
bool changeEnt = false;
QString message = i18n("Processing event # ");
int procCount = 0;
while ( ev ) {
//qDebug("i %d ", ++i);
if ( ev->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getEventString( ev );
if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
else if ( ev->getID("Sharp_DTM").isEmpty() ) { // add new
QString fileNameIn = "/tmp/kopitempin";
QFile fileIn( fileNameIn );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << ePrefix << eString ;
fileIn.close();
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
command = "(cat /tmp/kopitempin | db2file datebook -w -g -c " + codec+ ") > "+ fileName;
//qDebug("command ++++++++ ");
//qDebug("%s ",command.latin1());
//qDebug("command -------- ");
system ( command.utf8() );
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
getNumFromRecord( answer, ev ) ;
}
else { // change existing
//qDebug("canging %d %d",ev->zaurusStat() ,ev->zaurusId() );
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
changeString += eString + "\n";
changeEnt = true;
}
}
ev = er.next();
}
status.setText ( i18n("Changing events ...") );
qApp->processEvents();
//qDebug("changing... ");
if ( changeEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << changeString ;
file.close();
command = "db2file datebook -w -g -c " + codec+ " < "+ fileName;
system ( command.latin1() );
//qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1());
}
status.setText ( i18n("Deleting events ...") );
qApp->processEvents();
//qDebug("deleting... ");
if ( deleteEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << deleteString;
file.close();
command = "db2file datebook -d -c " + codec+ " < "+ fileName;
system ( command.latin1() );
// qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
}
changeString = tPrefix;
deleteString = tPrefix;
status.setText ( i18n("Processing todos ...") );
qApp->processEvents();
- QPtrList<Todo> tl = calendar->rawTodos();
+ Q3PtrList<Todo> tl = calendar->rawTodos();
Todo* to = tl.first();
i = 0;
message = i18n("Processing todo # ");
procCount = 0;
while ( to ) {
if ( to->tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) {
status.setText ( message + QString::number ( ++procCount ) );
qApp->processEvents();
QString eString = getTodoString( to );
if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { // delete
// deleting empty strings does not work.
// we write first and x and then delete the record with the x
eString = eString.replace( QRegExp(",\"\""),",\"x\"" );
changeString += eString + "\n";
deleteString += eString + "\n";
deleteEnt = true;
changeEnt = true;
}
else if ( to->getID("Sharp_DTM").isEmpty() ) { // add new
QString fileNameIn = "/tmp/kopitempin";
QFile fileIn( fileNameIn );
- if (!fileIn.open( IO_WriteOnly ) ) {
+ if (!fileIn.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream tsIn( &fileIn );
+ Q3TextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
tsIn << tPrefix << eString ;
fileIn.close();
command = "(cat /tmp/kopitempin | db2file todo -w -g -c " + codec+ ") > "+ fileName;
system ( command.utf8() );
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
answer = ts.read();
file.close();
//qDebug("answer \n%s ", answer.latin1());
getNumFromRecord( answer, to ) ;
}
else { // change existing
//qDebug("canging %d %d",to->zaurusStat() ,to->zaurusId() );
//command = "(echo \"" + ePrefix + eString + "\" ) | db2file datebook -w -g -c " + codec+ " > "+ fileName;
changeString += eString + "\n";
changeEnt = true;
}
}
to = tl.next();
}
status.setText ( i18n("Changing todos ...") );
qApp->processEvents();
//qDebug("changing... ");
if ( changeEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << changeString ;
file.close();
command = "db2file todo -w -g -c " + codec+ " < "+ fileName;
system ( command.latin1() );
//qDebug("command %s file :\n%s ", command.latin1(), changeString.latin1());
}
status.setText ( i18n("Deleting todos ...") );
qApp->processEvents();
//qDebug("deleting... ");
if ( deleteEnt ) {
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
ts << deleteString;
file.close();
command = "db2file todo -d -c " + codec+ " < "+ fileName;
system ( command.latin1() );
// qDebug("command %s file :\n%s ", command.latin1(), deleteString.latin1());
}
return true;
}
QString SharpFormat::dtToString( const QDateTime& dti, bool useTZ )
{
QString datestr;
QString timestr;
int offset = KGlobal::locale()->localTimeOffset( dti );
QDateTime dt;
if (useTZ)
dt = dti.addSecs ( -(offset*60));
else
dt = dti;
if(dt.date().isValid()){
const QDate& date = dt.date();
datestr.sprintf("%04d%02d%02d",
date.year(), date.month(), date.day());
}
if(dt.time().isValid()){
const QTime& time = dt.time();
timestr.sprintf("T%02d%02d%02d",
time.hour(), time.minute(), time.second());
}
return datestr + timestr;
}
@@ -754,65 +754,65 @@ QString SharpFormat::getEventString( Event* event )
list.append( "0" );
list.append( QString::number( rec->frequency() ));//12
list.append( "0" );
list.append( "0" );
writeEndDate = true;
break;
case Recurrence::rWeekly:// 1
list.append( "1" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
{
int days = 0;
QBitArray weekDays = rec->days();
int i;
for( i = 1; i <= 7; ++i ) {
if ( weekDays[i-1] ) {
days += 1 << (i-1);
}
}
list.append( QString::number( days ) );
}
//pending weekdays
writeEndDate = true;
break;
case Recurrence::rMonthlyPos:// 2
list.append( "2" );
list.append( QString::number( rec->frequency()) );//12
writeEndDate = true;
{
int count = 1;
- QPtrList<Recurrence::rMonthPos> rmp;
+ Q3PtrList<Recurrence::rMonthPos> rmp;
rmp = rec->monthPositions();
if ( rmp.first()->negative )
count = 5 - rmp.first()->rPos - 1;
else
count = rmp.first()->rPos - 1;
list.append( QString::number( count ) );
}
list.append( "0" );
break;
case Recurrence::rMonthlyDay:// 3
list.append( "3" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
list.append( "0" );
writeEndDate = true;
break;
case Recurrence::rYearlyMonth://4
list.append( "4" );
list.append( QString::number( rec->frequency()) );//12
list.append( "0" );
list.append( "0" );
writeEndDate = true;
break;
default:
list.append( "255" );
list.append( QString() );
list.append( "0" );
list.append( QString() );
list.append( "0" );
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index cc1c5ae..5a0c32e 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -594,65 +594,65 @@ void Todo::setPercentComplete(int v)
updated();
}
QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
*ok = false;
if ( ! hasDueDate() || cancelled() || !alarmEnabled() ) {
return QDateTime ();
}
// if the recurring todo is set to complete and requested time < start time of todo
// we want to get the alarm.
bool iscompleted = isCompleted();
if ( iscompleted && doesRecur() ) {
Todo * to = (Todo*) this;
to->checkSetCompletedFalse();
iscompleted = isCompleted();
if ( hasStartDate() && start_dt < dtStart() ){
iscompleted = false;
}
}
if ( iscompleted ) {
return QDateTime ();
}
QDateTime incidenceStart;
incidenceStart = dtDue();
bool enabled = false;
Alarm* alarm;
int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
- for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
+ for (Q3PtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
if ( alarmStart > start_dt ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
}
void Todo::checkSetCompletedFalse()
{
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 2131732..cea976c 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -1,75 +1,77 @@
/*
This file is part of libkcal.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef TODO_H
#define TODO_H
//
// Todo component, representing a VTODO object
//
#include "incidence.h"
#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3CString>
namespace KCal {
/**
This class provides a Todo in the sense of RFC2445.
*/
class Todo : public QObject,public Incidence
{
Q_OBJECT
public:
Todo();
Todo(const Todo &);
~Todo();
typedef ListBase<Todo> List;
- QCString type() const { return "Todo"; }
+ Q3CString type() const { return "Todo"; }
IncTypeID typeID() const { return todoID; }
/** Return an exact copy of this todo. */
Incidence *clone();
QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
/** for setting the todo's due date/time with a QDateTime. */
void setDtDue(const QDateTime &dtDue);
/** returns an event's Due date/time as a QDateTime. */
QDateTime dtDue() const;
/** returns an event's due time as a string formatted according to the
users locale settings */
QString dtDueTimeStr() const;
/** returns an event's due date as a string formatted according to the
users locale settings */
QString dtDueDateStr(bool shortfmt=true) const;
/** returns an event's due date and time as a string formatted according
to the users locale settings */
QString dtDueStr(bool shortfmt=true) const;
/** returns TRUE or FALSE depending on whether the todo has a due date */
bool hasDueDate() const;
/** sets the event's hasDueDate value. */
void setHasDueDate(bool f);
/*
Looks for a subtodo (including itself ) which is not complete and is
- overdue, or
- due today.
It returns 0 for nothing found,
1 for found a todo which is due today and no overdue found
2 for found a overdue todo
diff --git a/libkcal/vcaldrag.cpp b/libkcal/vcaldrag.cpp
index f01f332..324981e 100644
--- a/libkcal/vcaldrag.cpp
+++ b/libkcal/vcaldrag.cpp
@@ -1,54 +1,54 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "vcaldrag.h"
#include "vcalformat.h"
using namespace KCal;
VCalDrag::VCalDrag( Calendar *cal, QWidget *parent, const char *name )
- : QStoredDrag( "text/x-vCalendar", parent, name )
+ : Q3StoredDrag( "text/x-vCalendar", parent, name )
{
VCalFormat format;
setEncodedData( format.toString( cal ).utf8() );
}
bool VCalDrag::canDecode( QMimeSource *me )
{
return me->provides( "text/x-vCalendar" );
}
bool VCalDrag::decode( QMimeSource *de, Calendar *cal )
{
bool success = false;
QByteArray payload = de->encodedData( "text/x-vCalendar" );
if ( payload.size() ) {
QString txt = QString::fromUtf8( payload.data() );
VCalFormat format;
success = format.fromString( cal, txt );
}
return success;
}
diff --git a/libkcal/vcaldrag.h b/libkcal/vcaldrag.h
index 3048124..68a320d 100644
--- a/libkcal/vcaldrag.h
+++ b/libkcal/vcaldrag.h
@@ -1,47 +1,47 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef VCALDRAG_H
#define VCALDRAG_H
-#include <qdragobject.h>
+#include <q3dragobject.h>
namespace KCal {
class Calendar;
/** vCalendar drag&drop class. */
-class VCalDrag : public QStoredDrag {
+class VCalDrag : public Q3StoredDrag {
public:
/** Create a drag&drop object for vCalendar component \a vcal. */
VCalDrag( Calendar *vcal, QWidget *parent = 0, const char *name = 0 );
~VCalDrag() {};
/** Return, if drag&drop object can be decode to vCalendar. */
static bool canDecode( QMimeSource * );
/** Decode drag&drop object to vCalendar component \a vcal. */
static bool decode( QMimeSource *e, Calendar *cal );
};
}
#endif
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp
index 2e19740..9cbaf16 100644
--- a/libkcal/vcalformat.cpp
+++ b/libkcal/vcalformat.cpp
@@ -1,61 +1,63 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brwon
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qapplication.h>
#include <qdatetime.h>
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qclipboard.h>
#include <qdialog.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <klocale.h>
#include "vcc.h"
#include "vobject.h"
#include "vcaldrag.h"
#include "calendar.h"
#include "vcalformat.h"
using namespace KCal;
VCalFormat::VCalFormat()
{
mCalendar = 0;
useLocalTime = false;
}
VCalFormat::~VCalFormat()
{
}
void VCalFormat::setLocalTime ( bool b )
{
useLocalTime = b;
}
bool VCalFormat::load(Calendar *calendar, const QString &fileName)
@@ -79,95 +81,95 @@ bool VCalFormat::load(Calendar *calendar, const QString &fileName)
// put all vobjects into their proper places
populate(vcal);
// clean up from vcal API stuff
cleanVObjects(vcal);
cleanStrTbl();
return true;
}
bool VCalFormat::save(Calendar *calendar, const QString &fileName)
{
mCalendar = calendar;
if ( ! useLocalTime )
useLocalTime = mCalendar->isLocalTime();
QString tmpStr;
VObject *vcal, *vo;
vcal = newVObject(VCCalProp);
// addPropValue(vcal,VCLocationProp, "0.0");
addPropValue(vcal,VCProdIdProp, productId());
tmpStr = mCalendar->getTimeZoneStr();
//qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() );
addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit());
addPropValue(vcal,VCVersionProp, _VCAL_VERSION);
// TODO STUFF
- QPtrList<Todo> todoList = mCalendar->rawTodos();
- QPtrListIterator<Todo> qlt(todoList);
+ Q3PtrList<Todo> todoList = mCalendar->rawTodos();
+ Q3PtrListIterator<Todo> qlt(todoList);
for (; qlt.current(); ++qlt) {
vo = eventToVTodo(qlt.current());
addVObjectProp(vcal, vo);
}
// EVENT STUFF
- QPtrList<Event> events = mCalendar->rawEvents();
+ Q3PtrList<Event> events = mCalendar->rawEvents();
Event *ev;
for(ev=events.first();ev;ev=events.next()) {
vo = eventToVEvent(ev);
addVObjectProp(vcal, vo);
}
writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal);
cleanVObjects(vcal);
cleanStrTbl();
if (QFile::exists(fileName)) {
return true;
} else {
return false; // error
}
}
bool VCalFormat::fromString( Calendar *calendar, const QString &text )
{
// TODO: Factor out VCalFormat::fromString()
- QCString data = text.utf8();
+ Q3CString data = text.utf8();
if ( !data.size() ) return false;
VObject *vcal = Parse_MIME( data.data(), data.size());
if ( !vcal ) return false;
VObjectIterator i;
VObject *curvo;
initPropIterator( &i, vcal );
// we only take the first object. TODO: parse all incidences.
do {
curvo = nextVObject( &i );
} while ( strcmp( vObjectName( curvo ), VCEventProp ) &&
strcmp( vObjectName( curvo ), VCTodoProp ) );
if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) {
Event *event = VEventToEvent( curvo );
calendar->addEvent( event );
} else {
qDebug("VCalFormat::fromString(): Unknown object type. ");
deleteVObject( vcal );
return false;
}
deleteVObject( vcal );
return true;
}
QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLocal)
{
@@ -181,210 +183,210 @@ QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLo
QString result( buf );
cleanVObject( vevent );
useLocalTime = useL;
return result;
}
QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal )
{
if ( !todo ) return QString::null;
bool useL = useLocalTime;
useLocalTime = useLocal;
mCalendar = calendar;
VObject *vevent = eventToVTodo( todo );
char *buf = writeMemVObject( 0, 0, vevent );
QString result( buf );
cleanVObject( vevent );
useLocalTime = useL;
return result;
}
QString VCalFormat::toString( Calendar *calendar )
{
// TODO: Factor out VCalFormat::asString()
VObject *vcal = newVObject(VCCalProp);
addPropValue( vcal, VCProdIdProp, CalFormat::productId() );
QString tmpStr = mCalendar->getTimeZoneStr();
addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() );
addPropValue( vcal, VCVersionProp, _VCAL_VERSION );
// TODO: Use all data.
- QPtrList<Event> events = calendar->events();
+ Q3PtrList<Event> events = calendar->events();
Event *event = events.first();
if ( !event ) return QString::null;
VObject *vevent = eventToVEvent( event );
addVObjectProp( vcal, vevent );
char *buf = writeMemVObject( 0, 0, vcal );
QString result( buf );
cleanVObject( vcal );
return result;
}
VObject *VCalFormat::eventToVTodo(const Todo *anEvent)
{
VObject *vtodo;
QString tmpStr;
vtodo = newVObject(VCTodoProp);
// due date
if (anEvent->hasDueDate()) {
tmpStr = qDateTimeToISO(anEvent->dtDue(),
!anEvent->doesFloat());
addPropValue(vtodo, VCDueProp, tmpStr.local8Bit());
}
// start date
if (anEvent->hasStartDate()) {
tmpStr = qDateTimeToISO(anEvent->dtStart(),
!anEvent->doesFloat());
addPropValue(vtodo, VCDTstartProp, tmpStr.local8Bit());
}
// creation date
tmpStr = qDateTimeToISO(anEvent->created());
addPropValue(vtodo, VCDCreatedProp, tmpStr.local8Bit());
// unique id
addPropValue(vtodo, VCUniqueStringProp,
anEvent->uid().local8Bit());
// revision
tmpStr.sprintf("%i", anEvent->revision());
addPropValue(vtodo, VCSequenceProp, tmpStr.local8Bit());
// last modification date
tmpStr = qDateTimeToISO(anEvent->lastModified());
addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit());
// organizer stuff
tmpStr = "MAILTO:" + anEvent->organizer();
addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit());
// attendees
if (anEvent->attendeeCount() != 0) {
- QPtrList<Attendee> al = anEvent->attendees();
- QPtrListIterator<Attendee> ai(al);
+ Q3PtrList<Attendee> al = anEvent->attendees();
+ Q3PtrListIterator<Attendee> ai(al);
Attendee *curAttendee;
for (; ai.current(); ++ai) {
curAttendee = ai.current();
if (!curAttendee->email().isEmpty() &&
!curAttendee->name().isEmpty())
tmpStr = "MAILTO:" + curAttendee->name() + " <" +
curAttendee->email() + ">";
else if (curAttendee->name().isEmpty())
tmpStr = "MAILTO: " + curAttendee->email();
else if (curAttendee->email().isEmpty())
tmpStr = "MAILTO: " + curAttendee->name();
else if (curAttendee->name().isEmpty() &&
curAttendee->email().isEmpty())
kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl;
VObject *aProp = addPropValue(vtodo, VCAttendeeProp, tmpStr.local8Bit());
addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role()));
addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");
addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status()));
}
}
// description BL:
if (!anEvent->description().isEmpty()) {
VObject *d = addPropValue(vtodo, VCDescriptionProp,
anEvent->description().local8Bit());
if (anEvent->description().find('\n') != -1)
addProp(d, VCQuotedPrintableProp);
}
// summary
if (!anEvent->summary().isEmpty())
addPropValue(vtodo, VCSummaryProp, anEvent->summary().local8Bit());
if (!anEvent->location().isEmpty())
addPropValue(vtodo, VCLocationProp, anEvent->location().local8Bit());
// completed
// status
// backward compatibility, KOrganizer used to interpret only these two values
addPropValue(vtodo, VCStatusProp, anEvent->isCompleted() ? "COMPLETED" :
"NEEDS_ACTION");
// completion date
if (anEvent->hasCompletedDate()) {
tmpStr = qDateTimeToISO(anEvent->completed());
addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit());
}
// priority
tmpStr.sprintf("%i",anEvent->priority());
addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedToUid()) {
+ if (!anEvent->relatedToUid().isEmpty()) {
addPropValue(vtodo, VCRelatedToProp,
anEvent->relatedToUid().local8Bit());
}
// categories
QStringList tmpStrList = anEvent->categories();
tmpStr = "";
QString catStr;
for ( QStringList::Iterator it = tmpStrList.begin();
it != tmpStrList.end();
++it ) {
catStr = *it;
if (catStr[0] == ' ')
tmpStr += catStr.mid(1);
else
tmpStr += catStr;
// this must be a ';' character as the vCalendar specification requires!
// vcc.y has been hacked to translate the ';' to a ',' when the vcal is
// read in.
tmpStr += ";";
}
if (!tmpStr.isEmpty()) {
tmpStr.truncate(tmpStr.length()-1);
addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit());
}
// alarm stuff
kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl;
- QPtrList<Alarm> alarms = anEvent->alarms();
+ Q3PtrList<Alarm> alarms = anEvent->alarms();
Alarm* alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
if (alarm->enabled()) {
VObject *a;
tmpStr = qDateTimeToISO(alarm->time());
if (alarm->type() == Alarm::Audio) {
a = addProp(vtodo, VCAAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile()));
}
else if (alarm->type() == Alarm::Procedure) {
a = addProp(vtodo, VCPAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile()));
} else {
a = addProp(vtodo, VCDAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCDisplayStringProp, "beep!");
}
}
}
if (anEvent->pilotId()) {
// pilot sync stuff
tmpStr.sprintf("%i",anEvent->pilotId());
addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit());
tmpStr.sprintf("%i",anEvent->syncStatus());
addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit());
}
@@ -404,94 +406,94 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
!anEvent->doesFloat());
addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit());
// events that have time associated but take up no time should
// not have both DTSTART and DTEND.
if (anEvent->dtStart() != anEvent->dtEnd()) {
tmpStr = qDateTimeToISO(anEvent->dtEnd(),
!anEvent->doesFloat());
addPropValue(vevent, VCDTendProp, tmpStr.local8Bit());
}
// creation date
tmpStr = qDateTimeToISO(anEvent->created());
addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit());
// unique id
addPropValue(vevent, VCUniqueStringProp,
anEvent->uid().local8Bit());
// revision
tmpStr.sprintf("%i", anEvent->revision());
addPropValue(vevent, VCSequenceProp, tmpStr.local8Bit());
// last modification date
tmpStr = qDateTimeToISO(anEvent->lastModified());
addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit());
// attendee and organizer stuff
tmpStr = "MAILTO:" + anEvent->organizer();
addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit());
if (anEvent->attendeeCount() != 0) {
- QPtrList<Attendee> al = anEvent->attendees();
- QPtrListIterator<Attendee> ai(al);
+ Q3PtrList<Attendee> al = anEvent->attendees();
+ Q3PtrListIterator<Attendee> ai(al);
Attendee *curAttendee;
// TODO: Put this functionality into Attendee class
for (; ai.current(); ++ai) {
curAttendee = ai.current();
if (!curAttendee->email().isEmpty() &&
!curAttendee->name().isEmpty())
tmpStr = "MAILTO:" + curAttendee->name() + " <" +
curAttendee->email() + ">";
else if (curAttendee->name().isEmpty())
tmpStr = "MAILTO: " + curAttendee->email();
else if (curAttendee->email().isEmpty())
tmpStr = "MAILTO: " + curAttendee->name();
else if (curAttendee->name().isEmpty() &&
curAttendee->email().isEmpty())
kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl;
VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit());
addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role()));
addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE");
addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status()));
}
}
// recurrence rule stuff
if (anEvent->doesRecur()) {
// some more variables
- QPtrList<Recurrence::rMonthPos> tmpPositions;
- QPtrList<int> tmpDays;
+ Q3PtrList<Recurrence::rMonthPos> tmpPositions;
+ Q3PtrList<int> tmpDays;
int *tmpDay;
Recurrence::rMonthPos *tmpPos;
QString tmpStr2;
int i;
switch(anEvent->recurrence()->doesRecur()) {
case Recurrence::rDaily:
tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency());
// if (anEvent->rDuration > 0)
// tmpStr += "#";
break;
case Recurrence::rWeekly:
tmpStr.sprintf("W%i ",anEvent->recurrence()->frequency());
for (i = 0; i < 7; i++) {
if (anEvent->recurrence()->days().testBit(i))
tmpStr += dayFromNum(i);
}
break;
case Recurrence::rMonthlyPos:
tmpStr.sprintf("MP%i ", anEvent->recurrence()->frequency());
// write out all rMonthPos's
tmpPositions = anEvent->recurrence()->monthPositions();
for (tmpPos = tmpPositions.first();
tmpPos;
tmpPos = tmpPositions.next()) {
tmpStr2.sprintf("%i", tmpPos->rPos);
if (tmpPos->negative)
tmpStr2 += "- ";
else
tmpStr2 += "+ ";
tmpStr += tmpStr2;
@@ -516,65 +518,65 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
tmpStr.sprintf("YM%i ", anEvent->recurrence()->frequency());
// write out all the rYearNums;
tmpDays = anEvent->recurrence()->yearNums();
for (tmpDay = tmpDays.first();
tmpDay;
tmpDay = tmpDays.next()) {
tmpStr2.sprintf("%i ", *tmpDay);
tmpStr += tmpStr2;
}
break;
case Recurrence::rYearlyDay:
tmpStr.sprintf("YD%i ", anEvent->recurrence()->frequency());
// write out all the rYearNums;
tmpDays = anEvent->recurrence()->yearNums();
for (tmpDay = tmpDays.first();
tmpDay;
tmpDay = tmpDays.next()) {
tmpStr2.sprintf("%i ", *tmpDay);
tmpStr += tmpStr2;
}
break;
default:
kdDebug(5800) << "ERROR, it should never get here in eventToVEvent!" << endl;
break;
} // switch
if (anEvent->recurrence()->duration() > 0) {
tmpStr2.sprintf("#%i",anEvent->recurrence()->duration());
tmpStr += tmpStr2;
} else if (anEvent->recurrence()->duration() == -1) {
tmpStr += "#0"; // defined as repeat forever
} else {
- tmpStr += qDateTimeToISO(anEvent->recurrence()->endDate(), FALSE);
+ tmpStr += qDateTimeToISO((QDateTime)anEvent->recurrence()->endDate(), FALSE);
}
addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit());
} // event repeats
// exceptions to recurrence
DateList dateList = anEvent->exDates();
DateList::ConstIterator it;
QString tmpStr2;
for (it = dateList.begin(); it != dateList.end(); ++it) {
tmpStr = qDateToISO(*it) + ";";
tmpStr2 += tmpStr;
}
if (!tmpStr2.isEmpty()) {
tmpStr2.truncate(tmpStr2.length()-1);
addPropValue(vevent, VCExpDateProp, tmpStr2.local8Bit());
}
// description
if (!anEvent->description().isEmpty()) {
VObject *d = addPropValue(vevent, VCDescriptionProp,
anEvent->description().local8Bit());
if (anEvent->description().find('\n') != -1)
addProp(d, VCQuotedPrintableProp);
}
// summary
if (!anEvent->summary().isEmpty())
addPropValue(vevent, VCSummaryProp, anEvent->summary().local8Bit());
if (!anEvent->location().isEmpty())
@@ -596,112 +598,112 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent)
case Incidence::SecrecyConfidential:
text = "CONFIDENTIAL";
break;
}
if (text) {
addPropValue(vevent, VCClassProp, text);
}
// categories
QStringList tmpStrList = anEvent->categories();
tmpStr = "";
QString catStr;
for ( QStringList::Iterator it = tmpStrList.begin();
it != tmpStrList.end();
++it ) {
catStr = *it;
if (catStr[0] == ' ')
tmpStr += catStr.mid(1);
else
tmpStr += catStr;
// this must be a ';' character as the vCalendar specification requires!
// vcc.y has been hacked to translate the ';' to a ',' when the vcal is
// read in.
tmpStr += ";";
}
if (!tmpStr.isEmpty()) {
tmpStr.truncate(tmpStr.length()-1);
addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit());
}
// attachments
// TODO: handle binary attachments!
- QPtrList<Attachment> attachments = anEvent->attachments();
+ Q3PtrList<Attachment> attachments = anEvent->attachments();
for ( Attachment *at = attachments.first(); at; at = attachments.next() )
addPropValue(vevent, VCAttachProp, at->uri().local8Bit());
// resources
tmpStrList = anEvent->resources();
tmpStr = tmpStrList.join(";");
if (!tmpStr.isEmpty())
addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit());
// alarm stuff
- QPtrList<Alarm> alarms = anEvent->alarms();
+ Q3PtrList<Alarm> alarms = anEvent->alarms();
Alarm* alarm;
for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
if (alarm->enabled()) {
VObject *a ;
tmpStr = qDateTimeToISO(alarm->time());
if (alarm->type() == Alarm::Audio) {
a = addProp(vevent, VCAAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile()));
}
if (alarm->type() == Alarm::Procedure) {
a = addProp(vevent, VCPAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile()));
} else {
a = addProp(vevent, VCDAlarmProp);
addPropValue(a, VCRunTimeProp, tmpStr.local8Bit());
addPropValue(a, VCRepeatCountProp, "1");
addPropValue(a, VCDisplayStringProp, "beep!");
}
}
}
// priority
tmpStr.sprintf("%i",anEvent->priority());
addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit());
// transparency
tmpStr.sprintf("%i",anEvent->transparency());
addPropValue(vevent, VCTranspProp, tmpStr.local8Bit());
// related event
- if (anEvent->relatedToUid()) {
+ if (!anEvent->relatedToUid().isEmpty()) {
addPropValue(vevent, VCRelatedToProp,
anEvent->relatedToUid().local8Bit());
}
if (anEvent->pilotId()) {
// pilot sync stuff
tmpStr.sprintf("%i",anEvent->pilotId());
addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit());
tmpStr.sprintf("%i",anEvent->syncStatus());
addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit());
}
return vevent;
}
Todo *VCalFormat::VTodoToEvent(VObject *vtodo)
{
VObject *vo;
VObjectIterator voi;
char *s;
Todo *anEvent = new Todo;
// creation date
if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) {
anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo))));
deleteStr(s);
}
// unique id
vo = isAPropertyOf(vtodo, VCUniqueStringProp);
// while the UID property is preferred, it is not required. We'll use the
@@ -1379,112 +1381,112 @@ Event* VCalFormat::VEventToEvent(VObject *vevent)
}
// related event
if ((vo = isAPropertyOf(vevent, VCRelatedToProp)) != 0) {
anEvent->setRelatedToUid(s = fakeCString(vObjectUStringZValue(vo)));
deleteStr(s);
mEventsRelate.append(anEvent);
}
/* PILOT SYNC STUFF */
if ((vo = isAPropertyOf(vevent, XPilotIdProp))) {
anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo))));
deleteStr(s);
}
else
anEvent->setPilotId(0);
if ((vo = isAPropertyOf(vevent, XPilotStatusProp))) {
anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo))));
deleteStr(s);
}
else
anEvent->setSyncStatus(Event::SYNCMOD);
return anEvent;
}
QString VCalFormat::qDateToISO(const QDate &qd)
{
QString tmpStr;
- ASSERT(qd.isValid());
+ Q_ASSERT(qd.isValid());
tmpStr.sprintf("%.2d%.2d%.2d",
qd.year(), qd.month(), qd.day());
return tmpStr;
}
QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu)
{
QString tmpStr;
- ASSERT(qdt.date().isValid());
- ASSERT(qdt.time().isValid());
+ Q_ASSERT(qdt.date().isValid());
+ Q_ASSERT(qdt.time().isValid());
if (zulu && !useLocalTime ) {
QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60);
tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ",
tmpDT.date().year(), tmpDT.date().month(),
tmpDT.date().day(), tmpDT.time().hour(),
tmpDT.time().minute(), tmpDT.time().second());
} else {
tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d",
qdt.date().year(), qdt.date().month(),
qdt.date().day(), qdt.time().hour(),
qdt.time().minute(), qdt.time().second());
}
return tmpStr;
}
QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr)
{
QDate tmpDate;
QTime tmpTime;
QString tmpStr;
int year, month, day, hour, minute, second;
tmpStr = dtStr;
year = tmpStr.left(4).toInt();
month = tmpStr.mid(4,2).toInt();
day = tmpStr.mid(6,2).toInt();
hour = tmpStr.mid(9,2).toInt();
minute = tmpStr.mid(11,2).toInt();
second = tmpStr.mid(13,2).toInt();
tmpDate.setYMD(year, month, day);
tmpTime.setHMS(hour, minute, second);
- ASSERT(tmpDate.isValid());
- ASSERT(tmpTime.isValid());
+ Q_ASSERT(tmpDate.isValid());
+ Q_ASSERT(tmpTime.isValid());
QDateTime tmpDT(tmpDate, tmpTime);
// correct for GMT if string is in Zulu format
if (dtStr.at(dtStr.length()-1) == 'Z')
tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60);
return tmpDT;
}
QDate VCalFormat::ISOToQDate(const QString &dateStr)
{
int year, month, day;
year = dateStr.left(4).toInt();
month = dateStr.mid(4,2).toInt();
day = dateStr.mid(6,2).toInt();
return(QDate(year, month, day));
}
// take a raw vcalendar (i.e. from a file on disk, clipboard, etc. etc.
// and break it down from it's tree-like format into the dictionary format
// that is used internally in the VCalFormat.
void VCalFormat::populate(VObject *vcal)
{
// this function will populate the caldict dictionary and other event
// lists. It turns vevents into Events and then inserts them.
VObjectIterator i;
VObject *curVO, *curVOProp;
Event *anEvent;
if ((curVO = isAPropertyOf(vcal, ICMethodProp)) != 0) {
char *methodType = 0;
@@ -1619,97 +1621,97 @@ void VCalFormat::populate(VObject *vcal)
const char *VCalFormat::dayFromNum(int day)
{
const char *days[7] = { "MO ", "TU ", "WE ", "TH ", "FR ", "SA ", "SU " };
return days[day];
}
int VCalFormat::numFromDay(const QString &day)
{
if (day == "MO ") return 0;
if (day == "TU ") return 1;
if (day == "WE ") return 2;
if (day == "TH ") return 3;
if (day == "FR ") return 4;
if (day == "SA ") return 5;
if (day == "SU ") return 6;
return -1; // something bad happened. :)
}
Attendee::Role VCalFormat::readRole(const char *s) const
{
QString statStr = s;
statStr = statStr.upper();
Attendee::Role role = Attendee::ReqParticipant;
if ( statStr == "OWNER")
role = Attendee::Chair;
// enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair };
return role;
}
-QCString VCalFormat::writeRole(Attendee::Role role) const
+Q3CString VCalFormat::writeRole(Attendee::Role role) const
{
if ( role == Attendee::Chair )
return "OWNER";
return "ATTENDEE";
}
Attendee::PartStat VCalFormat::readStatus(const char *s) const
{
QString statStr = s;
statStr = statStr.upper();
Attendee::PartStat status;
if (statStr == "X-ACTION")
status = Attendee::NeedsAction;
else if (statStr == "NEEDS ACTION")
status = Attendee::NeedsAction;
else if (statStr== "ACCEPTED")
status = Attendee::Accepted;
else if (statStr== "SENT")
status = Attendee::NeedsAction;
else if (statStr== "TENTATIVE")
status = Attendee::Tentative;
else if (statStr== "CONFIRMED")
status = Attendee::Accepted;
else if (statStr== "DECLINED")
status = Attendee::Declined;
else if (statStr== "COMPLETED")
status = Attendee::Completed;
else if (statStr== "DELEGATED")
status = Attendee::Delegated;
else {
kdDebug(5800) << "error setting attendee mStatus, unknown mStatus!" << endl;
status = Attendee::NeedsAction;
}
return status;
}
-QCString VCalFormat::writeStatus(Attendee::PartStat status) const
+Q3CString VCalFormat::writeStatus(Attendee::PartStat status) const
{
switch(status) {
default:
case Attendee::NeedsAction:
return "NEEDS ACTION";
break;
case Attendee::Accepted:
return "ACCEPTED";
break;
case Attendee::Declined:
return "DECLINED";
break;
case Attendee::Tentative:
return "TENTATIVE";
break;
case Attendee::Delegated:
return "DELEGATED";
break;
case Attendee::Completed:
return "COMPLETED";
break;
case Attendee::InProcess:
return "NEEDS ACTION";
break;
}
}
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h
index 6dae3d2..cac9634 100644
--- a/libkcal/vcalformat.h
+++ b/libkcal/vcalformat.h
@@ -1,57 +1,60 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _VCALFORMAT_H
#define _VCALFORMAT_H
#include "calformat.h"
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#define _VCAL_VERSION "1.0"
class VObject;
namespace KCal {
/**
This class implements the vCalendar format. It provides methods for
loading/saving/converting vCalendar format data into the internal KOrganizer
representation as Calendar and Events.
@short vCalendar format implementation
*/
class VCalFormat : public CalFormat {
public:
VCalFormat();
virtual ~VCalFormat();
/** loads a calendar on disk in vCalendar format into the current calendar.
* any information already present is lost. Returns TRUE if successful,
* else returns FALSE.
* @param fileName the name of the calendar on disk.
*/
bool load(Calendar *,const QString &fileName );
/** writes out the calendar to disk in vCalendar format. Returns true if
* successful and false on error.
* @param fileName the name of the file
*/
bool save(Calendar *,const QString &fileName );
/**
@@ -66,48 +69,48 @@ class VCalFormat : public CalFormat {
QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true );
QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true );
protected:
/** translates a VObject of the TODO type into a Event */
Todo *VTodoToEvent(VObject *vtodo);
/** translates a VObject into a Event and returns a pointer to it. */
Event *VEventToEvent(VObject *vevent);
/** translate a Event into a VTodo-type VObject and return pointer */
VObject *eventToVTodo(const Todo *anEvent);
/** translate a Event into a VObject and returns a pointer to it. */
VObject* eventToVEvent(Event *anEvent);
/** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */
QString qDateToISO(const QDate &);
/** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */
QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE);
/** takes a string in the format YYYYMMDDTHHMMSS and returns a
* valid QDateTime. */
QDateTime ISOToQDateTime(const QString & dtStr);
/** takes a string in the format YYYYMMDD and returns a
* valid QDate. */
QDate ISOToQDate(const QString & dtStr);
/** takes a vCalendar tree of VObjects, and puts all of them that have
* the "event" property into the dictionary, todos in the todo-list, etc. */
void populate(VObject *vcal);
/** takes a number 0 - 6 and returns the two letter string of that day,
* i.e. MO, TU, WE, etc. */
const char *dayFromNum(int day);
/** the reverse of the above function. */
int numFromDay(const QString &day);
- Attendee::Role VCalFormat::readRole(const char *s) const;
- QCString writeRole(Attendee::Role role) const;
+ Attendee::Role readRole(const char *s) const;
+ Q3CString writeRole(Attendee::Role role) const;
Attendee::PartStat readStatus(const char *s) const;
- QCString writeStatus(Attendee::PartStat status) const;
+ Q3CString writeStatus(Attendee::PartStat status) const;
private:
Calendar *mCalendar;
bool useLocalTime;
- QPtrList<Event> mEventsRelate; // events with relations
- QPtrList<Todo> mTodosRelate; // todos with relations
+ Q3PtrList<Event> mEventsRelate; // events with relations
+ Q3PtrList<Todo> mTodosRelate; // todos with relations
};
}
#endif
diff --git a/libkdepim/categoryeditdialog.cpp b/libkdepim/categoryeditdialog.cpp
index e2325d2..92a1737 100644
--- a/libkdepim/categoryeditdialog.cpp
+++ b/libkdepim/categoryeditdialog.cpp
@@ -1,141 +1,142 @@
/*
This file is part of libkdepim.
Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qstringlist.h>
#include <qlineedit.h>
-#include <qlistview.h>
-#include <qheader.h>
+#include <q3listview.h>
+#include <q3header.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include "kpimprefs.h"
#include "categoryeditdialog.h"
using namespace KPIM;
CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent,
const char* name, bool modal,
- WFlags fl )
+ Qt::WFlags fl )
: CategoryEditDialog_base( parent, name, modal, fl ),
mPrefs( prefs )
{
mCategories->header()->hide();
QStringList::Iterator it;
bool categoriesExist=false;
for (it = mPrefs->mCustomCategories.begin();
it != mPrefs->mCustomCategories.end(); ++it ) {
- new QListViewItem(mCategories,*it);
+ new Q3ListViewItem(mCategories,*it);
categoriesExist=true;
}
- connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)),
- SLOT(editItem(QListViewItem *)));
+ connect(mCategories,SIGNAL(selectionChanged(Q3ListViewItem *)),
+ SLOT(editItem(Q3ListViewItem *)));
connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &)));
mButtonRemove->setEnabled(categoriesExist);
mButtonModify->setEnabled(categoriesExist);
#ifndef DESKTOP_VERSION
mButtonOk->hide();
mButtonCancel->hide();
#endif
mButtonAdd->setEnabled(!mEdit->text().isEmpty());
if ( QApplication::desktop()->width() > 460 )
resize( 300, 360 );
else
showMaximized();
}
/*
* Destroys the object and frees any allocated resources
*/
CategoryEditDialog::~CategoryEditDialog()
{
// no need to delete child widgets, Qt does it all for us
}
void CategoryEditDialog::slotTextChanged(const QString &text)
{
mButtonAdd->setEnabled(!text.isEmpty());
}
void CategoryEditDialog::add()
{
if (!mEdit->text().isEmpty()) {
- new QListViewItem(mCategories,mEdit->text());
+ new Q3ListViewItem(mCategories,mEdit->text());
mEdit->setText("");
mButtonRemove->setEnabled(mCategories->childCount()>0);
mButtonModify->setEnabled(mCategories->childCount()>0);
}
}
void CategoryEditDialog::remove()
{
if (mCategories->currentItem()) {
delete mCategories->currentItem();
mButtonRemove->setEnabled(mCategories->childCount()>0);
mButtonModify->setEnabled(mCategories->childCount()>0);
}
}
void CategoryEditDialog::modify()
{
if (!mEdit->text().isEmpty()) {
if (mCategories->currentItem()) {
mCategories->currentItem()->setText(0,mEdit->text());
}
}
}
void CategoryEditDialog::accept()
{
slotOk();
}
void CategoryEditDialog::slotOk()
{
slotApply();
QDialog::accept();
}
void CategoryEditDialog::slotApply()
{
mPrefs->mCustomCategories.clear();
- QListViewItem *item = mCategories->firstChild();
+ Q3ListViewItem *item = mCategories->firstChild();
while(item) {
mPrefs->mCustomCategories.append(item->text(0));
item = item->nextSibling();
}
mPrefs->writeConfig();
emit categoryConfigChanged();
}
-void CategoryEditDialog::editItem(QListViewItem *item)
+void CategoryEditDialog::editItem(Q3ListViewItem *item)
{
mEdit->setText(item->text(0));
mButtonRemove->setEnabled(true);
mButtonModify->setEnabled(true);
}
//US #include "categoryeditdialog.moc"
diff --git a/libkdepim/categoryeditdialog.h b/libkdepim/categoryeditdialog.h
index 9bb3201..828894f 100644
--- a/libkdepim/categoryeditdialog.h
+++ b/libkdepim/categoryeditdialog.h
@@ -1,86 +1,86 @@
/*
This file is part of libkdepim.
Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KPIM_CATEGORYEDITDIALOG_H
#define KPIM_CATEGORYEDITDIALOG_H
#include <categoryeditdialog_base.h>
-#include <qlistview.h>
+#include <q3listview.h>
class KPimPrefs;
namespace KPIM {
- class CategorySelectItem :public QObject, public QCheckListItem
+ class CategorySelectItem :public QObject, public Q3CheckListItem
{
Q_OBJECT
public:
- CategorySelectItem(QListView * parent, const QString & text, Type tt) : QObject( parent ),
- QCheckListItem (parent, text, tt )
+ CategorySelectItem(Q3ListView * parent, const QString & text, Type tt) : QObject( parent ),
+ Q3CheckListItem (parent, text, tt )
{;}
signals:
- void stateChanged( QListViewItem*);
+ void stateChanged( Q3ListViewItem*);
protected:
virtual void stateChange(bool b)
{
- QCheckListItem::stateChange(b);
+ Q3CheckListItem::stateChange(b);
emit stateChanged( this );
}
};
class CategoryEditDialog : public CategoryEditDialog_base
{
Q_OBJECT
public:
CategoryEditDialog( KPimPrefs *prefs, QWidget* parent = 0,
const char* name = 0,
- bool modal = FALSE, WFlags fl = 0 );
+ bool modal = FALSE, Qt::WFlags fl = 0 );
~CategoryEditDialog();
public slots:
void add();
void remove();
void modify();
void accept();
void slotOk();
void slotApply();
signals:
void categoryConfigChanged();
private slots:
- void editItem(QListViewItem *item);
+ void editItem(Q3ListViewItem *item);
void slotTextChanged(const QString &text);
-
+ private:
KPimPrefs *mPrefs;
};
}
#endif
diff --git a/libkdepim/categoryeditdialog_base.cpp b/libkdepim/categoryeditdialog_base.cpp
index 1908576..c85f6e5 100644
--- a/libkdepim/categoryeditdialog_base.cpp
+++ b/libkdepim/categoryeditdialog_base.cpp
@@ -1,100 +1,104 @@
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui'
**
** Created: Sat Mar 29 21:46:09 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "categoryeditdialog_base.h"
#include <qvariant.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qlineedit.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
/*
* Constructs a CategoryEditDialog_base as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
-CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
+CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
: QDialog( parent, name, true, fl )
{
if ( !name )
setName( "CategoryEditDialog_base" );
- CategoryEditDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout");
+ CategoryEditDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout");
mEdit = new QLineEdit( this, "mEdit" );
CategoryEditDialog_baseLayout->addMultiCellWidget( mEdit, 1, 1, 0, 0 );
- Layout13 = new QHBoxLayout( 0, 0, 6, "Layout13");
+ Layout13 = new Q3HBoxLayout( 0, 0, 6, "Layout13");
// mButtonHelp = new QPushButton( this, "mButtonHelp" );
//mButtonHelp->setAutoDefault( TRUE );
//Layout13->addWidget( mButtonHelp );
//QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
//Layout13->addItem( spacer );
//mApply = new QPushButton( this, "mApply" );
// Layout13->addWidget( mApply );
mButtonOk = new QPushButton( this, "mButtonOk" );
mButtonOk->setAutoDefault( TRUE );
mButtonOk->setDefault( TRUE );
Layout13->addWidget( mButtonOk );
mButtonCancel = new QPushButton( this, "mButtonCancel" );
mButtonCancel->setAutoDefault( TRUE );
Layout13->addWidget( mButtonCancel );
CategoryEditDialog_baseLayout->addMultiCellLayout( Layout13, 2, 2, 0, 1 );
- mCategories = new QListView( this, "mCategories" );
+ mCategories = new Q3ListView( this, "mCategories" );
mCategories->addColumn( tr2i18n( "Category" ) );
CategoryEditDialog_baseLayout->addWidget( mCategories, 0, 0 );
- layout103 = new QVBoxLayout( 0, 0, 6, "layout103");
+ layout103 = new Q3VBoxLayout( 0, 0, 6, "layout103");
mButtonAdd = new QPushButton( this, "mButtonAdd" );
CategoryEditDialog_baseLayout->addMultiCellWidget(mButtonAdd , 1, 1, 1, 1 );
//layout103->addWidget( mButtonAdd );
mButtonModify = new QPushButton( this, "mButtonModify" );
layout103->addWidget( mButtonModify );
mButtonRemove = new QPushButton( this, "mButtonRemove" );
layout103->addWidget( mButtonRemove );
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
layout103->addItem( spacer_2 );
CategoryEditDialog_baseLayout->addLayout( layout103, 0, 1 );
languageChange();
resize( sizeHint() );
// signals and slots connections
connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( mButtonAdd, SIGNAL( clicked() ), this, SLOT( add() ) );
connect( mButtonModify, SIGNAL( clicked() ), this, SLOT( modify() ) );
connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) );
connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) );
//connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) );
// tab order
// setTabOrder( mCategories, mEdit );
// setTabOrder( mEdit, mButtonAdd );
// setTabOrder( mButtonAdd, mButtonModify );
// setTabOrder( mButtonModify, mButtonRemove );
// setTabOrder( mButtonRemove, mButtonHelp );
// setTabOrder( mButtonHelp, mApply );
diff --git a/libkdepim/categoryeditdialog_base.h b/libkdepim/categoryeditdialog_base.h
index 5557ad0..cd577b0 100644
--- a/libkdepim/categoryeditdialog_base.h
+++ b/libkdepim/categoryeditdialog_base.h
@@ -1,58 +1,62 @@
/****************************************************************************
** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui'
**
** Created: Sat Mar 29 21:45:20 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef CATEGORYEDITDIALOG_BASE_H
#define CATEGORYEDITDIALOG_BASE_H
#include <qvariant.h>
#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
class QLineEdit;
-class QListView;
-class QListViewItem;
+class Q3ListView;
+class Q3ListViewItem;
class QPushButton;
class CategoryEditDialog_base : public QDialog
{
Q_OBJECT
public:
- CategoryEditDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ CategoryEditDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CategoryEditDialog_base();
QLineEdit* mEdit;
QPushButton* mButtonHelp;
QPushButton* mApply;
QPushButton* mButtonOk;
QPushButton* mButtonCancel;
- QListView* mCategories;
+ Q3ListView* mCategories;
QPushButton* mButtonAdd;
QPushButton* mButtonModify;
QPushButton* mButtonRemove;
public slots:
virtual void add();
virtual void modify();
virtual void slotApply();
virtual void remove();
virtual void slotOk();
protected:
- QGridLayout* CategoryEditDialog_baseLayout;
- QHBoxLayout* Layout13;
- QVBoxLayout* layout103;
+ Q3GridLayout* CategoryEditDialog_baseLayout;
+ Q3HBoxLayout* Layout13;
+ Q3VBoxLayout* layout103;
protected slots:
virtual void languageChange();
};
#endif // CATEGORYEDITDIALOG_BASE_H
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 2a9b43e..4f72880 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -1,246 +1,249 @@
/*
This file is part of libkdepim.
Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
-#include <qlistview.h>
+#include <q3listview.h>
#include <qpushbutton.h>
-#include <qheader.h>
-#include <qapp.h>
+#include <q3header.h>
+#include <qapplication.h>
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QDesktopWidget>
#include <kmessagebox.h>
#include "categoryeditdialog.h"
#include "categoryselectdialog.h"
#include "kpimprefs.h"
using namespace KPIM;
CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
const char* name,
- bool modal, WFlags fl )
+ bool modal, Qt::WFlags fl )
: CategorySelectDialog_base( parent, name, true, fl ),
mPrefs( prefs )
{
Q_UNUSED( modal );
mColorItem = 0;
mColorEnabled = false;
mCategories->header()->hide();
setCategories();
connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
if ( QApplication::desktop()->width() > 460 )
resize( 300, 360 );
else
showMaximized();
connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) );
// connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
#ifndef DESKTOP_VERSION
mButtonOk->hide();
mButtonCancel->hide();
#endif
}
void CategorySelectDialog::editCategoriesDialog()
{
KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
ced->exec();
delete ced;
slotApply();
QStringList temp = mCategoryList;
setCategories();
setSelected( temp );
}
void CategorySelectDialog::setCategories()
{
mColorItem = 0;
mCategories->clear();
mCategoryList.clear();
QStringList::Iterator it;
for (it = mPrefs->mCustomCategories.begin();
it != mPrefs->mCustomCategories.end(); ++it ) {
- CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox);
- QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
+ CategorySelectItem * item = new CategorySelectItem(mCategories,*it,Q3CheckListItem::CheckBox);
+ QObject::connect( item, SIGNAL( stateChanged(Q3ListViewItem *) ), this, SLOT( clicked(Q3ListViewItem *) ) );
}
}
CategorySelectDialog::~CategorySelectDialog()
{
}
void CategorySelectDialog::setSelected(const QStringList &selList)
{
clear();
QStringList::ConstIterator it;
QStringList notFound;
bool found = false;
for (it=selList.begin();it!=selList.end();++it) {
//qDebug(" CategorySelectDialog::setSelected(");
- QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
+ Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild();
while (item) {
if (item->text() == *it) {
item->setOn(true);
if ( ! found )
setColorItem( item );
found = true;
break;
}
- item = (QCheckListItem *)item->nextSibling();
+ item = (Q3CheckListItem *)item->nextSibling();
}
// if ( ! found ) {
//emit updateCategoriesGlobal();
// QMessageBox::information( this, "KO/E: Information!",
// "Categories found, which were not\n"
// "in list of categories!\n"
// "message",
// "OK", "", 0,
// 0, 1 );
// setSelected(selList);
// return;
// }
}
}
QStringList CategorySelectDialog::selectedCategories() const
{
return mCategoryList;
}
void CategorySelectDialog::setColorEnabled()
{
mColorEnabled = true;
mSetColorCat->show();
}
void CategorySelectDialog::setColorCat()
{
- QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem ();
+ Q3CheckListItem * newColorItem = (Q3CheckListItem * )mCategories->currentItem ();
if ( !newColorItem ) {
KMessageBox::error(this,i18n("There is no current item."));
return;
}
if ( !newColorItem->isOn() )
newColorItem->setOn( true );
setColorItem( newColorItem );
}
-void CategorySelectDialog::clicked ( QListViewItem * it )
+void CategorySelectDialog::clicked ( Q3ListViewItem * it )
{
if ( ! it )
return;
- QCheckListItem *i = (QCheckListItem *) it;
+ Q3CheckListItem *i = (Q3CheckListItem *) it;
if ( !i->isOn() && i==mColorItem) {
setColorItem( 0);
- QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
+ Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild();
while (item) {
if (item->isOn()) {
setColorItem( item );
break;
}
- item = (QCheckListItem *)item->nextSibling();
+ item = (Q3CheckListItem *)item->nextSibling();
}
} else if ( i->isOn() && !mColorItem) {
setColorItem( i);
}
}
-void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem )
+void CategorySelectDialog::setColorItem( Q3CheckListItem * newColorItem )
{
if ( !mColorEnabled )
return;
if ( mColorItem == newColorItem)
return;
if ( mColorItem ) {
mColorItem->setPixmap ( 0, QPixmap() );
mColorItem = 0;
}
if ( newColorItem ) {
QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 );
pix.fill(Qt::red );
newColorItem->setPixmap ( 0, pix );
mColorItem = newColorItem;
}
}
void CategorySelectDialog::slotApply()
{
QStringList categories;
- QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
+ Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild();
QString colcat;
while (item) {
if (item->isOn()) {
if ( item == mColorItem)
colcat = item->text();
else
categories.append(item->text());
}
- item = (QCheckListItem *)item->nextSibling();
+ item = (Q3CheckListItem *)item->nextSibling();
}
categories.sort();
if ( ! colcat.isEmpty() )
categories.prepend( colcat );
// QString categoriesStr = categories.join(",");
mCategoryList = categories;
}
void CategorySelectDialog::accept()
{
slotOk();
}
void CategorySelectDialog::slotOk()
{
slotApply();
emit categoriesSelected(mCategoryList);
emit categoriesSelected(mCategoryList.join(","));
QDialog::accept();
}
void CategorySelectDialog::clear()
{
- QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
+ Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild();
while (item) {
item->setOn(false);
- item = (QCheckListItem *)item->nextSibling();
+ item = (Q3CheckListItem *)item->nextSibling();
}
}
void CategorySelectDialog::updateCategoryConfig()
{
QStringList selected;
- QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
+ Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild();
while (item) {
if (item->isOn()) {
selected.append(item->text());
}
- item = (QCheckListItem *)item->nextSibling();
+ item = (Q3CheckListItem *)item->nextSibling();
}
setCategories();
setSelected(selected);
}
//#include "categoryselectdialog.moc"
diff --git a/libkdepim/categoryselectdialog.h b/libkdepim/categoryselectdialog.h
index 680a093..ff7ac58 100644
--- a/libkdepim/categoryselectdialog.h
+++ b/libkdepim/categoryselectdialog.h
@@ -1,75 +1,75 @@
/*
This file is part of libkdepim.
Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KPIM_CATEGORYSELECTDIALOG_H
#define KPIM_CATEGORYSELECTDIALOG_H
#include <categoryselectdialog_base.h>
class KPimPrefs;
-class QCheckListItem;
+class Q3CheckListItem;
namespace KPIM {
class CategorySelectDialog : public CategorySelectDialog_base
{
Q_OBJECT
public:
CategorySelectDialog( KPimPrefs *prefs, QWidget* parent = 0,
const char* name = 0,
- bool modal = FALSE, WFlags fl = 0 );
+ bool modal = FALSE, Qt::WFlags fl = 0 );
~CategorySelectDialog();
void setCategories();
void setColorEnabled();
void setSelected(const QStringList &selList);
QStringList selectedCategories() const;
public slots:
void slotOk();
void slotApply();
void clear();
void accept();
void editCategoriesDialog();
void updateCategoryConfig();
void setColorCat();
- void clicked ( QListViewItem * );
+ void clicked ( Q3ListViewItem * );
signals:
void categoriesSelected(const QString &);
void categoriesSelected(const QStringList &);
void editCategories();
private:
bool mColorEnabled;
KPimPrefs *mPrefs;
QStringList mCategoryList;
- QCheckListItem *mColorItem;
- void setColorItem( QCheckListItem * );
+ Q3CheckListItem *mColorItem;
+ void setColorItem( Q3CheckListItem * );
class CategorySelectDialogPrivate;
CategorySelectDialogPrivate *d;
};
}
#endif
diff --git a/libkdepim/categoryselectdialog_base.cpp b/libkdepim/categoryselectdialog_base.cpp
index 4793fd7..5d53ac4 100644
--- a/libkdepim/categoryselectdialog_base.cpp
+++ b/libkdepim/categoryselectdialog_base.cpp
@@ -1,84 +1,87 @@
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui'
**
** Created: Sat Mar 29 21:46:05 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "categoryselectdialog_base.h"
#include <qvariant.h>
-#include <qheader.h>
-#include <qlistview.h>
+#include <q3header.h>
+#include <q3listview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3HBoxLayout>
/*
* Constructs a CategorySelectDialog_base as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
-CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl )
+CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "CategorySelectDialog_base" );
- CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout");
+ CategorySelectDialog_baseLayout = new Q3VBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout");
- mCategories = new QListView( this, "mCategories" );
+ mCategories = new Q3ListView( this, "mCategories" );
mCategories->addColumn( i18n( "Category" ) );
CategorySelectDialog_baseLayout->addWidget( mCategories );
mSetColorCat = new QPushButton( this, "msetColor" );
CategorySelectDialog_baseLayout->addWidget( mSetColorCat );
- Layout12 = new QHBoxLayout( 0, 0, 4, "Layout12");
+ Layout12 = new Q3HBoxLayout( 0, 0, 4, "Layout12");
mClear = new QPushButton( this, "mClear" );
Layout12->addWidget( mClear );
// QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
//Layout12->addItem( spacer );
mButtonEdit = new QPushButton( this, "mButtonEdit" );
Layout12->addWidget( mButtonEdit );
CategorySelectDialog_baseLayout->addLayout( Layout12 );
- Layout11 = new QHBoxLayout( 0, 0, 4, "Layout11");
+ Layout11 = new Q3HBoxLayout( 0, 0, 4, "Layout11");
//mButtonHelp = new QPushButton( this, "mButtonHelp" );
//Layout11->addWidget( mButtonHelp );
//QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
// Layout11->addItem( spacer_2 );
//mApply = new QPushButton( this, "mApply" );
// Layout11->addWidget( mApply );
mButtonOk = new QPushButton( this, "mButtonOk" );
mButtonOk->setOn( FALSE );
mButtonOk->setDefault( TRUE );
Layout11->addWidget( mButtonOk );
mButtonCancel = new QPushButton( this, "mButtonCancel" );
Layout11->addWidget( mButtonCancel );
CategorySelectDialog_baseLayout->addLayout( Layout11 );
languageChange();
// resize( sizeHint() );
// signals and slots connections
connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) );
connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) );
//connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) );
// tab order
setTabOrder( mCategories, mClear );
setTabOrder( mClear, mButtonEdit );
setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp );
// setTabOrder( mButtonHelp, mApply );
// setTabOrder( mApply, mButtonOk );
diff --git a/libkdepim/categoryselectdialog_base.h b/libkdepim/categoryselectdialog_base.h
index 59ffa22..71d4ce9 100644
--- a/libkdepim/categoryselectdialog_base.h
+++ b/libkdepim/categoryselectdialog_base.h
@@ -1,54 +1,58 @@
/****************************************************************************
** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui'
**
** Created: Sat Mar 29 21:45:20 2003
** by: The User Interface Compiler ()
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef CATEGORYSELECTDIALOG_BASE_H
#define CATEGORYSELECTDIALOG_BASE_H
#include <qvariant.h>
#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QListView;
-class QListViewItem;
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
+class Q3ListView;
+class Q3ListViewItem;
class QPushButton;
class CategorySelectDialog_base : public QDialog
{
Q_OBJECT
public:
- CategorySelectDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ CategorySelectDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CategorySelectDialog_base();
- QListView* mCategories;
+ Q3ListView* mCategories;
QPushButton* mClear;
QPushButton* mButtonEdit;
QPushButton* mButtonHelp;
QPushButton* mApply;
QPushButton* mButtonOk;
QPushButton* mButtonCancel;
QPushButton* mSetColorCat;
public slots:
virtual void clear();
virtual void slotApply();
virtual void slotOk();
protected:
- QVBoxLayout* CategorySelectDialog_baseLayout;
- QHBoxLayout* Layout12;
- QHBoxLayout* Layout11;
+ Q3VBoxLayout* CategorySelectDialog_baseLayout;
+ Q3HBoxLayout* Layout12;
+ Q3HBoxLayout* Layout11;
protected slots:
virtual void languageChange();
};
#endif // CATEGORYSELECTDIALOG_BASE_H
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index f376e6c..3fc548a 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -10,65 +10,67 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <stdlib.h>
#include <qfile.h>
#include <qtimer.h>
#include <qmap.h>
#include <qregexp.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <qtopia/qcopenvelope_qws.h>
#else
#include <qapplication.h>
-#include <qprocess.h>
+#include <q3process.h>
+//Added by qt3to4:
+#include <Q3CString>
#endif
#include <kstaticdeleter.h>
#include <kmessagebox.h>
#include "externalapphandler.h"
#include "kpimglobalprefs.h"
//uncomment line to get debug output
//#define DEBUG_EXT_APP_HANDLER
/*********************************************************************************
*
********************************************************************************/
QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
: _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage)
{
//sourceMessage passes later three parameters: sourceChannel, uid, param1
if (_usedSourceParameters == 0)
_sourceMessageParameters = "QString,QString)";
else if (_usedSourceParameters == 1)
_sourceMessageParameters = "(QString,QString,QString)";
else if (_usedSourceParameters == 2)
_sourceMessageParameters = "(QString,QString,QString,QString)";
else if (_usedSourceParameters == 3)
_sourceMessageParameters = "(QString,QString,QString,QString,QString)";
}
@@ -94,88 +96,88 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa
e << _sourceChannel << uid;
if (_usedSourceParameters == 1)
e << param1;
else if (_usedSourceParameters == 2)
e << param1 << param2;
else if (_usedSourceParameters == 3)
e << param1 << param2 << param3;
qApp->processEvents();
return true;
#else
KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
return false;
#endif
}
/*********************************************************************************/
void QCopTransferItem::setSourceChannel(const QString& sourceChannel)
{
if ( !sourceChannel.isEmpty())
_sourceChannel = sourceChannel;
}
/*********************************************************************************/
-bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
+bool QCopTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data )
{
// copied from old mail2
/*
static int ii = 0;
// block second call
if ( ii < 2 ) {
++ii;
if ( ii > 1 ) {
qDebug("qcop call blocked ");
return true;
}
}
*/
// qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() );
//we are in the target and get a request from the source
if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data())
{
- QDataStream stream( data, IO_ReadOnly );
+ QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
QString sourceChannel;
QString uid;
QString param1;
QString param2;
QString param3;
stream >> sourceChannel >> uid;
if (_usedSourceParameters == 0)
{
emit receivedMessageFromSource(sourceChannel, uid);
}
else if (_usedSourceParameters == 1)
{
stream >> param1;
emit receivedMessageFromSource(sourceChannel, uid, param1);
}
else if (_usedSourceParameters == 2)
{
stream >> param1 >> param2;
emit receivedMessageFromSource(sourceChannel, uid, param1, param2);
}
else if (_usedSourceParameters == 3)
{
stream >> param1 >> param2 >> param3;
emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3);
}
return true;
}
@@ -197,71 +199,71 @@ QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString
}
/*********************************************************************************/
bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap)
{
#ifndef DESKTOP_VERSION
//targetMessage passes two parameters: uid, map
QString targetMessage = _targetMessage + _targetMessageParameters;
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1());
#endif
QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
//US we need no names in the To field. The emailadresses are enough
e << uid << nameEmailMap;
qApp->processEvents();
return true;
#else
KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
return false;
#endif
}
/*********************************************************************************/
-bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
+bool QCopMapTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data )
{
bool res = QCopTransferItem::appMessage( cmsg, data );
if (res == false)
{
- QDataStream stream( data, IO_ReadOnly );
+ QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() );
//we are in the source and get an answer from the target
if ((_targetMessage + _targetMessageParameters) == cmsg.data())
{
QMap<QString,QString> adrMap;
QString uid;
stream >> uid >> adrMap;
emit receivedMessageFromTarget(uid, adrMap);
return true;
}
}
return false;
}
/*********************************************************************************
*
********************************************************************************/
QCopListTransferItem::~QCopListTransferItem()
{
}
QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
@@ -276,74 +278,74 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString
{
#ifndef DESKTOP_VERSION
//targetMessage passes two parameters: uid, map
QString targetMessage = _targetMessage + _targetMessageParameters;
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1());
for ( int i = 0; i < list3.count(); i++)
qDebug("listentry list3: %s",list3[i].latin1());
#endif
QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
//US we need no names in the To field. The emailadresses are enough
e << uid << list1 << list2 << list3 << list4 << list5 << list6;
qApp->processEvents();
return true;
#else
KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
return false;
#endif
}
/*********************************************************************************/
-bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
+bool QCopListTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data )
{
bool res = QCopTransferItem::appMessage( cmsg, data );
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
#endif
if (res == false)
{
- QDataStream stream( data, IO_ReadOnly );
+ QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly );
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
#endif
//we are in the source and get an answer from the target
if ((_targetMessage + _targetMessageParameters) == cmsg.data())
{
QStringList list1;
QStringList list2;
QStringList list3;
QStringList list4;
QStringList list5;
QStringList list6;
QString uid;
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
#endif
stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6;
emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6);
return true;
}
}
return false;
}
@@ -489,67 +491,67 @@ void ExternalAppHandler::loadConfig()
//pagerclients
addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined);
addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined);
//sipclients
addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined);
addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined);
if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
( QFile::exists( opiepath + "/bin/kppi" )))
addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
}
ExternalAppHandler *ExternalAppHandler::instance()
{
if ( !sInstance ) {
sInstance = staticDeleter.setObject( new ExternalAppHandler() );
sInstance->loadConfig();
}
return sInstance;
}
void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2)
{
DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2);
// qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() );
mDefaultItems.append(dai);
}
-QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type)
+Q3PtrList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type)
{
- QList<DefaultAppItem> list;
+ Q3PtrList<DefaultAppItem> list;
DefaultAppItem* dai;
for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
{
if (dai->_type == type)
list.append(dai);
}
return list;
}
DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
{
DefaultAppItem* dai;
for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
{
if (dai->_type == type && dai->_id == clientid)
return dai;
}
return 0;
}
bool ExternalAppHandler::isEmailAppAvailable()
{
if (mEmailAppAvailable == UNDEFINED)
{
int client = KPimGlobalPrefs::instance()->mEmailClient;
if (client == KPimGlobalPrefs::NONE_EMC)
@@ -717,169 +719,169 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS
int client = KPimGlobalPrefs::instance()->mEmailClient;
if (client == KPimGlobalPrefs::OTHER_EMC)
{
channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
message = KPimGlobalPrefs::instance()->mEmailOtherMessage;
message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage2;
parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters2;
}
else
{
DefaultAppItem* dai = getDefaultItem(EMAIL, client);
if (!dai)
{
qDebug("could not find configured email application.");
return false;
}
channel = dai->_channel;
message2 = dai->_message2;
parameters2 = dai->_parameters2;
message = dai->_message;
parameters = dai->_parameters;
}
//first check if one of the mailers need the emails right in the message.
message2 = translateMessage(message2, emails, urls);
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1());
qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1());
#endif
qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() );
//KMessageBox::sorry( 0, message2 );
- QProcess * proc = new QProcess( this );
+ Q3Process * proc = new Q3Process( this );
int i = 0;
proc->addArgument( channel );
if ( message.find (" " ) > 0 ) {
QStringList list = QStringList::split( " ", message );
int i = 0;
while ( i < list.count ( ) ) {
//qDebug("add%sdd ",list[i].latin1() );
proc->addArgument( list[i] );
//KMessageBox::sorry( 0,list[i]);
++i;
}
} else {
proc->addArgument(message );
//KMessageBox::sorry( 0, message );
}
parameters2 = translateMessage(parameters2, urls, "" );
QString arg = "to='%1'";
arg = arg.arg( emails ) + ","+parameters2;;
//KMessageBox::sorry( 0,arg );
//qDebug("2add%sdd ",arg.latin1() );
proc->addArgument( arg);
- proc->launch("");
+ proc->launch(QString());
#endif
return true;
}
/**************************************************************************
*
**************************************************************************/
//calls the emailapplication and creates a mail with parameter emails as recipients
bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress )
{
QString channel;
QString message;
QString parameters;
int client = KPimGlobalPrefs::instance()->mEmailClient;
if (client == KPimGlobalPrefs::OTHER_EMC)
{
channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
message = KPimGlobalPrefs::instance()->mEmailOtherMessage;
parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
}
else
{
DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client);
if (!dai)
{
qDebug("could not find configured email application.");
return false;
}
channel = dai->_channel;
message = dai->_message;
parameters = dai->_parameters;
}
#ifdef DESKTOP_VERSION
//message = channel + " " +message + " \""+ parameters + "\"";
#endif
//first check if one of the mailers need the emails right in the message.
message = translateMessage(message, name, emailadress);
#ifdef DEBUG_EXT_APP_HANDLER
qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1());
#endif
#ifndef DESKTOP_VERSION
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameters(&e, parameters, name, emailadress);
#else // DESKTOP_VERSION
//KMessageBox::sorry( 0,channel );
- QProcess * proc = new QProcess( this );
+ Q3Process * proc = new Q3Process( this );
proc->addArgument( channel );
if ( message.find (" " ) > 0 ) {
QStringList list = QStringList::split( " ", message );
int i = 0;
while ( i < list.count ( ) ) {
//qDebug("add%sdd ",list[i].latin1() );
proc->addArgument( list[i] );
//KMessageBox::sorry( 0,list[i]);
++i;
}
} else {
proc->addArgument(message );
}
parameters = translateMessage(parameters, name, emailadress);
//KMessageBox::information(0,parameters);
proc->addArgument( parameters );
- proc->launch("");
+ proc->launch(QString());
#endif
return true;
}
/**************************************************************************
*
**************************************************************************/
//calls the emailapplication and creates a mail with parameter as recipients
// parameters format is
// NAME <EMAIL>:SUBJECT
bool ExternalAppHandler::mailToOneContact( const QString& adressline )
{
QString line = adressline;
int first = line.find( "<");
int last = line.find( ">");
QString name = line.left(first);
QString emailadress = line.mid(first+1, last-first-1);
//Subject can not be handled right now.
return mailToOneContact( name, emailadress );
}
/**************************************************************************
*
**************************************************************************/
//calls the phoneapplication with the number
@@ -1203,65 +1205,65 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete
key = key.replace( QRegExp("%2"), param2 );
++it2;
if(it2 != keyvallist.end())
{
QString value = (*it2);
value = value.replace( QRegExp("%1"), param1 );
value = value.replace( QRegExp("%2"), param2 );
valmap.insert(key, value);
useValMap = true;
}
else
{
// qDebug("pass parameter << %s", key.latin1());
(*e) << key;
}
}
if (useValMap == true)
(*e) << valmap;
#endif
}
/**************************************************************************
*
**************************************************************************/
-void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
+void ExternalAppHandler::appMessage( const Q3CString& cmsg, const QByteArray& data )
{
qDebug("ExternalAppHandler::appMessage %s %x", cmsg.data(), this);
if ( cmsg == "nextView()" ) {
qDebug("nextView()");
QTimer::singleShot( 0, this, SIGNAL ( nextView() ));
return;
}
if ( cmsg == "callContactdialog()" ) {
qDebug("callContactdialog()");
QTimer::singleShot( 0, this, SIGNAL ( callContactdialog() ));
return;
}
if ( cmsg == "doRingSync" ) {
qDebug("doRingSync");
QTimer::singleShot( 0, this, SIGNAL ( doRingSync() ));
return;
}
bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
if (!res)
res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data );
if (!res)
res = mDisplayDetails->appMessage( cmsg, data );
// if (!res)
// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
}
bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index b899ad7..3247fe4 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -5,135 +5,138 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef EXTERNALAPPHANDLER_H
#define EXTERNALAPPHANDLER_H
#include <qobject.h>
#include <qlist.h>
#include <qmap.h>
+#include <Q3PtrList>
+//Added by qt3to4:
+#include <Q3CString>
class QCopEnvelope;
class ExternalAppHandler;
class QCopTransferItem : public QObject
{
Q_OBJECT
public:
QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
QCopTransferItem();
bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
void setSourceChannel(const QString& sourceChannel);
- virtual bool appMessage( const QCString& msg, const QByteArray& data );
+ virtual bool appMessage( const Q3CString& msg, const QByteArray& data );
signals:
void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1);
void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2);
void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
public:
int _usedSourceParameters;
QString _sourceChannel;
QString _sourceMessage;
QString _sourceMessageParameters;
QString _targetChannel;
QString _targetMessage;
QString _targetMessageParameters;
};
/*********************************************************************************
*
********************************************************************************/
class QCopMapTransferItem : public QCopTransferItem
{
Q_OBJECT
public:
QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
- virtual bool appMessage( const QCString& msg, const QByteArray& data );
+ virtual bool appMessage( const Q3CString& msg, const QByteArray& data );
signals:
void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
};
/*********************************************************************************
*
********************************************************************************/
class QCopListTransferItem : public QCopTransferItem
{
Q_OBJECT
public:
QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
~QCopListTransferItem();
bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6);
- virtual bool appMessage( const QCString& msg, const QByteArray& data );
+ virtual bool appMessage( const Q3CString& msg, const QByteArray& data );
signals:
void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6);
};
/*********************************************************************************
*
********************************************************************************/
class DefaultAppItem
{
public:
DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2)
: _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2)
{ }
DefaultAppItem()
{ }
public:
int _type;
int _id;
QString _label;
QString _channel;
QString _message;
QString _parameters; // a list of parameters in stringrepresentation. Delimiter is ;
QString _message2;
QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ;
@@ -196,99 +199,99 @@ class ExternalAppHandler : public QObject
bool isEmailAppAvailable();
bool isSMSAppAvailable();
bool isPhoneAppAvailable();
bool isFaxAppAvailable();
bool isPagerAppAvailable();
bool isSIPAppAvailable();
//Call this method on the source when you want to select names from the addressbook by using QCop
bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
//Call this method on the target when you want to return the name/email map to the source (client).
bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email);
bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid);
bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid,
const QStringList& birthdayList, const QStringList& anniversaryList,
const QStringList& realNameList, const QStringList& emailList,
const QStringList& assembledNameList, const QStringList& uidList);
//loadConfig clears the cache and checks again if the applications are available or not
void loadConfig();
- QList<DefaultAppItem> getAvailableDefaultItems(Types);
+ Q3PtrList<DefaultAppItem> getAvailableDefaultItems(Types);
DefaultAppItem* getDefaultItem(Types, int);
public slots:
- void appMessage( const QCString& msg, const QByteArray& data );
+ void appMessage( const Q3CString& msg, const QByteArray& data );
signals:
void callContactdialog();
void nextView();
void doRingSync();
// Emmitted when the target app receives a request from the source app
void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
// Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
// The first parameter is a uniqueid. It can be used to identify the event
void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
// Emmitted when the target app receives a request from the source app
void requestForBirthdayList(const QString& sourceChannel, const QString& uid);
// Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
// The first parameter is a uniqueid. It can be used to identify the event
void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList,
const QStringList& anniversaryList, const QStringList& realNameList,
const QStringList& emailList, const QStringList& assembledNameList,
const QStringList& uidList);
private:
ExternalAppHandler();
- QList<DefaultAppItem> mDefaultItems;
+ Q3PtrList<DefaultAppItem> mDefaultItems;
Availability mEmailAppAvailable;
Availability mPhoneAppAvailable;
Availability mFaxAppAvailable;
Availability mSMSAppAvailable;
Availability mPagerAppAvailable;
Availability mSIPAppAvailable;
QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
QCopListTransferItem* mFindByEmailFromKAPITransfer;
QCopTransferItem* mDisplayDetails;
QCopListTransferItem* mBirthdayListFromKAPITransfer;
void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);
QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const;
static ExternalAppHandler *sInstance;
private slots:
void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& );
};
#endif
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
index 5094830..9f47766 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -1,80 +1,82 @@
/*
This file is part of KDEPim/Pi.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kdebug.h>
//#include <klocale.h>
//#include <stdlib.h>
#include "kdepimconfigwidget.h"
#include "kcmkdepimconfig.h"
#include "kprefs.h"
#include "kpimglobalprefs.h"
#ifndef _WIN32_
extern "C"
{
KCModule *create_kdepimconfig(QWidget *parent, const char * ) {
return new KCMKdePimConfig(parent, "kcmkdepimconfig" );
}
}
#endif
KCMKdePimConfig::KCMKdePimConfig(QWidget *parent, const char *name )
: KCModule( KPimGlobalPrefs::instance(), parent, name )
{
//abort();
- QVBoxLayout *layout = new QVBoxLayout( this );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this );
mConfigWidget = new KDEPIMConfigWidget( (KPimGlobalPrefs*)getPreferences(), this, "KDEPIMConfigWidget" );
layout->addWidget( mConfigWidget );
layout->setSpacing( 0 );
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}
void KCMKdePimConfig::load()
{
mConfigWidget->readConfig();
}
void KCMKdePimConfig::save()
{
mConfigWidget->writeConfig();
}
void KCMKdePimConfig::defaults()
{
qDebug("KCMKdePimConfig::defaults()");
mConfigWidget->setDefaults();
}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 292951b..11a2b45 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -2,234 +2,239 @@
This file is part of KdePim/Pi.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <qlayout.h>
#include <qtabwidget.h>
#include <qcombobox.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qcheckbox.h>
#include <qfile.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qdir.h>
#include <qregexp.h>
#include <qspinbox.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
#include <kdialog.h>
#include <kprefsdialog.h>
#include <klocale.h>
#include <kglobalsettings.h>
#include <kdateedit.h>
#include <kglobal.h>
#include <stdlib.h>
/*US
#include <qcheckbox.h>
#include <qframe.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qfile.h>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#ifndef KAB_EMBEDDED
#include <ktrader.h>
#else // KAB_EMBEDDED
#include <mergewidget.h>
#include <distributionlistwidget.h>
#endif // KAB_EMBEDDED
#include "addresseewidget.h"
#include "extensionconfigdialog.h"
#include "extensionwidget.h"
*/
#include "qapplication.h"
#include "kpimglobalprefs.h"
#include "kdepimconfigwidget.h"
#include <kprefs.h>
#include <kmessagebox.h>
KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
: KPrefsWidget(prefs, parent, name )
{
mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
- QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0,
KDialog::spacingHint() );
tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
setupLocaleTab();
setupLocaleDateTab();
setupTimeZoneTab();
setupExternalAppTab();
setupStoreTab();
setupBackupTab();
}
void KDEPIMConfigWidget::showTimeZoneTab()
{
tabWidget->setCurrentPage ( 3 ) ;
}
void KDEPIMConfigWidget::setupBackupTab()
{
- QVBox *colorPage = new QVBox( this );
+ Q3VBox *colorPage = new Q3VBox( this );
tabWidget->addTab( colorPage, i18n( "Backup" ) );
QWidget* topFrame = new QWidget( colorPage );
- QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout(topFrame);
KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"),
&(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame);
topLayout->addWidget((QWidget*)sb->checkBox());
QWidget* bupFrame = new QWidget( topFrame );
topLayout->addWidget((bupFrame));
QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) );
- QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame);
+ Q3VBoxLayout *bupLayout = new Q3VBoxLayout(bupFrame);
sb = addWidBool(i18n("Use standard backup dir"),
&(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame);
bupLayout->addWidget((QWidget*)sb->checkBox());
mBackupUrl = new KURLRequester( bupFrame );
mBackupUrl->setPathIsDir();
mBackupUrl->setURL( KGlobalSettings::backupDataDir() );
QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) );
bupLayout->addWidget( mBackupUrl );
mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir );
bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled );
- QHBox *dummy = new QHBox(bupFrame);
+ Q3HBox *dummy = new Q3HBox(bupFrame);
new QLabel(i18n("Number of Backups:"),dummy);
mBackupNumbersSpin = new QSpinBox(1,21,1,dummy);
new QLabel(i18n(" "),dummy);
bupLayout->addWidget( dummy );
- dummy = new QHBox(bupFrame);
+ dummy = new Q3HBox(bupFrame);
new QLabel(i18n("Make backup every "),dummy);
mBackupDayCountSpin = new QSpinBox(1,28,1,dummy);
new QLabel(i18n(" days"),dummy);
new QLabel(i18n(" "),dummy);
bupLayout->addWidget( dummy );
QString localKdeDir;
localKdeDir = readEnvPath("LOCALMICROKDEHOME");
if ( ! localKdeDir.isEmpty() ) {
sb->checkBox()->setEnabled( false );
sb->checkBox()->setChecked( true );
mBackupUrl->setEnabled( false );
KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true;
}
}
void KDEPIMConfigWidget::setupStoreTab()
{
- QVBox *colorPage = new QVBox( this );
+ Q3VBox *colorPage = new Q3VBox( this );
tabWidget->addTab( colorPage, i18n( "Colors" ) );
QWidget* cw = new QWidget( colorPage );
KPrefsWidColor *holidayColor =
addWidColor(i18n("Alternating background of list views"),
&(KPimGlobalPrefs::instance()->mAlternateColor),cw);
- QHBoxLayout *topLayout = new QHBoxLayout(cw);
+ Q3HBoxLayout *topLayout = new Q3HBoxLayout(cw);
topLayout->addWidget(holidayColor->label());
topLayout->addWidget( (QWidget* )holidayColor->button());
- QVBox *storePage = new QVBox( this );
+ Q3VBox *storePage = new Q3VBox( this );
if ( QApplication::desktop()->height() > 240 )
new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage );
new QLabel( i18n("<b>New data storage dir:</b>"), storePage );
mStoreUrl = new KURLRequester( storePage );
mStoreUrl->setPathIsDir();
mStoreUrl->setURL( KGlobal::dirs()->localkdedir() );
#ifdef DESKTOP_VERSION
QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ;
QFileInfo fi ( confFile );
if ( fi.exists() ) {
KConfig cfg ( confFile );
cfg.setGroup("Global");
QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" );
if ( localKdeDir != "x_x_x" ) {
mStoreUrl->setURL( localKdeDir );
qDebug("Reading config from %s ", confFile.latin1());
}
}
#endif
new QLabel( i18n("New dirs are created automatically"), storePage );
- QHBox *bb = new QHBox( storePage );
+ Q3HBox *bb = new Q3HBox( storePage );
QPushButton * pb;
if ( QApplication::desktop()->width() < 640 )
pb = new QPushButton ( i18n("Save"), bb );
else
pb = new QPushButton ( i18n("Save settings"), bb );
connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) );
pb = new QPushButton ( i18n("Save standard"), bb );
connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) );
#ifdef DESKTOP_VERSION
pb = new QPushButton ( i18n("Save using LOCAL storage"), bb );
connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) );
#endif
new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage );
mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage );
tabWidget->addTab( storePage, i18n( "Data storage path" ) );
#ifdef DESKTOP_VERSION
if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) {
mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" ));
}
#endif
}
void KDEPIMConfigWidget::setLocalStore()
{
mStoreUrl->setURL( "LOCAL:kdepimpi" );
saveStoreSettings();
QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data.");
KMessageBox::information( this, message);
}
void KDEPIMConfigWidget::setStandardStore()
{
mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
@@ -241,81 +246,81 @@ void KDEPIMConfigWidget::saveStoreSettings()
if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) {
QString file = qApp->applicationDirPath ()+"/.microkdehome";
QFileInfo fi ( file );
if ( fi.exists() ) {
bool res = QFile::remove( file );
if ( ! res )
KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file ));
}
}
#endif
if ( !mStoreUrl->url().isEmpty() ) {
QString path = QDir::homeDirPath();
QString url = mStoreUrl->url();
#ifdef DESKTOP_VERSION
if ( url.startsWith( "LOCAL:" ) ) {
path = qApp->applicationDirPath () ;
}
#endif
KConfig cfg ( path + "/.microkdehome" );
cfg.setGroup("Global");
cfg.writeEntry( "MICROKDEHOME", url );
qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1());
cfg.sync();
mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" ));
} else {
mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" );
saveStoreSettings();
}
}
void KDEPIMConfigWidget::setupExternalAppTab()
{
QWidget *externalAppsPage = new QWidget( this );
- QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
+ Q3VBoxLayout* layout = new Q3VBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
KDialog::spacingHintSmall() );
mExternalApps = new QComboBox( externalAppsPage );
QMap<ExternalAppHandler::Types, QString>::Iterator it;
for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
mExternalApps->insertItem( it.data(), it.key() );
layout->addWidget( mExternalApps );
connect( mExternalApps, SIGNAL( activated( int ) ),
this, SLOT (externalapp_changed( int ) ) );
- mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
- QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
+ mExternalAppGroupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
+ Q3GridLayout *boxLayout = new Q3GridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
mExternalAppGroupBox->layout()->setMargin(4);
mClient = new QComboBox( mExternalAppGroupBox );
boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
connect( mClient, SIGNAL( activated( int ) ),
this, SLOT (client_changed( int ) ) );
QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 1, 0 );
mChannel = new QLineEdit(mExternalAppGroupBox);
mChannel->setReadOnly(true);
boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 3, 0 );
mMessage = new QLineEdit(mExternalAppGroupBox);
mMessage->setReadOnly(true);
boxLayout->addWidget( mMessage , 4, 0);
lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 3, 1 );
mParameters = new QLineEdit(mExternalAppGroupBox);
mParameters->setReadOnly(true);
boxLayout->addWidget( mParameters, 4, 1 );
lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
if ( QApplication::desktop()->height() > 240 ) {
lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 6, 0 );
@@ -323,65 +328,65 @@ void KDEPIMConfigWidget::setupExternalAppTab()
mMessage2->setReadOnly(true);
boxLayout->addWidget( mMessage2 , 7, 0);
lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
boxLayout->addWidget( lab, 6, 1 );
mParameters2 = new QLineEdit(mExternalAppGroupBox);
mParameters2->setReadOnly(true);
boxLayout->addWidget( mParameters2, 7, 1 );
lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
} else {
mMessage2 = 0;
mParameters2 = 0;
}
connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
layout->addWidget( mExternalAppGroupBox );
tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
}
void KDEPIMConfigWidget::setupLocaleDateTab()
{
QWidget *topFrame = new QWidget( this );
- QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
+ Q3GridLayout *topLayout = new Q3GridLayout( topFrame, 3, 2);
topLayout->setSpacing(KDialog::spacingHintSmall());
topLayout->setMargin(KDialog::marginHintSmall());
int iii = 0;
KPrefsWidRadios *syncPrefsGroup =
addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
QString format;
if ( QApplication::desktop()->width() < 480 )
format = "(%d.%m.%Y)";
else
format = "(%d.%m.%Y|%A %d %B %Y)";
syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%m.%d.%Y)";
else
format = "(%m.%d.%Y|%A %B %d %Y)";
syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
if ( QApplication::desktop()->width() < 480 )
format = "(%Y-%m-%d)";
else
format = "(%Y-%m-%d|%A %Y %B %d)";
syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
syncPrefsGroup->addRadio(i18n("User defined"));
if ( QApplication::desktop()->width() < 480 ) {
syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
}
topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
++iii;
@@ -391,128 +396,128 @@ void KDEPIMConfigWidget::setupLocaleDateTab()
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatLong,iii,1);
++iii;
mUserDateFormatShort = new QLineEdit(topFrame);
lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mUserDateFormatShort,iii,1);
++iii;
lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
//qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() );
if ( QApplication::desktop()->height() > 240 ) {
lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
++iii;
}
connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
tabWidget->addTab( topFrame, i18n( "Date Format" ) );
}
void KDEPIMConfigWidget::setupLocaleTab()
{
QWidget *topFrame = new QWidget( this );
- QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(KDialog::spacingHint());
topLayout->setMargin(KDialog::marginHint());
int iii = 0;
KPrefsWidRadios *syncPrefsGroup =
addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
syncPrefsGroup->addRadio(i18n("English"));
syncPrefsGroup->addRadio(i18n("German"));
syncPrefsGroup->addRadio(i18n("French"));
syncPrefsGroup->addRadio(i18n("Italian"));
syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
if ( QApplication::desktop()->width() < 300 ) {
syncPrefsGroup->groupBox()->layout()->setMargin( 5 );
syncPrefsGroup->groupBox()->layout()->setSpacing( 0 );
}
topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
tabWidget->addTab( topFrame, i18n( "Language" ) );
topFrame = new QWidget( this );
- topLayout = new QGridLayout(topFrame,4,2);
+ topLayout = new Q3GridLayout(topFrame,4,2);
topLayout->setSpacing(KDialog::spacingHint());
topLayout->setMargin(KDialog::marginHint());
iii = 0;
syncPrefsGroup =
addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
if ( QApplication::desktop()->width() > 300 )
syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
syncPrefsGroup->addRadio(i18n("24:00"));
syncPrefsGroup->addRadio(i18n("12:00am"));
syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
++iii;
KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
&(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
++iii;
tabWidget->addTab( topFrame, i18n( "Time Format" ) );
}
void KDEPIMConfigWidget::setupTimeZoneTab()
{
QWidget *topFrame;
- QGridLayout *topLayout ;
+ Q3GridLayout *topLayout ;
topFrame = new QWidget( this );
- topLayout = new QGridLayout( topFrame, 5, 2);
+ topLayout = new Q3GridLayout( topFrame, 5, 2);
topLayout->setSpacing(KDialog::spacingHintSmall());
topLayout->setMargin(KDialog::marginHintSmall());
- QHBox *timeZoneBox = new QHBox( topFrame );
+ Q3HBox *timeZoneBox = new Q3HBox( topFrame );
topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
new QLabel( i18n("Timezone:"), timeZoneBox );
mTimeZoneCombo = new QComboBox( timeZoneBox );
if ( QApplication::desktop()->width() < 300 ) {
mTimeZoneCombo->setMaximumWidth(150);
}
QStringList list;
list = KGlobal::locale()->timeZoneList();
mTimeZoneCombo->insertStringList(list);
// find the currently set time zone and select it
QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
int nCurrentlySet = 11;
for (int i = 0; i < mTimeZoneCombo->count(); i++)
{
if (mTimeZoneCombo->text(i) == sCurrentlySet)
{
nCurrentlySet = i;
break;
}
}
mTimeZoneCombo->setCurrentItem(nCurrentlySet);
int iii = 1;
KPrefsWidBool *sb =
addWidBool(i18n("Add 30 min to selected Timezone"),
&(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame);
topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
++iii;
sb =
addWidBool(i18n("Timezone has daylight saving"),
@@ -521,65 +526,65 @@ void KDEPIMConfigWidget::setupTimeZoneTab()
++iii;
QLabel* lab;
lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
topLayout->addMultiCellWidget(lab, iii,iii,0,1);
++iii;
lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
topLayout->addMultiCellWidget(lab, iii,iii,0,1);
++iii;
lab = new QLabel( i18n("Daylight start:"), topFrame );
topLayout->addWidget(lab, iii,0);
mStartDateSavingEdit = new KDateEdit(topFrame);
topLayout->addWidget(mStartDateSavingEdit, iii,1);
++iii;
lab = new QLabel( i18n("Daylight end:"), topFrame );
topLayout->addWidget(lab, iii,0);
mEndDateSavingEdit = new KDateEdit(topFrame);
topLayout->addWidget(mEndDateSavingEdit, iii,1);
++iii;
QDate current ( 2001, 1,1);
mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
topFrame = new QWidget( this );
- topLayout = new QGridLayout( topFrame, 3, 2);
+ topLayout = new Q3GridLayout( topFrame, 3, 2);
topLayout->setSpacing(KDialog::spacingHintSmall());
topLayout->setMargin(KDialog::marginHintSmall());
tabWidget->addTab( topFrame, i18n( "Fonts" ) );
QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame );
topLayout->addMultiCellWidget(labb,0,0,0,2);
int i = 1;
KPrefsWidFont *timeLabelsFont =
addWidFont(i18n("Kx/Pi"),i18n("Application Font"),
&(KPimGlobalPrefs::instance()->mApplicationFont),topFrame);
topLayout->addWidget(timeLabelsFont->label(),i,0);
topLayout->addWidget(timeLabelsFont->preview(),i,1);
topLayout->addWidget(timeLabelsFont->button(),i,2);
}
void KDEPIMConfigWidget::externalapp_changed( int newApp )
{
// first store the current data
saveEditFieldSettings();
// set mCurrentApp
mCurrentApp = (ExternalAppHandler::Types)newApp;
// set mCurrentClient
switch(mCurrentApp)
{
case(ExternalAppHandler::EMAIL):
mCurrentClient = mEmailClient;
break;
case(ExternalAppHandler::PHONE):
mCurrentClient = mPhoneClient;
break;
@@ -682,65 +687,65 @@ void KDEPIMConfigWidget::saveEditFieldSettings()
else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC))
{
mPagerOtherChannel = mChannel->text();
mPagerOtherMessage = mMessage->text();
mPagerOtherMessageParameters = mParameters->text();
}
else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))
{
mSipOtherChannel = mChannel->text();
mSipOtherMessage = mMessage->text();
mSipOtherMessageParameters = mParameters->text();
}
}
void KDEPIMConfigWidget::updateClientWidgets()
{
bool blocked = signalsBlocked();
blockSignals( true );
// at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display
QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp );
if (it == mExternalAppsMap.end())
return;
// update group box
mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data()));
//update the entries in the client combobox
mClient->clear();
- QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
+ Q3PtrList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp);
DefaultAppItem* dai;
for ( dai=items.first(); dai != 0; dai=items.next() )
{
mClient->insertItem( i18n(dai->_label), dai->_id );
if (dai->_id == mCurrentClient)
{
//restore the edit fields with the data of the local membervariables if we had set it to "other".
//Otherwise take the default data from externalapphandler.
mChannel->setText(dai->_channel);
mMessage->setText(dai->_message);
mParameters->setText(dai->_parameters);
if ( mMessage2 )
mMessage2->setText(dai->_message2);
if ( mParameters2 )
mParameters2->setText(dai->_parameters2);
if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
{
mChannel->setText(mEmailOtherChannel);
mMessage->setText(mEmailOtherMessage);
mParameters->setText(mEmailOtherMessageParameters);
if ( mMessage2 )
mMessage2->setText(mEmailOtherMessage2);
if ( mParameters2 )
mParameters2->setText(mEmailOtherMessageParameters2);
}
else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
{
mChannel->setText(mPhoneOtherChannel);
mMessage->setText(mPhoneOtherMessage);
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index 824ef79..d693015 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -5,137 +5,139 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KDEPIMCONFIGWIDGET_H
#define KDEPIMCONFIGWIDGET_H
#include <kprefswidget.h>
#include <kio/kfile/kurlrequester.h>
#include <qmap.h>
+//Added by qt3to4:
+#include <QLabel>
#include "externalapphandler.h"
class QComboBox;
class QLineEdit;
class KPimGlobalPrefs;
-class QGroupBox;
+class Q3GroupBox;
class QTabWidget;
class KDateEdit;
class KDEPIMConfigWidget : public KPrefsWidget
{
Q_OBJECT
public:
KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 );
public slots:
void textChanged( const QString& text );
void showTimeZoneTab();
protected:
/** Implement this to read custom configuration widgets. */
virtual void usrReadConfig();
/** Implement this to write custom configuration widgets. */
virtual void usrWriteConfig();
private slots:
// void configureExtension();
// void selectionChanged( QListViewItem* );
// void itemClicked( QListViewItem* );
void client_changed( int newClient );
void externalapp_changed( int newApp );
void saveStoreSettings();
void setStandardStore();
void setLocalStore();
private:
void setupExternalAppTab();
void setupLocaleDateTab();
void setupLocaleTab();
void setupTimeZoneTab();
void setupStoreTab();
void setupBackupTab();
KURLRequester* mStoreUrl;
void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
void saveEditFieldSettings();
void updateClientWidgets();
QTabWidget *tabWidget;
QLineEdit* mUserDateFormatShort;
QLineEdit* mUserDateFormatLong;
QComboBox* mTimeZoneCombo;
KDateEdit* mStartDateSavingEdit;
KDateEdit* mEndDateSavingEdit;
// void restoreExtensionSettings();
// void saveExtensionSettings();
// KListView *mExtensionView;
// QCheckBox *mNameParsing;
// QCheckBox *mViewsSingleClickBox;
// QPushButton *mConfigureButton;
QComboBox* mExternalApps;
- QGroupBox* mExternalAppGroupBox;
+ Q3GroupBox* mExternalAppGroupBox;
QComboBox* mClient;
QLineEdit* mChannel;
QLineEdit* mMessage;
QLineEdit* mParameters;
QLineEdit* mMessage2;
QLineEdit* mParameters2;
ExternalAppHandler::Types mCurrentApp;
int mCurrentClient;
int mEmailClient;
QString mEmailOtherChannel;
QString mEmailOtherMessage;
QString mEmailOtherMessageParameters;
QString mEmailOtherMessage2;
QString mEmailOtherMessageParameters2;
int mPhoneClient;
QString mPhoneOtherChannel;
QString mPhoneOtherMessage;
QString mPhoneOtherMessageParameters;
int mFaxClient;
QString mFaxOtherChannel;
QString mFaxOtherMessage;
QString mFaxOtherMessageParameters;
int mSMSClient;
QString mSMSOtherChannel;
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index bf38479..28c88d4 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -1,121 +1,125 @@
/*
This file is part of libkdepim.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qapplication.h>
#include <qevent.h>
#include <qlineedit.h>
#include <qpixmap.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3Frame>
+#include <QKeyEvent>
#include <kdatepicker.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <knotifyclient.h>
#include <qpalette.h>
+#include <QDesktopWidget>
#include "kdateedit.h"
//#include "kdateedit.moc"
KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
- : QHBox(parent, name)
+ : Q3HBox(parent, name)
{
dateFormShort = true;
withoutDp = withoutDP;
mDateEdit = new QLineEdit(this);
mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort));
setFocusProxy(mDateEdit);
mDateEdit->installEventFilter(this);
// Highlight Background and Textcolor
QPalette palette = QWidget::palette();
unsigned char red, green, blue;
red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
mDateEdit->setPalette( palette );
if ( withoutDP ) {
mDateFrame = 0;
mDateButton = 0;
mDatePicker = 0;
} else {
QPixmap pixmap = SmallIcon("smallcal");
mDateButton = new QPushButton(this);
mDateButton->setPixmap(pixmap);
QPixmap pixmap2 = SmallIcon("today_small");
QPushButton* nowButton = new QPushButton(this);
nowButton->setPixmap(pixmap2);
- mDateFrame = new QVBox(0,0,WType_Popup);
+ mDateFrame = new Q3VBox(0,0,Qt::WType_Popup);
// mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
- mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
+ mDateFrame->setFrameStyle( Q3Frame::WinPanel |Q3Frame::Raised );
mDateFrame->setLineWidth(3);
mDateFrame->hide();
mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate());
connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate)));
connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate)));
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate)));
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate)));
connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide()));
connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker()));
connect(nowButton,SIGNAL(clicked()),SLOT(goToNow()));
- mDateButton->setFocusPolicy( QWidget::NoFocus );
+ mDateButton->setFocusPolicy( Qt::NoFocus );
mDateButton->setAutoDefault( false );
//mDateFrame->resize( 400, 300 );
}
connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed()));
connect(mDateEdit,SIGNAL(textChanged(const QString &)),
SLOT(textChanged(const QString &)));
// Create the keyword list. This will be used to match against when the user
// enters information.
mKeywordMap[i18n("tomorrow")] = 1;
mKeywordMap[i18n("today")] = 0;
mKeywordMap[i18n("yesterday")] = -1;
/*
* This loop uses some math tricks to figure out the offset in days
* to the next date the given day of the week occurs. There
* are two cases, that the new day is >= the current day, which means
* the new day has not occured yet or that the new day < the current day,
* which means the new day is already passed (so we need to find the
* day in the next week).
*/
QString dayName;
int currentDay = QDate::currentDate().dayOfWeek();
for (int i = 1; i <= 7; ++i)
{
dayName = KGlobal::locale()->weekDayName(i).lower();
if (i >= currentDay)
mKeywordMap[dayName] = i - currentDay;
else
mKeywordMap[dayName] = 7 - currentDay + i;
}
@@ -196,93 +200,93 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm
strLength = KGlobal::locale()->monthName(date.month(), false).length();
break;
case 'y':// 04 (year short)
strLength = 2; //Ok
break;
case 'Y':// 2004 (year)
strLength = 4; //Ok
break;
default:
break;
}
space = begin - (repeat++ * 2);
// all select? then dayswitch
if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) &&
( (dateForm.at(begin + 1).latin1() == 'd') ||
(dateForm.at(begin + 1).latin1() == 'a') ||
(dateForm.at(begin + 1).latin1() == 'A') ) ) {
break;
}
// mDateEdit-StringPos == CursorPosition(cpos) then break and set date
if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) {
break;
}
allStrLength += strLength;
begin = dateForm.find("%", begin +1);
}
// set date
switch ( dateForm.at(begin + 1).latin1() ) {
case 'd':
case 'a':
case 'A':
- if(key == Key_Up) {
+ if(key == Qt::Key_Up) {
setDate( date.addDays( 1 ) );
}
- else if(key == Key_Down) {
+ else if(key == Qt::Key_Down) {
setDate( date.addDays( -1 ) );
}
maxDay = readDate().day();
break;
case 'm':
case 'b':
case 'B':
- if(key == Key_Up) {
+ if(key == Qt::Key_Up) {
int year = ((date.month()+1)>12)?date.year()+1:date.year();
int month = ((date.month()+1)>12)?1:date.month()+1;
int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay;
setDate( QDate( year, month, day ) );
- } else if(key == Key_Down) {
+ } else if(key == Qt::Key_Down) {
int year = ((date.month()-1)<1)?date.year()-1:date.year();
int month = ((date.month()-1)<1)?12:date.month()-1;
int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay;
setDate( QDate( year, month, day ) );
}
break;
case 'y':
case 'Y':
- if(key == Key_Up) {
+ if(key == Qt::Key_Up) {
setDate( QDate( date.year() + 1, date.month() , date.day()) );
}
- else if(key == Key_Down) {
+ else if(key == Qt::Key_Down) {
setDate( QDate( date.year() - 1, date.month() , date.day()) );
}
break;
/* default:
if(key == Key_Up) {
setDate( date.addDays( 1 ) );
} else if(key == Key_Down) {
setDate( date.addDays( -1 ) );
}
break;*/
}
date = readDate();
begin = dateForm.find("%");
int allSelectStrLength = 0;
int selectStrLength = 0;
// set selection do new date an set cursor at end of selection
for(int i = 0; i < repeat; i++){
switch ( dateForm.at(begin + 1).latin1() )
{
case 'd':// 16 (month day)
selectStrLength = 2; //Ok
break;
case 'm':// 01 (month)
selectStrLength = 2; //Ok
break;
case 'a':// Mon (Weekday short)
selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length();
break;
case 'A':// Monday (Weekday)
selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length();
@@ -315,97 +319,97 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm
}
void KDateEdit::setHandleInvalid(bool handleInvalid)
{
mHandleInvalid = handleInvalid;
}
void KDateEdit::setEnabled(bool on)
{
mDateEdit->setEnabled(on);
mDateButton->setEnabled(on);
}
QDate KDateEdit::date() const
{
QDate date = readDate();
if (date.isValid() || mHandleInvalid) {
return date;
} else {
KNotifyClient::beep();
return QDate::currentDate();
}
}
void KDateEdit::keyPressEvent(QKeyEvent *e)
{
QDate date = readDate();
int cpos = mDateEdit->cursorPosition();
switch(e->key())
{
- case Key_Escape:
+ case Qt::Key_Escape:
mDateEdit->deselect();
- case Key_Tab:
- QHBox::keyPressEvent(e);
+ case Qt::Key_Tab:
+ Q3HBox::keyPressEvent(e);
break;
- case Key_Up:
+ case Qt::Key_Up:
// when date invalid then set to currend and return
if(!date.isValid()) {
date = QDate::currentDate();
setDate(date);
mDateEdit->setCursorPosition(cpos);
emit(dateChanged(date));
QString text = i18n( "You entered an invalid date!\n Date changed to current date." );
KMessageBox::information( 0, text );
return;
}
- setDate(date, &cpos, Key_Up, dateFormShort);
+ setDate(date, &cpos, Qt::Key_Up, dateFormShort);
break;
- case Key_Down:
+ case Qt::Key_Down:
// when date invalid then set to current and return
if(!date.isValid()) {
date = QDate::currentDate();
setDate(date);
mDateEdit->setCursorPosition(cpos);
emit(dateChanged(date));
QString text = i18n( "You entered an invalid date!\n Date changed to current date." );
KMessageBox::information( 0, text );
return;
}
- setDate(date, &cpos, Key_Down, dateFormShort);
+ setDate(date, &cpos, Qt::Key_Down, dateFormShort);
break;
default:
- QHBox::keyPressEvent(e);
+ Q3HBox::keyPressEvent(e);
break;
} // switch
mDateEdit->setCursorPosition(cpos);
}
void KDateEdit::setSelect( int from, int to )
{
// return;
mDateEdit->setSelection( from , to );
}
void KDateEdit::toggleDatePicker()
{
if( mDateFrame->isVisible() ) {
mDateFrame->hide();
} else {
QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight());
QSize datepickersize = mDatePicker->sizeHint();
if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() );
int h = QApplication::desktop()->height();
if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() );
mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(),
datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth());
QDate date = readDate();
if(date.isValid()) {
mDatePicker->setDate(date);
} else {
diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h
index 2d8c452..38eacde 100644
--- a/libkdepim/kdateedit.h
+++ b/libkdepim/kdateedit.h
@@ -1,84 +1,87 @@
/*
This file is part of libkdepim.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KDATEEDIT_H
#define KDATEEDIT_H
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qdatetime.h>
#include <qmap.h>
+//Added by qt3to4:
+#include <QKeyEvent>
+#include <QEvent>
class QLineEdit;
class QPushButton;
class QObject;
class QEvent;
class KDatePicker;
class KDateValidator;
/**
* A date editing widget that consists of a line edit followed by
* a small push button. The line edit contains the date in text form,
* and the push button will display a 'popup' style date picker.
*
* This widget also supports advanced features like allowing the user
* to type in the day name to get the date. The following keywords
* are supported (in the native language): tomorrow, yesturday, today,
* monday, tuesday, wednesday, thursday, friday, saturday, sunday.
*
* @author Cornelius Schumacher <schumacher@kde.org>
* @author Mike Pilone <mpilone@slac.com>
*/
-class KDateEdit : public QHBox
+class KDateEdit : public Q3HBox
{
Q_OBJECT
public:
KDateEdit(QWidget *parent=0, const char *name=0, bool withoutDP = false );
virtual ~KDateEdit();
/** @return True if the date in the text edit is valid,
* false otherwise. This will not modify the display of the date,
* but only check for validity.
*/
bool inputIsValid();
/** @return The date entered. This will not
* modify the display of the date, but only return it.
*/
QDate date() const;
/** @param handleInvalid If true the date edit accepts invalid dates
* and displays them as the empty ("") string. It also returns an invalid date.
* If false (default) invalid dates are not accepted and instead the date
* of today will be returned.
*/
void setHandleInvalid(bool handleInvalid);
/** Checks for a focus out event. The display of the date is updated
* to display the proper date when the focus leaves.
*/
virtual bool eventFilter(QObject *o, QEvent *e);
void toggleDateFormat();
void clear();
signals:
/** This signal is emitted whenever the user modifies the date. This
@@ -99,45 +102,45 @@ class KDateEdit : public QHBox
// and set selection from begin to end of single date
void setDate(QDate, int *cpos, const int, const bool);
/** Sets the date edit to be enabled or disabled (grayed out)
*
* @param on Enabled if true, disabled if false
*/
void setEnabled(bool on);
protected slots:
void toggleDatePicker();
void lineEnterPressed();
void textChanged(const QString &);
void goToNow();
private:
/** Reads the text from the line edit. If the text is a keyword, the
* word will be translated to a date. If the text is not a keyword, the
* text will be interpreted as a date.
*/
QDate readDate() const;
/** Maps the text that the user can enter to the offset in days from
* today. For example, the text 'tomorrow' is mapped to +1.
*/
QMap<QString, int> mKeywordMap;
bool mTextChanged;
bool mHandleInvalid;
QPushButton *mDateButton;
QLineEdit *mDateEdit;
KDatePicker *mDatePicker;
- QVBox *mDateFrame;
+ Q3VBox *mDateFrame;
int maxDay;
bool withoutDp;
protected:
virtual void keyPressEvent(QKeyEvent *qke);
void setSelect ( int, int );
bool dateFormShort;
char lengthMonthName;
};
#endif
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index 68ef943..28b65cf 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -1,75 +1,79 @@
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kdatepicker.h"
#include <kglobal.h>
#include <kapplication.h>
#include <klocale.h>
#include <kiconloader.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qpainter.h>
#include <qdialog.h>
#include <qtoolbutton.h>
#include <qfont.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qvalidator.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QKeyEvent>
+#include <QDesktopWidget>
#include <kdebug.h>
#include <knotifyclient.h>
#include <kglobalsettings.h>
#include "kdatetbl.h"
#include "kdateedit.h"
//#include "kdatepicker.moc"
KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name)
- : QFrame(parent,name),
+ : Q3Frame(parent,name),
yearForward(new QToolButton(this)),
yearBackward(new QToolButton(this)),
monthForward(new QToolButton(this)),
monthBackward(new QToolButton(this)),
selectMonth(new QToolButton(this)),
selectYear(new QToolButton(this)),
todayBut(new QToolButton(this)),
//line(new QLineEdit(this)),
val(new KDateValidator(this))
//table(new KDateTable(this)),
//fontsize(1)
{
QFont fo = KGlobalSettings::generalFont();
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 4;
fo.setPointSize(fo.pointSize()+add );
setFont( fo );
table = new KDateTable(this);
setFontSize(font().pointSize());
//line->setValidator(val);
lineDate = new KDateEdit( this, "dateediipicker", true );
yearForward->setPixmap(SmallIcon("3rightarrowB"));
yearBackward->setPixmap(SmallIcon("3leftarrowB"));
monthForward->setPixmap(SmallIcon("2rightarrowB"));
monthBackward->setPixmap(SmallIcon("2leftarrowB"));
todayBut->setPixmap(SmallIcon("today"));
setDate(dt); // set button texts
connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate)));
connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h
index 3db9a89..4d904da 100644
--- a/libkdepim/kdatepicker.h
+++ b/libkdepim/kdatepicker.h
@@ -1,83 +1,86 @@
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef MICROKDE_KDATEPICKER_H
#define MICROKDE_KDATEPICKER_H
#include <qdatetime.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qevent.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QKeyEvent>
class QLineEdit;
class QToolButton;
class KDateValidator;
class KDateTable;
class KDateEdit;
/**
* Provides a widget for calendar date input.
*
* Different from the
* previous versions, it now emits two types of signals, either
* @ref dateSelected() or @ref dateEntered() (see documentation for both
* signals).
*
* A line edit has been added in the newer versions to allow the user
* to select a date directly by entering numbers like 19990101
* or 990101.
*
* @image kdatepicker.png KDatePicker
*
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*
* @short A date selection widget.
**/
-class KDatePicker: public QFrame
+class KDatePicker: public Q3Frame
{
Q_OBJECT
public:
/** The usual constructor. The given date will be displayed
* initially.
**/
KDatePicker(QWidget *parent=0,
QDate=QDate::currentDate(),
const char *name=0);
/**
* The destructor.
**/
virtual ~KDatePicker();
/** The size hint for date pickers. The size hint recommends the
* minimum size of the widget so that all elements may be placed
* without clipping. This sometimes looks ugly, so when using the
* size hint, try adding 28 to each of the reported numbers of
* pixels.
**/
QSize sizeHint() const;
/**
* Sets the date.
*
* @returns @p false and does not change anything
* if the date given is invalid.
**/
bool setDate(const QDate&);
/**
* Returns the selected date.
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 9c28425..3677e87 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -9,65 +9,65 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include <kglobalsettings.h>
#include <kstaticdeleter.h>
#include <qregexp.h>
#include <qfile.h>
#include <stdlib.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qapplication.h>
#include "kpimglobalprefs.h"
KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP;
KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
: KPrefs("microkdeglobalrc")
{
mLocaleDict = 0;
KPrefs::setCurrentGroup("Fonts");
addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() );
KPrefs::setCurrentGroup("Locale");
addItemInt("PreferredLanguage",&mPreferredLanguage,0);
addItemInt("PreferredTime",&mPreferredTime,0);
addItemInt("PreferredDate",&mPreferredDate,0);
addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y");
addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
KPrefs::setCurrentGroup("Colors");
addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor());
KPrefs::setCurrentGroup("Time & Date");
addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
@@ -113,81 +113,81 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
KPrefs::setCurrentGroup( "BackupSettings" );
addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir());
addItemInt( "BackupNumbers", &mBackupNumbers, 3 );
addItemInt( "BackupDayCount", &mBackupDayCount, 2 );
addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true );
addItemBool( "BackupEnabled",&mBackupEnabled, false );
}
void KPimGlobalPrefs::setGlobalConfig()
{
if ( mLocaleDict == 0 ) {
QString fileName ;
QString name = KGlobal::getAppName() +"/";
#ifndef DESKTOP_VERSION
fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name;
#else
fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
#endif
mLocaleDict = 0;
if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
if ( mPreferredLanguage == 1 )
fileName = fileName+"germantranslation.txt";
else if ( mPreferredLanguage == 4 )
fileName = fileName+"usertranslation.txt";
else if ( mPreferredLanguage == 2 )
fileName = fileName+"frenchtranslation.txt";
else if ( mPreferredLanguage == 3 )
fileName = fileName+"italiantranslation.txt";
QFile file( fileName );
- if (file.open( IO_ReadOnly ) ) {
- QTextStream ts( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ if (file.open( QIODevice::ReadOnly ) ) {
+ Q3TextStream ts( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
//ts.setCodec( QTextCodec::latin1 );
QString text = ts.read();
file.close();
text.replace( QRegExp("\\\\n"), "\n" );
QString line;
QString we;
QString wt;
int br = 0;
int nbr;
nbr = text.find ( "},", br );
line = text.mid( br, nbr - br );
br = nbr+1;
int se, ee, st, et;
- mLocaleDict = new QDict<QString>;
+ mLocaleDict = new Q3Dict<QString>;
mLocaleDict->setAutoDelete( true );
QString end = "{ \"\",\"\" }";
while ( (line != end) && (br > 1) ) {
//qDebug("%d *%s* ", br, line.latin1());
se = line.find("\"")+1;
et = line.findRev("\"",-1);
ee = line.find("\",\"");
st = ee+3;
we = line.mid( se, ee-se );
if ( mPreferredLanguage == 4 )
wt = QString::fromUtf8(line.mid( st, et-st ).latin1());
else
wt = line.mid( st, et-st );
//qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
mLocaleDict->insert( we, new QString (wt) );
nbr = text.find ( "}", br );
line = text.mid( br, nbr - br );
br = nbr+1;
}
//qDebug("end *%s* ", end.latin1());
setLocaleDict( mLocaleDict );
} else {
qDebug("KO: Cannot find translation file %s",fileName.latin1() );
}
}
}
KGlobal::locale()->setHore24Format( !mPreferredTime );
KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
KGlobal::locale()->setLanguage( mPreferredLanguage );
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 94ac8ae..01f5ab0 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -3,118 +3,118 @@
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KPIMGLOBALPREFS_H
#define KPIMGLOBALPREFS_H
#include "kprefs.h"
-#include <qdict.h>
+#include <q3dict.h>
class KPimGlobalPrefs : public KPrefs
{
public:
void setGlobalConfig();
static KPimGlobalPrefs *instance();
virtual ~KPimGlobalPrefs();
enum EMailClients {
NONE_EMC = 0,
OTHER_EMC = 1,
OMPI_EMC = 2,
QTOPIA_EMC = 3,
OPIE_EMC = 4,
OPIE_MAILIT_EMC = 5
};
enum PhoneClients {
NONE_PHC = 0,
OTHER_PHC = 1,
KPPI_PHC = 2
};
enum FaxClients {
NONE_FAC = 0,
OTHER_FAC = 1
};
enum SMSClients {
NONE_SMC = 0,
OTHER_SMC = 1
};
enum PagerClients {
NONE_PAC = 0,
OTHER_PAC = 1
};
enum SIPClients {
NONE_SIC = 0,
OTHER_SIC = 1,
KPPI_SIC = 2
};
private:
KPimGlobalPrefs( const QString &name = QString::null );
static KPimGlobalPrefs *sInstance;
- QDict<QString> *mLocaleDict;
+ Q3Dict<QString> *mLocaleDict;
public:
//US I copied the following "locale" settings from KOPrefs
int mPreferredDate;
QString mUserDateFormatLong;
QString mUserDateFormatShort;
int mPreferredLanguage;
int mPreferredTime;
bool mWeekStartsOnSunday;
QString mTimeZoneId;
bool mUseDaylightsaving;
int mDaylightsavingStart;
int mDaylightsavingEnd;
bool mTimeZoneAdd30min;
QFont mApplicationFont;
QColor mAlternateColor;
int mEmailClient;
QString mEmailOtherChannel;
QString mEmailOtherMessage;
QString mEmailOtherMessageParameters;
QString mEmailOtherMessage2;
QString mEmailOtherMessageParameters2;
int mPhoneClient;
QString mPhoneOtherChannel;
QString mPhoneOtherMessage;
QString mPhoneOtherMessageParameters;
int mFaxClient;
QString mFaxOtherChannel;
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp
index 6dc741d..358acbd 100644
--- a/libkdepim/kprefsdialog.cpp
+++ b/libkdepim/kprefsdialog.cpp
@@ -1,76 +1,77 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
// $Id$
#include <qlayout.h>
#include <qlabel.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
+#include <q3groupbox.h>
+#include <q3buttongroup.h>
#include <qlineedit.h>
#include <qfont.h>
#include <qslider.h>
#include <qfile.h>
-#include <qtextstream.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3textstream.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qspinbox.h>
#include <qdatetime.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kfontdialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include "kprefs.h"
#include "kpimglobalprefs.h"
#include "kprefsdialog.h"
//#include "kprefsdialog.moc"
KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference,
QWidget *parent)
{
mReference = reference;
mCheck = new QCheckBox(text,parent);
}
void KPrefsDialogWidBool::readConfig()
{
mCheck->setChecked(*mReference);
}
void KPrefsDialogWidBool::writeConfig()
{
@@ -99,65 +100,65 @@ KPrefsDialogWidColor::~KPrefsDialogWidColor()
{
// kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl;
}
void KPrefsDialogWidColor::readConfig()
{
mButton->setColor(*mReference);
}
void KPrefsDialogWidColor::writeConfig()
{
*mReference = mButton->color();
}
QLabel *KPrefsDialogWidColor::label()
{
return mLabel;
}
KColorButton *KPrefsDialogWidColor::button()
{
return mButton;
}
KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
QFont *reference,QWidget *parent)
{
mReference = reference;
mLabel = new QLabel(labelText, parent);
mPreview = new QLabel(sampleText,parent);
- mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken);
+ mPreview->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken);
mButton = new QPushButton(i18n("Choose..."), parent);
connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
}
KPrefsDialogWidFont::~KPrefsDialogWidFont()
{
}
void KPrefsDialogWidFont::readConfig()
{
mPreview->setFont(*mReference);
}
void KPrefsDialogWidFont::writeConfig()
{
*mReference = mPreview->font();
}
QLabel *KPrefsDialogWidFont::label()
{
return mLabel;
}
QLabel *KPrefsDialogWidFont::preview()
{
return mPreview;
}
QPushButton *KPrefsDialogWidFont::button()
@@ -183,77 +184,77 @@ KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference,
mLabel = new QLabel(text,parent);
mSpin = new QSpinBox(0,23,1,parent);
mSpin->setSuffix(":00");
}
void KPrefsDialogWidTime::readConfig()
{
mSpin->setValue(*mReference);
}
void KPrefsDialogWidTime::writeConfig()
{
*mReference = mSpin->value();
}
QLabel *KPrefsDialogWidTime::label()
{
return mLabel;
}
QSpinBox *KPrefsDialogWidTime::spinBox()
{
return mSpin;
}
KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference,
QWidget *parent)
{
mReference = reference;
- mBox = new QButtonGroup(1,Qt::Horizontal,text,parent);
+ mBox = new Q3ButtonGroup(1,Qt::Horizontal,text,parent);
}
KPrefsDialogWidRadios::~KPrefsDialogWidRadios()
{
}
void KPrefsDialogWidRadios::addRadio(const QString &text)
{
new QRadioButton(text,mBox);
}
-QButtonGroup *KPrefsDialogWidRadios::groupBox()
+Q3ButtonGroup *KPrefsDialogWidRadios::groupBox()
{
return mBox;
}
void KPrefsDialogWidRadios::readConfig()
{
mBox->setButton(*mReference);
}
void KPrefsDialogWidRadios::writeConfig()
{
*mReference = mBox->id(mBox->selected());
}
KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference,
QWidget *parent, QLineEdit::EchoMode echomode)
{
mReference = reference;
mLabel = new QLabel(text,parent);
mEdit = new QLineEdit(parent);
mEdit->setEchoMode( echomode );
}
KPrefsDialogWidString::~KPrefsDialogWidString()
{
}
void KPrefsDialogWidString::readConfig()
{
mEdit->setText(*mReference);
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h
index 52ec809..cc95dd4 100644
--- a/libkdepim/kprefsdialog.h
+++ b/libkdepim/kprefsdialog.h
@@ -1,71 +1,73 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KPREFSDIALOG_H
#define _KPREFSDIALOG_H
// $Id$
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qlineedit.h>
+//Added by qt3to4:
+#include <QLabel>
#include <kdialogbase.h>
class KPrefs;
class KPrefsDialog;
class KColorButton;
class QCheckBox;
class QLabel;
class QSpinBox;
-class QButtonGroup;
+class Q3ButtonGroup;
/**
@short Base class for widgets used by @ref KPrefsDialog.
@author Cornelius Schumacher
@see KPrefsDialog
This class provides the interface for the preferences widgets used by
KPrefsDialog.
*/
class KPrefsDialogWid : public QObject
{
public:
/**
This function is called to read value of the setting from the
stored configuration and display it in the widget.
*/
virtual void readConfig() = 0;
/**
This function is called to write the current setting of the widget to the
stored configuration.
*/
virtual void writeConfig() = 0;
};
/**
@short Widget for bool settings in @ref KPrefsDialog.
This class provides a widget for configuring bool values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
class KPrefsDialogWidBool : public KPrefsDialogWid
{
@@ -229,73 +231,73 @@ class KPrefsDialogWidFont : public KPrefsDialogWid
@ref KPrefsDialog.
This class provides a widget for configuring selections. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management. The
setting is interpreted as an int value, corresponding to the position of the
radio button. The position of the button is defined by the sequence of @ref
addRadio() calls, starting with 0.
*/
class KPrefsDialogWidRadios : public KPrefsDialogWid
{
public:
/**
Create a widget for selection of an option. It consists of a box with
several radio buttons.
@param text Text of main box.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent);
virtual ~KPrefsDialogWidRadios();
/**
Add a radio button.
@param text Text of the button.
*/
void addRadio(const QString &text);
/**
Return the box widget used by this widget.
*/
- QButtonGroup *groupBox();
+ Q3ButtonGroup *groupBox();
void readConfig();
void writeConfig();
private:
int *mReference;
- QButtonGroup *mBox;
+ Q3ButtonGroup *mBox;
};
/**
@short Widget for string settings in @ref KPrefsDialog.
This class provides a widget for configuring string values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
class KPrefsDialogWidString : public KPrefsDialogWid
{
public:
/**
Create a string widget consisting of a test label and a line edit.
@param text Text of label.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal);
/**
Destructor.
*/
virtual ~KPrefsDialogWidString();
/**
Return label used by this widget.
*/
QLabel *label();
/**
Return QLineEdit used by this widget.
*/
@@ -410,62 +412,62 @@ class KPrefsDialog : public KDialogBase
void setDefaults();
/** Read preferences from config file. */
void readConfig();
/** Write preferences to config file. */
void writeConfig();
signals:
/** Emitted when the a changed configuration has been stored. */
void configChanged();
protected slots:
/** Apply changes to preferences */
void slotApply();
void accept();
/** Accept changes to preferences and close dialog */
void slotOk();
/** Set preferences to default values */
void slotDefault();
protected:
/** Implement this to read custom configuration widgets. */
virtual void usrReadConfig() {}
/** Implement this to write custom configuration widgets. */
virtual void usrWriteConfig() {}
private:
KPrefs *mPrefs;
- QPtrList<KPrefsDialogWid> mPrefsWids;
+ Q3PtrList<KPrefsDialogWid> mPrefsWids;
};
#include "kcmconfigs/kdepimconfigwidget.h"
class KPimPrefsGlobalDialog : public KPrefsDialog
{
Q_OBJECT
public:
KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true);
/**
Destructor.
*/
void showTZconfig();
public slots:
signals:
protected slots:
protected:
void usrReadConfig();
virtual void usrWriteConfig() ;
private:
KDEPIMConfigWidget* kdelibcfg;
};
#endif
diff --git a/libkdepim/kprefswidget.cpp b/libkdepim/kprefswidget.cpp
index f6a0b38..51431e2 100644
--- a/libkdepim/kprefswidget.cpp
+++ b/libkdepim/kprefswidget.cpp
@@ -1,76 +1,77 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
// $Id$
#include <qlayout.h>
#include <qlabel.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
+#include <q3groupbox.h>
+#include <q3buttongroup.h>
#include <qlineedit.h>
#include <qfont.h>
#include <qslider.h>
#include <qfile.h>
-#include <qtextstream.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3textstream.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qspinbox.h>
#include <qdatetime.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include "kprefs.h"
#include "kprefswidget.h"
//#include "kprefsdialog.moc"
KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference,
QWidget *parent)
{
mReference = reference;
mCheck = new QCheckBox(text,parent);
connect( mCheck, SIGNAL( toggled( bool ) ), SIGNAL( modified() ) );
}
void KPrefsWidBool::readConfig()
{
mCheck->setChecked(*mReference);
}
void KPrefsWidBool::writeConfig()
@@ -102,65 +103,65 @@ KPrefsWidColor::~KPrefsWidColor()
{
// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl;
}
void KPrefsWidColor::readConfig()
{
mButton->setColor(*mReference);
}
void KPrefsWidColor::writeConfig()
{
*mReference = mButton->color();
}
QLabel *KPrefsWidColor::label()
{
return mLabel;
}
KColorButton *KPrefsWidColor::button()
{
return mButton;
}
KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText,
QFont *reference,QWidget *parent)
{
mReference = reference;
mLabel = new QLabel(labelText, parent);
mPreview = new QLabel(sampleText,parent);
- mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken);
+ mPreview->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken);
mButton = new QPushButton(i18n("Choose..."), parent);
connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
}
KPrefsWidFont::~KPrefsWidFont()
{
}
void KPrefsWidFont::readConfig()
{
mPreview->setFont(*mReference);
}
void KPrefsWidFont::writeConfig()
{
*mReference = mPreview->font();
}
QLabel *KPrefsWidFont::label()
{
return mLabel;
}
QLabel *KPrefsWidFont::preview()
{
return mPreview;
}
QPushButton *KPrefsWidFont::button()
@@ -189,78 +190,78 @@ KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference,
mSpin = new QSpinBox(0,23,1,parent);
mSpin->setSuffix(":00");
connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) );
}
void KPrefsWidTime::readConfig()
{
mSpin->setValue(*mReference);
}
void KPrefsWidTime::writeConfig()
{
*mReference = mSpin->value();
}
QLabel *KPrefsWidTime::label()
{
return mLabel;
}
QSpinBox *KPrefsWidTime::spinBox()
{
return mSpin;
}
KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference,
QWidget *parent)
{
mReference = reference;
- mBox = new QButtonGroup(1,Qt::Horizontal,text,parent);
+ mBox = new Q3ButtonGroup(1,Qt::Horizontal,text,parent);
connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) );
}
KPrefsWidRadios::~KPrefsWidRadios()
{
}
void KPrefsWidRadios::addRadio(const QString &text)
{
new QRadioButton(text,mBox);
}
-QButtonGroup *KPrefsWidRadios::groupBox()
+Q3ButtonGroup *KPrefsWidRadios::groupBox()
{
return mBox;
}
void KPrefsWidRadios::readConfig()
{
mBox->setButton(*mReference);
}
void KPrefsWidRadios::writeConfig()
{
*mReference = mBox->id(mBox->selected());
}
KPrefsWidString::KPrefsWidString(const QString &text,QString *reference,
QWidget *parent, QLineEdit::EchoMode echomode)
{
mReference = reference;
mLabel = new QLabel(text,parent);
mEdit = new QLineEdit(parent);
mEdit->setEchoMode( echomode );
connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) );
}
KPrefsWidString::~KPrefsWidString()
{
}
void KPrefsWidString::readConfig()
diff --git a/libkdepim/kprefswidget.h b/libkdepim/kprefswidget.h
index 8543a39..9de1be5 100644
--- a/libkdepim/kprefswidget.h
+++ b/libkdepim/kprefswidget.h
@@ -1,72 +1,74 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
// $Id$
#ifndef _KPREFSWIDGET_H
#define _KPREFSWIDGET_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <QLabel>
class KPrefs;
class KColorButton;
class QCheckBox;
class QLabel;
class QSpinBox;
-class QButtonGroup;
+class Q3ButtonGroup;
/**
@short Base class for widgets used by @ref KPrefsDialog.
@author Cornelius Schumacher
@see KPrefsDialog
This class provides the interface for the preferences widgets used by
KPrefsDialog.
*/
class KPrefsWid : public QObject
{
Q_OBJECT
public:
/**
This function is called to read value of the setting from the
stored configuration and display it in the widget.
*/
virtual void readConfig() = 0;
/**
This function is called to write the current setting of the widget to the
stored configuration.
*/
virtual void writeConfig() = 0;
//connect to this signal if you want to be notified of changes
signals:
void modified();
};
/**
@short Widget for bool settings in @ref KPrefsDialog.
@@ -236,73 +238,73 @@ class KPrefsWidFont : public KPrefsWid
@ref KPrefsDialog.
This class provides a widget for configuring selections. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management. The
setting is interpreted as an int value, corresponding to the position of the
radio button. The position of the button is defined by the sequence of @ref
addRadio() calls, starting with 0.
*/
class KPrefsWidRadios : public KPrefsWid
{
public:
/**
Create a widget for selection of an option. It consists of a box with
several radio buttons.
@param text Text of main box.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
KPrefsWidRadios(const QString &text,int *reference,QWidget *parent);
virtual ~KPrefsWidRadios();
/**
Add a radio button.
@param text Text of the button.
*/
void addRadio(const QString &text);
/**
Return the box widget used by this widget.
*/
- QButtonGroup *groupBox();
+ Q3ButtonGroup *groupBox();
void readConfig();
void writeConfig();
private:
int *mReference;
- QButtonGroup *mBox;
+ Q3ButtonGroup *mBox;
};
/**
@short Widget for string settings in @ref KPrefsDialog.
This class provides a widget for configuring string values. It is meant to be
used by KPrefsDialog. The user is responsible for the layout management.
*/
class KPrefsWidString : public KPrefsWid
{
public:
/**
Create a string widget consisting of a test label and a line edit.
@param text Text of label.
@param reference Pointer to variable read and written by this widget.
@param parent Parent widget.
*/
KPrefsWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal);
/**
Destructor.
*/
virtual ~KPrefsWidString();
/**
Return label used by this widget.
*/
QLabel *label();
/**
Return QLineEdit used by this widget.
*/
@@ -420,36 +422,36 @@ class KPrefsWidget : public QWidget
/** Write preferences to config file. */
void writeConfig();
/** connect this slot to all UI elements */
void modified();
signals:
/** Emitted when the a changed configuration has been stored. */
//US void configChanged();
void changed( bool );
protected slots:
/** Apply changes to preferences */
//US void slotApply();
//US void accept();
/** Accept changes to preferences and close dialog */
//US void slotOk();
/** Set preferences to default values */
//US void slotDefault();
protected:
/** Implement this to read custom configuration widgets. */
virtual void usrReadConfig() {}
/** Implement this to write custom configuration widgets. */
virtual void usrWriteConfig() {}
private:
KPrefs *mPrefs;
- QPtrList<KPrefsWid> mPrefsWids;
+ Q3PtrList<KPrefsWid> mPrefsWids;
};
#endif
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 5708dfc..c844627 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -6,119 +6,122 @@
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#include "ksyncmanager.h"
#include <stdlib.h>
#ifndef _WIN32_
#include <unistd.h>
#endif
#include "ksyncprofile.h"
#include "ksyncprefsdialog.h"
#include "kpimprefs.h"
#include <kmessagebox.h>
#include <qdir.h>
-#include <qprogressbar.h>
-#include <qpopupmenu.h>
+#include <q3progressbar.h>
+#include <q3popupmenu.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qtimer.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qlineedit.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qtextcodec.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kfiledialog.h>
QDateTime KSyncManager::mRequestedSyncEvent;
-KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
+KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, Q3PopupMenu* syncmenu)
: QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu)
{
mServerSocket = 0;
- bar = new QProgressBar ( 1, 0 );
+ bar = new Q3ProgressBar ( 1, 0 );
bar->setCaption ("");
mWriteBackInPast = 2;
}
KSyncManager::~KSyncManager()
{
delete bar;
}
void KSyncManager::setDefaultFileName( QString s)
{
mDefFileName = s ;
if ( mPrefs->mPassiveSyncAutoStart )
enableQuick( false );
}
void KSyncManager::fillSyncMenu()
{
if ( mSyncMenu->count() )
mSyncMenu->clear();
mSyncMenu->insertItem( i18n("Configure..."), 0 );
mSyncMenu->insertSeparator();
- QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
+ Q3PopupMenu *clearMenu = new Q3PopupMenu ( mSyncMenu );
mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
clearMenu->insertItem( i18n("For all profiles"), 1 );
clearMenu->insertSeparator();
connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
mSyncMenu->insertSeparator();
if ( mServerSocket == 0 ) {
mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
} else {
mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
}
mSyncMenu->insertSeparator();
mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
mSyncMenu->insertSeparator();
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
config.setGroup("General");
QStringList prof = config.readListEntry("SyncProfileNames");
mLocalMachineName = config.readEntry("LocalMachineName","undefined");
if ( prof.count() < 2 ) {
prof.clear();
QString externalName;
#ifdef DESKTOP_VERSION
#ifdef _WIN32_
externalName = "OutLook";
#else
externalName = "KDE_Desktop";
#endif
#else
externalName = "Sharp_DTM";
#endif
prof << externalName;
prof << i18n("Local_file");
prof << i18n("Last_file");
@@ -326,65 +329,65 @@ void KSyncManager::slotSyncMenu( int action )
} else if ( mTargetApp == KOPI ) {
if ( temp->getIsPiSyncSpec() )
mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true );
mPassWordPiSync = temp->getRemotePw();
mActiveSyncPort = temp->getRemotePort();
mActiveSyncIP = temp->getRemoteIP();
} else {
mPassWordPiSync = temp->getRemotePwPWM();
mActiveSyncPort = temp->getRemotePortPWM();
mActiveSyncIP = temp->getRemoteIPPWM();
}
syncPi();
while ( !mPisyncFinished ) {
//qDebug("waiting ");
qApp->processEvents();
}
} else
syncRemote( temp );
}
}
delete temp;
setBlockSave(false);
}
void KSyncManager::enableQuick( bool ask )
{
bool autoStart;
bool changed = false;
if ( ask ) {
QDialog dia ( 0, "input-dialog", true );
QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lab.setText( mPrefs->mPassiveSyncPort );
lay.setMargin(7);
lay.setSpacing(7);
int po = 9197+mTargetApp;
QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia );
lay.addWidget( &label);
lay.addWidget( &lab);
QLineEdit lepw ( &dia );
lepw.setText( mPrefs->mPassiveSyncPw );
QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
lay.addWidget( &label2);
lay.addWidget( &lepw);
QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
lay.addWidget( &autostart);
autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
#ifdef DESKTOP_VERSION
#ifdef _WIN32_
QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
syncdesktop.hide();// not implemented!
#else
QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
#endif
lay.addWidget( &syncdesktop);
#else
mPrefs->mPassiveSyncWithDesktop = false;
QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
syncdesktop.hide();
#endif
syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
QPushButton pb ( "OK", &dia);
@@ -775,152 +778,152 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
mParent->topLevelWidget()->setCaption ("KDE-Pim");
return;
}
mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) );
//qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
if ( syncWithFile( localTempFile, true ) ) {
if ( mWriteBackFile ) {
int fi;
if ( (fi = postCommand.find("$PWD$")) > 0 ) {
QString pwd = getPassword();
postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
}
mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
result = system ( postCommand );
qDebug("KSM::Sync:Writing back file result: %d ", result);
if ( result != 0 ) {
mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
return;
} else {
mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
}
}
}
return;
}
bool KSyncManager::edit_pisync_options()
{
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
- QVBoxLayout lay ( &dia );
+ Q3VBoxLayout lay ( &dia );
lay.setSpacing( 5 );
lay.setMargin( 3 );
QLabel lab1 ( i18n("Password for remote access:"), &dia);
lay.addWidget( &lab1 );
QLineEdit le1 (&dia );
lay.addWidget( &le1 );
QLabel lab2 ( i18n("Remote IP address:"), &dia);
lay.addWidget( &lab2 );
QLineEdit le2 (&dia );
lay.addWidget( &le2 );
QLabel lab3 ( i18n("Remote port number:\n(May be: 1 - 65535)"), &dia);
lay.addWidget( &lab3 );
QLineEdit le3 (&dia );
lay.addWidget( &le3 );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
le1.setText( mPassWordPiSync );
le2.setText( mActiveSyncIP );
le3.setText( mActiveSyncPort );
if ( dia.exec() ) {
mPassWordPiSync = le1.text();
mActiveSyncPort = le3.text();
mActiveSyncIP = le2.text();
return true;
}
return false;
}
bool KSyncManager::edit_sync_options()
{
QDialog dia( mParent, "dia", true );
dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
- QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
- QVBoxLayout lay ( &dia );
+ Q3ButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
+ Q3VBoxLayout lay ( &dia );
lay.setSpacing( 2 );
lay.setMargin( 3 );
lay.addWidget(&gr);
QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
//QRadioButton both( i18n("Take both on conflict"), &gr );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
switch ( mSyncAlgoPrefs ) {
case 0:
loc.setChecked( true);
break;
case 1:
rem.setChecked( true );
break;
case 2:
newest.setChecked( true);
break;
case 3:
ask.setChecked( true);
break;
case 4:
f_loc.setChecked( true);
break;
case 5:
f_rem.setChecked( true);
break;
case 6:
// both.setChecked( true);
break;
default:
break;
}
if ( dia.exec() ) {
mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
return true;
}
return false;
}
QString KSyncManager::getPassword( )
{
QString retfile = "";
QDialog dia ( mParent, "input-dialog", true );
QLineEdit lab ( &dia );
lab.setEchoMode( QLineEdit::Password );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
lay.addWidget( &lab);
dia.setFixedSize( 230,50 );
dia.setCaption( i18n("Enter password") );
QPushButton pb ( "OK", &dia);
lay.addWidget( &pb );
connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
dia.show();
int res = dia.exec();
if ( res )
retfile = lab.text();
dia.hide();
qApp->processEvents();
return retfile;
}
void KSyncManager::confSync()
{
static KSyncPrefsDialog* sp = 0;
if ( ! sp ) {
sp = new KSyncPrefsDialog( mParent, "syncprefs", true );
}
sp->usrReadConfig();
#ifndef DESKTOP_VERSION
sp->showMaximized();
#else
sp->show();
#endif
sp->exec();
@@ -1305,103 +1308,103 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
mPisyncFinished = true;
} else {
qDebug("KSS: Error: unknown state: %d ", state);
mPisyncFinished = true;
}
delete s;
}
void KSyncManager::readFileFromSocket()
{
QString fileName = syncFileName();
bool syncOK = true;
mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
if ( ! syncWithFile( fileName , true ) ) {
mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
syncOK = false;
}
KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
if ( mWriteBackFile && syncOK ) {
mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") );
commandSocket->writeFile( fileName );
}
else {
commandSocket->sendStop();
if ( syncOK )
mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
mPisyncFinished = true;
}
}
-KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
+KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : Q3ServerSocket( port, backlog, parent, name )
{
mPendingConnect = 0;
mPassWord = pw;
mSocket = 0;
mSyncActionDialog = 0;
blockRC = false;
mErrorMessage = 0;
}
void KServerSocket::waitForSocketFinish()
{
if ( mSocket ) {
//qDebug("KSS:: waiting for finish operation");
QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish()));
return;
}
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
mSocket->setSocket( mPendingConnect );
mPendingConnect = 0;
}
void KServerSocket::newConnection ( int socket )
{
// qDebug("KServerSocket:New connection %d ", socket);
if ( mPendingConnect ) {
qDebug("KSS::Error : new Connection");
return;
}
if ( mSocket ) {
mPendingConnect = socket;
QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish()));
return;
qDebug("KSS::newConnection Socket deleted! ");
delete mSocket;
mSocket = 0;
}
mPendingConnect = 0;
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
mSocket->setSocket( socket );
}
void KServerSocket::discardClient()
{
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
}
void KServerSocket::deleteSocket()
{
//qDebug("KSS::deleteSocket");
if ( mSocket ) {
delete mSocket;
mSocket = 0;
}
if ( mErrorMessage )
QTimer::singleShot( 10, this , SLOT ( displayErrorMessage()));
}
void KServerSocket::readClient()
{
if ( blockRC )
return;
if ( mSocket == 0 ) {
qDebug("ERROR::KSS::readClient(): mSocket == 0 ");
return;
}
if ( mErrorMessage ) {
mErrorMessage = 999;
error_connect("ERROR_ED\r\n\r\n");
return;
}
@@ -1433,366 +1436,366 @@ void KServerSocket::readClient()
if ( tokens[0] == "PUT" ) {
if ( tokens[1] == mPassWord ) {
//emit getFile( mSocket );
blockRC = true;
mResource =tokens[2];
get_file();
}
else {
mErrorMessage = 2;
error_connect("ERROR_PW\r\n\r\n");
end_connect();
}
}
if ( tokens[0] == "STOP" ) {
//emit endConnect();
end_connect();
}
}
}
void KServerSocket::displayErrorMessage()
{
if ( mErrorMessage == 1 ) {
KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error"));
mErrorMessage = 0;
}
else if ( mErrorMessage == 2 ) {
KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error"));
mErrorMessage = 0;
}
}
void KServerSocket::error_connect( QString errmess )
{
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os( mSocket );
+ os.setEncoding( Q3TextStream::Latin1 );
os << errmess ;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle ) {
+ if ( mSocket->state() == Q3Socket::Idle ) {
QTimer::singleShot( 0, this , SLOT ( discardClient()));
}
}
void KServerSocket::end_connect()
{
delete mSyncActionDialog;
mSyncActionDialog = 0;
}
void KServerSocket::send_file()
{
//qDebug("MainWindow::sendFile(QSocket* s) ");
if ( mSyncActionDialog )
delete mSyncActionDialog;
mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
mSyncActionDialog->setCaption(i18n("Received sync request"));
QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
label->setAlignment ( Qt::AlignHCenter );
- QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( mSyncActionDialog );
lay->addWidget( label);
lay->setMargin(7);
lay->setSpacing(7);
if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent );
//secs = 333;
if ( secs < 0 )
secs = secs * (-1);
if ( secs > 30 )
//if ( true )
{
QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs );
QLabel* label = new QLabel( warning, mSyncActionDialog );
label->setAlignment ( Qt::AlignHCenter );
lay->addWidget( label);
if ( secs > 180 )
{
if ( secs > 300 ) {
if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) {
qDebug("KSS::Sync cancelled ,cs");
mErrorMessage = 0;
end_connect();
error_connect("ERROR_CA\r\n\r\n");
return ;
}
}
QFont f = label->font();
f.setPointSize ( f.pointSize() *2 );
f. setBold (true );
QLabel* label = new QLabel( warning, mSyncActionDialog );
label->setFont( f );
warning = i18n("ADJUST\nYOUR\nCLOCKS!");
label->setText( warning );
label->setAlignment ( Qt::AlignHCenter );
lay->addWidget( label);
mSyncActionDialog->setFixedSize( 230, 300);
} else {
mSyncActionDialog->setFixedSize( 230, 200);
}
} else {
mSyncActionDialog->setFixedSize( 230, 120);
}
} else
mSyncActionDialog->setFixedSize( 230, 120);
mSyncActionDialog->show();
mSyncActionDialog->raise();
emit request_file(mResource);
//emit request_file();
qApp->processEvents();
QString fileName = mFileName;
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
mErrorMessage = 0;
end_connect();
error_connect("ERROR_FI\r\n\r\n");
return ;
}
mSyncActionDialog->setCaption( i18n("Sending file...") );
- QTextStream ts( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os( mSocket );
+ os.setEncoding( Q3TextStream::Latin1 );
while ( ! ts.atEnd() ) {
os << ts.readLine() << "\r\n";
}
os << "\r\n";
//os << ts.read();
file.close();
mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( discardClient()));
}
void KServerSocket::get_file()
{
mSyncActionDialog->setCaption( i18n("Receiving synced file...") );
piTime.start();
piFileString = "";
QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) ));
}
void KServerSocket::readBackFileFromSocket()
{
//qDebug("readBackFileFromSocket() %d ", piTime.elapsed ());
while ( mSocket->canReadLine () ) {
piTime.restart();
QString line = mSocket->readLine ();
piFileString += line;
//qDebug("readline: %s ", line.latin1());
mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) );
}
if ( piTime.elapsed () < 3000 ) {
// wait for more
//qDebug("waitformore ");
QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) ));
return;
}
QString fileName = mFileName;
QFile file ( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
delete mSyncActionDialog;
mSyncActionDialog = 0;
qDebug("KSS:Error open read back file ");
piFileString = "";
emit file_received( false, mResource);
emit file_received( false);
blockRC = false;
return ;
}
// mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
- QTextStream ts ( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts ( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
mSyncActionDialog->setCaption( i18n("Writing file to disk...") );
ts << piFileString;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( discardClient()));
file.close();
piFileString = "";
emit file_received( true, mResource );
emit file_received( true);
delete mSyncActionDialog;
mSyncActionDialog = 0;
blockRC = false;
}
KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name )
{
mRemoteResource = remres;
if ( mRemoteResource.isEmpty() )
mRemoteResource = "ALL";
else
mRemoteResource.replace (QRegExp (" "),"_" );
mPassWord = password;
mSocket = 0;
mFirst = false;
mFirstLine = true;
mPort = port;
mHost = host;
tlw = cap;
mRetVal = quiet;
mTimerSocket = new QTimer ( this );
connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) );
mConnectProgress.setCaption( i18n("Pi-Sync") );
connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) );
mConnectCount = -1;
}
void KCommandSocket::sendFileRequest()
{
if ( tlw )
tlw->setCaption( i18n("Connected! Sending request for remote file ...") );
mConnectProgress.hide();
mConnectCount = 300;mConnectMax = 300;
mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") );
mConnectProgress.setLabelText( i18n("Waiting for remote file...") );
mTimerSocket->start( 100, true );
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os( mSocket );
+ os.setEncoding( Q3TextStream::Latin1 );
QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n";
}
void KCommandSocket::readFile( QString fn )
{
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
//qDebug("KCS: read file - new socket");
connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() ));
}
mFileString = "";
mFileName = fn;
mFirst = true;
if ( tlw )
tlw->setCaption( i18n("Trying to connect to remote...") );
mConnectCount = 30;mConnectMax = 30;
mTimerSocket->start( 1000, true );
mSocket->connectToHost( mHost, mPort );
//qDebug("KCS: Waiting for connection");
}
void KCommandSocket::updateConnectDialog()
{
if ( mConnectCount == mConnectMax ) {
//qDebug("MAXX %d", mConnectMax);
mConnectProgress.setTotalSteps ( 30 );
mConnectProgress.show();
mConnectProgress.setLabelText( i18n("Trying to connect to remote...") );
}
//qDebug("updateConnectDialog() %d", mConnectCount);
mConnectProgress.raise();
mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 );
--mConnectCount;
if ( mConnectCount > 0 )
mTimerSocket->start( 1000, true );
else
deleteSocket();
}
void KCommandSocket::writeFile( QString fileName )
{
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
}
mFileName = fileName ;
mConnectCount = 30;mConnectMax = 30;
mTimerSocket->start( 1000, true );
mSocket->connectToHost( mHost, mPort );
}
void KCommandSocket::writeFileToSocket()
{
mTimerSocket->stop();
QFile file2( mFileName );
- if (!file2.open( IO_ReadOnly ) ) {
+ if (!file2.open( QIODevice::ReadOnly ) ) {
mConnectProgress.hide();
mConnectCount = -1;
mRetVal= errorW;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
return ;
}
mConnectProgress.setTotalSteps ( file2.size() );
mConnectProgress.show();
int count = 0;
mConnectProgress.setLabelText( i18n("Sending back synced file...") );
mConnectProgress.setProgress( count );
mConnectProgress.blockSignals( true );
- QTextStream ts2( &file2 );
- ts2.setEncoding( QTextStream::Latin1 );
- QTextStream os2( mSocket );
- os2.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts2( &file2 );
+ ts2.setEncoding( Q3TextStream::Latin1 );
+ Q3TextStream os2( mSocket );
+ os2.setEncoding( Q3TextStream::Latin1 );
os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";;
int byteCount = 0;
int byteMax = file2.size()/53;
while ( ! ts2.atEnd() ) {
qApp->processEvents();
if ( byteCount > byteMax ) {
byteCount = 0;
mConnectProgress.setProgress( count );
}
QString temp = ts2.readLine();
count += temp.length();
byteCount += temp.length();
os2 << temp << "\r\n";
}
file2.close();
mConnectProgress.hide();
mConnectCount = -1;
os2 << "\r\n";
mRetVal= successW;
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
mConnectProgress.blockSignals( false );
}
void KCommandSocket::sendStop()
{
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ mSocket = new Q3Socket( this );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
}
mSocket->connectToHost( mHost, mPort );
- QTextStream os2( mSocket );
- os2.setEncoding( QTextStream::Latin1 );
+ Q3TextStream os2( mSocket );
+ os2.setEncoding( Q3TextStream::Latin1 );
os2 << "STOP\r\n\r\n";
mSocket->close();
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
}
void KCommandSocket::startReadFileFromSocket()
{
if ( ! mFirst )
return;
mConnectProgress.setLabelText( i18n("Receiving file from remote...") );
mFirst = false;
mFileString = "";
mTime.start();
mFirstLine = true;
QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) ));
}
void KCommandSocket::readFileFromSocket()
{
//qDebug("readBackFileFromSocket() %d ", mTime.elapsed ());
while ( mSocket->canReadLine () ) {
mTime.restart();
QString line = mSocket->readLine ();
if ( mFirstLine ) {
mFirstLine = false;
if ( line.left( 6 ) == "ERROR_" ) {
mTimerSocket->stop();
mConnectCount = -1;
if ( line.left( 8 ) == "ERROR_PW" ) {
mRetVal = errorPW;
deleteSocket();
return ;
}
if ( line.left( 8 ) == "ERROR_CA" ) {
@@ -1800,83 +1803,83 @@ void KCommandSocket::readFileFromSocket()
deleteSocket();
return ;
}
if ( line.left( 8 ) == "ERROR_FI" ) {
mRetVal = errorFI;
deleteSocket();
return ;
}
if ( line.left( 8 ) == "ERROR_ED" ) {
mRetVal = errorED;
deleteSocket();
return ;
}
mRetVal = errorUN;
deleteSocket();
return ;
}
}
mFileString += line;
//qDebug("readline: %s ", line.latin1());
}
if ( mTime.elapsed () < 3000 ) {
// wait for more
//qDebug("waitformore ");
QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) ));
return;
}
mTimerSocket->stop();
mConnectCount = -1;
mConnectProgress.hide();
QString fileName = mFileName;
QFile file ( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
mFileString = "";
mRetVal = errorR;
qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() );
deleteSocket();
return ;
}
// mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
- QTextStream ts ( &file );
- ts.setEncoding( QTextStream::Latin1 );
+ Q3TextStream ts ( &file );
+ ts.setEncoding( Q3TextStream::Latin1 );
ts << mFileString;
file.close();
mFileString = "";
mRetVal = successR;
mSocket->close();
// if state is not idle, deleteSocket(); is called via
// connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
- if ( mSocket->state() == QSocket::Idle )
+ if ( mSocket->state() == Q3Socket::Idle )
deleteSocket();
}
void KCommandSocket::deleteSocket()
{
//qDebug("KCommandSocket::deleteSocket() ");
mConnectProgress.hide();
if ( mConnectCount >= 0 ) {
mTimerSocket->stop();
mRetVal = errorTO;
qDebug("KCS::Connection to remote host timed out");
if ( mSocket ) {
mSocket->close();
//if ( mSocket->state() == QSocket::Idle )
// deleteSocket();
delete mSocket;
mSocket = 0;
}
if ( mConnectCount == 0 )
KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?"));
else if ( tlw )
tlw->setCaption( i18n("Connection to remote host cancelled!") );
emit commandFinished( this, mRetVal );
return;
}
//qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
if ( mSocket)
delete mSocket;
mSocket = 0;
//qDebug("commandFinished ");
emit commandFinished( this, mRetVal );
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 71d17e9..32c6557 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -1,167 +1,169 @@
/*
This file is part of KDE-Pim/Pi.
Copyright (c) 2004 Ulf Schenk
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
$Id$
*/
#ifndef _KSYNCMANAGER_H
#define _KSYNCMANAGER_H
#include <qobject.h>
#include <qstring.h>
-#include <qsocket.h>
+#include <q3socket.h>
#include <qdatetime.h>
-#include <qserversocket.h>
-#include <qtextstream.h>
+#include <q3serversocket.h>
+#include <q3textstream.h>
#include <qregexp.h>
-#include <qprogressdialog.h>
+#include <q3progressdialog.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
#include <kdialog.h>
-class QPopupMenu;
+class Q3PopupMenu;
class KSyncProfile;
class KPimPrefs;
class QWidget;
class KSyncManager;
class KSyncInterface;
-class QProgressBar;
+class Q3ProgressBar;
-class KServerSocket : public QServerSocket
+class KServerSocket : public Q3ServerSocket
{
Q_OBJECT
public:
KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 );
void newConnection ( int socket ) ;
void setFileName( QString fn ) {mFileName = fn;};
signals:
void file_received( bool );
void request_file();
void file_received( bool, const QString &);
void request_file(const QString &);
void saveFile();
void endConnect();
private slots:
void waitForSocketFinish();
void discardClient();
void deleteSocket();
void readClient();
void displayErrorMessage();
void readBackFileFromSocket();
private :
int mPendingConnect;
QString mResource;
int mErrorMessage;
bool blockRC;
void send_file();
void get_file();
void end_connect();
void error_connect( QString );
QDialog* mSyncActionDialog;
- QSocket* mSocket;
+ Q3Socket* mSocket;
QString mPassWord;
QString mFileName;
QTime piTime;
QString piFileString;
};
class KCommandSocket : public QObject
{
Q_OBJECT
public:
enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet };
KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
void readFile( QString );
void writeFile( QString );
void sendStop();
private slots :
void sendFileRequest();
void updateConnectDialog();
signals:
void commandFinished( KCommandSocket*, int );
private slots:
void startReadFileFromSocket();
void readFileFromSocket();
void deleteSocket();
void writeFileToSocket();
private :
QString mRemoteResource;
int mConnectCount;
int mConnectMax;
KProgressDialog mConnectProgress;
QWidget* tlw;
- QSocket* mSocket;
+ Q3Socket* mSocket;
QString mPassWord;
Q_UINT16 mPort;
QString mHost;
QString mFileName;
QTimer* mTimerSocket;
int mRetVal;
QTime mTime;
QString mFileString;
bool mFirst;
bool mFirstLine;
};
class KSyncManager : public QObject
{
Q_OBJECT
public:
enum TargetApp {
KOPI = 0,
KAPI = 1,
PWMPI = 2 };
- KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
+ KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, Q3PopupMenu* syncmenu);
~KSyncManager() ;
void multiSync( bool askforPrefs );
bool blockSave() { return mBlockSaveFlag; }
void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
void setDefaultFileName( QString s) ;
QString defaultFileName() { return mDefFileName ;}
QString syncFileName();
void enableQuick( bool ask = true);
bool syncWithDesktop () { return mSyncWithDesktop;}
QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
QString getCurrentSyncName() { return mCurrentSyncName; }
void showProgressBar(int percentage, QString caption = QString::null, int total=100);
void hideProgressBar();
bool isProgressBarCanceled();
// sync stuff
QString mLocalMachineName;
QStringList mExternSyncProfiles;
QStringList mSyncProfileNames;
bool mAskForPreferences;
bool mShowSyncSummary;
bool mIsKapiFile;
bool mWriteBackExistingOnly;
int mSyncAlgoPrefs;
bool mWriteBackFile;
int mWriteBackInFuture;
int mWriteBackInPast;
QString mPhoneDevice;
QString mPhoneConnection;
@@ -190,59 +192,59 @@ class KSyncManager : public QObject
void readFileFromSocket();
void fillSyncMenu();
private:
void syncPi();
KServerSocket * mServerSocket;
KPimPrefs* mPrefs;
QString mDefFileName;
QString mCurrentSyncDevice;
QString mCurrentSyncName;
void quickSyncLocalFile();
bool syncWithFile( QString fn , bool quick );
void syncLocalFile();
void syncPhone();
void syncSharp();
void syncKDE();
void syncOL();
bool syncExternalApplication(QString);
int mCurrentSyncProfile ;
void syncRemote( KSyncProfile* prof, bool ask = true);
bool edit_sync_options();
bool edit_pisync_options();
int ringSync();
QString getPassword( );
bool mPisyncFinished;
QStringList mSpecificResources;
QString mCurrentResourceLocal;
QString mCurrentResourceRemote;
bool mBlockSaveFlag;
QWidget* mParent;
KSyncInterface* mImplementation;
TargetApp mTargetApp;
- QPopupMenu* mSyncMenu;
- QProgressBar* bar;
+ Q3PopupMenu* mSyncMenu;
+ Q3ProgressBar* bar;
bool mSyncWithDesktop;
private slots:
void displayErrorPort();
void confSync();
};
class KSyncInterface
{
public :
virtual void removeSyncInfo( QString syncProfile) = 0;
virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0;
virtual bool syncExternal(KSyncManager* /*manager*/, QString /*resource*/)
{
// empty implementation, because some syncable applications do not
// have an external(sharpdtm) syncmode, like pwmanager.
return false;
}
};
#endif
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 2b87298..fd5bbca 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,413 +1,417 @@
/*
This file is part of KOrganizer.
Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
#include <qlabel.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
+#include <q3groupbox.h>
+#include <q3buttongroup.h>
#include <qlineedit.h>
#include <qfont.h>
#include <qslider.h>
#include <qfile.h>
#include <qdir.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qcombobox.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qspinbox.h>
#include <qdatetime.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
-#include <qstrlist.h>
+#include <q3strlist.h>
#include <qapplication.h>
#include <qlayout.h>
-#include <qscrollview.h>
-#include <qvgroupbox.h>
-#include <qhgroupbox.h>
+#include <q3scrollview.h>
+#include <q3vgroupbox.h>
+#include <q3hgroupbox.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3Frame>
#include <kcolorbutton.h>
#include <kdebug.h>
#include <klocale.h>
#include <kglobal.h>
#include <kfontdialog.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kiconloader.h>
#include <kemailsettings.h>
#include <kstandarddirs.h>
#include <kfiledialog.h>
#include <kmessagebox.h>
//#include <kurlrequester.h>
#include <klineedit.h>
#include "ksyncprofile.h"
//#include "koprefs.h"
#include "ksyncprefsdialog.h"
//#include "koglobals.h"
KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
KDialog(parent,name,true)
{
setCaption( i18n("Synchronization Preferences"));
mSyncProfiles.setAutoDelete( true );
setupSyncAlgTab();
}
KSyncPrefsDialog::~KSyncPrefsDialog()
{
}
void KSyncPrefsDialog::setupSyncAlgTab()
{
QLabel * lab;
//QFrame *page = addPage(i18n("Sync Prefs"),0,0);
- QVBox * mainbox = new QVBox( this );
- QScrollView* sv = new QScrollView( mainbox );
- QHBoxLayout * lay = new QHBoxLayout( this );
+ Q3VBox * mainbox = new Q3VBox( this );
+ Q3ScrollView* sv = new Q3ScrollView( mainbox );
+ Q3HBoxLayout * lay = new Q3HBoxLayout( this );
lay->addWidget( mainbox );
- QHBox * b_box = new QHBox( mainbox );
+ Q3HBox * b_box = new Q3HBox( mainbox );
QPushButton* button = new QPushButton( i18n("Ok"), b_box );
connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
button = new QPushButton( i18n("Cancel"), b_box );
connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
//QBoxLayout * sl = new QVBoxLayout(this );
//sl->addWidget ( sv );
- sv->setResizePolicy ( QScrollView::AutoOneFit );
- QFrame *topFrame = new QFrame ( sv );
+ sv->setResizePolicy ( Q3ScrollView::AutoOneFit );
+ Q3Frame *topFrame = new Q3Frame ( sv );
sv->addChild( topFrame );
mSetupSyncAlgTab = topFrame;
- QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
+ Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2);
topLayout->setSpacing(spacingHint());
topLayout->setMargin(marginHint());
//lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
int iii = 0;
//topLayout->addMultiCellWidget(lab , iii,iii,0,1);
//++iii;
mMyMachineName = new QLineEdit(topFrame);
lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mMyMachineName,iii,1);
++iii;
- QHBox* buttonbox = new QHBox( topFrame);
+ Q3HBox* buttonbox = new Q3HBox( topFrame);
topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
++iii;
button = new QPushButton( i18n("New profile"), buttonbox );
connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
button = new QPushButton( i18n("Clone profile"), buttonbox );
connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
button = new QPushButton( i18n("Delete profile"), buttonbox );
connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
mProfileBox = new QComboBox(topFrame);
mProfileBox->setEditable ( true );
mProfileBox->setInsertionPolicy(QComboBox::NoInsertion);
connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
topLayout->addWidget(lab ,iii,0);
topLayout->addWidget(mProfileBox, iii,1);
++iii;
- QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame);
+ Q3HGroupBox *iims = new Q3HGroupBox( i18n("Multiple Sync options"), topFrame);
new QLabel( i18n("Include in multiple "), iims );
mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
new QLabel( i18n(" sync"), iims );
topLayout->addMultiCellWidget(iims, iii,iii,0,1);
++iii;
- QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame);
+ Q3VGroupBox* gb0 = new Q3VGroupBox( i18n("Sync algo options"), topFrame);
topLayout->addMultiCellWidget(gb0, iii,iii,0,1);
++iii;
- QButtonGroup* gr;
+ Q3ButtonGroup* gr;
{
- QVGroupBox* topFrame = gb0;
+ Q3VGroupBox* topFrame = gb0;
mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
//topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
//++iii;
- gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
+ gr = new Q3ButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
//topLayout->addMultiCellWidget(gr, iii,iii,0,1);
//++iii;
loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
// both = new QRadioButton ( i18n("Take both on conflict"), gr );
mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
//topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
//++iii;
#if 0
- QHGroupBox* gb51 = new QHGroupBox( i18n("Local resources to sync with:"), topFrame);
+ Q3HGroupBox* gb51 = new Q3HGroupBox( i18n("Local resources to sync with:"), topFrame);
{
- QVBox * fibo2 = new QVBox ( gb51 );
+ Q3VBox * fibo2 = new Q3VBox ( gb51 );
new QLabel ( i18n("Calendar resources:"), fibo2 );
//mFilterInCal = new QComboBox( fibo2 );
- fibo2 = new QVBox ( gb51 );
+ fibo2 = new Q3VBox ( gb51 );
new QLabel ( i18n("Addressbook resources:"), fibo2 );
//mFilterInAB = new QComboBox( fibo2 );
}
#endif
- QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
- QVBox * fibo2 = new QVBox ( gb5 );
+ Q3HGroupBox* gb5 = new Q3HGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
+ Q3VBox * fibo2 = new Q3VBox ( gb5 );
new QLabel ( i18n("Incoming calendar filter:"), fibo2 );
mFilterInCal = new QComboBox( fibo2 );
- fibo2 = new QVBox ( gb5 );
+ fibo2 = new Q3VBox ( gb5 );
new QLabel ( i18n("Incoming addressbook filter:"), fibo2 );
mFilterInAB = new QComboBox( fibo2 );
mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
// topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
// ++iii;
- QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame);
+ Q3VGroupBox* gb2 = new Q3VGroupBox( i18n("Write back options"), topFrame);
//topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
//++iii;
{
- QVGroupBox*topFrame = gb2;
+ Q3VGroupBox*topFrame = gb2;
mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
- QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
- QVBox * fibo = new QVBox ( gb4 );
+ Q3HGroupBox* gb4 = new Q3HGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
+ Q3VBox * fibo = new Q3VBox ( gb4 );
new QLabel ( i18n("Outgoing calendar filter:"), fibo );
mFilterOutCal = new QComboBox( fibo );
- fibo = new QVBox ( gb4 );
+ fibo = new Q3VBox ( gb4 );
new QLabel ( i18n("Outgoing addressbook filter:"), fibo );
mFilterOutAB = new QComboBox( fibo );
//topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
//++iii;
mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
//topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
//++iii;
- QVGroupBox* gb3 = new QVGroupBox( i18n("Time period"), topFrame);
+ Q3VGroupBox* gb3 = new Q3VGroupBox( i18n("Time period"), topFrame);
connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) );
new QLabel( i18n("From ") , gb3 );
- QHBox * tf1 = new QHBox ( gb3 );
+ Q3HBox * tf1 = new Q3HBox ( gb3 );
mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 );
mWriteBackPastWeeks->setMaximumWidth( 100 );
new QLabel( i18n(" weeks in the past to ") ,tf1 );
- QHBox * tf2 = new QHBox ( gb3 );
+ Q3HBox * tf2 = new Q3HBox ( gb3 );
mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2);
mWriteBackFutureWeeks->setMaximumWidth( 100 );
new QLabel( i18n(" weeks in the future ") , tf2 );
//topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
//++iii;
gb3->setEnabled( false );
connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) );
}
connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
}
- proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
+ proGr = new Q3ButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
gr = proGr;
topLayout->addMultiCellWidget(gr, iii,iii,0,1);
++iii;
mIsLocal = new QRadioButton ( i18n("Local file"), gr );
mIsPi = new QRadioButton ( i18n("Pi-Sync - all calendars ( direct Kx/Pi to Kx/Pi sync )"), gr );
connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected calendars ( direct Kx/Pi to Kx/Pi sync )"), gr );
connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
- QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame);
+ Q3VGroupBox* gb1 = new Q3VGroupBox( i18n("Profile kind specific settings"), topFrame);
topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
++iii;
// ******************************************
// Profile kind specific settings
{
// *** phone *******************************
- QVGroupBox* topFrame = gb1;
- phoneWidget = new QVBox( topFrame);
+ Q3VGroupBox* topFrame = gb1;
+ phoneWidget = new Q3VBox( topFrame);
//topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
//++iii;
mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
- QHBox* temphb = new QHBox( phoneWidget );
+ Q3HBox* temphb = new Q3HBox( phoneWidget );
new QLabel( i18n("I/O device: "), temphb );
mPhoneDevice = new QLineEdit( temphb);
button = new QPushButton( i18n("Help..."), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
- temphb = new QHBox( phoneWidget );
+ temphb = new Q3HBox( phoneWidget );
new QLabel( i18n("Connection: "), temphb );
mPhoneConnection = new QLineEdit( temphb);
button = new QPushButton( i18n("Help..."), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
- temphb = new QHBox( phoneWidget );
+ temphb = new Q3HBox( phoneWidget );
new QLabel( i18n("Model(opt.): "), temphb );
mPhoneModel = new QLineEdit( temphb);
button = new QPushButton( i18n("Help..."), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
// *** local*******************************
- localFileWidget = new QVBox( topFrame);
+ localFileWidget = new Q3VBox( topFrame);
//topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
//++iii;
- temphb = new QHBox( localFileWidget );
+ temphb = new Q3HBox( localFileWidget );
lab = new QLabel( i18n("Local file Cal:"), temphb );
lab = new QLabel( i18n("Local file ABook:"), temphb );
lab = new QLabel( i18n("Local file PWMgr:"), temphb );
- temphb = new QHBox( localFileWidget );
+ temphb = new Q3HBox( localFileWidget );
button = new QPushButton( i18n("Choose..."), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
button = new QPushButton( i18n("Choose..."), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
button = new QPushButton( i18n("Choose..."), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
- temphb = new QHBox( localFileWidget );
+ temphb = new Q3HBox( localFileWidget );
mRemoteFile = new QLineEdit( temphb);
mRemoteFileAB = new QLineEdit( temphb);
mRemoteFilePWM = new QLineEdit( temphb);
mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
// *** remote*******************************
- remoteFileWidget = new QVBox( topFrame);
+ remoteFileWidget = new Q3VBox( topFrame);
//topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
//++iii;
- temphb = new QHBox( remoteFileWidget );
+ temphb = new Q3HBox( remoteFileWidget );
new QLabel( i18n("Calendar:"), temphb);
new QLabel( i18n("AddressBook:"), temphb);
new QLabel( i18n("PWManager:"), temphb);
lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
- temphb = new QHBox( remoteFileWidget );
+ temphb = new Q3HBox( remoteFileWidget );
mRemotePrecommand = new QLineEdit(temphb);
mRemotePrecommandAB = new QLineEdit(temphb);
mRemotePrecommandPWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
- temphb = new QHBox( remoteFileWidget );
+ temphb = new Q3HBox( remoteFileWidget );
mLocalTempFile = new QLineEdit(temphb);
mLocalTempFileAB = new QLineEdit(temphb);
mLocalTempFilePWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
- temphb = new QHBox( remoteFileWidget );
+ temphb = new Q3HBox( remoteFileWidget );
mRemotePostcommand = new QLineEdit(temphb );
mRemotePostcommandAB = new QLineEdit(temphb );
mRemotePostcommandPWM = new QLineEdit(temphb );
mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
- temphb = new QHBox( remoteFileWidget );
+ temphb = new Q3HBox( remoteFileWidget );
button = new QPushButton( i18n("ssh/scp"), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
button = new QPushButton( i18n("ftp"), temphb );
connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
// *** pi-sync*******************************
- piWidget = new QVBox( topFrame);
+ piWidget = new Q3VBox( topFrame);
//topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
//++iii;
- temphb = new QHBox( piWidget );
+ temphb = new Q3HBox( piWidget );
new QLabel( i18n("Calendar:"), temphb);
new QLabel( i18n("AddressBook:"), temphb);
new QLabel( i18n("PWManager:"), temphb);
lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
- temphb = new QHBox( piWidget );
+ temphb = new Q3HBox( piWidget );
mRemotePw = new QLineEdit(temphb);
mRemotePwAB = new QLineEdit(temphb);
mRemotePwPWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
- temphb = new QHBox( piWidget );
+ temphb = new Q3HBox( piWidget );
mRemoteIP = new QLineEdit(temphb);
mRemoteIPAB = new QLineEdit(temphb);
mRemoteIPPWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
- temphb = new QHBox( piWidget );
+ temphb = new Q3HBox( piWidget );
mRemotePort = new QLineEdit(temphb);
mRemotePortAB = new QLineEdit(temphb);
mRemotePortPWM = new QLineEdit(temphb);
lab = new QLabel( i18n("Local/remote Resource sync partners (Leave empty to not sync)"), piWidget);
- mTableBox = new QHBox( piWidget );
- mResTableKopi = new QTable( 1, 1, mTableBox );
- mResTableKapi = new QTable( 1, 1, mTableBox );
- mResTablePwmpi = new QTable( 1, 1, mTableBox );
+ mTableBox = new Q3HBox( piWidget );
+ mResTableKopi = new Q3Table( 1, 1, mTableBox );
+ mResTableKapi = new Q3Table( 1, 1, mTableBox );
+ mResTablePwmpi = new Q3Table( 1, 1, mTableBox );
mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") );
mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") );
mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") );
mResTableKopi->setLeftMargin( 80 );
mResTableKapi->setLeftMargin( 80 );
}
// ******************************************
// Profile kind specific settings END
}
void KSyncPrefsDialog::readResources()
{
mResourcesKopi.clear();
KConfig fc(locateLocal("config","kopicalendarrc"));
fc.setGroup("CC");
int numCals = fc.readNumEntry("NumberCalendars",0 );
int curCal = 1;
while ( curCal <= numCals ) {
QString prefix = "Cal_" +QString::number( curCal );
QString name = fc.readEntry( prefix+"_Name", "Calendar");
mResourcesKopi.append( name );
++curCal;
}
mResTableKopi->setNumRows( mResourcesKopi.count() );
int i;
for ( i = 0;i < mResourcesKopi.count(); ++i ) {
mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] );
}
mResourcesKapi.clear();
@@ -439,65 +443,65 @@ void KSyncPrefsDialog::readFilter()
KConfig cfgko(locateLocal("config","korganizerrc"));
KConfig cfgka(locateLocal("config","kaddressbookrc"));
cfgko.setGroup("General");
mFilterKopi = cfgko.readListEntry("CalendarFilters");
cfgka.setGroup("Filter");
int count = cfgka.readNumEntry( "Count", 0 );
for ( int i = 0; i < count; i++ ) {
cfgka.setGroup("Filter_"+QString::number( i ) );
mFilterKapi.append( cfgka.readEntry("Name", "internal error") );
}
mFilterOutCal->clear();
mFilterInCal->clear();
mFilterOutAB->clear();
mFilterInAB->clear();
QStringList temp = mFilterKopi;
temp.prepend(i18n("No Filter") );
mFilterOutCal->insertStringList( temp );
mFilterInCal->insertStringList( temp );
temp = mFilterKapi;
temp.prepend(i18n("No Filter") );
mFilterOutAB->insertStringList( temp );
mFilterInAB->insertStringList( temp );
}
void KSyncPrefsDialog::slotOK()
{
if ( mMyMachineName->text() == "undefined" ) {
KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
return;
}
int i;
for (i = 0; i < mSyncProfileNames.count(); ++ i) {
- if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
+ if ( mSyncProfileNames.count( mSyncProfileNames[i]) > 1 ) {
KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
return;
}
}
usrWriteConfig();
QDialog::accept();
}
void KSyncPrefsDialog::accept()
{
slotOK();
}
void KSyncPrefsDialog::chooseFile()
{
QString fn = QDir::homeDirPath();
fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
if ( fn == "" )
return;
mRemoteFile->setText( fn );
}
void KSyncPrefsDialog::chooseFileAB()
{
QString fn = QDir::homeDirPath();
fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this );
if ( fn == "" )
return;
mRemoteFileAB->setText( fn );
}
void KSyncPrefsDialog::chooseFilePWM()
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h
index d8c02de..1d7503e 100644
--- a/libkdepim/ksyncprefsdialog.h
+++ b/libkdepim/ksyncprefsdialog.h
@@ -1,171 +1,171 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef _KSYNCPREFSDIALOG_H
#define _KSYNCPREFSDIALOG_H
#include <kdialogbase.h>
-#include <qptrlist.h>
-#include <qtable.h>
-#include <qhbox.h>
+#include <q3ptrlist.h>
+#include <q3table.h>
+#include <q3hbox.h>
//#include <libkdepim/kprefsdialog.h>
class KColorButton;
class QSpinBox;;
class QRadioButton;
class QCheckBox;
class QSlider;
class KURLRequester;
class QComboBox;
-class QButtonGroup;
+class Q3ButtonGroup;
class QLineEdit;
-class QVBox;
+class Q3VBox;
class QStringList;
class KSyncProfile;
/** Dialog to change the korganizer configuration.
*/
class KSyncPrefsDialog : public KDialog
{
Q_OBJECT
public:
/** Initialize dialog and pages */
KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false);
~KSyncPrefsDialog();
void usrReadConfig();
void setLocalMachineName ( const QString& name );
QString getLocalMachineName ( );
QStringList getSyncProfileNames();
public slots:
protected slots:
void accept();
void deleteProfile();
void newProfile();
void cloneProfile();
void kindChanged(bool);
void fillSSH();
void fillFTP();
void textChanged( const QString & );
void profileChanged( int );
void chooseFile();
void chooseFileAB();
void chooseFilePWM();
void slotOK();
void helpDevice();
void helpModel();
void helpConnection();
protected:
void usrWriteConfig();
void setupSyncAlgTab();
void readFilter();
void readResources();
private:
void updateMyCaption();
int currentSelection;
- QPtrList<KSyncProfile> mSyncProfiles;
+ Q3PtrList<KSyncProfile> mSyncProfiles;
QStringList mSyncProfileNames;
QStringList mFilterKapi;
QStringList mFilterKopi;
QStringList mResourcesKopi;
QStringList mResourcesKapi;
QLineEdit * mMyMachineName;
QComboBox * mProfileBox;
QRadioButton* mIsLocal;
QRadioButton* mIsNotLocal;
QRadioButton* mIsPhone;
QRadioButton* mIsPi;
QRadioButton* mIsPiSpecific;
QCheckBox* mIncludeInRing;
QCheckBox* mIncludeInRingAB;
QCheckBox* mIncludeInRingPWM;
void addProfile ( KSyncProfile* );
void insertProfiles();
void saveProfile();
- QButtonGroup* proGr;
- QHBox * mTableBox;
- QTable* mResTableKopi;
- QTable* mResTableKapi;
- QTable* mResTablePwmpi;
+ Q3ButtonGroup* proGr;
+ Q3HBox * mTableBox;
+ Q3Table* mResTableKopi;
+ Q3Table* mResTableKapi;
+ Q3Table* mResTablePwmpi;
QComboBox * mFilterOutCal;
QComboBox * mFilterInCal;
QComboBox * mFilterOutAB;
QComboBox * mFilterInAB;
QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both;
QLineEdit * mRemotePostcommand;
QLineEdit * mRemotePrecommand;
QLineEdit * mRemoteFile;
QLineEdit * mLocalTempFile;
QLineEdit * mRemotePostcommandAB;
QLineEdit * mRemotePrecommandAB;
QLineEdit * mRemoteFileAB;
QLineEdit * mLocalTempFileAB;
QLineEdit * mRemotePostcommandPWM;
QLineEdit * mRemotePrecommandPWM;
QLineEdit * mRemoteFilePWM;
QLineEdit * mLocalTempFilePWM;
QLineEdit * mRemotePw;
QLineEdit * mRemoteIP;
QLineEdit * mRemotePort;
QLineEdit * mRemotePwAB;
QLineEdit * mRemoteIPAB;
QLineEdit * mRemotePortAB;
QLineEdit * mRemotePwPWM;
QLineEdit * mRemoteIPPWM;
QLineEdit * mRemotePortPWM;
QLineEdit * mPhoneDevice;
QLineEdit * mPhoneConnection;
QLineEdit * mPhoneModel;
QWidget* mSetupSyncAlgTab;
- QVBox* localFileWidget;
- QVBox* remoteFileWidget;
- QVBox* phoneWidget;
- QVBox* piWidget;
+ Q3VBox* localFileWidget;
+ Q3VBox* remoteFileWidget;
+ Q3VBox* phoneWidget;
+ Q3VBox* piWidget;
QCheckBox* mWriteBackFile;
QCheckBox* mWriteBackFuture;
QSpinBox* mWriteBackFutureWeeks;
QSpinBox* mWriteBackPastWeeks;
QCheckBox* mWriteBackExisting;
QCheckBox* mAskForPreferences;
QCheckBox* mShowSummaryAfterSync;
QCheckBox* mWriteContactToSIM;
QCheckBox* mIsKapiFileL;
QCheckBox* mIsKapiFileR;
};
#endif
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index 91fcfc5..1e41662 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -1,55 +1,55 @@
/*
This file is part of KDE-Pim/Pi.
Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _KSYNCPROFILE_H
#define _KSYNCPROFILE_H
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qcolor.h>
#include <qfont.h>
#include <qstringlist.h>
#include <qobject.h>
#include <qstring.h>
#include <libkcal/syncdefines.h>
class KConfig;
class KSyncProfile : public QObject {
public:
KSyncProfile();
~KSyncProfile() ;
KSyncProfile* clone();
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
void deleteConfig(KConfig *);
void setRemotePw( const QString& n ) {mRemotePw = n;}
QString getRemotePw( ) { return mRemotePw; }
void setRemotePwAB( const QString& n ) {mRemotePwAB = n;}
QString getRemotePwAB( ) { return mRemotePwAB; }
void setRemotePwPWM( const QString& n ) {mRemotePwPWM = n;}
QString getRemotePwPWM( ) { return mRemotePwPWM; }
void setRemoteIP( const QString& n ) {mRemoteIP = n;}
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro
index 7160d0e..fb27311 100644
--- a/libkdepim/libkdepim.pro
+++ b/libkdepim/libkdepim.pro
@@ -1,36 +1,36 @@
TEMPLATE = lib
CONFIG = qt warn_on
DEFINES +=KORG_NOKABC
-TARGET = microkdepim
+TARGET = xmicrokdepim
INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . ..
DESTDIR=../bin
DEFINES += DESKTOP_VERSION
include( ../variables.pri )
unix : {
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kpimprefs.h \
kpimglobalprefs.h \
kprefsdialog.h \
kprefswidget.h \
ksyncmanager.h \
ksyncprofile.h \
ksyncprefsdialog.h \
@@ -45,32 +45,34 @@ SOURCES = \
categoryselectdialog_base.cpp \
externalapphandler.cpp \
kdateedit.cpp \
kdatepicker.cpp \
kinputdialog.cpp \
kpimprefs.cpp \
kpimglobalprefs.cpp \
kprefsdialog.cpp \
kprefswidget.cpp \
ksyncmanager.cpp \
ksyncprofile.cpp \
ksyncprefsdialog.cpp \
kcmconfigs/kcmkdepimconfig.cpp \
kcmconfigs/kdepimconfigwidget.cpp \
phoneaccess.cpp
win32: {
#olimport section
importol {
debug: {
LIBS += mfc71ud.lib
}
release: {
LIBS += mfc71u.lib
}
DEFINES += _OL_IMPORT_
HEADERS += ol_access.h
SOURCES += ol_access.cpp
#olimport section end
}
}
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index f3db68e..4b42184 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,38 +1,38 @@
TEMPLATE = lib
CONFIG += qt warn_on
-TARGET = microkdepim
+TARGET = xmicrokdepim
INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
-LIBS += -lmicrokde
-#LIBS += -lmicrokcal
+LIBS += -lxmicrokde
+#LIBS += -lxmicrokcal
LIBS += -L$(QPEDIR)/lib
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
categoryeditdialog.h \
categoryeditdialog_base.h \
categoryselectdialog.h \
categoryselectdialog_base.h \
externalapphandler.h \
kdateedit.h \
kdatepicker.h \
kinputdialog.h \
kpimprefs.h \
kpimglobalprefs.h \
kprefsdialog.h \
kprefswidget.h \
ksyncmanager.h \
ksyncprofile.h \
ksyncprefsdialog.h \
kcmconfigs/kcmkdepimconfig.h \
kcmconfigs/kdepimconfigwidget.h \
phoneaccess.h
SOURCES = \
categoryeditdialog.cpp \
diff --git a/libkdepim/ol_access.cpp b/libkdepim/ol_access.cpp
index 1b05693..821f148 100755
--- a/libkdepim/ol_access.cpp
+++ b/libkdepim/ol_access.cpp
@@ -1,208 +1,208 @@
/*
This file is part of KDE-Pim/Pi.
Copyright (c) 2006 Lutz Rogowski <rogowski@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qtooltip.h>
-#include <qframe.h>
+#include <q3frame.h>
#include <qpixmap.h>
#include <qlayout.h>
-#include <qprogressbar.h>
-#include <qprogressdialog.h>
-#include <qwidgetstack.h>
+#include <q3progressbar.h>
+#include <q3progressdialog.h>
+#include <q3widgetstack.h>
#include <qdatetime.h>
#include <qdir.h>
#include <qpushbutton.h>
#include <qregexp.h>
#include <qapplication.h>
-#include <qhbox.h>
-#include <qheader.h>
+#include <q3hbox.h>
+#include <q3header.h>
#include <qdatetime.h>
-#include <qlistview.h>
+#include <q3listview.h>
#include <kdebug.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kstaticdeleter.h>
#include <kdialogbase.h>
#include <ol_access.h>
#include "../outport/msoutl9.h"
#include <ole2.h>
#include <comutil.h>
-class OLEListViewItem : public QCheckListItem
+class OLEListViewItem : public Q3CheckListItem
{
public:
- OLEListViewItem( QListView *parent, QString text ) :
- QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
- OLEListViewItem( QListViewItem *after, QString text ) :
- QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
+ OLEListViewItem( Q3ListView *parent, QString text ) :
+ Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox ) { ; };
+ OLEListViewItem( Q3ListViewItem *after, QString text ) :
+ Q3CheckListItem( after, text, Q3CheckListItem::CheckBox ) { ; };
~OLEListViewItem() {};
void setData( DWORD data ) {mData= data; };
void setDataID( QString data ){ mDataID = data ;}
QString dataID() { return mDataID;}
DWORD data() { return mData ;};
private:
DWORD mData;
QString mDataID;
};
class OLEFolderSelect : public KDialogBase
{
public:
OLEFolderSelect() :
KDialogBase( Plain, "", Ok | Cancel, Ok,
0, "", true, false, i18n("Import!") )
{
- QHBox * mw = new QHBox( this );
+ Q3HBox * mw = new Q3HBox( this );
setMainWidget( mw );
- mListView = new QListView( mw );
+ mListView = new Q3ListView( mw );
mListView->addColumn(i18n("Select Folder"));
mListView->addColumn(i18n("Content Type"));
}
- QListView* listView() { return mListView;}
+ Q3ListView* listView() { return mListView;}
private:
- QListView* mListView;
+ Q3ListView* mListView;
};
OL_access *OL_access::sInstance = 0;
static KStaticDeleter<OL_access> staticDeleterPim;
OL_access *OL_access::instance()
{
if ( !sInstance ) {
sInstance = staticDeleterPim.setObject( new OL_access() );
}
return sInstance;
}
OL_access::OL_access()
{
mErrorInit = true;
SCODE sc = ::OleInitialize(NULL);
if ( FAILED ( sc ) ) {
KMessageBox::information( 0 ,i18n("OLE initialisation failed" ));
return;
}
if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){
KMessageBox::information( 0, i18n("Sorry, cannot access Outlook") );
return ;
}
mErrorInit = false;
}
OL_access::~OL_access()
{
if (sInstance == this)
sInstance = staticDeleterPim.setObject(0);
}
KABC::Addressee::List OL_access::importOLcontacts()
{
KABC::Addressee::List retval;
if ( mErrorInit )
return retval;
QStringList folderList = getFolderSelection( OL_CONTACT_DATA , i18n("Select Folders to import"));
int numFolders = folderList.count()/2;
int i;
for ( i = 0; i < numFolders; ++i ) {
readContactData( getFolderFromID( 0, folderList[(i*2)+1] ) , &retval, false );
}
KMessageBox::information( 0, i18n("%1 contacts read").arg( retval.count() ) );
return retval;
}
void OL_access::readContactData( LPDISPATCH dispItem, KABC::Addressee::List* list, bool syncMode )
{
dispItem->AddRef();
MAPIFolder mf(dispItem);
mf.m_lpDispatch->AddRef();
_Items folderItems;
_variant_t indx((long)0);
LPDISPATCH itm;
int i;
folderItems = mf.GetItems();
QString cap = i18n("Importing contact data");
if ( syncMode ) {
cap = i18n("Reading contact data...");
}
- QProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(), 0 );
+ Q3ProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(), 0 );
bar.setCaption (i18n("Accessing OL") );
int h = bar.sizeHint().height() ;
int w = 300;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
for(i=1; i <= folderItems.GetCount(); ++i)
{
qApp->processEvents();
if ( ! bar.isVisible() )
return ;
bar.setProgress( i );
indx = (long)i;
itm = folderItems.Item(indx.Detach());
_ContactItem * pItem = (_ContactItem *)&itm;
list->append( ol2kapiContact( pItem, syncMode ) );
itm->Release();
}
}
QStringList OL_access::getFolderSelection( int type , QString caption )
{
OLEFolderSelect folder_dialog;
- QListView * listView = folder_dialog.listView();
+ Q3ListView * listView = folder_dialog.listView();
MAPIFolder mfInbox;
MAPIFolder mfRoot;
CString szName;
_NameSpace olNS;
olNS = gOlAppAB.GetNamespace(_T("MAPI"));
mfInbox = olNS.GetDefaultFolder(6);
mfRoot = mfInbox.GetParent();
szName = mfRoot.GetName();
long iType = mfRoot.GetDefaultItemType();
QString mes;
mes = QString::fromUcs2( szName.GetBuffer() );
OLEListViewItem * root = new OLEListViewItem( listView, mes );
mfRoot.m_lpDispatch->AddRef();
addFolder( root, mfRoot.m_lpDispatch, type );
root->setOpen( true );
listView->setSortColumn( 0 );
listView->sort( );
folder_dialog.setCaption( caption );
QStringList retval;
folder_dialog.resize( folder_dialog.sizeHint().width()+50, folder_dialog.sizeHint().height()+50 );
if ( folder_dialog.exec() ) {
OLEListViewItem* child = (OLEListViewItem*) listView->firstChild();
while ( child ) {
if ( child->isOn() && ! child->firstChild() ) {
retval << child->text( 0 );
retval << child->dataID();
}
child = (OLEListViewItem*) child->itemBelow();
}
//KMessageBox::information(0,retval.join(" \n "));
}
return retval;
@@ -1106,91 +1106,91 @@ KABC::Addressee OL_access::ol2kapiContact( _ContactItem * aItem , bool syncMode)
-custom fields: difficult to implement - not implemented
-keys: makes no sense
#endif
return addressee;
}
#if 0
QDateTime mDdate2Qdtr( DATE dt)
{
COleDateTime odt;
SYSTEMTIME st;
odt = dt;
if ( odt.GetStatus() != 0 )
return QDateTime();
odt.GetAsSystemTime(st);
if ( st.wYear > 4000 ) // this program as a year 4000 bug!
return QDateTime();
// it seems so, that 1.1.4501 indicates: DATE invalid
QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
return qdt;
}
DATE Qdt2date( QDateTime dt )
{
DATE ddd;
COleDateTime odt;
odt.SetDateTime(dt.date().year(), dt.date().month(),dt.date().day(),
dt.time().hour(), dt.time().minute(), dt.time().second() );
ddd = odt;
return ddd;
}
-class OLEListViewItem : public QCheckListItem
+class OLEListViewItem : public Q3CheckListItem
{
public:
- OLEListViewItem( QListView *parent, QString text ) :
- QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
- OLEListViewItem( QListViewItem *after, QString text ) :
- QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
+ OLEListViewItem( Q3ListView *parent, QString text ) :
+ Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox ) { ; };
+ OLEListViewItem( Q3ListViewItem *after, QString text ) :
+ Q3CheckListItem( after, text, Q3CheckListItem::CheckBox ) { ; };
~OLEListViewItem() {};
void setData( DWORD data ) {mData= data; };
void setDataID( QString data ){ mDataID = data ;}
QString dataID() { return mDataID;}
DWORD data() { return mData ;};
private:
DWORD mData;
QString mDataID;
};
bool KAImportOLdialog::sOLDispatch = false;
KAImportOLdialog::KAImportOLdialog( const QString &caption,
KABC::AddressBook * aBook, QWidget *parent ) :
KDialogBase( Plain, caption, User1 | Close, Ok,
parent, caption, true, false, i18n("Import!") )
{
mSyncMode = false;
- QHBox * mw = new QHBox( this );
+ Q3HBox * mw = new Q3HBox( this );
setMainWidget( mw );
- mListView = new QListView( mw );
+ mListView = new Q3ListView( mw );
mListView->addColumn(i18n("Select Folder"));
mListView->addColumn(i18n("Content Type"));
mABook = aBook;
connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
setupFolderView();
resize( sizeHint().width()+50, sizeHint().height()+50 );
}
KAImportOLdialog::~KAImportOLdialog()
{
}
void KAImportOLdialog::setSyncMode()
{
mSyncMode = true;
findButton( User1 )->setText( i18n("Synchronize!") );
}
KABC::Addressee::List KAImportOLdialog::getAddressList()
{
return mAList;
}
void KAImportOLdialog::setupFolderView()
{
SCODE sc = ::OleInitialize(NULL);
if ( FAILED ( sc ) ) {
KMessageBox::information(this,"OLE initialisation failed");
return;
}
if( ! KAImportOLdialog::sOLDispatch ) {
if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){
KMessageBox::information(this,"Sorry, cannot access Outlook");
@@ -1274,65 +1274,65 @@ void KAImportOLdialog::slotApply()
importedItems = 0;
OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
while ( child ) {
if ( child->isOn() ) {
readContactData( child->data() );
if ( mSyncMode ) {
mSelectedFolderID = child->dataID();
accept();
return;
}
}
child = (OLEListViewItem*) child->itemBelow();
}
QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
KMessageBox::information(this,mes);
}
void KAImportOLdialog::readContactData( DWORD folder )
{
LPDISPATCH dispItem = (LPDISPATCH)folder;
dispItem->AddRef();
MAPIFolder mf(dispItem);
mf.m_lpDispatch->AddRef();
_Items folderItems;
_variant_t indx((long)0);
LPDISPATCH itm;
int i;
folderItems = mf.GetItems();
QString cap = i18n("Importing contact data");
if ( mSyncMode ) {
cap = i18n("Reading contact data...");
}
- QProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(),this);
+ Q3ProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(),this);
bar.setCaption (i18n("Accessing OL") );
int h = bar.sizeHint().height() ;
int w = 300;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
//bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
bar.show();
for(i=1; i <= folderItems.GetCount(); ++i)
{
qApp->processEvents();
if ( ! bar.isVisible() )
return ;
bar.setProgress( i );
indx = (long)i;
itm = folderItems.Item(indx.Detach());
_ContactItem * pItem = (_ContactItem *)&itm;
if ( addAddressee( ol2kapiContact( pItem, mSyncMode ) ))
++importedItems;
itm->Release();
}
}
void KAImportOLdialog::slotOk()
{
QDialog::accept();
}
KABC::Addressee KAImportOLdialog::ol2kapiContact( _ContactItem * aItem , bool syncMode)
{
KABC::Addressee addressee;
addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer()));
//GetLastModificationTime()
diff --git a/libkdepim/ol_access.h b/libkdepim/ol_access.h
index 85dbc6c..3422f65 100755
--- a/libkdepim/ol_access.h
+++ b/libkdepim/ol_access.h
@@ -8,65 +8,65 @@
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef OL_ACCESS_H
#define OL_ACCESS_H
#include <qstring.h>
#include <kdialogbase.h>
#include <kabc/addressee.h>
#include <kabc/addressbook.h>
#include <afxdisp.h>
#include "../outport/msoutl9.h"
#define OL_CONTACT_DATA 2
#define OL_CALENDAR_DATA 1 //pending is this the right number
class QDateTime;
-class QListView;
+class Q3ListView;
class OLEListViewItem;
class _ContactItem;
class OL_access : public QObject
{
Q_OBJECT
public:
static OL_access *instance();
~OL_access();
//static converter methods
static QDateTime mDdate2Qdtr( DATE dt);
static DATE Qdt2date( QDateTime dt );
static KABC::Addressee ol2kapiContact( _ContactItem * aItem , bool syncMode);
static void writeData2OLitem( KABC::Addressee addressee, _ContactItem * aItem );
KABC::Addressee::List importOLcontacts();
QStringList getFolderSelection( int type, QString caption );
void readContactData( LPDISPATCH folder, KABC::Addressee::List* list, bool syncMode );
LPDISPATCH getFolderFromID( LPDISPATCH parentFolder, QString selectedFolderID );
bool setSelectedFolder( QString folderID );
//call setSelectedFolder() before using the next methods:
void deleteAddressee( KABC::Addressee a );
KABC::Addressee changeAddressee( KABC::Addressee a );
KABC::Addressee addAddressee( KABC::Addressee a );
public slots:
signals:
@@ -103,65 +103,65 @@ class KAImportOLdialog : public KDialogBase
Q__OBJECT
public:
/**
Construct new IncidenceEditor.
*/
KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook,
QWidget *parent );
~KAImportOLdialog();
/** Initialize editor. This function creates the tab widgets. */
void init();
void setSyncMode();
KABC::Addressee::List getAddressList();
QString selectedFolderID() {return mSelectedFolderID;}
static KABC::Addressee ol2kapiContact( _ContactItem * , bool syncMode );
static bool sOLDispatch;
pub_lic sl_ots:
sign_als:
prote_cted slo_ts:
void slotApply();
void slotOk();
void slotCancel();
protected:
void setupFolderView();
void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent);
void readContactData( DWORD folder );
KABC::AddressBook * mABook;
- QListView * mListView;
+ Q3ListView * mListView;
KABC::Addressee::List mAList;
bool addAddressee( KABC::Addressee a );
private:
int importedItems;
bool mSyncMode;
QString mSelectedFolderID;
};
class KAwritebackOL : public QObject
{
Q__OBJECT
public:
KAwritebackOL( const QString &olFolderID );
~KAwritebackOL();
bool init();
void deleteAddressee( KABC::Addressee a );
KABC::Addressee changeAddressee( KABC::Addressee a );
KABC::Addressee addAddressee( KABC::Addressee a );
public sl_ots:
signals:
protected sl_ots:
protected:
LPDISPATCH getFolderFromID( LPDISPATCH parentFolder );
LPDISPATCH getOLitemFromUid( QString uid );
void writeData2OLitem( KABC::Addressee a, _ContactItem * olitem );
private:
QString mSelectedFolderID;
LPDISPATCH mSelectedFolder;
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp
index 89db22b..0ea73f5 100644
--- a/libkdepim/phoneaccess.cpp
+++ b/libkdepim/phoneaccess.cpp
@@ -1,155 +1,158 @@
/*
This file is part of libkdepim.
Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qstring.h>
#include <qapplication.h>
-#include <qptrlist.h>
+#include <QDesktopWidget>
+#include <q3ptrlist.h>
#include <qregexp.h>
#include <qfile.h>
#include <qlabel.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#include <qdir.h>
#include <kmessagebox.h>
#include <stdlib.h>
#include "phoneaccess.h"
void PhoneAccess::writeConfig( QString device, QString connection, QString model )
{
#ifdef _WIN32_
QString fileName = qApp->applicationDirPath () +"\\gammurc";
#else
QString fileName = QDir::homeDirPath() +"/.gammurc";
#endif
//qDebug("save %d ", load );
QString content = "[gammu]\n";;
bool write = false;
bool addPort = true, addConnection = true, addModel = true;
QFile file( fileName );
if ( QFile::exists( fileName) ) {
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
qDebug("Error: cannot open %s ", fileName.latin1() );
return;
}
QString line;
- while ( file.readLine( line, 1024 ) > 0 ) {
+ char tmp[1024];
+ while ( file.readLine( tmp, 1024 ) > 0 ) {
+ line = tmp;
//qDebug("*%s* ", line.latin1() );
if ( line.left(7 ) == "[gammu]" ) {
;
} else
if ( line.left(4 ) == "port" ) {
if ( line == "port = " + device+"\n" ) {
content += line ;
addPort = false;
//qDebug("port found" );
}
} else if ( line.left(5 ) == "model" ) {
if ( line == "model = " + model +"\n") {
content += line ;
addModel = false;
//qDebug("model found" );
}
} else if ( line.left( 10 ) == "connection" ) {
if ( line == "connection = " + connection +"\n") {
addConnection = false;
content += line ;
//qDebug("con found" );
}
} else {
content += line ;
}
}
file.close();
} else {
if ( ! connection.isEmpty() ) {
addConnection = true;
}
if ( ! device.isEmpty() ) {
addPort = true;
}
if ( ! model.isEmpty() ) {
addModel = true;
}
}
if ( addConnection ) {
write = true;
content += "connection = ";
content += connection;
content += "\n";
}
if ( addPort ) {
write = true;
content += "port = ";
content += device;
content += "\n";
}
if ( addModel ) {
write = true;
content += "model = ";
content += model;
content += "\n";
}
if ( write ) {
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
qDebug("Error: cannot write file %s ", fileName.latin1() );
return;
}
qDebug("Writing file %s ", fileName.latin1() );
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts << content ;
file.close();
}
}
bool PhoneAccess::writeToPhone( QString fileName)
{
#ifdef DESKTOP_VERSION
#ifdef _WIN32_
QString command ="kammu --restore " + fileName ;
#else
QString command ="./kammu --restore " + fileName ;
#endif
#else
QString command ="kammu --restore " + fileName ;
#endif
int ret = 1;
while ( ret != 0 ) {
QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 );
int w = 235;
int h = status->sizeHint().height()+20 ;
int dw = QApplication::desktop()->width();
int dh = QApplication::desktop()->height();
if ( dw > 310 )
w = 310;
status->setCaption(i18n("Writing to phone...") );
status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
status->show();
status->raise();
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 72c4e60..4172cd0 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -9,265 +9,275 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid commercial KDGantt licenses may use this file in
** accordance with the KDGantt Commercial License Agreement provided with
** the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
** information about KDGantt Commercial License Agreements.
**
** Contact info@klaralvdalens-datakonsult.se if any conditions of this
** licensing are not clear to you.
**
** As a special exception, permission is given to link this program
** with any edition of Qt, and distribute the resulting executable,
** without including the source code for Qt in the source distribution.
**
**********************************************************************/
#include "KDGanttMinimizeSplitter.h"
#ifndef QT_NO_SPLITTER___
#include "qpainter.h"
#include "qdrawutil.h"
#include "qbitmap.h"
#if QT_VERSION >= 0x030000
-#include "qptrlist.h"
-#include "qmemarray.h"
+#include "q3ptrlist.h"
+#include "q3memarray.h"
#else
#include <qlist.h>
#include <qarray.h>
-#define QPtrList QList
-#define QMemArray QArray
+#define Q3PtrList QList
+#define Q3MemArray QArray
#endif
#include "qlayoutengine_p.h"
-#include "qobjectlist.h"
+#include "qobject.h"
#include "qstyle.h"
#include "qapplication.h" //sendPostedEvents
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qcursor.h>
-#include <qframe.h>
+#include <q3frame.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QPaintEvent>
#ifndef KDGANTT_MASTER_CVS
//#include "KDGanttMinimizeSplitter.moc"
#endif
#ifndef DOXYGEN_SKIP_INTERNAL
#if QT_VERSION >= 232
static int mouseOffset;
static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
-class KDRubberBand: public QFrame
+class KDRubberBand: public Q3Frame
{
public:
- KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;}
+ KDRubberBand( QWidget *parent, const char * name, Qt::WFlags f ) :Q3Frame ( parent, name, f ) {;}
protected:
virtual void mousePressEvent ( QMouseEvent * )
{
close();
};
};
KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
KDGanttMinimizeSplitter *parent, const char * name )
- : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false )
+ : _activeButton( 0 ), _collapsed( false )
{
-
+ setObjectName(name);
+ setParent(parent);
if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
mSizeHint = QSize(7,7);
mUseOffset = true;
} else {
mSizeHint = QSize(6,6);
mUseOffset = false;
}
s = parent;
setOrientation(o);
setMouseTracking( true );
mMouseDown = false;
//setMaximumHeight( 5 ); // test only
}
QSize KDGanttSplitterHandle::sizeHint() const
{
return mSizeHint;
}
void KDGanttSplitterHandle::setOrientation( Qt::Orientation o )
{
orient = o;
#ifndef QT_NO_CURSOR
- if ( o == KDGanttMinimizeSplitter::Horizontal )
- setCursor( splitHCursor );
+ if ( o == Qt::Horizontal )
+ setCursor( Qt::splitHCursor );
else
- setCursor( splitVCursor );
+ setCursor( Qt::splitVCursor );
#endif
}
void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
{
updateCursor( e->pos() );
- if ( !(e->state()&LeftButton) )
+ if ( !(e->state()&Qt::LeftButton) )
return;
if ( _activeButton != 0)
return;
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
if ( opaque() ) {
s->moveSplitter( pos, id() );
} else {
int min = pos; int max = pos;
s->getRange( id(), &min, &max );
s->setRubberband( QMAX( min, QMIN(max, pos )));
}
_collapsed = false;
}
void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e )
{
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
_activeButton = onButton( e->pos() );
mouseOffset = s->pick(e->pos());
mMouseDown = true;
repaint();
updateCursor( e->pos() );
}
}
void KDGanttSplitterHandle::updateCursor( const QPoint& p)
{
if ( onButton( p ) != 0 ) {
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
}
else {
- if ( orient == KDGanttMinimizeSplitter::Horizontal )
- setCursor( splitHCursor );
+ if ( orient == Qt::Horizontal )
+ setCursor( Qt::splitHCursor );
else
- setCursor( splitVCursor );
+ setCursor( Qt::splitVCursor );
}
}
void KDGanttSplitterHandle::toggle()
{
int pos;
int min, max;
if ( !_collapsed ) {
s->expandPos( id(), &min, &max );
if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left
|| s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) {
pos = min;
}
else {
pos = max;
}
_origPos = s->pick(mapToParent( QPoint( 0,0 ) ));
s->moveSplitter( pos, id() );
_collapsed = true;
}
else {
s->moveSplitter( _origPos, id() );
_collapsed = false;
}
repaint();
}
void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
{
mMouseDown = false;
if ( _activeButton != 0 ) {
if ( onButton( e->pos() ) == _activeButton )
{
toggle();
}
_activeButton = 0;
updateCursor( e->pos() );
}
else {
- if ( !opaque() && e->button() == LeftButton ) {
+ if ( !opaque() && e->button() == Qt::LeftButton ) {
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
s->setRubberband( -1 );
s->moveSplitter( pos, id() );
}
}
if ( s->rubberBand() ) {
//qDebug("hide rubberband ");
s->rubberBand()->close();
}
repaint();
}
int KDGanttSplitterHandle::onButton( const QPoint& p )
{
- QValueList<QPointArray> list = buttonRegions();
+ Q3ValueList<Q3PointArray> list = buttonRegions();
int index = 1;
int add = 12;
- for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
QRect rect = (*it).boundingRect();
rect.setLeft( rect.left()- add );
rect.setRight( rect.right() + add);
rect.setTop( rect.top()- add );
rect.setBottom( rect.bottom() + add);
if ( rect.contains( p ) ) {
return index;
}
index++;
}
return 0;
}
-QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions()
+Q3ValueList<Q3PointArray> KDGanttSplitterHandle::buttonRegions()
{
- QValueList<QPointArray> list;
+ Q3ValueList<Q3PointArray> list;
int sw = 8;
int yyy = 1;
int xxx = 1;
int voffset[] = { (int) -sw*3, (int) sw*3 };
for ( int i = 0; i < 2; i++ ) {
- QPointArray arr;
+ Q3PointArray arr;
if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) {
int mid = height()/2 + voffset[i];
arr.setPoints( 3,
1-xxx, mid - sw + 4,
sw-3-xxx, mid,
1-xxx, mid + sw -4);
}
else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
int mid = height()/2 + voffset[i];
arr.setPoints( 3,
sw-4, mid - sw + 4,
0, mid,
sw-4, mid + sw - 4);
}
else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) {
int mid = width()/2 + voffset[i];
arr.setPoints( 3,
mid - sw + 4, sw-4,
mid, 0,
mid + sw - 4, sw-4 );
}
else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) {
int mid = width()/2 + voffset[i];
arr.setPoints( 3,
mid - sw + 4, 1-yyy,
mid, sw-3-yyy,
mid + sw -4, 1-yyy);
}
@@ -282,136 +292,136 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
QPainter p( &buffer );
//LR
// Draw the splitter rectangle
p.setBrush( colorGroup().background() );
p.setPen( colorGroup().foreground() );
//p.drawRect( rect() );
#ifndef DESKTOP_VERSION
if ( mMouseDown && ! _activeButton)
buffer.fill( colorGroup().background().dark() );
else
#endif
buffer.fill( colorGroup().background() );
//buffer.fill( backgroundColor() );
// parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup());
int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size
// arrow color
QColor col;
if ( _activeButton )
col = colorGroup().background().dark( 250 );
else {
if ( mMouseDown )
col = Qt::white;
else
col = colorGroup().background().dark( 150 );
}
//QColor col = backgroundColor().dark( 130 );
p.setBrush( col );
p.setPen( col );
- QValueList<QPointArray> list = buttonRegions();
+ Q3ValueList<Q3PointArray> list = buttonRegions();
int index = 1;
if ( mUseOffset )
p.translate( 0, 1 );
- for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
if ( index == _activeButton ) {
/*
if ( ! _collapsed ) {
p.save();
// p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ),
// parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) );
p.translate( -1, 0 );
p.drawPolygon( *it, true );
p.restore(); } else
*/
p.drawPolygon( *it, true );
}
else {
/*
if ( ! _collapsed ) {
p.save();
p.translate( -1, 0 );
p.drawPolygon( *it, true );
p.restore();
} else
*/
p.drawPolygon( *it, true );
}
index++;
}
// Draw the lines between the arrows
if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
int mid = height()/2;
p.drawLine ( 1, mid - sw, 1, mid + sw );
p.drawLine ( 3, mid - sw, 3, mid + sw );
}
else if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) {
int mid = width()/2;
p.drawLine( mid -sw, 1, mid +sw, 1 );
p.drawLine( mid -sw, 3, mid +sw, 3 );
}
bitBlt( this, 0, 0, &buffer );
}
#endif
class QSplitterLayoutStruct
{
public:
KDGanttMinimizeSplitter::ResizeMode mode;
QCOORD sizer;
bool isSplitter;
QWidget *wid;
};
class QSplitterData
{
public:
QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {}
- QPtrList<QSplitterLayoutStruct> list;
+ Q3PtrList<QSplitterLayoutStruct> list;
bool opaque;
bool firstShow;
};
-void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer );
#endif // DOXYGEN_SKIP_INTERNAL
/*!
\class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h
\brief The KDGanttMinimizeSplitter class implements a splitter
widget with minimize buttons.
This class (and its documentation) is largely a copy of Qt's
QSplitter; the copying was necessary because QSplitter is not
extensible at all. QSplitter and its documentation are licensed
according to the GPL and the Qt Professional License (if you hold
such a license) and are (C) Trolltech AS.
A splitter lets the user control the size of child widgets by
dragging the boundary between the children. Any number of widgets
may be controlled.
To show a QListBox, a QListView and a QTextEdit side by side:
\code
KDGanttMinimizeSplitter *split = new KDGanttMinimizeSplitter( parent );
QListBox *lb = new QListBox( split );
QListView *lv = new QListView( split );
QTextEdit *ed = new QTextEdit( split );
\endcode
In KDGanttMinimizeSplitter, the boundary can be either horizontal or
vertical. The default is horizontal (the children are side by side)
but you can use setOrientation( QSplitter::Vertical ) to set it to
vertical.
@@ -432,514 +442,521 @@ void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int
children. It will be reinstated when you show() it again. It is also
possible to reorder the widgets within the splitter using
moveToFirst() and moveToLast().
*/
static QSize minSize( const QWidget* /*w*/ )
{
return QSize(0,0);
}
// This is the original version of minSize
static QSize minSizeHint( const QWidget* w )
{
QSize min = w->minimumSize();
QSize s;
if ( min.height() <= 0 || min.width() <= 0 )
s = w->minimumSizeHint();
if ( min.height() > 0 )
s.setHeight( min.height() );
if ( min.width() > 0 )
s.setWidth( min.width() );
return s.expandedTo(QSize(0,0));
}
/*!
Constructs a horizontal splitter with the \a parent and \a
name arguments being passed on to the QFrame constructor.
*/
KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
+ :Q3Frame(parent,name)
{
+ setAttribute(Qt::WA_PaintUnclipped);
mRubberBand = 0;
mFirstHandle = 0;
#if QT_VERSION >= 232
- orient = Horizontal;
+ orient = Qt::Horizontal;
init();
#endif
}
/*!
Constructs a splitter with orientation \a o with the \a parent
and \a name arguments being passed on to the QFrame constructor.
*/
-KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
+KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Qt::Orientation o, QWidget *parent, const char *name )
+ :Q3Frame(parent,name)
{
-
+ setAttribute(Qt::WA_PaintUnclipped);
mRubberBand = 0;
mFirstHandle = 0;
#if QT_VERSION >= 232
orient = o;
init();
#endif
}
/*!
Destroys the splitter and any children.
*/
KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter()
{
#if QT_VERSION >= 232
data->list.setAutoDelete( TRUE );
delete data;
#endif
if ( mRubberBand )
delete mRubberBand;
}
#if QT_VERSION >= 232
void KDGanttMinimizeSplitter::init()
{
data = new QSplitterData;
- if ( orient == Horizontal )
+ if ( orient == Qt::Horizontal )
setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) );
else
setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) );
#ifndef DESKTOP_VERSION
setOpaqueResize( false );
#else
setOpaqueResize( true );
#endif
}
#endif
void KDGanttMinimizeSplitter::toggle()
{
if ( mFirstHandle )
mFirstHandle->toggle();
else
qDebug("KDGanttMinimizeSplitter::toggle::sorry, handle not available ");
}
/*!
\brief the orientation of the splitter
By default the orientation is horizontal (the widgets are side by side).
The possible orientations are Qt:Vertical and Qt::Horizontal (the default).
*/
-void KDGanttMinimizeSplitter::setOrientation( Orientation o )
+void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o )
{
#if QT_VERSION >= 232
if ( orient == o )
return;
orient = o;
- if ( orient == Horizontal )
+ if ( orient == Qt::Horizontal )
setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
else
setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
((KDGanttSplitterHandle*)s->wid)->setOrientation( o );
s = data->list.next(); // ### next at end of loop, no iterator
}
recalc( isVisible() );
#endif
}
#if QT_VERSION >= 232
/*!
\reimp
*/
void KDGanttMinimizeSplitter::resizeEvent( QResizeEvent * )
{
doResize();
}
/*
Inserts the widget \a w at the end (or at the beginning if \a first
is TRUE) of the splitter's list of widgets.
It is the responsibility of the caller of this function to make sure
that \a w is not already in the splitter and to call recalcId if
needed. (If \a first is TRUE, then recalcId is very probably
needed.)
*/
QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool first )
{
QSplitterLayoutStruct *s;
KDGanttSplitterHandle *newHandle = 0;
if ( data->list.count() > 0 ) {
s = new QSplitterLayoutStruct;
s->mode = KeepSize;
QString tmp = "qt_splithandle_";
tmp += w->name();
newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() );
- if ( ! mFirstHandle )
- mFirstHandle = newHandle;
+ if ( ! mFirstHandle )
+ mFirstHandle = newHandle;
s->wid = newHandle;
newHandle->setId(data->list.count());
s->isSplitter = TRUE;
s->sizer = pick( newHandle->sizeHint() );
if ( first )
data->list.insert( 0, s );
else
data->list.append( s );
}
s = new QSplitterLayoutStruct;
s->mode = Stretch;
s->wid = w;
- if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
+ if ( !testAttribute( Qt::WA_Resized ) && w->sizeHint().isValid() )
s->sizer = pick( w->sizeHint() );
else
s->sizer = pick( w->size() );
s->isSplitter = FALSE;
if ( first )
data->list.insert( 0, s );
else
data->list.append( s );
if ( newHandle && isVisible() )
newHandle->show(); //will trigger sending of post events
return s;
}
/*!
Tells the splitter that a child widget has been inserted or removed.
The event is passed in \a c.
*/
void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
{
- if ( c->type() == QEvent::ChildInserted ) {
+ if ( c->type() == QEvent::ChildAdded ) {
if ( !c->child()->isWidgetType() )
return;
- if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) )
+ QWidget *cw = (QWidget*)c->child();
+
+ if ( (cw->windowFlags())&Qt::Window )
+ return;
+
+ // avoid infinite recursion
+ if(cw->objectName().startsWith("qt_splithandle_"))
return;
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
- if ( s->wid == c->child() )
+ if ( s->wid == cw )
return;
s = data->list.next();
}
- addWidget( (QWidget*)c->child() );
+ addWidget( cw );
recalc( isVisible() );
} else if ( c->type() == QEvent::ChildRemoved ) {
QSplitterLayoutStruct *p = 0;
if ( data->list.count() > 1 )
p = data->list.at(1); //remove handle _after_ first widget.
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->wid == c->child() ) {
data->list.removeRef( s );
delete s;
if ( p && p->isSplitter ) {
data->list.removeRef( p );
delete p->wid; //will call childEvent
delete p;
}
recalcId();
doResize();
return;
}
p = s;
s = data->list.next();
}
}
}
/*!
Shows a rubber band at position \a p. If \a p is negative, the
rubber band is removed.
*/
void KDGanttMinimizeSplitter::setRubberband( int p )
{
#ifdef DESKTOP_VERSION
QPainter paint( this );
- paint.setPen( gray );
- paint.setBrush( gray );
- paint.setRasterOp( XorROP );
+ paint.setPen( Qt::gray );
+ paint.setBrush( Qt::gray );
+ paint.setCompositionMode( QPainter::CompositionMode_Xor );
QRect r = contentsRect();
const int rBord = 3; //Themable????
#if QT_VERSION >= 0x030000
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
#else
int sw = style().splitterWidth();
#endif
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
if ( opaqueOldPos >= 0 )
paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
2*rBord, r.height() );
if ( p >= 0 )
paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
} else {
if ( opaqueOldPos >= 0 )
paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
r.width(), 2*rBord );
if ( p >= 0 )
paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
}
opaqueOldPos = p;
#else
if ( !mRubberBand ) {
- mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
+ mRubberBand = new KDRubberBand( 0, "rubber", Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
mRubberBand->setFrameStyle( Box | Raised );
//mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
}
QRect r = contentsRect();
static int rBord = 0; //Themable????
if ( !rBord ) {
if (QApplication::desktop()->width() <= 320 )
rBord = 3;
else
rBord = 4;
}
int sw = style().splitterWidth();
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
if ( p >= 0 ) {
QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y()));
mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() );
}
} else {
if ( p >= 0 ) {
QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord));
mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord);
}
}
opaqueOldPos = p;
if ( ! mRubberBand->isVisible() ) {
mRubberBand->show();
}
#endif
}
/*! \reimp */
bool KDGanttMinimizeSplitter::event( QEvent *e )
{
- if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) {
+ if ( e->type() == QEvent::LayoutRequest || ( e->type() == QEvent::Show && data->firstShow ) ) {
recalc( isVisible() );
if ( e->type() == QEvent::Show )
data->firstShow = FALSE;
}
return QWidget::event( e );
}
/*!
\obsolete
Draws the splitter handle in the rectangle described by \a x, \a y,
\a w, \a h using painter \a p.
\sa QStyle::drawPrimitive()
*/
void KDGanttMinimizeSplitter::drawSplitter( QPainter *p,
QCOORD x, QCOORD y, QCOORD w, QCOORD h )
{
#if 0
// LR
style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(),
(orientation() == Qt::Horizontal ?
- QStyle::Style_Horizontal : 0));
+ QStyle::State_Horizontal : 0));
#endif
}
/*!
Returns the id of the splitter to the right of or below the widget \a w,
or 0 if there is no such splitter
(i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end).
*/
int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const
{
QSplitterLayoutStruct *s = data->list.first();
bool seen_w = FALSE;
while ( s ) {
if ( s->isSplitter && seen_w )
return data->list.at();
if ( !s->isSplitter && s->wid == w )
seen_w = TRUE;
s = data->list.next();
}
return 0;
}
/*!
Moves the left/top edge of the splitter handle with id \a id as
close as possible to position \a p, which is the distance from the
left (or top) edge of the widget.
For Arabic and Hebrew the layout is reversed, and using this
function to set the position of the splitter might lead to
unexpected results, since in Arabic and Hebrew the position of
splitter one is to the left of the position of splitter zero.
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
{
p = adjustPos( p, id );
QSplitterLayoutStruct *s = data->list.at(id);
- int oldP = orient == Horizontal ? s->wid->x() : s->wid->y();
+ int oldP = orient == Qt::Horizontal ? s->wid->x() : s->wid->y();
bool upLeft;
- if ( false && orient == Horizontal ) {
+ if ( false && orient == Qt::Horizontal ) {
p += s->wid->width();
upLeft = p > oldP;
} else
upLeft = p < oldP;
moveAfter( p, id, upLeft );
moveBefore( p-1, id-1, upLeft );
storeSizes();
}
void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter )
{
- if ( orient == Horizontal ) {
- if ( false && orient == Horizontal && !isSplitter )
+ if ( orient == Qt::Horizontal ) {
+ if ( false && orient == Qt::Horizontal && !isSplitter )
p = contentsRect().width() - p - s;
w->setGeometry( p, contentsRect().y(), s, contentsRect().height() );
} else
w->setGeometry( contentsRect().x(), p, contentsRect().width(), s );
}
/*
Places the right/bottom edge of the widget at \a id at position \a pos.
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
{
if( id < 0 )
return;
QSplitterLayoutStruct *s = data->list.at(id);
if ( !s )
return;
QWidget *w = s->wid;
if ( w->isHidden() ) {
moveBefore( pos, id-1, upLeft );
} else if ( s->isSplitter ) {
int pos1, pos2;
int dd = s->sizer;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
pos1 = pos;
pos2 = pos + dd;
} else {
pos2 = pos - dd;
pos1 = pos2 + 1;
}
if ( upLeft ) {
setG( w, pos1, dd, TRUE );
moveBefore( pos2, id-1, upLeft );
} else {
moveBefore( pos2, id-1, upLeft );
setG( w, pos1, dd, TRUE );
}
} else {
int dd, newLeft, nextPos;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
dd = w->geometry().right() - pos;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos+1;
nextPos = newLeft + dd;
} else {
dd = pos - pick( w->pos() ) + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
}
setG( w, newLeft, dd, TRUE );
moveBefore( nextPos, id-1, upLeft );
}
}
/*
Places the left/top edge of the widget at \a id at position \a pos.
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
{
QSplitterLayoutStruct *s = id < int(data->list.count()) ?
data->list.at(id) : 0;
if ( !s )
return;
QWidget *w = s->wid;
if ( w->isHidden() ) {
moveAfter( pos, id+1, upLeft );
} else if ( pick( w->pos() ) == pos ) {
//No need to do anything if it's already there.
return;
} else if ( s->isSplitter ) {
int dd = s->sizer;
int pos1, pos2;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
pos2 = pos - dd;
pos1 = pos2 + 1;
} else {
pos1 = pos;
pos2 = pos + dd;
}
if ( upLeft ) {
setG( w, pos1, dd, TRUE );
moveAfter( pos2, id+1, upLeft );
} else {
moveAfter( pos2, id+1, upLeft );
setG( w, pos1, dd, TRUE );
}
} else {
int left = pick( w->pos() );
int right, dd,/* newRight,*/ newLeft, nextPos;
- if ( false && orient == Horizontal ) {
+ if ( false && orient == Qt::Horizontal ) {
dd = pos - left + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
} else {
right = pick( w->geometry().bottomRight() );
dd = right - pos + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
/*newRight = pos+dd-1;*/
newLeft = pos;
nextPos = newLeft + dd;
}
setG( w, newLeft, dd, TRUE );
/*if( right != newRight )*/
moveAfter( nextPos, id+1, upLeft );
}
}
void KDGanttMinimizeSplitter::expandPos( int id, int* min, int* max )
{
QSplitterLayoutStruct *s = data->list.at(id-1);
QWidget* w = s->wid;
*min = pick( w->mapToParent( QPoint(0,0) ) );
if ( (uint) id == data->list.count() ) {
pick( size() );
}
else {
QSplitterLayoutStruct *s = data->list.at(id+1);
QWidget* w = s->wid;
*max = pick( w->mapToParent( QPoint( w->width(), w->height() ) ) ) -8;
@@ -959,107 +976,107 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
int maxB = 0;
int minA = 0;
int maxA = 0; //after
int n = data->list.count();
if ( id < 0 || id >= n )
return;
int i;
for ( i = 0; i < id; i++ ) {
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
//ignore
} else if ( s->isSplitter ) {
minB += s->sizer;
maxB += s->sizer;
} else {
minB += pick( minSize(s->wid) );
maxB += pick( s->wid->maximumSize() );
}
}
for ( i = id; i < n; i++ ) {
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
//ignore
} else if ( s->isSplitter ) {
minA += s->sizer;
maxA += s->sizer;
} else {
minA += pick( minSize(s->wid) );
maxA += pick( s->wid->maximumSize() );
}
}
QRect r = contentsRect();
- if ( orient == Horizontal && false ) {
+ if ( orient == Qt::Horizontal && false ) {
#if QT_VERSION >= 0x030000
- int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int splitterWidth = style()->pixelMetric(QStyle::PM_SplitterWidth, 0,this);
#else
int splitterWidth = style().splitterWidth();
#endif
if ( min )
*min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth;
if ( max )
*max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth;
} else {
if ( min )
*min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA );
if ( max )
*max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA );
}
}
/*!
Returns the closest legal position to \a p of the splitter with id \a id.
\sa idAfter()
*/
int KDGanttMinimizeSplitter::adjustPos( int p, int id )
{
int min = 0;
int max = 0;
getRange( id, &min, &max );
p = QMAX( min, QMIN( p, max ) );
return p;
}
void KDGanttMinimizeSplitter::doResize()
{
QRect r = contentsRect();
int i;
int n = data->list.count();
- QMemArray<QLayoutStruct> a( n );
+ Q3MemArray<QLayoutStruct> a( n );
for ( i = 0; i< n; i++ ) {
a[i].init();
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
a[i].stretch = 0;
a[i].sizeHint = a[i].minimumSize = 0;
a[i].maximumSize = 0;
} else if ( s->isSplitter ) {
a[i].stretch = 0;
a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer;
a[i].empty = FALSE;
} else if ( s->mode == KeepSize ) {
a[i].stretch = 0;
a[i].minimumSize = pick( minSize(s->wid) );
a[i].sizeHint = s->sizer;
a[i].maximumSize = pick( s->wid->maximumSize() );
a[i].empty = FALSE;
} else if ( s->mode == FollowSizeHint ) {
a[i].stretch = 0;
a[i].minimumSize = a[i].sizeHint = pick( s->wid->sizeHint() );
a[i].maximumSize = pick( s->wid->maximumSize() );
a[i].empty = FALSE;
} else { //proportional
a[i].stretch = s->sizer;
a[i].maximumSize = pick( s->wid->maximumSize() );
a[i].sizeHint = a[i].minimumSize = pick( minSize(s->wid) );
a[i].empty = FALSE;
}
}
kdganttGeomCalc( a, 0, n, pick( r.topLeft() ), pick( r.size() ), 0 );
@@ -1103,65 +1120,65 @@ void KDGanttMinimizeSplitter::recalc( bool update )
for ( int j = 0; j< n; j++ ) {
QSplitterLayoutStruct *s = data->list.at(j);
if ( !s->wid->isHidden() ) {
empty = FALSE;
if ( s->isSplitter ) {
minl += s->sizer;
maxl += s->sizer;
} else {
QSize minS = minSize(s->wid);
minl += pick( minS );
maxl += pick( s->wid->maximumSize() );
mint = QMAX( mint, trans( minS ));
int tm = trans( s->wid->maximumSize() );
if ( tm > 0 )
maxt = QMIN( maxt, tm );
}
}
}
if ( empty ) {
if ( parentWidget() != 0 && parentWidget()->inherits("KDGanttMinimizeSplitter") ) {
// nested splitters; be nice
maxl = maxt = 0;
} else {
// KDGanttMinimizeSplitter with no children yet
maxl = QWIDGETSIZE_MAX;
}
} else {
maxl = QMIN( maxl, QWIDGETSIZE_MAX );
}
if ( maxt < mint )
maxt = mint;
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
setMaximumSize( maxl, maxt );
setMinimumSize( minl, mint );
} else {
setMaximumSize( maxt, maxl );
setMinimumSize( mint, minl );
}
if ( update )
doResize();
}
/*!
Sets resize mode of \a w to \a mode.
\sa ResizeMode
*/
void KDGanttMinimizeSplitter::setResizeMode( QWidget *w, ResizeMode mode )
{
processChildEvents();
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->wid == w ) {
s->mode = mode;
return;
}
s = data->list.next();
}
s = addWidget( w, TRUE );
s->mode = mode;
}
@@ -1238,112 +1255,106 @@ void KDGanttMinimizeSplitter::moveToLast( QWidget *w )
data->list.take(); //take p
data->list.append( p );
}
data->list.append( s );
break;
}
s = data->list.next();
}
if ( !found )
addWidget( w);
recalcId();
}
void KDGanttMinimizeSplitter::recalcId()
{
int n = data->list.count();
for ( int i = 0; i < n; i++ ) {
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->isSplitter )
((KDGanttSplitterHandle*)s->wid)->setId(i);
}
}
/*!\reimp
*/
QSize KDGanttMinimizeSplitter::sizeHint() const
{
constPolish();
int l = 0;
int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
+ if ( !children().empty() ) {
+ const QObjectList c = children();
+ for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
+ QObject * o = *i;
if ( o->isWidgetType() &&
!((QWidget*)o)->isHidden() ) {
QSize s = ((QWidget*)o)->sizeHint();
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
}
}
}
}
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
+ return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
}
/*!
\reimp
*/
QSize KDGanttMinimizeSplitter::minimumSizeHint() const
{
constPolish();
int l = 0;
int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
+ if ( !children().empty() ) {
+ const QObjectList c = children();
+ for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
+ QObject * o = *i;
if ( o->isWidgetType() &&
!((QWidget*)o)->isHidden() ) {
QSize s = minSizeHint((QWidget*)o);
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
}
}
}
}
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
+ return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
}
/*
Calculates stretch parameters from current sizes
*/
void KDGanttMinimizeSplitter::storeSizes()
{
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( !s->isSplitter )
s->sizer = pick( s->wid->size() );
s = data->list.next();
}
}
#if 0 // ### remove this code ASAP
/*!
Hides \a w if \a hide is TRUE and updates the splitter.
\warning Due to a limitation in the current implementation,
calling QWidget::hide() will not work.
*/
void KDGanttMinimizeSplitter::setHidden( QWidget *w, bool hide )
{
if ( w == w1 ) {
w1show = !hide;
} else if ( w == w2 ) {
@@ -1373,175 +1384,176 @@ bool KDGanttMinimizeSplitter::isHidden( QWidget *w ) const
else if ( w == w2 )
return !w2show;
#ifdef QT_CHECK_RANGE
else
qWarning( "KDGanttMinimizeSplitter::isHidden(), unknown widget" );
#endif
return FALSE;
}
#endif
/*!
Returns a list of the size parameters of all the widgets in this
splitter.
Giving the values to another splitter's setSizes() function will
produce a splitter with the same layout as this one.
Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
\code
QValueList<int> list = mySplitter.sizes();
QValueList<int>::Iterator it = list.begin();
while( it != list.end() ) {
myProcessing( *it );
++it;
}
\endcode
\sa setSizes()
*/
-QValueList<int> KDGanttMinimizeSplitter::sizes() const
+Q3ValueList<int> KDGanttMinimizeSplitter::sizes() const
{
+ /* TODO: hacker
if ( !testWState(WState_Polished) ) {
QWidget* that = (QWidget*) this;
that->polish();
- }
- QValueList<int> list;
+ } */
+ Q3ValueList<int> list;
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( !s->isSplitter )
list.append( s->sizer );
s = data->list.next();
}
return list;
}
/*!
Sets the size parameters to the values given in \a list.
If the splitter is horizontal, the values set the sizes from
left to right. If it is vertical, the sizes are applied from
top to bottom.
Extra values in \a list are ignored.
If \a list contains too few values, the result is undefined
but the program will still be well-behaved.
\sa sizes()
*/
-void KDGanttMinimizeSplitter::setSizes( QValueList<int> list )
+void KDGanttMinimizeSplitter::setSizes( Q3ValueList<int> list )
{
processChildEvents();
- QValueList<int>::Iterator it = list.begin();
+ Q3ValueList<int>::Iterator it = list.begin();
QSplitterLayoutStruct *s = data->list.first();
while ( s && it != list.end() ) {
if ( !s->isSplitter ) {
s->sizer = *it;
++it;
}
s = data->list.next();
}
doResize();
}
/*!
Gets all posted child events, ensuring that the internal state of
the splitter is consistent.
*/
void KDGanttMinimizeSplitter::processChildEvents()
{
- QApplication::sendPostedEvents( this, QEvent::ChildInserted );
+ QApplication::sendPostedEvents( this, QEvent::ChildAdded );
}
/*!
\reimp
*/
void KDGanttMinimizeSplitter::styleChange( QStyle& old )
{
#if QT_VERSION >= 0x030000
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
#else
int sw = style().splitterWidth();
#endif
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
s->sizer = sw;
s = data->list.next();
}
doResize();
- QFrame::styleChange( old );
+ Q3Frame::styleChange( old );
}
#endif
/*!
Specifies the direction of the minimize buttons.
If the orientation of the splitter is horizontal then with
KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used,
otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down
should be used.
*/
void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction )
{
_direction = direction;
}
/*!
Returns the direction of the minimize buttons.
*/
KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection() const
{
return _direction;
}
/*
This is a copy of qGeomCalc() in qlayoutengine.cpp which
unfortunately isn't exported.
*/
static inline int toFixed( int i ) { return i * 256; }
static inline int fRound( int i ) {
return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256;
}
-void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer )
{
typedef int fixed;
int cHint = 0;
int cMin = 0;
int cMax = 0;
int sumStretch = 0;
int spacerCount = 0;
bool wannaGrow = FALSE; // anyone who really wants to grow?
// bool canShrink = FALSE; // anyone who could be persuaded to shrink?
int i;
for ( i = start; i < start + count; i++ ) {
chain[i].done = FALSE;
cHint += chain[i].sizeHint;
cMin += chain[i].minimumSize;
cMax += chain[i].maximumSize;
sumStretch += chain[i].stretch;
if ( !chain[i].empty )
spacerCount++;
wannaGrow = wannaGrow || chain[i].expansive;
}
int extraspace = 0;
if ( spacerCount )
spacerCount--; // only spacers between things
if ( space < cMin + spacerCount * spacer ) {
// qDebug("not enough space");
for ( i = start; i < start+count; i++ ) {
chain[i].size = chain[i].minimumSize;
chain[i].done = TRUE;
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h
index 3042e0a..338d965 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -1,192 +1,199 @@
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <QMouseEvent>
+#include <QEvent>
/* -*- Mode: C++ -*-
$Id$
*/
/****************************************************************************
** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved.
**
** This file is part of the KDGantt library.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid commercial KDGantt licenses may use this file in
** accordance with the KDGantt Commercial License Agreement provided with
** the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
** information about KDGantt Commercial License Agreements.
**
** Contact info@klaralvdalens-datakonsult.se if any conditions of this
** licensing are not clear to you.
**
** As a special exception, permission is given to link this program
** with any edition of Qt, and distribute the resulting executable,
** without including the source code for Qt in the source distribution.
**
**********************************************************************/
#ifndef KDGANTTMINIMIZESPLITTER_H
#define KDGANTTMINIMIZESPLITTER_H
#ifndef QT_H
-#include "qframe.h"
-#include "qvaluelist.h"
+#include "q3frame.h"
+#include "q3valuelist.h"
#endif // QT_H
#ifndef QT_NO_SPLITTER___
class QSplitterData;
class QSplitterLayoutStruct;
class KDGanttSplitterHandle;
class KDRubberBand;
-class KDGanttMinimizeSplitter : public QFrame
+class KDGanttMinimizeSplitter : public Q3Frame
{
Q_OBJECT
// Q_ENUMS( Direction )
// Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
// Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
public:
enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
enum Direction { Left, Right, Up, Down };
KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 );
- KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 );
+ KDGanttMinimizeSplitter( Qt::Orientation, QWidget* parent=0, const char* name=0 );
~KDGanttMinimizeSplitter();
- virtual void setOrientation( Orientation );
- Orientation orientation() const { return orient; }
+ virtual void setOrientation( Qt::Orientation );
+ Qt::Orientation orientation() const { return orient; }
void setMinimizeDirection( Direction );
Direction minimizeDirection() const;
#if QT_VERSION >= 232
virtual void setResizeMode( QWidget *w, ResizeMode );
virtual void setOpaqueResize( bool = TRUE );
bool opaqueResize() const;
void moveToFirst( QWidget * );
void moveToLast( QWidget * );
void refresh() { recalc( TRUE ); }
QSize sizeHint() const;
QSize minimumSizeHint() const;
- QValueList<int> sizes() const;
- void setSizes( QValueList<int> );
+ Q3ValueList<int> sizes() const;
+ void setSizes( Q3ValueList<int> );
KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;}
void expandPos( int id, int* min, int* max );
KDRubberBand* rubberBand() { return mRubberBand ;}
public slots:
void toggle();
protected:
void childEvent( QChildEvent * );
bool event( QEvent * );
void resizeEvent( QResizeEvent * );
int idAfter( QWidget* ) const;
void moveSplitter( QCOORD pos, int id );
virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
QCOORD w, QCOORD h );
void styleChange( QStyle& );
int adjustPos( int , int );
virtual void setRubberband( int );
void getRange( int id, int*, int* );
private:
KDRubberBand* mRubberBand;
void init();
void recalc( bool update = FALSE );
void doResize();
void storeSizes();
void processChildEvents();
QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
void recalcId();
void moveBefore( int pos, int id, bool upLeft );
void moveAfter( int pos, int id, bool upLeft );
void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
QCOORD pick( const QPoint &p ) const
- { return orient == Horizontal ? p.x() : p.y(); }
+ { return orient == Qt::Horizontal ? p.x() : p.y(); }
QCOORD pick( const QSize &s ) const
- { return orient == Horizontal ? s.width() : s.height(); }
+ { return orient == Qt::Horizontal ? s.width() : s.height(); }
QCOORD trans( const QPoint &p ) const
- { return orient == Vertical ? p.x() : p.y(); }
+ { return orient == Qt::Vertical ? p.x() : p.y(); }
QCOORD trans( const QSize &s ) const
- { return orient == Vertical ? s.width() : s.height(); }
+ { return orient == Qt::Vertical ? s.width() : s.height(); }
KDGanttSplitterHandle* mFirstHandle;
QSplitterData *data;
#endif
private:
- Orientation orient;
+ Qt::Orientation orient;
Direction _direction;
#ifndef DOXYGEN_SKIP_INTERNAL
friend class KDGanttSplitterHandle;
#endif
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
#endif
};
#ifndef DOXYGEN_SKIP_INTERNAL
// This class was continued from a verbatim copy of the
// QSplitterHandle pertaining to the Qt Enterprise License and the
// GPL. It has only been renamed to KDGanttSplitterHandler in order to
// avoid a symbol clash on some platforms.
class KDGanttSplitterHandle : public QWidget
{
Q_OBJECT
#if QT_VERSION >= 232
public:
KDGanttSplitterHandle( Qt::Orientation o,
KDGanttMinimizeSplitter *parent, const char* name=0 );
void setOrientation( Qt::Orientation o );
Qt::Orientation orientation() const { return orient; }
bool opaque() const { return s->opaqueResize(); }
QSize sizeHint() const;
void toggle();
int id() const { return myId; } // data->list.at(id())->wid == this
void setId( int i ) { myId = i; }
protected:
- QValueList<QPointArray> buttonRegions();
+ Q3ValueList<Q3PointArray> buttonRegions();
void paintEvent( QPaintEvent * );
void mouseMoveEvent( QMouseEvent * );
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
int onButton( const QPoint& p );
void updateCursor( const QPoint& p );
private:
bool mMouseDown;
QSize mSizeHint;
bool mUseOffset;
Qt::Orientation orient;
bool opaq;
int myId;
KDGanttMinimizeSplitter *s;
int _activeButton;
bool _collapsed;
int _origPos;
#endif
};
#endif
#endif // QT_NO_SPLITTER
#endif // KDGANTTMINIMIZESPLITTER_H
diff --git a/microkde/fncolordialog.h b/microkde/fncolordialog.h
index 615d2ed..52356be 100755
--- a/microkde/fncolordialog.h
+++ b/microkde/fncolordialog.h
@@ -6,132 +6,132 @@
the Free Software Foundatibannwaon; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
2005/02/27 FreeNote 1.11.10pre
EPDF‚Ìo—ÍŒ`Ž®‚ðˆê•”•ÏX
EƒCƒ“ƒ|[ƒgŽž‚̃oƒOfix
*/
#ifndef FNPALETTEDIALOG_H
#define FNPALETTEDIALOG_H
#include <qwidget.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qcolor.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qslider.h>
#include <qspinbox.h>
//-----------------------------------------------------------------------------
// FNPaletteBase
//-----------------------------------------------------------------------------
-class Q_EXPORT FNPaletteBase : public QWidget
+class /* Q_EXPORT */ FNPaletteBase : public QWidget
{
Q_OBJECT
public:
- FNPaletteBase(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ FNPaletteBase(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~FNPaletteBase();
void setBGColor(QColor c) {
bgcolor_ = c;
selection_ = c;
redraw();
};
QColor color() const {
return selection_;
};
protected:
virtual void paintEvent(QPaintEvent*);
virtual void resizeEvent(QResizeEvent* evt);
virtual void redraw(bool force=false);
virtual void drawImpl(QPainter& pa);
virtual void mouseReleaseEvent(QMouseEvent* evt);
virtual bool pickColor(int x, int y);
QColor selection_;
private:
QPixmap wbuf_;
QColor bgcolor_;
bool _isblock;
signals:
void clicked(FNPaletteBase* sender);
};
//-----------------------------------------------------------------------------
// FNColorPalette
//-----------------------------------------------------------------------------
-class Q_EXPORT FNColorPalette : public FNPaletteBase
+class /* Q_EXPORT */ FNColorPalette : public FNPaletteBase
{
Q_OBJECT
public:
- FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~FNColorPalette();
};
//-----------------------------------------------------------------------------
// FNHSVPalette
//-----------------------------------------------------------------------------
-class Q_EXPORT FNHSVPalette : public FNPaletteBase
+class /*Q_EXPORT */ FNHSVPalette : public FNPaletteBase
{
Q_OBJECT
public:
- FNHSVPalette(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ FNHSVPalette(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~FNHSVPalette();
public slots:
void hueChanged(int v);
protected:
virtual void drawImpl(QPainter& pa);
int _hue;
};
//-----------------------------------------------------------------------------
// FNColorDialog
//-----------------------------------------------------------------------------
-class Q_EXPORT FNColorDialog : public QDialog
+class /*Q_EXPORT */FNColorDialog : public QDialog
{
Q_OBJECT
public:
- FNColorDialog(QWidget* parent=0, const char* name=0, WFlags f=0);
+ FNColorDialog(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
virtual ~FNColorDialog();
void setColor(QColor c);
QColor color() const;
public slots:
virtual void basePaletteClicked(FNPaletteBase*);
virtual void hsvPaletteClicked(FNPaletteBase*);
void rgbChanged(int);
private:
FNHSVPalette* _palette;
FNColorPalette* _base[16];
QSlider* _hue;
FNColorPalette* _select;
QSpinBox* _r;
QSpinBox* _g;
QSpinBox* _b;
bool _isblock;
};
#endif //FNPALETTEDIALOG_H
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index d7c12bb..b058d54 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -1,184 +1,187 @@
#include <stdlib.h>
#include <stdio.h>
#include "kapplication.h"
#include "ktextedit.h"
#include <qapplication.h>
#include <qstring.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qdialog.h>
#include <qlayout.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qregexp.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
int KApplication::random()
{
return rand();
}
//US
QString KApplication::randomString(int length)
{
if (length <=0 ) return QString::null;
QString str;
while (length--)
{
int r=random() % 62;
r+=48;
if (r>57) r+=7;
if (r>90) r+=6;
str += char(r);
// so what if I work backwards?
}
return str;
}
int KApplication::execDialog( QDialog* d )
{
if (QApplication::desktop()->width() <= 640 )
d->showMaximized();
else
;//d->resize( 800, 600 );
return d->exec();
}
void KApplication::showLicence()
{
KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" );
}
void KApplication::testCoords( int* x, int* y, int* wid, int * hei )
{
int dWid = QApplication::desktop()->width() ;
int dHei = QApplication::desktop()->height();
if ( *x < 0 ) *x = 0;
if ( *y < 20 ) *y = 20 ;
if ( *x + *wid > dWid ) {
*x = 0;
if ( *wid > dWid )
*wid = dWid;
}
if ( *y + *hei > dHei ) {
*y = 20;
if ( *hei > dHei )
*hei = dHei;
}
}
void KApplication::showFile(QString caption, QString fn)
{
QString text;
QString fileName;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
fileName += "/pics/" + fn ;
#else
fileName = qApp->applicationDirPath () + "/" + fn;
#endif
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return ;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
text = ts.read();
file.close();
KApplication::showText( caption, text );
}
bool KApplication::convert2latin1(QString fileName)
{
QString text;
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
- ts.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream ts( &file );
+ ts.setEncoding( Q3TextStream::UnicodeUTF8 );
text = ts.read();
file.close();
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream tsIn( &file );
- tsIn.setEncoding( QTextStream::Latin1 );
+ Q3TextStream tsIn( &file );
+ tsIn.setEncoding( Q3TextStream::Latin1 );
tsIn << text.latin1();
file.close();
return true;
}
void KApplication::showText(QString caption, QString text)
{
QDialog dia( 0, "name", true ); ;
dia.setCaption( caption );
- QVBoxLayout* lay = new QVBoxLayout( &dia );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
KTextEdit tb ( &dia );
- tb.setWordWrap( QMultiLineEdit::WidgetWidth );
+ tb.setWordWrap( Q3MultiLineEdit::WidgetWidth );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qdir.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include "kglobal.h"
#include "klocale.h"
class KBackupPrefs : public QDialog
{
public:
KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Backup Failed!") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( message, this );
lay->addWidget( lab );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Choose action"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
vcal = new QRadioButton(i18n("Try again now"), format );
tcal = new QRadioButton(i18n("Try again later"), format );
ical = new QRadioButton(i18n("Try again tomorrow"), format );
ocal = new QRadioButton(i18n("Disable backup"), format );
vcal->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget(ok );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
}
bool again() { return vcal->isChecked(); }
bool later() { return tcal->isChecked(); }
bool againTomorrow() { return ical->isChecked(); }
private:
QRadioButton* vcal, *ical, *ocal, *tcal;
};
int KApplication::createBackup( QString fn, QString dp, int numBup )
{
if ( numBup < 1) return 3;
int ret = 3;
//qDebug("KApplication::createBackup %s --- %s --- %d", fn.latin1(), dp.latin1(), numBup);
QDir bupDir ( dp );
bool tryAgain = true;
while ( tryAgain ) {
if ( !bupDir.exists() ) {
QString bd = dp.right(25);
if ( dp.length() > 25 )
bd = "..." + bd;
KBackupPrefs noDir( i18n("<b>Backup directory does not exist: </b>") + bd);
if ( !noDir.exec() ) return 3;
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 197bea2..16618fc 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -1,40 +1,43 @@
#include "kcolorbutton.h"
#include "kcolordialog.h"
#include "qapplication.h"
+#include <QDesktopWidget>
#include "qlayout.h"
#ifdef DESKTOP_VERSION
#include <qcolordialog.h>
+//Added by qt3to4:
+#include <QPixmap>
#endif
void KColorButton:: edit()
{
#ifdef DESKTOP_VERSION
QColor col = QColorDialog::getColor ( mColor );
if ( col.isValid () ) {
mColor = col;
setColor ( mColor );
emit changed ( mColor );
emit changedID ( mColor, id );
}
#else
KColorDialog* k = new KColorDialog( this );
k->setColor( mColor );
int res = k->exec();
if ( res ) {
mColor = k->getColor();
setColor ( mColor );
emit changed ( mColor );
emit changedID ( mColor, id );
}
delete k;
#endif
}
KColorButton::KColorButton( QWidget *p ):QPushButton( p )
{
int size = 24;
if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 )
size = 18;
setFixedSize( size,size );
int id = 0;
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 940196e..12063ca 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -1,146 +1,148 @@
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "kdebug.h"
#include "kurl.h"
#include "kstandarddirs.h"
#include "kconfig.h"
QString KConfig::mGroup = "";
//QString KConfig::mGroup = "General";
KConfig::KConfig( const QString &fileName )
: mFileName( fileName ), mDirty( false )
{
mTempGroup = "";
load();
}
KConfig::~KConfig()
{
sync();
}
// we need the temp group for plugins on windows
void KConfig::setTempGroup( const QString &group )
{
mTempGroup = group;
if ( mTempGroup.right( 1 ) != "/" ) mTempGroup += "/";
}
QString KConfig::tempGroup() const {
return mTempGroup;
}
void KConfig::setGroup( const QString &group )
{
mGroup = group;
if ( mGroup.right( 1 ) != "/" ) mGroup += "/";
}
//US
QString KConfig::group() const {
return mGroup;
}
//US added method
-QValueList<int> KConfig::readIntListEntry( const QString & key)
+Q3ValueList<int> KConfig::readIntListEntry( const QString & key)
{
// qDebug("KConfig::readIntListEntry key=%s:", key.latin1());
- QValueList<int> result;
+ Q3ValueList<int> result;
QMap<QString,QString>::ConstIterator mit = mStringMap.find( mGroup + key );
if ( mit == mStringMap.end() ) {
return result;
}
QStringList valuesAsStrings = QStringList::split(":", *mit );
bool ok = false;
bool ok2 = true;
int val;
for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) {
val = (*sit).toInt(&ok);
result << val;
if (ok == false) {
//qDebug("KConfig::readIntListEntry str=%s , int=%n:", (*sit).latin1(), &val);
ok2 = false;
}
}
if (ok2 == false)
{
qDebug("KConfig::readIntListEntry: error while reading one of the intvalues.");
}
return result;
}
int KConfig::readNumEntry( const QString & key, int def )
{
QString res = readEntry(key, QString::number(def ) );
bool ok = false;
int result = res.toInt(&ok);
if ( ok )
return result;
return def;
}
QString KConfig::readEntry( const QString &key, const QString &def )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return def;
}
return QString::fromUtf8((*it).latin1());
}
QSize KConfig::readSizeEntry( const QString &key, QSize* def )
{
- QValueList<int> intlist = readIntListEntry(key);
+ Q3ValueList<int> intlist = readIntListEntry(key);
if (intlist.count() < 2)
{
if (def)
return *def;
else
return QSize();
}
QSize ret;
ret.setWidth(intlist[0]);
ret.setHeight(intlist[1]);
return ret;
}
QStringList KConfig::readListEntry( const QString &key )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return QStringList();
}
QStringList temp = QStringList::split(":@:", QString::fromUtf8((*it).latin1()));
if ( temp.count() == 1 )
return QStringList::split(":", QString::fromUtf8((*it).latin1()));
return temp;
}
bool KConfig::readBoolEntry( const QString &key, bool def )
{
@@ -165,202 +167,202 @@ QColor KConfig::readColorEntry( const QString & e, QColor *def )
return QColor();
}
QColor c ( l[0].toInt(), l[1].toInt(), l[2].toInt() );
return c;
}
QFont KConfig::readFontEntry( const QString & e, QFont *def )
{
QStringList font = readListEntry( e );
if ( font.isEmpty() )
return *def;
QFont f;
f.setFamily( font[0]);
f.setBold ( font[1] == "bold");
f.setPointSize ( font[2].toInt());
f.setItalic( font[3] == "italic" );
return f;
}
QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def )
{
QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key );
if ( it == mDateTimeMap.end() ) {
if ( def ) return *def;
else return QDateTime();
}
return *it;
}
//US added method
-void KConfig::writeEntry( const QString &key, const QValueList<int> &value)
+void KConfig::writeEntry( const QString &key, const Q3ValueList<int> &value)
{
QStringList valuesAsStrings;
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int>::ConstIterator it;
for( it = value.begin(); it != value.end(); ++it )
{
valuesAsStrings << QString::number(*it);
}
mStringMap.insert( mGroup + key, valuesAsStrings.join(":") );
mDirty = true;
}
void KConfig::writeEntry( const QString & key , int num )
{
writeEntry( key, QString::number ( num ) );
}
void KConfig::writeEntry( const QString &key, const QString &value )
{
mStringMap.insert( mGroup + key, value.utf8() );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, const QStringList &value )
{
mStringMap.insert( mGroup + key, value.join(":@:").utf8() );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, bool value)
{
mBoolMap.insert( mGroup + key, value );
mDirty = true;
}
void KConfig::writeEntry( const QString & e, const QColor & c )
{
QStringList l;
l.append( QString::number ( c.red() ) );
l.append( QString::number ( c.green() ) );
l.append( QString::number ( c.blue() ) );
writeEntry( e.utf8(), l );
}
void KConfig::writeEntry( const QString & e, const QSize & s )
{
- QValueList<int> intlist;
+ Q3ValueList<int> intlist;
intlist << s.width() << s.height();
writeEntry( e, intlist );
}
void KConfig::writeEntry( const QString & e , const QFont & f )
{
QStringList font;
font.append( f.family());
font.append( (!f.bold ()?"nonbold":"bold") );
font.append( QString::number ( f.pointSize () ) );
font.append( !f.italic ()?"nonitalic":"italic" );
writeEntry( e, font );
}
void KConfig::writeEntry( const QString &key, const QDateTime &dt )
{
mDateTimeMap.insert( mGroup + key, dt );
}
void KConfig::load()
{
QFile f( mFileName );
- if ( !f.open( IO_ReadOnly ) ) {
+ if ( !f.open( QIODevice::ReadOnly ) ) {
//qDebug("KConfig: could not open file %s ",mFileName.latin1() );
return;
}
mBoolMap.clear();
mStringMap.clear();
- QTextStream t( &f );
- t.setEncoding( QTextStream::Latin1 );
+ Q3TextStream t( &f );
+ t.setEncoding( Q3TextStream::Latin1 );
QString line = t.readLine();
while ( !line.isNull() ) {
- QStringList tokens = QStringList::split( ",", line );
+ QStringList tokens = line.split(',');
if ( tokens[0] == "bool" ) {
bool value = false;
if ( tokens[2] == "1" ) value = true;
mBoolMap.insert( tokens[1], value );
} else if ( tokens[0] == "QString" ) {
QString value = tokens[2];
mStringMap.insert( tokens[1], value );
} else if ( tokens[0] == "QDateTime" ) {
#if 0
int year = tokens[2].toInt();
QDateTime dt( QDate( year,
tokens[3].toInt(),
tokens[4].toInt() ),
QTime( tokens[5].toInt(), tokens[6].toInt(),
tokens[7].toInt() ) );
mDateTimeMap.insert( tokens[1], dt );
#endif
}
line = t.readLine();
}
}
void KConfig::sync()
{
if ( !mDirty ) return;
//qDebug("KConfig::sync() %s ",mFileName.latin1() );
//kdDebug() << "KConfig::sync(): " << mFileName << endl;
//US I took the following code from a newer version of KDE
// Create the containing dir if needed
KURL path;
path.setPath(mFileName);
QString dir=path.directory();
KStandardDirs::makeDir(dir);
QFile f( mFileName );
- if ( !f.open( IO_WriteOnly ) ) {
+ if ( !f.open( QIODevice::WriteOnly ) ) {
qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() );
return;
}
- QTextStream t( &f );
- t.setEncoding( QTextStream::Latin1 );
+ Q3TextStream t( &f );
+ t.setEncoding( Q3TextStream::Latin1 );
QMap<QString,bool>::ConstIterator itBool;
for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) {
t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl;
}
QMap<QString,QString>::ConstIterator itString;
for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) {
t << "QString," << itString.key() << "," << (*itString ) << endl;
}
QMap<QString,QDateTime>::ConstIterator itDateTime;
for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) {
QDateTime dt = *itDateTime;
t << "QDateTime," << itDateTime.key() << ","
<< dt.date().year() << ","
<< dt.date().month() << ","
<< dt.date().day() << ","
<< dt.time().hour() << ","
<< dt.time().minute() << ","
<< dt.time().second() << endl;
}
f.close();
mDirty = false;
}
//US I took the following deleteGroup method from a newer version from KDE.
/**
* Deletes a configuration entry group
*
diff --git a/microkde/kconfig.h b/microkde/kconfig.h
index 1a1038f..7b91e44 100644
--- a/microkde/kconfig.h
+++ b/microkde/kconfig.h
@@ -1,104 +1,104 @@
#ifndef MINIKDE_KCONFIG_H
#define MINIKDE_KCONFIG_H
#include <qstring.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qcolor.h>
#include <qfont.h>
#include <qmap.h>
#include <qdatetime.h>
class KConfig
{
public:
KConfig( const QString & );
~KConfig();
void setTempGroup( const QString &group );
QString tempGroup() const;
void setGroup( const QString & );
//US
/**
* Returns the name of the group in which we are
* searching for keys and from which we are retrieving entries.
*
* @return The current group.
*/
QString group() const;
//US I took the following deleteGroup method from a newer version from KDE.
/**
* Deletes a configuration entry group
*
* If the group is not empty and bDeep is false, nothing gets
* deleted and false is returned.
* If this group is the current group and it is deleted, the
* current group is undefined and should be set with setGroup()
* before the next operation on the configuration object.
*
* @param group The name of the group
* returns true if we deleted at least one entry.
*/
bool deleteGroup( const QString& group);
//US I took the following hasGroup method from a newer version from KDE.
/**
* Returns true if the specified group is known about.
*
* @param group The group to search for.
* @return Whether the group exists.
*/
bool hasGroup(const QString &group) const;
QString getFileName();
//US added method readIntListEntry
- QValueList<int> readIntListEntry( const QString &);
+ Q3ValueList<int> readIntListEntry( const QString &);
int readNumEntry( const QString &, int def=0 );
QString readEntry( const QString &, const QString &def=QString::null );
QStringList readListEntry( const QString & );
bool readBoolEntry( const QString &, bool def=false );
QColor readColorEntry( const QString &, QColor * );
QFont readFontEntry( const QString &, QFont * );
QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 );
QSize readSizeEntry(const QString &, QSize* );
bool hasKey( const QString &);
- void writeEntry( const QString &, const QValueList<int>& );
+ void writeEntry( const QString &, const Q3ValueList<int>& );
void writeEntry( const QString &, int );
void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); }
void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); }
void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QString & );
void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QStringList & );
void writeEntry( const QString &, bool );
void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QColor & );
void writeEntry( const QString &, const QFont & );
void writeEntry( const QString &, const QDateTime & );
void writeEntry( const QString &, const QSize & );
void deleteEntry( const QString &);
void load();
void sync();
private:
static QString mGroup;
QString mTempGroup;
QString mFileName;
QMap<QString,bool> mBoolMap;
QMap<QString,QString> mStringMap;
QMap<QString,QDateTime> mDateTimeMap;
bool mDirty;
};
diff --git a/microkde/kdatepickernew.cpp b/microkde/kdatepickernew.cpp
index f60a422..8f8001e 100644
--- a/microkde/kdatepickernew.cpp
+++ b/microkde/kdatepickernew.cpp
@@ -284,65 +284,65 @@ KDatePicker::yearBackwardClicked()
void KDatePicker::selectWeekClicked() {} // ### in 3.2 obsolete; kept for binary compatibility
void
KDatePicker::weekSelected(int week)
{
week++; // week number starts with 1
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
QDate date = table->getDate();
int year = calendar->year(date);
calendar->setYMD(date, year, 1, 1);
date = calendar->addDays(date, -7);
while (calendar->weekNumber(date) != 1)
date = calendar->addDays(date, 1);
// date is now first day in week 1 some day in week 1
date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7);
setDate(date);
}
void
KDatePicker::selectMonthClicked()
{
// every year can have different month names (in some calendar systems)
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
QDate date = table->getDate();
int i, month, months = calendar->monthsInYear(date);
- QPopupMenu popup(selectMonth);
+ Q3PopupMenu popup(selectMonth);
for (i = 1; i <= months; i++)
popup.insertItem(calendar->monthName(i, calendar->year(date)), i);
popup.setActiveItem(calendar->month(date) - 1);
if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled
int day = calendar->day(date);
// ----- construct a valid date in this month:
//date.setYMD(date.year(), month, 1);
//date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
calendar->setYMD(date, calendar->year(date), month,
QMIN(day, calendar->daysInMonth(date)));
// ----- set this month
setDate(date);
}
void
KDatePicker::selectYearClicked()
{
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
int year;
KPopupFrame* popup = new KPopupFrame(this);
KDateInternalYearSelector* picker = new KDateInternalYearSelector(popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
picker->setFocus();
if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height()))))
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index 353f78d..10dc449 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -15,216 +15,223 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/////////////////// KDateTable widget class //////////////////////
//
// Copyright (C) 1997 Tim D. Gilman
// (C) 1998-2001 Mirko Boehm
// Written using Qt (http://www.troll.no) for the
// KDE project (http://www.kde.org)
//
// This is a support class for the KDatePicker class. It just
// draws the calender table without titles, but could theoretically
// be used as a standalone.
//
// When a date is selected by the user, it emits a signal:
// dateSelected(QDate)
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kapplication.h>
#include <klocale.h>
#include <kdebug.h>
#include <knotifyclient.h>
#include "kdatetbl.h"
#include <qdatetime.h>
#include <qstring.h>
#include <qpen.h>
#include <qpainter.h>
#include <qdialog.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <Q3Frame>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
#include <assert.h>
#include <qapplication.h>
KDateValidator::KDateValidator(QWidget* parent, const char* name)
: QValidator(parent, name)
{
}
QValidator::State
KDateValidator::validate(QString& text, int&) const
{
QDate temp;
// ----- everything is tested in date():
return date(text, temp);
}
QValidator::State
KDateValidator::date(const QString& text, QDate& d) const
{
QDate tmp = KGlobal::locale()->readDate(text);
if (!tmp.isNull())
{
d = tmp;
return Acceptable;
} else
- return Valid;
+ return QValidator::Intermediate;
}
void
KDateValidator::fixup( QString& ) const
{
}
-KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
- : QGridView(parent, name, f)
+KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, Qt::WFlags f)
+ : Q3GridView(parent, name, f)
{
setFont( KGlobalSettings::generalFont() );
if(!date_.isValid())
{
date_=QDate::currentDate();
}
- setFocusPolicy( QWidget::StrongFocus );
+ setFocusPolicy( Qt::StrongFocus );
setNumRows(7); // 6 weeks max + headline
setNumCols(7); // 7 days a week
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
viewport()->setBackgroundColor(QColor(220,245,255));
#if 0
- viewport()->setEraseColor(lightGray);
+ viewport()->setEraseColor(Qt::lightGray);
#endif
mMarkCurrent = false;
setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
}
void
KDateTable::paintCell(QPainter *painter, int row, int col)
{
QRect rect;
QString text;
QPen pen;
int w=cellWidth();
int h=cellHeight();
int pos;
- QBrush brushBlue(blue);
+ QBrush brushBlue(Qt::blue);
QBrush brushLightblue(QColor(220,245,255));
QFont _font=font();
// -----
if(row==0)
{ // we are drawing the headline
_font.setBold(true);
painter->setFont(_font);
bool normalday = true;
QString daystr;
if (KGlobal::locale()->weekStartsMonday())
{
daystr = KGlobal::locale()->weekDayName(col+1, true);
if (col == 5 || col == 6)
normalday = false;
} else {
daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true);
if (col == 0 || col == 6)
normalday = false;
}
if (!normalday)
{
painter->setPen(QColor(220,245,255));
painter->setBrush(brushLightblue);
painter->drawRect(0, 0, w, h);
- painter->setPen(blue);
+ painter->setPen(Qt::blue);
} else {
- painter->setPen(blue);
+ painter->setPen(Qt::blue);
painter->setBrush(brushBlue);
painter->drawRect(0, 0, w, h);
- painter->setPen(white);
+ painter->setPen(Qt::white);
}
- painter->drawText(0, 0, w, h-1, AlignCenter,
+ painter->drawText(0, 0, w, h-1, Qt::AlignCenter,
daystr, -1, &rect);
- painter->setPen(black);
- painter->moveTo(0, h-1);
- painter->lineTo(w-1, h-1);
+ painter->setPen(Qt::black);
+ painter->drawLine(0, h-1, w-1, h-1);
// ----- draw the weekday:
} else {
painter->setFont(_font);
pos=7*(row-1)+col;
if (KGlobal::locale()->weekStartsMonday())
pos++;
if(pos<firstday || (firstday+numdays<=pos))
{ // we are either
// ° painting a day of the previous month or
// ° painting a day of the following month
if(pos<firstday)
{ // previous month
text.setNum(numDaysPrevMonth+pos-firstday+1);
} else { // following month
text.setNum(pos-firstday-numdays+1);
}
- painter->setPen(gray);
+ painter->setPen(Qt::gray);
} else { // paint a day of the current month
text.setNum(pos-firstday+1);
- painter->setPen(black);
+ painter->setPen(Qt::black);
}
pen=painter->pen();
if(firstday+date.day()-1==pos)
{
if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
- painter->setPen(green);
+ painter->setPen(Qt::green);
else
- painter->setPen(red);
+ painter->setPen(Qt::red);
if(hasFocus())
{
- painter->setBrush(darkRed);
- pen=white;
+ painter->setBrush(Qt::darkRed);
+ pen=QColor(Qt::white);
} else {
- painter->setBrush(darkGray);
- pen=white;
+ painter->setBrush(Qt::darkGray);
+ pen=QColor(Qt::white);
}
} else {
if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
{
- painter->setPen(green);
- painter->setBrush(darkGreen);
- pen=white;
+ painter->setPen(Qt::green);
+ painter->setBrush(Qt::darkGreen);
+ pen=QColor(Qt::white);
} else {
painter->setBrush(QColor(220,245,255));
painter->setPen(QColor(220,245,255));
}
}
painter->drawRect(0, 0, w, h);
painter->setPen(pen);
- painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect);
+ painter->drawText(0, 0, w, h, Qt::AlignCenter, text, -1, &rect);
}
/*
if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width());
if(rect.height()>maxCell.height()) {
maxCell.setHeight(rect.height());
}
*/
}
void
KDateTable::keyPressEvent( QKeyEvent *e )
{
/*
// not working properly
if ( e->key() == Qt::Key_Prior ) {
if ( date.month() == 1 ) {
KNotifyClient::beep();
return;
}
int day = date.day();
if ( day > 27 )
while ( !QDate::isValid( date.year(), date.month()-1, day ) )
day--;
setDate(QDate(date.year(), date.month()-1, day));
return;
}
if ( e->key() == Qt::Key_Next ) {
if ( date.month() == 12 ) {
KNotifyClient::beep();
return;
}
int day = date.day();
@@ -245,65 +252,65 @@ KDateTable::keyPressEvent( QKeyEvent *e )
if ( e->key() == Qt::Key_Up ) {
add -= 7;
irgnore = false;
}
if ( e->key() == Qt::Key_Down ) {
add += 7;
irgnore = false;
}
if ( e->key() == Qt::Key_Left ) {
--add;
irgnore = false;
}
if ( e->key() == Qt::Key_Right ) {
++add;
irgnore = false;
}
}
if ( irgnore ) {
e->ignore();
return;
}
pos += add;
setDate(date.addDays( add ));
updateCell(temp/7+1, temp%7); // Update the previously selected cell
updateCell(pos/7+1, pos%7); // Update the selected cell
}
void
KDateTable::viewportResizeEvent(QResizeEvent * e)
{
- QGridView::viewportResizeEvent(e);
+ Q3GridView::viewportResizeEvent(e);
setCellWidth(viewport()->width()/7);
setCellHeight(viewport()->height()/7);
}
void
KDateTable::setFontSize(int size)
{
int count;
QRect rect;
// ----- store rectangles:
fontsize=size;
QFont _font = font();
_font.setPointSize(fontsize);
setFont( _font );
_font.setBold( true );
QFontMetrics metrics(_font);
// ----- find largest day name:
maxCell.setWidth(0);
maxCell.setHeight(0);
for(count=0; count<7; ++count)
{
rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true));
maxCell.setWidth(QMAX(maxCell.width(), rect.width()));
maxCell.setHeight(QMAX(maxCell.height(), rect.height()));
}
// ----- compare with a real wide number and add some space:
rect=metrics.boundingRect(QString::fromLatin1("88"));
maxCell.setWidth(QMAX(maxCell.width()+2, rect.width()));
#ifdef DESKTOP_VERSION
maxCell.setHeight(QMAX(maxCell.height()+8, rect.height()));
@@ -380,196 +387,196 @@ KDateTable::setDate(const QDate& date_)
date=date_;
changed=true;
}
mMarkCurrent = ( date.month() == QDate::currentDate().month() && date.year() == QDate::currentDate().year() );
temp.setYMD(date.year(), date.month(), 1);
firstday=temp.dayOfWeek();
if(firstday==1) firstday=8;
numdays=date.daysInMonth();
if(date.month()==1)
{ // set to december of previous year
temp.setYMD(date.year()-1, 12, 1);
} else { // set to previous month
temp.setYMD(date.year(), date.month()-1, 1);
}
numDaysPrevMonth=temp.daysInMonth();
if(changed)
{
repaintContents(false);
}
emit(dateChanged(date));
return true;
}
const QDate&
KDateTable::getDate() const
{
return date;
}
void KDateTable::focusInEvent( QFocusEvent *e )
{
repaintContents(false);
- QGridView::focusInEvent( e );
+ Q3GridView::focusInEvent( e );
}
void KDateTable::focusOutEvent( QFocusEvent *e )
{
repaintContents(false);
- QGridView::focusOutEvent( e );
+ Q3GridView::focusOutEvent( e );
}
QSize
KDateTable::sizeHint() const
{
if(maxCell.height()>0 && maxCell.width()>0)
{
return QSize((maxCell.width()+2)*numCols()+2*frameWidth(),
(maxCell.height()+4)*numRows()+2*frameWidth());
} else {
return QSize(-1, -1);
}
}
KDateInternalMonthPicker::KDateInternalMonthPicker
(QWidget* parent, const char* name)
- : QGridView(parent, name),
+ : Q3GridView(parent, name),
result(0) // invalid
{
QRect rect;
QFont font;
// -----
activeCol = -1;
activeRow = -1;
font=KGlobalSettings::generalFont();
int fontsize = 10;
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 8;
if ( QApplication::desktop()->width() > 640 )
add += 6;
font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
setNumRows(4);
setNumCols(3);
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
- viewport()->setEraseColor(lightGray); // for consistency with the datepicker
+ viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
// (this is slow, possibly, but unfortunatly it is needed here):
QFontMetrics metrics(font);
for(int i=1; i <= 12; ++i)
{
rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false));
if(max.width()<rect.width()) max.setWidth(rect.width());
if(max.height()<rect.height()) max.setHeight(rect.height());
}
}
QSize
KDateInternalMonthPicker::sizeHint() const
{
return QSize((max.width()+6)*numCols()+2*frameWidth(),
(max.height()+6)*numRows()+2*frameWidth());
}
int
KDateInternalMonthPicker::getResult() const
{
return result;
}
void
KDateInternalMonthPicker::setupPainter(QPainter *p)
{
- p->setPen(black);
+ p->setPen(Qt::black);
}
void
KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*)
{
setCellWidth(width()/3);
setCellHeight(height()/4);
}
void
KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col)
{
int index;
QString text;
// ----- find the number of the cell:
index=3*row+col+1;
text=KGlobal::locale()->monthName(index, false);
- painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
+ painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text);
if ( activeCol == col && activeRow == row )
painter->drawRect( 0, 0, cellWidth(), cellHeight() );
}
void
KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e)
{
- if(!isEnabled() || e->button() != LeftButton)
+ if(!isEnabled() || e->button() != Qt::LeftButton)
{
KNotifyClient::beep();
return;
}
// -----
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
activeCol = -1;
activeRow = -1;
} else {
activeCol = col;
activeRow = row;
updateCell( row, col /*, false */ );
}
}
void
KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e)
{
- if (e->state() & LeftButton)
+ if (e->state() & Qt::LeftButton)
{
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
int tmpRow = -1, tmpCol = -1;
if(row<0 || col<0)
{ // the user clicked on the frame of the table
if ( activeCol > -1 )
{
tmpRow = activeRow;
tmpCol = activeCol;
}
activeCol = -1;
activeRow = -1;
} else {
bool differentCell = (activeRow != row || activeCol != col);
if ( activeCol > -1 && differentCell)
{
tmpRow = activeRow;
tmpCol = activeCol;
}
if ( differentCell)
{
activeRow = row;
activeCol = col;
updateCell( row, col /*, false */ ); // mark the new active cell
}
}
if ( tmpRow > -1 ) // repaint the former active cell
@@ -585,123 +592,123 @@ KDateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e)
return;
}
// -----
int row, col, pos;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
emit(closeMe(0));
}
pos=3*row+col+1;
result=pos;
emit(closeMe(1));
}
KDateInternalYearSelector::KDateInternalYearSelector
(int fontsize, QWidget* parent, const char* name)
: QLineEdit(parent, name),
val(new QIntValidator(this)),
result(0)
{
QFont font;
// -----
font=KGlobalSettings::generalFont();
font.setPointSize(fontsize);
setFont(font);
#if 0
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
#endif
// we have to respect the limits of QDate here, I fear:
val->setRange(0, 8000);
setValidator(val);
connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot()));
}
void
KDateInternalYearSelector::yearEnteredSlot()
{
bool ok;
int year;
QDate date;
// ----- check if this is a valid year:
year=text().toInt(&ok);
if(!ok)
{
KNotifyClient::beep();
return;
}
date.setYMD(year, 1, 1);
if(!date.isValid())
{
KNotifyClient::beep();
return;
}
result=year;
emit(closeMe(1));
}
int
KDateInternalYearSelector::getYear()
{
return result;
}
void
KDateInternalYearSelector::setYear(int year)
{
QString temp;
// -----
temp.setNum(year);
setText(temp);
}
KPopupFrame::KPopupFrame(QWidget* parent, const char* name)
- : QFrame(parent, name, WType_Popup),
+ : Q3Frame(parent, name, Qt::WType_Popup),
result(0), // rejected
main(0)
{
- setFrameStyle(QFrame::Box|QFrame::Raised);
+ setFrameStyle(Q3Frame::Box|Q3Frame::Raised);
setMidLineWidth(2);
}
void
KPopupFrame::keyPressEvent(QKeyEvent* e)
{
- if(e->key()==Key_Escape)
+ if(e->key()==Qt::Key_Escape)
{
result=0; // rejected
qApp->exit_loop();
}
}
void
KPopupFrame::close(int r)
{
result=r;
qApp->exit_loop();
}
void
KPopupFrame::setMainWidget(QWidget* m)
{
main=m;
if(main!=0)
{
resize(main->width()+2*frameWidth(), main->height()+2*frameWidth());
}
}
void
KPopupFrame::resizeEvent(QResizeEvent*)
{
if(main!=0)
{
main->setGeometry(frameWidth(), frameWidth(),
width()-2*frameWidth(), height()-2*frameWidth());
}
}
@@ -727,180 +734,180 @@ KPopupFrame::popup(const QPoint &pos)
// Pop the thingy up.
move(x, y);
show();
}
int
KPopupFrame::exec(QPoint pos)
{
popup(pos);
repaint();
qApp->enter_loop();
hide();
return result;
}
int
KPopupFrame::exec(int x, int y)
{
return exec(QPoint(x, y));
}
void KPopupFrame::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KDateTable::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//#include "kdatetbl.moc"
KDateInternalWeekPicker::KDateInternalWeekPicker
(QWidget* parent, const char* name)
- : QGridView(parent, name),
+ : Q3GridView(parent, name),
result(0) // invalid
{
QRect rect;
QFont font;
// -----
activeCol = -1;
activeRow = -1;
font=KGlobalSettings::generalFont();
int fontsize = 10;
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 6;
font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
if ( QApplication::desktop()->height() > 240 ) {
setNumRows(13);
setNumCols(4);
} else {
setNumRows(4);
setNumCols(13);
}
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
- viewport()->setEraseColor(lightGray); // for consistency with the datepicker
+ viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
// (this is slow, possibly, but unfortunatly it is needed here):
QFontMetrics metrics(font);
for(int i=1; i <= 52; ++i)
{
rect=metrics.boundingRect(QString::number( i ));
if(max.width()<rect.width()) max.setWidth(rect.width());
if(max.height()<rect.height()) max.setHeight(rect.height());
}
if ( QApplication::desktop()->width() > 640 ) {
max.setWidth(max.width()+6);
max.setHeight(max.height()+8);
}
}
QSize
KDateInternalWeekPicker::sizeHint() const
{
return QSize((max.width()+6)*numCols()+2*frameWidth(),
(max.height()+6)*numRows()+2*frameWidth());
}
int
KDateInternalWeekPicker::getResult() const
{
return result;
}
void
KDateInternalWeekPicker::setupPainter(QPainter *p)
{
- p->setPen(black);
+ p->setPen(Qt::black);
}
void
KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*)
{
setCellWidth(width()/ numCols());
setCellHeight(height()/ numRows());
}
void
KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col)
{
int index;
QString text;
// ----- find the number of the cell:
index=numCols()*row+col+1;
text=QString::number( index );
- painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
+ painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text);
if ( activeCol == col && activeRow == row )
painter->drawRect( 0, 0, cellWidth(), cellHeight() );
}
void
KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e)
{
- if(!isEnabled() || e->button() != LeftButton)
+ if(!isEnabled() || e->button() != Qt::LeftButton)
{
KNotifyClient::beep();
return;
}
// -----
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
activeCol = -1;
activeRow = -1;
} else {
activeCol = col;
activeRow = row;
updateCell( row, col /*, false */ );
}
}
void
KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e)
{
- if (e->state() & LeftButton)
+ if (e->state() & Qt::LeftButton)
{
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
int tmpRow = -1, tmpCol = -1;
if(row<0 || col<0)
{ // the user clicked on the frame of the table
if ( activeCol > -1 )
{
tmpRow = activeRow;
tmpCol = activeCol;
}
activeCol = -1;
activeRow = -1;
} else {
bool differentCell = (activeRow != row || activeCol != col);
if ( activeCol > -1 && differentCell)
{
tmpRow = activeRow;
tmpCol = activeCol;
}
if ( differentCell)
{
activeRow = row;
activeCol = col;
updateCell( row, col /*, false */ ); // mark the new active cell
}
}
if ( tmpRow > -1 ) // repaint the former active cell
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h
index 87808df..2d3d2cf 100644
--- a/microkde/kdatetbl.h
+++ b/microkde/kdatetbl.h
@@ -1,66 +1,72 @@
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KDATETBL_H
#define KDATETBL_H
#include <qvalidator.h>
-#include <qgridview.h>
+#include <q3gridview.h>
#include <qlineedit.h>
#include <qdatetime.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <Q3Frame>
+#include <QKeyEvent>
+#include <QFocusEvent>
/**
* A table containing month names. It is used to pick a month directly.
* @internal
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*/
-class KDateInternalMonthPicker : public QGridView
+class KDateInternalMonthPicker : public Q3GridView
{
Q_OBJECT
protected:
/**
* Store the month that has been clicked [1..12].
*/
int result;
/**
* the cell under mouse cursor when LBM is pressed
*/
short int activeCol;
short int activeRow;
/**
* Contains the largest rectangle needed by the month names.
*/
QRect max;
signals:
/**
* This is send from the mouse click event handler.
*/
void closeMe(int);
public:
/**
* The constructor.
*/
KDateInternalMonthPicker(QWidget* parent, const char* name=0);
/**
* The size hint.
*/
QSize sizeHint() const;
/**
* Return the result. 0 means no selection (reject()), 1..12 are the
@@ -98,162 +104,162 @@ private:
/** Year selection widget.
* @internal
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*/
class KDateInternalYearSelector : public QLineEdit
{
Q_OBJECT
protected:
QIntValidator *val;
int result;
public slots:
void yearEnteredSlot();
signals:
void closeMe(int);
public:
KDateInternalYearSelector(int fontsize,
QWidget* parent=0,
const char* name=0);
int getYear();
void setYear(int year);
private:
class KDateInternalYearPrivate;
KDateInternalYearPrivate *d;
};
/**
* Frame with popup menu behaviour.
* @author Tim Gilman, Mirko Boehm
* @version $Id$
*/
-class KPopupFrame : public QFrame
+class KPopupFrame : public Q3Frame
{
Q_OBJECT
protected:
/**
* The result. It is returned from exec() when the popup window closes.
*/
int result;
/**
* Catch key press events.
*/
void keyPressEvent(QKeyEvent* e);
/**
* The only subwidget that uses the whole dialog window.
*/
QWidget *main;
public slots:
/**
* Close the popup window. This is called from the main widget, usually.
* @p r is the result returned from exec().
*/
void close(int r);
public:
/**
* The contructor. Creates a dialog without buttons.
*/
KPopupFrame(QWidget* parent=0, const char* name=0);
/**
* Set the main widget. You cannot set the main widget from the constructor,
* since it must be a child of the frame itselfes.
* Be careful: the size is set to the main widgets size. It is up to you to
* set the main widgets correct size before setting it as the main
* widget.
*/
void setMainWidget(QWidget* m);
/**
* The resize event. Simply resizes the main widget to the whole
* widgets client size.
*/
void resizeEvent(QResizeEvent*);
/**
* Open the popup window at position pos.
*/
void popup(const QPoint &pos);
/**
* Execute the popup window.
*/
int exec(QPoint p);
/**
* Dito.
*/
int exec(int x, int y);
private:
- virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
+ virtual bool close(bool alsoDelete) { return Q3Frame::close(alsoDelete); }
protected:
virtual void virtual_hook( int id, void* data );
private:
class KPopupFramePrivate;
KPopupFramePrivate *d;
};
/**
* Validates user-entered dates.
*/
class KDateValidator : public QValidator
{
public:
KDateValidator(QWidget* parent=0, const char* name=0);
virtual State validate(QString&, int&) const;
virtual void fixup ( QString & input ) const;
State date(const QString&, QDate&) const;
};
/**
* Date selection table.
* This is a support class for the KDatePicker class. It just
* draws the calender table without titles, but could theoretically
* be used as a standalone.
*
* When a date is selected by the user, it emits a signal:
* dateSelected(QDate)
*
* @internal
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*/
-class KDateTable : public QGridView
+class KDateTable : public Q3GridView
{
Q_OBJECT
public:
/**
* The constructor.
*/
KDateTable(QWidget *parent=0,
QDate date=QDate::currentDate(),
- const char* name=0, WFlags f=0);
+ const char* name=0, Qt::WFlags f=0);
/**
* Returns a recommended size for the widget.
* To save some time, the size of the largest used cell content is
* calculated in each paintCell() call, since all calculations have
* to be done there anyway. The size is stored in maxCell. The
* sizeHint() simply returns a multiple of maxCell.
*/
virtual QSize sizeHint() const;
/**
* Set the font size of the date table.
*/
void setFontSize(int size);
/**
* Select and display this date.
*/
bool setDate(const QDate&);
const QDate& getDate() const;
protected:
bool mMarkCurrent;
/**
* Paint a cell.
*/
virtual void paintCell(QPainter*, int, int);
/**
* Handle the resize events.
*/
virtual void viewportResizeEvent(QResizeEvent *);
/**
* React on mouse clicks that select a date.
*/
@@ -278,65 +284,65 @@ protected:
*/
int numdays;
/**
* The number of days in the previous month.
*/
int numDaysPrevMonth;
/**
* unused
*/
bool unused_hasSelection;
/**
* Save the size of the largest used cell content.
*/
QRect maxCell;
signals:
/**
* The selected date changed.
*/
void dateChanged(QDate);
/**
* A date has been selected by clicking on the table.
*/
void tableClicked();
protected:
virtual void virtual_hook( int id, void* data );
private:
class KDateTablePrivate;
KDateTablePrivate *d;
};
#endif // KDATETBL_H
-class KDateInternalWeekPicker : public QGridView
+class KDateInternalWeekPicker : public Q3GridView
{
Q_OBJECT
protected:
/**
* Store the month that has been clicked [1..12].
*/
int result;
/**
* the cell under mouse cursor when LBM is pressed
*/
short int activeCol;
short int activeRow;
/**
* Contains the largest rectangle needed by the month names.
*/
QRect max;
signals:
/**
* This is send from the mouse click event handler.
*/
void closeMe(int);
public:
/**
* The constructor.
*/
KDateInternalWeekPicker(QWidget* parent, const char* name=0);
/**
* The size hint.
*/
QSize sizeHint() const;
/**
* Return the result. 0 means no selection (reject()), 1..12 are the
diff --git a/microkde/kdebug.h b/microkde/kdebug.h
index bb9cfe3..534943c 100644
--- a/microkde/kdebug.h
+++ b/microkde/kdebug.h
@@ -1,92 +1,94 @@
#ifndef MINIKDE_KDEBUG_H
#define MINIKDE_KDEBUG_H
#include <stdio.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3CString>
class kdbgstream;
typedef kdbgstream & (*KDBGFUNC)(kdbgstream &); // manipulator function
class kdbgstream {
public:
kdbgstream(unsigned int _area, unsigned int _level, bool _print = true) :
area(_area), level(_level), print( _print ) { print = false; }
/* kdbgstream(const char * initialString, unsigned int _area, unsigned int _level, bool _print = false) :
output(QString::fromLatin1(initialString)), area(_area), level(_level), print(_print) { print = false; }*/
~kdbgstream()
{
// if (!output.isEmpty()) {
// fprintf(stderr,"ASSERT: debug output not ended with \\n\n");
//*this << "\n";
//}
}
kdbgstream &operator<<(bool) {
return *this;
}
kdbgstream &operator<<(short) {
return *this;
}
kdbgstream &operator<<(unsigned short) {
return *this;
}
kdbgstream &operator<<(char) {
return *this;
}
kdbgstream &operator<<(unsigned char) {
return *this;
}
kdbgstream &operator<<(int) {
return *this;
}
kdbgstream &operator<<(unsigned int) {
return *this;
}
kdbgstream &operator<<(long) {
return *this;
}
kdbgstream &operator<<(unsigned long) {
return *this;
}
kdbgstream &operator<<(const QString&) {
return *this;
}
kdbgstream &operator<<(const char*) {
return *this;
}
- kdbgstream &operator<<(const QCString&) {
+ kdbgstream &operator<<(const Q3CString&) {
return *this;
}
kdbgstream& operator<<(KDBGFUNC f) {
return (*f)(*this);
}
kdbgstream& operator<<(double) {
if (!print) return *this;
return *this;
}
void flush() {
return;
}
private:
QString output;
unsigned int area, level;
bool print;
};
inline kdbgstream &endl( kdbgstream &s) { s << "\n"; return s; }
inline kdbgstream kdDebug(int area = 0) { return kdbgstream(area, 0); }
inline kdbgstream kdWarning(int area = 0) { return kdbgstream(area, 0); }
inline kdbgstream kdError(int area = 0) { return kdbgstream(area, 0); }
#endif
diff --git a/microkde/kdecore/kcatalogue.cpp b/microkde/kdecore/kcatalogue.cpp
index 97ac326..1600b08 100644
--- a/microkde/kdecore/kcatalogue.cpp
+++ b/microkde/kdecore/kcatalogue.cpp
@@ -1,54 +1,56 @@
/* This file is part of the KDE libraries
Copyright (c) 2001 Hans Petter Bieker <bieker@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include "kcatalogue.h"
char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file,
const char *msgid);
void k_nl_unload_domain (struct loaded_domain *domain);
#ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp
struct kde_loaded_l10nfile
{
const char *filename;
int decided;
const void *data;
kde_loaded_l10nfile() : filename(0), decided(0), data(0) {}
};
#endif
class KCataloguePrivate
{
public:
QString name;
kde_loaded_l10nfile domain;
};
KCatalogue::KCatalogue(const QString & name)
: d( new KCataloguePrivate )
{
@@ -59,65 +61,65 @@ KCatalogue::KCatalogue(const KCatalogue & rhs)
: d( new KCataloguePrivate )
{
*this = rhs;
}
KCatalogue & KCatalogue::operator=(const KCatalogue & rhs)
{
d->name = rhs.d->name;
setFileName( rhs.fileName() );
return *this;
}
KCatalogue::~KCatalogue()
{
doUnload();
delete d;
}
QString KCatalogue::name() const
{
return d->name;
}
void KCatalogue::setFileName( const QString & fileName )
{
// nothing to do if the file name is already the same
if ( this->fileName() == fileName ) return;
doUnload();
- QCString newFileName = QFile::encodeName( fileName );
+ Q3CString newFileName = QFile::encodeName( fileName );
if ( !fileName.isEmpty() )
{
// set file name
char *filename = new char[ newFileName.length() + 1 ];
::qstrcpy( filename, newFileName );
d->domain.filename = filename;
}
}
QString KCatalogue::fileName() const
{
return QFile::decodeName( d->domain.filename );
}
const char * KCatalogue::translate(const char * msgid) const
{
qDebug("KCatalogue::translate has to be fixed %s",msgid );
//US return ::k_nl_find_msg( &d->domain, msgid );
return msgid;
}
void KCatalogue::doUnload()
{
// use gettext's unloader
if ( d->domain.data )
{
//US ::k_nl_unload_domain( (struct loaded_domain *)d->domain.data );
qDebug("KCatalogue::doUnload has to be fixed" );
}
diff --git a/microkde/kdecore/kconfigbase.h b/microkde/kdecore/kconfigbase.h
index 7e56d11..1ef6a04 100644
--- a/microkde/kdecore/kconfigbase.h
+++ b/microkde/kdecore/kconfigbase.h
@@ -1,102 +1,104 @@
/*
This file is part of the KDE libraries
Copyright (c) 1999 Preston Brown <pbrown@kde.org>
Copyright (c) 1997 Matthias Kalle Dalheimer <kalle@kde.org>
Copyright (c) 2001 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 as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#ifndef _KCONFIGBASE_H
#define _KCONFIGBASE_H
#include "kconfig.h"
+//Added by qt3to4:
+#include <Q3CString>
/**
* Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig
* groups.
*
* Careful programmers always set the group of a
* @ref KConfig @ref KSimpleConfig object to the group they want to read from
* and set it back to the old one of afterwards. This is usually
* written as:
* <pre>
*
* QString oldgroup config->group();
* config->setGroup( "TheGroupThatIWant" );
* ...
* config->writeEntry( "Blah", "Blubb" );
*
* config->setGroup( oldgroup );
* </pre>
*
* In order to facilitate this task, you can use
* KConfigGroupSaver. Simply construct such an object ON THE STACK
* when you want to switch to a new group. Then, when the object goes
* out of scope, the group will automatically be restored. If you
* want to use several different groups within a function or method,
* you can still use KConfigGroupSaver: Simply enclose all work with
* one group (including the creation of the KConfigGroupSaver object)
* in one block.
*
* @author Matthias Kalle Dalheimer <kalle@kde.org>
* @version $Id$
* @see KConfigBase, KConfig, KSimpleConfig
* @short Helper class for easier use of KConfig/KSimpleConfig groups
*/
//US I converted the class in a way that it can be used with KConfig objects of microkde
class KConfigGroupSaver
{
public:
/**
* Constructor. You pass a pointer to the KConfigBase-derived
* object you want to work with and a string indicating the _new_
* group.
*
* @param config The KConfigBase-derived object this
* KConfigGroupSaver works on.
* @param group The new group that the config object should switch to.
*/
KConfigGroupSaver( KConfig* config, QString group )
/* KDE 4 : make the second parameter const QString & */
: _config(config), _oldgroup(config->group())
{ _config->setGroup( group ); }
KConfigGroupSaver( KConfig* config, const char *group )
: _config(config), _oldgroup(config->group())
{ _config->setGroup( group ); }
- KConfigGroupSaver( KConfig* config, const QCString &group )
+ KConfigGroupSaver( KConfig* config, const Q3CString &group )
: _config(config), _oldgroup(config->group())
{ _config->setGroup( group ); }
~KConfigGroupSaver() { _config->setGroup( _oldgroup ); }
KConfig* config() { return _config; };
private:
KConfig* _config;
QString _oldgroup;
KConfigGroupSaver(const KConfigGroupSaver&);
KConfigGroupSaver& operator=(const KConfigGroupSaver&);
};
#endif
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index 6d0475a..0b54eb6 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -1,80 +1,83 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000 Michael Matz <matz@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#include <qclipboard.h>
#include <qfile.h>
#include <qtimer.h>
-#include <qobjectdict.h>
-#include <qwidgetlist.h>
+#include <q3objectdict.h>
#include <qwidget.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#include "kapplication.h"
#include "klibloader.h"
#include "kstandarddirs.h"
#include "kdebug.h"
#include "klocale.h"
/*US
#ifndef NDEBUG
#include "ltdl.h"
#endif
*/
//US do everything through qlibrary
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <qtopia/qlibrary.h>
#else
#include <qlibrary.h>
#endif
-template class QAsciiDict<KLibrary>;
+template class Q3AsciiDict<KLibrary>;
#include <stdlib.h> //getenv
/*US
#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifdef RTLD_GLOBAL
# define LT_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_GLOBAL DL_GLOBAL
# endif
#endif
#ifndef LT_GLOBAL
# define LT_GLOBAL 0
#endif
*/
/*US
extern "C" {
extern int lt_dlopen_flag;
}
*/
KLibFactory::KLibFactory( QObject* parent, const char* name )
: QObject( parent, name )
{
}
KLibFactory::~KLibFactory()
@@ -91,97 +94,97 @@ QObject* KLibFactory::create( QObject* parent, const char* name, const char* cla
}
QObject* KLibFactory::createObject( QObject*, const char*, const char*, const QStringList &)
{
return 0;
}
// -----------------------------------------------
//US KLibrary::KLibrary( const QString& libname, const QString& filename, void * handle )
KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* handle )
{
/* Make sure, we have a KLibLoader */
(void) KLibLoader::self();
m_libname = libname;
m_filename = filename;
m_handle = handle;
m_factory = 0;
m_timer = 0;
}
KLibrary::~KLibrary()
{
// kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl;
if ( m_timer && m_timer->isActive() )
m_timer->stop();
// If any object is remaining, delete
if ( m_objs.count() > 0 )
{
- QPtrListIterator<QObject> it( m_objs );
+ Q3PtrListIterator<QObject> it( m_objs );
for ( ; it.current() ; ++it )
{
kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl;
disconnect( it.current(), SIGNAL( destroyed() ),
this, SLOT( slotObjectDestroyed() ) );
}
m_objs.setAutoDelete(true);
m_objs.clear();
}
if ( m_factory ) {
// kdDebug(150) << " ... deleting the factory " << m_factory << endl;
delete m_factory;
}
}
QString KLibrary::name() const
{
return m_libname;
}
QString KLibrary::fileName() const
{
return m_filename;
}
KLibFactory* KLibrary::factory()
{
if ( m_factory )
return m_factory;
- QCString symname;
+ Q3CString symname;
symname.sprintf("init_%s", name().latin1() );
void* sym = symbol( symname );
if ( !sym )
{
qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data());
#ifndef NDEBUG
//US qDebug("KLibrary: errorcode: %s", lt_dlerror());
#endif
kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl;
return 0;
}
typedef KLibFactory* (*t_func)();
t_func func = (t_func)sym;
m_factory = func();
if( !m_factory )
{
kdWarning(150) << "KLibrary: The library " << name() << " does not offer a KDE compatible factory" << endl;
return 0;
}
connect( m_factory, SIGNAL( objectCreated( QObject * ) ),
this, SLOT( slotObjectCreated( QObject * ) ) );
return m_factory;
}
void* KLibrary::symbol( const char* symname ) const
{
//US void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname );
@@ -276,229 +279,229 @@ public:
int ref_count;
//US lt_dlhandle handle;
QLibrary *handle;
QString name;
QString filename;
};
//US KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, lt_dlhandle h)
KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h)
: lib(l), ref_count(1), handle(h), name(l->name()), filename(l->fileName())
{
unload_mode = UNKNOWN;
/*US
if (lt_dlsym(handle, "__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
} else if (lt_dlsym(handle, "__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
*/
//US use instead:
if (h->resolve("__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
} else if (h->resolve("__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
}
class KLibLoaderPrivate
{
public:
- QPtrList<KLibWrapPrivate> loaded_stack;
- QPtrList<KLibWrapPrivate> pending_close;
+ Q3PtrList<KLibWrapPrivate> loaded_stack;
+ Q3PtrList<KLibWrapPrivate> pending_close;
enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode;
QString errorMessage;
};
KLibLoader* KLibLoader::s_self = 0;
KLibLoader* KLibLoader::self()
{
if ( !s_self )
s_self = new KLibLoader;
return s_self;
}
void KLibLoader::cleanUp()
{
if ( !s_self )
return;
delete s_self;
s_self = 0;
}
KLibLoader::KLibLoader( QObject* parent, const char* name )
: QObject( parent, name )
{
s_self = this;
d = new KLibLoaderPrivate;
//US lt_dlinit();
d->unload_mode = KLibLoaderPrivate::UNKNOWN;
if (getenv("KDE_NOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD;
else if (getenv("KDE_DOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::UNLOAD;
d->loaded_stack.setAutoDelete( true );
}
KLibLoader::~KLibLoader()
{
// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl;
- QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
+ Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
{
kdDebug(150) << "The KLibLoader contains the library " << it.current()->name
<< " (" << it.current()->lib << ")" << endl;
d->pending_close.append(it.current());
}
close_pending(0);
delete d;
}
//static
QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ )
{
- QCString libname( name );
+ Q3CString libname( name );
// only append ".la" if there is no extension
// this allows to load non-libtool libraries as well
// (mhk, 20000228)
int pos = libname.findRev('/');
if (pos < 0)
pos = 0;
/*US
if (libname.find('.', pos) < 0) {
libname += ".la";
}
*/
//US in the microedition we work only with shared libraries.
if (libname.find('.', pos) < 0) {
#ifdef _WIN32_
libname += ".dll";
#else
libname += ".so";
#endif
}
// only look up the file if it is not an absolute filename
// (mhk, 20000228)
QString libfile;
if (libname[0] == '/')
libfile = libname;
else
{
//US at this point the libname must exist as real filesname. No expansions will be made later
// in findResources. Because of that we prepend the lib prefix here to the name
//US I add also the "lib" prefix. I do not how could this could have worked before without it?
#ifndef _WIN32_
libname.insert(pos, "lib");
#endif
//US libfile = instance->dirs()->findResource( "module", libname );
//qDebug("libname = %s ",libname.data() );
libfile = KGlobal::dirs()->findResource( "module", libname );
//qDebug("libfile = %s ",libfile.latin1() );
if ( libfile.isEmpty() )
{
//US libfile = instance->dirs()->findResource( "lib", libname );
libfile = KGlobal::dirs()->findResource( "lib", libname );
//qDebug("libfile2 = %s ",libfile.latin1() );
#ifndef NDEBUG
if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
#endif
}
if ( libfile.isEmpty() )
{
#ifndef NDEBUG
kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl;
- self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname);
+ self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(QString(libname));
qDebug("KLibLoader::library could not find library: %s", libname.data());
#endif
}
else
self()->d->errorMessage = QString::null;
}
//qDebug("return libfile = %s ",libfile.latin1() );
return libfile;
}
KLibrary* KLibLoader::globalLibrary( const char *name )
{
KLibrary *tmp;
/*US
int olt_dlopen_flag = lt_dlopen_flag;
lt_dlopen_flag |= LT_GLOBAL;
kdDebug(150) << "Loading the next library global with flag "
<< lt_dlopen_flag
<< "." << endl;
*/
tmp = library(name);
/*US
lt_dlopen_flag = olt_dlopen_flag;
*/
return tmp;
}
KLibrary* KLibLoader::library( const char *name )
{
if (!name)
return 0;
KLibWrapPrivate* wrap = m_libs[name];
if (wrap) {
/* Nothing to do to load the library. */
wrap->ref_count++;
return wrap->lib;
}
/* Test if this library was loaded at some time, but got
unloaded meanwhile, whithout being dlclose()'ed. */
- QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
+ Q3PtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
for (; it.current(); ++it) {
if (it.current()->name == name)
wrap = it.current();
}
if (wrap) {
d->pending_close.removeRef(wrap);
if (!wrap->lib) {
/* This lib only was in loaded_stack, but not in m_libs. */
wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
}
wrap->ref_count++;
} else {
QString libfile = findLibrary( name );
if ( libfile.isEmpty() )
return 0;
#ifdef DESKTOP_VERSION
QLibrary *qlib = new QLibrary( libfile.latin1() );
#else
QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately );
#endif
//US lt_dlhandle handle = lt_dlopen( libfile.latin1() );
//US if ( !handle )
if ( !qlib )
{
qDebug( "KLibLoader::library could not load library: %s", libfile.latin1());
d->errorMessage = QString::null;
return 0;
}
else
d->errorMessage = QString::null;
@@ -521,84 +524,84 @@ QString KLibLoader::lastErrorMessage() const
}
void KLibLoader::unloadLibrary( const char *libname )
{
KLibWrapPrivate *wrap = m_libs[ libname ];
if (!wrap)
return;
if (--wrap->ref_count)
return;
// kdDebug(150) << "closing library " << libname << endl;
m_libs.remove( libname );
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
close_pending( wrap );
}
KLibFactory* KLibLoader::factory( const char* name )
{
KLibrary* lib = library( name );
if ( !lib )
return 0;
return lib->factory();
}
void KLibLoader::slotLibraryDestroyed()
{
const KLibrary *lib = static_cast<const KLibrary *>( sender() );
- QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
+ Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
if ( it.current()->lib == lib )
{
KLibWrapPrivate *wrap = it.current();
wrap->lib = 0; /* the KLibrary object is already away */
m_libs.remove( it.currentKey() );
close_pending( wrap );
return;
}
}
void KLibLoader::close_pending(KLibWrapPrivate *wrap)
{
if (wrap && !d->pending_close.containsRef( wrap ))
d->pending_close.append( wrap );
/* First delete all KLibrary objects in pending_close, but _don't_ unload
the DSO behind it. */
- QPtrListIterator<KLibWrapPrivate> it(d->pending_close);
+ Q3PtrListIterator<KLibWrapPrivate> it(d->pending_close);
for (; it.current(); ++it) {
wrap = it.current();
if (wrap->lib) {
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
delete wrap->lib;
wrap->lib = 0;
}
}
if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return;
bool deleted_one = false;
while ((wrap = d->loaded_stack.first())) {
/* Let's first see, if we want to try to unload this lib.
If the env. var KDE_DOUNLOAD is set, we try to unload every lib.
If not, we look at the lib itself, and unload it only, if it exports
the symbol __kde_do_unload. */
if (d->unload_mode != KLibLoaderPrivate::UNLOAD
&& wrap->unload_mode != KLibWrapPrivate::UNLOAD)
break;
/* Now ensure, that the libs are only unloaded in the reverse direction
they were loaded. */
if (!d->pending_close.containsRef( wrap )) {
if (!deleted_one)
/* Only diagnose, if we really haven't deleted anything. */
// kdDebug(150) << "try to dlclose " << wrap->name << ": not yet" << endl;
break;
}
// kdDebug(150) << "try to dlclose " << wrap->name << ": yes, done." << endl;
diff --git a/microkde/kdecore/klibloader.h b/microkde/kdecore/klibloader.h
index ed57109..53d146e 100644
--- a/microkde/kdecore/klibloader.h
+++ b/microkde/kdecore/klibloader.h
@@ -1,87 +1,87 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLIBLOADER_H
#define KLIBLOADER_H
#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
-#include <qasciidict.h>
-#include <qptrlist.h>
+#include <q3asciidict.h>
+#include <q3ptrlist.h>
#include <kglobal.h>
#include <stdlib.h> // For backwards compatibility
class KInstance;
class QTimer;
class KLibrary;
class KLibFactory;
class KLibFactoryPrivate;
class KLibLoaderPrivate;
class KLibraryPrivate;
class QLibrary;
#define K_EXPORT_COMPONENT_FACTORY( libname, factory ) \
extern "C" { void *init_##libname() { return new factory; } }
/**
* @short Represents a dynamically loaded library.
*
* KLibrary allows you to look up symbols of the shared library.
* Use @ref KLibLoader to create a new instance of KLibrary.
*
* @see KLibLoader
* @author Torben Weis <weis@kde.org>
*/
class KLibrary : public QObject
{
friend class KLibLoader;
- friend class QAsciiDict<KLibrary>;
+ friend class Q3AsciiDict<KLibrary>;
Q_OBJECT
public:
/**
* @internal
* Don't create KLibrary objects on your own. Instead use @ref KLibLoader.
*/
//US KLibrary( const QString& libname, const QString& filename, void * handle );
KLibrary( const QString& libname, const QString& filename, QLibrary* handle );
/**
* Returns the name of the library.
* @return The name of the library like "libkspread".
*/
QString name() const;
/**
* Returns the file name of the library.
* @return The filename of the library, for example "/opt/kde2&/lib/libkspread.la"
*/
QString fileName() const;
/**
* Returns the factory of the library.
* @return The factory of the library if there is any, otherwise 0
*/
KLibFactory* factory();
/**
* Looks up a symbol from the library. This is a very low level
* function that you usually don't want to use. Usually you should
* check using @ref hasSymbol() whether the symbol actually exists,
@@ -98,65 +98,65 @@ public:
* Unlike @ref symbol(), this method doesn't warn if the symbol doesn't exist,
* so if the symbol might or might not exist, better use hasSymbol() before symbol().
* @param name the name of the symbol to check
* @return true if the symbol exists
* @since 3.1
*/
bool hasSymbol( const char* name ) const;
/**
* Unloads the library.
* This typically results in the deletion of this object. You should
* not reference its pointer after calling this function.
*/
void unload() const;
private slots:
void slotObjectCreated( QObject *obj );
void slotObjectDestroyed();
void slotTimeout();
private:
/**
* @internal
* Don't destruct KLibrary objects yourself. Instead use @ref unload() instead.
*/
~KLibrary();
QString m_libname;
QString m_filename;
KLibFactory* m_factory;
//US void * m_handle;
QLibrary* m_handle;
- QPtrList<QObject> m_objs;
+ Q3PtrList<QObject> m_objs;
QTimer *m_timer;
KLibraryPrivate *d;
};
class KLibWrapPrivate;
/**
* The KLibLoader allows you to load libraries dynamically at runtime.
* Dependent libraries are loaded automatically.
*
* KLibLoader follows the singleton pattern. You can not create multiple
* instances. Use @ref self() to get a pointer to the loader.
*
* @see KLibrary
* @author Torben Weis <weis@kde.org>
*/
class KLibLoader : public QObject
{
friend class KLibrary;
Q_OBJECT
public:
/**
* You should NEVER destruct an instance of KLibLoader
* until you know what you are doing. This will release
* the loaded libraries.
*/
~KLibLoader();
/**
* Loads and initializes a library. Loading a library multiple times is
* handled gracefully.
@@ -258,65 +258,65 @@ public:
*/
static KLibLoader* self();
/**
* @internal
* Internal Method, called by the KApplication destructor.
* Do not call it.
* This is what makes it possible to rely on ~KLibFactory
* being called in all cases, whether the library is unloaded
* while the application is running or when exiting.
*/
static void cleanUp();
/**
* Helper method which looks for a library in the standard paths
* ("module" and "lib" resources).
* Made public for code that doesn't use KLibLoader itself, but still
* wants to open modules.
* @param name of the library. If it is not a path, the function searches in
* the "module" and "lib" resources. If there is no extension,
* ".la" will be appended.
* @param instance a KInstance used to get the standard paths
*/
static QString findLibrary( const char * name/*US , const KInstance * instance = KGlobal::instance()*/ );
protected:
KLibLoader( QObject* parent = 0, const char* name = 0 );
private slots:
void slotLibraryDestroyed();
private:
void close_pending( KLibWrapPrivate * );
- QAsciiDict<KLibWrapPrivate> m_libs;
+ Q3AsciiDict<KLibWrapPrivate> m_libs;
static KLibLoader* s_self;
protected:
virtual void virtual_hook( int id, void* data );
private:
KLibLoaderPrivate *d;
};
/**
* If you develop a library that is to be loaded dynamically at runtime, then
* you should return a pointer to your factory. The K_EXPORT_COMPONENT_FACTORY
* macro is provided for this purpose:
* <pre>
* K_EXPORT_COMPONENT_FACTORY( libkspread, KSpreadFactory )
* </pre>
*
* The first macro argument is the name of your library, the second specifies the name
* of your factory.
*
* In the constructor of your factory you should create an instance of @ref KInstance
* like this:
* <pre>
* s_global = new KInstance( "kspread" );
* </pre>
* This @ref KInstance is comparable to @ref KGlobal used by normal applications.
* It allows you to find resource files (images, XML, sound etc.) belonging
* to the library.
*
* If you want to load a library, use @ref KLibLoader. You can query @ref KLibLoader
* directly for a pointer to the libraries factory by using the @ref KLibLoader::factory()
* function.
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 1d8ae9f..dd310fa 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -1,108 +1,109 @@
#include <qregexp.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include "kdebug.h"
#include "kcalendarsystemgregorian.h"
#include "klocale.h"
#include <qstringlist.h>
//#define COLLECT_TRANSLATION
-QDict<QString> *mLocaleDict = 0;
-void setLocaleDict( QDict<QString> * dict )
+Q3Dict<QString> *mLocaleDict = 0;
+void setLocaleDict( Q3Dict<QString> * dict )
{
mLocaleDict = dict;
}
#ifdef COLLECT_TRANSLATION
QStringList missingTrans;
QStringList existingTrans1;
QStringList existingTrans2;
void addMissing(const char *text)
{
QString mis ( text );
if ( !missingTrans.contains( mis ) )
missingTrans.append(mis);
}
void addExist(const char *text,QString trans )
{
//return;
QString mis ( text );
if ( !existingTrans1.contains( mis ) ) {
existingTrans1.append(mis);
existingTrans2.append(trans);
}
}
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#endif
void dumpMissing()
{
#ifdef COLLECT_TRANSLATION
QString fileName = "/tmp/usernewtrans.txt";
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return ;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
int i;
for ( i = 0; i< missingTrans.count(); ++i ) {
QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" );
ts << "{ \""<<text<< "\",\""<< text <<"\" },\n";
}
file.close();
{
QString fileName = "/tmp/usertrans.txt";
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return ;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
int i;
for ( i = 0; i< existingTrans1.count(); ++i ) {
QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" );
QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" );
ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n";
}
file.close();
}
#endif
}
QString i18n(const char *text)
{
if ( ! mLocaleDict ) {
#ifdef COLLECT_TRANSLATION
addMissing( text );
#endif
return QString( text );
}
else {
QString* ret = mLocaleDict->find(QString(text)) ;
if ( ret == 0 ) {
#ifdef COLLECT_TRANSLATION
addMissing( text );
#endif
return QString( text );
}
else {
if ( (*ret).isEmpty() ) {
@@ -438,125 +439,125 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat
case 'd':
put_it_in( buffer, index, pDate.day() );
break;
case 'a':
put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) );
break;
case 'A':
put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) );
break;
default:
buffer[index++] = rst.at( format_index );
break;
}
escape = false;
}
}
QString ret( buffer, index );
delete [] buffer;
return ret;
}
QString KLocale::formatDateTime(const QDateTime &pDateTime,
bool shortFormat,
bool includeSeconds,
IntDateFormat intIntDateFormat) const
{
QString format("%1 %2");
if ( intIntDateFormat == Default )
format = "%1 %2";
else if ( intIntDateFormat == Format1 )
format = "%1 %2";
- else if ( intIntDateFormat == ISODate )
+ else if ( intIntDateFormat == Qt::ISODate )
format = "%1T%2";
QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat ))
.arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat ));
//qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() );
return res;
}
QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const
{
return formatDateTime(pDateTime, true, true, intIntDateFormat);
}
QDate KLocale::readDate(const QString &intstr, bool* ok) const
{
QDate date;
date = readDate(intstr, true, ok);
if (date.isValid()) return date;
return readDate(intstr, false, ok);
}
QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const
{
QString fmt = (shortFormat ? dateFormatShort() : dateFormat()).simplifyWhiteSpace();
return readDate( intstr, fmt, ok );
}
QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) const
{
//kdDebug(173) << "KLocale::readDate intstr=" << intstr << " fmt=" << fmt << endl;
QString str = intstr.simplifyWhiteSpace().lower();
int day = -1, month = -1;
// allow the year to be omitted if not in the format
int year = QDate::currentDate().year();
uint strpos = 0;
uint fmtpos = 0;
while (fmt.length() > fmtpos || str.length() > strpos)
{
if ( !(fmt.length() > fmtpos && str.length() > strpos) )
goto error;
QChar c = fmt.at(fmtpos++);
if (c != '%') {
if (c.isSpace())
strpos++;
else if (c != str.at(strpos++))
goto error;
continue;
}
// remove space at the begining
if (str.length() > strpos && str.at(strpos).isSpace())
strpos++;
c = fmt.at(fmtpos++);
- switch (c)
+ switch (c.unicode())
{
case 'a':
case 'A':
// this will just be ignored
{ // Cristian Tache: porting to Win: Block added because of "j" redefinition
for (int j = 1; j < 8; j++) {
QString s = weekDayName(j, c == 'a').lower();
int len = s.length();
if (str.mid(strpos, len) == s)
strpos += len;
}
break;
}
case 'b':
case 'B':
{ // Cristian Tache: porting to Win: Block added because of "j" redefinition
for (int j = 1; j < 13; j++) {
QString s = monthName(j, c == 'b').lower();
int len = s.length();
if (str.mid(strpos, len) == s) {
month = j;
strpos += len;
}
}
break;
}
case 'd':
case 'e':
day = readInt(str, strpos);
if (day < 1 || day > 31)
goto error;
@@ -609,65 +610,65 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
QString str = intstr.simplifyWhiteSpace().lower();
QString Format = timeFormat().simplifyWhiteSpace();
if (!seconds)
Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null);
int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds
bool g_12h = false;
bool pm = false;
uint strpos = 0;
uint Formatpos = 0;
while (Format.length() > Formatpos || str.length() > strpos)
{
if ( !(Format.length() > Formatpos && str.length() > strpos) ) goto error;
QChar c = Format.at(Formatpos++);
if (c != '%')
{
if (c.isSpace())
strpos++;
else if (c != str.at(strpos++))
goto error;
continue;
}
// remove space at the begining
if (str.length() > strpos && str.at(strpos).isSpace())
strpos++;
c = Format.at(Formatpos++);
- switch (c)
+ switch (c.unicode())
{
case 'p':
{
QString s;
s = i18n("pm").lower();
int len = s.length();
if (str.mid(strpos, len) == s)
{
pm = true;
strpos += len;
}
else
{
s = i18n("am").lower();
len = s.length();
if (str.mid(strpos, len) == s) {
pm = false;
strpos += len;
}
else
goto error;
}
}
break;
case 'k':
case 'H':
g_12h = false;
hour = readInt(str, strpos);
if (hour < 0 || hour > 23)
goto error;
@@ -705,65 +706,65 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
if (ok) *ok = true;
return QTime(hour, minute, second);
error:
if (ok) *ok = false;
return QTime(-1, -1, -1); // return invalid date if it didn't work
// This will be removed in the near future, since it gives a warning on stderr.
// The presence of the bool* (since KDE-3.0) removes the need for an invalid QTime.
}
QDateTime KLocale::readDateTime(const QString &intstr,
IntDateFormat intIntDateFormat,
bool* ok) const
{
bool ok1, ok2;
// AT the moment we can not read any other format then ISODate
if ( intIntDateFormat != ISODate )
{
qDebug("KLocale::readDateTime, only ISODate is supported.");
return QDateTime();
}
int pos = intstr.find("T");
QString date = intstr.left(pos);
QString time = intstr.mid(pos+1);
QString dformat = dateFormat(intIntDateFormat);
QString tformat = timeFormat(intIntDateFormat);
QDate m_date = readDate(date, dformat, &ok1);
- QTime m_time = readTime(time, tformat, &ok2);
+ QTime m_time = readTime(time, !tformat.isEmpty(), &ok2);
QDateTime m_dt;
if (ok)
{
if ((ok1 == false) || (ok2 == false))
*ok = false;
else
*ok = true;
}
//only set values if both operations returned true.
if ((ok1 == true) && (ok2 == true))
{
m_dt.setDate(m_date);
m_dt.setTime(m_time);
}
//qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2);
return m_dt;
}
QDate KLocale::readDate(const QString &intstr,
IntDateFormat intIntDateFormat,
bool* ok) const
{
bool ok1;
QString dformat = dateFormat(intIntDateFormat);
QDate m_date = readDate(intstr, dformat, &ok1);
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 58e0b39..840fc9d 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -1,46 +1,46 @@
#ifndef MINIKDE_KLOCALE_H
#define MINIKDE_KLOCALE_H
#include <qstring.h>
#include <qstringlist.h>
#include <qdatetime.h>
-#include <qdict.h>
+#include <q3dict.h>
#ifndef I18N_NOOP
#define I18N_NOOP(x) (x)
#endif
class KCalendarSystem;
-void setLocaleDict( QDict<QString> * dict );
+void setLocaleDict( Q3Dict<QString> * dict );
QString i18n(const char *text);
QString i18n(const char *hint, const char *text);
QString i18n(const char *text1, const char *textn, int num);
// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict
// with our i18n method. we use uic -tr tr2i18n to redirect
// to the right i18n() function
inline QString tr2i18n(const char* message, const char* =0) {
return i18n( message);
}
class KLocale
{
public:
KLocale();
QString formatNumber(double num, int precision = -1) const;
QString formatNumber(const QString &numStr) const;
double readNumber(const QString &numStr, bool * ok = 0) const;
QString decimalSymbol() const;
QString thousandsSeparator() const;
QString positiveSign() const;
QString negativeSign() const;
QString translate( const char *index ) const;
QString translate( const char *index, const char *fallback) const;
enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 };
QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const;
diff --git a/microkde/kdecore/kmdcodec.cpp b/microkde/kdecore/kmdcodec.cpp
index bc03569..db11e52 100644
--- a/microkde/kdecore/kmdcodec.cpp
+++ b/microkde/kdecore/kmdcodec.cpp
@@ -10,64 +10,66 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
RFC 1321 "MD5 Message-Digest Algorithm" Copyright (C) 1991-1992.
RSA Data Security, Inc. Created 1991. All rights reserved.
The KMD5 class is based on a C++ implementation of
"RSA Data Security, Inc. MD5 Message-Digest Algorithm" by
Mordechai T. Abzug, Copyright (c) 1995. This implementation
passes the test-suite as defined in RFC 1321.
The encoding and decoding utilities in KCodecs with the exception of
quoted-printable are based on the java implementation in HTTPClient
package by Ronald Tschal� Copyright (C) 1996-1999.
The quoted-printable codec as described in RFC 2045, section 6.7. is by
Rik Hemsley (C) 2001.
*/
//US #include <config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <kdebug.h>
#include "kmdcodec.h"
+//Added by qt3to4:
+#include <Q3CString>
#define KMD5_S11 7
#define KMD5_S12 12
#define KMD5_S13 17
#define KMD5_S14 22
#define KMD5_S21 5
#define KMD5_S22 9
#define KMD5_S23 14
#define KMD5_S24 20
#define KMD5_S31 4
#define KMD5_S32 11
#define KMD5_S33 16
#define KMD5_S34 23
#define KMD5_S41 6
#define KMD5_S42 10
#define KMD5_S43 15
#define KMD5_S44 21
const char KCodecs::Base64EncMap[64] =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E,
0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33,
0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
};
const char KCodecs::Base64DecMap[128] =
{
@@ -118,72 +120,72 @@ const char KCodecs::UUDecMap[128] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const char KCodecs::hexChars[16] =
{
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
const unsigned int KCodecs::maxQPLineLength = 70;
/******************************** KCodecs ********************************/
// strchr(3) for broken systems.
static int rikFindChar(register const char * _s, const char c)
{
register const char * s = _s;
while (true)
{
if ((0 == *s) || (c == *s)) break; ++s;
if ((0 == *s) || (c == *s)) break; ++s;
if ((0 == *s) || (c == *s)) break; ++s;
if ((0 == *s) || (c == *s)) break; ++s;
}
return s - _s;
}
-QCString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF)
+Q3CString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF)
{
QByteArray out;
quotedPrintableEncode (in, out, useCRLF);
- return QCString (out.data(), out.size()+1);
+ return Q3CString (out.data(), out.size()+1);
}
-QCString KCodecs::quotedPrintableEncode(const QCString& str, bool useCRLF)
+Q3CString KCodecs::quotedPrintableEncode(const Q3CString& str, bool useCRLF)
{
if (str.isEmpty())
return "";
QByteArray in (str.length());
memcpy (in.data(), str.data(), str.length());
return quotedPrintableEncode(in, useCRLF);
}
void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool useCRLF)
{
out.resize (0);
if (in.isEmpty())
return;
char *cursor;
const char *data;
unsigned int lineLength;
unsigned int pos;
const unsigned int length = in.size();
const unsigned int end = length - 1;
// Reasonable guess for output size when we're encoding
// mostly-ASCII data. It doesn't really matter, because
// the underlying allocation routines are quite efficient,
// but it's nice to have 0 allocations in many cases.
out.resize ((length*12)/10);
cursor = out.data();
data = in.data();
lineLength = 0;
@@ -251,72 +253,72 @@ void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool
// Anything else is converted to =XX.
else
{
*cursor++ = '=';
*cursor++ = hexChars[c / 16];
*cursor++ = hexChars[c % 16];
lineLength += 3;
}
// If we're approaching the maximum line length, do a soft line break.
if ((lineLength > maxQPLineLength) && (i < end))
{
if (useCRLF) {
*cursor++ = '=';
*cursor++ = '\r';
*cursor++ = '\n';
} else {
*cursor++ = '=';
*cursor++ = '\n';
}
lineLength = 0;
}
}
out.truncate(cursor - out.data());
}
-QCString KCodecs::quotedPrintableDecode(const QByteArray & in)
+Q3CString KCodecs::quotedPrintableDecode(const QByteArray & in)
{
QByteArray out;
quotedPrintableDecode (in, out);
- return QCString (out.data(), out.size()+1);
+ return Q3CString (out.data(), out.size()+1);
}
-QCString KCodecs::quotedPrintableDecode(const QCString & str)
+Q3CString KCodecs::quotedPrintableDecode(const Q3CString & str)
{
if (str.isEmpty())
return "";
QByteArray in (str.length());
memcpy (in.data(), str.data(), str.length());
return quotedPrintableDecode (in);
}
void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
{
// clear out the output buffer
out.resize (0);
if (in.isEmpty())
return;
char *cursor;
const char *data;
const unsigned int length = in.size();
data = in.data();
out.resize (length);
cursor = out.data();
for (unsigned int i = 0; i < length; i++)
{
char c(in.at(i));
if ('=' == c)
{
if (i < length - 2)
{
@@ -326,482 +328,479 @@ void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
if (('\n' == c1) || ('\r' == c1 && '\n' == c2))
{
// Soft line break. No output.
if ('\r' == c1)
i += 2; // CRLF line breaks
else
i += 1;
}
else
{
// =XX encoded byte.
int hexChar0 = rikFindChar(hexChars, c1);
int hexChar1 = rikFindChar(hexChars, c2);
if (hexChar0 < 16 && hexChar1 < 16)
{
*cursor++ = char((hexChar0 * 16) | hexChar1);
i += 2;
}
}
}
}
else
{
*cursor++ = c;
}
}
out.truncate(cursor - out.data());
}
-QCString KCodecs::base64Encode( const QCString& str, bool insertLFs )
+Q3CString KCodecs::base64Encode( const Q3CString& str, bool insertLFs )
{
if ( str.isEmpty() )
return "";
QByteArray in (str.length());
memcpy( in.data(), str.data(), str.length() );
return base64Encode( in, insertLFs );
}
-QCString KCodecs::base64Encode( const QByteArray& in, bool insertLFs )
+Q3CString KCodecs::base64Encode( const QByteArray& in, bool insertLFs )
{
QByteArray out;
base64Encode( in, out, insertLFs );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::base64Encode( const QByteArray& in, QByteArray& out,
bool insertLFs )
{
// clear out the output buffer
out.resize (0);
if ( in.isEmpty() )
return;
unsigned int sidx = 0;
unsigned int didx = 0;
const char* data = in.data();
const unsigned int len = in.size();
unsigned int out_len = ((len+2)/3)*4;
// Deal with the 76 characters or less per
// line limit specified in RFC 2045 on a
// pre request basis.
insertLFs = (insertLFs && out_len > 76);
if ( insertLFs )
out_len += ((out_len-1)/76);
int count = 0;
out.resize( out_len );
// 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
if ( len > 1 )
{
while (sidx < len-2)
{
if ( insertLFs )
{
if ( count && (count%76) == 0 )
- out.at(didx++) = '\n';
+ out[didx++] = '\n';
count += 4;
}
- out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = Base64EncMap[(data[sidx+2] >> 6) & 003 |
+ out[didx++] = Base64EncMap[(data[sidx+2] >> 6) & 003 |
(data[sidx+1] << 2) & 077];
- out.at(didx++) = Base64EncMap[data[sidx+2] & 077];
+ out[didx++] = Base64EncMap[data[sidx+2] & 077];
sidx += 3;
}
}
if (sidx < len)
{
if ( insertLFs && (count > 0) && (count%76) == 0 )
- out.at(didx++) = '\n';
+ out[didx++] = '\n';
- out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077];
if (sidx < len-1)
{
- out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = Base64EncMap[(data[sidx+1] << 2) & 077];
+ out[didx++] = Base64EncMap[(data[sidx+1] << 2) & 077];
}
else
{
- out.at(didx++) = Base64EncMap[(data[sidx] << 4) & 077];
+ out[didx++] = Base64EncMap[(data[sidx] << 4) & 077];
}
}
// Add padding
while (didx < out.size())
- {
- out.at(didx) = '=';
- didx++;
- }
+ out[didx++] = '=';
}
-QCString KCodecs::base64Decode( const QCString& str )
+Q3CString KCodecs::base64Decode( const Q3CString& str )
{
if ( str.isEmpty() )
return "";
QByteArray in( str.length() );
memcpy( in.data(), str.data(), str.length() );
return base64Decode( in );
}
-QCString KCodecs::base64Decode( const QByteArray& in )
+Q3CString KCodecs::base64Decode( const QByteArray& in )
{
QByteArray out;
base64Decode( in, out );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::base64Decode( const QByteArray& in, QByteArray& out )
{
out.resize(0);
if ( in.isEmpty() )
return;
unsigned int count = 0;
unsigned int len = in.size(), tail = len;
const char* data = in.data();
// Deal with possible *nix "BEGIN" marker!!
while ( count < len && (data[count] == '\n' || data[count] == '\r' ||
data[count] == '\t' || data[count] == ' ') )
count++;
if ( QString(data+count).left(5).lower() == "begin" )
{
count += 5;
while ( count < len && data[count] != '\n' && data[count] != '\r' )
count++;
while ( count < len && (data[count] == '\n' || data[count] == '\r') )
count ++;
data += count;
tail = (len -= count);
}
// Find the tail end of the actual encoded data even if
// there is/are trailing CR and/or LF.
while ( data[tail-1] == '=' || data[tail-1] == '\n' ||
data[tail-1] == '\r' )
if ( data[--tail] != '=' ) len = tail;
unsigned int outIdx = 0;
out.resize( (count=len) );
for (unsigned int idx = 0; idx < count; idx++)
{
// Adhere to RFC 2045 and ignore characters
// that are not part of the encoding table.
unsigned char ch = data[idx];
if ((ch > 47 && ch < 58) || (ch > 64 && ch < 91) ||
(ch > 96 && ch < 123) || ch == '+' || ch == '/' || ch == '=')
{
- out.at(outIdx++) = Base64DecMap[ch];
+ out[outIdx++] = Base64DecMap[ch];
}
else
{
len--;
tail--;
}
}
// kdDebug() << "Tail size = " << tail << ", Length size = " << len << endl;
// 4-byte to 3-byte conversion
len = (tail>(len/4)) ? tail-(len/4) : 0;
unsigned int sidx = 0, didx = 0;
if ( len > 1 )
{
while (didx < len-2)
{
- out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003));
- out.at(didx+1) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017));
- out.at(didx+2) = (((out.at(sidx+2) << 6) & 255) | (out.at(sidx+3) & 077));
+ out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
+ out[didx+1] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
+ out[didx+2] = (((out[sidx+2] << 6) & 255) | (out[sidx+3] & 077));
sidx += 4;
didx += 3;
}
}
if (didx < len)
- out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003));
+ out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
if (++didx < len )
- out.at(didx) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017));
+ out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
// Resize the output buffer
if ( len == 0 || len < out.size() )
out.resize(len);
}
-QCString KCodecs::uuencode( const QCString& str )
+Q3CString KCodecs::uuencode( const Q3CString& str )
{
if ( str.isEmpty() )
return "";
QByteArray in;
in.resize( str.length() );
memcpy( in.data(), str.data(), str.length() );
return uuencode( in );
}
-QCString KCodecs::uuencode( const QByteArray& in )
+Q3CString KCodecs::uuencode( const QByteArray& in )
{
QByteArray out;
uuencode( in, out );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::uuencode( const QByteArray& in, QByteArray& out )
{
out.resize( 0 );
if( in.isEmpty() )
return;
unsigned int sidx = 0;
unsigned int didx = 0;
unsigned int line_len = 45;
const char nl[] = "\n";
const char* data = in.data();
const unsigned int nl_len = strlen(nl);
const unsigned int len = in.size();
out.resize( (len+2)/3*4 + ((len+line_len-1)/line_len)*(nl_len+1) );
// split into lines, adding line-length and line terminator
while (sidx+line_len < len)
{
// line length
- out.at(didx++) = UUEncMap[line_len];
+ out[didx++] = UUEncMap[line_len];
// 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
for (unsigned int end = sidx+line_len; sidx < end; sidx += 3)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 |
+ out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 |
(data[sidx+1] << 2) & 077];
- out.at(didx++) = UUEncMap[data[sidx+2] & 077];
+ out[didx++] = UUEncMap[data[sidx+2] & 077];
}
// line terminator
//for (unsigned int idx=0; idx < nl_len; idx++)
- //out.at(didx++) = nl[idx];
+ //out[didx++] = nl[idx];
memcpy(out.data()+didx, nl, nl_len);
didx += nl_len;
}
// line length
- out.at(didx++) = UUEncMap[len-sidx];
+ out[didx++] = UUEncMap[len-sidx];
// 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
while (sidx+2 < len)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 |
+ out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 |
(data[sidx+1] << 2) & 077];
- out.at(didx++) = UUEncMap[data[sidx+2] & 077];
+ out[didx++] = UUEncMap[data[sidx+2] & 077];
sidx += 3;
}
if (sidx < len-1)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] << 2) & 077];
- out.at(didx++) = UUEncMap[0];
+ out[didx++] = UUEncMap[(data[sidx+1] << 2) & 077];
+ out[didx++] = UUEncMap[0];
}
else if (sidx < len)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[0];
- out.at(didx++) = UUEncMap[0];
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx] << 4) & 077];
+ out[didx++] = UUEncMap[0];
+ out[didx++] = UUEncMap[0];
}
// line terminator
memcpy(out.data()+didx, nl, nl_len);
didx += nl_len;
// sanity check
if ( didx != out.size() )
out.resize( 0 );
}
-QCString KCodecs::uudecode( const QCString& str )
+Q3CString KCodecs::uudecode( const Q3CString& str )
{
if ( str.isEmpty() )
return "";
QByteArray in;
in.resize( str.length() );
memcpy( in.data(), str.data(), str.length() );
return uudecode( in );
}
-QCString KCodecs::uudecode( const QByteArray& in )
+Q3CString KCodecs::uudecode( const QByteArray& in )
{
QByteArray out;
uudecode( in, out );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::uudecode( const QByteArray& in, QByteArray& out )
{
out.resize( 0 );
if( in.isEmpty() )
return;
unsigned int sidx = 0;
unsigned int didx = 0;
unsigned int len = in.size();
unsigned int line_len, end;
const char* data = in.data();
// Deal with *nix "BEGIN"/"END" separators!!
unsigned int count = 0;
while ( count < len && (data[count] == '\n' || data[count] == '\r' ||
data[count] == '\t' || data[count] == ' ') )
count ++;
bool hasLF = false;
if ( QString( data+count).left(5).lower() == "begin" )
{
count += 5;
while ( count < len && data[count] != '\n' && data[count] != '\r' )
count ++;
while ( count < len && (data[count] == '\n' || data[count] == '\r') )
count ++;
data += count;
len -= count;
hasLF = true;
}
out.resize( len/4*3 );
while ( sidx < len )
{
// get line length (in number of encoded octets)
line_len = UUDecMap[ (unsigned char) data[sidx++]];
// ascii printable to 0-63 and 4-byte to 3-byte conversion
end = didx+line_len;
char A, B, C, D;
if (end > 2) {
while (didx < end-2)
{
A = UUDecMap[(unsigned char) data[sidx]];
B = UUDecMap[(unsigned char) data[sidx+1]];
C = UUDecMap[(unsigned char) data[sidx+2]];
D = UUDecMap[(unsigned char) data[sidx+3]];
- out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) );
- out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) );
- out.at(didx++) = ( ((C << 6) & 255) | (D & 077) );
+ out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) );
+ out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) );
+ out[didx++] = ( ((C << 6) & 255) | (D & 077) );
sidx += 4;
}
}
if (didx < end)
{
A = UUDecMap[(unsigned char) data[sidx]];
B = UUDecMap[(unsigned char) data[sidx+1]];
- out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) );
+ out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) );
}
if (didx < end)
{
B = UUDecMap[(unsigned char) data[sidx+1]];
C = UUDecMap[(unsigned char) data[sidx+2]];
- out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) );
+ out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) );
}
// skip padding
while (sidx < len && data[sidx] != '\n' && data[sidx] != '\r')
sidx++;
// skip end of line
while (sidx < len && (data[sidx] == '\n' || data[sidx] == '\r'))
sidx++;
// skip the "END" separator when present.
if ( hasLF && QString( data+sidx).left(3).lower() == "end" )
break;
}
if ( didx < out.size() )
out.resize( didx );
}
/******************************** KMD5 ********************************/
KMD5::KMD5()
{
init();
}
KMD5::KMD5(const char *in, int len)
{
init();
update(in, len);
}
KMD5::KMD5(const QByteArray& in)
{
init();
update( in );
}
-KMD5::KMD5(const QCString& in)
+KMD5::KMD5(const Q3CString& in)
{
init();
update( in );
}
void KMD5::update(const QByteArray& in)
{
update(in.data(), int(in.size()));
}
-void KMD5::update(const QCString& in)
+void KMD5::update(const Q3CString& in)
{
update(in.data(), int(in.length()));
}
void KMD5::update(const unsigned char* in, int len)
{
if (len < 0)
len = qstrlen(reinterpret_cast<const char*>(in));
if (!len)
return;
if (m_finalized) {
kdWarning() << "KMD5::update called after state was finalized!" << endl;
return;
}
Q_UINT32 in_index;
Q_UINT32 buffer_index;
Q_UINT32 buffer_space;
Q_UINT32 in_length = static_cast<Q_UINT32>( len );
buffer_index = static_cast<Q_UINT32>((m_count[0] >> 3) & 0x3F);
if ( (m_count[0] += (in_length << 3))<(in_length << 3) )
m_count[1]++;
m_count[1] += (in_length >> 29);
buffer_space = 64 - buffer_index;
if (in_length >= buffer_space)
{
@@ -844,148 +843,148 @@ void KMD5::finalize ()
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
encode (bits, m_count, 8);
//memcpy( bits, m_count, 8 );
// Pad out to 56 mod 64.
index = static_cast<Q_UINT32>((m_count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
update (reinterpret_cast<const char*>(PADDING), padLen);
// Append length (before padding)
update (reinterpret_cast<const char*>(bits), 8);
// Store state in digest
encode (m_digest, m_state, 16);
//memcpy( m_digest, m_state, 16 );
// Fill sensitive information with zero's
memset ( (void *)m_buffer, 0, sizeof(*m_buffer));
m_finalized = true;
}
bool KMD5::verify( const KMD5::Digest& digest)
{
finalize();
return (0 == memcmp(rawDigest(), digest, sizeof(KMD5::Digest)));
}
-bool KMD5::verify( const QCString& hexdigest)
+bool KMD5::verify( const Q3CString& hexdigest)
{
finalize();
return (0 == strcmp(hexDigest().data(), hexdigest));
}
const KMD5::Digest& KMD5::rawDigest()
{
finalize();
return m_digest;
}
void KMD5::rawDigest( KMD5::Digest& bin )
{
finalize();
memcpy( bin, m_digest, 16 );
}
-QCString KMD5::hexDigest()
+Q3CString KMD5::hexDigest()
{
- QCString s(33);
+ Q3CString s(33);
finalize();
sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5],
m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11],
m_digest[12], m_digest[13], m_digest[14], m_digest[15]);
return s;
}
-void KMD5::hexDigest(QCString& s)
+void KMD5::hexDigest(Q3CString& s)
{
finalize();
s.resize(33);
sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5],
m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11],
m_digest[12], m_digest[13], m_digest[14], m_digest[15]);
}
-QCString KMD5::base64Digest()
+Q3CString KMD5::base64Digest()
{
QByteArray ba(16);
finalize();
memcpy(ba.data(), m_digest, 16);
return KCodecs::base64Encode(ba);
}
void KMD5::init()
{
d = 0;
reset();
}
void KMD5::reset()
{
m_finalized = false;
m_count[0] = 0;
m_count[1] = 0;
m_state[0] = 0x67452301;
m_state[1] = 0xefcdab89;
m_state[2] = 0x98badcfe;
m_state[3] = 0x10325476;
memset ( m_buffer, 0, sizeof(*m_buffer));
memset ( m_digest, 0, sizeof(*m_digest));
}
void KMD5::transform( const unsigned char block[64] )
{
Q_UINT32 a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], x[16];
decode (x, block, 64);
//memcpy( x, block, 64 );
//US Q_ASSERT(!m_finalized); // not just a user error, since the method is private
- ASSERT(!m_finalized); // not just a user error, since the method is private
+ Q_ASSERT(!m_finalized); // not just a user error, since the method is private
/* Round 1 */
FF (a, b, c, d, x[ 0], KMD5_S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], KMD5_S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], KMD5_S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], KMD5_S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], KMD5_S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], KMD5_S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], KMD5_S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], KMD5_S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], KMD5_S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], KMD5_S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], KMD5_S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], KMD5_S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], KMD5_S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], KMD5_S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], KMD5_S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], KMD5_S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], KMD5_S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], KMD5_S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], KMD5_S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], KMD5_S24, 0xe9b6c7aa); /* 20 */
GG (a, b, c, d, x[ 5], KMD5_S21, 0xd62f105d); /* 21 */
GG (d, a, b, c, x[10], KMD5_S22, 0x2441453); /* 22 */
GG (c, d, a, b, x[15], KMD5_S23, 0xd8a1e681); /* 23 */
GG (b, c, d, a, x[ 4], KMD5_S24, 0xe7d3fbc8); /* 24 */
GG (a, b, c, d, x[ 9], KMD5_S21, 0x21e1cde6); /* 25 */
GG (d, a, b, c, x[14], KMD5_S22, 0xc33707d6); /* 26 */
GG (c, d, a, b, x[ 3], KMD5_S23, 0xf4d50d87); /* 27 */
GG (b, c, d, a, x[ 8], KMD5_S24, 0x455a14ed); /* 28 */
diff --git a/microkde/kdecore/kmdcodec.h b/microkde/kdecore/kmdcodec.h
index 2c4d611..616b683 100644
--- a/microkde/kdecore/kmdcodec.h
+++ b/microkde/kdecore/kmdcodec.h
@@ -10,345 +10,347 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
RFC 1321 "MD5 Message-Digest Algorithm" Copyright (C) 1991-1992.
RSA Data Security, Inc. Created 1991. All rights reserved.
The KMD5 class is based on a C++ implementation of
"RSA Data Security, Inc. MD5 Message-Digest Algorithm" by
Mordechai T. Abzug, Copyright (c) 1995. This implementation
passes the test-suite as defined in RFC 1321.
The encoding and decoding utilities in KCodecs with the exception of
quoted-printable are based on the java implementation in HTTPClient
package by Ronald Tschalär Copyright (C) 1996-1999.
The quoted-printable codec as described in RFC 2045, section 6.7. is by
Rik Hemsley (C) 2001.
*/
#ifndef _KMDBASE_H
#define _KMDBASE_H
#define KBase64 KCodecs
#include <qglobal.h>
#include <qstring.h>
#include <qiodevice.h>
+//Added by qt3to4:
+#include <Q3CString>
/**
* A wrapper class for the most commonly used encoding and
* decoding algorithms. Currently there is support for encoding
* and decoding input using base64, uu and the quoted-printable
* specifications.
*
* @sect Usage:
*
* <PRE>
* QCString input = "Aladdin:open sesame";
* QCString result = KCodecs::base64Encode(input);
* cout << "Result: " << result.data() << endl;
*
* Output should be
* Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==
* </PRE>
*
* The above example makes use of the convenience functions
* (ones that accept/return null-terminated strings) to encode/decode
* a string. If what you need is to encode or decode binary data, then
* it is highly recommended that you use the functions that take an input
* and output QByteArray as arguments. These functions are specifically
* tailored for encoding and decoding binary data.
*
* @short A collection of commonly used encoding and decoding algorithms.
* @author Dawit Alemayehu <adawit@kde.org>
* @author Rik Hemsley <rik@kde.org>
*/
class KCodecs
{
public:
/**
* Encodes the given data using the quoted-printable algorithm.
*
* @param in data to be encoded.
* @param useCRLF if true the input data is expected to have
* CRLF line breaks and the output will have CRLF line
* breaks, too.
* @return quoted-printable encoded data.
*/
- static QCString quotedPrintableEncode(const QByteArray & in,
+ static Q3CString quotedPrintableEncode(const QByteArray & in,
bool useCRLF = true);
/**
* @overload
*
* Same as above except it accepts a null terminated
* string instead an array.
*
* @param str data to be encoded.
* @param useCRLF if true the input data is expected to have
* CRLF line breaks and the output will have CRLF line
* breaks, too.
* @return quoted-printable encoded data.
*/
- static QCString quotedPrintableEncode(const QCString & str,
+ static Q3CString quotedPrintableEncode(const Q3CString & str,
bool useCRLF = true);
/**
* Encodes the given data using the quoted-printable algorithm.
*
* Use this function if you want the result of the encoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for encoding binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in data to be encoded.
* @param out decoded data.
* @param useCRLF if true the input data is expected to have
* CRLF line breaks and the output will have CRLF line
* breaks, too.
* @return quoted-printable encoded data.
*/
static void quotedPrintableEncode(const QByteArray & in, QByteArray& out,
bool useCRLF);
/**
* Decodes a quoted-printable encoded string.
*
* Accepts data with CRLF or standard unix line breaks.
*
* @param in the data to be decoded.
* @return decoded data.
*/
- static QCString quotedPrintableDecode(const QByteArray & in);
+ static Q3CString quotedPrintableDecode(const QByteArray & in);
/**
* @overload
*
* Same as above except it accepts a null terminated
* string instead an array.
*
* @param str the data to be decoded.
* @return decoded data.
*/
- static QCString quotedPrintableDecode(const QCString & str);
+ static Q3CString quotedPrintableDecode(const Q3CString & str);
/**
* Decodes a quoted-printable encoded data.
*
* Accepts data with CRLF or standard unix line breaks.
* Use this function if you want the result of the decoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for decoding an encoded
* binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in data to be encoded.
* @param out decoded data.
*
* @return quoted-printable encoded data.
*/
static void quotedPrintableDecode(const QByteArray & in, QByteArray& out);
/**
* Encodes the given data using the uuencode algorithm.
*
* The output is split into lines starting with the number of
* encoded octets in the line and ending with a newline. No
* line is longer than 45 octets (60 characters), excluding the
* line terminator.
*
* @param in the data to be uuencoded
* @return a uuencoded data.
*/
- static QCString uuencode( const QByteArray& in );
+ static Q3CString uuencode( const QByteArray& in );
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the string to be uuencoded.
* @return the encoded string.
*/
- static QCString uuencode( const QCString& str );
+ static Q3CString uuencode( const Q3CString& str );
/**
* Encodes the given data using the uuencode algorithm.
*
* Use this function if you want the result of the encoding
* to be placed in another array and cut down the number of
* copy operation that have to be performed in the process.
* This is the preffered method for encoding binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the data to be uuencoded.
* @param out the container for the uudecoded data.
*/
static void uuencode( const QByteArray& in, QByteArray& out );
/**
* Decodes the given data using the uuencode algorithm.
*
* Any 'begin' and 'end' lines like those generated by
* the utilities in unix and unix-like OS will be
* automatically ignored.
*
* @param in the data uuencoded data to be decoded.
* @return a decoded string.
*/
- static QCString uudecode( const QByteArray& in );
+ static Q3CString uudecode( const QByteArray& in );
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the string to be decoded.
* @return a uudecoded string.
*/
- static QCString uudecode( const QCString& str );
+ static Q3CString uudecode( const Q3CString& str );
/**
* Decodes the given data using the uudecode algorithm.
*
* Use this function if you want the result of the decoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is the preferred method for decoding binary data.
*
* Any 'begin' and 'end' lines like those generated by
* the utilities in unix and unix-like OS will be
* automatically ignored.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the uuencoded-data to be decoded.
* @param out the container for the uudecoded data.
*/
static void uudecode( const QByteArray& in, QByteArray& out );
/**
* Encodes the given data using the base64 algorithm.
*
* The boolean argument determines if the encoded data is
* going to be restricted to 76 characters or less per line
* as specified by RFC 2045. If @p insertLFs is true, then
* there will be 76 characters or less per line.
*
* @param in the data to be encoded.
* @param insertLFs limit the number of characters per line.
*
* @return a base64 encoded string.
*/
- static QCString base64Encode( const QByteArray& in, bool insertLFs = false);
+ static Q3CString base64Encode( const QByteArray& in, bool insertLFs = false);
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the string to be encoded.
* @param insertLFs limit the number of characters per line.
* @return the decoded string.
*/
- static QCString base64Encode( const QCString& str, bool insertLFs = false );
+ static Q3CString base64Encode( const Q3CString& str, bool insertLFs = false );
/**
* Encodes the given data using the base64 algorithm.
*
* Use this function if you want the result of the encoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for encoding binary data.
*
* The boolean argument determines if the encoded data is going
* to be restricted to 76 characters or less per line as specified
* by RFC 2045. If @p insertLFs is true, then there will be 76
* characters or less per line.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the data to be encoded using base64.
* @param out the container for the encoded data.
* @param insertLFs limit the number of characters per line.
*/
static void base64Encode( const QByteArray& in, QByteArray& out,
bool insertLFs = false );
/**
* Decodes the given data that was encoded using the
* base64 algorithm.
*
* @param in the base64-encoded data to be decoded.
* @return the decoded data.
*/
- static QCString base64Decode( const QByteArray& in );
+ static Q3CString base64Decode( const QByteArray& in );
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the base64-encoded string.
* @return the decoded string.
*/
- static QCString base64Decode( const QCString& str );
+ static Q3CString base64Decode( const Q3CString& str );
/**
* Decodes the given data that was encoded with the base64
* algorithm.
*
* Use this function if you want the result of the decoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for decoding an encoded
* binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the encoded data to be decoded.
* @param out the container for the decoded data.
*/
static void base64Decode( const QByteArray& in, QByteArray& out );
private:
KCodecs();
private:
static const char UUEncMap[64];
static const char UUDecMap[128];
static const char Base64EncMap[64];
static const char Base64DecMap[128];
static const char hexChars[16];
static const unsigned int maxQPLineLength;
};
@@ -402,158 +404,158 @@ class KMD5Private;
*/
class KMD5
{
public:
typedef unsigned char Digest[16];
KMD5();
/**
* Constructor that updates the digest for the given string.
*
* @param in C string or binary data
* @param len if negative, calculates the length by using
* strlen on the first parameter, otherwise
* it trusts the given length (does not stop on NUL byte).
*/
KMD5(const char* in, int len = -1);
/**
* @overload
*
* Same as above except it accepts a QByteArray as its argument.
*/
KMD5(const QByteArray& a );
/**
* @overload
*
* Same as above except it accepts a QByteArray as its argument.
*/
- KMD5(const QCString& a );
+ KMD5(const Q3CString& a );
/**
* Updates the message to be digested. Be sure to add all data
* before you read the digest. After reading the digest, you
* can <b>not</b> add more data!
*
* @param in message to be added to digest
* @param len the length of the given message.
*/
void update(const char* in, int len = -1) { update(reinterpret_cast<const unsigned char*>(in), len); }
/**
* @overload
*/
void update(const unsigned char* in, int len = -1);
/**
* @overload
*
* @param in message to be added to the digest (QByteArray).
*/
void update(const QByteArray& in );
/**
* @overload
*
* @param in message to be added to the digest (QByteArray).
*/
- void update(const QCString& in );
+ void update(const Q3CString& in );
/**
* @overload
*
* reads the data from an I/O device, i.e. from a file (QFile).
*
* NOTE that the file must be open for reading.
*
* @param file a pointer to FILE as returned by calls like f{d,re}open
*
* @returns false if an error occured during reading.
*/
bool update(QIODevice& file);
/**
* Calling this function will reset the calculated message digest.
* Use this method to perform another message digest calculation
* without recreating the KMD5 object.
*/
void reset();
/**
* @return the raw representation of the digest
*/
const Digest& rawDigest ();
/**
* Fills the given array with the binary representation of the
* message digest.
*
* Use this method if you do not want to worry about making
* copy of the digest once you obtain it.
*
* @param bin an array of 16 characters ( char[16] )
*/
void rawDigest( KMD5::Digest& bin );
/**
* Returns the value of the calculated message digest in
* a hexadecimal representation.
*/
- QCString hexDigest ();
+ Q3CString hexDigest ();
/**
* @overload
*/
- void hexDigest(QCString&);
+ void hexDigest(Q3CString&);
/**
* Returns the value of the calculated message digest in
* a base64-encoded representation.
*/
- QCString base64Digest ();
+ Q3CString base64Digest ();
/**
* returns true if the calculated digest for the given
* message matches the given one.
*/
bool verify( const KMD5::Digest& digest);
/**
* @overload
*/
- bool verify(const QCString&);
+ bool verify(const Q3CString&);
protected:
/**
* Performs the real update work. Note
* that length is implied to be 64.
*/
void transform( const unsigned char buffer[64] );
/**
* finalizes the digest
*/
void finalize();
private:
KMD5(const KMD5& u);
KMD5& operator=(const KMD5& md);
void init();
void encode( unsigned char* output, Q_UINT32 *in, Q_UINT32 len );
void decode( Q_UINT32 *output, const unsigned char* in, Q_UINT32 len );
Q_UINT32 rotate_left( Q_UINT32 x, Q_UINT32 n );
Q_UINT32 F( Q_UINT32 x, Q_UINT32 y, Q_UINT32 z );
Q_UINT32 G( Q_UINT32 x, Q_UINT32 y, Q_UINT32 z );
Q_UINT32 H( Q_UINT32 x, Q_UINT32 y, Q_UINT32 z );
Q_UINT32 I( Q_UINT32 x, Q_UINT32 y, Q_UINT32 z );
void FF( Q_UINT32& a, Q_UINT32 b, Q_UINT32 c, Q_UINT32 d, Q_UINT32 x,
Q_UINT32 s, Q_UINT32 ac );
void GG( Q_UINT32& a, Q_UINT32 b, Q_UINT32 c, Q_UINT32 d, Q_UINT32 x,
Q_UINT32 s, Q_UINT32 ac );
void HH( Q_UINT32& a, Q_UINT32 b, Q_UINT32 c, Q_UINT32 d, Q_UINT32 x,
Q_UINT32 s, Q_UINT32 ac );
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp
index 0220a34..d4010fa 100644
--- a/microkde/kdecore/kprefs.cpp
+++ b/microkde/kdecore/kprefs.cpp
@@ -1,55 +1,57 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#include <qcolor.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kconfig.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kdebug.h>
#include "kprefs.h"
class KPrefsItemBool : public KPrefsItem {
public:
KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true);
virtual ~KPrefsItemBool() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
bool *mReference;
bool mDefault;
};
class KPrefsItemInt : public KPrefsItem {
public:
KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
virtual ~KPrefsItemInt() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
@@ -111,75 +113,75 @@ class KPrefsItemString : public KPrefsItem {
const QString &defaultValue="", bool isPassword=false);
virtual ~KPrefsItemString() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
QString *mReference;
QString mDefault;
bool mPassword;
};
class KPrefsItemStringList : public KPrefsItem {
public:
KPrefsItemStringList(const QString &group,const QString &name,QStringList *,
const QStringList &defaultValue=QStringList());
virtual ~KPrefsItemStringList() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
QStringList *mReference;
QStringList mDefault;
};
class KPrefsItemIntList : public KPrefsItem {
public:
- KPrefsItemIntList(const QString &group,const QString &name,QValueList<int> *,
- const QValueList<int> &defaultValue=QValueList<int>());
+ KPrefsItemIntList(const QString &group,const QString &name,Q3ValueList<int> *,
+ const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
virtual ~KPrefsItemIntList() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
- QValueList<int> *mReference;
- QValueList<int> mDefault;
+ Q3ValueList<int> *mReference;
+ Q3ValueList<int> mDefault;
};
KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name,
bool *reference,bool defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemBool::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemBool::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemBool::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readBoolEntry(mName,mDefault);
}
KPrefsItemInt::KPrefsItemInt(const QString &group,const QString &name,
int *reference,int defaultValue) :
@@ -335,65 +337,65 @@ void KPrefsItemString::readConfig(KConfig *config)
*mReference = config->readEntry( mName, mDefault );
}
}
KPrefsItemStringList::KPrefsItemStringList(const QString &group,const QString &name,
QStringList *reference,const QStringList &defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemStringList::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemStringList::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemStringList::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readListEntry(mName);
}
KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name,
- QValueList<int> *reference,const QValueList<int> &defaultValue) :
+ Q3ValueList<int> *reference,const Q3ValueList<int> &defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemIntList::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemIntList::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemIntList::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readIntListEntry(mName);
}
QString *KPrefs::mCurrentGroup = 0;
KPrefs::KPrefs(const QString &configname)
{
if (!configname.isEmpty()) {
//qDebug("KPrefs::KPrefs %s",configname.latin1() );
mConfig = new KConfig(locateLocal("config",configname));
} else {
@@ -476,37 +478,37 @@ void KPrefs::addItemInt(const QString &key,int *reference,int defaultValue)
void KPrefs::addItemColor(const QString &key,QColor *reference,const QColor &defaultValue)
{
addItem(new KPrefsItemColor(*mCurrentGroup,key,reference,defaultValue));
}
void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaultValue)
{
addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue));
}
void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaultValue)
{
addItem(new KPrefsItemSize(*mCurrentGroup,key,reference,defaultValue));
}
void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue)
{
addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false));
}
void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue)
{
addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true));
}
void KPrefs::addItemStringList(const QString &key,QStringList *reference,
const QStringList &defaultValue)
{
addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue));
}
-void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference,
- const QValueList<int> &defaultValue)
+void KPrefs::addItemIntList(const QString &key,Q3ValueList<int> *reference,
+ const Q3ValueList<int> &defaultValue)
{
addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue));
}
diff --git a/microkde/kdecore/kprefs.h b/microkde/kdecore/kprefs.h
index 95d2724..d9d1572 100644
--- a/microkde/kdecore/kprefs.h
+++ b/microkde/kdecore/kprefs.h
@@ -1,60 +1,62 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _KPREFS_H
#define _KPREFS_H
// $Id$
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qcolor.h>
#include <qfont.h>
#include <qsize.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class KConfig;
/**
@short Class for storing a preferences setting
@author Cornelius Schumacher
@see KPref
This class represents one preferences setting as used by @ref KPrefs.
Subclasses of KPrefsItem implement storage functions for a certain type of
setting. Normally you don't have to use this class directly. Use the special
addItem() functions of KPrefs instead. If you subclass this class you will
have to register instances with the function KPrefs::addItem().
*/
class KPrefsItem {
public:
/**
Constructor.
@param group Config file group.
@param name Config file key.
*/
KPrefsItem(const QString &group,const QString &name) :
mGroup(group),mName(name) {}
/**
Destructor.
*/
virtual ~KPrefsItem() {}
/**
This function is called by @ref KPrefs to set this setting to its default
value.
@@ -254,63 +256,63 @@ class KPrefs {
@param key Key used in config file.
@param reference Pointer to the variable, which is set by readConfig()
and setDefaults() calls and read by writeConfig() calls.
@param defaultValue Default value, which is used by setDefaults() and
when the config file does not yet contain the key of
this item.
*/
void addItemPassword(const QString &key,QString *reference,
const QString &defaultValue="");
/**
Register an item of type QStringList.
@param key Key used in config file.
@param reference Pointer to the variable, which is set by readConfig()
and setDefaults() calls and read by writeConfig() calls.
@param defaultValue Default value, which is used by setDefaults() and
when the config file does not yet contain the key of
this item.
*/
void addItemStringList(const QString &key,QStringList *reference,
const QStringList &defaultValue=QStringList());
/**
Register an item of type QValueList<int>.
@param key Key used in config file.
@param reference Pointer to the variable, which is set by readConfig()
and setDefaults() calls and read by writeConfig() calls.
@param defaultValue Default value, which is used by setDefaults() and
when the config file does not yet contain the key of
this item.
*/
- void addItemIntList(const QString &key,QValueList<int> *reference,
- const QValueList<int> &defaultValue=QValueList<int>());
+ void addItemIntList(const QString &key,Q3ValueList<int> *reference,
+ const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
protected:
/**
Implemented by subclasses that use special defaults.
*/
virtual void usrSetDefaults() {};
/**
Implemented by subclasses that read special config values.
*/
virtual void usrReadConfig() {};
/**
Implemented by subclasses that write special config values.
*/
virtual void usrWriteConfig() {};
/**
Return the @ref KConfig object used for reading and writing the settings.
*/
KConfig *config() const;
private:
static QString *mCurrentGroup;
KConfig *mConfig; // pointer to KConfig object
- QPtrList<KPrefsItem> mItems;
+ Q3PtrList<KPrefsItem> mItems;
};
#endif
diff --git a/microkde/kdecore/kshortcut.h b/microkde/kdecore/kshortcut.h
index 4813734..244d590 100644
--- a/microkde/kdecore/kshortcut.h
+++ b/microkde/kdecore/kshortcut.h
@@ -534,110 +534,110 @@ class KKey
/**
* The KShortcut class is used to represent a keyboard shortcut to an action.
* A shortcut is normally a single key with modifiers, such as Ctrl+V.
* A KShortcut object may also contain an alternate key which will also
* activate the action it's associated to, as long as no other actions have
* defined that key as their primary key. Ex: Ctrl+V;Shift+Insert.
*/
class KShortcut
{
public:
/**
* The maximum number of key sequences that can be contained in
* a KShortcut.
*/
enum { MAX_SEQUENCES = 2 };
/**
* Creates a new null shortcut.
* @see null()
* @see isNull()
* @see clear()
*/
KShortcut() {}
/**
* Creates a new shortcut with the given Qt key code
* as the only key sequence.
* @param keyQt the qt keycode
* @see Qt::Key
*/
- KShortcut( int keyQt ) {}
+ KShortcut( int /*keyQt */) {}
/**
* Creates a new shortcut that contains only the given qt key
* sequence.
* @param keySeq the qt key sequence to add
*/
//US KShortcut( const QKeySequence& keySeq ) {}
/**
* Creates a new shortcut that contains only the given key
* in its only sequence.
* @param key the key to add
*/
//US KShortcut( const KKey& key );
/**
* Creates a new shortcut that contains only the given key
* sequence.
* @param keySeq the key sequence to add
*/
//US KShortcut( const KKeySequence& keySeq );
/**
* Copies the given shortcut.
* @param shortcut the shortcut to add
*/
//US KShortcut( const KShortcut& shortcut );
/**
* Creates a new key sequence that contains the given key sequence.
* The description consists of semicolon-separated keys as
* used in @ref KKeySequence::KKeySequence(const QString&).
* @param shortcut the description of the key
* @see KKeySequence::KKeySequence(const QString&)
*/
- KShortcut( const char* shortcut ) {}
+ KShortcut( const char* /*shortcut */) {}
/**
* Creates a new key sequence that contains the given key sequence.
* The description consists of semicolon-separated keys as
* used in @ref KKeySequence::KKeySequence(const QString&).
* @param shortcut the description of the key
* @see KKeySequence::KKeySequence(const QString&)
*/
- KShortcut( const QString& shortcut ) {}
+ KShortcut( const QString& /*shortcut */) {}
~KShortcut() {}
/**
* Clears the shortcut. The shortcut is null after calling this
* function.
* @see isNull()
*/
//US void clear();
/**
* Initializes the shortcut with the given Qt key code
* as the only key sequence.
* @param keyQt the qt keycode
* @see Qt::Key
*/
//US bool init( int keyQt );
/**
* Initializes the shortcut with the given qt key sequence.
* @param keySeq the qt key sequence to add
*/
//US bool init( const QKeySequence& keySeq );
/**
* Initializes the shortcut with the given key as its only sequence.
* @param key the key to add
*/
//US bool init( const KKey& key );
/**
* Initializes the shortcut with the given qt key sequence.
* @param keySeq the qt key sequence to add
@@ -787,60 +787,60 @@ class KShortcut
* @see MAX_SEQUENCES
* @since 3.2
*/
//US bool append( const KKey& spec );
/**
* Appends the sequences from the given shortcut.
* @param cut the shortcut to append
* @return true if successful, false otherwise
* @see MAX_SEQUENCES
* @since 3.2
*/
//US bool append( const KShortcut& cut );
/**
* Converts this shortcut to a key sequence. The first key sequence
* will be taken.
*/
//US operator QKeySequence () const;
/**
* Returns a description of the shortcut as semicolon-separated
* ket sequences, as returned by @ref KKeySequence::toString().
* @return the string represenation of this shortcut
* @see KKey::toString()
* @see KKeySequence::toString()
*/
//US QString toString() const;
/**
* @internal
*/
- QString toStringInternal( const KShortcut* pcutDefault = 0 ) const
+ QString toStringInternal( const KShortcut* /*pcutDefault*/ = 0 ) const
{
return "EMPTY IMPL.";
}
/**
* Returns a null shortcut.
* @return the null shortcut
* @see isNull()
* @see clear()
*/
//US static KShortcut& null();
//US protected:
//US uint m_nSeqs;
//US KKeySequence m_rgseq[MAX_SEQUENCES];
//US private:
//US class KShortcutPrivate* d;
//US friend class KKeyNative;
//US#ifndef KDE_NO_COMPAT
//US public:
//US operator int () const { return keyCodeQt(); }
//US#endif
};
#endif // __KSHORTCUT_H
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index d5bfefd..f10934b 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -8,113 +8,115 @@
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* Version: $Id$
* Generated: Thu Mar 5 16:05:28 EST 1998
*/
//US #include "config.h"
#include <stdlib.h>
#include <assert.h>
//US#include <errno.h>
//US #ifdef HAVE_SYS_STAT_H
//US #include <sys/stat.h>
//US #endif
//US#include <sys/types.h>
//US#include <dirent.h>
//US#include <pwd.h>
#include <qregexp.h>
-#include <qasciidict.h>
-#include <qdict.h>
+#include <q3asciidict.h>
+#include <q3dict.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qstring.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "kstandarddirs.h"
#include "kconfig.h"
#include "kdebug.h"
//US #include "kinstance.h"
#include "kshell.h"
//US#include <sys/param.h>
//US#include <unistd.h>
//US
QString KStandardDirs::mAppDir = QString::null;
-template class QDict<QStringList>;
+template class Q3Dict<QStringList>;
#if 0
-#include <qtextedit.h>
+#include <q3textedit.h>
void ddd( QString op )
{
- static QTextEdit * dot = 0;
+ static Q3TextEdit * dot = 0;
if ( ! dot )
- dot = new QTextEdit();
+ dot = new Q3TextEdit();
dot->show();
dot->append( op );
}
#endif
class KStandardDirs::KStandardDirsPrivate
{
public:
KStandardDirsPrivate()
: restrictionsActive(false),
dataRestrictionActive(false)
{ }
bool restrictionsActive;
bool dataRestrictionActive;
- QAsciiDict<bool> restrictions;
+ Q3AsciiDict<bool> restrictions;
QStringList xdgdata_prefixes;
QStringList xdgconf_prefixes;
};
static const char* const types[] = {"html", "icon", "apps", "sound",
"data", "locale", "services", "mime",
"servicetypes", "config", "exe", "tmp",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 };
static int tokenize( QStringList& token, const QString& str,
const QString& delim );
KStandardDirs::KStandardDirs( ) : addedCustoms(false)
{
d = new KStandardDirsPrivate;
dircache.setAutoDelete(true);
relatives.setAutoDelete(true);
absolutes.setAutoDelete(true);
savelocations.setAutoDelete(true);
addKDEDefaults();
}
KStandardDirs::~KStandardDirs()
{
delete d;
}
bool KStandardDirs::isRestrictedResource(const char *type, const QString& relPath) const
{
if (!d || !d->restrictionsActive)
@@ -416,102 +418,102 @@ static void lookupDirectory(const QString& path, const QString &relPart,
++iii;
if ( iii == 5 )
abort();
assert(path.at(path.length() - 1) == '/');
//US struct dirent *ep;
//US struct stat buff;
QString _dot(".");
QString _dotdot("..");
//US while( ( ep = readdir( dp ) ) != 0L )
QStringList direntries = dp.entryList();
QStringList::Iterator it = direntries.begin();
while ( it != list.end() ) // for each file...
{
//US QString fn( QFile::decodeName(ep->d_name));
QString fn = (*it); // dp.entryList already decodes
it++;
if ( fn.isNull() )
break;
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' )
continue;
/*US
if (!recursive && !regexp.exactMatch(fn))
continue; // No match
*/
//US this should do the same:
- int pos = regexp.match(fn);
+ int pos = regexp.exactMatch(fn);
if (!recursive && !pos == 0)
continue; // No match
QString pathfn = path + fn;
/*US
if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) {
kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl;
continue; // Couldn't stat (e.g. no read permissions)
}
if ( recursive )
{
if ( S_ISDIR( buff.st_mode )) {
lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq);
}
*/
//US replacement:
QFileInfo pathfnInfo(QFile::encodeName(pathfn));
if ( pathfnInfo.isReadable() == false )
{
//US kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl;
continue; // Couldn't stat (e.g. no read permissions)
}
if ( recursive )
{
if ( pathfnInfo.isDir()) {
lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq);
}
/*US
if (!regexp.exactMatch(fn))
continue; // No match
*/
//US this should do the same:
- pos = regexp.match(fn);
+ pos = regexp.exactMatch(fn);
if (!pos == 0)
continue; // No match
}
//US if ( S_ISREG( buff.st_mode))
if ( pathfnInfo.isFile())
{
if (!uniq || !relList.contains(relPart + fn))
{
list.append( pathfn );
relList.append( relPart + fn );
}
}
}
//US closedir( dp );
}
else
{
// We look for a single file.
QString fn = pattern;
QString pathfn = path + fn;
//US struct stat buff;
QFileInfo pathfnInfo(QFile::encodeName(pathfn));
//US if ( stat( QFile::encodeName(pathfn), &buff ) != 0 )
if ( pathfnInfo.isReadable() == false )
return; // File not found
//US if ( S_ISREG( buff.st_mode))
if ( pathfnInfo.isFile())
{
@@ -1079,65 +1081,65 @@ QString KStandardDirs::relativeLocation(const char *type, const QString &absPath
return fullPath.mid((*it).length());
}
return absPath;
}
bool KStandardDirs::makeDir(const QString& dir2, int mode)
{
QString dir = QDir::convertSeparators( dir2 );
#if 0
//LR
// we want an absolute path
if (dir.at(0) != '/')
return false;
QString target = dir;
uint len = target.length();
// append trailing slash if missing
if (dir.at(len - 1) != '/')
target += '/';
QString base("");
uint i = 1;
while( i < len )
{
//US struct stat st;
int pos = target.find('/', i);
base += target.mid(i - 1, pos - i + 1);
- QCString baseEncoded = QFile::encodeName(base);
+ Q3CString baseEncoded = QFile::encodeName(base);
// bail out if we encountered a problem
//US if (stat(baseEncoded, &st) != 0)
QFileInfo baseEncodedInfo(baseEncoded);
if (!baseEncodedInfo.exists())
{
// Directory does not exist....
// Or maybe a dangling symlink ?
//US if (lstat(baseEncoded, &st) == 0)
if (baseEncodedInfo.isSymLink()) {
//US (void)unlink(baseEncoded); // try removing
QFile(baseEncoded).remove();
}
//US if ( mkdir(baseEncoded, (mode_t) mode) != 0)
QDir dirObj;
if ( dirObj.mkdir(baseEncoded) != true )
{
//US perror("trying to create local folder");
return false; // Couldn't create it :-(
}
}
i = pos + 1;
}
return true;
#endif
// ********************************************
// new code for WIN32
QDir dirObj;
// we want an absolute path
@@ -1179,65 +1181,65 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
if (lstat(baseEncoded, &st) == 0)
(void)unlink(baseEncoded); // try removing
if ( mkdir(baseEncoded, (mode_t) mode) != 0) {
perror("trying to create local folder");
return false; // Couldn't create it :-(
}
}
*/
if (dirObj.exists(base) == false)
{
//qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1());
if (dirObj.mkdir(base) != true)
{
qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1());
return false;
}
}
i = pos + 1;
}
return true;
}
QString readEnvPath(const char *env)
{
//#ifdef _WIN32_
// return "";
//#else
- QCString c_path;
+ Q3CString c_path;
if ( getenv(env) != NULL )
c_path = QString ( getenv(env) );
if (c_path.isEmpty())
return QString::null;
return QFile::decodeName(c_path);
//#endif
}
void KStandardDirs::addKDEDefaults()
{
//qDebug("ERROR: KStandardDirs::addKDEDefaults() called ");
//return;
QStringList kdedirList;
// begin KDEDIRS
QString kdedirs = readEnvPath("MICROKDEDIRS");
if (!kdedirs.isEmpty())
{
tokenize(kdedirList, kdedirs, ":");
}
else
{
QString kdedir = readEnvPath("MICROKDEDIR");
if (!kdedir.isEmpty())
{
kdedir = KShell::tildeExpand(kdedir);
kdedirList.append(kdedir);
}
}
//US kdedirList.append(KDEDIR);
diff --git a/microkde/kdecore/kstandarddirs.h b/microkde/kdecore/kstandarddirs.h
index 901384e..f0e28fc 100644
--- a/microkde/kdecore/kstandarddirs.h
+++ b/microkde/kdecore/kstandarddirs.h
@@ -1,59 +1,59 @@
/*
This file is part of the KDE libraries
Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
Stephan Kulow <coolo@kde.org>
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 as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef SSK_KSTDDIRS_H
#define SSK_KSTDDIRS_H
#include <qstring.h>
-#include <qdict.h>
+#include <q3dict.h>
#include <qstringlist.h>
#include <kglobal.h>
class KConfig;
class KStandardDirsPrivate;
/**
* @short Site-independent access to standard KDE directories.
* @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* @version $Id$
*
* This is one of the most central classes in kdelibs as
* it provides a basic service: It knows where the files
* reside on the user's hard disk. And it's meant to be the
* only one that knows -- to make the real location as
* transparent as possible to both the user and the applications.
*
* To this end it insulates the application from all information
* and applications always refer to a file with a resource type
* (e.g. icon) and a filename (e.g. khexdit.xpm). In an ideal world
* the application would make no assumption where this file is and
* leave it up to @ref KStandardDirs::findResource("apps", "Home.desktop")
* to apply this knowledge to return /opt/kde/share/applnk/Home.desktop
* or ::locate("data", "kgame/background.jpg") to return
* /opt/kde/share/apps/kgame/background.jpg
*
* The main idea behind KStandardDirs is that there are several
* toplevel prefixes below which the files lie. One of these prefixes is
* the one where the user installed kdelibs, one is where the
* application was installed, and one is $HOME/.kde, but there
* may be even more. Under these prefixes there are several well
@@ -545,69 +545,69 @@ public:
/**
* @return $XDG_CONFIG_HOME
* See also http://www.freedesktop.org/standards/basedir/draft/basedir-spec/basedir-spec.html
*/
QString localxdgconfdir() const;
/**
* Checks for existence and accessability.
* Faster than creating a QFileInfo first.
* @param fullPath the path to check
* @return true if the directory exists
*/
static bool exists(const QString &fullPath);
/**
* Expands all symbolic links and resolves references to
* '/./', '/../' and extra '/' characters in @p dirname
* and returns the canonicalized absolute pathname.
* The resulting path will have no symbolic link, '/./'
* or '/../' components.
* @since 3.1
*/
static QString realPath(const QString &dirname);
static void setAppDir( const QString & );
static QString appDir();
private:
QStringList prefixes;
// Directory dictionaries
- QDict<QStringList> absolutes;
- QDict<QStringList> relatives;
+ Q3Dict<QStringList> absolutes;
+ Q3Dict<QStringList> relatives;
- mutable QDict<QStringList> dircache;
- mutable QDict<QString> savelocations;
+ mutable Q3Dict<QStringList> dircache;
+ mutable Q3Dict<QString> savelocations;
// Disallow assignment and copy-construction
KStandardDirs( const KStandardDirs& );
KStandardDirs& operator= ( const KStandardDirs& );
bool addedCustoms;
class KStandardDirsPrivate;
KStandardDirsPrivate *d;
//US
static QString mAppDir;
void checkConfig() const;
void applyDataRestrictions(const QString &) const;
//US void createSpecialResource(const char*);
};
/**
* \addtogroup locates Locate Functions
* @{
* On The Usage Of 'locate' and 'locateLocal'
*
* Typical KDE applications use resource files in one out of
* three ways:
*
* 1) A resource file is read but is never written. A system
* default is supplied but the user can override this
* default in his local .kde directory:
*
* \code
* // Code example
* myFile = locate("appdata", "groups.lst");
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp
index d38a6d5..c2df381 100644
--- a/microkde/kdeui/kaction.cpp
+++ b/microkde/kdeui/kaction.cpp
@@ -1,217 +1,220 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2002 Joseph Wenninger <jowenn@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kaction.h"
#include <assert.h>
#include <qtooltip.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3ValueList>
//US#include <qwhatsthis.h>
//US#include <kaccel.h>
//US#include <kaccelbase.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kguiitem.h>
//US#include <kmainwindow.h>
//US#include <kmenubar.h>
//US#include <kpopupmenu.h>
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
//US added this includefiles
#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qpopupmenu.h>
-#include <qiconset.h>
+#include <q3toolbar.h>
+#include <q3popupmenu.h>
+#include <qicon.h>
/**
* How it works.
* KActionCollection is an organizing container for KActions.
* KActionCollection keeps track of the information necessary to handle
* configuration and shortcuts.
*
* Focus Widget pointer:
* This is the widget which is the focus for action shortcuts.
* It is set either by passing a QWidget* to the KActionCollection constructor
* or by calling setWidget() if the widget wasn't known when the object was
* initially constructed (as in KXMLGUIClient and KParts::PartBase)
*
* Shortcuts:
* An action's shortcut will not not be connected unless a focus widget has
* been specified in KActionCollection.
*
* XML Filename:
* This is used to save user-modified settings back to the *ui.rc file.
* It is set by KXMLGUIFactory.
*/
int KAction::getToolButtonID()
{
static int toolbutton_no = -2;
return toolbutton_no--;
}
//---------------------------------------------------------------------
// KAction::KActionPrivate
//---------------------------------------------------------------------
class KAction::KActionPrivate : public KGuiItem
{
public:
KActionPrivate() : KGuiItem()
{
m_kaccel = 0;
m_configurable = true;
}
KAccel *m_kaccel;
- QValueList<KAccel*> m_kaccelList;
+ Q3ValueList<KAccel*> m_kaccelList;
QString m_groupText;
QString m_group;
KShortcut m_cut;
KShortcut m_cutDefault;
bool m_configurable;
struct Container
{
Container() { m_container = 0; m_representative = 0; m_id = 0; }
Container( const Container& s ) { m_container = s.m_container;
m_id = s.m_id; m_representative = s.m_representative; }
QWidget* m_container;
int m_id;
QWidget* m_representative;
};
- QValueList<Container> m_containers;
+ Q3ValueList<Container> m_containers;
};
//---------------------------------------------------------------------
// KAction
//---------------------------------------------------------------------
KAction::KAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
}
KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconName( sIconName );
}
-KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconSet( pix );
}
KAction::KAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( item.text(), cut, receiver, slot );
if( item.hasIconSet() )
setIcon( item.iconName() );
setToolTip( item.toolTip() );
setWhatsThis( item.whatsThis() );
}
// KDE 4: remove
KAction::KAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, 0, 0 );
}
KAction::KAction( const QString& text, const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
}
-KAction::KAction( const QString& text, const QIconSet& pix,
+KAction::KAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, 0, 0 );
setIconSet( pix );
}
KAction::KAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, 0, 0 );
d->setIconName( pix );
}
-KAction::KAction( const QString& text, const QIconSet& pix,
+KAction::KAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
setIconSet( pix );
}
KAction::KAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconName(pix);
}
KAction::KAction( QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( QString::null, KShortcut(), 0, 0 );
}
// KDE 4: remove end
KAction::~KAction()
{
#ifndef KDE_NO_COMPAT
if (d->m_kaccel)
unplugAccel();
@@ -477,77 +480,77 @@ void KAction::insertKAccel( KAccel* kaccel )
*/
}
void KAction::removeKAccel( KAccel* kaccel )
{
// qDebug("KAction::removeKAccel~ ...1 has top be fixed");
/*US
//kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl;
for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
if( d->m_kaccelList[i] == kaccel ) {
kaccel->remove( name() );
d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
break;
}
}
*/
}
// KDE 4: remove
void KAction::setAccel( int keyQt )
{
setShortcut( KShortcut(keyQt) );
}
// KDE 4: remove end
void KAction::updateShortcut( int i )
{
int id = itemId( i );
QWidget* w = container( i );
- if ( w->inherits( "QPopupMenu" ) ) {
- QPopupMenu* menu = static_cast<QPopupMenu*>(w);
+ if ( w->inherits( "Q3PopupMenu" ) ) {
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>(w);
updateShortcut( menu, id );
}
else if ( w->inherits( "QMenuBar" ) )
//US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id );
//US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id );
; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed");
}
-void KAction::updateShortcut( QPopupMenu* menu, int id )
+void KAction::updateShortcut( Q3PopupMenu* menu, int id )
{
/*US
//kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
// If the action has a KAccel object,
// show the string representation of its shortcut.
if ( d->m_kaccel || d->m_kaccelList.count() ) {
QString s = menu->text( id );
int i = s.find( '\t' );
if ( i >= 0 )
s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() );
else
s += "\t" + d->m_cut.seq(0).toString();
menu->changeItem( id, s );
}
// Otherwise insert the shortcut itself into the popup menu.
else {
// This is a fall-hack in case the KAction is missing a proper parent collection.
// It should be removed eventually. --ellis
menu->setAccel( d->m_cut.keyCodeQt(), id );
kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl;
}
*/
//qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed");
}
const KShortcut& KAction::shortcut() const
{
return d->m_cut;
@@ -592,92 +595,92 @@ void KAction::updateGroup( int )
QString KAction::group() const
{
return d->m_group;
}
bool KAction::isEnabled() const
{
return d->isEnabled();
}
bool KAction::isShortcutConfigurable() const
{
return d->m_configurable;
}
void KAction::setToolTip( const QString& tt )
{
//qDebug("KAction::setToolTip ...1 has top be fixed");
d->setToolTip( tt );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateToolTip( i );
}
void KAction::updateToolTip( int i )
{
//qDebug("KAction::updateToolTip ...1 has top be fixed");
QWidget *w = container( i );
if ( w->inherits( "KToolBar" ) )
QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
- else if ( w->inherits( "QToolBar" ) )
+ else if ( w->inherits( "Q3ToolBar" ) )
QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
}
QString KAction::toolTip() const
{
return d->toolTip();
}
int KAction::plug( QWidget *w, int index )
{
//kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl;
if (w == 0) {
kdWarning(129) << "KAction::plug called with 0 argument\n";
return -1;
}
// Check if action is permitted
//US if (kapp && !kapp->authorizeKAction(name()))
//US return -1;
plugShortcut();
- if ( w->inherits("QPopupMenu") )
+ if ( w->inherits("Q3PopupMenu") )
{
- QPopupMenu* menu = static_cast<QPopupMenu*>( w );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( w );
int id;
// Don't insert shortcut into menu if it's already in a KAccel object.
//qDebug("KAction::plug warning: real shortcuts not available yet. ");
//US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt();
int keyQt = 0;
if ( d->hasIcon() )
{
/*US
KInstance *instance;
if ( m_parentCollection )
instance = m_parentCollection->instance();
else
instance = KGlobal::instance();
*/
id = menu->insertItem( d->iconSet( KIcon::Small, 0/*US , instance */), d->text(), this,//dsweet
SLOT( slotActivated() ), keyQt,
-1, index );
}
else
id = menu->insertItem( d->text(), this,
SLOT( slotActivated() ), //dsweet
keyQt, -1, index );
// If the shortcut is already in a KAccel object, then
// we need to set the menu item's shortcut text.
/*US if ( d->m_kaccelList.count() || d->m_kaccel )
updateShortcut( menu, id );
*/
// call setItemEnabled only if the item really should be disabled,
// because that method is slow and the item is per default enabled
if ( !d->isEnabled() )
@@ -692,95 +695,95 @@ int KAction::plug( QWidget *w, int index )
if ( m_parentCollection )
m_parentCollection->connectHighlight( menu, this );
return d->m_containers.count() - 1;
}
else if ( w->inherits( "KToolBar" ) )
{
KToolBar *bar = static_cast<KToolBar *>( w );
int id_ = getToolButtonID();
/*US
KInstance *instance;
if ( m_parentCollection )
instance = m_parentCollection->instance();
else
instance = KGlobal::instance();
*/
if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly
{
bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index );
}
else
{
QString icon = d->iconName();
if ( icon.isEmpty() )
icon = "unknown";
bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index/*US, instance*/ );
}
- bar->getButton( id_ )->setName( QCString("toolbutton_")+name() );
+ bar->getButton( id_ )->setName( Q3CString("toolbutton_")+name() );
//US if ( !d->whatsThis().isEmpty() )
//US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() );
if ( !d->toolTip().isEmpty() )
QToolTip::add( bar->getButton(id_), d->toolTip() );
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
if ( m_parentCollection )
m_parentCollection->connectHighlight( bar, this );
return containerCount() - 1;
}
return -1;
}
void KAction::unplug( QWidget *w )
{
int i = findContainer( w );
if ( i == -1 )
return;
int id = itemId( i );
- if ( w->inherits( "QPopupMenu" ) )
+ if ( w->inherits( "Q3PopupMenu" ) )
{
- QPopupMenu *menu = static_cast<QPopupMenu *>( w );
+ Q3PopupMenu *menu = static_cast<Q3PopupMenu *>( w );
menu->removeItem( id );
}
else if ( w->inherits( "KToolBar" ) )
{
KToolBar *bar = static_cast<KToolBar *>( w );
bar->removeItemDelayed( id );
}
else if ( w->inherits( "QMenuBar" ) )
{
QMenuBar *bar = static_cast<QMenuBar *>( w );
bar->removeItem( id );
}
removeContainer( i );
if ( m_parentCollection )
m_parentCollection->disconnectHighlight( w, this );
}
void KAction::plugAccel(KAccel *kacc, bool configurable)
{
// qDebug("KAction::plugAccel ...1 has top be fixed");
/*US
kdWarning(129) << "KAction::plugAccel(): call to deprecated action." << endl;
kdDebug(129) << kdBacktrace() << endl;
//kdDebug(129) << "KAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl;
if ( d->m_kaccel )
unplugAccel();
// If the parent collection's accel ptr isn't set yet
//if ( m_parentCollection && !m_parentCollection->accel() )
@@ -833,270 +836,270 @@ void KAction::plugMainWindowAccel( QWidget *w )
else
kdDebug(129) << "KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl << endl;
*/
}
void KAction::setEnabled(bool enable)
{
//kdDebug(129) << "KAction::setEnabled( " << enable << " ): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
if ( enable == d->isEnabled() )
return;
// KDE 4: remove
//US if (d->m_kaccel)
//US d->m_kaccel->setEnabled(name(), enable);
// KDE 4: remove end
//US for ( uint i = 0; i < d->m_kaccelList.count(); i++ )
//US d->m_kaccelList[i]->setEnabled( name(), enable );
d->setEnabled( enable );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateEnabled( i );
emit enabled( d->isEnabled() );
}
void KAction::updateEnabled( int i )
{
QWidget *w = container( i );
- if ( w->inherits("QPopupMenu") )
- static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
+ if ( w->inherits("Q3PopupMenu") )
+ static_cast<Q3PopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
else if ( w->inherits("QMenuBar") )
static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
else if ( w->inherits( "KToolBar" ) )
{
static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
}
}
void KAction::setShortcutConfigurable( bool b )
{
d->m_configurable = b;
}
void KAction::setText( const QString& text )
{
/*US
// KDE 4: remove
if (d->m_kaccel) {
KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
if (pAction)
pAction->setLabel( text );
}
// KDE 4: remove end
for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
KAccelAction* pAction = d->m_kaccelList[i]->actions().actionPtr(name());
if (pAction)
pAction->setLabel( text );
}
*/
d->setText( text );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateText( i );
}
void KAction::updateText( int i )
{
QWidget *w = container( i );
- if ( w->inherits( "QPopupMenu" ) ) {
+ if ( w->inherits( "Q3PopupMenu" ) ) {
int id = itemId( i );
- static_cast<QPopupMenu*>(w)->changeItem( id, d->text() );
- updateShortcut( static_cast<QPopupMenu*>(w), id );
+ static_cast<Q3PopupMenu*>(w)->changeItem( id, d->text() );
+ updateShortcut( static_cast<Q3PopupMenu*>(w), id );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() );
else if ( w->inherits( "KToolBar" ) )
{
//qDebug("KAction::updateText ...3 has top be fixed");
QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) );
if ( button->inherits( "KToolBarButton" ) )
static_cast<KToolBarButton *>(button)->setText( d->plainText() );
}
}
QString KAction::text() const
{
return d->text();
}
QString KAction::plainText() const
{
return d->plainText( );
}
void KAction::setIcon( const QString &icon )
{
d->setIconName( icon );
// now handle any toolbars
int len = containerCount();
for ( int i = 0; i < len; ++i )
updateIcon( i );
}
void KAction::updateIcon( int id )
{
QWidget* w = container( id );
- if ( w->inherits( "QPopupMenu" ) ) {
+ if ( w->inherits( "Q3PopupMenu" ) ) {
int itemId_ = itemId( id );
- static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() );
- updateShortcut( static_cast<QPopupMenu*>(w), itemId_ );
+ static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() );
+ updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() );
else if ( w->inherits( "KToolBar" ) )
static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
- else if ( w->inherits( "QToolBar" ) )
+ else if ( w->inherits( "Q3ToolBar" ) )
{
qDebug("KAction::updateIcon has top be fixed");
//US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
}
}
QString KAction::icon() const
{
return d->iconName( );
}
-void KAction::setIconSet( const QIconSet &iconset )
+void KAction::setIconSet( const QIcon &iconset )
{
d->setIconSet( iconset );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateIconSet( i );
}
void KAction::updateIconSet( int id )
{
QWidget *w = container( id );
- if ( w->inherits( "QPopupMenu" ) )
+ if ( w->inherits( "Q3PopupMenu" ) )
{
int itemId_ = itemId( id );
- static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() );
- updateShortcut( static_cast<QPopupMenu*>(w), itemId_ );
+ static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() );
+ updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() );
else if ( w->inherits( "KToolBar" ) )
{
if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better )
static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() );
else
static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) );
}
}
-QIconSet KAction::iconSet( KIcon::Group group, int size ) const
+QIcon KAction::iconSet( KIcon::Group group, int size ) const
{
return d->iconSet( group, size );
}
bool KAction::hasIcon() const
{
return d->hasIcon();
}
void KAction::setWhatsThis( const QString& text )
{
d->setWhatsThis( text );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateWhatsThis( i );
}
void KAction::updateWhatsThis( int i )
{
qDebug("KAction::updateWhatsThis ...1 has top be fixed");
- QPopupMenu* pm = popupMenu( i );
+ Q3PopupMenu* pm = popupMenu( i );
if ( pm )
{
pm->setWhatsThis( itemId( i ), d->whatsThis() );
return;
}
KToolBar *tb = toolBar( i );
if ( tb )
{
QWidget *w = tb->getButton( itemId( i ) );
//US QWhatsThis::remove( w );
//US QWhatsThis::add( w, d->whatsThis() );
return;
}
}
QString KAction::whatsThis() const
{
return d->whatsThis();
}
QString KAction::whatsThisWithIcon() const
{
QString text = whatsThis();
if (!d->iconName().isEmpty())
return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text);
return text;
}
QWidget* KAction::container( int index ) const
{
assert( index < containerCount() );
return d->m_containers[ index ].m_container;
}
KToolBar* KAction::toolBar( int index ) const
{
//US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container );
return (KToolBar *)( d->m_containers[ index ].m_container );
}
-QPopupMenu* KAction::popupMenu( int index ) const
+Q3PopupMenu* KAction::popupMenu( int index ) const
{
//US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container );
- return (QPopupMenu *)( d->m_containers[ index ].m_container );
+ return (Q3PopupMenu *)( d->m_containers[ index ].m_container );
}
QWidget* KAction::representative( int index ) const
{
return d->m_containers[ index ].m_representative;
}
int KAction::itemId( int index ) const
{
return d->m_containers[ index ].m_id;
}
int KAction::containerCount() const
{
return d->m_containers.count();
}
uint KAction::kaccelCount() const
{
return d->m_kaccelList.count();
}
void KAction::addContainer( QWidget* c, int id )
{
KActionPrivate::Container p;
p.m_container = c;
p.m_id = id;
d->m_containers.append( p );
}
void KAction::addContainer( QWidget* c, QWidget* w )
{
@@ -1126,80 +1129,80 @@ void KAction::slotDestroyed()
// KDE 4: remove
if ( o == d->m_kaccel )
{
d->m_kaccel = 0;
return;
}
// KDE 4: remove end
for( uint i = 0; i < d->m_kaccelList.count(); i++ )
{
if ( o == d->m_kaccelList[i] )
{
disconnect( d->m_kaccelList[i], SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
return;
}
}
*/
int i;
do
{
i = findContainer( static_cast<const QWidget*>( o ) );
if ( i != -1 )
removeContainer( i );
} while ( i != -1 );
}
int KAction::findContainer( const QWidget* widget ) const
{
int pos = 0;
- QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin();
+ Q3ValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin();
while( it != d->m_containers.end() )
{
if ( (*it).m_representative == widget || (*it).m_container == widget )
return pos;
++it;
++pos;
}
return -1;
}
void KAction::removeContainer( int index )
{
int i = 0;
- QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin();
+ Q3ValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin();
while( it != d->m_containers.end() )
{
if ( i == index )
{
d->m_containers.remove( it );
return;
}
++it;
++i;
}
}
// FIXME: Remove this (ellis)
void KAction::slotKeycodeChanged()
{
qDebug("KAction::slotKeycodeChanged() ...44 has top be fixed");
/*US
kdDebug(129) << "KAction::slotKeycodeChanged()" << endl; // -- ellis
KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
if( pAction )
setShortcut(pAction->shortcut());
*/
}
KActionCollection *KAction::parentCollection() const
{
return m_parentCollection;
}
void KAction::unplugAll()
{
while ( containerCount() != 0 )
diff --git a/microkde/kdeui/kaction.h b/microkde/kdeui/kaction.h
index 13e2e1e..5c690ec 100644
--- a/microkde/kdeui/kaction.h
+++ b/microkde/kdeui/kaction.h
@@ -1,78 +1,80 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef __kaction_h__
#define __kaction_h__
//US #include <qkeysequence.h>
#include <qobject.h>
-#include <qvaluelist.h>
-#include <qguardedptr.h>
+#include <q3valuelist.h>
+#include <qpointer.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
#include <kguiitem.h>
#include <kshortcut.h>
#include <kstdaction.h>
//US#include <kicontheme.h>
//US added the following files
#include <kiconloader.h>
class QMenuBar;
-class QPopupMenu;
+class Q3PopupMenu;
//USclass QComboBox;
//USclass QPoint;
-class QIconSet;
+class QIcon;
class QString;
class KToolBar;
class KAccel;
//USclass KAccelActions;
//USclass KConfig;
//USclass KConfigBase;
//USclass KURL;
//USclass KInstance;
//USclass KToolBar;
class KActionCollection;
//USclass KPopupMenu;
class KMainWindow;
/**
* The KAction class (and derived and super classes) provides a way to
* easily encapsulate a "real" user-selected action or event in your
* program.
*
* For instance, a user may want to @p paste the contents of
* the clipboard or @p scroll @p down a document or @p quit the
* application. These are all @p actions -- events that the
* user causes to happen. The KAction class allows the developer to
* deal with these actions in an easy and intuitive manner.
*
* Specifically, the KAction class encapsulated the various attributes
* to an event/action. For instance, an action might have an icon
* that goes along with it (a clipboard for a "paste" action or
* scissors for a "cut" action). The action might have some text to
* describe the action. It will certainly have a method or function
* that actually @p executes the action! All these attributes
* are contained within the KAction object.
@@ -230,124 +232,124 @@ public:
* plugged in a toolbar...).
*
* @param text The text that will be displayed.
* @param cut The corresponding keyboard shortcut.
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* Constructs an action with text, icon, potential keyboard
* shortcut, and a SLOT to call when this action is invoked by
* the user.
*
* If you do not want or have a keyboard shortcut, set the
* @p cut param to 0.
*
* This is the other common KAction used. Use it when you
* @p do have a corresponding icon.
*
* @param text The text that will be displayed.
* @param pix The icon to display.
* @param cut The corresponding keyboard shortcut.
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* Constructs an action with text, icon, potential keyboard
* shortcut, and a SLOT to call when this action is invoked by
* the user. The icon is loaded on demand later based on where it
* is plugged in.
*
* If you do not want or have a keyboard shortcut, set the
* @p cut param to 0.
*
* This is the other common KAction used. Use it when you
* @p do have a corresponding icon.
*
* @param text The text that will be displayed.
* @param pix The icon to display.
* @param cut The corresponding keyboard shortcut (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* The same as the above constructor, but with a KGuiItem providing
* the text and icon.
*
* @param item The KGuiItem with the label and (optional) icon.
*/
KAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* @obsolete
*/
KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @obsolete
*/
KAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @obsolete
*/
- KAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @obsolete
*/
KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @obsolete
*/
- KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @obsolete
*/
KAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
/**
* @obsolete
*/
KAction( QObject* parent = 0, const char* name = 0 );
/**
* Standard destructor
*/
virtual ~KAction();
/**
* "Plug" or insert this action into a given widget.
*
* This will
* typically be a menu or a toolbar. From this point on, you will
* never need to directly manipulate the item in the menu or
* toolbar. You do all enabling/disabling/manipulation directly
* with your KAction object.
*
* @param w The GUI element to display this action
*/
virtual int plug( QWidget *w, int index = -1 );
/**
* @deprecated. Shouldn't be used. No substitute available.
@@ -432,159 +434,159 @@ public:
virtual const KShortcut& shortcutDefault() const;
// These two methods are for Q_PROPERTY
QString shortcutText() const;
void setShortcutText( const QString& );
/**
* Returns true if this action is enabled.
*/
virtual bool isEnabled() const;
/**
* Returns true if this action's shortcut is configurable.
*/
virtual bool isShortcutConfigurable() const;
virtual QString group() const;
/**
* Get the What's this text for the action.
*/
virtual QString whatsThis() const;
/**
* Get the tooltip text for the action.
*/
virtual QString toolTip() const;
/**
* Get the QIconSet from which the icons used to display this action will
* be chosen.
*/
- virtual QIconSet iconSet( KIcon::Group group, int size=0 ) const;
+ virtual QIcon iconSet( KIcon::Group group, int size=0 ) const;
#ifndef KDE_NO_COMPAT
- QIconSet iconSet() const
+ QIcon iconSet() const
{
return iconSet( KIcon::Small );
}
#endif
virtual QString icon() const;
KActionCollection *parentCollection() const;
/**
* @internal
* Generate a toolbar button id. Made public for reimplementations.
*/
static int getToolButtonID();
void unplugAll();
public slots:
/**
* Sets the text associated with this action. The text is used for menu
* and toolbar labels etc.
*/
virtual void setText(const QString &text);
/**
* Sets the keyboard shortcut associated with this action.
*/
virtual bool setShortcut( const KShortcut& );
virtual void setGroup( const QString& );
/**
* Sets the What's this text for the action. This text will be displayed when
* a widget that has been created by plugging this action into a container
* is clicked on in What's this mode.
*
* The What's this text can include QML markup as well as raw text.
*/
virtual void setWhatsThis( const QString& text );
/**
* Sets the tooltip text for the action.
* This will be used as a tooltip for a toolbar button, as a
* statusbar help-text for a menu item, and it also appears
* in the toolbar editor, to describe the action.
*/
virtual void setToolTip( const QString& );
/**
* Sets the QIconSet from which the icons used to display this action will
* be chosen.
*/
- virtual void setIconSet( const QIconSet &iconSet );
+ virtual void setIconSet( const QIcon &iconSet );
virtual void setIcon( const QString& icon );
/**
* Enables or disables this action. All uses of this action (eg. in menus
* or toolbars) will be updated to reflect the state of the action.
*/
virtual void setEnabled(bool enable);
/**
* Indicate whether the user may configure the action's shortcut.
*/
virtual void setShortcutConfigurable( bool );
/**
* Emulate user's interaction programmatically, by activating the action.
* The implementation simply emits activated().
*/
virtual void activate();
protected slots:
virtual void slotDestroyed();
virtual void slotKeycodeChanged();
virtual void slotActivated();
protected:
KToolBar* toolBar( int index ) const;
- QPopupMenu* popupMenu( int index ) const;
+ Q3PopupMenu* popupMenu( int index ) const;
void removeContainer( int index );
int findContainer( const QWidget* widget ) const;
void plugMainWindowAccel( QWidget *w );
void addContainer( QWidget* parent, int id );
void addContainer( QWidget* parent, QWidget* representative );
virtual void updateShortcut( int i );
- virtual void updateShortcut( QPopupMenu* menu, int id );
+ virtual void updateShortcut( Q3PopupMenu* menu, int id );
virtual void updateGroup( int id );
virtual void updateText(int i );
virtual void updateEnabled(int i);
virtual void updateIconSet(int i);
virtual void updateIcon( int i);
virtual void updateToolTip( int id );
virtual void updateWhatsThis( int i );
KActionCollection *m_parentCollection;
QString whatsThisWithIcon() const;
signals:
void activated();
void enabled( bool );
private:
void initPrivate( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot );
KAccel* kaccelCurrent();
bool initShortcut( const KShortcut& );
void plugShortcut();
bool updateKAccelShortcut( KAccel* kaccel );
void insertKAccel( KAccel* );
/** @internal To be used exclusively by KActionCollection::removeWidget(). */
void removeKAccel( KAccel* );
#ifndef KDE_NO_COMPAT
public:
/**
* @deprecated. Use shortcut().
* Get the keyboard accelerator associated with this action.
*/
diff --git a/microkde/kdeui/kactionclasses.cpp b/microkde/kdeui/kactionclasses.cpp
index 82e6c8b..c611865 100644
--- a/microkde/kdeui/kactionclasses.cpp
+++ b/microkde/kdeui/kactionclasses.cpp
@@ -1,520 +1,521 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2002 Joseph Wenninger <jowenn@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kactionclasses.h"
#include <assert.h>
#include <qfontdatabase.h>
-#include <qobjectlist.h>
+#include <qobject.h>
//US#include <qwhatsthis.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//US#include <kaccel.h>
//US#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
//US#include <kfontcombo.h>
//US#include <kmainwindow.h>
//US#include <kmenubar.h>
//US#include <kpopupmenu.h>
#include <kcombobox.h>
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
#include <kurl.h>
//US added the following includefiles
#include <kconfigbase.h>
#include <qwidget.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qmenubar.h>
-#include <qmainwindow.h>
-#include <qtoolbar.h>
+#include <q3mainwindow.h>
+#include <q3toolbar.h>
#include <qcombobox.h>
-#include <qmainwindow.h>
-
+#include <q3mainwindow.h>
+#include <qcoreapplication.h>
static QFontDatabase *fontDataBase = 0;
static void cleanupFontDatabase()
{
delete fontDataBase;
fontDataBase = 0;
}
static void get_fonts( QStringList &lst )
{
if ( !fontDataBase ) {
fontDataBase = new QFontDatabase();
qAddPostRoutine( cleanupFontDatabase );
}
lst.clear();
QStringList families = fontDataBase->families();
for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
{
QString family = *it;
if ( family. contains('-') ) // remove foundry
family = family.right( family.length() - family.find('-' ) - 1);
if ( !lst.contains( family ) )
lst.append( family );
}
lst.sort();
}
-static QValueList<int> get_standard_font_sizes()
+static Q3ValueList<int> get_standard_font_sizes()
{
if ( !fontDataBase ) {
fontDataBase = new QFontDatabase();
qAddPostRoutine( cleanupFontDatabase );
}
return fontDataBase->standardSizes();
}
class KToggleAction::KToggleActionPrivate
{
public:
KToggleActionPrivate()
{
m_checked = false;
}
bool m_checked;
QString m_exclusiveGroup;
};
KToggleAction::KToggleAction( const QString& text, const KShortcut& cut,
QObject* parent,
const char* name )
: KAction( text, cut, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KAction( text, cut, receiver, slot, parent, name )
{
d = new KToggleActionPrivate;
}
-KToggleAction::KToggleAction( const QString& text, const QIconSet& pix,
+KToggleAction::KToggleAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KToggleActionPrivate;
}
-KToggleAction::KToggleAction( const QString& text, const QIconSet& pix,
+KToggleAction::KToggleAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( QObject* parent, const char* name )
: KAction( parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::~KToggleAction()
{
delete d;
}
int KToggleAction::plug( QWidget* widget, int index )
{
- if ( !widget->inherits("QPopupMenu") && !widget->inherits("KToolBar") )
+ if ( !widget->inherits("Q3PopupMenu") && !widget->inherits("KToolBar") )
{
kdWarning() << "Can not plug KToggleAction in " << widget->className() << endl;
return -1;
}
/*US
if (kapp && !kapp->authorizeKAction(name()))
return -1;
*/
int _index = KAction::plug( widget, index );
if ( _index == -1 )
return _index;
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
int id = itemId( _index );
- static_cast<QPopupMenu*>(widget)->setItemChecked( id, d->m_checked );
+ static_cast<Q3PopupMenu*>(widget)->setItemChecked( id, d->m_checked );
} else if ( widget->inherits( "KToolBar" ) ) {
KToolBar *bar = static_cast<KToolBar *>( widget );
bar->setToggle( itemId( _index ), true );
bar->setButton( itemId( _index ), isChecked() );
}
return _index;
}
void KToggleAction::setChecked( bool c )
{
if ( c == d->m_checked )
return;
//kdDebug(129) << "KToggleAction::setChecked(" << c << ") " << this << " " << name() << endl;
d->m_checked = c;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateChecked( i );
if ( c && parent() && !exclusiveGroup().isEmpty() ) {
- const QObjectList *list = parent()->children();
- if ( list ) {
- QObjectListIt it( *list );
- for( ; it.current(); ++it ) {
- if ( it.current()->inherits( "KToggleAction" ) && it.current() != this &&
- static_cast<KToggleAction*>(it.current())->exclusiveGroup() == exclusiveGroup() ) {
- KToggleAction *a = static_cast<KToggleAction*>(it.current());
+ const QObjectList list = parent()->children();
+ if ( !list.empty() ) {
+ for(QObjectList::const_iterator it=list.begin();it!=list.end();++it) {
+ if ( (*it)->inherits( "KToggleAction" ) && (*it) != this &&
+ static_cast<KToggleAction*>((*it))->exclusiveGroup() == exclusiveGroup() ) {
+ KToggleAction *a = static_cast<KToggleAction*>(*it);
if( a->isChecked() ) {
a->setChecked( false );
emit a->toggled( false );
}
}
}
}
}
}
void KToggleAction::updateChecked( int id )
{
QWidget *w = container( id );
- if ( w->inherits( "QPopupMenu" ) )
- static_cast<QPopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked );
+ if ( w->inherits( "Q3PopupMenu" ) )
+ static_cast<Q3PopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked );
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->setItemChecked( itemId( id ), d->m_checked );
else if ( w->inherits( "KToolBar" ) )
{
QWidget* r = static_cast<KToolBar*>( w )->getButton( itemId( id ) );
if ( r && r->inherits( "KToolBarButton" ) )
static_cast<KToolBar*>( w )->setButton( itemId( id ), d->m_checked );
}
}
void KToggleAction::slotActivated()
{
setChecked( !isChecked() );
emit activated();
emit toggled( isChecked() );
}
bool KToggleAction::isChecked() const
{
return d->m_checked;
}
void KToggleAction::setExclusiveGroup( const QString& name )
{
d->m_exclusiveGroup = name;
}
QString KToggleAction::exclusiveGroup() const
{
return d->m_exclusiveGroup;
}
KRadioAction::KRadioAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: KToggleAction( text, cut, parent, name )
{
}
KRadioAction::KRadioAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KToggleAction( text, cut, receiver, slot, parent, name )
{
}
-KRadioAction::KRadioAction( const QString& text, const QIconSet& pix,
+KRadioAction::KRadioAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, parent, name )
{
}
KRadioAction::KRadioAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, parent, name )
{
}
-KRadioAction::KRadioAction( const QString& text, const QIconSet& pix,
+KRadioAction::KRadioAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, receiver, slot, parent, name )
{
}
KRadioAction::KRadioAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, receiver, slot, parent, name )
{
}
KRadioAction::KRadioAction( QObject* parent, const char* name )
: KToggleAction( parent, name )
{
}
void KRadioAction::slotActivated()
{
if ( isChecked() )
{
const QObject *senderObj = sender();
if ( !senderObj || !senderObj->inherits( "KToolBarButton" ) )
return;
qDebug("KRadioAction::slotActivated has to be fixed");
const_cast<KToolBarButton *>( static_cast<const KToolBarButton *>( senderObj ) )->on( true );
return;
}
KToggleAction::slotActivated();
}
class KSelectAction::KSelectActionPrivate
{
public:
KSelectActionPrivate()
{
m_edit = false;
m_menuAccelsEnabled = true;
m_menu = 0;
m_current = -1;
m_comboWidth = -1;
}
bool m_edit;
bool m_menuAccelsEnabled;
- QPopupMenu *m_menu;
+ Q3PopupMenu *m_menu;
int m_current;
int m_comboWidth;
QStringList m_list;
QString makeMenuText( const QString &_text )
{
if ( m_menuAccelsEnabled )
return _text;
QString text = _text;
uint i = 0;
while ( i < text.length() ) {
if ( text.at( i ) == '&' ) {
text.insert( i, '&' );
i += 2;
}
else
++i;
}
return text;
}
};
KSelectAction::KSelectAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, cut, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KAction( text, cut, receiver, slot, parent, name )
{
d = new KSelectActionPrivate;
}
-KSelectAction::KSelectAction( const QString& text, const QIconSet& pix,
+KSelectAction::KSelectAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KSelectActionPrivate;
}
-KSelectAction::KSelectAction( const QString& text, const QIconSet& pix,
+KSelectAction::KSelectAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( QObject* parent, const char* name )
: KAction( parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::~KSelectAction()
{
assert(d);
delete d->m_menu;
delete d; d = 0;
}
void KSelectAction::setCurrentItem( int id )
{
if ( id >= (int)d->m_list.count() ) {
- ASSERT(id < (int)d->m_list.count());
+ Q_ASSERT(id < (int)d->m_list.count());
return;
}
if ( d->m_menu )
{
if ( d->m_current >= 0 )
d->m_menu->setItemChecked( d->m_current, false );
if ( id >= 0 )
{
//US qDebug("KSelectAction::setCurrentItem %i", id);
d->m_menu->setItemChecked( id, true );
}
}
d->m_current = id;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateCurrentItem( i );
// emit KAction::activated();
// emit activated( currentItem() );
// emit activated( currentText() );
}
void KSelectAction::setComboWidth( int width )
{
if ( width < 0 )
return;
d->m_comboWidth=width;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateComboWidth( i );
}
-QPopupMenu* KSelectAction::popupMenu() const
+Q3PopupMenu* KSelectAction::popupMenu() const
{
kdDebug(129) << "KSelectAction::popupMenu()" << endl; // remove -- ellis
if ( !d->m_menu )
{
//US d->m_menu = new KPopupMenu(0L, "KSelectAction::popupMenu()");
- d->m_menu = new QPopupMenu(0L, "QSelectAction::popupMenu()");
+ d->m_menu = new Q3PopupMenu(0L, "QSelectAction::popupMenu()");
setupMenu();
if ( d->m_current >= 0 )
d->m_menu->setItemChecked( d->m_current, true );
}
return d->m_menu;
}
void KSelectAction::setupMenu() const
{
if ( !d->m_menu )
return;
d->m_menu->clear();
QStringList::ConstIterator it = d->m_list.begin();
for( uint id = 0; it != d->m_list.end(); ++it, ++id ) {
QString text = *it;
if ( !text.isEmpty() )
d->m_menu->insertItem( d->makeMenuText( text ), this, SLOT( slotActivated( int ) ), 0, id );
else
d->m_menu->insertSeparator();
}
}
void KSelectAction::changeItem( int index, const QString& text )
{
if ( index < 0 || index >= (int)d->m_list.count() )
{
kdWarning() << "KSelectAction::changeItem Index out of scope" << endl;
return;
}
@@ -614,104 +615,104 @@ void KSelectAction::updateComboWidth( int id )
}
void KSelectAction::updateItems( int id )
{
kdDebug(129) << "KAction::updateItems( " << id << ", lst )" << endl; // remove -- ellis
QWidget* w = container( id );
if ( w->inherits( "KToolBar" ) ) {
QWidget* r = static_cast<KToolBar*>( w )->getWidget( itemId( id ) );
if ( r->inherits( "QComboBox" ) ) {
QComboBox *cb = static_cast<QComboBox*>( r );
cb->clear();
QStringList lst = comboItems();
QStringList::ConstIterator it = lst.begin();
for( ; it != lst.end(); ++it )
cb->insertItem( *it );
// Ok, this currently doesn't work due to a bug in QComboBox
// (the sizehint is cached for ever and never recalculated)
// Bug reported (against Qt 2.3.1).
cb->setMinimumWidth( cb->sizeHint().width() );
}
}
}
int KSelectAction::plug( QWidget *widget, int index )
{
//US if (kapp && !kapp->authorizeKAction(name()))
//US return -1;
kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
// Create the PopupMenu and store it in m_menu
(void)popupMenu();
- QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget );
int id;
if ( hasIconSet() )
id = menu->insertItem( iconSet(), text(), d->m_menu, -1, index );
else
id = menu->insertItem( text(), d->m_menu, -1, index );
if ( !isEnabled() )
menu->setItemEnabled( id, false );
QString wth = whatsThis();
if ( !wth.isEmpty() )
menu->setWhatsThis( id, wth );
addContainer( menu, id );
connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
else if ( widget->inherits("KToolBar") )
{
KToolBar* bar = static_cast<KToolBar*>( widget );
int id_ = KAction::getToolButtonID();
bar->insertCombo( comboItems(), id_, isEditable(),
SIGNAL( activated( const QString & ) ), this,
SLOT( slotActivated( const QString & ) ), isEnabled(),
toolTip(), -1, index );
KComboBox *cb = bar->getCombo( id_ );
if ( cb )
{
cb->setMaximumHeight( 34 );
- if (!isEditable()) cb->setFocusPolicy(QWidget::NoFocus);
+ if (!isEditable()) cb->setFocusPolicy(Qt::NoFocus);
cb->setMinimumWidth( cb->sizeHint().width() );
if ( d->m_comboWidth > 0 )
{
cb->setMinimumWidth( d->m_comboWidth );
cb->setMaximumWidth( d->m_comboWidth );
}
cb->setInsertionPolicy( QComboBox::NoInsertion );
//US QWhatsThis::add( cb, whatsThis() );
}
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
updateCurrentItem( containerCount() - 1 );
return containerCount() - 1;
}
kdWarning() << "Can not plug KAction in " << widget->className() << endl;
return -1;
}
QStringList KSelectAction::comboItems() const
{
//qDebug("KSelectAction::comboItems has to be fixed");
if( d->m_menuAccelsEnabled )
{
QStringList lst;
QStringList::ConstIterator it = d->m_list.begin();
for( ; it != d->m_list.end(); ++it )
{
@@ -823,81 +824,81 @@ void KSelectAction::setMenuAccelsEnabled( bool b )
bool KSelectAction::menuAccelsEnabled() const
{
return d->m_menuAccelsEnabled;
}
class KListAction::KListActionPrivate
{
public:
KListActionPrivate()
{
m_current = 0;
}
int m_current;
};
KListAction::KListAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, cut, parent, name )
{
d = new KListActionPrivate;
}
KListAction::KListAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, cut, parent, name )
{
d = new KListActionPrivate;
if ( receiver )
connect( this, SIGNAL( activated( int ) ), receiver, slot );
}
-KListAction::KListAction( const QString& text, const QIconSet& pix,
+KListAction::KListAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
}
KListAction::KListAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
}
-KListAction::KListAction( const QString& text, const QIconSet& pix,
+KListAction::KListAction( const QString& text, const QIcon& pix,
const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
if ( receiver )
connect( this, SIGNAL( activated( int ) ), receiver, slot );
}
KListAction::KListAction( const QString& text, const QString& pix,
const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
if ( receiver )
connect( this, SIGNAL( activated( int ) ), receiver, slot );
}
KListAction::KListAction( QObject* parent, const char* name )
: KSelectAction( parent, name )
{
d = new KListActionPrivate;
}
KListAction::~KListAction()
{
delete d; d = 0;
}
@@ -936,91 +937,91 @@ public:
KRecentFilesAction::KRecentFilesAction( const QString& text,
const KShortcut& cut,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
const KShortcut& cut,
const QObject* receiver,
const char* slot,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
if ( receiver )
connect( this, SIGNAL(urlSelected(const KURL&)),
receiver, slot );
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
- const QIconSet& pix,
+ const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
- const QIconSet& pix,
+ const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
if ( receiver )
connect( this, SIGNAL(urlSelected(const KURL&)),
receiver, slot );
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
if ( receiver )
@@ -1172,87 +1173,87 @@ void KRecentFilesAction::itemSelected( const QString& text )
class KFontAction::KFontActionPrivate
{
public:
KFontActionPrivate()
{
}
QStringList m_fonts;
};
KFontAction::KFontAction( const QString& text,
const KShortcut& cut, QObject* parent,
const char* name )
: KSelectAction( text, cut, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, cut, receiver, slot, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
-KFontAction::KFontAction( const QString& text, const QIconSet& pix,
+KFontAction::KFontAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
-KFontAction::KFontAction( const QString& text, const QIconSet& pix,
+KFontAction::KFontAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( QObject* parent, const char* name )
: KSelectAction( parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
@@ -1332,298 +1333,298 @@ int KFontAction::plug( QWidget *w, int index )
return containerCount() - 1;
}
else return KSelectAction::plug( w, index );
*/
return 3;
}
class KFontSizeAction::KFontSizeActionPrivate
{
public:
KFontSizeActionPrivate()
{
}
};
KFontSizeAction::KFontSizeAction( const QString& text,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, cut, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( const QString& text,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, cut, receiver, slot, parent, name )
{
init();
}
-KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix,
+KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
init();
}
-KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix,
+KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( QObject* parent, const char* name )
: KSelectAction( parent, name )
{
init();
}
KFontSizeAction::~KFontSizeAction()
{
delete d;
d = 0;
}
void KFontSizeAction::init()
{
d = new KFontSizeActionPrivate;
setEditable( true );
- QValueList<int> sizes = get_standard_font_sizes();
+ Q3ValueList<int> sizes = get_standard_font_sizes();
QStringList lst;
- for ( QValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it )
+ for ( Q3ValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it )
lst.append( QString::number( *it ) );
setItems( lst );
}
void KFontSizeAction::setFontSize( int size )
{
if ( size == fontSize() ) {
setCurrentItem( items().findIndex( QString::number( size ) ) );
return;
}
if ( size < 1 ) {
kdWarning() << "KFontSizeAction: Size " << size << " is out of range" << endl;
return;
}
int index = items().findIndex( QString::number( size ) );
if ( index == -1 ) {
// Insert at the correct position in the list (to keep sorting)
- QValueList<int> lst;
+ Q3ValueList<int> lst;
// Convert to list of ints
QStringList itemsList = items();
for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it)
lst.append( (*it).toInt() );
// New size
lst.append( size );
// Sort the list
qDebug("KFontSizeAction::setFontSize heapsort not found.");
//US has to be fixed
//US qHeapSort( lst );
// Convert back to string list
QStringList strLst;
- for (QValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it)
+ for (Q3ValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it)
strLst.append( QString::number(*it) );
KSelectAction::setItems( strLst );
// Find new current item
index = lst.findIndex( size );
setCurrentItem( index );
}
else
setCurrentItem( index );
//emit KAction::activated();
//emit activated( index );
//emit activated( QString::number( size ) );
//emit fontSizeChanged( size );
}
int KFontSizeAction::fontSize() const
{
return currentText().toInt();
}
void KFontSizeAction::slotActivated( int index )
{
KSelectAction::slotActivated( index );
emit fontSizeChanged( items()[ index ].toInt() );
}
void KFontSizeAction::slotActivated( const QString& size )
{
setFontSize( size.toInt() ); // insert sorted first
KSelectAction::slotActivated( size );
emit fontSizeChanged( size.toInt() );
}
class KActionMenu::KActionMenuPrivate
{
public:
KActionMenuPrivate()
{
//US m_popup = new KPopupMenu(0L,"KActionMenu::KActionMenuPrivate");
- m_popup = new QPopupMenu(0L,"KActionMenu::KActionMenuPrivate");
+ m_popup = new Q3PopupMenu(0L,"KActionMenu::KActionMenuPrivate");
m_delayed = true;
m_stickyMenu = true;
}
~KActionMenuPrivate()
{
delete m_popup; m_popup = 0;
}
//US KPopupMenu *m_popup;
- QPopupMenu *m_popup;
+ Q3PopupMenu *m_popup;
bool m_delayed;
bool m_stickyMenu;
};
KActionMenu::KActionMenu( QObject* parent, const char* name )
: KAction( parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
KActionMenu::KActionMenu( const QString& text, QObject* parent,
const char* name )
: KAction( text, 0, parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
-KActionMenu::KActionMenu( const QString& text, const QIconSet& icon,
+KActionMenu::KActionMenu( const QString& text, const QIcon& icon,
QObject* parent, const char* name )
: KAction( text, icon, 0, parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
KActionMenu::KActionMenu( const QString& text, const QString& icon,
QObject* parent, const char* name )
: KAction( text, icon, 0, parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
KActionMenu::~KActionMenu()
{
unplugAll();
kdDebug(129) << "KActionMenu::~KActionMenu()" << endl; // ellis
delete d; d = 0;
}
void KActionMenu::popup( const QPoint& global )
{
popupMenu()->popup( global );
}
//US KPopupMenu* KActionMenu::popupMenu() const
-QPopupMenu* KActionMenu::popupMenu() const
+Q3PopupMenu* KActionMenu::popupMenu() const
{
return d->m_popup;
}
void KActionMenu::insert( KAction* cmd, int index )
{
if ( cmd )
cmd->plug( d->m_popup, index );
}
void KActionMenu::remove( KAction* cmd )
{
if ( cmd )
cmd->unplug( d->m_popup );
}
bool KActionMenu::delayed() const {
return d->m_delayed;
}
void KActionMenu::setDelayed(bool _delayed) {
d->m_delayed = _delayed;
}
bool KActionMenu::stickyMenu() const {
return d->m_stickyMenu;
}
void KActionMenu::setStickyMenu(bool sticky) {
d->m_stickyMenu = sticky;
}
int KActionMenu::plug( QWidget* widget, int index )
{
/*US
if (kapp && !kapp->authorizeKAction(name()))
return -1;
*/
kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
- QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget );
int id;
if ( hasIconSet() )
id = menu->insertItem( iconSet(), text(), d->m_popup, -1, index );
else
id = menu->insertItem( text(), d->m_popup, -1, index );
if ( !isEnabled() )
menu->setItemEnabled( id, false );
addContainer( menu, id );
connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
if ( m_parentCollection )
m_parentCollection->connectHighlight( menu, this );
return containerCount() - 1;
}
else if ( widget->inherits( "KToolBar" ) )
{
KToolBar *bar = static_cast<KToolBar *>( widget );
int id_ = KAction::getToolButtonID();
if ( icon().isEmpty() && !iconSet().isNull() )
bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ), isEnabled(), plainText(),
index );
else
{
/*US
KInstance *instance;
@@ -1752,70 +1753,70 @@ int KToolBarPopupAction::plug( QWidget *widget, int index )
/*US
KInstance * instance;
if ( m_parentCollection )
instance = m_parentCollection->instance();
else
instance = KGlobal::instance();
*/
bar->insertButton( icon(), id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ), isEnabled(), plainText(),
index/*US, instance*/ );
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
if (delayed()) {
bar->setDelayedPopup( id_, popupMenu(), stickyMenu() );
} else {
bar->getButton(id_)->setPopup(popupMenu(), stickyMenu());
}
/*US
if ( !whatsThis().isEmpty() )
QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() );
*/
return containerCount() - 1;
}
return KAction::plug( widget, index );
}
//US KPopupMenu *KToolBarPopupAction::popupMenu() const
-QPopupMenu *KToolBarPopupAction::popupMenu() const
+Q3PopupMenu *KToolBarPopupAction::popupMenu() const
{
if ( !m_popup ) {
KToolBarPopupAction *that = const_cast<KToolBarPopupAction*>(this);
//US that->m_popup = new KPopupMenu;
- that->m_popup = new QPopupMenu;
+ that->m_popup = new Q3PopupMenu;
}
return m_popup;
}
////////
KToggleToolBarAction::KToggleToolBarAction( const char* toolBarName,
const QString& text, KActionCollection* parent, const char* name )
: KToggleAction( text, KShortcut(), parent, name )
, m_toolBarName( toolBarName )
, m_toolBar( 0L )
{
}
KToggleToolBarAction::KToggleToolBarAction( KToolBar *toolBar, const QString &text,
KActionCollection *parent, const char *name )
: KToggleAction( text, KShortcut(), parent, name )
, m_toolBarName( 0 )
, m_toolBar( toolBar )
{
}
KToggleToolBarAction::~KToggleToolBarAction()
{
}
int KToggleToolBarAction::plug( QWidget* w, int index )
{
qDebug("KToggleToolBarAction::plug has to be fixed");
/*US
if (kapp && !kapp->authorizeKAction(name()))
return -1;
@@ -1924,88 +1925,88 @@ int KWidgetAction::plug( QWidget* w, int index )
m_widget->reparent( toolBar, QPoint() );
toolBar->insertWidget( id, 0, m_widget, index );
toolBar->setItemAutoSized( id, m_autoSized );
//US QWhatsThis::add( m_widget, whatsThis() );
addContainer( toolBar, id );
connect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) );
connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
void KWidgetAction::unplug( QWidget *w )
{
if( !m_widget || !isPlugged() )
return;
KToolBar* toolBar = (KToolBar*)m_widget->parent();
if ( toolBar == w )
{
disconnect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) );
m_widget->reparent( 0L, QPoint(), false ); // false = showit
}
KAction::unplug( w );
}
void KWidgetAction::slotToolbarDestroyed()
{
//Q_ASSERT( m_widget ); // When exiting the app the widget could be destroyed before the toolbar.
- ASSERT( isPlugged() );
+ Q_ASSERT( isPlugged() );
if( !m_widget || !isPlugged() )
return;
// Don't let a toolbar being destroyed, delete my widget.
m_widget->reparent( 0L, QPoint(), false /*showIt*/ );
}
////////
KActionSeparator::KActionSeparator( QObject *parent, const char *name )
: KAction( parent, name )
{
}
KActionSeparator::~KActionSeparator()
{
}
int KActionSeparator::plug( QWidget *widget, int index )
{
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
- QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget );
int id = menu->insertSeparator( index );
addContainer( menu, id );
connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
else if ( widget->inherits( "QMenuBar" ) )
{
QMenuBar *menuBar = static_cast<QMenuBar *>( widget );
int id = menuBar->insertSeparator( index );
addContainer( menuBar, id );
connect( menuBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
else if ( widget->inherits( "KToolBar" ) )
{
KToolBar *toolBar = static_cast<KToolBar *>( widget );
int id = toolBar->insertSeparator( index );
// toolBar->addSeparator();
addContainer( toolBar, id );
connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
diff --git a/microkde/kdeui/kactionclasses.h b/microkde/kdeui/kactionclasses.h
index f6e7a0f..a9b9104 100644
--- a/microkde/kdeui/kactionclasses.h
+++ b/microkde/kdeui/kactionclasses.h
@@ -5,158 +5,161 @@
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef __kactionclasses_h__
#define __kactionclasses_h__
#include <kaction.h>
//US#include <qkeysequence.h>
//US#include <qobject.h>
//US#include <qvaluelist.h>
//US#include <qguardedptr.h>
//US#include <kguiitem.h>
#include <kshortcut.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PopupMenu>
//US#include <kstdaction.h>
//US#include <kicontheme.h>
class QMenuBar;
-class QPopupMenu;
+class Q3PopupMenu;
//USclass QComboBox;
//USclass QPoint;
//USclass QIconSet;
//USclass QString;
//USclass KToolBar;
//USclass KAccel;
//USclass KAccelActions;
class KConfig;
//USclass KConfigBase;
class KURL;
//USclass KInstance;
//US class KToolBar needs to be replaced
-class KToolBar;
+#include "ktoolbar.h"
class KActionCollection;
//US class KPopupMenu needs to be replaced
//US class KPopupMenu;
//USclass KMainWindow;
/**
* Checkbox like action.
*
* This action provides two states: checked or not.
*
* @short Checkbox like action.
*/
class KToggleAction : public KAction
{
Q_OBJECT
Q_PROPERTY( bool checked READ isChecked WRITE setChecked )
Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup )
public:
/**
* Constructs a toggle action with text and potential keyboard
* accelerator but nothing else. Use this only if you really
* know what you are doing.
*
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( QObject* parent = 0, const char* name = 0 );
/**
* Destructor
*/
virtual ~KToggleAction();
/**
* "Plug" or insert this action into a given widget.
*
* This will typically be a menu or a toolbar. From this point
* on, you will never need to directly manipulate the item in the
* menu or toolbar. You do all enabling/disabling/manipulation
@@ -217,87 +220,87 @@ class KRadioAction : public KToggleAction
Q_OBJECT
public:
/**
* Constructs a radio action with text and potential keyboard
* accelerator but nothing else. Use this only if you really
* know what you are doing.
*
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( QObject* parent = 0, const char* name = 0 );
protected:
virtual void slotActivated();
protected:
virtual void virtual_hook( int id, void* data );
private:
class KRadioActionPrivate;
KRadioActionPrivate *d;
};
/**
@@ -323,151 +326,151 @@ class KSelectAction : public KAction
public:
/**
* Constructs a select action with text and potential keyboard
* accelerator but nothing else. Use this only if you really
* know what you are doing.
*
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( QObject* parent = 0, const char* name = 0 );
/**
* Destructor
*/
virtual ~KSelectAction();
/**
* "Plug" or insert this action into a given widget.
*
* This will typically be a menu or a toolbar.
* From this point on, you will never need to directly
* manipulate the item in the menu or toolbar.
* You do all enabling/disabling/manipulation directly with your KSelectAction object.
*
* @param widget The GUI element to display this action.
* @param index The index of the item.
*/
virtual int plug( QWidget* widget, int index = -1 );
/**
* When this action is plugged into a toolbar, it creates a combobox.
* @return true if the combo editable.
*/
virtual bool isEditable() const;
/**
* @return the items that can be selected with this action.
* Use setItems to set them.
*/
virtual QStringList items() const;
virtual void changeItem( int index, const QString& text );
virtual QString currentText() const;
virtual int currentItem() const;
/**
* When this action is plugged into a toolbar, it creates a combobox.
* This returns the maximum width set by setComboWidth
*/
virtual int comboWidth() const;
- QPopupMenu* popupMenu() const;
+ Q3PopupMenu* popupMenu() const;
/**
* Deprecated. See @ref setMenuAccelsEnabled .
* @since 3.1
*/
void setRemoveAmpersandsInCombo( bool b );
/// @since 3.1
bool removeAmpersandsInCombo() const;
/**
* Sets whether any occurence of the ampersand character ( &amp; ) in items
* should be interpreted as keyboard accelerator for items displayed in a
* menu or not.
* @since 3.1
*/
void setMenuAccelsEnabled( bool b );
/// @since 3.1
bool menuAccelsEnabled() const;
public slots:
/**
* Sets the currently checked item.
*
* @param index Index of the item (remember the first item is zero).
*/
virtual void setCurrentItem( int index );
/**
* Sets the items to be displayed in this action
* You need to call this.
*/
virtual void setItems( const QStringList &lst );
@@ -538,87 +541,87 @@ class KListAction : public KSelectAction
public:
/**
* Constructs a list action with text and potential keyboard
* accelerator but nothing else. Use this only if you really
* know what you are doing.
*
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KListAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KListAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( QObject* parent = 0, const char* name = 0 );
/**
* Destructor
*/
virtual ~KListAction();
virtual QString currentText() const;
virtual int currentItem() const;
@@ -656,92 +659,92 @@ public:
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke when a URL is selected.
* Its signature is of the form slotURLSelected( const KURL & ).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
- KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke when a URL is selected.
* Its signature is of the form slotURLSelected( const KURL & ).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
- KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke when a URL is selected.
* Its signature is of the form slotURLSelected( const KURL & ).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( QObject* parent = 0, const char* name = 0,
uint maxItems = 10 );
/**
* Destructor.
*/
virtual ~KRecentFilesAction();
@@ -805,173 +808,173 @@ signals:
/**
* This signal gets emited when the user selects an URL.
*
* @param url The URL thats the user selected.
*/
void urlSelected( const KURL& url );
protected slots:
/**
*
*/
void itemSelected( const QString& string );
protected:
virtual void virtual_hook( int id, void* data );
private:
void init();
class KRecentFilesActionPrivate;
KRecentFilesActionPrivate *d;
};
class KFontAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY( QString font READ font WRITE setFont )
public:
KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
const char* name = 0 );
KFontAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
- KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
- KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
KFontAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
KFontAction( QObject* parent = 0, const char* name = 0 );
~KFontAction();
QString font() const {
return currentText();
}
int plug( QWidget*, int index = -1 );
public slots:
void setFont( const QString &family );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KFontActionPrivate;
KFontActionPrivate *d;
};
class KFontSizeAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
public:
KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
const char* name = 0 );
KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent, const char* name = 0 );
- KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
- KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
KFontSizeAction( QObject* parent = 0, const char* name = 0 );
virtual ~KFontSizeAction();
virtual int fontSize() const;
public slots:
virtual void setFontSize( int size );
protected slots:
virtual void slotActivated( int );
virtual void slotActivated( const QString& );
virtual void slotActivated() { KAction::slotActivated(); }
signals:
void fontSizeChanged( int );
private:
void init();
protected:
virtual void virtual_hook( int id, void* data );
private:
class KFontSizeActionPrivate;
KFontSizeActionPrivate *d;
};
/**
* A KActionMenu is an action that holds a sub-menu of other actions.
* insert() and remove() allow to insert and remove actions into this action-menu.
* Plugged in a popupmenu, it will create a submenu.
* Plugged in a toolbar, it will create a button with a popup menu.
*
* This is the action used by the XMLGUI since it holds other actions.
* If you want a submenu for selecting one tool among many (without icons), see KSelectAction.
* See also setDelayed about the main action.
*/
class KActionMenu : public KAction
{
Q_OBJECT
Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
public:
KActionMenu( const QString& text, QObject* parent = 0,
const char* name = 0 );
- KActionMenu( const QString& text, const QIconSet& icon,
+ KActionMenu( const QString& text, const QIcon& icon,
QObject* parent = 0, const char* name = 0 );
KActionMenu( const QString& text, const QString& icon,
QObject* parent = 0, const char* name = 0 );
KActionMenu( QObject* parent = 0, const char* name = 0 );
virtual ~KActionMenu();
virtual void insert( KAction*, int index = -1 );
virtual void remove( KAction* );
//US KPopupMenu* popupMenu() const;
- QPopupMenu* popupMenu() const;
+ Q3PopupMenu* popupMenu() const;
void popup( const QPoint& global );
/**
* Returns true if this action creates a delayed popup menu
* when plugged in a KToolbar.
*/
bool delayed() const;
/**
* If set to true, this action will create a delayed popup menu
* when plugged in a KToolbar. Otherwise it creates a normal popup.
* Default: delayed
*
* Remember that if the "main" action (the toolbar button itself)
* cannot be clicked, then you should call setDelayed(false).
*
* On the opposite, if the main action can be clicked, it can only happen
* in a toolbar: in a menu, the parent of a submenu can't be activated.
* To get a "normal" menu item when plugged a menu (and no submenu)
* use KToolBarPopupAction.
*/
void setDelayed(bool _delayed);
/**
* Returns true if this action creates a sticky popup menu.
* See @ref setStickyMenu.
*/
bool stickyMenu() const;
/**
* If set to true, this action will create a sticky popup menu
* when plugged in a KToolbar.
* "Sticky", means it's visible until a selection is made or the mouse is
* clicked elsewhere. This feature allows you to make a selection without
@@ -1038,186 +1041,186 @@ public:
QObject* parent = 0, const char* name = 0 );
/**
* Create a KToolBarPopupAction, with a KGuiItem, an accelerator,
* a slot connected to the action, parent and name. The text and the
* icon are taken from the KGuiItem.
*
* If you do not want or have a keyboard accelerator, set the
* @p cut param to 0.
*
* @param item The text and icon that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's owner.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
virtual ~KToolBarPopupAction();
virtual int plug( QWidget *widget, int index = -1 );
/**
* The popup menu that is shown when clicking (some time) on the toolbar
* button. You may want to plug items into it on creation, or connect to
* aboutToShow for a more dynamic menu.
*/
//US KPopupMenu *popupMenu() const;
- QPopupMenu *popupMenu() const;
+ Q3PopupMenu *popupMenu() const;
/**
* Returns true if this action creates a delayed popup menu
* when plugged in a KToolbar.
*/
bool delayed() const;
/**
* If set to true, this action will create a delayed popup menu
* when plugged in a KToolbar. Otherwise it creates a normal popup.
* Default: delayed.
*/
void setDelayed(bool delayed);
/**
* Returns true if this action creates a sticky popup menu.
* See @ref setStickyMenu.
*/
bool stickyMenu() const;
/**
* If set to true, this action will create a sticky popup menu
* when plugged in a KToolbar.
* "Sticky", means it's visible until a selection is made or the mouse is
* clicked elsewhere. This feature allows you to make a selection without
* having to press and hold down the mouse while making a selection.
* Only available if delayed() is true.
* Default: sticky.
*/
void setStickyMenu(bool sticky);
private:
//US KPopupMenu *m_popup;
- QPopupMenu *m_popup;
+ Q3PopupMenu *m_popup;
bool m_delayed:1;
bool m_stickyMenu:1;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KToolBarPopupActionPrivate;
KToolBarPopupActionPrivate *d;
};
/**
* An action that takes care of everything associated with
* showing or hiding a toolbar by a menu action. It will
* show or hide the toolbar with the given name when
* activated, and check or uncheck itself if the toolbar
* is manually shown or hidden.
*
* If you need to perfom some additional action when the
* toolbar is shown or hidden, connect to the toggled(bool)
* signal. It will be emitted after the toolbar's
* visibility has changed, whenever it changes.
* @since 3.1
*/
class KToggleToolBarAction : public KToggleAction
{
Q_OBJECT
public:
/**
* Create a KToggleToolbarAction that manages the toolbar
* named toolBarName. This can be either the name of a
* toolbar in an xml ui file, or a toolbar programmatically
* created with that name.
*/
KToggleToolBarAction( const char* toolBarName, const QString& text,
KActionCollection* parent, const char* name );
KToggleToolBarAction( KToolBar *toolBar, const QString &text,
KActionCollection *parent, const char *name );
virtual ~KToggleToolBarAction();
virtual int plug( QWidget*, int index = -1 );
KToolBar *toolBar() {
return m_toolBar;
}
public slots:
virtual void setChecked( bool );
private:
- QCString m_toolBarName;
- QGuardedPtr<KToolBar> m_toolBar;
+ Q3CString m_toolBarName;
+ QPointer<KToolBar> m_toolBar;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KToggleToolBarActionPrivate;
KToggleToolBarActionPrivate *d;
};
/**
* An action that automatically embeds a widget into a
* toolbar.
*/
class KWidgetAction : public KAction
{
Q_OBJECT
public:
/**
* Create an action that will embed widget into a toolbar
* when plugged. This action may only be plugged into
* a toolbar.
*/
KWidgetAction( QWidget* widget, const QString& text,
const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
virtual ~KWidgetAction();
/**
* Returns the widget associated with this action.
*/
QWidget* widget() { return m_widget; }
void setAutoSized( bool );
/**
* Plug the action. The widget passed to the constructor
* will be reparented to w, which must inherit KToolBar.
*/
virtual int plug( QWidget* w, int index = -1 );
/**
* Unplug the action. Ensures that the action is not
* destroyed. It will be hidden and reparented to 0L instead.
*/
virtual void unplug( QWidget *w );
protected slots:
void slotToolbarDestroyed();
private:
- QGuardedPtr<QWidget> m_widget;
+ QPointer<QWidget> m_widget;
bool m_autoSized;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KWidgetActionPrivate;
KWidgetActionPrivate *d;
};
class KActionSeparator : public KAction
{
Q_OBJECT
public:
KActionSeparator( QObject* parent = 0, const char* name = 0 );
virtual ~KActionSeparator();
virtual int plug( QWidget*, int index = -1 );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KActionSeparatorPrivate;
KActionSeparatorPrivate *d;
};
#endif
diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp
index 69e5d02..4d66c7f 100644
--- a/microkde/kdeui/kactioncollection.cpp
+++ b/microkde/kdeui/kactioncollection.cpp
@@ -1,168 +1,170 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2002 Joseph Wenninger <jowenn@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kactioncollection.h"
//US#include "kactionshortcutlist.h"
-#include <qptrdict.h>
+#include <q3ptrdict.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//US#include <qvariant.h>
//US#include <kaccel.h>
//US#include <kaccelbase.h>
//US#include <kapplication.h>
#include <kdebug.h>
//US#include <kxmlguifactory.h>
//US I included the following files
-#include <qasciidict.h>
-#include <qptrlist.h>
+#include <q3asciidict.h>
+#include <q3ptrlist.h>
#include "kaction.h"
#include <kglobal.h>
#include <qobject.h>
#include <qwidget.h>
class KActionCollection::KActionCollectionPrivate
{
public:
KActionCollectionPrivate()
{
//US m_instance = 0;
//m_bOneKAccelOnly = false;
//m_iWidgetCurrent = 0;
m_bAutoConnectShortcuts = true;
m_widget = 0;
m_kaccel = m_builderKAccel = 0;
m_dctHighlightContainers.setAutoDelete( true );
m_highlight = false;
m_currentHighlightAction = 0;
m_statusCleared = true;
}
//US KInstance *m_instance;
//US QString m_sXMLFile;
bool m_bAutoConnectShortcuts;
//bool m_bOneKAccelOnly;
//int m_iWidgetCurrent;
//QValueList<QWidget*> m_widgetList;
//QValueList<KAccel*> m_kaccelList;
- QValueList<KActionCollection*> m_docList;
+ Q3ValueList<KActionCollection*> m_docList;
QWidget *m_widget;
KAccel *m_kaccel;
KAccel *m_builderKAccel;
- QAsciiDict<KAction> m_actionDict;
- QPtrDict< QPtrList<KAction> > m_dctHighlightContainers;
+ Q3AsciiDict<KAction> m_actionDict;
+ Q3PtrDict< Q3PtrList<KAction> > m_dctHighlightContainers;
bool m_highlight;
KAction *m_currentHighlightAction;
bool m_statusCleared;
};
KActionCollection::KActionCollection( QWidget *parent, const char *name /*US,
KInstance *instance */)
: QObject( (QObject*)parent, name )
{
kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis
d = new KActionCollectionPrivate;
if( parent )
setWidget( parent );
//d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
//US setInstance( instance );
}
KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US,
KInstance *instance */)
: QObject( parent, name )
{
kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis
d = new KActionCollectionPrivate;
if( watch )
setWidget( watch );
//d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
//US setInstance( instance );
}
// KDE 4: remove
KActionCollection::KActionCollection( QObject *parent, const char *name /*US,
KInstance *instance */)
: QObject( parent, name )
{
kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis
//US kdBacktrace not available
//US kdDebug(129) << kdBacktrace() << endl;
d = new KActionCollectionPrivate;
//US QWidget* w = dynamic_cast<QWidget*>( parent );
QWidget* w = (QWidget*)( parent );
if( w )
setWidget( w );
//d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
//US setInstance( instance );
}
KActionCollection::KActionCollection( const KActionCollection &copy )
: QObject()
{
kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl;
d = new KActionCollectionPrivate;
*this = copy;
}
// KDE 4: remove end
KActionCollection::~KActionCollection()
{
kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl;
- for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) {
+ for ( Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) {
KAction* pAction = it.current();
if ( pAction->m_parentCollection == this )
pAction->m_parentCollection = 0L;
}
//US delete d->m_kaccel;
//US delete d->m_builderKAccel;
delete d; d = 0;
}
void KActionCollection::setWidget( QWidget* w )
{
//if ( d->m_actionDict.count() > 0 ) {
// kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl;
// kdDebug(129) << kdBacktrace() << endl;
//}
//else
if ( !d->m_widget ) {
d->m_widget = w;
//qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde");
//US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" );
}
else if ( d->m_widget != w )
;
}
void KActionCollection::setAutoConnectShortcuts( bool b )
{
d->m_bAutoConnectShortcuts = b;
}
@@ -336,242 +338,242 @@ void KActionCollection::_insert( KAction* action )
return;
d->m_actionDict.insert( name, action );
emit inserted( action );
}
void KActionCollection::_remove( KAction* action )
{
delete _take( action );
}
KAction* KActionCollection::_take( KAction* action )
{
char unnamed_name[100];
const char *name = action->name();
if( qstrcmp( name, "unnamed" ) == 0 )
{
sprintf(unnamed_name, "unnamed-%p", (void *) action);
name = unnamed_name;
}
KAction *a = d->m_actionDict.take( name );
if ( !a || a != action )
return 0;
emit removed( action );
return a;
}
void KActionCollection::_clear()
{
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
while ( it.current() )
_remove( it.current() );
}
void KActionCollection::insert( KAction* action ) { _insert( action ); }
void KActionCollection::remove( KAction* action ) { _remove( action ); }
KAction* KActionCollection::take( KAction* action ) { return _take( action ); }
void KActionCollection::clear() { _clear(); }
KAccel* KActionCollection::accel() { return kaccel(); }
const KAccel* KActionCollection::accel() const { return kaccel(); }
KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; }
KAction* KActionCollection::action( const char* name, const char* classname ) const
{
KAction* pAction = 0;
if ( !classname && name )
pAction = d->m_actionDict[ name ];
else {
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
{
if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) &&
( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) {
pAction = it.current();
break;
}
}
}
if( !pAction ) {
for( uint i = 0; i < d->m_docList.count() && !pAction; i++ )
pAction = d->m_docList[i]->action( name, classname );
}
return pAction;
}
KAction* KActionCollection::action( int index ) const
{
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
it += index;
return it.current();
// return d->m_actions.at( index );
}
/*US
bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig )
{
return KActionShortcutList(this).readSettings( sConfigGroup, pConfig );
}
bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const
{
return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig );
}
*/
uint KActionCollection::count() const
{
return d->m_actionDict.count();
}
QStringList KActionCollection::groups() const
{
QStringList lst;
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) )
lst.append( it.current()->group() );
return lst;
}
KActionPtrList KActionCollection::actions( const QString& group ) const
{
KActionPtrList lst;
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
if ( it.current()->group() == group )
lst.append( it.current() );
else if ( it.current()->group().isEmpty() && group.isEmpty() )
lst.append( it.current() );
return lst;
}
KActionPtrList KActionCollection::actions() const
{
KActionPtrList lst;
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
lst.append( it.current() );
return lst;
}
/*US we have no instance object. Use KGlobal instead
void KActionCollection::setInstance( KInstance *instance )
{
if ( instance )
d->m_instance = instance;
qDebug("KActionCollection::setInstance has to be fixed");
else
d->m_instance = KGlobal::instance();
}
KInstance *KActionCollection::instance() const
{
return d->m_instance;
}
*/
/*US we have no XML facility in microkde
void KActionCollection::setXMLFile( const QString& sXMLFile )
{
d->m_sXMLFile = sXMLFile;
}
const QString& KActionCollection::xmlFile() const
{
return d->m_sXMLFile;
}
*/
void KActionCollection::setHighlightingEnabled( bool enable )
{
d->m_highlight = enable;
}
bool KActionCollection::highlightingEnabled() const
{
return d->m_highlight;
}
void KActionCollection::connectHighlight( QWidget *container, KAction *action )
{
if ( !d->m_highlight )
return;
- QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
+ Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
if ( !actionList )
{
- actionList = new QPtrList<KAction>;
+ actionList = new Q3PtrList<KAction>;
- if ( container->inherits( "QPopupMenu" ) )
+ if ( container->inherits( "Q3PopupMenu" ) )
{
connect( container, SIGNAL( highlighted( int ) ),
this, SLOT( slotMenuItemHighlighted( int ) ) );
connect( container, SIGNAL( aboutToHide() ),
this, SLOT( slotMenuAboutToHide() ) );
}
//US else if ( container->inherits( "KToolBar" ) )
- else if ( container->inherits( "QToolBar" ) )
+ else if ( container->inherits( "Q3ToolBar" ) )
{
connect( container, SIGNAL( highlighted( int, bool ) ),
this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) );
}
connect( container, SIGNAL( destroyed() ),
this, SLOT( slotDestroyed() ) );
d->m_dctHighlightContainers.insert( container, actionList );
}
actionList->append( action );
}
void KActionCollection::disconnectHighlight( QWidget *container, KAction *action )
{
if ( !d->m_highlight )
return;
- QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
+ Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
if ( !actionList )
return;
actionList->removeRef( action );
if ( actionList->count() == 0 )
d->m_dctHighlightContainers.remove( container );
}
void KActionCollection::slotMenuItemHighlighted( int id )
{
if ( !d->m_highlight )
return;
if ( d->m_currentHighlightAction )
emit actionHighlighted( d->m_currentHighlightAction, false );
QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) );
d->m_currentHighlightAction = findAction( container, id );
if ( !d->m_currentHighlightAction )
{
if ( !d->m_statusCleared )
emit clearStatusText();
d->m_statusCleared = true;
return;
}
d->m_statusCleared = false;
emit actionHighlighted( d->m_currentHighlightAction );
@@ -596,110 +598,110 @@ void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight )
return;
QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) );
KAction *action = findAction( container, id );
if ( !action )
{
d->m_currentHighlightAction = 0;
// use tooltip groups for toolbar status text stuff instead (Simon)
// emit clearStatusText();
return;
}
emit actionHighlighted( action, highlight );
if ( highlight )
d->m_currentHighlightAction = action;
else
{
d->m_currentHighlightAction = 0;
// emit clearStatusText();
}
}
void KActionCollection::slotDestroyed()
{
d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) );
}
KAction *KActionCollection::findAction( QWidget *container, int id )
{
- QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ];
+ Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ];
if ( !actionList )
return 0;
- QPtrListIterator<KAction> it( *actionList );
+ Q3PtrListIterator<KAction> it( *actionList );
for (; it.current(); ++it )
if ( it.current()->isPlugged( container, id ) )
return it.current();
return 0;
}
// KDE 4: remove
KActionCollection KActionCollection::operator+(const KActionCollection &c ) const
{
kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl;
KActionCollection ret( *this );
- QValueList<KAction *> actions = c.actions();
- QValueList<KAction *>::ConstIterator it = actions.begin();
- QValueList<KAction *>::ConstIterator end = actions.end();
+ Q3ValueList<KAction *> actions = c.actions();
+ Q3ValueList<KAction *>::ConstIterator it = actions.begin();
+ Q3ValueList<KAction *>::ConstIterator end = actions.end();
for (; it != end; ++it )
ret.insert( *it );
return ret;
}
KActionCollection &KActionCollection::operator=( const KActionCollection &copy )
{
kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl;
//d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly;
//d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent;
//d->m_widgetList = copy.d->m_widgetList;
//d->m_kaccelList = copy.d->m_kaccelList;
d->m_widget = copy.d->m_widget;
d->m_kaccel = copy.d->m_kaccel;
d->m_actionDict = copy.d->m_actionDict;
//US setInstance( copy.instance() );
return *this;
}
KActionCollection &KActionCollection::operator+=( const KActionCollection &c )
{
kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl;
- QAsciiDictIterator<KAction> it(c.d->m_actionDict);
+ Q3AsciiDictIterator<KAction> it(c.d->m_actionDict);
for ( ; it.current(); ++it )
insert( it.current() );
return *this;
}
// KDE 4: remove end
//---------------------------------------------------------------------
// KActionShortcutList
//---------------------------------------------------------------------
/*US
KActionShortcutList::KActionShortcutList( KActionCollection* pColl )
: m_actions( *pColl )
{ }
KActionShortcutList::~KActionShortcutList()
{ }
uint KActionShortcutList::count() const
{ return m_actions.count(); }
QString KActionShortcutList::name( uint i ) const
{ return m_actions.action(i)->name(); }
QString KActionShortcutList::label( uint i ) const
{ return m_actions.action(i)->text(); }
QString KActionShortcutList::whatsThis( uint i ) const
{ return m_actions.action(i)->whatsThis(); }
const KShortcut& KActionShortcutList::shortcut( uint i ) const
{ return m_actions.action(i)->shortcut(); }
const KShortcut& KActionShortcutList::shortcutDefault( uint i ) const
{ return m_actions.action(i)->shortcutDefault(); }
bool KActionShortcutList::isConfigurable( uint i ) const
{ return m_actions.action(i)->isShortcutConfigurable(); }
bool KActionShortcutList::setShortcut( uint i, const KShortcut& cut )
{ return m_actions.action(i)->setShortcut( cut ); }
diff --git a/microkde/kdeui/kactioncollection.h b/microkde/kdeui/kactioncollection.h
index b9466d0..50cb02a 100644
--- a/microkde/kdeui/kactioncollection.h
+++ b/microkde/kdeui/kactioncollection.h
@@ -1,95 +1,97 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
(C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 2000 Nicolas Hadacek <haadcek@kde.org>
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef __kactioncollection_h__
#define __kactioncollection_h__
#include <kaction.h>
//US #include <qkeysequence.h>
#include <qobject.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//US#include <qvaluelist.h>
//US#include <qguardedptr.h>
//US #include <kguiitem.h>
//US#include <kshortcut.h>
//US#include <kstdaction.h>
//US#include <kicontheme.h>
//USclass QMenuBar;
//USclass QPopupMenu;
//USclass QComboBox;
//USclass QPoint;
//USclass QIconSet;
//USclass QString;
//USclass KToolBar;
//USclass KAccel;
//USclass KAccelActions;
//USclass KConfig;
//USclass KConfigBase;
//USclass KURL;
//USclass KInstance;
//USclass KToolBar;
//USclass KActionCollection;
//USclass KPopupMenu;
//USclass KMainWindow;
//US added inclidefiles
class QWidget;
-typedef QValueList<KAction *> KActionPtrList;
+typedef Q3ValueList<KAction *> KActionPtrList;
/**
* A managed set of KAction objects.
*/
class KActionCollection : public QObject
{
friend class KAction;
friend class KXMLGUIClient;
Q_OBJECT
public:
KActionCollection( QWidget *parent, const char *name = 0/*US , KInstance *instance = 0 */);
/**
* Use this constructor if you want the collection's actions to restrict
* their accelerator keys to @p watch rather than the @p parent. If
* you don't require shortcuts, you can pass a null to the @p watch parameter.
*/
KActionCollection( QWidget *watch, QObject* parent, const char *name = 0/*US, KInstance *instance = 0 */);
KActionCollection( const KActionCollection &copy );
virtual ~KActionCollection();
/**
* This sets the widget to which the keyboard shortcuts should be attached.
* You only need to call this if a null pointer was passed in the constructor.
*/
virtual void setWidget( QWidget *widget );
/**
* This indicates whether new actions which are created in this collection
* should have their keyboard shortcuts automatically connected on
* construction. Set to 'false' if you will be loading XML-based settings.
* This is automatically done by KParts. The default is 'true'.
diff --git a/microkde/kdeui/kbuttonbox.cpp b/microkde/kdeui/kbuttonbox.cpp
index 83d622a..3ea6703 100644
--- a/microkde/kdeui/kbuttonbox.cpp
+++ b/microkde/kdeui/kbuttonbox.cpp
@@ -20,89 +20,91 @@
/*
* KButtonBox class
*
* A container widget for buttons. Uses Qt layout control to place the
* buttons, can handle both vertical and horizontal button placement.
*
* HISTORY
*
* 03/08/2000 Mario Weilguni <mweilguni@kde.org>
* Removed all those long outdated Motif stuff
* Improved and clarified some if conditions (easier to understand)
*
* 11/13/98 Reginald Stadlbauer <reggie@kde.org>
* Now in Qt 1.4x motif default buttons have no extra width/height anymore.
* So the KButtonBox doesn't add this width/height to default buttons anymore
* which makes the buttons look better.
*
* 01/17/98 Mario Weilguni <mweilguni@sime.com>
* Fixed a bug in sizeHint()
* Improved the handling of Motif default buttons
*
* 01/09/98 Mario Weilguni <mweilguni@sime.com>
* The last button was to far right away from the right/bottom border.
* Fixed this. Removed old code. Buttons get now a minimum width.
* Programmer may now override minimum width and height of a button.
*
*/
//US #include "kbuttonbox.moc"
#include <kbuttonbox.h>
#include <qpushbutton.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QResizeEvent>
#include <assert.h>
#define minButtonWidth 50
class KButtonBox::Item {
public:
QPushButton *button;
bool noexpand;
unsigned short stretch;
unsigned short actual_size;
};
-template class QPtrList<KButtonBox::Item>;
+template class Q3PtrList<KButtonBox::Item>;
class KButtonBoxPrivate {
public:
unsigned short border;
unsigned short autoborder;
unsigned short orientation;
bool activated;
- QPtrList<KButtonBox::Item> buttons;
+ Q3PtrList<KButtonBox::Item> buttons;
};
-KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation,
+KButtonBox::KButtonBox(QWidget *parent, Qt::Orientation _orientation,
int border, int autoborder)
: QWidget(parent)
{
data = new KButtonBoxPrivate;
assert(data != 0);
data->orientation = _orientation;
data->border = border;
data->autoborder = autoborder < 0 ? border : autoborder;
data->buttons.setAutoDelete(TRUE);
}
KButtonBox::~KButtonBox() {
delete data;
}
QPushButton *KButtonBox::addButton(const QString& text, bool noexpand) {
Item *item = new Item;
item->button = new QPushButton(text, this);
item->noexpand = noexpand;
data->buttons.append(item);
item->button->adjustSize();
return item->button;
}
QPushButton *
KButtonBox::addButton(
const QString & text,
QObject * receiver,
const char * slot,
@@ -120,65 +122,65 @@ KButtonBox::addButton(
void KButtonBox::addStretch(int scale) {
if(scale > 0) {
Item *item = new Item;
item->button = 0;
item->noexpand = FALSE;
item->stretch = scale;
data->buttons.append(item);
}
}
void KButtonBox::layout() {
// resize all buttons
QSize bs = bestButtonSize();
for(unsigned int i = 0; i < data->buttons.count(); i++) {
Item *item = data->buttons.at(i);
QPushButton *b = item->button;
if(b != 0) {
if(item->noexpand)
b->setFixedSize(buttonSizeHint(b));
else
b->setFixedSize(bs);
}
}
setMinimumSize(sizeHint());
}
void KButtonBox::placeButtons() {
unsigned int i;
- if(data->orientation == Horizontal) {
+ if(data->orientation == Qt::Horizontal) {
// calculate free size and stretches
int fs = width() - 2 * data->border;
int stretch = 0;
for(i = 0; i < data->buttons.count(); i++) {
Item *item = data->buttons.at(i);
if(item->button != 0) {
fs -= item->button->width();
// Last button?
if(i != data->buttons.count() - 1)
fs -= data->autoborder;
} else
stretch +=item->stretch;
}
// distribute buttons
int x_pos = data->border;
for(i = 0; i < data->buttons.count(); i++) {
Item *item = data->buttons.at(i);
if(item->button != 0) {
QPushButton *b = item->button;
b->move(x_pos, (height() - b->height()) / 2);
x_pos += b->width() + data->autoborder;
} else
x_pos += (int)((((double)fs) * item->stretch) / stretch);
}
} else { // VERTICAL
// calcualte free size and stretches
int fs = height() - 2 * data->border;
int stretch = 0;
for(i = 0; i < data->buttons.count(); i++) {
@@ -222,79 +224,79 @@ QSize KButtonBox::bestButtonSize() const {
QSize bs = buttonSizeHint(b);
if(bs.width() > s.width())
s.setWidth(bs.width());
if(bs.height() > s.height())
s.setHeight(bs.height());
}
}
return s;
}
QSize KButtonBox::sizeHint() const {
unsigned int i, dw;
if(data->buttons.count() == 0)
return QSize(0, 0);
else {
dw = 2 * data->border;
QSize bs = bestButtonSize();
for(i = 0; i < data->buttons.count(); i++) {
KButtonBox *that = (KButtonBox*)this;
Item *item = that->data->buttons.at(i);
QPushButton *b = item->button;
if(b != 0) {
QSize s;
if(item->noexpand)
s = that->buttonSizeHint(b);
else
s = bs;
- if(data->orientation == Horizontal)
+ if(data->orientation == Qt::Horizontal)
dw += s.width();
else
dw += s.height();
if( i != data->buttons.count() - 1 )
dw += data->autoborder;
}
}
- if(data->orientation == Horizontal)
+ if(data->orientation == Qt::Horizontal)
return QSize(dw, bs.height() + 2 * data->border);
else
return QSize(bs.width() + 2 * data->border, dw);
}
}
QSizePolicy KButtonBox::sizePolicy() const
{
- return data->orientation == Horizontal?
+ return data->orientation == Qt::Horizontal?
QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) :
QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum );
}
/*
* Returns the best size for a button. If a button is less than
* minButtonWidth pixels wide, return minButtonWidth pixels
* as minimum width
*/
QSize KButtonBox::buttonSizeHint(QPushButton *b) const {
QSize s = b->sizeHint();
QSize ms = b->minimumSize();
if(s.width() < minButtonWidth)
s.setWidth(minButtonWidth);
// allows the programmer to override the settings
if(ms.width() > s.width())
s.setWidth(ms.width());
if(ms.height() > s.height())
s.setHeight(ms.height());
return s;
}
void KButtonBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
diff --git a/microkde/kdeui/kbuttonbox.h b/microkde/kdeui/kbuttonbox.h
index 1104366..2e0f41d 100644
--- a/microkde/kdeui/kbuttonbox.h
+++ b/microkde/kdeui/kbuttonbox.h
@@ -1,83 +1,85 @@
/* This file is part of the KDE libraries
Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __KBUTTONBOX__H__
#define __KBUTTONBOX__H__
#include <qwidget.h>
+//Added by qt3to4:
+#include <QResizeEvent>
class QPushButton;
class KButtonBoxPrivate;
/**
* Container widget for buttons.
*
* This class uses Qt layout control to place the buttons; can handle
* both vertical and horizontal button placement. The default border
* is now @p 0 (making it easier to deal with layouts). The space
* between buttons is now more Motif compliant.
*
* @author Mario Weilguni <mweilguni@sime.com>
* @version $Id$
**/
class KButtonBox : public QWidget
{
Q_OBJECT
public:
/**
* Create an empty container for buttons.
*
* If @p _orientation is @p Vertical, the buttons inserted with
* @ref addButton() are laid out from top to bottom, otherwise they
* are laid out from left to right.
*/
- KButtonBox(QWidget *parent, Orientation _orientation = Horizontal,
+ KButtonBox(QWidget *parent, Qt::Orientation _orientation = Qt::Horizontal,
int border = 0, int _autoborder = 6);
/**
* Free private data field
*/
~KButtonBox();
/**
* @return The minimum size needed to fit all buttons.
*
* This size is
* calculated by the width/height of all buttons plus border/autoborder.
*/
virtual QSize sizeHint() const;
/**
* @reimplemented
*/
virtual QSizePolicy sizePolicy() const;
/**
* @reimplemented
*/
virtual void resizeEvent(QResizeEvent *);
/**
* Add a new @ref QPushButton.
*
* @param noexpand If @p noexpand is @p false, the width
* of the button is adjusted to fit the other buttons (the maximum
* of all buttons is taken). If @p noexpand is @p true, the width of this
* button will be set to the minimum width needed for the given text).
*
* @return A pointer to the new button.
diff --git a/microkde/kdeui/kguiitem.cpp b/microkde/kdeui/kguiitem.cpp
index 828c5e6..c91ffb7 100644
--- a/microkde/kdeui/kguiitem.cpp
+++ b/microkde/kdeui/kguiitem.cpp
@@ -1,205 +1,205 @@
/* This file is part of the KDE libraries
Copyright (C) 2001 Holger Freyther (freyher@yahoo.com)
based on ideas from Martijn and Simon
many thanks to Simon
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qregexp.h>
#include <qstring.h>
-#include <qiconset.h>
+#include <qicon.h>
#include <qpixmap.h>
#include <assert.h>
//US #include <kiconloader.h>
#include <kdebug.h>
#include "kguiitem.h"
class KGuiItem::KGuiItemPrivate
{
public:
KGuiItemPrivate()
{
m_enabled = true;
m_hasIcon = false;
}
KGuiItemPrivate( const KGuiItemPrivate &rhs )
{
(*this ) = rhs;
}
KGuiItemPrivate &operator=( const KGuiItemPrivate &rhs )
{
m_text = rhs.m_text;
m_iconSet = rhs.m_iconSet;
m_iconName = rhs.m_iconName;
m_toolTip = rhs.m_toolTip;
m_whatsThis = rhs.m_whatsThis;
m_statusText = rhs.m_statusText;
m_enabled = rhs.m_enabled;
m_hasIcon = rhs.m_hasIcon;
return *this;
}
QString m_text;
QString m_toolTip;
QString m_whatsThis;
QString m_statusText;
QString m_iconName;
- QIconSet m_iconSet;
+ QIcon m_iconSet;
bool m_hasIcon : 1;
bool m_enabled : 1;
};
KGuiItem::KGuiItem() {
d = new KGuiItemPrivate;
}
KGuiItem::KGuiItem( const QString &text, const QString &iconName,
const QString &toolTip, const QString &whatsThis )
{
d = new KGuiItemPrivate;
d->m_text = text;
d->m_toolTip = toolTip;
d->m_whatsThis = whatsThis;
setIconName( iconName );
}
-KGuiItem::KGuiItem( const QString &text, const QIconSet &iconSet,
+KGuiItem::KGuiItem( const QString &text, const QIcon &iconSet,
const QString &toolTip, const QString &whatsThis )
{
d = new KGuiItemPrivate;
d->m_text = text;
d->m_toolTip = toolTip;
d->m_whatsThis = whatsThis;
setIconSet( iconSet );
}
KGuiItem::KGuiItem( const KGuiItem &rhs )
: d( 0 )
{
(*this) = rhs;
}
KGuiItem &KGuiItem::operator=( const KGuiItem &rhs ) {
if ( d == rhs.d )
return *this;
assert( rhs.d );
delete d;
d = new KGuiItemPrivate( *rhs.d );
return *this;
}
KGuiItem::~KGuiItem() {
delete d;
}
QString KGuiItem::text() const {
return d->m_text;
}
QString KGuiItem::plainText() const {
QString stripped( d->m_text );
stripped.replace( QRegExp( "&(?!&)" ), QString::null );
return stripped;
}
-QIconSet KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const
+QIcon KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const
{
if( d->m_hasIcon )
{
if( !d->m_iconName.isEmpty())
{
// some caching here would(?) come handy
//US return instance->iconLoader()->loadIconSet( d->m_iconName, group, size );
return KGlobal::iconLoader()->loadIconSet( d->m_iconName);
// here is a little problem that with delayed icon loading
// we can't check if the icon really exists ... so what ...
// if( set.isNull() )
// {
// d->m_hasIcon = false;
// return QIconSet();
// }
// return set;
}
else
{
return d->m_iconSet;
}
}
else
- return QIconSet();
+ return QIcon();
}
QString KGuiItem::iconName() const
{
return d->m_iconName;
}
QString KGuiItem::toolTip() const {
return d->m_toolTip;
}
QString KGuiItem::whatsThis() const {
return d->m_whatsThis;
}
bool KGuiItem::isEnabled() const
{
return d->m_enabled;
}
bool KGuiItem::hasIcon() const
{
return d->m_hasIcon;
}
void KGuiItem::setText( const QString &text ) {
d->m_text=text;
}
-void KGuiItem::setIconSet( const QIconSet &iconset )
+void KGuiItem::setIconSet( const QIcon &iconset )
{
d->m_iconSet = iconset;
d->m_iconName = QString::null;
d->m_hasIcon = !iconset.isNull();
}
void KGuiItem::setIconName( const QString &iconName )
{
d->m_iconName = iconName;
- d->m_iconSet = QIconSet();
+ d->m_iconSet = QIcon();
d->m_hasIcon = !iconName.isEmpty();
}
void KGuiItem::setToolTip( const QString &toolTip) {
d->m_toolTip = toolTip;
}
void KGuiItem::setWhatsThis( const QString &whatsThis ) {
d->m_whatsThis = whatsThis;
}
void KGuiItem::setEnabled( bool enabled ){
d->m_enabled = enabled;
}
/* vim: et sw=4
*/
diff --git a/microkde/kdeui/kguiitem.h b/microkde/kdeui/kguiitem.h
index 0079bb4..6f92137 100644
--- a/microkde/kdeui/kguiitem.h
+++ b/microkde/kdeui/kguiitem.h
@@ -1,87 +1,87 @@
/* This file is part of the KDE libraries
Copyright (C) 2001 Holger Freyther (freyher@yahoo.com)
based on ideas from Martijn and Simon
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Many thanks to Simon tronical Hausmann
*/
#ifndef __kguiitem_h__
#define __kguiitem_h__
#include <qstring.h>
-#include <qiconset.h>
+#include <qicon.h>
#include <qpixmap.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
//US#include <kicontheme.h>
#include <kglobal.h>
//US added the following files
#include <kiconloader.h>
class KGuiItem
{
public:
KGuiItem();
KGuiItem( const QString &text,
const QString &iconName = QString::null,
const QString &toolTip = QString::null,
const QString &whatsThis = QString::null );
- KGuiItem( const QString &text, const QIconSet &iconSet,
+ KGuiItem( const QString &text, const QIcon &iconSet,
const QString &toolTip = QString::null,
const QString &whatsThis = QString::null );
KGuiItem( const KGuiItem &rhs );
KGuiItem &operator=( const KGuiItem &rhs );
~KGuiItem();
QString text() const;
QString plainText() const;
- QIconSet iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const;
+ QIcon iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const;
#ifndef KDE_NO_COMPAT
- QIconSet iconSet() const { return iconSet( KIcon::Small); }
+ QIcon iconSet() const { return iconSet( KIcon::Small); }
#endif
QString iconName() const;
QString toolTip() const;
QString whatsThis() const;
bool isEnabled() const;
bool hasIcon() const;
#ifndef KDE_NO_COMPAT
bool hasIconSet() const { return hasIcon(); }
#endif
void setText( const QString &text );
- void setIconSet( const QIconSet &iconset );
+ void setIconSet( const QIcon &iconset );
void setIconName( const QString &iconName );
void setToolTip( const QString &tooltip );
void setWhatsThis( const QString &whatsThis );
void setEnabled( bool enable );
private:
class KGuiItemPrivate;
KGuiItemPrivate *d;
};
/* vim: et sw=4
*/
#endif
diff --git a/microkde/kdeui/kjanuswidget.cpp b/microkde/kdeui/kjanuswidget.cpp
index 462c44f..3d9173d 100644
--- a/microkde/kdeui/kjanuswidget.cpp
+++ b/microkde/kdeui/kjanuswidget.cpp
@@ -1,494 +1,502 @@
/* This file is part of the KDE Libraries
* Copyright (C) 1999-2000 Espen Sand (espensa@online.no)
* Copyright (C) 2003 Ravikiran Rajagopal (ravi@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <qpixmap.h>
#include <qbitmap.h>
#include <qlayout.h>
#include <qlabel.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
#include <qtabwidget.h>
-#include <qlistview.h>
-#include <qhbox.h>
-#include <qvbox.h>
-#include <qgrid.h>
+#include <q3listview.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
+#include <q3grid.h>
#include <qpainter.h>
-#include <qobjectlist.h>
+#include <qobject.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3PtrList>
+#include <Q3Frame>
+#include <QEvent>
+#include <Q3VBoxLayout>
+#include <QShowEvent>
/*US
#include <qbitmap.h>
#include <qgrid.h>
#include <qhbox.h>
#include <qheader.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qobjectlist.h>
#include <qpixmap.h>
#include <qsplitter.h>
#include <qtabwidget.h>
#include <qvbox.h>
#include <qwidgetstack.h>
#include <qpainter.h>
#include <qstyle.h>
#include <kapplication.h>
#include <klocale.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kseparator.h>
#include <kdebug.h>
#include "kjanuswidget.h"
#include <klistview.h>
*/
#include <kseparator.h>
#include <kdialog.h> // Access to some static members
#include <kdebug.h>
#include <klistview.h>
#include "kjanuswidget.h"
-class KJanusWidget::IconListItem : public QListBoxItem
+class KJanusWidget::IconListItem : public Q3ListBoxItem
{
public:
- IconListItem( QListBox *listbox, const QPixmap &pixmap,
+ IconListItem( Q3ListBox *listbox, const QPixmap &pixmap,
const QString &text );
- virtual int height( const QListBox *lb ) const;
- virtual int width( const QListBox *lb ) const;
+ virtual int height( const Q3ListBox *lb ) const;
+ virtual int width( const Q3ListBox *lb ) const;
int expandMinimumWidth( int width );
protected:
const QPixmap &defaultPixmap();
void paint( QPainter *painter );
private:
QPixmap mPixmap;
int mMinimumWidth;
};
class KJanusWidget::KJanusWidgetPrivate
{
public:
KJanusWidgetPrivate() : mNextPageIndex(0) { }
int mNextPageIndex; // The next page index.
// Dictionary for multipage modes.
QMap<int,QWidget*> mIntToPage;
// Reverse dictionary. Used because showPage() may be performance critical.
QMap<QWidget*,int> mPageToInt;
// Dictionary of title string associated with page.
QMap<int, QString> mIntToTitle;
};
-template class QPtrList<QListViewItem>;
+template class Q3PtrList<Q3ListViewItem>;
KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face )
: QWidget( parent, name ),
mValid(false), mPageList(0),
mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0),
mShowIconsInTreeList(false), d(0)
{
- QVBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( this );
if( mFace == TreeList || mFace == IconList )
{
d = new KJanusWidgetPrivate;
- QFrame *page = 0;
+ Q3Frame *page = 0;
if( mFace == TreeList )
{
//US
qDebug("KJanusWidget::KJanusWidget TreeList not implemented yet");
/*US
QSplitter *splitter = new QSplitter( this );
topLayout->addWidget( splitter, 10 );
mTreeListResizeMode = QSplitter::KeepSize;
mTreeList = new KListView( splitter );
mTreeList->addColumn( QString::null );
mTreeList->header()->hide();
mTreeList->setRootIsDecorated(true);
mTreeList->setSorting( -1 );
connect( mTreeList, SIGNAL(selectionChanged()), SLOT(slotShowPage()) );
connect( mTreeList, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *)));
//
// Page area. Title at top with a separator below and a pagestack using
// all available space at bottom.
//
QFrame *p = new QFrame( splitter );
QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 );
hbox->addSpacing( KDialog::marginHint() );
page = new QFrame( p );
hbox->addWidget( page, 10 );
*/
}
else
{
- QHBoxLayout *hbox = new QHBoxLayout( topLayout );
+ Q3HBoxLayout *hbox = new Q3HBoxLayout( topLayout );
mIconList = new IconListBox( this );
QFont listFont( mIconList->font() );
listFont.setBold( true );
mIconList->setFont( listFont );
mIconList->verticalScrollBar()->installEventFilter( this );
hbox->addWidget( mIconList );
connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage()));
hbox->addSpacing( KDialog::marginHint() );
- page = new QFrame( this );
+ page = new Q3Frame( this );
hbox->addWidget( page, 10 );
}
//
// Rest of page area. Title at top with a separator below and a
// pagestack using all available space at bottom.
//
- QVBoxLayout *vbox = new QVBoxLayout( page, 0, KDialog::spacingHint() );
+ Q3VBoxLayout *vbox = new Q3VBoxLayout( page, 0, KDialog::spacingHint() );
mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" );
vbox->addWidget( mTitleLabel );
QFont titleFont( mTitleLabel->font() );
titleFont.setBold( true );
mTitleLabel->setFont( titleFont );
mTitleSep = new KSeparator( page );
- mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain );
+ mTitleSep->setFrameStyle( Q3Frame::HLine|Q3Frame::Plain );
vbox->addWidget( mTitleSep );
- mPageStack = new QWidgetStack( page );
+ mPageStack = new Q3WidgetStack( page );
connect(mPageStack, SIGNAL(aboutToShow(QWidget *)),
SIGNAL(aboutToShowPage(QWidget *)));
vbox->addWidget( mPageStack, 10 );
}
else if( mFace == Tabbed )
{
d = new KJanusWidgetPrivate;
mTabControl = new QTabWidget( this );
mTabControl->setMargin (KDialog::marginHint());
topLayout->addWidget( mTabControl, 10 );
}
else if( mFace == Swallow )
{
mSwallowPage = new QWidget( this );
topLayout->addWidget( mSwallowPage, 10 );
}
else
{
mFace = Plain;
- mPlainPage = new QFrame( this );
+ mPlainPage = new Q3Frame( this );
topLayout->addWidget( mPlainPage, 10 );
}
/*US
if ( kapp )
connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged()));
*/
mValid = true;
setSwallowedWidget(0); // Set default size if 'mFace' is Swallow.
}
KJanusWidget::~KJanusWidget()
{
/*US the destroyed signal caused a segmentation fault while closing the dialog and destructing
all pages. Why not just remove all pages in the destructor??
*/
// LR we have all subwidgets with parent-child relation
// LR we do not need to delete here anything by the private class
/*
if( mFace == Tabbed )
{
QMap<QWidget*,int>::Iterator it;
for (it = d->mPageToInt.begin(); it != d->mPageToInt.end(); ++it) {
QObject*page = (QObject*)it.key();
pageGone(page);
}
}
else
qDebug("KJanusWidget::~KJanusWidget so far ");
*/
//US end
delete d;
}
bool KJanusWidget::isValid() const
{
return( mValid );
}
-QFrame *KJanusWidget::plainPage()
+Q3Frame *KJanusWidget::plainPage()
{
return( mPlainPage );
}
int KJanusWidget::face() const
{
return( mFace );
}
QWidget *KJanusWidget::FindParent()
{
if( mFace == Tabbed ) {
return mTabControl;
}
else {
return this;
}
}
-QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header,
+Q3Frame *KJanusWidget::addPage( const QStringList &items, const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
- QFrame *page = new QFrame( FindParent(), "page" );
+ Q3Frame *page = new Q3Frame( FindParent(), "page" );
addPageWidget( page, items, header, pixmap );
return page;
}
void KJanusWidget::pageGone( QObject *obj )
{
// QObject* obj = (QObject*)sender();
removePage( static_cast<QWidget*>( obj ) );
}
-void KJanusWidget::slotReopen( QListViewItem * item )
+void KJanusWidget::slotReopen( Q3ListViewItem * item )
{
if( item )
item->setOpen( true );
}
-QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header,
+Q3Frame *KJanusWidget::addPage( const QString &itemName, const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addPage(items, header, pixmap);
}
-QVBox *KJanusWidget::addVBoxPage( const QStringList &items,
+Q3VBox *KJanusWidget::addVBoxPage( const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
qDebug("addPage: Invalid object ");
return( 0 );
}
- QVBox *page = new QVBox(FindParent() , "vbox_page" );
+ Q3VBox *page = new Q3VBox(FindParent() , "vbox_page" );
page->setSpacing( KDialog::spacingHintSmall() );
addPageWidget( page, items, header, pixmap );
return page;
}
-QVBox *KJanusWidget::addVBoxPage( const QString &itemName,
+Q3VBox *KJanusWidget::addVBoxPage( const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addVBoxPage(items, header, pixmap);
}
-QHBox *KJanusWidget::addHBoxPage( const QStringList &items,
+Q3HBox *KJanusWidget::addHBoxPage( const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false ) {
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
- QHBox *page = new QHBox(FindParent(), "hbox_page");
+ Q3HBox *page = new Q3HBox(FindParent(), "hbox_page");
page->setSpacing( KDialog::spacingHint() );
addPageWidget( page, items, header, pixmap );
return page;
}
-QHBox *KJanusWidget::addHBoxPage( const QString &itemName,
+Q3HBox *KJanusWidget::addHBoxPage( const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addHBoxPage(items, header, pixmap);
}
-QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir,
+Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir,
const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
- QGrid *page = new QGrid( n, dir, FindParent(), "page" );
+ Q3Grid *page = new Q3Grid( n, dir, FindParent(), "page" );
page->setSpacing( KDialog::spacingHint() );
addPageWidget( page, items, header, pixmap );
return page;
}
-QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir,
+Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir,
const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addGridPage(n, dir, items, header, pixmap);
}
-void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page)
+void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page)
{
bool isTop = true;
- QListViewItem *curTop = 0, *child, *last, *newChild;
+ Q3ListViewItem *curTop = 0, *child, *last, *newChild;
unsigned int index = 1;
QStringList curPath;
for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) {
QString name = (*it);
bool isPath = ( index != items.count() );
// Find the first child.
if (isTop) {
child = mTreeList->firstChild();
}
else {
child = curTop->firstChild();
}
// Now search for a child with the current Name, and if it we doesn't
// find it, then remember the location of the last child.
for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling());
if (last == 0 && child == 0) {
// This node didn't have any children at all, lets just insert the
// new child.
if (isTop)
- newChild = new QListViewItem(mTreeList, name);
+ newChild = new Q3ListViewItem(mTreeList, name);
else
- newChild = new QListViewItem(curTop, name);
+ newChild = new Q3ListViewItem(curTop, name);
}
else if (child != 0) {
// we found the given name in this child.
if (!isPath) {
kdDebug() << "The element inserted was already in the TreeList box!" << endl;
return;
}
else {
// Ok we found the folder
newChild = child;
}
}
else {
// the node had some children, but we didn't find the given name
if (isTop)
- newChild = new QListViewItem(mTreeList, last, name);
+ newChild = new Q3ListViewItem(mTreeList, last, name);
else
- newChild = new QListViewItem(curTop, last, name);
+ newChild = new Q3ListViewItem(curTop, last, name);
}
// Now make the element expandable if it is a path component, and make
// ready for next loop
if (isPath) {
newChild->setExpandable(true);
curTop = newChild;
isTop = false;
curPath << name;
QString key = curPath.join("_/_");
if (mFolderIconMap.contains(key)) {
QPixmap p = mFolderIconMap[key];
newChild->setPixmap(0,p);
}
}
else {
if (mShowIconsInTreeList) {
newChild->setPixmap(0, pixmap);
}
mTreeListToPageStack.insert(newChild, page);
}
}
}
-void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items,
+void KJanusWidget::addPageWidget( Q3Frame *page, const QStringList &items,
const QString &header,const QPixmap &pixmap )
{
/*US the following signal causes a segmentation fault while closing the dialog.
Why not just remove all pages in the destructor??
*/
//US connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*)));
// we have the SIGNAL(destroyed(QObject*) only in Qt3
#ifdef DESKTOP_VERSION
// connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*)));
#endif
if( mFace == Tabbed )
{
mTabControl->addTab (page, items.last());
d->mIntToPage[d->mNextPageIndex] = static_cast<QWidget*>(page);
d->mPageToInt[static_cast<QWidget*>(page)] = d->mNextPageIndex;
d->mNextPageIndex++;
}
else if( mFace == TreeList || mFace == IconList )
{
d->mIntToPage[d->mNextPageIndex] = static_cast<QWidget*>(page);
d->mPageToInt[static_cast<QWidget*>(page)] = d->mNextPageIndex;
mPageStack->addWidget( page, 0 );
if (items.count() == 0) {
kdDebug() << "Invalid QStringList, with zero items" << endl;
return;
}
if( mFace == TreeList )
{
InsertTreeListItem(items, pixmap, page);
}
@@ -521,207 +529,207 @@ void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items,
}
d->mNextPageIndex++;
}
else
{
kdDebug() << "KJanusWidget::addPageWidget: can only add a page in Tabbed, TreeList or IconList modes" << endl;
}
}
void KJanusWidget::setFolderIcon(const QStringList &path, const QPixmap &pixmap)
{
QString key = path.join("_/_");
mFolderIconMap.insert(key,pixmap);
}
bool KJanusWidget::setSwallowedWidget( QWidget *widget )
{
if( mFace != Swallow || mValid == false )
{
return( false );
}
//
// Remove current layout and make a new.
//
if( mSwallowPage->layout() != 0 )
{
delete mSwallowPage->layout();
}
- QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 );
+ Q3GridLayout *gbox = new Q3GridLayout( mSwallowPage, 1, 1, 0 );
//
// Hide old children
//
- QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please
- for( uint i=0; i < l->count(); i++ )
+ QObjectList l = mSwallowPage->children(); // silence please
+ for( uint i=0; i < l.count(); i++ )
{
- QObject *o = l->at(i);
+ QObject *o = l.at(i);
if( o->isWidgetType() )
{
((QWidget*)o)->hide();
}
}
//
// Add new child or make default size
//
if( widget == 0 )
{
gbox->addRowSpacing(0,100);
gbox->addColSpacing(0,100);
mSwallowPage->setMinimumSize(100,100);
}
else
{
if( widget->parent() != mSwallowPage )
{
widget->reparent( mSwallowPage, 0, QPoint(0,0) );
}
gbox->addWidget(widget, 0, 0 );
gbox->activate();
mSwallowPage->setMinimumSize( widget->minimumSize() );
}
return( true );
}
bool KJanusWidget::slotShowPage()
{
if( mValid == false )
{
return( false );
}
if( mFace == TreeList )
{
- QListViewItem *node = mTreeList->selectedItem();
+ Q3ListViewItem *node = mTreeList->selectedItem();
if( node == 0 ) { return( false ); }
QWidget *stackItem = mTreeListToPageStack[node];
// Make sure to call through the virtual function showPage(int)
return showPage(d->mPageToInt[stackItem]);
}
else if( mFace == IconList )
{
- QListBoxItem *node = mIconList->item( mIconList->currentItem() );
+ Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() );
if( node == 0 ) { return( false ); }
QWidget *stackItem = mIconListToPageStack[node];
// Make sure to call through the virtual function showPage(int)
return showPage(d->mPageToInt[stackItem]);
}
return( false );
}
bool KJanusWidget::showPage( int index )
{
if( d == 0 || mValid == false )
{
return( false );
}
else
{
return showPage(d->mIntToPage[index]);
}
}
bool KJanusWidget::showPage( QWidget *w )
{
if( w == 0 || mValid == false )
{
return( false );
}
if( mFace == TreeList || mFace == IconList )
{
mPageStack->raiseWidget( w );
mActivePageWidget = w;
int index = d->mPageToInt[w];
mTitleLabel->setText( d->mIntToTitle[index] );
if( mFace == TreeList )
{
- QMap<QListViewItem *, QWidget *>::Iterator it;
+ QMap<Q3ListViewItem *, QWidget *>::Iterator it;
for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){
- QListViewItem *key = it.key();
+ Q3ListViewItem *key = it.key();
QWidget *val = it.data();
if (val == w) {
mTreeList->setSelected(key, true );
break;
}
}
}
else
{
- QMap<QListBoxItem *, QWidget *>::Iterator it;
+ QMap<Q3ListBoxItem *, QWidget *>::Iterator it;
for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){
- QListBoxItem *key = it.key();
+ Q3ListBoxItem *key = it.key();
QWidget *val = it.data();
if (val == w) {
mIconList->setSelected( key, true );
break;
}
}
}
}
else if( mFace == Tabbed )
{
mTabControl->showPage(w);
mActivePageWidget = w;
}
else
{
return( false );
}
return( true );
}
int KJanusWidget::activePageIndex() const
{
if( mFace == TreeList) {
- QListViewItem *node = mTreeList->selectedItem();
+ Q3ListViewItem *node = mTreeList->selectedItem();
if( node == 0 ) { return -1; }
QWidget *stackItem = mTreeListToPageStack[node];
return d->mPageToInt[stackItem];
}
else if (mFace == IconList) {
- QListBoxItem *node = mIconList->item( mIconList->currentItem() );
+ Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() );
if( node == 0 ) { return( false ); }
QWidget *stackItem = mIconListToPageStack[node];
return d->mPageToInt[stackItem];
}
else if( mFace == Tabbed ) {
QWidget *widget = mTabControl->currentPage();
return( widget == 0 ? -1 : d->mPageToInt[widget] );
}
else {
return( -1 );
}
}
int KJanusWidget::pageIndex( QWidget *widget ) const
{
if( widget == 0 )
{
return( -1 );
}
else if( mFace == TreeList || mFace == IconList )
{
return( d->mPageToInt[widget] );
}
else if( mFace == Tabbed )
{
//
// The user gets the real page widget with addVBoxPage(), addHBoxPage()
// and addGridPage() but not with addPage() which returns a child of
// the toplevel page. addPage() returns a QFrame so I check for that.
//
if( widget->isA("QFrame") )
@@ -732,65 +740,65 @@ int KJanusWidget::pageIndex( QWidget *widget ) const
{
return( d->mPageToInt[widget] );
}
}
else
{
return( -1 );
}
}
/*US not yet implemented
void KJanusWidget::slotFontChanged()
{
if( mTitleLabel != 0 )
{
mTitleLabel->setFont( KGlobalSettings::generalFont() );
QFont titleFont( mTitleLabel->font() );
titleFont.setBold( true );
mTitleLabel->setFont( titleFont );
}
if( mFace == IconList )
{
QFont listFont( mIconList->font() );
listFont.setBold( true );
mIconList->setFont( listFont );
mIconList->invalidateHeight();
mIconList->invalidateWidth();
}
}
*/
// makes the treelist behave like the list of kcontrol
-void KJanusWidget::slotItemClicked(QListViewItem *it)
+void KJanusWidget::slotItemClicked(Q3ListViewItem *it)
{
if(it && (it->childCount()>0))
it->setOpen(!it->isOpen());
}
void KJanusWidget::setFocus()
{
if( mValid == false ) { return; }
if( mFace == TreeList )
{
mTreeList->setFocus();
}
if( mFace == IconList )
{
mIconList->setFocus();
}
else if( mFace == Tabbed )
{
mTabControl->setFocus();
}
else if( mFace == Swallow )
{
mSwallowPage->setFocus();
}
else if( mFace == Plain )
{
mPlainPage->setFocus();
}
}
QSize KJanusWidget::minimumSizeHint() const
@@ -866,307 +874,307 @@ void KJanusWidget::setTreeListAutoResize( bool state )
QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
splitter->setResizeMode( mTreeList, mTreeListResizeMode );
*/
}
}
void KJanusWidget::setIconListAllVisible( bool state )
{
if( mFace == IconList )
{
mIconList->setShowAll( state );
}
}
void KJanusWidget::setShowIconsInTreeList( bool state )
{
mShowIconsInTreeList = state;
}
void KJanusWidget::setRootIsDecorated( bool state )
{
if( mFace == TreeList ) {
mTreeList->setRootIsDecorated(state);
}
}
void KJanusWidget::unfoldTreeList( bool persist )
{
if( mFace == TreeList )
{
if( persist )
- connect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) );
+ connect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) );
else
- disconnect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) );
+ disconnect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) );
- for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
+ for( Q3ListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
item->setOpen( true );
}
}
void KJanusWidget::showEvent( QShowEvent * )
{
if( mFace == TreeList )
{
/*US
QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
splitter->setResizeMode( mTreeList, mTreeListResizeMode );
*/
}
}
//
// 2000-13-02 Espen Sand
// It should be obvious that this eventfilter must only be
// be installed on the vertical scrollbar of the mIconList.
//
bool KJanusWidget::eventFilter( QObject *o, QEvent *e )
{
if( e->type() == QEvent::Show )
{
IconListItem *item = (IconListItem*)mIconList->item(0);
if( item != 0 )
{
int lw = item->width( mIconList );
int sw = mIconList->verticalScrollBar()->sizeHint().width();
mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 );
}
}
else if( e->type() == QEvent::Hide )
{
IconListItem *item = (IconListItem*)mIconList->item(0);
if( item != 0 )
{
int lw = item->width( mIconList );
mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 );
}
}
return QWidget::eventFilter( o, e );
}
//
// Code for the icon list box
//
KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name,
- WFlags f )
+ Qt::WFlags f )
:KListBox( parent, name, f ), mShowAll(false), mHeightValid(false),
mWidthValid(false)
{
}
void KJanusWidget::IconListBox::updateMinimumHeight()
{
if( mShowAll == true && mHeightValid == false )
{
int h = frameWidth()*2;
- for( QListBoxItem *i = item(0); i != 0; i = i->next() )
+ for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() )
{
h += i->height( this );
}
setMinimumHeight( h );
mHeightValid = true;
}
}
void KJanusWidget::IconListBox::updateWidth()
{
if( mWidthValid == false )
{
int maxWidth = 10;
- for( QListBoxItem *i = item(0); i != 0; i = i->next() )
+ for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() )
{
int w = ((IconListItem *)i)->width(this);
maxWidth = QMAX( w, maxWidth );
}
- for( QListBoxItem *i = item(0); i != 0; i = i->next() )
+ for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() )
{
((IconListItem *)i)->expandMinimumWidth( maxWidth );
}
if( verticalScrollBar()->isVisible() )
{
maxWidth += verticalScrollBar()->sizeHint().width();
}
setFixedWidth( maxWidth + frameWidth()*2 );
mWidthValid = true;
}
}
void KJanusWidget::IconListBox::invalidateHeight()
{
mHeightValid = false;
}
void KJanusWidget::IconListBox::invalidateWidth()
{
mWidthValid = false;
}
void KJanusWidget::IconListBox::setShowAll( bool showAll )
{
mShowAll = showAll;
mHeightValid = false;
}
-KJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap,
+KJanusWidget::IconListItem::IconListItem( Q3ListBox *listbox, const QPixmap &pixmap,
const QString &text )
- : QListBoxItem( listbox )
+ : Q3ListBoxItem( listbox )
{
mPixmap = pixmap;
if( mPixmap.isNull() == true )
{
mPixmap = defaultPixmap();
}
setText( text );
mMinimumWidth = 0;
}
int KJanusWidget::IconListItem::expandMinimumWidth( int width )
{
mMinimumWidth = QMAX( mMinimumWidth, width );
return( mMinimumWidth );
}
const QPixmap &KJanusWidget::IconListItem::defaultPixmap()
{
static QPixmap *pix=0;
if( pix == 0 )
{
pix = new QPixmap( 32, 32 );
QPainter p( pix );
p.eraseRect( 0, 0, pix->width(), pix->height() );
p.setPen( Qt::red );
p.drawRect ( 0, 0, pix->width(), pix->height() );
p.end();
QBitmap mask( pix->width(), pix->height(), true);
mask.fill( Qt::black );
p.begin( &mask );
p.setPen( Qt::white );
p.drawRect ( 0, 0, pix->width(), pix->height() );
p.end();
pix->setMask( mask );
}
return( *pix );
}
void KJanusWidget::IconListItem::paint( QPainter *painter )
{
QFontMetrics fm = painter->fontMetrics();
//int wt = fm.boundingRect(text()).width();
int wp = mPixmap.width();
int ht = fm.lineSpacing();
int hp = mPixmap.height();
painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap );
if( text().isEmpty() == false )
{
painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() );
}
}
-int KJanusWidget::IconListItem::height( const QListBox *lb ) const
+int KJanusWidget::IconListItem::height( const Q3ListBox *lb ) const
{
if( text().isEmpty() == true )
{
return( mPixmap.height() );
}
else
{
return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 );
}
}
-int KJanusWidget::IconListItem::width( const QListBox *lb ) const
+int KJanusWidget::IconListItem::width( const Q3ListBox *lb ) const
{
int wt = lb->fontMetrics().boundingRect(text()).width()+10;
int wp = mPixmap.width() + 10;
int w = QMAX( wt, wp );
return( QMAX( w, mMinimumWidth ) );
}
void KJanusWidget::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
// TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to
// delete the node.
void KJanusWidget::removePage( QWidget *page )
{
//US qDebug("KJanusWidget::removePage 1 %lu , %lu, %lu", d, page, &(d->mPageToInt));
if (!d || !(d->mPageToInt.contains(page)))
{
return;
}
int index = d->mPageToInt[page];
if ( mFace == TreeList )
{
- QMap<QListViewItem*, QWidget *>::Iterator i;
+ QMap<Q3ListViewItem*, QWidget *>::Iterator i;
for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i )
if (i.data()==page)
{
delete i.key();
mPageStack->removeWidget(page);
mTreeListToPageStack.remove(i);
d->mIntToTitle.remove(index);
d->mPageToInt.remove(page);
d->mIntToPage.remove(index);
break;
}
}
else if ( mFace == IconList )
{
- QMap<QListBoxItem*, QWidget *>::Iterator i;
+ QMap<Q3ListBoxItem*, QWidget *>::Iterator i;
for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i )
if (i.data()==page)
{
delete i.key();
mPageStack->removeWidget(page);
mIconListToPageStack.remove(i);
d->mIntToTitle.remove(index);
d->mPageToInt.remove(page);
d->mIntToPage.remove(index);
break;
}
}
else // Tabbed
{
mTabControl->removePage(page);
d->mPageToInt.remove(page);
d->mIntToPage.remove(index);
}
}
QString KJanusWidget::pageTitle(int index) const
{
if (!d || !d->mIntToTitle.contains(index))
return QString::null;
else
return d->mIntToTitle[index];
}
QWidget *KJanusWidget::pageWidget(int index) const
{
if (!d || !d->mIntToPage.contains(index))
return 0;
diff --git a/microkde/kdeui/kjanuswidget.h b/microkde/kdeui/kjanuswidget.h
index 6d3f23d..72465ea 100644
--- a/microkde/kdeui/kjanuswidget.h
+++ b/microkde/kdeui/kjanuswidget.h
@@ -1,137 +1,143 @@
/* This file is part of the KDE Libraries
* Copyright (C) 1999-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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _KJANUS_WIDGET_H_
#define _KJANUS_WIDGET_H_
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qwidget.h>
#include <qmap.h>
-#include <qgrid.h>
+#include <q3grid.h>
+//Added by qt3to4:
+#include <QShowEvent>
+#include <Q3Frame>
+#include <QPixmap>
+#include <QLabel>
+#include <QEvent>
#include <klistbox.h>
/*US
#include <qptrlist.h>
#include <qpixmap.h>
#include <qsplitter.h>
#include <qstringlist.h>
#include <qmap.h>
*/
class KSeparator;
class KListView;
-class QWidgetStack;
+class Q3WidgetStack;
class QLabel;
class QTabWidget;
-class QListViewItem;
-class QVBox;
-class QHBox;
+class Q3ListViewItem;
+class Q3VBox;
+class Q3HBox;
/**
* Provides a number of ready to use layouts (faces). It is used
* as an internal widget in @ref KDialogBase, but can also used as a
* widget of its own.
*
* It provides TreeList, IconList, Tabbed, Plain and Swallow layouts.
*
* The TreeList face provides a list in the left area and pages in the
* right. The area are separated by a movable splitter. The style is somewhat
* similar to the layout in the Control Center. A page is raised by
* selecting the corresponding tree list item.
*
* The IconList face provides an icon list in the left area and pages in the
* right. For each entry the Icon is on top with the text below. The style
* is somewhat similar to the layout of the Eudora configuation dialog box.
* A page is raised by selecting the corresponding icon list item. The
* preferred icon size is 32x32 pixels.
*
* The Tabbed face is a common tabbed widget. The procedure for creating a
* page is similar for creating a TreeList. This has the advantage that if
* your widget contain too many pages it is trivial to convert it into a
* TreeList. Just change the face in the KJanusWidget constructor to
* KJanusWidget::TreeList and you have a tree list layout instead.
*
* The Plain face provides an empty widget (QFrame) where you can place your
* widgets. The KJanusWidget makes no assumptions regarding the contents so
* you are free to add whatever you want.
*
* The Swallow face is provided in order to simplify the usage of existing
* widgets and to allow changing the visible widget. You specify the widget
* to be displayed by @ref #setSwallowedWidget(). Your widget will be
* reparented inside the widget. You can specify a Null (0) widget. A empty
* space is then displayed.
*
* For all modes it is important that you specify the @ref QWidget::minimumSize()
* on the page, plain widget or the swallowed widget. If you use a QLayout
* on the page, plain widget or the swallowed widget this will be taken care
* of automatically. The size is used when the KJanusWidget determines its
* own minimum size. You get the minimum size by using the
* @ref #minimumSizeHint() or @ref #sizeHint() methods.
*
* Pages that have been added in TreeList, IconList or Tabbed mode can be
* removed by simply deleting the page. However, it would be preferable to use
* the QObject::deleteLater() function on the page as the main event loop
* may have optimized UI update events of the page by scheduling them for later.
*
* @short Easy to use widget with many layouts
* @author Espen Sand (espen@kde.org)
*/
class KJanusWidget : public QWidget
{
Q_OBJECT
private:
class IconListBox : public KListBox
{
public:
- IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 );
+ IconListBox( QWidget *parent=0, const char *name=0, Qt::WFlags f=0 );
void updateMinimumHeight();
void updateWidth();
void invalidateHeight();
void invalidateWidth();
void setShowAll( bool showAll );
private:
bool mShowAll;
bool mHeightValid;
bool mWidthValid;
};
public:
enum Face
{
TreeList = 0,
Tabbed,
Plain,
Swallow,
IconList
};
public:
/**
* Constructor where you specify the face.
*
* @param parent Parent of the widget.
* @param name Widget name.
* @param int face The kind of dialog, Use TreeList, Tabbed, Plain or
* Swallow.
*/
@@ -164,227 +170,227 @@ class KJanusWidget : public QWidget
* @return true if the widget was properly created.
*/
virtual bool isValid() const;
/**
* Returns the face type.
*
* @return The face type.
*/
virtual int face() const;
/**
* Returns the minimum size that must be made available for the widget
* so that UIs can be displayed properly
*
* @return The minimum size.
*/
virtual QSize minimumSizeHint() const;
/**
* Returns the recommended size for the widget in order to be displayed
* properly.
*
* @return The recommended size.
*/
virtual QSize sizeHint() const;
/**
* Returns the empty widget that is available in Plain mode.
*
* @return The widget or 0 if the face in not Plain.
*/
- virtual QFrame *plainPage();
+ virtual Q3Frame *plainPage();
/**
* Add a new page when the class is used in TreeList, IconList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. In most cases you must create a layout
* manager and associate it with this widget as well.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed.
*/
- virtual QFrame *addPage(const QString &item,const QString &header=QString::null,
+ virtual Q3Frame *addPage(const QString &item,const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
- virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null,
+ virtual Q3Frame *addPage(const QStringList &items, const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* Add a new page when the class is used in TreeList, IconList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. The returned widget is a @ref QVBox
* so it contains a QVBoxLayout layout that lines up the child widgets
* are vertically.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed. */
- virtual QVBox *addVBoxPage( const QString &item,
+ virtual Q3VBox *addVBoxPage( const QString &item,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addVBoxPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
- virtual QVBox *addVBoxPage( const QStringList &items,
+ virtual Q3VBox *addVBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* Add a new page when the class is used in TreeList, IconList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. The returned widget is a @ref QHBox
* so it contains a QHBoxLayout layout that lines up the child widgets
* are horizontally.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed.
*/
- virtual QHBox *addHBoxPage( const QString &itemName,
+ virtual Q3HBox *addHBoxPage( const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addHBoxPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
- virtual QHBox *addHBoxPage( const QStringList &items,
+ virtual Q3HBox *addHBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* Add a new page when the class is used in either TreeList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. The returned widget is a @ref QGrid
* so it contains a QGridLayout layout that places up the child widgets
* in a grid.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param n Specifies the number of columns if 'dir' is QGrid::Horizontal
* or the number of rows if 'dir' is QGrid::Vertical.
* @param dir Can be QGrid::Horizontal or QGrid::Vertical.
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed.
*/
//US changed Orientation into Direction for compatibility
- virtual QGrid *addGridPage( int n, QGrid::Direction dir,
+ virtual Q3Grid *addGridPage( int n, Qt::Orientation dir,
const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addGridPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
//US changed Orientation into Direction for compatibility
- virtual QGrid *addGridPage( int n, QGrid::Direction dir,
+ virtual Q3Grid *addGridPage( int n, Qt::Orientation dir,
const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* @short Removes a page created with @ref addPage, @ref addVBoxPage,
* @ref addHBoxPage or @ref addGridPage. If the page has already
* been deleted or has already been removed, nothing happens. The widget
* itself is not deleted.
*
* @param page The widget returned by @ref addPage , @ref addVBoxPage ,
* @ref addHBoxPage or @ref addGridPage .
*/
void removePage( QWidget *page );
/**
* Returns the index of a page created with @ref addPage ,
* @ref addVBoxPage , @ref addHBoxPage or @ref addGridPage .
* You can can compare this index with the value returned from
* @ref activePageIndex if you need to do some page specific actions
* in your code.
*
* The returned index will never change so you can safely use this
* function once and save the value.
*
* @param widget The widget returned by @ref addPage , @ref addVBoxPage ,
* @ref addHBoxPage or @ref addGridPage .
*
* @return The index or -1 if the face is not Tabbed, TreeList or
* IconList
*/
@@ -488,78 +494,78 @@ class KJanusWidget : public QWidget
*/
/*virtual*/ QWidget *pageWidget(int index) const;
signals:
void aboutToShowPage(QWidget *page);
public slots:
/**
* Give the keyboard input focus to the widget.
*/
virtual void setFocus();
protected:
/**
* Reimplemented to handle the splitter width when the the face
* is TreeList
*/
virtual void showEvent( QShowEvent * );
/**
* This function is used internally when in IconList mode. If you
* reimplement this class a make your own event filter, make sure to
* call this function from your filter.
*
* @param o Object that has received an event.
* @param e The event.
*/
virtual bool eventFilter( QObject *o, QEvent *e );
private slots:
bool slotShowPage();
//US not yet implemented void slotFontChanged();
- void slotItemClicked(QListViewItem *it);
+ void slotItemClicked(Q3ListViewItem *it);
void pageGone( QObject *obj); // signal from the added page's "destroyed" signal
- void slotReopen(QListViewItem *item);
+ void slotReopen(Q3ListViewItem *item);
protected:
bool showPage( QWidget *w );
- void addPageWidget( QFrame *page, const QStringList &items,
+ void addPageWidget( Q3Frame *page, const QStringList &items,
const QString &header, const QPixmap &pixmap );
- void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page);
+ void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page);
QWidget *FindParent();
private:
bool mValid;
// Obsolete members. Remove in KDE 4.
- QPtrList<QWidget> *mPageList;
+ Q3PtrList<QWidget> *mPageList;
QStringList *mTitleList;
int mFace;
KListView *mTreeList;
IconListBox *mIconList;
- QWidgetStack *mPageStack;
+ Q3WidgetStack *mPageStack;
QLabel *mTitleLabel;
QTabWidget *mTabControl;
- QFrame *mPlainPage;
+ Q3Frame *mPlainPage;
QWidget *mSwallowPage;
QWidget *mActivePageWidget;
KSeparator *mTitleSep;
//US QSplitter::ResizeMode mTreeListResizeMode;
bool mShowIconsInTreeList;
- QMap<QListViewItem *, QWidget *> mTreeListToPageStack;
- QMap<QListBoxItem *, QWidget *> mIconListToPageStack;
+ QMap<Q3ListViewItem *, QWidget *> mTreeListToPageStack;
+ QMap<Q3ListBoxItem *, QWidget *> mIconListToPageStack;
QMap<QString, QPixmap> mFolderIconMap;
QMap<QString, QStringList> mChildrenNames;
QMap<QString, QWidget *> mChildPages;
public:
class IconListItem;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KJanusWidgetPrivate;
KJanusWidgetPrivate *d;
};
#endif
diff --git a/microkde/kdeui/klistbox.cpp b/microkde/kdeui/klistbox.cpp
index c65b892..71020b3 100644
--- a/microkde/kdeui/klistbox.cpp
+++ b/microkde/kdeui/klistbox.cpp
@@ -1,95 +1,101 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qtimer.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QFocusEvent>
#include <kglobalsettings.h>
//US#include <kcursor.h>
#include <kapplication.h>
//US#include <kipc.h>
#include <kdebug.h>
#include "klistbox.h"
#ifdef Q_WS_X11
+#include <QX11Info>
#include <X11/Xlib.h>
#endif
#ifdef _WIN32_
#define Q_WS_QWS
#endif
-KListBox::KListBox( QWidget *parent, const char *name, WFlags f )
- : QListBox( parent, name, f )
+KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f )
+ : Q3ListBox( parent, name, f )
{
connect( this, SIGNAL( onViewport() ),
this, SLOT( slotOnViewport() ) );
- connect( this, SIGNAL( onItem( QListBoxItem * ) ),
- this, SLOT( slotOnItem( QListBoxItem * ) ) );
+ connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ),
+ this, SLOT( slotOnItem( Q3ListBoxItem * ) ) );
- connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *,
+ connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *,
const QPoint & ) ),
- this, SLOT( slotMouseButtonClicked( int, QListBoxItem *,
+ this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *,
const QPoint & ) ) );
/*US
slotSettingsChanged(KApplication::SETTINGS_MOUSE);
if (kapp)
{
connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) );
kapp->addKipcEventMask( KIPC::SettingsChanged );
}
*/
m_pCurrentItem = 0L;
//US set single to true
m_bUseSingle = true;
m_pAutoSelect = new QTimer( this );
connect( m_pAutoSelect, SIGNAL( timeout() ),
this, SLOT( slotAutoSelect() ) );
}
-void KListBox::slotOnItem( QListBoxItem *item )
+void KListBox::slotOnItem( Q3ListBoxItem *item )
{
/*US
if ( item && m_bChangeCursorOverItem && m_bUseSingle )
viewport()->setCursor( KCursor().handCursor() );
*/
if ( item && (m_autoSelectDelay > -1) && m_bUseSingle ) {
m_pAutoSelect->start( m_autoSelectDelay, true );
m_pCurrentItem = item;
}
}
void KListBox::slotOnViewport()
{
/*US
if ( m_bChangeCursorOverItem )
viewport()->unsetCursor();
*/
m_pAutoSelect->stop();
m_pCurrentItem = 0L;
}
/*US
void KListBox::slotSettingsChanged(int category)
{
if (category != KApplication::SETTINGS_MOUSE)
return;
m_bUseSingle = KGlobalSettings::singleClick();
m_bUseSingle = true;
disconnect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *,
@@ -110,205 +116,205 @@ void KListBox::slotSettingsChanged(int category)
}
else
{
// connect( this, SIGNAL( doubleClicked( QListBoxItem *,
// const QPoint & ) ),
// this, SLOT( slotExecute( QListBoxItem *,
// const QPoint & ) ) );
}
m_bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
m_autoSelectDelay = KGlobalSettings::autoSelectDelay();
if( !m_bUseSingle || !m_bChangeCursorOverItem )
viewport()->unsetCursor();
}
*/
void KListBox::slotAutoSelect()
{
// check that the item still exists
if( index( m_pCurrentItem ) == -1 )
return;
//Give this widget the keyboard focus.
if( !hasFocus() )
setFocus();
#ifdef Q_WS_X11 //FIXME
Window root;
Window child;
int root_x, root_y, win_x, win_y;
uint keybstate;
- XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
+ XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
&root_x, &root_y, &win_x, &win_y, &keybstate );
#endif
- QListBoxItem* previousItem = item( currentItem() );
+ Q3ListBoxItem* previousItem = item( currentItem() );
setCurrentItem( m_pCurrentItem );
if( m_pCurrentItem ) {
#ifndef Q_WS_QWS //FIXME
//Shift pressed?
if( (keybstate & ShiftMask) ) {
#endif
bool block = signalsBlocked();
blockSignals( true );
#ifndef Q_WS_QWS //FIXME
//No Ctrl? Then clear before!
if( !(keybstate & ControlMask) )
clearSelection();
#endif
//US in my QT version it is called isSelected() So what is right?
//US bool select = !m_pCurrentItem->isSelected();
bool select = !m_pCurrentItem->selected();
bool update = viewport()->isUpdatesEnabled();
viewport()->setUpdatesEnabled( false );
bool down = index( previousItem ) < index( m_pCurrentItem );
- QListBoxItem* it = down ? previousItem : m_pCurrentItem;
+ Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem;
for (;it ; it = it->next() ) {
if ( down && it == m_pCurrentItem ) {
setSelected( m_pCurrentItem, select );
break;
}
if ( !down && it == previousItem ) {
setSelected( previousItem, select );
break;
}
setSelected( it, select );
}
blockSignals( block );
viewport()->setUpdatesEnabled( update );
triggerUpdate( false );
emit selectionChanged();
- if( selectionMode() == QListBox::Single )
+ if( selectionMode() == Q3ListBox::Single )
emit selectionChanged( m_pCurrentItem );
}
#ifndef Q_WS_QWS //FIXME
else if( (keybstate & ControlMask) )
setSelected( m_pCurrentItem, !m_pCurrentItem->isSelected() );
#endif
else {
bool block = signalsBlocked();
blockSignals( true );
//US in my QT version it is called isSelected() So what is right?
//US if( !m_pCurrentItem->isSelected() )
if( !m_pCurrentItem->selected() )
clearSelection();
blockSignals( block );
setSelected( m_pCurrentItem, true );
}
#ifndef Q_WS_QWS //FIXME
}
else
kdDebug() << "Thats not supposed to happen!!!!" << endl;
#endif
}
-void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos )
+void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos )
{
#ifdef Q_WS_X11 //FIXME
Window root;
Window child;
int root_x, root_y, win_x, win_y;
uint keybstate;
- XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
+ XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
&root_x, &root_y, &win_x, &win_y, &keybstate );
#endif
m_pAutoSelect->stop();
#ifndef Q_WS_QWS //FIXME
//Dont emit executed if in SC mode and Shift or Ctrl are pressed
if( !( m_bUseSingle && ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) {
#endif
emit executed( item );
emit executed( item, pos );
#ifndef Q_WS_QWS //FIXME
}
#endif
}
//
// 2000-16-01 Espen Sand
// This widget is used in dialogs. It should ignore
// F1 (and combinations) and Escape since these are used
// to start help or close the dialog. This functionality
// should be done in QListView but it is not (at least now)
//
void KListBox::keyPressEvent(QKeyEvent *e)
{
- if( e->key() == Key_Escape )
+ if( e->key() == Qt::Key_Escape )
{
e->ignore();
}
- else if( e->key() == Key_F1 )
+ else if( e->key() == Qt::Key_F1 )
{
e->ignore();
}
else
{
- QListBox::keyPressEvent(e);
+ Q3ListBox::keyPressEvent(e);
}
}
void KListBox::focusOutEvent( QFocusEvent *fe )
{
m_pAutoSelect->stop();
- QListBox::focusOutEvent( fe );
+ Q3ListBox::focusOutEvent( fe );
}
void KListBox::leaveEvent( QEvent *e )
{
m_pAutoSelect->stop();
- QListBox::leaveEvent( e );
+ Q3ListBox::leaveEvent( e );
}
void KListBox::contentsMousePressEvent( QMouseEvent *e )
{
- if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) {
+ if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) {
bool block = signalsBlocked();
blockSignals( true );
clearSelection();
blockSignals( block );
}
- QListBox::contentsMousePressEvent( e );
+ Q3ListBox::contentsMousePressEvent( e );
}
void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e )
{
- QListBox::contentsMouseDoubleClickEvent( e );
+ Q3ListBox::contentsMouseDoubleClickEvent( e );
- QListBoxItem* item = itemAt( e->pos() );
+ Q3ListBoxItem* item = itemAt( e->pos() );
if( item ) {
emit doubleClicked( item, e->globalPos() );
- if( (e->button() == LeftButton) && !m_bUseSingle )
+ if( (e->button() == Qt::LeftButton) && !m_bUseSingle )
emitExecute( item, e->globalPos() );
}
}
-void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos )
+void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos )
{
- if( (btn == LeftButton) && item )
+ if( (btn == Qt::LeftButton) && item )
emitExecute( item, pos );
}
void KListBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "klistbox.moc"
diff --git a/microkde/kdeui/klistbox.h b/microkde/kdeui/klistbox.h
index 8023780..5ec514b 100644
--- a/microkde/kdeui/klistbox.h
+++ b/microkde/kdeui/klistbox.h
@@ -1,141 +1,146 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLISTBOX_H
#define KLISTBOX_H
-#include <qlistbox.h>
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QFocusEvent>
+#include <QKeyEvent>
+#include <QEvent>
/**
* Extends the functionality of @ref QListBox to honor the system
* wide settings for Single Click/Double Click mode, Auto Selection and
* Change Cursor over Link.
*
* There is a new signal @ref executed(). It gets connected to either
* @ref QListBox::clicked() or @ref QListBox::doubleClicked()
* depending on the KDE wide Single Click/Double Click settings. It is
* strongly recomended that you use this signal instead of the above
* mentioned. This way you don't need to care about the current
* settings. If you want to get informed when the user selects
* something connect to the @ref QListBox::selectionChanged() signal.
*
* @short A variant of @ref QListBox that honors KDE's system-wide settings.
**/
-class KListBox : public QListBox
+class KListBox : public Q3ListBox
{
Q_OBJECT
public:
- KListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ KListBox( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 );
signals:
/**
* Emitted whenever the user executes an listbox item.
*
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listbox item.
*
* Note that you may not delete any @ref QListBoxItem objects in slots
* connected to this signal.
*/
- void executed( QListBoxItem *item );
+ void executed( Q3ListBoxItem *item );
/**
* Emitted whenever the user executes an listbox item.
*
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listbox item.
* @param pos is the position where the user has clicked
*
* Note that you may not delete any @ref QListBoxItem objects in slots
* connected to this signal.
*/
- void executed( QListBoxItem *item, const QPoint &pos );
+ void executed( Q3ListBoxItem *item, const QPoint &pos );
/**
* This signal gets emitted whenever the user double clicks into the
* listbox.
*
* @param item The pointer to the clicked listbox item.
* @param pos The position where the user has clicked.
*
* Note that you may not delete any @ref QListBoxItem objects in slots
* connected to this signal.
*
* This signal is more or less here for the sake of completeness.
* You should normally not need to use this. In most cases it's better
* to use @ref executed() instead.
*/
- void doubleClicked( QListBoxItem *item, const QPoint &pos );
+ void doubleClicked( Q3ListBoxItem *item, const QPoint &pos );
protected slots:
- void slotOnItem( QListBoxItem *item );
+ void slotOnItem( Q3ListBoxItem *item );
void slotOnViewport();
//US void slotSettingsChanged(int);
/**
* Auto selection happend.
*/
void slotAutoSelect();
protected:
- void emitExecute( QListBoxItem *item, const QPoint &pos );
+ void emitExecute( Q3ListBoxItem *item, const QPoint &pos );
/**
* @reimplemented
*/
virtual void keyPressEvent(QKeyEvent *e);
/**
* @reimplemented
*/
virtual void focusOutEvent( QFocusEvent *fe );
/**
* @reimplemented
*/
virtual void leaveEvent( QEvent *e );
/**
* @reimplemented
*/
virtual void contentsMousePressEvent( QMouseEvent *e );
/**
* @reimplemented
*/
virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e );
bool m_bUseSingle;
//US bool m_bChangeCursorOverItem;
- QListBoxItem* m_pCurrentItem;
+ Q3ListBoxItem* m_pCurrentItem;
QTimer* m_pAutoSelect;
int m_autoSelectDelay;
private slots:
- void slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos );
+ void slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KListBoxPrivate;
KListBoxPrivate *d;
};
#endif
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp
index 60f3084..0e98160 100644
--- a/microkde/kdeui/klistview.cpp
+++ b/microkde/kdeui/klistview.cpp
@@ -1,295 +1,310 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
Copyright (C) 2000 Charles Samuels <charles@kde.org>
Copyright (C) 2000 Peter Putzer
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include <qtimer.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qcursor.h>
#include <qtooltip.h>
#include <qstyle.h>
#include <qpainter.h>
+//Added by qt3to4:
+#include <QDragLeaveEvent>
+#include <QKeyEvent>
+#include <Q3ValueList>
+#include <Q3PtrList>
+#include <QPixmap>
+#include <QDragEnterEvent>
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QEvent>
+#include <QPaintEvent>
#include <kglobalsettings.h>
#include <kconfig.h>
#include <kconfigbase.h>
//US #include <kcursor.h>
#include <kapplication.h>
//US #include <kipc.h>
#include <kdebug.h>
#ifdef _WIN32_
#define Q_WS_QWS
#endif
#ifndef _WIN32_
#define private public
-#include <qlistview.h>
+#include <q3listview.h>
#undef private
#endif
#include "klistview.h"
//US #include "klistviewlineedit.h"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
+#include <Q3Action>
// /*US
-class KListView::Tooltip : public QToolTip
+class KListView::Tooltip /* TODO:hacker:TODO: : public QToolTip */
{
public:
Tooltip (KListView* parent, QToolTipGroup* group = 0L);
virtual ~Tooltip () {}
protected:
// */
/**
* Reimplemented from QToolTip for internal reasons.
*/
// /*US
virtual void maybeTip (const QPoint&);
private:
KListView* mParent;
};
KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group)
- : QToolTip (parent, group),
+ : /* XXX:hacker:XXX: QToolTip (parent, group), */
mParent (parent)
{
}
void KListView::Tooltip::maybeTip (const QPoint&)
{
// FIXME
}
// */
class KListView::KListViewPrivate
{
public:
KListViewPrivate (KListView* listview)
: pCurrentItem (0L),
autoSelectDelay(1),
//US dragDelay (KGlobalSettings::dndEventDelay()),
dragDelay (10),
//US editor (new KListViewLineEdit (listview)),
cursorInExecuteArea(false),
bUseSingle(false),
bChangeCursorOverItem(false),
itemsMovable (true),
selectedBySimpleMove(false),
selectedUsingMouse(false),
itemsRenameable (false),
validDrag (false),
dragEnabled (false),
autoOpen (true),
dropVisualizer (true),
dropHighlighter (false),
createChildren (true),
pressedOnSelected (false),
wasShiftEvent (false),
fullWidth (false),
sortAscending(true),
tabRename(true),
sortColumn(0),
selectionDirection(0),
tooltipColumn (0),
selectionMode (Single),
contextMenuKey ( Qt::Key_Menu ),//KGlobalSettings::contextMenuKey()),
showContextMenusOnPress (true),//showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()),
mDropVisualizerWidth (4)
{
renameable += 0;
//US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int)));
}
~KListViewPrivate ()
{
//US delete editor;
}
- QListViewItem* pCurrentItem;
+ Q3ListViewItem* pCurrentItem;
QTimer autoSelect;
int autoSelectDelay;
QTimer dragExpand;
- QListViewItem* dragOverItem;
+ Q3ListViewItem* dragOverItem;
QPoint dragOverPoint;
QPoint startDragPos;
int dragDelay;
//US KListViewLineEdit *editor;
- QValueList<int> renameable;
+ Q3ValueList<int> renameable;
bool cursorInExecuteArea:1;
bool bUseSingle:1;
bool bChangeCursorOverItem:1;
bool itemsMovable:1;
bool selectedBySimpleMove : 1;
bool selectedUsingMouse:1;
bool itemsRenameable:1;
bool validDrag:1;
bool dragEnabled:1;
bool autoOpen:1;
bool dropVisualizer:1;
bool dropHighlighter:1;
bool createChildren:1;
bool pressedOnSelected:1;
bool wasShiftEvent:1;
bool fullWidth:1;
bool sortAscending:1;
bool tabRename:1;
int sortColumn;
//+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX
int selectionDirection;
int tooltipColumn;
SelectionModeExt selectionMode;
int contextMenuKey;
bool showContextMenusOnPress;
QRect mOldDropVisualizer;
int mDropVisualizerWidth;
QRect mOldDropHighlighter;
- QListViewItem *afterItemDrop;
- QListViewItem *parentItemDrop;
+ Q3ListViewItem *afterItemDrop;
+ Q3ListViewItem *parentItemDrop;
QColor alternateBackground;
};
/*US
KListViewLineEdit::KListViewLineEdit(KListView *parent)
: KLineEdit(parent->viewport()), item(0), col(0), p(parent)
{
setFrame( false );
hide();
connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() ));
}
KListViewLineEdit::~KListViewLineEdit()
{
}
void KListViewLineEdit::load(QListViewItem *i, int c)
{
item=i;
col=c;
QRect rect(p->itemRect(i));
setText(item->text(c));
int fieldX = rect.x() - 1;
int fieldW = p->columnWidth(col) + 2;
int pos = p->header()->mapToIndex(col);
for ( int index = 0; index < pos; index++ )
fieldX += p->columnWidth( p->header()->mapToSection( index ));
if ( col == 0 ) {
int d = i->depth() + (p->rootIsDecorated() ? 1 : 0);
d *= p->treeStepSize();
fieldX += d;
fieldW -= d;
}
if ( i->pixmap( col ) ) {// add width of pixmap
int d = i->pixmap( col )->width();
fieldX += d;
fieldW -= d;
}
setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2);
show();
setFocus();
}
*/
/* Helper functions to for
* tabOrderedRename functionality.
*/
-static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir)
+static int nextCol (KListView *pl, Q3ListViewItem *pi, int start, int dir)
{
if (pi)
{
// Find the next renameable column in the current row
for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir)
if (pl->isRenameable(start))
return start;
}
return -1;
}
-static QListViewItem *prevItem (QListViewItem *pi)
+static Q3ListViewItem *prevItem (Q3ListViewItem *pi)
{
- QListViewItem *pa = pi->itemAbove();
+ Q3ListViewItem *pa = pi->itemAbove();
/* Does what the QListViewItem::previousSibling()
* of my dreams would do.
*/
if (pa && pa->parent() == pi->parent())
return pa;
return NULL;
}
-static QListViewItem *lastQChild (QListViewItem *pi)
+static Q3ListViewItem *lastQChild (Q3ListViewItem *pi)
{
if (pi)
{
/* Since there's no QListViewItem::lastChild().
* This finds the last sibling for the given
* item.
*/
- for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling())
+ for (Q3ListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling())
pi = pt;
}
return pi;
}
/*US
void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward)
{
const int ncols = p->columns();
const int dir = forward ? +1 : -1;
const int restart = forward ? 0 : (ncols - 1);
QListViewItem *top = (pitem && pitem->parent())
? pitem->parent()->firstChild()
: p->firstChild();
QListViewItem *pi = pitem;
terminate(); // Save current changes
do
{
*/
/* Check the rest of the current row for an editable column,
* if that fails, check the entire next/previous row. The
* last case goes back to the first item in the current branch
* or the last item in the current branch depending on the
* direction.
*/
/*US
if ((column = nextCol(p, pi, column + dir, dir)) != -1 ||
(column = nextCol(p, (pi = (forward ? pi->nextSibling() : prevItem(pi))), restart, dir)) != -1 ||
(column = nextCol(p, (pi = (forward ? top : lastQChild(pitem))), restart, dir)) != -1)
{
@@ -299,68 +314,68 @@ void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool f
p->rename(pi, column);
*/
/* Some listviews may override rename() to
* prevent certain items from being renamed,
* if this is done, [m_]item will be NULL
* after the rename() call... try again.
*/
/*US
if (!item)
continue;
break;
}
}
}
while (pi && !item);
}
*/
/*US
#ifdef KeyPress
#undef KeyPress
#endif
bool KListViewLineEdit::event (QEvent *pe)
{
if (pe->type() == QEvent::KeyPress)
{
QKeyEvent *k = (QKeyEvent *) pe;
if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) &&
p->tabOrderedRenaming() && p->itemsRenameable() &&
- !(k->state() & ControlButton || k->state() & AltButton))
+ !(k->state() & Qt::ControlButton || k->state() & AltButton))
{
selectNextCell(item, col,
- (k->key() == Key_Tab && !(k->state() & ShiftButton)));
+ (k->key() == Key_Tab && !(k->state() & Qt::ShiftButton)));
return true;
}
}
return KLineEdit::event(pe);
}
void KListViewLineEdit::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter )
terminate(true);
else if(e->key() == Qt::Key_Escape)
terminate(false);
else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up)
{
terminate(true);
KLineEdit::keyPressEvent(e);
}
else
KLineEdit::keyPressEvent(e);
}
void KListViewLineEdit::terminate()
{
terminate(true);
}
void KListViewLineEdit::terminate(bool commit)
{
if ( item )
{
//kdDebug() << "KListViewLineEdit::terminate " << commit << endl;
@@ -377,198 +392,198 @@ void KListViewLineEdit::terminate(bool commit)
void KListViewLineEdit::focusOutEvent(QFocusEvent *ev)
{
QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev);
// Don't let a RMB close the editor
if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow)
terminate(true);
}
void KListViewLineEdit::paintEvent( QPaintEvent *e )
{
KLineEdit::paintEvent( e );
if ( !frame() ) {
QPainter p( this );
p.setClipRegion( e->region() );
p.drawRect( rect() );
}
}
// selection changed -> terminate. As our "item" can be already deleted,
// we can't call terminate(false), because that would emit done() with
// a dangling pointer to "item".
void KListViewLineEdit::slotSelectionChanged()
{
item = 0;
col = 0;
hide();
}
*/
KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse )
- : QListView( parent, name ),
+ : Q3ListView( parent, name ),
d (new KListViewPrivate (this))
{
#ifndef DESKTOP_VERSION
if ( emulateRightMouse )
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
//US setDragAutoScroll(true);
connect( this, SIGNAL( onViewport() ),
this, SLOT( slotOnViewport() ) );
- connect( this, SIGNAL( onItem( QListViewItem * ) ),
- this, SLOT( slotOnItem( QListViewItem * ) ) );
+ connect( this, SIGNAL( onItem( Q3ListViewItem * ) ),
+ this, SLOT( slotOnItem( Q3ListViewItem * ) ) );
connect (this, SIGNAL(contentsMoving(int,int)),
this, SLOT(cleanDropVisualizer()));
connect (this, SIGNAL(contentsMoving(int,int)),
this, SLOT(cleanItemHighlighter()));
/*US
slotSettingsChanged(KApplication::SETTINGS_MOUSE);
if (kapp)
{
connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) );
kapp->addKipcEventMask( KIPC::SettingsChanged );
}
*/
slotSettingsChanged(1); //US do this to initialize the connections
connect(&d->autoSelect, SIGNAL( timeout() ),
this, SLOT( slotAutoSelect() ) );
connect(&d->dragExpand, SIGNAL( timeout() ),
this, SLOT( slotDragExpand() ) );
// context menu handling
if (d->showContextMenusOnPress)
{
- connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)),
- this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
+ connect (this, SIGNAL (rightButtonPressed (Q3ListViewItem*, const QPoint&, int)),
+ this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int)));
}
else
{
- connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
- this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
+ connect (this, SIGNAL (rightButtonClicked (Q3ListViewItem*, const QPoint&, int)),
+ this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int)));
}
- connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)),
- this, SLOT (emitContextMenu (KListView*, QListViewItem*)));
+ connect (this, SIGNAL (menuShortCutPressed (KListView*, Q3ListViewItem*)),
+ this, SLOT (emitContextMenu (KListView*, Q3ListViewItem*)));
//qDebug("KListView::KListView make alternate color configurable");
d->alternateBackground = KGlobalSettings::alternateBackgroundColor();
}
KListView::~KListView()
{
delete d;
}
bool KListView::isExecuteArea( const QPoint& point )
{
if ( itemAt( point ) )
return isExecuteArea( point.x() );
return false;
}
QSize KListView::sizeHint() const
{
//qDebug("KListView::QSize sizeHint() ");
#ifdef DESKTOP_VERSION
- return QListView::sizeHint();
+ return Q3ListView::sizeHint();
#else
return QSize ( 40, 40 );
#endif
}
bool KListView::isExecuteArea( int x )
{
if( allColumnsShowFocus() )
return true;
else {
int offset = 0;
int width = columnWidth( 0 );
int pos = header()->mapToIndex( 0 );
for ( int index = 0; index < pos; index++ )
offset += columnWidth( header()->mapToSection( index ) );
x += contentsX(); // in case of a horizontal scrollbar
return ( x > offset && x < ( offset + width ) );
}
}
-void KListView::slotOnItem( QListViewItem *item )
+void KListView::slotOnItem( Q3ListViewItem *item )
{
QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) {
d->autoSelect.start( d->autoSelectDelay, true );
d->pCurrentItem = item;
}
}
void KListView::slotOnViewport()
{
if ( d->bChangeCursorOverItem )
viewport()->unsetCursor();
d->autoSelect.stop();
d->pCurrentItem = 0L;
}
void KListView::slotSettingsChanged(int category)
{
//qDebug("KListView::slotSettingsChanged has to be verified");
switch (category)
{
//US I create my private category (=1) to set the settings
case 1:
d->dragDelay = 2;
//US set explicitly d->bUseSingle = KGlobalSettings::singleClick();
// qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle);
- disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
- this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int)));
+ disconnect(this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)),
+ this, SLOT (slotMouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)));
if( d->bUseSingle )
- connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
- this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int)));
+ connect (this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)),
+ this, SLOT (slotMouseButtonClicked( int, Q3ListViewItem*, const QPoint &, int)));
//US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
//US d->autoSelectDelay = KGlobalSettings::autoSelectDelay();
if( !d->bUseSingle || !d->bChangeCursorOverItem )
viewport()->unsetCursor();
break;
/*US
case KApplication::SETTINGS_MOUSE:
d->dragDelay = KGlobalSettings::dndEventDelay();
d->bUseSingle = KGlobalSettings::singleClick();
disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int)));
if( d->bUseSingle )
connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int)));
d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
d->autoSelectDelay = KGlobalSettings::autoSelectDelay();
if( !d->bUseSingle || !d->bChangeCursorOverItem )
viewport()->unsetCursor();
break;
case KApplication::SETTINGS_POPUPMENU:
d->contextMenuKey = KGlobalSettings::contextMenuKey ();
d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress ();
@@ -582,454 +597,454 @@ void KListView::slotSettingsChanged(int category)
else
{
disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
}
break;
*/
default:
break;
}
}
void KListView::slotAutoSelect()
{
// check that the item still exists
if( itemIndex( d->pCurrentItem ) == -1 )
return;
if (!isActiveWindow())
{
d->autoSelect.stop();
return;
}
//Give this widget the keyboard focus.
if( !hasFocus() )
setFocus();
- QListViewItem* previousItem = currentItem();
+ Q3ListViewItem* previousItem = currentItem();
setCurrentItem( d->pCurrentItem );
#if 0
#ifndef Q_WS_QWS
// FIXME(E): Implement for Qt Embedded
if( d->pCurrentItem ) {
//Shift pressed?
if( (keybstate & ShiftMask) ) {
bool block = signalsBlocked();
blockSignals( true );
//No Ctrl? Then clear before!
if( !(keybstate & ControlMask) )
clearSelection();
bool select = !d->pCurrentItem->isSelected();
bool update = viewport()->isUpdatesEnabled();
viewport()->setUpdatesEnabled( false );
bool down = previousItem->itemPos() < d->pCurrentItem->itemPos();
- QListViewItemIterator lit( down ? previousItem : d->pCurrentItem );
+ Q3ListViewItemIterator lit( down ? previousItem : d->pCurrentItem );
for ( ; lit.current(); ++lit ) {
if ( down && lit.current() == d->pCurrentItem ) {
d->pCurrentItem->setSelected( select );
break;
}
if ( !down && lit.current() == previousItem ) {
previousItem->setSelected( select );
break;
}
lit.current()->setSelected( select );
}
blockSignals( block );
viewport()->setUpdatesEnabled( update );
triggerUpdate();
emit selectionChanged();
- if( selectionMode() == QListView::Single )
+ if( selectionMode() == Q3ListView::Single )
emit selectionChanged( d->pCurrentItem );
}
else if( (keybstate & ControlMask) )
setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() );
else {
bool block = signalsBlocked();
blockSignals( true );
if( !d->pCurrentItem->isSelected() )
clearSelection();
blockSignals( block );
setSelected( d->pCurrentItem, true );
}
}
else
kdDebug() << "KListView::slotAutoSelect: Thats not supposed to happen!!!!" << endl;
#endif
#endif
}
void KListView::slotHeaderChanged()
{
if (d->fullWidth && columns())
{
int w = 0;
for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i);
setColumnWidth( columns() - 1, viewport()->width() - w - 1 );
}
}
-void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c)
+void KListView::emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c)
{
// qDebug("KListView::emitExecute buttonstate=%i", buttonstate);
if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) {
// Double click mode ?
if ( !d->bUseSingle )
{
emit executed( item );
emit executed( item, pos, c );
}
else
{
//US special implementation for embedded systems
d->autoSelect.stop();
//Dont emit executed if in SC mode and Shift or Ctrl are pressed
- if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) {
+ if( !( (buttonstate==Qt::ShiftButton) || (buttonstate==Qt::ControlButton) )) {
// if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) {
emit executed( item );
emit executed( item, pos, c );
}
}
}
}
void KListView::focusInEvent( QFocusEvent *fe )
{
// kdDebug()<<"KListView::focusInEvent()"<<endl;
- QListView::focusInEvent( fe );
+ Q3ListView::focusInEvent( fe );
if ((d->selectedBySimpleMove)
&& (d->selectionMode == FileManager)
&& (fe->reason()!=QFocusEvent::Popup)
&& (fe->reason()!=QFocusEvent::ActiveWindow)
&& (currentItem()!=0))
{
currentItem()->setSelected(true);
currentItem()->repaint();
emit selectionChanged();
};
}
void KListView::focusOutEvent( QFocusEvent *fe )
{
cleanDropVisualizer();
cleanItemHighlighter();
d->autoSelect.stop();
if ((d->selectedBySimpleMove)
&& (d->selectionMode == FileManager)
&& (fe->reason()!=QFocusEvent::Popup)
&& (fe->reason()!=QFocusEvent::ActiveWindow)
&& (currentItem()!=0)
/*US && (!d->editor->isVisible()) */
)
{
currentItem()->setSelected(false);
currentItem()->repaint();
emit selectionChanged();
};
- QListView::focusOutEvent( fe );
+ Q3ListView::focusOutEvent( fe );
}
void KListView::leaveEvent( QEvent *e )
{
d->autoSelect.stop();
- QListView::leaveEvent( e );
+ Q3ListView::leaveEvent( e );
}
bool KListView::event( QEvent *e )
{
if (e->type() == QEvent::ApplicationPaletteChange) {
//qDebug("KListView::event make alternate color configurable");
//US d->alternateBackground=KGlobalSettings::alternateBackgroundColor();
d->alternateBackground = QColor(240, 240, 240);
}
- return QListView::event(e);
+ return Q3ListView::event(e);
}
void KListView::contentsMousePressEvent( QMouseEvent *e )
{
//qDebug("KListView::contentsMousePressEvent");
- if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) )
+ if( (selectionModeExt() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) )
{
bool block = signalsBlocked();
blockSignals( true );
clearSelection();
blockSignals( block );
}
else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove))
{
d->selectedBySimpleMove=false;
d->selectedUsingMouse=true;
if (currentItem()!=0)
{
currentItem()->setSelected(false);
currentItem()->repaint();
// emit selectionChanged();
};
};
QPoint p( contentsToViewport( e->pos() ) );
- QListViewItem *at = itemAt (p);
+ Q3ListViewItem *at = itemAt (p);
// true if the root decoration of the item "at" was clicked (i.e. the +/- sign)
bool rootDecoClicked = at
&& ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
&& ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
- if (e->button() == LeftButton && !rootDecoClicked)
+ if (e->button() == Qt::LeftButton && !rootDecoClicked)
{
//Start a drag
d->startDragPos = e->pos();
if (at)
{
d->validDrag = true;
d->pressedOnSelected = at->isSelected();
}
}
- QListView::contentsMousePressEvent( e );
+ Q3ListView::contentsMousePressEvent( e );
}
void KListView::contentsMouseMoveEvent( QMouseEvent *e )
{
if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) {
- QListView::contentsMouseMoveEvent (e);
+ Q3ListView::contentsMouseMoveEvent (e);
return;
}
QPoint vp = contentsToViewport(e->pos());
- QListViewItem *item = itemAt( vp );
+ Q3ListViewItem *item = itemAt( vp );
//do we process cursor changes at all?
if ( item && d->bChangeCursorOverItem && d->bUseSingle )
{
//Cursor moved on a new item or in/out the execute area
if( (item != d->pCurrentItem) ||
(isExecuteArea(vp) != d->cursorInExecuteArea) )
{
d->cursorInExecuteArea = isExecuteArea(vp);
//qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet");
/*US
if( d->cursorInExecuteArea ) //cursor moved in execute area
viewport()->setCursor( KCursor::handCursor() );
else //cursor moved out of execute area
viewport()->unsetCursor();
*/
}
}
bool dragOn = dragEnabled();
QPoint newPos = e->pos();
if (dragOn && d->validDrag &&
(newPos.x() > d->startDragPos.x()+d->dragDelay ||
newPos.x() < d->startDragPos.x()-d->dragDelay ||
newPos.y() > d->startDragPos.y()+d->dragDelay ||
newPos.y() < d->startDragPos.y()-d->dragDelay))
//(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
{
- QListView::contentsMouseReleaseEvent( 0 );
+ Q3ListView::contentsMouseReleaseEvent( 0 );
startDrag();
d->startDragPos = QPoint();
d->validDrag = false;
}
}
void KListView::contentsMouseReleaseEvent( QMouseEvent *e )
{
- if (e->button() == LeftButton)
+ if (e->button() == Qt::LeftButton)
{
// If the row was already selected, maybe we want to start an in-place editing
if ( d->pressedOnSelected && itemsRenameable() )
{
QPoint p( contentsToViewport( e->pos() ) );
- QListViewItem *at = itemAt (p);
+ Q3ListViewItem *at = itemAt (p);
if ( at )
{
// true if the root decoration of the item "at" was clicked (i.e. the +/- sign)
bool rootDecoClicked =
( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
&& ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
if (!rootDecoClicked)
{
int col = header()->mapToLogical( header()->cellAt( p.x() ) );
if ( d->renameable.contains(col) )
rename(at, col);
}
}
}
d->pressedOnSelected = false;
d->validDrag = false;
d->startDragPos = QPoint();
}
- QListView::contentsMouseReleaseEvent( e );
+ Q3ListView::contentsMouseReleaseEvent( e );
}
void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e )
{
//qDebug("KListView::contentsMouseDoubleClickEvent");
// We don't want to call the parent method because it does setOpen,
// whereas we don't do it in single click mode... (David)
//QListView::contentsMouseDoubleClickEvent( e );
QPoint vp = contentsToViewport(e->pos());
- QListViewItem *item = itemAt( vp );
- emit QListView::doubleClicked( item ); // we do it now
+ Q3ListViewItem *item = itemAt( vp );
+ emit Q3ListView::doubleClicked( item ); // we do it now
int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1;
if( item ) {
//qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked");
emit doubleClicked( item, e->globalPos(), col );
- if( (e->button() == LeftButton) && !d->bUseSingle ) {
+ if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) {
//qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute");
emitExecute( e->button(), item, e->globalPos(), col);
}
}
}
-void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c )
+void KListView::slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c )
{
//qDebug("KListView::slotMouseButtonClicked");
- if( (btn == LeftButton) && item ) {
+ if( (btn == Qt::LeftButton) && item ) {
//qDebug("KListView::slotMouseButtonClicked: emitExecute");
emitExecute(btn, item, pos, c);
}
}
void KListView::contentsDropEvent(QDropEvent* e)
{
qDebug("KListView::contentsDropEvent drag&drop not supported yet");
/*US
cleanDropVisualizer();
cleanItemHighlighter();
d->dragExpand.stop();
if (acceptDrag (e))
{
e->acceptAction();
QListViewItem *afterme;
QListViewItem *parent;
findDrop(e->pos(), parent, afterme);
if (e->source() == viewport() && itemsMovable())
movableDropEvent(parent, afterme);
else
{
emit dropped(e, afterme);
emit dropped(this, e, afterme);
emit dropped(e, parent, afterme);
emit dropped(this, e, parent, afterme);
}
}
*/
}
-void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme)
+void KListView::movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme)
{
- QPtrList<QListViewItem> items, afterFirsts, afterNows;
- QListViewItem *current=currentItem();
+ Q3PtrList<Q3ListViewItem> items, afterFirsts, afterNows;
+ Q3ListViewItem *current=currentItem();
bool hasMoved=false;
- for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext)
+ for (Q3ListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext)
{
iNext=i->itemBelow();
if (!i->isSelected())
continue;
// don't drop an item after itself, or else
// it moves to the top of the list
if (i==afterme)
continue;
i->setSelected(false);
- QListViewItem *afterFirst = i->itemAbove();
+ Q3ListViewItem *afterFirst = i->itemAbove();
if (!hasMoved)
{
emit aboutToMove();
hasMoved=true;
}
moveItem(i, parent, afterme);
// ###### This should include the new parent !!! -> KDE 3.0
// If you need this right now, have a look at keditbookmarks.
emit moved(i, afterFirst, afterme);
items.append (i);
afterFirsts.append (afterFirst);
afterNows.append (afterme);
afterme = i;
}
clearSelection();
- for (QListViewItem *i=items.first(); i != 0; i=items.next() )
+ for (Q3ListViewItem *i=items.first(); i != 0; i=items.next() )
i->setSelected(true);
if (current)
setCurrentItem(current);
emit moved(items,afterFirsts,afterNows);
if (firstChild())
emit moved();
}
void KListView::contentsDragMoveEvent(QDragMoveEvent *event)
{
qDebug("KListView::contentsDropEvent drag&drop not supported yet");
/*US
if (acceptDrag(event))
{
event->acceptAction();
//Clean up the view
findDrop(event->pos(), d->parentItemDrop, d->afterItemDrop);
QPoint vp = contentsToViewport( event->pos() );
QListViewItem *item = isExecuteArea( vp ) ? itemAt( vp ) : 0L;
if ( item != d->dragOverItem )
{
d->dragExpand.stop();
d->dragOverItem = item;
d->dragOverPoint = vp;
if ( d->dragOverItem && d->dragOverItem->isExpandable() && !d->dragOverItem->isOpen() )
d->dragExpand.start( QApplication::startDragTime(), true );
}
if (dropVisualizer())
@@ -1057,1113 +1072,1113 @@ void KListView::contentsDragMoveEvent(QDragMoveEvent *event)
event->ignore();
*/
}
void KListView::slotDragExpand()
{
if ( itemAt( d->dragOverPoint ) == d->dragOverItem )
d->dragOverItem->setOpen( true );
}
void KListView::contentsDragLeaveEvent (QDragLeaveEvent*)
{
d->dragExpand.stop();
cleanDropVisualizer();
cleanItemHighlighter();
}
void KListView::cleanDropVisualizer()
{
if (d->mOldDropVisualizer.isValid())
{
QRect rect=d->mOldDropVisualizer;
d->mOldDropVisualizer = QRect();
viewport()->repaint(rect, true);
}
}
int KListView::depthToPixels( int depth )
{
return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin();
}
-void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after)
+void KListView::findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after)
{
QPoint p (contentsToViewport(pos));
// Get the position to put it in
- QListViewItem *atpos = itemAt(p);
+ Q3ListViewItem *atpos = itemAt(p);
- QListViewItem *above;
+ Q3ListViewItem *above;
if (!atpos) // put it at the end
above = lastItem();
else
{
// Get the closest item before us ('atpos' or the one above, if any)
if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2))
above = atpos->itemAbove();
else
above = atpos;
}
if (above)
{
// Now, we know we want to go after "above". But as a child or as a sibling ?
// We have to ask the "above" item if it accepts children.
if (above->isExpandable())
{
// The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children
if (p.x() >= depthToPixels( above->depth() + 1 ) ||
(above->isOpen() && above->childCount() > 0) )
{
parent = above;
after = 0L;
return;
}
}
// Ok, there's one more level of complexity. We may want to become a new
// sibling, but of an upper-level group, rather than the "above" item
- QListViewItem * betterAbove = above->parent();
- QListViewItem * last = above;
+ Q3ListViewItem * betterAbove = above->parent();
+ Q3ListViewItem * last = above;
while ( betterAbove )
{
// We are allowed to become a sibling of "betterAbove" only if we are
// after its last child
if ( last->nextSibling() == 0 )
{
if (p.x() < depthToPixels ( betterAbove->depth() + 1 ))
above = betterAbove; // store this one, but don't stop yet, there may be a better one
else
break; // not enough on the left, so stop
last = betterAbove;
betterAbove = betterAbove->parent(); // up one level
} else
break; // we're among the child of betterAbove, not after the last one
}
}
// set as sibling
after = above;
parent = after ? after->parent() : 0L ;
}
-QListViewItem* KListView::lastChild () const
+Q3ListViewItem* KListView::lastChild () const
{
- QListViewItem* lastchild = firstChild();
+ Q3ListViewItem* lastchild = firstChild();
if (lastchild)
for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling());
return lastchild;
}
-QListViewItem *KListView::lastItem() const
+Q3ListViewItem *KListView::lastItem() const
{
- QListViewItem* last = lastChild();
+ Q3ListViewItem* last = lastChild();
- for (QListViewItemIterator it (last); it.current(); ++it)
+ for (Q3ListViewItemIterator it (last); it.current(); ++it)
last = it.current();
return last;
}
KLineEdit *KListView::renameLineEdit() const
{
//US return d->editor;
qDebug("KListView::renameLineEdit returns 0. Might crash");
return 0;
}
void KListView::startDrag()
{
qDebug("KListView::startDrag drag&drop not supported yet.");
/*US
QDragObject *drag = dragObject();
if (!drag)
return;
if (drag->drag() && drag->target() != viewport())
emit moved();
*/
}
-QDragObject *KListView::dragObject()
+Q3DragObject *KListView::dragObject()
{
if (!currentItem())
return 0;
- return new QStoredDrag("application/x-qlistviewitem", viewport());
+ return new Q3StoredDrag("application/x-qlistviewitem", viewport());
}
void KListView::setItemsMovable(bool b)
{
d->itemsMovable=b;
}
bool KListView::itemsMovable() const
{
return d->itemsMovable;
}
void KListView::setItemsRenameable(bool b)
{
d->itemsRenameable=b;
}
bool KListView::itemsRenameable() const
{
return d->itemsRenameable;
}
void KListView::setDragEnabled(bool b)
{
d->dragEnabled=b;
}
bool KListView::dragEnabled() const
{
return d->dragEnabled;
}
void KListView::setAutoOpen(bool b)
{
d->autoOpen=b;
}
bool KListView::autoOpen() const
{
return d->autoOpen;
}
bool KListView::dropVisualizer() const
{
return d->dropVisualizer;
}
void KListView::setDropVisualizer(bool b)
{
d->dropVisualizer=b;
}
-QPtrList<QListViewItem> KListView::selectedItems() const
+Q3PtrList<Q3ListViewItem> KListView::selectedItems() const
{
- QPtrList<QListViewItem> list;
- for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow())
+ Q3PtrList<Q3ListViewItem> list;
+ for (Q3ListViewItem *i=firstChild(); i!=0; i=i->itemBelow())
if (i->isSelected()) list.append(i);
return list;
}
-void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after)
+void KListView::moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after)
{
// sanity check - don't move a item into it's own child structure
- QListViewItem *i = parent;
+ Q3ListViewItem *i = parent;
while(i)
{
if(i == item)
return;
i = i->parent();
}
// Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor
// in here, without ever deleting the item.
if (item->parent())
item->parent()->takeItem(item);
else
takeItem(item);
if (parent)
parent->insertItem(item);
else
insertItem(item);
if (after)
;//item->moveToJustAfter(after);
}
void KListView::contentsDragEnterEvent(QDragEnterEvent *event)
{
qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet.");
/*US
if (acceptDrag (event))
event->accept();
*/
}
void KListView::setDropVisualizerWidth (int w)
{
d->mDropVisualizerWidth = w > 0 ? w : 1;
}
-QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent,
- QListViewItem *after)
+QRect KListView::drawDropVisualizer(QPainter *p, Q3ListViewItem *parent,
+ Q3ListViewItem *after)
{
QRect insertmarker;
if (!after && !parent)
insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2);
else
{
int level = 0;
if (after)
{
- QListViewItem* it = 0L;
+ Q3ListViewItem* it = 0L;
if (after->isOpen())
{
// Look for the last child (recursively)
it = after->firstChild();
if (it)
while (it->nextSibling() || it->firstChild())
if ( it->nextSibling() )
it = it->nextSibling();
else
it = it->firstChild();
}
insertmarker = itemRect (it ? it : after);
level = after->depth();
}
else if (parent)
{
insertmarker = itemRect (parent);
level = parent->depth() + 1;
}
insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() );
insertmarker.setRight (viewport()->width());
insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1);
insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2);
}
// This is not used anymore, at least by KListView itself (see viewportPaintEvent)
// Remove for KDE 3.0.
if (p)
- p->fillRect(insertmarker, Dense4Pattern);
+ p->fillRect(insertmarker, Qt::Dense4Pattern);
return insertmarker;
}
-QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item)
+QRect KListView::drawItemHighlighter(QPainter *painter, Q3ListViewItem *item)
{
QRect r;
if (item)
{
r = itemRect(item);
r.setLeft(r.left()+(item->depth()+1)*treeStepSize());
if (painter) {
//US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(),
//US QStyle::Style_FocusAtBorder, colorGroup().highlight());
const QColor* pHighl = &(colorGroup().highlight());
//LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true);
qDebug("KListView::drawItemHighlighter has to be verified");
}
}
return r;
}
void KListView::cleanItemHighlighter ()
{
if (d->mOldDropHighlighter.isValid())
{
QRect rect=d->mOldDropHighlighter;
d->mOldDropHighlighter = QRect();
viewport()->repaint(rect, true);
}
}
-void KListView::rename(QListViewItem *item, int c)
+void KListView::rename(Q3ListViewItem *item, int c)
{
if (d->renameable.contains(c))
{
ensureItemVisible(item);
//US d->editor->load(item,c);
qDebug("KListView::rename has to be verified");
}
}
bool KListView::isRenameable (int col) const
{
return d->renameable.contains(col);
}
void KListView::setRenameable (int col, bool yesno)
{
if (col>=header()->count()) return;
d->renameable.remove(col);
if (yesno && d->renameable.find(col)==d->renameable.end())
d->renameable+=col;
else if (!yesno && d->renameable.find(col)!=d->renameable.end())
d->renameable.remove(col);
}
-void KListView::doneEditing(QListViewItem *item, int row)
+void KListView::doneEditing(Q3ListViewItem *item, int row)
{
emit itemRenamed(item, item->text(row), row);
emit itemRenamed(item);
}
bool KListView::acceptDrag(QDropEvent* e) const
{
qDebug("KListView::acceptDrag drag&drop not supported yet");
//US return acceptDrops() && itemsMovable() && (e->source()==viewport());
return false;
}
void KListView::setCreateChildren(bool b)
{
d->createChildren=b;
}
bool KListView::createChildren() const
{
return d->createChildren;
}
int KListView::tooltipColumn() const
{
return d->tooltipColumn;
}
void KListView::setTooltipColumn(int column)
{
d->tooltipColumn=column;
}
void KListView::setDropHighlighter(bool b)
{
d->dropHighlighter=b;
}
bool KListView::dropHighlighter() const
{
return d->dropHighlighter;
}
-bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const
+bool KListView::showTooltip(Q3ListViewItem *item, const QPoint &, int column) const
{
return ((tooltip(item, column).length()>0) && (column==tooltipColumn()));
}
-QString KListView::tooltip(QListViewItem *item, int column) const
+QString KListView::tooltip(Q3ListViewItem *item, int column) const
{
return item->text(column);
}
void KListView::setTabOrderedRenaming(bool b)
{
d->tabRename = b;
}
bool KListView::tabOrderedRenaming() const
{
return d->tabRename;
}
void KListView::keyPressEvent (QKeyEvent* e)
{
//don't we need a contextMenuModifier too ? (aleXXX)
if (e->key() == d->contextMenuKey)
{
emit menuShortCutPressed (this, currentItem());
return;
}
if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace)
{
emit signalDelete ( );
return;
}
if (d->selectionMode != FileManager)
- QListView::keyPressEvent (e);
+ Q3ListView::keyPressEvent (e);
else
fileManagerKeyPressEvent (e);
}
void KListView::activateAutomaticSelection()
{
d->selectedBySimpleMove=true;
d->selectedUsingMouse=false;
if (currentItem()!=0)
{
selectAll(false);
currentItem()->setSelected(true);
currentItem()->repaint();
emit selectionChanged();
};
}
void KListView::deactivateAutomaticSelection()
{
d->selectedBySimpleMove=false;
}
bool KListView::automaticSelection() const
{
return d->selectedBySimpleMove;
}
void KListView::fileManagerKeyPressEvent (QKeyEvent* e)
{
//don't care whether it's on the keypad or not
- int e_state=(e->state() & ~Keypad);
+ int e_state=(e->state() & ~Qt::Keypad);
int oldSelectionDirection(d->selectionDirection);
- if ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
- && (e->key()!=Key_Meta) && (e->key()!=Key_Alt))
+ if ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control)
+ && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt))
{
- if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove))
+ if ((e_state==Qt::ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove))
selectAll(FALSE);
d->selectionDirection=0;
- d->wasShiftEvent = (e_state == ShiftButton);
+ d->wasShiftEvent = (e_state == Qt::ShiftButton);
};
- //d->wasShiftEvent = (e_state == ShiftButton);
+ //d->wasShiftEvent = (e_state == Qt::ShiftButton);
- QListViewItem* item = currentItem();
+ Q3ListViewItem* item = currentItem();
if (item==0) return;
- QListViewItem* repaintItem1 = item;
- QListViewItem* repaintItem2 = 0L;
- QListViewItem* visItem = 0L;
+ Q3ListViewItem* repaintItem1 = item;
+ Q3ListViewItem* repaintItem2 = 0L;
+ Q3ListViewItem* visItem = 0L;
- QListViewItem* nextItem = 0L;
+ Q3ListViewItem* nextItem = 0L;
int items = 0;
- bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton));
+ bool shiftOrCtrl((e_state==Qt::ControlButton) || (e_state==Qt::ShiftButton));
int selectedItems(0);
- for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling())
+ for (Q3ListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling())
if (tmpItem->isSelected()) selectedItems++;
if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse)))
- && (e_state==NoButton)
- && ((e->key()==Key_Down)
- || (e->key()==Key_Up)
- || (e->key()==Key_Next)
- || (e->key()==Key_Prior)
- || (e->key()==Key_Home)
- || (e->key()==Key_End)))
+ && (e_state==Qt::NoButton)
+ && ((e->key()==Qt::Key_Down)
+ || (e->key()==Qt::Key_Up)
+ || (e->key()==Qt::Key_Next)
+ || (e->key()==Qt::Key_Prior)
+ || (e->key()==Qt::Key_Home)
+ || (e->key()==Qt::Key_End)))
{
d->selectedBySimpleMove=true;
d->selectedUsingMouse=false;
}
else if (selectedItems>1)
d->selectedBySimpleMove=false;
bool emitSelectionChanged(false);
switch (e->key())
{
- case Key_Escape:
+ case Qt::Key_Escape:
selectAll(FALSE);
emitSelectionChanged=TRUE;
break;
- case Key_Space:
+ case Qt::Key_Space:
//toggle selection of current item
if (d->selectedBySimpleMove)
d->selectedBySimpleMove=false;
item->setSelected(!item->isSelected());
emitSelectionChanged=TRUE;
break;
- case Key_Insert:
+ case Qt::Key_Insert:
//toggle selection of current item and move to the next item
if (d->selectedBySimpleMove)
{
d->selectedBySimpleMove=false;
if (!item->isSelected()) item->setSelected(TRUE);
}
else
{
item->setSelected(!item->isSelected());
};
nextItem=item->itemBelow();
if (nextItem!=0)
{
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
};
d->selectionDirection=1;
emitSelectionChanged=TRUE;
break;
- case Key_Down:
+ case Qt::Key_Down:
nextItem=item->itemBelow();
//toggle selection of current item and move to the next item
if (shiftOrCtrl)
{
d->selectionDirection=1;
if (d->selectedBySimpleMove)
d->selectedBySimpleMove=false;
else
{
if (oldSelectionDirection!=-1)
{
item->setSelected(!item->isSelected());
emitSelectionChanged=TRUE;
};
};
}
else if ((d->selectedBySimpleMove) && (nextItem!=0))
{
item->setSelected(false);
emitSelectionChanged=TRUE;
};
if (nextItem!=0)
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
};
break;
- case Key_Up:
+ case Qt::Key_Up:
nextItem=item->itemAbove();
d->selectionDirection=-1;
//move to the prev. item and toggle selection of this one
// => No, can't select the last item, with this. For symmetry, let's
// toggle selection and THEN move up, just like we do in down (David)
if (shiftOrCtrl)
{
if (d->selectedBySimpleMove)
d->selectedBySimpleMove=false;
else
{
if (oldSelectionDirection!=1)
{
item->setSelected(!item->isSelected());
emitSelectionChanged=TRUE;
};
}
}
else if ((d->selectedBySimpleMove) && (nextItem!=0))
{
item->setSelected(false);
emitSelectionChanged=TRUE;
};
if (nextItem!=0)
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
};
break;
- case Key_End:
+ case Qt::Key_End:
//move to the last item and toggle selection of all items inbetween
nextItem=item;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
d->selectedBySimpleMove=false;
while(nextItem!=0)
{
if (shiftOrCtrl)
nextItem->setSelected(!nextItem->isSelected());
if (nextItem->itemBelow()==0)
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
}
nextItem=nextItem->itemBelow();
}
emitSelectionChanged=TRUE;
break;
- case Key_Home:
+ case Qt::Key_Home:
// move to the first item and toggle selection of all items inbetween
nextItem = firstChild();
visItem = nextItem;
repaintItem2 = visItem;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
{
d->selectedBySimpleMove=false;
while ( nextItem != item )
{
nextItem->setSelected( !nextItem->isSelected() );
nextItem = nextItem->itemBelow();
}
item->setSelected( !item->isSelected() );
}
setCurrentItem( firstChild() );
emitSelectionChanged=TRUE;
break;
- case Key_Next:
+ case Qt::Key_Next:
items=visibleHeight()/item->height();
nextItem=item;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
{
d->selectedBySimpleMove=false;
d->selectionDirection=1;
};
for (int i=0; i<items; i++)
{
if (shiftOrCtrl)
nextItem->setSelected(!nextItem->isSelected());
//the end
if ((i==items-1) || (nextItem->itemBelow()==0))
{
if (shiftOrCtrl)
nextItem->setSelected(!nextItem->isSelected());
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
ensureItemVisible(nextItem);
setCurrentItem(nextItem);
update();
if ((shiftOrCtrl) || (d->selectedBySimpleMove))
{
emit selectionChanged();
}
return;
}
nextItem=nextItem->itemBelow();
}
break;
- case Key_Prior:
+ case Qt::Key_Prior:
items=visibleHeight()/item->height();
nextItem=item;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
{
d->selectionDirection=-1;
d->selectedBySimpleMove=false;
};
for (int i=0; i<items; i++)
{
if ((nextItem!=item) &&(shiftOrCtrl))
nextItem->setSelected(!nextItem->isSelected());
//the end
if ((i==items-1) || (nextItem->itemAbove()==0))
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
ensureItemVisible(nextItem);
setCurrentItem(nextItem);
update();
if ((shiftOrCtrl) || (d->selectedBySimpleMove))
{
emit selectionChanged();
}
return;
}
nextItem=nextItem->itemAbove();
}
break;
- case Key_Minus:
+ case Qt::Key_Minus:
if ( item->isOpen() )
setOpen( item, FALSE );
break;
- case Key_Plus:
+ case Qt::Key_Plus:
if ( !item->isOpen() && (item->isExpandable() || item->childCount()) )
setOpen( item, TRUE );
break;
default:
- bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
- && (e->key()!=Key_Meta) && (e->key()!=Key_Alt));
+ bool realKey = ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control)
+ && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt));
bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected());
if (realKey && selectCurrentItem)
item->setSelected(false);
//this is mainly for the "goto filename beginning with pressed char" feature (aleXXX)
- QListView::SelectionMode oldSelectionMode = selectionMode();
- setSelectionMode (QListView::Multi);
- QListView::keyPressEvent (e);
+ Q3ListView::SelectionMode oldSelectionMode = selectionMode();
+ setSelectionMode (Q3ListView::Multi);
+ Q3ListView::keyPressEvent (e);
setSelectionMode (oldSelectionMode);
if (realKey && selectCurrentItem)
{
currentItem()->setSelected(true);
emitSelectionChanged=TRUE;
}
repaintItem2=currentItem();
if (realKey)
visItem=currentItem();
break;
}
if (visItem)
ensureItemVisible(visItem);
QRect ir;
if (repaintItem1)
ir = ir.unite( itemRect(repaintItem1) );
if (repaintItem2)
ir = ir.unite( itemRect(repaintItem2) );
if ( !ir.isEmpty() )
{ // rectangle to be repainted
if ( ir.x() < 0 )
ir.moveBy( -ir.x(), 0 );
viewport()->repaint( ir, FALSE );
}
/*if (repaintItem1)
repaintItem1->repaint();
if (repaintItem2)
repaintItem2->repaint();*/
update();
if (emitSelectionChanged)
emit selectionChanged();
}
void KListView::setSelectionModeExt (SelectionModeExt mode)
{
d->selectionMode = mode;
switch (mode)
{
case Single:
case Multi:
case Extended:
case NoSelection:
- setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode)));
+ setSelectionMode (static_cast<Q3ListView::SelectionMode>(static_cast<int>(mode)));
break;
case FileManager:
- setSelectionMode (QListView::Extended);
+ setSelectionMode (Q3ListView::Extended);
break;
default:
kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl;
break;
}
}
KListView::SelectionModeExt KListView::selectionModeExt () const
{
return d->selectionMode;
}
-int KListView::itemIndex( const QListViewItem *item ) const
+int KListView::itemIndex( const Q3ListViewItem *item ) const
{
if ( !item )
return -1;
if ( item == firstChild() )
return 0;
else {
- QListViewItemIterator it(firstChild());
+ Q3ListViewItemIterator it(firstChild());
uint j = 0;
for (; it.current() && it.current() != item; ++it, ++j );
if( !it.current() )
return -1;
return j;
}
}
-QListViewItem* KListView::itemAtIndex(int index)
+Q3ListViewItem* KListView::itemAtIndex(int index)
{
if (index<0)
return 0;
int j(0);
- for (QListViewItemIterator it=firstChild(); it.current(); it++)
+ for (Q3ListViewItemIterator it=firstChild(); it.current(); it++)
{
if (j==index)
return it.current();
j++;
};
return 0;
}
-void KListView::emitContextMenu (KListView*, QListViewItem* i)
+void KListView::emitContextMenu (KListView*, Q3ListViewItem* i)
{
QPoint p;
// qDebug("KListView::emitContextMenu ");
if (i)
p = viewport()->mapToGlobal(itemRect(i).center());
else
p = mapToGlobal(rect().center());
emit contextMenu (this, i, p);
}
-void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col)
+void KListView::emitContextMenu (Q3ListViewItem* i, const QPoint& p, int col)
{
- QListViewItem* item = i;
+ Q3ListViewItem* item = i;
int c = col;
// do not trust the values for QListViewItem* i and int col;
// qDebug("KListView::emitContextMenu col");
if ( col == -1 ) {
QPoint pp = viewport()->mapFromGlobal(p);
item = itemAt( pp);
c = header()->sectionAt(pp.x() );
}
emit contextRequest( item, p, c );
emit contextMenu (this, item, p);
}
void KListView::setAcceptDrops (bool val)
{
- QListView::setAcceptDrops (val);
+ Q3ListView::setAcceptDrops (val);
viewport()->setAcceptDrops (val);
}
int KListView::dropVisualizerWidth () const
{
return d->mDropVisualizerWidth;
}
void KListView::viewportPaintEvent(QPaintEvent *e)
{
- QListView::viewportPaintEvent(e);
+ Q3ListView::viewportPaintEvent(e);
if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer))
{
QPainter painter(viewport());
// This is where we actually draw the drop-visualizer
- painter.fillRect(d->mOldDropVisualizer, Dense4Pattern);
+ painter.fillRect(d->mOldDropVisualizer, Qt::Dense4Pattern);
}
if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter))
{
QPainter painter(viewport());
qDebug("KListView::viewportPaintEvent has to be verified");
// This is where we actually draw the drop-highlighter
//US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(),
//US QStyle::Style_FocusAtBorder);
//LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true);
}
}
void KListView::setFullWidth()
{
setFullWidth(true);
}
void KListView::setFullWidth(bool fullWidth)
{
d->fullWidth = fullWidth;
//US header()->setStretchEnabled(fullWidth, columns()-1);
}
bool KListView::fullWidth() const
{
return d->fullWidth;
}
int KListView::addColumn(const QString& label, int width)
{
- int result = QListView::addColumn(label, width);
+ int result = Q3ListView::addColumn(label, width);
if (d->fullWidth) {
//US header()->setStretchEnabled(false, columns()-2);
//US header()->setStretchEnabled(true, columns()-1);
}
return result;
}
-int KListView::addColumn(const QIconSet& iconset, const QString& label, int width)
+int KListView::addColumn(const QIcon& iconset, const QString& label, int width)
{
- int result = QListView::addColumn(iconset, label, width);
+ int result = Q3ListView::addColumn(iconset, label, width);
if (d->fullWidth) {
//US header()->setStretchEnabled(false, columns()-2);
//US header()->setStretchEnabled(true, columns()-1);
}
return result;
}
void KListView::removeColumn(int index)
{
- QListView::removeColumn(index);
+ Q3ListView::removeColumn(index);
//US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1);
}
void KListView::viewportResizeEvent(QResizeEvent* e)
{
- QListView::viewportResizeEvent(e);
+ Q3ListView::viewportResizeEvent(e);
}
const QColor &KListView::alternateBackground() const
{
return d->alternateBackground;
}
void KListView::setAlternateBackground(const QColor &c)
{
d->alternateBackground = c;
repaint();
}
void KListView::saveLayout(KConfig *config, const QString &group) const
{
KConfigGroupSaver saver(config, group);
QStringList widths, order;
for (int i = 0; i < columns(); ++i)
{
widths << QString::number(columnWidth(i));
order << QString::number(header()->mapToIndex(i));
}
config->writeEntry("ColumnWidths", widths);
config->writeEntry("ColumnOrder", order);
config->writeEntry("SortColumn", d->sortColumn);
config->writeEntry("SortAscending", d->sortAscending);
}
void KListView::restoreLayout(KConfig *config, const QString &group)
{
KConfigGroupSaver saver(config, group);
QStringList cols = config->readListEntry("ColumnWidths");
int i = 0;
for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it)
setColumnWidth(i++, (*it).toInt());
cols = config->readListEntry("ColumnOrder");
i = 0;
for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it)
header()->moveSection(i++, (*it).toInt());
/*US I changed the following code, because hasKey is not available.
!!! check if my version is correct
if (config->hasKey("SortColumn"))
setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true));
*/
QStringList langLst = config->readListEntry( "SortColumn" );
if (!langLst.isEmpty())
setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true));
}
void KListView::setSorting(int column, bool ascending)
{
d->sortColumn = column;
d->sortAscending = ascending;
- QListView::setSorting(column, ascending);
+ Q3ListView::setSorting(column, ascending);
}
int KListView::columnSorted(void) const
{
return d->sortColumn;
}
bool KListView::ascendingSort(void) const
{
return d->sortAscending;
}
-KListViewItem::KListViewItem(QListView *parent)
- : QListViewItem(parent)
+KListViewItem::KListViewItem(Q3ListView *parent)
+ : Q3ListViewItem(parent)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent)
- : QListViewItem(parent)
+KListViewItem::KListViewItem(Q3ListViewItem *parent)
+ : Q3ListViewItem(parent)
{
init();
}
-KListViewItem::KListViewItem(QListView *parent, QListViewItem *after)
- : QListViewItem(parent, after)
+KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after)
+ : Q3ListViewItem(parent, after)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after)
- : QListViewItem(parent, after)
+KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after)
+ : Q3ListViewItem(parent, after)
{
init();
}
-KListViewItem::KListViewItem(QListView *parent,
+KListViewItem::KListViewItem(Q3ListView *parent,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent,
+KListViewItem::KListViewItem(Q3ListViewItem *parent,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
-KListViewItem::KListViewItem(QListView *parent, QListViewItem *after,
+KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after,
+KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
KListViewItem::~KListViewItem()
{
}
void KListViewItem::init()
{
m_known = false;
}
const QColor &KListViewItem::backgroundColor()
{
if (isAlternate())
return static_cast< KListView* >(listView())->alternateBackground();
return listView()->viewport()->colorGroup().base();
}
bool KListViewItem::isAlternate()
{
KListView *lv = static_cast<KListView *>(listView());
if (lv && lv->alternateBackground().isValid())
{
KListViewItem *above = 0;
//US above = dynamic_cast<KListViewItem *>(itemAbove());
above = (KListViewItem *)(itemAbove());
m_known = above ? above->m_known : true;
if (m_known)
{
m_odd = above ? !above->m_odd : false;
@@ -2183,56 +2198,56 @@ bool KListViewItem::isAlternate()
}
else
{
//US item = dynamic_cast<KListViewItem *>(lv->firstChild());
item = (KListViewItem *)(lv->firstChild());
}
while(item)
{
item->m_odd = previous = !previous;
item->m_known = true;
//US item = dynamic_cast<KListViewItem *>(item->nextSibling());
item = (KListViewItem *)(item->nextSibling());
}
}
return m_odd;
}
return false;
}
void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
{
QColorGroup _cg = cg;
const QPixmap *pm = listView()->viewport()->backgroundPixmap();
if (pm && !pm->isNull())
{
_cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm));
QPoint o = p->brushOrigin();
p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() );
}
else if (isAlternate()) {
//US if (listView()->viewport()->backgroundMode()==Qt::FixedColor)
- if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground)
+ if (listView()->viewport()->backgroundMode()==Qt::PaletteBackground)
_cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground());
else
_cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground());
}
- QListViewItem::paintCell(p, _cg, column, width, alignment);
+ Q3ListViewItem::paintCell(p, _cg, column, width, alignment);
}
//US we do not have a "global KDE" variable to setup singleClick functionality
void KListView::setSingleClick(bool s)
{
d->bUseSingle = s;
slotSettingsChanged(1);
// qDebug("KListView::setSingleClick: single %i", d->bUseSingle);
}
void KListView::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "klistview.moc"
//US #include "klistviewlineedit.moc"
// vim: ts=2 sw=2 et
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index 9f0d9fd..2176525 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -1,215 +1,226 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
Copyright (C) 2000 Charles Samuels <charles@kde.org>
Copyright (C) 2000 Peter Putzer <putzer@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLISTVIEW_H
#define KLISTVIEW_H
-#include <qlistview.h>
-
-#include <qptrlist.h>
+#include <q3listview.h>
+
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QDragLeaveEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <QDragEnterEvent>
//US
class QDropEvent;
class QDragLeaveEvent;
class QDragMoveEvent;
class QDragEnterEvent;
-class QDragObject;
+class Q3DragObject;
class KConfig;
class KLineEdit;
/**
* This Widget extends the functionality of QListView to honor the system
* wide settings for Single Click/Double Click mode, AutoSelection and
* ChangeCursorOverLink (TM).
*
* There is a new signal executed(). It gets connected to either
* @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE
* wide Single Click/Double Click settings. It is strongly recommended that
* you use this signal instead of the above mentioned. This way you dont
* need to care about the current settings.
* If you want to get informed when the user selects something connect to the
* QListView::selectionChanged() signal.
*
* Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true)
* and connect it to a suitable slot.
* To see where you are dropping, @ref setDropVisualizer(true).
* And also you'll need @ref acceptDrag(QDropEvent*)
*
* KListView is drag-enabled, too: to benefit from that you've got derive from it.
* Reimplement @ref dragObject() and (possibly) @ref startDrag(),
* and @ref setDragEnabled(true).
*
* @version $Id$
*/
-class KListView : public QListView
+class KListView : public Q3ListView
{
Q_OBJECT
Q_ENUMS( SelectionModeExt )
Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
public:
/**
* Possible selection modes.
*
* The first four correspond directly to QListView::SelectionMode, while
* the FileManager selection mode is defined as follows:
* @li home: move to the first
* @li end: move to the last
* @li PgUp/PgDn: move one page up/down
* @li up/down: move one item up/down
* @li insert: toggle selection of current and move to the next
* @li space: toggle selection of the current
* @li CTRL+up: move to the previous item and toggle selection of this one
* @li CTRL+down: toggle selection of the current item and move to the next
* @li CTRL+end: toggle selection from (including) the current
* item to (including) the last item
* @li CTRL+home: toggle selection from (including) the current
* item to the (including) the first item
* @li CTRL+PgDn: toggle selection from (including) the current
* item to (excluding) the item one page down
* @li CTRL+PgUp: toggle selection from (excluding) the current
* item to (including) the item one page up
*
* The combinations work the same with SHIFT instead of CTRL, except
* that if you start selecting something using SHIFT everything selected
* before will be deselected first.
*
* Additionally the current item is always selected automatically when
* navigating using the keyboard, except other items were selected explicitely.
*
* This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected
*/
enum SelectionModeExt {
- Single = QListView::Single,
- Multi = QListView::Multi,
- Extended = QListView::Extended,
- NoSelection = QListView::NoSelection,
+ Single = Q3ListView::Single,
+ Multi = Q3ListView::Multi,
+ Extended = Q3ListView::Extended,
+ NoSelection = Q3ListView::NoSelection,
FileManager
};
void repaintContents( bool erase = true )
{
- QScrollView::repaintContents( contentsX(), contentsY(),
+ Q3ScrollView::repaintContents( contentsX(), contentsY(),
visibleWidth(), visibleHeight(), erase );
};
/**
* Constructor.
*
* The parameters @p parent and @p name are handled by
* @ref QListView, as usual.
*/
KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true );
/**
* Destructor.
*/
virtual ~KListView();
virtual QSize sizeHint() const;
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void setAcceptDrops (bool);
/**
* This function determines whether the given coordinates are within the
* execute area. The execute area is the part of a @ref QListViewItem where mouse
* clicks or double clicks respectively generate a @ref #executed() signal.
* Depending on @ref QListView::allColumnsShowFocus() this is either the
* whole item or only the first column.
* @return true if point is inside execute area of an item, false in all
* other cases including the case that it is over the viewport.
*/
virtual bool isExecuteArea( const QPoint& point );
/**
* Same thing, but from an x coordinate only. This only checks if x is in
* the first column (if all columns don't show focus), without testing if
* the y coordinate is over an item or not.
*/
bool isExecuteArea( int x );
/**
* @return a list containing the currently selected items.
*/
- QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
+ Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
/**
* Arbitrarily move @p item to @p parent, positioned immediately after item @p after.
*/
- void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after);
+ void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after);
/**
* @return the last item (not child!) of this listview.
*
* @see lastChild()
*/
- QListViewItem *lastItem() const;
+ Q3ListViewItem *lastItem() const;
/**
* @return the last child of this listview.
*
* @see lastItem()
*/
- QListViewItem* lastChild () const;
+ Q3ListViewItem* lastChild () const;
/**
* @return the lineedit used for inline renaming.
* Use that to setup a @ref KCompletion or @ref QValidator for the lineedit
*
* @since 3.2
*/
KLineEdit* renameLineEdit() const;
/**
* @returns if it is legal to move items in the list view. True by default.
*
* @see #setDragEnabled()
* @see #setItemsMovable()
*/
bool itemsMovable() const;
/**
* @return whether inplace-renaming has been enabled. False by default.
*
* @see #setItemsRenameable()
*/
bool itemsRenameable() const;
/**
* @return whether dragging is enabled. False by default.
*
* @see #setDragEnabled()
*/
bool dragEnabled() const;
/**
@@ -247,103 +258,103 @@ public:
* @deprecated
*/
bool createChildren() const;
/**
* @return true if drawing of the drop-highlighter has been enabled. False by default.
*
* @see #setDropHighlighter()
*/
bool dropHighlighter() const;
/**
* The dropVisualizerWidth defaults to 4.
*
* @see #setDropVisualizerWidth()
* @return the current width of the drop-visualizer.
*/
int dropVisualizerWidth () const;
/**
* @return the "extended" selection mode of this listview.
*
* @see SelectionModeExt
* @see setSelectionModeExt
*/
SelectionModeExt selectionModeExt () const;
/**
* Returns the index of @p item within the item tree or -1 if
* @p item doesn't exist in this list view. This function takes
* all items into account not only the visible ones.
*/
- int itemIndex( const QListViewItem *item ) const;
+ int itemIndex( const Q3ListViewItem *item ) const;
/**
* Returns the item of @p index within the item tree or 0 if
* @p index doesn't exist in this list view. This function takes
* all items into account not only the visible ones.
*/
- QListViewItem* itemAtIndex(int index);
+ Q3ListViewItem* itemAtIndex(int index);
/**
* @deprecated
* @see #setFullWidth()
*/
void setFullWidth();
/**
* Let the last column fit exactly all the available width.
*
* @see #fullWidth()
*/
void setFullWidth(bool fullWidth);
/**
* Returns whether the last column is set to fit the available width.
*
* @see #setFullWidth()
*/
bool fullWidth() const;
/**
* Reimplemented for full width support
*
* @see #removeColumn()
*/
virtual int addColumn(const QString& label, int width = -1);
/**
* Reimplemented for full width support
*/
- virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1);
+ virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1);
/**
* Reimplemented for full width support
*
* @see #addColumn()
*/
virtual void removeColumn(int index);
/**
* sets the alternate background background color.
* This only has an effect if the items are KListViewItems
*
* @param c the color to use for every other item. Set to an invalid
* colour to disable alternate colours.
*
* @see #alternateBackground()
**/
void setAlternateBackground(const QColor &c);
/**
* @return the alternate background color
*
* @see #setAlternateBackground()
*/
const QColor &alternateBackground() const;
/**
* Saves the list view's layout (column widtsh, column order, sort column)
* to a KConfig group
*
* @param config the @ref KConfig object to write to
* @param group the config group to use
*/
void saveLayout(KConfig *config, const QString &group) const;
@@ -359,230 +370,230 @@ public:
* Reimplemented to remember the current sort column and order.
* @param column is the column to be sorted, or -1 to sort in order of
* insertion
* @param whether to sort ascending (or descending)
*/
virtual void setSorting(int column, bool ascending = true);
/**
* @return the currently sorted column, or -1 if none is sorted
*/
int columnSorted(void) const;
/**
* @return whether the current sort is ascending (or descending)
*/
bool ascendingSort(void) const;
//US we do not have a "global KDE" variable to setup singleClick functionality
void setSingleClick(bool s);
signals:
/**
* This signal is emitted whenever the user executes an listview item.
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listview item.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*/
- void executed( QListViewItem *item );
+ void executed( Q3ListViewItem *item );
/**
* This signal is emitted whenever the user executes an listview item.
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listview item.
* @param pos is the position where the user has clicked
* @param c is the column into which the user clicked.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*/
- void executed( QListViewItem *item, const QPoint &pos, int c );
+ void executed( Q3ListViewItem *item, const QPoint &pos, int c );
/**
* This signal gets emitted whenever the user double clicks into the
* listview.
* @param item is the pointer to the clicked listview item.
* @param pos is the position where the user has clicked, and
* @param c is the column into which the user clicked.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*
* This signal is more or less here for the sake of completeness.
* You should normally not need to use this. In most cases its better
* to use @ref #executed() instead.
*/
- void doubleClicked( QListViewItem *item, const QPoint &pos, int c );
- void contextRequest( QListViewItem *item, const QPoint &pos, int c );
+ void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c );
+ void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c );
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* @param e is the drop event itself (it has already been accepted)
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items)
*
* @see #acceptDrop()
*/
- void dropped (QDropEvent * e, QListViewItem *after);
+ void dropped (QDropEvent * e, Q3ListViewItem *after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This is an overloaded version of the above (provided to simplify
* processing drops outside of the class).
*
* @param list is the listview
* @param e is the drop event itself (it has already been accepted)
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (KListView* list, QDropEvent* e, QListViewItem* after);
+ void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This function also provides a parent, in the event that your listview
* is a tree
* @param list is the listview
* @param e is the drop event itself (it has already been accepted)
* @param parent the item that is to be the parent of the new item
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after);
+ void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This function also provides a parent, in the event that your listview
* is a tree
* @param e is the drop event itself (it has already been accepted)
* @param parent the item that is to be the parent of the new item
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after);
+ void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
/**
* This signal is emitted when ever the user moves an item in the list via
* DnD.
* If more than one item is moved at the same time, this signal is only emitted
* once.
*/
void moved();
/**
* Connect to this signal if you want to do some preprocessing before
* a move is made, for example, to disable sorting
*
* This is sent only once per each groups of moves. That is, for each
* drop that is a move this will be emitted once, before KListView calls
* @see moveItem()
*/
void aboutToMove();
/**
* This signal is emitted when ever the user moves an item in the list via
* DnD.
* If more than one item is moved at the same time, @p afterFirst and
* @p afterNow will reflect what was true before the move.
* This differs from @ref moved(), so be careful. All the items will have been
* moved before @ref moved() is emitted, which is not true in this method. // FIXME
* @param item the item that was moved
* @param afterFirst the item that parameter item was in before the move, in the list
* @param afterNow the item it's currently after.
*/
- void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow);
+ void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow);
/**
* This signal is emitted after all the items have been moved. It reports info for
* each and every item moved, in order. The first element in @p items associates
* with the first of afterFirst and afterNow.
*/
- void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow);
+ void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow);
/**
* This signal gets emitted when an item is renamed via in-place renaming.
*
* @param item is the renamed item.
* @param str is the new value of column @p col.
* @param col is the renamed column.
*/
- void itemRenamed(QListViewItem* item, const QString &str, int col);
+ void itemRenamed(Q3ListViewItem* item, const QString &str, int col);
/**
* Same as above, but without the extra information.
*/
- void itemRenamed(QListViewItem* item);
+ void itemRenamed(Q3ListViewItem* item);
void signalDelete();
/**
* This signal is emitted when the shortcut key for popup-menus is pressed.
*
* Normally you should not use this, just connect a slot to signal
* @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly
* handle showing context menus regardless of settings.
*
* @param list is this listview.
* @param item is the @ref currentItem() at the time the key was pressed. May be 0L.
*/
- void menuShortCutPressed (KListView* list, QListViewItem* item);
+ void menuShortCutPressed (KListView* list, Q3ListViewItem* item);
/**
* This signal is emitted whenever a context-menu should be shown for item @p i.
* It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click).
*
* @param l is this listview.
* @param i is the item for which the menu should be shown. May be 0L.
* @param p is the point at which the menu should be shown.
*/
- void contextMenu (KListView* l, QListViewItem* i, const QPoint& p);
+ void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p);
public slots:
/**
* Rename column @p c of @p item.
*/
- virtual void rename(QListViewItem *item, int c);
+ virtual void rename(Q3ListViewItem *item, int c);
/**
* By default, if you called setItemsRenameable(true),
* only the first column is renameable.
* Use this function to enable the feature on other columns.
*
* If you want more intelligent (dynamic) selection,
* you'll have to derive from KListView,
* and override @ref rename() and call only call it
* if you want the item to be renamed.
*/
void setRenameable (int column, bool yesno=true);
/**
* Set whether items in the list view can be moved.
* It is enabled by default.
*
* @see itemsMovable()
*/
virtual void setItemsMovable(bool b);
/**
* Enables inplace-renaming of items.
* It is disabled by default.
*
* @see itemsRenameable()
* @see setRenameable()
*/
virtual void setItemsRenameable(bool b);
/**
* Enable/Disable the dragging of items.
@@ -644,118 +655,118 @@ public slots:
*/
void setTabOrderedRenaming(bool b);
/**
* Returns whether tab ordered renaming is enabled
* @since 3.1
*/
bool tabOrderedRenaming() const;
protected:
/**
* Determine whether a drop on position @p p would count as
* being above or below the QRect @p rect.
*
* @param rect is the rectangle we examine.
* @param p is the point located in the rectangle, p is assumed to be in
* viewport coordinates.
*/
inline bool below (const QRect& rect, const QPoint& p)
{
return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
}
/**
* An overloaded version of below(const QRect&, const QPoint&).
*
* It differs from the above only in what arguments it takes.
*
* @param i the item whose rect() is passed to the above function.
* @param p is translated from contents coordinates to viewport coordinates
* before being passed to the above function.
*/
- inline bool below (QListViewItem* i, const QPoint& p)
+ inline bool below (Q3ListViewItem* i, const QPoint& p)
{
return below (itemRect(i), contentsToViewport(p));
}
/**
* Reimplemented to reload the alternate background in palette changes.
* @internal
*/
virtual bool event( QEvent * );
/**
* Emit signal @ref #executed.
* @internal
*/
//US I added buttonstate to pass the current keyboard status
- void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c);
+ void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void focusInEvent(QFocusEvent* fe);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void focusOutEvent( QFocusEvent *fe );
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void leaveEvent( QEvent *e );
/**
* @return the tooltip for @p column of @p item.
*/
- virtual QString tooltip(QListViewItem* item, int column) const;
+ virtual QString tooltip(Q3ListViewItem* item, int column) const;
/**
* @return whether the tooltip for @p column of @p item shall be shown at point @p pos.
*/
- virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const;
+ virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const;
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDragMoveEvent (QDragMoveEvent *event);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsMousePressEvent( QMouseEvent *e );
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsMouseMoveEvent( QMouseEvent *e );
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
@@ -776,265 +787,265 @@ protected:
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsMouseReleaseEvent (QMouseEvent*);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDropEvent (QDropEvent*);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDragEnterEvent (QDragEnterEvent *);
/**
* @return a dragobject encoding the current selection.
*
* @see setDragEnabled()
*/
- virtual QDragObject *dragObject();
+ virtual Q3DragObject *dragObject();
/**
* @return true if the @p event provides some acceptable
* format.
* A common mistake is to forget the "const" in your reimplementation
*/
virtual bool acceptDrag (QDropEvent* event) const;
/**
* Paint the drag line. If painter is null, don't try to :)
*
* If after == 0 then the marker should be drawn at the top.
*
* @return the rectangle that you painted to.
*/
- virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after);
+ virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after);
/**
* Paint the drag rectangle. If painter is null, don't try to :)
*
*
* @return the rectangle that you painted to.
*/
- virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item);
+ virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item);
/**
* This method calls @ref dragObject() and starts the drag.
*
* Reimplement it to do fancy stuff like setting a pixmap or
* using a non-default DragMode
*/
virtual void startDrag();
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void keyPressEvent (QKeyEvent*);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void viewportPaintEvent(QPaintEvent*);
/**
* In FileManager selection mode: explicitely activate the mode
* in which the current item is automatically selected.
*/
void activateAutomaticSelection();
/**
* In FileManager selection mode: explicitely deactivate the mode
* in which the current item is automatically selected.
*/
void deactivateAutomaticSelection();
/**
* In FileManager selection mode: return whether it is currently in the mode
* where the current item is selected automatically.
* Returns false if items were selected explicitely, e.g. using the mouse.
*/
bool automaticSelection() const;
/**
* Reimplemented for setFullWidth()
*/
virtual void viewportResizeEvent(QResizeEvent* e);
protected slots:
/**
* Update internal settings whenever the global ones change.
* @internal
*/
void slotSettingsChanged(int);
- void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c );
- void doneEditing(QListViewItem *item, int row);
+ void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c );
+ void doneEditing(Q3ListViewItem *item, int row);
/**
* Repaint the rect where I was drawing the drop line.
*/
void cleanDropVisualizer();
/**
* Repaint the rect where I was drawing the drop rectangle.
*/
void cleanItemHighlighter();
/**
* Emit the @ref contextMenu signal. This slot is for mouse actions.
*/
- void emitContextMenu (QListViewItem*, const QPoint&, int);
+ void emitContextMenu (Q3ListViewItem*, const QPoint&, int);
/**
* Emit the @ref #contextMenu signal. This slot is for key presses.
*/
- void emitContextMenu (KListView*, QListViewItem*);
+ void emitContextMenu (KListView*, Q3ListViewItem*);
/**
* Accessory slot for AutoSelect
* @internal
*/
- void slotOnItem( QListViewItem *item );
+ void slotOnItem( Q3ListViewItem *item );
/**
* Accessory slot for AutoSelect/ChangeCursorOverItem
* @internal
*/
void slotOnViewport();
/**
* Process AutoSelection.
* @internal
*/
void slotAutoSelect();
void slotDragExpand();
/**
* Reacts to header changes in full width mode
* @internal
*/
void slotHeaderChanged();
protected:
/**
* Handle dropEvent when itemsMovable() is set to true.
*/
- virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme);
+ virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme);
/**
* Where is the nearest QListViewItem that I'm going to drop?
*
* FIXME KDE 4.0: Make this method const so it can be called from an
* acceptDrag method without ugly casts
*/
- virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after);
+ virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after);
/**
* A special keyPressEvent (for FileManager selection mode).
*/
void fileManagerKeyPressEvent (QKeyEvent*);
/**
* Convert the depth of an item into its indentation in pixels
*/
int depthToPixels( int depth );
private:
class Tooltip;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KListViewPrivate;
KListViewPrivate *d;
};
/**
* A listview item with support for alternate background colours. It is
* a drop-in replacement for @ref QListViewItem
*
* @short listview item with alternate background colour support
*/
-class KListViewItem : public QListViewItem
+class KListViewItem : public Q3ListViewItem
{
public:
/**
* constructors. The semantics remain as in @ref QListViewItem.
* Although they accept a @ref QListViewItem as parent, please
* don't mix KListViewItem (or subclasses) with QListViewItem
* (or subclasses).
*/
- KListViewItem(QListView *parent);
- KListViewItem(QListViewItem *parent);
- KListViewItem(QListView *parent, QListViewItem *after);
- KListViewItem(QListViewItem *parent, QListViewItem *after);
+ KListViewItem(Q3ListView *parent);
+ KListViewItem(Q3ListViewItem *parent);
+ KListViewItem(Q3ListView *parent, Q3ListViewItem *after);
+ KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after);
- KListViewItem(QListView *parent,
+ KListViewItem(Q3ListView *parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListViewItem *parent,
+ KListViewItem(Q3ListViewItem *parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListView *parent, QListViewItem *after,
+ KListViewItem(Q3ListView *parent, Q3ListViewItem *after,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListViewItem *parent, QListViewItem *after,
+ KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
virtual ~KListViewItem();
/**
* retuns true if this item is to be drawn with the alternate background
*/
bool isAlternate();
/**
* returns the background colour for this item
*/
const QColor &backgroundColor();
virtual void paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int alignment);
private:
void init();
private:
uint m_odd : 1;
uint m_known : 1;
uint m_unused : 30;
};
#endif
// vim: ts=2 sw=2 et
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp
index fa678f2..bac0db8 100644
--- a/microkde/kdeui/kmainwindow.cpp
+++ b/microkde/kdeui/kmainwindow.cpp
@@ -1,89 +1,95 @@
/* This file is part of the KDE libraries
Copyright
(C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997 Stephan Kulow (coolo@kde.org)
(C) 1997-2000 Sven Radej (radej@kde.org)
(C) 1997-2000 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 2002 Joseph Wenninger (jowenn@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qobjectlist.h>
+#include <qobject.h>
#include <qstringlist.h>
#include <qtimer.h>
#include <qmenubar.h>
#include <qstatusbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <Q3PtrList>
#include "kdebug.h"
#include "kmainwindow.h"
#include "kglobalsettings.h"
#include "kactioncollection.h"
class KMainWindowPrivate {
public:
//US bool showHelpMenu:1;
bool autoSaveSettings:1;
bool settingsDirty:1;
bool autoSaveWindowSize:1;
bool care_about_geometry:1;
QString autoSaveGroup;
//US KAccel * kaccel;
//US KMainWindowInterface *m_interface;
KDEPrivate::ToolBarHandler *toolBarHandler;
QTimer* settingsTimer;
KToggleAction *showStatusBarAction;
QRect defaultWindowSize;
};
static bool no_query_exit = false;
KMainWindow::KMainWindow( QWidget* parent, const char *name )
- : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
+ : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
{
mQToolBar = 0;
initKMainWindow(name);
}
void KMainWindow::parseGeometry(bool parsewidth)
{
//US the following code is not getting used in the embedded version !! So disable it for now
/*US
assert ( !kapp->geometryArgument().isNull() );
assert ( d->care_about_geometry );
#ifndef Q_WS_QWS
// FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it)
int x, y;
int w, h;
int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h);
if (parsewidth) {
QSize minSize = minimumSize();
QSize maxSize = maximumSize();
if ( (m & WidthValue) == 0 )
w = width();
if ( (m & HeightValue) == 0 )
h = height();
w = QMIN(w,maxSize.width());
h = QMIN(h,maxSize.height());
w = QMAX(w,minSize.width());
h = QMAX(h,minSize.height());
resize(w, h);
} else {
if ( parsewidth && (m & XValue) == 0 )
@@ -247,65 +253,65 @@ bool KMainWindow::restore( int number, bool show )
{
/*US we do not have and want to save sessioninformation. Use info from the default
application config.
*/
if ( !canBeRestored( number ) )
return FALSE;
//US KConfig *config = kapp->sessionConfig();
KConfig *config = KGlobal::config();
if ( readPropertiesInternal( config, number ) ){
if ( show )
KMainWindow::show();
return FALSE;
}
return FALSE;
}
void KMainWindow::setCaption( const QString &caption )
{
//US setPlainCaption( kapp->makeStdCaption(caption) );
setPlainCaption( caption );
}
void KMainWindow::setCaption( const QString &caption, bool modified )
{
//US setPlainCaption( kapp->makeStdCaption(caption, true, modified) );
setPlainCaption( caption + "modified:" );
}
void KMainWindow::setPlainCaption( const QString &caption )
{
- QMainWindow::setCaption( caption );
+ Q3MainWindow::setCaption( caption );
#ifndef Q_WS_QWS
//US the following is disabled for the embedded version
//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 );
//US info.setName( caption.utf8().data() );
#endif
}
void KMainWindow::slotStateChanged(const QString &newstate)
{
stateChanged(newstate, KXMLGUIClient::StateNoReverse);
}
/*
* Get rid of this for KDE 4.0
*/
void KMainWindow::slotStateChanged(const QString &newstate,
KXMLGUIClient::ReverseStateChange reverse)
{
stateChanged(newstate, reverse);
}
void KMainWindow::closeEvent ( QCloseEvent *e )
{
//qDebug("MainWindow::closeEvent ");
// Save settings if auto-save is enabled, and settings have changed
if (d->settingsDirty && d->autoSaveSettings)
saveAutoSaveSettings();
if (queryClose()) {
e->accept();
int not_withdrawn = 0;
@@ -392,147 +398,148 @@ void KMainWindow::setStandardToolBarMenuEnabled( bool enable )
/*US if ( factory() )
factory()->addClient( d->toolBarHandler );
*/
}
else
{
if ( !d->toolBarHandler )
return;
/*US
if ( factory() )
factory()->removeClient( d->toolBarHandler );
*/
delete d->toolBarHandler;
d->toolBarHandler = 0;
}
}
bool KMainWindow::isStandardToolBarMenuEnabled() const
{
return ( d->toolBarHandler != 0 );
}
void KMainWindow::createStandardStatusBarAction(){
if(!d->showStatusBarAction){
d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection());
connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool)));
if(internalStatusBar())
d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden());
}
}
-QToolBar *KMainWindow::tBar( )
+Q3ToolBar *KMainWindow::tBar( )
{
if ( ! mQToolBar )
- mQToolBar = new QToolBar( this );
+ mQToolBar = new Q3ToolBar( this );
return mQToolBar;
}
KToolBar *KMainWindow::toolBar( const char * name )
{
if (!name)
name = "mainToolBar";
KToolBar *tb = (KToolBar*)child( name, "KToolBar" );
if ( tb )
return tb;
bool honor_mode = (name == "mainToolBar");
/*US
if ( builderClient() )
return new KToolBar(this, name, honor_mode); // XMLGUI constructor
else
*/
- return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI
+ return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI
}
-QPtrListIterator<KToolBar> KMainWindow::toolBarIterator()
+Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator()
{
toolbarList.clear();
- QPtrList<QToolBar> lst;
- for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) {
- lst = toolBars( (ToolBarDock)i );
- for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) {
+ QList<Q3ToolBar*> lst;
+ for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) {
+ lst = toolBars( (Qt::ToolBarDock)i );
+ for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) {
+ Q3ToolBar *tb = *i;
if ( !tb->inherits( "KToolBar" ) )
continue;
toolbarList.append( (KToolBar*)tb );
}
}
- return QPtrListIterator<KToolBar>( toolbarList );
+ return Q3PtrListIterator<KToolBar>( toolbarList );
}
void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize )
{
d->autoSaveSettings = true;
d->autoSaveGroup = groupName;
d->autoSaveWindowSize = saveWindowSize;
// Get notified when the user moves a toolbar around
//US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ),
//US this, SLOT( setSettingsDirty() ) );
- connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ),
+ connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ),
this, SLOT( setSettingsDirty() ) );
// Get default values
//US int scnum = QApplication::desktop()->screenNumber(parentWidget());
//US QRect desk = QApplication::desktop()->screenGeometry(scnum);
QRect desk = KGlobalSettings::desktopGeometry(0);
d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height());
// Now read the previously saved settings
applyMainWindowSettings( KGlobal::config(), groupName );
}
void KMainWindow::resetAutoSaveSettings()
{
d->autoSaveSettings = false;
if ( d->settingsTimer )
d->settingsTimer->stop();
}
bool KMainWindow::autoSaveSettings() const
{
return d->autoSaveSettings;
}
QString KMainWindow::autoSaveGroup() const
{
return d->autoSaveGroup;
}
void KMainWindow::saveAutoSaveSettings()
{
- ASSERT( d->autoSaveSettings );
+ Q_ASSERT( d->autoSaveSettings );
//kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl;
saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup );
KGlobal::config()->sync();
d->settingsDirty = false;
if ( d->settingsTimer )
d->settingsTimer->stop();
}
void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory )
{
// disabling the updates prevents unnecessary redraws
setUpdatesEnabled( false );
// just in case we are rebuilding, let's remove our old client
//US guiFactory()->removeClient( this );
// make sure to have an empty GUI
QMenuBar* mb = internalMenuBar();
if ( mb )
mb->clear();
(void)toolBarIterator(); // make sure toolbarList is most-up-to-date
toolbarList.setAutoDelete( true );
toolbarList.clear();
toolbarList.setAutoDelete( false );
/*US
// don't build a help menu unless the user ask for it
if (d->showHelpMenu) {
// we always want a help menu
if (helpMenu2 == 0)
helpMenu2 = new KHelpMenu(this, instance()->aboutData(), true,
actionCollection());
@@ -610,65 +617,65 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG
if (sb) {
entryList.clear();
if ( sb->isHidden() )
entryList.append("Disabled");
else
entryList.append("Enabled");
if(sb->isHidden())
//US config->writeEntry(QString::fromLatin1("StatusBar"), entryList, ';');
config->writeEntry(QString::fromLatin1("StatusBar"), entryList);
else
config->deleteEntry(QString::fromLatin1("StatusBar"));
}
QMenuBar* mb = internalMenuBar();
if (mb) {
entryList.clear();
if ( mb->isHidden() )
entryList.append("Disabled");
else
entryList.append("Enabled");
// By default we don't hide.
if(mb->isHidden())
//US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';');
config->writeEntry(QString::fromLatin1("MenuBar"), entryList);
else
config->deleteEntry(QString::fromLatin1("MenuBar"));
}
int n = 1; // Toolbar counter. toolbars are counted from 1,
KToolBar *toolbar = 0;
- QPtrListIterator<KToolBar> it( toolBarIterator() );
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() );
while ( ( toolbar = it.current() ) ) {
++it;
QString group;
if (!configGroup.isEmpty())
{
// Give a number to the toolbar, but prefer a name if there is one,
// because there's no real guarantee on the ordering of toolbars
group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name());
group.prepend(" Toolbar");
group.prepend(configGroup);
}
toolbar->saveSettings(config, group);
n++;
}
if (!configGroup.isEmpty())
config->setGroup(oldGroup);
}
bool KMainWindow::readPropertiesInternal( KConfig *config, int number )
{
if ( number == 1 )
readGlobalProperties( config );
// in order they are in toolbar list
QString s;
s.setNum(number);
s.prepend(QString::fromLatin1("WindowProperties"));
config->setGroup(s);
// restore the object name (window role)
if ( config->hasKey(QString::fromLatin1("ObjectName" )) )
@@ -685,107 +692,109 @@ bool KMainWindow::readPropertiesInternal( KConfig *config, int number )
void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &configGroup)
{
kdDebug(200) << "KMainWindow::applyMainWindowSettings" << endl;
QString entry;
//US QStrList entryList;
QStringList entryList;
int i = 0; // Number of entries in list
if (!configGroup.isEmpty())
config->setGroup(configGroup);
restoreWindowSize(config);
QStatusBar* sb = internalStatusBar();
if (sb) {
entryList.clear();
//US i = config->readListEntry (QString::fromLatin1("StatusBar"), entryList, ';');
entryList = config->readListEntry (QString::fromLatin1("StatusBar"));
entry = entryList.first();
if (entry == QString::fromLatin1("Disabled"))
sb->hide();
else
sb->show();
if(d->showStatusBarAction)
d->showStatusBarAction->setChecked(!sb->isHidden());
}
QMenuBar* mb = internalMenuBar();
if (mb) {
entryList.clear();
//US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';');
entryList = config->readListEntry (QString::fromLatin1("MenuBar"));
- entry = entryList.first();
- if (entry==QString::fromLatin1("Disabled"))
- {
- mb->hide();
- } else
- {
- mb->show();
- }
+ if(!entryList.empty()) {
+ entry = entryList.first();
+ if (entry==QString::fromLatin1("Disabled"))
+ {
+ mb->hide();
+ } else
+ {
+ mb->show();
+ }
+ }
}
int n = 1; // Toolbar counter. toolbars are counted from 1,
KToolBar *toolbar;
- QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator
for ( ; it.current(); ++it) {
toolbar= it.current();
QString group;
if (!configGroup.isEmpty())
{
// Give a number to the toolbar, but prefer a name if there is one,
// because there's no real guarantee on the ordering of toolbars
group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name());
group.prepend(" Toolbar");
group.prepend(configGroup);
}
toolbar->applySettings(config, group);
n++;
}
finalizeGUI( true );
}
void KMainWindow::finalizeGUI( bool force )
{
//kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl;
// The whole reason for this is that moveToolBar relies on the indexes
// of the other toolbars, so in theory it should be called only once per
// toolbar, but in increasing order of indexes.
// Since we can't do that immediately, we move them, and _then_
// we call positionYourself again for each of them, but this time
// the toolbariterator should give them in the proper order.
// Both the XMLGUI and applySettings call this, hence "force" for the latter.
- QPtrListIterator<KToolBar> it( toolBarIterator() );
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() );
for ( ; it.current() ; ++ it )
it.current()->positionYourself( force );
d->settingsDirty = false;
}
void KMainWindow::saveWindowSize( KConfig * config ) const
{
/*US
int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->screenGeometry(scnum);
*/
QRect desk = KGlobalSettings::desktopGeometry(0);
QRect size( desk.width(), width(), desk.height(), height() );
if(size != d->defaultWindowSize){
config->writeEntry(QString::fromLatin1("Width %1").arg(desk.width()), width() );
config->writeEntry(QString::fromLatin1("Height %1").arg(desk.height()), height() );
}
else{
config->deleteEntry(QString::fromLatin1("Width %1").arg(desk.width()));
config->deleteEntry(QString::fromLatin1("Height %1").arg(desk.height()));
}
}
void KMainWindow::restoreWindowSize( KConfig * config )
{
if (d->care_about_geometry) {
parseGeometry(true);
} else {
// restore the size
/*US int scnum = QApplication::desktop()->screenNumber(parentWidget());
@@ -822,157 +831,145 @@ void KMainWindow::ignoreInitialGeometry()
void KMainWindow::setSettingsDirty()
{
//kdDebug(200) << "KMainWindow::setSettingsDirty" << endl;
d->settingsDirty = true;
if ( d->autoSaveSettings )
{
// Use a timer to save "immediately" user-wise, but not too immediately
// (to compress calls and save only once, in case of multiple changes)
if ( !d->settingsTimer )
{
d->settingsTimer = new QTimer( this );
connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) );
}
d->settingsTimer->start( 500, true );
}
}
bool KMainWindow::settingsDirty() const
{
return d->settingsDirty;
}
QString KMainWindow::settingsGroup() const
{
return d->autoSaveGroup;
}
void KMainWindow::resizeEvent( QResizeEvent * e)
{
if ( d->autoSaveWindowSize )
setSettingsDirty();
- QMainWindow::resizeEvent( e );
+ Q3MainWindow::resizeEvent( e );
}
bool KMainWindow::hasMenuBar()
{
return (internalMenuBar());
}
//US KMenuBar *KMainWindow::menuBar()
QMenuBar *KMainWindow::menuBar()
{
//US KMenuBar * mb = internalMenuBar();
QMenuBar * mb = internalMenuBar();
if ( !mb ) {
//US mb = new KMenuBar( this );
mb = new QMenuBar( this );
// trigger a re-layout and trigger a call to the private
// setMenuBar method.
- QMainWindow::menuBar();
+ Q3MainWindow::menuBar();
}
return mb;
}
//US KStatusBar *KMainWindow::statusBar()
QStatusBar *KMainWindow::statusBar()
{
//US KStatusBar * sb = internalStatusBar();
QStatusBar * sb = internalStatusBar();
if ( !sb ) {
//US sb = new KStatusBar( this );
sb = new QStatusBar( this );
// trigger a re-layout and trigger a call to the private
// setStatusBar method.
- QMainWindow::statusBar();
+ Q3MainWindow::statusBar();
}
return sb;
}
void KMainWindow::shuttingDown()
{
// Needed for Qt <= 3.0.3 at least to prevent reentrancy
// when queryExit() shows a dialog. Check before removing!
static bool reentrancy_protection = false;
if (!reentrancy_protection)
{
reentrancy_protection = true;
// call the virtual queryExit
queryExit();
reentrancy_protection = false;
}
}
//US KMenuBar *KMainWindow::internalMenuBar()
QMenuBar *KMainWindow::internalMenuBar()
{
//US QObjectList *l = queryList( "KMenuBar", 0, false, false );
- QObjectList *l = queryList( "QMenuBar", 0, false, false );
- if ( !l || !l->first() ) {
- delete l;
- return 0;
- }
-
-//US KMenuBar *m = (KMenuBar*)l->first();
- QMenuBar *m = (QMenuBar*)l->first();
- delete l;
- return m;
+ QObjectList l = queryList( "QMenuBar", 0, false, false );
+ if(l.empty())
+ return 0;
+ return (QMenuBar*)l.front();
}
//US KStatusBar *KMainWindow::internalStatusBar()
QStatusBar *KMainWindow::internalStatusBar()
{
//US QObjectList *l = queryList( "KStatusBar", 0, false, false );
- QObjectList *l = queryList( "QStatusBar", 0, false, false );
- if ( !l || !l->first() ) {
- delete l;
- return 0;
- }
-
-//US KStatusBar *s = (KStatusBar*)l->first();
- QStatusBar *s = (QStatusBar*)l->first();
- delete l;
- return s;
+ QObjectList l = queryList( "QStatusBar", 0, false, false );
+ if(l.empty())
+ return 0;
+ return (QStatusBar*)l.front();
}
void KMainWindow::childEvent( QChildEvent* e)
{
- QMainWindow::childEvent( e );
+ Q3MainWindow::childEvent( e );
}
void KMainWindow::paintEvent( QPaintEvent * e)
{
- QMainWindow::paintEvent( e );
+ Q3MainWindow::paintEvent( e );
}
QSize KMainWindow::sizeForCentralWidgetSize(QSize size)
{
KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" );
if (tb && !tb->isHidden()) {
switch( tb->barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
size += QSize(0, tb->sizeHint().height());
break;
case KToolBar::Left:
case KToolBar::Right:
size += QSize(toolBar()->sizeHint().width(), 0);
break;
case KToolBar::Flat:
//US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
size += QSize(0, tb->sizeHint().height());
break;
default:
break;
}
}
//US KMenuBar *mb = menuBar();
QMenuBar *mb = menuBar();
if (!mb->isHidden()) {
size += QSize(0,mb->heightForWidth(size.width()));
/*US if (style().styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, this))
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h
index 2dc8033..a3ac82f 100644
--- a/microkde/kdeui/kmainwindow.h
+++ b/microkde/kdeui/kmainwindow.h
@@ -1,90 +1,95 @@
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <QCloseEvent>
+#include <QPaintEvent>
/*
This file is part of the KDE libraries
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
$Id$
*/
#ifndef KMAINWINDOW_H
#define KMAINWINDOW_H
/*US
#include "kxmlguifactory.h"
#include "kxmlguiclient.h"
#include "kxmlguibuilder.h"
#include <qmetaobject.h>
class KPopupMenu;
class KXMLGUIFactory;
class KConfig;
class KHelpMenu;
class KStatusBar;
class QStatusBar;
class KMenuBar;
class KMWSessionManaged;
class KAccel;
class KToolBarMenuAction;
*/
class QMenuBar;
class QStatusBar;
class KMainWindowPrivate;
class KAction;
#include <ktoolbar.h>
#include <ktoolbarhandler.h>
#include <kxmlguiclient.h>
-#include <qmainwindow.h>
-#include <qptrlist.h>
+#include <q3mainwindow.h>
+#include <q3ptrlist.h>
class KActionCollection;
-class KMainWindow : public QMainWindow, virtual public KXMLGUIClient
+class KMainWindow : public Q3MainWindow, virtual public KXMLGUIClient
{
Q_OBJECT
private:
//US create private defaultconstructor
KMainWindow() {;};
public:
/**
* Construct a main window.
*
* @param parent The widget parent. This is usually 0 but it may also be the window
* group leader. In that case, the KMainWindow becomes sort of a
* secondary window.
*
* @param name The object name. For session management and window management to work
* properly, all main windows in the application should have a
* different name. When passing 0 (the default), KMainWindow will create
* a unique name, but it's recommended to explicitly pass a window name that will
* also describe the type of the window. If there can be several windows of the same
* type, append '#' (hash) to the name, and KMainWindow will append numbers to make
* the names unique. For example, for a mail client which has one main window showing
* the mails and folders, and which can also have one or more windows for composing
* mails, the name for the folders window should be e.g. "mainwindow" and
* for the composer windows "composer#".
*
* @param f Specify the widget flags. The default is
* WType_TopLevel and WDestructiveClose. TopLevel indicates that a
* main window is a toplevel window, regardless of whether it has a
* parent or not. DestructiveClose indicates that a main window is
* automatically destroyed when its window is closed. Pass 0 if
@@ -291,70 +296,70 @@ public:
*
* If there is no menu bar yet one will be created.
**/
//US KMenuBar *menuBar();
QMenuBar *menuBar();
/**
* Returns a pointer to the status bar.
*
* If there is no
* status bar yet one will be created.
*/
//US KStatusBar *statusBar();
QStatusBar *statusBar();
/**
* List of members of KMainWindow class.
*/
//US static QPtrList<KMainWindow>* memberList;
/**
* Returns a pointer to the toolbar with the specified name.
* This refers to toolbars created dynamically from the XML UI
* framework. If the toolbar does not exist one will be created.
*
* @param name The internal name of the toolbar. If no name is
* specified "mainToolBar" is assumed.
*
* @return A pointer to the toolbar
**/
KToolBar *toolBar( const char *name=0 );
// method for getting rid of KDE-Crap
- QToolBar *tBar( );
+ Q3ToolBar *tBar( );
/**
* @return An iterator over the list of all toolbars for this window.
*/
- QPtrListIterator<KToolBar> toolBarIterator();
+ Q3PtrListIterator<KToolBar> toolBarIterator();
/**
* @return A KAccel instance bound to this mainwindow. Used automatically
* by KAction to make keybindings work in all cases.
*/
KAccel *accel();
void setFrameBorderWidth( int ) {}
/**
* Call this to enable "auto-save" of toolbar/menubar/statusbar settings
* (and optionally window size).
* If the *bars were moved around/shown/hidden when the window is closed,
* saveMainWindowSettings( KGlobal::config(), groupName ) will be called.
*
* @param groupName a name that identifies this "type of window".
* You can have several types of window in the same application.
*
* @param saveWindowSize set it to true to include the window size
* when saving.
*
* Typically, you will call setAutoSaveSettings() in your
* KMainWindow-inherited class constructor, and it will take care
* of restoring and saving automatically. Make sure you call this
* _after all_ your *bars have been created.
*/
void setAutoSaveSettings( const QString & groupName = QString::fromLatin1("MainWindow"),
bool saveWindowSize = true );
/**
* Disable the auto-save-settings feature.
* You don't normally need to call this, ever.
@@ -729,49 +734,49 @@ protected slots:
* It must be reimplemented if you want
* to use a custom About Application dialog box. This slot is
* connected to the About Application entry in the menu returned
* by @ref customHelpMenu.
*
* Example:
* <pre>
*
* void MyMainLevel::setupInterface()
* {
* ..
* menuBar()->insertItem( i18n("&Help"), customHelpMenu() );
* ..
* }
*
* void MyMainLevel::showAboutApplication()
* {
* <activate your custom dialog>
* }
* </pre>
*/
//US virtual void showAboutApplication();
private slots:
/**
* Called when the app is shutting down.
*/
void shuttingDown();
void saveAutoSaveSettings();
private:
- QToolBar * mQToolBar;
+ Q3ToolBar * mQToolBar;
//US KMenuBar *internalMenuBar();
QMenuBar *internalMenuBar();
//US KStatusBar *internalStatusBar();
QStatusBar *internalStatusBar();
KMainWindowPrivate *d;
void initKMainWindow(const char *name);
- QPtrList<KToolBar> toolbarList;
+ Q3PtrList<KToolBar> toolbarList;
protected:
virtual void virtual_hook( int id, void* data );
};
#endif
diff --git a/microkde/kdeui/knuminput.cpp b/microkde/kdeui/knuminput.cpp
index 335d6f4..da01a20 100644
--- a/microkde/kdeui/knuminput.cpp
+++ b/microkde/kdeui/knuminput.cpp
@@ -13,154 +13,157 @@
* http://www.troll.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <qlabel.h>
#include <qlineedit.h>
#include <qsize.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qstyle.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QEvent>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include "knumvalidator.h"
#include "knuminput.h"
static inline int calcDiffByTen( int x, int y ) {
// calculate ( x - y ) / 10 without overflowing ints:
return ( x / 10 ) - ( y / 10 ) + ( x % 10 - y % 10 ) / 10;
}
// ----------------------------------------------------------------------------
KNumInput::KNumInput(QWidget* parent, const char* name)
: QWidget(parent, name)
{
init();
}
KNumInput::KNumInput(KNumInput* below, QWidget* parent, const char* name)
: QWidget(parent, name)
{
init();
if(below) {
m_next = below->m_next;
m_prev = below;
below->m_next = this;
if(m_next)
m_next->m_prev = this;
}
}
void KNumInput::init()
{
m_prev = m_next = 0;
m_colw1 = m_colw2 = 0;
m_label = 0;
m_slider = 0;
m_alignment = 0;
}
KNumInput::~KNumInput()
{
if(m_prev)
m_prev->m_next = m_next;
if(m_next)
m_next->m_prev = m_prev;
}
void KNumInput::setLabel(const QString & label, int a)
{
if(label.isEmpty()) {
delete m_label;
m_label = 0;
m_alignment = 0;
}
else {
if (m_label) m_label->setText(label);
else m_label = new QLabel(label, this, "KNumInput::QLabel");
- m_label->setAlignment((a & (~(AlignTop|AlignBottom|AlignVCenter)))
- | AlignVCenter);
+ m_label->setAlignment((a & (~(Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter)))
+ | Qt::AlignVCenter);
// if no vertical alignment set, use Top alignment
- if(!(a & (AlignTop|AlignBottom|AlignVCenter)))
- a |= AlignTop;
+ if(!(a & (Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter)))
+ a |= Qt::AlignTop;
m_alignment = a;
}
layout(true);
}
QString KNumInput::label() const
{
if (m_label) return m_label->text();
return QString::null;
}
void KNumInput::layout(bool deep)
{
int w1 = m_colw1;
int w2 = m_colw2;
// label sizeHint
m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0));
- if(m_label && (m_alignment & AlignVCenter))
+ if(m_label && (m_alignment & Qt::AlignVCenter))
m_colw1 = m_sizeLabel.width() + 4;
else
m_colw1 = 0;
// slider sizeHint
m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0));
doLayout();
if(!deep) {
m_colw1 = w1;
m_colw2 = w2;
return;
}
KNumInput* p = this;
while(p) {
p->doLayout();
w1 = QMAX(w1, p->m_colw1);
w2 = QMAX(w2, p->m_colw2);
p = p->m_prev;
}
p = m_next;
while(p) {
p->doLayout();
w1 = QMAX(w1, p->m_colw1);
w2 = QMAX(w2, p->m_colw2);
p = p->m_next;
}
p = this;
@@ -173,108 +176,108 @@ void KNumInput::layout(bool deep)
p = m_next;
while(p) {
p->m_colw1 = w1;
p->m_colw2 = w2;
p = p->m_next;
}
// kdDebug() << "w1 " << w1 << " w2 " << w2 << endl;
}
QSizePolicy KNumInput::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
}
QSize KNumInput::sizeHint() const
{
return minimumSizeHint();
}
void KNumInput::setSteps(int minor, int major)
{
if(m_slider)
m_slider->setSteps( minor, major );
}
// ----------------------------------------------------------------------------
KIntSpinBox::KIntSpinBox(QWidget *parent, const char *name)
: QSpinBox(0, 99, 1, parent, name)
{
- editor()->setAlignment(AlignRight);
+ setAlignment(Qt::AlignRight);
val_base = 10;
setValue(0);
}
KIntSpinBox::~KIntSpinBox()
{
}
KIntSpinBox::KIntSpinBox(int lower, int upper, int step, int value, int base,
QWidget* parent, const char* name)
: QSpinBox(lower, upper, step, parent, name)
{
- editor()->setAlignment(AlignRight);
+ setAlignment(Qt::AlignRight);
val_base = base;
setValue(value);
}
void KIntSpinBox::setBase(int base)
{
val_base = base;
}
int KIntSpinBox::base() const
{
return val_base;
}
QString KIntSpinBox::mapValueToText(int v)
{
return QString::number(v, val_base);
}
int KIntSpinBox::mapTextToValue(bool* ok)
{
return cleanText().toInt(ok, val_base);
}
void KIntSpinBox::setEditFocus(bool mark)
{
- editor()->setFocus();
+ setFocus();
if(mark)
- editor()->selectAll();
+ selectAll();
}
// ----------------------------------------------------------------------------
class KIntNumInput::KIntNumInputPrivate {
public:
int referencePoint;
short blockRelative;
KIntNumInputPrivate( int r )
: referencePoint( r ),
blockRelative( 0 ) {}
};
KIntNumInput::KIntNumInput(KNumInput* below, int val, QWidget* parent,
int _base, const char* name)
: KNumInput(below, parent, name)
{
init(val, _base);
}
KIntNumInput::KIntNumInput(QWidget *parent, const char *name)
: KNumInput(parent, name)
{
init(0, 10);
}
KIntNumInput::KIntNumInput(int val, QWidget *parent, int _base, const char *name)
: KNumInput(parent, name)
{
init(val, _base);
@@ -296,200 +299,200 @@ void KIntNumInput::init(int val, int _base)
void KIntNumInput::setReferencePoint( int ref ) {
// clip to valid range:
ref = kMin( maxValue(), kMax( minValue(), ref ) );
d->referencePoint = ref;
}
int KIntNumInput::referencePoint() const {
return d->referencePoint;
}
void KIntNumInput::spinValueChanged(int val)
{
if(m_slider)
m_slider->setValue(val);
emit valueChanged(val);
}
void KIntNumInput::slotEmitRelativeValueChanged( int value ) {
if ( d->blockRelative || !d->referencePoint ) return;
emit relativeValueChanged( double( value ) / double( d->referencePoint ) );
}
void KIntNumInput::setRange(int lower, int upper, int step, bool slider)
{
upper = kMax(upper, lower);
lower = kMin(upper, lower);
m_spin->setMinValue(lower);
m_spin->setMaxValue(upper);
m_spin->setLineStep(step);
- step = m_spin->lineStep(); // maybe QRangeControl didn't like out lineStep?
+ step = m_spin->singleStep(); // maybe QRangeControl didn't like out lineStep?
if(slider) {
if (m_slider)
m_slider->setRange(lower, upper);
else {
m_slider = new QSlider(lower, upper, step, m_spin->value(),
- QSlider::Horizontal, this);
+ Qt::Horizontal, this);
m_slider->setTickmarks(QSlider::Below);
connect(m_slider, SIGNAL(valueChanged(int)),
m_spin, SLOT(setValue(int)));
}
// calculate (upper-lower)/10 without overflowing int's:
int major = calcDiffByTen( upper, lower );
if ( major==0 ) major = step; // #### workaround Qt bug in 2.1-beta4
m_slider->setSteps(step, major);
m_slider->setTickInterval(major);
}
else {
delete m_slider;
m_slider = 0;
}
// check that reference point is still inside valid range:
setReferencePoint( referencePoint() );
layout(true);
}
void KIntNumInput::setMinValue(int min)
{
- setRange(min, m_spin->maxValue(), m_spin->lineStep(), m_slider);
+ setRange(min, m_spin->maxValue(), m_spin->singleStep(), m_slider);
}
int KIntNumInput::minValue() const
{
return m_spin->minValue();
}
void KIntNumInput::setMaxValue(int max)
{
- setRange(m_spin->minValue(), max, m_spin->lineStep(), m_slider);
+ setRange(m_spin->minValue(), max, m_spin->singleStep(), m_slider);
}
int KIntNumInput::maxValue() const
{
return m_spin->maxValue();
}
void KIntNumInput::setSuffix(const QString &suffix)
{
m_spin->setSuffix(suffix);
layout(true);
}
QString KIntNumInput::suffix() const
{
return m_spin->suffix();
}
void KIntNumInput::setPrefix(const QString &prefix)
{
m_spin->setPrefix(prefix);
layout(true);
}
QString KIntNumInput::prefix() const
{
return m_spin->prefix();
}
void KIntNumInput::setEditFocus(bool mark)
{
m_spin->setEditFocus(mark);
}
QSize KIntNumInput::minimumSizeHint() const
{
constPolish();
int w;
int h;
h = 2 + QMAX(m_sizeSpin.height(), m_sizeSlider.height());
// if in extra row, then count it here
- if(m_label && (m_alignment & (AlignBottom|AlignTop)))
+ if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop)))
h += 4 + m_sizeLabel.height();
else
// label is in the same row as the other widgets
h = QMAX(h, m_sizeLabel.height() + 2);
w = m_slider ? m_slider->sizeHint().width() + 8 : 0;
w += m_colw1 + m_colw2;
- if(m_alignment & (AlignTop|AlignBottom))
+ if(m_alignment & (Qt::AlignTop|Qt::AlignBottom))
w = QMAX(w, m_sizeLabel.width() + 4);
return QSize(w, h);
}
void KIntNumInput::doLayout()
{
m_sizeSpin = m_spin->sizeHint();
m_colw2 = m_sizeSpin.width();
if (m_label)
m_label->setBuddy(m_spin);
}
void KIntNumInput::resizeEvent(QResizeEvent* e)
{
int w = m_colw1;
int h = 0;
- if(m_label && (m_alignment & AlignTop)) {
+ if(m_label && (m_alignment & Qt::AlignTop)) {
m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height());
h += m_sizeLabel.height() + 4;
}
- if(m_label && (m_alignment & AlignVCenter))
+ if(m_label && (m_alignment & Qt::AlignVCenter))
m_label->setGeometry(0, 0, w, m_sizeSpin.height());
m_spin->setGeometry(w, h, m_slider ? m_colw2 : QMAX(m_colw2, e->size().width() - w), m_sizeSpin.height());
w += m_colw2 + 8;
if(m_slider)
m_slider->setGeometry(w, h, e->size().width() - w, m_sizeSpin.height());
h += m_sizeSpin.height() + 2;
- if(m_label && (m_alignment & AlignBottom))
+ if(m_label && (m_alignment & Qt::AlignBottom))
m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height());
}
KIntNumInput::~KIntNumInput()
{
delete d;
}
void KIntNumInput::setValue(int val)
{
m_spin->setValue(val);
// slider value is changed by spinValueChanged
}
void KIntNumInput::setRelativeValue( double r ) {
if ( !d->referencePoint ) return;
++d->blockRelative;
setValue( int( d->referencePoint * r + 0.5 ) );
--d->blockRelative;
}
double KIntNumInput::relativeValue() const {
if ( !d->referencePoint ) return 0;
return double( value() ) / double ( d->referencePoint );
}
int KIntNumInput::value() const
{
return m_spin->value();
}
void KIntNumInput::setSpecialValueText(const QString& text)
@@ -617,156 +620,156 @@ void KDoubleNumInput::updateLegacyMembers() {
double KDoubleNumInput::mapSliderToSpin( int val ) const
{
// map [slidemin,slidemax] to [spinmin,spinmax]
double spinmin = d->spin->minValue();
double spinmax = d->spin->maxValue();
double slidemin = m_slider->minValue(); // cast int to double to avoid
double slidemax = m_slider->maxValue(); // overflow in rel denominator
double rel = ( double(val) - slidemin ) / ( slidemax - slidemin );
return spinmin + rel * ( spinmax - spinmin );
}
void KDoubleNumInput::sliderMoved(int val)
{
d->spin->setValue( mapSliderToSpin( val ) );
}
void KDoubleNumInput::slotEmitRelativeValueChanged( double value )
{
if ( !d->referencePoint ) return;
emit relativeValueChanged( value / d->referencePoint );
}
QSize KDoubleNumInput::minimumSizeHint() const
{
constPolish();
int w;
int h;
h = 2 + QMAX(m_sizeEdit.height(), m_sizeSlider.height());
// if in extra row, then count it here
- if(m_label && (m_alignment & (AlignBottom|AlignTop)))
+ if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop)))
h += 4 + m_sizeLabel.height();
else
// label is in the same row as the other widgets
h = QMAX(h, m_sizeLabel.height() + 2);
w = m_slider ? m_slider->sizeHint().width() + 8 : 0;
w += m_colw1 + m_colw2;
- if(m_alignment & (AlignTop|AlignBottom))
+ if(m_alignment & (Qt::AlignTop|Qt::AlignBottom))
w = QMAX(w, m_sizeLabel.width() + 4);
return QSize(w, h);
}
void KDoubleNumInput::resizeEvent(QResizeEvent* e)
{
int w = m_colw1;
int h = 0;
- if(m_label && (m_alignment & AlignTop)) {
+ if(m_label && (m_alignment & Qt::AlignTop)) {
m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height());
h += m_sizeLabel.height() + 4;
}
- if(m_label && (m_alignment & AlignVCenter))
+ if(m_label && (m_alignment & Qt::AlignVCenter))
m_label->setGeometry(0, 0, w, m_sizeEdit.height());
d->spin->setGeometry(w, h, m_slider ? m_colw2
: e->size().width() - w, m_sizeEdit.height());
w += m_colw2 + 8;
if(m_slider)
m_slider->setGeometry(w, h, e->size().width() - w, m_sizeEdit.height());
h += m_sizeEdit.height() + 2;
- if(m_label && (m_alignment & AlignBottom))
+ if(m_label && (m_alignment & Qt::AlignBottom))
m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height());
}
void KDoubleNumInput::doLayout()
{
m_sizeEdit = d->spin->sizeHint();
m_colw2 = m_sizeEdit.width();
}
void KDoubleNumInput::setValue(double val)
{
d->spin->setValue( val );
}
void KDoubleNumInput::setRelativeValue( double r )
{
if ( !d->referencePoint ) return;
++d->blockRelative;
setValue( r * d->referencePoint );
--d->blockRelative;
}
void KDoubleNumInput::setReferencePoint( double ref )
{
// clip to valid range:
ref = kMin( maxValue(), kMax( minValue(), ref ) );
d->referencePoint = ref;
}
void KDoubleNumInput::setRange(double lower, double upper, double step,
bool slider)
{
if( m_slider ) {
// don't update the slider to avoid an endless recursion
QSpinBox * spin = d->spin;
disconnect(spin, SIGNAL(valueChanged(int)),
m_slider, SLOT(setValue(int)) );
}
d->spin->setRange( lower, upper, step, d->spin->precision() );
if(slider) {
// upcast to base type to get the min/maxValue in int form:
QSpinBox * spin = d->spin;
int slmax = spin->maxValue();
int slmin = spin->minValue();
int slvalue = spin->value();
- int slstep = spin->lineStep();
+ int slstep = spin->singleStep();
if (m_slider) {
m_slider->setRange(slmin, slmax);
m_slider->setLineStep(slstep);
m_slider->setValue(slvalue);
} else {
m_slider = new QSlider(slmin, slmax, slstep, slvalue,
- QSlider::Horizontal, this);
+ Qt::Horizontal, this);
m_slider->setTickmarks(QSlider::Below);
// feedback line: when one moves, the other moves, too:
connect(m_slider, SIGNAL(valueChanged(int)),
SLOT(sliderMoved(int)) );
}
connect(spin, SIGNAL(valueChanged(int)),
m_slider, SLOT(setValue(int)) );
// calculate ( slmax - slmin ) / 10 without overflowing ints:
int major = calcDiffByTen( slmax, slmin );
if ( !major ) major = slstep; // ### needed?
m_slider->setTickInterval(major);
} else {
delete m_slider;
m_slider = 0;
}
setReferencePoint( referencePoint() );
layout(true);
updateLegacyMembers();
}
void KDoubleNumInput::setMinValue(double min)
{
setRange(min, maxValue(), d->spin->lineStep(), m_slider);
}
double KDoubleNumInput::minValue() const
{
return d->spin->minValue();
}
@@ -883,75 +886,75 @@ public:
int mapToInt( double value, bool * ok ) const {
assert( ok );
const double f = factor();
if ( value > double(INT_MAX) / f ) {
kdWarning() << "KDoubleSpinBox: can't represent value " << value
<< "in terms of fixed-point numbers with precision "
<< mPrecision << endl;
*ok = false;
return INT_MAX;
} else if ( value < double(INT_MIN) / f ) {
kdWarning() << "KDoubleSpinBox: can't represent value " << value
<< "in terms of fixed-point numbers with precision "
<< mPrecision << endl;
*ok = false;
return INT_MIN;
} else {
*ok = true;
return int( value * f + ( value < 0 ? -0.5 : 0.5 ) );
}
}
double mapToDouble( int value ) const {
return double(value) * basicStep();
}
int mPrecision;
KDoubleValidator * mValidator;
};
KDoubleSpinBox::KDoubleSpinBox( QWidget * parent, const char * name )
: QSpinBox( parent, name )
{
- editor()->setAlignment( Qt::AlignRight );
+ setAlignment( Qt::AlignRight );
d = new Private();
updateValidator();
}
KDoubleSpinBox::KDoubleSpinBox( double lower, double upper, double step,
double value, int precision,
QWidget * parent, const char * name )
: QSpinBox( parent, name )
{
- editor()->setAlignment( Qt::AlignRight );
+ setAlignment( Qt::AlignRight );
d = new Private();
setRange( lower, upper, step, precision );
setValue( value );
connect( this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)) );
}
KDoubleSpinBox::~KDoubleSpinBox() {
delete d; d = 0;
}
bool KDoubleSpinBox::acceptLocalizedNumbers() const {
if ( !d->mValidator ) return true; // we'll set one that does;
// can't do it now, since we're const
return d->mValidator->acceptLocalizedNumbers();
}
void KDoubleSpinBox::setAcceptLocalizedNumbers( bool accept ) {
if ( !d->mValidator ) updateValidator();
d->mValidator->setAcceptLocalizedNumbers( accept );
}
void KDoubleSpinBox::setRange( double lower, double upper, double step,
int precision ) {
lower = kMin(upper, lower);
upper = kMax(upper, lower);
setPrecision( precision, true ); // disable bounds checking, since
setMinValue( lower ); // it's done in set{Min,Max}Value
setMaxValue( upper ); // anyway and we want lower, upper
setLineStep( step ); // and step to have the right precision
}
int KDoubleSpinBox::precision() const {
@@ -998,98 +1001,98 @@ void KDoubleSpinBox::setValue( double value ) {
bool ok = false;
base::setValue( d->mapToInt( value, &ok ) );
assert( ok );
}
}
double KDoubleSpinBox::minValue() const {
return d->mapToDouble( base::minValue() );
}
void KDoubleSpinBox::setMinValue( double value ) {
bool ok = false;
int min = d->mapToInt( value, &ok );
if ( !ok ) return;
base::setMinValue( min );
updateValidator();
}
double KDoubleSpinBox::maxValue() const {
return d->mapToDouble( base::maxValue() );
}
void KDoubleSpinBox::setMaxValue( double value ) {
bool ok = false;
int max = d->mapToInt( value, &ok );
if ( !ok ) return;
base::setMaxValue( max );
updateValidator();
}
double KDoubleSpinBox::lineStep() const {
- return d->mapToDouble( base::lineStep() );
+ return d->mapToDouble( base::singleStep() );
}
void KDoubleSpinBox::setLineStep( double step ) {
bool ok = false;
if ( step > maxValue() - minValue() )
base::setLineStep( 1 );
else
base::setLineStep( kMax( d->mapToInt( step, &ok ), 1 ) );
}
QString KDoubleSpinBox::mapValueToText( int value ) {
if ( acceptLocalizedNumbers() )
return KGlobal::locale()
->formatNumber( d->mapToDouble( value ), d->mPrecision );
else
return QString().setNum( d->mapToDouble( value ), 'f', d->mPrecision );
}
int KDoubleSpinBox::mapTextToValue( bool * ok ) {
double value;
if ( acceptLocalizedNumbers() )
value = KGlobal::locale()->readNumber( cleanText(), ok );
else
value = cleanText().toDouble( ok );
if ( !*ok ) return 0;
if ( value > maxValue() )
value = maxValue();
else if ( value < minValue() )
value = minValue();
return d->mapToInt( value, ok );
}
void KDoubleSpinBox::setValidator( const QValidator * ) {
// silently discard the new validator. We don't want another one ;-)
}
void KDoubleSpinBox::slotValueChanged( int value ) {
emit valueChanged( d->mapToDouble( value ) );
}
void KDoubleSpinBox::updateValidator() {
if ( !d->mValidator ) {
d->mValidator = new KDoubleValidator( minValue(), maxValue(), precision(),
this, "d->mValidator" );
- base::setValidator( d->mValidator );
+ lineEdit()->setValidator( d->mValidator );
} else
d->mValidator->setRange( minValue(), maxValue(), precision() );
}
void KNumInput::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KIntNumInput::virtual_hook( int id, void* data )
{ KNumInput::virtual_hook( id, data ); }
void KDoubleNumInput::virtual_hook( int id, void* data )
{ KNumInput::virtual_hook( id, data ); }
void KIntSpinBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KDoubleSpinBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "knuminput.moc"
diff --git a/microkde/kdeui/knuminput.h b/microkde/kdeui/knuminput.h
index 123fefa..9f9e200 100644
--- a/microkde/kdeui/knuminput.h
+++ b/microkde/kdeui/knuminput.h
@@ -1,116 +1,121 @@
/*
* knuminput.h
*
* Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca>
* Copyright (c) 2000 Dirk A. Mueller <mueller@kde.org>
* Copyright (c) 2002 Marc Mutz <mutz@kde.org>
*
* Requires the Qt widget libraries, available at no cost at
* http://www.troll.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef K_NUMINPUT_H
#define K_NUMINPUT_H
#include <qwidget.h>
#include <qspinbox.h>
+#include <QLineEdit>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
+#include <QEvent>
class QLabel;
class QSlider;
class QLineEdit;
class QLayout;
class QValidator;
class KIntSpinBox;
/* ------------------------------------------------------------------------ */
/**
* You need to inherit from this class if you want to implement K*NumInput
* for a different variable type
*
*/
class KNumInput : public QWidget
{
Q_OBJECT
Q_PROPERTY( QString label READ label WRITE setLabel )
public:
/**
* Default constructor
*
*/
KNumInput(QWidget* parent=0, const char* name=0);
/**
* @param below A pointer to another KNumInput.
*
*/
KNumInput(KNumInput* below, QWidget* parent=0, const char* name=0);
~KNumInput();
/**
* Sets the text and alignment of the main description label.
*
* @param label The text of the label.
* Use QString::null to remove an existing one.
*
* @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and
* @p AlignTop, @p AlignVCenter, @p AlignBottom.
* default is @p AlignLeft | @p AlignTop.
*
* The vertical alignment flags have special meaning with this
* widget:
*
* @li @p AlignTop The label is placed above the edit/slider
* @li @p AlignVCenter The label is placed left beside the edit
* @li @p AlignBottom The label is placed below the edit/slider
*
*/
- virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop);
+ virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop);
/**
* @return the text of the label.
*/
QString label() const;
/**
* @return if the num input has a slider.
* @since 3.1
*/
bool showSlider() const { return m_slider; }
/**
* Sets the spacing of tickmarks for the slider.
*
* @param minor Minor tickmark separation.
* @param major Major tickmark separation.
*/
void setSteps(int minor, int major);
/**
* Specifies that this widget may stretch horizontally, but is
* fixed vertically (like @ref QSpinBox itself).
*/
QSizePolicy sizePolicy() const;
/**
* Returns a size which fits the contents of the control.
*
* @return the preferred size necessary to show the control
*/
virtual QSize sizeHint() const;
@@ -273,65 +278,65 @@ public:
* @param max maximum value
* @param step step size for the QSlider
*/
void setRange(int min, int max, int step=1, bool slider=true);
/**
* Sets the minimum value.
*/
void setMinValue(int min);
/**
* @return the minimum value.
*/
int minValue() const;
/**
* Sets the maximum value.
*/
void setMaxValue(int max);
/**
* @return the maximum value.
*/
int maxValue() const;
/**
* Sets the special value text. If set, the SpinBox will display
* this text instead of the numeric value whenever the current
* value is equal to minVal(). Typically this is used for indicating
* that the choice has a special (default) meaning.
*/
void setSpecialValueText(const QString& text);
/**
* @reimplemented
*/
- virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop);
+ virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop);
/**
* This method returns the minimum size necessary to display the
* control. The minimum size is enough to show all the labels
* in the current font (font change may invalidate the return value).
*
* @return the minimum size necessary to show the control
*/
virtual QSize minimumSizeHint() const;
public slots:
/**
* Sets the value of the control.
*/
void setValue(int);
/**
* Sets the value in units of the @ref referencePoint
* @since 3.1
*/
void setRelativeValue(double);
/**
* Sets the reference point for @ref relativeValue.
* @since 3.1
*/
void setReferencePoint(int);
/**
* Sets the suffix to @p suffix.
* Use QString::null to disable this feature.
* Formatting has to be provided (e.g. a space separator between the
@@ -559,65 +564,65 @@ public:
* @return the maximum value.
*/
double maxValue() const;
/**
* Specifies the number of digits to use.
*/
void setPrecision(int precision);
/**
* @return the reference point for @ref #relativeValue calculation
* @since 3.1
*/
double referencePoint() const;
/**
* @return the current value in units of @ref #referencePoint.
* @since 3.1
*/
double relativeValue() const;
/**
* Sets the special value text. If set, the spin box will display
* this text instead of the numeric value whenever the current
* value is equal to @ref #minVal(). Typically this is used for indicating
* that the choice has a special (default) meaning.
*/
void setSpecialValueText(const QString& text);
/**
* @reimplemented
*/
- virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop);
+ virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop);
/**
* @reimplemented
*/
virtual QSize minimumSizeHint() const;
/**
* @reimplemented
*/
virtual bool eventFilter(QObject*, QEvent*);
public slots:
/**
* Sets the value of the control.
*/
void setValue(double);
/**
* Sets the value in units of @ref #referencePoint.
* @since 3.1
*/
void setRelativeValue(double);
/**
* Sets the reference Point to @p ref. It @p ref == 0, emitting of
* @ref #relativeValueChanged is blocked and @ref #relativeValue
* just returns 0.
* @since 3.1
*/
void setReferencePoint(double ref);
/**
* Sets the suffix to be displayed to @p suffix. Use QString::null to disable
* this feature. Note that the suffix is attached to the value without any
@@ -729,64 +734,68 @@ public:
* and a slider.
*
* @param lower The lowest valid value.
* @param upper The greatest valid value.
* @param step The step size of the scrollbar.
* @param value The actual value.
* @param base The base of the used number system.
* @param parent The parent of the widget.
* @param name The Name of the widget.
*/
KIntSpinBox(int lower, int upper, int step, int value, int base = 10,
QWidget* parent = 0, const char* name = 0);
/**
* Destructor.
*/
virtual ~KIntSpinBox();
/**
* Sets the base in which the numbers in the spin box are represented.
*/
void setBase(int base);
/**
* @return the base in which numbers in the spin box are represented.
*/
int base() const;
/**
* sets focus and optionally marks all text
*
*/
void setEditFocus(bool mark);
+ void setValidator(const QValidator *v) {
+ lineEdit()->setValidator(v);
+ }
+
protected:
/**
* Overloaded the method in QSpinBox
* to make use of the base given in the constructor.
*/
virtual QString mapValueToText(int);
/**
* Overloaded the method in QSpinBox
* to make use of the base given in the constructor.
*/
virtual int mapTextToValue(bool*);
private:
int val_base;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KIntSpinBoxPrivate;
KIntSpinBoxPrivate *d;
};
/* --------------------------------------------------------------------------- */
/**
This class provides a spin box for fractional numbers.
@sect Parameters
There are a number of interdependent parameters whose relation to
diff --git a/microkde/kdeui/kpopupmenu.cpp b/microkde/kdeui/kpopupmenu.cpp
index 96d2a87..7e1503c 100644
--- a/microkde/kdeui/kpopupmenu.cpp
+++ b/microkde/kdeui/kpopupmenu.cpp
@@ -1,19 +1,22 @@
#include <kpopupmenu.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <QFocusEvent>
+#include <Q3PopupMenu>
KPopupMenu::KPopupMenu ( QWidget * parent, const char * name )
- : QPopupMenu ( parent, name ) {;}
+ : Q3PopupMenu ( parent, name ) {;}
KMenuBar::KMenuBar ( QWidget * parent, const char * name )
: QPEMenuBar ( parent, name ) {}
void KMenuBar::focusOutEvent ( QFocusEvent * e)
{
QPEMenuBar::focusOutEvent( e );
QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) );
}
diff --git a/microkde/kdeui/kpopupmenu.h b/microkde/kdeui/kpopupmenu.h
index fd00f36..1c903ad 100644
--- a/microkde/kdeui/kpopupmenu.h
+++ b/microkde/kdeui/kpopupmenu.h
@@ -1,32 +1,34 @@
#ifndef KPOPUPMENU_H
#define KPOPUPMENU_H
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <QFocusEvent>
#ifdef DESKTOP_VERSION
#include <qmenubar.h>
#define QPEMenuBar QMenuBar
#else
#include <qpe/qpemenubar.h>
#endif
-class KPopupMenu : public QPopupMenu
+class KPopupMenu : public Q3PopupMenu
{
Q_OBJECT
public:
KPopupMenu ( QWidget * parent=0, const char * name=0 );
};
class KMenuBar : public QPEMenuBar
{
Q_OBJECT
public:
KMenuBar ( QWidget * parent=0, const char * name=0 );
signals:
void lostFocus();
protected:
void focusOutEvent ( QFocusEvent * e);
};
#endif
diff --git a/microkde/kdeui/kseparator.cpp b/microkde/kdeui/kseparator.cpp
index d028420..66000f0 100644
--- a/microkde/kdeui/kseparator.cpp
+++ b/microkde/kdeui/kseparator.cpp
@@ -1,96 +1,98 @@
/*
* Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <qstyle.h>
+//Added by qt3to4:
+#include <Q3Frame>
#include <kdebug.h>
//US #include <kapplication.h>
//US #include "kseparator.moc"
#include "kseparator.h"
-KSeparator::KSeparator(QWidget* parent, const char* name, WFlags f)
- : QFrame(parent, name, f)
+KSeparator::KSeparator(QWidget* parent, const char* name, Qt::WFlags f)
+ : Q3Frame(parent, name, f)
{
setLineWidth(1);
setMidLineWidth(0);
setOrientation( HLine );
}
-KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, WFlags f)
- : QFrame(parent, name, f)
+KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, Qt::WFlags f)
+ : Q3Frame(parent, name, f)
{
setLineWidth(1);
setMidLineWidth(0);
setOrientation( orientation );
}
void KSeparator::setOrientation(int orientation)
{
switch(orientation)
{
- case Vertical:
+ case Qt::Vertical:
case VLine:
- setFrameStyle( QFrame::VLine | QFrame::Sunken );
+ setFrameStyle( Q3Frame::VLine | Q3Frame::Sunken );
setMinimumSize(2, 0);
break;
default:
kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl;
- case Horizontal:
+ case Qt::Horizontal:
case HLine:
- setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken );
setMinimumSize(0, 2);
break;
}
}
int KSeparator::orientation() const
{
if ( frameStyle() & VLine )
return VLine;
if ( frameStyle() & HLine )
return HLine;
return 0;
}
void KSeparator::drawFrame(QPainter *p)
{
QPoint p1, p2;
QRect r = frameRect();
const QColorGroup & g = colorGroup();
if ( frameStyle() & HLine ) {
p1 = QPoint( r.x(), r.height()/2 );
p2 = QPoint( r.x()+r.width(), p1.y() );
}
else {
p1 = QPoint( r.x()+r.width()/2, 0 );
p2 = QPoint( p1.x(), r.height() );
}
diff --git a/microkde/kdeui/kseparator.h b/microkde/kdeui/kseparator.h
index 6d2712a..c673475 100644
--- a/microkde/kdeui/kseparator.h
+++ b/microkde/kdeui/kseparator.h
@@ -1,77 +1,77 @@
/*
* Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __KSEPARATOR_H__
#define __KSEPARATOR_H__
-#include <qframe.h>
+#include <q3frame.h>
/**
* Standard horizontal or vertical separator.
*
* @author Michael Roth <mroth@wirlweb.de>
* @version $Id$
*/
-class KSeparator : public QFrame
+class KSeparator : public Q3Frame
{
Q_OBJECT
Q_PROPERTY( int orientation READ orientation WRITE setOrientation )
public:
/**
* Constructor.
**/
- KSeparator(QWidget* parent=0, const char* name=0, WFlags f=0);
+ KSeparator(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
/**
* Constructor.
*
* @param orientation Set the orientation of the separator.
* Possible values are HLine or Horizontal and VLine or Vertical.
**/
KSeparator(int orientation, QWidget* parent=0, const char* name=0,
- WFlags f=0);
+ Qt::WFlags f=0);
/**
* Returns the orientation of the separator.
*
* Possible values are VLine and HLine.
**/
int orientation() const;
/**
* Set the orientation of the separator to @p orient
*
* Possible values are VLine and HLine.
*/
void setOrientation(int orient);
/**
* The recommended height (width) for a horizontal (vertical) separator.
**/
virtual QSize sizeHint() const;
protected:
virtual void drawFrame( QPainter * );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KSeparatorPrivate* d;
};
#endif // __KSEPARATOR_H__
diff --git a/microkde/kdeui/ksqueezedtextlabel.cpp b/microkde/kdeui/ksqueezedtextlabel.cpp
index 37fa29a..e2c61fd 100644
--- a/microkde/kdeui/ksqueezedtextlabel.cpp
+++ b/microkde/kdeui/ksqueezedtextlabel.cpp
@@ -1,52 +1,55 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ksqueezedtextlabel.h"
#include <qtooltip.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name )
: QLabel ( parent, name ) {
setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
fullText = text;
squeezeTextToLabel();
}
KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name )
: QLabel ( parent, name ) {
setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
}
void KSqueezedTextLabel::resizeEvent( QResizeEvent * ) {
squeezeTextToLabel();
}
QSize KSqueezedTextLabel::minimumSizeHint() const
{
QSize sh = QLabel::minimumSizeHint();
sh.setWidth(-1);
return sh;
}
void KSqueezedTextLabel::setText( const QString &text ) {
fullText = text;
squeezeTextToLabel();
}
void KSqueezedTextLabel::squeezeTextToLabel() {
QFontMetrics fm(fontMetrics());
int labelWidth = size().width();
diff --git a/microkde/kdeui/ksqueezedtextlabel.h b/microkde/kdeui/ksqueezedtextlabel.h
index 1634adc..487d0b0 100644
--- a/microkde/kdeui/ksqueezedtextlabel.h
+++ b/microkde/kdeui/ksqueezedtextlabel.h
@@ -1,54 +1,56 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KSQUEEZEDTEXTLABEL_H
#define KSQUEEZEDTEXTLABEL_H
#include <qlabel.h>
+//Added by qt3to4:
+#include <QResizeEvent>
/**
* A label class that squeezes its text into the label
*
* If the text is too long to fit into the label it is divided into
* remaining left and right parts which are separated by three dots.
*
* Example:
* http://www.kde.org/documentation/index.html could be squeezed to
* http://www.kde...ion/index.html
* @short A replacement for QLabel that squeezes its text
* @author Ronny Standtke <Ronny.Standtke@gmx.de>
* @version $Id$
*
*/
/*
* @ref QLabel
*/
class KSqueezedTextLabel : public QLabel {
Q_OBJECT
public:
/**
* Default constructor.
*/
KSqueezedTextLabel( QWidget *parent, const char *name = 0 );
KSqueezedTextLabel( const QString &text, QWidget *parent, const char *name = 0 );
virtual QSize minimumSizeHint() const;
diff --git a/microkde/kdeui/kstdaction.cpp b/microkde/kdeui/kstdaction.cpp
index cfd7b54..f0d162d 100644
--- a/microkde/kdeui/kstdaction.cpp
+++ b/microkde/kdeui/kstdaction.cpp
@@ -1,54 +1,54 @@
/* This file is part of the KDE libraries
Copyright (C) 1999,2000 Kurt Granroth <granroth@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kstdaction.h"
#include <qtoolbutton.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
//US #include <kaboutdata.h>
#include <kaction.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstdaccel.h>
//US #include <kmainwindow.h>
namespace KStdAction
{
struct KStdActionInfo
{
StdAction id;
/*US KStdAccel::StdAccel idAccel;*/
const char* psName;
const char* psLabel;
const char* psWhatsThis;
const char* psIconName;
};
const KStdActionInfo g_rgActionInfo[] =
{
{ New, /*USKStdAccel::New,*/ "file_new", I18N_NOOP("&New"), 0, "filenew" },
{ Open, /*USKStdAccel::Open,*/ "file_open", I18N_NOOP("&Open..."), 0, "fileopen" },
{ OpenRecent, /*USKStdAccel::AccelNone,*/ "file_open_recent", I18N_NOOP("Open &Recent"), 0, 0 },
{ Save, /*USKStdAccel::Save,*/ "file_save", I18N_NOOP("&Save"), 0, "filesave" },
{ SaveAs, /*USKStdAccel::AccelNone,*/ "file_save_as", I18N_NOOP("Save &As..."), 0, "filesaveas" },
{ Revert, /*USKStdAccel::AccelNone,*/ "file_revert", I18N_NOOP("Re&vert"), 0, "revert" },
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 027e5e9..02db316 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -1,388 +1,399 @@
/* This file is part of the KDE libraries
Copyright
(C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997, 1998 Stephan Kulow (coolo@kde.org)
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Sven Radej (radej@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 1999 Kurt Granroth (granroth@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifdef KDE_USE_FINAL
#undef Always
-#include <qdockwindow.h>
+#include <q3dockwindow.h>
#endif
-
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
+#include <QPixmap>
+#include <Q3Frame>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QShowEvent>
+#include <QDesktopWidget>
+#include <QBoxLayout>
#include "ktoolbar.h"
#include "kmainwindow.h"
#include <string.h>
#include <qpainter.h>
#include <qtooltip.h>
#include <qdrawutil.h>
#include <qstring.h>
#include <qrect.h>
-#include <qobjectlist.h>
+#include <qobject.h>
#include <qtimer.h>
#include <qstyle.h>
#include <qapplication.h>
//US #include <config.h>
#include "klineedit.h"
#include "kseparator.h"
#include <klocale.h>
#include <kapplication.h>
#include <kaction.h>
#include <kstdaction.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kiconloader.h>
#include <kcombobox.h>
//US #include <kpopupmenu.h>
//US #include <kanimwidget.h>
//US #include <kipc.h>
//US #include <kwin.h>
#include <kdebug.h>
#include <qlayout.h>
#include "ktoolbarbutton.h"
//US
#include "kconfigbase.h"
-#include <qpopupmenu.h>
-#include <qmainwindow.h>
+#include <q3popupmenu.h>
+#include <q3mainwindow.h>
enum {
CONTEXT_TOP = 0,
CONTEXT_LEFT = 1,
CONTEXT_RIGHT = 2,
CONTEXT_BOTTOM = 3,
CONTEXT_FLOAT = 4,
CONTEXT_FLAT = 5,
CONTEXT_ICONS = 6,
CONTEXT_TEXT = 7,
CONTEXT_TEXTRIGHT = 8,
CONTEXT_TEXTUNDER = 9,
CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before
};
class KToolBarPrivate
{
public:
KToolBarPrivate() {
m_iconSize = 0;
m_iconText = KToolBar::IconOnly;
m_highlight = true;
m_transparent = true;
m_honorStyle = false;
m_enableContext = true;
m_xmlguiClient = 0;
m_configurePlugged = false;
//US oldPos = Qt::DockUnmanaged;
- oldPos = QMainWindow::Unmanaged;
+ oldPos = Qt::Unmanaged;
modified = m_isHorizontal = positioned = FALSE;
HiddenDefault = false;
IconSizeDefault = 0;
IconTextDefault = "IconOnly";
IndexDefault = -1;
NewLineDefault = false;
OffsetDefault = -1;
PositionDefault = "Top";
idleButtons.setAutoDelete(true);
}
int m_iconSize;
KToolBar::IconText m_iconText;
bool m_highlight : 1;
bool m_transparent : 1;
bool m_honorStyle : 1;
bool m_isHorizontal : 1;
bool m_enableContext : 1;
bool m_configurePlugged : 1;
bool modified : 1;
bool positioned : 1;
QWidget *m_parent;
- QMainWindow::ToolBarDock oldPos;
+ Qt::ToolBarDock oldPos;
KXMLGUIClient *m_xmlguiClient;
struct ToolBarInfo
{
//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
- ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {}
+ ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
- ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
+ ToolBarInfo( Qt::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
int index, offset;
bool newline;
//US Qt::Dock dock;
- QMainWindow::ToolBarDock dock;
+ Qt::ToolBarDock dock;
};
ToolBarInfo toolBarInfo;
- QValueList<int> iconSizes;
+ Q3ValueList<int> iconSizes;
QTimer repaintTimer;
// Default Values.
bool HiddenDefault;
int IconSizeDefault;
QString IconTextDefault;
int IndexDefault;
bool NewLineDefault;
int OffsetDefault;
QString PositionDefault;
- QPtrList<QWidget> idleButtons;
+ Q3PtrList<QWidget> idleButtons;
};
-KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent,
+KToolBarSeparator::KToolBarSeparator(Qt::Orientation o , bool l, Q3ToolBar *parent,
const char* name )
- :QFrame( parent, name ), line( l )
+ :Q3Frame( parent, name ), line( l )
{
- connect( parent, SIGNAL(orientationChanged(Orientation)),
- this, SLOT(setOrientation(Orientation)) );
+ connect( parent, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(setOrientation(Qt::Orientation)) );
setOrientation( o );
setBackgroundMode( parent->backgroundMode() );
setBackgroundOrigin( ParentOrigin );
}
-void KToolBarSeparator::setOrientation( Orientation o )
+void KToolBarSeparator::setOrientation( Qt::Orientation o )
{
orient = o;
if ( line ) {
- if ( orientation() == Vertical )
+ if ( orientation() == Qt::Vertical )
setFrameStyle( HLine + Sunken );
else
setFrameStyle( VLine + Sunken );
} else {
setFrameStyle( NoFrame );
}
}
void KToolBarSeparator::styleChange( QStyle& )
{
setOrientation( orient );
}
QSize KToolBarSeparator::sizeHint() const
{
- return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
+ return orientation() == Qt::Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
}
QSizePolicy KToolBarSeparator::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
}
KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
- : QToolBar( QString::fromLatin1( name ),
- parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
+ : Q3ToolBar( QString::fromLatin1( name ),
+ parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0,
parent, FALSE,
name ? name : "mainToolBar")
#else
- : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
+ : QPEToolBar( parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0,
QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
-KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
+KToolBar::KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
- : QToolBar( QString::fromLatin1( name ),
+ : Q3ToolBar( QString::fromLatin1( name ),
parentWindow, dock, newLine,
name ? name : "mainToolBar")
#else
: QPEToolBar( parentWindow,QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
-KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
+KToolBar::KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
- : QToolBar( QString::fromLatin1( name ),
+ : Q3ToolBar( QString::fromLatin1( name ),
parentWindow, dock, newLine,
name ? name : "mainToolBar")
#else
: QPEToolBar( parentWindow,QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
KToolBar::~KToolBar()
{
inshutdownprocess = true;
emit toolbarDestroyed();
delete d;
}
void KToolBar::init( bool readConfig, bool honorStyle )
{
sizeHintW = 240;
sizeHintH = 22;
inshutdownprocess = false;
d = new KToolBarPrivate;
setFullSize( TRUE );
d->m_honorStyle = honorStyle;
context = 0;
layoutTimer = new QTimer( this );
connect( layoutTimer, SIGNAL( timeout() ),
this, SLOT( rebuildLayout() ) );
connect( &(d->repaintTimer), SIGNAL( timeout() ),
this, SLOT( slotRepaint() ) );
/*US
if ( kapp ) { // may be null when started inside designer
connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged()));
// request notification of changes in icon style
kapp->addKipcEventMask(KIPC::IconChanged);
connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int)));
}
*/
// finally, read in our configurable settings
if ( readConfig )
slotReadConfig();
if ( mainWindow() )
- connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ),
- this, SLOT( toolBarPosChanged( QToolBar * ) ) );
+ connect( mainWindow(), SIGNAL( toolBarPositionChanged( Q3ToolBar * ) ),
+ this, SLOT( toolBarPosChanged( Q3ToolBar * ) ) );
// Hack to make sure we recalculate our size when we dock.
//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) );
}
int KToolBar::insertButton(const QString& icon, int id, bool enabled,
const QString& text, int index/*US, KInstance *_instance*/ )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QString& icon, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled, const QString& text, int index/*US, KInstance *_instance*/ )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
connect( button, signal, receiver, slot );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled,
const QString& text, int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
doConnections( button );
return index;
}
#if 0
bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index/*US, instance*/ );
#endif
int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled, const QString& text,
int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
connect( button, signal, receiver, slot );
doConnections( button );
return index;
}
-int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup,
+int KToolBar::insertButton(const QString& icon, int id, Q3PopupMenu *popup,
bool enabled, const QString &text, int index )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
button->setPopup( popup );
doConnections( button );
return index;
}
-int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
+int KToolBar::insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup,
bool enabled, const QString &text, int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
button->setPopup( popup );
doConnections( button );
return index;
}
int KToolBar::insertLined (const QString& text, int id,
const char *signal,
const QObject *receiver, const char *slot,
bool enabled ,
const QString& toolTipText,
int size, int index )
{
KLineEdit *lined = new KLineEdit ( this, 0 );
if ( !toolTipText.isEmpty() )
QToolTip::add( lined, toolTipText );
if ( size > 0 )
lined->setMinimumWidth( size );
insertWidgetInternal( lined, index, id );
connect( lined, signal, receiver, slot );
lined->setText(text);
lined->setEnabled( enabled );
return index;
}
int KToolBar::insertCombo (const QStringList &list, int id, bool writable,
const char *signal, const QObject *receiver,
@@ -511,77 +522,77 @@ void KToolBar::setItemEnabled( int id, bool enabled )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
if ( (*it) )
(*it)->setEnabled( enabled );
}
void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setPixmap( _pixmap );
}
void KToolBar::setButtonIcon( int id, const QString& _icon )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setIcon( _icon );
}
-void KToolBar::setButtonIconSet( int id, const QIconSet& iconset )
+void KToolBar::setButtonIconSet( int id, const QIcon& iconset )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setIconSet( iconset );
}
-void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle )
+void KToolBar::setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setDelayedPopup( _popup, toggle );
}
void KToolBar::setAutoRepeat (int id, bool flag)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setAutoRepeat( flag );
}
void KToolBar::setToggle (int id, bool flag )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setToggle( flag );
@@ -758,65 +769,65 @@ KToolBarButton * KToolBar::getButton (int id)
}
void KToolBar::alignItemRight (int id, bool right )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
if ( rightAligned && !right && (*it) == rightAligned )
rightAligned = 0;
if ( (*it) && right )
rightAligned = (*it);
}
QWidget *KToolBar::getWidget (int id)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
return ( it == id2widget.end() ) ? 0 : (*it);
}
void KToolBar::setItemAutoSized (int id, bool yes )
{
QWidget *w = getWidget(id);
if ( w && yes )
setStretchableWidget( w );
}
void KToolBar::clear ()
{
- QToolBar::clear();
+ Q3ToolBar::clear();
widget2id.clear();
id2widget.clear();
}
void KToolBar::removeItem(int id)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
{
kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
return;
}
QWidget * w = (*it);
id2widget.remove( id );
widget2id.remove( w );
widgets.removeRef( w );
delete w;
}
void KToolBar::removeItemDelayed(int id)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
{
kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
return;
}
QWidget * w = (*it);
id2widget.remove( id );
widget2id.remove( w );
@@ -847,79 +858,79 @@ void KToolBar::showItem (int id)
int KToolBar::itemIndex (int id)
{
QWidget *w = getWidget(id);
return w ? widgets.findRef(w) : -1;
}
void KToolBar::setFullSize(bool flag )
{
setHorizontalStretchable( flag );
setVerticalStretchable( flag );
}
bool KToolBar::fullSize() const
{
return isHorizontalStretchable() || isVerticalStretchable();
}
void KToolBar::enableMoving(bool flag )
{
//US setMovingEnabled(flag);
this->mainWindow()->setToolBarsMovable(flag);
}
void KToolBar::setBarPos (BarPosition bpos)
{
if ( !mainWindow() )
return;
//US mainWindow()->moveDockWindow( this, (Dock)bpos );
- mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
+ mainWindow()->moveToolBar( this, (Qt::ToolBarDock)bpos );
}
const KToolBar::BarPosition KToolBar::barPos()
{
- if ( !(QMainWindow*)mainWindow() )
+ if ( !(Q3MainWindow*)mainWindow() )
return KToolBar::Top;
//US Dock dock;
- QMainWindow::ToolBarDock dock;
+ Qt::ToolBarDock dock;
int dm1, dm2;
bool dm3;
- ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
+ ((Q3MainWindow*)mainWindow())->getLocation( (Q3ToolBar*)this, dock, dm1, dm3, dm2 );
//US if ( dock == DockUnmanaged ) {
- if ( dock == QMainWindow::Unmanaged ) {
+ if ( dock == Qt::Unmanaged ) {
return (KToolBar::BarPosition)Top;
}
return (BarPosition)dock;
}
bool KToolBar::enable(BarStatus stat)
{
bool mystat = isVisible();
if ( (stat == Toggle && mystat) || stat == Hide )
hide();
else
show();
return isVisible() == mystat;
}
void KToolBar::setMaxHeight ( int h )
{
setMaximumHeight( h );
}
int KToolBar::maxHeight()
{
return maximumHeight();
}
void KToolBar::setMaxWidth (int dw)
{
@@ -938,163 +949,163 @@ void KToolBar::setTitle (const QString& _title)
setLabel( _title );
}
void KToolBar::enableFloating (bool )
{
}
void KToolBar::setIconText(IconText it)
{
setIconText( it, true );
}
void KToolBar::setIconText(IconText icontext, bool update)
{
bool doUpdate=false;
if (icontext != d->m_iconText) {
d->m_iconText = icontext;
doUpdate=true;
}
if (update == false)
return;
if (doUpdate)
emit modechange(); // tell buttons what happened
// ugly hack to force a QMainWindow::triggerLayout( TRUE )
if ( mainWindow() ) {
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
mw->setUpdatesEnabled( FALSE );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setUpdatesEnabled( TRUE );
}
}
KToolBar::IconText KToolBar::iconText() const
{
return d->m_iconText;
}
void KToolBar::setIconSize(int size)
{
setIconSize( size, true );
}
void KToolBar::setIconSize(int size, bool update)
{
bool doUpdate=false;
if ( size != d->m_iconSize ) {
d->m_iconSize = size;
doUpdate=true;
}
if (update == false)
return;
if (doUpdate)
emit modechange(); // tell buttons what happened
// ugly hack to force a QMainWindow::triggerLayout( TRUE )
if ( mainWindow() ) {
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
mw->setUpdatesEnabled( FALSE );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setUpdatesEnabled( TRUE );
}
}
int KToolBar::iconSize() const
{
/*US
if ( !d->m_iconSize ) // default value?
{
if (!::qstrcmp(QObject::name(), "mainToolBar"))
return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar);
else
return KGlobal::iconLoader()->currentSize(KIcon::Toolbar);
}
return d->m_iconSize;
*/
int ret = 18;
if ( QApplication::desktop()->width() > 320 )
ret = 30;
return ret;
}
void KToolBar::setEnableContextMenu(bool enable )
{
d->m_enableContext = enable;
}
bool KToolBar::contextMenuEnabled() const
{
return d->m_enableContext;
}
void KToolBar::setItemNoStyle(int id, bool no_style )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if (button)
button->setNoStyle( no_style );
}
void KToolBar::setFlat (bool flag)
{
if ( !mainWindow() )
return;
if ( flag )
//US mainWindow()->moveDockWindow( this, DockMinimized );
- mainWindow()->moveToolBar( this, QMainWindow::Minimized );
+ mainWindow()->moveToolBar( this, Qt::Minimized );
else
//US mainWindow()->moveDockWindow( this, DockTop );
- mainWindow()->moveToolBar( this, QMainWindow::Top );
+ mainWindow()->moveToolBar( this, Qt::Top );
// And remember to save the new look later
/*US
if ( mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
int KToolBar::count() const
{
return id2widget.count();
}
void KToolBar::saveState()
{
/*US
// first, try to save to the xml file
if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) {
// go down one level to get to the right tags
QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement();
elem = elem.firstChild().toElement();
QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name());
QDomElement current;
// now try to find our toolbar
d->modified = false;
for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
current = elem;
if ( current.tagName().lower() != "toolbar" )
continue;
@@ -1220,258 +1231,258 @@ void KToolBar::saveSettings(KConfig *config, const QString &_configGroup)
void KToolBar::setXMLGUIClient( KXMLGUIClient *client )
{
d->m_xmlguiClient = client;
}
void KToolBar::setText( const QString & txt )
{
//US setLabel( txt + " ( " + kapp->caption() + " ) " );
setLabel( txt + " ( " + KGlobal::getAppName() + " ) " );
}
QString KToolBar::text() const
{
return label();
}
void KToolBar::doConnections( KToolBarButton *button )
{
connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) );
connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) );
connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) );
connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) );
connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) );
connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) );
}
void KToolBar::mousePressEvent ( QMouseEvent *m )
{
if ( !mainWindow() )
return;
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
if ( mw->toolBarsMovable() && d->m_enableContext ) {
- if ( m->button() == RightButton ) {
+ if ( m->button() == Qt::RightButton ) {
int i = contextMenu()->exec( m->globalPos(), 0 );
switch ( i ) {
case -1:
return; // popup cancelled
case CONTEXT_LEFT:
//US mw->moveDockWindow( this, DockLeft );
- mw->moveToolBar( this, QMainWindow::Left );
+ mw->moveToolBar( this, Qt::Left );
break;
case CONTEXT_RIGHT:
//US mw->moveDockWindow( this, DockRight );
- mw->moveToolBar( this, QMainWindow::Right );
+ mw->moveToolBar( this, Qt::Right );
break;
case CONTEXT_TOP:
//US mw->moveDockWindow( this, DockTop );
- mw->moveToolBar( this, QMainWindow::Top );
+ mw->moveToolBar( this, Qt::Top );
break;
case CONTEXT_BOTTOM:
//US mw->moveDockWindow( this, DockBottom );
- mw->moveToolBar( this, QMainWindow::Bottom );
+ mw->moveToolBar( this, Qt::Bottom );
break;
case CONTEXT_FLOAT:
break;
case CONTEXT_FLAT:
//US mw->moveDockWindow( this, DockMinimized );
- mw->moveToolBar( this, QMainWindow::Minimized );
+ mw->moveToolBar( this, Qt::Minimized );
break;
case CONTEXT_ICONS:
setIconText( IconOnly );
break;
case CONTEXT_TEXTRIGHT:
setIconText( IconTextRight );
break;
case CONTEXT_TEXT:
setIconText( TextOnly );
break;
case CONTEXT_TEXTUNDER:
setIconText( IconTextBottom );
break;
default:
if ( i >= CONTEXT_ICONSIZES )
setIconSize( i - CONTEXT_ICONSIZES );
else
return; // assume this was an action handled elsewhere, no need for setSettingsDirty()
}
/*US
if ( mw->inherits("KMainWindow") )
static_cast<KMainWindow *>(mw)->setSettingsDirty();
*/
}
}
}
void KToolBar::rebuildLayout()
{
for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next())
w->blockSignals(false);
d->idleButtons.clear();
layoutTimer->stop();
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
QBoxLayout *l = boxLayout();
l->setMargin( 1 );
// clear the old layout
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
for ( QWidget *w = widgets.first(); w; w = widgets.next() ) {
if ( w == rightAligned ) {
continue;
}
if ( w->inherits( "KToolBarSeparator" ) &&
!( (KToolBarSeparator*)w )->showLine() ) {
l->addSpacing( 6 );
w->hide();
continue;
}
- if ( w->inherits( "QPopupMenu" ) )
+ if ( w->inherits( "Q3PopupMenu" ) )
continue;
l->addWidget( w );
w->show();
}
if ( rightAligned ) {
l->addStretch();
l->addWidget( rightAligned );
rightAligned->show();
}
if ( fullSize() ) {
// This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword).
//if ( !stretchableWidget && widgets.last() &&
// !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) )
// setStretchableWidget( widgets.last() );
if ( !rightAligned )
l->addStretch();
if ( stretchableWidget )
l->setStretchFactor( stretchableWidget, 10 );
}
l->invalidate();
QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) );
//#endif //DESKTOP_VERSION
}
void KToolBar::childEvent( QChildEvent *e )
{
if ( e->child()->isWidgetType() ) {
QWidget * w = (QWidget*)e->child();
if ( e->type() == QEvent::ChildInserted ) {
- if ( !e->child()->inherits( "QPopupMenu" ) &&
+ if ( !e->child()->inherits( "Q3PopupMenu" ) &&
::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
// prevent items that have been explicitly inserted by insert*() from
// being inserted again
if ( !widget2id.contains( w ) )
{
int dummy = -1;
insertWidgetInternal( w, dummy, -1 );
}
}
- } else {
+ } else if( e->type() == QEvent::ChildRemoved ) {
removeWidgetInternal( w );
}
- if ( isVisibleTo( 0 ) )
+ /* TODO:hacker: if ( isVisibleTo( 0 ) )
{
QBoxLayout *l = boxLayout();
// QLayout *l = layout();
// clear the old layout so that we don't get unnecassery layout
// changes till we have rebuild the thing
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
layoutTimer->start( 50, TRUE );
- }
+ } */
}
- QToolBar::childEvent( e );
+ Q3ToolBar::childEvent( e );
}
void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
{
// we can't have it in widgets, or something is really wrong
//widgets.removeRef( w );
connect( w, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ) );
if ( index == -1 || index > (int)widgets.count() ) {
widgets.append( w );
index = (int)widgets.count();
}
else
widgets.insert( index, w );
if ( id == -1 )
id = id2widget.count();
id2widget.insert( id, w );
widget2id.insert( w, id );
}
void KToolBar::repaintMe()
{
setUpdatesEnabled( true );
- QToolBar::repaint( true );
+ Q3ToolBar::repaint( true );
qDebug(" KToolBar::repaintMe() ");
}
void KToolBar::showEvent( QShowEvent *e )
{
rebuildLayout();
- QToolBar::showEvent( e );
+ Q3ToolBar::showEvent( e );
}
void KToolBar::setStretchableWidget( QWidget *w )
{
- QToolBar::setStretchableWidget( w );
+ Q3ToolBar::setStretchableWidget( w );
stretchableWidget = w;
}
QSizePolicy KToolBar::sizePolicy() const
{
- if ( orientation() == Horizontal )
+ if ( orientation() == Qt::Horizontal )
return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
else
return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
}
QSize KToolBar::sizeHint() const
{
- QSize sh = QToolBar::sizeHint();
+ QSize sh = Q3ToolBar::sizeHint();
//qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() );
if ( sh.height() <= 20 || sh.width() < 60 )
return QSize( sizeHintW, sizeHintH );
KToolBar* ttt = (KToolBar*) this;
ttt->sizeHintW = sh.width();
ttt->sizeHintH = sh.height();
return sh;
//return QToolBar::sizeHint();
#if 0
QWidget::polish();
static int iii = 0;
++iii;
qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
switch( barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
for ( QWidget *w = widgets.first(); w; w =widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(6, 0);
}
else
{
QSize sh = w->sizeHint();
if (!sh.isValid())
sh = w->minimumSize();
minSize = minSize.expandedTo(QSize(0, sh.height()));
minSize += QSize(sh.width()+1, 0);
@@ -1479,101 +1490,101 @@ QSize KToolBar::sizeHint() const
}
/*US
minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0);
*/
minSize += QSize(margin*2, margin*2);
break;
case KToolBar::Left:
case KToolBar::Right:
for ( QWidget *w = widgets.first(); w; w = widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(0, 6);
}
else
{
QSize sh = w->sizeHint();
if (!sh.isValid())
sh = w->minimumSize();
minSize = minSize.expandedTo(QSize(sh.width(), 0));
minSize += QSize(0, sh.height()+1);
}
}
/*US
minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
*/
minSize += QSize(margin*2, margin*2);
break;
default:
- minSize = QToolBar::sizeHint();
+ minSize = Q3ToolBar::sizeHint();
break;
}
return minSize;
#endif
}
QSize KToolBar::minimumSize() const
{
return minimumSizeHint();
}
QSize KToolBar::minimumSizeHint() const
{
return sizeHint();
}
bool KToolBar::highlight() const
{
return d->m_highlight;
}
void KToolBar::hide()
{
- QToolBar::hide();
+ Q3ToolBar::hide();
}
void KToolBar::show()
{
- QToolBar::show();
+ Q3ToolBar::show();
}
void KToolBar::resizeEvent( QResizeEvent *e )
{
bool b = isUpdatesEnabled();
setUpdatesEnabled( FALSE );
- QToolBar::resizeEvent( e );
+ Q3ToolBar::resizeEvent( e );
if (b)
d->repaintTimer.start( 100, true );
}
void KToolBar::slotIconChanged(int group)
{
if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar))
return;
if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
return;
emit modechange();
if (isVisible())
updateGeometry();
}
void KToolBar::slotReadConfig()
{
//kdDebug(220) << "KToolBar::slotReadConfig" << endl;
// Read appearance settings (hmm, we used to do both here,
// but a well behaved application will call applyMainWindowSettings
// anyway, right ?)
applyAppearanceSettings(KGlobal::config(), QString::null );
}
void KToolBar::slotAppearanceChanged()
{
// Read appearance settings from global file.
applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ );
// And remember to save the new look later
/*US
if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
@@ -1697,65 +1708,65 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGr
iconsize = d->IconSizeDefault;
icontext = d->IconTextDefault;
}
// revert back to the old group
} // end block for KConfigGroupSaver
bool doUpdate = false;
IconText icon_text;
if ( icontext == "IconTextRight" )
icon_text = IconTextRight;
else if ( icontext == "IconTextBottom" )
icon_text = IconTextBottom;
else if ( icontext == "TextOnly" )
icon_text = TextOnly;
else
icon_text = IconOnly;
// check if the icon/text has changed
if (icon_text != d->m_iconText) {
//kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl;
setIconText(icon_text, false);
doUpdate = true;
}
// ...and check if the icon size has changed
if (iconsize != d->m_iconSize) {
setIconSize(iconsize, false);
doUpdate = true;
}
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
// ...and if we should highlight
if ( highlight != d->m_highlight ) {
d->m_highlight = highlight;
doUpdate = true;
}
// ...and if we should move transparently
if ( mw && transparent != (!mw->opaqueMoving()) ) {
mw->setOpaqueMoving( !transparent );
}
if (doUpdate)
emit modechange(); // tell buttons what happened
if (isVisible ())
updateGeometry();
}
void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
{
//kdDebug(220) << "KToolBar::applySettings group=" << _configGroup << endl;
QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
/*
Let's explain this a bit more in details.
The order in which we apply settings is :
Global config / <appnamerc> user settings if no XMLGUI is used
Global config / App-XML attributes / <appnamerc> user settings if XMLGUI is used
So in the first case, we simply read everything from KConfig as below,
but in the second case we don't do anything here if there is no app-specific config,
@@ -1776,147 +1787,147 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
static const QString &attrIndex = KGlobal::staticQString("Index");
static const QString &attrOffset = KGlobal::staticQString("Offset");
static const QString &attrNewLine = KGlobal::staticQString("NewLine");
static const QString &attrHidden = KGlobal::staticQString("Hidden");
QString position = config->readEntry(attrPosition, d->PositionDefault);
int index = config->readNumEntry(attrIndex, d->IndexDefault);
int offset = config->readNumEntry(attrOffset, d->OffsetDefault);
bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault);
bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault);
*/
QString position = config->readEntry("Position", d->PositionDefault);
int index = config->readNumEntry("Index", d->IndexDefault);
int offset = config->readNumEntry("Offset", d->OffsetDefault);
bool newLine = config->readBoolEntry("NewLine", d->NewLineDefault);
bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault);
/*US Dock pos(DockTop);
if ( position == "Top" )
pos = DockTop;
else if ( position == "Bottom" )
pos = DockBottom;
else if ( position == "Left" )
pos = DockLeft;
else if ( position == "Right" )
pos = DockRight;
else if ( position == "Floating" )
pos = DockTornOff;
else if ( position == "Flat" )
pos = DockMinimized;
*/
- QMainWindow::ToolBarDock pos(QMainWindow::Top);
+ Qt::ToolBarDock pos(Qt::DockTop);
if ( position == "Top" )
- pos = QMainWindow::Top;
+ pos = Qt::Top;
else if ( position == "Bottom" )
- pos = QMainWindow::Bottom;
+ pos = Qt::Bottom;
else if ( position == "Left" )
- pos = QMainWindow::Left;
+ pos = Qt::Left;
else if ( position == "Right" )
- pos = QMainWindow::Right;
+ pos = Qt::Right;
else if ( position == "Floating" )
- pos = QMainWindow::TornOff;
+ pos = Qt::TornOff;
else if ( position == "Flat" )
- pos = QMainWindow::Minimized;
+ pos = Qt::Minimized;
//kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl;
if (hidden)
hide();
else
show();
if ( mainWindow() )
{
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
//kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl;
d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset );
// moveDockWindow calls QDockArea which does a reparent() on us with
// showIt = true, so we loose our visibility status
bool doHide = isHidden();
//US mw->moveDockWindow( this, pos, newLine, index, offset );
mw->moveToolBar( this, pos, newLine, index, offset );
//kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl;
if ( doHide )
hide();
}
if (isVisible ())
updateGeometry();
}
}
bool KToolBar::event( QEvent *e )
{
if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() )
d->repaintTimer.start( 100, true );
if (e->type() == QEvent::ChildInserted )
{
// By pass QToolBar::event,
// it will show() the inserted child and we don't want to
// do that until we have rebuild the layout.
childEvent((QChildEvent *)e);
return true;
}
- return QToolBar::event( e );
+ return Q3ToolBar::event( e );
}
void KToolBar::slotRepaint()
{
setUpdatesEnabled( FALSE );
// Send a resizeEvent to update the "toolbar extension arrow"
// (The button you get when your toolbar-items don't fit in
// the available space)
QResizeEvent ev(size(), size());
resizeEvent(&ev);
//#ifdef DESKTOP_VERSION
QApplication::sendPostedEvents( this, QEvent::LayoutHint );
//#endif //DESKTOP_VERSION
setUpdatesEnabled( TRUE );
repaint( TRUE );
}
-void KToolBar::toolBarPosChanged( QToolBar *tb )
+void KToolBar::toolBarPosChanged( Q3ToolBar *tb )
{
if ( tb != this )
return;
//US if ( d->oldPos == DockMinimized )
- if ( d->oldPos == QMainWindow::Minimized )
+ if ( d->oldPos == Qt::Minimized )
rebuildLayout();
- d->oldPos = (QMainWindow::ToolBarDock)barPos();
+ d->oldPos = (Qt::ToolBarDock)barPos();
/*US
if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
/*US
void KToolBar::loadState( const QDomElement &element )
{
//kdDebug(220) << "KToolBar::loadState " << this << endl;
if ( !mainWindow() )
return;
{
QCString text = element.namedItem( "text" ).toElement().text().utf8();
if ( text.isEmpty() )
text = element.namedItem( "Text" ).toElement().text().utf8();
if ( !text.isEmpty() )
setText( i18n( text ) );
}
{
QCString attrFullWidth = element.attribute( "fullWidth" ).lower().latin1();
if ( !attrFullWidth.isEmpty() )
setFullSize( attrFullWidth == "true" );
}
Dock dock = DockTop;
{
QCString attrPosition = element.attribute( "position" ).lower().latin1();
//kdDebug(220) << "KToolBar::loadState attrPosition=" << attrPosition << endl;
if ( !attrPosition.isEmpty() ) {
@@ -2002,65 +2013,65 @@ void KToolBar::loadState( const QDomElement &element )
show();
getAttributes( d->PositionDefault, d->IconTextDefault, d->IndexDefault );
}
*/
void KToolBar::getAttributes( QString &position, QString &icontext, int &index )
{
// get all of the stuff to save
switch ( barPos() ) {
case KToolBar::Flat:
position = "Flat";
break;
case KToolBar::Bottom:
position = "Bottom";
break;
case KToolBar::Left:
position = "Left";
break;
case KToolBar::Right:
position = "Right";
break;
case KToolBar::Floating:
position = "Floating";
break;
case KToolBar::Top:
default:
position = "Top";
break;
}
if ( mainWindow() ) {
- QMainWindow::ToolBarDock dock;
+ Qt::ToolBarDock dock;
bool newLine;
int offset;
mainWindow()->getLocation( this, dock, index, newLine, offset );
}
switch (d->m_iconText) {
case KToolBar::IconTextRight:
icontext = "IconTextRight";
break;
case KToolBar::IconTextBottom:
icontext = "IconTextBottom";
break;
case KToolBar::TextOnly:
icontext = "TextOnly";
break;
case KToolBar::IconOnly:
default:
icontext = "IconOnly";
break;
}
}
/*US
void KToolBar::saveState( QDomElement &current )
{
QString position, icontext;
int index = -1;
getAttributes( position, icontext, index );
current.setAttribute( "noMerge", "1" );
current.setAttribute( "position", position );
current.setAttribute( "iconText", icontext );
current.setAttribute( "index", index );
@@ -2071,110 +2082,110 @@ void KToolBar::saveState( QDomElement &current )
d->modified = true;
}
*/
void KToolBar::positionYourself( bool force )
{
if (force)
d->positioned = false;
if ( d->positioned || !mainWindow() )
{
//kdDebug(220) << "KToolBar::positionYourself d->positioned=true ALREADY DONE" << endl;
return;
}
// we can't test for ForceHide after moveDockWindow because QDockArea
// does a reparent() with showIt == true
bool doHide = isHidden();
//kdDebug(220) << "positionYourself " << name() << " dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " offset=" << d->toolBarInfo.offset << endl;
/*US mainWindow()->moveDockWindow( this, d->toolBarInfo.dock,
d->toolBarInfo.newline,
d->toolBarInfo.index,
d->toolBarInfo.offset );
*/
mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault );
if ( doHide )
hide();
// This method can only have an effect once - unless force is set
d->positioned = TRUE;
}
//US KPopupMenu *KToolBar::contextMenu()
-QPopupMenu *KToolBar::contextMenu()
+Q3PopupMenu *KToolBar::contextMenu()
{
if ( context )
return context;
// Construct our context popup menu. Name it qt_dockwidget_internal so it
// won't be deleted by QToolBar::clear().
//US context = new KPopupMenu( this, "qt_dockwidget_internal" );
- context = new QPopupMenu( this, "qt_dockwidget_internal" );
+ context = new Q3PopupMenu( this, "qt_dockwidget_internal" );
//US context->insertTitle(i18n("Toolbar Menu"));
//US KPopupMenu *orient = new KPopupMenu( context, "orient" );
- QPopupMenu *orient = new QPopupMenu( context, "orient" );
+ Q3PopupMenu *orient = new Q3PopupMenu( context, "orient" );
orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP );
orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT );
orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT );
orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM );
orient->insertSeparator(-1);
//orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT );
orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT );
//US KPopupMenu *mode = new KPopupMenu( context, "mode" );
- QPopupMenu *mode = new QPopupMenu( context, "mode" );
+ Q3PopupMenu *mode = new Q3PopupMenu( context, "mode" );
mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS );
mode->insertItem( i18n("Text Only"), CONTEXT_TEXT );
mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT );
mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER );
//US KPopupMenu *size = new KPopupMenu( context, "size" );
- QPopupMenu *size = new QPopupMenu( context, "size" );
+ Q3PopupMenu *size = new Q3PopupMenu( context, "size" );
size->insertItem( i18n("Default"), CONTEXT_ICONSIZES );
// Query the current theme for available sizes
- QValueList<int> avSizes;
+ Q3ValueList<int> avSizes;
/*US
KIconTheme *theme = KGlobal::instance()->iconLoader()->theme();
if (!::qstrcmp(QObject::name(), "mainToolBar"))
avSizes = theme->querySizes( KIcon::MainToolbar);
else
avSizes = theme->querySizes( KIcon::Toolbar);
*/
avSizes << 16;
avSizes << 32;
d->iconSizes = avSizes;
- QValueList<int>::Iterator it;
+ Q3ValueList<int>::Iterator it;
for (it=avSizes.begin(); it!=avSizes.end(); it++) {
QString text;
if ( *it < 19 )
text = i18n("Small (%1x%2)").arg(*it).arg(*it);
else if (*it < 25)
text = i18n("Medium (%1x%2)").arg(*it).arg(*it);
else
text = i18n("Large (%1x%2)").arg(*it).arg(*it);
//we use the size as an id, with an offset
size->insertItem( text, CONTEXT_ICONSIZES + *it );
}
context->insertItem( i18n("Orientation"), orient );
orient->setItemChecked(CONTEXT_TOP, true);
context->insertItem( i18n("Text Position"), mode );
context->setItemChecked(CONTEXT_ICONS, true);
context->insertItem( i18n("Icon Size"), size );
/*US
if (mainWindow()->inherits("KMainWindow"))
{
if ( (static_cast<KMainWindow*>(mainWindow())->toolBarMenuAction()) &&
(static_cast<KMainWindow*>(mainWindow())->hasMenuBar()) )
(static_cast<KMainWindow*>(mainWindow()))->toolBarMenuAction()->plug(context);
}
*/
connect( context, SIGNAL( aboutToShow() ), this, SLOT( slotContextAboutToShow() ) );
return context;
}
@@ -2189,66 +2200,66 @@ void KToolBar::slotContextAboutToShow()
xmlGuiClient = (KXMLGUIClient *)mainWindow();
if ( xmlGuiClient )
{
KAction *configureAction = xmlGuiClient->actionCollection()->action(KStdAction::stdName(KStdAction::ConfigureToolbars));
if ( configureAction )
{
configureAction->plug(context);
d->m_configurePlugged = true;
}
}
}
for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i)
context->setItemChecked(i, false);
switch( d->m_iconText )
{
case IconOnly:
default:
context->setItemChecked(CONTEXT_ICONS, true);
break;
case IconTextRight:
context->setItemChecked(CONTEXT_TEXTRIGHT, true);
break;
case TextOnly:
context->setItemChecked(CONTEXT_TEXT, true);
break;
case IconTextBottom:
context->setItemChecked(CONTEXT_TEXTUNDER, true);
break;
}
- QValueList<int>::ConstIterator iIt = d->iconSizes.begin();
- QValueList<int>::ConstIterator iEnd = d->iconSizes.end();
+ Q3ValueList<int>::ConstIterator iIt = d->iconSizes.begin();
+ Q3ValueList<int>::ConstIterator iEnd = d->iconSizes.end();
for (; iIt != iEnd; ++iIt )
context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false );
context->setItemChecked( CONTEXT_ICONSIZES, false );
context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true );
for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i )
context->setItemChecked( i, false );
switch ( barPos() )
{
case KToolBar::Flat:
context->setItemChecked( CONTEXT_FLAT, true );
break;
case KToolBar::Bottom:
context->setItemChecked( CONTEXT_BOTTOM, true );
break;
case KToolBar::Left:
context->setItemChecked( CONTEXT_LEFT, true );
break;
case KToolBar::Right:
context->setItemChecked( CONTEXT_RIGHT, true );
break;
case KToolBar::Floating:
context->setItemChecked( CONTEXT_FLOAT, true );
break;
case KToolBar::Top:
context->setItemChecked( CONTEXT_TOP, true );
break;
default: break;
}
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 3319fa8..4e00abd 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -1,228 +1,236 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997, 1998 Stephan Kulow (coolo@kde.org)
(C) 1997, 1998 Sven Radej (radej@kde.org)
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 1999, 2000 Kurt Granroth (granroth@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KTOOLBAR_H
#define KTOOLBAR_H
#ifndef DESKTOP_VERSION
#define private public
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#undef private
#include <qpe/qpetoolbar.h>
#else
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#endif
-#include <qmainwindow.h>
+#include <q3mainwindow.h>
#include <qcombobox.h>
#include <qmap.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QResizeEvent>
+#include <Q3PopupMenu>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QShowEvent>
#include <kglobal.h>
-#include <qguardedptr.h>
-#include <qframe.h>
-#include <qiconset.h>
+#include <qpointer.h>
+#include <q3frame.h>
+#include <qicon.h>
class QDomElement;
class QSize;
class QPixmap;
-class QPopupMenu;
+class Q3PopupMenu;
class QStringList;
class QDomDocument;
class QTimer;
class KLineEdit;
class KToolBar;
class KToolBarButton;
class KToolBoxManager;
//US class KAnimWidget;
//US class KPopupMenu;
//US class KInstance;
class KComboBox;
class KXMLGUIClient;
class KToolBarPrivate;
-class KToolBarSeparator : public QFrame
+class KToolBarSeparator : public Q3Frame
{
Q_OBJECT
public:
- KToolBarSeparator( Orientation, bool l, QToolBar *parent, const char* name=0 );
+ KToolBarSeparator( Qt::Orientation, bool l, Q3ToolBar *parent, const char* name=0 );
QSize sizeHint() const;
- Orientation orientation() const { return orient; }
+ Qt::Orientation orientation() const { return orient; }
QSizePolicy sizePolicy() const;
bool showLine() const { return line; }
public slots:
- void setOrientation( Orientation );
+ void setOrientation( Qt::Orientation );
protected:
void styleChange( QStyle& );
private:
- Orientation orient;
+ Qt::Orientation orient;
bool line;
};
/**
* A KDE-style toolbar.
*
* KToolBar can be dragged around in and between different docks.
*
* A KToolBar can contain all sorts of widgets.
*
* KToolBar can be used as a standalone widget, but @ref KMainWindow
* provides easy factories and management of one or more toolbars.
* Once you have a KToolBar object, you can insert items into it with the
* insert... methods, or remove them with the @ref removeItem() method. This
* can be done at any time; the toolbar will be automatically updated.
* There are also many methods to set per-child properties like alignment
* and toggle behaviour.
*
* KToolBar uses a global config group to load toolbar settings on
* construction. It will reread this config group on a
* @ref KApplication::appearanceChanged() signal.
*
* @short Floatable toolbar with auto resize.
* @version $Id$
* @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>.
*/
// strange things are happening ... so I have to use strange define methods ...
// porting KToolBar back to Qt2 really needs some strange hacks
#ifndef DESKTOP_VERSION
-#define QToolBar QPEToolBar
+#define Q3ToolBar QPEToolBar
#endif
- class KToolBar : public QToolBar
+ class KToolBar : public Q3ToolBar
{
Q_OBJECT
Q_ENUMS( IconText BarPosition )
Q_PROPERTY( IconText iconText READ iconText WRITE setIconText )
Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos )
Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize )
Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize )
Q_PROPERTY( QString text READ text WRITE setText )
#ifndef DESKTOP_VERSION
-#undef QToolBar
+#undef Q3ToolBar
#endif
public:
enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom};
/**
* The state of the status bar.
* @deprecated
**/
enum BarStatus{Toggle, Show, Hide};
/**
* Possible bar positions.
**/
enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat};
/**
* Constructor.
* This constructor is used by the XML-GUI. If you use it, you need
* to call QMainWindow::addToolBar to specify the position of the toolbar.
* So it's simpler to use the other constructor.
*
* The toolbar will read in various global config settings for
* things like icon size and text position, etc. However, some of
* the settings will be honored only if @ref #_honor_mode is set to
* true. All other toolbars will be IconOnly and use Medium icons.
*
* @param parent The standard toolbar parent (usually a
* @ref KMainWindow)
* @param name The standard internal name
* @param honor_style If true, then global settings for IconSize and IconText will be honored
* @param readConfig whether to apply the configuration (global and application-specific)
*/
KToolBar( QWidget *parent, const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
/**
* Constructor for non-XML-GUI applications.
*
* The toolbar will read in various global config settings for
* things like icon size and text position, etc. However, some of
* the settings will be honored only if @ref #_honor_mode is set to
* true. All other toolbars will be IconOnly and use Medium icons.
*
* @param parentWindow The window that should be the parent of this toolbar
* @param dock The position of the toolbar. Usually QMainWindow::Top.
* @param newLine If true, start a new line in the dock for this toolbar.
* @param name The standard internal name
* @param honor_style If true, then global settings for IconSize and IconText will be honored
* @param readConfig whether to apply the configuration (global and application-specific)
*/
- KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false,
+ KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false,
const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
/**
* Constructor for non-XML-GUI applications.
*
* The toolbar will read in various global config settings for
* things like icon size and text position, etc. However, some of
* the settings will be honored only if @ref #_honor_mode is set to
* true. All other toolbars will be IconOnly and use Medium icons.
*
* @param parentWindow The window that should be the parent of this toolbar
* @param dock Another widget than the mainwindow to dock toolbar to.
* @param newLine If true, start a new line in the dock for this toolbar.
* @param name The standard internal name
* @param honor_style If true, then global settings for IconSize and IconText will be honored
* @param readConfig whether to apply the configuration (global and application-specific)
*/
- KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine = false,
+ KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine = false,
const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
virtual ~KToolBar();
/**
* Insert a button (a @ref KToolBarButton) with a pixmap. The
* pixmap is loaded by the button itself based on the global icon
* settings.
*
* You should connect to one or more signals in KToolBar:
* @ref clicked() , @ref pressed() , @ref released() , or
* @ref highlighted() and if the button is a toggle button
* (@ref setToggle() ) @ref toggled() . Those signals have @p id
* of a button that caused the signal. If you want to bind a popup
* to button, see @ref setButton().
*
* @param icon The name of the icon to use as the active pixmap
* @param id The id of this button
* @param enabled Enable or disable the button at startup
* @param text The tooltip or toolbar text (depending on state)
* @param index The position of the button. (-1 = at end).
*
* @return The item index.
*/
int insertButton(const QString& icon, int id, bool enabled = true,
const QString& text = QString::null, int index=-1/*US ,
KInstance *_instance = KGlobal::instance()*/);
/**
* This is the same as above, but with specified signals and
* slots to which this button will be connected.
*
@@ -274,137 +282,137 @@ public:
* This is the same as above, but with specified signals and
* slots to which this button will be connected.
*
* You can add more signals with @ref addConnection().
*
* @param icon The name of the icon to use as the active pixmap
* @param id The id of this button
* @param signal The signal to connect to
* @param receiver The slot's parent
* @param enabled Enable or disable the button at startup
* @param text The tooltip or toolbar text (depending on state)
* @param index The position of the button. (-1 = at end).
*
* @return The item index.
*/
int insertButton(const QPixmap& pixmap, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled = true, const QString& text = QString::null,
int index=-1 );
/**
* Inserts a button with popupmenu.
*
* Button will have small
* triangle. You have to connect to popup's signals. The
* signals @ref KButton::pressed(), @ref KButton::released(),
* @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not
* emmited by
* this button (see @ref setDelayedPopup() for that).
* You can add custom popups which inherit @ref QPopupMenu to get popups
* with tables, drawings etc. Just don't fiddle with events there.
*/
- int insertButton(const QString& icon, int id, QPopupMenu *popup,
+ int insertButton(const QString& icon, int id, Q3PopupMenu *popup,
bool enabled, const QString&_text, int index=-1);
/**
* Inserts a button with popupmenu.
*
* Button will have small
* triangle. You have to connect to popup's signals. The
* signals @ref KButton::pressed(), @ref KButton::released(),
* @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not
* emmited by
* this button (see @ref setDelayedPopup() for that).
* You can add custom popups which inherit @ref QPopupMenu to get popups
* with tables, drawings etc. Just don't fiddle with events there.
*/
- int insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
+ int insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup,
bool enabled, const QString&_text, int index=-1);
/**
* Inserts a @ref KLineEdit. You have to specify signals and slots to
* which KLineEdit will be connected. KLineEdit has all slots QLineEdit
* has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation
* KLineEdit can be set to autoresize itself to full free width
* in toolbar, that is to last right aligned item. For that,
* toolbar must be set to full width (which it is by default).
* @see setFullWidth()
* @see setItemAutoSized()
* @see KLineEdit
* @return Item index.
*/
int insertLined (const QString& text, int id,
const char *signal,
const QObject *receiver, const char *slot,
bool enabled = true,
const QString& toolTipText = QString::null,
int size = 70, int index =-1);
/**
* Inserts a @ref KComboBox with list.
*
* Can be writable, but cannot contain
* pixmaps. By default inserting policy is AtBottom, i.e. typed items
* are placed at the bottom of the list. Can be autosized. If the size
* argument is specified as -1, the width of the combobox is automatically
* computed.
*
* @see setFullWidth()
* @see setItemAutoSized()
* @see KComboBox
* @return Item index.
*/
int insertCombo (const QStringList &list, int id, bool writable,
const char *signal, const QObject *receiver,
const char *slot, bool enabled=true,
const QString& tooltiptext=QString::null,
int size=70, int index=-1,
- QComboBox::Policy policy = QComboBox::AtBottom);
+ QComboBox::Policy policy = QComboBox::InsertAtBottom);
/**
* Insert a @ref KComboBox with text.
*
* The rest is the same as above.
* @see setItemAutoSized()
*
* @see KComboBox
* @return Item index.
*/
int insertCombo (const QString& text, int id, bool writable,
const char *signal, QObject *recevier,
const char *slot, bool enabled=true,
const QString& tooltiptext=QString::null,
int size=70, int index=-1,
- QComboBox::Policy policy = QComboBox::AtBottom);
+ QComboBox::Policy policy = QComboBox::InsertAtBottom);
/**
* Inserts a separator into the toolbar with the given id.
* Returns the separator's index
*/
int insertSeparator( int index = -1, int id = -1 );
/**
* Inserts a line separator into the toolbar with the given id.
* Returns the separator's index
*/
int insertLineSeparator( int index = -1, int id = -1 );
/**
* Inserts a user-defined widget. The widget @p must have this
* toolbar as its parent.
*
* Widget must have a QWidget for base class. Widget can be
* autosized to full width. If you forget about it, you can get a
* pointer to this widget with @ref getWidget().
* @see setItemAutoSized()
* @return Item index.
*/
int insertWidget(int id, int width, QWidget *_widget, int index=-1);
/**
* Inserts an animated widget. A @ref KAnimWidget will be created
* internally using the icon name you provide.
* This will emit a signal (clicked()) whenever the
* animation widget is clicked.
*
* @see animatedWidget()
@@ -436,91 +444,91 @@ public:
/**
* Adds connections to items.
*
* It is important that you
* know the @p id of particular item. Nothing happens if you forget @p id.
*/
void addConnection (int id, const char *signal,
const QObject *receiver, const char *slot);
/**
* Enables/disables item.
*/
void setItemEnabled( int id, bool enabled );
/**
* Sets the icon for a button.
*
* Can be used while button is visible.
*/
void setButtonIcon( int id, const QString& _icon );
/**
* Sets button pixmap.
*
* Can be used while button is visible.
*/
void setButtonPixmap( int id, const QPixmap& _pixmap );
/**
* Sets a button icon from a QIconSet.
*
* Can be used while button is visible.
*/
- void setButtonIconSet( int id, const QIconSet& iconset );
+ void setButtonIconSet( int id, const QIcon& iconset );
/**
* Sets a delayed popup for a button.
*
* Delayed popup is what you see in
* Netscape Navigator's Previous and Next buttons: If you click them you
* go back
* or forth. If you press them long enough, you get a history-menu.
* This is exactly what we do here.
*
* You will insert normal a button with connection (or use signals from
* toolbar):
* <pre>
* bar->insertButton(icon, id, SIGNAL(clicked ()), this,
* SLOT (slotClick()), true, "click or wait for popup");
* </pre> And then add a delayed popup:
* <pre>
* bar->setDelayedPopup (id, historyPopup); </pre>
*
* Don't add delayed popups to buttons which have normal popups.
*
* You may add popups which are derived from @ref QPopupMenu. You may
* add popups that are already in the menu bar or are submenus of
* other popups.
*/
- void setDelayedPopup (int id , QPopupMenu *_popup, bool toggle = false);
+ void setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle = false);
/**
* Turns a button into an autorepeat button.
*
* Toggle buttons, buttons with menus, or
* buttons with delayed menus cannot be made into autorepeat buttons.
* Moreover, you can and will receive
* only the signal clicked(), but not pressed() or released().
* When the user presses this button, you will receive the signal clicked(),
* and if the button is still pressed after some time,
* you will receive more clicked() signals separated by regular
* intervals. Since this uses @ref QButton::setAutoRepeat() ,
* I can't quantify 'some'.
*/
void setAutoRepeat (int id, bool flag=true);
/**
* Turns button into a toggle button if @p flag is true.
*/
void setToggle (int id, bool flag = true);
/**
* Toggles a togglebutton.
*
* If the button is a toggle button (see @ref setToggle())
* the button state will be toggled. This will also cause the toolbar to
* emit the signal @ref KButton::toggled() with parameter @p id. You must connect to
* this signal, or use @ref addConnection() to connect directly to the
* button signal @ref KButton::toggled().
*/
void toggleButton (int id);
@@ -1031,80 +1039,80 @@ signals:
* internal, aimed to buttons.
*/
void modechange ();
/**
* This signal is emitted when the toolbar is getting deleted,
* and before ~KToolbar finishes (so it's still time to remove
* widgets from the toolbar).
* Used by KWidgetAction.
* @since 3.2
*/
void toolbarDestroyed();
public:
/**
* @return global setting for "Highlight buttons under mouse"
*/
void repaintMe();
static bool highlightSetting();
/**
* @return global setting for "Toolbars transparent when moving"
*/
static bool transparentSetting();
/**
* @return global setting for "Icon Text"
*/
static IconText iconTextSetting();
public slots:
virtual void setIconText( const QString &txt )
- { QToolBar::setIconText( txt ); }
+ { Q3ToolBar::setIconText( txt ); }
void slotRepaint();
protected:
void mousePressEvent( QMouseEvent * );
void childEvent( QChildEvent *e );
void showEvent( QShowEvent *e );
void resizeEvent( QResizeEvent *e );
bool event( QEvent *e );
void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false);
QString settingsGroup();
private slots:
void rebuildLayout();
void slotReadConfig ();
void slotAppearanceChanged();
void slotIconChanged(int);
- void toolBarPosChanged( QToolBar *tb );
+ void toolBarPosChanged( Q3ToolBar *tb );
void slotContextAboutToShow();
void widgetDestroyed();
private:
int sizeHintW;
int sizeHintH;
void init( bool readConfig = true, bool honorStyle = false );
void doConnections( KToolBarButton *button );
void insertWidgetInternal( QWidget *w, int &index, int id );
void removeWidgetInternal( QWidget *w );
void getAttributes( QString &position, QString &icontext, int &index );
//US KPopupMenu *contextMenu();
- QPopupMenu *contextMenu();
+ Q3PopupMenu *contextMenu();
QMap<QWidget*, int > widget2id;
typedef QMap<int, QWidget* > Id2WidgetMap;
Id2WidgetMap id2widget;
//US KPopupMenu *context;
- QPopupMenu *context;
- QPtrList<QWidget> widgets;
+ Q3PopupMenu *context;
+ Q3PtrList<QWidget> widgets;
QTimer *layoutTimer;
- QGuardedPtr<QWidget> stretchableWidget, rightAligned;
+ QPointer<QWidget> stretchableWidget, rightAligned;
protected:
virtual void virtual_hook( int id, void* data );
private:
KToolBarPrivate *d;
bool inshutdownprocess;
};
#endif
diff --git a/microkde/kdeui/ktoolbarbutton.cpp b/microkde/kdeui/ktoolbarbutton.cpp
index 1d5d0e5..7b98b32 100644
--- a/microkde/kdeui/ktoolbarbutton.cpp
+++ b/microkde/kdeui/ktoolbarbutton.cpp
@@ -4,80 +4,84 @@
(C) 1997, 1998 Sven Radej (radej@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 1999 Kurt Granroth (granroth@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#include <string.h>
#include "ktoolbarbutton.h"
#include "ktoolbar.h"
#include <qstyle.h>
#include <qimage.h>
#include <qtimer.h>
#include <qdrawutil.h>
#include <qtooltip.h>
#include <qbitmap.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcursor.h>
#include <qpainter.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QEvent>
#include <kapplication.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kglobalsettings.h>
//US #include <kiconeffect.h>
#include <kiconloader.h>
// needed to get our instance
#include <kmainwindow.h>
-template class QIntDict<KToolBarButton>;
+template class Q3IntDict<KToolBarButton>;
class KToolBarButtonPrivate
{
public:
KToolBarButtonPrivate()
{
m_noStyle = false;
m_isSeparator = false;
m_isRadio = false;
m_highlight = false;
m_isRaised = false;
m_isActive = false;
m_iconName = QString::null;
m_iconText = KToolBar::IconOnly;
m_iconSize = 0;
//US m_instance = KGlobal::instance();
}
~KToolBarButtonPrivate()
{
}
int m_id;
bool m_noStyle: 1;
bool m_isSeparator: 1;
bool m_isRadio: 1;
bool m_highlight: 1;
bool m_isRaised: 1;
bool m_isActive: 1;
QString m_iconName;
@@ -86,111 +90,111 @@ public:
KToolBar::IconText m_iconText;
int m_iconSize;
QSize size;
QPoint m_mousePressPos;
//US KInstance *m_instance;
};
// This will construct a separator
KToolBarButton::KToolBarButton( QWidget *_parent, const char *_name )
: QToolButton( _parent , _name)
{
d = new KToolBarButtonPrivate;
resize(6,6);
hide();
d->m_isSeparator = true;
}
KToolBarButton::KToolBarButton( const QString& _icon, int _id,
QWidget *_parent, const char *_name,
const QString &_txt/*US, KInstance *_instance*/ )
: QToolButton( _parent, _name ), d( 0 )
{
d = new KToolBarButtonPrivate;
d->m_id = _id;
d->m_parent = (KToolBar*)_parent;
QToolButton::setTextLabel(_txt);
//US d->m_instance = _instance;
- setFocusPolicy( NoFocus );
+ setFocusPolicy( Qt::NoFocus );
// connect all of our slots and start trapping events
connect(d->m_parent, SIGNAL( modechange() ),
this, SLOT( modeChange() ));
connect(this, SIGNAL( clicked() ),
this, SLOT( slotClicked() ) );
connect(this, SIGNAL( pressed() ),
this, SLOT( slotPressed() ) );
connect(this, SIGNAL( released() ),
this, SLOT( slotReleased() ) );
installEventFilter(this);
d->m_iconName = _icon;
// do our initial setup
modeChange();
}
KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id,
QWidget *_parent, const char *name,
const QString& txt)
: QToolButton( _parent, name ), d( 0 )
{
d = new KToolBarButtonPrivate;
d->m_id = _id;
d->m_parent = (KToolBar *) _parent;
QToolButton::setTextLabel(txt);
- setFocusPolicy( NoFocus );
+ setFocusPolicy( Qt::NoFocus );
// connect all of our slots and start trapping events
connect(d->m_parent, SIGNAL( modechange()),
this, SLOT(modeChange()));
connect(this, SIGNAL( clicked() ),
this, SLOT( slotClicked() ));
connect(this, SIGNAL( pressed() ),
this, SLOT( slotPressed() ));
connect(this, SIGNAL( released() ),
this, SLOT( slotReleased() ));
installEventFilter(this);
// set our pixmap and do our initial setup
- setIconSet( QIconSet( pixmap ));
+ setIconSet( QIcon( pixmap ));
modeChange();
}
KToolBarButton::~KToolBarButton()
{
delete d; d = 0;
}
void KToolBarButton::modeChange()
{
QSize mysize;
// grab a few global variables for use in this function and others
d->m_highlight = d->m_parent->highlight();
d->m_iconText = d->m_parent->iconText();
d->m_iconSize = d->m_parent->iconSize();
if (!d->m_iconName.isNull())
setIcon(d->m_iconName);
// we'll start with the size of our pixmap
int pix_width = d->m_iconSize;
if ( d->m_iconSize == 0 ) {
if (!strcmp(d->m_parent->name(), "mainToolBar"))
/*US
pix_width = IconSize( KIcon::MainToolbar );
else
pix_width = IconSize( KIcon::Toolbar );
*/
//qDebug("KToolBarButton::modeChange make iconsize configurable");
pix_width = 16;
@@ -263,139 +267,139 @@ void KToolBarButton::setTextLabel( const QString& text, bool tipToo)
QString txt(text);
if (txt.right(3) == QString::fromLatin1("..."))
txt.truncate(txt.length() - 3);
QToolButton::setTextLabel(txt, tipToo);
update();
}
void KToolBarButton::setText( const QString& text)
{
setTextLabel(text, true);
modeChange();
}
void KToolBarButton::setIcon( const QString &icon )
{
d->m_iconName = icon;
d->m_iconSize = d->m_parent->iconSize();
// QObject::name() return "const char *" instead of QString.
if (!strcmp(d->m_parent->name(), "mainToolBar"))
/*US QToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet(
d->m_iconName, KIcon::MainToolbar, d->m_iconSize ));
*/
QToolButton::setIconSet( KGlobal::iconLoader()->loadIconSet(d->m_iconName ));
else
/*US QToolButton::setIconSet(d->m_instance->iconLoader()->loadIconSet(
d->m_iconName, KIcon::Toolbar, d->m_iconSize ));
*/
QToolButton::setIconSet(KGlobal::iconLoader()->loadIconSet(d->m_iconName));
}
-void KToolBarButton::setIconSet( const QIconSet &iconset )
+void KToolBarButton::setIconSet( const QIcon &iconset )
{
QToolButton::setIconSet( iconset );
}
// remove?
void KToolBarButton::setPixmap( const QPixmap &pixmap )
{
if( pixmap.isNull()) // called by QToolButton
{
QToolButton::setPixmap( pixmap );
return;
}
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Active );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Active );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDefaultPixmap( const QPixmap &pixmap )
{
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Normal );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Normal );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDisabledPixmap( const QPixmap &pixmap )
{
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Disabled );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Disabled );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDefaultIcon( const QString& icon )
{
- QIconSet set = iconSet();
+ QIcon set = iconSet();
QPixmap pm;
if (!strcmp(d->m_parent->name(), "mainToolBar"))
pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar,
d->m_iconSize );
else
pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar,
d->m_iconSize );
- set.setPixmap( pm, QIconSet::Automatic, QIconSet::Normal );
+ set.setPixmap( pm, QIcon::Automatic, QIcon::Normal );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDisabledIcon( const QString& icon )
{
- QIconSet set = iconSet();
+ QIcon set = iconSet();
QPixmap pm;
if (!strcmp(d->m_parent->name(), "mainToolBar"))
pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar,
d->m_iconSize );
else
pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar,
d->m_iconSize );
- set.setPixmap( pm, QIconSet::Automatic, QIconSet::Disabled );
+ set.setPixmap( pm, QIcon::Automatic, QIcon::Disabled );
QToolButton::setIconSet( set );
}
-QPopupMenu *KToolBarButton::popup()
+QMenu *KToolBarButton::popup()
{
// obsolete
// KDE4: remove me
return QToolButton::popup();
}
-void KToolBarButton::setPopup(QPopupMenu *p, bool)
+void KToolBarButton::setPopup(Q3PopupMenu *p, bool)
{
QToolButton::setPopup(p);
QToolButton::setPopupDelay(1);
}
-void KToolBarButton::setDelayedPopup (QPopupMenu *p, bool)
+void KToolBarButton::setDelayedPopup (Q3PopupMenu *p, bool)
{
QToolButton::setPopup(p);
//US QToolButton::setPopupDelay(QApplication::startDragTime());
}
void KToolBarButton::leaveEvent(QEvent *)
{
if( d->m_isRaised || d->m_isActive )
{
d->m_isRaised = false;
d->m_isActive = false;
repaint(false);
}
emit highlighted(d->m_id, false);
}
void KToolBarButton::enterEvent(QEvent *)
{
if (d->m_highlight)
{
if (isEnabled())
{
d->m_isActive = true;
if (!isToggleButton())
d->m_isRaised = true;
}
else
{
d->m_isRaised = false;
d->m_isActive = false;
}
@@ -422,231 +426,241 @@ bool KToolBarButton::eventFilter(QObject *o, QEvent *ev)
else if (ev->type() == QEvent::MouseMove)
{
QMouseEvent* mev = static_cast<QMouseEvent*>(ev);
if ((mev->pos() - d->m_mousePressPos).manhattanLength()
//US > KGlobalSettings::dndEventDelay())
> 5 )
{
//US openPopup();
return true;
}
}
}
if ((ev->type() == QEvent::MouseButtonPress ||
ev->type() == QEvent::MouseButtonRelease ||
ev->type() == QEvent::MouseButtonDblClick) && d->m_isRadio && isOn())
return true;
// From Kai-Uwe Sattler <kus@iti.CS.Uni-Magdeburg.De>
if (ev->type() == QEvent::MouseButtonDblClick)
{
emit doubleClicked(d->m_id);
return true;
}
}
return QToolButton::eventFilter(o, ev);
}
void KToolBarButton::drawButton( QPainter *_painter )
{
#ifdef DESKTOP_VERSION
- QStyle::SFlags flags = QStyle::Style_Default;
- QStyle::SCFlags active = QStyle::SC_None;
+ QStyle::State flags = QStyle::State_None;
+ QStyle::SubControls active = QStyle::SC_None;
if (isDown()) {
- flags |= QStyle::Style_Down;
+ flags |= QStyle::State_DownArrow;
active |= QStyle::SC_ToolButton;
}
- if (isEnabled()) flags |= QStyle::Style_Enabled;
- if (isOn()) flags |= QStyle::Style_On;
- if (isEnabled() && d->m_isRaised) flags |= QStyle::Style_Raised;
- if (hasFocus()) flags |= QStyle::Style_HasFocus;
+ if (isEnabled()) flags |= QStyle::State_Enabled;
+ if (isOn()) flags |= QStyle::State_On;
+ if (isEnabled() && d->m_isRaised) flags |= QStyle::State_Raised;
+ if (hasFocus()) flags |= QStyle::State_HasFocus;
+
+ QStyleOptionToolButton qsotb;
+ qsotb.initFrom(this);
+ qsotb.state = flags;
+ qsotb.activeSubControls = active;
+ qsotb.rect = rect();
+ qsotb.palette = palette();
// Draw a styled toolbutton
- style().drawComplexControl(QStyle::CC_ToolButton, _painter, this, rect(),
- colorGroup(), flags, QStyle::SC_ToolButton, active, QStyleOption());
+ style()->drawComplexControl(QStyle::CC_ToolButton, &qsotb, _painter, this);
#else
style().drawToolButton(_painter, rect().x(), rect().y(), rect().width(), rect().height(), colorGroup());
#endif
int dx, dy;
QFont tmp_font(KGlobalSettings::toolBarFont());
QFontMetrics fm(tmp_font);
QRect textRect;
int textFlags = 0;
if (d->m_iconText == KToolBar::IconOnly) // icon only
{
/*US
QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
QIconSet::Disabled,
isOn() ? QIconSet::On : QIconSet::Off );
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
if( !pixmap.isNull())
{
dx = ( width() - pixmap.width() ) / 2;
dy = ( height() - pixmap.height() ) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
_painter->drawPixmap( dx, dy, pixmap );
}
}
else if (d->m_iconText == KToolBar::IconTextRight) // icon and text (if any)
{
/*US
QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
QIconSet::Disabled,
isOn() ? QIconSet::On : QIconSet::Off );
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
if( !pixmap.isNull())
{
dx = 4;
dy = ( height() - pixmap.height() ) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
_painter->drawPixmap( dx, dy, pixmap );
}
if (!textLabel().isNull())
{
- textFlags = AlignVCenter|AlignLeft;
+ textFlags = Qt::AlignVCenter|Qt::AlignLeft;
if (!pixmap.isNull())
dx = 4 + pixmap.width() + 2;
else
dx = 4;
dy = 0;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
textRect = QRect(dx, dy, width()-dx, height());
}
}
else if (d->m_iconText == KToolBar::TextOnly)
{
if (!textLabel().isNull())
{
- textFlags = AlignVCenter|AlignLeft;
+ textFlags = Qt::AlignVCenter|Qt::AlignLeft;
dx = (width() - fm.width(textLabel())) / 2;
dy = (height() - fm.lineSpacing()) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() );
}
}
else if (d->m_iconText == KToolBar::IconTextBottom)
{
/*US
QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
QIconSet::Disabled,
isOn() ? QIconSet::On : QIconSet::Off );
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
if( !pixmap.isNull())
{
dx = (width() - pixmap.width()) / 2;
dy = (height() - fm.lineSpacing() - pixmap.height()) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
_painter->drawPixmap( dx, dy, pixmap );
}
if (!textLabel().isNull())
{
- textFlags = AlignBottom|AlignHCenter;
+ textFlags = Qt::AlignBottom|Qt::AlignHCenter;
dx = (width() - fm.width(textLabel())) / 2;
dy = height() - fm.lineSpacing() - 4;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() );
}
}
// Draw the text at the position given by textRect, and using textFlags
if (!textLabel().isNull() && !textRect.isNull())
{
_painter->setFont(KGlobalSettings::toolBarFont());
if (!isEnabled())
_painter->setPen(palette().disabled().dark());
else if(d->m_isRaised)
_painter->setPen(KGlobalSettings::toolBarHighlightColor());
else
_painter->setPen( colorGroup().buttonText() );
_painter->drawText(textRect, textFlags, textLabel());
}
if (QToolButton::popup())
{
#ifdef DESKTOP_VERSION
- QStyle::SFlags arrowFlags = QStyle::Style_Default;
+ QStyle::State arrowFlags = QStyle::State_None;
+
+ if (isDown()) arrowFlags |= QStyle::State_DownArrow;
+ if (isEnabled()) arrowFlags |= QStyle::State_Enabled;
- if (isDown()) arrowFlags |= QStyle::Style_Down;
- if (isEnabled()) arrowFlags |= QStyle::Style_Enabled;
+ QStyleOption qso;
+ qso.initFrom(this);
+ qso.state = arrowFlags;
+ qso.rect = QRect(width()-7, height()-7, 7, 7);
+ qso.palette = palette();
- style().drawPrimitive(QStyle::PE_ArrowDown, _painter,
- QRect(width()-7, height()-7, 7, 7), colorGroup(),
- arrowFlags, QStyleOption() );
+ style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &qso, _painter);
#else
style().drawArrow(_painter, Qt::DownArrow, isDown(),
width()-7, height()-7, 7, 7, colorGroup(), isEnabled() );
#endif
}
}
void KToolBarButton::paletteChange(const QPalette &)
{
if(!d->m_isSeparator)
{
modeChange();
repaint(false); // no need to delete it first therefore only false
}
}
void KToolBarButton::showMenu()
{
// obsolete
// KDE4: remove me
}
void KToolBarButton::slotDelayTimeout()
{
// obsolete
// KDE4: remove me
}
void KToolBarButton::slotClicked()
{
emit clicked( d->m_id );
diff --git a/microkde/kdeui/ktoolbarbutton.h b/microkde/kdeui/ktoolbarbutton.h
index 9aaa13c..ad02e4e 100644
--- a/microkde/kdeui/ktoolbarbutton.h
+++ b/microkde/kdeui/ktoolbarbutton.h
@@ -1,69 +1,72 @@
/* This file is part of the KDE libraries
Copyright (C) 1997, 1998 Stephan Kulow (coolo@kde.org)
(C) 1997, 1998 Sven Radej (radej@kde.org)
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 2000 Kurt Granroth (granroth@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#ifndef _KTOOLBARBUTTON_H
#define _KTOOLBARBUTTON_H
#include <qpixmap.h>
#include <qtoolbutton.h>
-#include <qintdict.h>
+#include <q3intdict.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <Q3PopupMenu>
#include <kglobal.h>
class KToolBar;
class KToolBarButtonPrivate;
//USclass KInstance;
class QEvent;
-class QPopupMenu;
+class Q3PopupMenu;
class QPainter;
/**
* A toolbar button. This is used internally by @ref KToolBar, use the
* KToolBar methods instead.
* @internal
*/
class KToolBarButton : public QToolButton
{
Q_OBJECT
public:
/**
* Construct a button with an icon loaded by the button itself.
* This will trust the button to load the correct icon with the
* correct size.
*
* @param icon Name of icon to load (may be absolute or relative)
* @param id Id of this button
* @param parent This button's parent
* @param name This button's internal name
* @param txt This button's text (in a tooltip or otherwise)
*/
KToolBarButton(const QString& icon, int id, QWidget *parent,
const char *name=0L, const QString &txt=QString::null/*US,
KInstance *_instance = KGlobal::instance()*/);
/**
* Construct a button with an existing pixmap. It is not
* recommended that you use this as the internal icon loading code
* will almost always get it "right".
*
@@ -121,150 +124,150 @@ public:
*
* @param pixmap The pixmap to use when disabled
*/
void setDisabledPixmap(const QPixmap& pixmap);
#endif
/**
* Set the text for this button. The text will be either used as a
* tooltip (IconOnly) or will be along side the icon
*
* @param text The button (or tooltip) text
*/
virtual void setText(const QString &text);
/**
* Set the icon for this button. The icon will be loaded internally
* with the correct size. This function is preferred over @ref setIconSet
*
* @param icon The name of the icon
*/
virtual void setIcon(const QString &icon);
/// @since 3.1
virtual void setIcon( const QPixmap &pixmap )
{ QToolButton::setIcon( pixmap ); }
/**
* Set the pixmaps for this toolbar button from a QIconSet.
* If you call this you don't need to call any of the other methods
* that set icons or pixmaps.
* @param iconset The iconset to use
*/
- virtual void setIconSet( const QIconSet &iconset );
+ virtual void setIconSet( const QIcon &iconset );
#ifndef KDE_NO_COMPAT
/**
* @deprecated
* Set the active icon for this button. The pixmap itself is loaded
* internally based on the icon size... .. the disabled and default
* pixmaps, however will only be constructed if @ref #generate is
* true. This function is preferred over @ref setPixmap
*
* @param icon The name of the active icon
* @param generate If true, then the other icons are automagically
* generated from this one
*/
void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); }
/**
* @deprecated
* Force the button to use this icon as the default one rather
* then generating it using effects.
*
* @param icon The icon to use as the default (normal) one
*/
void setDefaultIcon(const QString& icon);
/**
* @deprecated
* Force the button to use this icon when disabled one rather then
* generating it using effects.
*
* @param icon The icon to use when disabled
*/
void setDisabledIcon(const QString& icon);
#endif
/**
* Turn this button on or off
*
* @param flag true or false
*/
void on(bool flag = true);
/**
* Toggle this button
*/
void toggle();
/**
* Turn this button into a toggle button or disable the toggle
* aspects of it. This does not toggle the button itself.
* Use @ref toggle() for that.
*
* @param toggle true or false
*/
void setToggle(bool toggle = true);
/**
* Return a pointer to this button's popup menu (if it exists)
*/
- QPopupMenu *popup();
+ QMenu *popup();
/**
* Returns the button's id.
* @since 3.2
*/
int id() const;
/**
* Give this button a popup menu. There will not be a delay when
* you press the button. Use @ref setDelayedPopup if you want that
* behavior.
*
* @param p The new popup menu
*/
- void setPopup (QPopupMenu *p, bool unused = false);
+ void setPopup (Q3PopupMenu *p, bool unused = false);
/**
* Gives this button a delayed popup menu.
*
* This function allows you to add a delayed popup menu to the button.
* The popup menu is then only displayed when the button is pressed and
* held down for about half a second.
*
* @param p the new popup menu
*/
- void setDelayedPopup(QPopupMenu *p, bool unused = false);
+ void setDelayedPopup(Q3PopupMenu *p, bool unused = false);
/**
* Turn this button into a radio button
*
* @param f true or false
*/
void setRadio(bool f = true);
/**
* Toolbar buttons naturally will assume the global styles
* concerning icons, icons sizes, etc. You can use this function to
* explicitely turn this off, if you like.
*
* @param no_style Will disable styles if true
*/
void setNoStyle(bool no_style = true);
signals:
void clicked(int);
void doubleClicked(int);
void pressed(int);
void released(int);
void toggled(int);
void highlighted(int, bool);
public slots:
/**
* This slot should be called whenever the toolbar mode has
* potentially changed. This includes such events as text changing,
* orientation changing, etc.
*/
void modeChange();
@@ -274,40 +277,40 @@ protected:
void paletteChange(const QPalette &);
void leaveEvent(QEvent *e);
void enterEvent(QEvent *e);
void drawButton(QPainter *p);
bool eventFilter (QObject *o, QEvent *e);
void showMenu();
/// @since 3.1
bool isRaised() const;
/// @since 3.1
bool isActive() const;
/// @since 3.1
int iconTextMode() const;
protected slots:
void slotClicked();
void slotPressed();
void slotReleased();
void slotToggled();
void slotDelayTimeout();
protected:
virtual void virtual_hook( int id, void* data );
private:
KToolBarButtonPrivate *d;
};
/**
* List of @ref KToolBarButton objects.
* @internal
* @version $Id$
*/
-class KToolBarButtonList : public QIntDict<KToolBarButton>
+class KToolBarButtonList : public Q3IntDict<KToolBarButton>
{
public:
KToolBarButtonList();
~KToolBarButtonList() {}
};
#endif
diff --git a/microkde/kdeui/ktoolbarhandler.cpp b/microkde/kdeui/ktoolbarhandler.cpp
index 7b97233..4d3ace7 100644
--- a/microkde/kdeui/ktoolbarhandler.cpp
+++ b/microkde/kdeui/ktoolbarhandler.cpp
@@ -1,151 +1,153 @@
/* This file is part of the KDE libraries
Copyright (C) 2002 Simon Hausmann <hausmann@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ktoolbarhandler.h"
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <kapplication.h>
#include <ktoolbar.h>
#include <kmainwindow.h>
#include <klocale.h>
#include <kaction.h>
#include <assert.h>
namespace
{
const char *actionListName = "show_menu_and_toolbar_actionlist";
const char *guiDescription = ""
"<!DOCTYPE kpartgui><kpartgui name=\"StandardToolBarMenuHandler\">"
"<MenuBar>"
" <Menu name=\"settings\">"
" <ActionList name=\"%1\" />"
" </Menu>"
"</MenuBar>"
"</kpartgui>";
const char *resourceFileName = "barhandler.rc";
class BarActionBuilder
{
public:
- BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, QPtrList<KToolBar> &oldToolBarList )
+ BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, Q3PtrList<KToolBar> &oldToolBarList )
: m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false )
{
/*US
QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows();
QPtrListIterator<QDockWindow> dockWindowIt( dockWindows );
for ( ; dockWindowIt.current(); ++dockWindowIt ) {
//US KToolBar *toolBar = dynamic_cast<KToolBar *>( dockWindowIt.current() );
KToolBar *toolBar = (KToolBar *)( dockWindowIt.current() );
if ( !toolBar )
continue;
if ( oldToolBarList.findRef( toolBar ) == -1 )
m_needsRebuild = true;
m_toolBars.append( toolBar );
}
*/
if ( !m_needsRebuild )
m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() );
}
bool needsRebuild() const { return m_needsRebuild; }
- QPtrList<KAction> create()
+ Q3PtrList<KAction> create()
{
if ( !m_needsRebuild )
- return QPtrList<KAction>();
+ return Q3PtrList<KAction>();
- QPtrListIterator<KToolBar> toolBarIt( m_toolBars );
+ Q3PtrListIterator<KToolBar> toolBarIt( m_toolBars );
for ( ; toolBarIt.current(); ++toolBarIt )
handleToolBar( toolBarIt.current() );
- QPtrList<KAction> actions;
+ Q3PtrList<KAction> actions;
if ( m_toolBarActions.count() == 0 )
return actions;
if ( m_toolBarActions.count() == 1 ) {
m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) );
return m_toolBarActions;
}
KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" );
- QPtrListIterator<KAction> actionIt( m_toolBarActions );
+ Q3PtrListIterator<KAction> actionIt( m_toolBarActions );
for ( ; actionIt.current(); ++actionIt )
menuAction->insert( actionIt.current() );
actions.append( menuAction );
return actions;
}
- const QPtrList<KToolBar> &toolBars() const { return m_toolBars; }
+ const Q3PtrList<KToolBar> &toolBars() const { return m_toolBars; }
private:
void handleToolBar( KToolBar *toolBar )
{
KAction *action = new KToggleToolBarAction( toolBar,
i18n( "Show %1" ).arg( toolBar->label() ),
m_actionCollection,
toolBar->name() );
m_toolBarActions.append( action );
}
KActionCollection *m_actionCollection;
KMainWindow *m_mainWindow;
- QPtrList<KToolBar> m_toolBars;
- QPtrList<KAction> m_toolBarActions;
+ Q3PtrList<KToolBar> m_toolBars;
+ Q3PtrList<KAction> m_toolBarActions;
bool m_needsRebuild : 1;
};
}
using namespace KDEPrivate;
ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, const char *name )
: QObject( mainWindow, name ), KXMLGUIClient( mainWindow )
{
init( mainWindow );
}
ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name )
: QObject( parent, name ), KXMLGUIClient( mainWindow )
{
init( mainWindow );
}
ToolBarHandler::~ToolBarHandler()
{
m_actions.setAutoDelete( true );
m_actions.clear();
}
KAction *ToolBarHandler::toolBarMenuAction()
{
assert( m_actions.count() == 1 );
return m_actions.getFirst();
}
void ToolBarHandler::setupActions()
@@ -195,59 +197,59 @@ void ToolBarHandler::clientAdded( KXMLGUIClient *client )
if ( client == this )
setupActions();
}
*/
void ToolBarHandler::init( KMainWindow *mainWindow )
{
d = 0;
m_mainWindow = mainWindow;
/*US
connect( m_mainWindow->guiFactory(), SIGNAL( clientAdded( KXMLGUIClient * ) ),
this, SLOT( clientAdded( KXMLGUIClient * ) ) );
*/
/* re-use an existing resource file if it exists. can happen if the user launches the
* toolbar editor */
/*
setXMLFile( resourceFileName );
*/
/*US
if ( domDocument().documentElement().isNull() ) {
QString completeDescription = QString::fromLatin1( guiDescription )
.arg( actionListName );
setXML( completeDescription, false*/ /*merge*/ /*);
}
*/
}
void ToolBarHandler::connectToActionContainers()
{
- QPtrListIterator<KAction> actionIt( m_actions );
+ Q3PtrListIterator<KAction> actionIt( m_actions );
for ( ; actionIt.current(); ++actionIt )
connectToActionContainer( actionIt.current() );
}
void ToolBarHandler::connectToActionContainer( KAction *action )
{
uint containerCount = action->containerCount();
for ( uint i = 0; i < containerCount; ++i )
connectToActionContainer( action->container( i ) );
}
void ToolBarHandler::connectToActionContainer( QWidget *container )
{
//US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container );
- QPopupMenu *popupMenu = (QPopupMenu *)( container );
+ Q3PopupMenu *popupMenu = (Q3PopupMenu *)( container );
if ( !popupMenu )
return;
connect( popupMenu, SIGNAL( aboutToShow() ),
this, SLOT( setupActions() ) );
}
//US #include "ktoolbarhandler.moc"
/* vim: et sw=4 ts=4
*/
diff --git a/microkde/kdeui/ktoolbarhandler.h b/microkde/kdeui/ktoolbarhandler.h
index a1340ae..35f0d18 100644
--- a/microkde/kdeui/ktoolbarhandler.h
+++ b/microkde/kdeui/ktoolbarhandler.h
@@ -1,70 +1,70 @@
/* This file is part of the KDE libraries
Copyright (C) 2002 Simon Hausmann <hausmann@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KBARHANDLER_H
#define KBARHANDLER_H
#include <qobject.h>
-#include <qguardedptr.h>
-#include <qptrlist.h>
+#include <qpointer.h>
+#include <q3ptrlist.h>
#include <kxmlguiclient.h>
#include <kaction.h>
class KMainWindow;
class KToolBar;
namespace KDEPrivate
{
/// @since 3.1
class ToolBarHandler : public QObject, public KXMLGUIClient
{
Q_OBJECT
public:
ToolBarHandler( KMainWindow *mainWindow, const char *name = 0 );
ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name = 0 );
virtual ~ToolBarHandler();
KAction *toolBarMenuAction();
public slots:
void setupActions();
private slots:
//US void clientAdded( KXMLGUIClient *client );
private:
void init( KMainWindow *mainWindow );
void connectToActionContainers();
void connectToActionContainer( KAction *action );
void connectToActionContainer( QWidget *container );
struct Data;
Data *d;
- QGuardedPtr<KMainWindow> m_mainWindow;
- QPtrList<KAction> m_actions;
- QPtrList<KToolBar> m_toolBars;
+ QPointer<KMainWindow> m_mainWindow;
+ Q3PtrList<KAction> m_actions;
+ Q3PtrList<KToolBar> m_toolBars;
};
} // namespace KDEPrivate
#endif // KBARHANDLER_H
/* vim: et sw=4 ts=4
*/
diff --git a/microkde/kdeui/kxmlguiclient.cpp b/microkde/kdeui/kxmlguiclient.cpp
index 073e30b..8740bde 100644
--- a/microkde/kdeui/kxmlguiclient.cpp
+++ b/microkde/kdeui/kxmlguiclient.cpp
@@ -10,125 +10,127 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kxmlguiclient.h"
/*US
#include "kxmlguifactory.h"
#include "kxmlguibuilder.h"
*/
/*US
#include <qdir.h>
#include <qfile.h>
#include <qdom.h>
#include <qtextstream.h>
#include <qregexp.h>
*/
//US #include <kinstance.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <kaction.h>
#include <kapplication.h>
#include <assert.h>
+//Added by qt3to4:
+#include <Q3PtrList>
class KXMLGUIClientPrivate
{
public:
KXMLGUIClientPrivate()
{
//US m_instance = KGlobal::instance();
//US m_factory = 0L;
m_parent = 0L;
//US m_builder = 0L;
m_actionCollection = 0;
}
~KXMLGUIClientPrivate()
{
}
//US KInstance *m_instance;
//US QDomDocument m_doc;
KActionCollection *m_actionCollection;
//US QDomDocument m_buildDocument;
//US KXMLGUIFactory *m_factory;
KXMLGUIClient *m_parent;
//QPtrList<KXMLGUIClient> m_supers;
- QPtrList<KXMLGUIClient> m_children;
+ Q3PtrList<KXMLGUIClient> m_children;
//US KXMLGUIBuilder *m_builder;
//US QString m_xmlFile;
//US QString m_localXMLFile;
};
KXMLGUIClient::KXMLGUIClient()
{
d = new KXMLGUIClientPrivate;
}
KXMLGUIClient::KXMLGUIClient( KXMLGUIClient *parent )
{
d = new KXMLGUIClientPrivate;
parent->insertChildClient( this );
}
KXMLGUIClient::~KXMLGUIClient()
{
if ( d->m_parent )
d->m_parent->removeChildClient( this );
- QPtrListIterator<KXMLGUIClient> it( d->m_children );
+ Q3PtrListIterator<KXMLGUIClient> it( d->m_children );
for ( ; it.current(); ++it ) {
assert( it.current()->d->m_parent == this );
it.current()->d->m_parent = 0;
}
delete d->m_actionCollection;
delete d;
}
KAction *KXMLGUIClient::action( const char *name ) const
{
KAction* act = actionCollection()->action( name );
if ( !act ) {
- QPtrListIterator<KXMLGUIClient> childIt( d->m_children );
+ Q3PtrListIterator<KXMLGUIClient> childIt( d->m_children );
for (; childIt.current(); ++childIt ) {
act = childIt.current()->actionCollection()->action( name );
if ( act )
break;
}
}
return act;
}
KActionCollection *KXMLGUIClient::actionCollection() const
{
if ( !d->m_actionCollection )
d->m_actionCollection = new KActionCollection( 0, 0,
"KXMLGUILClient-KActionCollection" );
return d->m_actionCollection;
}
/*US
KAction *KXMLGUIClient::action( const QDomElement &element ) const
{
static const QString &attrName = KGlobal::staticQString( "name" );
return actionCollection()->action( element.attribute( attrName ).latin1() );
}
KInstance *KXMLGUIClient::instance() const
{
return d->m_instance;
}
QDomDocument KXMLGUIClient::domDocument() const
{
return d->m_doc;
@@ -559,83 +561,83 @@ KXMLGUIFactory *KXMLGUIClient::factory() const
{
return d->m_factory;
}
*/
KXMLGUIClient *KXMLGUIClient::parentClient() const
{
return d->m_parent;
}
void KXMLGUIClient::insertChildClient( KXMLGUIClient *child )
{
if ( child->d->m_parent )
child->d->m_parent->removeChildClient( child );
d->m_children.append( child );
child->d->m_parent = this;
}
void KXMLGUIClient::removeChildClient( KXMLGUIClient *child )
{
assert( d->m_children.containsRef( child ) );
d->m_children.removeRef( child );
child->d->m_parent = 0;
}
/*bool KXMLGUIClient::addSuperClient( KXMLGUIClient *super )
{
if ( d->m_supers.contains( super ) )
return false;
d->m_supers.append( super );
return true;
}*/
-const QPtrList<KXMLGUIClient> *KXMLGUIClient::childClients()
+const Q3PtrList<KXMLGUIClient> *KXMLGUIClient::childClients()
{
return &d->m_children;
}
/*US
void KXMLGUIClient::setClientBuilder( KXMLGUIBuilder *builder )
{
d->m_builder = builder;
if ( builder )
builder->setBuilderInstance( instance() );
}
KXMLGUIBuilder *KXMLGUIClient::clientBuilder() const
{
return d->m_builder;
}
*/
-void KXMLGUIClient::plugActionList( const QString &name, const QPtrList<KAction> &actionList )
+void KXMLGUIClient::plugActionList( const QString &name, const Q3PtrList<KAction> &actionList )
{
/*US
if ( !d->m_factory )
return;
d->m_factory->plugActionList( this, name, actionList );
*/
}
void KXMLGUIClient::unplugActionList( const QString &name )
{
/*US
if ( !d->m_factory )
return;
d->m_factory->unplugActionList( this, name );
*/
}
/*US
QString KXMLGUIClient::findMostRecentXMLFile( const QStringList &files, QString &doc )
{
QValueList<DocStruct> allDocuments;
QStringList::ConstIterator it = files.begin();
QStringList::ConstIterator end = files.end();
for (; it != end; ++it )
{
//kdDebug() << "KXMLGUIClient::findMostRecentXMLFile " << *it << endl;
QString data = KXMLGUIFactory::readConfigFile( *it );
DocStruct d;
diff --git a/microkde/kdeui/kxmlguiclient.h b/microkde/kdeui/kxmlguiclient.h
index cd74c8e..b9d7b09 100644
--- a/microkde/kdeui/kxmlguiclient.h
+++ b/microkde/kdeui/kxmlguiclient.h
@@ -1,56 +1,56 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
Copyright (C) 2000 Kurt Granroth <granroth@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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _KXMLGUICLIENT_H
#define _KXMLGUICLIENT_H
//US #include <qdom.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qmap.h>
#include <qstringlist.h>
class QWidget;
class KAction;
class KActionCollection;
class KInstance;
class KXMLGUIClientPrivate;
class KXMLGUIFactory;
class KXMLGUIBuilder;
/**
*
* A KXMLGUIClient can be used with @ref KXMLGUIFactory to create a
* GUI from actions and an XML document, and can be dynamically merged
* with other KXMLGUIClients.
*/
class KXMLGUIClient
{
friend class KEditToolbarWidget; // for setXMLFile(3 args)
public:
/**
* Constructs a KXMLGUIClient which can be used with a
* @ref KXMLGUIFactory to create a GUI from actions and an XML document, and
* which can be dynamically merged with other KXMLGUIClients.
*/
KXMLGUIClient();
/**
* Constructs a KXMLGUIClient which can be used with a @ref KXMLGUIFactory
* to create a GUI from actions and an XML document,
@@ -132,65 +132,65 @@ public:
*/
//US void setFactory( KXMLGUIFactory *factory );
/**
* Retrieves a pointer to the @ref KXMLGUIFactory this client is
* associated with (will return 0L if the client's GUI has not been built
* by a KXMLGUIFactory.
*/
//US KXMLGUIFactory *factory() const;
/**
* KXMLGUIClients can form a simple child/parent object tree. This
* method returns a pointer to the parent client or 0L if it has no
* parent client assigned.
*/
KXMLGUIClient *parentClient() const;
/**
* Use this method to make a client a child client of another client.
* Usually you don't need to call this method, as it is called
* automatically when using the second constructor, which takes a
* arent argument.
*/
void insertChildClient( KXMLGUIClient *child );
/**
* Removes the given @p child from the client's children list.
*/
void removeChildClient( KXMLGUIClient *child );
/**
* Retrieves a list of all child clients.
*/
- const QPtrList<KXMLGUIClient> *childClients();
+ const Q3PtrList<KXMLGUIClient> *childClients();
/**
* A client can have an own @ref KXMLGUIBuilder.
* Use this method to assign your builder instance to the client (so that the
* @ref KXMLGUIFactory can use it when building the client's GUI)
*
* Client specific guibuilders are useful if you want to create
* custom container widgets for your GUI.
*/
//US void setClientBuilder( KXMLGUIBuilder *builder );
/**
* Retrieves the client's GUI builder or 0L if no client specific
* builder has been assigned via @ref #setClientBuilder()
*/
//US KXMLGUIBuilder *clientBuilder() const;
/**
* Forces this client to re-read its XML resource file. This is
* intended to be used when you know that the resource file has
* changed and you will soon be rebuilding the GUI. It has no
* useful effect with non-KParts GUIs, so don't bother using it
* unless your app is component based.
*/
//US void reloadXML();
/**
* ActionLists are a way for XMLGUI to support dynamic lists of
* actions. E.g. if you are writing a file manager, and there is a
* menu file whose contents depend on the mimetype of the file that
* is selected, then you can achieve this using ActionLists. It
* works as follows:
@@ -199,65 +199,65 @@ public:
* \verbatim
* <kpartgui name="xxx_part" version="1">
* <MenuBar>
* <Menu name="file">
* ... <!-- some useful actions-->
* <ActionList name="xxx_file_actionlist" />
* ... <!-- even more useful actions-->
* </Menu>
* ...
* </MenuBar>
* </kpartgui>
* \endverbatim
*
* This tag will get expanded to a list of actions. In the example
* above ( a file manager with a dynamic file menu ), you would call
* \code
* QPtrList<KAction> file_actions;
* for( ... )
* if( ... )
* file_actions.append( cool_action );
* unplugActionList( "xxx_file_actionlist" );
* plugActionList( "xxx_file_actionlist", file_actions );
* \endcode
* every time a file is selected, unselected or ...
*
* \note You should not call createGUI() after calling this
* function. In fact, that would remove the newly added
* actionlists again...
* \note Forgetting to call unplugActionList() before
* plugActionList() would leave the previous actions in the
* menu too..
*/
- void plugActionList( const QString &name, const QPtrList<KAction> &actionList );
+ void plugActionList( const QString &name, const Q3PtrList<KAction> &actionList );
/**
* The complement of \ref plugActionList() ...
*/
void unplugActionList( const QString &name );
//US static QString findMostRecentXMLFile( const QStringList &files, QString &doc );
void addStateActionEnabled(const QString& state, const QString& action);
void addStateActionDisabled(const QString& state, const QString& action);
enum ReverseStateChange { StateNoReverse, StateReverse };
struct StateChange
{
QStringList actionsToEnable;
QStringList actionsToDisable;
};
StateChange getActionsToChangeForState(const QString& state);
/// @since 3.1
//US void beginXMLPlug( QWidget * );
/// @since 3.1
//US void endXMLPlug();
/// @since 3.1
//US void prepareXMLUnplug( QWidget * );
protected:
/**
* Returns true if client was added to super client list.
* Returns false if client was already in list.
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp
index 8398956..57e7ea6 100644
--- a/microkde/kdialog.cpp
+++ b/microkde/kdialog.cpp
@@ -1,67 +1,69 @@
#include <kdialog.h>
-#include <qapp.h>
+#include <qapplication.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <klocale.h>
KDialog::KDialog( QWidget *parent, const char *name, bool modal ) :
QDialog( parent, name, modal )
{
;
}
#ifdef DESKTOP_VERSION
int KDialog::spacingHint() { return 7; }
int KDialog::marginHint() { return 7; }
int KDialog::spacingHintSmall() { return 4; }
int KDialog::marginHintSmall() { return 4; }
#else
int KDialog::spacingHint() { return 3; }
int KDialog::marginHint() { return 3; }
int KDialog::spacingHintSmall() { return 1; }
int KDialog::marginHintSmall() { return 1; }
#endif
KProgressDialog::KProgressDialog( QWidget *parent, const char *name, bool modal ) :
QDialog( parent, name, modal )
{
- QVBoxLayout* lay= new QVBoxLayout ( this );
+ Q3VBoxLayout* lay= new Q3VBoxLayout ( this );
mLabel = new QLabel ( "abc",this );
- mBar = new QProgressBar ( this );
+ mBar = new Q3ProgressBar ( this );
mButton = new QPushButton ( i18n("Cancel"),this );
lay->addWidget ( mLabel );
lay->addWidget ( mBar );
lay->addWidget ( mButton );
connect ( mButton , SIGNAL ( clicked () ), this, SIGNAL ( cancelled () ));
resize ( 220, sizeHint().height() +mLabel->sizeHint().height());
}
void KProgressDialog::setLabelText ( const QString & t)
{
mLabel->setText( t );
}
void KProgressDialog::setTotalSteps ( int totalSteps )
{
setActiveWindow();
setFocus();
mBar->setTotalSteps ( totalSteps );
}
void KProgressDialog::setProgress ( int progress )
{
setActiveWindow();
setFocus();
mBar->setProgress ( progress );
}
void KProgressDialog::accept()
{
mLabel->setText( i18n("Eeek, there I am ticklish!") );
move ( geometry().x()-20,geometry().y()+20);
// QDialog::accept();
}
diff --git a/microkde/kdialog.h b/microkde/kdialog.h
index bc80689..5f9bf0e 100644
--- a/microkde/kdialog.h
+++ b/microkde/kdialog.h
@@ -1,38 +1,40 @@
#ifndef MINIKDE_KDIALOG_H
#define MINIKDE_KDIALOG_H
#include <qdialog.h>
+//Added by qt3to4:
+#include <QLabel>
class QLabel;
-class QProgressBar;
+class Q3ProgressBar;
class QPushButton ;
class KDialog : public QDialog
{
Q_OBJECT
public:
KDialog( QWidget *parent=0, const char *name=0, bool modal=true );
static int spacingHint();
static int marginHint();
static int spacingHintSmall();
static int marginHintSmall();
};
class KProgressDialog : public QDialog
{
Q_OBJECT
public:
KProgressDialog( QWidget *parent=0, const char *name=0, bool modal=false );
void setLabelText ( const QString & );
void setTotalSteps ( int totalSteps );
void setProgress ( int progress );
void accept();
void reject();
private:
QLabel * mLabel;
- QProgressBar *mBar;
+ Q3ProgressBar *mBar;
QPushButton *mButton;
signals:
void cancelled ();
};
#endif
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index d5c7e61..a40bad6 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -1,36 +1,40 @@
#include <qtabwidget.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qframe.h>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include "klocale.h"
#include "kdebug.h"
#include "kdialogbase.h"
KDialogBase::KDialogBase()
{
}
KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal,
const QString &caption,
int buttonMask, ButtonCode defaultButton,
bool separator,
const QString &user1,
const QString &user2,
const QString &user3) :
KDialog( parent, name, modal )
{
init( caption, buttonMask, user1, user2 );
if (findButton( defaultButton ) ) {
(findButton( defaultButton ) )->setFocus();
(findButton( defaultButton ) )->setDefault( true );
}
}
KDialogBase::KDialogBase( int dialogFace, const QString &caption,
int buttonMask, ButtonCode defaultButton,
QWidget *parent, const char *name, bool modal,
bool separator,
@@ -106,93 +110,93 @@ void KDialogBase::init( const QString &caption, int buttonMask,
if ( buttonMask & Close ) {
mCloseButton = new QPushButton( i18n("Close"), this );
connect( mCloseButton, SIGNAL( clicked() ), SLOT( slotClose() ) );
} else {
mCloseButton = 0;
}
}
QTabWidget *KDialogBase::tabWidget()
{
if ( !mTabWidget ) {
mTabWidget = new QTabWidget( this );
setMainWidget( mTabWidget );
}
return mTabWidget;
}
void KDialogBase::hideButtons()
{
if ( mUser1Button ) mUser1Button->hide() ;
if ( mUser2Button ) mUser2Button->hide() ;
if ( mOkButton ) mOkButton->hide() ;
if ( mApplyButton ) mApplyButton->hide() ;
if ( mDefaultButton ) mDefaultButton->hide();
if ( mCancelButton ) mCancelButton->hide() ;
if ( mCloseButton ) mCloseButton->hide() ;
}
void KDialogBase::initLayout()
{
delete mTopLayout;
- mTopLayout = new QVBoxLayout( this );
+ mTopLayout = new Q3VBoxLayout( this );
mTopLayout->setMargin( marginHintSmall() );
mTopLayout->setSpacing( spacingHintSmall() );
mTopLayout->addWidget( mMainWidget );
- QBoxLayout *buttonLayout = new QHBoxLayout;
+ Q3BoxLayout *buttonLayout = new Q3HBoxLayout;
mTopLayout->addLayout( buttonLayout );
if ( mUser1Button ) buttonLayout->addWidget( mUser1Button );
if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
if ( mOkButton ) buttonLayout->addWidget( mOkButton );
if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton );
if ( mCancelButton ) buttonLayout->addWidget( mCancelButton );
if ( mCloseButton ) buttonLayout->addWidget( mCloseButton );
buttonLayout->setMargin( marginHintSmall() );
buttonLayout->setSpacing( spacingHintSmall() );
}
-QFrame *KDialogBase::addPage( const QString &name )
+Q3Frame *KDialogBase::addPage( const QString &name )
{
// kdDebug() << "KDialogBase::addPage(): " << name << endl;
- QFrame *frame = new QFrame( tabWidget() );
+ Q3Frame *frame = new Q3Frame( tabWidget() );
tabWidget()->addTab( frame, name );
return frame;
}
-QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & )
+Q3Frame *KDialogBase::addPage( const QString &name, int, const QPixmap & )
{
return addPage( name );
}
void KDialogBase::setMainWidget( QWidget *widget )
{
kdDebug() << "KDialogBase::setMainWidget()" << endl;
mMainWidget = widget;
initLayout();
}
void KDialogBase::setButtonText( ButtonCode id, const QString &text )
{
QPushButton *button = findButton( id );
if ( button ) {
button->setText( text );
}
}
void KDialogBase::enableButton( ButtonCode id, bool state )
{
QPushButton *button = findButton( id );
if ( button ) {
button->setEnabled( state );
}
}
QPushButton *KDialogBase::findButton( ButtonCode id )
{
QPushButton *button = 0;
@@ -225,68 +229,68 @@ QPushButton *KDialogBase::findButton( ButtonCode id )
}
void KDialogBase::enableButtonOK( bool state )
{
enableButton( Ok, state );
}
void KDialogBase::enableButtonApply( bool state )
{
enableButton( Apply, state );
}
void KDialogBase::showButton( ButtonCode id, bool show )
{
QPushButton *button = findButton( id );
if ( button ) {
if ( show ) button->show();
else button->hide();
}
}
int KDialogBase::pageIndex( QWidget *widget ) const
{
return 0;
}
bool KDialogBase::showPage( int index )
{
tabWidget()->setCurrentPage( index );return false;
}
-QFrame *KDialogBase::plainPage()
+Q3Frame *KDialogBase::plainPage()
{
if ( !mPlainPage ) {
- mPlainPage = new QFrame( this );
+ mPlainPage = new Q3Frame( this );
setMainWidget( mPlainPage );
}
return mPlainPage;
}
void KDialogBase::slotOk()
{
emit okClicked();
accept();
}
void KDialogBase::slotApply()
{
emit applyClicked();
}
void KDialogBase::slotCancel()
{
emit cancelClicked();
reject();
}
void KDialogBase::slotClose()
{
emit closeClicked();
reject();
}
void KDialogBase::accept ()
{
emit acceptClicked();
KDialog::accept();
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h
index 17c186b..64cbd17 100644
--- a/microkde/kdialogbase.h
+++ b/microkde/kdialogbase.h
@@ -1,143 +1,145 @@
#ifndef MINIKDE_KDIALOGBASE_H
#define MINIKDE_KDIALOGBASE_H
-#include <qframe.h>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <QPixmap>
#include "kdialog.h"
class QPushButton;
class QLayout;
class QTabWidget;
-class QBoxLayout;
+class Q3BoxLayout;
class KDialogBase : public KDialog
{
Q_OBJECT
public:
enum ButtonCode
{
Help = 0x00000001,
Default = 0x00000002,
Ok = 0x00000004,
Apply = 0x00000008,
Try = 0x00000010,
Cancel = 0x00000020,
Close = 0x00000040,
User1 = 0x00000080,
User2 = 0x00000100,
User3 = 0x00000200,
No = 0x00000080,
Yes = 0x00000100,
Details = 0x00000400,
Filler = 0x40000000,
Stretch = 0x80000000
};
enum DialogType
{
TreeList,
Tabbed,
Plain,
Swallow,
IconList
};
KDialogBase();
KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true,
const QString &caption=QString::null,
int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
bool separator=false,
const QString &user1=QString::null,
const QString &user2=QString::null,
const QString &user3=QString::null);
KDialogBase( int dialogFace, const QString &caption,
int buttonMask, ButtonCode defaultButton,
QWidget *parent=0, const char *name=0, bool modal=true,
bool separator=false,
const QString &user1=QString::null,
const QString &user2=QString::null,
const QString &user3=QString::null);
virtual ~KDialogBase();
- QFrame *addPage( const QString & );
- QFrame *addPage( const QString &, int, const QPixmap & );
+ Q3Frame *addPage( const QString & );
+ Q3Frame *addPage( const QString &, int, const QPixmap & );
void setMainWidget( QWidget *widget );
void setButtonText( ButtonCode id, const QString &text );
void enableButton( ButtonCode id, bool state );
void enableButtonOK( bool state );
void enableButtonApply( bool state );
void showButton( ButtonCode, bool show );
int pageIndex( QWidget *widget ) const;
bool showPage( int index );
void hideButtons();
- QFrame *plainPage();
+ Q3Frame *plainPage();
signals:
void user1Clicked();
void user2Clicked();
/**
* The Apply button was pressed. This signal is only emitted if
* @ref slotApply() is not replaced.
*/
void applyClicked();
/**
* The OK button was pressed. This signal is only emitted if
* @ref slotOk() is not replaced.
*/
void okClicked();
/**
* The Cancel button was pressed. This signal is only emitted if
* @ref slotCancel() is not replaced.
*/
void cancelClicked();
/**
* The Close button was pressed. This signal is only emitted if
* @ref slotClose() is not replaced.
*/
void closeClicked();
void defaultClicked();
void acceptClicked();
protected slots:
virtual void slotOk();
virtual void slotApply();
virtual void slotCancel();
virtual void slotClose();
virtual void slotUser1();
virtual void slotUser2();
virtual void accept ();
protected:
QPushButton *findButton( ButtonCode );
QTabWidget *tabWidget();
private:
void init( const QString &caption, int buttonMask,
const QString &user1=QString::null, const QString &user2=QString::null );
void initLayout();
QWidget *mMainWidget;
QTabWidget *mTabWidget;
- QFrame *mPlainPage;
- QBoxLayout *mTopLayout;
+ Q3Frame *mPlainPage;
+ Q3BoxLayout *mTopLayout;
QPushButton *mUser1Button;
QPushButton *mUser2Button;
QPushButton *mCloseButton;
QPushButton *mOkButton;
QPushButton *mApplyButton;
QPushButton *mCancelButton;
QPushButton *mDefaultButton;
};
#endif
diff --git a/microkde/keditlistbox.cpp b/microkde/keditlistbox.cpp
index 55b7784..257a44a 100644
--- a/microkde/keditlistbox.cpp
+++ b/microkde/keditlistbox.cpp
@@ -1,144 +1,147 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
2000, 2002 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qstringlist.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qlistbox.h>
-#include <qwhatsthis.h>
+#include <q3groupbox.h>
+#include <q3listbox.h>
+#include <q3whatsthis.h>
#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3StrList>
#include <kcombobox.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klineedit.h>
#include <klocale.h>
#include <kapplication.h>
#include <knotifyclient.h>
#include "keditlistbox.h"
#include <assert.h>
class KEditListBoxPrivate
{
public:
bool m_checkAtEntering;
int buttons;
};
KEditListBox::KEditListBox(QWidget *parent, const char *name,
bool checkAtEntering, int buttons )
- :QGroupBox(parent, name )
+ :Q3GroupBox(parent, name )
{
init( checkAtEntering, buttons );
}
KEditListBox::KEditListBox(const QString& title, QWidget *parent,
const char *name, bool checkAtEntering, int buttons)
- :QGroupBox(title, parent, name )
+ :Q3GroupBox(title, parent, name )
{
init( checkAtEntering, buttons );
}
KEditListBox::KEditListBox(const QString& title, const CustomEditor& custom,
QWidget *parent, const char *name,
bool checkAtEntering, int buttons)
- :QGroupBox(title, parent, name )
+ :Q3GroupBox(title, parent, name )
{
m_lineEdit = custom.lineEdit();
init( checkAtEntering, buttons, custom.representationWidget() );
}
KEditListBox::~KEditListBox()
{
delete d;
d=0;
}
void KEditListBox::init( bool checkAtEntering, int buttons,
QWidget *representationWidget )
{
d=new KEditListBoxPrivate;
d->m_checkAtEntering=checkAtEntering;
d->buttons = buttons;
int lostButtons = 0;
if ( (buttons & Add) == 0 )
lostButtons++;
if ( (buttons & Remove) == 0 )
lostButtons++;
if ( (buttons & UpDown) == 0 )
lostButtons += 2;
servNewButton = servRemoveButton = servUpButton = servDownButton = 0L;
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding));
QWidget * gb = this;
- QGridLayout * grid = new QGridLayout(gb, 7 - lostButtons, 2,
+ Q3GridLayout * grid = new Q3GridLayout(gb, 7 - lostButtons, 2,
KDialog::marginHint(),
KDialog::spacingHint());
grid->addRowSpacing(0, fontMetrics().lineSpacing());
for ( int i = 1; i < 7 - lostButtons; i++ )
grid->setRowStretch(i, 1);
grid->setMargin(15);
if ( representationWidget )
representationWidget->reparent( gb, QPoint(0,0) );
else
m_lineEdit=new KLineEdit(gb);
- m_listBox = new QListBox(gb);
+ m_listBox = new Q3ListBox(gb);
QWidget *editingWidget = representationWidget ?
representationWidget : m_lineEdit;
grid->addMultiCellWidget(editingWidget,1,1,0,1);
grid->addMultiCellWidget(m_listBox, 2, 6 - lostButtons, 0, 0);
int row = 2;
if ( buttons & Add ) {
servNewButton = new QPushButton(i18n("&Add"), gb);
servNewButton->setEnabled(false);
connect(servNewButton, SIGNAL(clicked()), SLOT(addItem()));
grid->addWidget(servNewButton, row++, 1);
}
if ( buttons & Remove ) {
servRemoveButton = new QPushButton(i18n("&Remove"), gb);
servRemoveButton->setEnabled(false);
connect(servRemoveButton, SIGNAL(clicked()), SLOT(removeItem()));
grid->addWidget(servRemoveButton, row++, 1);
}
if ( buttons & UpDown ) {
servUpButton = new QPushButton(i18n("Move &Up"), gb);
servUpButton->setEnabled(false);
connect(servUpButton, SIGNAL(clicked()), SLOT(moveItemUp()));
servDownButton = new QPushButton(i18n("Move &Down"), gb);
servDownButton->setEnabled(false);
connect(servDownButton, SIGNAL(clicked()), SLOT(moveItemDown()));
grid->addWidget(servUpButton, row++, 1);
@@ -175,88 +178,88 @@ void KEditListBox::typedSomething(const QString& text)
if (!d->m_checkAtEntering)
servNewButton->setEnabled(!text.isEmpty());
else
{
if (text.isEmpty())
{
servNewButton->setEnabled(false);
}
else
{
bool enable = (m_listBox->findItem( text ) == 0L);
servNewButton->setEnabled( enable );
}
}
}
void KEditListBox::moveItemUp()
{
if (!m_listBox->isEnabled())
{
KNotifyClient::beep();
return;
}
unsigned int selIndex = m_listBox->currentItem();
if (selIndex == 0)
{
KNotifyClient::beep();
return;
}
- QListBoxItem *selItem = m_listBox->item(selIndex);
+ Q3ListBoxItem *selItem = m_listBox->item(selIndex);
m_listBox->takeItem(selItem);
m_listBox->insertItem(selItem, selIndex-1);
m_listBox->setCurrentItem(selIndex - 1);
emit changed();
}
void KEditListBox::moveItemDown()
{
if (!m_listBox->isEnabled())
{
KNotifyClient::beep();
return;
}
unsigned int selIndex = m_listBox->currentItem();
if (selIndex == m_listBox->count() - 1)
{
KNotifyClient::beep();
return;
}
- QListBoxItem *selItem = m_listBox->item(selIndex);
+ Q3ListBoxItem *selItem = m_listBox->item(selIndex);
m_listBox->takeItem(selItem);
m_listBox->insertItem(selItem, selIndex+1);
m_listBox->setCurrentItem(selIndex + 1);
emit changed();
}
void KEditListBox::addItem()
{
// when m_checkAtEntering is true, the add-button is disabled, but this
// slot can still be called through Key_Return/Key_Enter. So we guard
// against this.
if ( !servNewButton || !servNewButton->isEnabled() )
return;
const QString& currentTextLE=m_lineEdit->text();
bool alreadyInList(false);
//if we didn't check for dupes at the inserting we have to do it now
if (!d->m_checkAtEntering)
{
// first check current item instead of dumb iterating the entire list
if ( m_listBox->currentText() == currentTextLE )
alreadyInList = true;
else
{
alreadyInList =(m_listBox->findItem(currentTextLE) != 0);
}
}
if ( servNewButton )
servNewButton->setEnabled(false);
@@ -320,70 +323,72 @@ void KEditListBox::enableMoveButtons(int index)
{
servUpButton->setEnabled(true);
servDownButton->setEnabled(false);
}
else if (index == 0)
{
servUpButton->setEnabled(false);
servDownButton->setEnabled(true);
}
else
{
servUpButton->setEnabled(true);
servDownButton->setEnabled(true);
}
}
if ( servRemoveButton )
servRemoveButton->setEnabled(true);
}
void KEditListBox::clear()
{
m_lineEdit->clear();
m_listBox->clear();
emit changed();
}
void KEditListBox::insertStringList(const QStringList& list, int index)
{
m_listBox->insertStringList(list,index);
}
-void KEditListBox::insertStrList(const QStrList* list, int index)
+void KEditListBox::insertStrList(const Q3StrList* list, int index)
{
- m_listBox->insertStrList(list,index);
+ for(Q3StrList::const_iterator i=list->begin();i!=list->end();++i)
+ m_listBox->insertItem(*i,index++);
}
-void KEditListBox::insertStrList(const QStrList& list, int index)
+void KEditListBox::insertStrList(const Q3StrList& list, int index)
{
- m_listBox->insertStrList(list,index);
+ for(Q3StrList::const_iterator i=list.begin();i!=list.end();++i)
+ m_listBox->insertItem(*i,index++);
}
void KEditListBox::insertStrList(const char ** list, int numStrings, int index)
{
m_listBox->insertStrList(list,numStrings,index);
}
QStringList KEditListBox::items() const
{
QStringList list;
for ( uint i = 0; i < m_listBox->count(); i++ )
list.append( m_listBox->text( i ));
return list;
}
void KEditListBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
KEditListBox::CustomEditor::CustomEditor( KComboBox *combo )
{
m_representationWidget = combo;
m_lineEdit = static_cast<KLineEdit*>( combo->lineEdit() );
assert( m_lineEdit );
}
diff --git a/microkde/keditlistbox.h b/microkde/keditlistbox.h
index 130d933..e43d958 100644
--- a/microkde/keditlistbox.h
+++ b/microkde/keditlistbox.h
@@ -1,71 +1,73 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KEDITLISTBOX_H
#define KEDITLISTBOX_H
-#include <qgroupbox.h>
-#include <qlistbox.h>
+#include <q3groupbox.h>
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <Q3StrList>
class KLineEdit;
class KComboBox;
class QPushButton;
class KEditListBoxPrivate;
/**
* An editable listbox
*
* This class provides a editable listbox ;-), this means
* a listbox which is accompanied by a line edit to enter new
* items into the listbox and pushbuttons to add and remove
* items from the listbox and two buttons to move items up and down.
*/
-class KEditListBox : public QGroupBox
+class KEditListBox : public Q3GroupBox
{
Q_OBJECT
public:
/// @since 3.1
class CustomEditor
{
public:
CustomEditor()
: m_representationWidget( 0L ),
m_lineEdit( 0L ) {}
CustomEditor( QWidget *repWidget, KLineEdit *edit )
: m_representationWidget( repWidget ),
m_lineEdit( edit ) {}
CustomEditor( KComboBox *combo );
void setRepresentationWidget( QWidget *repWidget ) {
m_representationWidget = repWidget;
}
void setLineEdit( KLineEdit *edit ) {
m_lineEdit = edit;
}
virtual QWidget *representationWidget() const {
return m_representationWidget;
}
virtual KLineEdit *lineEdit() const {
return m_lineEdit;
}
protected:
QWidget *m_representationWidget;
@@ -97,130 +99,130 @@ public:
/**
* Create an editable listbox.
*
* The same as the other constructor, additionally it takes
* @title, which will be the title of the frame around the listbox.
*/
KEditListBox(const QString& title, QWidget *parent = 0,
const char *name = 0, bool checkAtEntering=false,
int buttons = All );
/**
* Another constructor, which allows to use a custom editing widget
* instead of the standard KLineEdit widget. E.g. you can use a
* @ref KURLRequester or a @ref KComboBox as input widget. The custom
* editor must consist of a lineedit and optionally another widget that
* is used as representation. A KComboBox or a KURLRequester have a
* KLineEdit as child-widget for example, so the KComboBox is used as
* the representation widget.
*
* @see KURLRequester::customEditor()
* @since 3.1
*/
KEditListBox( const QString& title,
const CustomEditor &customEditor,
QWidget *parent = 0, const char *name = 0,
bool checkAtEntering = false, int buttons = All );
virtual ~KEditListBox();
/**
* Return a pointer to the embedded QListBox.
*/
- QListBox* listBox() const { return m_listBox; }
+ Q3ListBox* listBox() const { return m_listBox; }
/**
* Return a pointer to the embedded QLineEdit.
*/
KLineEdit* lineEdit() const { return m_lineEdit; }
/**
* Return a pointer to the Add button
*/
QPushButton* addButton() const { return servNewButton; }
/**
* Return a pointer to the Remove button
*/
QPushButton* removeButton() const { return servRemoveButton; }
/**
* Return a pointer to the Up button
*/
QPushButton* upButton() const { return servUpButton; }
/**
* Return a pointer to the Down button
*/
QPushButton* downButton() const { return servDownButton; }
/**
* See @ref QListBox::count()
*/
int count() const { return int(m_listBox->count()); }
/**
* See @ref QListBox::insertStringList()
*/
void insertStringList(const QStringList& list, int index=-1);
/**
* See @ref QListBox::insertStringList()
*/
- void insertStrList(const QStrList* list, int index=-1);
+ void insertStrList(const Q3StrList* list, int index=-1);
/**
* See @ref QListBox::insertStrList()
*/
- void insertStrList(const QStrList& list, int index=-1);
+ void insertStrList(const Q3StrList& list, int index=-1);
/**
* See @ref QListBox::insertStrList()
*/
void insertStrList(const char ** list, int numStrings=-1, int index=-1);
/**
* See @ref QListBox::insertItem()
*/
void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);}
/**
* Clears both the listbox and the line edit.
*/
void clear();
/**
* See @ref QListBox::text()
*/
QString text(int index) const { return m_listBox->text(index); }
/**
* See @ref QListBox::currentItem()
*/
int currentItem() const;
/**
* See @ref QListBox::currentText()
*/
QString currentText() const { return m_listBox->currentText(); }
/**
* @returns a stringlist of all items in the listbox
*/
QStringList items() const;
signals:
void changed();
protected slots:
//the names should be self-explaining
void moveItemUp();
void moveItemDown();
void addItem();
void removeItem();
void enableMoveButtons(int index);
void typedSomething(const QString& text);
private:
- QListBox *m_listBox;
+ Q3ListBox *m_listBox;
QPushButton *servUpButton, *servDownButton;
QPushButton *servNewButton, *servRemoveButton;
KLineEdit *m_lineEdit;
//this is called in both ctors, to avoid code duplication
void init( bool checkAtEntering, int buttons,
QWidget *representationWidget = 0L );
protected:
virtual void virtual_hook( int id, void* data );
private:
//our lovely private d-pointer
KEditListBoxPrivate *d;
};
#endif
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 383e711..c1bfdef 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -1,88 +1,90 @@
#include <kfiledialog.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#ifndef DESKTOP_VERSION
//US orig#include <ofileselector.h>
#include <ofileselector_p.h>
QString KFileDialog::getSaveFileName( const QString & fn,
const QString & cap , QWidget * par )
{
QString retfile = "";
QDialog dia ( par, "input-dialog", true );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
QString file = fn;
if ( file.isEmpty() )
file = QDir::homeDirPath()+"/*";
QFileInfo fi ( file );
OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
lay.addWidget( &o);
// o.setNewVisible( true );
// o.setNameVisible( true );
dia.showMaximized();
if ( cap.isEmpty() )
dia.setCaption( file );
else
dia.setCaption( cap );
int res = dia.exec();
if ( res )
retfile = o.selectedName();
return retfile;
}
QString KFileDialog::getOpenFileName( const QString & fn,
const QString & cap, QWidget * par )
{
QString retfile = "";
QDialog dia ( par, "input-dialog", true );
// QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
QString file = fn;
if ( file.isEmpty() )
file = QDir::homeDirPath()+"/*";;
QFileInfo fi ( file );
OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
lay.addWidget( &o);
dia.showMaximized();
dia.setCaption( cap );
int res = dia.exec();
if ( res )
retfile = o.selectedName();
return retfile;
}
QString KFileDialog::getExistingDirectory( const QString & fn,
const QString & cap, QWidget * par )
{
return KFileDialog::getSaveFileName( fn, cap, par );
}
#else
-#include <qfiledialog.h>
+#include <q3filedialog.h>
QString KFileDialog::getSaveFileName( const QString & fn,
const QString & cap , QWidget * par )
{
- return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
+ return Q3FileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
}
QString KFileDialog::getOpenFileName( const QString & fn,
const QString & cap, QWidget * par )
{
- return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
+ return Q3FileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
}
QString KFileDialog::getExistingDirectory( const QString & fn,
const QString & cap, QWidget * par )
{
- return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap );
+ return Q3FileDialog::getExistingDirectory( fn, par, "exidtingdir", cap );
}
#endif
diff --git a/microkde/kfontdialog.cpp b/microkde/kfontdialog.cpp
index 174123c..f83c2a8 100644
--- a/microkde/kfontdialog.cpp
+++ b/microkde/kfontdialog.cpp
@@ -1,32 +1,34 @@
#include "kfontdialog.h"
#ifndef DESKTOP_VERSION
#include "ofontselector.h"
#else
#include <qfontdialog.h>
#endif
#include <qdialog.h>
#include <qlayout.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
QFont KFontDialog::getFont( const QFont & f, bool & ok )
{
#ifndef DESKTOP_VERSION
QDialog d( 0, "fd", true );;
OFontSelector s ( true, &d, "fontsel");
- QVBoxLayout l ( &d );
+ Q3VBoxLayout l ( &d );
l.addWidget( &s );
s.setSelectedFont ( f );
QPushButton b ( "OK", &d );
l.addWidget( &b );
qDebug("size %d ", f.bold());
QObject::connect( &b, SIGNAL( clicked () ), &d, SLOT ( accept () ) );
d.show();
ok = false;
if ( d.exec () ) {
ok = true;
return s.selectedFont ( );
}
return f;
#else
return QFontDialog::getFont ( &ok, f, 0, "fontdialog" );
#endif
}
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp
index 53edd08..9cc5835 100644
--- a/microkde/kglobal.cpp
+++ b/microkde/kglobal.cpp
@@ -1,48 +1,49 @@
#include "kglobal.h"
#include "kstandarddirs.h"
-#include <qkeycode.h>
+#include <qnamespace.h>
#include <qapplication.h>
+#include <QDesktopWidget>
KLocale *KGlobal::mLocale = 0;
KConfig *KGlobal::mConfig = 0;
KIconLoader *KGlobal::mIconLoader = 0;
KStandardDirs *KGlobal::mDirs = 0;
QString KGlobal::mAppName = "godot";
KLocale *KGlobal::locale()
{
if ( !mLocale ) {
- ASSERT(mAppName);
+ Q_ASSERT(!mAppName.isEmpty());
mLocale = new KLocale();//mAppName);
}
return mLocale;
}
//US
void KGlobal::setLocale(KLocale *kg)
{
mLocale = kg;
}
KConfig *KGlobal::config()
{
//mConfig is set inside setAppName. Though it has to be the first function you call.
return mConfig;
}
KGlobal::Size KGlobal::getDesktopSize()
{
#ifdef DESKTOP_VERSION
return KGlobal::Desktop;
#else
if ( QApplication::desktop()->width() <= 320 )
return KGlobal::Small;
else if ( QApplication::desktop()->width() > 480)
return KGlobal::Desktop;
else
return KGlobal::Medium;
#endif
}
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index 2e483e9..1f08255 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -1,38 +1,39 @@
#include "kglobalsettings.h"
#include "kconfig.h"
#include "kglobal.h"
#include "kconfigbase.h"
#include <qapplication.h>
+#include <QDesktopWidget>
#ifdef DESKTOP_VERSION
QColor KGlobalSettings::mAlternate = QColor( 235, 235, 235 );
#else
QColor KGlobalSettings::mAlternate = QColor( 210, 210, 210 );
#endif
QFont KGlobalSettings::generalFont()
{
int size = 12;
if (QApplication::desktop()->width() < 480 ) {
size = 10;
}
#ifndef DESKTOP_VERSION
else
if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
size = 18;
#endif
QFont f = QApplication::font();
//qDebug("pointsize %d %s", f.pointSize(),f.family().latin1());
f.setPointSize( size );
return f;
}
QFont KGlobalSettings::generalMaxFont()
{
int size = 12;
if (QApplication::desktop()->width() < 480 ) {
size = 10;
}
#ifndef DESKTOP_VERSION
else
diff --git a/microkde/kiconloader.cpp b/microkde/kiconloader.cpp
index 4842d71..e7f657d 100644
--- a/microkde/kiconloader.cpp
+++ b/microkde/kiconloader.cpp
@@ -1,117 +1,119 @@
#include "kiconloader.h"
#include "kglobal.h"
#ifndef DESKTOP_VERSION_OEGEL
#include <qdir.h>
+//Added by qt3to4:
+#include <QPixmap>
QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int,
int, QString *, bool ) const
{
QPixmap pix;
QString file;
file = iconPath() + name+".png";
pix.load ( file );
// qDebug("KIconLoader::loadIcon %s -----------", file.latin1());
return pix;
}
-QIconSet KIconLoader::loadIconSet( const QString& name) const
+QIcon KIconLoader::loadIconSet( const QString& name) const
{
QPixmap pixmapLoader;
QString file;
file = iconPath() + name+".png";
pixmapLoader.load( file );
//qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() );
- QIconSet is ( pixmapLoader );
+ QIcon is ( pixmapLoader );
return is;
}
QPixmap BarIcon( const QString &name )
{
QPixmap pix;
pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" );
return pix;
}
QPixmap DesktopIcon( const QString &name, int )
{
QPixmap pix;
pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" );
return pix;
}
QPixmap SmallIcon( const QString &name )
{
QPixmap pixmapLoader;
QString file;
file =KGlobal::iconLoader()->iconPath() + name +".png";
pixmapLoader.load( file );
return pixmapLoader;
}
QPixmap SmallIconSet( const QString &name )
{
QPixmap pixmapLoader;
QString file;
file =KGlobal::iconLoader()->iconPath() + name +".png";
pixmapLoader.load( file );
return pixmapLoader;
}
#else
#include <qpe/resource.h>
#include <kglobal.h>
QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int,
int, QString *, bool ) const
{
QString px = this->iconPath() + "/" + name;
QPixmap p = Resource::loadPixmap( px );
QPixmap* pPtr = &p;
if (pPtr == 0)
qDebug("KIconLoader::loadIcon: %s not found", px.latin1());
return p;
}
-QIconSet KIconLoader::loadIconSet( const QString& name) const
+QIcon KIconLoader::loadIconSet( const QString& name) const
{
QString px = this->iconPath() + "/" + name;
- QIconSet is ;//= Resource::loadIconSet( px );
- QIconSet* isPtr = 0;//LR&is;
+ QIcon is ;//= Resource::loadIconSet( px );
+ QIcon* isPtr = 0;//LR&is;
if (isPtr == 0)
qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1());
return is;
}
QPixmap BarIcon( const QString &name )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
QPixmap DesktopIcon( const QString &name, int )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
QPixmap SmallIcon( const QString &name )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
QPixmap SmallIconSet( const QString &name )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
#endif
diff --git a/microkde/kiconloader.h b/microkde/kiconloader.h
index 68fec4e..2abb667 100644
--- a/microkde/kiconloader.h
+++ b/microkde/kiconloader.h
@@ -1,52 +1,52 @@
#ifndef MINIKDE_KICONLOADER_H
#define MINIKDE_KICONLOADER_H
#include <qpixmap.h>
#include <qstring.h>
//US
-#include <qiconset.h>
+#include <qicon.h>
class KIcon
{
public:
enum Group { NoGroup=-1, Desktop=0, Toolbar, MainToolbar, Small,
Panel, LastGroup, User };
enum StdSizes { SizeSmall=16, SizeMedium=32, SizeLarge=48 };
enum States { DefaultState, ActiveState, DisabledState, LastState };
};
class KIconLoader
{
public:
KIconLoader()
: mIconpath(0) {}
KIconLoader( const QString &iconpath )
: mIconpath(iconpath) {}
//US QPixmap loadIcon( const QString &name, int );
QPixmap loadIcon(const QString& name, KIcon::Group group, int size=0,
int state=KIcon::DefaultState, QString *path_store=0,
bool canReturnNull=false) const;
//US
QString setIconPath( const QString &);
QString iconPath( /*US const QString &, int */) const;
QString iconPath( const QString &, int ) const;
- QIconSet loadIconSet( const QString &name) const;
+ QIcon loadIconSet( const QString &name) const;
//US to make this class usable for different applications, we have to add a iconpathvariable
private:
QString mIconpath;
};
QPixmap BarIcon(const QString& name);
QPixmap DesktopIcon(const QString& name, int);
QPixmap SmallIcon(const QString& name);
QPixmap SmallIconSet( const QString &name );
#endif
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index ca94570..ce62da7 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -1,61 +1,63 @@
/* This file is part of the KDE libraries
Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <sys/stat.h>
#ifdef _WIN32_
#else
#include <unistd.h>
#endif
#include <qstring.h>
//US #include <qtooltip.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <QPixmap>
//US #include <kaccel.h>
//US #include <kcombobox.h>
#include <kdebug.h>
#include <kdialog.h>
#include <kfiledialog.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
//US #include <kurlcompletion.h>
//US #include <kurldrag.h>
//US #include <kprotocolinfo.h>
#include "kurlrequester.h"
class KURLDragPushButton : public QPushButton
{
public:
KURLDragPushButton( QWidget *parent, const char *name=0 )
: QPushButton( parent, name ) {
//US setDragEnabled( true );
}
~KURLDragPushButton() {}
void setURL( const KURL& url ) {
m_urls.clear();
m_urls.append( url );
}
@@ -153,100 +155,100 @@ public:
if ( comp )
return comp->replacedPath( txt );
else
*/
return txt;
}
KLineEdit *edit;
//US KComboBox *combo;
int fileDialogMode;
QString fileDialogFilter;
};
/*US
KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent,
const char *name )
: QHBox( parent, name )
{
d = new KURLRequesterPrivate;
// must have this as parent
editWidget->reparent( this, 0, QPoint(0,0) );
//US d->edit = dynamic_cast<KLineEdit*>( editWidget );
d->edit = (KLineEdit*)( editWidget );
//US d->combo = dynamic_cast<KComboBox*>( editWidget );
init();
}
*/
KURLRequester::KURLRequester( QWidget *parent, const char *name )
- : QHBox( parent, name )
+ : Q3HBox( parent, name )
{
d = new KURLRequesterPrivate;
init();
}
KURLRequester::KURLRequester( const QString& url, QWidget *parent,
const char *name )
- : QHBox( parent, name )
+ : Q3HBox( parent, name )
{
d = new KURLRequesterPrivate;
init();
setURL( url );
}
KURLRequester::~KURLRequester()
{
//US delete myCompletion;
delete myFileDialog;
delete d;
}
void KURLRequester::init()
{
myFileDialog = 0L;
myShowLocalProt = false;
mPathIsDir = false;
if (/*US !d->combo && */ !d->edit )
d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" );
myButton = new KURLDragPushButton( this, "kfile button");
- QIconSet iconSet = SmallIconSet("fileopen");
- QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ QIcon iconSet = SmallIconSet("fileopen");
+ QPixmap pixMap = iconSet.pixmap( QIcon::Small, QIcon::Normal );
myButton->setIconSet( iconSet );
myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
//US QToolTip::add(myButton, i18n("Open file dialog"));
connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() ));
setSpacing( KDialog::spacingHint() );
QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit;
setFocusProxy( widget );
d->connectSignals( this );
connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() ));
/*US
myCompletion = new KURLCompletion();
d->setCompletionObject( myCompletion );
KAccel *accel = new KAccel( this );
accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() ));
accel->readSettings();
*/
}
void KURLRequester::setURL( const QString& url )
{
bool hasLocalPrefix = (url.startsWith("file:"));
if ( !myShowLocalProt && hasLocalPrefix )
d->setText( url.mid( 5, url.length()-5 ));
else
d->setText( url );
diff --git a/microkde/kio/kfile/kurlrequester.h b/microkde/kio/kfile/kurlrequester.h
index faa3326..5d4fa11 100644
--- a/microkde/kio/kfile/kurlrequester.h
+++ b/microkde/kio/kfile/kurlrequester.h
@@ -1,88 +1,88 @@
/* This file is part of the KDE libraries
Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KURLREQUESTER_H
#define KURLREQUESTER_H
-#include <qhbox.h>
+#include <q3hbox.h>
#include <keditlistbox.h>
//US #include <kfile.h>
//US #include <kpushbutton.h>
#include <kurl.h>
//US class KComboBox;
class KFileDialog;
class KLineEdit;
//US class KURLCompletion;
class KURLDragPushButton;
class QPushButton;
class QString;
class QTimer;
/**
* This class is a widget showing a lineedit and a button, which invokes a
* filedialog. File name completion is available in the lineedit.
*
* The defaults for the filedialog are to ask for one existing local file, i.e.
* KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly )
* The default filter is "*", i.e. show all files, and the start directory is
* the current working directory, or the last directory where a file has been
* selected.
*
* You can change this behavior by using @ref setMode() or @ref setFilter().
*
* @short A widget to request a filename/url from the user
* @author Carsten Pfeiffer <pfeiffer@kde.org>
*/
-class KURLRequester : public QHBox
+class KURLRequester : public Q3HBox
{
Q_OBJECT
Q_PROPERTY( QString url READ url WRITE setURL )
public:
/**
* Constructs a KURLRequester widget.
*/
KURLRequester( QWidget *parent=0, const char *name=0 );
/**
* Constructs a KURLRequester widget with the initial URL @p url.
*/
KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 );
/**
* Special constructor, which creates a KURLRequester widget with a custom
* edit-widget. The edit-widget can be either a KComboBox or a KLineEdit
* (or inherited thereof). Note: for geometry management reasons, the
* edit-widget is reparented to have the KURLRequester as parent.
* @param modal specifies whether the filedialog should be opened as modal
* or not.
*/
//US KURLRequester( QWidget *editWidget, QWidget *parent, const char *name=0 );
/**
* Destructs the KURLRequester.
*/
~KURLRequester();
/**
* @returns the current url in the lineedit. May be malformed, if the user
* entered something weird. ~user or environment variables are substituted
diff --git a/microkde/kio/kio/kdirwatch.cpp b/microkde/kio/kio/kdirwatch.cpp
index 1596d1f..5f07c54 100644
--- a/microkde/kio/kio/kdirwatch.cpp
+++ b/microkde/kio/kio/kdirwatch.cpp
@@ -23,69 +23,71 @@ Copyright (c) 2004 Ulf Schenk
$Id$
*/
// CHANGES:
// Februar 2002 - Add file watching and remote mount check for STAT
// Mar 30, 2001 - Native support for Linux dir change notification.
// Jan 28, 2000 - Usage of FAM service on IRIX (Josef.Weidendorfer@in.tum.de)
// May 24. 1998 - List of times introduced, and some bugs are fixed. (sven)
// May 23. 1998 - Removed static pointer - you can have more instances.
// It was Needed for KRegistry. KDirWatch now emits signals and doesn't
// call (or need) KFM. No more URL's - just plain paths. (sven)
// Mar 29. 1998 - added docs, stop/restart for particular Dirs and
// deep copies for list of dirs. (sven)
// Mar 28. 1998 - Created. (sven)
//US #include <config.h>
#ifdef HAVE_DNOTIFY
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#endif
#include <sys/stat.h>
#include <assert.h>
#include <qdir.h>
#include <qfile.h>
-#include <qintdict.h>
-#include <qptrlist.h>
+#include <q3intdict.h>
+#include <q3ptrlist.h>
#include <qsocketnotifier.h>
#include <qstringlist.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kapplication.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kconfigbase.h>
#include <kglobal.h>
#include <kstaticdeleter.h>
#include "kdirwatch.h"
#include "kdirwatch_p.h"
//US #include "global.h" // KIO::probably_slow_mounted
#define NO_NOTIFY (time_t) 0
static KDirWatchPrivate* dwp_self = 0;
#ifdef HAVE_DNOTIFY
#include <sys/utsname.h>
static int dnotify_signal = 0;
/* DNOTIFY signal handler
*
* As this is called asynchronously, only a flag is set and
* a rescan is requested.
* This is done by writing into a pipe to trigger a QSocketNotifier
* watching on this pipe: a timer is started and after a timeout,
* the rescan is done.
*/
void KDirWatchPrivate::dnotify_handler(int, siginfo_t *si, void *)
{
@@ -155,65 +157,65 @@ void KDirWatchPrivate::dnotify_sigio_handler(int sig, siginfo_t *si, void *p)
* are supported:
* - Polling: All files to be watched are polled regularly
* using stat (more precise: QFileInfo.lastModified()).
* The polling frequency is determined from global kconfig
* settings, defaulting to 500 ms for local directories
* and 5000 ms for remote mounts
* - FAM (File Alternation Monitor): first used on IRIX, SGI
* has ported this method to LINUX. It uses a kernel part
* (IMON, sending change events to /dev/imon) and a user
* level damon (fam), to which applications connect for
* notification of file changes. For NFS, the fam damon
* on the NFS server machine is used; if IMON is not built
* into the kernel, fam uses polling for local files.
* - DNOTIFY: In late LINUX 2.3.x, directory notification was
* introduced. By opening a directory, you can request for
* UNIX signals to be sent to the process when a directory
* is changed.
*/
KDirWatchPrivate::KDirWatchPrivate()
{
timer = new QTimer(this);
connect (timer, SIGNAL(timeout()), this, SLOT(slotRescan()));
freq = 3600000; // 1 hour as upper bound
statEntries = 0;
delayRemove = false;
m_ref = 0;
//US KConfigGroup config(KGlobal::config(), QCString("DirWatch"));
//US m_nfsPollInterval = config.readNumEntry("NFSPollInterval", 5000);
//US m_PollInterval = config.readNumEntry("PollInterval", 500);
KConfig *config = KGlobal::config();
- KConfigGroupSaver saver( config, QCString("DirWatch") );
+ KConfigGroupSaver saver( config, Q3CString("DirWatch") );
m_nfsPollInterval = config->readNumEntry("NFSPollInterval", 5000);
m_PollInterval = config->readNumEntry("PollInterval", 500);
QString available("Stat");
#ifdef HAVE_FAM
// It's possible that FAM server can't be started
if (FAMOpen(&fc) ==0) {
available += ", FAM";
use_fam=true;
sn = new QSocketNotifier( FAMCONNECTION_GETFD(&fc),
QSocketNotifier::Read, this);
connect( sn, SIGNAL(activated(int)),
this, SLOT(famEventReceived()) );
}
else {
kdDebug(7001) << "Can't use FAM (fam daemon not running?)" << endl;
use_fam=false;
}
#endif
#ifdef HAVE_DNOTIFY
supports_dnotify = true; // not guilty until proven guilty
rescan_all = false;
struct utsname uts;
int major, minor, patch;
if (uname(&uts) < 0)
supports_dnotify = false; // *shrug*
else if (sscanf(uts.release, "%d.%d.%d", &major, &minor, &patch) != 3)
supports_dnotify = false; // *shrug*
@@ -702,65 +704,65 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
e->dn_fd = 0;
}
}
else {
removeEntry(0, QDir::cleanDirPath(e->path+"/.."), e);
}
}
}
#endif
if (e->m_mode == StatMode) {
statEntries--;
if ( statEntries == 0 ) {
timer->stop(); // stop timer if lists are empty
kdDebug(7001) << " Stopped Polling Timer" << endl;
}
}
kdDebug(7001) << "Removed " << (e->isDir ? "Dir ":"File ") << e->path
<< (sub_entry ? QString(" for %1").arg(sub_entry->path) : QString(""))
<< (instance ? QString(" [%1]").arg(instance->name()) : QString(""))
<< endl;
m_mapEntries.remove( e->path ); // <e> not valid any more
}
/* Called from KDirWatch destructor:
* remove <instance> as client from all entries
*/
void KDirWatchPrivate::removeEntries( KDirWatch* instance )
{
- QPtrList<Entry> list;
+ Q3PtrList<Entry> list;
int minfreq = 3600000;
// put all entries where instance is a client in list
EntryMap::Iterator it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it ) {
Client* c = (*it).m_clients.first();
for(;c;c=(*it).m_clients.next())
if (c->instance == instance) break;
if (c) {
c->count = 1; // forces deletion of instance as client
list.append(&(*it));
}
else if ( (*it).m_mode == StatMode && (*it).freq < minfreq )
minfreq = (*it).freq;
}
for(Entry* e=list.first();e;e=list.next())
removeEntry(instance, e->path, 0);
if (minfreq > freq) {
// we can decrease the global polling frequency
freq = minfreq;
if (timer->isActive()) timer->changeInterval(freq);
kdDebug(7001) << "Poll Freq now " << freq << " msec" << endl;
}
}
// instance ==0: stop scanning for all instances
bool KDirWatchPrivate::stopEntryScan( KDirWatch* instance, Entry* e)
{
int stillWatching = 0;
Client* c = e->m_clients.first();
@@ -978,65 +980,65 @@ void KDirWatchPrivate::emitEvent(Entry* e, int event, const QString &fileName)
}
}
// Remove entries which were marked to be removed
void KDirWatchPrivate::slotRemoveDelayed()
{
Entry* e;
delayRemove = false;
for(e=removeList.first();e;e=removeList.next())
removeEntry(0, e->path, 0);
removeList.clear();
}
/* Scan all entries to be watched for changes. This is done regularly
* when polling and once after a DNOTIFY signal. This is NOT used by FAM.
*/
void KDirWatchPrivate::slotRescan()
{
EntryMap::Iterator it;
// People can do very long things in the slot connected to dirty(),
// like showing a message box. We don't want to keep polling during
// that time, otherwise the value of 'delayRemove' will be reset.
bool timerRunning = timer->isActive();
if ( timerRunning )
timer->stop();
// We delay deletions of entries this way.
// removeDir(), when called in slotDirty(), can cause a crash otherwise
delayRemove = true;
#ifdef HAVE_DNOTIFY
- QPtrList<Entry> dList, cList;
+ Q3PtrList<Entry> dList, cList;
// for DNotify method,
if (rescan_all)
{
// mark all as dirty
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it )
(*it).dn_dirty = true;
rescan_all = false;
}
else
{
// progate dirty flag to dependant entries (e.g. file watches)
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it )
if ( ((*it).m_mode == DNotifyMode) && (*it).dn_dirty )
(*it).propagate_dirty();
}
#endif
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it ) {
// we don't check invalid entries (i.e. remove delayed)
if (!(*it).isValid()) continue;
int ev = scanEntry( &(*it) );
#ifdef HAVE_DNOTIFY
if ((*it).m_mode == DNotifyMode) {
if ((*it).isDir && (ev == Deleted)) {
dList.append( &(*it) );
diff --git a/microkde/kio/kio/kdirwatch_p.h b/microkde/kio/kio/kdirwatch_p.h
index 0ab482f..be74f2a 100644
--- a/microkde/kio/kio/kdirwatch_p.h
+++ b/microkde/kio/kio/kdirwatch_p.h
@@ -1,153 +1,153 @@
/* Private Header for class of KDirWatchPrivate
*
* this separate header file is needed for MOC processing
* because KDirWatchPrivate has signals and slots
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef _KDIRWATCH_P_H
#define _KDIRWATCH_P_H
#ifdef HAVE_FAM
#include <fam.h>
#endif
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdirwatch.h>
#include <ctime>
#define invalid_ctime ((time_t)-1)
/* KDirWatchPrivate is a singleton and does the watching
* for every KDirWatch instance in the application.
*/
class KDirWatchPrivate : public QObject
{
Q_OBJECT
public:
enum entryStatus { Normal = 0, NonExistent };
enum entryMode { UnknownMode = 0, StatMode, DNotifyMode, FAMMode };
enum { NoChange=0, Changed=1, Created=2, Deleted=4 };
struct Client {
KDirWatch* instance;
int count;
// did the instance stop watching
bool watchingStopped;
// events blocked when stopped
int pending;
};
class Entry
{
public:
// the last observed modification time
time_t m_ctime;
// the last observed link count
int m_nlink;
entryStatus m_status;
entryMode m_mode;
bool isDir;
// instances interested in events
- QPtrList<Client> m_clients;
+ Q3PtrList<Client> m_clients;
// nonexistent entries of this directory
- QPtrList<Entry> m_entries;
+ Q3PtrList<Entry> m_entries;
QString path;
int msecLeft, freq;
void addClient(KDirWatch*);
void removeClient(KDirWatch*);
int clients();
bool isValid() { return m_clients.count() || m_entries.count(); }
#ifdef HAVE_FAM
FAMRequest fr;
#endif
#ifdef HAVE_DNOTIFY
int dn_fd;
bool dn_dirty;
void propagate_dirty();
#endif
};
typedef QMap<QString,Entry> EntryMap;
KDirWatchPrivate();
~KDirWatchPrivate();
void resetList (KDirWatch*,bool);
void useFreq(Entry* e, int newFreq);
void addEntry(KDirWatch*,const QString&, Entry*, bool);
void removeEntry(KDirWatch*,const QString&, Entry*);
bool stopEntryScan(KDirWatch*, Entry*);
bool restartEntryScan(KDirWatch*, Entry*, bool );
void stopScan(KDirWatch*);
void startScan(KDirWatch*, bool, bool);
void removeEntries(KDirWatch*);
void statistics();
Entry* entry(const QString&);
int scanEntry(Entry* e);
void emitEvent(Entry* e, int event, const QString &fileName = QString::null);
// Memory management - delete when last KDirWatch gets deleted
void ref() { m_ref++; }
bool deref() { return ( --m_ref == 0 ); }
public slots:
void slotRescan();
void famEventReceived(); // for FAM
void slotActivated(); // for DNOTIFY
void slotRemoveDelayed();
public:
QTimer *timer;
EntryMap m_mapEntries;
private:
int freq;
int statEntries;
int m_nfsPollInterval, m_PollInterval;
int m_ref;
bool useStat(Entry*);
bool delayRemove;
- QPtrList<Entry> removeList;
+ Q3PtrList<Entry> removeList;
#ifdef HAVE_FAM
QSocketNotifier *sn;
FAMConnection fc;
bool use_fam;
void checkFAMEvent(FAMEvent*);
bool useFAM(Entry*);
#endif
#ifdef HAVE_DNOTIFY
bool supports_dnotify;
bool rescan_all;
int mPipe[2];
QTimer mTimer;
QSocketNotifier *mSn;
- QIntDict<Entry> fd_Entry;
+ Q3IntDict<Entry> fd_Entry;
static void dnotify_handler(int, siginfo_t *si, void *);
static void dnotify_sigio_handler(int, siginfo_t *si, void *);
bool useDNotify(Entry*);
#endif
};
#endif // KDIRWATCH_P_H
diff --git a/microkde/klineedit.h b/microkde/klineedit.h
index 70c72d1..9eb749d 100644
--- a/microkde/klineedit.h
+++ b/microkde/klineedit.h
@@ -1,36 +1,38 @@
#ifndef MINIKDE_KLINEEDIT_H
#define MINIKDE_KLINEEDIT_H
#include <qlineedit.h>
+//Added by qt3to4:
+#include <QKeyEvent>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
class KLineEdit : public QLineEdit
{
Q_OBJECT
public:
KLineEdit( QWidget *parent=0, const char *name=0 ) :
QLineEdit( parent, name )
{
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
}
void keyPressEvent ( QKeyEvent * e)
{
switch ( e->key() ) {
case Qt::Key_Down:
emit scrollDOWN();
e->accept();
break;
case Qt::Key_Up:
emit scrollUP();
e->accept();
break;
default:
QLineEdit::keyPressEvent ( e );
diff --git a/microkde/klineeditdlg.h b/microkde/klineeditdlg.h
index 68e9252..d0004cd 100644
--- a/microkde/klineeditdlg.h
+++ b/microkde/klineeditdlg.h
@@ -1,34 +1,36 @@
#ifndef MICROKDE_KLINEEDITDLG_H
#define MICROKDE_KLINEEDITDLG_H
#include "kdialogbase.h"
#include <klineedit.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
class KLineEditDlg : public QDialog
{
public:
KLineEditDlg( const QString & text, const QString & editText, QWidget *parent ) :
QDialog( parent,"lineedit", true ) {
QLabel* lab = new QLabel( text, this );
mEdit = new KLineEdit( this );
- QVBoxLayout* vl = new QVBoxLayout( this );
+ Q3VBoxLayout* vl = new Q3VBoxLayout( this );
vl->setSpacing(5);
vl->setMargin(7);
vl->addWidget( lab );
vl->addWidget( mEdit );
mEdit->setText( editText );
QPushButton * p = new QPushButton (" OK ", this );
vl->addWidget( p );
connect( p, SIGNAL ( clicked () ), this , SLOT (accept() ) );
}
QString text() { return mEdit->text(); }
private:
KLineEdit* mEdit;
};
#endif
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp
index 55253c0..4820faf 100644
--- a/microkde/kresources/configdialog.cpp
+++ b/microkde/kresources/configdialog.cpp
@@ -1,117 +1,120 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qcheckbox.h>
-#include <qscrollview.h>
+#include <q3scrollview.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
#include <kbuttonbox.h>
#include <kdialog.h>
#include <klineedit.h>
#include "factory.h"
#include "configwidget.h"
#include "configdialog.h"
using namespace KRES;
ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
Resource* resource, const char *name )
: KDialogBase( parent, name, true, i18n( "Resource Configuration" ),
Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false)
{
Factory *factory = Factory::self( resourceFamily );
//US resize( 250, 240 );
resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240));
- QFrame *main;
+ Q3Frame *main;
main = plainPage();
- QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() );
+ Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main, 0, spacingHint() );
- QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
+ Q3GroupBox *generalGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main );
generalGroupBox->layout()->setSpacing( spacingHint() );
generalGroupBox->setTitle( i18n( "General Settings" ) );
new QLabel( i18n( "Name:" ), generalGroupBox );
mName = new KLineEdit( generalGroupBox );
new QLabel("", generalGroupBox );
mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
mReadOnly->setChecked( mResource->readOnly() );
new QLabel("", generalGroupBox );
mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox );
mIncludeInSync->setChecked( mResource->includeInSync() );
mName->setText( mResource->resourceName() );
mainLayout->addWidget( generalGroupBox );
- QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
+ Q3GroupBox *resourceGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main );
resourceGroupBox->layout()->setSpacing( spacingHint());
resourceGroupBox->setTitle( i18n( "%1 Resource Settings" )
.arg( factory->typeName( resource->type() ) ) );
mainLayout->addWidget( resourceGroupBox );
mainLayout->addStretch();
mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox );
if ( mConfigWidget ) {
connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ),
SLOT( setReadOnly( bool ) ) );
connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ),
SLOT( setIncludeInSync( bool ) ) );
connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ),
SLOT( setPersistentReadOnly( bool ) ) );
mConfigWidget->setInEditMode( false );
mConfigWidget->loadSettings( mResource );
mConfigWidget->show();
}
connect( mName, SIGNAL( textChanged(const QString &)),
SLOT( slotNameChanged(const QString &)));
slotNameChanged( mName->text() );
//US setMinimumSize( 400, 250 );
setMinimumSize( KMIN(KGlobal::getDesktopWidth(), 400), KMIN(KGlobal::getDesktopHeight(), 250));
}
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index fc7a42e..1a9d063 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -1,194 +1,198 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#ifdef DESKTOP_VERSION
#include <qinputdialog.h>
#else
#include <qtcompat/qinputdialog.h>
#endif
#include <qlabel.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3ValueList>
+#include <Q3VBoxLayout>
#include <kapplication.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#include <klistview.h>
#include <kbuttonbox.h>
//US #include <ktrader.h>
#include "resource.h"
#include "configdialog.h"
#include "configpage.h"
//US
#include <qpushbutton.h>
#include <qfile.h>
#include <kglobal.h>
using namespace KRES;
-class ConfigViewItem : public QCheckListItem
+class ConfigViewItem : public Q3CheckListItem
{
public:
- ConfigViewItem( QListView *parent, Resource* resource ) :
- QCheckListItem( parent, resource->resourceName(), CheckBox ),
+ ConfigViewItem( Q3ListView *parent, Resource* resource ) :
+ Q3CheckListItem( parent, resource->resourceName(), CheckBox ),
mResource( resource ),
mIsStandard( false )
{
setText( 1, mResource->type() );
setOn( mResource->isActive() );
}
void setStandard( bool value )
{
setText( 2, ( value ? i18n( "Yes" ) : QString::null ) );
mIsStandard = value;
}
bool standard() const { return mIsStandard; }
bool readOnly() const { return mResource->readOnly(); }
Resource *resource() { return mResource; }
private:
Resource* mResource;
bool mIsStandard;
};
ConfigPage::ConfigPage( QWidget *parent, const char *name )
: QWidget( parent, name ),
mCurrentManager( 0 ),
mCurrentConfig( 0 )
{
setCaption( i18n( "Resource Configuration" ) );
- QVBoxLayout *mainLayout = new QVBoxLayout( this );
+ Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this );
- QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this );
+ Q3GroupBox *groupBox = new Q3GroupBox( i18n( "Resources" ), this );
groupBox->setColumnLayout(0, Qt::Vertical );
groupBox->layout()->setSpacing( 3 );
groupBox->layout()->setMargin( 5 );
- QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 );
+ Q3GridLayout *groupBoxLayout = new Q3GridLayout( groupBox->layout(), 4, 2 );
//US mFamilyCombo = new KComboBox( false, groupBox );
mFamilyCombo = new KComboBox( groupBox );
groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 );
mListView = new KListView( groupBox );
mListView->setAllColumnsShowFocus( true );
mListView->addColumn( i18n( "Name" ) );
mListView->addColumn( i18n( "Type" ) );
mListView->addColumn( i18n( "Standard" ) );
//US groupBoxLayout->addWidget( mListView, 1, 0 );
groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 );
mAddButton = new QPushButton( i18n( "&Add..." ), groupBox );
groupBoxLayout->addWidget( mAddButton, 2, 0 );
mRemoveButton = new QPushButton( i18n( "&Remove" ), groupBox );
groupBoxLayout->addWidget( mRemoveButton, 2, 1 );
mEditButton = new QPushButton( i18n( "&Edit..." ), groupBox );
groupBoxLayout->addWidget( mEditButton, 3, 0 );
mStandardButton = new QPushButton( i18n( "&Use as Standard" ), groupBox );
groupBoxLayout->addWidget( mStandardButton, 3, 1 );
mRemoveButton->setEnabled( false );
mEditButton->setEnabled( false );
mStandardButton->setEnabled( false );
connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) );
connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) );
connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) );
mainLayout->addWidget( groupBox );
connect( mFamilyCombo, SIGNAL( activated( int ) ),
SLOT( slotFamilyChanged( int ) ) );
connect( mListView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionChanged() ) );
- connect( mListView, SIGNAL( clicked( QListViewItem * ) ),
- SLOT( slotItemClicked( QListViewItem * ) ) );
+ connect( mListView, SIGNAL( clicked( Q3ListViewItem * ) ),
+ SLOT( slotItemClicked( Q3ListViewItem * ) ) );
mLastItem = 0;
//US mConfig = new KConfig( "kcmkresourcesrc" );
mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") );
mConfig->setGroup( "General" );
load();
}
ConfigPage::~ConfigPage()
{
- QValueList<ResourcePageInfo>::Iterator it;
+ Q3ValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) {
(*it).mManager->removeListener( this );
delete (*it).mManager;
delete (*it).mConfig;
}
mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() );
delete mConfig;
mConfig = 0;
}
void ConfigPage::load()
{
kdDebug(5650) << "ConfigPage::load()" << endl;
mListView->clear();
//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
//US KTrader::OfferList::ConstIterator it;
//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
//US QString family = tmp.toString();
QStringList families;
families << "contact";
for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
{
QString family = (*it);
if ( !family.isEmpty() ) {
@@ -201,65 +205,65 @@ void ConfigPage::load()
ResourcePageInfo info;
info.mManager = mCurrentManager;
QString configDir = KGlobal::dirs()->saveLocation( "config" );
//QString configDir = KStandardDirs::appDir() + "/config";
if ( family == "contact" && QFile::exists( configDir + "/kabcrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kabcrc" ) );
} else if ( family == "calendar" && QFile::exists( configDir + "/kcalrc" ) ) {
info.mConfig = new KConfig( locateLocal( "config", "kcalrc" ) );
} else {
QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
info.mConfig = new KConfig( configFile );
}
info.mManager->readConfig( info.mConfig );
mInfoMap.append( info );
}
}
}
}
mCurrentManager = 0;
mFamilyCombo->insertStringList( mFamilyMap );
int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 );
mFamilyCombo->setCurrentItem( currentFamily );
slotFamilyChanged( currentFamily );
}
void ConfigPage::save()
{
saveResourceSettings();
- QValueList<ResourcePageInfo>::Iterator it;
+ Q3ValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it )
(*it).mManager->writeConfig( (*it).mConfig );
emit changed( false );
}
void ConfigPage::defaults()
{
}
void ConfigPage::slotFamilyChanged( int pos )
{
if ( pos < 0 || pos >= (int)mFamilyMap.count() )
return;
saveResourceSettings();
mFamily = mFamilyMap[ pos ];
//US qDebug("ConfigPage::slotFamilyChanged 4 family=%s", mFamily.latin1());
mCurrentManager = mInfoMap[ pos ].mManager;
mCurrentConfig = mInfoMap[ pos ].mConfig;
if ( !mCurrentManager )
kdDebug(5650) << "ERROR: cannot create ResourceManager<Resource>( mFamily )" << endl;
mListView->clear();
if ( mCurrentManager->isEmpty() ) {
//US qDebug("ConfigPage::slotFamilyChanged 4.1 mCurrentManager=%ul", mCurrentManager );
@@ -312,223 +316,223 @@ void ConfigPage::slotAdd()
desc = QInputDialog::getItem( i18n( "Resource Configuration" ),
i18n( "Select type of the new resource:" ), descs, 0,
false, &ok, this );
if ( !ok )
return;
QString type = types[ descs.findIndex( desc ) ];
// Create new resource
Resource *resource = mCurrentManager->createResource( type );
if ( !resource ) {
KMessageBox::error( this, i18n("Unable to create resource of type '%1'.")
.arg( type ) );
return;
}
resource->setResourceName( type + "-resource" );
ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
if ( dlg.exec() ) {
mCurrentManager->add( resource );
ConfigViewItem *item = new ConfigViewItem( mListView, resource );
mLastItem = item;
// if there are only read-only resources we'll set this resource
// as standard resource
if ( !resource->readOnly() ) {
bool onlyReadOnly = true;
- QListViewItem *it = mListView->firstChild();
+ Q3ListViewItem *it = mListView->firstChild();
while ( it != 0 ) {
ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it );
if ( !confIt->readOnly() && confIt != item )
onlyReadOnly = false;
it = it->itemBelow();
}
if ( onlyReadOnly )
item->setStandard( true );
}
emit changed( true );
} else {
delete resource;
resource = 0;
}
}
void ConfigPage::slotRemove()
{
if ( !mCurrentManager )
return;
- QListViewItem *item = mListView->currentItem();
+ Q3ListViewItem *item = mListView->currentItem();
ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item );
if ( !confItem )
return;
if ( confItem->standard() ) {
KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) );
return;
}
mCurrentManager->remove( confItem->resource() );
if ( item == mLastItem )
mLastItem = 0;
mListView->takeItem( item );
delete item;
emit changed( true );
}
void ConfigPage::slotEdit()
{
if ( !mCurrentManager )
return;
- QListViewItem *item = mListView->currentItem();
+ Q3ListViewItem *item = mListView->currentItem();
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
if ( !configItem )
return;
Resource *resource = configItem->resource();
ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
if ( dlg.exec() ) {
configItem->setText( 0, resource->resourceName() );
configItem->setText( 1, resource->type() );
if ( configItem->standard() && configItem->readOnly() ) {
KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) );
configItem->setStandard( false );
}
mCurrentManager->resourceChanged( resource );
emit changed( true );
}
}
void ConfigPage::slotStandard()
{
if ( !mCurrentManager )
return;
ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() );
if ( !item )
return;
if ( item->readOnly() ) {
KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) );
return;
}
if ( !item->isOn() ) {
KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) );
return;
}
- QListViewItem *it = mListView->firstChild();
+ Q3ListViewItem *it = mListView->firstChild();
while ( it != 0 ) {
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it );
if ( configItem->standard() )
configItem->setStandard( false );
it = it->itemBelow();
}
item->setStandard( true );
mCurrentManager->setStandardResource( item->resource() );
emit changed( true );
}
void ConfigPage::slotSelectionChanged()
{
bool state = ( mListView->currentItem() != 0 );
mRemoveButton->setEnabled( state );
mEditButton->setEnabled( state );
mStandardButton->setEnabled( state );
}
void ConfigPage::resourceAdded( Resource* resource )
{
qDebug("ConfigPage::resourceAdded : %s", resource->resourceName().latin1());
ConfigViewItem *item = new ConfigViewItem( mListView, resource );
// FIXME: this sucks. This should be in the config file,
// or application-dependent, in which case it's always Off
item->setOn( false );
mLastItem = item;
emit changed( true );
}
void ConfigPage::resourceModified( Resource* resource )
{
qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1());
}
void ConfigPage::resourceDeleted( Resource* resource )
{
qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1());
}
-void ConfigPage::slotItemClicked( QListViewItem *item )
+void ConfigPage::slotItemClicked( Q3ListViewItem *item )
{
ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item );
if ( !configItem ) return;
if ( configItem->standard() && !configItem->isOn() ) {
KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) );
configItem->setOn( true );
return;
}
if ( configItem->isOn() != configItem->resource()->isActive() ) {
emit changed( true );
}
}
void ConfigPage::saveResourceSettings()
{
//qDebug("ConfigPage::saveResourceSettings() begin");
if ( mCurrentManager ) {
- QListViewItem *item = mListView->firstChild();
+ Q3ListViewItem *item = mListView->firstChild();
while ( item ) {
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
// check if standard resource
if ( configItem->standard() && !configItem->readOnly() &&
configItem->isOn() ) {
mCurrentManager->setStandardResource( configItem->resource() );
}
// check if active or passive resource
configItem->resource()->setActive( configItem->isOn() );
item = item->nextSibling();
}
mCurrentManager->writeConfig( mCurrentConfig );
if ( !mCurrentManager->standardResource() )
KMessageBox::sorry( this, i18n( "There is no valid standard resource!<br>Please select one which is neither read-only nor inactive." ) );
}
//qDebug("ConfigPage::saveResourceSettings() end");
}
//US #include "configpage.moc"
diff --git a/microkde/kresources/configpage.h b/microkde/kresources/configpage.h
index be9239e..dc1aa50 100644
--- a/microkde/kresources/configpage.h
+++ b/microkde/kresources/configpage.h
@@ -1,104 +1,106 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_CONFIGPAGE_H
#define KRESOURCES_CONFIGPAGE_H
#include <qstringlist.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "manager.h"
class KComboBox;
class KListView;
-class QListViewItem;
+class Q3ListViewItem;
class QPushButton;
namespace KRES {
class ResourcePageInfo
{
public:
Manager<Resource> *mManager;
KConfig *mConfig;
};
class Resource;
class ConfigPage : public QWidget, public ManagerListener<Resource>
{
Q_OBJECT
public:
ConfigPage( QWidget *parent = 0, const char *name = 0 );
virtual ~ConfigPage();
void load();
void save();
virtual void defaults();
public slots:
void slotFamilyChanged( int );
void slotAdd();
void slotRemove();
void slotEdit();
void slotStandard();
void slotSelectionChanged();
// From ManagerListener<Resource>
public:
virtual void resourceAdded( Resource* resource );
virtual void resourceModified( Resource* resource );
virtual void resourceDeleted( Resource* resource );
protected slots:
- void slotItemClicked( QListViewItem * );
+ void slotItemClicked( Q3ListViewItem * );
signals:
void changed( bool );
private:
void saveResourceSettings();
Manager<Resource>* mCurrentManager;
KConfig* mCurrentConfig;
KConfig* mConfig;
QString mFamily;
QStringList mFamilyMap;
- QValueList<ResourcePageInfo> mInfoMap;
+ Q3ValueList<ResourcePageInfo> mInfoMap;
KComboBox* mFamilyCombo;
KListView* mListView;
QPushButton* mAddButton;
QPushButton* mRemoveButton;
QPushButton* mEditButton;
QPushButton* mStandardButton;
- QListViewItem* mLastItem;
+ Q3ListViewItem* mLastItem;
static const QString syncfamily;
};
}
#endif
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index 86b22b2..4f286d1 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -12,75 +12,75 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include <klocale.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kstaticdeleter.h>
//#ifndef DESKTOP_VERSION
#include <klibloader.h>
//#endif
#include <qfile.h>
#include "resource.h"
#include "factory.h"
#ifdef STATIC_RESOURCES
#include <file/resourcefile.h>
#include <dir/resourcedir.h>
#include <qtopia/resourceqtopia.h>
#endif
using namespace KRES;
-QDict<Factory> *Factory::mSelves = 0;
-static KStaticDeleter< QDict<Factory> > staticDeleter;
+Q3Dict<Factory> *Factory::mSelves = 0;
+static KStaticDeleter< Q3Dict<Factory> > staticDeleter;
Factory *Factory::self( const QString& resourceFamily)
{
Factory *factory = 0;
if ( !mSelves )
{
- mSelves = staticDeleter.setObject( new QDict<Factory> );
+ mSelves = staticDeleter.setObject( new Q3Dict<Factory> );
}
factory = mSelves->find( resourceFamily );
if ( !factory ) {
factory = new Factory( resourceFamily);
mSelves->insert( resourceFamily, factory );
}
return factory;
}
Factory::Factory( const QString& resourceFamily) :
mResourceFamily( resourceFamily )
{
//US so far we have three types available for resourceFamily "contact"
// and that are "file", "dir", "ldap"
/*US
KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" )
.arg( resourceFamily ) );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
QVariant type = (*it)->property( "X-KDE-ResourceType" );
if ( !type.toString().isEmpty() )
mTypeMap.insert( type.toString(), *it );
}
*/
//US new
PluginInfo* info = new PluginInfo;
info->library = "microkabc_file";
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index ea01b23..709fde0 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -1,59 +1,59 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_FACTORY_H
#define KRESOURCES_FACTORY_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qstring.h>
#include <kconfig.h>
#include "resource.h"
namespace KRES {
class ConfigWidget;
//US
struct PluginInfo
{
QString library;
QString nameLabel;
QString descriptionLabel;
};
/**
* Class for loading resource plugins.
* Do not use this class directly. Use ResourceManager instead
*
* Example:
*
* <pre>
* KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self();
*
* QStringList list = factory->resources();
* QStringList::Iterator it;
* for ( it = list.begin(); it != list.end(); ++it ) {
@@ -85,42 +85,42 @@ class Factory
*/
ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
/**
* Returns a pointer to a resource object or a null pointer
* if resource type doesn't exist.
*
* @param type The type of the resource, returned by @ref resources()
* @param ab The address book, the resource should belong to
* @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
*/
Resource *resource( const QString& type, const KConfig *config);
/**
* Returns a list of all available resource types.
*/
QStringList typeNames() const;
/**
* Returns the name for a special type.
*/
QString typeName( const QString &type ) const;
/**
* Returns the description for a special type.
*/
QString typeDescription( const QString &type ) const;
protected:
Factory( const QString& resourceFamily);
private:
- static QDict<Factory> *mSelves;
+ static Q3Dict<Factory> *mSelves;
QString mResourceFamily;
//US QMap<QString, KService::Ptr> mTypeMap;
//US lets store the pluginfo struct as value instead of a KService
QMap<QString, PluginInfo*> mTypeMap;
};
}
#endif
diff --git a/microkde/kresources/kcmkresources.cpp b/microkde/kresources/kcmkresources.cpp
index d600a31..f5eb826 100644
--- a/microkde/kresources/kcmkresources.cpp
+++ b/microkde/kresources/kcmkresources.cpp
@@ -1,77 +1,80 @@
/*
This file is part of libkresources.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
//US #include <kaboutdata.h>
//US #include <kgenericfactory.h>
#include <klocale.h>
#include "configpage.h"
#include "kcmkresources.h"
using namespace KRES;
//US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory;
//US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) );
//US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& )
//US : KCModule( ResourcesFactory::instance(), parent, name )
KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& )
: KDialogBase( parent, name, true, i18n( "Configure Resources" ),
Ok|Cancel, Ok, true )
{
- QFrame *main = plainPage();
+ Q3Frame *main = plainPage();
- QVBoxLayout *layout = new QVBoxLayout( main );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( main );
mConfigPage = new KRES::ConfigPage( main );
layout->addWidget( mConfigPage );
connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) );
#ifndef DESKTOP_VERSION
showMaximized();
#endif
}
void KCMKResources::changed( bool changed)
{
modified = changed;
}
void KCMKResources::slotOk()
{
if (modified) {
mConfigPage->save();
modified = false;
}
KDialogBase::slotOk();
}
void KCMKResources::load()
{
qDebug("KCMKResources::load" );
mConfigPage->load();
}
void KCMKResources::save()
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h
index 69062da..88705d4 100644
--- a/microkde/kresources/manager.h
+++ b/microkde/kresources/manager.h
@@ -3,66 +3,68 @@
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2004 Ulf Schenk
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KRESOURCES_MANAGER_H
#define KRESOURCES_MANAGER_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "factory.h"
#include "managerimpl.h"
namespace KRES {
class Resource;
template<class T>
class ManagerListener
{
public:
virtual void resourceAdded( T *resource ) = 0;
virtual void resourceModified( T *resource ) = 0;
virtual void resourceDeleted( T *resource ) = 0;
};
// TODO:
// The resource manager should provide some signals
// to warn applications that resources have been added,
// removed or modified.
//
// The manager should also keep track of which (or at least
// how many) applications hve opened a resource, so that it
// is only closed if none of them is using it any more
template<class T>
class Manager : private ManagerImplListener
{
public:
class Iterator
{
@@ -146,65 +148,65 @@ class Manager : private ManagerImplListener
Resource::List *mList;
};
ActiveIterator activeBegin()
{
ActiveIterator it;
it.mIt = mImpl->resourceList()->begin();
it.mList = mImpl->resourceList();
if ( it.mIt != mImpl->resourceList()->end() ) {
if ( !(*it)->isActive() ) it++;
}
return it;
}
ActiveIterator activeEnd()
{
ActiveIterator it;
it.mIt = mImpl->resourceList()->end();
it.mList = mImpl->resourceList();
return it;
}
bool isEmpty() const { return mImpl->resourceList()->isEmpty(); }
Manager( const QString &family )
{
mFactory = Factory::self( family );
// The managerimpl will use the same Factory object as the manager
// because of the Factory::self() pattern
mImpl = new ManagerImpl( family );
mImpl->setListener( this );
- mListeners = new QPtrList<ManagerListener<T> >;
+ mListeners = new Q3PtrList<ManagerListener<T> >;
}
virtual ~Manager()
{
mImpl->setListener( 0 );
delete mListeners;
delete mImpl;
}
/**
Recreate Resource objects from configuration file. If cfg is 0, read standard
configuration file.
*/
void readConfig( KConfig *cfg = 0 )
{
mImpl->readConfig( cfg );
}
/**
Write configuration of Resource objects to configuration file. If cfg is 0, write
to standard configuration file.
*/
void writeConfig( KConfig *cfg = 0 )
{
mImpl->writeConfig( cfg );
}
/**
Add resource to manager. This passes ownership of the Resource object
to the manager.
*/
void add( Resource *resource )
@@ -301,38 +303,38 @@ class Manager : private ManagerImplListener
}
virtual void resourceAdded( Resource *res )
{
T* resource = (T *)( res );
ManagerListener<T> *listener;
for ( listener = mListeners->first(); listener; listener = mListeners->next() )
listener->resourceAdded( resource );
}
virtual void resourceModified( Resource *res )
{
T* resource = (T *)( res );
ManagerListener<T> *listener;
for ( listener = mListeners->first(); listener; listener = mListeners->next() )
listener->resourceModified( resource );
}
virtual void resourceDeleted( Resource *res )
{
T* resource = (T *)( res );
ManagerListener<T> *listener;
for ( listener = mListeners->first(); listener; listener = mListeners->next() ) {
listener->resourceDeleted( resource );
}
}
private:
ManagerImpl *mImpl;
Factory *mFactory;
- QPtrList<ManagerListener<T> > *mListeners;
+ Q3PtrList<ManagerListener<T> > *mListeners;
};
}
#endif
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp
index a6d2007..4c0751c 100644
--- a/microkde/kresources/managerimpl.cpp
+++ b/microkde/kresources/managerimpl.cpp
@@ -6,64 +6,66 @@
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "resource.h"
#include "factory.h"
#include "managerimpl.h"
using namespace KRES;
ManagerImpl::ManagerImpl( const QString &family )
: mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ),
mFactory( 0 )
{
kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl;
}
ManagerImpl::~ManagerImpl()
{
kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
delete *it;
}
delete mStdConfig;
}
void ManagerImpl::createStandardConfig()
@@ -203,78 +205,78 @@ void ManagerImpl::setStandardResource( Resource *resource )
{
mStandard = resource;
}
void ManagerImpl::resourceChanged( Resource *resource )
{
writeResourceConfig( resource, true );
// ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() );
// allManagers.dcopResourceModified( resource->identifier() );
}
// DCOP asynchronous functions
//US since we work from inside the application, we call the methods directly.
QStringList ManagerImpl::resourceNames()
{
QStringList result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( (*it)->resourceName() );
}
return result;
}
Resource::List *ManagerImpl::resourceList()
{
return &mResources;
}
-QPtrList<Resource> ManagerImpl::resources()
+Q3PtrList<Resource> ManagerImpl::resources()
{
- QPtrList<Resource> result;
+ Q3PtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( *it );
}
return result;
}
-QPtrList<Resource> ManagerImpl::resources( bool active )
+Q3PtrList<Resource> ManagerImpl::resources( bool active )
{
- QPtrList<Resource> result;
+ Q3PtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
if ( (*it)->isActive() == active ) {
result.append( *it );
}
}
return result;
}
void ManagerImpl::setListener( ManagerImplListener *listener )
{
mListener = listener;
}
Resource* ManagerImpl::readResourceConfig( const QString& identifier,
bool checkActive )
{
kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
mConfig->setGroup( "Resource_" + identifier );
#ifdef _WIN32_
// we use plugins on win32. the group is stored in a static variable
// such that gourp info not avail on win32 plugins
// to fix that, it would be a looooot of work
mConfig->setTempGroup( "Resource_" + identifier );
#endif
QString type = mConfig->readEntry( "ResourceType" );
QString name = mConfig->readEntry( "ResourceName" );
Resource *resource = mFactory->resource( type, mConfig );
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h
index 56a2db6..1f728e5 100644
--- a/microkde/kresources/managerimpl.h
+++ b/microkde/kresources/managerimpl.h
@@ -3,117 +3,117 @@
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KRESOURCES_MANAGERIMPL_H
#define KRESOURCES_MANAGERIMPL_H
#include <qstring.h>
-#include <qptrlist.h>
-#include <qdict.h>
+#include <q3ptrlist.h>
+#include <q3dict.h>
//US
#include <qobject.h>
#include "resource.h"
class KConfig;
namespace KRES {
class Resource;
class Factory;
class ManagerImplListener
{
public:
virtual void resourceAdded( Resource *resource ) = 0;
virtual void resourceModified( Resource *resource ) = 0;
virtual void resourceDeleted( Resource *resource ) = 0;
};
/**
@internal
Do not use this class directly. Use ResourceManager instead
*/
class ManagerImpl : public QObject
{
Q_OBJECT
public:
ManagerImpl( const QString &family);
~ManagerImpl();
void readConfig( KConfig * );
void writeConfig( KConfig * );
void add( Resource *resource, bool useDCOP = true );
void remove( Resource *resource, bool useDCOP = true );
Resource *standardResource();
void setStandardResource( Resource *resource );
void setActive( Resource *resource, bool active );
Resource::List *resourceList();
- QPtrList<Resource> resources();
+ Q3PtrList<Resource> resources();
// Get only active or passive resources
- QPtrList<Resource> resources( bool active );
+ Q3PtrList<Resource> resources( bool active );
QStringList resourceNames();
void setListener( ManagerImplListener *listener );
public slots:
void resourceChanged( Resource *resource );
private:
// dcop calls
private:
void createStandardConfig();
Resource *readResourceConfig( const QString& identifier, bool checkActive );
void writeResourceConfig( Resource *resource, bool checkActive );
void removeResource( Resource *resource );
Resource *getResource( Resource *resource );
Resource *getResource( const QString& identifier );
QString mFamily;
KConfig *mConfig;
KConfig *mStdConfig;
Resource *mStandard;
Factory *mFactory;
Resource::List mResources;
ManagerImplListener *mListener;
};
}
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index ed5af96..1f9527c 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -1,63 +1,63 @@
/*
This file is part of libkresources
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_RESOURCE_H
#define KRESOURCES_RESOURCE_H
//US
#ifdef QT_THREAD_SUPPORT
#include <qmutex.h>
#endif //QT_THREAD_SUPPORT
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qwidget.h>
#include <qobject.h>
#include <klibloader.h>
class KConfig;
namespace KRES {
class ConfigWidget;
/**
* @internal
* @libdoc The KDE Resource library
*
* NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
* interface, it is in constant flux.
*
* The KDE Resource framework can be used to manage resources of
* different types, organized in families. The Resource framework
* is currently used for addressbook resources in libkabc and for
* calendar resources in libkcal.
*
* When you want to use the framework for a new family, you need to
* <ul><li>Define a name for your resource family</li>
* <li>subclass Resource and add the fields and method that are needed
* in your application</li>
* <li>If needed, override the doOpen() and doClose() methods.
* <li> Provide a configuration possibility for resources in your
* new family. You can use @ref ResourcesConfigPage to easily create a
* KControl applet</li>
@@ -210,65 +210,65 @@ Name=Example Resource
[Plugin]
Type=exchange
X-KDE-Library=resourceexample
</pre>
* <B>Makefile.am</B>
<pre>
kde_module_LTLIBRARIES = resourceexample.la
resourceexample_la_SOURCES = resourceexample.cpp resourceexampleconfig.cpp
resourceexample_la_LDFLAGS= $(all_libraries) -module $(KDE_PLUGIN)
resourceexample_la_LIBADD= -lkderesources
linkdir= $(kde_datadir)/resources/family
link_DATA= resourceexample.desktop
</pre>
*
*
*/
/**
* A @ref Resource is a ...
*
* A subclass should reimplement at least the constructor and the
k * @ref writeConfig method.
*
*/
class Resource : public QObject
{
Q_OBJECT
public:
- typedef QValueList<Resource *> List;
+ typedef Q3ValueList<Resource *> List;
/**
* Constructor. Construct resource from config.
* @param config Configuration to read persistence information from.
* If config==0, create object using default settings.
*/
Resource( const KConfig* config );
/**
* Destructor.
*/
virtual ~Resource();
/**
* Write configuration information for this resource to a configuration
* file. If you override this method, remember to call Resource::writeConfig
* or Terrible Things(TM) will happen.
* @param config Configuration to write persistence information to.
*/
virtual void writeConfig( KConfig* config );
/**
* Open this resource, if it not already open. Increase the open
* count of this object, and open the resource by calling @ref doOpen().
* This method may block while another thread is concurrently opening
* or closing the resource.
*
* Returns true if the resource was already opened or if it was opened
* successfully; returns false if the resource was not opened successfully.
*/
bool open();
diff --git a/microkde/kresources/selectdialog.cpp b/microkde/kresources/selectdialog.cpp
index fba8648..d5b83e9 100644
--- a/microkde/kresources/selectdialog.cpp
+++ b/microkde/kresources/selectdialog.cpp
@@ -5,144 +5,148 @@
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*US
#include <kbuttonbox.h>
#include <klistbox.h>
#include <klocale.h>
#include <kmessagebox.h>
*/
#include <klocale.h>
#include <kmessagebox.h>
//US
#include <kglobal.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qlayout.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3PtrList>
#include "resource.h"
#include "selectdialog.h"
using namespace KRES;
//US I am using KBaseDialog instead of KDialog
//US : KDialog( parent, name, true )
-SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent,
+SelectDialog::SelectDialog( Q3PtrList<Resource> list, QWidget *parent,
const char *name )
: KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel,
Ok, true)
{
//US setCaption( i18n( "Resource Selection" ) );
//US resize( 300, 200 );
resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) );
//US
- QFrame *main = plainPage();
+ Q3Frame *main = plainPage();
/*US
QVBoxLayout *layout = new QVBoxLayout( main );
mConfigPage = new KRES::ConfigPage( main );
layout->addWidget( mConfigPage );
*/
//US QVBoxLayout *mainLayout = new QVBoxLayout( this );
- QVBoxLayout *mainLayout = new QVBoxLayout( main );
+ Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main );
mainLayout->setMargin( marginHint() );
//US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this );
- QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, main );
+ Q3GroupBox *groupBox = new Q3GroupBox( 2, Qt::Horizontal, main );
groupBox->setTitle( i18n( "Resources" ) );
//US mResourceId = new KListBox( groupBox );
- mResourceId = new QListBox( groupBox );
+ mResourceId = new Q3ListBox( groupBox );
mainLayout->addWidget( groupBox );
mainLayout->addSpacing( 40 );
/*US
KButtonBox *buttonBox = new KButtonBox( this );
buttonBox->addStretch();
buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) );
buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) );
buttonBox->layout();
mainLayout->addWidget( buttonBox );
*/
// setup listbox
uint counter = 0;
for ( uint i = 0; i < list.count(); ++i ) {
Resource *resource = list.at( i );
if ( resource && !resource->readOnly() ) {
mResourceMap.insert( counter, resource );
mResourceId->insertItem( resource->resourceName() );
counter++;
}
}
mResourceId->setCurrentItem( 0 );
- connect( mResourceId, SIGNAL(returnPressed(QListBoxItem*)),
+ connect( mResourceId, SIGNAL(returnPressed(Q3ListBoxItem*)),
SLOT(accept()) );
}
Resource *SelectDialog::resource()
{
if ( mResourceId->currentItem() != -1 )
return mResourceMap[ mResourceId->currentItem() ];
else
return 0;
}
-Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent )
+Resource *SelectDialog::getResource( Q3PtrList<Resource> list, QWidget *parent )
{
if ( list.count() == 0 ) {
KMessageBox::error( parent, i18n( "There is no resource available!" ) );
return 0;
}
if ( list.count() == 1 ) return list.first();
// the following lines will return a writeable resource if only _one_ writeable
// resource exists
Resource *found = 0;
Resource *it = list.first();
while ( it ) {
if ( !it->readOnly() ) {
if ( found ) {
found = 0;
break;
} else
found = it;
}
it = list.next();
}
if ( found )
return found;
SelectDialog dlg( list, parent);
//US if ( dlg.exec() == KDialog::Accepted )
if ( dlg.exec() )
return dlg.resource();
else
return 0;
diff --git a/microkde/kresources/selectdialog.h b/microkde/kresources/selectdialog.h
index 7026212..be5152b 100644
--- a/microkde/kresources/selectdialog.h
+++ b/microkde/kresources/selectdialog.h
@@ -1,92 +1,92 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_SELECTDIALOG_H
#define KRESOURCES_SELECTDIALOG_H
#include <qobject.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qmap.h>
#include <kdialogbase.h>
//US class KListBox;
-class QListBox;
+class Q3ListBox;
namespace KRES {
class Resource;
/**
* Dialog for selecting a resource.
*
* Example:
*
* <pre>
* KABC::Resource *res = KABC::SelectDialog::getResource();
* if ( !( res ) ) {
* // no resource selected
* } else {
* // do something with resource
* }
* </pre>
*/
//US class SelectDialog : KDialog
class SelectDialog : KDialogBase
{
// Q_OBJECT
public:
/**
* Constructor.
* @param ab The address book you want to select the resource from
* @param parent The parent widget
* @param name The name of the dialog
*/
- SelectDialog( QPtrList<Resource> list, QWidget *parent = 0,
+ SelectDialog( Q3PtrList<Resource> list, QWidget *parent = 0,
const char *name = 0);
// ~SelectDialog();
/**
* Return selected resource.
*/
Resource *resource();
/**
* Open a dialog showing the available resources and return the resource the
* user has selected. Returns 0, if the dialog was canceled.
*/
- static Resource *getResource( QPtrList<Resource> list, QWidget *parent = 0 );
+ static Resource *getResource( Q3PtrList<Resource> list, QWidget *parent = 0 );
private:
//US KListBox *mResourceId;
- QListBox *mResourceId;
+ Q3ListBox *mResourceId;
QMap<int, Resource*> mResourceMap;
};
}
#endif
diff --git a/microkde/ksystemtray.cpp b/microkde/ksystemtray.cpp
index 4f81d02..0d0045f 100644
--- a/microkde/ksystemtray.cpp
+++ b/microkde/ksystemtray.cpp
@@ -1,11 +1,14 @@
#include "ksystemtray.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QLabel>
void KSystemTray::mousePressEvent( QMouseEvent *)
{
; //qDebug("hallo");
}
KSystemTray::KSystemTray( QWidget *parent ) : QLabel( parent )
{
}
diff --git a/microkde/ksystemtray.h b/microkde/ksystemtray.h
index f3e4f6a..6708c86 100644
--- a/microkde/ksystemtray.h
+++ b/microkde/ksystemtray.h
@@ -1,14 +1,16 @@
#ifndef MICROKDE_KSYSTEMTRAY_H
#define MICROKDE_KSYSTEMTRAY_H
#include <qlabel.h>
+//Added by qt3to4:
+#include <QMouseEvent>
class KSystemTray : public QLabel
{
Q_OBJECT
public:
KSystemTray( QWidget *parent = 0 );
void mousePressEvent( QMouseEvent *);
};
#endif
diff --git a/microkde/ktempfile.cpp b/microkde/ktempfile.cpp
index b9166bd..d61d22e 100644
--- a/microkde/ktempfile.cpp
+++ b/microkde/ktempfile.cpp
@@ -1,25 +1,25 @@
-#include <qtextstream.h>
+#include <q3textstream.h>
#include "ktempfile.h"
KTempFile::KTempFile()
{
}
KTempFile::KTempFile( const QString &filename, const QString &extension )
{
}
void KTempFile::setAutoDelete( bool )
{
}
QString KTempFile::name()
{
return QString::null;
}
-QTextStream *KTempFile::textStream()
+Q3TextStream *KTempFile::textStream()
{
return 0;
}
diff --git a/microkde/ktempfile.h b/microkde/ktempfile.h
index 20dfa82..1ac7258 100644
--- a/microkde/ktempfile.h
+++ b/microkde/ktempfile.h
@@ -1,20 +1,20 @@
#ifndef MINIKDE_KTEMPFILE_H
#define MINIKDE_KTEMPFILE_H
#include <qstring.h>
-class QTextStream;
+class Q3TextStream;
class KTempFile
{
public:
KTempFile();
KTempFile( const QString &filename, const QString &extension );
void setAutoDelete( bool );
QString name();
- QTextStream *textStream();
+ Q3TextStream *textStream();
};
#endif
diff --git a/microkde/ktextedit.cpp b/microkde/ktextedit.cpp
index 4dd6875..d74706b 100644
--- a/microkde/ktextedit.cpp
+++ b/microkde/ktextedit.cpp
@@ -1,53 +1,55 @@
#include <ktextedit.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+//Added by qt3to4:
+#include <QMouseEvent>
#endif
-KTextEdit::KTextEdit ( QWidget *parent ) : QMultiLineEdit( parent )
+KTextEdit::KTextEdit ( QWidget *parent ) : Q3MultiLineEdit( parent )
{
mAllowPopupMenu = false;
mMouseDown = false;
mIgnoreMark = false;
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
}
void KTextEdit::mousePressEvent(QMouseEvent *e)
{
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
mAllowPopupMenu = true;
mYMousePos = mapToGlobal( (e->pos())).y();
mXMousePos = mapToGlobal( (e->pos())).x();
}
- if ( e->button() == RightButton && !mAllowPopupMenu )
+ if ( e->button() == Qt::RightButton && !mAllowPopupMenu )
return;
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
if ( hasMarkedText () )
mIgnoreMark = !mIgnoreMark;
if ( mIgnoreMark && hasMarkedText () ) {
mMouseDown = false;
return ;
}
}
- QMultiLineEdit::mousePressEvent( e );
+ Q3MultiLineEdit::mousePressEvent( e );
}
void KTextEdit::mouseReleaseEvent(QMouseEvent *e)
{
- QMultiLineEdit::mouseReleaseEvent(e);
+ Q3MultiLineEdit::mouseReleaseEvent(e);
}
void KTextEdit::mouseMoveEvent(QMouseEvent *e)
{
int diff = mYMousePos - mapToGlobal( (e->pos())).y();
if ( diff < 0 ) diff = -diff;
int diff2 = mXMousePos - mapToGlobal( (e->pos())).x();
if ( diff2 < 0 ) diff2 = -diff2;
if ( diff+ diff2 > 20 )
mAllowPopupMenu = false;
- QMultiLineEdit::mouseMoveEvent(e);
+ Q3MultiLineEdit::mouseMoveEvent(e);
}
diff --git a/microkde/ktextedit.h b/microkde/ktextedit.h
index 87c0602..b7c8924 100644
--- a/microkde/ktextedit.h
+++ b/microkde/ktextedit.h
@@ -1,23 +1,25 @@
#ifndef MICROKDE_KTEXTEDIT_H
#define MICROKDE_KTEXTEDIT_H
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
+//Added by qt3to4:
+#include <QMouseEvent>
-class KTextEdit : public QMultiLineEdit
+class KTextEdit : public Q3MultiLineEdit
{
public:
KTextEdit( QWidget *parent ) ;
void setIgnoreMark( bool b ) { mIgnoreMark = b; }
private:
bool mAllowPopupMenu;
bool mMouseDown;
bool mIgnoreMark;
int mYMousePos;
int mXMousePos;
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
};
#endif
diff --git a/microkde/kurl.cpp b/microkde/kurl.cpp
index 2574e25..122ad71 100644
--- a/microkde/kurl.cpp
+++ b/microkde/kurl.cpp
@@ -5,131 +5,133 @@
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kurl.h"
#ifndef KDE_QT_ONLY
#include <kdebug.h>
#include <kglobal.h>
//US#include <kidna.h>
#endif
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#ifdef _WIN32_
#else
#include <unistd.h>
#endif
-#include <qurl.h>
+#include <q3url.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qregexp.h>
//US#include <qstylesheet.h>
#include <qmap.h>
#include <qtextcodec.h>
+//Added by qt3to4:
+#include <Q3CString>
static const QString fileProt = "file";
static QTextCodec * codecForHint( int encoding_hint /* not 0 ! */ )
{
return QTextCodec::codecForMib( encoding_hint );
}
static QString encode( const QString& segment, bool encode_slash, int encoding_hint )
{
const char *encode_string;
if (encode_slash)
encode_string = "<>#@\"&%?={}|^~[]\'`\\:+/";
else
encode_string = "<>#@\"&%?={}|^~[]\'`\\:+";
- QCString local;
+ Q3CString local;
if (encoding_hint==0)
local = segment.local8Bit();
else
{
QTextCodec * textCodec = codecForHint( encoding_hint );
if (!textCodec)
local = segment.local8Bit();
else
local = textCodec->fromUnicode( segment );
}
int old_length = local.length();
if ( !old_length )
return segment.isNull() ? QString::null : QString(""); // differenciate null and empty
// a worst case approximation
QChar *new_segment = new QChar[ old_length * 3 + 1 ];
int new_length = 0;
for ( int i = 0; i < old_length; i++ )
{
// 'unsave' and 'reserved' characters
// according to RFC 1738,
// 2.2. URL Character Encoding Issues (pp. 3-4)
// WABA: Added non-ascii
unsigned char character = local[i];
if ( (character <= 32) || (character >= 127) ||
strchr(encode_string, character) )
{
new_segment[ new_length++ ] = '%';
unsigned int c = character / 16;
c += (c > 9) ? ('A' - 10) : '0';
new_segment[ new_length++ ] = c;
c = character % 16;
c += (c > 9) ? ('A' - 10) : '0';
new_segment[ new_length++ ] = c;
}
else
- new_segment[ new_length++ ] = local[i];
+ new_segment[ new_length++ ] = character;
}
QString result = QString(new_segment, new_length);
delete [] new_segment;
return result;
}
static QString encodeHost( const QString& segment, bool encode_slash, int encoding_hint )
{
// Hostnames are encoded differently
// we use the IDNA transformation instead
// Note: when merging qt-addon, use QResolver::domainToAscii here
#ifndef KDE_QT_ONLY
Q_UNUSED( encode_slash );
Q_UNUSED( encoding_hint );
return KIDNA::toAscii(segment);
#else
return encode(segment, encode_slash, encoding_hint);
#endif
}
static int hex2int( unsigned int _char )
{
if ( _char >= 'A' && _char <='F')
return _char - 'A' + 10;
if ( _char >= 'a' && _char <='f')
return _char - 'a' + 10;
if ( _char >= '0' && _char <='9')
return _char - '0';
return -1;
}
@@ -176,65 +178,65 @@ static QString lazy_encode( const QString& segment )
c += (c > 9) ? ('A' - 10) : '0';
new_segment[ new_length++ ] = c;
c = character % 16;
c += (c > 9) ? ('A' - 10) : '0';
new_segment[ new_length++ ] = c;
}
else
new_segment[ new_length++ ] = segment[i];
}
QString result = QString(new_segment, new_length);
delete [] new_segment;
return result;
}
static void decode( const QString& segment, QString &decoded, QString &encoded, int encoding_hint=0, bool updateDecoded = true )
{
decoded = QString::null;
encoded = segment;
int old_length = segment.length();
if ( !old_length )
return;
QTextCodec *textCodec = 0;
if (encoding_hint)
textCodec = codecForHint( encoding_hint );
if (!textCodec)
textCodec = QTextCodec::codecForLocale();
- QCString csegment = textCodec->fromUnicode(segment);
+ Q3CString csegment = textCodec->fromUnicode(segment);
// Check if everything went ok
if (textCodec->toUnicode(csegment) != segment)
{
// Uh oh
textCodec = codecForHint( 106 ); // Fall back to utf-8
csegment = textCodec->fromUnicode(segment);
}
old_length = csegment.length();
int new_length = 0;
int new_length2 = 0;
// make a copy of the old one
char *new_segment = new char[ old_length + 1 ];
QChar *new_usegment = new QChar[ old_length * 3 + 1 ];
int i = 0;
while( i < old_length )
{
bool bReencode = false;
unsigned char character = csegment[ i++ ];
if ((character <= ' ') || (character > 127))
bReencode = true;
new_usegment [ new_length2++ ] = character;
if (character == '%' )
{
int a = i+1 < old_length ? hex2int( csegment[i] ) : -1;
int b = i+1 < old_length ? hex2int( csegment[i+1] ) : -1;
if ((a == -1) || (b == -1)) // Only replace if sequence is valid
{
// Contains stray %, make sure to re-encode!
@@ -249,65 +251,65 @@ static void decode( const QString& segment, QString &decoded, QString &encoded,
new_usegment [ new_length2++ ] = (unsigned char) csegment[i++];
new_usegment [ new_length2++ ] = (unsigned char) csegment[i++];
}
}
if (bReencode)
{
new_length2--;
new_usegment [ new_length2++ ] = '%';
unsigned int c = character / 16;
c += (c > 9) ? ('A' - 10) : '0';
new_usegment[ new_length2++ ] = c;
c = character % 16;
c += (c > 9) ? ('A' - 10) : '0';
new_usegment[ new_length2++ ] = c;
}
new_segment [ new_length++ ] = character;
}
new_segment [ new_length ] = 0;
encoded = QString( new_usegment, new_length2);
// Encoding specified
if (updateDecoded)
{
QByteArray array;
array.setRawData(new_segment, new_length);
decoded = textCodec->toUnicode( array, new_length );
array.resetRawData(new_segment, new_length);
- QCString validate = textCodec->fromUnicode(decoded);
+ Q3CString validate = textCodec->fromUnicode(decoded);
if (strcmp(validate.data(), new_segment) != 0)
{
decoded = QString::fromLocal8Bit(new_segment, new_length);
}
}
delete [] new_segment;
delete [] new_usegment;
}
static QString decode(const QString &segment, int encoding_hint = 0)
{
QString result;
QString tmp;
decode(segment, result, tmp, encoding_hint);
return result;
}
static QString cleanpath(const QString &path, bool cleanDirSeparator=true)
{
if (path.isEmpty()) return QString::null;
int len = path.length();
bool slash = (len && path[len-1] == '/') ||
(len > 1 && path[len-2] == '/' && path[len-1] == '.');
// The following code cleans up directory path much like
// QDir::cleanDirPath() except it can be made to ignore multiple
// directory separators by setting the flag to false. That fixes
// bug# 15044, mail.altavista.com and other similar brain-dead server
// implementations that do not follow what has been specified in
// RFC 2396!! (dA)
@@ -390,106 +392,106 @@ QStringList KURL::List::toStringList() const
for( KURL::List::ConstIterator it = begin();
it != end();
it++)
{
lst.append( (*it).url() );
}
return lst;
}
KURL::KURL()
{
reset();
}
KURL::~KURL()
{
}
KURL::KURL( const QString &url, int encoding_hint )
{
reset();
parse( url, encoding_hint );
}
KURL::KURL( const char * url, int encoding_hint )
{
reset();
parse( QString::fromLatin1(url), encoding_hint );
}
-KURL::KURL( const QCString& url, int encoding_hint )
+KURL::KURL( const Q3CString& url, int encoding_hint )
{
reset();
parse( QString::fromLatin1(url), encoding_hint );
}
KURL::KURL( const KURL& _u )
{
*this = _u;
}
QDataStream & operator<< (QDataStream & s, const KURL & a)
{
QString QueryForWire=a.m_strQuery_encoded;
if (!a.m_strQuery_encoded.isNull())
QueryForWire.prepend("?");
s << a.m_strProtocol << a.m_strUser << a.m_strPass << a.m_strHost
<< a.m_strPath << a.m_strPath_encoded << QueryForWire << a.m_strRef_encoded
<< Q_INT8(a.m_bIsMalformed ? 1 : 0) << a.m_iPort;
return s;
}
QDataStream & operator>> (QDataStream & s, KURL & a)
{
Q_INT8 malf;
QString QueryFromWire;
s >> a.m_strProtocol >> a.m_strUser >> a.m_strPass >> a.m_strHost
>> a.m_strPath >> a.m_strPath_encoded >> QueryFromWire >> a.m_strRef_encoded
>> malf >> a.m_iPort;
a.m_bIsMalformed = (malf != 0);
if ( QueryFromWire.isEmpty() )
a.m_strQuery_encoded = QString::null;
else
a.m_strQuery_encoded = QueryFromWire.mid(1);
return s;
}
#ifndef QT_NO_NETWORKPROTOCOL
-KURL::KURL( const QUrl &u )
+KURL::KURL( const Q3Url &u )
{
*this = u;
}
#endif
KURL::KURL( const KURL& _u, const QString& _rel_url, int encoding_hint )
{
// WORKAROUND THE RFC 1606 LOOPHOLE THAT ALLOWS
// http:/index.html AS A VALID SYNTAX FOR RELATIVE
// URLS. ( RFC 2396 section 5.2 item # 3 )
QString rUrl = _rel_url;
int len = _u.m_strProtocol.length();
if ( !_u.m_strHost.isEmpty() && !rUrl.isEmpty() &&
rUrl.find( _u.m_strProtocol, 0, false ) == 0 &&
rUrl[len] == ':' && (rUrl[len+1] != '/' ||
(rUrl[len+1] == '/' && rUrl[len+2] != '/')) )
{
rUrl.remove( 0, rUrl.find( ':' ) + 1 );
}
if ( rUrl.isEmpty() )
{
*this = _u;
}
else if ( rUrl[0] == '#' )
{
*this = _u;
QString ref = decode(rUrl.mid(1), encoding_hint);
if ( ref.isNull() )
ref = ""; // we know there was an (empty) html ref, we saw the '#'
setHTMLRef( ref );
}
@@ -560,71 +562,71 @@ void KURL::reset()
bool KURL::isEmpty() const
{
return (m_strPath.isEmpty() && m_strProtocol.isEmpty());
}
void KURL::parse( const QString& _url, int encoding_hint )
{
//kdDebug(126) << "parse " << _url << endl;
// Return immediately whenever the given url
// is empty or null.
if ( _url.isEmpty() )
{
m_strProtocol = _url;
return;
}
QString port;
bool badHostName = false;
int start = 0;
uint len = _url.length();
const QChar* buf = _url.unicode();
const QChar* orig = buf;
QChar delim;
QString tmp;
uint pos = 0;
// Node 1: Accept alpha or slash
QChar x = buf[pos++];
if ( x == '/' )
goto Node9;
- if ( !isalpha( (int)x ) )
+ if ( !x.isLetter() )
goto NodeErr;
// Node 2: Accept any amount of (alpha|digit|'+'|'-')
// '.' is not currently accepted, because current KURL may be confused.
// Proceed with :// :/ or :
- while( pos < len && (isalpha((int)buf[pos]) || isdigit((int)buf[pos]) ||
+ while( pos < len && ( buf[pos].isLetter() || buf[pos].isDigit() ||
buf[pos] == '+' || buf[pos] == '-')) pos++;
if ( pos+2 < len && buf[pos] == ':' && buf[pos+1] == '/' && buf[pos+2] == '/' )
{
m_strProtocol = QString( orig, pos ).lower();
pos += 3;
}
else if (pos+1 < len && buf[pos] == ':' ) // Need to always compare length()-1 otherwise KURL passes "http:" as legal!!
{
m_strProtocol = QString( orig, pos ).lower();
//kdDebug(126)<<"setting protocol to "<<m_strProtocol<<endl;
pos++;
start = pos;
goto Node9;
}
else
goto NodeErr;
//Node 3: We need at least one character here
if ( pos == len )
goto NodeErr;
start = pos;
// Node 4: Accept any amount of characters.
if (buf[pos] == '[') // An IPv6 host follows.
goto Node8;
// Terminate on / or @ or ? or # or " or ; or <
x = buf[pos];
while( (x != ':') && (x != '@') && (x != '/') && (x != '?') && (x != '#') )
{
if ((x == '\"') || (x == ';') || (x == '<'))
badHostName = true;
@@ -740,69 +742,69 @@ void KURL::parse( const QString& _url, int encoding_hint )
x = buf[pos];
while( (x != ':') && (x != '@') && (x != '/') && (x != '?') && (x != '#') )
{
if ((x == '\"') || (x == ';') || (x == '<'))
badHostName = true;
if (++pos == len)
break;
x = buf[pos];
}
if (badHostName)
goto NodeErr;
if ( pos == len )
{
setHost(decode(QString( buf + start, pos - start ), encoding_hint));
goto NodeOk;
}
setHost(decode(QString( buf + start, pos - start ), encoding_hint));
}
x = buf[pos];
if ( x == '/' )
{
start = pos++;
goto Node9;
}
else if ( x != ':' )
goto NodeErr;
pos++;
// Node 8a: Accept at least one digit
if ( pos == len )
goto NodeErr;
start = pos;
- if ( !isdigit( buf[pos++] ) )
+ if ( !buf[pos++].isDigit() )
goto NodeErr;
// Node 8b: Accept any amount of digits
- while( pos < len && isdigit( buf[pos] ) ) pos++;
+ while( pos < len && buf[pos].isDigit() ) pos++;
port = QString( buf + start, pos - start );
m_iPort = port.toUShort();
if ( pos == len )
goto NodeOk;
start = pos++;
Node9: // parse path until query or reference reached
while( pos < len && buf[pos] != '#' && buf[pos]!='?' ) pos++;
tmp = QString( buf + start, pos - start );
//kdDebug(126)<<" setting encoded path&query to:"<<tmp<<endl;
setEncodedPath( tmp, encoding_hint );
if ( pos == len )
goto NodeOk;
//Node10: // parse query or reference depending on what comes first
delim = (buf[pos++]=='#'?'?':'#');
start = pos;
while(pos < len && buf[pos]!=delim ) pos++;
tmp = QString(buf + start, pos - start);
if (delim=='#')
setQuery(tmp, encoding_hint);
else
m_strRef_encoded = tmp;
if (pos == len)
goto NodeOk;
@@ -819,65 +821,65 @@ void KURL::parse( const QString& _url, int encoding_hint )
m_bIsMalformed = false; // Valid URL
//kdDebug()<<"Prot="<<m_strProtocol<<"\nUser="<<m_strUser<<"\nPass="<<m_strPass<<"\nHost="<<m_strHost<<"\nPath="<<m_strPath<<"\nQuery="<<m_strQuery_encoded<<"\nRef="<<m_strRef_encoded<<"\nPort="<<m_iPort<<endl;
if (m_strProtocol.isEmpty())
{
m_strProtocol = fileProt;
}
return;
NodeErr:
// kdDebug(126) << "KURL couldn't parse URL \"" << _url << "\"" << endl;
reset();
m_strProtocol = _url;
}
KURL& KURL::operator=( const QString& _url )
{
reset();
parse( _url );
return *this;
}
KURL& KURL::operator=( const char * _url )
{
reset();
parse( QString::fromLatin1(_url) );
return *this;
}
#ifndef QT_NO_NETWORKPROTOCOL
-KURL& KURL::operator=( const QUrl & u )
+KURL& KURL::operator=( const Q3Url & u )
{
m_strProtocol = u.protocol();
m_strUser = u.user();
m_strPass = u.password();
m_strHost = u.host();
m_strPath = u.path( FALSE );
m_strPath_encoded = QString::null;
m_strQuery_encoded = u.query();
m_strRef_encoded = u.ref();
m_bIsMalformed = !u.isValid();
m_iPort = u.port();
return *this;
}
#endif
KURL& KURL::operator=( const KURL& _u )
{
m_strProtocol = _u.m_strProtocol;
m_strUser = _u.m_strUser;
m_strPass = _u.m_strPass;
m_strHost = _u.m_strHost;
m_strPath = _u.m_strPath;
m_strPath_encoded = _u.m_strPath_encoded;
m_strQuery_encoded = _u.m_strQuery_encoded;
m_strRef_encoded = _u.m_strRef_encoded;
m_bIsMalformed = _u.m_bIsMalformed;
m_iPort = _u.m_iPort;
return *this;
}
@@ -1345,109 +1347,109 @@ KURL::List KURL::split( const KURL& _url )
{
ref = url.m_strRef_encoded;
break;
}
}
// Set HTML ref in all URLs.
KURL::List::Iterator it;
for( it = lst.begin() ; it != lst.end(); ++it )
{
(*it).m_strRef_encoded = ref;
}
return lst;
}
KURL::List KURL::split( const QString& _url )
{
return split(KURL(_url));
}
KURL KURL::join( const KURL::List & lst )
{
if (lst.isEmpty()) return KURL();
KURL tmp;
KURL::List::ConstIterator first = lst.fromLast();
for( KURL::List::ConstIterator it = first; it != lst.end(); --it )
{
KURL u(*it);
if (it != first)
{
- if (!u.m_strRef_encoded) u.m_strRef_encoded = tmp.url();
+ if (u.m_strRef_encoded.isEmpty()) u.m_strRef_encoded = tmp.url();
else u.m_strRef_encoded += "#" + tmp.url(); // Support more than one suburl thingy
}
tmp = u;
}
return tmp;
}
QString KURL::fileName( bool _strip_trailing_slash ) const
{
QString fname;
if (hasSubURL()) { // If we have a suburl, then return the filename from there
KURL::List list = KURL::split(*this);
KURL::List::Iterator it = list.fromLast();
return (*it).fileName(_strip_trailing_slash);
}
const QString &path = m_strPath;
int len = path.length();
if ( len == 0 )
return fname;
if ( _strip_trailing_slash )
{
while ( len >= 1 && path[ len - 1 ] == '/' )
len--;
}
else if ( path[ len - 1 ] == '/' )
return fname;
// Does the path only consist of '/' characters ?
if ( len == 1 && path[ 0 ] == '/' )
return fname;
// Skip last n slashes
int n = 1;
if (!m_strPath_encoded.isEmpty())
{
// This is hairy, we need the last unencoded slash.
// Count in the encoded string how many encoded slashes follow the last
// unencoded one.
int i = m_strPath_encoded.findRev( '/', len - 1 );
QString fileName_encoded = m_strPath_encoded.mid(i+1);
- n += fileName_encoded.contains("%2f", false);
+ n += fileName_encoded.count("%2f", Qt::CaseInsensitive);
}
int i = len;
do {
i = path.findRev( '/', i - 1 );
}
while (--n && (i > 0));
// If ( i == -1 ) => the first character is not a '/'
// So it's some URL like file:blah.tgz, return the whole path
if ( i == -1 ) {
if ( len == (int)path.length() )
fname = path;
else
// Might get here if _strip_trailing_slash is true
fname = path.left( len );
}
else
{
fname = path.mid( i + 1, len - i - 1 ); // TO CHECK
}
return fname;
}
void KURL::addPath( const QString& _txt )
{
if (hasSubURL())
{
KURL::List lst = split( *this );
KURL &u = lst.last();
u.addPath(_txt);
*this = join( lst );
return;
diff --git a/microkde/kurl.h b/microkde/kurl.h
index cd65a1c..016eb24 100644
--- a/microkde/kurl.h
+++ b/microkde/kurl.h
@@ -1,99 +1,101 @@
/* This file is part of the KDE libraries
* Copyright (C) 1999 Torben Weis <weis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
**/
#ifndef __kurl_h__
#define __kurl_h__ "$Id$"
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <Q3CString>
-class QUrl;
+class Q3Url;
class QStringList;
template <typename K, typename V> class QMap;
class KURLPrivate;
/**
* Represents and parses a URL.
*
* A prototypical URL looks like:
* <pre>
* protocol:/user:password\@hostname:port/path/to/file.ext#reference
* </pre>
*
* KURL has some restrictions regarding the path
* encoding. KURL works internally with the decoded path and
* and encoded query. For example,
* <pre>
* http://localhost/cgi-bin/test%20me.pl?cmd=Hello%20you
* </pre>
* would result in a decoded path "/cgi-bin/test me.pl"
* and in the encoded query "?cmd=Hello%20you".
* Since path is internally always encoded you may @em not use
* "%00" in the path, although this is OK for the query.
*
* @author Torben Weis <weis@kde.org>
*/
class KURL
{
public:
enum AdjustementFlags
{
NoAdjustements = 0,
StripFileProtocol = 1
};
/**
* KURL::List is a QValueList that contains KURLs with a few
* convenience methods.
* @see KURL
* @see QValueList
*/
- class List : public QValueList<KURL>
+ class List : public Q3ValueList<KURL>
{
public:
/**
* Creates an empty List.
*/
List() { }
/**
* Creates a list that contains the given URL as only
* item.
* @param url the url to add.
*/
List(const KURL &url);
/**
* Creates a list that contains the URLs from the given
* list.
* @param list the list containing the URLs as strings
*/
List(const QStringList &list);
/**
* Converts the URLs of this list to a list of strings.
* @return the list of strings
*/
QStringList toStringList() const;
};
/**
* Constructs an empty URL.
*/
KURL();
/**
* Destructs the KURL object.
*/
@@ -106,75 +108,75 @@ public:
* It is dangerous to feed unix filenames into this function,
* this will work most of the time but not always.
* For example "/home/Torben%20Weis" will be considered a URL
* pointing to the file "/home/Torben Weis" instead of to the
* file "/home/Torben%20Weis".
* This means that if you have a usual UNIX like path you
* should not use this constructor.
* Instead create an empty url and set the path by using
* @ref setPath().
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
KURL( const QString& url, int encoding_hint = 0 );
/**
* Constructor taking a char * @p url, which is an _encoded_ representation
* of the URL, exactly like the usual constructor. This is useful when
* then URL, in its encoded form, is strictly ascii.
* @param url A encoded URL. If the URL does not have a protocol part,
* "file:" is assumed.
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
KURL( const char * url, int encoding_hint = 0 );
/**
* Constructor taking a QCString @p url, which is an _encoded_ representation
* of the URL, exactly like the usual constructor. This is useful when
* then URL, in its encoded form, is strictly ascii.
* @param url A encoded URL. If the URL does not have a protocol part,
* "file:" is assumed.
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
- KURL( const QCString& url, int encoding_hint = 0 );
+ KURL( const Q3CString& url, int encoding_hint = 0 );
/**
* Copy constructor.
* @param u the KURL to copy
*/
KURL( const KURL& u );
/**
* Converts from a @ref QUrl.
* @param u the QUrl
*/
- KURL( const QUrl &u );
+ KURL( const Q3Url &u );
/**
* Constructor allowing relative URLs.
*
* @param _baseurl The base url.
* @param _rel_url A relative or absolute URL.
* If this is an absolute URL then @p _baseurl will be ignored.
* If this is a relative URL it will be combined with @p _baseurl.
* Note that _rel_url should be encoded too, in any case.
* So do NOT pass a path here (use setPath or addPath instead).
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
KURL( const KURL& _baseurl, const QString& _rel_url, int encoding_hint=0 );
/**
* Returns the protocol for the URL (i.e., file, http, etc.).
* @return the protocol of the URL, does not include the colon. If the
* URL is malformed, QString::null will be returned.
**/
QString protocol() const { return m_bIsMalformed ? QString::null : m_strProtocol; }
/**
* Sets the protocol for the URL (i.e., file, http, etc.)
* @param _txt the new protocol of the URL (without colon)
**/
void setProtocol( const QString& _txt );
/**
* Returns the decoded user name (login, user id, ...) included in the URL.
* @return the user name or QString::null if there is no user name
**/
QString user() const { return m_strUser; }
/**
@@ -629,65 +631,65 @@ public:
/**
* Returns the URL as string, escaped for HTML.
* Example:
* <pre>
* http://localhost:8080/test.cgi?test=hello world&name=fred
* </pre>
* @return A human readable URL, with no non-necessary encodings/escaped
* characters. Password will not be shown.
*/
QString prettyURL( int _trailing, AdjustementFlags _flags) const;
// ### BIC: Merge the two above
/**
* Test to see if the KURL is empty.
* @return true if the URL is empty
**/
bool isEmpty() const;
/**
* This function is useful to implement the "Up" button in a file manager for example.
* @ref cd() never strips a sub-protocol. That means that if you are in
* file:/home/x.tgz#gzip:/#tar:/ and hit the up button you expect to see
* file:/home. The algorithm tries to go up on the right-most URL. If that is not
* possible it strips the right most URL. It continues stripping URLs.
* @return a URL that is a level higher
*/
KURL upURL( ) const;
KURL& operator=( const KURL& _u );
KURL& operator=( const QString& _url );
KURL& operator=( const char * _url );
- KURL& operator=( const QUrl & u );
+ KURL& operator=( const Q3Url & u );
bool operator==( const KURL& _u ) const;
bool operator==( const QString& _u ) const;
bool operator!=( const KURL& _u ) const { return !( *this == _u ); }
bool operator!=( const QString& _u ) const { return !( *this == _u ); }
/**
* The same as equals(), just with a less obvious name.
* Compares this url with @p u.
* @param ignore_trailing set to true to ignore trailing '/' characters.
* @return true if both urls are the same
* @see operator==. This function should be used if you want to
* ignore trailing '/' characters.
* @deprecated
*/
bool cmp( const KURL &u, bool ignore_trailing = false ) const;
/**
* Compares this url with @p u.
* @param ignore_trailing set to true to ignore trailing '/' characters.
* @return true if both urls are the same
* @see operator==. This function should be used if you want to
* ignore trailing '/' characters.
* @since 3.1
*/
bool equals( const KURL &u, bool ignore_trailing = false ) const;
/**
* Checks whether the given URL is parent of this URL.
* For instance, ftp://host/dir/ is a parent of ftp://host/dir/subdir/subsubdir/.
* @return true if this url is a parent of @p u (or the same URL as @p u)
*/
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index 9c87682..88f17e5 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,190 +1,192 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qcursor.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <QPixmap>
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
//US #include <klibloader.h>
#include <krun.h>
#include <kprocess.h>
#include <kglobalsettings.h>
#include "kcmultidialog.h"
//US #include "kcmultidialog.moc"
//US #include "kcmoduleloader.h"
KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
: KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
parent, name, modal, true), d(0L)
{
setFont( KGlobalSettings::generalMaxFont() );
enableButton(Apply, false);
//connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
_baseGroup = baseGroup;
mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
setMainWidget(mMainWidget );
#ifdef DESKTOP_VERSION
resize(640,480);
#else
//resize(640,480);
//setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
resize(800,800);
setMaximumSize( 800, 800 );
//showMaximized();
#endif
}
KCMultiDialog::~KCMultiDialog()
{
//US moduleDict.setAutoDelete(true);
}
void KCMultiDialog::slotDefault()
{
int curPageIndex = activePageIndex();
- QPtrListIterator<KCModule> it(modules);
+ Q3PtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
{
if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
{
(*it)->defaults();
clientChanged(true);
return;
}
}
}
void KCMultiDialog::accept()
{
slotOk();
}
void KCMultiDialog::slotApply()
{
- QPtrListIterator<KCModule> it(modules);
+ Q3PtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
(*it)->save();
clientChanged(false);
emit applyClicked();
}
void KCMultiDialog::slotOk()
{
qDebug("KCMultiDialog::slotOk clicked");
- QPtrListIterator<KCModule> it(modules);
+ Q3PtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
(*it)->save();
QDialog::accept();
emit okClicked();
}
void KCMultiDialog::slotHelp()
{
/*US
KURL url( KURL("help:/"), _docPath );
if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
KProcess process;
process << "khelpcenter"
<< url.url();
process.start(KProcess::DontCare);
process.detach();
} else {
new KRun(url);
}
*/
}
void KCMultiDialog::clientChanged(bool state)
{
enableButton(Apply, state);
}
/*US
void KCMultiDialog::addModule(const QString& path, bool withfallback)
{
kdDebug(1208) << "KCMultiDialog::addModule " << path << endl;
KCModuleInfo info(path, _baseGroup);
QHBox* page = addHBoxPage(info.moduleName(), info.comment(),
KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium));
if(!page) {
KCModuleLoader::unloadModule(info);
return;
}
moduleDict.insert(page, new LoadInfo(path, withfallback));
if (modules.isEmpty())
slotAboutToShow(page);
}
*/
-QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
+Q3VBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
{
- QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
+ Q3VBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
return page;
}
//US special method for microkde. We dop noty want to load everything dynamically.
void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
{
modules.append(module);
connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
//US
module->load();
}
void KCMultiDialog::slotAboutToShow(QWidget *page)
{
/*US
LoadInfo *loadInfo = moduleDict[page];
if (!loadInfo)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
moduleDict.remove(page);
KCModuleInfo info(loadInfo->path, _baseGroup);
KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
if (!module)
{
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index 66412ac..78f8a00 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -1,151 +1,151 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCMULTIDIALOG_H
#define KCMULTIDIALOG_H
-#include <qptrlist.h>
-#include <qptrdict.h>
+#include <q3ptrlist.h>
+#include <q3ptrdict.h>
#include <kdialogbase.h>
#include <kjanuswidget.h>
#include <kcmodule.h>
/**
* A class that offers a @ref KDialogBase containing arbitrary KControl Modules
*
* @short A method that offers a @ref KDialogBase containing arbitrary
* KControl Modules.
*
* @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org>
* @since 3.2
*/
class KCMultiDialog : public KDialogBase
{
Q_OBJECT
public:
/**
* Constructs a new KCMultiDialog
*
* @param parent The parent Widget
* @param name The widget name
* @param baseGroup The baseGroup, if you want to call a module out of
* kcontrol, just keep "settings"
* @param modal If you pass true here, the dialog will be modal
**/
KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"),
QWidget *parent=0, const char *name=0,
bool modal=false);
/**
* Destructor
**/
virtual ~KCMultiDialog();
/**
* Add a module.
*
* @param module Specify the name of the module that is to be added
* to the list of modules the dialog will show.
*
* @param withfallback Try harder to load the module. Might result
* in the module appearing outside the dialog.
**/
//US void addModule(const QString& module, bool withfallback=true);
//US special method for microkde. We do not want to load everything dynamically.
void addModule(KCModule* module );//, const QString& modulename, const QString& iconname);
- QVBox* getNewVBoxPage(const QString & modulename) ;
+ Q3VBox* getNewVBoxPage(const QString & modulename) ;
bool showPage( int index );
int activePageIndex() const;
int pageIndex( QWidget *widget ) const;
protected slots:
/**
* This slot is called when the user presses the "Default" Button
* You can reimplement it if needed.
*
* @note Make sure you call the original implementation!
**/
virtual void slotDefault();
/**
* This slot is called when the user presses the "Apply" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotApply();
/**
* This slot is called when the user presses the "OK" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotOk();
/**
* This slot is called when the user presses the "Help" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotHelp();
void accept();
private slots:
void slotAboutToShow(QWidget *);
void clientChanged(bool state);
private:
/*US
struct LoadInfo {
LoadInfo(const QString &_path, bool _withfallback)
: path(_path), withfallback(_withfallback)
{ }
QString path;
bool withfallback;
};
*/
- QPtrList<KCModule> modules;
+ Q3PtrList<KCModule> modules;
/*
QPtrDict<LoadInfo> moduleDict;
QString _docPath;
*/
QString _baseGroup;
//US
KJanusWidget* mMainWidget;
// For future use
class KCMultiDialogPrivate;
KCMultiDialogPrivate *d;
};
#endif //KCMULTIDIALOG_H
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 7120bdd..4ff06a3 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -1,41 +1,41 @@
TEMPLATE = lib
CONFIG += qt warn_on
include( ../variables.pri )
#INCLUDEPATH += $(QTDIR)/include .
#DEPENDPATH += $(QTDIR)/include
INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio
#LIBS += -lqtcompat
-TARGET = microkde
+TARGET = xmicrokde
DESTDIR= ../bin
DEFINES += DESKTOP_VERSION KDE_QT_ONLY
unix : {
staticlib: {
INCLUDEPATH += ../kabc/plugins
DEFINES += STATIC_RESOURCES
}
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
HEADERS = \
qlayoutengine_p.h \
KDGanttMinimizeSplitter.h \
kapplication.h \
kaudioplayer.h \
kcalendarsystem.h \
kcalendarsystemgregorian.h \
kcolorbutton.h \
kcombobox.h \
kconfig.h \
kdatetbl.h \
kdebug.h \
@@ -149,32 +149,34 @@ KDGanttMinimizeSplitter.cpp \
kdeui/kguiitem.cpp \
kdeui/kjanuswidget.cpp \
kdeui/klistbox.cpp \
kdeui/klistview.cpp \
kdeui/knuminput.cpp \
kdeui/knumvalidator.cpp \
kdeui/kseparator.cpp \
kdeui/ksqueezedtextlabel.cpp \
kio/kio/kdirwatch.cpp \
kio/kfile/kurlrequester.cpp \
kresources/configpage.cpp \
kresources/configdialog.cpp \
kresources/configwidget.cpp \
kresources/factory.cpp \
kresources/kcmkresources.cpp \
kresources/managerimpl.cpp \
kresources/resource.cpp \
kresources/selectdialog.cpp \
kutils/kcmultidialog.cpp \
kdeui/kaction.cpp \
kdeui/kpopupmenu.cpp \
kdeui/kactionclasses.cpp \
kdeui/kactioncollection.cpp \
kdeui/kmainwindow.cpp \
kdeui/ktoolbar.cpp \
kdeui/ktoolbarbutton.cpp \
kdeui/ktoolbarhandler.cpp \
kdeui/kstdaction.cpp \
kdeui/kxmlguiclient.cpp \
kdecore/kprefs.cpp \
kdecore/klibloader.cpp \
kidmanager.cpp
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro
index 8fe2bd5..514e7b3 100644
--- a/microkde/microkdeE.pro
+++ b/microkde/microkdeE.pro
@@ -1,42 +1,42 @@
TEMPLATE = lib
CONFIG += qt warn_on
INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include
DEPENDPATH += $(QPEDIR)/include
LIBS += -lmicroqtcompat -L$(QPEDIR)/lib
DEFINES += KDE_QT_ONLY
-TARGET = microkde
+TARGET = xmicrokde
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
qlayoutengine_p.h fncolordialog.h\
KDGanttMinimizeSplitter.h \
kapplication.h \
kaudioplayer.h \
kcalendarsystem.h \
kcalendarsystemgregorian.h \
kcolorbutton.h \
kcolordialog.h \
kcombobox.h \
kconfig.h \
kdatetbl.h \
kdebug.h \
kdialog.h \
kdialogbase.h \
keditlistbox.h \
kemailsettings.h \
kfiledialog.h \
kfontdialog.h \
kglobal.h \
kglobalsettings.h \
kiconloader.h \
klineedit.h \
klineeditdlg.h \
kmessagebox.h \
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index f4f112e..0f95c84 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -236,65 +236,65 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st
box->setSpacing( 0 );
QToolButton *btn = new QToolButton( box );
btn->setIconSet( Resource::loadPixmap("up") );
connect(btn, SIGNAL(clicked() ),
this, SLOT( cdUP() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadPixmap("home") );
connect(btn, SIGNAL(clicked() ),
this, SLOT( cdHome() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadPixmap("DocsIcon") );
connect(btn, SIGNAL(clicked() ),
this, SLOT(cdDoc() ) );
m_btnNew = new QToolButton( box );
m_btnNew->setIconSet( Resource::loadPixmap("new") );
connect(m_btnNew, SIGNAL(clicked() ),
this, SLOT(slotNew() ) );
m_btnClose = new QToolButton( box );
m_btnClose->setIconSet( Resource::loadPixmap("close") );
connect(m_btnClose, SIGNAL(clicked() ),
selector(), SIGNAL(closeMe() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") );
/* let's fill device parts */
- QPopupMenu* pop = new QPopupMenu(this);
+ Q3PopupMenu* pop = new Q3PopupMenu(this);
connect(pop, SIGNAL( activated(int) ),
this, SLOT(slotFSActivated(int) ) );
StorageInfo storage;
const QList<FileSystem> &fs = storage.fileSystems();
QListIterator<FileSystem> it(fs);
for ( ; it.current(); ++it ) {
const QString disk = (*it)->name();
const QString path = (*it)->path();
m_dev.insert( disk, path );
pop->insertItem( disk );
}
m_fsPop = pop;
btn->setPopup( pop );
btn->setPopupDelay ( 0 );
lay->addWidget( box );
m_view = new QListView( this );
m_view->installEventFilter(this);
QPEApplication::setStylusOperation( m_view->viewport(),
QPEApplication::RightOnHold);
m_view->addColumn(" " );
m_view->addColumn(i18n("Name"), 150 );
m_view->addColumn(i18n("Size"), -1 );
m_view->addColumn(i18n("Date"), -1 );
m_view->addColumn(i18n("Mime Type"), -1 );
diff --git a/microkde/ofileselector_p.h b/microkde/ofileselector_p.h
index 834fd70..a7d97fe 100644
--- a/microkde/ofileselector_p.h
+++ b/microkde/ofileselector_p.h
@@ -108,65 +108,65 @@ private:
class OFileViewFileListView : public QWidget {
Q_OBJECT
public:
OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
~OFileViewFileListView();
OFileSelectorItem* currentItem()const;
void reread( bool all = false );
int fileCount()const;
QString currentDir()const;
protected:
bool eventFilter (QObject *o, QEvent *e);
private slots:
void slotNew(); // will emit newSelected
void cdUP();
void cdHome();
void cdDoc();
void changeDir( const QString& );
void slotCurrentChanged( QListViewItem* );
void slotClicked(int, QListViewItem*, const QPoint&, int );
void slotDoubleClicked(QListViewItem*);
void slotFSActivated(int);
protected:
OFileSelector* selector();
private:
QMap<QString, QString> m_dev;
bool m_all : 1;
OFileSelector* m_sel;
- QPopupMenu* m_fsPop;
+ Q3PopupMenu* m_fsPop;
bool compliesMime( const QString& );
QStringList m_mimes; // used in compy mime
QString m_currentDir;
QToolButton *m_btnNew, *m_btnClose;
void connectSlots();
void addFile( QFileInfo* info, bool symlink = FALSE );
void addDir ( QFileInfo* info, bool symlink = FALSE );
void addSymlink( QFileInfo* info, bool = FALSE );
private:
QListView* m_view;
};
typedef QMap<QString, QStringList> MimeTypes;
class OFileViewInterface;
class OFileViewFileListView;
class QLineEdit;
class QComboBox;
class QWidgetStack;
class QHBox;
class OFileSelector : public QWidget {
Q_OBJECT
friend class OFileViewInterface;
friend class OFileViewFileListView;
public:
enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
// enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2};
diff --git a/microkde/qlayoutengine_p.h b/microkde/qlayoutengine_p.h
index 2d6a556..e782703 100644
--- a/microkde/qlayoutengine_p.h
+++ b/microkde/qlayoutengine_p.h
@@ -1,111 +1,109 @@
+//Added by qt3to4:
+#include <Q3MemArray>
// THIS IS A COPY OF THE FILE FOUND IN $QTDIR/src/kernel. Needed to modify qsplitter
/****************************************************************************
** $Id$
**
** Internal header file.
**
** Created : 981027
**
** Copyright (C) 1998-99 by Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QLAYOUTENGINE_P_H
#define QLAYOUTENGINE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of qlayout.cpp, qlayoutengine.cpp, qmainwindow.cpp and qsplitter.cpp.
// This header file may change from version to version without notice,
// or even be removed.
//
// We mean it.
//
//
-#ifndef QT_H
-#include "qabstractlayout.h"
-#endif // QT_H
-
#ifndef QT_NO_LAYOUT
struct QLayoutStruct
{
void initParameters() { minimumSize = sizeHint = 0;
maximumSize = QWIDGETSIZE_MAX; expansive = FALSE; empty = TRUE; }
void init() { stretch = 0; initParameters(); }
//permanent storage:
int stretch;
//parameters:
QCOORD sizeHint;
QCOORD maximumSize;
QCOORD minimumSize;
bool expansive;
bool empty;
//temporary storage:
bool done;
//result:
int pos;
int size;
};
-void qGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void qGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer );
/*
Modify total maximum (max) and total expansion (exp)
when adding boxmax/boxexp.
Expansive boxes win over non-expansive boxes.
*/
static inline void qMaxExpCalc( QCOORD & max, bool &exp,
QCOORD boxmax, bool boxexp )
{
if ( exp ) {
if ( boxexp )
max = QMAX( max, boxmax );
} else {
if ( boxexp )
max = boxmax;
else
max = QMIN( max, boxmax );
}
exp = exp || boxexp;
}
#endif //QT_NO_LAYOUT
#endif
diff --git a/pwmanager/libcrypt/cipher/cipher.pro b/pwmanager/libcrypt/cipher/cipher.pro
index ad96201..7e1a330 100644
--- a/pwmanager/libcrypt/cipher/cipher.pro
+++ b/pwmanager/libcrypt/cipher/cipher.pro
@@ -39,32 +39,34 @@ SOURCES += ac.c \
sha1.c \
sha256.c \
sha512.c \
tiger.c \
twofish.c
# rndw32.c \
HEADERS += ../crypt/ath.h \
../crypt/cipher.h \
../crypt/g10lib.h \
../crypt/gcrypt-module.h \
../crypt/gcrypt.h \
../crypt/mpi.h \
../crypt/secmem.h \
../crypt/stdmem.h \
../crypt/types.h
SOURCES += ../crypt/ath.c \
../crypt/global.c \
../crypt/misc.c \
../crypt/missing-string.c \
../crypt/module.c \
../crypt/secmem.c \
../crypt/sexp.c \
../crypt/stdmem.c
#LIBS += -L../$(PLATFORM)
#LIBS += -lgcrypt -lmpi -lerror
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/pwmanager/libcrypt/error/error.pro b/pwmanager/libcrypt/error/error.pro
index 8c5f667..e96bcee 100644
--- a/pwmanager/libcrypt/error/error.pro
+++ b/pwmanager/libcrypt/error/error.pro
@@ -1,32 +1,34 @@
######################################################################
# Automatically generated by qmake (1.07a) Tue Oct 19 15:09:32 2004
######################################################################
TEMPLATE = lib
CONFIG += staticlib
INCLUDEPATH += .
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR= ../$(PLATFORM)
TARGET = kpmicroerror
# Input
HEADERS += code-from-errno.h \
code-to-errno.h \
err-codes-sym.h \
err-codes.h \
err-sources-sym.h \
err-sources.h \
errnos-sym.h \
gettext.h
SOURCES += code-from-errno.c \
code-to-errno.c \
strerror-sym.c \
strerror.c \
strsource-sym.c \
strsource.c
# gpg-error.c \
# gpg-error.h \
# mkerrcodes.h
- # mkerrcodes.c \ \ No newline at end of file
+ # mkerrcodes.c \
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/pwmanager/libcrypt/mpi/mpi.pro b/pwmanager/libcrypt/mpi/mpi.pro
index 4eb6346..d213bc3 100644
--- a/pwmanager/libcrypt/mpi/mpi.pro
+++ b/pwmanager/libcrypt/mpi/mpi.pro
@@ -11,32 +11,34 @@ MOC_DIR = moc/$(PLATFORM)
DESTDIR= ../$(PLATFORM)
TARGET = kpmicrompi
# Input
HEADERS += asm-syntax.h \
longlong.h \
generic/mpi-asm-defs.h \
mpi-inline.h \
mpi-internal.h \
sysdep.h
SOURCES += mpi-add.c \
mpi-bit.c \
mpi-cmp.c \
mpi-div.c \
mpi-gcd.c \
mpi-inline.c \
mpi-inv.c \
mpi-mpow.c \
mpi-mul.c \
mpi-pow.c \
mpi-scan.c \
mpicoder.c \
mpih-div.c \
mpih-mul.c \
mpiutil.c \
generic/mpih-add1.c \
generic/mpih-lshift.c \
generic/mpih-mul1.c \
generic/mpih-mul2.c \
generic/mpih-mul3.c \
generic/mpih-rshift.c \
generic/mpih-sub1.c \
generic/udiv-w-sdiv.c
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/pwmanager/libcrypt/zlib/zlib.pro b/pwmanager/libcrypt/zlib/zlib.pro
index 2841aaf..7ba44e3 100644
--- a/pwmanager/libcrypt/zlib/zlib.pro
+++ b/pwmanager/libcrypt/zlib/zlib.pro
@@ -5,32 +5,34 @@
TEMPLATE = lib
CONFIG += staticlib
INCLUDEPATH += .
TARGET = zlib
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR= ../$(PLATFORM)
# Input
HEADERS += deflate.h \
infblock.h \
infcodes.h \
inffast.h \
inffixed.h \
inftrees.h \
infutil.h \
trees.h \
zconf.h \
zlib.h \
zutil.h
SOURCES += adler32.c \
compress.c \
crc32.c \
deflate.c \
infblock.c \
infcodes.c \
inffast.c \
inflate.c \
inftrees.c \
infutil.c \
trees.c \
uncompr.c \
zutil.c
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp
index 2fa9e8a..f76d33b 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.cpp
+++ b/pwmanager/pwmanager/addentrywnd_emb.cpp
@@ -1,169 +1,172 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "addentrywnd_emb.h"
#include "pwmdoc.h"
#include <qlayout.h>
#include <qlabel.h>
#include <qtabwidget.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
#include <klocale.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <qpushbutton.h>
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
/*
* Constructs a addEntryWnd as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, parent, name, true ), doc(d)
{
QWidget *page = plainPage();
- QVBoxLayout *pageLayout = new QVBoxLayout( page );
+ Q3VBoxLayout *pageLayout = new Q3VBoxLayout( page );
QTabWidget* mTabWidget = new QTabWidget( page );
pageLayout->addWidget( mTabWidget );
////////////////////////////////////////////////////////////////////
// This is the Password tab
QWidget *tab1 = new QWidget( mTabWidget );
- QGridLayout *layout = new QGridLayout( tab1, 3, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( tab1, 3, 1 );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
int i = 0;
descLineEdit = new KLineEdit( tab1, "descLineEdit" );
descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 );
layout->addWidget( descLineLabel, i, 0 );
layout->addWidget( descLineEdit, i, 1 );
i++;
categoryComboBox = new KComboBox( tab1 );
QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 );
layout->addWidget( label, i, 0 );
layout->addWidget( categoryComboBox, i, 1 );
i++;
categoryComboBox->setEditable( TRUE );
- categoryComboBox->setSizeLimit( 8 );
+ categoryComboBox->setMaxVisibleItems( 8 );
categoryComboBox->setAutoCompletion( TRUE );
categoryComboBox->setDuplicatesEnabled( FALSE );
connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&)));
usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" );
usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 );
layout->addWidget( usernameLineLabel, i, 0 );
layout->addWidget( usernameLineEdit, i, 1 );
i++;
pwLineEdit = new KLineEdit( tab1, "pwLineEdit" );
pwLineEdit->setEchoMode( QLineEdit::Password );
pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 );
layout->addWidget( pwLineLabel, i, 0 );
layout->addWidget( pwLineEdit, i, 1 );
i++;
revealButton = new QPushButton( i18n("&Reveal"), tab1, "revealButton" );
revealButton->setToggleButton( TRUE );
layout->addWidget( revealButton, i, 0 );
generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" );
layout->addWidget( generateButton, i, 1 );
i++;
urlLineEdit = new KLineEdit( tab1, "urlLineEdit" );
label = new QLabel( urlLineEdit, i18n("URL:"), tab1 );
layout->addWidget( label, i, 0 );
layout->addWidget( urlLineEdit, i, 1 );
i++;
mTabWidget->addTab( tab1, i18n( "&Password" ) );
////////////////////////////////////////////////////////////////////
// This is the Comment tab
QWidget *tab2 = new QWidget( mTabWidget );
- layout = new QGridLayout( tab2, 3, 1 );
+ layout = new Q3GridLayout( tab2, 3, 1 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
i = 0;
- commentTextEdit = new QMultiLineEdit(tab2);
+ commentTextEdit = new Q3MultiLineEdit(tab2);
layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 );
i++;
mTabWidget->addTab( tab2, i18n( "&Comments" ) );
////////////////////////////////////////////////////////////////////
// This is the Launcher tab
QWidget *tab3 = new QWidget( mTabWidget );
- layout = new QGridLayout( tab3, 3, 1 );
+ layout = new Q3GridLayout( tab3, 3, 1 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
i = 0;
launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" );
label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 );
QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 );
QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 );
QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 );
QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 );
QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 );
label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 );
layout->addWidget( label1, i, 0 );
layout->addWidget( label2, i, 1 );
i++;
layout->addWidget( label3, i, 0 );
layout->addWidget( label4, i, 1 );
i++;
layout->addWidget( label5, i, 0 );
i++;
layout->addWidget( label, i, 0 );
layout->addWidget( launcherLineEdit, i, 1 );
i++;
mTabWidget->addTab( tab3, i18n( "&Launcher" ) );
// signals and slots connections
diff --git a/pwmanager/pwmanager/addentrywnd_emb.h b/pwmanager/pwmanager/addentrywnd_emb.h
index 966d9d2..ad7d30c 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.h
+++ b/pwmanager/pwmanager/addentrywnd_emb.h
@@ -1,78 +1,83 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#ifndef ADDENTRYWND_EMB_H
#define ADDENTRYWND_EMB_H
#include <qvariant.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <QLabel>
#include <kdialogbase.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
class QSpacerItem;
class KLineEdit;
class QPushButton;
class KComboBox;
class QLabel;
-class QGroupBox;
-class QMultiLineEdit;
+class Q3GroupBox;
+class Q3MultiLineEdit;
class PwMDoc;
class addEntryWnd : public KDialogBase
{
Q_OBJECT
public:
addEntryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0);
~addEntryWnd();
KLineEdit* launcherLineEdit;
QPushButton* generateButton;
KLineEdit* descLineEdit;
KComboBox* categoryComboBox;
KLineEdit* usernameLineEdit;
KLineEdit* pwLineEdit;
KLineEdit* urlLineEdit;
QLabel* descLineLabel;
QLabel* usernameLineLabel;
QLabel* pwLineLabel;
QPushButton* revealButton;
- QMultiLineEdit* commentTextEdit;
+ Q3MultiLineEdit* commentTextEdit;
PwMDoc* doc;
public slots:
virtual void revealButton_slot();
virtual void generateButton_slot();
virtual void advancedCommentButton_slot(bool on);
protected slots:
virtual void slotOk();
virtual void categorySelected ( const QString & string );
};
#endif // ADDENTRYWND_H
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp
index 09efd1c..c952ead 100644
--- a/pwmanager/pwmanager/addentrywndimpl.cpp
+++ b/pwmanager/pwmanager/addentrywndimpl.cpp
@@ -167,55 +167,55 @@ void AddEntryWndImpl::setComment(const QString &comm)
}
void AddEntryWndImpl::advancedCommentButton_slot(bool on)
{
#ifndef PWM_EMBEDDED
switchComment(on);
#endif
}
void AddEntryWndImpl::switchComment(bool toAdvanced)
{
#ifndef PWM_EMBEDDED
useAdvComment = toAdvanced;
if (toAdvanced) {
if (commentTextEdit) {
savedCommentText = commentTextEdit->text();
delete_and_null(commentTextEdit);
}
if (editAdvCommentButton)
return;
editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."),
commentDummy);
editAdvCommentButton->resize(commentDummy->size().width(), 50);
connect(editAdvCommentButton, SIGNAL(clicked()),
this, SLOT(editAdvCommentButton_slot()));
editAdvCommentButton->show();
} else {
delete_ifnot_null(editAdvCommentButton);
if (commentTextEdit)
return;
- commentTextEdit = new QTextEdit(commentDummy);
+ commentTextEdit = new Q3TextEdit(commentDummy);
commentTextEdit->setTextFormat(Qt::PlainText);
commentTextEdit->resize(commentDummy->size());
commentTextEdit->setText(savedCommentText);
commentTextEdit->show();
}
#endif
}
void AddEntryWndImpl::editAdvCommentButton_slot()
{
#ifndef PWM_EMBEDDED
AdvCommEditImpl editor(this);
editor.setHtmlDta(advCommentDta);
if (editor.exec())
return;
advCommentDta = editor.getHtmlDta();
#endif
}
-#ifndef PWM_EMBEDDED
-#include "addentrywndimpl.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_addentrywndimpl.cpp"
#endif
diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h
index e13eb54..c5f4bb1 100644
--- a/pwmanager/pwmanager/addentrywndimpl.h
+++ b/pwmanager/pwmanager/addentrywndimpl.h
@@ -1,127 +1,127 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __ADDENTRYWNDIMPL_H
#define __ADDENTRYWNDIMPL_H
#ifndef PWM_EMBEDDED
#include <qlineedit.h>
-#include <qtextedit.h>
+#include <q3textedit.h>
#include <qcombobox.h>
#include "addentrywnd.h"
#else
#include <klineedit.h>
#include <kcombobox.h>
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#include "addentrywnd_emb.h"
#endif
#include <qpushbutton.h>
class PwGenWndImpl;
/** "add/edit" Window */
class AddEntryWndImpl : public addEntryWnd
{
Q_OBJECT
public:
#ifndef PWM_EMBEDDED
AddEntryWndImpl();
#else
AddEntryWndImpl( PwMDoc* doc, QWidget* parent = 0, const char* name = 0);
#endif
~AddEntryWndImpl();
/* get... functions */
QString getDescription()
{ return descLineEdit->text(); }
QString getCategory()
{ return categoryComboBox->currentText(); }
QString getUsername()
{ return usernameLineEdit->text(); }
QString getPassword()
{ return pwLineEdit->text(); }
QString getUrl()
{ return urlLineEdit->text(); }
QString getLauncher()
{ return launcherLineEdit->text(); }
QString getComment();
/* set... functions */
void setDescription(const QString &desc)
{ descLineEdit->setText(desc); }
void setCurrCategory(const QString &cat);
void addCategory(const QString &cat)
{ categoryComboBox->insertItem(cat); }
void setUsername(const QString &name)
{ usernameLineEdit->setText(name); }
void setPassword(const QString &pw)
{ pwLineEdit->setText(pw); }
void setUrl(const QString &url)
{ urlLineEdit->setText(url); }
void setLauncher(const QString launcher)
{ launcherLineEdit->setText(launcher); }
void setComment(const QString &comm);
/** are we using an advanced comment */
bool isAdvancedComment()
{ return useAdvComment; }
public slots:
#ifndef PWM_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
/** OK button pressed */
void okButton_slot();
/** cancel button pressed */
void cancelButton_slot();
-//MOC_SKIP_END
+#endif
#else
virtual void slotOk();
#endif
/** Reveal button pressed */
void revealButton_slot();
/** Generate button pressed */
void generateButton_slot();
/** advanced comment button pressed */
void advancedCommentButton_slot(bool on);
/** edit advanced comment button pressed */
void editAdvCommentButton_slot();
protected:
void switchComment(bool toAdvanced);
protected:
QPushButton *editAdvCommentButton;
#ifndef PWM_EMBEDDED
- QTextEdit *commentTextEdit;
+ Q3TextEdit *commentTextEdit;
#else
//nothing here
#endif
/** saved data from normal comment text edit box */
QString savedCommentText;
/** use an advanced comment? */
bool useAdvComment;
/** data of advanced comment (if available) */
QString advCommentDta;
/** password generation object */
PwGenWndImpl *pwGen;
};
#endif
diff --git a/pwmanager/pwmanager/binentrygen.h b/pwmanager/pwmanager/binentrygen.h
index 49288aa..9263cdc 100644
--- a/pwmanager/pwmanager/binentrygen.h
+++ b/pwmanager/pwmanager/binentrygen.h
@@ -1,56 +1,56 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __BINENTRYGEN_H
#define __BINENTRYGEN_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include "pwmdoc.h"
/** Binary entry generator.
* This generator generates a normal struct PwMDataItem
* from binary data (using base64 encoding).
* This mechanism is used to support the binary interface functions
* of the KWallet emulation, for example.
*
* The format of the encoded binary data as a PwMDataItem is as follows:
*
* PwMDataItem::desc contains the normal description string for
* this entry. Nothing surprising.
* PwMDataItem::name contains the "DataType" number in ascii format.
* PwMDataItem::pw contains the base64 encoded data stream.
* PwMDataItem::binary is always true for binary entries.
* All other PwMDataItems are currently unused by BinEntryGen.
*/
class BinEntryGen
{
public:
enum DataType
{
None = 0,
KWalletMap,
KWalletStream
};
public:
BinEntryGen() { }
/** Encode the binary "data" and return it in "ret" */
diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp
index 5416856..a60440d 100644
--- a/pwmanager/pwmanager/commentbox.cpp
+++ b/pwmanager/pwmanager/commentbox.cpp
@@ -1,63 +1,63 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "commentbox.h"
#include "pwmexception.h"
#include "htmlgen.h"
#include <klocale.h>
#ifndef PWM_EMBEDDED
#include <khtml_part.h>
#include <khtmlview.h>
-#include <qtextedit.h>
+#include <q3textedit.h>
#else
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#endif
#ifndef PWM_EMBEDDED
CommentBox::CommentBox(QWidget *_parentWidget)
{
PWM_ASSERT(_parentWidget);
parentWidget = _parentWidget;
textDta = 0;
htmlDta = 0;
mode = mode_notSet;
setFont( prefs->mViewFont );
}
CommentBox::~CommentBox()
{
clearText();
clearHtml();
}
void CommentBox::clear()
{
clearText();
clearHtml();
mode = mode_notSet;
this->hide();
}
void CommentBox::clearText()
{
delete_ifnot_null(textDta);
@@ -108,65 +108,65 @@ void CommentBox::setContent(const QString &dta)
if (dta.isEmpty()) {
clear();
return;
}
if (HtmlGen::isHtml(dta)) {
setHtml(dta);
return;
}
// we assume it's plain text
setText(dta);
}
void CommentBox::switchTo(commentBoxMode newMode)
{
if (newMode == mode)
return;
// cleanup old mode
switch (mode) {
case mode_text:
clearText();
break;
case mode_html:
clearHtml();
break;
default:
break;
}
// setup new mode
switch (newMode) {
case mode_text:
- textDta = new QTextEdit(parentWidget);
+ textDta = new Q3TextEdit(parentWidget);
textDta->setTextFormat(Qt::PlainText);
textDta->setReadOnly(true);
textDta->show();
break;
case mode_html:
htmlDta = new KHTMLPart(parentWidget, 0,
parentWidget);
htmlDta->show();
break;
default:
BUG();
break;
}
mode = newMode;
}
void CommentBox::show()
{
switch (mode) {
case mode_text:
PWM_ASSERT(textDta);
textDta->show();
break;
case mode_html:
PWM_ASSERT(htmlDta);
htmlDta->show();
break;
default:
break;
}
@@ -200,84 +200,84 @@ void CommentBox::resize(const QSize &size)
htmlDta->view()->resize(size);
break;
default:
break;
}
}
QSize CommentBox::size()
{
switch (mode) {
case mode_text:
PWM_ASSERT(textDta);
return textDta->size();
break;
case mode_html:
PWM_ASSERT(htmlDta);
return htmlDta->view()->size();
break;
default:
break;
}
return QSize();
}
////////////////////////////////////////////////////////////////////////
#else
CommentBox::CommentBox(QWidget *_parentWidget)
- : QTextBrowser(_parentWidget)
+ : Q3TextBrowser(_parentWidget)
{
//this->setReadOnly(true);
- setFocusPolicy( QWidget::ClickFocus );
+ setFocusPolicy( Qt::ClickFocus );
}
CommentBox::~CommentBox()
{
}
void CommentBox::clear()
{
this->hide();
}
void CommentBox::setText(const QString &text)
{
- QTextBrowser::setText( text);
+ Q3TextBrowser::setText( text);
if (!isVisible())
show();
}
bool CommentBox::getText(QString *text)
{
*text = this->text();
return true;
}
void CommentBox::setContent(const QString &dta)
{
// if there's no data, hide the comment-box
if (dta.isEmpty()) {
clear();
return;
}
// we assume it's plain text
setText(dta);
}
#endif
diff --git a/pwmanager/pwmanager/commentbox.h b/pwmanager/pwmanager/commentbox.h
index 3103353..d14ba13 100644
--- a/pwmanager/pwmanager/commentbox.h
+++ b/pwmanager/pwmanager/commentbox.h
@@ -1,124 +1,124 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef COMMENTBOX_H
#define COMMENTBOX_H
#include <qstring.h>
#include <qsize.h>
class QWidget;
-class QTextEdit;
+class Q3TextEdit;
class KHTMLPart;
#ifndef PWM_EMBEDDED
class CommentBox
{
protected:
enum commentBoxMode
{
mode_notSet = 0,
mode_text,
mode_html
};
public:
CommentBox(QWidget *_parentWidget);
~CommentBox();
/** clear all data in the comment box */
void clear();
/** show the comment box */
void show();
/** hide the comment box */
void hide();
/** resize the comment box */
void resize(const QSize &size);
void resize(int w, int h)
{ resize(QSize(w, h)); }
/** get the size of the comment box */
QSize size();
/** if neccessary switch to text-mode and
* insert this text into the comment box
*/
void setText(const QString &text);
/** get the text of the comment box.
* If it's not in text-mode it returns false
*/
bool getText(QString *text);
/** if neccessary switch to HTML-mode and
* insert this html code into the comment box
*/
void setHtml(QString code);
/** checks "dta" for its type, sets the correct
* mode and writes "dta" to the comment box
*/
void setContent(const QString &dta);
protected:
/** switch the current mode */
void switchTo(commentBoxMode newMode);
/** clear all text data */
void clearText();
/** clear all HTML data */
void clearHtml();
protected:
/** parent widget for this comment box */
QWidget *parentWidget;
/** current comment box usage type */
commentBoxMode mode;
/** if the comment box is a normal textbox, data is stored here */
- QTextEdit *textDta;
+ Q3TextEdit *textDta;
/** if the comment box is a HTML box, data is stored here */
KHTMLPart *htmlDta;
};
#else
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
/** Implementation of the advanced HTML comment box */
//US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size
// without conflicting with the two display modes
-class CommentBox : public QTextBrowser
+class CommentBox : public Q3TextBrowser
{
public:
CommentBox(QWidget *_parentWidget);
~CommentBox();
/** clear all data in the comment box */
void clear();
/** if neccessary switch to text-mode and
* insert this text into the comment box
*/
void setText(const QString &text);
/** get the text of the comment box.
* If it's not in text-mode it returns false
*/
bool getText(QString *text);
/** if neccessary switch to HTML-mode and
* insert this html code into the comment box
*/
void setContent(const QString &dta);
};
#endif
#endif
diff --git a/pwmanager/pwmanager/csv.cpp b/pwmanager/pwmanager/csv.cpp
index 194edf2..226cc08 100644
--- a/pwmanager/pwmanager/csv.cpp
+++ b/pwmanager/pwmanager/csv.cpp
@@ -1,210 +1,212 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.1 of pwmanager
* and was modified to run on embedded devices that run microkde
* The original file version was 1.2
* $Id$
**************************************************************************/
#include "csv.h"
#include "pwmdoc.h"
#include "pwmexception.h"
#include <kmessagebox.h>
#include <klocale.h>
+//Added by qt3to4:
+#include <Q3CString>
#define MAX_CSV_FILE_SIZE (50 * 1024 * 1024) // bytes
Csv::Csv(QWidget *_parent)
: parent (_parent)
{
}
Csv::~Csv()
{
}
bool Csv::importData(const QString &filepath,
PwMDoc *doc)
{
bool ret = true;
QByteArray d;
QFile f(filepath);
- if (!f.open(IO_ReadOnly)) {
+ if (!f.open(QIODevice::ReadOnly)) {
KMessageBox::error(parent,
i18n("Could not open file.\n"
"Does the file exist?"),
i18n("Open error."));
ret = false;
goto out;
}
if (f.size() > MAX_CSV_FILE_SIZE) {
KMessageBox::error(parent,
i18n("File too big.\nMaximum file size is 1 Byte.", "File too big.\nMaximum file size is %n Bytes.", MAX_CSV_FILE_SIZE),
i18n("File too big."));
ret = false;
goto out_close;
}
d = f.readAll();
if (d.isEmpty()) {
KMessageBox::error(parent,
i18n("Could not read file or file empty."),
i18n("Reading failed."));
ret = false;
goto out_close;
}
if (!doImport(d, doc)) {
KMessageBox::error(parent,
i18n("Import failed.\n"
"Corrupt CSV data format."),
i18n("File corrupt."));
ret = false;
goto out_close;
}
out_close:
f.close();
out:
return ret;
}
bool Csv::doImport(const QByteArray &d,
PwMDoc *doc)
{
PwMDataItem di;
//US ENH: initialize all members:
di.clear();
int refIndex = 0;
int ret;
- QCString s, curCat;
+ Q3CString s, curCat;
int fieldIndex = 0;
bool inRecord = false;
/* fieldIndex is a reference count to see which
* value we are attaching to di.
* Valid counts are:
* 0 -> category
* 1 -> desc
* 2 -> name
* 3 -> pw
* 4 -> url
* 5 -> launcher
* 6 -> comment
*/
while (1) {
ret = nextField(&s, d, inRecord, &refIndex);
switch (ret) {
case 0:
// successfully got next field.
inRecord = true;
switch (fieldIndex) {
case 0: // category
if (s.isEmpty()) {
/* This is special case. It's the category
* list terminating empty field.
*/
++fieldIndex;
} else
curCat = s;
break;
case 1: // desc
- di.desc = s;
+ di.desc = std::string(s);
++fieldIndex;
break;
case 2: // name
- di.name = s;
+ di.name = std::string(s);
++fieldIndex;
break;
case 3: // pw
- di.pw = s;
+ di.pw = std::string(s);
++fieldIndex;
break;
case 4: // url
- di.url = s;
+ di.url = std::string(s);
++fieldIndex;
break;
case 5: // launcher
- di.launcher = s;
+ di.launcher = std::string(s);
++fieldIndex;
break;
case 6: // comment
- di.comment = s;
+ di.comment = std::string(s);
++fieldIndex;
break;
default:
/* Too many fields in a record.
* We simply throw it away.
*/
break;
}
break;
case 1:
// record complete.
if (fieldIndex == 6)
- di.comment = s;
+ di.comment = std::string(s);
inRecord = false;
fieldIndex = 0;
doc->addEntry(curCat, &di, true);
//US ENH: clear di for the next row
di.clear();
break;
case 2:
// data completely parsed.
doc->flagDirty();
return true;
case -1:
// parse error
doc->flagDirty();
return false;
}
}
BUG();
return false;
}
-int Csv::nextField(QCString *ret,
+int Csv::nextField(Q3CString *ret,
const QByteArray &in,
bool inRecord,
int *_refIndex)
{
int rv = -2;
char c;
bool inField = false;
bool isQuoted = false;
bool searchingTerminator = false;
int refIndex;
int inSize = static_cast<int>(in.size());
ret->truncate(0);
for (refIndex = *_refIndex; refIndex < inSize; ++refIndex) {
c = in.at(refIndex);
if (!inField) {
// we have to search the field beginning, now.
switch (c) {
case ' ': // space
case ' ': // tab
// hm, still not the beginning. Go on..
break;
case '\r':
case '\n':
if (inRecord) {
/* This is the end of the last field in
* the record.
*/
PWM_ASSERT(ret->isEmpty());
rv = 1; // record end
goto out;
} else {
@@ -324,105 +326,105 @@ int Csv::nextField(QCString *ret,
unexp_eof:
printDebug("unexpected EOF :(");
return -1; // parser error
out:
if (!isQuoted)
*ret = ret->stripWhiteSpace();
*_refIndex = refIndex + 1;
return rv;
}
bool Csv::exportData(const QString &filepath,
PwMDoc *doc)
{
PWM_ASSERT(!doc->isDocEmpty());
bool ret = true;
if (QFile::exists(filepath)) {
int ret;
ret = KMessageBox::questionYesNo(parent,
i18n("This file does already exist.\n"
"Do you want to overwrite it?"),
i18n("Overwrite file?"));
if (ret == KMessageBox::No)
return false;
if (!QFile::remove(filepath)) {
KMessageBox::error(parent,
i18n("Could not delete the old file."),
i18n("Delete error."));
return false;
}
}
QFile f(filepath);
- if (!f.open(IO_ReadWrite)) {
+ if (!f.open(QIODevice::ReadWrite)) {
KMessageBox::error(parent,
i18n("Could not open file for writing."),
i18n("Open error."));
ret = false;
goto out;
}
doc->unlockAll_tempoary();
if (!doExport(f, doc))
ret = false;
doc->unlockAll_tempoary(true);
f.close();
out:
return ret;
}
bool Csv::doExport(QFile &f,
PwMDoc *doc)
{
unsigned int numCat = doc->numCategories();
unsigned int numEntr;
unsigned int i, j;
PwMDataItem d;
- QCString s, catName;
+ Q3CString s, catName;
QByteArray b;
for (i = 0; i < numCat; ++i) {
numEntr = doc->numEntries(i);
catName = newField(doc->getCategory(i)->c_str());
for (j = 0; j < numEntr; ++j) {
doc->getEntry(i, j, &d);
s = catName;
s += ",,";
s += newField(d.desc.c_str());
s += ",";
s += newField(d.name.c_str());
s += ",";
s += newField(d.pw.c_str());
s += ",";
s += newField(d.url.c_str());
s += ",";
s += newField(d.launcher.c_str());
s += ",";
s += newField(d.comment.c_str());
s += "\r\n";
b = s;
// remove \0 termination
#ifndef PWM_EMBEDDED
- b.resize(b.size() - 1, QGArray::SpeedOptim);
+ b.resize(b.size() - 1, Q3GArray::SpeedOptim);
#else
b.resize(b.size() - 1);
#endif
if (!f.writeBlock(b))
return false;
}
}
return true;
}
-QCString Csv::newField(QCString s)
+Q3CString Csv::newField(Q3CString s)
{
if (s.isEmpty())
- return QCString();
- QCString ret("\"");
+ return Q3CString();
+ Q3CString ret("\"");
#ifndef PWM_EMBEDDED
s.replace('\"', "\"\"");
#else
- s.replace(QRegExp("\""), "\"\"");
+ s.replace("\"", "\"\"");
#endif
ret += s;
ret += "\"";
return ret;
}
diff --git a/pwmanager/pwmanager/csv.h b/pwmanager/pwmanager/csv.h
index 6f3c1e1..8049122 100644
--- a/pwmanager/pwmanager/csv.h
+++ b/pwmanager/pwmanager/csv.h
@@ -1,91 +1,91 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.1 of pwmanager
* and was modified to run on embedded devices that run microkde
* The original file version was 1.2
* $Id$
**************************************************************************/
#ifndef __PWMANAGER_CSV_H
#define __PWMANAGER_CSV_H
-#include <qcstring.h>
+#include <q3cstring.h>
#include <qfile.h>
class PwMDoc;
class QString;
class QWidget;
/** class for CSV (Comma Separated Value) export and import.
*
* http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm
* http://en.wikipedia.org/wiki/Comma-separated_values
*
* There are two types of CSV output we can produce.
* One with Category support (recommended):
* "Category 1",, "Desc 1", "Username 1", "Password 1", "URL 1", "Launcher 1", "Comment 1"
* "Category 1",, "Desc 2", "Username 2", "Password 2", "URL 2", "Launcher 2", "Comment 2"
* ...
* The empty "" is neccessary, because in future versions we will
* support nested Categories. We want to be future compatible, now.
*
* And one without Category support:
*FIXME: it's not implemented, yet. ;)
* "Desc 1", "Username 1", "Password 1", "URL 1", "Launcher 1", "Comment 1"
* "Desc 2", "Username 2", "Password 2", "URL 2", "Launcher 2", "Comment 2"
* ...
*
*/
class Csv
{
public:
Csv(QWidget *_parent);
~Csv();
/** import data from "filepath" into "doc" */
bool importData(const QString &filepath,
PwMDoc *doc);
/** export data from "doc" to "filepath" */
bool exportData(const QString &filepath,
PwMDoc *doc);
protected:
/** do the import process. */
bool doImport(const QByteArray &d,
PwMDoc *doc);
/** parse for the next field.
* @return Return values are:
* 0 -> successfully got the next field.
* 1 -> record end.
* 2 -> data end.
* -1 -> parser error.
*/
- int nextField(QCString *ret,
+ int nextField(Q3CString *ret,
const QByteArray &in,
bool inRecord,
int *_refIndex);
/** do the export process. */
bool doExport(QFile &f,
PwMDoc *doc);
/** generate a new data field string. */
- QCString newField(QCString s);
+ Q3CString newField(Q3CString s);
protected:
/** current parent widget. */
QWidget *parent;
};
#endif // __PWMANAGER_CSV_H
diff --git a/pwmanager/pwmanager/editcategory.cpp b/pwmanager/pwmanager/editcategory.cpp
index 4e2378c..4f19299 100644
--- a/pwmanager/pwmanager/editcategory.cpp
+++ b/pwmanager/pwmanager/editcategory.cpp
@@ -1,101 +1,103 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "editcategory.h"
#include "pwmdoc.h"
#include <qlayout.h>
#include <qlabel.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
#include <klocale.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <qpushbutton.h>
/*
* Constructs a addEntryWnd as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
editCategoryWnd::editCategoryWnd( PwMDoc* d, QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "edit category descriptions" ),
Apply | User2 | Ok,
Ok, parent, name, true ),
doc(d)
{
findButton( Ok )->setText (i18n("Close" )) ;
findButton( User2 )->setText (i18n("Cancel" )) ;
connect(this,SIGNAL(user2Clicked()), SLOT(cancel_slot()));
enableButton( KDialogBase::Apply, false );
QWidget *page = plainPage();
- QGridLayout *layout = new QGridLayout( page, 3, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( page, 3, 1 );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
int i = 0;
categoryComboBox = new KComboBox( page );
QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( categoryComboBox, i, 1 );
i++;
categoryComboBox->setEditable( FALSE );
- categoryComboBox->setSizeLimit( 100 );
+ categoryComboBox->setMaxVisibleItems( 100 );
connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&)));
descLineEdit = new KLineEdit( page, "descLineEdit" );
label = new QLabel( descLineEdit, i18n("Text1 (Description):"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( descLineEdit, i, 1 );
connect( descLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) );
i++;
usernameLineEdit = new KLineEdit( page, "usernameLineEdit" );
label = new QLabel( usernameLineEdit, i18n("Text2 (Username):"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( usernameLineEdit, i, 1 );
connect( usernameLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) );
i++;
pwLineEdit = new KLineEdit( page, "pwLineEdit" );
label = new QLabel( pwLineEdit, i18n("Text3 (Password):"), page );
layout->addWidget( label, i, 0 );
layout->addWidget( pwLineEdit, i, 1 );
connect( pwLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) );
i++;
unsigned int count = doc->numCategories();
for (unsigned int i = 0; i < count; ++i) {
categoryComboBox->insertItem(doc->getCategory(i)->c_str());
}
// PwMCategoryItem* getCategoryEntry(unsigned int index)
// { return &(dti.dta[index]); }
diff --git a/pwmanager/pwmanager/editcategory.h b/pwmanager/pwmanager/editcategory.h
index 90b685b..10a012b 100644
--- a/pwmanager/pwmanager/editcategory.h
+++ b/pwmanager/pwmanager/editcategory.h
@@ -1,73 +1,78 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#ifndef EDITCATEGORY_H
#define EDITCATEGORY_H
#include <qvariant.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
+#include <Q3HBoxLayout>
+#include <QLabel>
#include <kdialogbase.h>
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+class Q3VBoxLayout;
+class Q3HBoxLayout;
+class Q3GridLayout;
class QSpacerItem;
class KLineEdit;
class QPushButton;
class KComboBox;
class QLabel;
-class QGroupBox;
-class QMultiLineEdit;
+class Q3GroupBox;
+class Q3MultiLineEdit;
class PwMDoc;
class editCategoryWnd : public KDialogBase
{
Q_OBJECT
public:
editCategoryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0);
~editCategoryWnd();
void setCurrCategory(const QString &cat);
KComboBox* categoryComboBox;
KLineEdit* descLineEdit;
KLineEdit* usernameLineEdit;
KLineEdit* pwLineEdit;
//public slots:
// virtual void revealButton_slot();
// virtual void generateButton_slot();
// virtual void advancedCommentButton_slot(bool on);
protected slots:
virtual void slotOk();
virtual void slotApply();
virtual void cancel_slot();
virtual void categorySelected ( const QString & string );
virtual void widgetModified(const QString &);
private:
PwMDoc* doc;
diff --git a/pwmanager/pwmanager/findwnd_emb.cpp b/pwmanager/pwmanager/findwnd_emb.cpp
index 6dcabe8..03d4e38 100644
--- a/pwmanager/pwmanager/findwnd_emb.cpp
+++ b/pwmanager/pwmanager/findwnd_emb.cpp
@@ -1,103 +1,105 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "findwnd_emb.h"
#include <klocale.h>
#include <qcheckbox.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include <qradiobutton.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <klineedit.h>
#include <qlabel.h>
/*
#include <qvariant.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
*/
/*
* Constructs a findWnd as a child of 'parent', with the
* name 'name'.
*/
findWnd::findWnd( QWidget* parent, const char* name )
: KDialogBase( KDialogBase::Plain, i18n( "Find" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
- QVBoxLayout *layout = new QVBoxLayout( page );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( page );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
exactCheckBox = new QCheckBox( i18n( "&Exact match" ), page );
layout->addWidget( exactCheckBox );
caseSensCheckBox = new QCheckBox( i18n( "&Case sensitive" ), page );
layout->addWidget( caseSensCheckBox );
- QButtonGroup* buttonGroup1 = new QButtonGroup(1, Qt::Horizontal, i18n( "Search in Column" ), page );
+ Q3ButtonGroup* buttonGroup1 = new Q3ButtonGroup(1, Qt::Horizontal, i18n( "Search in Column" ), page );
layout->addWidget( buttonGroup1 );
descRadioButton = new QRadioButton( i18n( "&Description" ), buttonGroup1 );
pwRadioButton = new QRadioButton( i18n( "&Password" ), buttonGroup1 );
commentRadioButton = new QRadioButton( i18n( "C&omment" ), buttonGroup1 );
nameRadioButton = new QRadioButton( i18n( "&Username" ), buttonGroup1 );
urlRadioButton = new QRadioButton( i18n( "U&RL" ), buttonGroup1 );
launcherRadioButton = new QRadioButton( i18n( "&Launcher" ), buttonGroup1 );
descRadioButton->setChecked( TRUE );
findLineEdit = new KLineEdit( page );
// QLabel* label = new QLabel( findLineEdit, i18n( "Find:" ), page );
//layout->addWidget( label );
layout->addWidget( findLineEdit );
setButtonText( KDialogBase::Ok, "&Find" );
setButtonText( KDialogBase::Cancel, "&Close" );
resize( sizeHint() );
connect( buttonGroup1, SIGNAL( clicked(int) ), this, SLOT( selectionChanged_slot() ) );
connect( findLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( selectionChanged_slot() ) );
connect( caseSensCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( selectionChanged_slot() ) );
connect( exactCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( selectionChanged_slot() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
diff --git a/pwmanager/pwmanager/findwndimpl.cpp b/pwmanager/pwmanager/findwndimpl.cpp
index 059219f..d323133 100644
--- a/pwmanager/pwmanager/findwndimpl.cpp
+++ b/pwmanager/pwmanager/findwndimpl.cpp
@@ -104,35 +104,35 @@ void FindWndImpl::findButton_slot()
foundPositions[currFoundPos++]);
emit foundAt(numEntries - 1 - lvp);
if (currFoundPos + 1 > static_cast<int>(foundPositions.size()))
currFoundPos = 0;
}
#ifdef PWM_EMBEDDED
void FindWndImpl::slotOk()
{
findButton_slot();
//do not call KDialogBase::slotOk() here
// user should press the close button instead
}
#endif
void FindWndImpl::closeButton_slot()
{
#ifndef PWM_EMBEDDED
done(0);
#endif
}
void FindWndImpl::selectionChanged_slot()
{
fAt = 0;
refVal = 0;
currFoundPos = -1;
}
-#ifndef PWM_EMBEDDED
-#include "findwndimpl.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_findwndimpl.cpp"
#endif
diff --git a/pwmanager/pwmanager/genpasswd.cpp b/pwmanager/pwmanager/genpasswd.cpp
index 41078b3..82f0c06 100644
--- a/pwmanager/pwmanager/genpasswd.cpp
+++ b/pwmanager/pwmanager/genpasswd.cpp
@@ -1,55 +1,57 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "genpasswd.h"
#include "pwmexception.h"
#include "randomizer.h"
#include "globalstuff.h"
+//Added by qt3to4:
+#include <Q3PtrList>
/* how often can a char of the same charset be reused in order */
#define FILTER_MAX_CHARSET_REUSE 3
/* re-randomize all charsets on every iteration (0/1) */
#define RERAND_CHARSET 0
struct staticCharsetStruct
{
const char *lower;
const char *upper;
const char *num;
const char *special;
const char *blank;
};
static struct staticCharsetStruct staticCharset = {
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"0123456789",
"!\"§$%&/()=?,.-;:_+",
" "
};
GenPasswd::GenPasswd()
: length (8)
, useFilter (true)
{
dynCharset.setAutoDelete(true);
}
@@ -129,65 +131,65 @@ void GenPasswd::rndDynCharset()
}
p->data = tmpData;
}
}
QString GenPasswd::gen()
{
BUG_ON(dynCharset.count() <= 0);
BUG_ON(length < 1);
dynCharset_element *curCharset;
QString ret;
int i;
for (i = 0; i < length; ++i) {
curCharset = selectNextCharset();
#if RERAND_CHARSET != 0
rndDynCharset();
#endif // RERAND_CHARSET
ret += genNewRandom(curCharset);
}
return ret;
}
GenPasswd::dynCharset_element * GenPasswd::selectNextCharset()
{
dynCharset_element *ret;
int numCharsets = dynCharset.count();
BUG_ON(numCharsets <= 0);
if (numCharsets == 1)
return dynCharset.at(0);
Randomizer *rnd = Randomizer::obj();
if (useFilter) {
// find out which charsets are allowed (filtering)
- QPtrList<dynCharset_element> allowedCharsets;
+ Q3PtrList<dynCharset_element> allowedCharsets;
// QPtrList<dynCharset_element>::iterator is not available in QT-3.1
unsigned int i, cnt = dynCharset.count();
dynCharset_element *p;
for (i = 0; i < cnt; ++i) {
p = dynCharset.at(i);
PWM_ASSERT(p);
if (p->refCnt < FILTER_MAX_CHARSET_REUSE) {
allowedCharsets.append(p);
} else {
p->refCnt = 0;
}
}
int numAllowedCharsets = allowedCharsets.count();
BUG_ON(numAllowedCharsets <= 0);
// now get a random charset out of the allowed
unsigned int randomPos = rnd->genRndUInt() % numAllowedCharsets;
ret = allowedCharsets.at(randomPos);
ret->refCnt++;
return ret;
}
// all charsets are allowed here (no filtering). Get a random.
unsigned int randomPos = rnd->genRndUInt() % numCharsets;
ret = dynCharset.at(randomPos);
return ret;
}
QChar GenPasswd::genNewRandom(const dynCharset_element *charset)
{
Randomizer *rnd = Randomizer::obj();
int pos = rnd->genRndInt() % charset->data.length();
return charset->data.at(pos);
}
diff --git a/pwmanager/pwmanager/genpasswd.h b/pwmanager/pwmanager/genpasswd.h
index 3fa1607..5493891 100644
--- a/pwmanager/pwmanager/genpasswd.h
+++ b/pwmanager/pwmanager/genpasswd.h
@@ -1,76 +1,76 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __GENPASSWD_H
#define __GENPASSWD_H
#include <qstring.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
/** internal password generator of PwManager */
class GenPasswd
{
protected:
struct dynCharset_element
{
/** charset data */
QString data;
/** reference counter for the filter */
unsigned int refCnt;
};
public:
GenPasswd();
/** set the charset to use */
void setCharset(bool lower,
bool upper,
bool num,
bool special,
bool blank,
QString user);
/** set the password length */
void setLen(int len)
{ length = len; }
/** use the filter? */
void setUseFilter(bool use)
{ useFilter = use; }
/** start to generate a new password and return it.
* Returns an empty string on error.
*/
QString gen();
protected:
/** randomize the dynamic charset */
void rndDynCharset();
/** select the next charset (based on useFilter) */
dynCharset_element * selectNextCharset();
/** generate a new random char from the given charset */
QChar genNewRandom(const dynCharset_element *charset);
protected:
/** password length to generate */
int length;
/** use the filter? */
bool useFilter;
/** dynamic charset used for generating the password */
- QPtrList<dynCharset_element> dynCharset;
+ Q3PtrList<dynCharset_element> dynCharset;
};
#endif // __GENPASSWD_H
diff --git a/pwmanager/pwmanager/getkeycardwnd.cpp b/pwmanager/pwmanager/getkeycardwnd.cpp
index 89dada2..b8e6174 100644
--- a/pwmanager/pwmanager/getkeycardwnd.cpp
+++ b/pwmanager/pwmanager/getkeycardwnd.cpp
@@ -1,67 +1,70 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: fsdeveloper@yahoo.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "getkeycardwnd.h"
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
#include <klocale.h>
GetKeyCardWnd::GetKeyCardWnd(QWidget *parent,
- const char *name, bool modal, WFlags f)
+ const char *name, bool modal, Qt::WFlags f)
: QDialog(parent, name, modal, f)
{
- vbox1 = new QVBox(this);
+ vbox1 = new Q3VBox(this);
text_label = new QLabel(vbox1);
- hbox1 = new QHBox(vbox1);
+ hbox1 = new Q3HBox(vbox1);
okButton = new QPushButton(i18n("&Ok"), hbox1);
cancelButton = new QPushButton(i18n("&Cancel"), hbox1);
vbox1->setSpacing(10);
vbox1->setMargin(10);
hbox1->setSpacing(10);
resize(500, 100);
setCaption(i18n("Insert key-card"));
text_label->setText(i18n("Please insert the key-card "
"and press the OK button."));
connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
}
GetKeyCardWnd::~GetKeyCardWnd()
{
}
void GetKeyCardWnd::resizeEvent(QResizeEvent *)
{
vbox1->resize(size());
}
void GetKeyCardWnd::okButton_slot()
{
done(1);
}
-#ifndef PWM_EMBEDDED
-#include "getkeycardwnd.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_getkeycardwnd.cpp"
#endif
diff --git a/pwmanager/pwmanager/getkeycardwnd.h b/pwmanager/pwmanager/getkeycardwnd.h
index fbe46ee..202e920 100644
--- a/pwmanager/pwmanager/getkeycardwnd.h
+++ b/pwmanager/pwmanager/getkeycardwnd.h
@@ -1,53 +1,55 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: fsdeveloper@yahoo.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef GETKEYCARDWND_H
#define GETKEYCARDWND_H
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qevent.h>
+//Added by qt3to4:
+#include <QResizeEvent>
/** The equivalent to GetMasterPwWndImpl for chipcards */
class GetKeyCardWnd : public QDialog
{
Q_OBJECT
public:
GetKeyCardWnd(QWidget *parent = 0, const char *name = 0,
- bool modal = FALSE, WFlags f = 0);
+ bool modal = FALSE, Qt::WFlags f = 0);
~GetKeyCardWnd();
protected slots:
void okButton_slot();
protected:
- QVBox *vbox1;
- QHBox *hbox1;
+ Q3VBox *vbox1;
+ Q3HBox *hbox1;
QLabel *text_label;
QPushButton *okButton;
QPushButton *cancelButton;
protected:
void resizeEvent(QResizeEvent *);
};
#endif
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
index 678f05f..7e4bbb7 100644
--- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
+++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp
@@ -14,98 +14,101 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "getmasterpwwnd_emb.h"
#include "klocale.h"
/*
#include <qvariant.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
*/
#include <qwidget.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
/*
* Constructs a getMasterPwWnd as a child of 'parent', with the
* name 'name'
*/
getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "Master-password" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
- QVBoxLayout *pageLayout = new QVBoxLayout( page );
+ Q3VBoxLayout *pageLayout = new Q3VBoxLayout( page );
pwLineEdit = new QLineEdit( page, "pwLineEdit" );
pwLineEdit->setEchoMode( QLineEdit::Password );
QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" );
- textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
+ textLabel1->setAlignment( int( Qt::WordBreak | Qt::AlignCenter ) );
pageLayout->addWidget(textLabel1);
pageLayout->addWidget(pwLineEdit);
QWidget* numberBox = new QWidget( page );
#ifndef DESKTOP_VERSION
if ( QApplication::desktop()->width() > 320 ) {
numberBox->setFixedHeight(250);
numberBox->setFixedWidth(200);
}
else{
numberBox->setFixedHeight(150);
numberBox->setFixedWidth(150);
}
#endif
- QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 );
+ Q3GridLayout* numberLayout = new Q3GridLayout( numberBox, 4, 3 );
numberLayout->setMargin( 0 );
numberLayout->setSpacing( 0 );
QPushButton* p1 = new QPushButton( i18n("1"), numberBox );
numberLayout->addWidget( p1, 0, 0 );
QPushButton* p2 = new QPushButton( i18n("2"), numberBox );
numberLayout->addWidget( p2, 0, 1 );
QPushButton* p3 = new QPushButton( i18n("3"), numberBox );
numberLayout->addWidget( p3, 0, 2 );
QPushButton* p4 = new QPushButton( i18n("4"), numberBox );
numberLayout->addWidget( p4, 1, 0 );
QPushButton* p5 = new QPushButton( i18n("5"), numberBox );
numberLayout->addWidget( p5, 1, 1 );
QPushButton* p6 = new QPushButton( i18n("6"), numberBox );
numberLayout->addWidget( p6, 1, 2 );
QPushButton* p7 = new QPushButton( i18n("7"), numberBox );
numberLayout->addWidget( p7, 2, 0 );
QPushButton* p8 = new QPushButton( i18n("8"), numberBox );
numberLayout->addWidget( p8, 2, 1 );
QPushButton* p9 = new QPushButton( i18n("9"), numberBox );
numberLayout->addWidget( p9, 2, 2 );
QPushButton* clear = new QPushButton( i18n("x"), numberBox );
numberLayout->addWidget( clear, 3, 0 );
QPushButton* p0 = new QPushButton( i18n("0"), numberBox );
numberLayout->addWidget( p0, 3, 1 );
QPushButton* backspace = new QPushButton( i18n("-"), numberBox );
numberLayout->addWidget( backspace, 3, 2 );
pageLayout->addWidget(numberBox);
#ifdef DESKTOP_VERSION
resize( sizeHint() );
diff --git a/pwmanager/pwmanager/getmasterpwwndimpl.cpp b/pwmanager/pwmanager/getmasterpwwndimpl.cpp
index 6be9618..f741f72 100644
--- a/pwmanager/pwmanager/getmasterpwwndimpl.cpp
+++ b/pwmanager/pwmanager/getmasterpwwndimpl.cpp
@@ -26,35 +26,35 @@ GetMasterPwWndImpl::GetMasterPwWndImpl(QWidget * parent, const char *name)
{
}
GetMasterPwWndImpl::~GetMasterPwWndImpl()
{
}
void GetMasterPwWndImpl::okButton_slot()
{
#ifndef PWM_EMBEDDED
if (pwLineEdit->text() != "")
done(1);
#endif
}
void GetMasterPwWndImpl::cancelButton_slot()
{
#ifndef PWM_EMBEDDED
done(2);
#endif
}
#ifdef PWM_EMBEDDED
void GetMasterPwWndImpl::slotOk()
{
if (pwLineEdit->text() != "")
getMasterPwWnd::slotOk();
else
return;
}
#endif
-#ifndef PWM_EMBEDDED
-#include "getmasterpwwndimpl.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_getmasterpwwndimpl.cpp"
#endif
diff --git a/pwmanager/pwmanager/globalstuff.h b/pwmanager/pwmanager/globalstuff.h
index 090fcda..2e8f287 100644
--- a/pwmanager/pwmanager/globalstuff.h
+++ b/pwmanager/pwmanager/globalstuff.h
@@ -5,128 +5,128 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __GLOBALSTUFF_H
#define __GLOBALSTUFF_H
#ifndef PWM_EMBEDDED
#include "config.h"
#endif
#include "compiler.h"
//US BUG: the following code caused compile errors with certain gcccompilers (2.95).
// Because of that I replaced it with a Qt version, which should do the same.
#include <string>
#ifndef PWM_EMBEDDED
#include <sstream>
#else
#include <qstring.h>
-#include <qtextstream.h>
+#include <QTextOStream>
#endif
#ifndef CONFIG_KEYCARD
class QWidget;
void no_keycard_support_msg_box(QWidget *parentWidget);
#endif // CONFIG_KEYCARD
#ifdef PROG_NAME
# undef PROG_NAME
#endif
#define PROG_NAME "PwM/Pi"
#ifdef PACKAGE_NAME
# undef PACKAGE_NAME
#endif
#define PACKAGE_NAME "pwm-pi"
#ifdef PACKAGE_VER
# undef PACKAGE_VER
#endif
#define PACKAGE_VER "1.0.1"
#ifdef CONFIG_DEBUG
# define PWM_DEBUG
#else
# undef PWM_DEBUG
#endif
#ifdef QT_MAKE_VERSION
# undef QT_MAKE_VERSION
#endif
#define QT_MAKE_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c))
/** remove "unused parameter" warnings */
#ifdef PARAM_UNUSED
# undef PARAM_UNUSED
#endif
#define PARAM_UNUSED(x) (void)x
/** return the number of elements in an array */
#ifdef array_size
# undef array_size
#endif
#define array_size(x) (sizeof(x) / sizeof((x)[0]))
//US BUG: the following code caused compile errors with certain gcccompilers (2.95).
// Because of that I replaced it with a Qt version, which should do the same.
#ifndef PWM_EMBEDDED
/** convert something to string using ostringstream */
template <class T> inline
std::string tostr(const T &t)
{
std::ostringstream s;
s << t;
return s.str();
}
#else
/** convert something to string using ostringstream */
template <class T> inline
std::string tostr(const T &t)
{
QString result;
- QTextOStream(&result) << t;
+ QTextOStream tmp(&result); tmp << t;
return result.latin1();
}
#endif
/** delete the memory and NULL the pointer */
template<class T> inline
void delete_and_null(T *&p)
{
delete p;
p = 0;
}
/** delete the memory if the pointer isn't a NULL pointer */
template<class T> inline
void delete_ifnot_null(T *&p)
{
if (p)
delete_and_null(p);
}
template<class T> inline
void delete_and_null_array(T *&p)
{
delete [] p;
p = 0;
}
template<class T> inline
void delete_ifnot_null_array(T *&p)
{
if (p)
delete_and_null_array(p);
}
diff --git a/pwmanager/pwmanager/htmlgen.cpp b/pwmanager/pwmanager/htmlgen.cpp
index bee8198..be3406a 100644
--- a/pwmanager/pwmanager/htmlgen.cpp
+++ b/pwmanager/pwmanager/htmlgen.cpp
@@ -31,65 +31,65 @@
#define HTML_COMMENT_HDR "<!-- type: comment -->"
#define HTML_COMMENTVER_HDR "<!-- ver: 0.1 -->"
#define HTML_STYLESHEET_DUMMY "@STYLESHEET@"
#define HTML_GLOBTBL_CLASS "\"globtable\""
#define HTML_GLOBTITLE_CLASS "\"globtitle\""
#define HTML_SUBTBL_CLASS "\"subtable\""
#define HTML_SUBTITLE_CLASS "\"subtitle\""
#define HTML_ENTRY_CLASS "\"entry\""
#define HTML_VALUE_CLASS "\"value\""
#define PATH_COMMENTSTYLE_CSS "pwmanager/html/htmlcomment_style.css"
#if defined(PWM_DEBUG) && HTMLGEN_DEBUG != 0
#define HTML_ENDL "\n"
#else // defined(PWM_DEBUG) && ...
#define HTML_ENDL ""
#endif // defined(PWM_DEBUG) && ...
HtmlGen::HtmlGen()
{
useSSDummy = true;
}
HtmlGen::~HtmlGen()
{
}
QString HtmlGen::escapeHtmlText(const QString &str)
{
QString ret;
unsigned int len = str.length(), i;
char c;
for (i = 0; i < len; ++i) {
- c = str.at(i);
+ c = str.at(i).toLatin1();
switch (c) {
case '<':
ret.append("&lt;");
break;
case '>':
ret.append("&gt;");
break;
case '&':
ret.append("&amp;");
break;
case '\"':
ret.append("&quot;");
break;
case 'ä':
ret.append("&auml;");
break;
case 'Ä':
ret.append("&Auml;");
break;
case 'ü':
ret.append("&uuml;");
break;
case 'Ü':
ret.append("&Uuml;");
break;
case 'ö':
ret.append("&ouml;");
break;
case 'Ö':
ret.append("&Ouml;");
break;
case 'ß':
diff --git a/pwmanager/pwmanager/ipc.cpp b/pwmanager/pwmanager/ipc.cpp
index 643b022..4c65f1d 100644
--- a/pwmanager/pwmanager/ipc.cpp
+++ b/pwmanager/pwmanager/ipc.cpp
@@ -1,217 +1,217 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "ipc.h"
#include "pwmexception.h"
#include <qsocketnotifier.h>
#ifndef _WIN32_
#include <sys/socket.h>
#endif
#ifndef PWM_EMBEDDED
#include <sys/types.h>
#include <stdio.h>
#else
-#include <qsocket.h>
+#include <q3socket.h>
#endif
#define END_OF_LINE '\n'
#define INIT_LINEBUF_LEN 64 /* byte */
#ifndef PWM_EMBEDDED
Ipc::Ipc()
: stream (0)
, notifier (0)
, rdBuf (0)
{
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) {
throw PwMException(PwMException::EX_GENERIC,
"Ipc: socketpair() failed");
}
rdBufSize = INIT_LINEBUF_LEN;
rdBuf = static_cast<char *>(malloc(rdBufSize));
if (!rdBuf) {
close(sock[0]);
close(sock[1]);
throw PwMException(PwMException::EX_GENERIC,
"Ipc: OOM");
}
stream = fdopen(sock[0], "r");
if (!stream) {
close(sock[0]);
close(sock[1]);
free(rdBuf);
throw PwMException(PwMException::EX_GENERIC,
"Ipc: fdopen() failed");
}
notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read);
connect(notifier, SIGNAL(activated(int)),
this, SLOT(receiveData(int)));
host = true;
}
#else
Ipc::Ipc()
: notifier (0)
, rdBuf (0)
{
#ifndef _WIN32_
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) {
qDebug("Ipc: socketpair() failed");
}
#endif
- QSocket* qsock = new QSocket();
+ Q3Socket* qsock = new Q3Socket();
qsock->setSocket(sock[0]);
rdBufSize = INIT_LINEBUF_LEN;
rdBuf = (char *)(malloc(rdBufSize));
if (!rdBuf) {
close(sock[0]);
close(sock[1]);
qDebug("Ipc: OOM");
}
- qsock = new QSocket();
+ qsock = new Q3Socket();
qsock->setSocket(sock[0]);
/*US
stream = fdopen(sock[0], "r");
if (!stream) {
close(sock[0]);
close(sock[1]);
free(rdBuf);
qDebug("Ipc: fdopen() failed");
}
*/
notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read);
connect(notifier, SIGNAL(activated(int)),
this, SLOT(receiveData(int)));
host = true;
}
#endif
#ifndef PWM_EMBEDDED
Ipc::Ipc(const Ipc *ipc)
: stream (0)
, notifier (0)
, rdBuf (0)
{
rdBufSize = INIT_LINEBUF_LEN;
rdBuf = static_cast<char *>(malloc(rdBufSize));
if (!rdBuf) {
throw PwMException(PwMException::EX_GENERIC,
"Ipc: OOM");
}
sock[0] = ipc->sock[1];
sock[1] = ipc->sock[0];
stream = fdopen(sock[0], "r");
if (!stream) {
free(rdBuf);
throw PwMException(PwMException::EX_GENERIC,
"Ipc: fdopen() failed");
}
notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read);
connect(notifier, SIGNAL(activated(int)),
this, SLOT(receiveData(int)));
host = false;
}
#else
Ipc::Ipc(const Ipc *ipc)
: notifier (0)
, rdBuf (0)
{
rdBufSize = INIT_LINEBUF_LEN;
rdBuf = (char *)(malloc(rdBufSize));
if (!rdBuf) {
qDebug("Ipc: OOM");
}
sock[0] = ipc->sock[1];
sock[1] = ipc->sock[0];
- qSock = new QSocket();
+ qSock = new Q3Socket();
qSock->setSocket(sock[0]);
/*US
stream = fdopen(sock[0], "r");
if (!stream) {
free(rdBuf);
qDebug("Ipc: fdopen() failed");
}
*/
notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read);
connect(notifier, SIGNAL(activated(int)),
this, SLOT(receiveData(int)));
host = false;
}
#endif
Ipc::~Ipc()
{
#ifdef PWM_EMBEDDED
delete qSock;
#endif
delete_ifnot_null(notifier);
if (rdBuf)
free(rdBuf);
#ifndef PWM_EMBEDDED
if (stream)
fclose(stream);
#endif
if (host) {
close(sock[0]);
close(sock[1]);
}
}
void Ipc::receiveData(int s)
{
PWM_ASSERT(s == sock[0]);
PARAM_UNUSED(s);
#ifndef PWM_EMBEDDED
ssize_t rd;
rd = ::getline(&rdBuf, &rdBufSize, stream);
if (likely(rd > 0)) {
emit lineAvailable(rdBuf, rd);
}
#else
int rd;
rd = qSock->readLine(rdBuf, rdBufSize);
if (rd > 0) {
emit lineAvailable(rdBuf, rd);
}
#endif
qDebug("void Ipc::receiveData(int s) has to be implemented.");
}
-#ifndef PWM_EMBEDDED
-#include "ipc.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_ipc.cpp"
#endif
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h
index 7bfca02..3248283 100644
--- a/pwmanager/pwmanager/ipc.h
+++ b/pwmanager/pwmanager/ipc.h
@@ -1,92 +1,92 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __PWM_IPC_H
#define __PWM_IPC_H
#include <qobject.h>
#ifndef _WIN32_
#include <unistd.h>
#else
#include <io.h>
#endif
#ifndef PWM_EMBEDDED
#include <stdio.h>
#else
-#include <qsocket.h>
+#include <q3socket.h>
#endif
class QSocketNotifier;
/** very simple interprocess communication class */
class Ipc : public QObject
{
Q_OBJECT
public:
/** create a new Ipc communication object */
Ipc();
/** create a new Ipc communication object and
* connect it to "ipc"
*/
Ipc(const Ipc *ipc);
/** destructor */
~Ipc();
/** send data to the other socket end
* (To the connected ipc object)
*/
#ifndef PWM_EMBEDDED
void send(const char *buf, size_t size)
{ write(sock[0], buf, size); }
#else
void send(const char *buf, size_t size)
{ qSock->writeBlock(buf, size); }
#endif
signals:
/** a line is available */
void lineAvailable(const char *buf, size_t size);
protected slots:
/** received data on socket */
void receiveData(int s);
protected:
#ifndef PWM_EMBEDDED
/** stream on "this" end of the socket (sock[0]) */
FILE *stream;
/** current receive buffer size */
size_t rdBufSize;
#else
- QSocket* qSock;
+ Q3Socket* qSock;
/** current receive buffer size */
unsigned int rdBufSize;
#endif
/** full-duplex socket file desciptors */
int sock[2];
/** socket notifier */
QSocketNotifier *notifier;
/** are we the host or the client object? */
bool host;
/** receive buffer */
char *rdBuf;
};
#endif // __PWM_IPC_H
diff --git a/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp b/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp
index b7944c3..1804e88 100644
--- a/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp
+++ b/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp
@@ -1,72 +1,74 @@
/*
This file is part of PwManager/Pi
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <kdebug.h>
#include "pwmconfigwidget.h"
#include "kcmpwmconfig.h"
#include "pwmprefs.h"
#include "kprefs.h"
extern "C"
{
KCModule *create_pwmconfig(QWidget *parent, const char * ) {
return new KCMPwmConfig(parent, "kcmpwmconfig" );
}
}
KCMPwmConfig::KCMPwmConfig(QWidget *parent, const char *name )
: KCModule( PWMPrefs::instance(), parent, name )
{
- QVBoxLayout *layout = new QVBoxLayout( this );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( this );
mConfigWidget = new PWMConfigWidget( (PWMPrefs*)getPreferences(), this, "mConfigWidget" );
layout->addWidget( mConfigWidget );
layout->setSpacing( 0 );
layout->setMargin( 0 );
connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}
void KCMPwmConfig::load()
{
mConfigWidget->readConfig();
}
void KCMPwmConfig::save()
{
mConfigWidget->writeConfig();
}
void KCMPwmConfig::defaults()
{
mConfigWidget->setDefaults();
}
#ifndef PWM_EMBEDDED
#include "kcmkabconfig.moc"
#endif //PWM_EMBEDDED
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp
index 2c5189c..04771b3 100644
--- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp
+++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp
@@ -1,258 +1,261 @@
/*
This file is part of KAddressBook.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include <qcheckbox.h>
-#include <qframe.h>
-#include <qgroupbox.h>
+#include <q3frame.h>
+#include <q3groupbox.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qlabel.h>
#include <qfile.h>
-#include <qvbox.h>
+#include <q3vbox.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3VBoxLayout>
#include <kconfig.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klistview.h>
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <kio/kfile/kurlrequester.h>
#include "pwmprefs.h"
#include "pwmconfigwidget.h"
#include "pwmexception.h"
PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name )
: KPrefsWidget(prefs, parent, name )
{
- QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0,
KDialog::spacingHint() );
QTabWidget *tabWidget = new QTabWidget( this );
topLayout->addWidget( tabWidget );
// windowsStyle page
//////////////////////////////////////////////////////
QWidget *windowStylePage = new QWidget( this );
- QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3);
+ Q3GridLayout *windowStyleLayout = new Q3GridLayout( windowStylePage, 3, 3);
int i = 0;
KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage);
windowStyle->addRadio(i18n("Category on top"));
windowStyle->addRadio(i18n("Category-list left/top"));
windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2);
++i;
QLabel* lab = new QLabel(i18n("Font for Password entries:"), windowStylePage);
windowStyleLayout->addMultiCellWidget( lab,i,i,0,2);
++i;
KPrefsWidFont *selEntrFont =
addWidFont(i18n("Password"),i18n("Font:"),
&(prefs->mEntryFont),windowStylePage);
windowStyleLayout->addWidget(selEntrFont->label(),i,0);
windowStyleLayout->addWidget(selEntrFont->preview(),i,1);
windowStyleLayout->addWidget(selEntrFont->button(),i,2);
++i;
lab = new QLabel(i18n("Font for Password summary:"), windowStylePage);
windowStyleLayout->addMultiCellWidget( lab,i,i,0,2);
++i;
selEntrFont =
addWidFont(i18n("Summary"),i18n("Font:"),
&(prefs->mViewFont),windowStylePage);
windowStyleLayout->addWidget(selEntrFont->label(),i,0);
windowStyleLayout->addWidget(selEntrFont->preview(),i,1);
windowStyleLayout->addWidget(selEntrFont->button(),i,2);
++i;
lab = new QLabel(i18n(""), windowStylePage);
windowStyleLayout->addMultiCellWidget( lab,i,i,0,2);
// File page
//////////////////////////////////////////////////////
QWidget *filePage = new QWidget( this );
- QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2);
+ Q3GridLayout *fileLayout = new Q3GridLayout( filePage, 3, 2);
i = 0;
QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage);
fileLayout->addWidget(kcfg_compression_label,i,0);
kcfg_compression = new QComboBox(filePage, "kcfg_compression");
kcfg_compression->insertItem(i18n("None"));
kcfg_compression->insertItem(i18n("gzip"));
//US not yet supported: kcfg_compression->insertItem(i18n("bzip2"));
fileLayout->addWidget( kcfg_compression,i,1);
++i;
QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage);
fileLayout->addWidget(kcfg_crypt_label,i,0);
kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo");
kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)"));
#ifdef CONFIG_PWMANAGER_GCRY
kcfg_cryptAlgo->insertItem(i18n("AES-128, Rijndael (128 bit)"));
kcfg_cryptAlgo->insertItem(i18n("AES-192, Rijndael (192 bit)"));
kcfg_cryptAlgo->insertItem(i18n("AES-256, Rijndael (256 bit)"));
kcfg_cryptAlgo->insertItem(i18n("Triple-DES (168 bit)"));
kcfg_cryptAlgo->insertItem(i18n("Twofish (256 bit)"));
kcfg_cryptAlgo->insertItem(i18n("Twofish-128 (128 bit)"));
#endif // CONFIG_PWMANAGER_GCRY
fileLayout->addWidget( kcfg_cryptAlgo,i,1);
++i;
QLabel* kcfg_hash_label = new QLabel(i18n("Hashing:"), filePage);
fileLayout->addWidget(kcfg_hash_label,i,0);
kcfg_hashAlgo = new QComboBox(filePage, "kcfg_hashAlgo");
kcfg_hashAlgo->insertItem(i18n("SHA-160, SHA1 (160 bit)"));
#ifdef CONFIG_PWMANAGER_GCRY
kcfg_hashAlgo->insertItem(i18n("SHA-256 (256 bit)"));
kcfg_hashAlgo->insertItem(i18n("SHA-384 (384 bit)"));
kcfg_hashAlgo->insertItem(i18n("SHA-512 (512 bit)"));
kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)"));
kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)"));
kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)"));
#endif // CONFIG_PWMANAGER_GCRY
fileLayout->addWidget( kcfg_hashAlgo,i,1);
++i;
permissionLineEdit = new QLineEdit(filePage);
QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage);
fileLayout->addWidget(permissionLineLabel,i,0);
fileLayout->addWidget(permissionLineEdit,i,1);
++i;
KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"),
&(prefs->mMakeFileBackup),filePage);
fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
// Timeout page
//////////////////////////////////////////////////////
QWidget *timeoutPage = new QWidget( this );
- QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2);
+ Q3GridLayout *timeoutLayout = new Q3GridLayout( timeoutPage, 3, 2);
i = 0;
pwTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "pwTimeoutSpinBox" );
QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("<b>Password timeout</b> (timeout to hold password in memory,so you don't have to re-enter it,if you already have entered it) [set to 0 to disable]:"), timeoutPage);
timeoutLayout->addMultiCellWidget(timeoutLabel, i, i, 0 ,1);
++i;
timeoutLayout->addMultiCellWidget(pwTimeoutSpinBox,i,i,0,1);
++i;
pwTimeoutSpinBox->setSuffix ( i18n(" sec") );
lockTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "lockTimeoutSpinBox" );
QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("<b>Auto-lock timeout</b> (auto lock document after this\namount of seconds) [set to 0 to disable]:"), timeoutPage);
timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,1);
++i;
timeoutLayout->addMultiCellWidget(lockTimeoutSpinBox,i,i,0,1);
lockTimeoutSpinBox->setSuffix ( i18n(" sec") );
++i;
sb = addWidBool(i18n("deep-lock on autolock"),
&(prefs->mAutoDeeplock),timeoutPage);
timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),timeoutPage);
timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
// Autostart page
//////////////////////////////////////////////////////
QWidget *autostartPage = new QWidget( this );
- QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2);
+ Q3GridLayout *autostartLayout = new Q3GridLayout( autostartPage, 3, 2);
i = 0;
autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit");
QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage);
autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1);
++i;
autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1);
++i;
sb = addWidBool(i18n("open deeplocked"),
&(prefs->mAutostartDeeplocked),autostartPage);
autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
// external app page
//////////////////////////////////////////////////////
QWidget *externalappPage = new QWidget( this );
- QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2);
+ Q3GridLayout *externalappLayout = new Q3GridLayout( externalappPage, 3, 2);
i = 0;
browserLineEdit = new QLineEdit(externalappPage);
QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage);
externalappLayout->addWidget(browserLineLabel,i,0);
externalappLayout->addWidget(browserLineEdit,i,1);
++i;
xtermLineEdit = new QLineEdit(externalappPage);
QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage);
externalappLayout->addWidget(xtermLineLabel,i,0);
externalappLayout->addWidget(xtermLineEdit,i,1);
++i;
#if 0
// miscelaneous page
//////////////////////////////////////////////////////
QWidget *miscPage = new QWidget( this );
- QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2);
+ Q3GridLayout *miscLayout = new Q3GridLayout( miscPage, 3, 2);
i = 0;
/*US ENH: PWM/Pi has no tray and con be minimized
sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage);
miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
*/
sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage);
miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
/*US ENH: PWM/Pi has no tray and con be minimized
sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage);
miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage);
minimizeRadio->addRadio(i18n("don't lock"));
minimizeRadio->addRadio(i18n("normal lock"));
minimizeRadio->addRadio(i18n("deep-lock"));
miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2);
++i;
sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage);
miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage);
miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1);
++i;
@@ -330,36 +333,36 @@ int PWMConfigWidget::getFilePermissions()
for (j = 0; j < 8; ++j) {
if (permString.at(i) == octalDigits[j]) {
isOctal = true;
break;
}
}
if (!isOctal) {
printWarn("CONFIG: File-permissions: This is "
"not an octal number ");
return CONF_DEFAULT_FILEPERMISSIONS;
}
}
int ret = strtol(permString.latin1(), 0, 8);
if (ret == 0) {
/* either an error occured, or the user did really type 000 */
printWarn("CONFIG: File-permissions: Hm, either conversion error, "
"or you really typed 000. 8-)");
return CONF_DEFAULT_FILEPERMISSIONS;
}
return ret;
}
void PWMConfigWidget::setFilePermissions(int perm)
{
char tmpBuf[30];
sprintf(tmpBuf, "%o", perm);
permissionLineEdit->setText(tmpBuf);
}
-#ifndef PWM_EMBEDDED
-#include "pwmconfigwidget.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmconfigwidget.cpp"
#endif //PWM_EMBEDDED
diff --git a/pwmanager/pwmanager/listobjselectwnd.cpp b/pwmanager/pwmanager/listobjselectwnd.cpp
index 59729f1..7da7e95 100644
--- a/pwmanager/pwmanager/listobjselectwnd.cpp
+++ b/pwmanager/pwmanager/listobjselectwnd.cpp
@@ -1,80 +1,83 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "listobjselectwnd.h"
#include <klocale.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
ListObjSelectWnd::ListObjSelectWnd(const QString &caption, const QString &titleText,
QWidget *parent, bool multiSel, const char *name,
- bool modal, WFlags f)
+ bool modal, Qt::WFlags f)
: QDialog(parent, name, modal, f)
{
- vbox1 = new QVBox(this);
+ vbox1 = new Q3VBox(this);
title = new QLabel(vbox1);
- list = new QListBox(vbox1);
+ list = new Q3ListBox(vbox1);
if (multiSel) {
- hbox2 = new QHBox(vbox1);
+ hbox2 = new Q3HBox(vbox1);
selAllButton = new QPushButton(i18n("&Select all"), hbox2);
unselAllButton = new QPushButton(i18n("&Unselect all"), hbox2);
}
- hbox1 = new QHBox(vbox1);
+ hbox1 = new Q3HBox(vbox1);
okButton = new QPushButton(i18n("&Ok"), hbox1);
cancelButton = new QPushButton(i18n("&Cancel"), hbox1);
vbox1->setSpacing(10);
vbox1->setMargin(10);
hbox1->setSpacing(10);
resize(250, 300);
setCaption(caption);
if (multiSel) {
- list->setSelectionMode(QListBox::Multi);
+ list->setSelectionMode(Q3ListBox::Multi);
}
title->setAlignment(Qt::AlignHCenter | Qt::WordBreak);
title->setText(titleText);
connect(okButton, SIGNAL(clicked()),
this, SLOT(okButton_slot()));
connect(cancelButton, SIGNAL(clicked()),
this, SLOT(cancelButton_slot()));
if (multiSel) {
connect(selAllButton, SIGNAL(clicked()),
this, SLOT(selAllButton_slot()));
connect(unselAllButton, SIGNAL(clicked()),
this, SLOT(unselAllButton_slot()));
}
}
ListObjSelectWnd::~ListObjSelectWnd()
{
}
void ListObjSelectWnd::resizeEvent(QResizeEvent *)
{
vbox1->resize(size());
}
void ListObjSelectWnd::okButton_slot()
{
unsigned int cnt = list->count(), i;
for (i = 0; i < cnt; ++i) {
if (list->isSelected(i)) {
done(1);
@@ -97,35 +100,35 @@ void ListObjSelectWnd::selAllButton_slot()
}
void ListObjSelectWnd::unselAllButton_slot()
{
unsigned int cnt = list->count(), i;
for (i = 0; i < cnt; ++i) {
list->setSelected(i, false);
}
}
QStringList ListObjSelectWnd::getSelectedList()
{
QStringList ret;
unsigned int cnt = list->count(), i;
for (i = 0; i < cnt; ++i) {
if (list->isSelected(i)) {
#ifndef PWM_EMBEDDED
ret.push_back(list->text(i));
#else
ret.append(list->text(i));
#endif
}
}
return ret;
}
void ListObjSelectWnd::setList(const QStringList &_list)
{
list->clear();
list->insertStringList(_list);
}
-#ifndef PWM_EMBEDDED
-#include "listobjselectwnd.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_listobjselectwnd.cpp"
#endif
diff --git a/pwmanager/pwmanager/listobjselectwnd.h b/pwmanager/pwmanager/listobjselectwnd.h
index 3b5f1eb..df3da93 100644
--- a/pwmanager/pwmanager/listobjselectwnd.h
+++ b/pwmanager/pwmanager/listobjselectwnd.h
@@ -1,85 +1,87 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef LISTOBJSELECTWND_H
#define LISTOBJSELECTWND_H
#include <qdialog.h>
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qlabel.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qpushbutton.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <QResizeEvent>
/** Display a list-window for selection of some objects */
class ListObjSelectWnd : public QDialog
{
Q_OBJECT
public:
ListObjSelectWnd(const QString &caption, const QString &titleText,
QWidget *parent = 0, bool multiSel = false,
const char *name = 0,
- bool modal = FALSE, WFlags f = 0);
+ bool modal = FALSE, Qt::WFlags f = 0);
~ListObjSelectWnd();
void setList(const QStringList &_list);
void addObj(const QString &name)
{ list->insertItem(name); }
void selectObj(const QString &name)
#ifndef PWM_EMBEDDED
{ list->setCurrentItem(list->findItem(name, Qt::ExactMatch)); }
#else
{ list->setCurrentItem(list->findItem(name)); }
#endif
QString getSelected()
{ return list->currentText(); }
int getSelectedIndex()
#ifndef PWM_EMBEDDED
{ return list->index(list->selectedItem()); }
#else
{ return list->currentItem(); }
#endif
QStringList getSelectedList();
void clearObjs()
{ list->clear(); }
protected:
- QVBox *vbox1;
- QHBox *hbox1;
- QHBox *hbox2;
+ Q3VBox *vbox1;
+ Q3HBox *hbox1;
+ Q3HBox *hbox2;
QLabel *title;
- QListBox *list;
+ Q3ListBox *list;
QPushButton *okButton;
QPushButton *cancelButton;
QPushButton *selAllButton;
QPushButton *unselAllButton;
protected:
void resizeEvent(QResizeEvent *);
protected slots:
void okButton_slot();
void cancelButton_slot();
void selAllButton_slot();
void unselAllButton_slot();
};
#endif
diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp
index 0df9431..4253ab1 100644
--- a/pwmanager/pwmanager/listviewpwm.cpp
+++ b/pwmanager/pwmanager/listviewpwm.cpp
@@ -1,129 +1,132 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "listviewpwm.h"
#include "pwmexception.h"
#include "pwmview.h"
#include <qpainter.h>
#include <qpixmap.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QKeyEvent>
#include <kiconloader.h>
#ifdef PWM_EMBEDDED
#include <kglobal.h>
#endif
ListViewPwM::ListViewPwM(QWidget *parent, const char *name)
: KListView(parent, name)
{
// setResizeMode(QListView::AllColumns);
setAllColumnsShowFocus (true );
}
bool ListViewPwM::event(QEvent *e)
{
- if (e->type() == QEvent::LayoutHint)
+ if (e->type() == QEvent::LayoutRequest)
emit layoutChanged();
if (e->type() == QEvent::KeyPress) {
QKeyEvent* ke = (QKeyEvent*) e;
if ( ke->key() == Qt::Key_Space) {
emit toggleOverview();
return true;
}
if ( ke->key() == Qt::Key_I || ke->key() == Qt::Key_N || ke->key() == Qt::Key_Insert) {
emit insertPW();
return true;
}
if ( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace) {
emit deletePW();
return true;
}
}
return KListView::event(e);
}
QPixmap * ListViewItemPwM::onPix = 0;
QPixmap * ListViewItemPwM::offPix = 0;
-ListViewItemPwM::ListViewItemPwM(QListView *parent)
- : QCheckListItem(parent, "", QCheckListItem::CheckBox)
+ListViewItemPwM::ListViewItemPwM(Q3ListView *parent)
+ : Q3CheckListItem(parent, "", Q3CheckListItem::CheckBox)
{
if (!onPix) {
PWM_ASSERT(!offPix);
KIconLoader* picons;
#ifndef PWM_EMBEDDED
KIconLoader il;
picons = &il;
#else
picons = KGlobal::iconLoader();
#endif
KIconLoader il;
#ifndef PWM_EMBEDDED
static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small));
#else
static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small));
#endif
onPix = &onP;
static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small));
offPix = &offP;
}
}
void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int align)
{
// qDebug("ListViewItemPwM::paintCell column=%i", column);
if (!p)
return;
//US BUG:
if (column != COLUMN_DESC) {
- QCheckListItem::paintCell(p, cg, column, width, align);
+ Q3CheckListItem::paintCell(p, cg, column, width, align);
return;
}
QPixmap *curPix = isOn() ? onPix : offPix;
int pixSpace = curPix->width();
pixSpace += 4;
#ifndef PWM_EMBEDDED
QRect window(p->viewport());
// clear the rectangle (we have to clear it first. see QT doc)
p->eraseRect(0, 0, pixSpace, window.height());
// now draw the pixmap
int y = (height() - curPix->height()) / 2;
p->drawPixmap(1, y, *curPix);
window.moveLeft(pixSpace);
p->setViewport(window);
#else
p->eraseRect(0, 0, pixSpace, height());
// now draw the pixmap
int y = (height() - curPix->height()) / 2;
p->drawPixmap(1, y, *curPix);
p->translate( pixSpace, 0 );
#endif
- QListViewItem::paintCell(p, cg, column, width - pixSpace, align);
+ Q3ListViewItem::paintCell(p, cg, column, width - pixSpace, align);
}
-#ifndef PWM_EMBEDDED
-#include "listviewpwm.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_listviewpwm.cpp"
#endif
diff --git a/pwmanager/pwmanager/listviewpwm.h b/pwmanager/pwmanager/listviewpwm.h
index 51008b8..2652939 100644
--- a/pwmanager/pwmanager/listviewpwm.h
+++ b/pwmanager/pwmanager/listviewpwm.h
@@ -1,60 +1,63 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __LISTVIEW_H
#define __LISTVIEW_H
#include <klistview.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QPixmap>
/** PwManager implementation of the list view.
* Derived from KListView.
*/
class ListViewPwM : public KListView
{
Q_OBJECT
public:
ListViewPwM(QWidget *parent = 0, const char *name = 0);
signals:
void layoutChanged();
void toggleOverview();
void insertPW();
void deletePW( );
protected:
virtual bool event(QEvent *e);
};
-class ListViewItemPwM : public QCheckListItem
+class ListViewItemPwM : public Q3CheckListItem
{
public:
- ListViewItemPwM(QListView *parent);
+ ListViewItemPwM(Q3ListView *parent);
protected:
void paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int align);
protected:
/** pixmap to display for an item with state "on" */
static QPixmap *onPix;
/** pixmap to display for an item with state "off" */
static QPixmap *offPix;
};
#endif
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp
index ee26082..acb0011 100644
--- a/pwmanager/pwmanager/main.cpp
+++ b/pwmanager/pwmanager/main.cpp
@@ -113,64 +113,65 @@ static void addAuthors(KAboutData *aboutData)
"numerous view-improvements."),
"mscifo@o1.com");
aboutData->addCredit("Elias Probst",
I18N_NOOP(
"Gentoo ebuild maintainer."),
"elias.probst@gmx.de");
aboutData->addCredit("George Staikos",
I18N_NOOP("KWallet"),
"staikos@kde.org");
aboutData->addCredit("Matthew Palmer",
I18N_NOOP("rc2 code"),
"mjp16@uow.edu.au");
aboutData->addCredit("Olivier Sessink",
I18N_NOOP("gpasman"),
"gpasman@nl.linux.org");
aboutData->addCredit("The libgcrypt developers",
I18N_NOOP("Blowfish and SHA1 algorithms"),
0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/");
aboutData->addCredit("Troy Engel",
I18N_NOOP("kpasman"),
"tengel@sonic.net");
aboutData->addCredit("Wickey",
I18N_NOOP("graphics-design in older versions."),
"wickey@gmx.at");
aboutData->addCredit("Ian MacGregor",
I18N_NOOP(
"original documentation author."));
}
#endif
int main(int argc, char *argv[])
{
+ if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi");
printDebugConfigureInfo();
#ifndef PWM_EMBEDDED
KAboutData aboutData(PACKAGE_NAME, PROG_NAME,
PACKAGE_VER, description, KAboutData::License_File,
"(c) 2003, 2004 Michael Buesch and the PwManager Team", 0,
"http://passwordmanager.sourceforge.net/",
"mbuesch@freenet.de");
addAuthors(&aboutData);
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(options);
KUniqueApplication::addCmdLineOptions();
if (!KUniqueApplication::start()) {
printInfo("already running.");
return EXIT_SUCCESS;
}
PwMApplication a;
aboutData.setLicenseTextFile(LICENSE_FILE);
return a.exec();
#else
bool exitHelp = false;
if ( argc > 1 ) {
QString command = argv[1];
if ( command == "-help" ){
printf("PWM/PI command line commands:\n");
printf(" no command: Start PWM/PI in usual way\n");
printf(" -help: This output\n");
printf(" PWM/PI is exiting now. Bye!\n");
exitHelp = true;
}
diff --git a/pwmanager/pwmanager/printtext.h b/pwmanager/pwmanager/printtext.h
index 82e31b0..71bc2e0 100644
--- a/pwmanager/pwmanager/printtext.h
+++ b/pwmanager/pwmanager/printtext.h
@@ -1,68 +1,68 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef PRINTTEXT_H
#define PRINTTEXT_H
#include <kprinter.h>
#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <q3paintdevicemetrics.h>
#include <qrect.h>
#include <qpoint.h>
/** prints text "raw" to a printer */
class PrintText : public KPrinter
{
public:
PrintText();
~PrintText();
/** begin printing. Call this before drawing to the device! */
void beginPrint();
/** prints a line */
void printLine(QString t);
/** returns a pointer to the paint object */
QPainter* getPaint()
{ return paint; }
/** sets the header-text */
void setHeader(const QString &left, const QString &middle);
/** returns the header-text */
void getHeader(QString *left, QString *middle);
protected:
/** painter object */
QPainter *paint;
/** metrics */
- QPaintDeviceMetrics *metrics;
+ Q3PaintDeviceMetrics *metrics;
/** left field of header */
QString headerLeft;
/** middle field of header */
QString headerMiddle;
/** right field of header */
QString headerRight;
/** current Y-Position */
int curYPos;
/** text-body rectangle */
QRect body;
/** line-spacing */
int ls;
/** top-left point for beginning printing */
QPoint topLeft;
/** current page number */
int page;
protected:
/** prints the header on the page */
void printHeader();
};
#endif
diff --git a/pwmanager/pwmanager/pwgenwnd_emb.cpp b/pwmanager/pwmanager/pwgenwnd_emb.cpp
index 429904c..21e0af4 100644
--- a/pwmanager/pwmanager/pwgenwnd_emb.cpp
+++ b/pwmanager/pwmanager/pwgenwnd_emb.cpp
@@ -1,127 +1,130 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "pwgenwnd_emb.h"
#include <qpushbutton.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qspinbox.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include "klocale.h"
/*
* Constructs a pwGenWnd as a child of 'parent', with the
* name 'name'.
*
*/
pwGenWnd::pwGenWnd( QWidget* parent, const char* name)
: KDialogBase( KDialogBase::Plain, i18n( "Password generator" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
- QVBoxLayout* pwGenWndLayout = new QVBoxLayout( page, 11, 6, "pwGenWndLayout");
+ Q3VBoxLayout* pwGenWndLayout = new Q3VBoxLayout( page, 11, 6, "pwGenWndLayout");
- QGroupBox* groupBox1 = new QGroupBox( page, "groupBox1" );
+ Q3GroupBox* groupBox1 = new Q3GroupBox( page, "groupBox1" );
groupBox1->setTitle( i18n( "Character set:" ) );
groupBox1->setColumnLayout(0, Qt::Vertical );
groupBox1->layout()->setSpacing( 6 );
groupBox1->layout()->setMargin( 11 );
- QVBoxLayout* groupBox1Layout = new QVBoxLayout( groupBox1->layout() );
+ Q3VBoxLayout* groupBox1Layout = new Q3VBoxLayout( groupBox1->layout() );
groupBox1Layout->setAlignment( Qt::AlignTop );
int_charLowerCheckBox = new QCheckBox( i18n("Lowercase (abc)"), groupBox1, "int_charLowerCheckBox" );
int_charLowerCheckBox->setChecked( TRUE );
groupBox1Layout->addWidget( int_charLowerCheckBox );
int_charUpperCheckBox = new QCheckBox( i18n("Uppercase (ABC)"), groupBox1, "int_charUpperCheckBox" );
int_charUpperCheckBox->setChecked( TRUE );
groupBox1Layout->addWidget( int_charUpperCheckBox );
int_charNumCheckBox = new QCheckBox( i18n("Numbers (123)"), groupBox1, "int_charNumCheckBox" );
int_charNumCheckBox->setChecked( TRUE );
groupBox1Layout->addWidget( int_charNumCheckBox );
int_charSpecCheckBox = new QCheckBox( i18n("Special characters:"), groupBox1, "int_charSpecCheckBox" );
groupBox1Layout->addWidget( int_charSpecCheckBox );
QLabel* textLabel7 = new QLabel( groupBox1, "textLabel7" );
QString st("\x21\x22\xc2\xa7\x24\x25\x26\x2f\x28\x29\x3d\x3f\x2c\x2e\x2d\x3b\x3a\x5f\x2b");
textLabel7->setText( st.utf8() );
groupBox1Layout->addWidget( textLabel7 );
int_charBlankCheckBox = new QCheckBox( i18n( "Spaces (blank characters)"), groupBox1, "int_charBlankCheckBox" );
groupBox1Layout->addWidget( int_charBlankCheckBox );
- QHBoxLayout* layout7 = new QHBoxLayout( 0, 0, 6, "layout7");
+ Q3HBoxLayout* layout7 = new Q3HBoxLayout( 0, 0, 6, "layout7");
int_charUserCheckBox = new QCheckBox( i18n("User defined:"), groupBox1, "int_charUserCheckBox" );
layout7->addWidget( int_charUserCheckBox );
int_userDefLineEdit = new QLineEdit( groupBox1, "int_userDefLineEdit" );
int_userDefLineEdit->setEnabled( FALSE );
layout7->addWidget( int_userDefLineEdit );
groupBox1Layout->addLayout( layout7 );
pwGenWndLayout->addWidget( groupBox1 );
- QHBoxLayout* layout8 = new QHBoxLayout( 0, 0, 6, "layout8");
+ Q3HBoxLayout* layout8 = new Q3HBoxLayout( 0, 0, 6, "layout8");
int_lenSpinBox = new QSpinBox( page, "int_lenSpinBox" );
QLabel* textLabel2 = new QLabel( int_lenSpinBox, i18n("Password Length:"), page, "textLabel2" );
layout8->addWidget( textLabel2 );
int_lenSpinBox->setMaxValue( 9999 );
int_lenSpinBox->setMinValue( 1 );
int_lenSpinBox->setValue( 8 );
layout8->addWidget( int_lenSpinBox );
pwGenWndLayout->addLayout( layout8 );
int_filterCheckBox = new QCheckBox( i18n( "Enable Filtering to get better passwords" ), page, "int_filterCheckBox" );
int_filterCheckBox->setChecked( TRUE );
pwGenWndLayout->addWidget( int_filterCheckBox );
setButtonText( KDialogBase::Ok, "&Generate now" );
// signals and slots connections
connect( int_charUserCheckBox, SIGNAL( toggled(bool) ), int_userDefLineEdit, SLOT( setEnabled(bool) ) );
}
/*
* Destroys the object and frees any allocated resources
*/
pwGenWnd::~pwGenWnd()
{
// no need to delete child widgets, Qt does it all for us
}
void pwGenWnd::cancelButton_slot()
{
qWarning( "pwGenWnd::cancelButton_slot(): Not implemented yet" );
diff --git a/pwmanager/pwmanager/pwgenwndimpl.cpp b/pwmanager/pwmanager/pwgenwndimpl.cpp
index 5313060..0eb7043 100644
--- a/pwmanager/pwmanager/pwgenwndimpl.cpp
+++ b/pwmanager/pwmanager/pwgenwndimpl.cpp
@@ -5,65 +5,65 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwgenwndimpl.h"
#include "pwmexception.h"
#include "genpasswd.h"
#include <qtabwidget.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <klocale.h>
#include <kmessagebox.h>
#ifndef PWM_EMBEDDED
PwGenWndImpl::PwGenWndImpl(QWidget *parent,
const char *name,
bool modal,
- WFlags fl)
+ Qt::WFlags fl)
: pwGenWnd(parent, name, modal, fl)
{
}
#else
PwGenWndImpl::PwGenWndImpl( QWidget* parent, const char* name)
: pwGenWnd( parent, name)
{
}
#endif
PwGenWndImpl::~PwGenWndImpl()
{
}
#ifdef PWM_EMBEDDED
void PwGenWndImpl::slotOk()
{
// internal generator
if (!optionsSanityIntGen())
return;
if (!startIntGen())
return;
KDialogBase::slotOk();
}
#endif
void PwGenWndImpl::genButton_slot()
{
#ifndef PWM_EMBEDDED
// internal generator
diff --git a/pwmanager/pwmanager/pwgenwndimpl.h b/pwmanager/pwmanager/pwgenwndimpl.h
index 994ff2f..1e706a1 100644
--- a/pwmanager/pwmanager/pwgenwndimpl.h
+++ b/pwmanager/pwmanager/pwgenwndimpl.h
@@ -4,63 +4,63 @@
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __PWGENWNDIMPL_H
#define __PWGENWNDIMPL_H
#ifndef PWM_EMBEDDED
#include "pwgenwnd.h"
#else
#include "pwgenwnd_emb.h"
#endif
class PwGenWndImpl : public pwGenWnd
{
public:
#ifndef PWM_EMBEDDED
PwGenWndImpl(QWidget *parent = 0,
const char *name = 0,
bool modal = FALSE,
- WFlags fl = 0);
+ Qt::WFlags fl = 0);
#else
PwGenWndImpl( QWidget* parent = 0, const char* name = 0);
#endif
~PwGenWndImpl();
/** returns the generated password */
QString getPassword();
protected slots:
/** generate button pressed */
void genButton_slot();
#ifdef PWM_EMBEDDED
virtual void slotOk();
#endif
/** cancel button pressed */
void cancelButton_slot();
protected:
/** start the internal generator */
bool startIntGen();
/** check all options of the internal generator */
bool optionsSanityIntGen();
protected:
/** the generated password */
QString password;
};
#endif // __PWGENWNDIMPL_H
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 8373850..694fb13 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1,59 +1,65 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include <klocale.h>
#include <klistview.h>
#include <ktoolbar.h>
#include <kfiledialog.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <qstatusbar.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <QHideEvent>
+#include <QFocusEvent>
+#include <QCloseEvent>
#ifndef PWM_EMBEDDED
#include <kmenubar.h>
#include <kstatusbar.h>
#include <dcopclient.h>
#include "configwndimpl.h"
#include "configuration.h"
#else
#include <qmenubar.h>
#include <qmessagebox.h>
#include <pwmprefs.h>
#include <kpimglobalprefs.h>
#include <kprefsdialog.h>
#include <kcmconfigs/kcmpwmconfig.h>
#include <kcmconfigs/kcmkdepimconfig.h>
#include <kcmultidialog.h>
#include "editcategory.h"
#endif
#ifndef DESKTOP_VERSION
#include <qpe/global.h>
#endif
#include <qpixmap.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qlineedit.h>
#include <qfileinfo.h>
#include <qclipboard.h>
@@ -157,255 +163,255 @@ enum {
enum {
BUTTON_TOOL_NEW = 0,
BUTTON_TOOL_OPEN,
BUTTON_TOOL_SAVE,
BUTTON_TOOL_SAVEAS,
BUTTON_TOOL_PRINT,
BUTTON_TOOL_ADD,
BUTTON_TOOL_EDIT,
BUTTON_TOOL_DEL,
BUTTON_TOOL_FIND,
BUTTON_TOOL_LOCK,
BUTTON_TOOL_DEEPLOCK,
BUTTON_TOOL_UNLOCK
};
PwM::PwM(PwMInit *_init, PwMDoc *doc,
bool virginity,
QWidget *parent, const char *name)
: KMainWindow(parent, "HALLO")
, forceQuit (false)
, forceMinimizeToTray (false)
{
syncManager = 0;
virgin = !virginity;
init = _init;
connect(doc, SIGNAL(docClosed(PwMDoc *)),
this, SLOT(docClosed(PwMDoc *)));
initMenubar();
initToolbar();
initMetrics();
setVirgin(virginity);
- setFocusPolicy(QWidget::WheelFocus);
+ setFocusPolicy(Qt::WheelFocus);
#ifndef PWM_EMBEDDED
statusBar()->show();
#endif
view = makeNewListView(doc);
setCentralWidget(view);
updateCaption();
showStatMsg(i18n("Ready."));
}
PwM::~PwM()
{
//qDebug("PwM::~PwM() %x", this);
disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
this, SLOT(docClosed(PwMDoc *)));
conf()->confWndMainWndSize(size());
//LR closing of windows changed
//needed for fastload option on PDA
//emit closed(this);
//qDebug("PwM::~PwM() emited closed(this)");
delete view;
delete syncManager;
}
void PwM::initMenubar()
{
KIconLoader* picons;
#ifndef PWM_EMBEDDED
KIconLoader icons;
picons = &icons;
#else
picons = KGlobal::iconLoader();
syncPopup = new KPopupMenu(this);
syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
syncManager->setBlockSave(false);
connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
syncManager->fillSyncMenu();
#endif
filePopup = new KPopupMenu(this);
importPopup = new KPopupMenu(filePopup);
exportPopup = new KPopupMenu(filePopup);
managePopup = new KPopupMenu(this);
#ifdef CONFIG_KEYCARD
chipcardPopup = new KPopupMenu(this);
#endif // CONFIG_KEYCARD
viewPopup = new KPopupMenu(this);
optionsPopup = new KPopupMenu(this);
// "file" popup menu
- filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("filenew", KIcon::Small)),
i18n("&New"), this,
SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
- filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("fileopen", KIcon::Small)),
i18n("&Open"), this,
SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
- filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("fileclose", KIcon::Small)),
i18n("&Close"), this,
SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
filePopup->insertSeparator();
- filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("filesave", KIcon::Small)),
i18n("&Save"), this,
SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
- filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("filesaveas", KIcon::Small)),
i18n("Save &as..."),
this, SLOT(saveAs_slot()), 0,
BUTTON_POPUP_FILE_SAVEAS);
filePopup->insertSeparator();
// "file/export" popup menu
exportPopup->insertItem(i18n("&Text-file..."), this,
SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV);
#ifdef CONFIG_KWALLETIF
exportPopup->insertItem(i18n("&KWallet..."), this,
SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
#endif
- filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("fileexport", KIcon::Small)),
i18n("E&xport"), exportPopup,
BUTTON_POPUP_FILE_EXPORT);
// "file/import" popup menu
importPopup->insertItem(i18n("&Text-file..."), this,
SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV);
#ifdef CONFIG_KWALLETIF
importPopup->insertItem(i18n("&KWallet..."), this,
SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
#endif
- filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("fileimport", KIcon::Small)),
i18n("I&mport"), importPopup,
BUTTON_POPUP_FILE_IMPORT);
filePopup->insertSeparator();
#if 0
- filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("fileprint", KIcon::Small)),
i18n("&Print..."), this,
SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
filePopup->insertSeparator();
#endif
- filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
+ filePopup->insertItem(QIcon(picons->loadIcon("exit", KIcon::Small)),
i18n("&Quit"), this,
SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
menuBar()->insertItem(i18n("&File"), filePopup);
// "manage" popup menu
- managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
+ managePopup->insertItem(QIcon(picons->loadIcon("pencil", KIcon::Small)),
i18n("&Add password"), this,
SLOT(addPwd_slot()), 0,
BUTTON_POPUP_MANAGE_ADD);
managePopup->insertSeparator();
- managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
+ managePopup->insertItem(QIcon(picons->loadIcon("edit", KIcon::Small)),
i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
BUTTON_POPUP_MANAGE_EDIT);
- managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
+ managePopup->insertItem(QIcon(picons->loadIcon("editdelete", KIcon::Small)),
i18n("&Delete"), this, SLOT(deletePwd_slot()),
0, BUTTON_POPUP_MANAGE_DEL);
managePopup->insertSeparator();
- managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
+ managePopup->insertItem(QIcon(picons->loadIcon("rotate", KIcon::Small)),
i18n("Change &Master Password"), this,
SLOT(changeMasterPwd_slot()), 0,
BUTTON_POPUP_MANAGE_CHANGEMP);
menuBar()->insertItem(i18n("&Manage"), managePopup);
// "chipcard" popup menu
#ifdef CONFIG_KEYCARD
- chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
+ chipcardPopup->insertItem(QIcon(picons->loadIcon("filenew", KIcon::Small)),
i18n("&Generate new key-card"), this,
SLOT(genNewCard_slot()), 0,
BUTTON_POPUP_CHIPCARD_GENNEW);
- chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
+ chipcardPopup->insertItem(QIcon(picons->loadIcon("editdelete", KIcon::Small)),
i18n("&Erase key-card"), this,
SLOT(eraseCard_slot()), 0,
BUTTON_POPUP_CHIPCARD_DEL);
- chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
+ chipcardPopup->insertItem(QIcon(picons->loadIcon("", KIcon::Small)),
i18n("Read card-&ID"), this,
SLOT(readCardId_slot()), 0,
BUTTON_POPUP_CHIPCARD_READID);
chipcardPopup->insertSeparator();
- chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
+ chipcardPopup->insertItem(QIcon(picons->loadIcon("2rightarrow", KIcon::Small)),
i18n("&Make card backup-image"), this,
SLOT(makeCardBackup_slot()), 0,
BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
- chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
+ chipcardPopup->insertItem(QIcon(picons->loadIcon("2leftarrow", KIcon::Small)),
i18n("&Replay card backup-image"), this,
SLOT(replayCardBackup_slot()), 0,
BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
#endif // CONFIG_KEYCARD
// "view" popup menu
- viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
+ viewPopup->insertItem(QIcon(picons->loadIcon("find", KIcon::Small)),
i18n("&Find"), this,
SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
viewPopup->insertSeparator();
- viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
+ viewPopup->insertItem(QIcon(picons->loadIcon("halfencrypted", KIcon::Small)),
i18n("&Lock all entries"), this,
SLOT(lockWnd_slot()), 0,
BUTTON_POPUP_VIEW_LOCK);
- viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
+ viewPopup->insertItem(QIcon(picons->loadIcon("encrypted", KIcon::Small)),
i18n("&Deep-lock all entries"), this,
SLOT(deepLockWnd_slot()), 0,
BUTTON_POPUP_VIEW_DEEPLOCK);
- viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
+ viewPopup->insertItem(QIcon(picons->loadIcon("decrypted", KIcon::Small)),
i18n("&Unlock all entries"), this,
SLOT(unlockWnd_slot()), 0,
BUTTON_POPUP_VIEW_UNLOCK);
menuBar()->insertItem(i18n("&View"), viewPopup);
// "options" popup menu
- optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
+ optionsPopup->insertItem(QIcon(picons->loadIcon("configure", KIcon::Small)),
i18n("&Configure PwM/Pi..."), this,
SLOT(config_slot()),0,
BUTTON_POPUP_OPTIONS_CONFIG);
- optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
+ optionsPopup->insertItem(QIcon(picons->loadIcon("configure", KIcon::Small)),
i18n("Global Settings..."), this,
SLOT(config_global_slot()),0,
BUTTON_POPUP_OPTIONS_GLOBAL_CONFIG);
if ( QApplication::desktop()->width() <= 240 ) {
managePopup->insertSeparator();
managePopup->insertItem(i18n("&Options"), optionsPopup);
} else
menuBar()->insertItem(i18n("&Options"), optionsPopup);
// "help" popup menu
#ifndef PWM_EMBEDDED
helpPopup = helpMenu(QString::null, false);
#else
- optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
+ optionsPopup->insertItem(QIcon(picons->loadIcon("configure", KIcon::Small)),
i18n("C&ategories..."), this,
SLOT(category_slot()),0,
BUTTON_POPUP_OPTIONS_CATEGORY);
menuBar()->insertItem(i18n("&Sync"), syncPopup);
helpPopup = new KPopupMenu(this);
helpPopup->insertItem(i18n("&License"), this,
SLOT(showLicense_slot()), 0,
BUTTON_POPUP_HELP_LICENSE);
helpPopup->insertItem(i18n("&Faq"), this,
SLOT(faq_slot()), 0,
BUTTON_POPUP_HELP_FAQ);
helpPopup->insertItem(i18n("&About PwManager"), this,
SLOT(createAboutData_slot()), 0,
BUTTON_POPUP_HELP_ABOUT);
helpPopup->insertItem(i18n("&Sync HowTo"), this,
SLOT(syncHowTo_slot()), 0,
BUTTON_POPUP_HELP_SYNC);
helpPopup->insertItem(i18n("&What's New"), this,
SLOT(whatsnew_slot()), 0,
@@ -893,70 +899,70 @@ void PwM::config_slot()
if ( QApplication::desktop()->height() <= 480 )
;// ConfigureDialog->hideButtons();
ConfigureDialog->showMaximized();
#endif
if ( ConfigureDialog->exec() )
KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
delete ConfigureDialog;
int newStyle = conf()->confWndMainViewStyle();
// reinitialize tray
init->initTray();
// reinitialize KWallet emulation
init->initKWalletEmu();
PwMDocList *_dl = PwMDoc::getOpenDocList();
const vector<PwMDocList::listItem> *dl = _dl->getList();
vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
end = dl->end();
PwMDoc *doc;
while (i != end) {
doc = (*i).doc;
// unlock-without-mpw timeout
doc->timer()->start(DocTimer::id_mpwTimer);
// auto-lock timeout
doc->timer()->start(DocTimer::id_autoLockTimer);
++i;
}
- const QValueList<PwM *> *ml = init->mainWndList();
+ const Q3ValueList<PwM *> *ml = init->mainWndList();
#ifndef PWM_EMBEDDED
- QValueList<PwM *>::const_iterator i2 = ml->begin(),
+ Q3ValueList<PwM *>::const_iterator i2 = ml->begin(),
end2 = ml->end();
#else
- QValueList<PwM *>::ConstIterator i2 = ml->begin(),
+ Q3ValueList<PwM *>::ConstIterator i2 = ml->begin(),
end2 = ml->end();
#endif
PwM *pwm;
while (i2 != end2) {
pwm = *i2;
// reinitialize the window style.
if (oldStyle != newStyle)
pwm->curView()->initStyle(newStyle);
// set the new font
pwm->curView()->setFont(conf()->confGlobEntryFont());
++i2;
}
}
void PwM::activateMpButton(bool activate)
{
managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate);
}
void PwM::closeEvent(QCloseEvent *e)
{
//qDebug("PwM::closeEvent ");
emit closed( this );
return;
e->accept();
}
void PwM::docClosed(PwMDoc *doc)
{
//qDebug("PwM::docClosed ");
PARAM_UNUSED(doc);
PWM_ASSERT(doc == curDoc());
@@ -1565,35 +1571,35 @@ void PwM::createAboutData_slot()
//this are the overwritten callbackmethods from the syncinterface
bool PwM::sync(KSyncManager* manager, QString filename, int mode,QString resource)
{
PWM_ASSERT(curDoc());
bool ret = curDoc()->sync(manager, filename, mode,resource);
qDebug("PwM::sync save now: ret=%i", ret);
if (ret == true) {
//US BUG: what can we call here to update the view of the current doc?
//mViewManager->refreshView();
//US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
save();
}
return ret;
}
void PwM::removeSyncInfo( QString syncProfile)
{
qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1());
curDoc()->removeSyncInfo( syncProfile );
//US curDoc()->removeSyncInfo sets the dirtyFlag.
}
#endif
-#ifndef PWM_EMBEDDED
-#include "pwm.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwm.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h
index c4bbb4e..450d13f 100644
--- a/pwmanager/pwmanager/pwm.h
+++ b/pwmanager/pwmanager/pwm.h
@@ -7,81 +7,86 @@
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __PWM_H
#define __PWM_H
#include <kpopupmenu.h>
#include <klistview.h>
#include <kmainwindow.h>
#ifndef PWM_EMBEDDED
#include <kwin.h>
#include <kapp.h>
#include <kdeversion.h>
#else
#include <ksyncmanager.h>
#endif
#include <kaction.h>
#include <qglobal.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QFocusEvent>
+#include <Q3PopupMenu>
+#include <QHideEvent>
#include "pwmview.h"
#include "pwmexception.h"
/** timeout for displaying a message on the status-bar (in seconds) */
#define STATUSBAR_MSG_TIMEOUT 5
class PwMInit;
class KSyncManager;
/** PwM is the base class of the project */
#ifndef PWM_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class PwM : public KMainWindow
-//MOC_SKIP_END
+#endif
#else
class PwM : public KMainWindow, public KSyncInterface
#endif
{
Q_OBJECT
public:
friend class PwMView;
/** construtor */
PwM(PwMInit *_init, PwMDoc *doc,
bool virginity = true,
QWidget* parent = 0, const char *name = 0);
/** destructor */
~PwM();
/** copy some text to the global clipboard */
static void copyToClipboard(const QString &s);
/** returns pointer to the view */
PwMView * curView()
{ return view; }
/** returns pointer to the currently using document. */
PwMDoc * curDoc()
{ return curView()->document(); }
/** open a new doc with the given filename */
PwMDoc * openDoc(QString filename, bool openDeepLocked = false);
/** show a message on the global status bar.
* The message times out after some seconds.
*/
void showStatMsg(const QString &msg);
/** ask the user where to save the doc (if it has not been saved, yet)
* and write the data to disk.
*/
@@ -255,46 +260,46 @@ protected:
/** "manage" popup-menu */
KPopupMenu *managePopup;
#ifdef CONFIG_KEYCARD
/** "chipcard" popup-menu */
KPopupMenu *chipcardPopup;
#endif // CONFIG_KEYCARD
/** "view" popup-menu */
KPopupMenu *viewPopup;
/** "options" popup-menu */
KPopupMenu *optionsPopup;
/** "help" popup-menu */
KPopupMenu *helpPopup;
/** "export" popup-menu */
KPopupMenu *exportPopup;
/** "import" popup-menu */
KPopupMenu *importPopup;
/** force quit this window? */
bool forceQuit;
/** force minimize this window to the tray */
bool forceMinimizeToTray;
private:
#ifdef PWM_EMBEDDED
//this are the overwritten callbackmethods from the syncinterface
virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource);
virtual void removeSyncInfo( QString syncProfile);
// LR *******************************
// sync stuff!
- QPopupMenu *syncPopup;
+ Q3PopupMenu *syncPopup;
KSyncManager* syncManager;
#endif
};
#endif
diff --git a/pwmanager/pwmanager/pwmanager.pro b/pwmanager/pwmanager/pwmanager.pro
index 7efe45c..d6d8dbe 100644
--- a/pwmanager/pwmanager/pwmanager.pro
+++ b/pwmanager/pwmanager/pwmanager.pro
@@ -1,47 +1,47 @@
TEMPLATE = app
CONFIG += qt warn_off
DESTDIR= ../../bin
TARGET = pwmpi
include( ../../variables.pri )
INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error ../libcrypt/zlib
DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION
#enable this setting if you want debugoutput for pwmanager
#DEFINES += CONFIG_DEBUG
LIBS += -L../libcrypt/
LIBS += -L../../bin/
-LIBS += -lmicrokde
-LIBS += -lmicrokdepim
+LIBS += -lxmicrokde
+LIBS += -lxmicrokdepim
LIBS += -lzlib
LIBS += -lkpmicrocipher
LIBS += -lkpmicroerror
LIBS += -lkpmicrompi
LIBS += -lstdc++
unix:{
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32:{
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
QMAKE_LINK += /NODEFAULTLIB:LIBC
QMAKE_CXXFLAGS += /TP /GX /GR /Ehsc
}
#INTERFACES = \
#addentrywnd.ui \
#configwnd.ui \
#findwnd.ui \
#getmasterpwwnd.ui \
#pwgenwnd.ui \
#setmasterpwwnd.ui \
#subtbledit.ui
#INTERFACES = \
#subtbledit.ui \
@@ -146,32 +146,34 @@ gpasmanfile.cpp \
htmlgen.cpp \
ipc.cpp \
libgcryptif.cpp \
listobjselectwnd.cpp \
listviewpwm.cpp \
main.cpp \
pwgenwnd_emb.cpp \
pwgenwndimpl.cpp \
pwm.cpp \
pwmdoc.cpp \
pwmdocui.cpp \
pwmexception.cpp \
pwminit.cpp \
pwmprefs.cpp \
pwmtray.cpp \
pwmview.cpp \
pwmviewstyle_0.cpp \
pwmviewstyle_1.cpp \
pwmviewstyle.cpp \
randomizer.cpp \
rc2.cpp \
rencatwnd.cpp \
serializer.cpp \
setmasterpwwnd_emb.cpp \
setmasterpwwndimpl.cpp \
sha1.cpp \
waitwnd.cpp \
kcmconfigs/kcmpwmconfig.cpp \
kcmconfigs/pwmconfigwidget.cpp
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro
index 6b68514..e80d1ae 100644
--- a/pwmanager/pwmanager/pwmanagerE.pro
+++ b/pwmanager/pwmanager/pwmanagerE.pro
@@ -1,51 +1,51 @@
TEMPLATE = app
CONFIG += qt warn_on
TARGET = pwmpi
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/bin
INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error $(QPEDIR)/include
DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY
#enable this setting if you want debugoutput for pwmanager
#DEFINES += CONFIG_DEBUG
LIBS += -L../libcrypt/$(PLATFORM)
-LIBS += -lmicrokde
+LIBS += -lxmicrokde
LIBS += -lmicroqtcompat
-LIBS += -lmicrokdepim
+LIBS += -lxmicrokdepim
LIBS += -L$(QPEDIR)/lib
LIBS += -lqpe
LIBS += -lzlib
#LIBS += -lbz2
#LIBS += -lkpmicrogcrypt
LIBS += -ljpeg
LIBS += $(QTOPIALIB)
LIBS += -lkpmicrocipher
LIBS += -lkpmicroerror
LIBS += -lkpmicrompi
LIBS += -lstdc++
LIBS += $(GCC3EXTRALIB1)
LIBS += $(GCC3EXTRALIB2)
#INTERFACES = \
#addentrywnd.ui \
#configwnd.ui \
#findwnd.ui \
#getmasterpwwnd.ui \
#pwgenwnd.ui \
#setmasterpwwnd.ui \
#subtbledit.ui
#INTERFACES = \
#subtbledit.ui \
#HEADERS = \
#configuration_31compat.h \
#configuration.h \
#configwnd.h \
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index b58d7e2..9213360 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -19,64 +19,65 @@
#include "pwmdoc.h"
#include "pwmview.h"
#include "blowfish.h"
#include "sha1.h"
#include "globalstuff.h"
#include "gpasmanfile.h"
#include "serializer.h"
#include "compressgzip.h"
//US#include "compressbzip2.h"
#include "randomizer.h"
#include "pwminit.h"
#include "libgcryptif.h"
#ifdef PWM_EMBEDDED
#include "pwmprefs.h"
#include "kglobal.h"
#endif
#include <kmessagebox.h>
#include <kconfig.h>
#include <kglobalsettings.h>
#include <libkcal/syncdefines.h>
#ifdef CONFIG_KWALLETIF
# include "kwalletemu.h"
#endif // CONFIG_KWALLETIF
#include <qdatetime.h>
#include <qsize.h>
#include <qfileinfo.h>
#include <qfile.h>
+#include <QDesktopWidget>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
//US#include <iostream>
#include <algorithm>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32_
#include <unistd.h>
#include <stdint.h>
#endif
#ifdef PWM_EMBEDDED
#ifndef Q_LONG
#define Q_LONG long
#endif
#ifndef Q_ULONG
#define Q_ULONG unsigned long
#endif
#endif //PWM_EMBEDDED
//TODO: reset to its normal value.
//LR set to 5 min
#define META_CHECK_TIMER_INTERVAL 300 /* 10 300*/ /* sek */
using namespace std;
@@ -452,75 +453,76 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
if ( retval == 0 ) {
qDebug("KO: Backup cancelled. Will try again tomorrow ");
// retval == 0 : backup skipped for today, try again tomorrow
mLastBackupDate = daysTo - d_count+1;
saveDate = true;
} else if ( retval == 1 ){
qDebug("KO: Backup created.");
// backup ok
mLastBackupDate = daysTo;
saveDate = true;
} else if ( retval == 2 ){
qDebug("KO: Backup globally cancelled.");
// backup globally cancelled
b_enabled = false;
}
if ( !b_enabled ) {
config.writeEntry( "mBackupEnabled", false );
}
if ( saveDate ) {
configGlobal.writeEntry( "LastBackupDate-"+ fileInfo.fileName (), mLastBackupDate );
}
}
}
if (QFile::exists(filename)) {
/* Move the existing file to some tmp file.
* When saving file succeeds, delete tmp file. Otherwise
* move tmp file back. See below.
*/
Randomizer *rnd = Randomizer::obj();
char rnd_buf[5];
sprintf(rnd_buf, "%X%X%X%X", rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF,
rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF);
- tmpFileMoved = filename + "." + rnd_buf + ".mv";
+ tmpFileMoved = filename; tmpFileMoved += '.';
+ tmpFileMoved += rnd_buf; tmpFileMoved += ".mv";
if (!copyFile(filename, tmpFileMoved))
return e_openFile;
if (!QFile::remove(filename)) {
printWarn(string("removing orig file ")
+ filename.latin1()
+ " failed!");
}
}
f.setName(filename);
- if (!f.open(IO_ReadWrite)) {
+ if (!f.open(QIODevice::ReadWrite)) {
ret = e_openFile;
goto out_moveback;
}
e = writeFileHeader(hashAlgo, hashAlgo,
cryptAlgo, compress,
&currentPw, &f);
if (e == e_hashNotImpl) {
printDebug("PwMDoc::saveDoc(): writeFileHeader() failed: e_hashNotImpl");
f.close();
ret = e_hashNotImpl;
goto out_moveback;
} else if (e != e_success) {
printDebug("PwMDoc::saveDoc(): writeFileHeader() failed");
f.close();
ret = e_writeHeader;
goto out_moveback;
}
if (!serializeDta(&serialized)) {
printDebug("PwMDoc::saveDoc(): serializeDta() failed");
f.close();
ret = e_serializeDta;
goto out_moveback;
}
e = writeDataHash(hashAlgo, &serialized, &f);
if (e == e_hashNotImpl) {
printDebug("PwMDoc::saveDoc(): writeDataHash() failed: e_hashNotImpl");
f.close();
ret = e_hashNotImpl;
goto out_moveback;
} else if (e != e_success) {
printDebug("PwMDoc::saveDoc(): writeDataHash() failed");
f.close();
@@ -605,65 +607,65 @@ out:
}
PwMerror PwMDoc::openDoc(const QString *file, int openLocked)
{
PWM_ASSERT(file);
PWM_ASSERT(openLocked == 0 || openLocked == 1 || openLocked == 2);
string decrypted, dataHash;
PwMerror ret;
char cryptAlgo, dataHashType, compress;
unsigned int headerLen;
if (*file == "")
return e_readFile;
filename = *file;
/* check if this file is already open.
* This does not catch symlinks!
*/
if (!isDeepLocked()) {
if (getOpenDocList()->find(filename.latin1()))
return e_alreadyOpen;
}
QFile f(filename);
if (openLocked == 2) {
// open deep-locked
if (!QFile::exists(filename))
return e_openFile;
if (deepLock(true, false) != e_success)
return e_openFile;
goto out_success;
}
- if (!f.open(IO_ReadOnly))
+ if (!f.open(QIODevice::ReadOnly))
return e_openFile;
ret = checkHeader(&cryptAlgo, &currentPw, &compress, &headerLen,
&dataHashType, &dataHash, &f);
if (ret != e_success) {
printDebug("PwMDoc::openDoc(): checkHeader() failed");
f.close();
if (ret == e_wrongPw) {
wrongMpwMsgBox(getDocStatFlag(DOC_STAT_USE_CHIPCARD));
return ret;
} else if (ret == e_noPw ||
ret == e_fileVer ||
ret == e_fileFormat ||
ret == e_hashNotImpl) {
return ret;
} else
return e_readFile;
}
ret = decrypt(&decrypted, headerLen, &currentPw, cryptAlgo, dataHashType, &f);
if (ret == e_cryptNotImpl) {
printDebug("PwMDoc::openDoc(): decrypt() failed: e_cryptNotImpl");
f.close();
return e_cryptNotImpl;
} else if (ret != e_success) {
printDebug("PwMDoc::openDoc(): decrypt() failed");
f.close();
return e_readFile;
}
if (!decompressDta(&decrypted, compress)) {
printDebug("PwMDoc::openDoc(): decompressDta() failed");
f.close();
return e_fileCorrupt;
@@ -974,68 +976,68 @@ PwMerror PwMDoc::writeDataHash(char dataHash, string *d, QFile *f)
}
default: {
return e_hashNotImpl;
} }
return e_success;
}
bool PwMDoc::backupFile(const QString &filePath)
{
QFileInfo fi(filePath);
if (!fi.exists())
return true; // Yes, true is correct.
QString pathOnly(fi.dirPath(true));
QString nameOnly(fi.fileName());
QString backupPath = pathOnly
+ "/~"
+ nameOnly
+ ".backup";
return copyFile(filePath, backupPath);
}
bool PwMDoc::copyFile(const QString &src, const QString &dst)
{
QFileInfo fi(src);
if (!fi.exists())
return false;
if (QFile::exists(dst)) {
if (!QFile::remove(dst))
return false;
}
QFile srcFd(src);
- if (!srcFd.open(IO_ReadOnly))
+ if (!srcFd.open(QIODevice::ReadOnly))
return false;
QFile dstFd(dst);
- if (!dstFd.open(IO_ReadWrite)) {
+ if (!dstFd.open(QIODevice::ReadWrite)) {
srcFd.close();
return false;
}
const int tmpBuf_size = 512;
char tmpBuf[tmpBuf_size];
Q_LONG bytesRead, bytesWritten;
while (!srcFd.atEnd()) {
bytesRead = srcFd.readBlock(tmpBuf,
static_cast<Q_ULONG>(tmpBuf_size));
if (bytesRead == -1) {
srcFd.close();
dstFd.close();
return false;
}
bytesWritten = dstFd.writeBlock(tmpBuf,
static_cast<Q_ULONG>(bytesRead));
if (bytesWritten != bytesRead) {
srcFd.close();
dstFd.close();
return false;
}
}
srcFd.close();
dstFd.close();
return true;
}
PwMerror PwMDoc::addEntry(const QString &category, PwMDataItem *d,
bool dontFlagDirty, bool updateMeta)
{
PWM_ASSERT(d);
@@ -1456,107 +1458,107 @@ PwMerror PwMDoc::encrypt(string *d, const QString *pw, QFile *f, char algo,
hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
);
delete [] plain;
if (err != e_success)
return e_cryptNotImpl;
break;
}
default: {
delete_ifnot_null_array(encrypted);
return e_cryptNotImpl;
} }
// write encrypted data to file
if (f->writeBlock(reinterpret_cast<const char *>(encrypted),
static_cast<Q_ULONG>(encSize))
!= static_cast<Q_LONG>(encSize)) {
delete_ifnot_null_array(encrypted);
return e_writeFile;
}
delete_ifnot_null_array(encrypted);
return e_success;
}
PwMerror PwMDoc::decrypt(string *d, unsigned int pos, const QString *pw,
char algo,
char hashalgo, //US BUG: pass _hashalgo because we need it in hashPassphrase
QFile *f)
{
PWM_ASSERT(d);
PWM_ASSERT(pw);
PWM_ASSERT(f);
- unsigned int cryptLen = f->size() - pos;
+ size_t cryptLen = f->size() - pos;
byte *encrypted = new byte[cryptLen];
byte *decrypted = new byte[cryptLen];
f->at(pos);
#ifndef PWM_EMBEDDED
if (f->readBlock(reinterpret_cast<char *>(encrypted),
static_cast<Q_ULONG>(cryptLen))
!= static_cast<Q_LONG>(cryptLen)) {
delete [] encrypted;
delete [] decrypted;
return e_readFile;
}
#else
if (f->readBlock((char *)(encrypted),
(unsigned long)(cryptLen))
!= (long)(cryptLen)) {
delete [] encrypted;
delete [] decrypted;
return e_readFile;
}
#endif
switch (algo) {
case PWM_CRYPT_BLOWFISH: {
Blowfish bf;
bf.bf_setkey((byte *) pw->latin1(), pw->length());
bf.bf_decrypt(decrypted, encrypted, cryptLen);
break;
}
case PWM_CRYPT_AES128:
/*... fall through */
case PWM_CRYPT_AES192:
case PWM_CRYPT_AES256:
case PWM_CRYPT_3DES:
case PWM_CRYPT_TWOFISH:
case PWM_CRYPT_TWOFISH128: {
if (!LibGCryptIf::available())
return e_cryptNotImpl;
LibGCryptIf gc;
PwMerror err;
- err = gc.decrypt(&decrypted,
+ err = gc.decrypt((unsigned char **)&decrypted,
&cryptLen,
- encrypted,
+ (unsigned char*)encrypted,
cryptLen,
reinterpret_cast<const unsigned char *>(pw->latin1()),
pw->length(),
algo,
hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
);
if (err != e_success) {
delete [] encrypted;
delete [] decrypted;
return e_cryptNotImpl;
}
break;
}
default: {
delete [] encrypted;
delete [] decrypted;
return e_cryptNotImpl;
} }
delete [] encrypted;
#ifndef PWM_EMBEDDED
d->assign(reinterpret_cast<const char *>(decrypted),
static_cast<string::size_type>(cryptLen));
#else
d->assign((const char *)(decrypted),
(string::size_type)(cryptLen));
#endif
delete [] decrypted;
if (algo == PWM_CRYPT_BLOWFISH) {
if (!Blowfish::unpadNull(d)) {
BUG();
return e_readFile;
}
@@ -2404,65 +2406,65 @@ bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex)
if (!customBrowser.isEmpty()) {
browserProc.clearArguments();
browserProc << customBrowser << url;
if (browserProc.start(KProcess::DontCare))
return true;
}
browserProc.clearArguments();
browserProc << "konqueror" << url;
if (browserProc.start(KProcess::DontCare))
return true;
browserProc.clearArguments();
browserProc << "mozilla" << url;
if (browserProc.start(KProcess::DontCare))
return true;
browserProc.clearArguments();
browserProc << "opera" << url;
if (browserProc.start(KProcess::DontCare))
return true;
return false;
}
PwMerror PwMDoc::exportToText(const QString *file)
{
PWM_ASSERT(file);
if (QFile::exists(*file)) {
if (!QFile::remove(*file))
return e_accessFile;
}
QFile f(*file);
- if (!f.open(IO_ReadWrite))
+ if (!f.open(QIODevice::ReadWrite))
return e_openFile;
if (!unlockAll_tempoary()) {
f.close();
return e_lock;
}
// write header
string header = i18n("Password table generated by\nPwM v").latin1();
header += PACKAGE_VER;
header += i18n("\non ").latin1();
QDate currDate = QDate::currentDate();
QTime currTime = QTime::currentTime();
#ifndef PWM_EMBEDDED
header += currDate.toString("ddd MMMM d ").latin1();
header += currTime.toString("hh:mm:ss ").latin1();
#else
QString dfs = KGlobal::locale()->dateFormatShort();
bool ampm = KGlobal::locale()->use12Clock();
KGlobal::locale()->setDateFormatShort("%A %B %d");
KGlobal::locale()->setHore24Format(true);
header += KGlobal::locale()->formatDate(currDate, true, KLocale::Userdefined).latin1();
header += KGlobal::locale()->formatTime(currTime, true).latin1();
KGlobal::locale()->setDateFormatShort(dfs);
KGlobal::locale()->setHore24Format(!ampm);
#endif
header += tostr(currDate.year());
header += "\n==============================\n\n";
@@ -2678,65 +2680,65 @@ PwMerror PwMDoc::importText_PwM(const QString *file)
// read launcher-line
if ((ret = getline(&ch_tmp, &ch_tmp_size, f)) == -1)
goto formatError;
if (!textExtractEntry_PwM(ch_tmp, ret, &currItem.launcher))
goto formatError;
currItem.lockStat = true;
currItem.listViewPos = -1;
addEntry(curCat.c_str(), &currItem, true);
++entriesRead;
} while (1);
} while (1);
if (!entriesRead)
goto formatError;
free(ch_tmp);
fclose(f);
flagDirty();
return e_success;
formatError:
free(ch_tmp);
fclose(f);
return e_fileFormat;
#else
PWM_ASSERT(file);
QFile f(file->latin1());
int tmp;
ssize_t ret;
string curCat;
unsigned int entriesRead = 0;
PwMDataItem currItem;
- bool res = f.open(IO_ReadOnly);
+ bool res = f.open(QIODevice::ReadOnly);
if (res == false)
return e_openFile;
unsigned int ch_tmp_size = 1024;
char *ch_tmp = (char*)malloc(ch_tmp_size);
if (!ch_tmp) {
f.close();
return e_outOfMem;
}
// - check header
if (f.readLine(ch_tmp, ch_tmp_size) == -1) // skip first line.
goto formatError;
//US read fileversion first, then check if ok.
if (f.readLine(ch_tmp, ch_tmp_size) == -1)
goto formatError;
// check version-string and return version in "ch_tmp".
//US if (fscanf(f, "PwM v%s", ch_tmp) != 1) {
//US // header not recognized as PwM generated header
//US goto formatError;
//US }
//US set filepointer behind version-string-line previously checked
//US if (f.readLine(ch_tmp, ch_tmp_size) == -1)
//US goto formatError;
// skip next line containing the build-date
if (f.readLine(ch_tmp, ch_tmp_size) == -1)
goto formatError;
// read header termination line
if (f.readLine(ch_tmp, ch_tmp_size) == -1)
goto formatError;
@@ -3600,35 +3602,35 @@ PwMDataItem* PwMDoc::findEntryByID(const QString &uid, unsigned int *category, u
}
return 0;
}
QStringList PwMDoc::getIDEntryList()
{
QStringList results;
vector<PwMCategoryItem>::iterator catcounter = dti.dta.begin(),
catend = dti.dta.end();
vector<PwMDataItem>::iterator entrBegin, entrEnd, entrI;
while (catcounter != catend) {
entrBegin = catcounter->d.begin();
entrEnd = catcounter->d.end();
entrI = entrBegin;
while (entrI != entrEnd) {
results.append( (*entrI).meta.uniqueid.c_str() );
++entrI;
}
++catcounter;
}
return results;
}
-#ifndef PWM_EMBEDDED
-#include "pwmdoc.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmdoc.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index 144831f..07c97a9 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -183,80 +183,80 @@ struct PwMDataItem
int listViewPos;
/** does this entry contain binary data? */
bool binary;
/** meta data for this data item. */
PwMMetaData meta;
/** data revision counter. This counter can be used
* to easily, efficiently determine if this data item
* has changed since some time.
* This counter is incremented on every update.
*/
unsigned int rev;
void clear(bool clearMeta = true)
{
/* NOTE: Don't use .clear() here to be
* backward compatible with gcc-2 (Debian Woody)
*/
desc = "";
name = "";
pw = "";
comment = "";
url = "";
launcher = "";
lockStat = true;
listViewPos = -1;
binary = false;
if (clearMeta)
meta.clear();
}
//US ENH: we need this operator to compare two items if we have no unique ids
//available. Generaly this happens before the first sync
- bool PwMDataItem::operator==( const PwMDataItem &a ) const
+ bool operator==( const PwMDataItem &a ) const
{
//qDebug("oper==%s", a.desc.c_str());
if ( desc != a.desc ) return false;
if ( name != a.name ) return false;
if ( pw != a.pw ) return false;
if ( comment != a.comment ) return false;
if ( url != a.url ) return false;
if ( launcher != a.launcher ) return false;
//all other field will not be checked.
return true;
}
//US ENH: this sync method actually copies all values from the parameter like the =operator
//does with two exceptions: listViewPos will not be changed, and the launcher only if required.
- bool PwMDataItem::syncItem(const PwMDataItem &a, bool syncLauncher=true )
+ bool syncItem(const PwMDataItem &a, bool syncLauncher=true )
{
desc = a.desc;
name = a.name;
pw = a.pw;
comment = a.comment;
url = a.url;
if (syncLauncher == true)
launcher = a.launcher;
meta = a.meta;
binary = a.binary;
lockStat = a.lockStat;
rev = a.rev;
return true;
}
};
struct PwMCategoryItem
{
/** all PwMDataItems (all passwords) within this category */
vector<PwMDataItem> d;
/** category name/description */
string name;
//US ENH: enhancements of the filestructure
/* each category stores the text for description,name and password */
string desc_text;
string name_text;
string pw_text;
void clear()
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp
index a9916c2..ea96509 100644
--- a/pwmanager/pwmanager/pwmdocui.cpp
+++ b/pwmanager/pwmanager/pwmdocui.cpp
@@ -436,35 +436,35 @@ bool PwMDocUi::openDocUi(PwMDoc *doc,
}
QString PwMDocUi::string_defaultCategory()
{
return i18n("Default");
}
QString PwMDocUi::string_locked()
{
return i18n("<LOCKED>");
}
QString PwMDocUi::string_deepLockedShort()
{
return i18n("DEEP-LOCKED");
}
QString PwMDocUi::string_deepLockedLong()
{
return i18n("This file is DEEP-LOCKED!\n"
"That means all data has been encrypted\n"
"and written out to the file. If you want\n"
"to see the entries, please UNLOCK the file.\n"
"While unlocking, you will be prompted for the\n"
"master-password or the key-card.");
}
QString PwMDocUi::string_defaultTitle()
{
return i18n("Untitled");
}
-#ifndef PWM_EMBEDDED
-#include "pwmdocui.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmdocui.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index d59d4d8..15e21ee 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -1,54 +1,56 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwminit.h"
#include "randomizer.h"
#include <qdir.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#ifndef PWM_EMBEDDED
#include "selftest.h"
#include "configuration.h"
#else
#include "pwmprefs.h"
#endif
#include "pwm.h"
#include "pwmexception.h"
#include "pwmtray.h"
#include "pwmdoc.h"
#ifdef CONFIG_KWALLETIF
# include "kwalletemu.h"
#endif // CONFIG_KWALLETIF
#ifdef CONFIG_KEYCARD
# include "pwmkeycard.h"
#endif // CONFIG_KEYCARD
#include <qmessagebox.h>
#include <kmessagebox.h>
#ifndef PWM_EMBEDDED
#include <kcmdlineargs.h>
#include <kwin.h>
#include <dcopclient.h>
#endif
#include <kapplication.h>
#include <kiconloader.h>
@@ -63,70 +65,70 @@ static NOREGPARM void sig_handler(int signum)
{
switch (signum) {
case SIGINT:
case SIGTERM:
sig_init_pointer->shutdownApp(20 + signum);
break;
default:
printDebug(string("unhandled signal ")
+ tostr(signum));
}
}
PwMInit::PwMInit(PwMApplication *_app)
: runStatus (unknown)
, _curWidget (0)
, _dcopClient (0)
, _kwalletEmu (0)
, _keycard (0)
, _tray (0)
{
sig_init_pointer = this;
app = _app;
}
PwMInit::~PwMInit()
{
//qDebug("PwMInit::~PwMInit() ");
#ifndef PWM_EMBEDDED
SelfTest::cancel();
// close all open mainwnds
- QValueList<PwM *>::iterator i = _mainWndList.begin(),
+ Q3ValueList<PwM *>::iterator i = _mainWndList.begin(),
end = _mainWndList.end();
#else
// close all open mainwnds
- QValueList<PwM *>::Iterator i = _mainWndList.begin(),
+ Q3ValueList<PwM *>::Iterator i = _mainWndList.begin(),
end = _mainWndList.end();
#endif
while (i != end) {
disconnect(*i, SIGNAL(closed(PwM *)),
this, SLOT(mainWndClosed(PwM *)));
delete *i;
++i;
}
_mainWndList.clear();
// close all remaining open documents
PwMDocList *_dl = PwMDoc::getOpenDocList();
vector<PwMDocList::listItem> dl = *(_dl->getList());
vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
end2 = dl.end();
while (i2 != end2) {
delete (*i2).doc;
++i2;
}
#ifdef CONFIG_KWALLETIF
delete_ifnot_null(_kwalletEmu);
#endif // CONFIG_KWALLETIF
#ifdef CONFIG_KEYCARD
delete_ifnot_null(_keycard);
#endif // CONFIG_KEYCARD
delete_ifnot_null(_tray);
Randomizer::cleanup();
#ifndef PWM_EMBEDDED
Configuration::cleanup();
#endif
}
@@ -397,69 +399,69 @@ again:
doDeleteDoc = true;
}
}
if (doMinimizeToTray) {
//qDebug("doMinimizeToTray ");
PWM_ASSERT(_tray);
int mmlock = conf()->confGlobMinimizeLock();
switch (mmlock) {
case 0: // don't lock anything
break;
case 1: // normal lock
wnd->curDoc()->lockAll(true);
break;
case 2: // deep-lock
wnd->curDoc()->deepLock();
break;
default:
WARN();
}
} else if (doDeleteDoc) {
//qDebug("doDeleteDoc ");
if (!wnd->curDoc()->tryDelete()) {
/* We failed deleting the doc,
* so open a new window with it, again.
*/
createMainWnd(QString::null, false,
false, wnd->curDoc());
}
}
#ifndef PWM_EMBEDDED
// find the closed window in the "mainWndList" and delete it.
- QValueList<PwM *>::iterator i = _mainWndList.begin(),
+ Q3ValueList<PwM *>::iterator i = _mainWndList.begin(),
end = _mainWndList.end();
#else
// find the closed window in the "mainWndList" and delete it.
- QValueList<PwM *>::Iterator i = _mainWndList.begin(),
+ Q3ValueList<PwM *>::Iterator i = _mainWndList.begin(),
end = _mainWndList.end();
#endif
while (i != end) {
//qDebug("iii %x end %x wnd %x", (*i), (*end), wnd);
if (*i == wnd) {
#ifndef PWM_EMBEDDED
_mainWndList.erase(i);
#else
_mainWndList.remove(i);
#endif
if ( app->mainWidget() == wnd ) {
if ( _mainWndList.count() ) {
#ifndef DESKTOP_VERSION
app->showMainWidget(_mainWndList.first() );
#endif //DESKTOP_VERSION
}
}
delete wnd;
goto out_success;
}
++i;
}
BUG();
out_success:
#ifndef PWM_EMBEDDED
if (!_mainWndList.size())
#else
if (!_mainWndList.count())
#endif
@@ -544,118 +546,117 @@ void PwMInit::handleCmdLineArgs(bool initial)
0,
savedCmd.minimized);
PwMDoc *newDoc = newInstance->openDoc(curArg,
savedCmd.open_deeplocked);
if (!newDoc) {
newInstance->setForceQuit(true);
delete_and_null(newInstance);
}
}
}
if (savedCmd.minToTray) {
minimizeAllMainWnd(true);
} else if (savedCmd.minimized) {
minimizeAllMainWnd(false);
}
if (!savedCmd.skipSelfTest && initial) {
SelfTest::schedule();
}
args->clear();
#endif
}
void PwMInit::minimizeAllMainWnd(bool toTray)
{
#ifndef PWM_EMBEDDED
if (!_mainWndList.size())
return;
#else
if (!_mainWndList.count())
return;
#endif
- const QValueList<PwM *> *ml = mainWndList();
+ const Q3ValueList<PwM *> *ml = mainWndList();
#ifndef PWM_EMBEDDED
- QValueList<PwM *>::const_iterator it = ml->begin(),
+ Q3ValueList<PwM *>::const_iterator it = ml->begin(),
end = ml->end();
#else
- QValueList<PwM *>::ConstIterator it = ml->begin(),
+ Q3ValueList<PwM *>::ConstIterator it = ml->begin(),
end = ml->end();
#endif
PwM *wnd;
if (toTray && _tray) {
/* minimize to tray.
* close all mainWnd.
*/
while (it != end) {
wnd = *it;
wnd->setForceMinimizeToTray(true);
wnd->close_slot();
++it;
}
} else {
// normal minimize
while (it != end) {
wnd = *it;
wnd->hide();
wnd->showMinimized();
++it;
}
}
}
#ifdef PWM_EMBEDDED
#ifndef DESKTOP_VERSION
PwMApplication::PwMApplication(int & argc, char ** argv)
: QPEApplication( argc, argv )
, init (0)
{
this->setKeepRunning ();
}
PwMApplication::~PwMApplication()
{
delete_ifnot_null(init);
}
#else //DESKTOP_VERSION
PwMApplication::PwMApplication(int & argc, char ** argv)
: QApplication( argc, argv )
, init (0)
{
- setStyle( new QPlatinumStyle ());
QString hdir = QDir::homeDirPath();
// there is a bug when creating dirs for WIN 98
// it is difficult to fix, because we have no WIN 98 runnung
// such that we try it to create the dirs at startup here
if ( hdir == "C:\\" )
{
// win 98 or ME
QDir app_dir;
if ( !app_dir.exists("C:\\kdepim") )
app_dir.mkdir ("C:\\kdepim");
if ( !app_dir.exists("C:\\kdepim\\apps") )
app_dir.mkdir ("C:\\kdepim\\apps");
if ( !app_dir.exists("C:\\kdepim\\config") )
app_dir.mkdir ("C:\\kdepim\\config");
if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") )
app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager");
}
}
PwMApplication::~PwMApplication()
{
delete_ifnot_null(init);
}
#endif //DESKTOP_VERSION
#endif //PWM_EMBEDDED
-#ifndef PWM_EMBEDDED
-#include "pwminit.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwminit.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwminit.h b/pwmanager/pwmanager/pwminit.h
index bf72093..32d1b4f 100644
--- a/pwmanager/pwmanager/pwminit.h
+++ b/pwmanager/pwmanager/pwminit.h
@@ -1,103 +1,102 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __PWMINIT_H
#define __PWMINIT_H
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qobject.h>
#ifndef PWM_EMBEDDED
#include <kuniqueapplication.h>
#else //PWM_EMBEDDED
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else //DESKTOP_VERSION
#include <qapplication.h>
-#include <qplatinumstyle.h>
#endif //DESKTOP_VERSION
#include <kapplication.h>
#endif //PWM_EMBEDDED
#include "globalstuff.h"
class DCOPClient;
class KWalletEmu;
class PwMKeyCard;
class KApplication;
class QWidget;
class PwM;
class PwMTray;
class PwMDoc;
class PwMInit;
/** main application class */
#ifndef PWM_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class PwMApplication : public KUniqueApplication
{
public:
PwMApplication(bool allowStyles=true,
bool GUIenabled=true,
bool configUnique=false)
: KUniqueApplication(allowStyles, GUIenabled, configUnique)
, init (0)
{ }
~PwMApplication()
{ delete_ifnot_null(init); }
int newInstance();
protected:
PwMInit *init;
};
-//MOC_SKIP_END
+#endif
#else //PWM_EMBEDDED
#ifndef DESKTOP_VERSION
class PwMApplication : public QPEApplication
{
public:
PwMApplication(int & argc, char ** argv);
~PwMApplication();
int newInstance();
protected:
PwMInit *init;
};
#else //DESKTOP_VERSION
class PwMApplication : public QApplication
{
public:
PwMApplication(int & argc, char ** argv);
~PwMApplication();
int newInstance();
protected:
PwMInit *init;
};
#endif
#endif
/** PwManager initialisation class.
@@ -125,98 +124,98 @@ protected:
bool open_deeplocked;
bool minimized;
bool minToTray;
bool skipSelfTest;
// initial open paths are not saved here.
};
public:
PwMInit(PwMApplication *_app);
~PwMInit();
/** Initialize the application. */
void initializeApp();
/** shutdown PwManager */
void shutdownApp(int exitStatus);
/** returns a pointer to the current widget */
QWidget * curWidget()
{ return _curWidget; }
/** returns a pointer to the dcop client */
DCOPClient * dcopClient()
{ return _dcopClient; }
/** returns a pointer to the KWallet emulation */
KWalletEmu * kwalletEmu()
{ return _kwalletEmu; }
/** returns a pointer to the keycard interface */
PwMKeyCard * keycard()
{ return _keycard; }
/** returns a pointer to the tray icon */
PwMTray * tray()
{ return _tray; }
/** returns a list of all open main windows */
- const QValueList<PwM *> * mainWndList()
+ const Q3ValueList<PwM *> * mainWndList()
{ return &_mainWndList; }
/** create a new document */
PwMDoc * createDoc();
/** create a new PwM main window */
PwM * createMainWnd(const QString &loadFile = QString::null,
bool loadFileDeepLocked = false,
bool virginity = true,
PwMDoc *doc = 0,
bool minimized = false);
/** (re)initialize the KWallet emulation */
void initKWalletEmu(bool forceDisable = false, bool forceReload = false);
/** (re)initialize the tray icon */
void initTray();
protected:
/** initialize the DCOP connection */
void initDCOP();
/** initialize the keycard interface */
void initKeycard();
/** initialize posix signal handling */
void initPosixSignalHandler();
/** handle the commandline args */
void handleCmdLineArgs(bool initial = true);
/** minimize all open mainWnds to tray (or if
* no tray is present, minimize them the normal way)
*/
void minimizeAllMainWnd(bool toTray);
protected slots:
/** a main window got closed */
void mainWndClosed(PwM *wnd);
/** the tray icon got closed */
void trayIconClosed(PwMTray *tray);
/** sets _curWidget on behalf of a PwM signal */
void setCurWidget(PwM *w)
{ _curWidget = reinterpret_cast<QWidget *>(w); }
/** resets _curWidget to nothing */
void resetCurWidget()
{ _curWidget = 0; }
/** remove the tray and quit the app */
void removeTrayAndQuit();
protected:
/** run-status of the app */
RunStatus runStatus;
/** PwMApplication pointer */
PwMApplication *app;
/** pointer to the current widget the user is dealing with */
QWidget *_curWidget;
/** pointer to the dcop client */
DCOPClient *_dcopClient;
/** pointer to the KWallet emulation */
KWalletEmu *_kwalletEmu;
/** pointer to the keycard interface */
PwMKeyCard *_keycard;
/** pointer to the tray icon */
PwMTray *_tray;
/** list of all open main windows */
- QValueList<PwM *> _mainWndList;
+ Q3ValueList<PwM *> _mainWndList;
/** saved command line options. */
savedCmd_t savedCmd;
};
#endif // __PWMINIT_H
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h
index 1f6a35c..42f7c2e 100644
--- a/pwmanager/pwmanager/pwmprefs.h
+++ b/pwmanager/pwmanager/pwmprefs.h
@@ -1,62 +1,64 @@
/*
This file is part of PwManager/Pi
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#ifndef PWMPREFS_H
#define PWMPREFS_H
#include <qstringlist.h>
#include <qsize.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kpimprefs.h>
class KConfig;
#define conf() PWMPrefs::instance()
#define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */
#define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */
#define CONF_DEFAULT_TRAY false
#define CONF_DEFAULT_UNLOCKONOPEN true
#define CONF_DEFAULT_MAINVIEWSTYLE 1/* Category List Left */
#define CONF_DEFAULT_COMPRESSION 0x01/* gzip */
#define CONF_DEFAULT_CRYPTALGO (0x01 - 1)/* blowfish */
#define CONF_DEFAULT_HASHALGO (0x01 - 1)/* sha1 */
#define CONF_DEFAULT_AUTOMINIMIZE false
#define CONF_DEFAULT_BROWSERCOMMAND ""
#define CONF_DEFAULT_XTERMCOMMAND "konsole -e"
#define CONF_DEFAULT_FILEPERMISSIONS 0600
#define CONF_DEFAULT_MAKEFILEBACKUP false
#define CONF_DEFAULT_AUTOSTART_DEEPL true
#define CONF_DEFAULT_AUTODEEPLOCK true
#define CONF_DEFAULT_KWALLETEMU false
#define CONF_DEFAULT_MINIMIZELOCK 2/* deep-lock */
#define CONF_DEFAULT_NEWENTRLOCKSTAT false/* new entries unlocked */
#define CONF_DEFAULT_WNDCLOSE true/* don't minimize to tray */
class PWMPrefs : public KPimPrefs
@@ -121,46 +123,46 @@ public:
void confWndMainWndSize(const QSize &e);
void confWndMainViewStyle(int e);
void confWndAutoMinimizeOnStart(bool e);
void confWndClose(bool e);
QString mAutoStart;
QString mBrowserCommand;
QString mXTermCommand;
QFont mEntryFont;
QFont mViewFont;
int mPwTimeout;
int mLockTimeout;
int mCompression;
int mCryptAlgo;
int mHashAlgo;
int mFilePermissions;
int mMinimizeLock;
bool mUnlockOnOpen;
bool mTray;
bool mMakeFileBackup;
bool mAutostartDeeplocked;
bool mAutoDeeplock;
bool mKWalletEmu;
bool mNewEntrLockStat;
QSize mMainWndSize;
int mMainViewStyle;
bool mAutoMinimizeOnStart;
bool mClose;
//US ENH
- QValueList<int> mCommentSplitter;
- QValueList<int> mCategorySplitter;
+ Q3ValueList<int> mCommentSplitter;
+ Q3ValueList<int> mCategorySplitter;
// US introduce a nonconst way to return the config object.
KConfig* getConfig();
private:
PWMPrefs();
static PWMPrefs *sInstance;
};
#endif
diff --git a/pwmanager/pwmanager/pwmtray.cpp b/pwmanager/pwmanager/pwmtray.cpp
index fe074ca..478116f 100644
--- a/pwmanager/pwmanager/pwmtray.cpp
+++ b/pwmanager/pwmanager/pwmtray.cpp
@@ -3,125 +3,128 @@
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* Original implementation of the tray-tree *
* (c) by Matt Scifo <mscifo@o1.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwmtray.h"
#include "pwmexception.h"
#include "pwm.h"
#include "pwmdoc.h"
#include "pwminit.h"
#ifndef PWM_EMBEDDED
#include "configuration.h"
#else
#include "pwmprefs.h"
#endif
#include <klocale.h>
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <QMouseEvent>
void ActiveTreeItem::execIt()
{
#ifndef PWM_EMBEDDED
unsigned int entr = static_cast<unsigned int>(entry);
unsigned int cat = static_cast<unsigned int>(category);
#else
unsigned int entr = (unsigned int)(entry);
unsigned int cat = (unsigned int)(category);
#endif
switch (task) {
case pwToClipboard: {
PwMDataItem d;
doc->getDataChangedLock();
bool wasLocked = doc->isLocked(cat, entr);
doc->getEntry(cat, entr, &d, true);
if (wasLocked)
doc->lockAt(cat, entr, true);
doc->putDataChangedLock();
PwM::copyToClipboard(d.pw.c_str());
break;
} case nameToClipboard: {
PwMDataItem d;
doc->getEntry(cat, entr, &d);
PwM::copyToClipboard(d.name.c_str());
break;
} case descToClipboard: {
PwMDataItem d;
doc->getEntry(cat, entr, &d);
PwM::copyToClipboard(d.desc.c_str());
break;
} case urlToClipboard: {
PwMDataItem d;
doc->getEntry(cat, entr, &d);
PwM::copyToClipboard(d.url.c_str());
break;
} case launcherToClipboard: {
PwMDataItem d;
doc->getEntry(cat, entr, &d);
PwM::copyToClipboard(d.launcher.c_str());
break;
} case commentToClipboard: {
PwMDataItem d;
doc->getEntry(cat, entr, &d);
PwM::copyToClipboard(d.comment.c_str());
break;
} case execLauncher: {
doc->execLauncher(cat, entr);
break;
} case goToURL: {
doc->goToURL(cat, entr);
break;
} case openMainWnd: {
// search if there is already an open window.
- const QValueList<PwM *> *wl = tray->init->mainWndList();
+ const Q3ValueList<PwM *> *wl = tray->init->mainWndList();
#ifndef PWM_EMBEDDED
- QValueList<PwM *>::const_iterator i = wl->begin(),
+ Q3ValueList<PwM *>::const_iterator i = wl->begin(),
end = wl->end();
#else
- QValueList<PwM *>::ConstIterator i = wl->begin(),
+ Q3ValueList<PwM *>::ConstIterator i = wl->begin(),
end = wl->end();
#endif
PwM *wnd;
while (i != end) {
wnd = *i;
if (wnd->curDoc() == doc) {
// now bring this window to the foreground.
if (!wnd->hasFocus()) {
wnd->hide();
wnd->showNormal();
wnd->setFocus();
}
return;
}
++i;
}
// there is no open window, so open a new one.
tray->init->createMainWnd(QString::null, false, false, doc);
break;
} case closeDoc: {
doc->tryDelete();
break;
} case lock: {
doc->lockAll(true);
break;
} case deepLock: {
doc->deepLock();
break;
} case unlock: {
doc->lockAll(false);
break;
} default: {
@@ -149,83 +152,83 @@ PwMTray::~PwMTray()
emit closed(this);
}
//US ENH for embedded tray class
KPopupMenu* PwMTray::contextMenu()
{
if (m_ctxMenu == 0)
{
m_ctxMenu = new KPopupMenu();
}
return m_ctxMenu;
}
void PwMTray::buildMain()
{
KPopupMenu *ctxMenu = contextMenu();
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("&New main window..."), this,
SLOT(newMainWnd()));
ctxMenu->insertItem(i18n("&Open file..."), this,
SLOT(openDoc()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("&Remove from tray"), this,
SLOT(undock()));
}
void PwMTray::insertActiveTreeItem(KPopupMenu *insertIn, const QString &text,
ActiveTreeItem::Task task, PwMDoc *doc,
int docCategory, int docEntry,
- QValueList<int> *activeItemsList)
+ Q3ValueList<int> *activeItemsList)
{
ActiveTreeItem *activeItem;
int id;
activeItem = new ActiveTreeItem(text, insertIn->font(), task,
doc, docCategory, docEntry,
this);
id = insertIn->insertItem(activeItem);
insertIn->connectItem(id, activeItem, SLOT(execIt()));
#ifndef PWM_EMBEDDED
activeItemsList->push_back(id);
#else
activeItemsList->append(id);
#endif
}
void PwMTray::rebuildTree(KPopupMenu *popup, PwMDoc *doc,
- QValueList<int> *activeItems)
+ Q3ValueList<int> *activeItems)
{
PWM_ASSERT(doc);
PWM_ASSERT(popup);
activeItems->clear();
popup->clear();
#ifndef PWM_EMBEDDED
popup->insertTitle(i18n("Categories:"));
#endif
vector<string> catList;
vector<string> entrList;
doc->getCategoryList(&catList);
KPopupMenu *newCatMenu;
KPopupMenu *newEntrMenu;
int i, size = catList.size();
int j, entries;
for (i = 0; i < size; ++i) {
newCatMenu = new KPopupMenu(popup);
popup->insertItem(catList[i].c_str(), newCatMenu);
doc->getEntryList(i, &entrList);
entries = entrList.size();
for (j = 0; j < entries; ++j) {
newEntrMenu = new KPopupMenu(newCatMenu);
newCatMenu->insertItem(entrList[j].c_str(), newEntrMenu);
if (doc->isBinEntry(i, j)) {
/* This is a binary entry. Don't insert the usual
* menu items.
*/
#ifndef PWM_EMBEDDED
newEntrMenu->insertTitle(i18n("This is a binary entry.\n"
"It is not a normal password-entry, as it contains "
@@ -305,69 +308,69 @@ void PwMTray::insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc)
activeItem = new ActiveTreeItem(i18n("&Lock all entries"),
menu->font(), ActiveTreeItem::lock,
doc, 0, 0, this);
id = menu->insertItem(activeItem);
menu->connectItem(id, activeItem, SLOT(execIt()));
activeItem = new ActiveTreeItem(i18n("&Deep-lock all entries"),
menu->font(), ActiveTreeItem::deepLock,
doc, 0, 0, this);
id = menu->insertItem(activeItem);
menu->connectItem(id, activeItem, SLOT(execIt()));
activeItem = new ActiveTreeItem(i18n("&Unlock all entries"),
menu->font(), ActiveTreeItem::unlock,
doc, 0, 0, this);
id = menu->insertItem(activeItem);
menu->connectItem(id, activeItem, SLOT(execIt()));
}
void PwMTray::updateTree(PwMDoc *document)
{
PWM_ASSERT(document);
KPopupMenu *treeEntry;
int treeItemNum = -1;
int id = findTreeEntry(document, &treeEntry, &treeItemNum);
if (id == -1) {
// tree-entry doesn't exist, yet.
id = insertTreeEntry(document, &treeEntry);
}
if (treeItemNum != -1) {
// delete all *old* active items
KPopupMenu *ctxMenu = contextMenu();
- QValueList<int> *oldItems = &tree[treeItemNum].activeItems;
+ Q3ValueList<int> *oldItems = &tree[treeItemNum].activeItems;
#ifndef PWM_EMBEDDED
- QValueList<int>::iterator i = oldItems->begin();
+ Q3ValueList<int>::iterator i = oldItems->begin();
#else
- QValueList<int>::Iterator i = oldItems->begin();
+ Q3ValueList<int>::Iterator i = oldItems->begin();
#endif
while (i != oldItems->end()) {
ctxMenu->removeItem(*i);
++i;
}
oldItems->clear();
ctxMenu->changeItem(id, document->getTitle());
}
treeItem newTreeItem;
if (document->isDeepLocked()) {
treeEntry->clear();
#ifndef PWM_EMBEDDED
treeEntry->insertTitle(i18n("Categories:"));
#endif
QString msg(IS_DEEPLOCKED_SHORTMSG);
msg += " ";
msg += i18n("(Click here to unlock)");
treeEntry->insertItem(msg, document,
SLOT(_deepUnlock()));
insertMainWndCtrl(treeEntry, document);
} else {
rebuildTree(treeEntry, document, &newTreeItem.activeItems);
}
newTreeItem.menuId = id;
newTreeItem.doc = document;
newTreeItem.menu = treeEntry;
if (treeItemNum == -1) {
#ifndef PWM_EMBEDDED
tree.push_back(newTreeItem);
#else
tree.append(newTreeItem);
@@ -452,35 +455,35 @@ void PwMTray::connectDocToTray(PwMDoc *doc)
{
connect(doc, SIGNAL(dataChanged(PwMDoc *)),
this, SLOT(updateTree(PwMDoc *)));
connect(doc, SIGNAL(docClosed(PwMDoc *)),
this, SLOT(closeTreeEntry(PwMDoc *)));
// fake a dataChanged signal for this doc to update the tray tree.
updateTree(doc);
}
void PwMTray::openDoc()
{
// open the document in a new window.
PwM *newInstance = init->createMainWnd();
PwMDoc *newDoc = newInstance->openDoc("");
if (!newDoc) {
newInstance->setForceQuit(true);
delete_and_null(newInstance);
}
}
void PwMTray::newMainWnd()
{
init->createMainWnd();
}
void PwMTray::undock()
{
conf()->confGlobTray(false);
init->initTray();
// Attention! "this" is already deleted here!
}
-#ifndef PWM_EMBEDDED
-#include "pwmtray.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmtray.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwmtray.h b/pwmanager/pwmanager/pwmtray.h
index ffb625e..b1145e0 100644
--- a/pwmanager/pwmanager/pwmtray.h
+++ b/pwmanager/pwmanager/pwmtray.h
@@ -1,292 +1,294 @@
/***************************************************************************
* *
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __PWMTRAY_H
#define __PWMTRAY_H
#ifndef PWM_EMBEDDED
#include <ksystemtray.h>
#endif
#include <kpopupmenu.h>
#include <qpainter.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QMenuItem>
//#include "pwmexception.h"
class PwMInit;
class PwMDoc;
class PwMTray;
/* wrapper to workaround MOC problems */
-class __ActiveTreeItem : public QCustomMenuItem
- , public QObject
+class __ActiveTreeItem : public QMenuItem
{
public:
__ActiveTreeItem() {}
};
/** implements the "active" part of the tree */
class ActiveTreeItem : public __ActiveTreeItem
{
Q_OBJECT
public:
enum Task
{
pwToClipboard,
nameToClipboard,
descToClipboard,
urlToClipboard,
launcherToClipboard,
commentToClipboard,
execLauncher,
goToURL,
openMainWnd,
closeDoc,
lock,
deepLock,
unlock
};
public:
ActiveTreeItem(const QString &_text, const QFont &_font,
Task _task, PwMDoc * _doc,
int _category, int _entry,
PwMTray *_tray)
: text (_text)
, font (_font)
, task (_task)
, doc (_doc)
, category (_category)
, entry (_entry)
, tray (_tray)
{ }
/* ~ActiveTreeItem()
{ cout << "deleted \"" << text << "\"" << endl; } */
void paint(QPainter *p, const QColorGroup & /*cg*/, bool /*act*/,
bool /*enabled*/, int x, int y, int w, int h)
{
p->setFont(font);
- p->drawText(x, y, w, h, AlignLeft | AlignVCenter |
- DontClip | ShowPrefix, text);
+ p->drawText(x, y, w, h, Qt::AlignLeft | Qt::AlignVCenter |
+ Qt::DontClip | Qt::ShowPrefix, text);
}
QSize sizeHint()
{
- return QFontMetrics(font).size(AlignLeft | AlignVCenter |
- ShowPrefix | DontClip, text);
+ return QFontMetrics(font).size(Qt::AlignLeft | Qt::AlignVCenter |
+ Qt::ShowPrefix | Qt::DontClip, text);
}
bool fullSpan() const
{ return false; }
bool isSeparator() const
{ return false; }
void setFont(const QFont &f)
{ font = f; }
public slots:
/** this is the executive part, that is triggered, when the user clicks it */
void execIt();
protected:
QString text;
QFont font;
Task task;
PwMDoc *doc;
int category;
int entry;
PwMTray *tray;
};
/** tray icon implementation */
#ifndef PWM_EMBEDDED
-//MOC_SKIP_BEGIN
+#ifndef Q_MOC_RUN
class PwMTray : public KSystemTray
{
Q_OBJECT
friend class ActiveTreeItem;
struct treeItem
{
int menuId;
PwMDoc *doc;
KPopupMenu *menu;
- QValueList<int> activeItems; // ids of all active items
+ Q3ValueList<int> activeItems; // ids of all active items
};
public:
PwMTray(PwMInit *_init, QWidget* parent = 0, const char* name = 0);
~PwMTray();
/** connect all signals for this document to the tray */
void connectDocToTray(PwMDoc *doc);
public slots:
/** for update-notification from all open documents */
void updateTree(PwMDoc *document);
/** when a document has been closed, call this func
* to delete its tray-entry
*/
void closeTreeEntry(PwMDoc *document);
protected slots:
/** open a new document */
void openDoc();
/** open a new mainwnd */
void newMainWnd();
/** undock this tray icon */
void undock();
signals:
/** this icon got deleted */
void closed(PwMTray *);
/** the user clicked on the tray icon */
void clickedIcon(PwMTray *);
protected:
/** holds a list of all open files, its documents and
* its menuIDs
*/
- QValueList<struct treeItem> tree;
+ Q3ValueList<struct treeItem> tree;
/** pointer to init */
PwMInit *init;
protected:
/** search if an entry with for the given document
* exists and resturn its ID and a pointer to the main
* KPopupMenu. If no item is found,
* it returns -1 as ID and a NULL-pointer.
*/
int findTreeEntry(PwMDoc *doc, KPopupMenu **menu, int *treeItem);
/** build the main menu-items */
void buildMain();
/** rebuilds the tree for the given KPopupMenu entry */
void rebuildTree(KPopupMenu *popup, PwMDoc *doc,
- QValueList<int> *activeItems);
+ Q3ValueList<int> *activeItems);
/** insert a new tree-entry for the given doc and returns the ID.*/
int insertTreeEntry(PwMDoc *doc, KPopupMenu **popup);
/** removes a tree entry */
void removeTreeEntry(int menuId, int treeItem, KPopupMenu **menu);
/** inserts a new active-tree-item into the given tree entry */
void insertActiveTreeItem(KPopupMenu *insertIn, const QString &text,
ActiveTreeItem::Task task, PwMDoc *doc,
int docCategory, int docEntry,
- QValueList<int> *activeItemsList);
+ Q3ValueList<int> *activeItemsList);
/** mouse event on icon */
void mouseReleaseEvent(QMouseEvent *e);
/** inserts the items for the main window control
* into the popup menu.
*/
void insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc);
};
-//MOC_SKIP_END
+#endif
#else
class PwMTray : public QWidget
{
Q_OBJECT
friend class ActiveTreeItem;
struct treeItem
{
int menuId;
PwMDoc *doc;
KPopupMenu *menu;
- QValueList<int> activeItems; // ids of all active items
+ Q3ValueList<int> activeItems; // ids of all active items
};
public:
PwMTray(PwMInit *_init, QWidget* parent = 0, const char* name = 0);
~PwMTray();
//US ENH needed for embedde version.
KPopupMenu* contextMenu();
KPopupMenu* m_ctxMenu;
/** connect all signals for this document to the tray */
void connectDocToTray(PwMDoc *doc);
public slots:
/** for update-notification from all open documents */
void updateTree(PwMDoc *document);
/** when a document has been closed, call this func
* to delete its tray-entry
*/
void closeTreeEntry(PwMDoc *document);
protected slots:
/** open a new document */
void openDoc();
/** open a new mainwnd */
void newMainWnd();
/** undock this tray icon */
void undock();
signals:
/** this icon got deleted */
void closed(PwMTray *);
/** the user clicked on the tray icon */
void clickedIcon(PwMTray *);
protected:
/** holds a list of all open files, its documents and
* its menuIDs
*/
- QValueList<struct treeItem> tree;
+ Q3ValueList<struct treeItem> tree;
/** pointer to init */
PwMInit *init;
protected:
/** search if an entry with for the given document
* exists and resturn its ID and a pointer to the main
* KPopupMenu. If no item is found,
* it returns -1 as ID and a NULL-pointer.
*/
int findTreeEntry(PwMDoc *doc, KPopupMenu **menu, int *treeItem);
/** build the main menu-items */
void buildMain();
/** rebuilds the tree for the given KPopupMenu entry */
void rebuildTree(KPopupMenu *popup, PwMDoc *doc,
- QValueList<int> *activeItems);
+ Q3ValueList<int> *activeItems);
/** insert a new tree-entry for the given doc and returns the ID.*/
int insertTreeEntry(PwMDoc *doc, KPopupMenu **popup);
/** removes a tree entry */
void removeTreeEntry(int menuId, int treeItem, KPopupMenu **menu);
/** inserts a new active-tree-item into the given tree entry */
void insertActiveTreeItem(KPopupMenu *insertIn, const QString &text,
ActiveTreeItem::Task task, PwMDoc *doc,
int docCategory, int docEntry,
- QValueList<int> *activeItemsList);
+ Q3ValueList<int> *activeItemsList);
/** mouse event on icon */
void mouseReleaseEvent(QMouseEvent *e);
/** inserts the items for the main window control
* into the popup menu.
*/
void insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc);
};
#endif
#endif
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index 2533487..68500d0 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -6,225 +6,233 @@
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwmview.h"
#include "pwmexception.h"
#include "globalstuff.h"
#include "pwm.h"
#include "rencatwnd.h"
#ifndef PWM_EMBEDDED
#include "configuration.h"
#else
#include "pwmprefs.h"
#endif
#include "commentbox.h"
#include <kmessagebox.h>
#include <klocale.h>
#include <qlineedit.h>
#include <qpoint.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QResizeEvent>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
//US ENH: for examle in listviewpwm.cpp
//US ENH: Because of that I transfer them into the headerfile.
/*
#define COLUMN_DESC 0
#define COLUMN_NAME 1
#define COLUMN_PW 2
#define COLUMN_URL 3
#define COLUMN_LAUNCHER 4
*/
PwMView::PwMView(PwM *_mainClass,
QWidget *parent, PwMDoc *_doc,
const char *name)
: PwMViewStyle(parent, name)
{
PWM_ASSERT(_mainClass);
PWM_ASSERT(parent);
PWM_ASSERT(_doc);
setView(this);
doc = _doc;
doc->setListViewPointer(this);
mainClass = _mainClass;
resize(_mainClass->size());
initStyle(conf()->confWndMainViewStyle());
initCtxMenu();
doc->setCurrentView(this);
connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView()));
connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot()));
connect(this, SIGNAL(insertPW()), mainClass, SLOT(addPwd_slot()));
connect(this, SIGNAL(deletePW()), mainClass, SLOT(deletePwd_slot()));
}
PwMView::~PwMView()
{
}
void PwMView::initCtxMenu()
{
- ctxMenu = new QPopupMenu(this);
+ ctxMenu = new Q3PopupMenu(this);
ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot()));
ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("copy password to clipboard"),
this, SLOT(copyPwToClip()));
ctxMenu->insertItem(i18n("copy username to clipboard"),
this, SLOT(copyNameToClip()));
ctxMenu->insertItem(i18n("copy description to clipboard"),
this, SLOT(copyDescToClip()));
ctxMenu->insertItem(i18n("copy url to clipboard"),
this, SLOT(copyUrlToClip()));
ctxMenu->insertItem(i18n("copy launcher to clipboard"),
this, SLOT(copyLauncherToClip()));
ctxMenu->insertItem(i18n("copy comment to clipboard"),
this, SLOT(copyCommentToClip()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass,
SLOT(execLauncher_slot()));
ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass,
SLOT(goToURL_slot()));
}
void PwMView::resizeEvent(QResizeEvent *)
{
resizeView(size());
}
-void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
+void PwMView::refreshCommentTextEdit(Q3ListViewItem *curItem)
{
PWM_ASSERT(commentBox);
if (!curItem)
return;
string comment;
PwMerror ret;
ret = document()->getCommentByLvp_long(getCurrentCategory(),
lv->childCount() - lv->itemIndex(curItem) - 1,
&comment);
if (ret == e_binEntry) {
commentBox->setContent(i18n("This is a binary entry.\n"
"It is not a normal password-entry, as it contains "
"binary data, which PwManager can't display here."));
} else if (ret == e_normalEntry) {
commentBox->setContent(comment.c_str());
} else {
BUG();
return;
}
lv->ensureItemVisible(curItem);
}
void PwMView::keyReleaseEvent(QKeyEvent * /*e*/)
{
refreshCommentTextEdit(lv->currentItem());
}
bool PwMView::getCurEntryIndex(unsigned int *index)
{
- QListViewItem *current = lv->currentItem();
+ Q3ListViewItem *current = lv->currentItem();
if (!current)
return false;
return getDocEntryIndex(index, current);
}
bool PwMView::getDocEntryIndex(unsigned int *index,
- const QListViewItem *item)
+ const Q3ListViewItem *item)
{
vector<unsigned int> foundPositions;
PwMDataItem curItem;
curItem.desc = item->text(COLUMN_DESC).latin1();
curItem.name = item->text(COLUMN_NAME).latin1();
document()->getCommentByLvp(getCurrentCategory(),
lv->childCount() - lv->itemIndex(item) - 1,
&curItem.comment);
curItem.url = item->text(COLUMN_URL).latin1();
curItem.launcher = item->text(COLUMN_LAUNCHER).latin1();
document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC |
SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL |
SEARCH_IN_LAUNCHER,
&foundPositions, true);
if (foundPositions.size()) {
*index = foundPositions[0];
return true;
}
return false;
}
-void PwMView::handleToggle(QListViewItem *item)
+void PwMView::handleToggle(Q3ListViewItem *item)
{
PWM_ASSERT(doc);
if (!item)
return;
- QCheckListItem *clItem = (QCheckListItem *)item;
+ Q3CheckListItem *clItem = (Q3CheckListItem *)item;
QString curCat(getCurrentCategory());
// find document position of this entry.
unsigned int curEntryDocIndex;
if (!getDocEntryIndex(&curEntryDocIndex, item))
return;
// hack to refresh the comment, if only one item is present
if (lv->childCount() == 1)
refreshCommentTextEdit(lv->currentItem());
if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn())
return; // this is just a click somewhere on the entry
if (doc->isDeepLocked()) {
PwMerror ret;
ret = doc->deepLock(false);
if (ret != e_success)
clItem->setOn(false);
return;
}
doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn());
}
-void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int)
+void PwMView::handleRightClick(Q3ListViewItem *item, const QPoint &point, int)
{
if (!item)
return;
ctxMenu->move(point);
/* don't use ctxMenu->exec() here, as it generates race conditions
* with the card interface code. Believe it or not. :)
*/
ctxMenu->show();
}
void PwMView::updateCategories()
{
//qDebug("PwMView::updateCategories() ");
QString oldSel(getCurrentCategory());
delAllCategories();
QStringList catList;
document()->getCategoryList(&catList);
catList.sort();
#ifndef PWM_EMBEDDED
QStringList::iterator i = catList.begin(),
end = catList.end();
#else
QStringList::Iterator i = catList.begin(),
end = catList.end();
#endif
while (i != end) {
addCategory(*i);
++i;
}
selectCategory(oldSel);
}
@@ -245,146 +253,146 @@ void PwMView::shiftToView()
doc->ensureLvp();
// clear all tmp-data vectors
unsigned int i, entries = doc->numEntries(catDocIndex);
if (entries) {
mainClass->setVirgin(false);
}
vector<PwMDataItem> tmpSorted;
PwMDataItem currItem;
currItem.clear();
tmpSorted.insert(tmpSorted.begin(), entries, currItem);
// Sort items and store them in tempoary tmpSorted.
for (i = 0; i < entries; ++i) {
doc->getEntry(catDocIndex, i, &currItem);
//qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos);
tmpSorted[currItem.listViewPos] = currItem;
}
// shift tempoary data to ListView.
tmpDisableSort();
lv->clear();
//US ENH: adjust the headers of the table according the category texts
{
PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex);
// qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str());
lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str());
lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str());
lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str());
}
- QCheckListItem *newItem;
+ Q3CheckListItem *newItem;
vector<PwMDataItem>::iterator it = tmpSorted.begin(),
end = tmpSorted.end();
while (it != end) {
newItem = new ListViewItemPwM(lv);
newItem->setText(COLUMN_DESC, (*it).desc.c_str());
if ((*it).binary) {
newItem->setText(COLUMN_NAME, "");
newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>"));
newItem->setText(COLUMN_URL, "");
newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
} else {
newItem->setText(COLUMN_NAME, (*it).name.c_str());
if ((*it).lockStat) {
newItem->setText(COLUMN_PW, QString((*it).pw.c_str())
+ " "
+ i18n("To unlock click the icon on the left."));
} else {
newItem->setText(COLUMN_PW, (*it).pw.c_str());
}
newItem->setText(COLUMN_URL, (*it).url.c_str());
newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
}
newItem->setOn(!((*it).lockStat));
lv->insertItem(newItem);
++it;
}
tmpReEnableSort();
if (cY || cX)
lv->setContentsPos(cX, cY);
}
void PwMView::reorgLp()
{
if (!lv->childCount())
return;
PWM_ASSERT(doc);
PWM_ASSERT(!doc->isDocEmpty());
- QListViewItem *currItem;
+ Q3ListViewItem *currItem;
vector<unsigned int> foundPos;
/* This searchIn _should_ be:
* const unsigned int searchIn = SEARCH_IN_DESC;
* But we want backward compatibility (see comment in PwMDoc::addEntry()).
* So we need to search again, if we don't find the entry. (see below)
*/
const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME |
SEARCH_IN_URL | SEARCH_IN_LAUNCHER;
QString curCat(getCurrentCategory());
PwMDataItem findThis;
unsigned int i, cnt = lv->childCount();
for (i = 0; i < cnt; ++i) {
currItem = lv->itemAtIndex(i);
findThis.desc = currItem->text(COLUMN_DESC).latin1();
findThis.name = currItem->text(COLUMN_NAME).latin1();
findThis.url = currItem->text(COLUMN_URL).latin1();
findThis.launcher = currItem->text(COLUMN_LAUNCHER).latin1();
doc->findEntry(curCat, findThis, searchIn,
&foundPos, true);
if (!foundPos.size()) {
/* Did not find the entry. We seem to have a binary
* entry here (pray for it!). So search again with
* the "correct" searchIn flags.
*/
const unsigned int searchIn2 = SEARCH_IN_DESC;
doc->findEntry(curCat, findThis, searchIn2,
&foundPos, true);
if (unlikely(!foundPos.size())) {
BUG();
continue;
}
/* We assert that it's a binary entry, now.
* No chance to efficiently verify it here.
*/
}
doc->setListViewPos(curCat, foundPos[0], cnt - i - 1);
}
}
void PwMView::selAt(int index)
{
- QListViewItem *item = lv->itemAtIndex(index);
+ Q3ListViewItem *item = lv->itemAtIndex(index);
if (!item)
return;
lv->setCurrentItem(item);
lv->ensureItemVisible(item);
}
void PwMView::renCatButton_slot()
{
if (doc->isDeepLocked())
return;
RenCatWnd wnd(this);
if (wnd.exec() == 1) {
QString newName(wnd.getNewName());
if (newName == "")
return;
document()->renameCategory(getCurrentCategory(),
newName);
}
}
void PwMView::delCatButton_slot()
{
if (doc->isDeepLocked())
return;
if (numCategories() <= 1) {
mainClass->showStatMsg(i18n("Can't remove the last category."));
return;
}
if (KMessageBox::questionYesNo(this,
i18n("Do you really want to\n"
"delete the selected\n"
"category? All password-\n"
@@ -450,65 +458,65 @@ void PwMView::copyUrlToClip()
void PwMView::copyLauncherToClip()
{
if (doc->isDeepLocked())
return;
unsigned int curIndex = 0;
if (!getCurEntryIndex(&curIndex))
return;
PwMDataItem d;
document()->getEntry(getCurrentCategory(), curIndex, &d);
PwM::copyToClipboard(d.launcher.c_str());
}
void PwMView::copyCommentToClip()
{
if (doc->isDeepLocked())
return;
unsigned int curIndex = 0;
if (!getCurEntryIndex(&curIndex))
return;
PwMDataItem d;
document()->getEntry(getCurrentCategory(), curIndex, &d);
PwM::copyToClipboard(d.comment.c_str());
}
/************************************************************************
*
*
*
************************************************************************/
PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name )
- : QTextBrowser( parent, name )
+ : Q3TextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
void PwMDataItemView::setPwMDataItem( const PwMDataItem& a )
{
mItem = a;
// clear view
setText( QString::null );
QString dynamicPart;
QString format = "<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>";
dynamicPart += format
.arg( i18n("LastUpdate") )
.arg( mItem.meta.update.toString().latin1() );
dynamicPart += format
.arg( i18n("Description") )
@@ -537,87 +545,87 @@ void PwMDataItemView::setPwMDataItem( const PwMDataItem& a )
QString mText = "<table><td colspan=\"2\">&nbsp;</td>";
mText += dynamicPart;
mText += "</table>";
// at last display it...
setText( mText );
}
PwMDataItem PwMDataItemView::pwmdataitem() const
{
return mItem;
}
/************************************************************************
*
*
*
************************************************************************/
PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name )
: KDialogBase(parent, name, true ,
i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false)
{
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
QWidget* topframe = new QWidget( this );
setMainWidget( topframe );
- QBoxLayout* bl;
+ Q3BoxLayout* bl;
if ( QApplication::desktop()->width() < 640 ) {
- bl = new QVBoxLayout( topframe );
+ bl = new Q3VBoxLayout( topframe );
} else {
- bl = new QHBoxLayout( topframe );
+ bl = new Q3HBoxLayout( topframe );
}
- QVBox* subframe = new QVBox( topframe );
+ Q3VBox* subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
QLabel* lab = new QLabel( i18n("Local Entry"), subframe );
if ( takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
PwMDataItemView * av = new PwMDataItemView( subframe );
av->setPwMDataItem( loc );
- subframe = new QVBox( topframe );
+ subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
lab = new QLabel( i18n("Remote Entry"), subframe );
if ( !takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
av = new PwMDataItemView( subframe );
av->setPwMDataItem( rem );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
#ifndef DESKTOP_VERSION
showMaximized();
#else
resize ( 640, 400 );
#endif
}
int PwMDataItemChooser::executeD( bool local )
{
mSyncResult = 3;
if ( local )
findButton( User1 )->setFocus();
else
findButton( Ok )->setFocus();
exec();
return mSyncResult;
}
void PwMDataItemChooser::slot_remote()
{
mSyncResult = 2;
accept();
}
void PwMDataItemChooser::slot_local()
{
mSyncResult = 1;
accept();
}
-#ifndef PWM_EMBEDDED
-#include "pwmview.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmview.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwmview.h b/pwmanager/pwmanager/pwmview.h
index e42b17a..8f60063 100644
--- a/pwmanager/pwmanager/pwmview.h
+++ b/pwmanager/pwmanager/pwmview.h
@@ -12,176 +12,180 @@
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef PWMVIEW_H
#define PWMVIEW_H
//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
//US ENH: for examle in listviewpwm.cpp
//US ENH: Because of that I transfer them into the headerfile.
#define COLUMN_DESC 0
#define COLUMN_NAME 1
#define COLUMN_PW 2
#define COLUMN_URL 3
#define COLUMN_LAUNCHER 4
#include "listviewpwm.h"
#include "pwmdoc.h"
#include "pwmviewstyle.h"
#include <kconfig.h>
#include <klocale.h>
#include <kdialogbase.h>
#include <qevent.h>
#include <qfont.h>
#include <qobject.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QKeyEvent>
+#include <Q3PopupMenu>
#include <vector>
#include <string>
using std::string;
using std::vector;
class PwM;
class ConfFile;
class PwMStatusBar;
/** View class for PwM */
class PwMView : public PwMViewStyle
{
Q_OBJECT
friend class PwMViewStyle;
public:
/** construtor */
PwMView(PwM *_mainClass, QWidget* parent, PwMDoc *_doc,
const char *name = 0);
/** destructor */
~PwMView();
/** returns pointer to the document */
PwMDoc* document()
{ return doc; }
/** returns the index of the currently selected entry.
* (index as represented in PwMDoc !)
*/
bool getCurEntryIndex(unsigned int *index);
/** returns the position of the given item in the document
* Note: This func only serches in the current category.
*/
bool getDocEntryIndex(unsigned int *index,
- const QListViewItem *item);
+ const Q3ListViewItem *item);
public slots:
/** update the view (call if dirty) */
void updateView()
{
updateCategories();
shiftToView();
}
/** (re)sort all items and (re)shift them to listView. */
void shiftToView();
/** handle clicking on an item */
- void handleToggle(QListViewItem *item);
+ void handleToggle(Q3ListViewItem *item);
/** handle right-clicking on an item */
- void handleRightClick(QListViewItem *item, const QPoint &point, int);
+ void handleRightClick(Q3ListViewItem *item, const QPoint &point, int);
/** selects the item at "index" */
void selAt(int index);
/** rename category button pressed */
void renCatButton_slot();
/** delete category button pressed */
void delCatButton_slot();
protected:
/** right-click context-menu */
- QPopupMenu *ctxMenu;
+ Q3PopupMenu *ctxMenu;
protected:
/** update the categories from document */
void updateCategories();
/** widget resize event */
void resizeEvent(QResizeEvent *);
/** initialize context-menu */
void initCtxMenu();
/** tempoarly disable auto-sorting and user-sorting */
void tmpDisableSort()
{ lv->setSorting(-1); }
/** re-enable tempoarly disabled sorting */
void tmpReEnableSort()
{
lv->setSorting(lv->columns() + 1,
true/*lv->sortOrder() == Qt::Ascending*/);
}
/** The user pressed and released a key. */
void keyReleaseEvent(QKeyEvent *e);
protected slots:
/** changes the comment text-edit, because a new item has been selected */
- void refreshCommentTextEdit(QListViewItem *curItem);
+ void refreshCommentTextEdit(Q3ListViewItem *curItem);
/** copy pw to clipboard */
void copyPwToClip();
/** copy name to clipboard */
void copyNameToClip();
/** copy desc to clipboard */
void copyDescToClip();
/** copy url to clipboard */
void copyUrlToClip();
/** copy launcher to clipboard */
void copyLauncherToClip();
/** copy comment to clipboard */
void copyCommentToClip();
/** reorganize the "listViewPos" positions in the document
* (for the current category only!)
*/
void reorgLp();
private:
/** document */
PwMDoc *doc;
/** pointer to the main class "PwM" */
PwM *mainClass;
};
//US ENH basic widget to view an password entry. We need it for the sync stuff.
//But might be oif interest for other functionalities as well.
-class PwMDataItemView : public QTextBrowser
+class PwMDataItemView : public Q3TextBrowser
{
public:
PwMDataItemView( QWidget *parent = 0, const char *name = 0 );
/**
Sets the PwMDataItem object. It is displayed immediately.
@param a The PwMDataItem object.
*/
void setPwMDataItem( const PwMDataItem& a );
/**
Returns the current PwMDataItem object.
*/
PwMDataItem pwmdataitem() const;
private:
PwMDataItem mItem;
};
//US ENH we need this chooser when syncing results in a conflict
class PwMDataItemChooser : public KDialogBase
{
Q_OBJECT
public:
PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent = 0, const char *name = 0 );
int executeD( bool local );
private:
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp
index ee35472..b6d930f 100644
--- a/pwmanager/pwmanager/pwmviewstyle.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle.cpp
@@ -32,106 +32,106 @@
#endif
PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name)
: QWidget(parent, name)
{
curStyle = style_notset;
s0 = 0;
s1 = 0;
}
PwMViewStyle::~PwMViewStyle()
{
//US ENH : store the size of the listviewcolumns
switch (curStyle)
{
case style_0:
s0->saveSettings(PWMPrefs::instance());
break;
case style_1:
s1->saveSettings(PWMPrefs::instance());
break;
default:
BUG();
}
PWMPrefs::instance()->writeConfig();
delete_ifnot_null(s0);
delete_ifnot_null(s1);
}
-void PwMViewStyle::editPassWord( QListViewItem * i )
+void PwMViewStyle::editPassWord( Q3ListViewItem * i )
{
if ( !i )
return;
emit editPW();
}
void PwMViewStyle::initStyle(style_t style)
{
printDebug(string("initializing style ") + tostr(style));
bool wasMaximized = v->isMaximized();
if (v->isVisible())
v->hide();
switch (style) {
case style_0:
delete_ifnot_null(s0);
delete_ifnot_null(s1);
s0 = new PwMViewStyle_0(v);
lv = s0->getLv();
commentBox = s0->getCommentBox();
break;
case style_1:
delete_ifnot_null(s0);
delete_ifnot_null(s1);
s1 = new PwMViewStyle_1(v);
lv = s1->getLv();
commentBox = s1->getCommentBox();
break;
default:
BUG();
return;
}
curStyle = style;
- connect(lv, SIGNAL(pressed(QListViewItem *)),
- v, SLOT(handleToggle(QListViewItem *)));
- connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)),
- v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int)));
- connect(lv, SIGNAL(clicked(QListViewItem *)),
- v, SLOT(refreshCommentTextEdit(QListViewItem *)));
- connect(lv, SIGNAL(returnPressed(QListViewItem *)),
- this, SLOT(editPassWord(QListViewItem *)));
- connect(lv, SIGNAL(doubleClicked(QListViewItem *)),
- this, SLOT(editPassWord(QListViewItem *)));
+ connect(lv, SIGNAL(pressed(Q3ListViewItem *)),
+ v, SLOT(handleToggle(Q3ListViewItem *)));
+ connect(lv, SIGNAL(rightButtonClicked(Q3ListViewItem *, const QPoint &, int)),
+ v, SLOT(handleRightClick(Q3ListViewItem *, const QPoint &, int)));
+ connect(lv, SIGNAL(clicked(Q3ListViewItem *)),
+ v, SLOT(refreshCommentTextEdit(Q3ListViewItem *)));
+ connect(lv, SIGNAL(returnPressed(Q3ListViewItem *)),
+ this, SLOT(editPassWord(Q3ListViewItem *)));
+ connect(lv, SIGNAL(doubleClicked(Q3ListViewItem *)),
+ this, SLOT(editPassWord(Q3ListViewItem *)));
connect(lv, SIGNAL(insertPW()),
this, SIGNAL( insertPW() ));
connect(lv, SIGNAL(deletePW()),
this, SIGNAL( deletePW() ));
lv->addColumn(i18n("Description"), 180);
lv->addColumn(i18n("Username"), 150);
lv->addColumn(i18n("Password"), 150);
lv->addColumn(i18n("URL"), 180);
lv->addColumn(i18n("Launcher"), 120);
v->tmpReEnableSort();
//US ENH : load the size of the listviewcolumns
switch (curStyle)
{
case style_0:
s0->restoreSettings(PWMPrefs::instance());
break;
case style_1:
s1->restoreSettings(PWMPrefs::instance());
break;
default:
BUG();
}
resizeView(v->size());
v->updateView();
if (wasMaximized) {
v->showMaximized();
} else {
v->show();
}
@@ -220,35 +220,35 @@ void PwMViewStyle::delAllCategories()
void PwMViewStyle::selectCategory(const QString &cat)
{
switch (curStyle) {
case style_0:
PWM_ASSERT(s0);
s0->selectCategory(cat);
return;
case style_1:
PWM_ASSERT(s1);
s1->selectCategory(cat);
return;
default:
BUG();
}
}
int PwMViewStyle::numCategories()
{
switch (curStyle) {
case style_0:
PWM_ASSERT(s0);
return s0->numCategories();
case style_1:
PWM_ASSERT(s1);
return s1->numCategories();
default:
BUG();
}
return 0;
}
-#ifndef PWM_EMBEDDED
-#include "pwmviewstyle.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmviewstyle.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwmviewstyle.h b/pwmanager/pwmanager/pwmviewstyle.h
index 6c2d81c..a7dccbe 100644
--- a/pwmanager/pwmanager/pwmviewstyle.h
+++ b/pwmanager/pwmanager/pwmviewstyle.h
@@ -1,115 +1,115 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef PWMVIEWSTYLE_H
#define PWMVIEWSTYLE_H
#include <qwidget.h>
#include <qsplitter.h>
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qpushbutton.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#ifndef PWM_EMBEDDED
-#include <qtextedit.h>
+#include <q3textedit.h>
#else
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#endif
#include <qlabel.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qcombobox.h>
#include <qsize.h>
class ListViewPwM;
class PwMViewStyle_0;
class PwMViewStyle_1;
class PwMView;
-class QListViewItem;
+class Q3ListViewItem;
class CommentBox;
class PwMViewStyle : public QWidget
{
Q_OBJECT
public:
enum style_t
{
style_notset = -1,
style_0 = 0,
style_1 = 1
};
public:
PwMViewStyle(QWidget *parent = 0, const char *name = 0);
~PwMViewStyle();
/** initialize a new style */
void initStyle(style_t style);
void initStyle(int style)
{ initStyle(static_cast<style_t>(style)); }
/** returns the currently used style */
style_t getCurStyle()
{ return curStyle; }
void setView(PwMView *view)
{ v = view; }
/** returns the currently selected category */
QString getCurrentCategory();
protected:
/** add Category to the view */
void addCategory(const QString &cat);
/** delete Category from view */
void delCategory(const QString &cat);
/** delete all categories from view */
void delAllCategories();
/** select the specified category */
void selectCategory(const QString &cat);
/** returns the number of categories in this view.
* This value dosn't say anything about the number of
* categories in the document.
*/
int numCategories();
/** resize the view */
void resizeView(const QSize &size);
ListViewPwM *lv;
CommentBox *commentBox;
protected slots:
- void editPassWord( QListViewItem * );
+ void editPassWord( Q3ListViewItem * );
private:
/** which style has the view?
* KListBox on the left,
* or QComboBox on the top?
*/
style_t curStyle;
PwMViewStyle_0 *s0;
PwMViewStyle_1 *s1;
PwMView *v;
signals:
void editPW();
void insertPW();
void deletePW();
};
#endif
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.cpp b/pwmanager/pwmanager/pwmviewstyle_0.cpp
index 1d88a34..3d1f41f 100644
--- a/pwmanager/pwmanager/pwmviewstyle_0.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle_0.cpp
@@ -1,118 +1,121 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwmviewstyle_0.h"
#include "pwmview.h"
#include "listviewpwm.h"
#include "commentbox.h"
#include <klocale.h>
#include <kglobal.h>
#include <kiconloader.h>
#include "pwmprefs.h"
+//Added by qt3to4:
+#include <QLabel>
+#include <Q3ValueList>
PwMViewStyle_0::PwMViewStyle_0(PwMView *view)
: QObject()
{
- vbox1 = new QVBox(view);
+ vbox1 = new Q3VBox(view);
vbox1->setSpacing(0);
- hbox1 = new QHBox(vbox1);
+ hbox1 = new Q3HBox(vbox1);
hbox1->setSpacing(0);
categoriesTitle = new QLabel(hbox1);
categoriesTitle->setText(i18n("Category:"));
categoriesCombo = new QComboBox(hbox1);
categoriesCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred ));
renCatButton = new QPushButton( hbox1);
renCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("edit", KIcon::Small) );
int maxsi = renCatButton->sizeHint().height()+4;
renCatButton->setMinimumSize( maxsi, maxsi );
delCatButton = new QPushButton( hbox1);
delCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("editdelete", KIcon::Small) );
maxsi = delCatButton->sizeHint().height()+4;
delCatButton->setMinimumSize( maxsi, maxsi );
- delCatButton->setFocusPolicy( QWidget::NoFocus );
- renCatButton->setFocusPolicy( QWidget::NoFocus );
+ delCatButton->setFocusPolicy( Qt::NoFocus );
+ renCatButton->setFocusPolicy( Qt::NoFocus );
#ifndef PWM_EMBEDDED
splitter1 = new QSplitter(vbox1);
splitter1->setOrientation(Qt::Vertical);
#else
splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1);
splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
//US topLayout->addWidget(mMiniSplitter );
#endif
lv = new ListViewPwM(splitter1);
commentBox = new CommentBox(splitter1);
// set sizes and styles
commentBox->resize(commentBox->size().width(), 60);
categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
// connections
connect(categoriesCombo, SIGNAL(activated(int)),
view, SLOT(shiftToView()));
connect(renCatButton, SIGNAL(clicked()),
view, SLOT(renCatButton_slot()));
connect(delCatButton, SIGNAL(clicked()),
view, SLOT(delCatButton_slot()));
connect(lv, SIGNAL(toggleOverview()),
this, SLOT(toggleSplitter()));
}
PwMViewStyle_0::~PwMViewStyle_0()
{
delete vbox1;
}
void PwMViewStyle_0::toggleSplitter()
{
- QValueList<int> si = splitter1->sizes();
+ Q3ValueList<int> si = splitter1->sizes();
splitter1->toggle();
- QValueList<int> si2 = splitter1->sizes();
+ Q3ValueList<int> si2 = splitter1->sizes();
//qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] );
if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) {
int diff = si[0]/2;
if ( diff > 200 )
diff = 200;
si[0] -= diff;
si[1] += diff;
splitter1->toggle();
splitter1->setSizes( si );
}
}
void PwMViewStyle_0::delCategory(const QString &cat)
{
PWM_ASSERT(categoriesCombo);
int i, count = categoriesCombo->count();
for (i = 0; i < count; ++i) {
if (categoriesCombo->text(i) == cat) {
categoriesCombo->removeItem(i);
return;
}
}
BUG();
}
void PwMViewStyle_0::selectCategory(const QString &cat)
{
PWM_ASSERT(categoriesCombo);
int i, count = categoriesCombo->count();
for (i = 0; i < count; ++i) {
if (categoriesCombo->text(i) == cat) {
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.h b/pwmanager/pwmanager/pwmviewstyle_0.h
index 6d3c1d1..f144eec 100644
--- a/pwmanager/pwmanager/pwmviewstyle_0.h
+++ b/pwmanager/pwmanager/pwmviewstyle_0.h
@@ -1,107 +1,107 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef PWMVIEWSTYLE_0_H
#define PWMVIEWSTYLE_0_H
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qpushbutton.h>
#ifndef PWM_EMBEDDED
-#include <qtextedit.h>
+#include <q3textedit.h>
#include <qsplitter.h>
#else
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#include <KDGanttMinimizeSplitter.h>
#endif
#include <qlabel.h>
#include <qcombobox.h>
class PwMView;
class ListViewPwM;
class CommentBox;
class PWMPrefs;
class PwMViewStyle_0 : public QObject
{
Q_OBJECT
public:
PwMViewStyle_0(PwMView *view);
~PwMViewStyle_0();
ListViewPwM * getLv()
{ return lv; }
CommentBox * getCommentBox()
{ return commentBox; }
/** returns the currently selected category */
QString getCurrentCategory()
{ return categoriesCombo->currentText(); }
/** add Category to the view */
void addCategory(const QString &cat)
{ categoriesCombo->insertItem(cat); }
/** delete Category from view */
void delCategory(const QString &cat);
/** delete all categories from view */
void delAllCategories()
{ categoriesCombo->clear(); }
/** select the specified category */
void selectCategory(const QString &cat);
/** returns the number of categories in this view.
* This value dosn't say anything about the number of
* categories in the document.
*/
int numCategories()
{ return categoriesCombo->count(); }
/** resize the view */
void resize(const QSize &size)
{ vbox1->resize(size); }
//US ENH: I need a place to load the view dependend settings. Eg. splittersize
void restoreSettings(PWMPrefs* prefs);
void saveSettings(PWMPrefs* prefs);
public slots:
void toggleSplitter();
protected:
/** main list view */
ListViewPwM *lv;
/** categories combo-box */
QComboBox *categoriesCombo;
/** title string for the categories combo or list box */
QLabel *categoriesTitle;
/** hbox1 for widget style */
- QHBox *hbox1;
+ Q3HBox *hbox1;
/** vbox1 for widget style */
- QVBox *vbox1;
+ Q3VBox *vbox1;
/** splitter for commentTextEdit */
#ifndef PWM_EMBEDDED
QSplitter *splitter1;
#else
KDGanttMinimizeSplitter * splitter1;
#endif
/** push button to change the category name */
QPushButton *renCatButton;
/** push button to delete the category */
QPushButton *delCatButton;
/** comment box */
CommentBox *commentBox;
};
#endif
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp
index e335a3f..83eed97 100644
--- a/pwmanager/pwmanager/pwmviewstyle_1.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp
@@ -1,192 +1,198 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "pwmviewstyle_1.h"
#include "pwmview.h"
#include "listviewpwm.h"
#include "commentbox.h"
#include <klocale.h>
#include "pwmprefs.h"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#else
#include <qapplication.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QLabel>
+#include <Q3ValueList>
+#include <Q3Frame>
+#include <Q3PopupMenu>
#endif
#define INITIAL_CATEGORIES_WIDTH 100
PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
: QObject()
{
#ifndef PWM_EMBEDDED
splitter = new QSplitter(view);
#else
if ( QApplication::desktop()->width() > 240 ) {
splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view);
splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
// topLayout = new QHBoxLayout( this );
// mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
// mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
} else {
splitter = new KDGanttMinimizeSplitter( Qt::Vertical, view);
splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
// topLayout = new QHBoxLayout( this );
// mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
// mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
}
//US topLayout->addWidget(mMiniSplitter );
#endif
- vbox1 = new QVBox(splitter);
+ vbox1 = new Q3VBox(splitter);
categoriesTitle = new QLabel(vbox1);
- categoriesList = new QListBox(vbox1);
+ categoriesList = new Q3ListBox(vbox1);
#ifndef PWM_EMBEDDED
splitter2 = new QSplitter(splitter);
splitter2->setOrientation(Qt::Vertical);
#else
splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter);
splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
//US topLayout->addWidget(mMiniSplitter );
#endif
lv = new ListViewPwM(splitter2);
commentBox = new CommentBox(splitter2);
// set sizes and styles
//US commentBox->resize(commentBox->size().width(), 60);
- QValueList<int> sizes;
+ Q3ValueList<int> sizes;
#ifndef PWM_EMBEDDED
sizes.push_back(INITIAL_CATEGORIES_WIDTH);
sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH);
#else
sizes.append(INITIAL_CATEGORIES_WIDTH);
sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH);
#endif
//US splitter->setSizes(sizes);
categoriesTitle->setAlignment(Qt::AlignHCenter);
#ifndef PWM_EMBEDDED
- categoriesTitle->setFrameShape(QFrame::MenuBarPanel);
+ categoriesTitle->setFrameShape(Q3Frame::MenuBarPanel);
#else
//categoriesTitle->setFrameShape(QFrame::StyledPanel);
#endif
categoriesTitle->setText(i18n("Category:"));
- catCtxMenu = new QPopupMenu(view);
+ catCtxMenu = new Q3PopupMenu(view);
catCtxMenu->insertItem(i18n("&Rename"),
view, SLOT(renCatButton_slot()));
catCtxMenu->insertItem(i18n("&Delete"),
view, SLOT(delCatButton_slot()));
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold );
#endif
// connections
connect(categoriesList, SIGNAL(highlighted(int)),
view, SLOT(shiftToView()));
connect(categoriesList,
- SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)),
+ SIGNAL(rightButtonClicked(Q3ListBoxItem *, const QPoint &)),
this,
- SLOT(catRightClick(QListBoxItem *, const QPoint &)));
+ SLOT(catRightClick(Q3ListBoxItem *, const QPoint &)));
connect(lv, SIGNAL(toggleOverview()),
this, SLOT(toggleSplitter()));
}
PwMViewStyle_1::~PwMViewStyle_1()
{
delete catCtxMenu;
delete splitter;
}
void PwMViewStyle_1::toggleSplitter()
{
- QValueList<int> si = splitter2->sizes();
+ Q3ValueList<int> si = splitter2->sizes();
splitter2->toggle();
- QValueList<int> si2 = splitter2->sizes();
+ Q3ValueList<int> si2 = splitter2->sizes();
//qDebug("PwMViewStyle_1::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] );
if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) {
int diff = si[0]/2;
if ( diff > 200 )
diff = 200;
si[0] -= diff;
si[1] += diff;
splitter2->toggle();
splitter2->setSizes( si );
}
}
-void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point)
+void PwMViewStyle_1::catRightClick(Q3ListBoxItem *item, const QPoint &point)
{
if (!item)
return;
catCtxMenu->move(point);
catCtxMenu->show();
}
void PwMViewStyle_1::delCategory(const QString &cat)
{
PWM_ASSERT(categoriesList);
int i, count = categoriesList->count();
for (i = 0; i < count; ++i) {
if (categoriesList->text(i) == cat) {
categoriesList->removeItem(i);
return;
}
}
BUG();
}
void PwMViewStyle_1::selectCategory(const QString &cat)
{
PWM_ASSERT(categoriesList);
int i, count = categoriesList->count();
for (i = 0; i < count; ++i) {
if (categoriesList->text(i) == cat) {
categoriesList->setCurrentItem(i);
return;
}
}
// fall back to 0
categoriesList->setCurrentItem(0);
}
//US ENH: I need a place to load the view dependend settings. Eg. splittersize
void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs)
{
//load and store the size of the listviewcolumns
lv->restoreLayout(prefs->getConfig(), "listview");
splitter->setSizes( prefs->mCategorySplitter );
splitter2->setSizes( prefs->mCommentSplitter );
commentBox->setFont( prefs->mViewFont );
}
//US ENH: I need a place to load the view dependend settings. Eg. splittersize
void PwMViewStyle_1::saveSettings(PWMPrefs* prefs)
{
//store the size of the listviewcolumns
lv->saveLayout(prefs->getConfig(), "listview");
prefs->mCategorySplitter = splitter->sizes();
prefs->mCommentSplitter = splitter2->sizes();
}
-#ifndef PWM_EMBEDDED
-#include "pwmviewstyle_1.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmviewstyle_1.cpp"
#endif
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.h b/pwmanager/pwmanager/pwmviewstyle_1.h
index 4f7a256..66cba03 100644
--- a/pwmanager/pwmanager/pwmviewstyle_1.h
+++ b/pwmanager/pwmanager/pwmviewstyle_1.h
@@ -1,114 +1,114 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef PWMVIEWSTYLE_1_H
#define PWMVIEWSTYLE_1_H
-#include <qvbox.h>
+#include <q3vbox.h>
#ifndef PWM_EMBEDDED
-#include <qtextedit.h>
+#include <q3textedit.h>
#include <qsplitter.h>
#else
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
#include <KDGanttMinimizeSplitter.h>
#endif
#include <qlabel.h>
-#include <qlistbox.h>
-#include <qpopupmenu.h>
+#include <q3listbox.h>
+#include <q3popupmenu.h>
class PwMView;
class ListViewPwM;
class CommentBox;
class PWMPrefs;
class PwMViewStyle_1 : public QObject
{
Q_OBJECT
public:
PwMViewStyle_1(PwMView *view);
~PwMViewStyle_1();
ListViewPwM * getLv()
{ return lv; }
CommentBox * getCommentBox()
{ return commentBox; }
/** returns the currently selected category */
QString getCurrentCategory()
{ return categoriesList->currentText(); }
/** add Category to the view */
void addCategory(const QString &cat)
{ categoriesList->insertItem(cat); }
/** delete Category from view */
void delCategory(const QString &cat);
/** delete all categories from view */
void delAllCategories()
{ categoriesList->clear(); }
/** select the specified category */
void selectCategory(const QString &cat);
/** returns the number of categories in this view.
* This value dosn't say anything about the number of
* categories in the document.
*/
int numCategories()
{ return categoriesList->count(); }
/** resize the view */
void resize(const QSize &size)
{ splitter->resize(size); }
//US ENH: I need a place to load the view dependend settings. Eg. splittersize
void restoreSettings(PWMPrefs* prefs);
void saveSettings(PWMPrefs* prefs);
public slots:
void toggleSplitter();
protected slots:
/** user clicked right button in category list */
- void catRightClick(QListBoxItem *item, const QPoint &point);
+ void catRightClick(Q3ListBoxItem *item, const QPoint &point);
protected:
/** main list view */
ListViewPwM *lv;
#ifndef PWM_EMBEDDED
/** main splitter widget */
QSplitter *splitter;
/** commentTextEdit splitter */
QSplitter *splitter2;
#else
/** main splitter widget */
KDGanttMinimizeSplitter *splitter;
/** commentTextEdit splitter */
KDGanttMinimizeSplitter *splitter2;
#endif
/** categories list-box */
- QListBox *categoriesList;
+ Q3ListBox *categoriesList;
/** title string for the categories combo or list box */
QLabel *categoriesTitle;
/** hbox1 for widget style */
- QVBox *vbox1;
+ Q3VBox *vbox1;
/** text-edit to display the comment */
CommentBox *commentBox;
/** category list context menu */
- QPopupMenu *catCtxMenu;
+ Q3PopupMenu *catCtxMenu;
};
#endif
diff --git a/pwmanager/pwmanager/randomizer.cpp b/pwmanager/pwmanager/randomizer.cpp
index da4df78..24f9926 100644
--- a/pwmanager/pwmanager/randomizer.cpp
+++ b/pwmanager/pwmanager/randomizer.cpp
@@ -24,83 +24,83 @@
#include <kapplication.h>
#include <stdlib.h>
#include <time.h>
#ifdef PWM_EMBEDDED
#ifndef Q_LONG
#define Q_LONG long
#endif
#endif //PWM_EMBEDDED
#ifdef _WIN32_
int rand_r( uint * seed ) {
srand(*seed);
return rand();
}
#endif
Randomizer * Randomizer::rndObj (0);
Randomizer::Randomizer()
{
rndDev = new QFile;
seed = time(0);
#if 1 // set to 0 to test rand_r() fallback
// probe for /dev/urandom
rndDev->setName("/dev/urandom");
if (rndDev->exists() &&
- rndDev->open(IO_ReadOnly)) {
+ rndDev->open(QIODevice::ReadOnly)) {
printDebug("Randomizer: using /dev/urandom");
return;
}
// probe for /dev/random
rndDev->setName("/dev/random");
if (rndDev->exists() &&
- rndDev->open(IO_ReadOnly)) {
+ rndDev->open(QIODevice::ReadOnly)) {
printDebug("Randomizer: using /dev/random");
return;
}
// probe for EGD
char *fn = getenv("RANDFILE");
if (fn) {
rndDev->setName(fn);
if (rndDev->exists() &&
- rndDev->open(IO_ReadOnly)) {
+ rndDev->open(QIODevice::ReadOnly)) {
printDebug(string("Randomizer: using $RANDFILE \"")
+ fn
+ "\" (aka EGD)");
return;
}
}
#endif
/* no secure randomizer found.
* Fall back to stdlib randomizer.
*/
delete_and_null(rndDev);
printWarn("neither /dev/*random nor EGD found! "
"Falling back to insecure rand_r()!");
}
Randomizer::~Randomizer()
{
#ifndef PWM_EMBEDDED
while (mutex.locked()) {
/* wait for the mutex to unlock.
* Don't block the GUI here, so processEvents()
*/
kapp->processEvents();
}
#endif
if (rndDev) {
rndDev->close();
delete rndDev;
}
}
diff --git a/pwmanager/pwmanager/rencatwnd.cpp b/pwmanager/pwmanager/rencatwnd.cpp
index 3c4de27..3ca758c 100644
--- a/pwmanager/pwmanager/rencatwnd.cpp
+++ b/pwmanager/pwmanager/rencatwnd.cpp
@@ -1,70 +1,73 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "rencatwnd.h"
#include <klocale.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
RenCatWnd::RenCatWnd(QWidget *parent,
- const char *name, bool modal, WFlags f)
+ const char *name, bool modal, Qt::WFlags f)
: QDialog(parent, name, true, f)
{
- vbox1 = new QVBox(this);
+ vbox1 = new Q3VBox(this);
label = new QLabel(vbox1);
newName = new QLineEdit(vbox1);
- hbox1 = new QHBox(vbox1);
+ hbox1 = new Q3HBox(vbox1);
okButton = new QPushButton(i18n("&Ok"), hbox1);
cancelButton = new QPushButton(i18n("&Cancel"), hbox1);
vbox1->setSpacing(10);
vbox1->setMargin(10);
hbox1->setSpacing(10);
resize(220, 100);
setCaption(i18n("Rename category"));
label->setText(i18n("New category name:"));
connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_slot()));
}
RenCatWnd::~RenCatWnd()
{
}
void RenCatWnd::resizeEvent(QResizeEvent *)
{
vbox1->resize(size());
}
void RenCatWnd::okButton_slot()
{
done(1);
}
void RenCatWnd::cancelButton_slot()
{
done(2);
}
-#ifndef PWM_EMBEDDED
-#include "rencatwnd.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_rencatwnd.cpp"
#endif
diff --git a/pwmanager/pwmanager/rencatwnd.h b/pwmanager/pwmanager/rencatwnd.h
index 37b6725..1773136 100644
--- a/pwmanager/pwmanager/rencatwnd.h
+++ b/pwmanager/pwmanager/rencatwnd.h
@@ -1,60 +1,62 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef RENCATWND_H
#define RENCATWND_H
-#include <qvbox.h>
-#include <qhbox.h>
+#include <q3vbox.h>
+#include <q3hbox.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qevent.h>
+//Added by qt3to4:
+#include <QResizeEvent>
/** rename category window */
class RenCatWnd : public QDialog
{
Q_OBJECT
public:
RenCatWnd(QWidget *parent = 0, const char *name = 0,
- bool modal = FALSE, WFlags f = 0);
+ bool modal = FALSE, Qt::WFlags f = 0);
~RenCatWnd();
QString getNewName()
{ return newName->text(); }
protected slots:
void okButton_slot();
void cancelButton_slot();
protected:
- QVBox *vbox1;
- QHBox *hbox1;
+ Q3VBox *vbox1;
+ Q3HBox *hbox1;
QLabel *label;
QLineEdit *newName;
QPushButton *okButton;
QPushButton *cancelButton;
protected:
void resizeEvent(QResizeEvent *);
};
#endif
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp
index 507fa30..6c6512e 100644
--- a/pwmanager/pwmanager/serializer.cpp
+++ b/pwmanager/pwmanager/serializer.cpp
@@ -1,58 +1,60 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "serializer.h"
#include "pwmexception.h"
#ifdef PWM_EMBEDDED
#include <kglobal.h>
#include <klocale.h>
+//Added by qt3to4:
+#include <Q3CString>
#endif
/* enable/disable serializer debugging (0/1) */
#define SERIALIZER_DEBUG 0
/* use the old xml tags for writing (0/1) */
#define USE_OLD_TAGS 0
/* write a CDATA section (0/1) */
#define WRITE_CDATA_SEC 0
#define META_CREATE_DATE "c"
#define META_VALID_DATE "v"
#define META_EXPIRE_DATE "e"
#define META_UPDATE_DATE "u"
#define META_UPDATE_INT "i"
//US ENH : uniqueid and sync information
#define META_UNIQUEID "n"
#define SYNC_ROOT "s"
#define SYNC_TARGET_PREFIX "t"
#define SYNC_TARGET_NAME "n"
/* This is compatibility stuff.
* The names of the entries have changed and here are the
* new and old ones
*/
#define ROOT_MAGIC_OLD "PwM-xml-dat"
#define VER_STR_OLD "ver"
#define COMPAT_VER_OLD "0x02"
#define CAT_ROOT_OLD "categories"
#define CAT_PREFIX_OLD "cat_"
#define CAT_NAME_OLD "name"
@@ -117,143 +119,143 @@
# define COMPAT_VER_WR COMPAT_VER_NEW
# define CAT_ROOT_WR CAT_ROOT_NEW
# define CAT_PREFIX_WR CAT_PREFIX_NEW
# define CAT_NAME_WR CAT_NAME_NEW
//US ENH : optional text for categories
# define CAT_TEXT_WR CAT_TEXT_NEW
# define ENTRY_PREFIX_WR ENTRY_PREFIX_NEW
# define ENTRY_DESC_WR ENTRY_DESC_NEW
# define ENTRY_NAME_WR ENTRY_NAME_NEW
# define ENTRY_PW_WR ENTRY_PW_NEW
# define ENTRY_COMMENT_WR ENTRY_COMMENT_NEW
# define ENTRY_URL_WR ENTRY_URL_NEW
# define ENTRY_LAUNCHER_WR ENTRY_LAUNCHER_NEW
# define ENTRY_LVP_WR ENTRY_LVP_NEW
# define ENTRY_BIN_WR ENTRY_BIN_NEW
# define ENTRY_META_WR ENTRY_META_NEW
#endif
Serializer::Serializer()
{
defaultLockStat = true;
//US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing
#ifndef PWM_EMBEDDED
domDoc = new QDomDocument;
#else
domDoc = new QDomDocument("mydoc");
#endif
}
-Serializer::Serializer(const QCString &buffer)
+Serializer::Serializer(const Q3CString &buffer)
{
defaultLockStat = true;
//US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing
#ifndef PWM_EMBEDDED
domDoc = new QDomDocument;
#else
domDoc = new QDomDocument("mydoc");
#endif
if (!parseXml(buffer)) {
delete domDoc;
#ifndef PWM_EMBEDDED
throw PwMException(PwMException::EX_PARSE);
#else
qDebug("Serializer::Serializer : Parse Exception ");
#endif
}
}
Serializer::~Serializer()
{
delete_ifnot_null(domDoc);
}
void Serializer::clear()
{
delete_ifnot_null(domDoc);
domDoc = new QDomDocument;
}
-bool Serializer::parseXml(const QCString &buffer)
+bool Serializer::parseXml(const Q3CString &buffer)
{
//abort();
//qDebug("parse %s ", buffer.data());
PWM_ASSERT(domDoc);
#ifndef PWM_EMBEDDED
if (!domDoc->setContent(buffer, true))
return false;
#else
#ifdef DESKTOP_VERSION
if (!domDoc->setContent(buffer, true))
#else
if (!domDoc->setContent(buffer))
#endif
return false;
#endif
if (!checkValid())
return false;
return true;
}
-QCString Serializer::getXml()
+Q3CString Serializer::getXml()
{
PWM_ASSERT(domDoc);
#ifndef PWM_EMBEDDED
#if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0
- QCString tmp(domDoc->toCString(8));
+ Q3CString tmp(domDoc->toCString(8));
printDebug("<BEGIN Serializer::getXml() dump>\n");
cout << tmp << endl;
printDebug("<END Serializer::getXml() dump>");
#endif // DEBUG
- QCString ret(domDoc->toCString(0));
+ Q3CString ret(domDoc->toCString(0));
ret.replace('\n', "");
return ret;
#else
#if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0
- QCString tmp(" " + domDoc->toCString());
+ Q3CString tmp(" " + domDoc->toCString());
printDebug("<BEGIN Serializer::getXml() dump>\n");
qDebug(tmp);
cout << tmp << endl;
printDebug("<END Serializer::getXml() dump>");
#endif // DEBUG
- QCString ret(domDoc->toCString());
- ret.replace(QRegExp("\n"), "");
+ Q3CString ret(domDoc->toByteArray());
+ ret.replace("\n", "");
return ret;
#endif
}
bool Serializer::serialize(PwMItem &dta)
{
PWM_ASSERT(domDoc);
QDomElement root(genNewRoot());
QDomElement catNode(domDoc->createElement(CAT_ROOT_WR));
QDomElement syncNode(domDoc->createElement(SYNC_ROOT));
if (!addSyncData(&syncNode, dta.syncDta))
return false;
root.appendChild(syncNode);
if (!addCategories(&catNode, dta.dta))
return false;
root.appendChild(catNode);
return true;
}
bool Serializer::deSerialize(PwMItem *dta)
{
PWM_ASSERT(domDoc);
PWM_ASSERT(dta);
QDomElement root(domDoc->documentElement());
QDomNode n;
dta->clear();
for (n = root.firstChild(); !n.isNull(); n = n.nextSibling()) {
// find <categories> ... </categories>
// <c> ... </c>
if (n.nodeName() == CAT_ROOT_NEW ||
diff --git a/pwmanager/pwmanager/serializer.h b/pwmanager/pwmanager/serializer.h
index df50e42..e085ade 100644
--- a/pwmanager/pwmanager/serializer.h
+++ b/pwmanager/pwmanager/serializer.h
@@ -1,84 +1,84 @@
/***************************************************************************
* *
* copyright (C) 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef __SERIALIZER_H
#define __SERIALIZER_H
#include "pwmdoc.h"
-#include <qcstring.h>
+#include <q3cstring.h>
#include <qdom.h>
#include <vector>
using std::vector;
/** This serializes its input data into
* the PwManager-XML-datastream, that becomes
* encrypted and maybe compressed
*/
class Serializer
{
public:
/** construct an empty serializer document */
Serializer();
/** construct a serializer document and parse "buffer" */
- Serializer(const QCString &buffer);
+ Serializer(const Q3CString &buffer);
/** destructor */
virtual ~Serializer();
/** clears all data */
void clear();
/** parse the given data buffer */
- bool parseXml(const QCString &buffer);
+ bool parseXml(const Q3CString &buffer);
/** returns the current XML data */
- QCString getXml();
+ Q3CString getXml();
/** serialize "dta" and store it as XML data */
//US ENH: we need to serialize and deserialize not only categories, but also synctargets
bool serialize(PwMItem &dta);
/** deserialize the (parsed) XML data and store it in "dta" */
bool deSerialize(PwMItem *dta);
/** sets the initial default lockStat we should assign */
void setDefaultLockStat(bool stat)
{ defaultLockStat = stat; }
protected:
/** main data holder */
QDomDocument *domDoc;
/** default lockStat to assign */
bool defaultLockStat;
protected:
/** check if this is valid PwManager XML data */
bool checkValid();
/** read the categories in the node "n" */
bool readCategories(const QDomNode &n,
vector<PwMCategoryItem> *dta);
/** read the entries in the node "n" */
bool readEntries(const QDomNode &n,
vector<PwMDataItem> *dta);
/** extract the data out of the given item at "n" */
bool extractEntry(const QDomNode &n,
PwMDataItem *dta);
/** extract the meta-data */
bool extractMeta(const QDomNode &n,
PwMMetaData *dta);
/** generates a new root node and sets all initial parameters */
QDomElement genNewRoot();
diff --git a/pwmanager/pwmanager/setmasterpwwnd_emb.cpp b/pwmanager/pwmanager/setmasterpwwnd_emb.cpp
index e6471e6..c5fd4e4 100644
--- a/pwmanager/pwmanager/setmasterpwwnd_emb.cpp
+++ b/pwmanager/pwmanager/setmasterpwwnd_emb.cpp
@@ -2,142 +2,145 @@
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#include "setmasterpwwnd_emb.h"
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3GridLayout>
#include <klocale.h>
/*US
#include <qvariant.h>
#include <qpushbutton.h>
#include <qtabwidget.h>
#include <qwidget.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
*/
/*
* Constructs a setMasterPwWnd as a child of 'parent', with the
* name 'name'
*
*/
setMasterPwWnd::setMasterPwWnd( QWidget* parent, const char* name )
: KDialogBase( KDialogBase::Plain, i18n( "Set master-password" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Ok, parent, name, true )
{
QWidget *page = plainPage();
- QVBoxLayout *pageLayout = new QVBoxLayout( page );
+ Q3VBoxLayout *pageLayout = new Q3VBoxLayout( page );
mainTab = new QTabWidget( page );
pageLayout->addWidget( mainTab );
if ( !name )
setName( "setMasterPwWnd" );
////////////////////////////////////////////////////////////////////
// This is the Password tab1
tab = new QWidget( mainTab );
- QGridLayout *layout = new QGridLayout( tab, 5, 1 );
+ Q3GridLayout *layout = new Q3GridLayout( tab, 5, 1 );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
QLabel* label = new QLabel( i18n( "Using a normal password-string to encrypt the data." ), tab );
- label->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
+ label->setAlignment( int( Qt::WordBreak | Qt::AlignCenter ) );
layout->addWidget(label, 0, 0);
pwEdit_1 = new QLineEdit( tab, "pwEdit_1" );
pwEdit_1->setEchoMode( QLineEdit::Password );
label = new QLabel( pwEdit_1, i18n( "Please enter the new master-password:" ), tab );
layout->addWidget(label, 1, 0);
layout->addWidget(pwEdit_1, 2, 0);
pwEdit_2 = new QLineEdit( tab, "pwEdit_2" );
pwEdit_2->setEchoMode( QLineEdit::Password );
label = new QLabel( pwEdit_2, i18n( "Please enter the password again:" ), tab );
layout->addWidget(label, 3, 0);
layout->addWidget(pwEdit_2, 4, 0);
mainTab->insertTab( tab, i18n("Normal password") );
////////////////////////////////////////////////////////////////////
// This is the Password tab2
tab_2 = new QWidget( mainTab );
- layout = new QGridLayout( tab_2, 5, 1 );
+ layout = new Q3GridLayout( tab_2, 5, 1 );
layout->setMargin( KDialogBase::marginHint() );
layout->setSpacing( KDialogBase::spacingHint() );
label = new QLabel( i18n( "Using a PwM key-card to encrypt the data." ), tab_2 );
- label->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) );
+ label->setAlignment( int( Qt::WordBreak | Qt::AlignCenter ) );
layout->addWidget(label, 0, 0);
label = new QLabel( i18n( "selected card:" ), tab_2 );
- label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
+ label->setAlignment( int( Qt::AlignVCenter | Qt::AlignRight ) );
layout->addWidget(label, 1, 0);
selCardButton = new QPushButton( i18n( "&Select the currently inserted card as key-card" ), tab_2 );
layout->addWidget(selCardButton, 2, 0);
genCardButton = new QPushButton( i18n( "&generate new key-card") , tab_2 );
layout->addWidget(genCardButton, 3, 0);
curCardIdLabel = new QLabel( QString("") , tab_2 );
layout->addWidget(curCardIdLabel, 4, 0);
mainTab->insertTab( tab_2, i18n("Key-card (chipcard)" ) );
// resize( QSize(411, 313).expandedTo(minimumSizeHint()) );
// signals and slots connections
// connect( okButton, SIGNAL( clicked() ), this, SLOT( okButton_slot() ) );
// connect( cancelButton, SIGNAL( clicked() ), this, SLOT( cancelButton_slot() ) );
connect( genCardButton, SIGNAL( clicked() ), this, SLOT( genCardButton_slot() ) );
connect( selCardButton, SIGNAL( clicked() ), this, SLOT( selCardButton_slot() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
setMasterPwWnd::~setMasterPwWnd()
{
// no need to delete child widgets, Qt does it all for us
}
diff --git a/pwmanager/pwmanager/setmasterpwwnd_emb.h b/pwmanager/pwmanager/setmasterpwwnd_emb.h
index c8ddec6..a070fea 100644
--- a/pwmanager/pwmanager/setmasterpwwnd_emb.h
+++ b/pwmanager/pwmanager/setmasterpwwnd_emb.h
@@ -1,61 +1,63 @@
/*
This file is part of PwManager/Platform independent.
Copyright (c) 2004 Ulf Schenk
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
$Id$
*/
#ifndef SETMASTERPWWND_EMB_H
#define SETMASTERPWWND_EMB_H
#include <kdialogbase.h>
+//Added by qt3to4:
+#include <QLabel>
class QLineEdit;
class QPushButton;
class QLabel;
class QTabWidget;
class QWidget;
class setMasterPwWnd : public KDialogBase
{
Q_OBJECT
public:
setMasterPwWnd( QWidget* parent = 0, const char* name = 0 );
~setMasterPwWnd();
QTabWidget* mainTab;
QWidget* tab;
QWidget* tab_2;
QLineEdit* pwEdit_1;
QLineEdit* pwEdit_2;
QPushButton* selCardButton;
QPushButton* genCardButton;
QLabel* curCardIdLabel;
public slots:
virtual void okButton_slot();
virtual void cancelButton_slot();
virtual void genCardButton_slot();
virtual void selCardButton_slot();
};
diff --git a/pwmanager/pwmanager/setmasterpwwndimpl.cpp b/pwmanager/pwmanager/setmasterpwwndimpl.cpp
index 3482643..7041d2e 100644
--- a/pwmanager/pwmanager/setmasterpwwndimpl.cpp
+++ b/pwmanager/pwmanager/setmasterpwwndimpl.cpp
@@ -159,35 +159,35 @@ void SetMasterPwWndImpl::keyAvailable_slot(uint32_t cardId,
{
if (key == "")
return;
curCardKey = key;
char id_buf[(sizeof(cardId) * 2) + 2 /* "0x" */ + 1 /* NULL */];
memcpy(id_buf, "0x", 2);
sprintf(id_buf + 2, "%X", cardId);
curCardIdLabel->setText(id_buf);
}
string SetMasterPwWndImpl::getPw(bool *useCard)
{
int index = mainTab->currentPageIndex();
if (index == 0) {
// normal password
if (useCard)
*useCard = false;
PWM_ASSERT(pwEdit_1->text() == pwEdit_2->text());
return pwEdit_1->text().latin1();
} else {
#ifdef CONFIG_KEYCARD
// key-card
if (useCard)
*useCard = true;
PWM_ASSERT(curCardKey != "");
PWM_ASSERT(curCardIdLabel->text() != STRING_CARD_NONE);
return curCardKey;
#endif // CONFIG_KEYCARD
}
return "";
}
-#ifndef PWM_EMBEDDED
-#include "setmasterpwwndimpl.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_setmasterpwwndimpl.cpp"
#endif
diff --git a/pwmanager/pwmanager/waitwnd.cpp b/pwmanager/pwmanager/waitwnd.cpp
index a3f25cc..d4676a9 100644
--- a/pwmanager/pwmanager/waitwnd.cpp
+++ b/pwmanager/pwmanager/waitwnd.cpp
@@ -1,94 +1,98 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include "waitwnd.h"
#include "globalstuff.h"
#include "pwmexception.h"
#include <qmessagebox.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QCloseEvent>
+#include <QLabel>
#include <klocale.h>
WaitWnd::WaitWnd(QString caption, QString _staticText,
bool showCancelButton, bool showGenericText,
QWidget *parent,
- const char *name, bool modal, WFlags f)
+ const char *name, bool modal, Qt::WFlags f)
: QDialog(parent, name, modal, f)
{
canClose = false;
- vbox1 = new QVBox(this);
+ vbox1 = new Q3VBox(this);
staticText = new QLabel(vbox1);
if (showGenericText) {
genericText = new QLabel(vbox1);
genericText->setAlignment(Qt::AlignHCenter | Qt::WordBreak);
} else {
genericText = 0;
}
if (showCancelButton) {
cancelButton = new QPushButton(vbox1);
connect(cancelButton, SIGNAL(clicked()),
this, SLOT(cancel_slot()));
cancelButton->setText(i18n("&Cancel"));
} else {
cancelButton = 0;
}
vbox1->setSpacing(10);
vbox1->setMargin(10);
resize(300, 150);
setCaption(caption);
staticText->setText(_staticText);
staticText->setAlignment(Qt::AlignHCenter | Qt::WordBreak);
}
WaitWnd::~WaitWnd()
{
}
void WaitWnd::resizeEvent(QResizeEvent *)
{
vbox1->resize(size());
}
void WaitWnd::closeEvent(QCloseEvent *e)
{
if (canClose) {
emit goingToClose();
e->accept();
} else {
e->ignore();
}
}
void WaitWnd::cancel_slot()
{
canClose = true;
close();
}
void WaitWnd::updateGenericText(const QString &text)
{
if (genericText)
genericText->setText(text);
}
-#ifndef PWM_EMBEDDED
-#include "waitwnd.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_waitwnd.cpp"
#endif
diff --git a/pwmanager/pwmanager/waitwnd.h b/pwmanager/pwmanager/waitwnd.h
index ae86c8b..6a619b9 100644
--- a/pwmanager/pwmanager/waitwnd.h
+++ b/pwmanager/pwmanager/waitwnd.h
@@ -1,61 +1,64 @@
/***************************************************************************
* *
* copyright (C) 2003 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#ifndef WAITWND_H
#define WAITWND_H
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qevent.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QCloseEvent>
/** window to ask the user to wait */
class WaitWnd : public QDialog
{
Q_OBJECT
public:
WaitWnd(QString caption, QString _staticText,
bool showCancelButton, bool showGenericText,
QWidget *parent = 0, const char *name = 0,
- bool modal = FALSE, WFlags f = 0);
+ bool modal = FALSE, Qt::WFlags f = 0);
~WaitWnd();
void updateGenericText(const QString &text);
signals:
void goingToClose();
protected slots:
void cancel_slot();
protected:
- QVBox *vbox1;
+ Q3VBox *vbox1;
QLabel *staticText;
QLabel *genericText;
QPushButton *cancelButton;
/** can we safely close the widget? */
bool canClose;
protected:
void resizeEvent(QResizeEvent *);
void closeEvent(QCloseEvent *e);
};
#endif
diff --git a/qtcompat/qptrlist.h b/qtcompat/qptrlist.h
index 8ce6868..c3d3ca2 100644
--- a/qtcompat/qptrlist.h
+++ b/qtcompat/qptrlist.h
@@ -1,10 +1,14 @@
#ifndef QTCOMPAT_QPTRLIST_H
#define QTCOMPAT_QPTRLIST_H
+#if 0
+
#include <qlist.h>
#define QPtrList QList
#define QPtrListIterator QListIterator
#define QPtrCollection QCollection
#endif
+
+#endif
diff --git a/qtcompat/qptrstack.h b/qtcompat/qptrstack.h
index 92070b3..b0afdf1 100644
--- a/qtcompat/qptrstack.h
+++ b/qtcompat/qptrstack.h
@@ -1,9 +1,13 @@
#ifndef QTCOMPAT_QPTRSTACK_H
#define QTCOMPAT_QPTRSTACK_H
+#if 0
+
#include <qstack.h>
#define QPtrStack QStack
#define QPtrStackIterator QStackIterator
#endif
+
+#endif