author | eilers <eilers> | 2003-04-02 14:22:18 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-04-02 14:22:18 (UTC) |
commit | f0d3ff51dde49f994783827051464920529024af (patch) (unidiff) | |
tree | 7d306530f14d020a85b332482fa549e8006f3148 | |
parent | 617523539b2ac77a97db427ba218b5951267410d (diff) | |
download | opie-f0d3ff51dde49f994783827051464920529024af.zip opie-f0d3ff51dde49f994783827051464920529024af.tar.gz opie-f0d3ff51dde49f994783827051464920529024af.tar.bz2 |
Fix bug #791 (Misbehaviour of contacteditor: The main tab is active for every new
entry)
Export to VCard added.
Edit:Save removed (Was just for testing purposes)
-rw-r--r-- | core/pim/addressbook/TODO | 8 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 30 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 5 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 2 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 2 |
5 files changed, 38 insertions, 9 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index da9b9c2..a3cffa7 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO | |||
@@ -1,116 +1,112 @@ | |||
1 | Stuff todo until OPIE 1.0 : | 1 | Stuff todo until OPIE 1.0 : |
2 | =========================== | 2 | =========================== |
3 | 3 | ||
4 | Feature requests: | 4 | Feature requests: |
5 | ----------------- | 5 | ----------------- |
6 | - Dial by mobile phone by tapping the number.. | 6 | - Dial by mobile phone by tapping the number.. |
7 | (Maybe using gsmtool. And we may | 7 | (Maybe using gsmtool. And we may |
8 | add a library class for this) | 8 | add a library class for this) |
9 | - dial with dtmfdial in case it's installed and there's no mobile | 9 | - dial with dtmfdial in case it's installed and there's no mobile |
10 | - 3rd column for 2. Contact | 10 | - 3rd column for 2. Contact |
11 | - Implementing additional Views (Phonebook, ...) | 11 | - Implementing additional Views (Phonebook, ...) |
12 | - Birthday & Anniversary Reminder | 12 | - Birthday & Anniversary Reminder |
13 | - Beaming of multiple contacts (current list/ by search or by category) | 13 | - Beaming of multiple contacts (current list/ by search or by category) |
14 | - Configure the letter-picker: lastname/fullname search | 14 | - Configure the letter-picker: lastname/fullname search |
15 | - User center of the joypad to switch back from card to listview ! | 15 | - Optionally put scrollbars left. |
16 | 16 | ||
17 | Known Bugs: | 17 | Known Bugs: |
18 | ----------- | 18 | ----------- |
19 | 19 | ||
20 | Bugs but not in addressbook: | ||
21 | ----------------------------- | ||
22 | - VCARD: If umlaut (äöüß) in address, the parser gets confused.. | ||
23 | |||
24 | |||
25 | Urgent: | 20 | Urgent: |
26 | -------- | 21 | -------- |
27 | - Category is on the wrong position after changing to personal and back to normal | 22 | - Category is on the wrong position after changing to personal and back to normal |
28 | ( Temporarily workaround: Category is never deactivated.. :S ) | 23 | ( Temporarily workaround: Category is never deactivated.. :S ) |
29 | 24 | ||
30 | 25 | ||
31 | Important: | 26 | Important: |
32 | ---------- | 27 | ---------- |
33 | 28 | ||
34 | - "What's this" should be added (Deleyed after Feature Freeze) | 29 | - "What's this" should be added (Deleyed after Feature Freeze) |
35 | 30 | ||
36 | Less important: | 31 | Less important: |
37 | --------------- | 32 | --------------- |
38 | - Reload if contacts were changed externally | 33 | - Reload if contacts were changed externally |
39 | - The picker (alphabetical sort widget) should be | 34 | - The picker (alphabetical sort widget) should be |
40 | placed verticaly or horizontally (configurable) | 35 | placed verticaly or horizontally (configurable) |
41 | - Find a smart solution for activating/deactivating the "send email" event | 36 | - Find a smart solution for activating/deactivating the "send email" event |
42 | - If new contact is added (contacteditor closed): focus (table, card) to | 37 | - If new contact is added (contacteditor closed): focus (table, card) to |
43 | this entry ! | 38 | this entry ! |
44 | - After search (Started with Return): KeyFocus should be on Tabelle | 39 | - After search (Started with Return): KeyFocus should be on Tabelle |
45 | 40 | ||
46 | ContactEditor: | 41 | ContactEditor: |
47 | - Redesign of Contacteditor | 42 | - Redesign of Contacteditor |
48 | 43 | ||
49 | Should be Fixed (not absolute sure, need further validation): | 44 | Should be Fixed (not absolute sure, need further validation): |
50 | ------------------------------------------------------------- | 45 | ------------------------------------------------------------- |
51 | 46 | ||
52 | 47 | ||
53 | Fixed/Ready: | 48 | Fixed/Ready: |
54 | ------- | 49 | ------- |
55 | - Syncing: abtable not reloaded after sync. | 50 | - Syncing: abtable not reloaded after sync. |
56 | - Find widget should be replaced by something like | 51 | - Find widget should be replaced by something like |
57 | qpdf has. | 52 | qpdf has. |
58 | - Adding a configuration dialog | 53 | - Adding a configuration dialog |
59 | - Picker: Activated letter schould be more visible | 54 | - Picker: Activated letter schould be more visible |
60 | - Advanced handling of cursor keys (search..) | 55 | - Advanced handling of cursor keys (search..) |
61 | - Mail-Icon is missing | 56 | - Mail-Icon is missing |
62 | - Use opie-mail insted of qt-mail if possible. | 57 | - Use opie-mail insted of qt-mail if possible. |
63 | - Font menu is invisible using german translation | 58 | - Font menu is invisible using german translation |
64 | - Personal contact editor: Disable categories | 59 | - Personal contact editor: Disable categories |
65 | - "Nonenglish" translation bug has to be fixed. | 60 | - "Nonenglish" translation bug has to be fixed. |
66 | - contacteditor: Birthday, annyversary, ... : Use Dateselector | 61 | - contacteditor: Birthday, annyversary, ... : Use Dateselector |
67 | - The names of the countries are sorted by there english names, only.. | 62 | - The names of the countries are sorted by there english names, only.. |
68 | Even if they are translated.. :S | 63 | Even if they are translated.. :S |
69 | - Cursor keys should work in detail-view (ablabel) | 64 | - Cursor keys should work in detail-view (ablabel) |
70 | -> Ablabel should be removed and Abtable should be increased with | 65 | -> Ablabel should be removed and Abtable should be increased with |
71 | different views (as started by darwin zins).. | 66 | different views (as started by darwin zins).. |
72 | - Use advanced database functions in abtable to decrease | 67 | - Use advanced database functions in abtable to decrease |
73 | memory footprint and to make everything more easy ! | 68 | memory footprint and to make everything more easy ! |
74 | (abtable should store Iterator for selected Category) | 69 | (abtable should store Iterator for selected Category) |
75 | - Abtable: Configure Contact column (internally already available, | 70 | - Abtable: Configure Contact column (internally already available, |
76 | need configuration) | 71 | need configuration) |
77 | - Select of primary contact (see #274 on mantis) | 72 | - Select of primary contact (see #274 on mantis) |
78 | - Category-select does not work completely: "Unfiled" is always in listview .. | 73 | - Category-select does not work completely: "Unfiled" is always in listview .. |
79 | - Return from Contacteditor: Category resettet to all | 74 | - Return from Contacteditor: Category resettet to all |
80 | - Personal Details not working | 75 | - Personal Details not working |
81 | - If category changed, the letterpicker should be resetted | 76 | - If category changed, the letterpicker should be resetted |
82 | - There should be some icons for List and Cardview | 77 | - There should be some icons for List and Cardview |
83 | - If in Cardview and a category change removes all entries: | 78 | - If in Cardview and a category change removes all entries: |
84 | There are already entries in Cardview after up/down | 79 | There are already entries in Cardview after up/down |
85 | - Personal Details: Anniversary zeigt Fantasie-Werte | 80 | - Personal Details: Anniversary zeigt Fantasie-Werte |
86 | - Unfiled shown just in Category "All" and "Unfiled". | 81 | - Unfiled shown just in Category "All" and "Unfiled". |
87 | - After finising search and after Edit: Clear Picker | 82 | - After finising search and after Edit: Clear Picker |
88 | - After Edit: Table position back to edited entry. | 83 | - After Edit: Table position back to edited entry. |
89 | - Optimize Table Update... | 84 | - Optimize Table Update... |
90 | - Change MyDialog to Config | 85 | - Change MyDialog to Config |
91 | - Store position and state of toolbar | 86 | - Store position and state of toolbar |
92 | - Searchwidget closed: Selected user is jumping | 87 | - Searchwidget closed: Selected user is jumping |
93 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) | 88 | - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) |
94 | zu lange.. | 89 | zu lange.. |
95 | - VCARD: Import of Anniversary does not work correctly (currently disabled) | 90 | - VCARD: Import of Anniversary does not work correctly (currently disabled) |
96 | - Name order selected in "contacteditor" not used in list view. | 91 | - Name order selected in "contacteditor" not used in list view. |
97 | - OK-Key does not switch from Detailview (ablable) to Listview | 92 | - OK-Key does not switch from Detailview (ablable) to Listview |
98 | - Receiving of beams should open a dialog | 93 | - Receiving of beams should open a dialog |
99 | - Fix start of opie-mail | 94 | - Fix start of opie-mail |
100 | - Implement Button Pics | 95 | - Implement Button Pics |
101 | - Add a dialog to accept and optionally edit received contacts by IRDA. | 96 | - Add a dialog to accept and optionally edit received contacts by IRDA. |
102 | - Language not English (tested with german opie-translation): | 97 | - Language not English (tested with german opie-translation): |
103 | 1. Configure nicht übersetzt (alles leer). | 98 | 1. Configure nicht übersetzt (alles leer). |
104 | 2. Contacteditor nur teilweise übersetzt. | 99 | 2. Contacteditor nur teilweise übersetzt. |
105 | 3. Kategorie-Picker geht nicht. | 100 | 3. Kategorie-Picker geht nicht. |
106 | - Plugin for Today for Birthdays and Anniversaries | 101 | - Plugin for Today for Birthdays and Anniversaries |
107 | - Implement a picker/combo for the default email. | 102 | - Implement a picker/combo for the default email. |
108 | - Overview window cleanup needed.. | 103 | - Overview window cleanup needed.. |
109 | - Store last settings of combo-boxes | 104 | - Store last settings of combo-boxes |
110 | - Personal and Business Web-page is not editable | 105 | - Personal and Business Web-page is not editable |
111 | - Default Email-button: A lot of problems: | 106 | - Default Email-button: A lot of problems: |
112 | If on second tab: The combo chooser is on the top left of the screen ! :( | 107 | If on second tab: The combo chooser is on the top left of the screen ! :( |
113 | - Default Email-Button: Sometimes not hiding the textfields completely | 108 | - Default Email-Button: Sometimes not hiding the textfields completely |
114 | - Fix handling of 3 Firstnames | 109 | - Fix handling of 3 Firstnames |
115 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large | 110 | - Cursor-UP/Down: Should additionally scroll cardview if it is too large |
116 | (behaviour should be selectable by configuration) | 111 | (behaviour should be selectable by configuration) |
112 | - User center of the joypad to switch back from card to listview ! | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index a5bf19b..89a3312 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,845 +1,875 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** OContact info@trolltech.com if any conditions of this licensing are | 16 | ** OContact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "contacteditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abview.h" | 25 | #include "abview.h" |
26 | #include "abtable.h" | 26 | #include "abtable.h" |
27 | // #include "addresssettings.h" | 27 | // #include "addresssettings.h" |
28 | #include "addressbook.h" | 28 | #include "addressbook.h" |
29 | 29 | ||
30 | 30 | ||
31 | #include <opie/ofileselector.h> | 31 | #include <opie/ofileselector.h> |
32 | #include <opie/ofiledialog.h> | 32 | #include <opie/ofiledialog.h> |
33 | #include <opie/ocontact.h> | 33 | #include <opie/ocontact.h> |
34 | #include <opie/ocontactaccessbackend_vcard.h> | 34 | #include <opie/ocontactaccessbackend_vcard.h> |
35 | 35 | ||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/ir.h> | 37 | #include <qpe/ir.h> |
38 | #include <qpe/qpemessagebox.h> | 38 | #include <qpe/qpemessagebox.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/qpetoolbar.h> | 40 | #include <qpe/qpetoolbar.h> |
41 | #include <qpe/qpemenubar.h> | 41 | #include <qpe/qpemenubar.h> |
42 | // #include <qtoolbar.h> | 42 | // #include <qtoolbar.h> |
43 | // #include <qmenubar.h> | 43 | // #include <qmenubar.h> |
44 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
45 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
46 | 46 | ||
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qdialog.h> | 48 | #include <qdialog.h> |
49 | #include <qdir.h> | 49 | #include <qdir.h> |
50 | #include <qfile.h> | 50 | #include <qfile.h> |
51 | #include <qimage.h> | 51 | #include <qimage.h> |
52 | #include <qlayout.h> | 52 | #include <qlayout.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qpixmap.h> | 54 | #include <qpixmap.h> |
55 | #include <qpopupmenu.h> | 55 | #include <qpopupmenu.h> |
56 | #include <qstringlist.h> | 56 | #include <qstringlist.h> |
57 | #include <qtoolbutton.h> | 57 | #include <qtoolbutton.h> |
58 | #include <qwhatsthis.h> | 58 | #include <qwhatsthis.h> |
59 | #include <qdatetime.h> | 59 | #include <qdatetime.h> |
60 | 60 | ||
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | #include <sys/stat.h> | 62 | #include <sys/stat.h> |
63 | #include <sys/types.h> | 63 | #include <sys/types.h> |
64 | #include <fcntl.h> | 64 | #include <fcntl.h> |
65 | #include <unistd.h> | 65 | #include <unistd.h> |
66 | 66 | ||
67 | 67 | ||
68 | #include "picker.h" | 68 | #include "picker.h" |
69 | #include "configdlg.h" | 69 | #include "configdlg.h" |
70 | 70 | ||
71 | extern QString addressbookPersonalVCardName(); | 71 | extern QString addressbookPersonalVCardName(); |
72 | 72 | ||
73 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 73 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
74 | WFlags f ) | 74 | WFlags f ) |
75 | : QMainWindow( parent, name, f ), | 75 | : QMainWindow( parent, name, f ), |
76 | catMenu (0l), | 76 | catMenu (0l), |
77 | abEditor(0l), | 77 | abEditor(0l), |
78 | syncing(FALSE), | 78 | syncing(FALSE), |
79 | m_tableViewButton(0l), | 79 | m_tableViewButton(0l), |
80 | m_cardViewButton(0l) | 80 | m_cardViewButton(0l) |
81 | { | 81 | { |
82 | isLoading = true; | 82 | isLoading = true; |
83 | 83 | ||
84 | m_config.load(); | 84 | m_config.load(); |
85 | 85 | ||
86 | setCaption( tr("Contacts") ); | 86 | setCaption( tr("Contacts") ); |
87 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 87 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
88 | 88 | ||
89 | // Settings for Main Menu | 89 | // Settings for Main Menu |
90 | // setToolBarsMovable( false ); | 90 | // setToolBarsMovable( false ); |
91 | setToolBarsMovable( !m_config.fixedBars() ); | 91 | setToolBarsMovable( !m_config.fixedBars() ); |
92 | setRightJustification( true ); | 92 | setRightJustification( true ); |
93 | 93 | ||
94 | QPEToolBar *bar = new QPEToolBar( this ); | 94 | QPEToolBar *bar = new QPEToolBar( this ); |
95 | bar->setHorizontalStretchable( TRUE ); | 95 | bar->setHorizontalStretchable( TRUE ); |
96 | 96 | ||
97 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 97 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
98 | mbList->setMargin( 0 ); | 98 | mbList->setMargin( 0 ); |
99 | 99 | ||
100 | QPopupMenu *edit = new QPopupMenu( mbList ); | 100 | QPopupMenu *edit = new QPopupMenu( mbList ); |
101 | mbList->insertItem( tr( "Contact" ), edit ); | 101 | mbList->insertItem( tr( "Contact" ), edit ); |
102 | 102 | ||
103 | // Category Menu | 103 | // Category Menu |
104 | catMenu = new QPopupMenu( this ); | 104 | catMenu = new QPopupMenu( this ); |
105 | catMenu->setCheckable( TRUE ); | 105 | catMenu->setCheckable( TRUE ); |
106 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 106 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
107 | mbList->insertItem( tr("View"), catMenu ); | 107 | mbList->insertItem( tr("View"), catMenu ); |
108 | 108 | ||
109 | // Create Toolbar | 109 | // Create Toolbar |
110 | listTools = new QPEToolBar( this, "list operations" ); | 110 | listTools = new QPEToolBar( this, "list operations" ); |
111 | listTools->setHorizontalStretchable( true ); | 111 | listTools->setHorizontalStretchable( true ); |
112 | addToolBar( listTools ); | 112 | addToolBar( listTools ); |
113 | moveToolBar( listTools, m_config.getToolBarPos() ); | 113 | moveToolBar( listTools, m_config.getToolBarPos() ); |
114 | 114 | ||
115 | // View Icons | 115 | // View Icons |
116 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), | 116 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/weeklst" ), |
117 | QString::null, 0, this, 0 ); | 117 | QString::null, 0, this, 0 ); |
118 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 118 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
119 | m_tableViewButton->setToggleAction( true ); | 119 | m_tableViewButton->setToggleAction( true ); |
120 | m_tableViewButton->addTo( listTools ); | 120 | m_tableViewButton->addTo( listTools ); |
121 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); | 121 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "day" ), QString::null, 0, this, 0 ); |
122 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 122 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
123 | m_cardViewButton->setToggleAction( true ); | 123 | m_cardViewButton->setToggleAction( true ); |
124 | m_cardViewButton->addTo( listTools ); | 124 | m_cardViewButton->addTo( listTools ); |
125 | 125 | ||
126 | listTools->addSeparator(); | 126 | listTools->addSeparator(); |
127 | 127 | ||
128 | // Other Buttons | 128 | // Other Buttons |
129 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 129 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
130 | 0, this, 0 ); | 130 | 0, this, 0 ); |
131 | actionNew = a; | 131 | actionNew = a; |
132 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
133 | a->addTo( edit ); | 133 | a->addTo( edit ); |
134 | a->addTo( listTools ); | 134 | a->addTo( listTools ); |
135 | 135 | ||
136 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 136 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
137 | 0, this, 0 ); | 137 | 0, this, 0 ); |
138 | actionEdit = a; | 138 | actionEdit = a; |
139 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 139 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
140 | a->addTo( edit ); | 140 | a->addTo( edit ); |
141 | a->addTo( listTools ); | 141 | a->addTo( listTools ); |
142 | 142 | ||
143 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 143 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
144 | 0, this, 0 ); | 144 | 0, this, 0 ); |
145 | actionTrash = a; | 145 | actionTrash = a; |
146 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 146 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
147 | a->addTo( edit ); | 147 | a->addTo( edit ); |
148 | a->addTo( listTools ); | 148 | a->addTo( listTools ); |
149 | 149 | ||
150 | 150 | ||
151 | // make it possible to go directly to businesscard via qcop call | 151 | // make it possible to go directly to businesscard via qcop call |
152 | //#if defined(Q_WS_QWS) // Why this ? (se) | 152 | //#if defined(Q_WS_QWS) // Why this ? (se) |
153 | #if !defined(QT_NO_COP) | 153 | #if !defined(QT_NO_COP) |
154 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 154 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
155 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 155 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
156 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 156 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
157 | #endif | 157 | #endif |
158 | // #endif | 158 | // #endif |
159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
160 | QString::null, 0, this, 0 ); | 160 | QString::null, 0, this, 0 ); |
161 | actionFind = a; | 161 | actionFind = a; |
162 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 162 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
163 | a->addTo( edit ); | 163 | a->addTo( edit ); |
164 | a->addTo( listTools ); | 164 | a->addTo( listTools ); |
165 | 165 | ||
166 | // Much better search widget, taken from QTReader.. (se) | 166 | // Much better search widget, taken from QTReader.. (se) |
167 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 167 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
168 | searchBar->setHorizontalStretchable( TRUE ); | 168 | searchBar->setHorizontalStretchable( TRUE ); |
169 | searchBar->hide(); | 169 | searchBar->hide(); |
170 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 170 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
171 | 171 | ||
172 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 172 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
173 | // searchEdit->setFont( f ); | 173 | // searchEdit->setFont( f ); |
174 | 174 | ||
175 | searchBar->setStretchableWidget( searchEdit ); | 175 | searchBar->setStretchableWidget( searchEdit ); |
176 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 176 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
177 | this, SLOT( slotFind( ) ) ); | 177 | this, SLOT( slotFind( ) ) ); |
178 | 178 | ||
179 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 179 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
180 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 180 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
181 | a->addTo( searchBar ); | 181 | a->addTo( searchBar ); |
182 | 182 | ||
183 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 183 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
184 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 184 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
185 | a->addTo( searchBar ); | 185 | a->addTo( searchBar ); |
186 | 186 | ||
187 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 187 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
188 | QString::null, 0, this, 0 ); | 188 | QString::null, 0, this, 0 ); |
189 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 189 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
190 | actionMail = a; | 190 | actionMail = a; |
191 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 191 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
192 | a->addTo( edit ); | 192 | a->addTo( edit ); |
193 | a->addTo( listTools ); | 193 | a->addTo( listTools ); |
194 | 194 | ||
195 | if ( Ir::supported() ) { | 195 | if ( Ir::supported() ) { |
196 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 196 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
197 | 0, this, 0 ); | 197 | 0, this, 0 ); |
198 | actionBeam = a; | 198 | actionBeam = a; |
199 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
200 | a->addTo( edit ); | 200 | a->addTo( edit ); |
201 | a->addTo( listTools ); | 201 | a->addTo( listTools ); |
202 | } | 202 | } |
203 | 203 | ||
204 | edit->insertSeparator(); | 204 | edit->insertSeparator(); |
205 | 205 | ||
206 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, | 206 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, |
207 | 0, this, 0); | 207 | 0, this, 0); |
208 | actionPersonal = a; | 208 | actionPersonal = a; |
209 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 209 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
210 | a->addTo( edit ); | 210 | a->addTo( edit ); |
211 | 211 | ||
212 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, | ||
213 | 0, this, 0); | ||
214 | actionPersonal = a; | ||
215 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); | ||
216 | a->addTo( edit ); | ||
217 | |||
212 | edit->insertSeparator(); | 218 | edit->insertSeparator(); |
213 | 219 | ||
214 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 220 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
215 | QString::null, 0, this, 0 , TRUE ); | 221 | QString::null, 0, this, 0 , TRUE ); |
216 | actionPersonal = a; | 222 | actionPersonal = a; |
217 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 223 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
218 | a->addTo( edit ); | 224 | a->addTo( edit ); |
219 | 225 | ||
220 | 226 | ||
221 | #ifdef __DEBUG_RELEASE | 227 | #ifdef __DEBUG_RELEASE |
222 | // Remove this function for public Release ! This is only | 228 | // Remove this function for public Release ! This is only |
223 | // for debug purposes .. | 229 | // for debug purposes .. |
224 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 230 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
225 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 231 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
226 | a->addTo( edit ); | 232 | a->addTo( edit ); |
227 | #endif | 233 | #endif |
228 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, | 234 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, |
229 | 0, this, 0 ); | 235 | 0, this, 0 ); |
230 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 236 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
231 | a->addTo( edit ); | 237 | a->addTo( edit ); |
232 | 238 | ||
233 | // Create Views | 239 | // Create Views |
234 | listContainer = new QWidget( this ); | 240 | listContainer = new QWidget( this ); |
235 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 241 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
236 | 242 | ||
237 | m_abView = new AbView( listContainer, m_config.orderList() ); | 243 | m_abView = new AbView( listContainer, m_config.orderList() ); |
238 | vb->addWidget( m_abView ); | 244 | vb->addWidget( m_abView ); |
239 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 245 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
240 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), | 246 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), |
241 | this, SLOT( slotViewSwitched( int ) ) ); | 247 | this, SLOT( slotViewSwitched( int ) ) ); |
242 | 248 | ||
243 | 249 | ||
244 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 250 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
245 | 251 | ||
246 | m_abView->load(); | 252 | m_abView->load(); |
247 | 253 | ||
248 | // Letter Picker | 254 | // Letter Picker |
249 | pLabel = new LetterPicker( listContainer ); | 255 | pLabel = new LetterPicker( listContainer ); |
250 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 256 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
251 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | 257 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); |
252 | 258 | ||
253 | vb->addWidget( pLabel ); | 259 | vb->addWidget( pLabel ); |
254 | 260 | ||
255 | // All Categories into view-menu.. | 261 | // All Categories into view-menu.. |
256 | populateCategories(); | 262 | populateCategories(); |
257 | 263 | ||
258 | // Fontsize | 264 | // Fontsize |
259 | defaultFont = new QFont( m_abView->font() ); | 265 | defaultFont = new QFont( m_abView->font() ); |
260 | slotSetFont(m_config.fontSize()); | 266 | slotSetFont(m_config.fontSize()); |
261 | m_curFontSize = m_config.fontSize(); | 267 | m_curFontSize = m_config.fontSize(); |
262 | 268 | ||
263 | setCentralWidget(listContainer); | 269 | setCentralWidget(listContainer); |
264 | 270 | ||
265 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 271 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
266 | 272 | ||
267 | 273 | ||
268 | isLoading = false; | 274 | isLoading = false; |
269 | } | 275 | } |
270 | 276 | ||
271 | 277 | ||
272 | void AddressbookWindow::slotConfig() | 278 | void AddressbookWindow::slotConfig() |
273 | { | 279 | { |
274 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 280 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
275 | dlg -> setConfig( m_config ); | 281 | dlg -> setConfig( m_config ); |
276 | dlg -> showMaximized(); | 282 | dlg -> showMaximized(); |
277 | if ( dlg -> exec() ) { | 283 | if ( dlg -> exec() ) { |
278 | qWarning ("Config Dialog accepted!"); | 284 | qWarning ("Config Dialog accepted!"); |
279 | m_config = dlg -> getConfig(); | 285 | m_config = dlg -> getConfig(); |
280 | if ( m_curFontSize != m_config.fontSize() ){ | 286 | if ( m_curFontSize != m_config.fontSize() ){ |
281 | qWarning("Font was changed!"); | 287 | qWarning("Font was changed!"); |
282 | m_curFontSize = m_config.fontSize(); | 288 | m_curFontSize = m_config.fontSize(); |
283 | emit slotSetFont( m_curFontSize ); | 289 | emit slotSetFont( m_curFontSize ); |
284 | } | 290 | } |
285 | m_abView -> setListOrder( m_config.orderList() ); | 291 | m_abView -> setListOrder( m_config.orderList() ); |
286 | } | 292 | } |
287 | 293 | ||
288 | delete dlg; | 294 | delete dlg; |
289 | } | 295 | } |
290 | 296 | ||
291 | 297 | ||
292 | void AddressbookWindow::slotSetFont( int size ) | 298 | void AddressbookWindow::slotSetFont( int size ) |
293 | { | 299 | { |
294 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); | 300 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); |
295 | 301 | ||
296 | if (size > 2 || size < 0) | 302 | if (size > 2 || size < 0) |
297 | size = 1; | 303 | size = 1; |
298 | 304 | ||
299 | m_config.setFontSize( size ); | 305 | m_config.setFontSize( size ); |
300 | 306 | ||
301 | QFont *currentFont; | 307 | QFont *currentFont; |
302 | 308 | ||
303 | switch (size) { | 309 | switch (size) { |
304 | case 0: | 310 | case 0: |
305 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 311 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
306 | currentFont = new QFont (m_abView->font()); | 312 | currentFont = new QFont (m_abView->font()); |
307 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 313 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
308 | // abList->resizeRows(); | 314 | // abList->resizeRows(); |
309 | break; | 315 | break; |
310 | case 1: | 316 | case 1: |
311 | m_abView->setFont( *defaultFont ); | 317 | m_abView->setFont( *defaultFont ); |
312 | currentFont = new QFont (m_abView->font()); | 318 | currentFont = new QFont (m_abView->font()); |
313 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 319 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
314 | // abList->resizeRows(); | 320 | // abList->resizeRows(); |
315 | break; | 321 | break; |
316 | case 2: | 322 | case 2: |
317 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 323 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
318 | currentFont = new QFont (m_abView->font()); | 324 | currentFont = new QFont (m_abView->font()); |
319 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 325 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
320 | // abList->resizeRows(); | 326 | // abList->resizeRows(); |
321 | break; | 327 | break; |
322 | } | 328 | } |
323 | } | 329 | } |
324 | 330 | ||
325 | 331 | ||
326 | 332 | ||
327 | void AddressbookWindow::importvCard() { | 333 | void AddressbookWindow::importvCard() { |
328 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 334 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
329 | if(!str.isEmpty() ){ | 335 | if(!str.isEmpty() ){ |
330 | setDocument((const QString&) str ); | 336 | setDocument((const QString&) str ); |
331 | } | 337 | } |
332 | 338 | ||
333 | } | 339 | } |
340 | void AddressbookWindow::exportvCard() | ||
341 | { | ||
342 | qWarning(" void AddressbookWindow::exportvCard()"); | ||
343 | QString filename = OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); | ||
344 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ | ||
345 | qWarning(" Save to file %s, (%d)", filename.latin1(), filename.length()-1 ); | ||
346 | OContact curCont = m_abView->currentEntry(); | ||
347 | if ( !curCont.isEmpty() ){ | ||
348 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | ||
349 | filename ); | ||
350 | OContactAccess* access = new OContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); | ||
351 | if ( access ){ | ||
352 | access->add( curCont ); | ||
353 | access->save(); | ||
354 | } | ||
355 | delete access; | ||
356 | }else | ||
357 | QMessageBox::critical( 0, "Export VCard", | ||
358 | QString( tr( "You have to select a contact !") ) ); | ||
359 | |||
360 | }else | ||
361 | QMessageBox::critical( 0, "Export VCard", | ||
362 | QString( tr( "You have to set a filename !") ) ); | ||
363 | } | ||
334 | 364 | ||
335 | void AddressbookWindow::setDocument( const QString &filename ) | 365 | void AddressbookWindow::setDocument( const QString &filename ) |
336 | { | 366 | { |
337 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); | 367 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); |
338 | 368 | ||
339 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 369 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
340 | 370 | ||
341 | 371 | ||
342 | 372 | ||
343 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 373 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
344 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 374 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
345 | tr( "&Yes" ), tr( "&No" ), QString::null, | 375 | tr( "&Yes" ), tr( "&No" ), QString::null, |
346 | 0, // Enter == button 0 | 376 | 0, // Enter == button 0 |
347 | 2 ) ) { // Escape == button 2 | 377 | 2 ) ) { // Escape == button 2 |
348 | case 0: | 378 | case 0: |
349 | qWarning("YES clicked"); | 379 | qWarning("YES clicked"); |
350 | break; | 380 | break; |
351 | case 1: | 381 | case 1: |
352 | qWarning("NO clicked"); | 382 | qWarning("NO clicked"); |
353 | return; | 383 | return; |
354 | break; | 384 | break; |
355 | } | 385 | } |
356 | } | 386 | } |
357 | 387 | ||
358 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 388 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
359 | filename ); | 389 | filename ); |
360 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 390 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
361 | OContactAccess::List allList = access->allRecords(); | 391 | OContactAccess::List allList = access->allRecords(); |
362 | qWarning( "Found number of contacts in File: %d", allList.count() ); | 392 | qWarning( "Found number of contacts in File: %d", allList.count() ); |
363 | 393 | ||
364 | if ( !allList.count() ) { | 394 | if ( !allList.count() ) { |
365 | QMessageBox::information( this, "Import VCard", | 395 | QMessageBox::information( this, "Import VCard", |
366 | "It was impossible to import\nthe VCard.\n" | 396 | "It was impossible to import\nthe VCard.\n" |
367 | "The VCard may be corrupted!" ); | 397 | "The VCard may be corrupted!" ); |
368 | } | 398 | } |
369 | 399 | ||
370 | bool doAsk = true; | 400 | bool doAsk = true; |
371 | OContactAccess::List::Iterator it; | 401 | OContactAccess::List::Iterator it; |
372 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 402 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
373 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); | 403 | qWarning("Adding Contact from: %s", (*it).fullName().latin1() ); |
374 | if ( doAsk ){ | 404 | if ( doAsk ){ |
375 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 405 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
376 | tr( "Do you really want add contact for \n%1?" ) | 406 | tr( "Do you really want add contact for \n%1?" ) |
377 | .arg( (*it).fullName().latin1() ), | 407 | .arg( (*it).fullName().latin1() ), |
378 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 408 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
379 | 0, // Enter == button 0 | 409 | 0, // Enter == button 0 |
380 | 2 ) ) { // Escape == button 2 | 410 | 2 ) ) { // Escape == button 2 |
381 | case 0: | 411 | case 0: |
382 | qWarning("YES clicked"); | 412 | qWarning("YES clicked"); |
383 | m_abView->addEntry( *it ); | 413 | m_abView->addEntry( *it ); |
384 | break; | 414 | break; |
385 | case 1: | 415 | case 1: |
386 | qWarning("NO clicked"); | 416 | qWarning("NO clicked"); |
387 | break; | 417 | break; |
388 | case 2: | 418 | case 2: |
389 | qWarning("YesAll clicked"); | 419 | qWarning("YesAll clicked"); |
390 | doAsk = false; | 420 | doAsk = false; |
391 | break; | 421 | break; |
392 | } | 422 | } |
393 | }else | 423 | }else |
394 | m_abView->addEntry( *it ); | 424 | m_abView->addEntry( *it ); |
395 | 425 | ||
396 | } | 426 | } |
397 | 427 | ||
398 | delete access; | 428 | delete access; |
399 | } | 429 | } |
400 | 430 | ||
401 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 431 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
402 | { | 432 | { |
403 | QMainWindow::resizeEvent( e ); | 433 | QMainWindow::resizeEvent( e ); |
404 | 434 | ||
405 | 435 | ||
406 | } | 436 | } |
407 | 437 | ||
408 | AddressbookWindow::~AddressbookWindow() | 438 | AddressbookWindow::~AddressbookWindow() |
409 | { | 439 | { |
410 | ToolBarDock dock; | 440 | ToolBarDock dock; |
411 | int dummy; | 441 | int dummy; |
412 | bool bDummy; | 442 | bool bDummy; |
413 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 443 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
414 | m_config.setToolBarDock( dock ); | 444 | m_config.setToolBarDock( dock ); |
415 | m_config.save(); | 445 | m_config.save(); |
416 | } | 446 | } |
417 | 447 | ||
418 | void AddressbookWindow::slotUpdateToolbar() | 448 | void AddressbookWindow::slotUpdateToolbar() |
419 | { | 449 | { |
420 | OContact ce = m_abView->currentEntry(); | 450 | OContact ce = m_abView->currentEntry(); |
421 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 451 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
422 | } | 452 | } |
423 | 453 | ||
424 | void AddressbookWindow::slotListNew() | 454 | void AddressbookWindow::slotListNew() |
425 | { | 455 | { |
426 | OContact cnt; | 456 | OContact cnt; |
427 | if( !syncing ) { | 457 | if( !syncing ) { |
428 | editEntry( NewEntry ); | 458 | editEntry( NewEntry ); |
429 | } else { | 459 | } else { |
430 | QMessageBox::warning(this, tr("Contacts"), | 460 | QMessageBox::warning(this, tr("Contacts"), |
431 | tr("Can not edit data, currently syncing")); | 461 | tr("Can not edit data, currently syncing")); |
432 | } | 462 | } |
433 | } | 463 | } |
434 | 464 | ||
435 | // void AddressbookWindow::slotListView() | 465 | // void AddressbookWindow::slotListView() |
436 | // { | 466 | // { |
437 | // m_abView -> init( abList->currentEntry() ); | 467 | // m_abView -> init( abList->currentEntry() ); |
438 | // // :SX mView->sync(); | 468 | // // :SX mView->sync(); |
439 | // //:SXshowView(); | 469 | // //:SXshowView(); |
440 | // } | 470 | // } |
441 | 471 | ||
442 | void AddressbookWindow::slotListDelete() | 472 | void AddressbookWindow::slotListDelete() |
443 | { | 473 | { |
444 | if(!syncing) { | 474 | if(!syncing) { |
445 | OContact tmpEntry = m_abView ->currentEntry(); | 475 | OContact tmpEntry = m_abView ->currentEntry(); |
446 | 476 | ||
447 | // get a name, do the best we can... | 477 | // get a name, do the best we can... |
448 | QString strName = tmpEntry.fullName(); | 478 | QString strName = tmpEntry.fullName(); |
449 | if ( strName.isEmpty() ) { | 479 | if ( strName.isEmpty() ) { |
450 | strName = tmpEntry.company(); | 480 | strName = tmpEntry.company(); |
451 | if ( strName.isEmpty() ) | 481 | if ( strName.isEmpty() ) |
452 | strName = "No Name"; | 482 | strName = "No Name"; |
453 | } | 483 | } |
454 | 484 | ||
455 | 485 | ||
456 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 486 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
457 | strName ) ) { | 487 | strName ) ) { |
458 | m_abView->removeEntry( tmpEntry.uid() ); | 488 | m_abView->removeEntry( tmpEntry.uid() ); |
459 | } | 489 | } |
460 | } else { | 490 | } else { |
461 | QMessageBox::warning( this, tr("Contacts"), | 491 | QMessageBox::warning( this, tr("Contacts"), |
462 | tr("Can not edit data, currently syncing") ); | 492 | tr("Can not edit data, currently syncing") ); |
463 | } | 493 | } |
464 | } | 494 | } |
465 | 495 | ||
466 | void AddressbookWindow::slotFindOpen() | 496 | void AddressbookWindow::slotFindOpen() |
467 | { | 497 | { |
468 | searchBar->show(); | 498 | searchBar->show(); |
469 | m_abView -> inSearch(); | 499 | m_abView -> inSearch(); |
470 | searchEdit->setFocus(); | 500 | searchEdit->setFocus(); |
471 | } | 501 | } |
472 | void AddressbookWindow::slotFindClose() | 502 | void AddressbookWindow::slotFindClose() |
473 | { | 503 | { |
474 | searchBar->hide(); | 504 | searchBar->hide(); |
475 | m_abView -> offSearch(); | 505 | m_abView -> offSearch(); |
476 | // m_abView->setFocus(); | 506 | // m_abView->setFocus(); |
477 | } | 507 | } |
478 | 508 | ||
479 | 509 | ||
480 | void AddressbookWindow::slotFind() | 510 | void AddressbookWindow::slotFind() |
481 | { | 511 | { |
482 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 512 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
483 | 513 | ||
484 | searchEdit->clearFocus(); | 514 | searchEdit->clearFocus(); |
485 | // m_abView->setFocus(); | 515 | // m_abView->setFocus(); |
486 | 516 | ||
487 | } | 517 | } |
488 | 518 | ||
489 | void AddressbookWindow::slotViewBack() | 519 | void AddressbookWindow::slotViewBack() |
490 | { | 520 | { |
491 | // :SX showList(); | 521 | // :SX showList(); |
492 | } | 522 | } |
493 | 523 | ||
494 | void AddressbookWindow::slotViewEdit() | 524 | void AddressbookWindow::slotViewEdit() |
495 | { | 525 | { |
496 | if(!syncing) { | 526 | if(!syncing) { |
497 | if (actionPersonal->isOn()) { | 527 | if (actionPersonal->isOn()) { |
498 | editPersonal(); | 528 | editPersonal(); |
499 | } else { | 529 | } else { |
500 | editEntry( EditEntry ); | 530 | editEntry( EditEntry ); |
501 | } | 531 | } |
502 | } else { | 532 | } else { |
503 | QMessageBox::warning( this, tr("Contacts"), | 533 | QMessageBox::warning( this, tr("Contacts"), |
504 | tr("Can not edit data, currently syncing") ); | 534 | tr("Can not edit data, currently syncing") ); |
505 | } | 535 | } |
506 | } | 536 | } |
507 | 537 | ||
508 | 538 | ||
509 | 539 | ||
510 | void AddressbookWindow::writeMail() | 540 | void AddressbookWindow::writeMail() |
511 | { | 541 | { |
512 | OContact c = m_abView -> currentEntry(); | 542 | OContact c = m_abView -> currentEntry(); |
513 | QString name = c.fileAs(); | 543 | QString name = c.fileAs(); |
514 | QString email = c.defaultEmail(); | 544 | QString email = c.defaultEmail(); |
515 | 545 | ||
516 | // I prefer the OPIE-Environment variable before the | 546 | // I prefer the OPIE-Environment variable before the |
517 | // QPE-one.. | 547 | // QPE-one.. |
518 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 548 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
519 | if ( basepath.isEmpty() ) | 549 | if ( basepath.isEmpty() ) |
520 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 550 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
521 | 551 | ||
522 | // Try to access the preferred. If not possible, try to | 552 | // Try to access the preferred. If not possible, try to |
523 | // switch to the other one.. | 553 | // switch to the other one.. |
524 | if ( m_config.useQtMail() ){ | 554 | if ( m_config.useQtMail() ){ |
525 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 555 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
526 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 556 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
527 | qWarning ("QCop"); | 557 | qWarning ("QCop"); |
528 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 558 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
529 | e << name << email; | 559 | e << name << email; |
530 | return; | 560 | return; |
531 | } else | 561 | } else |
532 | m_config.setUseOpieMail( true ); | 562 | m_config.setUseOpieMail( true ); |
533 | } | 563 | } |
534 | if ( m_config.useOpieMail() ){ | 564 | if ( m_config.useOpieMail() ){ |
535 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 565 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
536 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 566 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
537 | qWarning ("QCop"); | 567 | qWarning ("QCop"); |
538 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 568 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
539 | e << name << email; | 569 | e << name << email; |
540 | return; | 570 | return; |
541 | } else | 571 | } else |
542 | m_config.setUseQtMail( true ); | 572 | m_config.setUseQtMail( true ); |
543 | } | 573 | } |
544 | 574 | ||
545 | } | 575 | } |
546 | 576 | ||
547 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 577 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
548 | 578 | ||
549 | void AddressbookWindow::slotBeam() | 579 | void AddressbookWindow::slotBeam() |
550 | { | 580 | { |
551 | QString beamFilename; | 581 | QString beamFilename; |
552 | OContact c; | 582 | OContact c; |
553 | if ( actionPersonal->isOn() ) { | 583 | if ( actionPersonal->isOn() ) { |
554 | beamFilename = addressbookPersonalVCardName(); | 584 | beamFilename = addressbookPersonalVCardName(); |
555 | if ( !QFile::exists( beamFilename ) ) | 585 | if ( !QFile::exists( beamFilename ) ) |
556 | return; // can't beam a non-existent file | 586 | return; // can't beam a non-existent file |
557 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 587 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
558 | beamFilename ); | 588 | beamFilename ); |
559 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 589 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
560 | OContactAccess::List allList = access->allRecords(); | 590 | OContactAccess::List allList = access->allRecords(); |
561 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 591 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
562 | c = *it; | 592 | c = *it; |
563 | 593 | ||
564 | delete access; | 594 | delete access; |
565 | } else { | 595 | } else { |
566 | unlink( beamfile ); // delete if exists | 596 | unlink( beamfile ); // delete if exists |
567 | mkdir("/tmp/obex/", 0755); | 597 | mkdir("/tmp/obex/", 0755); |
568 | c = m_abView -> currentEntry(); | 598 | c = m_abView -> currentEntry(); |
569 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 599 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
570 | beamfile ); | 600 | beamfile ); |
571 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 601 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
572 | access->add( c ); | 602 | access->add( c ); |
573 | access->save(); | 603 | access->save(); |
574 | delete access; | 604 | delete access; |
575 | 605 | ||
576 | beamFilename = beamfile; | 606 | beamFilename = beamfile; |
577 | } | 607 | } |
578 | 608 | ||
579 | qWarning("Beaming: %s", beamFilename.latin1() ); | 609 | qWarning("Beaming: %s", beamFilename.latin1() ); |
580 | 610 | ||
581 | Ir *ir = new Ir( this ); | 611 | Ir *ir = new Ir( this ); |
582 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 612 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
583 | QString description = c.fullName(); | 613 | QString description = c.fullName(); |
584 | ir->send( beamFilename, description, "text/x-vCard" ); | 614 | ir->send( beamFilename, description, "text/x-vCard" ); |
585 | } | 615 | } |
586 | 616 | ||
587 | void AddressbookWindow::beamDone( Ir *ir ) | 617 | void AddressbookWindow::beamDone( Ir *ir ) |
588 | { | 618 | { |
589 | 619 | ||
590 | delete ir; | 620 | delete ir; |
591 | unlink( beamfile ); | 621 | unlink( beamfile ); |
592 | } | 622 | } |
593 | 623 | ||
594 | 624 | ||
595 | static void parseName( const QString& name, QString *first, QString *middle, | 625 | static void parseName( const QString& name, QString *first, QString *middle, |
596 | QString * last ) | 626 | QString * last ) |
597 | { | 627 | { |
598 | 628 | ||
599 | int comma = name.find ( "," ); | 629 | int comma = name.find ( "," ); |
600 | QString rest; | 630 | QString rest; |
601 | if ( comma > 0 ) { | 631 | if ( comma > 0 ) { |
602 | *last = name.left( comma ); | 632 | *last = name.left( comma ); |
603 | comma++; | 633 | comma++; |
604 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 634 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
605 | comma++; | 635 | comma++; |
606 | rest = name.mid( comma ); | 636 | rest = name.mid( comma ); |
607 | } else { | 637 | } else { |
608 | int space = name.findRev( ' ' ); | 638 | int space = name.findRev( ' ' ); |
609 | *last = name.mid( space+1 ); | 639 | *last = name.mid( space+1 ); |
610 | rest = name.left( space ); | 640 | rest = name.left( space ); |
611 | } | 641 | } |
612 | int space = rest.find( ' ' ); | 642 | int space = rest.find( ' ' ); |
613 | if ( space <= 0 ) { | 643 | if ( space <= 0 ) { |
614 | *first = rest; | 644 | *first = rest; |
615 | } else { | 645 | } else { |
616 | *first = rest.left( space ); | 646 | *first = rest.left( space ); |
617 | *middle = rest.mid( space+1 ); | 647 | *middle = rest.mid( space+1 ); |
618 | } | 648 | } |
619 | 649 | ||
620 | } | 650 | } |
621 | 651 | ||
622 | 652 | ||
623 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 653 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
624 | { | 654 | { |
625 | if (msg == "editPersonal()") { | 655 | if (msg == "editPersonal()") { |
626 | editPersonal(); | 656 | editPersonal(); |
627 | } else if (msg == "editPersonalAndClose()") { | 657 | } else if (msg == "editPersonalAndClose()") { |
628 | editPersonal(); | 658 | editPersonal(); |
629 | close(); | 659 | close(); |
630 | } else if ( msg == "addContact(QString,QString)" ) { | 660 | } else if ( msg == "addContact(QString,QString)" ) { |
631 | QDataStream stream(data,IO_ReadOnly); | 661 | QDataStream stream(data,IO_ReadOnly); |
632 | QString name, email; | 662 | QString name, email; |
633 | stream >> name >> email; | 663 | stream >> name >> email; |
634 | 664 | ||
635 | OContact cnt; | 665 | OContact cnt; |
636 | QString fn, mn, ln; | 666 | QString fn, mn, ln; |
637 | parseName( name, &fn, &mn, &ln ); | 667 | parseName( name, &fn, &mn, &ln ); |
638 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 668 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
639 | cnt.setFirstName( fn ); | 669 | cnt.setFirstName( fn ); |
640 | cnt.setMiddleName( mn ); | 670 | cnt.setMiddleName( mn ); |
641 | cnt.setLastName( ln ); | 671 | cnt.setLastName( ln ); |
642 | cnt.insertEmails( email ); | 672 | cnt.insertEmails( email ); |
643 | cnt.setDefaultEmail( email ); | 673 | cnt.setDefaultEmail( email ); |
644 | cnt.setFileAs(); | 674 | cnt.setFileAs(); |
645 | 675 | ||
646 | m_abView -> addEntry( cnt ); | 676 | m_abView -> addEntry( cnt ); |
647 | 677 | ||
648 | // :SXm_abView()->init( cnt ); | 678 | // :SXm_abView()->init( cnt ); |
649 | editEntry( EditEntry ); | 679 | editEntry( EditEntry ); |
650 | } else if ( msg == "beamBusinessCard()" ) { | 680 | } else if ( msg == "beamBusinessCard()" ) { |
651 | QString beamFilename = addressbookPersonalVCardName(); | 681 | QString beamFilename = addressbookPersonalVCardName(); |
652 | if ( !QFile::exists( beamFilename ) ) | 682 | if ( !QFile::exists( beamFilename ) ) |
653 | return; // can't beam a non-existent file | 683 | return; // can't beam a non-existent file |
654 | 684 | ||
655 | Ir *ir = new Ir( this ); | 685 | Ir *ir = new Ir( this ); |
656 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 686 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
657 | QString description = "mycard.vcf"; | 687 | QString description = "mycard.vcf"; |
658 | ir->send( beamFilename, description, "text/x-vCard" ); | 688 | ir->send( beamFilename, description, "text/x-vCard" ); |
659 | } | 689 | } |
660 | #if 0 | 690 | #if 0 |
661 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 691 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
662 | QDataStream stream(data,IO_ReadOnly); | 692 | QDataStream stream(data,IO_ReadOnly); |
663 | QCString ch,m; | 693 | QCString ch,m; |
664 | QStringList types; | 694 | QStringList types; |
665 | stream >> ch >> m >> types; | 695 | stream >> ch >> m >> types; |
666 | AddressPicker picker(abList,this,0,TRUE); | 696 | AddressPicker picker(abList,this,0,TRUE); |
667 | picker.showMaximized(); | 697 | picker.showMaximized(); |
668 | picker.setChoiceNames(types); | 698 | picker.setChoiceNames(types); |
669 | int i=0; | 699 | int i=0; |
670 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 700 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
671 | QStringList sel; | 701 | QStringList sel; |
672 | stream >> sel; | 702 | stream >> sel; |
673 | picker.setSelection(i++,sel); | 703 | picker.setSelection(i++,sel); |
674 | } | 704 | } |
675 | picker.showMaximized(); | 705 | picker.showMaximized(); |
676 | picker.exec(); | 706 | picker.exec(); |
677 | 707 | ||
678 | // ###### note: contacts may have been added - save here! | 708 | // ###### note: contacts may have been added - save here! |
679 | 709 | ||
680 | setCentralWidget(abList); | 710 | setCentralWidget(abList); |
681 | QCopEnvelope e(ch,m); | 711 | QCopEnvelope e(ch,m); |
682 | i=0; | 712 | i=0; |
683 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 713 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
684 | QStringList sel = picker.selection(i++); | 714 | QStringList sel = picker.selection(i++); |
685 | e << sel; | 715 | e << sel; |
686 | } | 716 | } |
687 | } | 717 | } |
688 | #endif | 718 | #endif |
689 | 719 | ||
690 | } | 720 | } |
691 | 721 | ||
692 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 722 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
693 | { | 723 | { |
694 | OContact entry; | 724 | OContact entry; |
695 | if ( !abEditor ) { | 725 | if ( !abEditor ) { |
696 | abEditor = new ContactEditor( entry, this, "editor" ); | 726 | abEditor = new ContactEditor( entry, this, "editor" ); |
697 | } | 727 | } |
698 | if ( entryMode == EditEntry ) | 728 | if ( entryMode == EditEntry ) |
699 | abEditor->setEntry( m_abView -> currentEntry() ); | 729 | abEditor->setEntry( m_abView -> currentEntry() ); |
700 | else if ( entryMode == NewEntry ) | 730 | else if ( entryMode == NewEntry ) |
701 | abEditor->setEntry( entry ); | 731 | abEditor->setEntry( entry ); |
702 | // other things may change the caption. | 732 | // other things may change the caption. |
703 | abEditor->setCaption( tr("Edit Address") ); | 733 | abEditor->setCaption( tr("Edit Address") ); |
704 | 734 | ||
705 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 735 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
706 | abEditor->showMaximized(); | 736 | abEditor->showMaximized(); |
707 | #endif | 737 | #endif |
708 | // fix the foxus... | 738 | // fix the foxus... |
709 | abEditor->setNameFocus(); | 739 | abEditor->setNameFocus(); |
710 | if ( abEditor->exec() ) { | 740 | if ( abEditor->exec() ) { |
711 | setFocus(); | 741 | setFocus(); |
712 | if ( entryMode == NewEntry ) { | 742 | if ( entryMode == NewEntry ) { |
713 | OContact insertEntry = abEditor->entry(); | 743 | OContact insertEntry = abEditor->entry(); |
714 | insertEntry.assignUid(); | 744 | insertEntry.assignUid(); |
715 | m_abView -> addEntry( insertEntry ); | 745 | m_abView -> addEntry( insertEntry ); |
716 | } else { | 746 | } else { |
717 | OContact replEntry = abEditor->entry(); | 747 | OContact replEntry = abEditor->entry(); |
718 | 748 | ||
719 | if ( !replEntry.isValidUid() ) | 749 | if ( !replEntry.isValidUid() ) |
720 | replEntry.assignUid(); | 750 | replEntry.assignUid(); |
721 | 751 | ||
722 | m_abView -> replaceEntry( replEntry ); | 752 | m_abView -> replaceEntry( replEntry ); |
723 | } | 753 | } |
724 | } | 754 | } |
725 | // populateCategories(); | 755 | // populateCategories(); |
726 | 756 | ||
727 | } | 757 | } |
728 | 758 | ||
729 | void AddressbookWindow::editPersonal() | 759 | void AddressbookWindow::editPersonal() |
730 | { | 760 | { |
731 | OContact entry; | 761 | OContact entry; |
732 | 762 | ||
733 | // Switch to personal view if not selected | 763 | // Switch to personal view if not selected |
734 | // but take care of the menu, too | 764 | // but take care of the menu, too |
735 | if ( ! actionPersonal->isOn() ){ | 765 | if ( ! actionPersonal->isOn() ){ |
736 | qWarning("*** ++++"); | 766 | qWarning("*** ++++"); |
737 | actionPersonal->setOn( true ); | 767 | actionPersonal->setOn( true ); |
738 | slotPersonalView(); | 768 | slotPersonalView(); |
739 | } | 769 | } |
740 | 770 | ||
741 | if ( !abEditor ) { | 771 | if ( !abEditor ) { |
742 | abEditor = new ContactEditor( entry, this, "editor" ); | 772 | abEditor = new ContactEditor( entry, this, "editor" ); |
743 | } | 773 | } |
744 | 774 | ||
745 | abEditor->setCaption(tr("Edit My Personal Details")); | 775 | abEditor->setCaption(tr("Edit My Personal Details")); |
746 | abEditor->setPersonalView( true ); | 776 | abEditor->setPersonalView( true ); |
747 | editEntry( EditEntry ); | 777 | editEntry( EditEntry ); |
748 | abEditor->setPersonalView( false ); | 778 | abEditor->setPersonalView( false ); |
749 | 779 | ||
750 | } | 780 | } |
751 | 781 | ||
752 | 782 | ||
753 | void AddressbookWindow::slotPersonalView() | 783 | void AddressbookWindow::slotPersonalView() |
754 | { | 784 | { |
755 | qWarning("slotPersonalView()"); | 785 | qWarning("slotPersonalView()"); |
756 | if (!actionPersonal->isOn()) { | 786 | if (!actionPersonal->isOn()) { |
757 | // we just turned it off | 787 | // we just turned it off |
758 | qWarning("slotPersonalView()-> OFF"); | 788 | qWarning("slotPersonalView()-> OFF"); |
759 | setCaption( tr("Contacts") ); | 789 | setCaption( tr("Contacts") ); |
760 | actionNew->setEnabled(TRUE); | 790 | actionNew->setEnabled(TRUE); |
761 | actionTrash->setEnabled(TRUE); | 791 | actionTrash->setEnabled(TRUE); |
762 | actionFind->setEnabled(TRUE); | 792 | actionFind->setEnabled(TRUE); |
763 | actionMail->setEnabled(TRUE); | 793 | actionMail->setEnabled(TRUE); |
764 | // slotUpdateToolbar(); | 794 | // slotUpdateToolbar(); |
765 | 795 | ||
766 | m_abView->showPersonal( false ); | 796 | m_abView->showPersonal( false ); |
767 | 797 | ||
768 | return; | 798 | return; |
769 | } | 799 | } |
770 | 800 | ||
771 | qWarning("slotPersonalView()-> ON"); | 801 | qWarning("slotPersonalView()-> ON"); |
772 | // XXX need to disable some QActions. | 802 | // XXX need to disable some QActions. |
773 | actionNew->setEnabled(FALSE); | 803 | actionNew->setEnabled(FALSE); |
774 | actionTrash->setEnabled(FALSE); | 804 | actionTrash->setEnabled(FALSE); |
775 | actionFind->setEnabled(FALSE); | 805 | actionFind->setEnabled(FALSE); |
776 | actionMail->setEnabled(FALSE); | 806 | actionMail->setEnabled(FALSE); |
777 | 807 | ||
778 | setCaption( tr("Contacts - My Personal Details") ); | 808 | setCaption( tr("Contacts - My Personal Details") ); |
779 | 809 | ||
780 | m_abView->showPersonal( true ); | 810 | m_abView->showPersonal( true ); |
781 | 811 | ||
782 | } | 812 | } |
783 | 813 | ||
784 | 814 | ||
785 | void AddressbookWindow::listIsEmpty( bool empty ) | 815 | void AddressbookWindow::listIsEmpty( bool empty ) |
786 | { | 816 | { |
787 | if ( !empty ) { | 817 | if ( !empty ) { |
788 | deleteButton->setEnabled( TRUE ); | 818 | deleteButton->setEnabled( TRUE ); |
789 | } | 819 | } |
790 | } | 820 | } |
791 | 821 | ||
792 | void AddressbookWindow::reload() | 822 | void AddressbookWindow::reload() |
793 | { | 823 | { |
794 | syncing = FALSE; | 824 | syncing = FALSE; |
795 | m_abView->clear(); | 825 | m_abView->clear(); |
796 | m_abView->reload(); | 826 | m_abView->reload(); |
797 | } | 827 | } |
798 | 828 | ||
799 | void AddressbookWindow::flush() | 829 | void AddressbookWindow::flush() |
800 | { | 830 | { |
801 | syncing = TRUE; | 831 | syncing = TRUE; |
802 | m_abView->save(); | 832 | m_abView->save(); |
803 | } | 833 | } |
804 | 834 | ||
805 | 835 | ||
806 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 836 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
807 | { | 837 | { |
808 | if(active_view == AbView::CardView){ | 838 | if(active_view == AbView::CardView){ |
809 | slotViewSwitched( AbView::TableView ); | 839 | slotViewSwitched( AbView::TableView ); |
810 | e->ignore(); | 840 | e->ignore(); |
811 | return; | 841 | return; |
812 | } | 842 | } |
813 | if(syncing) { | 843 | if(syncing) { |
814 | /* shouldn't we save, I hear you say? well its already been set | 844 | /* shouldn't we save, I hear you say? well its already been set |
815 | so that an edit can not occur during a sync, and we flushed | 845 | so that an edit can not occur during a sync, and we flushed |
816 | at the start of the sync, so there is no need to save | 846 | at the start of the sync, so there is no need to save |
817 | Saving however itself would cause problems. */ | 847 | Saving however itself would cause problems. */ |
818 | e->accept(); | 848 | e->accept(); |
819 | return; | 849 | return; |
820 | } | 850 | } |
821 | //################## shouldn't always save | 851 | //################## shouldn't always save |
822 | // True, but the database handles this automatically ! (se) | 852 | // True, but the database handles this automatically ! (se) |
823 | if ( save() ) | 853 | if ( save() ) |
824 | e->accept(); | 854 | e->accept(); |
825 | else | 855 | else |
826 | e->ignore(); | 856 | e->ignore(); |
827 | } | 857 | } |
828 | 858 | ||
829 | /* | 859 | /* |
830 | Returns TRUE if it is OK to exit | 860 | Returns TRUE if it is OK to exit |
831 | */ | 861 | */ |
832 | 862 | ||
833 | bool AddressbookWindow::save() | 863 | bool AddressbookWindow::save() |
834 | { | 864 | { |
835 | if ( !m_abView->save() ) { | 865 | if ( !m_abView->save() ) { |
836 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 866 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
837 | tr("Unable to save information.\n" | 867 | tr("Unable to save information.\n" |
838 | "Free up some space\n" | 868 | "Free up some space\n" |
839 | "and try again.\n" | 869 | "and try again.\n" |
840 | "\nQuit anyway?"), | 870 | "\nQuit anyway?"), |
841 | QMessageBox::Yes|QMessageBox::Escape, | 871 | QMessageBox::Yes|QMessageBox::Escape, |
842 | QMessageBox::No|QMessageBox::Default ) | 872 | QMessageBox::No|QMessageBox::Default ) |
843 | != QMessageBox::No ) | 873 | != QMessageBox::No ) |
844 | return TRUE; | 874 | return TRUE; |
845 | else | 875 | else |
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h index 69fe2f8..f7a560a 100644 --- a/core/pim/addressbook/addressbook.h +++ b/core/pim/addressbook/addressbook.h | |||
@@ -1,135 +1,136 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef Addressbook_H | 20 | #ifndef Addressbook_H |
21 | #define Addressbook_H | 21 | #define Addressbook_H |
22 | 22 | ||
23 | // Remove this for OPIE releae 1.0 ! | 23 | // Remove this for OPIE releae 1.0 ! |
24 | #define __DEBUG_RELEASE | 24 | // #define __DEBUG_RELEASE |
25 | 25 | ||
26 | #include <qmainwindow.h> | 26 | #include <qmainwindow.h> |
27 | #include <qvaluelist.h> | 27 | #include <qvaluelist.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include "ofloatbar.h" | 30 | #include "ofloatbar.h" |
31 | #include "abview.h" | 31 | #include "abview.h" |
32 | #include "abconfig.h" | 32 | #include "abconfig.h" |
33 | 33 | ||
34 | class ContactEditor; | 34 | class ContactEditor; |
35 | class AbLabel; | 35 | class AbLabel; |
36 | class AbTable; | 36 | class AbTable; |
37 | class QPEToolBar; | 37 | class QPEToolBar; |
38 | class QPopupMenu; | 38 | class QPopupMenu; |
39 | class QToolButton; | 39 | class QToolButton; |
40 | class QDialog; | 40 | class QDialog; |
41 | class Ir; | 41 | class Ir; |
42 | class QAction; | 42 | class QAction; |
43 | class LetterPicker; | 43 | class LetterPicker; |
44 | 44 | ||
45 | class AddressbookWindow: public QMainWindow | 45 | class AddressbookWindow: public QMainWindow |
46 | { | 46 | { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | public: | 48 | public: |
49 | enum EntryMode { NewEntry=0, EditEntry }; | 49 | enum EntryMode { NewEntry=0, EditEntry }; |
50 | 50 | ||
51 | AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 51 | AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
52 | ~AddressbookWindow(); | 52 | ~AddressbookWindow(); |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | void resizeEvent( QResizeEvent * e ); | 55 | void resizeEvent( QResizeEvent * e ); |
56 | 56 | ||
57 | void editPersonal(); | 57 | void editPersonal(); |
58 | void editEntry( EntryMode ); | 58 | void editEntry( EntryMode ); |
59 | void closeEvent( QCloseEvent *e ); | 59 | void closeEvent( QCloseEvent *e ); |
60 | bool save(); | 60 | bool save(); |
61 | 61 | ||
62 | public slots: | 62 | public slots: |
63 | void flush(); | 63 | void flush(); |
64 | void reload(); | 64 | void reload(); |
65 | void appMessage(const QCString &, const QByteArray &); | 65 | void appMessage(const QCString &, const QByteArray &); |
66 | void setDocument( const QString & ); | 66 | void setDocument( const QString & ); |
67 | #ifdef __DEBUG_RELEASE | 67 | #ifdef __DEBUG_RELEASE |
68 | void slotSave(); | 68 | // void slotSave(); |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | private slots: | 71 | private slots: |
72 | void importvCard(); | 72 | void importvCard(); |
73 | void exportvCard(); | ||
73 | void slotListNew(); | 74 | void slotListNew(); |
74 | /* void slotListView(); */ | 75 | /* void slotListView(); */ |
75 | void slotListDelete(); | 76 | void slotListDelete(); |
76 | void slotViewBack(); | 77 | void slotViewBack(); |
77 | void slotViewEdit(); | 78 | void slotViewEdit(); |
78 | void slotPersonalView(); | 79 | void slotPersonalView(); |
79 | void listIsEmpty( bool ); | 80 | void listIsEmpty( bool ); |
80 | /* void slotSettings(); */ | 81 | /* void slotSettings(); */ |
81 | void writeMail(); | 82 | void writeMail(); |
82 | void slotBeam(); | 83 | void slotBeam(); |
83 | void beamDone( Ir * ); | 84 | void beamDone( Ir * ); |
84 | void slotSetCategory( int ); | 85 | void slotSetCategory( int ); |
85 | void slotSetLetter( char ); | 86 | void slotSetLetter( char ); |
86 | void slotUpdateToolbar(); | 87 | void slotUpdateToolbar(); |
87 | void slotSetFont(int); | 88 | void slotSetFont(int); |
88 | 89 | ||
89 | void slotFindOpen(); | 90 | void slotFindOpen(); |
90 | void slotFindClose(); | 91 | void slotFindClose(); |
91 | void slotFind(); | 92 | void slotFind(); |
92 | void slotNotFound(); | 93 | void slotNotFound(); |
93 | void slotWrapAround(); | 94 | void slotWrapAround(); |
94 | 95 | ||
95 | void slotViewSwitched( int ); | 96 | void slotViewSwitched( int ); |
96 | void slotListView(); | 97 | void slotListView(); |
97 | void slotCardView(); | 98 | void slotCardView(); |
98 | 99 | ||
99 | void slotConfig(); | 100 | void slotConfig(); |
100 | 101 | ||
101 | private: | 102 | private: |
102 | void populateCategories(); | 103 | void populateCategories(); |
103 | 104 | ||
104 | QPopupMenu *catMenu; | 105 | QPopupMenu *catMenu; |
105 | QPEToolBar *listTools; | 106 | QPEToolBar *listTools; |
106 | QToolButton *deleteButton; | 107 | QToolButton *deleteButton; |
107 | enum Panes { paneList=0, paneView, paneEdit }; | 108 | enum Panes { paneList=0, paneView, paneEdit }; |
108 | ContactEditor *abEditor; | 109 | ContactEditor *abEditor; |
109 | LetterPicker *pLabel; | 110 | LetterPicker *pLabel; |
110 | AbView* m_abView; | 111 | AbView* m_abView; |
111 | QWidget *listContainer; | 112 | QWidget *listContainer; |
112 | 113 | ||
113 | // Searching stuff | 114 | // Searching stuff |
114 | OFloatBar* searchBar; | 115 | OFloatBar* searchBar; |
115 | QLineEdit* searchEdit; | 116 | QLineEdit* searchEdit; |
116 | 117 | ||
117 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; | 118 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; |
118 | 119 | ||
119 | int viewMargin; | 120 | int viewMargin; |
120 | 121 | ||
121 | bool syncing; | 122 | bool syncing; |
122 | QFont *defaultFont; | 123 | QFont *defaultFont; |
123 | int m_curFontSize; | 124 | int m_curFontSize; |
124 | 125 | ||
125 | bool isLoading; | 126 | bool isLoading; |
126 | 127 | ||
127 | AbConfig m_config; | 128 | AbConfig m_config; |
128 | 129 | ||
129 | QAction* m_tableViewButton; | 130 | QAction* m_tableViewButton; |
130 | QAction* m_cardViewButton; | 131 | QAction* m_cardViewButton; |
131 | 132 | ||
132 | int active_view; | 133 | int active_view; |
133 | }; | 134 | }; |
134 | 135 | ||
135 | #endif | 136 | #endif |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index df97b85..f33ee0a 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -747,1000 +747,1002 @@ void ContactEditor::populateDefaultEmailCmb(){ | |||
747 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 747 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
748 | QString type = slChooserNames[index]; | 748 | QString type = slChooserNames[index]; |
749 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); | 749 | qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); |
750 | 750 | ||
751 | if ( !initializing ) | 751 | if ( !initializing ) |
752 | contactfields.setFieldOrder( widgetPos-1, index ); | 752 | contactfields.setFieldOrder( widgetPos-1, index ); |
753 | 753 | ||
754 | // Create and connect combobox for selecting the default email | 754 | // Create and connect combobox for selecting the default email |
755 | if ( type == "Default Email"){ | 755 | if ( type == "Default Email"){ |
756 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); | 756 | qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); |
757 | 757 | ||
758 | // More than one default-email chooser is not allowed ! | 758 | // More than one default-email chooser is not allowed ! |
759 | if ( ( defaultEmailChooserPosition != -1 ) && | 759 | if ( ( defaultEmailChooserPosition != -1 ) && |
760 | defaultEmailChooserPosition != widgetPos && !initializing){ | 760 | defaultEmailChooserPosition != widgetPos && !initializing){ |
761 | chooserError( widgetPos ); | 761 | chooserError( widgetPos ); |
762 | return true; | 762 | return true; |
763 | } | 763 | } |
764 | 764 | ||
765 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 765 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
766 | if ( cmbo ){ | 766 | if ( cmbo ){ |
767 | inputStack->raiseWidget( TextField ); | 767 | inputStack->raiseWidget( TextField ); |
768 | inputStack -> removeWidget( cmbo ); | 768 | inputStack -> removeWidget( cmbo ); |
769 | delete cmbo; | 769 | delete cmbo; |
770 | } | 770 | } |
771 | cmbo = new QComboBox( inputStack ); | 771 | cmbo = new QComboBox( inputStack ); |
772 | cmbo -> insertStringList( emails ); | 772 | cmbo -> insertStringList( emails ); |
773 | 773 | ||
774 | inputStack -> addWidget( cmbo, Combo ); | 774 | inputStack -> addWidget( cmbo, Combo ); |
775 | inputStack -> raiseWidget( Combo ); | 775 | inputStack -> raiseWidget( Combo ); |
776 | 776 | ||
777 | defaultEmailChooserPosition = widgetPos; | 777 | defaultEmailChooserPosition = widgetPos; |
778 | cmbDefaultEmail = cmbo; | 778 | cmbDefaultEmail = cmbo; |
779 | 779 | ||
780 | connect( cmbo,SIGNAL( activated(int) ), | 780 | connect( cmbo,SIGNAL( activated(int) ), |
781 | SLOT( defaultEmailChanged(int) ) ); | 781 | SLOT( defaultEmailChanged(int) ) ); |
782 | 782 | ||
783 | // Set current default email | 783 | // Set current default email |
784 | populateDefaultEmailCmb(); | 784 | populateDefaultEmailCmb(); |
785 | 785 | ||
786 | 786 | ||
787 | } else { | 787 | } else { |
788 | // Something else was selected: Hide combo.. | 788 | // Something else was selected: Hide combo.. |
789 | qWarning(" Hiding default-email combo" ); | 789 | qWarning(" Hiding default-email combo" ); |
790 | if ( defaultEmailChooserPosition == widgetPos ){ | 790 | if ( defaultEmailChooserPosition == widgetPos ){ |
791 | defaultEmailChooserPosition = -1; | 791 | defaultEmailChooserPosition = -1; |
792 | } | 792 | } |
793 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 793 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
794 | if ( cmbo ){ | 794 | if ( cmbo ){ |
795 | inputStack->raiseWidget( TextField ); | 795 | inputStack->raiseWidget( TextField ); |
796 | inputStack -> removeWidget( cmbo ); | 796 | inputStack -> removeWidget( cmbo ); |
797 | cmbDefaultEmail = 0l; | 797 | cmbDefaultEmail = 0l; |
798 | delete cmbo; | 798 | delete cmbo; |
799 | } | 799 | } |
800 | 800 | ||
801 | // Caller should initialize the responsible textfield, therefore | 801 | // Caller should initialize the responsible textfield, therefore |
802 | // "false" is returned | 802 | // "false" is returned |
803 | return false; | 803 | return false; |
804 | } | 804 | } |
805 | 805 | ||
806 | // Everything is worked off .. | 806 | // Everything is worked off .. |
807 | return true; | 807 | return true; |
808 | 808 | ||
809 | } | 809 | } |
810 | 810 | ||
811 | // Currently accessed when we select default-email more than once ! | 811 | // Currently accessed when we select default-email more than once ! |
812 | void ContactEditor::chooserError( int index ) | 812 | void ContactEditor::chooserError( int index ) |
813 | { | 813 | { |
814 | qWarning("ContactEditor::chooserError( %d )", index); | 814 | qWarning("ContactEditor::chooserError( %d )", index); |
815 | QMessageBox::warning( this, "Chooser Error", | 815 | QMessageBox::warning( this, "Chooser Error", |
816 | "Multiple selection of this\n" | 816 | "Multiple selection of this\n" |
817 | "Item is not allowed !\n\n" | 817 | "Item is not allowed !\n\n" |
818 | "First deselect the previous one !", | 818 | "First deselect the previous one !", |
819 | "&OK", 0, 0, | 819 | "&OK", 0, 0, |
820 | 0, 0 ); | 820 | 0, 0 ); |
821 | 821 | ||
822 | // Reset the selected Chooser. Unfortunately the chooser | 822 | // Reset the selected Chooser. Unfortunately the chooser |
823 | // generates no signal, therfore we have to | 823 | // generates no signal, therfore we have to |
824 | // call the cmbChooserChange function manually.. | 824 | // call the cmbChooserChange function manually.. |
825 | switch( index ){ | 825 | switch( index ){ |
826 | case 1: | 826 | case 1: |
827 | cmbChooserField1 -> setCurrentItem( 0 ); | 827 | cmbChooserField1 -> setCurrentItem( 0 ); |
828 | slotCmbChooser1Change( 0 ); | 828 | slotCmbChooser1Change( 0 ); |
829 | break; | 829 | break; |
830 | case 2: | 830 | case 2: |
831 | cmbChooserField2 -> setCurrentItem( 0 ); | 831 | cmbChooserField2 -> setCurrentItem( 0 ); |
832 | slotCmbChooser2Change( 0 ); | 832 | slotCmbChooser2Change( 0 ); |
833 | break; | 833 | break; |
834 | case 3: | 834 | case 3: |
835 | cmbChooserField3 -> setCurrentItem( 0 ); | 835 | cmbChooserField3 -> setCurrentItem( 0 ); |
836 | slotCmbChooser3Change( 0 ); | 836 | slotCmbChooser3Change( 0 ); |
837 | break; | 837 | break; |
838 | case 4: | 838 | case 4: |
839 | cmbChooserField4 -> setCurrentItem( 0 ); | 839 | cmbChooserField4 -> setCurrentItem( 0 ); |
840 | slotCmbChooser4Change( 0 ); | 840 | slotCmbChooser4Change( 0 ); |
841 | break; | 841 | break; |
842 | } | 842 | } |
843 | } | 843 | } |
844 | 844 | ||
845 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 845 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
846 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 846 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
847 | QLineEdit* , int widgetPos ) { | 847 | QLineEdit* , int widgetPos ) { |
848 | 848 | ||
849 | QString type = slChooserNames[index]; // :SX | 849 | QString type = slChooserNames[index]; // :SX |
850 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", | 850 | qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", |
851 | type.latin1(),textChanged.latin1(), index, widgetPos ); | 851 | type.latin1(),textChanged.latin1(), index, widgetPos ); |
852 | 852 | ||
853 | if ( type == "Default Email"){ | 853 | if ( type == "Default Email"){ |
854 | qWarning ("??? Wozu??: %s", textChanged.latin1()); | 854 | qWarning ("??? Wozu??: %s", textChanged.latin1()); |
855 | defaultEmail = textChanged; | 855 | defaultEmail = textChanged; |
856 | 856 | ||
857 | populateDefaultEmailCmb(); | 857 | populateDefaultEmailCmb(); |
858 | 858 | ||
859 | }else if (type == "Emails"){ | 859 | }else if (type == "Emails"){ |
860 | qDebug("emails"); | 860 | qDebug("emails"); |
861 | 861 | ||
862 | QString de; | 862 | QString de; |
863 | emails = QStringList::split (",", textChanged ); | 863 | emails = QStringList::split (",", textChanged ); |
864 | 864 | ||
865 | populateDefaultEmailCmb(); | 865 | populateDefaultEmailCmb(); |
866 | } | 866 | } |
867 | 867 | ||
868 | slChooserValues[index] = textChanged; | 868 | slChooserValues[index] = textChanged; |
869 | 869 | ||
870 | } | 870 | } |
871 | 871 | ||
872 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 872 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
873 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); | 873 | qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); |
874 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 874 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
875 | } | 875 | } |
876 | 876 | ||
877 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 877 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
878 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); | 878 | qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); |
879 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 879 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
880 | 880 | ||
881 | } | 881 | } |
882 | 882 | ||
883 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 883 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
884 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); | 884 | qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); |
885 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 885 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
886 | } | 886 | } |
887 | 887 | ||
888 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 888 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
889 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); | 889 | qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); |
890 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 890 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
891 | } | 891 | } |
892 | 892 | ||
893 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 893 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
894 | 894 | ||
895 | if ( cmbAddress->currentItem() == 0 ) { | 895 | if ( cmbAddress->currentItem() == 0 ) { |
896 | slBusinessAddress[0] = textChanged; | 896 | slBusinessAddress[0] = textChanged; |
897 | } else { | 897 | } else { |
898 | slHomeAddress[0] = textChanged; | 898 | slHomeAddress[0] = textChanged; |
899 | } | 899 | } |
900 | } | 900 | } |
901 | 901 | ||
902 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 902 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
903 | 903 | ||
904 | if ( cmbAddress->currentItem() == 0 ) { | 904 | if ( cmbAddress->currentItem() == 0 ) { |
905 | slBusinessAddress[1] = textChanged; | 905 | slBusinessAddress[1] = textChanged; |
906 | } else { | 906 | } else { |
907 | slHomeAddress[1] = textChanged; | 907 | slHomeAddress[1] = textChanged; |
908 | } | 908 | } |
909 | } | 909 | } |
910 | 910 | ||
911 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 911 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
912 | 912 | ||
913 | if ( cmbAddress->currentItem() == 0 ) { | 913 | if ( cmbAddress->currentItem() == 0 ) { |
914 | slBusinessAddress[2] = textChanged; | 914 | slBusinessAddress[2] = textChanged; |
915 | } else { | 915 | } else { |
916 | slHomeAddress[2] = textChanged; | 916 | slHomeAddress[2] = textChanged; |
917 | } | 917 | } |
918 | } | 918 | } |
919 | 919 | ||
920 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 920 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
921 | 921 | ||
922 | if ( cmbAddress->currentItem() == 0 ) { | 922 | if ( cmbAddress->currentItem() == 0 ) { |
923 | slBusinessAddress[3] = textChanged; | 923 | slBusinessAddress[3] = textChanged; |
924 | } else { | 924 | } else { |
925 | slHomeAddress[3] = textChanged; | 925 | slHomeAddress[3] = textChanged; |
926 | } | 926 | } |
927 | } | 927 | } |
928 | 928 | ||
929 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 929 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
930 | 930 | ||
931 | 931 | ||
932 | if ( cmbAddress->currentItem() == 0 ) { | 932 | if ( cmbAddress->currentItem() == 0 ) { |
933 | slBusinessAddress[4] = textChanged; | 933 | slBusinessAddress[4] = textChanged; |
934 | } else { | 934 | } else { |
935 | slHomeAddress[4] = textChanged; | 935 | slHomeAddress[4] = textChanged; |
936 | } | 936 | } |
937 | } | 937 | } |
938 | 938 | ||
939 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 939 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
940 | 940 | ||
941 | if ( cmbAddress->currentItem() == 0 ) { | 941 | if ( cmbAddress->currentItem() == 0 ) { |
942 | slBusinessAddress[5] = textChanged; | 942 | slBusinessAddress[5] = textChanged; |
943 | } else { | 943 | } else { |
944 | slHomeAddress[5] = textChanged; | 944 | slHomeAddress[5] = textChanged; |
945 | } | 945 | } |
946 | } | 946 | } |
947 | 947 | ||
948 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 948 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
949 | 949 | ||
950 | if ( cmbAddress->currentItem() == 0 ) { | 950 | if ( cmbAddress->currentItem() == 0 ) { |
951 | slBusinessAddress[6] = textChanged; | 951 | slBusinessAddress[6] = textChanged; |
952 | } else { | 952 | } else { |
953 | slHomeAddress[6] = textChanged; | 953 | slHomeAddress[6] = textChanged; |
954 | } | 954 | } |
955 | } | 955 | } |
956 | 956 | ||
957 | 957 | ||
958 | void ContactEditor::slotCmbChooser1Change( int index ) { | 958 | void ContactEditor::slotCmbChooser1Change( int index ) { |
959 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); | 959 | qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); |
960 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 960 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
961 | 961 | ||
962 | txtChooserField1->setText( slChooserValues[index] ); | 962 | txtChooserField1->setText( slChooserValues[index] ); |
963 | txtChooserField1->setFocus(); | 963 | txtChooserField1->setFocus(); |
964 | 964 | ||
965 | } | 965 | } |
966 | 966 | ||
967 | } | 967 | } |
968 | 968 | ||
969 | void ContactEditor::slotCmbChooser2Change( int index ) { | 969 | void ContactEditor::slotCmbChooser2Change( int index ) { |
970 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); | 970 | qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); |
971 | 971 | ||
972 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 972 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
973 | 973 | ||
974 | txtChooserField2->setText( slChooserValues[index] ); | 974 | txtChooserField2->setText( slChooserValues[index] ); |
975 | txtChooserField2->setFocus(); | 975 | txtChooserField2->setFocus(); |
976 | 976 | ||
977 | } | 977 | } |
978 | } | 978 | } |
979 | 979 | ||
980 | void ContactEditor::slotCmbChooser3Change( int index ) { | 980 | void ContactEditor::slotCmbChooser3Change( int index ) { |
981 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); | 981 | qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); |
982 | 982 | ||
983 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 983 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
984 | 984 | ||
985 | txtChooserField3->setText( slChooserValues[index] ); | 985 | txtChooserField3->setText( slChooserValues[index] ); |
986 | txtChooserField3->setFocus(); | 986 | txtChooserField3->setFocus(); |
987 | 987 | ||
988 | } | 988 | } |
989 | } | 989 | } |
990 | 990 | ||
991 | void ContactEditor::slotCmbChooser4Change( int index ) { | 991 | void ContactEditor::slotCmbChooser4Change( int index ) { |
992 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); | 992 | qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); |
993 | 993 | ||
994 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 994 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
995 | 995 | ||
996 | txtChooserField4->setText( slChooserValues[index] ); | 996 | txtChooserField4->setText( slChooserValues[index] ); |
997 | txtChooserField4->setFocus(); | 997 | txtChooserField4->setFocus(); |
998 | 998 | ||
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | void ContactEditor::slotAddressTypeChange( int index ) { | 1002 | void ContactEditor::slotAddressTypeChange( int index ) { |
1003 | 1003 | ||
1004 | 1004 | ||
1005 | if ( !initializing ) | 1005 | if ( !initializing ) |
1006 | contactfields.setFieldOrder( 4, index ); | 1006 | contactfields.setFieldOrder( 4, index ); |
1007 | 1007 | ||
1008 | 1008 | ||
1009 | if ( index == 0 ) { | 1009 | if ( index == 0 ) { |
1010 | 1010 | ||
1011 | txtAddress->setText( slBusinessAddress[0] ); | 1011 | txtAddress->setText( slBusinessAddress[0] ); |
1012 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1012 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1013 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1013 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1014 | txtCity->setText( slBusinessAddress[3] ); | 1014 | txtCity->setText( slBusinessAddress[3] ); |
1015 | txtState->setText( slBusinessAddress[4] ); | 1015 | txtState->setText( slBusinessAddress[4] ); |
1016 | txtZip->setText( slBusinessAddress[5] ); | 1016 | txtZip->setText( slBusinessAddress[5] ); |
1017 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1017 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1018 | txtTmp->setText( slBusinessAddress[6] ); | 1018 | txtTmp->setText( slBusinessAddress[6] ); |
1019 | 1019 | ||
1020 | } else { | 1020 | } else { |
1021 | 1021 | ||
1022 | txtAddress->setText( slHomeAddress[0] ); | 1022 | txtAddress->setText( slHomeAddress[0] ); |
1023 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1023 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1024 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1024 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1025 | txtCity->setText( slHomeAddress[3] ); | 1025 | txtCity->setText( slHomeAddress[3] ); |
1026 | txtState->setText( slHomeAddress[4] ); | 1026 | txtState->setText( slHomeAddress[4] ); |
1027 | txtZip->setText( slHomeAddress[5] ); | 1027 | txtZip->setText( slHomeAddress[5] ); |
1028 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1028 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1029 | txtTmp->setText( slHomeAddress[6] ); | 1029 | txtTmp->setText( slHomeAddress[6] ); |
1030 | 1030 | ||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1035 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1036 | 1036 | ||
1037 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); | 1037 | qWarning( "ContactEditor::slotFullNameChange( %s )", textChanged.latin1() ); |
1038 | 1038 | ||
1039 | int index = cmbFileAs->currentItem(); | 1039 | int index = cmbFileAs->currentItem(); |
1040 | 1040 | ||
1041 | cmbFileAs->clear(); | 1041 | cmbFileAs->clear(); |
1042 | 1042 | ||
1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1044 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1044 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1045 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1045 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1046 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1046 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1047 | if ( ! txtSuffix->text().isEmpty() ) | 1047 | if ( ! txtSuffix->text().isEmpty() ) |
1048 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1048 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1049 | 1049 | ||
1050 | cmbFileAs->setCurrentItem( index ); | 1050 | cmbFileAs->setCurrentItem( index ); |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | void ContactEditor::slotSuffixChange( const QString& ) { | 1055 | void ContactEditor::slotSuffixChange( const QString& ) { |
1056 | // Just want to update the FileAs combo if the suffix was changed.. | 1056 | // Just want to update the FileAs combo if the suffix was changed.. |
1057 | slotFullNameChange( txtFullName->text() ); | 1057 | slotFullNameChange( txtFullName->text() ); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | void ContactEditor::accept() { | 1060 | void ContactEditor::accept() { |
1061 | 1061 | ||
1062 | if ( isEmpty() ) { | 1062 | if ( isEmpty() ) { |
1063 | cleanupFields(); | 1063 | cleanupFields(); |
1064 | reject(); | 1064 | reject(); |
1065 | } else { | 1065 | } else { |
1066 | saveEntry(); | 1066 | saveEntry(); |
1067 | cleanupFields(); | 1067 | cleanupFields(); |
1068 | QDialog::accept(); | 1068 | QDialog::accept(); |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | void ContactEditor::slotNote() { | 1073 | void ContactEditor::slotNote() { |
1074 | 1074 | ||
1075 | dlgNote->showMaximized(); | 1075 | dlgNote->showMaximized(); |
1076 | if ( !dlgNote->exec() ) { | 1076 | if ( !dlgNote->exec() ) { |
1077 | txtNote->setText( ent.notes() ); | 1077 | txtNote->setText( ent.notes() ); |
1078 | } | 1078 | } |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | void ContactEditor::slotName() { | 1081 | void ContactEditor::slotName() { |
1082 | 1082 | ||
1083 | QString tmpName; | 1083 | QString tmpName; |
1084 | 1084 | ||
1085 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1085 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1086 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1086 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1087 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1087 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1088 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1088 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1089 | 1089 | ||
1090 | dlgName->showMaximized(); | 1090 | dlgName->showMaximized(); |
1091 | if ( dlgName->exec() ) { | 1091 | if ( dlgName->exec() ) { |
1092 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1092 | if ( txtLastName->text().contains( ' ', TRUE ) ) |
1093 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1093 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1094 | else | 1094 | else |
1095 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1095 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1096 | 1096 | ||
1097 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1097 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1098 | slotFullNameChange( txtFullName->text() ); | 1098 | slotFullNameChange( txtFullName->text() ); |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | void ContactEditor::setNameFocus() { | 1103 | void ContactEditor::setNameFocus() { |
1104 | 1104 | ||
1105 | txtFullName->setFocus(); | 1105 | txtFullName->setFocus(); |
1106 | 1106 | ||
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | bool ContactEditor::isEmpty() { | 1109 | bool ContactEditor::isEmpty() { |
1110 | // Test and see if the record should be saved. | 1110 | // Test and see if the record should be saved. |
1111 | // More strict than the original qtopia, needs name or fileas to save | 1111 | // More strict than the original qtopia, needs name or fileas to save |
1112 | 1112 | ||
1113 | QString t = txtFullName->text(); | 1113 | QString t = txtFullName->text(); |
1114 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1114 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1115 | return false; | 1115 | return false; |
1116 | 1116 | ||
1117 | t = cmbFileAs->currentText(); | 1117 | t = cmbFileAs->currentText(); |
1118 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1118 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1119 | return false; | 1119 | return false; |
1120 | 1120 | ||
1121 | return true; | 1121 | return true; |
1122 | 1122 | ||
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1125 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1126 | 1126 | ||
1127 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1127 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1128 | QString strFirstName; | 1128 | QString strFirstName; |
1129 | QString strMiddleName; | 1129 | QString strMiddleName; |
1130 | QString strLastName; | 1130 | QString strLastName; |
1131 | QString strTitle; | 1131 | QString strTitle; |
1132 | int commapos; | 1132 | int commapos; |
1133 | bool haveLastName = false; | 1133 | bool haveLastName = false; |
1134 | 1134 | ||
1135 | qWarning("Fullname: %s", simplifiedName.latin1()); | 1135 | qWarning("Fullname: %s", simplifiedName.latin1()); |
1136 | 1136 | ||
1137 | commapos = simplifiedName.find( ',', 0, TRUE); | 1137 | commapos = simplifiedName.find( ',', 0, TRUE); |
1138 | if ( commapos >= 0 ) { | 1138 | if ( commapos >= 0 ) { |
1139 | qWarning(" Commapos: %d", commapos ); | 1139 | qWarning(" Commapos: %d", commapos ); |
1140 | 1140 | ||
1141 | // A comma (",") separates the lastname from one or | 1141 | // A comma (",") separates the lastname from one or |
1142 | // many first names. Thus, remove the lastname from the | 1142 | // many first names. Thus, remove the lastname from the |
1143 | // String and parse the firstnames. | 1143 | // String and parse the firstnames. |
1144 | 1144 | ||
1145 | strLastName = simplifiedName.left( commapos ); | 1145 | strLastName = simplifiedName.left( commapos ); |
1146 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1146 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1147 | haveLastName = true; | 1147 | haveLastName = true; |
1148 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); | 1148 | qWarning("Fullname without ',': %s", simplifiedName.latin1()); |
1149 | 1149 | ||
1150 | // If we have any lastname, we should now split all first names. | 1150 | // If we have any lastname, we should now split all first names. |
1151 | // The first one will be the used as first, the rest as "middle names" | 1151 | // The first one will be the used as first, the rest as "middle names" |
1152 | 1152 | ||
1153 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1153 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1154 | QStringList::Iterator it = allFirstNames.begin(); | 1154 | QStringList::Iterator it = allFirstNames.begin(); |
1155 | strFirstName = *it++; | 1155 | strFirstName = *it++; |
1156 | QStringList allSecondNames; | 1156 | QStringList allSecondNames; |
1157 | for ( ; it != allFirstNames.end(); ++it ) | 1157 | for ( ; it != allFirstNames.end(); ++it ) |
1158 | allSecondNames.append( *it ); | 1158 | allSecondNames.append( *it ); |
1159 | 1159 | ||
1160 | strMiddleName = allSecondNames.join(" "); | 1160 | strMiddleName = allSecondNames.join(" "); |
1161 | 1161 | ||
1162 | } else { | 1162 | } else { |
1163 | 1163 | ||
1164 | // No comma separator used: We use the first word as firstname, the | 1164 | // No comma separator used: We use the first word as firstname, the |
1165 | // last as second/lastname and everything in the middle as middlename | 1165 | // last as second/lastname and everything in the middle as middlename |
1166 | 1166 | ||
1167 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1167 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1168 | QStringList::Iterator it = allNames.begin(); | 1168 | QStringList::Iterator it = allNames.begin(); |
1169 | strFirstName = *it++; | 1169 | strFirstName = *it++; |
1170 | QStringList allSecondNames; | 1170 | QStringList allSecondNames; |
1171 | for ( ; it != --allNames.end(); ++it ) | 1171 | for ( ; it != --allNames.end(); ++it ) |
1172 | allSecondNames.append( *it ); | 1172 | allSecondNames.append( *it ); |
1173 | 1173 | ||
1174 | strMiddleName = allSecondNames.join(" "); | 1174 | strMiddleName = allSecondNames.join(" "); |
1175 | strLastName = *(--allNames.end()); | 1175 | strLastName = *(--allNames.end()); |
1176 | 1176 | ||
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | if ( strFirstName == strLastName ) | 1179 | if ( strFirstName == strLastName ) |
1180 | strFirstName = ""; | 1180 | strFirstName = ""; |
1181 | 1181 | ||
1182 | qWarning(" strFirstName: %s", strFirstName.latin1()); | 1182 | qWarning(" strFirstName: %s", strFirstName.latin1()); |
1183 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); | 1183 | qWarning(" strMiddleName: %s", strMiddleName.latin1()); |
1184 | qWarning(" strLastName: %s", strLastName.latin1()); | 1184 | qWarning(" strLastName: %s", strLastName.latin1()); |
1185 | qWarning(" strTitle: %s", strTitle.latin1()); | 1185 | qWarning(" strTitle: %s", strTitle.latin1()); |
1186 | 1186 | ||
1187 | switch (type) { | 1187 | switch (type) { |
1188 | case NAME_FL: | 1188 | case NAME_FL: |
1189 | return strFirstName + " " + strLastName; | 1189 | return strFirstName + " " + strLastName; |
1190 | 1190 | ||
1191 | case NAME_LF: | 1191 | case NAME_LF: |
1192 | return strLastName + ", " + strFirstName; | 1192 | return strLastName + ", " + strFirstName; |
1193 | 1193 | ||
1194 | case NAME_LFM: | 1194 | case NAME_LFM: |
1195 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1195 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1196 | 1196 | ||
1197 | case NAME_FML: | 1197 | case NAME_FML: |
1198 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1198 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1199 | 1199 | ||
1200 | case NAME_F: | 1200 | case NAME_F: |
1201 | return strFirstName; | 1201 | return strFirstName; |
1202 | 1202 | ||
1203 | case NAME_M: | 1203 | case NAME_M: |
1204 | return strMiddleName; | 1204 | return strMiddleName; |
1205 | 1205 | ||
1206 | case NAME_L: | 1206 | case NAME_L: |
1207 | return strLastName; | 1207 | return strLastName; |
1208 | 1208 | ||
1209 | case NAME_S: | 1209 | case NAME_S: |
1210 | return txtSuffix->text(); | 1210 | return txtSuffix->text(); |
1211 | 1211 | ||
1212 | } | 1212 | } |
1213 | return QString::null; | 1213 | return QString::null; |
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | void ContactEditor::cleanupFields() { | 1216 | void ContactEditor::cleanupFields() { |
1217 | QStringList::Iterator it = slChooserValues.begin(); | 1217 | QStringList::Iterator it = slChooserValues.begin(); |
1218 | 1218 | ||
1219 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1219 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1220 | (*it) = ""; | 1220 | (*it) = ""; |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | for ( int i = 0; i < 7; i++ ) { | 1223 | for ( int i = 0; i < 7; i++ ) { |
1224 | slHomeAddress[i] = ""; | 1224 | slHomeAddress[i] = ""; |
1225 | slBusinessAddress[i] = ""; | 1225 | slBusinessAddress[i] = ""; |
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | QListIterator<QLineEdit> itLV( listValue ); | 1228 | QListIterator<QLineEdit> itLV( listValue ); |
1229 | for ( ; itLV.current(); ++itLV ) { | 1229 | for ( ; itLV.current(); ++itLV ) { |
1230 | (*itLV)->setText( "" ); | 1230 | (*itLV)->setText( "" ); |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | txtFirstName->setText(""); | 1233 | txtFirstName->setText(""); |
1234 | txtMiddleName->setText(""); | 1234 | txtMiddleName->setText(""); |
1235 | txtLastName->setText(""); | 1235 | txtLastName->setText(""); |
1236 | txtSuffix->setText(""); | 1236 | txtSuffix->setText(""); |
1237 | txtNote->setText(""); | 1237 | txtNote->setText(""); |
1238 | txtFullName->setText(""); | 1238 | txtFullName->setText(""); |
1239 | txtJobTitle->setText(""); | 1239 | txtJobTitle->setText(""); |
1240 | txtOrganization->setText(""); | 1240 | txtOrganization->setText(""); |
1241 | txtChooserField1->setText(""); | 1241 | txtChooserField1->setText(""); |
1242 | txtChooserField2->setText(""); | 1242 | txtChooserField2->setText(""); |
1243 | txtChooserField3->setText(""); | 1243 | txtChooserField3->setText(""); |
1244 | txtAddress->setText(""); | 1244 | txtAddress->setText(""); |
1245 | txtCity->setText(""); | 1245 | txtCity->setText(""); |
1246 | txtState->setText(""); | 1246 | txtState->setText(""); |
1247 | txtZip->setText(""); | 1247 | txtZip->setText(""); |
1248 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1248 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1249 | txtTmp->setText(""); | 1249 | txtTmp->setText(""); |
1250 | txtTmp = cmbFileAs->lineEdit(); | 1250 | txtTmp = cmbFileAs->lineEdit(); |
1251 | txtTmp->setText(""); | 1251 | txtTmp->setText(""); |
1252 | 1252 | ||
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | void ContactEditor::setEntry( const OContact &entry ) { | 1255 | void ContactEditor::setEntry( const OContact &entry ) { |
1256 | 1256 | ||
1257 | initializing = true; | 1257 | initializing = true; |
1258 | 1258 | ||
1259 | // Cleanup and activate the general Page .. | ||
1259 | cleanupFields(); | 1260 | cleanupFields(); |
1261 | tabMain->setCurrentPage( 0 ); | ||
1260 | 1262 | ||
1261 | ent = entry; | 1263 | ent = entry; |
1262 | 1264 | ||
1263 | emails = QStringList(ent.emailList()); | 1265 | emails = QStringList(ent.emailList()); |
1264 | defaultEmail = ent.defaultEmail(); | 1266 | defaultEmail = ent.defaultEmail(); |
1265 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1267 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1266 | qDebug("default email=%s",defaultEmail.latin1()); | 1268 | qDebug("default email=%s",defaultEmail.latin1()); |
1267 | 1269 | ||
1268 | txtFirstName->setText( ent.firstName() ); | 1270 | txtFirstName->setText( ent.firstName() ); |
1269 | txtMiddleName->setText( ent.middleName() ); | 1271 | txtMiddleName->setText( ent.middleName() ); |
1270 | txtLastName->setText( ent.lastName() ); | 1272 | txtLastName->setText( ent.lastName() ); |
1271 | txtSuffix->setText( ent.suffix() ); | 1273 | txtSuffix->setText( ent.suffix() ); |
1272 | 1274 | ||
1273 | // QString *tmpString = new QString; | 1275 | // QString *tmpString = new QString; |
1274 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1276 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1275 | // + " " + ent.lastName() + " " + ent.suffix(); | 1277 | // + " " + ent.lastName() + " " + ent.suffix(); |
1276 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1278 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1277 | 1279 | ||
1278 | if ( !ent.isEmpty() ){ | 1280 | if ( !ent.isEmpty() ){ |
1279 | // Lastnames with multiple words need to be protected by a comma ! | 1281 | // Lastnames with multiple words need to be protected by a comma ! |
1280 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1282 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1281 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1283 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1282 | else | 1284 | else |
1283 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1285 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1284 | } | 1286 | } |
1285 | 1287 | ||
1286 | cmbFileAs->setEditText( ent.fileAs() ); | 1288 | cmbFileAs->setEditText( ent.fileAs() ); |
1287 | 1289 | ||
1288 | //if (hasTitle) | 1290 | //if (hasTitle) |
1289 | txtJobTitle->setText( ent.jobTitle() ); | 1291 | txtJobTitle->setText( ent.jobTitle() ); |
1290 | 1292 | ||
1291 | //if (hasCompany) | 1293 | //if (hasCompany) |
1292 | txtOrganization->setText( ent.company() ); | 1294 | txtOrganization->setText( ent.company() ); |
1293 | 1295 | ||
1294 | //if (hasNotes) | 1296 | //if (hasNotes) |
1295 | txtNote->setText( ent.notes() ); | 1297 | txtNote->setText( ent.notes() ); |
1296 | 1298 | ||
1297 | //if (hasStreet) { | 1299 | //if (hasStreet) { |
1298 | slHomeAddress[0] = ent.homeStreet(); | 1300 | slHomeAddress[0] = ent.homeStreet(); |
1299 | slBusinessAddress[0] = ent.businessStreet(); | 1301 | slBusinessAddress[0] = ent.businessStreet(); |
1300 | //} | 1302 | //} |
1301 | 1303 | ||
1302 | //if (hasCity) { | 1304 | //if (hasCity) { |
1303 | slHomeAddress[3] = ent.homeCity(); | 1305 | slHomeAddress[3] = ent.homeCity(); |
1304 | slBusinessAddress[3] = ent.businessCity(); | 1306 | slBusinessAddress[3] = ent.businessCity(); |
1305 | //} | 1307 | //} |
1306 | 1308 | ||
1307 | //if (hasState) { | 1309 | //if (hasState) { |
1308 | slHomeAddress[4] = ent.homeState(); | 1310 | slHomeAddress[4] = ent.homeState(); |
1309 | slBusinessAddress[4] = ent.businessState(); | 1311 | slBusinessAddress[4] = ent.businessState(); |
1310 | //} | 1312 | //} |
1311 | 1313 | ||
1312 | //if (hasZip) { | 1314 | //if (hasZip) { |
1313 | slHomeAddress[5] = ent.homeZip(); | 1315 | slHomeAddress[5] = ent.homeZip(); |
1314 | slBusinessAddress[5] = ent.businessZip(); | 1316 | slBusinessAddress[5] = ent.businessZip(); |
1315 | //} | 1317 | //} |
1316 | 1318 | ||
1317 | //if (hasCountry) { | 1319 | //if (hasCountry) { |
1318 | slHomeAddress[6] = ent.homeCountry(); | 1320 | slHomeAddress[6] = ent.homeCountry(); |
1319 | slBusinessAddress[6] = ent.businessCountry(); | 1321 | slBusinessAddress[6] = ent.businessCountry(); |
1320 | //} | 1322 | //} |
1321 | 1323 | ||
1322 | QStringList::ConstIterator it; | 1324 | QStringList::ConstIterator it; |
1323 | QListIterator<QLineEdit> itLE( listValue ); | 1325 | QListIterator<QLineEdit> itLE( listValue ); |
1324 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1326 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1325 | 1327 | ||
1326 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); | 1328 | qWarning(" Filling dynamic Field: %s", (*it).latin1() ); |
1327 | 1329 | ||
1328 | if ( *it == "Department" ) | 1330 | if ( *it == "Department" ) |
1329 | (*itLE)->setText( ent.department() ); | 1331 | (*itLE)->setText( ent.department() ); |
1330 | 1332 | ||
1331 | if ( *it == "Company" ) | 1333 | if ( *it == "Company" ) |
1332 | (*itLE)->setText( ent.company() ); | 1334 | (*itLE)->setText( ent.company() ); |
1333 | 1335 | ||
1334 | if ( *it == "Office" ) | 1336 | if ( *it == "Office" ) |
1335 | (*itLE)->setText( ent.office() ); | 1337 | (*itLE)->setText( ent.office() ); |
1336 | 1338 | ||
1337 | if ( *it == "Profession" ) | 1339 | if ( *it == "Profession" ) |
1338 | (*itLE)->setText( ent.profession() ); | 1340 | (*itLE)->setText( ent.profession() ); |
1339 | 1341 | ||
1340 | if ( *it == "Assistant" ) | 1342 | if ( *it == "Assistant" ) |
1341 | (*itLE)->setText( ent.assistant() ); | 1343 | (*itLE)->setText( ent.assistant() ); |
1342 | 1344 | ||
1343 | if ( *it == "Manager" ) | 1345 | if ( *it == "Manager" ) |
1344 | (*itLE)->setText( ent.manager() ); | 1346 | (*itLE)->setText( ent.manager() ); |
1345 | 1347 | ||
1346 | if ( *it == "Spouse" ) | 1348 | if ( *it == "Spouse" ) |
1347 | (*itLE)->setText( ent.spouse() ); | 1349 | (*itLE)->setText( ent.spouse() ); |
1348 | 1350 | ||
1349 | if ( *it == "Nickname" ){ | 1351 | if ( *it == "Nickname" ){ |
1350 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); | 1352 | qWarning("**** Nichname: %s", ent.nickname().latin1() ); |
1351 | (*itLE)->setText( ent.nickname() ); | 1353 | (*itLE)->setText( ent.nickname() ); |
1352 | } | 1354 | } |
1353 | 1355 | ||
1354 | if ( *it == "Children" ) | 1356 | if ( *it == "Children" ) |
1355 | (*itLE)->setText( ent.children() ); | 1357 | (*itLE)->setText( ent.children() ); |
1356 | 1358 | ||
1357 | } | 1359 | } |
1358 | 1360 | ||
1359 | QStringList::Iterator itV; | 1361 | QStringList::Iterator itV; |
1360 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1362 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1361 | 1363 | ||
1362 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1364 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1363 | *itV = ent.businessPhone(); | 1365 | *itV = ent.businessPhone(); |
1364 | /* | 1366 | /* |
1365 | if ( *it == "Business 2 Phone" ) | 1367 | if ( *it == "Business 2 Phone" ) |
1366 | *itV = ent.business2Phone(); | 1368 | *itV = ent.business2Phone(); |
1367 | */ | 1369 | */ |
1368 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1370 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1369 | *itV = ent.businessFax(); | 1371 | *itV = ent.businessFax(); |
1370 | 1372 | ||
1371 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1373 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1372 | *itV = ent.businessMobile(); | 1374 | *itV = ent.businessMobile(); |
1373 | /* | 1375 | /* |
1374 | if ( *it == "Company Phone" ) | 1376 | if ( *it == "Company Phone" ) |
1375 | *itV = ent.companyPhone(); | 1377 | *itV = ent.companyPhone(); |
1376 | */ | 1378 | */ |
1377 | if ( *it == "Default Email" ) | 1379 | if ( *it == "Default Email" ) |
1378 | *itV = ent.defaultEmail(); | 1380 | *itV = ent.defaultEmail(); |
1379 | 1381 | ||
1380 | if ( *it == "Emails" ) | 1382 | if ( *it == "Emails" ) |
1381 | *itV = ent.emailList().join(", "); // :SX | 1383 | *itV = ent.emailList().join(", "); // :SX |
1382 | 1384 | ||
1383 | if ( *it == "Home Phone" ) | 1385 | if ( *it == "Home Phone" ) |
1384 | *itV = ent.homePhone(); | 1386 | *itV = ent.homePhone(); |
1385 | /* | 1387 | /* |
1386 | if ( *it == "Home 2 Phone" ) | 1388 | if ( *it == "Home 2 Phone" ) |
1387 | *itV = ent.home2Phone(); | 1389 | *itV = ent.home2Phone(); |
1388 | */ | 1390 | */ |
1389 | if ( *it == "Home Fax" ) | 1391 | if ( *it == "Home Fax" ) |
1390 | *itV = ent.homeFax(); | 1392 | *itV = ent.homeFax(); |
1391 | 1393 | ||
1392 | if ( *it == "Home Mobile" ) | 1394 | if ( *it == "Home Mobile" ) |
1393 | *itV = ent.homeMobile(); | 1395 | *itV = ent.homeMobile(); |
1394 | /* | 1396 | /* |
1395 | if ( *it == "Car Phone" ) | 1397 | if ( *it == "Car Phone" ) |
1396 | *itV = ent.carPhone(); | 1398 | *itV = ent.carPhone(); |
1397 | 1399 | ||
1398 | if ( *it == "ISDN Phone" ) | 1400 | if ( *it == "ISDN Phone" ) |
1399 | *itV = ent.ISDNPhone(); | 1401 | *itV = ent.ISDNPhone(); |
1400 | 1402 | ||
1401 | if ( *it == "Other Phone" ) | 1403 | if ( *it == "Other Phone" ) |
1402 | *itV = ent.otherPhone(); | 1404 | *itV = ent.otherPhone(); |
1403 | */ | 1405 | */ |
1404 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1406 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1405 | *itV = ent.businessPager(); | 1407 | *itV = ent.businessPager(); |
1406 | /* | 1408 | /* |
1407 | if ( *it == "Home Pager") | 1409 | if ( *it == "Home Pager") |
1408 | *itV = ent.homePager(); | 1410 | *itV = ent.homePager(); |
1409 | 1411 | ||
1410 | if ( *it == "AIM IM" ) | 1412 | if ( *it == "AIM IM" ) |
1411 | *itV = ent.AIMIM(); | 1413 | *itV = ent.AIMIM(); |
1412 | 1414 | ||
1413 | if ( *it == "ICQ IM" ) | 1415 | if ( *it == "ICQ IM" ) |
1414 | *itV = ent.ICQIM(); | 1416 | *itV = ent.ICQIM(); |
1415 | 1417 | ||
1416 | if ( *it == "Jabber IM" ) | 1418 | if ( *it == "Jabber IM" ) |
1417 | *itV = ent.jabberIM(); | 1419 | *itV = ent.jabberIM(); |
1418 | 1420 | ||
1419 | if ( *it == "MSN IM" ) | 1421 | if ( *it == "MSN IM" ) |
1420 | *itV = ent.MSNIM(); | 1422 | *itV = ent.MSNIM(); |
1421 | 1423 | ||
1422 | if ( *it == "Yahoo IM" ) | 1424 | if ( *it == "Yahoo IM" ) |
1423 | *itV = ent.yahooIM(); | 1425 | *itV = ent.yahooIM(); |
1424 | */ | 1426 | */ |
1425 | if ( *it == "Home Web Page" ) | 1427 | if ( *it == "Home Web Page" ) |
1426 | *itV = ent.homeWebpage(); | 1428 | *itV = ent.homeWebpage(); |
1427 | 1429 | ||
1428 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1430 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1429 | *itV = ent.businessWebpage(); | 1431 | *itV = ent.businessWebpage(); |
1430 | 1432 | ||
1431 | 1433 | ||
1432 | } | 1434 | } |
1433 | 1435 | ||
1434 | 1436 | ||
1435 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1437 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1436 | 1438 | ||
1437 | QString gender = ent.gender(); | 1439 | QString gender = ent.gender(); |
1438 | cmbGender->setCurrentItem( gender.toInt() ); | 1440 | cmbGender->setCurrentItem( gender.toInt() ); |
1439 | 1441 | ||
1440 | txtNote->setText( ent.notes() ); | 1442 | txtNote->setText( ent.notes() ); |
1441 | 1443 | ||
1442 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1444 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1443 | 1445 | ||
1444 | // Get combo-settings from contact and set preset.. | 1446 | // Get combo-settings from contact and set preset.. |
1445 | contactfields.loadFromRecord( ent ); | 1447 | contactfields.loadFromRecord( ent ); |
1446 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1448 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1447 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1449 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1448 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1450 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1449 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1451 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1450 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1452 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1451 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1453 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1452 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1454 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1453 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1455 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1454 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1456 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1455 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1457 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1456 | 1458 | ||
1457 | updateDatePicker(); | 1459 | updateDatePicker(); |
1458 | 1460 | ||
1459 | initializing = false; | 1461 | initializing = false; |
1460 | } | 1462 | } |
1461 | void ContactEditor::updateDatePicker() | 1463 | void ContactEditor::updateDatePicker() |
1462 | { | 1464 | { |
1463 | // Set DatePicker | 1465 | // Set DatePicker |
1464 | if ( !ent.birthday().isNull() ){ | 1466 | if ( !ent.birthday().isNull() ){ |
1465 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1467 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1466 | birthdayPicker->setDate( ent.birthday() ); | 1468 | birthdayPicker->setDate( ent.birthday() ); |
1467 | } else | 1469 | } else |
1468 | birthdayButton->setText( tr ("Unknown") ); | 1470 | birthdayButton->setText( tr ("Unknown") ); |
1469 | 1471 | ||
1470 | if ( !ent.anniversary().isNull() ){ | 1472 | if ( !ent.anniversary().isNull() ){ |
1471 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1473 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1472 | anniversaryPicker->setDate( ent.anniversary() ); | 1474 | anniversaryPicker->setDate( ent.anniversary() ); |
1473 | } else | 1475 | } else |
1474 | anniversaryButton->setText( tr ("Unknown") ); | 1476 | anniversaryButton->setText( tr ("Unknown") ); |
1475 | 1477 | ||
1476 | } | 1478 | } |
1477 | 1479 | ||
1478 | void ContactEditor::saveEntry() { | 1480 | void ContactEditor::saveEntry() { |
1479 | 1481 | ||
1480 | // Store current combo into contact | 1482 | // Store current combo into contact |
1481 | contactfields.saveToRecord( ent ); | 1483 | contactfields.saveToRecord( ent ); |
1482 | 1484 | ||
1483 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1485 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1484 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1486 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1485 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1487 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1486 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1488 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1487 | 1489 | ||
1488 | ent.setFirstName( txtFirstName->text() ); | 1490 | ent.setFirstName( txtFirstName->text() ); |
1489 | ent.setLastName( txtLastName->text() ); | 1491 | ent.setLastName( txtLastName->text() ); |
1490 | ent.setMiddleName( txtMiddleName->text() ); | 1492 | ent.setMiddleName( txtMiddleName->text() ); |
1491 | ent.setSuffix( txtSuffix->text() ); | 1493 | ent.setSuffix( txtSuffix->text() ); |
1492 | 1494 | ||
1493 | ent.setFileAs( cmbFileAs->currentText() ); | 1495 | ent.setFileAs( cmbFileAs->currentText() ); |
1494 | 1496 | ||
1495 | ent.setCategories( cmbCat->currentCategories() ); | 1497 | ent.setCategories( cmbCat->currentCategories() ); |
1496 | 1498 | ||
1497 | 1499 | ||
1498 | //if (hasTitle) | 1500 | //if (hasTitle) |
1499 | ent.setJobTitle( txtJobTitle->text() ); | 1501 | ent.setJobTitle( txtJobTitle->text() ); |
1500 | 1502 | ||
1501 | //if (hasCompany) | 1503 | //if (hasCompany) |
1502 | ent.setCompany( txtOrganization->text() ); | 1504 | ent.setCompany( txtOrganization->text() ); |
1503 | 1505 | ||
1504 | //if (hasNotes) | 1506 | //if (hasNotes) |
1505 | ent.setNotes( txtNote->text() ); | 1507 | ent.setNotes( txtNote->text() ); |
1506 | 1508 | ||
1507 | //if (hasStreet) { | 1509 | //if (hasStreet) { |
1508 | ent.setHomeStreet( slHomeAddress[0] ); | 1510 | ent.setHomeStreet( slHomeAddress[0] ); |
1509 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1511 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1510 | //} | 1512 | //} |
1511 | 1513 | ||
1512 | //if (hasCity) { | 1514 | //if (hasCity) { |
1513 | ent.setHomeCity( slHomeAddress[3] ); | 1515 | ent.setHomeCity( slHomeAddress[3] ); |
1514 | ent.setBusinessCity( slBusinessAddress[3] ); | 1516 | ent.setBusinessCity( slBusinessAddress[3] ); |
1515 | //} | 1517 | //} |
1516 | 1518 | ||
1517 | //if (hasState) { | 1519 | //if (hasState) { |
1518 | ent.setHomeState( slHomeAddress[4] ); | 1520 | ent.setHomeState( slHomeAddress[4] ); |
1519 | ent.setBusinessState( slBusinessAddress[4] ); | 1521 | ent.setBusinessState( slBusinessAddress[4] ); |
1520 | //} | 1522 | //} |
1521 | 1523 | ||
1522 | //if (hasZip) { | 1524 | //if (hasZip) { |
1523 | ent.setHomeZip( slHomeAddress[5] ); | 1525 | ent.setHomeZip( slHomeAddress[5] ); |
1524 | ent.setBusinessZip( slBusinessAddress[5] ); | 1526 | ent.setBusinessZip( slBusinessAddress[5] ); |
1525 | //} | 1527 | //} |
1526 | 1528 | ||
1527 | //if (hasCountry) { | 1529 | //if (hasCountry) { |
1528 | ent.setHomeCountry( slHomeAddress[6] ); | 1530 | ent.setHomeCountry( slHomeAddress[6] ); |
1529 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1531 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1530 | //} | 1532 | //} |
1531 | 1533 | ||
1532 | QStringList::ConstIterator it; | 1534 | QStringList::ConstIterator it; |
1533 | QListIterator<QLineEdit> itLE( listValue ); | 1535 | QListIterator<QLineEdit> itLE( listValue ); |
1534 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1536 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1535 | 1537 | ||
1536 | if ( *it == "Department" ) | 1538 | if ( *it == "Department" ) |
1537 | ent.setDepartment( (*itLE)->text() ); | 1539 | ent.setDepartment( (*itLE)->text() ); |
1538 | 1540 | ||
1539 | if ( *it == "Company" ) | 1541 | if ( *it == "Company" ) |
1540 | ent.setCompany( (*itLE)->text() ); | 1542 | ent.setCompany( (*itLE)->text() ); |
1541 | 1543 | ||
1542 | if ( *it == "Office" ) | 1544 | if ( *it == "Office" ) |
1543 | ent.setOffice( (*itLE)->text() ); | 1545 | ent.setOffice( (*itLE)->text() ); |
1544 | 1546 | ||
1545 | if ( *it == "Profession" ) | 1547 | if ( *it == "Profession" ) |
1546 | ent.setProfession( (*itLE)->text() ); | 1548 | ent.setProfession( (*itLE)->text() ); |
1547 | 1549 | ||
1548 | if ( *it == "Assistant" ) | 1550 | if ( *it == "Assistant" ) |
1549 | ent.setAssistant( (*itLE)->text() ); | 1551 | ent.setAssistant( (*itLE)->text() ); |
1550 | 1552 | ||
1551 | if ( *it == "Manager" ) | 1553 | if ( *it == "Manager" ) |
1552 | ent.setManager( (*itLE)->text() ); | 1554 | ent.setManager( (*itLE)->text() ); |
1553 | 1555 | ||
1554 | if ( *it == "Spouse" ) | 1556 | if ( *it == "Spouse" ) |
1555 | ent.setSpouse( (*itLE)->text() ); | 1557 | ent.setSpouse( (*itLE)->text() ); |
1556 | 1558 | ||
1557 | if ( *it == "Nickname" ) | 1559 | if ( *it == "Nickname" ) |
1558 | ent.setNickname( (*itLE)->text() ); | 1560 | ent.setNickname( (*itLE)->text() ); |
1559 | 1561 | ||
1560 | if ( *it == "Children" ) | 1562 | if ( *it == "Children" ) |
1561 | ent.setChildren( (*itLE)->text() ); | 1563 | ent.setChildren( (*itLE)->text() ); |
1562 | 1564 | ||
1563 | } | 1565 | } |
1564 | 1566 | ||
1565 | 1567 | ||
1566 | QStringList::ConstIterator itV; | 1568 | QStringList::ConstIterator itV; |
1567 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1569 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1568 | 1570 | ||
1569 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1571 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1570 | ent.setBusinessPhone( *itV ); | 1572 | ent.setBusinessPhone( *itV ); |
1571 | 1573 | ||
1572 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1574 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1573 | ent.setBusinessFax( *itV ); | 1575 | ent.setBusinessFax( *itV ); |
1574 | 1576 | ||
1575 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1577 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1576 | ent.setBusinessMobile( *itV ); | 1578 | ent.setBusinessMobile( *itV ); |
1577 | 1579 | ||
1578 | if ( *it == "Emails" ){ | 1580 | if ( *it == "Emails" ){ |
1579 | QString allemail; | 1581 | QString allemail; |
1580 | QString defaultmail; | 1582 | QString defaultmail; |
1581 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1583 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1582 | if ( defaultEmail.isEmpty() ){ | 1584 | if ( defaultEmail.isEmpty() ){ |
1583 | qWarning("Default email was not set by user!"); | 1585 | qWarning("Default email was not set by user!"); |
1584 | qWarning("Using first email in list: %s", defaultmail.latin1()); | 1586 | qWarning("Using first email in list: %s", defaultmail.latin1()); |
1585 | ent.setDefaultEmail( defaultmail ); | 1587 | ent.setDefaultEmail( defaultmail ); |
1586 | } | 1588 | } |
1587 | ent.setEmails( allemail ); | 1589 | ent.setEmails( allemail ); |
1588 | } | 1590 | } |
1589 | 1591 | ||
1590 | if ( *it == "Default Email") | 1592 | if ( *it == "Default Email") |
1591 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1593 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1592 | 1594 | ||
1593 | if ( *it == "Home Phone" ) | 1595 | if ( *it == "Home Phone" ) |
1594 | ent.setHomePhone( *itV ); | 1596 | ent.setHomePhone( *itV ); |
1595 | 1597 | ||
1596 | if ( *it == "Home Fax" ) | 1598 | if ( *it == "Home Fax" ) |
1597 | ent.setHomeFax( *itV ); | 1599 | ent.setHomeFax( *itV ); |
1598 | 1600 | ||
1599 | if ( *it == "Home Mobile" ) | 1601 | if ( *it == "Home Mobile" ) |
1600 | ent.setHomeMobile( *itV ); | 1602 | ent.setHomeMobile( *itV ); |
1601 | 1603 | ||
1602 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1604 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1603 | ent.setBusinessPager( *itV ); | 1605 | ent.setBusinessPager( *itV ); |
1604 | 1606 | ||
1605 | if ( *it == "Home Web Page" ) | 1607 | if ( *it == "Home Web Page" ) |
1606 | ent.setHomeWebpage( *itV ); | 1608 | ent.setHomeWebpage( *itV ); |
1607 | 1609 | ||
1608 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1610 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1609 | ent.setBusinessWebpage( *itV ); | 1611 | ent.setBusinessWebpage( *itV ); |
1610 | 1612 | ||
1611 | 1613 | ||
1612 | } | 1614 | } |
1613 | 1615 | ||
1614 | int gender = cmbGender->currentItem(); | 1616 | int gender = cmbGender->currentItem(); |
1615 | ent.setGender( QString::number( gender ) ); | 1617 | ent.setGender( QString::number( gender ) ); |
1616 | 1618 | ||
1617 | QString str = txtNote->text(); | 1619 | QString str = txtNote->text(); |
1618 | if ( !str.isNull() ) | 1620 | if ( !str.isNull() ) |
1619 | ent.setNotes( str ); | 1621 | ent.setNotes( str ); |
1620 | 1622 | ||
1621 | } | 1623 | } |
1622 | 1624 | ||
1623 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1625 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1624 | QString &strAll ) | 1626 | QString &strAll ) |
1625 | { | 1627 | { |
1626 | int where, | 1628 | int where, |
1627 | start; | 1629 | start; |
1628 | if ( txt.isEmpty() ) | 1630 | if ( txt.isEmpty() ) |
1629 | return; | 1631 | return; |
1630 | // find the first | 1632 | // find the first |
1631 | where = txt.find( ',' ); | 1633 | where = txt.find( ',' ); |
1632 | if ( where < 0 ) { | 1634 | if ( where < 0 ) { |
1633 | strDefaultEmail = txt; | 1635 | strDefaultEmail = txt; |
1634 | strAll = txt; | 1636 | strAll = txt; |
1635 | } else { | 1637 | } else { |
1636 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1638 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1637 | strAll = strDefaultEmail; | 1639 | strAll = strDefaultEmail; |
1638 | while ( where > -1 ) { | 1640 | while ( where > -1 ) { |
1639 | strAll.append(" "); | 1641 | strAll.append(" "); |
1640 | start = where; | 1642 | start = where; |
1641 | where = txt.find( ',', where + 1 ); | 1643 | where = txt.find( ',', where + 1 ); |
1642 | if ( where > - 1 ) | 1644 | if ( where > - 1 ) |
1643 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1645 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1644 | else // grab until the end... | 1646 | else // grab until the end... |
1645 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1647 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1646 | } | 1648 | } |
1647 | } | 1649 | } |
1648 | } | 1650 | } |
1649 | 1651 | ||
1650 | void parseEmailTo( const QString &strDefaultEmail, | 1652 | void parseEmailTo( const QString &strDefaultEmail, |
1651 | const QString &strOtherEmail, QString &strBack ) | 1653 | const QString &strOtherEmail, QString &strBack ) |
1652 | { | 1654 | { |
1653 | // create a comma dilimeted set of emails... | 1655 | // create a comma dilimeted set of emails... |
1654 | // use the power of short circuiting... | 1656 | // use the power of short circuiting... |
1655 | bool foundDefault = false; | 1657 | bool foundDefault = false; |
1656 | QString strTmp; | 1658 | QString strTmp; |
1657 | int start = 0; | 1659 | int start = 0; |
1658 | int where; | 1660 | int where; |
1659 | // start at the beginng. | 1661 | // start at the beginng. |
1660 | strBack = strDefaultEmail; | 1662 | strBack = strDefaultEmail; |
1661 | where = 0; | 1663 | where = 0; |
1662 | while ( where > -1 ) { | 1664 | while ( where > -1 ) { |
1663 | start = where; | 1665 | start = where; |
1664 | where = strOtherEmail.find( ' ', where + 1 ); | 1666 | where = strOtherEmail.find( ' ', where + 1 ); |
1665 | if ( where > 0 ) { | 1667 | if ( where > 0 ) { |
1666 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1668 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1667 | } else | 1669 | } else |
1668 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1670 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1669 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1671 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1670 | strBack.append( ", " ); | 1672 | strBack.append( ", " ); |
1671 | strBack.append( strTmp ); | 1673 | strBack.append( strTmp ); |
1672 | } else | 1674 | } else |
1673 | foundDefault = true; | 1675 | foundDefault = true; |
1674 | } | 1676 | } |
1675 | } | 1677 | } |
1676 | 1678 | ||
1677 | 1679 | ||
1678 | static inline bool containsAlphaNum( const QString &str ) | 1680 | static inline bool containsAlphaNum( const QString &str ) |
1679 | { | 1681 | { |
1680 | int i, | 1682 | int i, |
1681 | count = str.length(); | 1683 | count = str.length(); |
1682 | for ( i = 0; i < count; i++ ) | 1684 | for ( i = 0; i < count; i++ ) |
1683 | if ( !str[i].isSpace() ) | 1685 | if ( !str[i].isSpace() ) |
1684 | return TRUE; | 1686 | return TRUE; |
1685 | return FALSE; | 1687 | return FALSE; |
1686 | } | 1688 | } |
1687 | 1689 | ||
1688 | static inline bool constainsWhiteSpace( const QString &str ) | 1690 | static inline bool constainsWhiteSpace( const QString &str ) |
1689 | { | 1691 | { |
1690 | int i, | 1692 | int i, |
1691 | count = str.length(); | 1693 | count = str.length(); |
1692 | for (i = 0; i < count; i++ ) | 1694 | for (i = 0; i < count; i++ ) |
1693 | if ( str[i].isSpace() ) | 1695 | if ( str[i].isSpace() ) |
1694 | return TRUE; | 1696 | return TRUE; |
1695 | return FALSE; | 1697 | return FALSE; |
1696 | } | 1698 | } |
1697 | 1699 | ||
1698 | void ContactEditor::setPersonalView( bool personal ) | 1700 | void ContactEditor::setPersonalView( bool personal ) |
1699 | { | 1701 | { |
1700 | m_personalView = personal; | 1702 | m_personalView = personal; |
1701 | 1703 | ||
1702 | // Currently disbled due to the fact that | 1704 | // Currently disbled due to the fact that |
1703 | // show will not work... | 1705 | // show will not work... |
1704 | return; | 1706 | return; |
1705 | 1707 | ||
1706 | if ( personal ){ | 1708 | if ( personal ){ |
1707 | cmbCat->hide(); | 1709 | cmbCat->hide(); |
1708 | labCat->hide(); | 1710 | labCat->hide(); |
1709 | 1711 | ||
1710 | } else{ | 1712 | } else{ |
1711 | cmbCat->show(); | 1713 | cmbCat->show(); |
1712 | labCat->show(); | 1714 | labCat->show(); |
1713 | } | 1715 | } |
1714 | } | 1716 | } |
1715 | 1717 | ||
1716 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1718 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1717 | { | 1719 | { |
1718 | QDate date; | 1720 | QDate date; |
1719 | date.setYMD( year, month, day ); | 1721 | date.setYMD( year, month, day ); |
1720 | QString dateString = TimeString::numberDateString( date ); | 1722 | QString dateString = TimeString::numberDateString( date ); |
1721 | anniversaryButton->setText( dateString ); | 1723 | anniversaryButton->setText( dateString ); |
1722 | ent.setAnniversary ( date ); | 1724 | ent.setAnniversary ( date ); |
1723 | } | 1725 | } |
1724 | 1726 | ||
1725 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1727 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1726 | { | 1728 | { |
1727 | QDate date; | 1729 | QDate date; |
1728 | date.setYMD( year, month, day ); | 1730 | date.setYMD( year, month, day ); |
1729 | QString dateString = TimeString::numberDateString( date ); | 1731 | QString dateString = TimeString::numberDateString( date ); |
1730 | birthdayButton->setText( dateString ); | 1732 | birthdayButton->setText( dateString ); |
1731 | ent.setBirthday ( date ); | 1733 | ent.setBirthday ( date ); |
1732 | } | 1734 | } |
1733 | 1735 | ||
1734 | void ContactEditor::slotRemoveBirthday() | 1736 | void ContactEditor::slotRemoveBirthday() |
1735 | { | 1737 | { |
1736 | qWarning("void ContactEditor::slotRemoveBirthday()"); | 1738 | qWarning("void ContactEditor::slotRemoveBirthday()"); |
1737 | ent.setBirthday( QDate() ); | 1739 | ent.setBirthday( QDate() ); |
1738 | updateDatePicker(); | 1740 | updateDatePicker(); |
1739 | } | 1741 | } |
1740 | 1742 | ||
1741 | void ContactEditor::slotRemoveAnniversary() | 1743 | void ContactEditor::slotRemoveAnniversary() |
1742 | { | 1744 | { |
1743 | qWarning("void ContactEditor::slotRemoveAnniversary()"); | 1745 | qWarning("void ContactEditor::slotRemoveAnniversary()"); |
1744 | ent.setAnniversary( QDate() ); | 1746 | ent.setAnniversary( QDate() ); |
1745 | updateDatePicker(); | 1747 | updateDatePicker(); |
1746 | } | 1748 | } |
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index d590a86..c0465b5 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h | |||
@@ -1,10 +1,10 @@ | |||
1 | #ifndef _VERSION_H_ | 1 | #ifndef _VERSION_H_ |
2 | #define _VERSION_H_ | 2 | #define _VERSION_H_ |
3 | 3 | ||
4 | #define MAINVERSION "0" | 4 | #define MAINVERSION "0" |
5 | #define SUBVERSION "9" | 5 | #define SUBVERSION "9" |
6 | #define PATCHVERSION "3" | 6 | #define PATCHVERSION "4" |
7 | 7 | ||
8 | #define APPNAME "OPIE_ADDRESSBOOK" | 8 | #define APPNAME "OPIE_ADDRESSBOOK" |
9 | 9 | ||
10 | #endif | 10 | #endif |