summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index beb953a..8229212 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -181,27 +181,27 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
181 // not to mention it also does the necessary stuff for the 181 // not to mention it also does the necessary stuff for the
182 // journaling... 182 // journaling...
183 QString str = addressbookXMLFilename(); 183 QString str = addressbookXMLFilename();
184 if ( str.isNull() ) { 184 if ( str.isNull() ) {
185 QMessageBox::warning( this, tr("Out of Space"), 185 QMessageBox::warning( this, tr("Out of Space"),
186 tr("There is not enough space to create\n" 186 tr("There is not enough space to create\n"
187 "neccessary startup files.\n" 187 "neccessary startup files.\n"
188 "\nFree up some space before\nentering data!") 188 "\nFree up some space before\nentering data!")
189 ); 189 );
190 } 190 }
191 191
192 listContainer = new QWidget( this ); 192 listContainer = new QWidget( this );
193 193
194 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 194 QVBoxLayout *vb = new QVBoxLayout( listContainer );
195 195
196 abList = new AbTable( &orderedFields, listContainer, "table" ); 196 abList = new AbTable( &orderedFields, listContainer, "table" );
197 vb->addWidget(abList); 197 vb->addWidget(abList);
198 abList->setHScrollBarMode( QScrollView::AlwaysOff ); 198 abList->setHScrollBarMode( QScrollView::AlwaysOff );
199 connect( abList, SIGNAL( empty( bool ) ), 199 connect( abList, SIGNAL( empty( bool ) ),
200 this, SLOT( listIsEmpty( bool ) ) ); 200 this, SLOT( listIsEmpty( bool ) ) );
201 connect( abList, SIGNAL( details() ), 201 connect( abList, SIGNAL( details() ),
202 this, SLOT( slotListView() ) ); 202 this, SLOT( slotListView() ) );
203 connect( abList, SIGNAL(currentChanged(int,int)), 203 connect( abList, SIGNAL(currentChanged(int,int)),
204 this, SLOT(slotUpdateToolbar()) ); 204 this, SLOT(slotUpdateToolbar()) );
205 205
206 mView = 0; 206 mView = 0;
207 207
@@ -224,39 +224,39 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
224 224
225 fontMenu = new QPopupMenu(this); 225 fontMenu = new QPopupMenu(this);
226 fontMenu->setCheckable( true ); 226 fontMenu->setCheckable( true );
227 connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); 227 connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int)));
228 228
229 fontMenu->insertItem(tr( "Small" ), 0); 229 fontMenu->insertItem(tr( "Small" ), 0);
230 fontMenu->insertItem(tr( "Normal" ), 1); 230 fontMenu->insertItem(tr( "Normal" ), 1);
231 fontMenu->insertItem(tr( "Large" ), 2); 231 fontMenu->insertItem(tr( "Large" ), 2);
232 232
233 defaultFont = new QFont( abList->font() ); 233 defaultFont = new QFont( abList->font() );
234 234
235 slotSetFont(startFontSize); 235 slotSetFont(startFontSize);
236 236
237 mbList->insertItem( tr("Font"), fontMenu); 237 mbList->insertItem( tr("Font"), fontMenu);
238 setCentralWidget(listContainer); 238 setCentralWidget(listContainer);
239 239
240 // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); 240 // qDebug("adressbook contrsuction: t=%d", t.elapsed() );
241} 241}
242void AddressbookWindow::slotSetFont( int size ) { 242void AddressbookWindow::slotSetFont( int size ) {
243 243
244 if (size > 2 || size < 0) 244 if (size > 2 || size < 0)
245 size = 1; 245 size = 1;
246 246
247 startFontSize = size; 247 startFontSize = size;
248 248
249 QFont *currentFont; 249 QFont *currentFont;
250 250
251 switch (size) { 251 switch (size) {
252 case 0: 252 case 0:
253 fontMenu->setItemChecked(0, true); 253 fontMenu->setItemChecked(0, true);
254 fontMenu->setItemChecked(1, false); 254 fontMenu->setItemChecked(1, false);
255 fontMenu->setItemChecked(2, false); 255 fontMenu->setItemChecked(2, false);
256 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); 256 abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) );
257 currentFont = new QFont (abList->font()); 257 currentFont = new QFont (abList->font());
258 abList->resizeRows(currentFont->pixelSize() + 7); 258 abList->resizeRows(currentFont->pixelSize() + 7);
259 break; 259 break;
260 case 1: 260 case 1:
261 fontMenu->setItemChecked(0, false); 261 fontMenu->setItemChecked(0, false);
262 fontMenu->setItemChecked(1, true); 262 fontMenu->setItemChecked(1, true);
@@ -462,25 +462,25 @@ static void parseName( const QString& name, QString *first, QString *middle,
462 } else { 462 } else {
463 int space = name.findRev( ' ' ); 463 int space = name.findRev( ' ' );
464 *last = name.mid( space+1 ); 464 *last = name.mid( space+1 );
465 rest = name.left( space ); 465 rest = name.left( space );
466 } 466 }
467 int space = rest.find( ' ' ); 467 int space = rest.find( ' ' );
468 if ( space <= 0 ) { 468 if ( space <= 0 ) {
469 *first = rest; 469 *first = rest;
470 } else { 470 } else {
471 *first = rest.left( space ); 471 *first = rest.left( space );
472 *middle = rest.mid( space+1 ); 472 *middle = rest.mid( space+1 );
473 } 473 }
474 474
475} 475}
476 476
477 477
478void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 478void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
479{ 479{
480 if (msg == "editPersonal()") { 480 if (msg == "editPersonal()") {
481 editPersonal(); 481 editPersonal();
482 } else if (msg == "editPersonalAndClose()") { 482 } else if (msg == "editPersonalAndClose()") {
483 editPersonal(); 483 editPersonal();
484 close(); 484 close();
485 } else if ( msg == "addContact(QString,QString)" ) { 485 } else if ( msg == "addContact(QString,QString)" ) {
486 QDataStream stream(data,IO_ReadOnly); 486 QDataStream stream(data,IO_ReadOnly);
@@ -494,25 +494,25 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
494 cnt.setFirstName( fn ); 494 cnt.setFirstName( fn );
495 cnt.setMiddleName( mn ); 495 cnt.setMiddleName( mn );
496 cnt.setLastName( ln ); 496 cnt.setLastName( ln );
497 cnt.setEmails( email ); 497 cnt.setEmails( email );
498 cnt.setDefaultEmail( email ); 498 cnt.setDefaultEmail( email );
499 cnt.setFileAs(); 499 cnt.setFileAs();
500 500
501 if ( bAbEditFirstTime ) { 501 if ( bAbEditFirstTime ) {
502 abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, 502 abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields,
503 this, "editor" ); 503 this, "editor" );
504 bAbEditFirstTime = FALSE; 504 bAbEditFirstTime = FALSE;
505 } else { 505 } else {
506 abEditor->setEntry( cnt ); 506 abEditor->setEntry( cnt );
507 } 507 }
508 abView()->init( cnt ); 508 abView()->init( cnt );
509 editEntry( NewEntry ); 509 editEntry( NewEntry );
510 510
511 511
512 512
513 } 513 }
514#if 0 514#if 0
515 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { 515 else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
516 QDataStream stream(data,IO_ReadOnly); 516 QDataStream stream(data,IO_ReadOnly);
517 QCString ch,m; 517 QCString ch,m;
518 QStringList types; 518 QStringList types;
@@ -785,25 +785,25 @@ void AddressbookWindow::initFields()
785 785
786 zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); 786 zn = cfg.readEntry( "Category" + QString::number(i), QString::null );
787 while ( !zn.isNull() ) { 787 while ( !zn.isNull() ) {
788 if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) { 788 if ( zn.contains( tr("Work") ) || zn.contains( tr("Mb") ) ) {
789 slOrderedFields.clear(); 789 slOrderedFields.clear();
790 break; 790 break;
791 } 791 }
792 slOrderedFields.append( zn ); 792 slOrderedFields.append( zn );
793 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); 793 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null );
794 } 794 }
795 cfg.setGroup( "Font" ); 795 cfg.setGroup( "Font" );
796 startFontSize = cfg.readNumEntry( "fontSize", 1 ); 796 startFontSize = cfg.readNumEntry( "fontSize", 1 );
797 797
798 798
799 } else { 799 } else {
800 QString str; 800 QString str;
801 str = getenv("HOME"); 801 str = getenv("HOME");
802 str += "/Settings/AddressBook.conf"; 802 str += "/Settings/AddressBook.conf";
803 QFile::remove( str ); 803 QFile::remove( str );
804 } 804 }
805 if ( slOrderedFields.count() > 0 ) { 805 if ( slOrderedFields.count() > 0 ) {
806 for( QStringList::ConstIterator it = slOrderedFields.begin(); 806 for( QStringList::ConstIterator it = slOrderedFields.begin();
807 it != slOrderedFields.end(); ++it ) { 807 it != slOrderedFields.end(); ++it ) {
808 QValueList<int>::ConstIterator itVl; 808 QValueList<int>::ConstIterator itVl;
809 QStringList::ConstIterator itVis; 809 QStringList::ConstIterator itVis;
@@ -850,32 +850,32 @@ AbLabel *AddressbookWindow::abView()
850 mView = new AbLabel( this, "viewer" ); 850 mView = new AbLabel( this, "viewer" );
851 mView->init( Contact() ); 851 mView->init( Contact() );
852 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 852 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
853 } 853 }
854 return mView; 854 return mView;
855} 855}
856 856
857void AddressbookWindow::slotFind() 857void AddressbookWindow::slotFind()
858{ 858{
859#ifndef MAKE_FOR_SHARP_ROM 859#ifndef MAKE_FOR_SHARP_ROM
860 if ( centralWidget() == abView() ) 860 if ( centralWidget() == abView() )
861 showList(); 861 showList();
862 862
863 FindDialog frmFind( "Contacts", this ); 863 FindDialog frmFind( "Contacts", this );
864 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 864 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int)));
865 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 865 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
866 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 866 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
867 867
868 frmFind.exec(); 868 frmFind.exec();
869 869
870 if ( abList->numSelections() ) 870 if ( abList->numSelections() )
871 abList->clearSelection(); 871 abList->clearSelection();
872 872
873 abList->clearFindRow(); 873 abList->clearFindRow();
874#endif 874#endif
875} 875}
876 876
877void AddressbookWindow::slotSetCategory( int c ) 877void AddressbookWindow::slotSetCategory( int c )
878{ 878{
879 if ( c <= 0 ) 879 if ( c <= 0 )
880 return; 880 return;
881 for ( unsigned int i = 1; i < catMenu->count(); i++ ) 881 for ( unsigned int i = 1; i < catMenu->count(); i++ )
@@ -897,24 +897,25 @@ void AddressbookWindow::slotSetLetter( char c ) {
897 897
898 abList->setShowByLetter( c ); 898 abList->setShowByLetter( c );
899 899
900} 900}
901 901
902void AddressbookWindow::populateCategories() 902void AddressbookWindow::populateCategories()
903{ 903{
904 catMenu->clear(); 904 catMenu->clear();
905 905
906 int id, 906 int id,
907 rememberId; 907 rememberId;
908 id = 1; 908 id = 1;
909 rememberId = 0;
909 catMenu->insertItem( tr( "All" ), id++ ); 910 catMenu->insertItem( tr( "All" ), id++ );
910 QStringList categories = abList->categories(); 911 QStringList categories = abList->categories();
911 categories.append( tr( "Unfiled" ) ); 912 categories.append( tr( "Unfiled" ) );
912 for ( QStringList::Iterator it = categories.begin(); 913 for ( QStringList::Iterator it = categories.begin();
913 it != categories.end(); ++it ) { 914 it != categories.end(); ++it ) {
914 catMenu->insertItem( *it, id ); 915 catMenu->insertItem( *it, id );
915 if ( *it == abList->showCategory() ) 916 if ( *it == abList->showCategory() )
916 rememberId = id; 917 rememberId = id;
917 ++id; 918 ++id;
918 } 919 }
919 if ( abList->showCategory().isEmpty() ) 920 if ( abList->showCategory().isEmpty() )
920 slotSetCategory( 1 ); 921 slotSetCategory( 1 );