summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp25
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 )
QByteArray ba = f.readAll();
f.close();
+ if (ba.isEmpty() )
+ return;
char *uc = ba.data();//(QChar *)data.unicode();
int len = ba.size();//data.length();
@@ -798,15 +800,22 @@ void AbTable::journalFreeReplace( const Contact &cnt, int row )
QString strName,
strContact;
- AbTableItem *ati;
+ AbTableItem *ati = 0l;
strName = findContactName( cnt );
strContact = findContactContact( cnt );
ati = static_cast<AbTableItem*>(item(row, 0));
- contactList.remove( ati );
- ati->setItem( strName, strContact );
- contactList.insert( ati, cnt );
-
- ati = static_cast<AbTableItem*>(item(row, 1));
- ati->setItem( strContact, strName );
+ if ( ati != 0 ) {
+ contactList.remove( ati );
+ ati->setItem( strName, strContact );
+ contactList.insert( ati, cnt );
+
+ ati = static_cast<AbTableItem*>(item(row, 1));
+ ati->setItem( strContact, strName );
+ }else{
+ int myrows = numRows();
+ setNumRows( myrows + 1 );
+ insertIntoTable( cnt, myrows );
+ // gets deleted when returning
+ }
}
@@ -1084,5 +1093,5 @@ void AbTable::updateVisible()
if (tmpStr == "a")
hide = true;
-
+
if (tmpStr == "b")
hide = true;