author | eilers <eilers> | 2002-10-16 10:55:17 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-16 10:55:17 (UTC) |
commit | 2bfae6336f88a460311abaf727256c3413b27f67 (patch) (unidiff) | |
tree | f554fcecb260ef506a839f4d7994f427ad184555 | |
parent | f9756ca203a06fa60413ef1a96416d87b9dc1a6b (diff) | |
download | opie-2bfae6336f88a460311abaf727256c3413b27f67.zip opie-2bfae6336f88a460311abaf727256c3413b27f67.tar.gz opie-2bfae6336f88a460311abaf727256c3413b27f67.tar.bz2 |
Fixed reload after sync- bug
-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 @@ | |||
1 | Stuff todo: | 1 | Stuff todo: |
2 | 2 | ||
3 | Urgent: | 3 | Urgent: |
4 | - Syncing: abtable not reloaded after sync. | 4 | |
5 | - Font menu is invisible using german translation | ||
5 | 6 | ||
6 | Important: | 7 | Important: |
7 | 8 | ||
8 | - Finishing of new View functions (List, Phonebook...) | 9 | - Finishing of new View functions (List, Phonebook...) |
9 | - Reload if contacts were changed externally | 10 | - Reload if contacts were changed externally |
10 | - "What's this" should be added | 11 | - "What's this" should be added |
@@ -17,10 +18,11 @@ Less important: | |||
17 | - Find widget should be replaced by something like | 18 | - Find widget should be replaced by something like |
18 | qpdf has. | 19 | qpdf has. |
19 | - The picker (alphabetical sort widget) should be | 20 | - The picker (alphabetical sort widget) should be |
20 | placed verticaly or horizontally (configurable) | 21 | placed verticaly or horizontally (configurable) |
21 | 22 | ||
22 | 23 | ||
23 | Should be Fixed: | 24 | Should be Fixed (not absolute sure, need validation): |
24 | - "Nonenglish" translation bug has to be fixed. | 25 | - "Nonenglish" translation bug has to be fixed. |
25 | 26 | ||
26 | Fixed: \ No newline at end of file | 27 | Fixed: |
28 | - 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() { | |||
467 | } | 467 | } |
468 | updateVisible(); | 468 | updateVisible(); |
469 | */ | 469 | */ |
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | bool AbTable::save( const QString& /* fn */ ) | 473 | bool AbTable::save() |
474 | { | 474 | { |
475 | // QTime t; | 475 | // QTime t; |
476 | // t.start(); | 476 | // t.start(); |
477 | qWarning("abtable:Save data"); | 477 | qWarning("abtable:Save data"); |
478 | m_contactdb.save(); | 478 | |
479 | 479 | return m_contactdb.save(); | |
480 | return true; | ||
481 | } | 480 | } |
482 | 481 | ||
483 | void AbTable::load( const QString& /* fn */ ) | 482 | void AbTable::load() |
484 | { | 483 | { |
485 | setSorting( false ); | 484 | setSorting( false ); |
486 | setUpdatesEnabled( FALSE ); | 485 | setUpdatesEnabled( FALSE ); |
487 | 486 | ||
488 | qWarning("abtable:Load data"); | 487 | qWarning("abtable:Load data"); |
489 | 488 | ||
@@ -491,21 +490,25 @@ void AbTable::load( const QString& /* fn */ ) | |||
491 | OContactAccess::List::Iterator it; | 490 | OContactAccess::List::Iterator it; |
492 | setNumRows( list.count() ); | 491 | setNumRows( list.count() ); |
493 | int row = 0; | 492 | int row = 0; |
494 | for ( it = list.begin(); it != list.end(); ++it ) | 493 | for ( it = list.begin(); it != list.end(); ++it ) |
495 | insertIntoTable( *it, row++ ); | 494 | insertIntoTable( *it, row++ ); |
496 | 495 | ||
497 | resort(); | ||
498 | |||
499 | setUpdatesEnabled( TRUE ); | 496 | setUpdatesEnabled( TRUE ); |
500 | 497 | ||
501 | setSorting( true ); | 498 | setSorting( true ); |
502 | //resort(); | 499 | resort(); |
503 | } | 500 | } |
504 | 501 | ||
505 | 502 | ||
503 | void AbTable::reload() | ||
504 | { | ||
505 | m_contactdb.reload(); | ||
506 | load(); | ||
507 | } | ||
508 | |||
506 | void AbTable::realignTable( int row ) | 509 | void AbTable::realignTable( int row ) |
507 | { | 510 | { |
508 | QTableItem *ti1, | 511 | QTableItem *ti1, |
509 | *ti2; | 512 | *ti2; |
510 | int totalRows = numRows(); | 513 | int totalRows = numRows(); |
511 | for ( int curr = row; curr < totalRows - 1; curr++ ) { | 514 | 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: | |||
74 | 74 | ||
75 | void deleteCurrentEntry(); | 75 | void deleteCurrentEntry(); |
76 | void clear(); | 76 | void clear(); |
77 | void clearFindRow() { currFindRow = -2; } | 77 | void clearFindRow() { currFindRow = -2; } |
78 | void loadFields(); | 78 | void loadFields(); |
79 | void refresh(); | 79 | void refresh(); |
80 | bool save( const QString &fn ); | 80 | bool save(); |
81 | void load( const QString &fn ); | 81 | void load(); |
82 | void reload(); | ||
82 | 83 | ||
83 | // addresspicker mode | 84 | // addresspicker mode |
84 | void setChoiceNames( const QStringList& list); | 85 | void setChoiceNames( const QStringList& list); |
85 | QStringList choiceNames() const; | 86 | QStringList choiceNames() const; |
86 | void setChoiceSelection(int index, const QStringList& list); | 87 | void setChoiceSelection(int index, const QStringList& list); |
87 | QStringList choiceSelection(int index) const; | 88 | 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 @@ | |||
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | #include <unistd.h> | 65 | #include <unistd.h> |
66 | 66 | ||
67 | #include <qdatetime.h> | 67 | #include <qdatetime.h> |
68 | 68 | ||
69 | #include "picker.h" | 69 | #include "picker.h" |
70 | static QString addressbookOldXMLFilename() | ||
71 | { | ||
72 | QString filename = QPEApplication::documentDir() + "addressbook.xml"; | ||
73 | return filename; | ||
74 | } | ||
75 | |||
76 | static QString addressbookXMLFilename() | ||
77 | { | ||
78 | QString filename = Global::applicationFileName("addressbook", | ||
79 | "addressbook.xml"); | ||
80 | return filename; | ||
81 | } | ||
82 | 70 | ||
83 | static QString addressbookPersonalVCardName() | 71 | static QString addressbookPersonalVCardName() |
84 | { | 72 | { |
85 | QString filename = Global::applicationFileName("addressbook", | 73 | QString filename = Global::applicationFileName("addressbook", |
86 | "businesscard.vcf"); | 74 | "businesscard.vcf"); |
87 | return filename; | 75 | return filename; |
@@ -199,27 +187,12 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
199 | 187 | ||
200 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 188 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
201 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 189 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
202 | a->addTo( edit ); | 190 | a->addTo( edit ); |
203 | 191 | ||
204 | // Create Views | 192 | // Create Views |
205 | |||
206 | // This is safe to call without checking to see if it exists... | ||
207 | // not to mention it also does the necessary stuff for the | ||
208 | // journaling... | ||
209 | QString str = addressbookXMLFilename(); | ||
210 | if ( str.isNull() ) { | ||
211 | QMessageBox::warning( | ||
212 | this, | ||
213 | tr("Out of Space"), | ||
214 | tr("There is not enough space to create\n" | ||
215 | "neccessary startup files.\n" | ||
216 | "\nFree up some space before\nentering data!") | ||
217 | ); | ||
218 | } | ||
219 | |||
220 | listContainer = new QWidget( this ); | 193 | listContainer = new QWidget( this ); |
221 | 194 | ||
222 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 195 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
223 | 196 | ||
224 | abList = new AbTable( &orderedFields, listContainer, "table" ); | 197 | abList = new AbTable( &orderedFields, listContainer, "table" ); |
225 | vb->addWidget(abList); | 198 | vb->addWidget(abList); |
@@ -227,17 +200,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
227 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); | 200 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); |
228 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); | 201 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); |
229 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); | 202 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); |
230 | 203 | ||
231 | mView = 0; | 204 | mView = 0; |
232 | 205 | ||
233 | abList->load( addressbookXMLFilename() ); | 206 | abList->load(); |
234 | if ( QFile::exists(addressbookOldXMLFilename()) ) { | ||
235 | abList->load( addressbookOldXMLFilename() ); | ||
236 | QFile::remove(addressbookOldXMLFilename()); | ||
237 | } | ||
238 | 207 | ||
239 | pLabel = new LetterPicker( listContainer ); | 208 | pLabel = new LetterPicker( listContainer ); |
240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 209 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
241 | vb->addWidget(pLabel); | 210 | vb->addWidget(pLabel); |
242 | catMenu = new QPopupMenu( this ); | 211 | catMenu = new QPopupMenu( this ); |
243 | catMenu->setCheckable( TRUE ); | 212 | catMenu->setCheckable( TRUE ); |
@@ -706,19 +675,19 @@ void AddressbookWindow::listIsEmpty( bool empty ) | |||
706 | } | 675 | } |
707 | 676 | ||
708 | void AddressbookWindow::reload() | 677 | void AddressbookWindow::reload() |
709 | { | 678 | { |
710 | syncing = FALSE; | 679 | syncing = FALSE; |
711 | abList->clear(); | 680 | abList->clear(); |
712 | abList->load( addressbookXMLFilename() ); | 681 | abList->reload(); |
713 | } | 682 | } |
714 | 683 | ||
715 | void AddressbookWindow::flush() | 684 | void AddressbookWindow::flush() |
716 | { | 685 | { |
717 | syncing = TRUE; | 686 | syncing = TRUE; |
718 | abList->save( addressbookXMLFilename() ); | 687 | abList->save(); |
719 | } | 688 | } |
720 | 689 | ||
721 | 690 | ||
722 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 691 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
723 | { | 692 | { |
724 | if ( centralWidget() == mView ) { | 693 | if ( centralWidget() == mView ) { |
@@ -752,39 +721,24 @@ void AddressbookWindow::closeEvent( QCloseEvent *e ) | |||
752 | /* | 721 | /* |
753 | Returns TRUE if it is OK to exit | 722 | Returns TRUE if it is OK to exit |
754 | */ | 723 | */ |
755 | 724 | ||
756 | bool AddressbookWindow::save() | 725 | bool AddressbookWindow::save() |
757 | { | 726 | { |
758 | QString str = addressbookXMLFilename(); | 727 | if ( !abList->save() ) { |
759 | if ( str.isNull() ) { | 728 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
760 | if ( QMessageBox::critical( 0, tr("Out of space"), | ||
761 | tr("Unable to save information.\n" | 729 | tr("Unable to save information.\n" |
762 | "Free up some space\n" | 730 | "Free up some space\n" |
763 | "and try again.\n" | 731 | "and try again.\n" |
764 | "\nQuit anyway?"), | 732 | "\nQuit anyway?"), |
765 | QMessageBox::Yes|QMessageBox::Escape, | 733 | QMessageBox::Yes|QMessageBox::Escape, |
766 | QMessageBox::No|QMessageBox::Default ) | 734 | QMessageBox::No|QMessageBox::Default ) |
767 | != QMessageBox::No ) | 735 | != QMessageBox::No ) |
768 | return TRUE; | 736 | return TRUE; |
769 | else | 737 | else |
770 | return FALSE; | 738 | return FALSE; |
771 | } else { | ||
772 | if ( !abList->save( str ) ) { | ||
773 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | ||
774 | tr("Unable to save information.\n" | ||
775 | "Free up some space\n" | ||
776 | "and try again.\n" | ||
777 | "\nQuit anyway?"), | ||
778 | QMessageBox::Yes|QMessageBox::Escape, | ||
779 | QMessageBox::No|QMessageBox::Default ) | ||
780 | != QMessageBox::No ) | ||
781 | return TRUE; | ||
782 | else | ||
783 | return FALSE; | ||
784 | } | ||
785 | } | 739 | } |
786 | return TRUE; | 740 | return TRUE; |
787 | } | 741 | } |
788 | 742 | ||
789 | void AddressbookWindow::slotSettings() | 743 | void AddressbookWindow::slotSettings() |
790 | { | 744 | { |