summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp86
-rw-r--r--core/pim/addressbook/addressbook.cpp27
-rw-r--r--core/pim/addressbook/addressbook.h1
-rw-r--r--core/pim/addressbook/picker.cpp7
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
@@ -992,49 +992,48 @@ QStringList AbTable::choiceSelection(int /*index*/) const
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
1007void AbTable::setShowCategory( const QString &c ) 1007void AbTable::setShowCategory( const QString &c )
1008{ 1008{
1009 showCat = c; 1009 showCat = c;
1010 updateVisible(); 1010 updateVisible();
1011} 1011}
1012 1012
1013void AbTable::setShowByLetter( char c ) 1013void 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
1020QString AbTable::showCategory() const 1019QString AbTable::showCategory() const
1021{ 1020{
1022 return showCat; 1021 return showCat;
1023} 1022}
1024 1023
1025 1024
1026QStringList AbTable::categories() 1025QStringList 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
1033void AbTable::updateVisible() 1032void 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;
@@ -1056,54 +1055,131 @@ void AbTable::updateVisible()
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
1107void AbTable::setPaintingEnabled( bool e ) 1183void AbTable::setPaintingEnabled( bool e )
1108{ 1184{
1109 if ( e != enablePainting ) { 1185 if ( e != enablePainting ) {
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
@@ -78,49 +78,48 @@ static QString addressbookXMLFilename()
78} 78}
79 79
80static QString addressbookPersonalVCardName() 80static 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
88AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 88AddressbookWindow::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;
@@ -169,91 +168,95 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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}
239void AddressbookWindow::slotSetFont( int size ) { 242void 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);
@@ -273,80 +276,80 @@ void AddressbookWindow::slotSetFont( int size ) {
273 } 276 }
274} 277}
275 278
276 279
277void AddressbookWindow::setDocument( const QString &filename ) 280void 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
293void AddressbookWindow::resizeEvent( QResizeEvent *e ) 296void 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
303AddressbookWindow::~AddressbookWindow() 306AddressbookWindow::~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
310void AddressbookWindow::slotUpdateToolbar() 313void 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
316void AddressbookWindow::showList() 319void 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
325void AddressbookWindow::showView() 328void 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
335void AddressbookWindow::slotListNew() 338void 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
349void AddressbookWindow::slotListView() 352void AddressbookWindow::slotListView()
350{ 353{
351 abView()->init( abList->currentEntry() ); 354 abView()->init( abList->currentEntry() );
352 mView->sync(); 355 mView->sync();
@@ -580,49 +583,49 @@ void AddressbookWindow::slotPersonalView()
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
610void AddressbookWindow::editEntry( EntryMode entryMode ) 613void 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() ) {
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
@@ -68,37 +68,38 @@ private slots:
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);
76private: 76private:
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
@@ -58,100 +58,96 @@ void PickerLabel::setLetters( char ch1, char ch2, char ch3 )
58 58
59} 59}
60 60
61void PickerLabel::clearLetter() 61void 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
78void PickerLabel::mouseReleaseEvent( QMouseEvent *e ) 78void 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
145void PickerLabel::emitClearSignal() { 141void PickerLabel::emitClearSignal() {
146 emit clearAll(); 142 emit clearAll();
147} 143}
148 144
149LetterPicker::LetterPicker( QWidget *parent, const char *name ) 145LetterPicker::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 );
@@ -207,28 +203,27 @@ LetterPicker::LetterPicker( QWidget *parent, const char *name )
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
212LetterPicker::~LetterPicker() 208LetterPicker::~LetterPicker()
213{ 209{
214} 210}
215 211
216void LetterPicker::clear() 212void 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
229void LetterPicker::newLetter( char letter ) 225void LetterPicker::newLetter( char letter )
230{ 226{
231 qDebug( "LetterPicker::newLetter %c", letter );
232 emit letterClicked( letter ); 227 emit letterClicked( letter );
233 228
234} 229}