summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-13 21:35:12 (UTC)
committer zautrix <zautrix>2004-09-13 21:35:12 (UTC)
commitbd6b4acb39498ffea3beea7d9b5f7620b60c14db (patch) (unidiff)
treee2d7425b7bb49fbcb7acb5ced497ac1fed06dfaf
parent06eabf6e82c0390699d11fd12580d91261829431 (diff)
downloadkdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.zip
kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.gz
kdepimpi-bd6b4acb39498ffea3beea7d9b5f7620b60c14db.tar.bz2
Many bugfixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp62
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp56
-rw-r--r--kaddressbook/mainembedded.cpp15
-rw-r--r--kaddressbook/nameeditdialog.cpp7
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp2
-rw-r--r--korganizer/calendarview.cpp8
-rw-r--r--libkdepim/addresseeview.cpp10
-rw-r--r--libkdepim/kdateedit.cpp17
-rw-r--r--libkdepim/kdateedit.h3
-rw-r--r--microkde/kdeui/kaction.cpp44
10 files changed, 144 insertions, 80 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 6b282e2..4cdd5e5 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -708,221 +708,225 @@ void Addressee::setSecrecy( const Secrecy &secrecy )
708 mData->secrecy = secrecy; 708 mData->secrecy = secrecy;
709} 709}
710 710
711Secrecy Addressee::secrecy() const 711Secrecy Addressee::secrecy() const
712{ 712{
713 return mData->secrecy; 713 return mData->secrecy;
714} 714}
715 715
716QString Addressee::secrecyLabel() 716QString Addressee::secrecyLabel()
717{ 717{
718 return i18n("Security Class"); 718 return i18n("Security Class");
719} 719}
720 720
721 721
722void Addressee::setLogo( const Picture &logo ) 722void Addressee::setLogo( const Picture &logo )
723{ 723{
724 if ( logo == mData->logo ) return; 724 if ( logo == mData->logo ) return;
725 detach(); 725 detach();
726 mData->empty = false; 726 mData->empty = false;
727 mData->logo = logo; 727 mData->logo = logo;
728} 728}
729 729
730Picture Addressee::logo() const 730Picture Addressee::logo() const
731{ 731{
732 return mData->logo; 732 return mData->logo;
733} 733}
734 734
735QString Addressee::logoLabel() 735QString Addressee::logoLabel()
736{ 736{
737 return i18n("Logo"); 737 return i18n("Logo");
738} 738}
739 739
740 740
741void Addressee::setPhoto( const Picture &photo ) 741void Addressee::setPhoto( const Picture &photo )
742{ 742{
743 if ( photo == mData->photo ) return; 743 if ( photo == mData->photo ) return;
744 detach(); 744 detach();
745 mData->empty = false; 745 mData->empty = false;
746 mData->photo = photo; 746 mData->photo = photo;
747} 747}
748 748
749Picture Addressee::photo() const 749Picture Addressee::photo() const
750{ 750{
751 return mData->photo; 751 return mData->photo;
752} 752}
753 753
754QString Addressee::photoLabel() 754QString Addressee::photoLabel()
755{ 755{
756 return i18n("Photo"); 756 return i18n("Photo");
757} 757}
758 758
759 759
760void Addressee::setSound( const Sound &sound ) 760void Addressee::setSound( const Sound &sound )
761{ 761{
762 if ( sound == mData->sound ) return; 762 if ( sound == mData->sound ) return;
763 detach(); 763 detach();
764 mData->empty = false; 764 mData->empty = false;
765 mData->sound = sound; 765 mData->sound = sound;
766} 766}
767 767
768Sound Addressee::sound() const 768Sound Addressee::sound() const
769{ 769{
770 return mData->sound; 770 return mData->sound;
771} 771}
772 772
773QString Addressee::soundLabel() 773QString Addressee::soundLabel()
774{ 774{
775 return i18n("Sound"); 775 return i18n("Sound");
776} 776}
777 777
778 778
779void Addressee::setAgent( const Agent &agent ) 779void Addressee::setAgent( const Agent &agent )
780{ 780{
781 if ( agent == mData->agent ) return; 781 if ( agent == mData->agent ) return;
782 detach(); 782 detach();
783 mData->empty = false; 783 mData->empty = false;
784 mData->agent = agent; 784 mData->agent = agent;
785} 785}
786 786
787Agent Addressee::agent() const 787Agent Addressee::agent() const
788{ 788{
789 return mData->agent; 789 return mData->agent;
790} 790}
791 791
792QString Addressee::agentLabel() 792QString Addressee::agentLabel()
793{ 793{
794 return i18n("Agent"); 794 return i18n("Agent");
795} 795}
796 796
797 797
798 798
799void Addressee::setNameFromString( const QString &str ) 799void Addressee::setNameFromString( const QString &str )
800{ 800{
801 setFormattedName( str ); 801 setFormattedName( str );
802 setName( str ); 802 setName( str );
803 803
804 QStringList titles; 804 static bool first = true;
805 titles += i18n( "Dr." ); 805 static QStringList titles;
806 titles += i18n( "Miss" ); 806 static QStringList suffixes;
807 titles += i18n( "Mr." ); 807 static QStringList prefixes;
808 titles += i18n( "Mrs." ); 808
809 titles += i18n( "Ms." ); 809 if ( first ) {
810 titles += i18n( "Prof." ); 810 first = false;
811 811 titles += i18n( "Dr." );
812 QStringList suffixes; 812 titles += i18n( "Miss" );
813 suffixes += i18n( "I" ); 813 titles += i18n( "Mr." );
814 suffixes += i18n( "II" ); 814 titles += i18n( "Mrs." );
815 suffixes += i18n( "III" ); 815 titles += i18n( "Ms." );
816 suffixes += i18n( "Jr." ); 816 titles += i18n( "Prof." );
817 suffixes += i18n( "Sr." ); 817
818 818 suffixes += i18n( "I" );
819 QStringList prefixes; 819 suffixes += i18n( "II" );
820 prefixes += "van"; 820 suffixes += i18n( "III" );
821 prefixes += "von"; 821 suffixes += i18n( "Jr." );
822 prefixes += "de"; 822 suffixes += i18n( "Sr." );
823 823
824//US KConfig config( "kabcrc" ); 824 prefixes += "van";
825 KConfig config( locateLocal( "config", "kabcrc") ); 825 prefixes += "von";
826 config.setGroup( "General" ); 826 prefixes += "de";
827 titles += config.readListEntry( "Prefixes" ); 827
828 titles.remove( "" ); 828 KConfig config( locateLocal( "config", "kabcrc") );
829 prefixes += config.readListEntry( "Inclusions" ); 829 config.setGroup( "General" );
830 prefixes.remove( "" ); 830 titles += config.readListEntry( "Prefixes" );
831 suffixes += config.readListEntry( "Suffixes" ); 831 titles.remove( "" );
832 suffixes.remove( "" ); 832 prefixes += config.readListEntry( "Inclusions" );
833 prefixes.remove( "" );
834 suffixes += config.readListEntry( "Suffixes" );
835 suffixes.remove( "" );
836 }
833 837
834 // clear all name parts 838 // clear all name parts
835 setPrefix( "" ); 839 setPrefix( "" );
836 setGivenName( "" ); 840 setGivenName( "" );
837 setAdditionalName( "" ); 841 setAdditionalName( "" );
838 setFamilyName( "" ); 842 setFamilyName( "" );
839 setSuffix( "" ); 843 setSuffix( "" );
840 844
841 if ( str.isEmpty() ) 845 if ( str.isEmpty() )
842 return; 846 return;
843 847
844 int i = str.find(','); 848 int i = str.find(',');
845 if( i < 0 ) { 849 if( i < 0 ) {
846 QStringList parts = QStringList::split( " ", str ); 850 QStringList parts = QStringList::split( " ", str );
847 int leftOffset = 0; 851 int leftOffset = 0;
848 int rightOffset = parts.count() - 1; 852 int rightOffset = parts.count() - 1;
849 853
850 QString suffix; 854 QString suffix;
851 while ( rightOffset >= 0 ) { 855 while ( rightOffset >= 0 ) {
852 if ( suffixes.contains( parts[ rightOffset ] ) ) { 856 if ( suffixes.contains( parts[ rightOffset ] ) ) {
853 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 857 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
854 rightOffset--; 858 rightOffset--;
855 } else 859 } else
856 break; 860 break;
857 } 861 }
858 setSuffix( suffix ); 862 setSuffix( suffix );
859 863
860 if ( rightOffset < 0 ) 864 if ( rightOffset < 0 )
861 return; 865 return;
862 866
863 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 867 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
864 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 868 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
865 rightOffset--; 869 rightOffset--;
866 } else 870 } else
867 setFamilyName( parts[ rightOffset ] ); 871 setFamilyName( parts[ rightOffset ] );
868 872
869 QString prefix; 873 QString prefix;
870 while ( leftOffset < rightOffset ) { 874 while ( leftOffset < rightOffset ) {
871 if ( titles.contains( parts[ leftOffset ] ) ) { 875 if ( titles.contains( parts[ leftOffset ] ) ) {
872 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 876 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
873 leftOffset++; 877 leftOffset++;
874 } else 878 } else
875 break; 879 break;
876 } 880 }
877 setPrefix( prefix ); 881 setPrefix( prefix );
878 882
879 if ( leftOffset < rightOffset ) { 883 if ( leftOffset < rightOffset ) {
880 setGivenName( parts[ leftOffset ] ); 884 setGivenName( parts[ leftOffset ] );
881 leftOffset++; 885 leftOffset++;
882 } 886 }
883 887
884 QString additionalName; 888 QString additionalName;
885 while ( leftOffset < rightOffset ) { 889 while ( leftOffset < rightOffset ) {
886 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 890 additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] );
887 leftOffset++; 891 leftOffset++;
888 } 892 }
889 setAdditionalName( additionalName ); 893 setAdditionalName( additionalName );
890 } else { 894 } else {
891 QString part1 = str.left( i ); 895 QString part1 = str.left( i );
892 QString part2 = str.mid( i + 1 ); 896 QString part2 = str.mid( i + 1 );
893 897
894 QStringList parts = QStringList::split( " ", part1 ); 898 QStringList parts = QStringList::split( " ", part1 );
895 int leftOffset = 0; 899 int leftOffset = 0;
896 int rightOffset = parts.count() - 1; 900 int rightOffset = parts.count() - 1;
897 901
898 QString suffix; 902 QString suffix;
899 while ( rightOffset >= 0 ) { 903 while ( rightOffset >= 0 ) {
900 if ( suffixes.contains( parts[ rightOffset ] ) ) { 904 if ( suffixes.contains( parts[ rightOffset ] ) ) {
901 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); 905 suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " "));
902 rightOffset--; 906 rightOffset--;
903 } else 907 } else
904 break; 908 break;
905 } 909 }
906 setSuffix( suffix ); 910 setSuffix( suffix );
907 911
908 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { 912 if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) {
909 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); 913 setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] );
910 rightOffset--; 914 rightOffset--;
911 } else 915 } else
912 setFamilyName( parts[ rightOffset ] ); 916 setFamilyName( parts[ rightOffset ] );
913 917
914 QString prefix; 918 QString prefix;
915 while ( leftOffset < rightOffset ) { 919 while ( leftOffset < rightOffset ) {
916 if ( titles.contains( parts[ leftOffset ] ) ) { 920 if ( titles.contains( parts[ leftOffset ] ) ) {
917 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); 921 prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] );
918 leftOffset++; 922 leftOffset++;
919 } else 923 } else
920 break; 924 break;
921 } 925 }
922 926
923 parts = QStringList::split( " ", part2 ); 927 parts = QStringList::split( " ", part2 );
924 928
925 leftOffset = 0; 929 leftOffset = 0;
926 rightOffset = parts.count(); 930 rightOffset = parts.count();
927 931
928 while ( leftOffset < rightOffset ) { 932 while ( leftOffset < rightOffset ) {
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 3cfc1f2..826c69b 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -1,186 +1,185 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qhbox.h> 25#include <qhbox.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlistbox.h> 28#include <qlistbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qtabwidget.h> 30#include <qtabwidget.h>
31 31
32#ifndef KAB_EMBEDDED 32#ifndef KAB_EMBEDDED
33#include <qtextedit.h> 33#include <qtextedit.h>
34 34
35#include <kaccelmanager.h> 35#include <kaccelmanager.h>
36#include "keywidget.h" 36#include "keywidget.h"
37#include "soundwidget.h" 37#include "soundwidget.h"
38 38
39#else //KAB_EMBEDDED 39#else //KAB_EMBEDDED
40#include <qmultilineedit.h> 40#include <qmultilineedit.h>
41#endif //KAB_EMBEDDED 41#endif //KAB_EMBEDDED
42 42
43 43
44#include "keywidget.h" 44#include "keywidget.h"
45#include "geowidget.h" 45#include "geowidget.h"
46#include "imagewidget.h" 46#include "imagewidget.h"
47#include "nameeditdialog.h" 47#include "nameeditdialog.h"
48#include "phoneeditwidget.h" 48#include "phoneeditwidget.h"
49#include "secrecywidget.h" 49#include "secrecywidget.h"
50 50
51 51
52#include <qtoolbutton.h> 52#include <qtoolbutton.h>
53#include <qtooltip.h> 53#include <qtooltip.h>
54 54
55#include <kapplication.h> 55#include <kapplication.h>
56#include <kconfig.h> 56#include <kconfig.h>
57#include <kcombobox.h> 57#include <kcombobox.h>
58#include <kdebug.h> 58#include <kdebug.h>
59#include <kdialogbase.h> 59#include <kdialogbase.h>
60#include <kglobal.h> 60#include <kglobal.h>
61#include <kiconloader.h> 61#include <kiconloader.h>
62#include <klineedit.h> 62#include <klineedit.h>
63#include <klocale.h> 63#include <klocale.h>
64#include <kmessagebox.h> 64#include <kmessagebox.h>
65#include <kseparator.h> 65#include <kseparator.h>
66#include <ksqueezedtextlabel.h> 66#include <ksqueezedtextlabel.h>
67 67
68#include <libkdepim/categoryeditdialog.h> 68#include <libkdepim/categoryeditdialog.h>
69#include <libkdepim/categoryselectdialog.h> 69#include <libkdepim/categoryselectdialog.h>
70 70
71#include <libkdepim/kdateedit.h> 71#include <libkdepim/kdateedit.h>
72 72
73#include "addresseditwidget.h" 73#include "addresseditwidget.h"
74#include "emaileditwidget.h" 74#include "emaileditwidget.h"
75#include "kabcore.h" 75#include "kabcore.h"
76#include "kabprefs.h" 76#include "kabprefs.h"
77 77
78#include "addresseeeditorwidget.h" 78#include "addresseeeditorwidget.h"
79 79
80 80
81 81
82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension, 82AddresseeEditorWidget::AddresseeEditorWidget( KABCore *core, bool isExtension,
83 QWidget *parent, const char *name ) 83 QWidget *parent, const char *name )
84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ), 84 : ExtensionWidget( core, parent, name ), mIsExtension( isExtension ),
85 mBlockSignals( false ) 85 mBlockSignals( false )
86{ 86{
87 87
88 mAConfig = AddresseeConfig::instance(); 88 mAConfig = AddresseeConfig::instance();
89 89
90 kdDebug(5720) << "AddresseeEditorWidget()" << endl;
91 mFormattedNameType = NameEditDialog::CustomName; 90 mFormattedNameType = NameEditDialog::CustomName;
92 initGUI(); 91 initGUI();
93 mCategoryDialog = 0; 92 mCategoryDialog = 0;
94 mCategoryEditDialog = 0; 93 mCategoryEditDialog = 0;
95 94
96 // Load the empty addressee as defaults 95 // Load the empty addressee as defaults
97 load(); 96 load();
98 97
99 mDirty = false; 98 mDirty = false;
100} 99}
101 100
102AddresseeEditorWidget::~AddresseeEditorWidget() 101AddresseeEditorWidget::~AddresseeEditorWidget()
103{ 102{
104 kdDebug(5720) << "~AddresseeEditorWidget()" << endl; 103 kdDebug(5720) << "~AddresseeEditorWidget()" << endl;
105} 104}
106 105
107void AddresseeEditorWidget::contactsSelectionChanged() 106void AddresseeEditorWidget::contactsSelectionChanged()
108{ 107{
109 KABC::Addressee::List list = selectedContacts(); 108 KABC::Addressee::List list = selectedContacts();
110 109
111 mAddressee = list[ 0 ]; 110 mAddressee = list[ 0 ];
112 load(); 111 load();
113} 112}
114 113
115void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr ) 114void AddresseeEditorWidget::setAddressee( const KABC::Addressee &addr )
116{ 115{
117 mAddressee = addr; 116 mAddressee = addr;
118 load(); 117 load();
119} 118}
120 119
121const KABC::Addressee &AddresseeEditorWidget::addressee() 120const KABC::Addressee &AddresseeEditorWidget::addressee()
122{ 121{
123 return mAddressee; 122 return mAddressee;
124} 123}
125 124
126void AddresseeEditorWidget::textChanged( const QString& ) 125void AddresseeEditorWidget::textChanged( const QString& )
127{ 126{
128 emitModified(); 127 emitModified();
129} 128}
130 129
131void AddresseeEditorWidget::initGUI() 130void AddresseeEditorWidget::initGUI()
132{ 131{
133 QVBoxLayout *layout = new QVBoxLayout( this ); 132 QVBoxLayout *layout = new QVBoxLayout( this );
134 133
135 mTabWidget = new QTabWidget( this ); 134 mTabWidget = new QTabWidget( this );
136 layout->addWidget( mTabWidget ); 135 layout->addWidget( mTabWidget );
137 136
138 setupTab1(); 137 setupTab1();
139 setupTab1_1(); 138 setupTab1_1();
140 setupTab2(); 139 setupTab2();
141 setupTab2_1(); 140 setupTab2_1();
142 setupTab3(); 141 setupTab3();
143 setupTab3_1(); 142 setupTab3_1();
144 143
145 mNameEdit->setFocus(); 144 mNameEdit->setFocus();
146 145
147 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ), 146 connect( mTabWidget, SIGNAL( currentChanged(QWidget*) ),
148 SLOT( pageChanged(QWidget*) ) ); 147 SLOT( pageChanged(QWidget*) ) );
149} 148}
150 149
151void AddresseeEditorWidget::setupTab1() 150void AddresseeEditorWidget::setupTab1()
152{ 151{
153 // This is the General tab 152 // This is the General tab
154 QWidget *tab1 = new QWidget( mTabWidget ); 153 QWidget *tab1 = new QWidget( mTabWidget );
155 154
156//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); 155//US QGridLayout *layout = new QGridLayout( tab1, 11, 7 );
157 QGridLayout *layout = new QGridLayout( tab1, 7, 1 ); 156 QGridLayout *layout = new QGridLayout( tab1, 7, 1 );
158 layout->setMargin( KDialogBase::marginHintSmall() ); 157 layout->setMargin( KDialogBase::marginHintSmall() );
159 layout->setSpacing( KDialogBase::spacingHintSmall() ); 158 layout->setSpacing( KDialogBase::spacingHintSmall() );
160 159
161 QLabel *label; 160 QLabel *label;
162 KSeparator* bar; 161 KSeparator* bar;
163 QPushButton *button; 162 QPushButton *button;
164 163
165 ////////////////////////////////// 164 //////////////////////////////////
166 // Upper left group (person info) 165 // Upper left group (person info)
167 166
168 // Person icon 167 // Person icon
169 /* LR 168 /* LR
170 label = new QLabel( tab1 ); 169 label = new QLabel( tab1 );
171//US ambiguous call. Add one more parameter 170//US ambiguous call. Add one more parameter
172//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 171//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
173 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 172 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
174 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 173 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
175 */ 174 */
176 // First name 175 // First name
177 button = new QPushButton( i18n( "Name..." ), tab1 ); 176 button = new QPushButton( i18n( "Name..." ), tab1 );
178//US QToolTip::add( button, i18n( "Edit the contact's name" ) ); 177//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
179 mNameEdit = new KLineEdit( tab1, "mNameEdit" ); 178 mNameEdit = new KLineEdit( tab1, "mNameEdit" );
180 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), 179 connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
181 SLOT( nameTextChanged( const QString& ) ) ); 180 SLOT( nameTextChanged( const QString& ) ) );
182 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); 181 connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
183 182
184 mNameLabel = new KSqueezedTextLabel( tab1 ); 183 mNameLabel = new KSqueezedTextLabel( tab1 );
185 mNameLabel->hide(); 184 mNameLabel->hide();
186 185
@@ -539,192 +538,193 @@ void AddresseeEditorWidget::setupTab2()
539 538
540 QLabel *label; 539 QLabel *label;
541 KSeparator* bar; 540 KSeparator* bar;
542 541
543 /////////////////////// 542 ///////////////////////
544 // Office info 543 // Office info
545 544
546 // Department 545 // Department
547 label = new QLabel( tab2 ); 546 label = new QLabel( tab2 );
548//US loadIcon call is ambiguous. Add one more parameter 547//US loadIcon call is ambiguous. Add one more parameter
549//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 548//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
550 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 549 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
551 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 550 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
552 551
553 label = new QLabel( i18n( "Department:" ), tab2 ); 552 label = new QLabel( i18n( "Department:" ), tab2 );
554 layout->addWidget( label, 0, 1 ); 553 layout->addWidget( label, 0, 1 );
555 mDepartmentEdit = new KLineEdit( tab2 ); 554 mDepartmentEdit = new KLineEdit( tab2 );
556 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 555 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
557 SLOT( textChanged( const QString& ) ) ); 556 SLOT( textChanged( const QString& ) ) );
558 label->setBuddy( mDepartmentEdit ); 557 label->setBuddy( mDepartmentEdit );
559 layout->addWidget( mDepartmentEdit, 0, 2 ); 558 layout->addWidget( mDepartmentEdit, 0, 2 );
560 559
561 label = new QLabel( i18n( "Office:" ), tab2 ); 560 label = new QLabel( i18n( "Office:" ), tab2 );
562 layout->addWidget( label, 1, 1 ); 561 layout->addWidget( label, 1, 1 );
563 mOfficeEdit = new KLineEdit( tab2 ); 562 mOfficeEdit = new KLineEdit( tab2 );
564 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ), 563 connect( mOfficeEdit, SIGNAL( textChanged( const QString& ) ),
565 SLOT( textChanged( const QString& ) ) ); 564 SLOT( textChanged( const QString& ) ) );
566 label->setBuddy( mOfficeEdit ); 565 label->setBuddy( mOfficeEdit );
567 layout->addWidget( mOfficeEdit, 1, 2 ); 566 layout->addWidget( mOfficeEdit, 1, 2 );
568 567
569 label = new QLabel( i18n( "Profession:" ), tab2 ); 568 label = new QLabel( i18n( "Profession:" ), tab2 );
570 layout->addWidget( label, 2, 1 ); 569 layout->addWidget( label, 2, 1 );
571 mProfessionEdit = new KLineEdit( tab2 ); 570 mProfessionEdit = new KLineEdit( tab2 );
572 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ), 571 connect( mProfessionEdit, SIGNAL( textChanged( const QString& ) ),
573 SLOT( textChanged( const QString& ) ) ); 572 SLOT( textChanged( const QString& ) ) );
574 label->setBuddy( mProfessionEdit ); 573 label->setBuddy( mProfessionEdit );
575 layout->addWidget( mProfessionEdit, 2, 2 ); 574 layout->addWidget( mProfessionEdit, 2, 2 );
576 575
577 label = new QLabel( i18n( "Manager\'s name:" ), tab2 ); 576 label = new QLabel( i18n( "Manager\'s name:" ), tab2 );
578//US layout->addWidget( label, 0, 3 ); 577//US layout->addWidget( label, 0, 3 );
579 layout->addWidget( label, 3, 1 ); 578 layout->addWidget( label, 3, 1 );
580 mManagerEdit = new KLineEdit( tab2 ); 579 mManagerEdit = new KLineEdit( tab2 );
581 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ), 580 connect( mManagerEdit, SIGNAL( textChanged( const QString& ) ),
582 SLOT( textChanged( const QString& ) ) ); 581 SLOT( textChanged( const QString& ) ) );
583 label->setBuddy( mManagerEdit ); 582 label->setBuddy( mManagerEdit );
584//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 ); 583//US layout->addMultiCellWidget( mManagerEdit, 0, 0, 4, 5 );
585 layout->addWidget( mManagerEdit, 3, 2 ); 584 layout->addWidget( mManagerEdit, 3, 2 );
586 585
587 label = new QLabel( i18n( "Assistant's name:" ), tab2 ); 586 label = new QLabel( i18n( "Assistant's name:" ), tab2 );
588//US layout->addWidget( label, 1, 3 ); 587//US layout->addWidget( label, 1, 3 );
589 layout->addWidget( label, 4, 1 ); 588 layout->addWidget( label, 4, 1 );
590 mAssistantEdit = new KLineEdit( tab2 ); 589 mAssistantEdit = new KLineEdit( tab2 );
591 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ), 590 connect( mAssistantEdit, SIGNAL( textChanged( const QString& ) ),
592 SLOT( textChanged( const QString& ) ) ); 591 SLOT( textChanged( const QString& ) ) );
593 label->setBuddy( mAssistantEdit ); 592 label->setBuddy( mAssistantEdit );
594//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 ); 593//US layout->addMultiCellWidget( mAssistantEdit, 1, 1, 4, 5 );
595 layout->addWidget( mAssistantEdit, 4, 2 ); 594 layout->addWidget( mAssistantEdit, 4, 2 );
596 595
597 bar = new KSeparator( KSeparator::HLine, tab2 ); 596 bar = new KSeparator( KSeparator::HLine, tab2 );
598//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 ); 597//US layout->addMultiCellWidget( bar, 3, 3, 0, 5 );
599 layout->addMultiCellWidget( bar, 5, 5, 0, 2 ); 598 layout->addMultiCellWidget( bar, 5, 5, 0, 2 );
600 599
601 ///////////////////////////////////////////////// 600 /////////////////////////////////////////////////
602 // Personal info 601 // Personal info
603 602
604 label = new QLabel( tab2 ); 603 label = new QLabel( tab2 );
605//US loadIcon call is ambiguous. Add one more parameter 604//US loadIcon call is ambiguous. Add one more parameter
606//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 605//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
607 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) ); 606 label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
608//US layout->addMultiCellWidget( label, 4, 5, 0, 0 ); 607//US layout->addMultiCellWidget( label, 4, 5, 0, 0 );
609 layout->addMultiCellWidget( label, 6, 7, 0, 0 ); 608 layout->addMultiCellWidget( label, 6, 7, 0, 0 );
610 609
611 label = new QLabel( i18n( "Nick name:" ), tab2 ); 610 label = new QLabel( i18n( "Nick name:" ), tab2 );
612//US layout->addWidget( label, 4, 1 ); 611//US layout->addWidget( label, 4, 1 );
613 layout->addWidget( label, 6, 1 ); 612 layout->addWidget( label, 6, 1 );
614 mNicknameEdit = new KLineEdit( tab2 ); 613 mNicknameEdit = new KLineEdit( tab2 );
615 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ), 614 connect( mNicknameEdit, SIGNAL( textChanged( const QString& ) ),
616 SLOT( textChanged( const QString& ) ) ); 615 SLOT( textChanged( const QString& ) ) );
617 label->setBuddy( mNicknameEdit ); 616 label->setBuddy( mNicknameEdit );
618//US layout->addWidget( mNicknameEdit, 4, 2 ); 617//US layout->addWidget( mNicknameEdit, 4, 2 );
619 layout->addWidget( mNicknameEdit, 6, 2 ); 618 layout->addWidget( mNicknameEdit, 6, 2 );
620 619
621 label = new QLabel( i18n( "Spouse's name:" ), tab2 ); 620 label = new QLabel( i18n( "Spouse's name:" ), tab2 );
622//US layout->addWidget( label, 5, 1 ); 621//US layout->addWidget( label, 5, 1 );
623 layout->addWidget( label, 7, 1 ); 622 layout->addWidget( label, 7, 1 );
624 mSpouseEdit = new KLineEdit( tab2 ); 623 mSpouseEdit = new KLineEdit( tab2 );
625 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ), 624 connect( mSpouseEdit, SIGNAL( textChanged( const QString& ) ),
626 SLOT( textChanged( const QString& ) ) ); 625 SLOT( textChanged( const QString& ) ) );
627 label->setBuddy( mSpouseEdit ); 626 label->setBuddy( mSpouseEdit );
628//US layout->addWidget( mSpouseEdit, 5, 2 ); 627//US layout->addWidget( mSpouseEdit, 5, 2 );
629 layout->addWidget( mSpouseEdit, 7, 2 ); 628 layout->addWidget( mSpouseEdit, 7, 2 );
630 629
631 label = new QLabel( i18n( "Birthday:" ), tab2 ); 630 label = new QLabel( i18n( "Birthday:" ), tab2 );
632//US layout->addWidget( label, 4, 3 ); 631//US layout->addWidget( label, 4, 3 );
633 layout->addWidget( label, 8, 1 ); 632 layout->addWidget( label, 8, 1 );
634 mBirthdayPicker = new KDateEdit( tab2 ); 633 mBirthdayPicker = new KDateEdit( tab2 );
634 mBirthdayPicker->toggleDateFormat();
635 mBirthdayPicker->setHandleInvalid( true ); 635 mBirthdayPicker->setHandleInvalid( true );
636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ), 636 connect( mBirthdayPicker, SIGNAL( dateChanged( QDate ) ),
637 SLOT( dateChanged( QDate ) ) ); 637 SLOT( dateChanged( QDate ) ) );
638 638
639 639
640#ifndef KAB_EMBEDDED 640#ifndef KAB_EMBEDDED
641 //US invalid dates are handdled by the KDateEdit widget itself 641 //US invalid dates are handdled by the KDateEdit widget itself
642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ), 642 connect( mBirthdayPicker, SIGNAL( invalidDateEntered() ),
643 SLOT( invalidDate() ) ); 643 SLOT( invalidDate() ) );
644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ), 644 connect( mBirthdayPicker, SIGNAL( textChanged( const QString& ) ),
645 SLOT( emitModified() ) ); 645 SLOT( emitModified() ) );
646#endif //KAB_EMBEDDED 646#endif //KAB_EMBEDDED
647 647
648 label->setBuddy( mBirthdayPicker ); 648 label->setBuddy( mBirthdayPicker );
649//US layout->addWidget( mBirthdayPicker, 4, 4 ); 649//US layout->addWidget( mBirthdayPicker, 4, 4 );
650 layout->addWidget( mBirthdayPicker, 8, 2 ); 650 layout->addWidget( mBirthdayPicker, 8, 2 );
651 651
652 label = new QLabel( i18n( "Anniversary:" ), tab2 ); 652 label = new QLabel( i18n( "Anniversary:" ), tab2 );
653//US layout->addWidget( label, 5, 3 ); 653//US layout->addWidget( label, 5, 3 );
654 layout->addWidget( label, 9, 1 ); 654 layout->addWidget( label, 9, 1 );
655 mAnniversaryPicker = new KDateEdit( tab2 ); 655 mAnniversaryPicker = new KDateEdit( tab2 );
656 mAnniversaryPicker->setHandleInvalid( true ); 656 mAnniversaryPicker->setHandleInvalid( true );
657 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ), 657 connect( mAnniversaryPicker, SIGNAL( dateChanged( QDate ) ),
658 SLOT( dateChanged( QDate ) ) ); 658 SLOT( dateChanged( QDate ) ) );
659#ifndef KAB_EMBEDDED 659#ifndef KAB_EMBEDDED
660 //US invalid dates are handled by the KDateEdit widget itself 660 //US invalid dates are handled by the KDateEdit widget itself
661 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ), 661 connect( mAnniversaryPicker, SIGNAL( invalidDateEntered() ),
662 SLOT( invalidDate() ) ); 662 SLOT( invalidDate() ) );
663 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ), 663 connect( mAnniversaryPicker, SIGNAL( textChanged( const QString& ) ),
664 SLOT( emitModified() ) ); 664 SLOT( emitModified() ) );
665#endif //KAB_EMBEDDED 665#endif //KAB_EMBEDDED
666 666
667 label->setBuddy( mAnniversaryPicker ); 667 label->setBuddy( mAnniversaryPicker );
668//US layout->addWidget( mAnniversaryPicker, 5, 4 ); 668//US layout->addWidget( mAnniversaryPicker, 5, 4 );
669 layout->addWidget( mAnniversaryPicker, 9, 2 ); 669 layout->addWidget( mAnniversaryPicker, 9, 2 );
670 670
671/*US 671/*US
672 bar = new KSeparator( KSeparator::HLine, tab2 ); 672 bar = new KSeparator( KSeparator::HLine, tab2 );
673 layout->addMultiCellWidget( bar, 6, 6, 0, 5 ); 673 layout->addMultiCellWidget( bar, 6, 6, 0, 5 );
674 674
675 ////////////////////////////////////// 675 //////////////////////////////////////
676 // Notes 676 // Notes
677 label = new QLabel( i18n( "Note:" ), tab2 ); 677 label = new QLabel( i18n( "Note:" ), tab2 );
678 label->setAlignment( Qt::AlignTop | Qt::AlignLeft ); 678 label->setAlignment( Qt::AlignTop | Qt::AlignLeft );
679 layout->addWidget( label, 7, 0 ); 679 layout->addWidget( label, 7, 0 );
680#ifndef KAB_EMBEDDED 680#ifndef KAB_EMBEDDED
681 mNoteEdit = new QTextEdit( tab2 ); 681 mNoteEdit = new QTextEdit( tab2 );
682 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 682 mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
683 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 683 mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
684#else //KAB_EMBEDDED 684#else //KAB_EMBEDDED
685 mNoteEdit = new QMultiLineEdit( tab2 ); 685 mNoteEdit = new QMultiLineEdit( tab2 );
686//US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth ); 686//US mNoteEdit->setWordWrap( QTextEdit::WidgetWidth );
687//US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() ); 687//US mNoteEdit->setMinimumSize( mNoteEdit->sizeHint() );
688qDebug("AddresseeEditorWidget::setupTab2 has to be changed"); 688qDebug("AddresseeEditorWidget::setupTab2 has to be changed");
689#endif //KAB_EMBEDDED 689#endif //KAB_EMBEDDED
690 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) ); 690 connect( mNoteEdit, SIGNAL( textChanged() ), SLOT( emitModified() ) );
691 label->setBuddy( mNoteEdit ); 691 label->setBuddy( mNoteEdit );
692 layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 ); 692 layout->addMultiCellWidget( mNoteEdit, 7, 7, 1, 5 );
693*/ 693*/
694 // Build the layout and add to the tab widget 694 // Build the layout and add to the tab widget
695 layout->activate(); // required 695 layout->activate(); // required
696 696
697 mTabWidget->addTab( tab2, i18n( "&Details" ) ); 697 mTabWidget->addTab( tab2, i18n( "&Details" ) );
698} 698}
699 699
700void AddresseeEditorWidget::setupTab2_1() 700void AddresseeEditorWidget::setupTab2_1()
701{ 701{
702 // This is the Details tab 702 // This is the Details tab
703 QWidget *tab2_2 = new QWidget( mTabWidget ); 703 QWidget *tab2_2 = new QWidget( mTabWidget );
704 704
705 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 ); 705 QGridLayout *layout = new QGridLayout( tab2_2, 1, 2 );
706 layout->setMargin( KDialogBase::marginHintSmall() ); 706 layout->setMargin( KDialogBase::marginHintSmall() );
707 layout->setSpacing( KDialogBase::spacingHintSmall() ); 707 layout->setSpacing( KDialogBase::spacingHintSmall() );
708 708
709 QLabel *label; 709 QLabel *label;
710 KSeparator* bar; 710 KSeparator* bar;
711 711
712/*US 712/*US
713 /////////////////////// 713 ///////////////////////
714 // Office info 714 // Office info
715 715
716 // Department 716 // Department
717 label = new QLabel( tab2 ); 717 label = new QLabel( tab2 );
718//US loadIcon call is ambiguous. Add one more parameter 718//US loadIcon call is ambiguous. Add one more parameter
719//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) ); 719//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop ) );
720 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) ); 720 label->setPixmap( KGlobal::iconLoader()->loadIcon( "folder", KIcon::Desktop, 0 ) );
721 layout->addMultiCellWidget( label, 0, 1, 0, 0 ); 721 layout->addMultiCellWidget( label, 0, 1, 0, 0 );
722 722
723 label = new QLabel( i18n( "Department:" ), tab2 ); 723 label = new QLabel( i18n( "Department:" ), tab2 );
724 layout->addWidget( label, 0, 1 ); 724 layout->addWidget( label, 0, 1 );
725 mDepartmentEdit = new KLineEdit( tab2 ); 725 mDepartmentEdit = new KLineEdit( tab2 );
726 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ), 726 connect( mDepartmentEdit, SIGNAL( textChanged( const QString& ) ),
727 SLOT( textChanged( const QString& ) ) ); 727 SLOT( textChanged( const QString& ) ) );
728 label->setBuddy( mDepartmentEdit ); 728 label->setBuddy( mDepartmentEdit );
729 layout->addWidget( mDepartmentEdit, 0, 2 ); 729 layout->addWidget( mDepartmentEdit, 0, 2 );
730 730
@@ -854,415 +854,441 @@ void AddresseeEditorWidget::setupTab3()
854 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 854 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
855 layout->setMargin( KDialogBase::marginHintSmall() ); 855 layout->setMargin( KDialogBase::marginHintSmall() );
856 layout->setSpacing( KDialogBase::spacingHintSmall() ); 856 layout->setSpacing( KDialogBase::spacingHintSmall() );
857//US layout->setColStretch( 2, 1 ); 857//US layout->setColStretch( 2, 1 );
858 858
859 ////////////////////////////////////// 859 //////////////////////////////////////
860 // Geo 860 // Geo
861 mGeoWidget = new GeoWidget( tab3 ); 861 mGeoWidget = new GeoWidget( tab3 );
862 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 862 // mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
863 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 863 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
864 layout->addWidget( mGeoWidget, 0, 0 ); 864 layout->addWidget( mGeoWidget, 0, 0 );
865/*US 865/*US
866 ////////////////////////////////////// 866 //////////////////////////////////////
867 // Sound 867 // Sound
868#ifndef KAB_EMBEDDED 868#ifndef KAB_EMBEDDED
869 mSoundWidget = new SoundWidget( tab3 ); 869 mSoundWidget = new SoundWidget( tab3 );
870 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 870 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
871 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 871 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
872 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 872 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
873#else //KAB_EMBEDDED 873#else //KAB_EMBEDDED
874qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 874qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
875#endif //KAB_EMBEDDED 875#endif //KAB_EMBEDDED
876 876
877 ////////////////////////////////////// 877 //////////////////////////////////////
878 // Images 878 // Images
879 mImageWidget = new ImageWidget( tab3 ); 879 mImageWidget = new ImageWidget( tab3 );
880 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 880 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
881 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 881 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
882 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop ); 882 layout->addWidget( mImageWidget, 1, 0, Qt::AlignTop );
883*/ 883*/
884//US 884//US
885/* 885/*
886 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 ); 886 KSeparator* bar = new KSeparator( KSeparator::HLine, tab3 );
887 layout->addMultiCellWidget( bar, 1, 1, 0, 0 ); 887 layout->addMultiCellWidget( bar, 1, 1, 0, 0 );
888*/ 888*/
889 ////////////////////////////////////// 889 //////////////////////////////////////
890 // Keys 890 // Keys
891 mKeyWidget = new KeyWidget( tab3 ); 891 mKeyWidget = new KeyWidget( tab3 );
892 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 892 //mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
893 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 893 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
894//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 894//US layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
895 layout->addWidget( mKeyWidget, 1, 0 ); 895 layout->addWidget( mKeyWidget, 1, 0 );
896 896
897 mTabWidget->addTab( tab3, i18n( "&Misc" ) ); 897 mTabWidget->addTab( tab3, i18n( "&Misc" ) );
898} 898}
899 899
900void AddresseeEditorWidget::setupTab3_1() 900void AddresseeEditorWidget::setupTab3_1()
901{ 901{
902 // This is the Misc tab 902 // This is the Misc tab
903 QWidget *tab3 = new QWidget( mTabWidget ); 903 QWidget *tab3 = new QWidget( mTabWidget );
904 904
905//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 ); 905//US QGridLayout *layout = new QGridLayout( tab3, 2, 3 );
906 QGridLayout *layout = new QGridLayout( tab3, 1, 1 ); 906 QGridLayout *layout = new QGridLayout( tab3, 1, 1 );
907 layout->setMargin( KDialogBase::marginHint() ); 907 layout->setMargin( KDialogBase::marginHint() );
908 layout->setSpacing( KDialogBase::spacingHint() ); 908 layout->setSpacing( KDialogBase::spacingHint() );
909//US layout->setColStretch( 2, 1 ); 909//US layout->setColStretch( 2, 1 );
910 910
911/*US 911/*US
912 ////////////////////////////////////// 912 //////////////////////////////////////
913 // Geo 913 // Geo
914 mGeoWidget = new GeoWidget( tab3 ); 914 mGeoWidget = new GeoWidget( tab3 );
915 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() ); 915 mGeoWidget->setMinimumSize( mGeoWidget->sizeHint() );
916 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 916 connect( mGeoWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
917 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop ); 917 layout->addWidget( mGeoWidget, 0, 0, Qt::AlignTop );
918*/ 918*/
919 ////////////////////////////////////// 919 //////////////////////////////////////
920 // Sound 920 // Sound
921#ifndef KAB_EMBEDDED 921#ifndef KAB_EMBEDDED
922 mSoundWidget = new SoundWidget( tab3 ); 922 mSoundWidget = new SoundWidget( tab3 );
923 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() ); 923 mSoundWidget->setMinimumSize( mSoundWidget->sizeHint() );
924 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 924 connect( mSoundWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
925 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop ); 925 layout->addWidget( mSoundWidget, 0, 1, Qt::AlignTop );
926#else //KAB_EMBEDDED 926#else //KAB_EMBEDDED
927//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed"); 927//US qDebug("AddresseeEditorWidget::setupTab2 sound part is not supported = has to be changed");
928#endif //KAB_EMBEDDED 928#endif //KAB_EMBEDDED
929 929
930 ////////////////////////////////////// 930 //////////////////////////////////////
931 // Images 931 // Images
932 mImageWidget = new ImageWidget( tab3 ); 932 mImageWidget = new ImageWidget( tab3 );
933 mImageWidget->setMinimumSize( mImageWidget->sizeHint() ); 933 mImageWidget->setMinimumSize( mImageWidget->sizeHint() );
934 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 934 connect( mImageWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
935 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop ); 935 layout->addWidget( mImageWidget, 0, 0, Qt::AlignTop );
936/*US 936/*US
937 ////////////////////////////////////// 937 //////////////////////////////////////
938 // Keys 938 // Keys
939 mKeyWidget = new KeyWidget( tab3 ); 939 mKeyWidget = new KeyWidget( tab3 );
940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() ); 940 mKeyWidget->setMinimumSize( mKeyWidget->sizeHint() );
941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 941 connect( mKeyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop ); 942 layout->addWidget( mKeyWidget, 1, 1, Qt::AlignTop );
943*/ 943*/
944 mTabWidget->addTab( tab3, i18n( "&Images" ) ); 944 mTabWidget->addTab( tab3, i18n( "&Images" ) );
945} 945}
946 946
947 947
948void AddresseeEditorWidget::load() 948void AddresseeEditorWidget::load()
949{ 949{
950 kdDebug(5720) << "AddresseeEditorWidget::load()" << endl;
951 950
952 // Block signals in case anything tries to emit modified 951 // Block signals in case anything tries to emit modified
953 // CS: This doesn't seem to work. 952 // CS: This doesn't seem to work.
954 bool block = signalsBlocked(); 953 bool block = signalsBlocked();
955 blockSignals( true ); 954 blockSignals( true );
956 mBlockSignals = true; // used for internal signal blocking 955 mBlockSignals = true; // used for internal signal blocking
957 956
958 mNameEdit->setText( mAddressee.assembledName() ); 957 mNameEdit->setText( mAddressee.assembledName() );
959 958
960 if ( mAddressee.formattedName().isEmpty() ) { 959 if ( mAddressee.formattedName().isEmpty() ) {
961//US KConfig config( "kaddressbookrc" ); 960//US KConfig config( "kaddressbookrc" );
962 KConfig config( locateLocal("config", "kaddressbookrc") ); 961 KConfig config( locateLocal("config", "kaddressbookrc") );
963 config.setGroup( "General" ); 962 config.setGroup( "General" );
964 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 ); 963 mFormattedNameType = config.readNumEntry( "FormattedNameType", 1 );
965 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 964 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
966 } else { 965 } else {
967 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) ) 966 if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::SimpleName ) )
968 mFormattedNameType = NameEditDialog::SimpleName; 967 mFormattedNameType = NameEditDialog::SimpleName;
969 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) ) 968 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::FullName ) )
970 mFormattedNameType = NameEditDialog::FullName; 969 mFormattedNameType = NameEditDialog::FullName;
971 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) ) 970 else if ( mAddressee.formattedName() == NameEditDialog::formattedName( mAddressee, NameEditDialog::ReverseName ) )
972 mFormattedNameType = NameEditDialog::ReverseName; 971 mFormattedNameType = NameEditDialog::ReverseName;
973 else 972 else
974 mFormattedNameType = NameEditDialog::CustomName; 973 mFormattedNameType = NameEditDialog::CustomName;
975 } 974 }
976 975
977 mFormattedNameLabel->setText( mAddressee.formattedName() ); 976 mFormattedNameLabel->setText( mAddressee.formattedName() );
978 977
979 mRoleEdit->setText( mAddressee.role() ); 978 mRoleEdit->setText( mAddressee.role() );
980 mOrgEdit->setText( mAddressee.organization() ); 979 mOrgEdit->setText( mAddressee.organization() );
981 980
982//US mURLEdit->setURL( mAddressee.url().url() ); 981//US mURLEdit->setURL( mAddressee.url().url() );
983 mURLEdit->setText( mAddressee.url().prettyURL() ); 982 mURLEdit->setText( mAddressee.url().prettyURL() );
984//US?? mURLEdit->home( false ); 983//US?? mURLEdit->home( false );
985 984
986 // mNoteEdit->setText( mAddressee.note() ); 985 // mNoteEdit->setText( mAddressee.note() );
987 mNoteEdit->setText( mAddressee.note() ); 986 mNoteEdit->setText( mAddressee.note() );
988 mEmailWidget->setEmails( mAddressee.emails() ); 987 mEmailWidget->setEmails( mAddressee.emails() );
989 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() ); 988 mPhoneEditWidget->setPhoneNumbers( mAddressee.phoneNumbers() );
990 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() ); 989 mAddressEditWidget->setAddresses( mAddressee, mAddressee.addresses() );
991 mBirthdayPicker->setDate( mAddressee.birthday().date() ); 990 mBirthdayPicker->setDate( mAddressee.birthday().date() );
992 991
993//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom( 992//US mAnniversaryPicker->setDate( QDate::fromString( mAddressee.custom(
994//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) ); 993//US "KADDRESSBOOK", "X-Anniversary" ), Qt::ISODate) );
995 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ), 994 QDate dt = KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
996 "%Y-%m-%d"); // = Qt::ISODate 995 "%Y-%m-%d"); // = Qt::ISODate
997 mAnniversaryPicker->setDate( dt ); 996 mAnniversaryPicker->setDate( dt );
998 997
999 998
1000 mNicknameEdit->setText( mAddressee.nickName() ); 999 mNicknameEdit->setText( mAddressee.nickName() );
1001 mCategoryEdit->setText( mAddressee.categories().join( "," ) ); 1000 mCategoryEdit->setText( mAddressee.categories().join( "," ) );
1002 1001
1003 mGeoWidget->setGeo( mAddressee.geo() ); 1002 mGeoWidget->setGeo( mAddressee.geo() );
1004 mImageWidget->setPhoto( mAddressee.photo() ); 1003 mImageWidget->setPhoto( mAddressee.photo() );
1005 mImageWidget->setLogo( mAddressee.logo() ); 1004 mImageWidget->setLogo( mAddressee.logo() );
1006 mKeyWidget->setKeys( mAddressee.keys() ); 1005 mKeyWidget->setKeys( mAddressee.keys() );
1007 mSecrecyWidget->setSecrecy( mAddressee.secrecy() ); 1006 mSecrecyWidget->setSecrecy( mAddressee.secrecy() );
1008#ifndef KAB_EMBEDDED 1007#ifndef KAB_EMBEDDED
1009 mSoundWidget->setSound( mAddressee.sound() ); 1008 mSoundWidget->setSound( mAddressee.sound() );
1010#else //KAB_EMBEDDED 1009#else //KAB_EMBEDDED
1011//US qDebug("AddresseeEditorWidget::load has to be changed 2"); 1010//US qDebug("AddresseeEditorWidget::load has to be changed 2");
1012#endif //KAB_EMBEDDED 1011#endif //KAB_EMBEDDED
1013 1012
1014 // Load customs 1013 // Load customs
1015 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) ); 1014 mIMAddressEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ) );
1016 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) ); 1015 mSpouseEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ) );
1017 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) ); 1016 mManagerEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ) );
1018 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) ); 1017 mAssistantEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ) );
1019 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) ); 1018 mDepartmentEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Department" ) );
1020 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) ); 1019 mOfficeEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Office" ) );
1021 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) ); 1020 mProfessionEdit->setText( mAddressee.custom( "KADDRESSBOOK", "X-Profession" ) );
1022 1021
1023 blockSignals( block ); 1022 blockSignals( block );
1024 mBlockSignals = false; 1023 mBlockSignals = false;
1025 1024
1026 mDirty = false; 1025 mDirty = false;
1027} 1026}
1028 1027
1029void AddresseeEditorWidget::save() 1028void AddresseeEditorWidget::save()
1030{ 1029{
1031 if ( !mDirty ) return; 1030 if ( !dirty() ) {
1031 return;
1032 }
1032 1033
1033 mAddressee.setRole( mRoleEdit->text() ); 1034 mAddressee.setRole( mRoleEdit->text() );
1034 mAddressee.setOrganization( mOrgEdit->text() ); 1035 mAddressee.setOrganization( mOrgEdit->text() );
1035 mAddressee.setUrl( KURL( mURLEdit->text() ) ); 1036 mAddressee.setUrl( KURL( mURLEdit->text() ) );
1036 mAddressee.setNote( mNoteEdit->text() ); 1037 mAddressee.setNote( mNoteEdit->text() );
1037 if ( mBirthdayPicker->inputIsValid() ) 1038 if ( mBirthdayPicker->inputIsValid() ) {
1038 mAddressee.setBirthday( QDateTime( mBirthdayPicker->date() ) ); 1039 QDate da = mBirthdayPicker->date();
1039 else 1040 if ( da > QDate::currentDate() )
1041 da.setYMD(da.year()-100, da.month(), da.day() );
1042 mAddressee.setBirthday( QDateTime( da ) );
1043 qDebug("bday %s ",da.toString().latin1());
1044 }
1045 else {
1040 mAddressee.setBirthday( QDateTime() ); 1046 mAddressee.setBirthday( QDateTime() );
1041 1047 mBirthdayPicker->clear();
1048 }
1042 mAddressee.setNickName( mNicknameEdit->text() ); 1049 mAddressee.setNickName( mNicknameEdit->text() );
1043 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) ); 1050 mAddressee.setCategories( QStringList::split( ",", mCategoryEdit->text() ) );
1044 1051
1045 mAddressee.setGeo( mGeoWidget->geo() ); 1052 mAddressee.setGeo( mGeoWidget->geo() );
1046 mAddressee.setPhoto( mImageWidget->photo() ); 1053 mAddressee.setPhoto( mImageWidget->photo() );
1047 mAddressee.setLogo( mImageWidget->logo() ); 1054 mAddressee.setLogo( mImageWidget->logo() );
1048 mAddressee.setKeys( mKeyWidget->keys() ); 1055 mAddressee.setKeys( mKeyWidget->keys() );
1049#ifndef KAB_EMBEDDED 1056#ifndef KAB_EMBEDDED
1050 mAddressee.setSound( mSoundWidget->sound() ); 1057 mAddressee.setSound( mSoundWidget->sound() );
1051#else //KAB_EMBEDDED 1058#else //KAB_EMBEDDED
1052//US qDebug("AddresseeEditorWidget::save sound not supported"); 1059//US qDebug("AddresseeEditorWidget::save sound not supported");
1053#endif //KAB_EMBEDDED 1060#endif //KAB_EMBEDDED
1054 mAddressee.setSecrecy( mSecrecyWidget->secrecy() ); 1061 mAddressee.setSecrecy( mSecrecyWidget->secrecy() );
1055 1062
1056 // save custom fields 1063 // save custom fields
1057 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() ); 1064 mAddressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMAddressEdit->text() );
1058 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() ); 1065 mAddressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", mSpouseEdit->text() );
1059 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() ); 1066 mAddressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", mManagerEdit->text() );
1060 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() ); 1067 mAddressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", mAssistantEdit->text() );
1061 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() ); 1068 mAddressee.insertCustom( "KADDRESSBOOK", "X-Department", mDepartmentEdit->text() );
1062 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() ); 1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Office", mOfficeEdit->text() );
1063 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() ); 1070 mAddressee.insertCustom( "KADDRESSBOOK", "X-Profession", mProfessionEdit->text() );
1064 if ( mAnniversaryPicker->inputIsValid() ) { 1071 if ( mAnniversaryPicker->inputIsValid() ) {
1065
1066//US mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary",
1067//US mAnniversaryPicker->date().toString( Qt::ISODate ) );
1068 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate); 1072 QString dt = KGlobal::locale()->formatDate(mAnniversaryPicker->date(), true, KLocale::ISODate);
1069 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 1073 mAddressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
1070 } 1074 }
1071 else 1075 else {
1072 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" ); 1076 mAddressee.removeCustom( "KADDRESSBOOK", "X-Anniversary" );
1077 mAnniversaryPicker->clear();
1078 }
1073 1079
1074 // Save the email addresses 1080 // Save the email addresses
1075 QStringList emails = mAddressee.emails(); 1081 QStringList emails = mAddressee.emails();
1076 QStringList::Iterator iter; 1082 QStringList::Iterator iter;
1077 for ( iter = emails.begin(); iter != emails.end(); ++iter ) 1083 for ( iter = emails.begin(); iter != emails.end(); ++iter )
1078 mAddressee.removeEmail( *iter ); 1084 mAddressee.removeEmail( *iter );
1079 1085
1080 emails = mEmailWidget->emails(); 1086 emails = mEmailWidget->emails();
1081 bool first = true; 1087 bool first = true;
1082 for ( iter = emails.begin(); iter != emails.end(); ++iter ) { 1088 for ( iter = emails.begin(); iter != emails.end(); ++iter ) {
1083 mAddressee.insertEmail( *iter, first ); 1089 mAddressee.insertEmail( *iter, first );
1084 first = false; 1090 first = false;
1085 } 1091 }
1086 1092
1087 // Save the phone numbers 1093 // Save the phone numbers
1088 KABC::PhoneNumber::List phoneNumbers; 1094 KABC::PhoneNumber::List phoneNumbers;
1089 KABC::PhoneNumber::List::Iterator phoneIter; 1095 KABC::PhoneNumber::List::Iterator phoneIter;
1090 phoneNumbers = mAddressee.phoneNumbers(); 1096 phoneNumbers = mAddressee.phoneNumbers();
1091 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1097 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1092 ++phoneIter ) 1098 ++phoneIter )
1093 mAddressee.removePhoneNumber( *phoneIter ); 1099 mAddressee.removePhoneNumber( *phoneIter );
1094 1100
1095 phoneNumbers = mPhoneEditWidget->phoneNumbers(); 1101 phoneNumbers = mPhoneEditWidget->phoneNumbers();
1096 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end(); 1102 for ( phoneIter = phoneNumbers.begin(); phoneIter != phoneNumbers.end();
1097 ++phoneIter ) 1103 ++phoneIter )
1098 mAddressee.insertPhoneNumber( *phoneIter ); 1104 mAddressee.insertPhoneNumber( *phoneIter );
1099 1105
1100 // Save the addresses 1106 // Save the addresses
1101 KABC::Address::List addresses; 1107 KABC::Address::List addresses;
1102 KABC::Address::List::Iterator addressIter; 1108 KABC::Address::List::Iterator addressIter;
1103 addresses = mAddressee.addresses(); 1109 addresses = mAddressee.addresses();
1104 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1110 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1105 ++addressIter ) 1111 ++addressIter )
1106 mAddressee.removeAddress( *addressIter ); 1112 mAddressee.removeAddress( *addressIter );
1107 1113
1108 addresses = mAddressEditWidget->addresses(); 1114 addresses = mAddressEditWidget->addresses();
1109 for ( addressIter = addresses.begin(); addressIter != addresses.end(); 1115 for ( addressIter = addresses.begin(); addressIter != addresses.end();
1110 ++addressIter ) 1116 ++addressIter )
1111 mAddressee.insertAddress( *addressIter ); 1117 mAddressee.insertAddress( *addressIter );
1112 mDirty = false; 1118 mDirty = false;
1113} 1119}
1114 1120
1115bool AddresseeEditorWidget::dirty() 1121bool AddresseeEditorWidget::dirty()
1116{ 1122{
1123
1124 if ( ! mDirty ) {
1125 if ( mBirthdayPicker->inputIsValid() ) {
1126 QDate da = mBirthdayPicker->date();
1127 if ( !(da == mAddressee.birthday().date()))
1128 mDirty = true;
1129 }
1130 else {
1131 mBirthdayPicker->clear();
1132 }
1133 if ( mAnniversaryPicker->inputIsValid() ) {
1134 QDate da = mAnniversaryPicker->date();
1135 if ( da != KGlobal::locale()->readDate( mAddressee.custom("KADDRESSBOOK", "X-Anniversary" ),
1136 "%Y-%m-%d"))
1137 mDirty = true;
1138 }
1139 else {
1140 mAnniversaryPicker->clear();
1141 }
1142 }
1117 return mDirty; 1143 return mDirty;
1118} 1144}
1119 1145
1120void AddresseeEditorWidget::nameTextChanged( const QString &text ) 1146void AddresseeEditorWidget::nameTextChanged( const QString &text )
1121{ 1147{
1122 // use the addressee class to parse the name for us 1148 // use the addressee class to parse the name for us
1123 mAConfig->setUid( mAddressee.uid() ); 1149 mAConfig->setUid( mAddressee.uid() );
1124 if ( mAConfig->automaticNameParsing() ) { 1150 if ( mAConfig->automaticNameParsing() ) {
1125 if ( !mAddressee.formattedName().isEmpty() ) { 1151 if ( !mAddressee.formattedName().isEmpty() ) {
1126 QString fn = mAddressee.formattedName(); 1152 QString fn = mAddressee.formattedName();
1127 mAddressee.setNameFromString( text ); 1153 mAddressee.setNameFromString( text );
1128 mAddressee.setFormattedName( fn ); 1154 mAddressee.setFormattedName( fn );
1129 } else { 1155 } else {
1130 // use extra addressee to avoid a formatted name assignment 1156 // use extra addressee to avoid a formatted name assignment
1131 Addressee addr; 1157 Addressee addr;
1132 addr.setNameFromString( text ); 1158 addr.setNameFromString( text );
1133 mAddressee.setPrefix( addr.prefix() ); 1159 mAddressee.setPrefix( addr.prefix() );
1134 mAddressee.setGivenName( addr.givenName() ); 1160 mAddressee.setGivenName( addr.givenName() );
1135 mAddressee.setAdditionalName( addr.additionalName() ); 1161 mAddressee.setAdditionalName( addr.additionalName() );
1136 mAddressee.setFamilyName( addr.familyName() ); 1162 mAddressee.setFamilyName( addr.familyName() );
1137 mAddressee.setSuffix( addr.suffix() ); 1163 mAddressee.setSuffix( addr.suffix() );
1138 } 1164 }
1139 } 1165 }
1140 1166
1141 nameBoxChanged(); 1167 nameBoxChanged();
1142 1168
1143 emitModified(); 1169 emitModified();
1144} 1170}
1145 1171
1146void AddresseeEditorWidget::nameBoxChanged() 1172void AddresseeEditorWidget::nameBoxChanged()
1147{ 1173{
1148 KABC::Addressee addr; 1174 KABC::Addressee addr;
1149 mAConfig->setUid( mAddressee.uid() ); 1175 mAConfig->setUid( mAddressee.uid() );
1150 if ( mAConfig->automaticNameParsing() ) { 1176 if ( mAConfig->automaticNameParsing() ) {
1151 addr.setNameFromString( mNameEdit->text() ); 1177 addr.setNameFromString( mNameEdit->text() );
1152 mNameLabel->hide(); 1178 mNameLabel->hide();
1153 mNameEdit->show(); 1179 mNameEdit->show();
1154 } else { 1180 } else {
1155 addr = mAddressee; 1181 addr = mAddressee;
1156 mNameEdit->hide(); 1182 mNameEdit->hide();
1157 mNameLabel->setText( mNameEdit->text() ); 1183 mNameLabel->setText( mNameEdit->text() );
1158 mNameLabel->show(); 1184 mNameLabel->show();
1159 } 1185 }
1160 1186
1161 if ( mFormattedNameType != NameEditDialog::CustomName ) { 1187 if ( mFormattedNameType != NameEditDialog::CustomName ) {
1162 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1188 mFormattedNameLabel->setText( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1163 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) ); 1189 mAddressee.setFormattedName( NameEditDialog::formattedName( mAddressee, mFormattedNameType ) );
1164 } 1190 }
1165} 1191}
1166 1192
1167void AddresseeEditorWidget::nameButtonClicked() 1193void AddresseeEditorWidget::nameButtonClicked()
1168{ 1194{
1169 // show the name dialog. 1195 // show the name dialog.
1170 NameEditDialog dialog( mAddressee, mFormattedNameType, this ); 1196 NameEditDialog dialog( mAddressee, mFormattedNameType, this );
1171 1197
1172 if ( dialog.exec() ) { 1198 if ( KApplication::execDialog( &dialog) ) {
1173 if ( dialog.changed() ) { 1199 if ( dialog.changed() ) {
1174 mAddressee.setFamilyName( dialog.familyName() ); 1200 mAddressee.setFamilyName( dialog.familyName() );
1175 mAddressee.setGivenName( dialog.givenName() ); 1201 mAddressee.setGivenName( dialog.givenName() );
1176 mAddressee.setPrefix( dialog.prefix() ); 1202 mAddressee.setPrefix( dialog.prefix() );
1177 mAddressee.setSuffix( dialog.suffix() ); 1203 mAddressee.setSuffix( dialog.suffix() );
1178 mAddressee.setAdditionalName( dialog.additionalName() ); 1204 mAddressee.setAdditionalName( dialog.additionalName() );
1179 mFormattedNameType = dialog.formattedNameType(); 1205 mFormattedNameType = dialog.formattedNameType();
1180 if ( mFormattedNameType == NameEditDialog::CustomName ) { 1206 if ( mFormattedNameType == NameEditDialog::CustomName ) {
1181 mFormattedNameLabel->setText( dialog.customFormattedName() ); 1207 mFormattedNameLabel->setText( dialog.customFormattedName() );
1182 mAddressee.setFormattedName( dialog.customFormattedName() ); 1208 mAddressee.setFormattedName( dialog.customFormattedName() );
1183 } 1209 }
1184 // Update the name edit. 1210 // Update the name edit.
1185 bool block = mNameEdit->signalsBlocked(); 1211 bool block = mNameEdit->signalsBlocked();
1186 mNameEdit->blockSignals( true ); 1212 mNameEdit->blockSignals( true );
1187 mNameEdit->setText( mAddressee.assembledName() ); 1213 mNameEdit->setText( mAddressee.assembledName() );
1188 mNameEdit->blockSignals( block ); 1214 mNameEdit->blockSignals( block );
1189 1215
1190 // Update the combo box. 1216 // Update the combo box.
1191 nameBoxChanged(); 1217 nameBoxChanged();
1192 1218
1193 emitModified(); 1219 emitModified();
1194 } 1220 }
1195 } 1221 }
1196} 1222}
1197 1223
1198void AddresseeEditorWidget::categoryButtonClicked() 1224void AddresseeEditorWidget::categoryButtonClicked()
1199{ 1225{
1200 // Show the category dialog 1226 // Show the category dialog
1201 if ( mCategoryDialog == 0 ) { 1227 if ( mCategoryDialog == 0 ) {
1202 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this ); 1228 mCategoryDialog = new KPIM::CategorySelectDialog( KABPrefs::instance(), this );
1203 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ), 1229 connect( mCategoryDialog, SIGNAL( categoriesSelected( const QStringList& ) ),
1204 SLOT(categoriesSelected( const QStringList& ) ) ); 1230 SLOT(categoriesSelected( const QStringList& ) ) );
1205 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) ); 1231 connect( mCategoryDialog, SIGNAL( editCategories() ), SLOT( editCategories() ) );
1206 } 1232 }
1207 1233
1208 mCategoryDialog->setCategories(); 1234 mCategoryDialog->setCategories();
1209 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) ); 1235 mCategoryDialog->setSelected( QStringList::split( ",", mCategoryEdit->text() ) );
1210 mCategoryDialog->show(); 1236 mCategoryDialog->show();
1211 mCategoryDialog->raise(); 1237 mCategoryDialog->raise();
1212} 1238}
1213 1239
1214void AddresseeEditorWidget::categoriesSelected( const QStringList &list ) 1240void AddresseeEditorWidget::categoriesSelected( const QStringList &list )
1215{ 1241{
1216 mCategoryEdit->setText( list.join( "," ) ); 1242 mCategoryEdit->setText( list.join( "," ) );
1217} 1243}
1218 1244
1219void AddresseeEditorWidget::editCategories() 1245void AddresseeEditorWidget::editCategories()
1220{ 1246{
1221 if ( mCategoryEditDialog == 0 ) { 1247 if ( mCategoryEditDialog == 0 ) {
1222 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this ); 1248 mCategoryEditDialog = new KPIM::CategoryEditDialog( KABPrefs::instance(), this );
1223 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ), 1249 connect( mCategoryEditDialog, SIGNAL( categoryConfigChanged() ),
1224 SLOT( categoryButtonClicked() ) ); 1250 SLOT( categoryButtonClicked() ) );
1225 } 1251 }
1226 1252
1227 mCategoryEditDialog->show(); 1253 mCategoryEditDialog->show();
1228 mCategoryEditDialog->raise(); 1254 mCategoryEditDialog->raise();
1229} 1255}
1230 1256
1231void AddresseeEditorWidget::emitModified() 1257void AddresseeEditorWidget::emitModified()
1232{ 1258{
1233 mDirty = true; 1259 mDirty = true;
1234 1260
1235 KABC::Addressee::List list; 1261 KABC::Addressee::List list;
1236 1262
1237 if ( mIsExtension && !mBlockSignals ) { 1263 if ( mIsExtension && !mBlockSignals ) {
1238 save(); 1264 save();
1239 list.append( mAddressee ); 1265 list.append( mAddressee );
1240 } 1266 }
1241 1267
1242 emit modified( list ); 1268 emit modified( list );
1243} 1269}
1244 1270
1245void AddresseeEditorWidget::dateChanged( QDate ) 1271void AddresseeEditorWidget::dateChanged( QDate )
1246{ 1272{
1247 emitModified(); 1273 emitModified();
1248} 1274}
1249 1275
1250//US invalid dates are handdled by the KDateEdit widget itself 1276//US invalid dates are handdled by the KDateEdit widget itself
1251void AddresseeEditorWidget::invalidDate() 1277void AddresseeEditorWidget::invalidDate()
1252{ 1278{
1253 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) ); 1279 KMessageBox::sorry( this, i18n( "You must specify a valid date" ) );
1254} 1280}
1255 1281
1256 1282
1257void AddresseeEditorWidget::pageChanged( QWidget *wdg ) 1283void AddresseeEditorWidget::pageChanged( QWidget *wdg )
1258{ 1284{
1259#ifndef KAB_EMBEDDED 1285#ifndef KAB_EMBEDDED
1260 if ( wdg ) 1286 if ( wdg )
1261 KAcceleratorManager::manage( wdg ); 1287 KAcceleratorManager::manage( wdg );
1262#else //KAB_EMBEDDED 1288#else //KAB_EMBEDDED
1263//US 1289//US
1264#endif //KAB_EMBEDDED 1290#endif //KAB_EMBEDDED
1265 1291
1266} 1292}
1267 1293
1268QString AddresseeEditorWidget::title() const 1294QString AddresseeEditorWidget::title() const
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index d781f67..4230c07 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,169 +1,184 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#else 4#else
5#include <qapplication.h> 5#include <qapplication.h>
6#include <qwindowsstyle.h> 6#include <qwindowsstyle.h>
7#include <qplatinumstyle.h> 7#include <qplatinumstyle.h>
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#endif 9#endif
10 10
11#include <kstandarddirs.h> 11#include <kstandarddirs.h>
12#include <kglobal.h> 12#include <kglobal.h>
13#include <stdio.h> 13#include <stdio.h>
14#include <qdir.h> 14#include <qdir.h>
15#include "kaddressbookmain.h" 15#include "kaddressbookmain.h"
16#include "externalapphandler.h" 16#include "externalapphandler.h"
17 17
18int main( int argc, char **argv ) 18int main( int argc, char **argv )
19{ 19{
20#ifndef DESKTOP_VERSION 20#ifndef DESKTOP_VERSION
21 QPEApplication a( argc, argv ); 21 QPEApplication a( argc, argv );
22 a.setKeepRunning (); 22 a.setKeepRunning ();
23#else 23#else
24 QApplication a( argc, argv ); 24 QApplication a( argc, argv );
25 QApplication::setStyle( new QPlatinumStyle ()); 25 QApplication::setStyle( new QPlatinumStyle ());
26 QString hdir = QDir::homeDirPath(); 26 QString hdir = QDir::homeDirPath();
27 // there is a bug when creating dirs for WIN 98 27 // there is a bug when creating dirs for WIN 98
28 // it is difficult to fix, because we have no WIN 98 runnung 28 // it is difficult to fix, because we have no WIN 98 runnung
29 // such that we try it to create the dirs at startup here 29 // such that we try it to create the dirs at startup here
30 if ( hdir == "C:\\" ) { // win 98 or ME 30 if ( hdir == "C:\\" ) { // win 98 or ME
31 QDir app_dir; 31 QDir app_dir;
32 if ( !app_dir.exists("C:\\kdepim") ) 32 if ( !app_dir.exists("C:\\kdepim") )
33 app_dir.mkdir ("C:\\kdepim"); 33 app_dir.mkdir ("C:\\kdepim");
34 if ( !app_dir.exists("C:\\kdepim\\apps") ) 34 if ( !app_dir.exists("C:\\kdepim\\apps") )
35 app_dir.mkdir ("C:\\kdepim\\apps"); 35 app_dir.mkdir ("C:\\kdepim\\apps");
36 if ( !app_dir.exists("C:\\kdepim\\config") ) 36 if ( !app_dir.exists("C:\\kdepim\\config") )
37 app_dir.mkdir ("C:\\kdepim\\config"); 37 app_dir.mkdir ("C:\\kdepim\\config");
38 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 38 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") )
39 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); 39 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
40 } 40 }
41#endif 41#endif
42 42
43 bool exitHelp = false; 43 bool exitHelp = false;
44 if ( argc > 1 ) { 44 if ( argc > 1 ) {
45 QString command = argv[1]; 45 QString command = argv[1];
46 if ( command == "-help" ){ 46 if ( command == "-help" ){
47 printf("KA/E command line commands:\n"); 47 printf("KA/E command line commands:\n");
48 printf(" no command: Start KA/E in usual way\n"); 48 printf(" no command: Start KA/E in usual way\n");
49 printf(" -help: This output\n"); 49 printf(" -help: This output\n");
50 printf(" KA/E is exiting now. Bye!\n"); 50 printf(" KA/E is exiting now. Bye!\n");
51 exitHelp = true; 51 exitHelp = true;
52 } 52 }
53 } 53 }
54 if ( ! exitHelp ) { 54 if ( ! exitHelp ) {
55 55
56 KGlobal::setAppName( "kaddressbook" ); 56 KGlobal::setAppName( "kaddressbook" );
57#ifndef DESKTOP_VERSION 57#ifndef DESKTOP_VERSION
58 if ( QApplication::desktop()->width() > 320 ) 58 if ( QApplication::desktop()->width() > 320 )
59 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 59 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
60 else 60 else
61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
62#else 62#else
63 QString fileName ; 63 QString fileName ;
64 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 64 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
65 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 65 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
66 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 66 QApplication::addLibraryPath ( qApp->applicationDirPath () );
67 67
68#endif 68#endif
69 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 69 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
70 KAddressBookMain m ; 70 KAddressBookMain m ;
71//US MainWindow m; 71//US MainWindow m;
72 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 72 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
73 73
74 {
75 KConfig kon ( locateLocal( "config", "korganizerrc" ) );
76 kon.setGroup("Locale");
77 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
78 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
79 KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) );
80 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
81 dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
82 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
83 kon.setGroup("Time & Date");
84 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
85 kon.readNumEntry( "DaylightsavingStart", 90),
86 kon.readNumEntry( "DaylightsavingEnd",304) );
87 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
88 }
74#ifndef DESKTOP_VERSION 89#ifndef DESKTOP_VERSION
75 a.showMainWidget( &m ); 90 a.showMainWidget( &m );
76#else 91#else
77 a.setMainWidget( &m ); 92 a.setMainWidget( &m );
78 m.resize (640, 480 ); 93 m.resize (640, 480 );
79 m.show(); 94 m.show();
80#endif 95#endif
81 a.exec(); 96 a.exec();
82 97
83 } 98 }
84 qDebug("KA: Bye! "); 99 qDebug("KA: Bye! ");
85} 100}
86 101
87/* 102/*
88#include <stdlib.h> 103#include <stdlib.h>
89 104
90#include <qstring.h> 105#include <qstring.h>
91 106
92#include <kabc/stdaddressbook.h> 107#include <kabc/stdaddressbook.h>
93#include <kaboutdata.h> 108#include <kaboutdata.h>
94#include <kcmdlineargs.h> 109#include <kcmdlineargs.h>
95#include <kcrash.h> 110#include <kcrash.h>
96#include <kdebug.h> 111#include <kdebug.h>
97#include <klocale.h> 112#include <klocale.h>
98#include <kstartupinfo.h> 113#include <kstartupinfo.h>
99#include <kuniqueapplication.h> 114#include <kuniqueapplication.h>
100#include <kwin.h> 115#include <kwin.h>
101 116
102#include "kaddressbookmain.h" 117#include "kaddressbookmain.h"
103#include "kabcore.h" 118#include "kabcore.h"
104 119
105extern "C" { 120extern "C" {
106 121
107void crashHandler( int ) 122void crashHandler( int )
108{ 123{
109 KABC::StdAddressBook::handleCrash(); 124 KABC::StdAddressBook::handleCrash();
110 ::exit( 0 ); 125 ::exit( 0 );
111} 126}
112 127
113} 128}
114 129
115class KAddressBookApp : public KUniqueApplication { 130class KAddressBookApp : public KUniqueApplication {
116 public: 131 public:
117 KAddressBookApp() : mMainWin( 0 ) {} 132 KAddressBookApp() : mMainWin( 0 ) {}
118 ~KAddressBookApp() {} 133 ~KAddressBookApp() {}
119 134
120 int newInstance(); 135 int newInstance();
121 136
122 private: 137 private:
123 KAddressBookMain *mMainWin; 138 KAddressBookMain *mMainWin;
124}; 139};
125 140
126int KAddressBookApp::newInstance() 141int KAddressBookApp::newInstance()
127{ 142{
128 if ( isRestored() ) { 143 if ( isRestored() ) {
129 // There can only be one main window 144 // There can only be one main window
130 if ( KMainWindow::canBeRestored( 1 ) ) { 145 if ( KMainWindow::canBeRestored( 1 ) ) {
131 mMainWin = new KAddressBookMain; 146 mMainWin = new KAddressBookMain;
132 mMainWin->show(); 147 mMainWin->show();
133 mMainWin->restore( 1 ); 148 mMainWin->restore( 1 );
134 } 149 }
135 } else { 150 } else {
136 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 151 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
137 152
138 QCString addrStr = args->getOption( "addr" ); 153 QCString addrStr = args->getOption( "addr" );
139 QCString uidStr = args->getOption( "uid" ); 154 QCString uidStr = args->getOption( "uid" );
140 QString addr; 155 QString addr;
141 QString uid; 156 QString uid;
142 if ( !addrStr.isEmpty() ) 157 if ( !addrStr.isEmpty() )
143 addr = QString::fromLocal8Bit( addrStr ); 158 addr = QString::fromLocal8Bit( addrStr );
144 if ( !uidStr.isEmpty() ) 159 if ( !uidStr.isEmpty() )
145 uid = QString::fromLocal8Bit( uidStr ); 160 uid = QString::fromLocal8Bit( uidStr );
146 161
147 162
148 if ( args->isSet( "editor-only" ) ) { 163 if ( args->isSet( "editor-only" ) ) {
149 if ( !mMainWin ) 164 if ( !mMainWin )
150 mMainWin = new KAddressBookMain; 165 mMainWin = new KAddressBookMain;
151 KStartupInfo::appStarted(); 166 KStartupInfo::appStarted();
152 mMainWin->hide(); 167 mMainWin->hide();
153 } else { 168 } else {
154 if ( mMainWin ) { 169 if ( mMainWin ) {
155 mMainWin->show(); 170 mMainWin->show();
156 KWin::setActiveWindow( mMainWin->winId() ); 171 KWin::setActiveWindow( mMainWin->winId() );
157 } else { 172 } else {
158 mMainWin = new KAddressBookMain; 173 mMainWin = new KAddressBookMain;
159 mMainWin->show(); 174 mMainWin->show();
160 } 175 }
161 } 176 }
162 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do 177 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do
163 if ( !addr.isEmpty() ) 178 if ( !addr.isEmpty() )
164 mMainWin->addEmail( addr ); 179 mMainWin->addEmail( addr );
165 180
166 if ( !uid.isEmpty() ) 181 if ( !uid.isEmpty() )
167 mMainWin->showContactEditor( uid ); 182 mMainWin->showContactEditor( uid );
168 if ( args->isSet( "new-contact" ) ) { 183 if ( args->isSet( "new-contact" ) ) {
169 mMainWin->newContact(); 184 mMainWin->newContact();
diff --git a/kaddressbook/nameeditdialog.cpp b/kaddressbook/nameeditdialog.cpp
index fb7eb22..8213c2b 100644
--- a/kaddressbook/nameeditdialog.cpp
+++ b/kaddressbook/nameeditdialog.cpp
@@ -16,262 +16,259 @@
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qcheckbox.h> 30#include <qcheckbox.h>
31#include <qstring.h> 31#include <qstring.h>
32 32
33#ifndef KAB_EMBEDDED 33#ifndef KAB_EMBEDDED
34#include <kaccelmanager.h> 34#include <kaccelmanager.h>
35#else //KAB_EMBEDDED 35#else //KAB_EMBEDDED
36#include <kstandarddirs.h> 36#include <kstandarddirs.h>
37#endif //KAB_EMBEDDED 37#endif //KAB_EMBEDDED
38 38
39#include <kapplication.h> 39#include <kapplication.h>
40#include <kbuttonbox.h> 40#include <kbuttonbox.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <klineedit.h> 42#include <klineedit.h>
43#include <klistview.h> 43#include <klistview.h>
44#include <kcombobox.h> 44#include <kcombobox.h>
45#include <klocale.h> 45#include <klocale.h>
46#include <kglobal.h> 46#include <kglobal.h>
47#include <kdebug.h> 47#include <kdebug.h>
48#include <kiconloader.h> 48#include <kiconloader.h>
49#include <kmessagebox.h> 49#include <kmessagebox.h>
50 50
51#include "nameeditdialog.h" 51#include "nameeditdialog.h"
52 52
53NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type, 53NameEditDialog::NameEditDialog( const KABC::Addressee &addr, int type,
54 QWidget *parent, const char *name ) 54 QWidget *parent, const char *name )
55 : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel, 55 : KDialogBase( Plain, i18n( "Edit Contact Name" ), Help | Ok | Cancel,
56 Ok, parent, name, true ) 56 Ok, parent, name, true )
57{ 57{
58 58
59 QWidget *page = plainPage(); 59 QWidget *page = plainPage();
60 QGridLayout *layout = new QGridLayout( page, 5, 3 ); 60 QGridLayout *layout = new QGridLayout( page, 5, 3 );
61 layout->setSpacing( spacingHint() ); 61 layout->setSpacing( spacingHint() );
62 layout->addColSpacing( 2, 100 ); 62 layout->addColSpacing( 2, 100 );
63 QLabel *label; 63 QLabel *label;
64 64
65 label = new QLabel( i18n( "Honorific prefixes:" ), page ); 65 label = new QLabel( i18n( "Honorific prefixes:" ), page );
66 layout->addWidget( label, 0, 0 ); 66 layout->addWidget( label, 0, 0 );
67 mPrefixCombo = new KComboBox( page ); 67 mPrefixCombo = new KComboBox( page );
68 mPrefixCombo->setDuplicatesEnabled( false ); 68 mPrefixCombo->setDuplicatesEnabled( false );
69 mPrefixCombo->setEditable( true ); 69 mPrefixCombo->setEditable( true );
70 label->setBuddy( mPrefixCombo ); 70 label->setBuddy( mPrefixCombo );
71 layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 ); 71 layout->addMultiCellWidget( mPrefixCombo, 0, 0, 1, 2 );
72 72
73 label = new QLabel( i18n( "Given name:" ), page ); 73 label = new QLabel( i18n( "Given name:" ), page );
74 layout->addWidget( label, 1, 0 ); 74 layout->addWidget( label, 1, 0 );
75 mGivenNameEdit = new KLineEdit( page ); 75 mGivenNameEdit = new KLineEdit( page );
76 label->setBuddy( mGivenNameEdit ); 76 label->setBuddy( mGivenNameEdit );
77 layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 ); 77 layout->addMultiCellWidget( mGivenNameEdit, 1, 1, 1, 2 );
78 78
79 label = new QLabel( i18n( "Additional names:" ), page ); 79 label = new QLabel( i18n( "Additional names:" ), page );
80 layout->addWidget( label, 2, 0 ); 80 layout->addWidget( label, 2, 0 );
81 mAdditionalNameEdit = new KLineEdit( page ); 81 mAdditionalNameEdit = new KLineEdit( page );
82 label->setBuddy( mAdditionalNameEdit ); 82 label->setBuddy( mAdditionalNameEdit );
83 layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 ); 83 layout->addMultiCellWidget( mAdditionalNameEdit, 2, 2, 1, 2 );
84 84
85 label = new QLabel( i18n( "Family names:" ), page ); 85 label = new QLabel( i18n( "Family names:" ), page );
86 layout->addWidget( label, 3, 0 ); 86 layout->addWidget( label, 3, 0 );
87 mFamilyNameEdit = new KLineEdit( page ); 87 mFamilyNameEdit = new KLineEdit( page );
88 label->setBuddy( mFamilyNameEdit ); 88 label->setBuddy( mFamilyNameEdit );
89 layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 ); 89 layout->addMultiCellWidget( mFamilyNameEdit, 3, 3, 1, 2 );
90 90
91 label = new QLabel( i18n( "Honorific suffixes:" ), page ); 91 label = new QLabel( i18n( "Honorific suffixes:" ), page );
92 layout->addWidget( label, 4, 0 ); 92 layout->addWidget( label, 4, 0 );
93 mSuffixCombo = new KComboBox( page ); 93 mSuffixCombo = new KComboBox( page );
94 mSuffixCombo->setDuplicatesEnabled( false ); 94 mSuffixCombo->setDuplicatesEnabled( false );
95 mSuffixCombo->setEditable( true ); 95 mSuffixCombo->setEditable( true );
96 label->setBuddy( mSuffixCombo ); 96 label->setBuddy( mSuffixCombo );
97 layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 ); 97 layout->addMultiCellWidget( mSuffixCombo, 4, 4, 1, 2 );
98 98
99 mFormattedNameCombo = new KComboBox( page ); 99 mFormattedNameCombo = new KComboBox( page );
100 mFormattedNameCombo->setMaximumWidth(100); 100 mFormattedNameCombo->setMaximumWidth(100);
101 101
102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 ); 102 layout->addMultiCellWidget( mFormattedNameCombo, 5, 5, 0, 0 );
103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) ); 103 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( typeChanged( int ) ) );
104 104
105 mFormattedNameEdit = new KLineEdit( page ); 105 mFormattedNameEdit = new KLineEdit( page );
106 mFormattedNameEdit->setEnabled( type == CustomName ); 106 mFormattedNameEdit->setEnabled( type == CustomName );
107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 ); 107 layout->addMultiCellWidget( mFormattedNameEdit, 5, 5, 1, 2 );
108 108
109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page ); 109 mParseBox = new QCheckBox( i18n( "Parse name automatically" ), page );
110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) ); 110 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( parseBoxChanged(bool) ) );
111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) ); 111 connect( mParseBox, SIGNAL( toggled(bool) ), SLOT( modified() ) );
112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 1 ); 112 layout->addMultiCellWidget( mParseBox, 6, 6, 0, 2 );
113 113
114 // Fill in the values 114 // Fill in the values
115 mFamilyNameEdit->setText( addr.familyName() ); 115 mFamilyNameEdit->setText( addr.familyName() );
116 mGivenNameEdit->setText( addr.givenName() ); 116 mGivenNameEdit->setText( addr.givenName() );
117 mAdditionalNameEdit->setText( addr.additionalName() ); 117 mAdditionalNameEdit->setText( addr.additionalName() );
118 mFormattedNameEdit->setText( addr.formattedName() ); 118 mFormattedNameEdit->setText( addr.formattedName() );
119 119
120 // Prefix and suffix combos 120 // Prefix and suffix combos
121//US KConfig config( "kabcrc" ); 121//US KConfig config( "kabcrc" );
122 KConfig config( locateLocal("config", "kabcrc") ); 122 KConfig config( locateLocal("config", "kabcrc") );
123 config.setGroup( "General" ); 123 config.setGroup( "General" );
124 124
125 QStringList sTitle; 125 QStringList sTitle;
126 sTitle += i18n( "Dr." ); 126 sTitle += i18n( "Dr." );
127 sTitle += i18n( "Miss" ); 127 sTitle += i18n( "Miss" );
128 sTitle += i18n( "Mr." ); 128 sTitle += i18n( "Mr." );
129 sTitle += i18n( "Mrs." ); 129 sTitle += i18n( "Mrs." );
130 sTitle += i18n( "Ms." ); 130 sTitle += i18n( "Ms." );
131 sTitle += i18n( "Prof." ); 131 sTitle += i18n( "Prof." );
132 sTitle += config.readListEntry( "Prefixes" ); 132 sTitle += config.readListEntry( "Prefixes" );
133 sTitle.sort(); 133 sTitle.sort();
134 134
135 QStringList sSuffix; 135 QStringList sSuffix;
136 sSuffix += i18n( "I" ); 136 sSuffix += i18n( "I" );
137 sSuffix += i18n( "II" ); 137 sSuffix += i18n( "II" );
138 sSuffix += i18n( "III" ); 138 sSuffix += i18n( "III" );
139 sSuffix += i18n( "Jr." ); 139 sSuffix += i18n( "Jr." );
140 sSuffix += i18n( "Sr." ); 140 sSuffix += i18n( "Sr." );
141 sSuffix += config.readListEntry( "Suffixes" ); 141 sSuffix += config.readListEntry( "Suffixes" );
142 sSuffix.sort(); 142 sSuffix.sort();
143 143
144 mPrefixCombo->insertStringList( sTitle ); 144 mPrefixCombo->insertStringList( sTitle );
145 mSuffixCombo->insertStringList( sSuffix ); 145 mSuffixCombo->insertStringList( sSuffix );
146 146
147#ifndef KAB_EMBEDDED 147#ifndef KAB_EMBEDDED
148 mPrefixCombo->setCurrentText( addr.prefix() ); 148 mPrefixCombo->setCurrentText( addr.prefix() );
149 mSuffixCombo->setCurrentText( addr.suffix() ); 149 mSuffixCombo->setCurrentText( addr.suffix() );
150#else //KAB_EMBEDDED 150#else //KAB_EMBEDDED
151 mPrefixCombo->setEditText( addr.prefix() ); 151 mPrefixCombo->setEditText( addr.prefix() );
152 mSuffixCombo->setEditText( addr.suffix() ); 152 mSuffixCombo->setEditText( addr.suffix() );
153#endif //KAB_EMBEDDED 153#endif //KAB_EMBEDDED
154 154
155 AddresseeConfig::instance()->setUid( addr.uid() ); 155 AddresseeConfig::instance()->setUid( addr.uid() );
156 mParseBox->setChecked( AddresseeConfig::instance()->automaticNameParsing() ); 156 mParseBox->setChecked( AddresseeConfig::instance()->automaticNameParsing() );
157 157
158#ifndef KAB_EMBEDDED 158#ifndef KAB_EMBEDDED
159 KAcceleratorManager::manage( this ); 159 KAcceleratorManager::manage( this );
160#endif //KAB_EMBEDDED 160#endif //KAB_EMBEDDED
161 161
162 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 162 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
163 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 163 connect( mPrefixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
164 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 164 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
165 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 165 connect( mGivenNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 166 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 167 connect( mAdditionalNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 168 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 169 connect( mFamilyNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 170 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) ); 171 connect( mSuffixCombo, SIGNAL( textChanged( const QString& ) ), SLOT( updateTypeCombo() ) );
172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) ); 172 connect( mFormattedNameCombo, SIGNAL( activated( int ) ), SLOT( modified() ) );
173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) ); 173 connect( mFormattedNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( modified() ) );
174 174
175 updateTypeCombo(); 175 updateTypeCombo();
176 mFormattedNameCombo->setCurrentItem( type ); 176 mFormattedNameCombo->setCurrentItem( type );
177 177
178#ifdef KAB_EMBEDDED 178
179 resize( KMIN(KGlobal::getDesktopWidth()-10, 490), KMIN(KGlobal::getDesktopHeight()-50, 300));
180#endif //KAB_EMBEDDED
181
182 mChanged = false; 179 mChanged = false;
183} 180}
184 181
185NameEditDialog::~NameEditDialog() 182NameEditDialog::~NameEditDialog()
186{ 183{
187} 184}
188 185
189QString NameEditDialog::familyName() const 186QString NameEditDialog::familyName() const
190{ 187{
191 return mFamilyNameEdit->text(); 188 return mFamilyNameEdit->text();
192} 189}
193 190
194QString NameEditDialog::givenName() const 191QString NameEditDialog::givenName() const
195{ 192{
196 return mGivenNameEdit->text(); 193 return mGivenNameEdit->text();
197} 194}
198 195
199QString NameEditDialog::prefix() const 196QString NameEditDialog::prefix() const
200{ 197{
201 return mPrefixCombo->currentText(); 198 return mPrefixCombo->currentText();
202} 199}
203 200
204QString NameEditDialog::suffix() const 201QString NameEditDialog::suffix() const
205{ 202{
206 return mSuffixCombo->currentText(); 203 return mSuffixCombo->currentText();
207} 204}
208 205
209QString NameEditDialog::additionalName() const 206QString NameEditDialog::additionalName() const
210{ 207{
211 return mAdditionalNameEdit->text(); 208 return mAdditionalNameEdit->text();
212} 209}
213 210
214QString NameEditDialog::customFormattedName() const 211QString NameEditDialog::customFormattedName() const
215{ 212{
216 return mFormattedNameEdit->text(); 213 return mFormattedNameEdit->text();
217} 214}
218 215
219int NameEditDialog::formattedNameType() const 216int NameEditDialog::formattedNameType() const
220{ 217{
221 return mFormattedNameCombo->currentItem(); 218 return mFormattedNameCombo->currentItem();
222} 219}
223 220
224bool NameEditDialog::changed() const 221bool NameEditDialog::changed() const
225{ 222{
226 return mChanged; 223 return mChanged;
227} 224}
228 225
229QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type ) 226QString NameEditDialog::formattedName( const KABC::Addressee &addr, int type )
230{ 227{
231 switch ( type ) { 228 switch ( type ) {
232 case SimpleName: 229 case SimpleName:
233 return addr.givenName() + " " + addr.familyName(); 230 return addr.givenName() + " " + addr.familyName();
234 break; 231 break;
235 case FullName: 232 case FullName:
236 return addr.prefix() + " " + addr.givenName() + " " + 233 return addr.prefix() + " " + addr.givenName() + " " +
237 addr.additionalName() + " " + addr.familyName() + " " + 234 addr.additionalName() + " " + addr.familyName() + " " +
238 addr.suffix(); 235 addr.suffix();
239 break; 236 break;
240 case ReverseName: 237 case ReverseName:
241 return addr.familyName() + ", " + addr.givenName(); 238 return addr.familyName() + ", " + addr.givenName();
242 break; 239 break;
243 default: 240 default:
244 return ""; 241 return "";
245 break; 242 break;
246 } 243 }
247} 244}
248 245
249void NameEditDialog::parseBoxChanged( bool value ) 246void NameEditDialog::parseBoxChanged( bool value )
250{ 247{
251 //AddresseeConfig::instance()->setUid( addr.uid() ); 248 //AddresseeConfig::instance()->setUid( addr.uid() );
252 AddresseeConfig::instance()->setAutomaticNameParsing( value ); 249 AddresseeConfig::instance()->setAutomaticNameParsing( value );
253} 250}
254 251
255void NameEditDialog::typeChanged( int pos ) 252void NameEditDialog::typeChanged( int pos )
256{ 253{
257 mFormattedNameEdit->setEnabled( pos == 0 ); 254 mFormattedNameEdit->setEnabled( pos == 0 );
258} 255}
259 256
260void NameEditDialog::modified() 257void NameEditDialog::modified()
261{ 258{
262 mChanged = true; 259 mChanged = true;
263} 260}
264 261
265void NameEditDialog::updateTypeCombo() 262void NameEditDialog::updateTypeCombo()
266{ 263{
267 KABC::Addressee addr; 264 KABC::Addressee addr;
268 addr.setPrefix( mPrefixCombo->currentText() ); 265 addr.setPrefix( mPrefixCombo->currentText() );
269 addr.setGivenName( mGivenNameEdit->text() ); 266 addr.setGivenName( mGivenNameEdit->text() );
270 addr.setAdditionalName( mAdditionalNameEdit->text() ); 267 addr.setAdditionalName( mAdditionalNameEdit->text() );
271 addr.setFamilyName( mFamilyNameEdit->text() ); 268 addr.setFamilyName( mFamilyNameEdit->text() );
272 addr.setSuffix( mSuffixCombo->currentText() ); 269 addr.setSuffix( mSuffixCombo->currentText() );
273 270
274 int pos = mFormattedNameCombo->currentItem(); 271 int pos = mFormattedNameCombo->currentItem();
275 272
276 mFormattedNameCombo->clear(); 273 mFormattedNameCombo->clear();
277 mFormattedNameCombo->insertItem( i18n( "Custom" ) ); 274 mFormattedNameCombo->insertItem( i18n( "Custom" ) );
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index ed591fc..c3a1627 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -1,135 +1,137 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#include "genericwrapper.h" 2#include "genericwrapper.h"
3#include <libetpan/libetpan.h> 3#include <libetpan/libetpan.h>
4#include "mailtypes.h" 4#include "mailtypes.h"
5 5
6#include <kconfig.h> 6#include <kconfig.h>
7#include <kglobal.h> 7#include <kglobal.h>
8#include <kstandarddirs.h> 8#include <kstandarddirs.h>
9 9
10 10
11using namespace Opie::Core; 11using namespace Opie::Core;
12Genericwrapper::Genericwrapper() 12Genericwrapper::Genericwrapper()
13 : AbstractMail() 13 : AbstractMail()
14{ 14{
15 bodyCache.clear(); 15 bodyCache.clear();
16 m_storage = 0; 16 m_storage = 0;
17 m_folder = 0; 17 m_folder = 0;
18} 18}
19 19
20Genericwrapper::~Genericwrapper() 20Genericwrapper::~Genericwrapper()
21{ 21{
22 if (m_folder) { 22 if (m_folder) {
23 mailfolder_free(m_folder); 23 mailfolder_free(m_folder);
24 } 24 }
25 if (m_storage) { 25 if (m_storage) {
26 mailstorage_free(m_storage); 26 mailstorage_free(m_storage);
27 } 27 }
28 cleanMimeCache(); 28 cleanMimeCache();
29} 29}
30QString Genericwrapper::parseDateTime( mailimf_date_time *date ) 30QString Genericwrapper::parseDateTime( mailimf_date_time *date )
31{ 31{
32 static bool init = false ; 32 static bool init = false ;
33 if ( ! init ) { 33 if ( ! init ) {
34 KConfig kon ( locateLocal( "config", "korganizerrc" ) ); 34 KConfig kon ( locateLocal( "config", "korganizerrc" ) );
35 kon.setGroup("Locale"); 35 kon.setGroup("Locale");
36 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); 36 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) );
37 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); 37 QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( "");
38 KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); 38 KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) );
39 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 39 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
40 dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" );
41 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
40 kon.setGroup("Time & Date"); 42 kon.setGroup("Time & Date");
41 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), 43 KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ),
42 kon.readNumEntry( "DaylightsavingStart", 90), 44 kon.readNumEntry( "DaylightsavingStart", 90),
43 kon.readNumEntry( "DaylightsavingEnd",304) ); 45 kon.readNumEntry( "DaylightsavingEnd",304) );
44 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); 46 KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") );
45 47
46 init = true; 48 init = true;
47 49
48 } 50 }
49 QDate da (date->dt_year,date->dt_month, date->dt_day ); 51 QDate da (date->dt_year,date->dt_month, date->dt_day );
50 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); 52 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
51 QDateTime dt ( da ,ti ); 53 QDateTime dt ( da ,ti );
52 int off = KGlobal::locale()->localTimeOffset( dt ); 54 int off = KGlobal::locale()->localTimeOffset( dt );
53 //dt = dt.addSecs( off*60 ); 55 //dt = dt.addSecs( off*60 );
54 QString ret; 56 QString ret;
55 if ( da == QDate::currentDate () ) 57 if ( da == QDate::currentDate () )
56 ret = KGlobal::locale()->formatTime( ti,true); 58 ret = KGlobal::locale()->formatTime( ti,true);
57 59
58 else { 60 else {
59 ret = KGlobal::locale()->formatDateTime( dt,true,true); 61 ret = KGlobal::locale()->formatDateTime( dt,true,true);
60 } 62 }
61#if 0 63#if 0
62 if ( off < 0 ) 64 if ( off < 0 )
63 ret += " -"; 65 ret += " -";
64 else 66 else
65 ret += " +"; 67 ret += " +";
66 ret += QString::number( off / 60 ); 68 ret += QString::number( off / 60 );
67 ret += "h"; 69 ret += "h";
68#endif 70#endif
69#if 0 71#if 0
70 char tmp[23]; 72 char tmp[23];
71 73
72 // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", 74 // snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i",
73 // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 75 // date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
74 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i", 76 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %+05i",
75 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 77 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
76 78
77 79
78 return QString( tmp ); 80 return QString( tmp );
79#endif 81#endif
80 return ret; 82 return ret;
81} 83}
82 84
83void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) 85void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
84{ 86{
85 if (!mime) { 87 if (!mime) {
86 return; 88 return;
87 } 89 }
88 mailmime_field*field = 0; 90 mailmime_field*field = 0;
89 mailmime_single_fields fields; 91 mailmime_single_fields fields;
90 memset(&fields, 0, sizeof(struct mailmime_single_fields)); 92 memset(&fields, 0, sizeof(struct mailmime_single_fields));
91 if (mime->mm_mime_fields != NULL) { 93 if (mime->mm_mime_fields != NULL) {
92 mailmime_single_fields_init(&fields, mime->mm_mime_fields, 94 mailmime_single_fields_init(&fields, mime->mm_mime_fields,
93 mime->mm_content_type); 95 mime->mm_content_type);
94 } 96 }
95 97
96 mailmime_content*type = fields.fld_content; 98 mailmime_content*type = fields.fld_content;
97 clistcell*current; 99 clistcell*current;
98 if (!type) { 100 if (!type) {
99 target->setType("text"); 101 target->setType("text");
100 target->setSubtype("plain"); 102 target->setSubtype("plain");
101 } else { 103 } else {
102 target->setSubtype(type->ct_subtype); 104 target->setSubtype(type->ct_subtype);
103 switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { 105 switch(type->ct_type->tp_data.tp_discrete_type->dt_type) {
104 case MAILMIME_DISCRETE_TYPE_TEXT: 106 case MAILMIME_DISCRETE_TYPE_TEXT:
105 target->setType("text"); 107 target->setType("text");
106 break; 108 break;
107 case MAILMIME_DISCRETE_TYPE_IMAGE: 109 case MAILMIME_DISCRETE_TYPE_IMAGE:
108 target->setType("image"); 110 target->setType("image");
109 break; 111 break;
110 case MAILMIME_DISCRETE_TYPE_AUDIO: 112 case MAILMIME_DISCRETE_TYPE_AUDIO:
111 target->setType("audio"); 113 target->setType("audio");
112 break; 114 break;
113 case MAILMIME_DISCRETE_TYPE_VIDEO: 115 case MAILMIME_DISCRETE_TYPE_VIDEO:
114 target->setType("video"); 116 target->setType("video");
115 break; 117 break;
116 case MAILMIME_DISCRETE_TYPE_APPLICATION: 118 case MAILMIME_DISCRETE_TYPE_APPLICATION:
117 target->setType("application"); 119 target->setType("application");
118 break; 120 break;
119 case MAILMIME_DISCRETE_TYPE_EXTENSION: 121 case MAILMIME_DISCRETE_TYPE_EXTENSION:
120 default: 122 default:
121 if (type->ct_type->tp_data.tp_discrete_type->dt_extension) { 123 if (type->ct_type->tp_data.tp_discrete_type->dt_extension) {
122 target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension); 124 target->setType(type->ct_type->tp_data.tp_discrete_type->dt_extension);
123 } 125 }
124 break; 126 break;
125 } 127 }
126 if (type->ct_parameters) { 128 if (type->ct_parameters) {
127 fillParameters(target,type->ct_parameters); 129 fillParameters(target,type->ct_parameters);
128 } 130 }
129 } 131 }
130 if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { 132 if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) {
131 for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) { 133 for (current=clist_begin(mime->mm_mime_fields->fld_list);current!=0;current=clist_next(current)) {
132 field = (mailmime_field*)current->data; 134 field = (mailmime_field*)current->data;
133 switch(field->fld_type) { 135 switch(field->fld_type) {
134 case MAILMIME_FIELD_TRANSFER_ENCODING: 136 case MAILMIME_FIELD_TRANSFER_ENCODING:
135 target->setEncoding(getencoding(field->fld_data.fld_encoding)); 137 target->setEncoding(getencoding(field->fld_data.fld_encoding));
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index d5d31e2..258bd43 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1167,195 +1167,197 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1167 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1167 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1168 remote->addEvent( eventRSync ); 1168 remote->addEvent( eventRSync );
1169 QString mes; 1169 QString mes;
1170 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1170 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1171 QString delmess; 1171 QString delmess;
1172 if ( delFut ) { 1172 if ( delFut ) {
1173 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); 1173 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture );
1174 mes += delmess; 1174 mes += delmess;
1175 } 1175 }
1176 if ( KOPrefs::instance()->mShowSyncSummary ) { 1176 if ( KOPrefs::instance()->mShowSyncSummary ) {
1177 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1177 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1178 } 1178 }
1179 qDebug( mes ); 1179 qDebug( mes );
1180 mCalendar->checkAlarmForIncidence( 0, true ); 1180 mCalendar->checkAlarmForIncidence( 0, true );
1181 return syncOK; 1181 return syncOK;
1182} 1182}
1183 1183
1184void CalendarView::setSyncDevice( QString s ) 1184void CalendarView::setSyncDevice( QString s )
1185{ 1185{
1186 mCurrentSyncDevice= s; 1186 mCurrentSyncDevice= s;
1187} 1187}
1188void CalendarView::setSyncName( QString s ) 1188void CalendarView::setSyncName( QString s )
1189{ 1189{
1190 mCurrentSyncName= s; 1190 mCurrentSyncName= s;
1191} 1191}
1192bool CalendarView::syncCalendar(QString filename, int mode) 1192bool CalendarView::syncCalendar(QString filename, int mode)
1193{ 1193{
1194 mGlobalSyncMode = SYNC_MODE_NORMAL; 1194 mGlobalSyncMode = SYNC_MODE_NORMAL;
1195 CalendarLocal* calendar = new CalendarLocal(); 1195 CalendarLocal* calendar = new CalendarLocal();
1196 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1196 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1197 FileStorage* storage = new FileStorage( calendar ); 1197 FileStorage* storage = new FileStorage( calendar );
1198 bool syncOK = false; 1198 bool syncOK = false;
1199 storage->setFileName( filename ); 1199 storage->setFileName( filename );
1200 // qDebug("loading ... "); 1200 // qDebug("loading ... ");
1201 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1201 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1202 getEventViewerDialog()->setSyncMode( true ); 1202 getEventViewerDialog()->setSyncMode( true );
1203 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1203 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1204 getEventViewerDialog()->setSyncMode( false ); 1204 getEventViewerDialog()->setSyncMode( false );
1205 if ( syncOK ) { 1205 if ( syncOK ) {
1206 if ( KOPrefs::instance()->mWriteBackFile ) 1206 if ( KOPrefs::instance()->mWriteBackFile )
1207 { 1207 {
1208 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1208 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1209 storage->save(); 1209 storage->save();
1210 } 1210 }
1211 } 1211 }
1212 setModified( true ); 1212 setModified( true );
1213 } 1213 }
1214 delete storage; 1214 delete storage;
1215 delete calendar; 1215 delete calendar;
1216 if ( syncOK ) 1216 if ( syncOK )
1217 updateView(); 1217 updateView();
1218 return syncOK; 1218 return syncOK;
1219} 1219}
1220void CalendarView::syncPhone() 1220void CalendarView::syncPhone()
1221{ 1221{
1222 syncExternal( 1 ); 1222 syncExternal( 1 );
1223} 1223}
1224void CalendarView::syncExternal( int mode ) 1224void CalendarView::syncExternal( int mode )
1225{ 1225{
1226 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1226 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1227 //mCurrentSyncDevice = "sharp-DTM"; 1227 //mCurrentSyncDevice = "sharp-DTM";
1228 if ( KOPrefs::instance()->mAskForPreferences ) 1228 if ( KOPrefs::instance()->mAskForPreferences )
1229 edit_sync_options(); 1229 edit_sync_options();
1230 qApp->processEvents(); 1230 qApp->processEvents();
1231 CalendarLocal* calendar = new CalendarLocal(); 1231 CalendarLocal* calendar = new CalendarLocal();
1232 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1232 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1233 bool syncOK = false; 1233 bool syncOK = false;
1234 bool loadSuccess = false; 1234 bool loadSuccess = false;
1235 PhoneFormat* phoneFormat = 0; 1235 PhoneFormat* phoneFormat = 0;
1236#ifndef DESKTOP_VERSION 1236#ifndef DESKTOP_VERSION
1237 SharpFormat* sharpFormat = 0; 1237 SharpFormat* sharpFormat = 0;
1238 if ( mode == 0 ) { // sharp 1238 if ( mode == 0 ) { // sharp
1239 sharpFormat = new SharpFormat () ; 1239 sharpFormat = new SharpFormat () ;
1240 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1240 loadSuccess = sharpFormat->load( calendar, mCalendar );
1241 1241
1242 } else 1242 } else
1243#endif 1243#endif
1244 if ( mode == 1 ) { // phone 1244 if ( mode == 1 ) { // phone
1245 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1245 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1246 KOPrefs::instance()->mPhoneDevice, 1246 KOPrefs::instance()->mPhoneDevice,
1247 KOPrefs::instance()->mPhoneConnection, 1247 KOPrefs::instance()->mPhoneConnection,
1248 KOPrefs::instance()->mPhoneModel); 1248 KOPrefs::instance()->mPhoneModel);
1249 loadSuccess = phoneFormat->load( calendar,mCalendar); 1249 loadSuccess = phoneFormat->load( calendar,mCalendar);
1250 1250
1251 } else 1251 } else
1252 return; 1252 return;
1253 if ( loadSuccess ) { 1253 if ( loadSuccess ) {
1254 getEventViewerDialog()->setSyncMode( true ); 1254 getEventViewerDialog()->setSyncMode( true );
1255 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1255 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1256 getEventViewerDialog()->setSyncMode( false ); 1256 getEventViewerDialog()->setSyncMode( false );
1257 qApp->processEvents(); 1257 qApp->processEvents();
1258 if ( syncOK ) { 1258 if ( syncOK ) {
1259 if ( KOPrefs::instance()->mWriteBackFile ) 1259 if ( KOPrefs::instance()->mWriteBackFile )
1260 { 1260 {
1261 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1261 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1262 Incidence* inc = iL.first(); 1262 Incidence* inc = iL.first();
1263 while ( inc ) { 1263 if ( phoneFormat ) {
1264 inc->removeID(mCurrentSyncDevice); 1264 while ( inc ) {
1265 inc = iL.next(); 1265 inc->removeID(mCurrentSyncDevice);
1266 inc = iL.next();
1267 }
1266 } 1268 }
1267#ifndef DESKTOP_VERSION 1269#ifndef DESKTOP_VERSION
1268 if ( sharpFormat ) 1270 if ( sharpFormat )
1269 sharpFormat->save(calendar); 1271 sharpFormat->save(calendar);
1270#endif 1272#endif
1271 if ( phoneFormat ) 1273 if ( phoneFormat )
1272 phoneFormat->save(calendar); 1274 phoneFormat->save(calendar);
1273 iL = calendar->rawIncidences(); 1275 iL = calendar->rawIncidences();
1274 inc = iL.first(); 1276 inc = iL.first();
1275 Incidence* loc; 1277 Incidence* loc;
1276 while ( inc ) { 1278 while ( inc ) {
1277 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1279 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1278 loc = mCalendar->incidence(inc->uid() ); 1280 loc = mCalendar->incidence(inc->uid() );
1279 if ( loc ) { 1281 if ( loc ) {
1280 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1282 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1281 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1283 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1282 } 1284 }
1283 } 1285 }
1284 inc = iL.next(); 1286 inc = iL.next();
1285 } 1287 }
1286 Incidence* lse = getLastSyncEvent(); 1288 Incidence* lse = getLastSyncEvent();
1287 if ( lse ) { 1289 if ( lse ) {
1288 lse->setReadOnly( false ); 1290 lse->setReadOnly( false );
1289 lse->setDescription( "" ); 1291 lse->setDescription( "" );
1290 lse->setReadOnly( true ); 1292 lse->setReadOnly( true );
1291 } 1293 }
1292 } 1294 }
1293 } 1295 }
1294 setModified( true ); 1296 setModified( true );
1295 } else { 1297 } else {
1296 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1298 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1297 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1299 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1298 question, i18n("Ok")) ; 1300 question, i18n("Ok")) ;
1299 1301
1300 } 1302 }
1301 delete calendar; 1303 delete calendar;
1302 updateView(); 1304 updateView();
1303 return ;//syncOK; 1305 return ;//syncOK;
1304 1306
1305} 1307}
1306void CalendarView::syncSharp() 1308void CalendarView::syncSharp()
1307{ 1309{
1308 syncExternal( 0 ); 1310 syncExternal( 0 );
1309 1311
1310} 1312}
1311 1313
1312 1314
1313#include <kabc/stdaddressbook.h> 1315#include <kabc/stdaddressbook.h>
1314bool CalendarView::importBday() 1316bool CalendarView::importBday()
1315{ 1317{
1316 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 1318 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
1317 KABC::AddressBook::Iterator it; 1319 KABC::AddressBook::Iterator it;
1318 int count = 0; 1320 int count = 0;
1319 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1321 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1320 ++count; 1322 ++count;
1321 } 1323 }
1322 QProgressBar bar(count,0 ); 1324 QProgressBar bar(count,0 );
1323 int w = 300; 1325 int w = 300;
1324 if ( QApplication::desktop()->width() < 320 ) 1326 if ( QApplication::desktop()->width() < 320 )
1325 w = 220; 1327 w = 220;
1326 int h = bar.sizeHint().height() ; 1328 int h = bar.sizeHint().height() ;
1327 int dw = QApplication::desktop()->width(); 1329 int dw = QApplication::desktop()->width();
1328 int dh = QApplication::desktop()->height(); 1330 int dh = QApplication::desktop()->height();
1329 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1331 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1330 bar.show(); 1332 bar.show();
1331 bar.setCaption (i18n("Reading addressbook - close to abort!") ); 1333 bar.setCaption (i18n("Reading addressbook - close to abort!") );
1332 qApp->processEvents(); 1334 qApp->processEvents();
1333 count = 0; 1335 count = 0;
1334 int addCount = 0; 1336 int addCount = 0;
1335 KCal::Attendee* a = 0; 1337 KCal::Attendee* a = 0;
1336 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 1338 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
1337 if ( ! bar.isVisible() ) 1339 if ( ! bar.isVisible() )
1338 return false; 1340 return false;
1339 bar.setProgress( count++ ); 1341 bar.setProgress( count++ );
1340 qApp->processEvents(); 1342 qApp->processEvents();
1341 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); 1343 //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() );
1342 if ( (*it).birthday().date().isValid() ){ 1344 if ( (*it).birthday().date().isValid() ){
1343 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1345 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1344 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) 1346 if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) )
1345 ++addCount; 1347 ++addCount;
1346 } 1348 }
1347 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); 1349 QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d");
1348 if ( anni.isValid() ){ 1350 if ( anni.isValid() ){
1349 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 1351 a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
1350 if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) 1352 if ( addAnniversary( anni, (*it).assembledName(), a, false ) )
1351 ++addCount; 1353 ++addCount;
1352 } 1354 }
1353 } 1355 }
1354 updateView(); 1356 updateView();
1355 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1357 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1356 return true; 1358 return true;
1357} 1359}
1358 1360
1359bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1361bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1360{ 1362{
1361 //qDebug("addAnni "); 1363 //qDebug("addAnni ");
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp
index d710541..5c69010 100644
--- a/libkdepim/addresseeview.cpp
+++ b/libkdepim/addresseeview.cpp
@@ -1,223 +1,229 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21 21
22#include <kabc/address.h> 22#include <kabc/address.h>
23#include <kabc/addressee.h> 23#include <kabc/addressee.h>
24#include <kabc/phonenumber.h> 24#include <kabc/phonenumber.h>
25#include <kglobal.h> 25#include <kglobal.h>
26//US#include <kglobalsettings.h> 26//US#include <kglobalsettings.h>
27#include <kiconloader.h> 27#include <kiconloader.h>
28#include <klocale.h> 28#include <klocale.h>
29//US #include <kstringhandler.h> 29//US #include <kstringhandler.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qregexp.h> 31#include <qregexp.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qapplication.h> 33#include <qapplication.h>
34 34
35 35
36#include "externalapphandler.h" 36#include "externalapphandler.h"
37#include "addresseeview.h" 37#include "addresseeview.h"
38 38
39 39
40//US #ifndef DESKTOP_VERSION 40//US #ifndef DESKTOP_VERSION
41//US #include <qtopia/qcopenvelope_qws.h> 41//US #include <qtopia/qcopenvelope_qws.h>
42//US #include <qpe/qpeapplication.h> 42//US #include <qpe/qpeapplication.h>
43//US #endif 43//US #endif
44 44
45//US static int kphoneInstalled = 0; 45//US static int kphoneInstalled = 0;
46 46
47using namespace KPIM; 47using namespace KPIM;
48 48
49AddresseeView::AddresseeView( QWidget *parent, const char *name ) 49AddresseeView::AddresseeView( QWidget *parent, const char *name )
50//US : KTextBrowser( parent, name ) 50//US : KTextBrowser( parent, name )
51 : QTextBrowser( parent, name ) 51 : QTextBrowser( parent, name )
52 52
53 53
54{ 54{
55//US setWrapPolicy( QTextEdit::AtWordBoundary ); 55//US setWrapPolicy( QTextEdit::AtWordBoundary );
56 setLinkUnderline( false ); 56 setLinkUnderline( false );
57 // setVScrollBarMode( QScrollView::AlwaysOff ); 57 // setVScrollBarMode( QScrollView::AlwaysOff );
58 //setHScrollBarMode( QScrollView::AlwaysOff ); 58 //setHScrollBarMode( QScrollView::AlwaysOff );
59 59
60//US QStyleSheet *sheet = styleSheet(); 60//US QStyleSheet *sheet = styleSheet();
61//US QStyleSheetItem *link = sheet->item( "a" ); 61//US QStyleSheetItem *link = sheet->item( "a" );
62//US link->setColor( KGlobalSettings::linkColor() ); 62//US link->setColor( KGlobalSettings::linkColor() );
63 63
64} 64}
65 65
66void AddresseeView::setSource(const QString& n) 66void AddresseeView::setSource(const QString& n)
67{ 67{
68 qDebug("********AddresseeView::setSource %s", n.latin1()); 68 //qDebug("********AddresseeView::setSource %s", n.latin1());
69 69
70 if ( n.left( 6 ) == "mailto" ) 70 if ( n.left( 6 ) == "mailto" )
71 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); 71 ExternalAppHandler::instance()->mailToOneContact( n.mid(7) );
72 else if ( n.left( 7 ) == "phoneto" ) 72 else if ( n.left( 7 ) == "phoneto" )
73 ExternalAppHandler::instance()->callByPhone( n.mid(8) ); 73 ExternalAppHandler::instance()->callByPhone( n.mid(8) );
74 else if ( n.left( 5 ) == "faxto" ) 74 else if ( n.left( 5 ) == "faxto" )
75 ExternalAppHandler::instance()->callByFax( n.mid(6) ); 75 ExternalAppHandler::instance()->callByFax( n.mid(6) );
76 else if ( n.left( 5 ) == "smsto" ) 76 else if ( n.left( 5 ) == "smsto" )
77 ExternalAppHandler::instance()->callBySMS( n.mid(6) ); 77 ExternalAppHandler::instance()->callBySMS( n.mid(6) );
78 else if ( n.left( 7 ) == "pagerto" ) 78 else if ( n.left( 7 ) == "pagerto" )
79 ExternalAppHandler::instance()->callByPager( n.mid(8) ); 79 ExternalAppHandler::instance()->callByPager( n.mid(8) );
80 80
81} 81}
82void AddresseeView::setAddressee( const KABC::Addressee& addr ) 82void AddresseeView::setAddressee( const KABC::Addressee& addr )
83{ 83{
84 ExternalAppHandler* eah = ExternalAppHandler::instance(); 84 ExternalAppHandler* eah = ExternalAppHandler::instance();
85 bool kemailAvail = eah->isEmailAppAvailable(); 85 bool kemailAvail = eah->isEmailAppAvailable();
86 bool kphoneAvail = eah->isPhoneAppAvailable(); 86 bool kphoneAvail = eah->isPhoneAppAvailable();
87 bool kfaxAvail = eah->isFaxAppAvailable(); 87 bool kfaxAvail = eah->isFaxAppAvailable();
88 bool ksmsAvail = eah->isSMSAppAvailable(); 88 bool ksmsAvail = eah->isSMSAppAvailable();
89 bool kpagerAvail = eah->isPagerAppAvailable(); 89 bool kpagerAvail = eah->isPagerAppAvailable();
90 90
91 91
92 mAddressee = addr; 92 mAddressee = addr;
93 // clear view 93 // clear view
94 setText( QString::null ); 94 setText( QString::null );
95 95
96 if ( mAddressee.isEmpty() ) 96 if ( mAddressee.isEmpty() )
97 return; 97 return;
98 98
99 QString name = ( mAddressee.assembledName().isEmpty() ? 99 QString name = ( mAddressee.assembledName().isEmpty() ?
100 mAddressee.formattedName() : mAddressee.assembledName() ); 100 mAddressee.formattedName() : mAddressee.assembledName() );
101 101
102 QString dynamicPart; 102 QString dynamicPart;
103 103
104 QStringList emails = mAddressee.emails(); 104 QStringList emails = mAddressee.emails();
105 QStringList::ConstIterator emailIt; 105 QStringList::ConstIterator emailIt;
106 QString type = i18n( "Email" ); 106 QString type = i18n( "Email" );
107 emailIt = emails.begin(); 107 emailIt = emails.begin();
108 if ( emailIt != emails.end() ) { 108 if ( emailIt != emails.end() ) {
109 if ( kemailAvail ) { 109 if ( kemailAvail ) {
110 dynamicPart += QString( 110 dynamicPart += QString(
111 "<tr><td align=\"right\"><b>%1</b></td>" 111 "<tr><td align=\"right\"><b>%1</b></td>"
112 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 112 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
113 .arg( type ) 113 .arg( type )
114 .arg( name ) 114 .arg( name )
115 .arg( *emailIt ) 115 .arg( *emailIt )
116 .arg( *emailIt ); 116 .arg( *emailIt );
117 ++emailIt; 117 ++emailIt;
118 } else { 118 } else {
119 dynamicPart += QString( 119 dynamicPart += QString(
120 "<tr><td align=\"right\"><b>%1</b></td>" 120 "<tr><td align=\"right\"><b>%1</b></td>"
121 "<td align=\"left\">%2</td></tr>" ) 121 "<td align=\"left\">%2</td></tr>" )
122 .arg( type ) 122 .arg( type )
123 .arg( *emailIt ); 123 .arg( *emailIt );
124 ++emailIt; 124 ++emailIt;
125 } 125 }
126 } 126 }
127 127 if ( mAddressee.birthday().date().isValid() ) {
128 dynamicPart += QString(
129 "<tr><td align=\"right\"><b>%1</b></td>"
130 "<td align=\"left\">%2</td></tr>" )
131 .arg( i18n ("Birthday") )
132 .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) );
133 }
128 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); 134 KABC::PhoneNumber::List phones = mAddressee.phoneNumbers();
129 KABC::PhoneNumber::List::ConstIterator phoneIt; 135 KABC::PhoneNumber::List::ConstIterator phoneIt;
130 QString extension; 136 QString extension;
131 int phonetype; 137 int phonetype;
132 QString sms; 138 QString sms;
133 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 139 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
134 phonetype = (*phoneIt).type(); 140 phonetype = (*phoneIt).type();
135 if (ksmsAvail && 141 if (ksmsAvail &&
136 ( 142 (
137 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || 143 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
138 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) 144 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
139 ) 145 )
140 ) 146 )
141 { 147 {
142 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) 148 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
143 .arg( (*phoneIt).number() ); 149 .arg( (*phoneIt).number() );
144 150
145 } 151 }
146 else 152 else
147 sms = ""; 153 sms = "";
148 154
149 extension = QString::null; 155 extension = QString::null;
150 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { 156 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
151 if (kfaxAvail) extension = "faxto:"; 157 if (kfaxAvail) extension = "faxto:";
152 } 158 }
153 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { 159 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
154 if (kpagerAvail) extension = "pagerto:"; 160 if (kpagerAvail) extension = "pagerto:";
155 } 161 }
156 else if (kphoneAvail) { 162 else if (kphoneAvail) {
157 extension = "phoneto:"; 163 extension = "phoneto:";
158 } 164 }
159 else 165 else
160 extension = QString::null; 166 extension = QString::null;
161 167
162 if ( !extension.isEmpty() ) { 168 if ( !extension.isEmpty() ) {
163 dynamicPart += QString( 169 dynamicPart += QString(
164 "<tr><td align=\"right\"><b>%1</b></td>" 170 "<tr><td align=\"right\"><b>%1</b></td>"
165 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) 171 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
166 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 172 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
167 .arg( extension ) 173 .arg( extension )
168 .arg( (*phoneIt).number() ) 174 .arg( (*phoneIt).number() )
169 .arg( (*phoneIt).number() ) 175 .arg( (*phoneIt).number() )
170 .arg( sms ); 176 .arg( sms );
171 177
172 } else { 178 } else {
173 dynamicPart += QString( 179 dynamicPart += QString(
174 "<tr><td align=\"right\"><b>%1</b></td>" 180 "<tr><td align=\"right\"><b>%1</b></td>"
175 "<td align=\"left\">%2 %3</td></tr>" ) 181 "<td align=\"left\">%2 %3</td></tr>" )
176 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 182 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
177 .arg( (*phoneIt).number() ) 183 .arg( (*phoneIt).number() )
178 .arg( sms ); 184 .arg( sms );
179 } 185 }
180 } 186 }
181 187
182 188
183 for ( ; emailIt != emails.end(); ++emailIt ) { 189 for ( ; emailIt != emails.end(); ++emailIt ) {
184 if ( kemailAvail ) { 190 if ( kemailAvail ) {
185 dynamicPart += QString( 191 dynamicPart += QString(
186 "<tr><td align=\"right\"><b>%1</b></td>" 192 "<tr><td align=\"right\"><b>%1</b></td>"
187 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) 193 "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" )
188 .arg( type ) 194 .arg( type )
189 .arg( name ) 195 .arg( name )
190 .arg( *emailIt ) 196 .arg( *emailIt )
191 .arg( *emailIt ); 197 .arg( *emailIt );
192 } else { 198 } else {
193 dynamicPart += QString( 199 dynamicPart += QString(
194 "<tr><td align=\"right\"><b>%1</b></td>" 200 "<tr><td align=\"right\"><b>%1</b></td>"
195 "<td align=\"left\">%2</td></tr>" ) 201 "<td align=\"left\">%2</td></tr>" )
196 .arg( type ) 202 .arg( type )
197 .arg( *emailIt ); 203 .arg( *emailIt );
198 } 204 }
199 } 205 }
200 206
201 if ( !mAddressee.url().url().isEmpty() ) { 207 if ( !mAddressee.url().url().isEmpty() ) {
202 dynamicPart += QString( 208 dynamicPart += QString(
203 "<tr><td align=\"right\"><b>%1</b></td>" 209 "<tr><td align=\"right\"><b>%1</b></td>"
204 "<td align=\"left\">%2</td></tr>" ) 210 "<td align=\"left\">%2</td></tr>" )
205 .arg( i18n( "Homepage" ) ) 211 .arg( i18n( "Homepage" ) )
206//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); 212//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) );
207 .arg( mAddressee.url().url() ); 213 .arg( mAddressee.url().url() );
208 //qDebug("AddresseeView::setAddressee has to be verified."); 214 //qDebug("AddresseeView::setAddressee has to be verified.");
209 } 215 }
210 216
211 KABC::Address::List addresses = mAddressee.addresses(); 217 KABC::Address::List addresses = mAddressee.addresses();
212 KABC::Address::List::ConstIterator addrIt; 218 KABC::Address::List::ConstIterator addrIt;
213 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { 219 for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) {
214 if ( true /*(*addrIt).label().isEmpty()*/ ) { 220 if ( true /*(*addrIt).label().isEmpty()*/ ) {
215 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); 221 QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace();
216//US formattedAddress = formattedAddress.replace( '\n', "<br>" ); 222//US formattedAddress = formattedAddress.replace( '\n', "<br>" );
217 //qDebug("adresss %s ",formattedAddress.latin1() ); 223 //qDebug("adresss %s ",formattedAddress.latin1() );
218 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); 224 formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" );
219 //qDebug("AddresseeView::setAddressee has to be verified."); 225 //qDebug("AddresseeView::setAddressee has to be verified.");
220 226
221 dynamicPart += QString( 227 dynamicPart += QString(
222 "<tr><td align=\"right\"><b>%1</b></td>" 228 "<tr><td align=\"right\"><b>%1</b></td>"
223 "<td align=\"left\">%2</td></tr>" ) 229 "<td align=\"left\">%2</td></tr>" )
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp
index 5fb948a..c4c0081 100644
--- a/libkdepim/kdateedit.cpp
+++ b/libkdepim/kdateedit.cpp
@@ -31,193 +31,199 @@
31#include <kdatepicker.h> 31#include <kdatepicker.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include <kiconloader.h> 34#include <kiconloader.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kmessagebox.h> 36#include <kmessagebox.h>
37#include <knotifyclient.h> 37#include <knotifyclient.h>
38#include <qpalette.h> 38#include <qpalette.h>
39 39
40#include "kdateedit.h" 40#include "kdateedit.h"
41//#include "kdateedit.moc" 41//#include "kdateedit.moc"
42 42
43KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) 43KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP )
44 : QHBox(parent, name) 44 : QHBox(parent, name)
45{ 45{
46 dateFormShort = true; 46 dateFormShort = true;
47 withoutDp = withoutDP; 47 withoutDp = withoutDP;
48 mDateEdit = new QLineEdit(this); 48 mDateEdit = new QLineEdit(this);
49 mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort)); 49 mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort));
50 setFocusProxy(mDateEdit); 50 setFocusProxy(mDateEdit);
51 mDateEdit->installEventFilter(this); 51 mDateEdit->installEventFilter(this);
52 52
53 // Highlight Background and Textcolor 53 // Highlight Background and Textcolor
54 QPalette palette = QWidget::palette(); 54 QPalette palette = QWidget::palette();
55 unsigned char red, green, blue; 55 unsigned char red, green, blue;
56 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; 56 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
57 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; 57 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
58 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; 58 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
59 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); 59 palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) );
60 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); 60 palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) );
61 mDateEdit->setPalette( palette ); 61 mDateEdit->setPalette( palette );
62 62
63 if ( withoutDP ) { 63 if ( withoutDP ) {
64 mDateFrame = 0; 64 mDateFrame = 0;
65 mDateButton = 0; 65 mDateButton = 0;
66 mDatePicker = 0; 66 mDatePicker = 0;
67 } else { 67 } else {
68 QPixmap pixmap = SmallIcon("smallcal"); 68 QPixmap pixmap = SmallIcon("smallcal");
69 mDateButton = new QPushButton(this); 69 mDateButton = new QPushButton(this);
70 mDateButton->setPixmap(pixmap); 70 mDateButton->setPixmap(pixmap);
71 71
72 mDateFrame = new QVBox(0,0,WType_Popup); 72 mDateFrame = new QVBox(0,0,WType_Popup);
73 // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 73 // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
74 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 74 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
75 mDateFrame->setLineWidth(3); 75 mDateFrame->setLineWidth(3);
76 mDateFrame->hide(); 76 mDateFrame->hide();
77 77
78 mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); 78 mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate());
79 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); 79 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate)));
80 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); 80 connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate)));
81 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); 81 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate)));
82 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); 82 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate)));
83 connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); 83 connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide()));
84 connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); 84 connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker()));
85 85
86 //mDateFrame->resize( 400, 300 ); 86 //mDateFrame->resize( 400, 300 );
87 87
88 } 88 }
89 connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); 89 connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed()));
90 connect(mDateEdit,SIGNAL(textChanged(const QString &)), 90 connect(mDateEdit,SIGNAL(textChanged(const QString &)),
91 SLOT(textChanged(const QString &))); 91 SLOT(textChanged(const QString &)));
92 92
93 // Create the keyword list. This will be used to match against when the user 93 // Create the keyword list. This will be used to match against when the user
94 // enters information. 94 // enters information.
95 mKeywordMap[i18n("tomorrow")] = 1; 95 mKeywordMap[i18n("tomorrow")] = 1;
96 mKeywordMap[i18n("today")] = 0; 96 mKeywordMap[i18n("today")] = 0;
97 mKeywordMap[i18n("yesterday")] = -1; 97 mKeywordMap[i18n("yesterday")] = -1;
98 98
99 /* 99 /*
100 * This loop uses some math tricks to figure out the offset in days 100 * This loop uses some math tricks to figure out the offset in days
101 * to the next date the given day of the week occurs. There 101 * to the next date the given day of the week occurs. There
102 * are two cases, that the new day is >= the current day, which means 102 * are two cases, that the new day is >= the current day, which means
103 * the new day has not occured yet or that the new day < the current day, 103 * the new day has not occured yet or that the new day < the current day,
104 * which means the new day is already passed (so we need to find the 104 * which means the new day is already passed (so we need to find the
105 * day in the next week). 105 * day in the next week).
106 */ 106 */
107 QString dayName; 107 QString dayName;
108 int currentDay = QDate::currentDate().dayOfWeek(); 108 int currentDay = QDate::currentDate().dayOfWeek();
109 for (int i = 1; i <= 7; ++i) 109 for (int i = 1; i <= 7; ++i)
110 { 110 {
111 dayName = KGlobal::locale()->weekDayName(i).lower(); 111 dayName = KGlobal::locale()->weekDayName(i).lower();
112 if (i >= currentDay) 112 if (i >= currentDay)
113 mKeywordMap[dayName] = i - currentDay; 113 mKeywordMap[dayName] = i - currentDay;
114 else 114 else
115 mKeywordMap[dayName] = 7 - currentDay + i; 115 mKeywordMap[dayName] = 7 - currentDay + i;
116 } 116 }
117 117
118 mTextChanged = false; 118 mTextChanged = false;
119 mHandleInvalid = false; 119 mHandleInvalid = false;
120 QWidget::setTabOrder( mDateEdit, mDateButton ); 120 QWidget::setTabOrder( mDateEdit, mDateButton );
121} 121}
122 122
123KDateEdit::~KDateEdit() 123KDateEdit::~KDateEdit()
124{ 124{
125 delete mDateFrame; 125 delete mDateFrame;
126} 126}
127 127void KDateEdit::clear()
128{
129 bool b = mDateEdit->signalsBlocked();
130 mDateEdit->blockSignals(true);
131 mDateEdit->setText("");
132 mDateEdit->blockSignals(b);
133}
128void KDateEdit::setDate(QDate newDate) 134void KDateEdit::setDate(QDate newDate)
129{ 135{
130 if (!newDate.isValid() && !mHandleInvalid) 136 if (!newDate.isValid() && !mHandleInvalid)
131 return; 137 return;
132 if ( readDate() == newDate ) 138 if ( readDate() == newDate )
133 return; 139 return;
134 QString dateString = ""; 140 QString dateString = "";
135 if(newDate.isValid()) 141 if(newDate.isValid())
136 dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); 142 dateString = KGlobal::locale()->formatDate( newDate, dateFormShort );
137 143
138 mTextChanged = false; 144 mTextChanged = false;
139 145
140 // We do not want to generate a signal here, since we explicity setting 146 // We do not want to generate a signal here, since we explicity setting
141 // the date 147 // the date
142 bool b = mDateEdit->signalsBlocked(); 148 bool b = mDateEdit->signalsBlocked();
143 mDateEdit->blockSignals(true); 149 mDateEdit->blockSignals(true);
144 mDateEdit->setText(dateString); 150 mDateEdit->setText(dateString);
145 mDateEdit->blockSignals(b); 151 mDateEdit->blockSignals(b);
146} 152}
147 153
148void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort) 154void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort)
149{ 155{
150 QString dateForm = dateFormShort ? 156 QString dateForm = dateFormShort ?
151 KGlobal::locale()->dateFormatShort() : 157 KGlobal::locale()->dateFormatShort() :
152 KGlobal::locale()->dateFormat(); 158 KGlobal::locale()->dateFormat();
153 159
154 int begin = dateForm.find("%"); 160 int begin = dateForm.find("%");
155 int space = 0; 161 int space = 0;
156 int allStrLength = 0; 162 int allStrLength = 0;
157 int strLength = 0; 163 int strLength = 0;
158 int repeat = 0; 164 int repeat = 0;
159 165
160 // witch? Day, Month or Year switch? 166 // witch? Day, Month or Year switch?
161 while(1){ 167 while(1){
162 switch ( dateForm.at(begin + 1).latin1() ) 168 switch ( dateForm.at(begin + 1).latin1() )
163 { 169 {
164 case 'd':// 16 (month day) 170 case 'd':// 16 (month day)
165 strLength = 2; //Ok 171 strLength = 2; //Ok
166 break; 172 break;
167 case 'm':// 01 (month) 173 case 'm':// 01 (month)
168 strLength = 2; //Ok 174 strLength = 2; //Ok
169 break; 175 break;
170 case 'a':// Mon (Weekday) 176 case 'a':// Mon (Weekday)
171 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); 177 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length();
172 break; 178 break;
173 case 'A':// Monday (Weekday) 179 case 'A':// Monday (Weekday)
174 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); 180 strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length();
175 break; 181 break;
176 case 'b':// Jan (monthName) 182 case 'b':// Jan (monthName)
177 strLength = KGlobal::locale()->monthName(date.month(), true).length(); 183 strLength = KGlobal::locale()->monthName(date.month(), true).length();
178 break; 184 break;
179 case 'B':// January (monthName) 185 case 'B':// January (monthName)
180 strLength = KGlobal::locale()->monthName(date.month(), false).length(); 186 strLength = KGlobal::locale()->monthName(date.month(), false).length();
181 break; 187 break;
182 case 'y':// 04 (year short) 188 case 'y':// 04 (year short)
183 strLength = 2; //Ok 189 strLength = 2; //Ok
184 break; 190 break;
185 case 'Y':// 2004 (year) 191 case 'Y':// 2004 (year)
186 strLength = 4; //Ok 192 strLength = 4; //Ok
187 break; 193 break;
188 default: 194 default:
189 break; 195 break;
190 } 196 }
191 space = begin - (repeat++ * 2); 197 space = begin - (repeat++ * 2);
192 // all select? then dayswitch 198 // all select? then dayswitch
193 if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && 199 if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) &&
194 ( (dateForm.at(begin + 1).latin1() == 'd') || 200 ( (dateForm.at(begin + 1).latin1() == 'd') ||
195 (dateForm.at(begin + 1).latin1() == 'a') || 201 (dateForm.at(begin + 1).latin1() == 'a') ||
196 (dateForm.at(begin + 1).latin1() == 'A') ) ) { 202 (dateForm.at(begin + 1).latin1() == 'A') ) ) {
197 break; 203 break;
198 } 204 }
199 // mDateEdit-StringPos == CursorPosition(cpos) then break and set date 205 // mDateEdit-StringPos == CursorPosition(cpos) then break and set date
200 if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { 206 if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) {
201 break; 207 break;
202 } 208 }
203 allStrLength += strLength; 209 allStrLength += strLength;
204 begin = dateForm.find("%", begin +1); 210 begin = dateForm.find("%", begin +1);
205 } 211 }
206 212
207 // set date 213 // set date
208 switch ( dateForm.at(begin + 1).latin1() ) { 214 switch ( dateForm.at(begin + 1).latin1() ) {
209 case 'd': 215 case 'd':
210 case 'a': 216 case 'a':
211 case 'A': 217 case 'A':
212 if(key == Key_Up) { 218 if(key == Key_Up) {
213 setDate( date.addDays( 1 ) ); 219 setDate( date.addDays( 1 ) );
214 } 220 }
215 else if(key == Key_Down) { 221 else if(key == Key_Down) {
216 setDate( date.addDays( -1 ) ); 222 setDate( date.addDays( -1 ) );
217 } 223 }
218 maxDay = readDate().day(); 224 maxDay = readDate().day();
219 break; 225 break;
220 case 'm': 226 case 'm':
221 case 'b': 227 case 'b':
222 case 'B': 228 case 'B':
223 if(key == Key_Up) { 229 if(key == Key_Up) {
@@ -370,117 +376,122 @@ void KDateEdit::setSelect( int from, int to )
370{ 376{
371// return; 377// return;
372 mDateEdit->setSelection( from , to ); 378 mDateEdit->setSelection( from , to );
373} 379}
374 380
375void KDateEdit::toggleDatePicker() 381void KDateEdit::toggleDatePicker()
376{ 382{
377 if( mDateFrame->isVisible() ) { 383 if( mDateFrame->isVisible() ) {
378 mDateFrame->hide(); 384 mDateFrame->hide();
379 } else { 385 } else {
380 QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); 386 QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight());
381 QSize datepickersize = mDatePicker->sizeHint(); 387 QSize datepickersize = mDatePicker->sizeHint();
382 388
383 if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); 389 if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() );
384 390
385 int h = QApplication::desktop()->height(); 391 int h = QApplication::desktop()->height();
386 392
387 if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); 393 if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() );
388 394
389 mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), 395 mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(),
390 datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); 396 datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth());
391 397
392 QDate date = readDate(); 398 QDate date = readDate();
393 if(date.isValid()) { 399 if(date.isValid()) {
394 mDatePicker->setDate(date); 400 mDatePicker->setDate(date);
395 } else { 401 } else {
396 mDatePicker->setDate(QDate::currentDate()); 402 mDatePicker->setDate(QDate::currentDate());
397 } 403 }
398 mDateFrame->show(); 404 mDateFrame->show();
399 } 405 }
400} 406}
401 407
402 408
403void KDateEdit::lineEnterPressed() 409void KDateEdit::lineEnterPressed()
404{ 410{
405 QDate date = readDate(); 411 QDate date = readDate();
406 412
407 if(date.isValid()) 413 if(date.isValid())
408 { 414 {
409 // Update the edit. This is needed if the user has entered a 415 // Update the edit. This is needed if the user has entered a
410 // word rather than the actual date. 416 // word rather than the actual date.
411 setDate(date); 417 setDate(date);
412 emit(dateChanged(date)); 418 emit(dateChanged(date));
413 emit returnPressed(); 419 emit returnPressed();
414 } 420 }
415 else 421 else
416 { 422 {
417 if ( withoutDp ) { 423 if ( withoutDp ) {
418 KNotifyClient::beep(); 424 KNotifyClient::beep();
419 } else { 425 } else {
420 if ( !mDateEdit->text().isEmpty() ) { 426 if ( !mDateEdit->text().isEmpty() ) {
421 mTextChanged = false; 427 mTextChanged = false;
422 QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); 428 QString text = i18n( "You entered an invalid date!\n Will use current date instead." );
423 if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { 429 if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) {
424 setDate( QDate::currentDate() ); 430 setDate( QDate::currentDate() );
425 emit dateChanged( QDate::currentDate() ); 431 emit dateChanged( QDate::currentDate() );
426 } 432 }
427 } 433 }
428 } 434 }
429 } 435 }
430} 436}
431 437
432bool KDateEdit::inputIsValid() 438bool KDateEdit::inputIsValid()
433{ 439{
434 return readDate().isValid(); 440 return readDate().isValid();
435} 441}
436 442
437QDate KDateEdit::readDate() const 443QDate KDateEdit::readDate() const
438{ 444{
439 QString text = mDateEdit->text(); 445 QString text = mDateEdit->text();
440 QDate date; 446 QDate date;
441 447
442 if (mKeywordMap.contains(text.lower())) 448 if (mKeywordMap.contains(text.lower()))
443 { 449 {
444 date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); 450 date = QDate::currentDate().addDays(mKeywordMap[text.lower()]);
445 } 451 }
446 else 452 else
447 { 453 {
448 date = KGlobal::locale()->readDate(text); 454 date = KGlobal::locale()->readDate(text);
449 } 455 }
450 456
451 return date; 457 return date;
452} 458}
453 459
454bool KDateEdit::eventFilter(QObject *, QEvent *e) 460bool KDateEdit::eventFilter(QObject *, QEvent *e)
455{ 461{
456 // We only process the focus out event if the text has changed 462 // We only process the focus out event if the text has changed
457 // since we got focus 463 // since we got focus
458 if ((e->type() == QEvent::FocusOut) && mTextChanged) 464 if ((e->type() == QEvent::FocusOut) && mTextChanged)
459 { 465 {
460 lineEnterPressed(); 466 lineEnterPressed();
461 mTextChanged = false; 467 mTextChanged = false;
462 } 468 }
463 // switch dateFormShort by double klick with mouse 469 // switch dateFormShort by double klick with mouse
464 else if (e->type() == QEvent::MouseButtonDblClick) 470 else if (e->type() == QEvent::MouseButtonDblClick)
465 { 471 {
466 dateFormShort = dateFormShort?false:true; 472 toggleDateFormat();
467 mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort));
468 } 473 }
469 else if (e->type() == QEvent::FocusIn) 474 else if (e->type() == QEvent::FocusIn)
470 { 475 {
471 maxDay = readDate().day(); 476 maxDay = readDate().day();
472 } 477 }
473 478
474 return false; 479 return false;
475} 480}
481void KDateEdit::toggleDateFormat()
482{
483 dateFormShort = ! dateFormShort;
484 mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort));
485
486}
476 487
477void KDateEdit::textChanged(const QString &) 488void KDateEdit::textChanged(const QString &)
478{ 489{
479 if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { 490 if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) {
480 QDate date; //invalid date 491 QDate date; //invalid date
481 emit(dateChanged(date)); 492 emit(dateChanged(date));
482 } else { 493 } else {
483 mTextChanged = true; 494 mTextChanged = true;
484 } 495 }
485 maxDay = readDate().day(); 496 maxDay = readDate().day();
486} 497}
diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h
index 742d843..cf3b90a 100644
--- a/libkdepim/kdateedit.h
+++ b/libkdepim/kdateedit.h
@@ -1,140 +1,141 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 3
4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef KDATEEDIT_H 24#ifndef KDATEEDIT_H
25#define KDATEEDIT_H 25#define KDATEEDIT_H
26 26
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qvbox.h> 28#include <qvbox.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qmap.h> 30#include <qmap.h>
31 31
32class QLineEdit; 32class QLineEdit;
33class QPushButton; 33class QPushButton;
34class QObject; 34class QObject;
35class QEvent; 35class QEvent;
36class KDatePicker; 36class KDatePicker;
37class KDateValidator; 37class KDateValidator;
38 38
39/** 39/**
40* A date editing widget that consists of a line edit followed by 40* A date editing widget that consists of a line edit followed by
41* a small push button. The line edit contains the date in text form, 41* a small push button. The line edit contains the date in text form,
42* and the push button will display a 'popup' style date picker. 42* and the push button will display a 'popup' style date picker.
43* 43*
44* This widget also supports advanced features like allowing the user 44* This widget also supports advanced features like allowing the user
45* to type in the day name to get the date. The following keywords 45* to type in the day name to get the date. The following keywords
46* are supported (in the native language): tomorrow, yesturday, today, 46* are supported (in the native language): tomorrow, yesturday, today,
47* monday, tuesday, wednesday, thursday, friday, saturday, sunday. 47* monday, tuesday, wednesday, thursday, friday, saturday, sunday.
48* 48*
49* @author Cornelius Schumacher <schumacher@kde.org> 49* @author Cornelius Schumacher <schumacher@kde.org>
50* @author Mike Pilone <mpilone@slac.com> 50* @author Mike Pilone <mpilone@slac.com>
51*/ 51*/
52class KDateEdit : public QHBox 52class KDateEdit : public QHBox
53{ 53{
54 Q_OBJECT 54 Q_OBJECT
55 public: 55 public:
56 KDateEdit(QWidget *parent=0, const char *name=0, bool withoutDP = false ); 56 KDateEdit(QWidget *parent=0, const char *name=0, bool withoutDP = false );
57 virtual ~KDateEdit(); 57 virtual ~KDateEdit();
58 58
59 /** @return True if the date in the text edit is valid, 59 /** @return True if the date in the text edit is valid,
60 * false otherwise. This will not modify the display of the date, 60 * false otherwise. This will not modify the display of the date,
61 * but only check for validity. 61 * but only check for validity.
62 */ 62 */
63 bool inputIsValid(); 63 bool inputIsValid();
64 64
65 /** @return The date entered. This will not 65 /** @return The date entered. This will not
66 * modify the display of the date, but only return it. 66 * modify the display of the date, but only return it.
67 */ 67 */
68 QDate date() const; 68 QDate date() const;
69 69
70 /** @param handleInvalid If true the date edit accepts invalid dates 70 /** @param handleInvalid If true the date edit accepts invalid dates
71 * and displays them as the empty ("") string. It also returns an invalid date. 71 * and displays them as the empty ("") string. It also returns an invalid date.
72 * If false (default) invalid dates are not accepted and instead the date 72 * If false (default) invalid dates are not accepted and instead the date
73 * of today will be returned. 73 * of today will be returned.
74 */ 74 */
75 void setHandleInvalid(bool handleInvalid); 75 void setHandleInvalid(bool handleInvalid);
76 76
77 /** Checks for a focus out event. The display of the date is updated 77 /** Checks for a focus out event. The display of the date is updated
78 * to display the proper date when the focus leaves. 78 * to display the proper date when the focus leaves.
79 */ 79 */
80 virtual bool eventFilter(QObject *o, QEvent *e); 80 virtual bool eventFilter(QObject *o, QEvent *e);
81 81 void toggleDateFormat();
82 void clear();
82 signals: 83 signals:
83 /** This signal is emitted whenever the user modifies the date. This 84 /** This signal is emitted whenever the user modifies the date. This
84 * may not get emitted until the user presses enter in the line edit or 85 * may not get emitted until the user presses enter in the line edit or
85 * focus leaves the widget (ie: the user confirms their selection). 86 * focus leaves the widget (ie: the user confirms their selection).
86 */ 87 */
87 void dateChanged(QDate); 88 void dateChanged(QDate);
88 void returnPressed(); 89 void returnPressed();
89 public slots: 90 public slots:
90 /** Sets the date. 91 /** Sets the date.
91 * 92 *
92 * @param date The new date to display. This date must be valid or 93 * @param date The new date to display. This date must be valid or
93 * it will not be displayed. 94 * it will not be displayed.
94 */ 95 */
95 void setDate(QDate date); 96 void setDate(QDate date);
96 // set Date with key_up key_down to relation of cursor Position 97 // set Date with key_up key_down to relation of cursor Position
97 // and set selection from begin to end of single date 98 // and set selection from begin to end of single date
98 void setDate(QDate, int *cpos, const int, const bool); 99 void setDate(QDate, int *cpos, const int, const bool);
99 100
100 /** Sets the date edit to be enabled or disabled (grayed out) 101 /** Sets the date edit to be enabled or disabled (grayed out)
101 * 102 *
102 * @param on Enabled if true, disabled if false 103 * @param on Enabled if true, disabled if false
103 */ 104 */
104 void setEnabled(bool on); 105 void setEnabled(bool on);
105 106
106 protected slots: 107 protected slots:
107 void toggleDatePicker(); 108 void toggleDatePicker();
108 void lineEnterPressed(); 109 void lineEnterPressed();
109 void textChanged(const QString &); 110 void textChanged(const QString &);
110 111
111 private: 112 private:
112 /** Reads the text from the line edit. If the text is a keyword, the 113 /** Reads the text from the line edit. If the text is a keyword, the
113 * word will be translated to a date. If the text is not a keyword, the 114 * word will be translated to a date. If the text is not a keyword, the
114 * text will be interpreted as a date. 115 * text will be interpreted as a date.
115 */ 116 */
116 QDate readDate() const; 117 QDate readDate() const;
117 118
118 /** Maps the text that the user can enter to the offset in days from 119 /** Maps the text that the user can enter to the offset in days from
119 * today. For example, the text 'tomorrow' is mapped to +1. 120 * today. For example, the text 'tomorrow' is mapped to +1.
120 */ 121 */
121 QMap<QString, int> mKeywordMap; 122 QMap<QString, int> mKeywordMap;
122 bool mTextChanged; 123 bool mTextChanged;
123 bool mHandleInvalid; 124 bool mHandleInvalid;
124 125
125 QPushButton *mDateButton; 126 QPushButton *mDateButton;
126 QLineEdit *mDateEdit; 127 QLineEdit *mDateEdit;
127 KDatePicker *mDatePicker; 128 KDatePicker *mDatePicker;
128 QVBox *mDateFrame; 129 QVBox *mDateFrame;
129 int maxDay; 130 int maxDay;
130 bool withoutDp; 131 bool withoutDp;
131 132
132 protected: 133 protected:
133 virtual void keyPressEvent(QKeyEvent *qke); 134 virtual void keyPressEvent(QKeyEvent *qke);
134 void setSelect ( int, int ); 135 void setSelect ( int, int );
135 bool dateFormShort; 136 bool dateFormShort;
136 char lengthMonthName; 137 char lengthMonthName;
137 138
138}; 139};
139 140
140#endif 141#endif
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp
index 77d36a5..d38a6d5 100644
--- a/microkde/kdeui/kaction.cpp
+++ b/microkde/kdeui/kaction.cpp
@@ -119,193 +119,192 @@ KAction::KAction( const QString& text, const KShortcut& cut,
119: QObject( parent, name ) 119: QObject( parent, name )
120{ 120{
121 initPrivate( text, cut, receiver, slot ); 121 initPrivate( text, cut, receiver, slot );
122} 122}
123 123
124KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut, 124KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut,
125 const QObject* receiver, const char* slot, 125 const QObject* receiver, const char* slot,
126 KActionCollection* parent, const char* name ) 126 KActionCollection* parent, const char* name )
127: QObject( parent, name ) 127: QObject( parent, name )
128{ 128{
129 initPrivate( text, cut, receiver, slot ); 129 initPrivate( text, cut, receiver, slot );
130 d->setIconName( sIconName ); 130 d->setIconName( sIconName );
131} 131}
132 132
133KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 133KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
134 const QObject* receiver, const char* slot, 134 const QObject* receiver, const char* slot,
135 KActionCollection* parent, const char* name ) 135 KActionCollection* parent, const char* name )
136: QObject( parent, name ) 136: QObject( parent, name )
137{ 137{
138 initPrivate( text, cut, receiver, slot ); 138 initPrivate( text, cut, receiver, slot );
139 d->setIconSet( pix ); 139 d->setIconSet( pix );
140} 140}
141KAction::KAction( const KGuiItem& item, const KShortcut& cut, 141KAction::KAction( const KGuiItem& item, const KShortcut& cut,
142 const QObject* receiver, const char* slot, 142 const QObject* receiver, const char* slot,
143 KActionCollection* parent, const char* name ) 143 KActionCollection* parent, const char* name )
144: QObject( parent, name ) 144: QObject( parent, name )
145{ 145{
146 initPrivate( item.text(), cut, receiver, slot ); 146 initPrivate( item.text(), cut, receiver, slot );
147 if( item.hasIconSet() ) 147 if( item.hasIconSet() )
148 setIcon( item.iconName() ); 148 setIcon( item.iconName() );
149 setToolTip( item.toolTip() ); 149 setToolTip( item.toolTip() );
150 setWhatsThis( item.whatsThis() ); 150 setWhatsThis( item.whatsThis() );
151} 151}
152 152
153// KDE 4: remove 153// KDE 4: remove
154KAction::KAction( const QString& text, const KShortcut& cut, 154KAction::KAction( const QString& text, const KShortcut& cut,
155 QObject* parent, const char* name ) 155 QObject* parent, const char* name )
156 : QObject( parent, name ) 156 : QObject( parent, name )
157{ 157{
158 initPrivate( text, cut, 0, 0 ); 158 initPrivate( text, cut, 0, 0 );
159} 159}
160KAction::KAction( const QString& text, const KShortcut& cut, 160KAction::KAction( const QString& text, const KShortcut& cut,
161 const QObject* receiver, 161 const QObject* receiver,
162 const char* slot, QObject* parent, const char* name ) 162 const char* slot, QObject* parent, const char* name )
163 : QObject( parent, name ) 163 : QObject( parent, name )
164{ 164{
165 initPrivate( text, cut, receiver, slot ); 165 initPrivate( text, cut, receiver, slot );
166} 166}
167KAction::KAction( const QString& text, const QIconSet& pix, 167KAction::KAction( const QString& text, const QIconSet& pix,
168 const KShortcut& cut, 168 const KShortcut& cut,
169 QObject* parent, const char* name ) 169 QObject* parent, const char* name )
170 : QObject( parent, name ) 170 : QObject( parent, name )
171{ 171{
172 initPrivate( text, cut, 0, 0 ); 172 initPrivate( text, cut, 0, 0 );
173 setIconSet( pix ); 173 setIconSet( pix );
174} 174}
175 175
176KAction::KAction( const QString& text, const QString& pix, 176KAction::KAction( const QString& text, const QString& pix,
177 const KShortcut& cut, 177 const KShortcut& cut,
178 QObject* parent, const char* name ) 178 QObject* parent, const char* name )
179: QObject( parent, name ) 179: QObject( parent, name )
180{ 180{
181 initPrivate( text, cut, 0, 0 ); 181 initPrivate( text, cut, 0, 0 );
182 d->setIconName( pix ); 182 d->setIconName( pix );
183} 183}
184 184
185KAction::KAction( const QString& text, const QIconSet& pix, 185KAction::KAction( const QString& text, const QIconSet& pix,
186 const KShortcut& cut, 186 const KShortcut& cut,
187 const QObject* receiver, const char* slot, QObject* parent, 187 const QObject* receiver, const char* slot, QObject* parent,
188 const char* name ) 188 const char* name )
189 : QObject( parent, name ) 189 : QObject( parent, name )
190{ 190{
191 initPrivate( text, cut, receiver, slot ); 191 initPrivate( text, cut, receiver, slot );
192 setIconSet( pix ); 192 setIconSet( pix );
193} 193}
194 194
195KAction::KAction( const QString& text, const QString& pix, 195KAction::KAction( const QString& text, const QString& pix,
196 const KShortcut& cut, 196 const KShortcut& cut,
197 const QObject* receiver, const char* slot, QObject* parent, 197 const QObject* receiver, const char* slot, QObject* parent,
198 const char* name ) 198 const char* name )
199 : QObject( parent, name ) 199 : QObject( parent, name )
200{ 200{
201 initPrivate( text, cut, receiver, slot ); 201 initPrivate( text, cut, receiver, slot );
202 d->setIconName(pix); 202 d->setIconName(pix);
203} 203}
204 204
205KAction::KAction( QObject* parent, const char* name ) 205KAction::KAction( QObject* parent, const char* name )
206 : QObject( parent, name ) 206 : QObject( parent, name )
207{ 207{
208 208
209 initPrivate( QString::null, KShortcut(), 0, 0 ); 209 initPrivate( QString::null, KShortcut(), 0, 0 );
210} 210}
211// KDE 4: remove end 211// KDE 4: remove end
212 212
213KAction::~KAction() 213KAction::~KAction()
214{ 214{
215 kdDebug(129) << "KAction::~KAction( this = \"" << name() << "\" )" << endl; // -- ellis
216#ifndef KDE_NO_COMPAT 215#ifndef KDE_NO_COMPAT
217 if (d->m_kaccel) 216 if (d->m_kaccel)
218 unplugAccel(); 217 unplugAccel();
219#endif 218#endif
220 219
221 // If actionCollection hasn't already been destructed, 220 // If actionCollection hasn't already been destructed,
222 if ( m_parentCollection ) { 221 if ( m_parentCollection ) {
223 m_parentCollection->take( this ); 222 m_parentCollection->take( this );
224 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) 223 for( uint i = 0; i < d->m_kaccelList.count(); i++ )
225//US d->m_kaccelList[i]->remove( name() ); 224//US d->m_kaccelList[i]->remove( name() );
226 qDebug("KAction::KAction~ ...1 has top be fixed"); 225 qDebug("KAction::KAction~ ...1 has top be fixed");
227 } 226 }
228 227
229 // Do not call unplugAll from here, as tempting as it sounds. 228 // Do not call unplugAll from here, as tempting as it sounds.
230 // KAction is designed around the idea that you need to plug 229 // KAction is designed around the idea that you need to plug
231 // _and_ to unplug it "manually". Unplugging leads to an important 230 // _and_ to unplug it "manually". Unplugging leads to an important
232 // slowdown when e.g. closing the window, in which case we simply 231 // slowdown when e.g. closing the window, in which case we simply
233 // want to destroy everything asap, not to remove actions one by one 232 // want to destroy everything asap, not to remove actions one by one
234 // from the GUI. 233 // from the GUI.
235 234
236 delete d; d = 0; 235 delete d; d = 0;
237} 236}
238 237
239void KAction::initPrivate( const QString& text, const KShortcut& cut, 238void KAction::initPrivate( const QString& text, const KShortcut& cut,
240 const QObject* receiver, const char* slot ) 239 const QObject* receiver, const char* slot )
241{ 240{
242 d = new KActionPrivate; 241 d = new KActionPrivate;
243 242
244 d->m_cutDefault = cut; 243 d->m_cutDefault = cut;
245 244
246//US m_parentCollection = dynamic_cast<KActionCollection *>( parent() ); 245//US m_parentCollection = dynamic_cast<KActionCollection *>( parent() );
247 m_parentCollection = (KActionCollection *)( parent() ); 246 m_parentCollection = (KActionCollection *)( parent() );
248 kdDebug(129) << "KAction::initPrivate(): this = " << this << " name = \"" << name() << "\" cut = " << cut.toStringInternal() << " m_parentCollection = " << m_parentCollection << endl; 247 kdDebug(129) << "KAction::initPrivate(): this = " << this << " name = \"" << name() << "\" cut = " << cut.toStringInternal() << " m_parentCollection = " << m_parentCollection << endl;
249 if ( m_parentCollection ) 248 if ( m_parentCollection )
250 m_parentCollection->insert( this ); 249 m_parentCollection->insert( this );
251 250
252 if ( receiver && slot ) 251 if ( receiver && slot )
253 connect( this, SIGNAL( activated() ), receiver, slot ); 252 connect( this, SIGNAL( activated() ), receiver, slot );
254 253
255 if( !cut.isNull() && qstrcmp( name(), "unnamed" ) == 0 ) 254 if( !cut.isNull() && qstrcmp( name(), "unnamed" ) == 0 )
256 kdWarning(129) << "KAction::initPrivate(): trying to assign a shortcut (" << cut.toStringInternal() << ") to an unnamed action." << endl; 255 kdWarning(129) << "KAction::initPrivate(): trying to assign a shortcut (" << cut.toStringInternal() << ") to an unnamed action." << endl;
257 d->setText( text ); 256 d->setText( text );
258 initShortcut( cut ); 257 initShortcut( cut );
259 258
260} 259}
261 260
262bool KAction::isPlugged() const 261bool KAction::isPlugged() const
263{ 262{
264 return (containerCount() > 0) || d->m_kaccel; 263 return (containerCount() > 0) || d->m_kaccel;
265} 264}
266 265
267bool KAction::isPlugged( const QWidget *container ) const 266bool KAction::isPlugged( const QWidget *container ) const
268{ 267{
269 return findContainer( container ) > -1; 268 return findContainer( container ) > -1;
270} 269}
271 270
272bool KAction::isPlugged( const QWidget *container, int id ) const 271bool KAction::isPlugged( const QWidget *container, int id ) const
273{ 272{
274 int i = findContainer( container ); 273 int i = findContainer( container );
275 return ( i > -1 && itemId( i ) == id ); 274 return ( i > -1 && itemId( i ) == id );
276} 275}
277 276
278bool KAction::isPlugged( const QWidget *container, const QWidget *_representative ) const 277bool KAction::isPlugged( const QWidget *container, const QWidget *_representative ) const
279{ 278{
280 int i = findContainer( container ); 279 int i = findContainer( container );
281 return ( i > -1 && representative( i ) == _representative ); 280 return ( i > -1 && representative( i ) == _representative );
282} 281}
283 282
284 283
285/* 284/*
286Three actionCollection conditions: 285Three actionCollection conditions:
287 1) Scope is known on creation and KAccel object is created (e.g. KMainWindow) 286 1) Scope is known on creation and KAccel object is created (e.g. KMainWindow)
288 2) Scope is unknown and no KAccel object is available (e.g. KXMLGUIClient) 287 2) Scope is unknown and no KAccel object is available (e.g. KXMLGUIClient)
289 a) addClient() will be called on object 288 a) addClient() will be called on object
290 b) we just want to add the actions to another KXMLGUIClient object 289 b) we just want to add the actions to another KXMLGUIClient object
291 290
292The question is how to do we incorporate #2b into the XMLGUI framework? 291The question is how to do we incorporate #2b into the XMLGUI framework?
293 292
294 293
295We have a KCommandHistory object with undo and redo actions in a passed actionCollection 294We have a KCommandHistory object with undo and redo actions in a passed actionCollection
296We have a KoDoc object which holds a KCommandHistory object and the actionCollection 295We have a KoDoc object which holds a KCommandHistory object and the actionCollection
297We have two KoView objects which both point to the same KoDoc object 296We have two KoView objects which both point to the same KoDoc object
298Undo and Redo should be available in both KoView objects, and 297Undo and Redo should be available in both KoView objects, and
299 calling the undo->setEnabled() should affect both KoViews 298 calling the undo->setEnabled() should affect both KoViews
300 299
301When addClient is called, it needs to be able to find the undo and redo actions 300When addClient is called, it needs to be able to find the undo and redo actions
302When it calls plug() on them, they need to be inserted into the KAccel object of the appropriate KoView 301When it calls plug() on them, they need to be inserted into the KAccel object of the appropriate KoView
303 302
304In this case, the actionCollection belongs to KoDoc and we need to let it know that its shortcuts 303In this case, the actionCollection belongs to KoDoc and we need to let it know that its shortcuts
305have the same scope as the KoView actionCollection 304have the same scope as the KoView actionCollection
306 305
307KXMLGUIClient::addSubActionCollection 306KXMLGUIClient::addSubActionCollection
308 307
309Document: 308Document:
310 create document actions 309 create document actions
311 310
@@ -342,673 +341,674 @@ shortcut may be set:
342 341
343On Construction: [via initShortcut()] 342On Construction: [via initShortcut()]
344 insert into KAccel of m_parentCollection, 343 insert into KAccel of m_parentCollection,
345 if kaccel() && isAutoConnectShortcuts() exists 344 if kaccel() && isAutoConnectShortcuts() exists
346 345
347On Plug: [via plug() -> plugShortcut()] 346On Plug: [via plug() -> plugShortcut()]
348 insert into KAccel of m_parentCollection, if exists and not already inserted into 347 insert into KAccel of m_parentCollection, if exists and not already inserted into
349 348
350On Read XML: [via setShortcut()] 349On Read XML: [via setShortcut()]
351 set in all current KAccels 350 set in all current KAccels
352 insert into KAccel of m_parentCollection, if exists and not already inserted into 351 insert into KAccel of m_parentCollection, if exists and not already inserted into
353*/ 352*/
354 353
355KAccel* KAction::kaccelCurrent() 354KAccel* KAction::kaccelCurrent()
356{ 355{
357 if( m_parentCollection && m_parentCollection->builderKAccel() ) 356 if( m_parentCollection && m_parentCollection->builderKAccel() )
358 return m_parentCollection->builderKAccel(); 357 return m_parentCollection->builderKAccel();
359 else if( m_parentCollection && m_parentCollection->kaccel() ) 358 else if( m_parentCollection && m_parentCollection->kaccel() )
360 return m_parentCollection->kaccel(); 359 return m_parentCollection->kaccel();
361 else 360 else
362 return 0L; 361 return 0L;
363} 362}
364 363
365// Only to be called from initPrivate() 364// Only to be called from initPrivate()
366bool KAction::initShortcut( const KShortcut& cut ) 365bool KAction::initShortcut( const KShortcut& cut )
367{ 366{
368 d->m_cut = cut; 367 d->m_cut = cut;
369 368
370 // Only insert action into KAccel if it has a valid name, 369 // Only insert action into KAccel if it has a valid name,
371 if( qstrcmp( name(), "unnamed" ) != 0 && 370 if( qstrcmp( name(), "unnamed" ) != 0 &&
372 m_parentCollection && 371 m_parentCollection &&
373 m_parentCollection->isAutoConnectShortcuts() && 372 m_parentCollection->isAutoConnectShortcuts() &&
374 m_parentCollection->kaccel() ) 373 m_parentCollection->kaccel() )
375 { 374 {
376 insertKAccel( m_parentCollection->kaccel() ); 375 insertKAccel( m_parentCollection->kaccel() );
377 return true; 376 return true;
378 } 377 }
379 return false; 378 return false;
380 } 379 }
381 380
382// Only to be called from plug() 381// Only to be called from plug()
383void KAction::plugShortcut() 382void KAction::plugShortcut()
384{ 383{
385 KAccel* kaccel = kaccelCurrent(); 384 KAccel* kaccel = kaccelCurrent();
386 385
387 //kdDebug(129) << "KAction::plugShortcut(): this = " << this << " kaccel() = " << (m_parentCollection ? m_parentCollection->kaccel() : 0) << endl; 386 //kdDebug(129) << "KAction::plugShortcut(): this = " << this << " kaccel() = " << (m_parentCollection ? m_parentCollection->kaccel() : 0) << endl;
388 if( kaccel && qstrcmp( name(), "unnamed" ) != 0 ) { 387 if( kaccel && qstrcmp( name(), "unnamed" ) != 0 ) {
389 // Check if already plugged into current KAccel object 388 // Check if already plugged into current KAccel object
390 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { 389 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
391 if( d->m_kaccelList[i] == kaccel ) 390 if( d->m_kaccelList[i] == kaccel )
392 return; 391 return;
393 } 392 }
394 393
395 insertKAccel( kaccel ); 394 insertKAccel( kaccel );
396 } 395 }
397} 396}
398 397
399bool KAction::setShortcut( const KShortcut& cut ) 398bool KAction::setShortcut( const KShortcut& cut )
400{ 399{
401 qDebug("KAction::setShortcut~ ...1 has top be fixed"); 400 qDebug("KAction::setShortcut~ ...1 has top be fixed");
402/*US 401/*US
403 bool bChanged = (d->m_cut != cut); 402 bool bChanged = (d->m_cut != cut);
404 d->m_cut = cut; 403 d->m_cut = cut;
405 404
406 KAccel* kaccel = kaccelCurrent(); 405 KAccel* kaccel = kaccelCurrent();
407 bool bInsertRequired = true; 406 bool bInsertRequired = true;
408 // Apply new shortcut to all existing KAccel objects 407 // Apply new shortcut to all existing KAccel objects
409 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { 408 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
410 // Check whether shortcut has already been plugged into 409 // Check whether shortcut has already been plugged into
411 // the current kaccel object. 410 // the current kaccel object.
412 if( d->m_kaccelList[i] == kaccel ) 411 if( d->m_kaccelList[i] == kaccel )
413 bInsertRequired = false; 412 bInsertRequired = false;
414 if( bChanged ) 413 if( bChanged )
415 updateKAccelShortcut( d->m_kaccelList[i] ); 414 updateKAccelShortcut( d->m_kaccelList[i] );
416 } 415 }
417 416
418 // Only insert action into KAccel if it has a valid name, 417 // Only insert action into KAccel if it has a valid name,
419 if( kaccel && bInsertRequired && qstrcmp( name(), "unnamed" ) ) 418 if( kaccel && bInsertRequired && qstrcmp( name(), "unnamed" ) )
420 insertKAccel( kaccel ); 419 insertKAccel( kaccel );
421 420
422 if( bChanged ) { 421 if( bChanged ) {
423 // KDE 4: remove 422 // KDE 4: remove
424 if ( d->m_kaccel ) 423 if ( d->m_kaccel )
425 d->m_kaccel->setShortcut( name(), cut ); 424 d->m_kaccel->setShortcut( name(), cut );
426 // KDE 4: remove end 425 // KDE 4: remove end
427 int len = containerCount(); 426 int len = containerCount();
428 for( int i = 0; i < len; ++i ) 427 for( int i = 0; i < len; ++i )
429 updateShortcut( i ); 428 updateShortcut( i );
430 } 429 }
431*/ 430*/
432 431
433 return true; 432 return true;
434} 433}
435 434
436bool KAction::updateKAccelShortcut( KAccel* kaccel ) 435bool KAction::updateKAccelShortcut( KAccel* kaccel )
437{ 436{
438 qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); 437 //qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed");
438
439 // Check if action is permitted 439 // Check if action is permitted
440/*US 440/*US
441 if (kapp && !kapp->authorizeKAction(name())) 441 if (kapp && !kapp->authorizeKAction(name()))
442 return false; 442 return false;
443 443
444 bool b = true; 444 bool b = true;
445 445
446 if ( !kaccel->actions().actionPtr( name() ) ) { 446 if ( !kaccel->actions().actionPtr( name() ) ) {
447 if(!d->m_cut.isNull() ) { 447 if(!d->m_cut.isNull() ) {
448 kdDebug(129) << "Inserting " << name() << ", " << d->text() << ", " << d->plainText() << endl; 448 kdDebug(129) << "Inserting " << name() << ", " << d->text() << ", " << d->plainText() << endl;
449 b = kaccel->insert( name(), d->plainText(), QString::null, 449 b = kaccel->insert( name(), d->plainText(), QString::null,
450 d->m_cut, 450 d->m_cut,
451 this, SLOT(slotActivated()), 451 this, SLOT(slotActivated()),
452 isShortcutConfigurable(), isEnabled() ); 452 isShortcutConfigurable(), isEnabled() );
453 } 453 }
454 } 454 }
455 else 455 else
456 b = kaccel->setShortcut( name(), d->m_cut ); 456 b = kaccel->setShortcut( name(), d->m_cut );
457 457
458 return b; 458 return b;
459*/ 459*/
460 return true; 460 return true;
461} 461}
462 462
463void KAction::insertKAccel( KAccel* kaccel ) 463void KAction::insertKAccel( KAccel* kaccel )
464{ 464{
465 qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); 465 //qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed");
466
466/*US 467/*US
467 //kdDebug(129) << "KAction::insertKAccel( " << kaccel << " ): this = " << this << endl; 468 //kdDebug(129) << "KAction::insertKAccel( " << kaccel << " ): this = " << this << endl;
468 if ( !kaccel->actions().actionPtr( name() ) ) { 469 if ( !kaccel->actions().actionPtr( name() ) ) {
469 if( updateKAccelShortcut( kaccel ) ) { 470 if( updateKAccelShortcut( kaccel ) ) {
470 d->m_kaccelList.append( kaccel ); 471 d->m_kaccelList.append( kaccel );
471 connect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); 472 connect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
472 } 473 }
473 } 474 }
474 else 475 else
475 kdWarning(129) << "KAction::insertKAccel( kaccel = " << kaccel << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis 476 kdWarning(129) << "KAction::insertKAccel( kaccel = " << kaccel << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis
476*/ 477*/
477} 478}
478 479
479void KAction::removeKAccel( KAccel* kaccel ) 480void KAction::removeKAccel( KAccel* kaccel )
480{ 481{
481 qDebug("KAction::removeKAccel~ ...1 has top be fixed"); 482 // qDebug("KAction::removeKAccel~ ...1 has top be fixed");
483
482/*US 484/*US
483 //kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl; 485 //kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl;
484 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { 486 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
485 if( d->m_kaccelList[i] == kaccel ) { 487 if( d->m_kaccelList[i] == kaccel ) {
486 kaccel->remove( name() ); 488 kaccel->remove( name() );
487 d->m_kaccelList.remove( d->m_kaccelList.at( i ) ); 489 d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
488 disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); 490 disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
489 break; 491 break;
490 } 492 }
491 } 493 }
492*/ 494*/
493} 495}
494 496
495// KDE 4: remove 497// KDE 4: remove
496void KAction::setAccel( int keyQt ) 498void KAction::setAccel( int keyQt )
497{ 499{
498 setShortcut( KShortcut(keyQt) ); 500 setShortcut( KShortcut(keyQt) );
499} 501}
500// KDE 4: remove end 502// KDE 4: remove end
501 503
502void KAction::updateShortcut( int i ) 504void KAction::updateShortcut( int i )
503{ 505{
504 int id = itemId( i ); 506 int id = itemId( i );
505 507
506 QWidget* w = container( i ); 508 QWidget* w = container( i );
507 if ( w->inherits( "QPopupMenu" ) ) { 509 if ( w->inherits( "QPopupMenu" ) ) {
508 QPopupMenu* menu = static_cast<QPopupMenu*>(w); 510 QPopupMenu* menu = static_cast<QPopupMenu*>(w);
509 updateShortcut( menu, id ); 511 updateShortcut( menu, id );
510 } 512 }
511 else if ( w->inherits( "QMenuBar" ) ) 513 else if ( w->inherits( "QMenuBar" ) )
512//US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id ); 514//US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id );
513//US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); 515//US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id );
514 qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); 516
517 ; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed");
515 518
516} 519}
517 520
518void KAction::updateShortcut( QPopupMenu* menu, int id ) 521void KAction::updateShortcut( QPopupMenu* menu, int id )
519{ 522{
520/*US 523/*US
521 //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; 524 //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
522 // If the action has a KAccel object, 525 // If the action has a KAccel object,
523 // show the string representation of its shortcut. 526 // show the string representation of its shortcut.
524 if ( d->m_kaccel || d->m_kaccelList.count() ) { 527 if ( d->m_kaccel || d->m_kaccelList.count() ) {
525 QString s = menu->text( id ); 528 QString s = menu->text( id );
526 int i = s.find( '\t' ); 529 int i = s.find( '\t' );
527 if ( i >= 0 ) 530 if ( i >= 0 )
528 s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() ); 531 s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() );
529 else 532 else
530 s += "\t" + d->m_cut.seq(0).toString(); 533 s += "\t" + d->m_cut.seq(0).toString();
531 534
532 menu->changeItem( id, s ); 535 menu->changeItem( id, s );
533 } 536 }
534 // Otherwise insert the shortcut itself into the popup menu. 537 // Otherwise insert the shortcut itself into the popup menu.
535 else { 538 else {
536 // This is a fall-hack in case the KAction is missing a proper parent collection. 539 // This is a fall-hack in case the KAction is missing a proper parent collection.
537 // It should be removed eventually. --ellis 540 // It should be removed eventually. --ellis
538 menu->setAccel( d->m_cut.keyCodeQt(), id ); 541 menu->setAccel( d->m_cut.keyCodeQt(), id );
539 kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl; 542 kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl;
540 } 543 }
541*/ 544*/
542 qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed"); 545
546
547//qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed");
543 548
544} 549}
545 550
546const KShortcut& KAction::shortcut() const 551const KShortcut& KAction::shortcut() const
547{ 552{
548 return d->m_cut; 553 return d->m_cut;
549} 554}
550 555
551const KShortcut& KAction::shortcutDefault() const 556const KShortcut& KAction::shortcutDefault() const
552{ 557{
553 return d->m_cutDefault; 558 return d->m_cutDefault;
554} 559}
555 560
556QString KAction::shortcutText() const 561QString KAction::shortcutText() const
557{ 562{
558 return d->m_cut.toStringInternal(); 563 return d->m_cut.toStringInternal();
559} 564}
560 565
561void KAction::setShortcutText( const QString& s ) 566void KAction::setShortcutText( const QString& s )
562{ 567{
563 setShortcut( KShortcut(s) ); 568 setShortcut( KShortcut(s) );
564} 569}
565 570
566int KAction::accel() const 571int KAction::accel() const
567{ 572{
568 qDebug("KAction::accel() ...1 has top be fixed"); 573 // qDebug("KAction::accel() ...1 has top be fixed");
569//US return d->m_cut.keyCodeQt(); 574//US return d->m_cut.keyCodeQt();
570 return 0; 575 return 0;
571} 576}
572 577
573void KAction::setGroup( const QString& grp ) 578void KAction::setGroup( const QString& grp )
574{ 579{
575 d->m_group = grp; 580 d->m_group = grp;
576 581
577 int len = containerCount(); 582 int len = containerCount();
578 for( int i = 0; i < len; ++i ) 583 for( int i = 0; i < len; ++i )
579 updateGroup( i ); 584 updateGroup( i );
580} 585}
581 586
582void KAction::updateGroup( int ) 587void KAction::updateGroup( int )
583{ 588{
584 // DO SOMETHING 589 // DO SOMETHING
585} 590}
586 591
587QString KAction::group() const 592QString KAction::group() const
588{ 593{
589 return d->m_group; 594 return d->m_group;
590} 595}
591 596
592bool KAction::isEnabled() const 597bool KAction::isEnabled() const
593{ 598{
594 return d->isEnabled(); 599 return d->isEnabled();
595} 600}
596 601
597bool KAction::isShortcutConfigurable() const 602bool KAction::isShortcutConfigurable() const
598{ 603{
599 return d->m_configurable; 604 return d->m_configurable;
600} 605}
601 606
602void KAction::setToolTip( const QString& tt ) 607void KAction::setToolTip( const QString& tt )
603{ 608{
604 qDebug("KAction::setToolTip ...1 has top be fixed"); 609 //qDebug("KAction::setToolTip ...1 has top be fixed");
605 d->setToolTip( tt ); 610 d->setToolTip( tt );
606 611
607 int len = containerCount(); 612 int len = containerCount();
608 for( int i = 0; i < len; ++i ) 613 for( int i = 0; i < len; ++i )
609 updateToolTip( i ); 614 updateToolTip( i );
610} 615}
611 616
612void KAction::updateToolTip( int i ) 617void KAction::updateToolTip( int i )
613{ 618{
614 qDebug("KAction::updateToolTip ...1 has top be fixed"); 619 //qDebug("KAction::updateToolTip ...1 has top be fixed");
615 QWidget *w = container( i ); 620 QWidget *w = container( i );
616 621
617 if ( w->inherits( "KToolBar" ) ) 622 if ( w->inherits( "KToolBar" ) )
618 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); 623 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
619 else if ( w->inherits( "QToolBar" ) ) 624 else if ( w->inherits( "QToolBar" ) )
620 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); 625 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
621} 626}
622 627
623QString KAction::toolTip() const 628QString KAction::toolTip() const
624{ 629{
625 return d->toolTip(); 630 return d->toolTip();
626} 631}
627 632
628int KAction::plug( QWidget *w, int index ) 633int KAction::plug( QWidget *w, int index )
629{ 634{
630 //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; 635 //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl;
631 if (w == 0) { 636 if (w == 0) {
632 kdWarning(129) << "KAction::plug called with 0 argument\n"; 637 kdWarning(129) << "KAction::plug called with 0 argument\n";
633 return -1; 638 return -1;
634 } 639 }
635 640
636#ifndef NDEBUG 641
637 KAccel* kaccel = kaccelCurrent();
638 // If there is a shortcut, but no KAccel available
639 if( !d->m_cut.isNull() && kaccel == 0 ) {
640 kdWarning(129) << "KAction::plug(): has no KAccel object; this = " << this << " name = " << name() << " parentCollection = " << m_parentCollection << endl; // ellis
641//US kdDebug(129) << kdBacktrace() << endl;
642 }
643#endif
644 642
645 // Check if action is permitted 643 // Check if action is permitted
646//US if (kapp && !kapp->authorizeKAction(name())) 644//US if (kapp && !kapp->authorizeKAction(name()))
647//US return -1; 645//US return -1;
648 646
649 plugShortcut(); 647 plugShortcut();
650 648
651 if ( w->inherits("QPopupMenu") ) 649 if ( w->inherits("QPopupMenu") )
652 { 650 {
653 QPopupMenu* menu = static_cast<QPopupMenu*>( w ); 651 QPopupMenu* menu = static_cast<QPopupMenu*>( w );
654 int id; 652 int id;
655 // Don't insert shortcut into menu if it's already in a KAccel object. 653 // Don't insert shortcut into menu if it's already in a KAccel object.
656 //qDebug("KAction::plug warning: real shortcuts not available yet. "); 654 //qDebug("KAction::plug warning: real shortcuts not available yet. ");
657//US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt(); 655//US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt();
658 int keyQt = 0; 656 int keyQt = 0;
659 657
660 if ( d->hasIcon() ) 658 if ( d->hasIcon() )
661 { 659 {
662/*US 660/*US
663 KInstance *instance; 661 KInstance *instance;
664 if ( m_parentCollection ) 662 if ( m_parentCollection )
665 instance = m_parentCollection->instance(); 663 instance = m_parentCollection->instance();
666 else 664 else
667 instance = KGlobal::instance(); 665 instance = KGlobal::instance();
668*/ 666*/
669 id = menu->insertItem( d->iconSet( KIcon::Small, 0/*US , instance */), d->text(), this,//dsweet 667 id = menu->insertItem( d->iconSet( KIcon::Small, 0/*US , instance */), d->text(), this,//dsweet
670 SLOT( slotActivated() ), keyQt, 668 SLOT( slotActivated() ), keyQt,
671 -1, index ); 669 -1, index );
672 } 670 }
673 else 671 else
674 id = menu->insertItem( d->text(), this, 672 id = menu->insertItem( d->text(), this,
675 SLOT( slotActivated() ), //dsweet 673 SLOT( slotActivated() ), //dsweet
676 keyQt, -1, index ); 674 keyQt, -1, index );
677 675
678 // If the shortcut is already in a KAccel object, then 676 // If the shortcut is already in a KAccel object, then
679 // we need to set the menu item's shortcut text. 677 // we need to set the menu item's shortcut text.
680/*US if ( d->m_kaccelList.count() || d->m_kaccel ) 678/*US if ( d->m_kaccelList.count() || d->m_kaccel )
681 updateShortcut( menu, id ); 679 updateShortcut( menu, id );
682*/ 680*/
683 // call setItemEnabled only if the item really should be disabled, 681 // call setItemEnabled only if the item really should be disabled,
684 // because that method is slow and the item is per default enabled 682 // because that method is slow and the item is per default enabled
685 if ( !d->isEnabled() ) 683 if ( !d->isEnabled() )
686 menu->setItemEnabled( id, false ); 684 menu->setItemEnabled( id, false );
687 685
688 if ( !d->whatsThis().isEmpty() ) 686 if ( !d->whatsThis().isEmpty() )
689 menu->setWhatsThis( id, whatsThisWithIcon() ); 687 menu->setWhatsThis( id, whatsThisWithIcon() );
690 688
691 addContainer( menu, id ); 689 addContainer( menu, id );
692 connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); 690 connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
693 691
694 if ( m_parentCollection ) 692 if ( m_parentCollection )
695 m_parentCollection->connectHighlight( menu, this ); 693 m_parentCollection->connectHighlight( menu, this );
696 694
697 return d->m_containers.count() - 1; 695 return d->m_containers.count() - 1;
698 } 696 }
699 else if ( w->inherits( "KToolBar" ) ) 697 else if ( w->inherits( "KToolBar" ) )
700 { 698 {
701 KToolBar *bar = static_cast<KToolBar *>( w ); 699 KToolBar *bar = static_cast<KToolBar *>( w );
702 700
703 int id_ = getToolButtonID(); 701 int id_ = getToolButtonID();
704/*US 702/*US
705 KInstance *instance; 703 KInstance *instance;
706 if ( m_parentCollection ) 704 if ( m_parentCollection )
707 instance = m_parentCollection->instance(); 705 instance = m_parentCollection->instance();
708 else 706 else
709 instance = KGlobal::instance(); 707 instance = KGlobal::instance();
710*/ 708*/
711 if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly 709 if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly
712 { 710 {
713 bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this, 711 bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this,
714 SLOT( slotActivated() ), 712 SLOT( slotActivated() ),
715 d->isEnabled(), d->plainText(), index ); 713 d->isEnabled(), d->plainText(), index );
716 } 714 }
717 else 715 else
718 { 716 {
719 QString icon = d->iconName(); 717 QString icon = d->iconName();
720 if ( icon.isEmpty() ) 718 if ( icon.isEmpty() )
721 icon = "unknown"; 719 icon = "unknown";
722 bar->insertButton( icon, id_, SIGNAL( clicked() ), this, 720 bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
723 SLOT( slotActivated() ), 721 SLOT( slotActivated() ),
724 d->isEnabled(), d->plainText(), index/*US, instance*/ ); 722 d->isEnabled(), d->plainText(), index/*US, instance*/ );
725 } 723 }
726 bar->getButton( id_ )->setName( QCString("toolbutton_")+name() ); 724 bar->getButton( id_ )->setName( QCString("toolbutton_")+name() );
727 725
728//US if ( !d->whatsThis().isEmpty() ) 726//US if ( !d->whatsThis().isEmpty() )
729//US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() ); 727//US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() );
730 if ( !d->toolTip().isEmpty() ) 728 if ( !d->toolTip().isEmpty() )
731 QToolTip::add( bar->getButton(id_), d->toolTip() ); 729 QToolTip::add( bar->getButton(id_), d->toolTip() );
732 730
733 addContainer( bar, id_ ); 731 addContainer( bar, id_ );
734 732
735 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); 733 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
736 734
737 if ( m_parentCollection ) 735 if ( m_parentCollection )
738 m_parentCollection->connectHighlight( bar, this ); 736 m_parentCollection->connectHighlight( bar, this );
739 737
740 return containerCount() - 1; 738 return containerCount() - 1;
741 739
742 } 740 }
743 741
744 return -1; 742 return -1;
745} 743}
746 744
747void KAction::unplug( QWidget *w ) 745void KAction::unplug( QWidget *w )
748{ 746{
749 int i = findContainer( w ); 747 int i = findContainer( w );
750 if ( i == -1 ) 748 if ( i == -1 )
751 return; 749 return;
752 int id = itemId( i ); 750 int id = itemId( i );
753 751
754 if ( w->inherits( "QPopupMenu" ) ) 752 if ( w->inherits( "QPopupMenu" ) )
755 { 753 {
756 QPopupMenu *menu = static_cast<QPopupMenu *>( w ); 754 QPopupMenu *menu = static_cast<QPopupMenu *>( w );
757 menu->removeItem( id ); 755 menu->removeItem( id );
758 } 756 }
759 else if ( w->inherits( "KToolBar" ) ) 757 else if ( w->inherits( "KToolBar" ) )
760 { 758 {
761 KToolBar *bar = static_cast<KToolBar *>( w ); 759 KToolBar *bar = static_cast<KToolBar *>( w );
762 bar->removeItemDelayed( id ); 760 bar->removeItemDelayed( id );
763 } 761 }
764 else if ( w->inherits( "QMenuBar" ) ) 762 else if ( w->inherits( "QMenuBar" ) )
765 { 763 {
766 QMenuBar *bar = static_cast<QMenuBar *>( w ); 764 QMenuBar *bar = static_cast<QMenuBar *>( w );
767 bar->removeItem( id ); 765 bar->removeItem( id );
768 } 766 }
769 767
770 removeContainer( i ); 768 removeContainer( i );
771 769
772 if ( m_parentCollection ) 770 if ( m_parentCollection )
773 m_parentCollection->disconnectHighlight( w, this ); 771 m_parentCollection->disconnectHighlight( w, this );
774} 772}
775 773
776void KAction::plugAccel(KAccel *kacc, bool configurable) 774void KAction::plugAccel(KAccel *kacc, bool configurable)
777{ 775{
778 qDebug("KAction::plugAccel ...1 has top be fixed"); 776 // qDebug("KAction::plugAccel ...1 has top be fixed");
777
779/*US 778/*US
780 kdWarning(129) << "KAction::plugAccel(): call to deprecated action." << endl; 779 kdWarning(129) << "KAction::plugAccel(): call to deprecated action." << endl;
781 kdDebug(129) << kdBacktrace() << endl; 780 kdDebug(129) << kdBacktrace() << endl;
782 //kdDebug(129) << "KAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl; 781 //kdDebug(129) << "KAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl;
783 if ( d->m_kaccel ) 782 if ( d->m_kaccel )
784 unplugAccel(); 783 unplugAccel();
785 784
786 // If the parent collection's accel ptr isn't set yet 785 // If the parent collection's accel ptr isn't set yet
787 //if ( m_parentCollection && !m_parentCollection->accel() ) 786 //if ( m_parentCollection && !m_parentCollection->accel() )
788 // m_parentCollection->setAccel( kacc ); 787 // m_parentCollection->setAccel( kacc );
789 788
790 // We can only plug this action into the given KAccel object 789 // We can only plug this action into the given KAccel object
791 // if it does not already contain an action with the same name. 790 // if it does not already contain an action with the same name.
792 if ( !kacc->actions().actionPtr(name()) ) 791 if ( !kacc->actions().actionPtr(name()) )
793 { 792 {
794 d->m_kaccel = kacc; 793 d->m_kaccel = kacc;
795 d->m_kaccel->insert(name(), d->plainText(), QString::null, 794 d->m_kaccel->insert(name(), d->plainText(), QString::null,
796 KShortcut(d->m_cut), 795 KShortcut(d->m_cut),
797 this, SLOT(slotActivated()), 796 this, SLOT(slotActivated()),
798 configurable, isEnabled()); 797 configurable, isEnabled());
799 connect(d->m_kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed())); 798 connect(d->m_kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()));
800 //connect(d->m_kaccel, SIGNAL(keycodeChanged()), this, SLOT(slotKeycodeChanged())); 799 //connect(d->m_kaccel, SIGNAL(keycodeChanged()), this, SLOT(slotKeycodeChanged()));
801 } 800 }
802 else 801 else
803 kdWarning(129) << "KAction::plugAccel( kacc = " << kacc << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis 802 kdWarning(129) << "KAction::plugAccel( kacc = " << kacc << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis
804*/ 803*/
805} 804}
806 805
807void KAction::unplugAccel() 806void KAction::unplugAccel()
808{ 807{
809 qDebug("KAction::unplugAccel ...1 has top be fixed"); 808 // qDebug("KAction::unplugAccel ...1 has top be fixed");
810/*US 809/*US
811 //kdDebug(129) << "KAction::unplugAccel() " << this << " " << name() << endl; 810 //kdDebug(129) << "KAction::unplugAccel() " << this << " " << name() << endl;
812 if ( d->m_kaccel ) 811 if ( d->m_kaccel )
813 { 812 {
814 d->m_kaccel->remove(name()); 813 d->m_kaccel->remove(name());
815 d->m_kaccel = 0; 814 d->m_kaccel = 0;
816 } 815 }
817*/ 816*/
818} 817}
819 818
820void KAction::plugMainWindowAccel( QWidget *w ) 819void KAction::plugMainWindowAccel( QWidget *w )
821{ 820{
822 qDebug("KAction::plugMainWindowAccel ...1 has top be fixed"); 821 // qDebug("KAction::plugMainWindowAccel ...1 has top be fixed");
822
823/*US 823/*US
824 // Note: topLevelWidget() stops too early, we can't use it. 824 // Note: topLevelWidget() stops too early, we can't use it.
825 QWidget * tl = w; 825 QWidget * tl = w;
826 QWidget * n; 826 QWidget * n;
827 while ( !tl->isDialog() && ( n = tl->parentWidget() ) ) // lookup parent and store 827 while ( !tl->isDialog() && ( n = tl->parentWidget() ) ) // lookup parent and store
828 tl = n; 828 tl = n;
829 829
830 KMainWindow * mw = dynamic_cast<KMainWindow *>(tl); // try to see if it's a kmainwindow 830 KMainWindow * mw = dynamic_cast<KMainWindow *>(tl); // try to see if it's a kmainwindow
831 if (mw) 831 if (mw)
832 plugAccel( mw->accel() ); 832 plugAccel( mw->accel() );
833 else 833 else
834 kdDebug(129) << "KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl << endl; 834 kdDebug(129) << "KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl << endl;
835*/ 835*/
836} 836}
837 837
838void KAction::setEnabled(bool enable) 838void KAction::setEnabled(bool enable)
839{ 839{
840 //kdDebug(129) << "KAction::setEnabled( " << enable << " ): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; 840 //kdDebug(129) << "KAction::setEnabled( " << enable << " ): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
841 if ( enable == d->isEnabled() ) 841 if ( enable == d->isEnabled() )
842 return; 842 return;
843 843
844 // KDE 4: remove 844 // KDE 4: remove
845//US if (d->m_kaccel) 845//US if (d->m_kaccel)
846//US d->m_kaccel->setEnabled(name(), enable); 846//US d->m_kaccel->setEnabled(name(), enable);
847 // KDE 4: remove end 847 // KDE 4: remove end
848 848
849//US for ( uint i = 0; i < d->m_kaccelList.count(); i++ ) 849//US for ( uint i = 0; i < d->m_kaccelList.count(); i++ )
850//US d->m_kaccelList[i]->setEnabled( name(), enable ); 850//US d->m_kaccelList[i]->setEnabled( name(), enable );
851 851
852 d->setEnabled( enable ); 852 d->setEnabled( enable );
853 853
854 int len = containerCount(); 854 int len = containerCount();
855 for( int i = 0; i < len; ++i ) 855 for( int i = 0; i < len; ++i )
856 updateEnabled( i ); 856 updateEnabled( i );
857 857
858 emit enabled( d->isEnabled() ); 858 emit enabled( d->isEnabled() );
859} 859}
860 860
861void KAction::updateEnabled( int i ) 861void KAction::updateEnabled( int i )
862{ 862{
863 QWidget *w = container( i ); 863 QWidget *w = container( i );
864 864
865 if ( w->inherits("QPopupMenu") ) 865 if ( w->inherits("QPopupMenu") )
866 static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); 866 static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
867 else if ( w->inherits("QMenuBar") ) 867 else if ( w->inherits("QMenuBar") )
868 static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); 868 static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
869 else if ( w->inherits( "KToolBar" ) ) 869 else if ( w->inherits( "KToolBar" ) )
870 { 870 {
871 static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); 871 static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
872 } 872 }
873} 873}
874 874
875void KAction::setShortcutConfigurable( bool b ) 875void KAction::setShortcutConfigurable( bool b )
876{ 876{
877 d->m_configurable = b; 877 d->m_configurable = b;
878} 878}
879 879
880void KAction::setText( const QString& text ) 880void KAction::setText( const QString& text )
881{ 881{
882/*US 882/*US
883 // KDE 4: remove 883 // KDE 4: remove
884 if (d->m_kaccel) { 884 if (d->m_kaccel) {
885 KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name()); 885 KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
886 if (pAction) 886 if (pAction)
887 pAction->setLabel( text ); 887 pAction->setLabel( text );
888 } 888 }
889 // KDE 4: remove end 889 // KDE 4: remove end
890 890
891 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { 891 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
892 KAccelAction* pAction = d->m_kaccelList[i]->actions().actionPtr(name()); 892 KAccelAction* pAction = d->m_kaccelList[i]->actions().actionPtr(name());
893 if (pAction) 893 if (pAction)
894 pAction->setLabel( text ); 894 pAction->setLabel( text );
895 } 895 }
896*/ 896*/
897 d->setText( text ); 897 d->setText( text );
898 898
899 int len = containerCount(); 899 int len = containerCount();
900 for( int i = 0; i < len; ++i ) 900 for( int i = 0; i < len; ++i )
901 updateText( i ); 901 updateText( i );
902 902
903} 903}
904 904
905void KAction::updateText( int i ) 905void KAction::updateText( int i )
906{ 906{
907 QWidget *w = container( i ); 907 QWidget *w = container( i );
908 908
909 if ( w->inherits( "QPopupMenu" ) ) { 909 if ( w->inherits( "QPopupMenu" ) ) {
910 int id = itemId( i ); 910 int id = itemId( i );
911 static_cast<QPopupMenu*>(w)->changeItem( id, d->text() ); 911 static_cast<QPopupMenu*>(w)->changeItem( id, d->text() );
912 updateShortcut( static_cast<QPopupMenu*>(w), id ); 912 updateShortcut( static_cast<QPopupMenu*>(w), id );
913 } 913 }
914 else if ( w->inherits( "QMenuBar" ) ) 914 else if ( w->inherits( "QMenuBar" ) )
915 static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); 915 static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() );
916 else if ( w->inherits( "KToolBar" ) ) 916 else if ( w->inherits( "KToolBar" ) )
917 { 917 {
918 qDebug("KAction::updateText ...3 has top be fixed"); 918 //qDebug("KAction::updateText ...3 has top be fixed");
919 QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) ); 919 QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) );
920 if ( button->inherits( "KToolBarButton" ) ) 920 if ( button->inherits( "KToolBarButton" ) )
921 static_cast<KToolBarButton *>(button)->setText( d->plainText() ); 921 static_cast<KToolBarButton *>(button)->setText( d->plainText() );
922 922
923 } 923 }
924} 924}
925 925
926QString KAction::text() const 926QString KAction::text() const
927{ 927{
928 return d->text(); 928 return d->text();
929} 929}
930 930
931QString KAction::plainText() const 931QString KAction::plainText() const
932{ 932{
933 return d->plainText( ); 933 return d->plainText( );
934} 934}
935 935
936void KAction::setIcon( const QString &icon ) 936void KAction::setIcon( const QString &icon )
937{ 937{
938 d->setIconName( icon ); 938 d->setIconName( icon );
939 939
940 // now handle any toolbars 940 // now handle any toolbars
941 int len = containerCount(); 941 int len = containerCount();
942 for ( int i = 0; i < len; ++i ) 942 for ( int i = 0; i < len; ++i )
943 updateIcon( i ); 943 updateIcon( i );
944} 944}
945 945
946void KAction::updateIcon( int id ) 946void KAction::updateIcon( int id )
947{ 947{
948 QWidget* w = container( id ); 948 QWidget* w = container( id );
949 949
950 if ( w->inherits( "QPopupMenu" ) ) { 950 if ( w->inherits( "QPopupMenu" ) ) {
951 int itemId_ = itemId( id ); 951 int itemId_ = itemId( id );
952 static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() ); 952 static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() );
953 updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); 953 updateShortcut( static_cast<QPopupMenu*>(w), itemId_ );
954 } 954 }
955 else if ( w->inherits( "QMenuBar" ) ) 955 else if ( w->inherits( "QMenuBar" ) )
956 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() ); 956 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() );
957 else if ( w->inherits( "KToolBar" ) ) 957 else if ( w->inherits( "KToolBar" ) )
958 static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); 958 static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
959 else if ( w->inherits( "QToolBar" ) ) 959 else if ( w->inherits( "QToolBar" ) )
960 { 960 {
961 qDebug("KAction::updateIcon has top be fixed"); 961 qDebug("KAction::updateIcon has top be fixed");
962//US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); 962//US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
963 } 963 }
964} 964}
965 965
966QString KAction::icon() const 966QString KAction::icon() const
967{ 967{
968 return d->iconName( ); 968 return d->iconName( );
969} 969}
970 970
971void KAction::setIconSet( const QIconSet &iconset ) 971void KAction::setIconSet( const QIconSet &iconset )
972{ 972{
973 d->setIconSet( iconset ); 973 d->setIconSet( iconset );
974 974
975 int len = containerCount(); 975 int len = containerCount();
976 for( int i = 0; i < len; ++i ) 976 for( int i = 0; i < len; ++i )
977 updateIconSet( i ); 977 updateIconSet( i );
978} 978}
979 979
980 980
981void KAction::updateIconSet( int id ) 981void KAction::updateIconSet( int id )
982{ 982{
983 QWidget *w = container( id ); 983 QWidget *w = container( id );
984 984
985 if ( w->inherits( "QPopupMenu" ) ) 985 if ( w->inherits( "QPopupMenu" ) )
986 { 986 {
987 int itemId_ = itemId( id ); 987 int itemId_ = itemId( id );
988 static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() ); 988 static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() );
989 updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); 989 updateShortcut( static_cast<QPopupMenu*>(w), itemId_ );
990 } 990 }
991 else if ( w->inherits( "QMenuBar" ) ) 991 else if ( w->inherits( "QMenuBar" ) )
992 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() ); 992 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() );
993 else if ( w->inherits( "KToolBar" ) ) 993 else if ( w->inherits( "KToolBar" ) )
994 { 994 {
995 if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better ) 995 if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better )
996 static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() ); 996 static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() );
997 else 997 else
998 static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) ); 998 static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) );
999 } 999 }
1000} 1000}
1001 1001
1002QIconSet KAction::iconSet( KIcon::Group group, int size ) const 1002QIconSet KAction::iconSet( KIcon::Group group, int size ) const
1003{ 1003{
1004 return d->iconSet( group, size ); 1004 return d->iconSet( group, size );
1005} 1005}
1006 1006
1007bool KAction::hasIcon() const 1007bool KAction::hasIcon() const
1008{ 1008{
1009 return d->hasIcon(); 1009 return d->hasIcon();
1010} 1010}
1011 1011
1012 1012
1013void KAction::setWhatsThis( const QString& text ) 1013void KAction::setWhatsThis( const QString& text )
1014{ 1014{
@@ -1025,191 +1025,191 @@ void KAction::updateWhatsThis( int i )
1025 QPopupMenu* pm = popupMenu( i ); 1025 QPopupMenu* pm = popupMenu( i );
1026 if ( pm ) 1026 if ( pm )
1027 { 1027 {
1028 pm->setWhatsThis( itemId( i ), d->whatsThis() ); 1028 pm->setWhatsThis( itemId( i ), d->whatsThis() );
1029 return; 1029 return;
1030 } 1030 }
1031 1031
1032 KToolBar *tb = toolBar( i ); 1032 KToolBar *tb = toolBar( i );
1033 if ( tb ) 1033 if ( tb )
1034 { 1034 {
1035 QWidget *w = tb->getButton( itemId( i ) ); 1035 QWidget *w = tb->getButton( itemId( i ) );
1036//US QWhatsThis::remove( w ); 1036//US QWhatsThis::remove( w );
1037//US QWhatsThis::add( w, d->whatsThis() ); 1037//US QWhatsThis::add( w, d->whatsThis() );
1038 return; 1038 return;
1039 } 1039 }
1040} 1040}
1041 1041
1042QString KAction::whatsThis() const 1042QString KAction::whatsThis() const
1043{ 1043{
1044 return d->whatsThis(); 1044 return d->whatsThis();
1045} 1045}
1046 1046
1047QString KAction::whatsThisWithIcon() const 1047QString KAction::whatsThisWithIcon() const
1048{ 1048{
1049 QString text = whatsThis(); 1049 QString text = whatsThis();
1050 if (!d->iconName().isEmpty()) 1050 if (!d->iconName().isEmpty())
1051 return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text); 1051 return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text);
1052 return text; 1052 return text;
1053} 1053}
1054 1054
1055QWidget* KAction::container( int index ) const 1055QWidget* KAction::container( int index ) const
1056{ 1056{
1057 assert( index < containerCount() ); 1057 assert( index < containerCount() );
1058 return d->m_containers[ index ].m_container; 1058 return d->m_containers[ index ].m_container;
1059} 1059}
1060 1060
1061KToolBar* KAction::toolBar( int index ) const 1061KToolBar* KAction::toolBar( int index ) const
1062{ 1062{
1063//US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container ); 1063//US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container );
1064 return (KToolBar *)( d->m_containers[ index ].m_container ); 1064 return (KToolBar *)( d->m_containers[ index ].m_container );
1065} 1065}
1066 1066
1067QPopupMenu* KAction::popupMenu( int index ) const 1067QPopupMenu* KAction::popupMenu( int index ) const
1068{ 1068{
1069//US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container ); 1069//US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container );
1070 return (QPopupMenu *)( d->m_containers[ index ].m_container ); 1070 return (QPopupMenu *)( d->m_containers[ index ].m_container );
1071} 1071}
1072 1072
1073QWidget* KAction::representative( int index ) const 1073QWidget* KAction::representative( int index ) const
1074{ 1074{
1075 return d->m_containers[ index ].m_representative; 1075 return d->m_containers[ index ].m_representative;
1076} 1076}
1077 1077
1078int KAction::itemId( int index ) const 1078int KAction::itemId( int index ) const
1079{ 1079{
1080 return d->m_containers[ index ].m_id; 1080 return d->m_containers[ index ].m_id;
1081} 1081}
1082 1082
1083int KAction::containerCount() const 1083int KAction::containerCount() const
1084{ 1084{
1085 return d->m_containers.count(); 1085 return d->m_containers.count();
1086} 1086}
1087 1087
1088uint KAction::kaccelCount() const 1088uint KAction::kaccelCount() const
1089{ 1089{
1090 return d->m_kaccelList.count(); 1090 return d->m_kaccelList.count();
1091} 1091}
1092 1092
1093void KAction::addContainer( QWidget* c, int id ) 1093void KAction::addContainer( QWidget* c, int id )
1094{ 1094{
1095 KActionPrivate::Container p; 1095 KActionPrivate::Container p;
1096 p.m_container = c; 1096 p.m_container = c;
1097 p.m_id = id; 1097 p.m_id = id;
1098 d->m_containers.append( p ); 1098 d->m_containers.append( p );
1099} 1099}
1100 1100
1101void KAction::addContainer( QWidget* c, QWidget* w ) 1101void KAction::addContainer( QWidget* c, QWidget* w )
1102{ 1102{
1103 KActionPrivate::Container p; 1103 KActionPrivate::Container p;
1104 p.m_container = c; 1104 p.m_container = c;
1105 p.m_representative = w; 1105 p.m_representative = w;
1106 d->m_containers.append( p ); 1106 d->m_containers.append( p );
1107} 1107}
1108 1108
1109void KAction::activate() 1109void KAction::activate()
1110{ 1110{
1111 slotActivated(); 1111 slotActivated();
1112} 1112}
1113 1113
1114void KAction::slotActivated() 1114void KAction::slotActivated()
1115{ 1115{
1116 emit activated(); 1116 emit activated();
1117} 1117}
1118 1118
1119void KAction::slotDestroyed() 1119void KAction::slotDestroyed()
1120{ 1120{
1121 kdDebug(129) << "KAction::slotDestroyed(): this = " << this << ", name = \"" << name() << "\", sender = " << sender() << endl; 1121
1122 const QObject* o = sender(); 1122 const QObject* o = sender();
1123 1123
1124/* 1124/*
1125 1125
1126 1126
1127 // KDE 4: remove 1127 // KDE 4: remove
1128 if ( o == d->m_kaccel ) 1128 if ( o == d->m_kaccel )
1129 { 1129 {
1130 d->m_kaccel = 0; 1130 d->m_kaccel = 0;
1131 return; 1131 return;
1132 } 1132 }
1133 // KDE 4: remove end 1133 // KDE 4: remove end
1134 1134
1135 for( uint i = 0; i < d->m_kaccelList.count(); i++ ) 1135 for( uint i = 0; i < d->m_kaccelList.count(); i++ )
1136 { 1136 {
1137 if ( o == d->m_kaccelList[i] ) 1137 if ( o == d->m_kaccelList[i] )
1138 { 1138 {
1139 disconnect( d->m_kaccelList[i], SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); 1139 disconnect( d->m_kaccelList[i], SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
1140 d->m_kaccelList.remove( d->m_kaccelList.at( i ) ); 1140 d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
1141 return; 1141 return;
1142 } 1142 }
1143 } 1143 }
1144*/ 1144*/
1145 int i; 1145 int i;
1146 do 1146 do
1147 { 1147 {
1148 i = findContainer( static_cast<const QWidget*>( o ) ); 1148 i = findContainer( static_cast<const QWidget*>( o ) );
1149 if ( i != -1 ) 1149 if ( i != -1 )
1150 removeContainer( i ); 1150 removeContainer( i );
1151 } while ( i != -1 ); 1151 } while ( i != -1 );
1152 1152
1153} 1153}
1154 1154
1155int KAction::findContainer( const QWidget* widget ) const 1155int KAction::findContainer( const QWidget* widget ) const
1156{ 1156{
1157 int pos = 0; 1157 int pos = 0;
1158 QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin(); 1158 QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin();
1159 while( it != d->m_containers.end() ) 1159 while( it != d->m_containers.end() )
1160 { 1160 {
1161 if ( (*it).m_representative == widget || (*it).m_container == widget ) 1161 if ( (*it).m_representative == widget || (*it).m_container == widget )
1162 return pos; 1162 return pos;
1163 ++it; 1163 ++it;
1164 ++pos; 1164 ++pos;
1165 } 1165 }
1166 1166
1167 return -1; 1167 return -1;
1168} 1168}
1169 1169
1170void KAction::removeContainer( int index ) 1170void KAction::removeContainer( int index )
1171{ 1171{
1172 int i = 0; 1172 int i = 0;
1173 QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin(); 1173 QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin();
1174 while( it != d->m_containers.end() ) 1174 while( it != d->m_containers.end() )
1175 { 1175 {
1176 if ( i == index ) 1176 if ( i == index )
1177 { 1177 {
1178 d->m_containers.remove( it ); 1178 d->m_containers.remove( it );
1179 return; 1179 return;
1180 } 1180 }
1181 ++it; 1181 ++it;
1182 ++i; 1182 ++i;
1183 } 1183 }
1184} 1184}
1185 1185
1186// FIXME: Remove this (ellis) 1186// FIXME: Remove this (ellis)
1187void KAction::slotKeycodeChanged() 1187void KAction::slotKeycodeChanged()
1188{ 1188{
1189 qDebug("KAction::slotKeycodeChanged() ...44 has top be fixed"); 1189 qDebug("KAction::slotKeycodeChanged() ...44 has top be fixed");
1190/*US 1190/*US
1191 kdDebug(129) << "KAction::slotKeycodeChanged()" << endl; // -- ellis 1191 kdDebug(129) << "KAction::slotKeycodeChanged()" << endl; // -- ellis
1192 KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name()); 1192 KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
1193 if( pAction ) 1193 if( pAction )
1194 setShortcut(pAction->shortcut()); 1194 setShortcut(pAction->shortcut());
1195*/ 1195*/
1196} 1196}
1197 1197
1198KActionCollection *KAction::parentCollection() const 1198KActionCollection *KAction::parentCollection() const
1199{ 1199{
1200 return m_parentCollection; 1200 return m_parentCollection;
1201} 1201}
1202 1202
1203void KAction::unplugAll() 1203void KAction::unplugAll()
1204{ 1204{
1205 while ( containerCount() != 0 ) 1205 while ( containerCount() != 0 )
1206 unplug( container( 0 ) ); 1206 unplug( container( 0 ) );
1207} 1207}
1208 1208
1209void KAction::virtual_hook( int, void* ) 1209void KAction::virtual_hook( int, void* )
1210{ /*BASE::virtual_hook( id, data );*/ } 1210{ /*BASE::virtual_hook( id, data );*/ }
1211 1211
1212/* vim: et sw=2 ts=2 1212/* vim: et sw=2 ts=2
1213 */ 1213 */
1214 1214
1215//US #include "kaction.moc" 1215//US #include "kaction.moc"