-rw-r--r-- | core/pim/addressbook/abtable.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index e9e6a0b..3fa1a7c 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -563,4 +563,6 @@ void AbTable::loadFile( const QString &strFile, bool journalFile ) | |||
563 | QByteArray ba = f.readAll(); | 563 | QByteArray ba = f.readAll(); |
564 | f.close(); | 564 | f.close(); |
565 | if (ba.isEmpty() ) | ||
566 | return; | ||
565 | char *uc = ba.data();//(QChar *)data.unicode(); | 567 | char *uc = ba.data();//(QChar *)data.unicode(); |
566 | int len = ba.size();//data.length(); | 568 | int len = ba.size();//data.length(); |
@@ -798,15 +800,22 @@ void AbTable::journalFreeReplace( const Contact &cnt, int row ) | |||
798 | QString strName, | 800 | QString strName, |
799 | strContact; | 801 | strContact; |
800 | AbTableItem *ati; | 802 | AbTableItem *ati = 0l; |
801 | 803 | ||
802 | strName = findContactName( cnt ); | 804 | strName = findContactName( cnt ); |
803 | strContact = findContactContact( cnt ); | 805 | strContact = findContactContact( cnt ); |
804 | ati = static_cast<AbTableItem*>(item(row, 0)); | 806 | ati = static_cast<AbTableItem*>(item(row, 0)); |
805 | contactList.remove( ati ); | 807 | if ( ati != 0 ) { |
806 | ati->setItem( strName, strContact ); | 808 | contactList.remove( ati ); |
807 | contactList.insert( ati, cnt ); | 809 | ati->setItem( strName, strContact ); |
808 | 810 | contactList.insert( ati, cnt ); | |
809 | ati = static_cast<AbTableItem*>(item(row, 1)); | 811 | |
810 | ati->setItem( strContact, strName ); | 812 | ati = static_cast<AbTableItem*>(item(row, 1)); |
813 | ati->setItem( strContact, strName ); | ||
814 | }else{ | ||
815 | int myrows = numRows(); | ||
816 | setNumRows( myrows + 1 ); | ||
817 | insertIntoTable( cnt, myrows ); | ||
818 | // gets deleted when returning | ||
819 | } | ||
811 | } | 820 | } |
812 | 821 | ||
@@ -1084,5 +1093,5 @@ void AbTable::updateVisible() | |||
1084 | if (tmpStr == "a") | 1093 | if (tmpStr == "a") |
1085 | hide = true; | 1094 | hide = true; |
1086 | 1095 | ||
1087 | if (tmpStr == "b") | 1096 | if (tmpStr == "b") |
1088 | hide = true; | 1097 | hide = true; |