summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 17277b4..759cb48 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -147,12 +147,13 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam
147AbTable::~AbTable() 147AbTable::~AbTable()
148{ 148{
149} 149}
150 150
151void AbTable::init() 151void AbTable::init()
152{ 152{
153 showChar = '\0';
153 setNumRows( 0 ); 154 setNumRows( 0 );
154 setNumCols( 2 ); 155 setNumCols( 2 );
155 156
156 horizontalHeader()->setLabel( 0, tr( "Full Name" )); 157 horizontalHeader()->setLabel( 0, tr( "Full Name" ));
157 horizontalHeader()->setLabel( 1, tr( "Contact" )); 158 horizontalHeader()->setLabel( 1, tr( "Contact" ));
158 setLeftMargin( 0 ); 159 setLeftMargin( 0 );
@@ -449,18 +450,19 @@ void AbTable::addEntry( const Contact &newCnt )
449 insertIntoTable( newCnt, row ); 450 insertIntoTable( newCnt, row );
450 setCurrentCell( row, 0 ); 451 setCurrentCell( row, 0 );
451 updateVisible(); 452 updateVisible();
452} 453}
453 454
454void AbTable::resizeRows( int size ) { 455void AbTable::resizeRows( int size ) {
455 456/*
456 if (numRows()) { 457 if (numRows()) {
457 for (int i = 0; i < numRows(); i++) { 458 for (int i = 0; i < numRows(); i++) {
458 setRowHeight( i, size ); 459 setRowHeight( i, size );
459 } 460 }
460 } 461 }*/
462 updateVisible();
461} 463}
462 464
463void AbTable::updateJournal( const Contact &cnt, 465void AbTable::updateJournal( const Contact &cnt,
464 Contact::journal_action action, int row ) 466 Contact::journal_action action, int row )
465{ 467{
466 QFile f( journalFileName() ); 468 QFile f( journalFileName() );
@@ -1005,12 +1007,19 @@ QStringList AbTable::choiceSelection(int /*index*/) const
1005void AbTable::setShowCategory( const QString &c ) 1007void AbTable::setShowCategory( const QString &c )
1006{ 1008{
1007 showCat = c; 1009 showCat = c;
1008 updateVisible(); 1010 updateVisible();
1009} 1011}
1010 1012
1013void AbTable::setShowByLetter( char c )
1014{
1015 showChar = tolower(c);
1016 qDebug( "AbTable::setShowByLetter %c", showChar);
1017 updateVisible();
1018}
1019
1011QString AbTable::showCategory() const 1020QString AbTable::showCategory() const
1012{ 1021{
1013 return showCat; 1022 return showCat;
1014} 1023}
1015 1024
1016 1025
@@ -1029,23 +1038,26 @@ void AbTable::updateVisible()
1029 totalCats, 1038 totalCats,
1030 it, 1039 it,
1031 row; 1040 row;
1032 bool hide; 1041 bool hide;
1033 AbTableItem *ati; 1042 AbTableItem *ati;
1034 Contact *cnt; 1043 Contact *cnt;
1044 QString fileAsName;
1045 QString tmpStr;
1035 visible = 0; 1046 visible = 0;
1036 1047
1037 setPaintingEnabled( FALSE ); 1048 setPaintingEnabled( FALSE );
1038 1049
1039 totalRows = numRows(); 1050 totalRows = numRows();
1040 id = mCat.id( "Contacts", showCat ); 1051 id = mCat.id( "Contacts", showCat );
1041 QArray<int> cats; 1052 QArray<int> cats;
1042 for ( row = 0; row < totalRows; row++ ) { 1053 for ( row = 0; row < totalRows; row++ ) {
1043 ati = static_cast<AbTableItem*>( item(row, 0) ); 1054 ati = static_cast<AbTableItem*>( item(row, 0) );
1044 cnt = &contactList[ati]; 1055 cnt = &contactList[ati];
1045 cats = cnt->categories(); 1056 cats = cnt->categories();
1057 fileAsName = cnt->fileAs();
1046 hide = false; 1058 hide = false;
1047 if ( !showCat.isEmpty() ) { 1059 if ( !showCat.isEmpty() ) {
1048 if ( showCat == tr( "Unfiled" ) ) { 1060 if ( showCat == tr( "Unfiled" ) ) {
1049 if ( cats.count() > 0 ) 1061 if ( cats.count() > 0 )
1050 hide = true; 1062 hide = true;
1051 } else { 1063 } else {
@@ -1059,12 +1071,22 @@ void AbTable::updateVisible()
1059 break; 1071 break;
1060 } 1072 }
1061 } 1073 }
1062 } 1074 }
1063 } 1075 }
1064 } 1076 }
1077 if ( showChar != '\0' ) {
1078 tmpStr = fileAsName.left(1);
1079 tmpStr = tmpStr.lower();
1080 qDebug( "updateVisible ");
1081 qDebug( tmpStr );
1082 qDebug( "updateVisible2 %c", showChar );
1083 if ( tmpStr != QString(QChar(showChar)) ) {
1084 hide = true;
1085 }
1086 }
1065 if ( hide ) { 1087 if ( hide ) {
1066 if ( currentRow() == row ) 1088 if ( currentRow() == row )
1067 setCurrentCell( -1, 0 ); 1089 setCurrentCell( -1, 0 );
1068 if ( rowHeight(row) > 0 ) 1090 if ( rowHeight(row) > 0 )
1069 hideRow( row ); 1091 hideRow( row );
1070 } else { 1092 } else {