Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (show 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 @@ -147,12 +147,13 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam AbTable::~AbTable() { } void AbTable::init() { + showChar = '\0'; setNumRows( 0 ); setNumCols( 2 ); horizontalHeader()->setLabel( 0, tr( "Full Name" )); horizontalHeader()->setLabel( 1, tr( "Contact" )); setLeftMargin( 0 ); @@ -449,18 +450,19 @@ void AbTable::addEntry( const Contact &newCnt ) insertIntoTable( newCnt, row ); setCurrentCell( row, 0 ); updateVisible(); } void AbTable::resizeRows( int size ) { - +/* if (numRows()) { for (int i = 0; i < numRows(); i++) { setRowHeight( i, size ); } - } + }*/ + updateVisible(); } void AbTable::updateJournal( const Contact &cnt, Contact::journal_action action, int row ) { QFile f( journalFileName() ); @@ -1005,12 +1007,19 @@ QStringList AbTable::choiceSelection(int /*index*/) const void AbTable::setShowCategory( const QString &c ) { showCat = c; updateVisible(); } +void AbTable::setShowByLetter( char c ) +{ + showChar = tolower(c); + qDebug( "AbTable::setShowByLetter %c", showChar); + updateVisible(); +} + QString AbTable::showCategory() const { return showCat; } @@ -1029,23 +1038,26 @@ void AbTable::updateVisible() totalCats, it, row; bool hide; AbTableItem *ati; Contact *cnt; + QString fileAsName; + QString tmpStr; visible = 0; setPaintingEnabled( FALSE ); totalRows = numRows(); id = mCat.id( "Contacts", showCat ); QArray<int> cats; for ( row = 0; row < totalRows; row++ ) { ati = static_cast<AbTableItem*>( item(row, 0) ); cnt = &contactList[ati]; cats = cnt->categories(); + fileAsName = cnt->fileAs(); hide = false; if ( !showCat.isEmpty() ) { if ( showCat == tr( "Unfiled" ) ) { if ( cats.count() > 0 ) hide = true; } else { @@ -1059,12 +1071,22 @@ void AbTable::updateVisible() break; } } } } } + if ( showChar != '\0' ) { + tmpStr = fileAsName.left(1); + tmpStr = tmpStr.lower(); + qDebug( "updateVisible "); + qDebug( tmpStr ); + qDebug( "updateVisible2 %c", showChar ); + if ( tmpStr != QString(QChar(showChar)) ) { + hide = true; + } + } if ( hide ) { if ( currentRow() == row ) setCurrentCell( -1, 0 ); if ( rowHeight(row) > 0 ) hideRow( row ); } else { |