Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 26 |
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 | |||
@@ -150,6 +150,7 @@ AbTable::~AbTable() | |||
150 | 150 | ||
151 | void AbTable::init() | 151 | void AbTable::init() |
152 | { | 152 | { |
153 | showChar = '\0'; | ||
153 | setNumRows( 0 ); | 154 | setNumRows( 0 ); |
154 | setNumCols( 2 ); | 155 | setNumCols( 2 ); |
155 | 156 | ||
@@ -452,12 +453,13 @@ void AbTable::addEntry( const Contact &newCnt ) | |||
452 | } | 453 | } |
453 | 454 | ||
454 | void AbTable::resizeRows( int size ) { | 455 | void 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 | ||
463 | void AbTable::updateJournal( const Contact &cnt, | 465 | void AbTable::updateJournal( const Contact &cnt, |
@@ -1008,6 +1010,13 @@ void AbTable::setShowCategory( const QString &c ) | |||
1008 | updateVisible(); | 1010 | updateVisible(); |
1009 | } | 1011 | } |
1010 | 1012 | ||
1013 | void AbTable::setShowByLetter( char c ) | ||
1014 | { | ||
1015 | showChar = tolower(c); | ||
1016 | qDebug( "AbTable::setShowByLetter %c", showChar); | ||
1017 | updateVisible(); | ||
1018 | } | ||
1019 | |||
1011 | QString AbTable::showCategory() const | 1020 | QString AbTable::showCategory() const |
1012 | { | 1021 | { |
1013 | return showCat; | 1022 | return showCat; |
@@ -1032,6 +1041,8 @@ void AbTable::updateVisible() | |||
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 ); |
@@ -1043,6 +1054,7 @@ void AbTable::updateVisible() | |||
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" ) ) { |
@@ -1062,6 +1074,16 @@ void AbTable::updateVisible() | |||
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 ); |