-rw-r--r-- | core/pim/addressbook/TODO | 8 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 21 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 5 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 56 |
4 files changed, 25 insertions, 65 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 32d2838..7bc906d 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO @@ -1,10 +1,11 @@ Stuff todo: Urgent: -- Syncing: abtable not reloaded after sync. + +- Font menu is invisible using german translation Important: - Finishing of new View functions (List, Phonebook...) - Reload if contacts were changed externally - "What's this" should be added @@ -17,10 +18,11 @@ Less important: - Find widget should be replaced by something like qpdf has. - The picker (alphabetical sort widget) should be placed verticaly or horizontally (configurable) -Should be Fixed: +Should be Fixed (not absolute sure, need validation): - "Nonenglish" translation bug has to be fixed. -Fixed:
\ No newline at end of file +Fixed: +- Syncing: abtable not reloaded after sync. diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 70c070f..91a7171 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -467,23 +467,22 @@ void AbTable::resizeRows() { } updateVisible(); */ } -bool AbTable::save( const QString& /* fn */ ) +bool AbTable::save() { // QTime t; // t.start(); qWarning("abtable:Save data"); - m_contactdb.save(); - - return true; + + return m_contactdb.save(); } -void AbTable::load( const QString& /* fn */ ) +void AbTable::load() { setSorting( false ); setUpdatesEnabled( FALSE ); qWarning("abtable:Load data"); @@ -491,21 +490,25 @@ void AbTable::load( const QString& /* fn */ ) OContactAccess::List::Iterator it; setNumRows( list.count() ); int row = 0; for ( it = list.begin(); it != list.end(); ++it ) insertIntoTable( *it, row++ ); - resort(); - setUpdatesEnabled( TRUE ); - + setSorting( true ); - //resort(); + resort(); } +void AbTable::reload() +{ + m_contactdb.reload(); + load(); +} + void AbTable::realignTable( int row ) { QTableItem *ti1, *ti2; int totalRows = numRows(); for ( int curr = row; curr < totalRows - 1; curr++ ) { diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h index 84aef1e..80c3ca0 100644 --- a/core/pim/addressbook/abtable.h +++ b/core/pim/addressbook/abtable.h @@ -74,14 +74,15 @@ public: void deleteCurrentEntry(); void clear(); void clearFindRow() { currFindRow = -2; } void loadFields(); void refresh(); - bool save( const QString &fn ); - void load( const QString &fn ); + bool save(); + void load(); + void reload(); // addresspicker mode void setChoiceNames( const QStringList& list); QStringList choiceNames() const; void setChoiceSelection(int index, const QStringList& list); QStringList choiceSelection(int index) const; diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 2eb9ddf..93581e8 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -64,24 +64,12 @@ #include <fcntl.h> #include <unistd.h> #include <qdatetime.h> #include "picker.h" -static QString addressbookOldXMLFilename() -{ - QString filename = QPEApplication::documentDir() + "addressbook.xml"; - return filename; -} - -static QString addressbookXMLFilename() -{ - QString filename = Global::applicationFileName("addressbook", - "addressbook.xml"); - return filename; -} static QString addressbookPersonalVCardName() { QString filename = Global::applicationFileName("addressbook", "businesscard.vcf"); return filename; @@ -199,27 +187,12 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); a->addTo( edit ); // Create Views - - // This is safe to call without checking to see if it exists... - // not to mention it also does the necessary stuff for the - // journaling... - QString str = addressbookXMLFilename(); - if ( str.isNull() ) { - QMessageBox::warning( - this, - tr("Out of Space"), - tr("There is not enough space to create\n" - "neccessary startup files.\n" - "\nFree up some space before\nentering data!") - ); - } - listContainer = new QWidget( this ); QVBoxLayout *vb = new QVBoxLayout( listContainer ); abList = new AbTable( &orderedFields, listContainer, "table" ); vb->addWidget(abList); @@ -227,17 +200,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); mView = 0; - abList->load( addressbookXMLFilename() ); - if ( QFile::exists(addressbookOldXMLFilename()) ) { - abList->load( addressbookOldXMLFilename() ); - QFile::remove(addressbookOldXMLFilename()); - } + abList->load(); pLabel = new LetterPicker( listContainer ); connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); vb->addWidget(pLabel); catMenu = new QPopupMenu( this ); catMenu->setCheckable( TRUE ); @@ -706,19 +675,19 @@ void AddressbookWindow::listIsEmpty( bool empty ) } void AddressbookWindow::reload() { syncing = FALSE; abList->clear(); - abList->load( addressbookXMLFilename() ); + abList->reload(); } void AddressbookWindow::flush() { syncing = TRUE; - abList->save( addressbookXMLFilename() ); + abList->save(); } void AddressbookWindow::closeEvent( QCloseEvent *e ) { if ( centralWidget() == mView ) { @@ -752,39 +721,24 @@ void AddressbookWindow::closeEvent( QCloseEvent *e ) /* Returns TRUE if it is OK to exit */ bool AddressbookWindow::save() { - QString str = addressbookXMLFilename(); - if ( str.isNull() ) { - if ( QMessageBox::critical( 0, tr("Out of space"), + if ( !abList->save() ) { + if ( QMessageBox::critical( 0, tr( "Out of space" ), tr("Unable to save information.\n" "Free up some space\n" "and try again.\n" "\nQuit anyway?"), QMessageBox::Yes|QMessageBox::Escape, QMessageBox::No|QMessageBox::Default ) != QMessageBox::No ) return TRUE; else return FALSE; - } else { - if ( !abList->save( str ) ) { - if ( QMessageBox::critical( 0, tr( "Out of space" ), - tr("Unable to save information.\n" - "Free up some space\n" - "and try again.\n" - "\nQuit anyway?"), - QMessageBox::Yes|QMessageBox::Escape, - QMessageBox::No|QMessageBox::Default ) - != QMessageBox::No ) - return TRUE; - else - return FALSE; - } } return TRUE; } void AddressbookWindow::slotSettings() { |