-rw-r--r-- | core/pim/addressbook/abtable.cpp | 86 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 27 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 1 | ||||
-rw-r--r-- | core/pim/addressbook/picker.cpp | 7 |
4 files changed, 98 insertions, 23 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 759cb48..124ff6c 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -968,157 +968,233 @@ QStringList AbTable::choiceNames() const | |||
968 | } | 968 | } |
969 | 969 | ||
970 | void AbTable::setChoiceSelection(int /*index*/, const QStringList& /*list*/) | 970 | void AbTable::setChoiceSelection(int /*index*/, const QStringList& /*list*/) |
971 | { | 971 | { |
972 | /* ###### | 972 | /* ###### |
973 | 973 | ||
974 | QString selname = choicenames.at(index); | 974 | QString selname = choicenames.at(index); |
975 | for (each row) { | 975 | for (each row) { |
976 | Contact *c = contactForRow(row); | 976 | Contact *c = contactForRow(row); |
977 | if ( list.contains(c->email) ) { | 977 | if ( list.contains(c->email) ) { |
978 | list.remove(c->email); | 978 | list.remove(c->email); |
979 | setText(row, 2, selname); | 979 | setText(row, 2, selname); |
980 | } | 980 | } |
981 | } | 981 | } |
982 | for (remaining list items) { | 982 | for (remaining list items) { |
983 | Contact *c = new contact(item); | 983 | Contact *c = new contact(item); |
984 | setText(newrow, 2, selname); | 984 | setText(newrow, 2, selname); |
985 | } | 985 | } |
986 | 986 | ||
987 | */ | 987 | */ |
988 | } | 988 | } |
989 | 989 | ||
990 | QStringList AbTable::choiceSelection(int /*index*/) const | 990 | QStringList AbTable::choiceSelection(int /*index*/) const |
991 | { | 991 | { |
992 | QStringList r; | 992 | QStringList r; |
993 | /* ###### | 993 | /* ###### |
994 | 994 | ||
995 | QString selname = choicenames.at(index); | 995 | QString selname = choicenames.at(index); |
996 | for (each row) { | 996 | for (each row) { |
997 | Contact *c = contactForRow(row); | 997 | Contact *c = contactForRow(row); |
998 | if ( text(row,2) == selname ) { | 998 | if ( text(row,2) == selname ) { |
999 | r.append(c->email); | 999 | r.append(c->email); |
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | */ | 1003 | */ |
1004 | return r; | 1004 | return r; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | void AbTable::setShowCategory( const QString &c ) | 1007 | void AbTable::setShowCategory( const QString &c ) |
1008 | { | 1008 | { |
1009 | showCat = c; | 1009 | showCat = c; |
1010 | updateVisible(); | 1010 | updateVisible(); |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | void AbTable::setShowByLetter( char c ) | 1013 | void AbTable::setShowByLetter( char c ) |
1014 | { | 1014 | { |
1015 | showChar = tolower(c); | 1015 | showChar = tolower(c); |
1016 | qDebug( "AbTable::setShowByLetter %c", showChar); | ||
1017 | updateVisible(); | 1016 | updateVisible(); |
1018 | } | 1017 | } |
1019 | 1018 | ||
1020 | QString AbTable::showCategory() const | 1019 | QString AbTable::showCategory() const |
1021 | { | 1020 | { |
1022 | return showCat; | 1021 | return showCat; |
1023 | } | 1022 | } |
1024 | 1023 | ||
1025 | 1024 | ||
1026 | QStringList AbTable::categories() | 1025 | QStringList AbTable::categories() |
1027 | { | 1026 | { |
1028 | mCat.load( categoryFileName() ); | 1027 | mCat.load( categoryFileName() ); |
1029 | QStringList categoryList = mCat.labels( "Contacts" ); | 1028 | QStringList categoryList = mCat.labels( "Contacts" ); |
1030 | return categoryList; | 1029 | return categoryList; |
1031 | } | 1030 | } |
1032 | 1031 | ||
1033 | void AbTable::updateVisible() | 1032 | void AbTable::updateVisible() |
1034 | { | 1033 | { |
1035 | int visible, | 1034 | int visible, |
1036 | totalRows, | 1035 | totalRows, |
1037 | id, | 1036 | id, |
1038 | totalCats, | 1037 | totalCats, |
1039 | it, | 1038 | it, |
1040 | row; | 1039 | row; |
1041 | bool hide; | 1040 | bool hide; |
1042 | AbTableItem *ati; | 1041 | AbTableItem *ati; |
1043 | Contact *cnt; | 1042 | Contact *cnt; |
1044 | QString fileAsName; | 1043 | QString fileAsName; |
1045 | QString tmpStr; | 1044 | QString tmpStr; |
1046 | visible = 0; | 1045 | visible = 0; |
1047 | 1046 | ||
1048 | setPaintingEnabled( FALSE ); | 1047 | setPaintingEnabled( FALSE ); |
1049 | 1048 | ||
1050 | totalRows = numRows(); | 1049 | totalRows = numRows(); |
1051 | id = mCat.id( "Contacts", showCat ); | 1050 | id = mCat.id( "Contacts", showCat ); |
1052 | QArray<int> cats; | 1051 | QArray<int> cats; |
1053 | for ( row = 0; row < totalRows; row++ ) { | 1052 | for ( row = 0; row < totalRows; row++ ) { |
1054 | ati = static_cast<AbTableItem*>( item(row, 0) ); | 1053 | ati = static_cast<AbTableItem*>( item(row, 0) ); |
1055 | cnt = &contactList[ati]; | 1054 | cnt = &contactList[ati]; |
1056 | cats = cnt->categories(); | 1055 | cats = cnt->categories(); |
1057 | fileAsName = cnt->fileAs(); | 1056 | fileAsName = cnt->fileAs(); |
1058 | hide = false; | 1057 | hide = false; |
1059 | if ( !showCat.isEmpty() ) { | 1058 | if ( !showCat.isEmpty() ) { |
1060 | if ( showCat == tr( "Unfiled" ) ) { | 1059 | if ( showCat == tr( "Unfiled" ) ) { |
1061 | if ( cats.count() > 0 ) | 1060 | if ( cats.count() > 0 ) |
1062 | hide = true; | 1061 | hide = true; |
1063 | } else { | 1062 | } else { |
1064 | // do some comparing | 1063 | // do some comparing |
1065 | if ( !hide ) { | 1064 | if ( !hide ) { |
1066 | hide = true; | 1065 | hide = true; |
1067 | totalCats = int(cats.count()); | 1066 | totalCats = int(cats.count()); |
1068 | for ( it = 0; it < totalCats; it++ ) { | 1067 | for ( it = 0; it < totalCats; it++ ) { |
1069 | if ( cats[it] == id ) { | 1068 | if ( cats[it] == id ) { |
1070 | hide = false; | 1069 | hide = false; |
1071 | break; | 1070 | break; |
1072 | } | 1071 | } |
1073 | } | 1072 | } |
1074 | } | 1073 | } |
1075 | } | 1074 | } |
1076 | } | 1075 | } |
1077 | if ( showChar != '\0' ) { | 1076 | if ( showChar != '\0' ) { |
1078 | tmpStr = fileAsName.left(1); | 1077 | tmpStr = fileAsName.left(1); |
1079 | tmpStr = tmpStr.lower(); | 1078 | tmpStr = tmpStr.lower(); |
1080 | qDebug( "updateVisible "); | 1079 | if ( tmpStr != QString(QChar(showChar)) && showChar != '#' ) { |
1081 | qDebug( tmpStr ); | ||
1082 | qDebug( "updateVisible2 %c", showChar ); | ||
1083 | if ( tmpStr != QString(QChar(showChar)) ) { | ||
1084 | hide = true; | 1080 | hide = true; |
1085 | } | 1081 | } |
1082 | if ( showChar == '#' ) { | ||
1083 | if (tmpStr == "a") | ||
1084 | hide = true; | ||
1085 | |||
1086 | if (tmpStr == "b") | ||
1087 | hide = true; | ||
1088 | |||
1089 | if (tmpStr == "c") | ||
1090 | hide = true; | ||
1091 | |||
1092 | if (tmpStr == "d") | ||
1093 | hide = true; | ||
1094 | |||
1095 | if (tmpStr == "e") | ||
1096 | hide = true; | ||
1097 | |||
1098 | if (tmpStr == "f") | ||
1099 | hide = true; | ||
1100 | |||
1101 | if (tmpStr == "g") | ||
1102 | hide = true; | ||
1103 | |||
1104 | if (tmpStr == "h") | ||
1105 | hide = true; | ||
1106 | |||
1107 | if (tmpStr == "i") | ||
1108 | hide = true; | ||
1109 | |||
1110 | if (tmpStr == "j") | ||
1111 | hide = true; | ||
1112 | |||
1113 | if (tmpStr == "k") | ||
1114 | hide = true; | ||
1115 | |||
1116 | if (tmpStr == "l") | ||
1117 | hide = true; | ||
1118 | |||
1119 | if (tmpStr == "m") | ||
1120 | hide = true; | ||
1121 | |||
1122 | if (tmpStr == "n") | ||
1123 | hide = true; | ||
1124 | |||
1125 | if (tmpStr == "o") | ||
1126 | hide = true; | ||
1127 | |||
1128 | if (tmpStr == "p") | ||
1129 | hide = true; | ||
1130 | |||
1131 | if (tmpStr == "q") | ||
1132 | hide = true; | ||
1133 | |||
1134 | if (tmpStr == "r") | ||
1135 | hide = true; | ||
1136 | |||
1137 | if (tmpStr == "s") | ||
1138 | hide = true; | ||
1139 | |||
1140 | if (tmpStr == "t") | ||
1141 | hide = true; | ||
1142 | |||
1143 | if (tmpStr == "u") | ||
1144 | hide = true; | ||
1145 | |||
1146 | if (tmpStr == "v") | ||
1147 | hide = true; | ||
1148 | |||
1149 | if (tmpStr == "w") | ||
1150 | hide = true; | ||
1151 | |||
1152 | if (tmpStr == "x") | ||
1153 | hide = true; | ||
1154 | |||
1155 | if (tmpStr == "y") | ||
1156 | hide = true; | ||
1157 | |||
1158 | if (tmpStr == "z") | ||
1159 | hide = true; | ||
1160 | } | ||
1161 | |||
1086 | } | 1162 | } |
1087 | if ( hide ) { | 1163 | if ( hide ) { |
1088 | if ( currentRow() == row ) | 1164 | if ( currentRow() == row ) |
1089 | setCurrentCell( -1, 0 ); | 1165 | setCurrentCell( -1, 0 ); |
1090 | if ( rowHeight(row) > 0 ) | 1166 | if ( rowHeight(row) > 0 ) |
1091 | hideRow( row ); | 1167 | hideRow( row ); |
1092 | } else { | 1168 | } else { |
1093 | if ( rowHeight(row) == 0 ) { | 1169 | if ( rowHeight(row) == 0 ) { |
1094 | showRow( row ); | 1170 | showRow( row ); |
1095 | adjustRow( row ); | 1171 | adjustRow( row ); |
1096 | } | 1172 | } |
1097 | visible++; | 1173 | visible++; |
1098 | } | 1174 | } |
1099 | } | 1175 | } |
1100 | if ( !visible ) | 1176 | if ( !visible ) |
1101 | setCurrentCell( -1, 0 ); | 1177 | setCurrentCell( -1, 0 ); |
1102 | 1178 | ||
1103 | setPaintingEnabled( TRUE ); | 1179 | setPaintingEnabled( TRUE ); |
1104 | } | 1180 | } |
1105 | 1181 | ||
1106 | 1182 | ||
1107 | void AbTable::setPaintingEnabled( bool e ) | 1183 | void AbTable::setPaintingEnabled( bool e ) |
1108 | { | 1184 | { |
1109 | if ( e != enablePainting ) { | 1185 | if ( e != enablePainting ) { |
1110 | if ( !enablePainting ) { | 1186 | if ( !enablePainting ) { |
1111 | enablePainting = true; | 1187 | enablePainting = true; |
1112 | rowHeightChanged( 0 ); | 1188 | rowHeightChanged( 0 ); |
1113 | viewport()->update(); | 1189 | viewport()->update(); |
1114 | } else { | 1190 | } else { |
1115 | enablePainting = false; | 1191 | enablePainting = false; |
1116 | } | 1192 | } |
1117 | } | 1193 | } |
1118 | } | 1194 | } |
1119 | 1195 | ||
1120 | void AbTable::rowHeightChanged( int row ) | 1196 | void AbTable::rowHeightChanged( int row ) |
1121 | { | 1197 | { |
1122 | if ( enablePainting ) | 1198 | if ( enablePainting ) |
1123 | QTable::rowHeightChanged( row ); | 1199 | QTable::rowHeightChanged( row ); |
1124 | } | 1200 | } |
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e502cf6..beb953a 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -54,323 +54,326 @@ | |||
54 | #include <qstringlist.h> | 54 | #include <qstringlist.h> |
55 | #include <qtoolbutton.h> | 55 | #include <qtoolbutton.h> |
56 | #include <qwhatsthis.h> | 56 | #include <qwhatsthis.h> |
57 | 57 | ||
58 | #include <stdlib.h> | 58 | #include <stdlib.h> |
59 | #include <sys/stat.h> | 59 | #include <sys/stat.h> |
60 | #include <sys/types.h> | 60 | #include <sys/types.h> |
61 | #include <fcntl.h> | 61 | #include <fcntl.h> |
62 | #include <unistd.h> | 62 | #include <unistd.h> |
63 | 63 | ||
64 | #include <qdatetime.h> | 64 | #include <qdatetime.h> |
65 | 65 | ||
66 | #include "picker.h" | 66 | #include "picker.h" |
67 | static QString addressbookOldXMLFilename() | 67 | static QString addressbookOldXMLFilename() |
68 | { | 68 | { |
69 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; | 69 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; |
70 | return filename; | 70 | return filename; |
71 | } | 71 | } |
72 | 72 | ||
73 | static QString addressbookXMLFilename() | 73 | static QString addressbookXMLFilename() |
74 | { | 74 | { |
75 | QString filename = Global::applicationFileName("addressbook", | 75 | QString filename = Global::applicationFileName("addressbook", |
76 | "addressbook.xml"); | 76 | "addressbook.xml"); |
77 | return filename; | 77 | return filename; |
78 | } | 78 | } |
79 | 79 | ||
80 | static QString addressbookPersonalVCardName() | 80 | static QString addressbookPersonalVCardName() |
81 | { | 81 | { |
82 | QString filename = Global::applicationFileName("addressbook", | 82 | QString filename = Global::applicationFileName("addressbook", |
83 | "businesscard.vcf"); | 83 | "businesscard.vcf"); |
84 | return filename; | 84 | return filename; |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 88 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
89 | WFlags f ) | 89 | WFlags f ) |
90 | : QMainWindow( parent, name, f ), | 90 | : QMainWindow( parent, name, f ), |
91 | abEditor(0), | 91 | abEditor(0), |
92 | bAbEditFirstTime(TRUE), | 92 | bAbEditFirstTime(TRUE), |
93 | syncing(FALSE) | 93 | syncing(FALSE) |
94 | { | 94 | { |
95 | initFields(); | 95 | initFields(); |
96 | 96 | ||
97 | setCaption( tr("Contacts") ); | 97 | setCaption( tr("Contacts") ); |
98 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 98 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
99 | 99 | ||
100 | setToolBarsMovable( FALSE ); | 100 | setToolBarsMovable( FALSE ); |
101 | 101 | ||
102 | QBoxLayout *vb = new QVBoxLayout( this, 0, 0 ); | ||
103 | // Create Toolbars | 102 | // Create Toolbars |
104 | 103 | ||
105 | QPEToolBar *bar = new QPEToolBar( this ); | 104 | QPEToolBar *bar = new QPEToolBar( this ); |
106 | bar->setHorizontalStretchable( TRUE ); | 105 | bar->setHorizontalStretchable( TRUE ); |
107 | 106 | ||
108 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 107 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
109 | mbList->setMargin( 0 ); | 108 | mbList->setMargin( 0 ); |
110 | 109 | ||
111 | QPopupMenu *edit = new QPopupMenu( this ); | 110 | QPopupMenu *edit = new QPopupMenu( this ); |
112 | mbList->insertItem( tr( "Contact" ), edit ); | 111 | mbList->insertItem( tr( "Contact" ), edit ); |
113 | 112 | ||
114 | listTools = new QPEToolBar( this, "list operations" ); | 113 | listTools = new QPEToolBar( this, "list operations" ); |
115 | 114 | ||
116 | 115 | ||
117 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 116 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
118 | 0, this, 0 ); | 117 | 0, this, 0 ); |
119 | actionNew = a; | 118 | actionNew = a; |
120 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 119 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
121 | a->addTo( edit ); | 120 | a->addTo( edit ); |
122 | a->addTo( listTools ); | 121 | a->addTo( listTools ); |
123 | 122 | ||
124 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 123 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
125 | 0, this, 0 ); | 124 | 0, this, 0 ); |
126 | actionEdit = a; | 125 | actionEdit = a; |
127 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 126 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
128 | a->addTo( edit ); | 127 | a->addTo( edit ); |
129 | a->addTo( listTools ); | 128 | a->addTo( listTools ); |
130 | 129 | ||
131 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 130 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
132 | 0, this, 0 ); | 131 | 0, this, 0 ); |
133 | actionTrash = a; | 132 | actionTrash = a; |
134 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 133 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
135 | a->addTo( edit ); | 134 | a->addTo( edit ); |
136 | a->addTo( listTools ); | 135 | a->addTo( listTools ); |
137 | 136 | ||
138 | #ifndef MAKE_FOR_SHARP_ROM | 137 | #ifndef MAKE_FOR_SHARP_ROM |
139 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 138 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
140 | QString::null, 0, this, 0 ); | 139 | QString::null, 0, this, 0 ); |
141 | actionFind = a; | 140 | actionFind = a; |
142 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 141 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
143 | a->addTo( edit ); | 142 | a->addTo( edit ); |
144 | a->addTo( listTools ); | 143 | a->addTo( listTools ); |
145 | #endif | 144 | #endif |
146 | 145 | ||
147 | 146 | ||
148 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 147 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), |
149 | QString::null, 0, this, 0 ); | 148 | QString::null, 0, this, 0 ); |
150 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 149 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
151 | actionMail = a; | 150 | actionMail = a; |
152 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 151 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
153 | a->addTo( edit ); | 152 | a->addTo( edit ); |
154 | a->addTo( listTools ); | 153 | a->addTo( listTools ); |
155 | 154 | ||
156 | 155 | ||
157 | 156 | ||
158 | if ( Ir::supported() ) { | 157 | if ( Ir::supported() ) { |
159 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 158 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
160 | 0, this, 0 ); | 159 | 0, this, 0 ); |
161 | actionBeam = a; | 160 | actionBeam = a; |
162 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 161 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
163 | a->addTo( edit ); | 162 | a->addTo( edit ); |
164 | a->addTo( listTools ); | 163 | a->addTo( listTools ); |
165 | } | 164 | } |
166 | 165 | ||
167 | edit->insertSeparator(); | 166 | edit->insertSeparator(); |
168 | 167 | ||
169 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 168 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
170 | actionPersonal = a; | 169 | actionPersonal = a; |
171 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 170 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
172 | a->addTo( edit ); | 171 | a->addTo( edit ); |
173 | 172 | ||
174 | 173 | ||
175 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 174 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
176 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
177 | a->addTo( edit ); | 176 | a->addTo( edit ); |
178 | 177 | ||
179 | // Create Views | 178 | // Create Views |
180 | 179 | ||
181 | // This is safe to call without checking to see if it exists... | 180 | // This is safe to call without checking to see if it exists... |
182 | // not to mention it also does the necessary stuff for the | 181 | // not to mention it also does the necessary stuff for the |
183 | // journaling... | 182 | // journaling... |
184 | QString str = addressbookXMLFilename(); | 183 | QString str = addressbookXMLFilename(); |
185 | if ( str.isNull() ) { | 184 | if ( str.isNull() ) { |
186 | QMessageBox::warning( this, tr("Out of Space"), | 185 | QMessageBox::warning( this, tr("Out of Space"), |
187 | tr("There is not enough space to create\n" | 186 | tr("There is not enough space to create\n" |
188 | "neccessary startup files.\n" | 187 | "neccessary startup files.\n" |
189 | "\nFree up some space before\nentering data!") | 188 | "\nFree up some space before\nentering data!") |
190 | ); | 189 | ); |
191 | } | 190 | } |
192 | 191 | ||
193 | abList = new AbTable( &orderedFields, this, "table" ); | 192 | listContainer = new QWidget( this ); |
194 | vb->insertWidget(0,abList); | 193 | |
194 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | ||
195 | |||
196 | abList = new AbTable( &orderedFields, listContainer, "table" ); | ||
197 | vb->addWidget(abList); | ||
195 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 198 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
196 | connect( abList, SIGNAL( empty( bool ) ), | 199 | connect( abList, SIGNAL( empty( bool ) ), |
197 | this, SLOT( listIsEmpty( bool ) ) ); | 200 | this, SLOT( listIsEmpty( bool ) ) ); |
198 | connect( abList, SIGNAL( details() ), | 201 | connect( abList, SIGNAL( details() ), |
199 | this, SLOT( slotListView() ) ); | 202 | this, SLOT( slotListView() ) ); |
200 | connect( abList, SIGNAL(currentChanged(int,int)), | 203 | connect( abList, SIGNAL(currentChanged(int,int)), |
201 | this, SLOT(slotUpdateToolbar()) ); | 204 | this, SLOT(slotUpdateToolbar()) ); |
202 | 205 | ||
203 | mView = 0; | 206 | mView = 0; |
204 | 207 | ||
205 | abList->load( addressbookXMLFilename() ); | 208 | abList->load( addressbookXMLFilename() ); |
206 | if ( QFile::exists(addressbookOldXMLFilename()) ) { | 209 | if ( QFile::exists(addressbookOldXMLFilename()) ) { |
207 | abList->load( addressbookOldXMLFilename() ); | 210 | abList->load( addressbookOldXMLFilename() ); |
208 | QFile::remove(addressbookOldXMLFilename()); | 211 | QFile::remove(addressbookOldXMLFilename()); |
209 | } | 212 | } |
210 | 213 | ||
211 | pLabel = new LetterPicker( abList ); | 214 | pLabel = new LetterPicker( listContainer ); |
212 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 215 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
213 | vb->insertWidget(1,pLabel); | 216 | vb->addWidget(pLabel); |
214 | catMenu = new QPopupMenu( this ); | 217 | catMenu = new QPopupMenu( this ); |
215 | catMenu->setCheckable( TRUE ); | 218 | catMenu->setCheckable( TRUE ); |
216 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 219 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
217 | populateCategories(); | 220 | populateCategories(); |
218 | 221 | ||
219 | mbList->insertItem( tr("View"), catMenu ); | 222 | mbList->insertItem( tr("View"), catMenu ); |
220 | setCentralWidget( abList ); | 223 | setCentralWidget( listContainer ); |
221 | 224 | ||
222 | fontMenu = new QPopupMenu(this); | 225 | fontMenu = new QPopupMenu(this); |
223 | fontMenu->setCheckable( true ); | 226 | fontMenu->setCheckable( true ); |
224 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | 227 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); |
225 | 228 | ||
226 | fontMenu->insertItem(tr( "Small" ), 0); | 229 | fontMenu->insertItem(tr( "Small" ), 0); |
227 | fontMenu->insertItem(tr( "Normal" ), 1); | 230 | fontMenu->insertItem(tr( "Normal" ), 1); |
228 | fontMenu->insertItem(tr( "Large" ), 2); | 231 | fontMenu->insertItem(tr( "Large" ), 2); |
229 | 232 | ||
230 | defaultFont = new QFont( abList->font() ); | 233 | defaultFont = new QFont( abList->font() ); |
231 | 234 | ||
232 | slotSetFont(startFontSize); | 235 | slotSetFont(startFontSize); |
233 | 236 | ||
234 | mbList->insertItem( tr("Font"), fontMenu); | 237 | mbList->insertItem( tr("Font"), fontMenu); |
235 | setCentralWidget(abList); | 238 | setCentralWidget(listContainer); |
236 | 239 | ||
237 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 240 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
238 | } | 241 | } |
239 | void AddressbookWindow::slotSetFont( int size ) { | 242 | void AddressbookWindow::slotSetFont( int size ) { |
240 | 243 | ||
241 | if (size > 2 || size < 0) | 244 | if (size > 2 || size < 0) |
242 | size = 1; | 245 | size = 1; |
243 | 246 | ||
244 | startFontSize = size; | 247 | startFontSize = size; |
245 | 248 | ||
246 | QFont *currentFont; | 249 | QFont *currentFont; |
247 | 250 | ||
248 | switch (size) { | 251 | switch (size) { |
249 | case 0: | 252 | case 0: |
250 | fontMenu->setItemChecked(0, true); | 253 | fontMenu->setItemChecked(0, true); |
251 | fontMenu->setItemChecked(1, false); | 254 | fontMenu->setItemChecked(1, false); |
252 | fontMenu->setItemChecked(2, false); | 255 | fontMenu->setItemChecked(2, false); |
253 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 256 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
254 | currentFont = new QFont (abList->font()); | 257 | currentFont = new QFont (abList->font()); |
255 | abList->resizeRows(currentFont->pixelSize() + 7); | 258 | abList->resizeRows(currentFont->pixelSize() + 7); |
256 | break; | 259 | break; |
257 | case 1: | 260 | case 1: |
258 | fontMenu->setItemChecked(0, false); | 261 | fontMenu->setItemChecked(0, false); |
259 | fontMenu->setItemChecked(1, true); | 262 | fontMenu->setItemChecked(1, true); |
260 | fontMenu->setItemChecked(2, false); | 263 | fontMenu->setItemChecked(2, false); |
261 | abList->setFont( *defaultFont ); | 264 | abList->setFont( *defaultFont ); |
262 | currentFont = new QFont (abList->font()); | 265 | currentFont = new QFont (abList->font()); |
263 | abList->resizeRows(currentFont->pixelSize() + 7); | 266 | abList->resizeRows(currentFont->pixelSize() + 7); |
264 | break; | 267 | break; |
265 | case 2: | 268 | case 2: |
266 | fontMenu->setItemChecked(0, false); | 269 | fontMenu->setItemChecked(0, false); |
267 | fontMenu->setItemChecked(1, false); | 270 | fontMenu->setItemChecked(1, false); |
268 | fontMenu->setItemChecked(2, true); | 271 | fontMenu->setItemChecked(2, true); |
269 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 272 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
270 | currentFont = new QFont (abList->font()); | 273 | currentFont = new QFont (abList->font()); |
271 | abList->resizeRows(currentFont->pixelSize() + 7); | 274 | abList->resizeRows(currentFont->pixelSize() + 7); |
272 | break; | 275 | break; |
273 | } | 276 | } |
274 | } | 277 | } |
275 | 278 | ||
276 | 279 | ||
277 | void AddressbookWindow::setDocument( const QString &filename ) | 280 | void AddressbookWindow::setDocument( const QString &filename ) |
278 | { | 281 | { |
279 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; | 282 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; |
280 | 283 | ||
281 | QValueList<Contact> cl = Contact::readVCard( filename ); | 284 | QValueList<Contact> cl = Contact::readVCard( filename ); |
282 | for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { | 285 | for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { |
283 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") | 286 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") |
284 | // .arg( (*it).fullName() ); | 287 | // .arg( (*it).fullName() ); |
285 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == | 288 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == |
286 | // QMessageBox::Ok ) { | 289 | // QMessageBox::Ok ) { |
287 | abList->addEntry( *it ); | 290 | abList->addEntry( *it ); |
288 | // } | 291 | // } |
289 | } | 292 | } |
290 | 293 | ||
291 | } | 294 | } |
292 | 295 | ||
293 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 296 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
294 | { | 297 | { |
295 | QMainWindow::resizeEvent( e ); | 298 | QMainWindow::resizeEvent( e ); |
296 | 299 | ||
297 | if ( centralWidget() == abList ) | 300 | if ( centralWidget() == listContainer ) |
298 | showList(); | 301 | showList(); |
299 | else if ( centralWidget() == mView ) | 302 | else if ( centralWidget() == mView ) |
300 | showView(); | 303 | showView(); |
301 | } | 304 | } |
302 | 305 | ||
303 | AddressbookWindow::~AddressbookWindow() | 306 | AddressbookWindow::~AddressbookWindow() |
304 | { | 307 | { |
305 | Config cfg("AddressBook"); | 308 | Config cfg("AddressBook"); |
306 | cfg.setGroup("Font"); | 309 | cfg.setGroup("Font"); |
307 | cfg.writeEntry("fontSize", startFontSize); | 310 | cfg.writeEntry("fontSize", startFontSize); |
308 | } | 311 | } |
309 | 312 | ||
310 | void AddressbookWindow::slotUpdateToolbar() | 313 | void AddressbookWindow::slotUpdateToolbar() |
311 | { | 314 | { |
312 | Contact ce = abList->currentEntry(); | 315 | Contact ce = abList->currentEntry(); |
313 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 316 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
314 | } | 317 | } |
315 | 318 | ||
316 | void AddressbookWindow::showList() | 319 | void AddressbookWindow::showList() |
317 | { | 320 | { |
318 | if ( mView ) mView->hide(); | 321 | if ( mView ) mView->hide(); |
319 | setCentralWidget( abList ); | 322 | setCentralWidget( listContainer ); |
320 | abList->show(); | 323 | listContainer->show(); |
321 | // update our focues... (or use a stack widget!); | 324 | // update our focues... (or use a stack widget!); |
322 | abList->setFocus(); | 325 | abList->setFocus(); |
323 | } | 326 | } |
324 | 327 | ||
325 | void AddressbookWindow::showView() | 328 | void AddressbookWindow::showView() |
326 | { | 329 | { |
327 | if ( abList->numRows() > 0 ) { | 330 | if ( abList->numRows() > 0 ) { |
328 | abList->hide(); | 331 | listContainer->hide(); |
329 | setCentralWidget( abView() ); | 332 | setCentralWidget( abView() ); |
330 | mView->show(); | 333 | mView->show(); |
331 | mView->setFocus(); | 334 | mView->setFocus(); |
332 | } | 335 | } |
333 | } | 336 | } |
334 | 337 | ||
335 | void AddressbookWindow::slotListNew() | 338 | void AddressbookWindow::slotListNew() |
336 | { | 339 | { |
337 | Contact cnt; | 340 | Contact cnt; |
338 | if( !syncing ) { | 341 | if( !syncing ) { |
339 | if ( abEditor ) | 342 | if ( abEditor ) |
340 | abEditor->setEntry( cnt ); | 343 | abEditor->setEntry( cnt ); |
341 | abView()->init( cnt ); | 344 | abView()->init( cnt ); |
342 | editEntry( NewEntry ); | 345 | editEntry( NewEntry ); |
343 | } else { | 346 | } else { |
344 | QMessageBox::warning(this, tr("Contacts"), | 347 | QMessageBox::warning(this, tr("Contacts"), |
345 | tr("Can not edit data, currently syncing")); | 348 | tr("Can not edit data, currently syncing")); |
346 | } | 349 | } |
347 | } | 350 | } |
348 | 351 | ||
349 | void AddressbookWindow::slotListView() | 352 | void AddressbookWindow::slotListView() |
350 | { | 353 | { |
351 | abView()->init( abList->currentEntry() ); | 354 | abView()->init( abList->currentEntry() ); |
352 | mView->sync(); | 355 | mView->sync(); |
353 | showView(); | 356 | showView(); |
354 | } | 357 | } |
355 | 358 | ||
356 | void AddressbookWindow::slotListDelete() | 359 | void AddressbookWindow::slotListDelete() |
357 | { | 360 | { |
358 | if(!syncing) { | 361 | if(!syncing) { |
359 | Contact tmpEntry = abList->currentEntry(); | 362 | Contact tmpEntry = abList->currentEntry(); |
360 | 363 | ||
361 | // get a name, do the best we can... | 364 | // get a name, do the best we can... |
362 | QString strName = tmpEntry.fullName(); | 365 | QString strName = tmpEntry.fullName(); |
363 | if ( strName.isEmpty() ) { | 366 | if ( strName.isEmpty() ) { |
364 | strName = tmpEntry.company(); | 367 | strName = tmpEntry.company(); |
365 | if ( strName.isEmpty() ) | 368 | if ( strName.isEmpty() ) |
366 | strName = "No Name"; | 369 | strName = "No Name"; |
367 | } | 370 | } |
368 | 371 | ||
369 | 372 | ||
370 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 373 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
371 | strName ) ) { | 374 | strName ) ) { |
372 | abList->deleteCurrentEntry(); | 375 | abList->deleteCurrentEntry(); |
373 | showList(); | 376 | showList(); |
374 | } | 377 | } |
375 | } else { | 378 | } else { |
376 | QMessageBox::warning( this, tr("Contacts"), | 379 | QMessageBox::warning( this, tr("Contacts"), |
@@ -556,97 +559,97 @@ void AddressbookWindow::editPersonal() | |||
556 | 559 | ||
557 | abEditor->setCaption(tr("Edit My Personal Details")); | 560 | abEditor->setCaption(tr("Edit My Personal Details")); |
558 | abEditor->showMaximized(); | 561 | abEditor->showMaximized(); |
559 | 562 | ||
560 | // fix the foxus... | 563 | // fix the foxus... |
561 | abEditor->setNameFocus(); | 564 | abEditor->setNameFocus(); |
562 | if ( abEditor->exec() ) { | 565 | if ( abEditor->exec() ) { |
563 | setFocus(); | 566 | setFocus(); |
564 | Contact new_personal = abEditor->entry(); | 567 | Contact new_personal = abEditor->entry(); |
565 | QString fname = addressbookPersonalVCardName(); | 568 | QString fname = addressbookPersonalVCardName(); |
566 | Contact::writeVCard( fname, new_personal ); | 569 | Contact::writeVCard( fname, new_personal ); |
567 | abView()->init(new_personal); | 570 | abView()->init(new_personal); |
568 | abView()->sync(); | 571 | abView()->sync(); |
569 | } | 572 | } |
570 | abEditor->setCaption( tr("Edit Address") ); | 573 | abEditor->setCaption( tr("Edit Address") ); |
571 | } | 574 | } |
572 | 575 | ||
573 | void AddressbookWindow::slotPersonalView() | 576 | void AddressbookWindow::slotPersonalView() |
574 | { | 577 | { |
575 | if (!actionPersonal->isOn()) { | 578 | if (!actionPersonal->isOn()) { |
576 | // we just turned it off | 579 | // we just turned it off |
577 | setCaption( tr("Contacts") ); | 580 | setCaption( tr("Contacts") ); |
578 | actionNew->setEnabled(TRUE); | 581 | actionNew->setEnabled(TRUE); |
579 | actionTrash->setEnabled(TRUE); | 582 | actionTrash->setEnabled(TRUE); |
580 | #ifndef MAKE_FOR_SHARP_ROM | 583 | #ifndef MAKE_FOR_SHARP_ROM |
581 | actionFind->setEnabled(TRUE); | 584 | actionFind->setEnabled(TRUE); |
582 | #endif | 585 | #endif |
583 | slotUpdateToolbar(); // maybe some of the above could be moved there | 586 | slotUpdateToolbar(); // maybe some of the above could be moved there |
584 | showList(); | 587 | showList(); |
585 | return; | 588 | return; |
586 | } | 589 | } |
587 | 590 | ||
588 | // XXX need to disable some QActions. | 591 | // XXX need to disable some QActions. |
589 | actionNew->setEnabled(FALSE); | 592 | actionNew->setEnabled(FALSE); |
590 | actionTrash->setEnabled(FALSE); | 593 | actionTrash->setEnabled(FALSE); |
591 | #ifndef MAKE_FOR_SHARP_ROM | 594 | #ifndef MAKE_FOR_SHARP_ROM |
592 | actionFind->setEnabled(FALSE); | 595 | actionFind->setEnabled(FALSE); |
593 | #endif | 596 | #endif |
594 | actionMail->setEnabled(FALSE); | 597 | actionMail->setEnabled(FALSE); |
595 | 598 | ||
596 | setCaption( tr("Contacts - My Personal Details") ); | 599 | setCaption( tr("Contacts - My Personal Details") ); |
597 | QString filename = addressbookPersonalVCardName(); | 600 | QString filename = addressbookPersonalVCardName(); |
598 | Contact me; | 601 | Contact me; |
599 | if (QFile::exists(filename)) | 602 | if (QFile::exists(filename)) |
600 | me = Contact::readVCard( filename )[0]; | 603 | me = Contact::readVCard( filename )[0]; |
601 | 604 | ||
602 | abView()->init( me ); | 605 | abView()->init( me ); |
603 | abView()->sync(); | 606 | abView()->sync(); |
604 | abList->hide(); | 607 | listContainer->hide(); |
605 | setCentralWidget( abView() ); | 608 | setCentralWidget( abView() ); |
606 | mView->show(); | 609 | mView->show(); |
607 | mView->setFocus(); | 610 | mView->setFocus(); |
608 | } | 611 | } |
609 | 612 | ||
610 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 613 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
611 | { | 614 | { |
612 | Contact entry; | 615 | Contact entry; |
613 | if ( bAbEditFirstTime ) { | 616 | if ( bAbEditFirstTime ) { |
614 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, | 617 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, |
615 | this, "editor" ); | 618 | this, "editor" ); |
616 | bAbEditFirstTime = FALSE; | 619 | bAbEditFirstTime = FALSE; |
617 | if ( entryMode == EditEntry ) | 620 | if ( entryMode == EditEntry ) |
618 | abEditor->setEntry( abList->currentEntry() ); | 621 | abEditor->setEntry( abList->currentEntry() ); |
619 | } | 622 | } |
620 | // other things may chane the caption. | 623 | // other things may chane the caption. |
621 | abEditor->setCaption( tr("Edit Address") ); | 624 | abEditor->setCaption( tr("Edit Address") ); |
622 | 625 | ||
623 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 626 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
624 | abEditor->showMaximized(); | 627 | abEditor->showMaximized(); |
625 | #endif | 628 | #endif |
626 | // fix the foxus... | 629 | // fix the foxus... |
627 | abEditor->setNameFocus(); | 630 | abEditor->setNameFocus(); |
628 | if ( abEditor->exec() ) { | 631 | if ( abEditor->exec() ) { |
629 | setFocus(); | 632 | setFocus(); |
630 | if ( entryMode == NewEntry ) { | 633 | if ( entryMode == NewEntry ) { |
631 | Contact insertEntry = abEditor->entry(); | 634 | Contact insertEntry = abEditor->entry(); |
632 | insertEntry.assignUid(); | 635 | insertEntry.assignUid(); |
633 | abList->addEntry( insertEntry ); | 636 | abList->addEntry( insertEntry ); |
634 | } else { | 637 | } else { |
635 | Contact replaceEntry = abEditor->entry(); | 638 | Contact replaceEntry = abEditor->entry(); |
636 | if ( !replaceEntry.isValidUid() ) | 639 | if ( !replaceEntry.isValidUid() ) |
637 | replaceEntry.assignUid(); | 640 | replaceEntry.assignUid(); |
638 | abList->replaceCurrentEntry( replaceEntry ); | 641 | abList->replaceCurrentEntry( replaceEntry ); |
639 | } | 642 | } |
640 | } | 643 | } |
641 | populateCategories(); | 644 | populateCategories(); |
642 | showList(); | 645 | showList(); |
643 | } | 646 | } |
644 | 647 | ||
645 | void AddressbookWindow::listIsEmpty( bool empty ) | 648 | void AddressbookWindow::listIsEmpty( bool empty ) |
646 | { | 649 | { |
647 | if ( !empty ) { | 650 | if ( !empty ) { |
648 | deleteButton->setEnabled( TRUE ); | 651 | deleteButton->setEnabled( TRUE ); |
649 | } | 652 | } |
650 | } | 653 | } |
651 | 654 | ||
652 | void AddressbookWindow::reload() | 655 | void AddressbookWindow::reload() |
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 31c4660..8e8c883 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h | |||
@@ -44,61 +44,62 @@ protected: | |||
44 | void resizeEvent( QResizeEvent * e ); | 44 | void resizeEvent( QResizeEvent * e ); |
45 | void showList(); | 45 | void showList(); |
46 | void showView(); | 46 | void showView(); |
47 | enum EntryMode { NewEntry=0, EditEntry }; | 47 | enum EntryMode { NewEntry=0, EditEntry }; |
48 | void editPersonal(); | 48 | void editPersonal(); |
49 | void editEntry( EntryMode ); | 49 | void editEntry( EntryMode ); |
50 | void closeEvent( QCloseEvent *e ); | 50 | void closeEvent( QCloseEvent *e ); |
51 | bool save(); | 51 | bool save(); |
52 | 52 | ||
53 | public slots: | 53 | public slots: |
54 | void flush(); | 54 | void flush(); |
55 | void reload(); | 55 | void reload(); |
56 | void appMessage(const QCString &, const QByteArray &); | 56 | void appMessage(const QCString &, const QByteArray &); |
57 | void setDocument( const QString & ); | 57 | void setDocument( const QString & ); |
58 | 58 | ||
59 | private slots: | 59 | private slots: |
60 | void slotListNew(); | 60 | void slotListNew(); |
61 | void slotListView(); | 61 | void slotListView(); |
62 | void slotListDelete(); | 62 | void slotListDelete(); |
63 | void slotViewBack(); | 63 | void slotViewBack(); |
64 | void slotViewEdit(); | 64 | void slotViewEdit(); |
65 | void slotPersonalView(); | 65 | void slotPersonalView(); |
66 | void listIsEmpty( bool ); | 66 | void listIsEmpty( bool ); |
67 | void slotSettings(); | 67 | void slotSettings(); |
68 | void writeMail(); | 68 | void writeMail(); |
69 | void slotBeam(); | 69 | void slotBeam(); |
70 | void beamDone( Ir * ); | 70 | void beamDone( Ir * ); |
71 | void slotFind(); | 71 | void slotFind(); |
72 | void slotSetCategory( int ); | 72 | void slotSetCategory( int ); |
73 | void slotSetLetter( char ); | 73 | void slotSetLetter( char ); |
74 | void slotUpdateToolbar(); | 74 | void slotUpdateToolbar(); |
75 | void slotSetFont(int); | 75 | void slotSetFont(int); |
76 | private: | 76 | private: |
77 | void initFields();// inititialize our fields... | 77 | void initFields();// inititialize our fields... |
78 | AbLabel *abView(); | 78 | AbLabel *abView(); |
79 | void populateCategories(); | 79 | void populateCategories(); |
80 | 80 | ||
81 | QPopupMenu *catMenu, *fontMenu; | 81 | QPopupMenu *catMenu, *fontMenu; |
82 | QPEToolBar *listTools; | 82 | QPEToolBar *listTools; |
83 | QToolButton *deleteButton; | 83 | QToolButton *deleteButton; |
84 | QValueList<int> allFields, | 84 | QValueList<int> allFields, |
85 | orderedFields; | 85 | orderedFields; |
86 | QStringList slOrderedFields; | 86 | QStringList slOrderedFields; |
87 | enum Panes { paneList=0, paneView, paneEdit }; | 87 | enum Panes { paneList=0, paneView, paneEdit }; |
88 | ContactEditor *abEditor; | 88 | ContactEditor *abEditor; |
89 | AbLabel *mView; | 89 | AbLabel *mView; |
90 | LetterPicker *pLabel; | 90 | LetterPicker *pLabel; |
91 | AbTable *abList; | 91 | AbTable *abList; |
92 | QWidget *listContainer; | ||
92 | 93 | ||
93 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, | 94 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, |
94 | *actionPersonal, *actionMail; | 95 | *actionPersonal, *actionMail; |
95 | 96 | ||
96 | bool bAbEditFirstTime; | 97 | bool bAbEditFirstTime; |
97 | int viewMargin; | 98 | int viewMargin; |
98 | 99 | ||
99 | bool syncing; | 100 | bool syncing; |
100 | QFont *defaultFont; | 101 | QFont *defaultFont; |
101 | int startFontSize; | 102 | int startFontSize; |
102 | }; | 103 | }; |
103 | 104 | ||
104 | #endif | 105 | #endif |
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp index 06dcc7d..a165451 100644 --- a/core/pim/addressbook/picker.cpp +++ b/core/pim/addressbook/picker.cpp | |||
@@ -34,148 +34,144 @@ void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) | |||
34 | if (ch1 != '\0') | 34 | if (ch1 != '\0') |
35 | letter1 = ch1; | 35 | letter1 = ch1; |
36 | else | 36 | else |
37 | letter1 = ' '; | 37 | letter1 = ' '; |
38 | 38 | ||
39 | if (ch2 != '\0') | 39 | if (ch2 != '\0') |
40 | letter2 = ch2; | 40 | letter2 = ch2; |
41 | else | 41 | else |
42 | letter2 = ' '; | 42 | letter2 = ' '; |
43 | 43 | ||
44 | if (ch3 != '\0') | 44 | if (ch3 != '\0') |
45 | letter3 = ch3; | 45 | letter3 = ch3; |
46 | else | 46 | else |
47 | letter3 = ' '; | 47 | letter3 = ' '; |
48 | 48 | ||
49 | tmpStr = "<qt>"; | 49 | tmpStr = "<qt>"; |
50 | tmpStr += letter1; | 50 | tmpStr += letter1; |
51 | tmpStr += letter2; | 51 | tmpStr += letter2; |
52 | tmpStr += letter3; | 52 | tmpStr += letter3; |
53 | tmpStr += "</qt>"; | 53 | tmpStr += "</qt>"; |
54 | 54 | ||
55 | setText(tmpStr); | 55 | setText(tmpStr); |
56 | 56 | ||
57 | currentLetter = 0; | 57 | currentLetter = 0; |
58 | 58 | ||
59 | } | 59 | } |
60 | 60 | ||
61 | void PickerLabel::clearLetter() | 61 | void PickerLabel::clearLetter() |
62 | { | 62 | { |
63 | 63 | ||
64 | QString tmpStr; | 64 | QString tmpStr; |
65 | 65 | ||
66 | tmpStr = "<qt>"; | 66 | tmpStr = "<qt>"; |
67 | tmpStr += letter1; | 67 | tmpStr += letter1; |
68 | tmpStr += letter2; | 68 | tmpStr += letter2; |
69 | tmpStr += letter3; | 69 | tmpStr += letter3; |
70 | tmpStr += "</qt>"; | 70 | tmpStr += "</qt>"; |
71 | 71 | ||
72 | setText(tmpStr); | 72 | setText(tmpStr); |
73 | 73 | ||
74 | currentLetter = 0; | 74 | currentLetter = 0; |
75 | 75 | ||
76 | } | 76 | } |
77 | 77 | ||
78 | void PickerLabel::mouseReleaseEvent( QMouseEvent *e ) | 78 | void PickerLabel::mouseReleaseEvent( QMouseEvent *e ) |
79 | { | 79 | { |
80 | QString tmpStr; | 80 | QString tmpStr; |
81 | 81 | ||
82 | if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3) | 82 | if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') |
83 | QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); | 83 | QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); |
84 | 84 | ||
85 | qDebug( "a" ); | ||
86 | switch (currentLetter) { | 85 | switch (currentLetter) { |
87 | case 0: | 86 | case 0: |
88 | tmpStr = "<qt><font color=\"#7F0000\">"; | 87 | tmpStr = "<qt><font color=\"#7F0000\">"; |
89 | tmpStr += letter1; | 88 | tmpStr += letter1; |
90 | tmpStr += "</font>"; | 89 | tmpStr += "</font>"; |
91 | tmpStr += letter2; | 90 | tmpStr += letter2; |
92 | tmpStr += letter3; | 91 | tmpStr += letter3; |
93 | tmpStr += "</qt>"; | 92 | tmpStr += "</qt>"; |
94 | 93 | ||
95 | setText(tmpStr); | 94 | setText(tmpStr); |
96 | 95 | ||
97 | currentLetter++; | 96 | currentLetter++; |
98 | lastLetter = letter1; | 97 | lastLetter = letter1; |
99 | emit selectedLetter( letter1 ); | 98 | emit selectedLetter( letter1 ); |
100 | qDebug( "PickerLabel::mouseReleaseEvent %c", letter1 ); | ||
101 | break; | 99 | break; |
102 | 100 | ||
103 | case 1: | 101 | case 1: |
104 | tmpStr = "<qt>"; | 102 | tmpStr = "<qt>"; |
105 | tmpStr += letter1; | 103 | tmpStr += letter1; |
106 | tmpStr += "<font color=\"#7F0000\">"; | 104 | tmpStr += "<font color=\"#7F0000\">"; |
107 | tmpStr += letter2; | 105 | tmpStr += letter2; |
108 | tmpStr += "</font>"; | 106 | tmpStr += "</font>"; |
109 | tmpStr += letter3; | 107 | tmpStr += letter3; |
110 | tmpStr += "</qt>"; | 108 | tmpStr += "</qt>"; |
111 | 109 | ||
112 | setText(tmpStr); | 110 | setText(tmpStr); |
113 | 111 | ||
114 | currentLetter++; | 112 | currentLetter++; |
115 | lastLetter = letter2; | 113 | lastLetter = letter2; |
116 | emit selectedLetter( letter2 ); | 114 | emit selectedLetter( letter2 ); |
117 | qDebug( "PickerLabel::mouseReleaseEvent %c", letter2 ); | ||
118 | break; | 115 | break; |
119 | 116 | ||
120 | case 2: | 117 | case 2: |
121 | tmpStr = "<qt>"; | 118 | tmpStr = "<qt>"; |
122 | tmpStr += letter1; | 119 | tmpStr += letter1; |
123 | tmpStr += letter2; | 120 | tmpStr += letter2; |
124 | tmpStr += "<font color=\"#7F0000\">"; | 121 | tmpStr += "<font color=\"#7F0000\">"; |
125 | tmpStr += letter3; | 122 | tmpStr += letter3; |
126 | tmpStr += "</font></qt>"; | 123 | tmpStr += "</font></qt>"; |
127 | 124 | ||
128 | setText(tmpStr); | 125 | setText(tmpStr); |
129 | 126 | ||
130 | currentLetter++; | 127 | currentLetter++; |
131 | lastLetter = letter3; | 128 | lastLetter = letter3; |
132 | emit selectedLetter( letter3 ); | 129 | emit selectedLetter( letter3 ); |
133 | qDebug( "PickerLabel::mouseReleaseEvent %c", letter3 ); | ||
134 | break; | 130 | break; |
135 | 131 | ||
136 | default: | 132 | default: |
137 | clearLetter(); | 133 | clearLetter(); |
138 | lastLetter = '\0'; | 134 | lastLetter = '\0'; |
139 | emit selectedLetter( '\0' ); | 135 | emit selectedLetter( '\0' ); |
140 | 136 | ||
141 | 137 | ||
142 | } | 138 | } |
143 | } | 139 | } |
144 | 140 | ||
145 | void PickerLabel::emitClearSignal() { | 141 | void PickerLabel::emitClearSignal() { |
146 | emit clearAll(); | 142 | emit clearAll(); |
147 | } | 143 | } |
148 | 144 | ||
149 | LetterPicker::LetterPicker( QWidget *parent, const char *name ) | 145 | LetterPicker::LetterPicker( QWidget *parent, const char *name ) |
150 | : QFrame( parent, name ) | 146 | : QFrame( parent, name ) |
151 | { | 147 | { |
152 | QHBoxLayout *l = new QHBoxLayout(this); | 148 | QHBoxLayout *l = new QHBoxLayout(this); |
153 | 149 | ||
154 | lblABC = new PickerLabel( this ); | 150 | lblABC = new PickerLabel( this ); |
155 | l->addWidget( lblABC ); | 151 | l->addWidget( lblABC ); |
156 | 152 | ||
157 | lblDEF = new PickerLabel( this ); | 153 | lblDEF = new PickerLabel( this ); |
158 | l->addWidget( lblDEF ); | 154 | l->addWidget( lblDEF ); |
159 | 155 | ||
160 | lblGHI = new PickerLabel( this ); | 156 | lblGHI = new PickerLabel( this ); |
161 | l->addWidget( lblGHI ); | 157 | l->addWidget( lblGHI ); |
162 | 158 | ||
163 | lblJKL = new PickerLabel( this ); | 159 | lblJKL = new PickerLabel( this ); |
164 | l->addWidget( lblJKL ); | 160 | l->addWidget( lblJKL ); |
165 | 161 | ||
166 | lblMNO = new PickerLabel( this ); | 162 | lblMNO = new PickerLabel( this ); |
167 | l->addWidget( lblMNO ); | 163 | l->addWidget( lblMNO ); |
168 | 164 | ||
169 | lblPQR = new PickerLabel( this ); | 165 | lblPQR = new PickerLabel( this ); |
170 | l->addWidget( lblPQR ); | 166 | l->addWidget( lblPQR ); |
171 | 167 | ||
172 | lblSTU = new PickerLabel( this ); | 168 | lblSTU = new PickerLabel( this ); |
173 | l->addWidget( lblSTU ); | 169 | l->addWidget( lblSTU ); |
174 | 170 | ||
175 | lblVWX = new PickerLabel( this ); | 171 | lblVWX = new PickerLabel( this ); |
176 | l->addWidget( lblVWX ); | 172 | l->addWidget( lblVWX ); |
177 | 173 | ||
178 | lblYZ = new PickerLabel( this ); | 174 | lblYZ = new PickerLabel( this ); |
179 | l->addWidget( lblYZ ); | 175 | l->addWidget( lblYZ ); |
180 | 176 | ||
181 | lblABC->setLetters( 'A', 'B', 'C' ); | 177 | lblABC->setLetters( 'A', 'B', 'C' ); |
@@ -183,52 +179,51 @@ LetterPicker::LetterPicker( QWidget *parent, const char *name ) | |||
183 | lblGHI->setLetters( 'G', 'H', 'I' ); | 179 | lblGHI->setLetters( 'G', 'H', 'I' ); |
184 | lblJKL->setLetters( 'J', 'K', 'L' ); | 180 | lblJKL->setLetters( 'J', 'K', 'L' ); |
185 | lblMNO->setLetters( 'M', 'N', 'O' ); | 181 | lblMNO->setLetters( 'M', 'N', 'O' ); |
186 | lblPQR->setLetters( 'P', 'Q', 'R' ); | 182 | lblPQR->setLetters( 'P', 'Q', 'R' ); |
187 | lblSTU->setLetters( 'S', 'T', 'U' ); | 183 | lblSTU->setLetters( 'S', 'T', 'U' ); |
188 | lblVWX->setLetters( 'V', 'W', 'X' ); | 184 | lblVWX->setLetters( 'V', 'W', 'X' ); |
189 | lblYZ->setLetters( 'Y', 'Z', '#' ); | 185 | lblYZ->setLetters( 'Y', 'Z', '#' ); |
190 | 186 | ||
191 | connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 187 | connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
192 | connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 188 | connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
193 | connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 189 | connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
194 | connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 190 | connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
195 | connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 191 | connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
196 | connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 192 | connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
197 | connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 193 | connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
198 | connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 194 | connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
199 | connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 195 | connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
200 | connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); | 196 | connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); |
201 | connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); | 197 | connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); |
202 | connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); | 198 | connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); |
203 | connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); | 199 | connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); |
204 | connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); | 200 | connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); |
205 | connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); | 201 | connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); |
206 | connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); | 202 | connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); |
207 | connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); | 203 | connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); |
208 | connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); | 204 | connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); |
209 | 205 | ||
210 | } | 206 | } |
211 | 207 | ||
212 | LetterPicker::~LetterPicker() | 208 | LetterPicker::~LetterPicker() |
213 | { | 209 | { |
214 | } | 210 | } |
215 | 211 | ||
216 | void LetterPicker::clear() | 212 | void LetterPicker::clear() |
217 | { | 213 | { |
218 | lblABC->clearLetter(); | 214 | lblABC->clearLetter(); |
219 | lblDEF->clearLetter(); | 215 | lblDEF->clearLetter(); |
220 | lblGHI->clearLetter(); | 216 | lblGHI->clearLetter(); |
221 | lblJKL->clearLetter(); | 217 | lblJKL->clearLetter(); |
222 | lblMNO->clearLetter(); | 218 | lblMNO->clearLetter(); |
223 | lblPQR->clearLetter(); | 219 | lblPQR->clearLetter(); |
224 | lblSTU->clearLetter(); | 220 | lblSTU->clearLetter(); |
225 | lblVWX->clearLetter(); | 221 | lblVWX->clearLetter(); |
226 | lblYZ->clearLetter(); | 222 | lblYZ->clearLetter(); |
227 | } | 223 | } |
228 | 224 | ||
229 | void LetterPicker::newLetter( char letter ) | 225 | void LetterPicker::newLetter( char letter ) |
230 | { | 226 | { |
231 | qDebug( "LetterPicker::newLetter %c", letter ); | ||
232 | emit letterClicked( letter ); | 227 | emit letterClicked( letter ); |
233 | 228 | ||
234 | } | 229 | } |