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,1012 +1,1042 @@ | |||
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 |
846 | return FALSE; | 876 | return FALSE; |
847 | } | 877 | } |
848 | return TRUE; | 878 | return TRUE; |
849 | } | 879 | } |
850 | 880 | ||
851 | #ifdef __DEBUG_RELEASE | 881 | #ifdef __DEBUG_RELEASE |
852 | void AddressbookWindow::slotSave() | 882 | void AddressbookWindow::slotSave() |
853 | { | 883 | { |
854 | save(); | 884 | save(); |
855 | } | 885 | } |
856 | #endif | 886 | #endif |
857 | 887 | ||
858 | 888 | ||
859 | void AddressbookWindow::slotNotFound() | 889 | void AddressbookWindow::slotNotFound() |
860 | { | 890 | { |
861 | qWarning("Got notfound signal!"); | 891 | qWarning("Got notfound signal!"); |
862 | QMessageBox::information( this, tr( "Not Found" ), | 892 | QMessageBox::information( this, tr( "Not Found" ), |
863 | tr( "Unable to find a contact for this \n search pattern!" ) ); | 893 | tr( "Unable to find a contact for this \n search pattern!" ) ); |
864 | 894 | ||
865 | 895 | ||
866 | } | 896 | } |
867 | void AddressbookWindow::slotWrapAround() | 897 | void AddressbookWindow::slotWrapAround() |
868 | { | 898 | { |
869 | qWarning("Got wrap signal!"); | 899 | qWarning("Got wrap signal!"); |
870 | // if ( doNotifyWrapAround ) | 900 | // if ( doNotifyWrapAround ) |
871 | // QMessageBox::information( this, tr( "End of list" ), | 901 | // QMessageBox::information( this, tr( "End of list" ), |
872 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 902 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
873 | 903 | ||
874 | } | 904 | } |
875 | 905 | ||
876 | void AddressbookWindow::slotSetCategory( int c ) | 906 | void AddressbookWindow::slotSetCategory( int c ) |
877 | { | 907 | { |
878 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); | 908 | qWarning( "void AddressbookWindow::slotSetCategory( %d ) from %d", c, catMenu->count() ); |
879 | 909 | ||
880 | QString cat, book; | 910 | QString cat, book; |
881 | AbView::Views view = AbView::TableView; | 911 | AbView::Views view = AbView::TableView; |
882 | 912 | ||
883 | if ( c <= 0 ) | 913 | if ( c <= 0 ) |
884 | return; | 914 | return; |
885 | 915 | ||
886 | // Switch view | 916 | // Switch view |
887 | if ( c < 3 ) | 917 | if ( c < 3 ) |
888 | for ( unsigned int i = 1; i < 3; i++ ){ | 918 | for ( unsigned int i = 1; i < 3; i++ ){ |
889 | if ( catMenu ) | 919 | if ( catMenu ) |
890 | catMenu->setItemChecked( i, c == (int)i ); | 920 | catMenu->setItemChecked( i, c == (int)i ); |
891 | } | 921 | } |
892 | else | 922 | else |
893 | // Checkmark Category Menu Item Selected | 923 | // Checkmark Category Menu Item Selected |
894 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 924 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
895 | catMenu->setItemChecked( i, c == (int)i ); | 925 | catMenu->setItemChecked( i, c == (int)i ); |
896 | 926 | ||
897 | // Now switch to the selected category | 927 | // Now switch to the selected category |
898 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 928 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
899 | if (catMenu->isItemChecked( i )) { | 929 | if (catMenu->isItemChecked( i )) { |
900 | if ( i == 1 ){ // default List view | 930 | if ( i == 1 ){ // default List view |
901 | book = QString::null; | 931 | book = QString::null; |
902 | view = AbView::TableView; | 932 | view = AbView::TableView; |
903 | }else if ( i == 2 ){ | 933 | }else if ( i == 2 ){ |
904 | book = tr( "Cards" ); | 934 | book = tr( "Cards" ); |
905 | view = AbView::CardView; | 935 | view = AbView::CardView; |
906 | // }else if ( i == 3 ){ | 936 | // }else if ( i == 3 ){ |
907 | // book = tr( "Personal" ); | 937 | // book = tr( "Personal" ); |
908 | // view = AbView:: PersonalView; | 938 | // view = AbView:: PersonalView; |
909 | }else if ( i == 3 ){ // default All Categories | 939 | }else if ( i == 3 ){ // default All Categories |
910 | cat = QString::null; | 940 | cat = QString::null; |
911 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 941 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
912 | cat = "Unfiled"; | 942 | cat = "Unfiled"; |
913 | qWarning ("Unfiled selected!!!"); | 943 | qWarning ("Unfiled selected!!!"); |
914 | }else{ | 944 | }else{ |
915 | cat = m_abView->categories()[i - 4]; | 945 | cat = m_abView->categories()[i - 4]; |
916 | } | 946 | } |
917 | } | 947 | } |
918 | } | 948 | } |
919 | 949 | ||
920 | // Switch to the selected View | 950 | // Switch to the selected View |
921 | slotViewSwitched( view ); | 951 | slotViewSwitched( view ); |
922 | 952 | ||
923 | // Tell the view about the selected category | 953 | // Tell the view about the selected category |
924 | m_abView -> setShowByCategory( cat ); | 954 | m_abView -> setShowByCategory( cat ); |
925 | 955 | ||
926 | if ( book.isEmpty() ) | 956 | if ( book.isEmpty() ) |
927 | book = "List"; | 957 | book = "List"; |
928 | if ( cat.isEmpty() ) | 958 | if ( cat.isEmpty() ) |
929 | cat = "All"; | 959 | cat = "All"; |
930 | 960 | ||
931 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 961 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
932 | } | 962 | } |
933 | 963 | ||
934 | void AddressbookWindow::slotViewSwitched( int view ) | 964 | void AddressbookWindow::slotViewSwitched( int view ) |
935 | { | 965 | { |
936 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); | 966 | qWarning( "void AddressbookWindow::slotViewSwitched( %d )", view ); |
937 | int menu = 0; | 967 | int menu = 0; |
938 | 968 | ||
939 | // Switch to selected view | 969 | // Switch to selected view |
940 | switch ( view ){ | 970 | switch ( view ){ |
941 | case AbView::TableView: | 971 | case AbView::TableView: |
942 | menu = 1; | 972 | menu = 1; |
943 | m_tableViewButton->setOn(true); | 973 | m_tableViewButton->setOn(true); |
944 | m_cardViewButton->setOn(false); | 974 | m_cardViewButton->setOn(false); |
945 | break; | 975 | break; |
946 | case AbView::CardView: | 976 | case AbView::CardView: |
947 | menu = 2; | 977 | menu = 2; |
948 | m_tableViewButton->setOn(false); | 978 | m_tableViewButton->setOn(false); |
949 | m_cardViewButton->setOn(true); | 979 | m_cardViewButton->setOn(true); |
950 | break; | 980 | break; |
951 | } | 981 | } |
952 | for ( unsigned int i = 1; i < 3; i++ ){ | 982 | for ( unsigned int i = 1; i < 3; i++ ){ |
953 | if ( catMenu ) | 983 | if ( catMenu ) |
954 | catMenu->setItemChecked( i, menu == (int)i ); | 984 | catMenu->setItemChecked( i, menu == (int)i ); |
955 | } | 985 | } |
956 | 986 | ||
957 | // Tell the view about the selected view | 987 | // Tell the view about the selected view |
958 | m_abView -> setShowToView ( (AbView::Views) view ); | 988 | m_abView -> setShowToView ( (AbView::Views) view ); |
959 | active_view = view; | 989 | active_view = view; |
960 | } | 990 | } |
961 | 991 | ||
962 | 992 | ||
963 | void AddressbookWindow::slotListView() | 993 | void AddressbookWindow::slotListView() |
964 | { | 994 | { |
965 | slotViewSwitched( AbView::TableView ); | 995 | slotViewSwitched( AbView::TableView ); |
966 | } | 996 | } |
967 | 997 | ||
968 | void AddressbookWindow::slotCardView() | 998 | void AddressbookWindow::slotCardView() |
969 | { | 999 | { |
970 | slotViewSwitched( AbView::CardView ); | 1000 | slotViewSwitched( AbView::CardView ); |
971 | } | 1001 | } |
972 | 1002 | ||
973 | void AddressbookWindow::slotSetLetter( char c ) { | 1003 | void AddressbookWindow::slotSetLetter( char c ) { |
974 | 1004 | ||
975 | m_abView->setShowByLetter( c ); | 1005 | m_abView->setShowByLetter( c ); |
976 | 1006 | ||
977 | } | 1007 | } |
978 | 1008 | ||
979 | 1009 | ||
980 | void AddressbookWindow::populateCategories() | 1010 | void AddressbookWindow::populateCategories() |
981 | { | 1011 | { |
982 | catMenu->clear(); | 1012 | catMenu->clear(); |
983 | 1013 | ||
984 | int id, rememberId; | 1014 | int id, rememberId; |
985 | id = 1; | 1015 | id = 1; |
986 | rememberId = 0; | 1016 | rememberId = 0; |
987 | 1017 | ||
988 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); | 1018 | catMenu->insertItem( Resource::loadPixmap( "datebook/weeklst" ), tr( "List" ), id++ ); |
989 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); | 1019 | catMenu->insertItem( Resource::loadPixmap( "day" ), tr( "Cards" ), id++ ); |
990 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 1020 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
991 | catMenu->insertSeparator(); | 1021 | catMenu->insertSeparator(); |
992 | 1022 | ||
993 | catMenu->insertItem( tr( "All" ), id++ ); | 1023 | catMenu->insertItem( tr( "All" ), id++ ); |
994 | QStringList categories = m_abView->categories(); | 1024 | QStringList categories = m_abView->categories(); |
995 | categories.append( tr( "Unfiled" ) ); | 1025 | categories.append( tr( "Unfiled" ) ); |
996 | for ( QStringList::Iterator it = categories.begin(); | 1026 | for ( QStringList::Iterator it = categories.begin(); |
997 | it != categories.end(); ++it ) { | 1027 | it != categories.end(); ++it ) { |
998 | catMenu->insertItem( *it, id ); | 1028 | catMenu->insertItem( *it, id ); |
999 | if ( *it == m_abView -> showCategory() ) | 1029 | if ( *it == m_abView -> showCategory() ) |
1000 | rememberId = id; | 1030 | rememberId = id; |
1001 | ++id; | 1031 | ++id; |
1002 | } | 1032 | } |
1003 | 1033 | ||
1004 | 1034 | ||
1005 | if ( m_abView -> showCategory().isEmpty() ) { | 1035 | if ( m_abView -> showCategory().isEmpty() ) { |
1006 | slotSetCategory( 3 ); | 1036 | slotSetCategory( 3 ); |
1007 | } | 1037 | } |
1008 | else { | 1038 | else { |
1009 | slotSetCategory( rememberId ); | 1039 | slotSetCategory( rememberId ); |
1010 | } | 1040 | } |
1011 | } | 1041 | } |
1012 | 1042 | ||
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 | |||
@@ -1,1746 +1,1748 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "addresspicker.h" | 23 | #include "addresspicker.h" |
24 | #include "ocontactfields.h" | 24 | #include "ocontactfields.h" |
25 | 25 | ||
26 | #include <qpe/categoryselect.h> | 26 | #include <qpe/categoryselect.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qpedialog.h> | 28 | #include <qpe/qpedialog.h> |
29 | #include <qpe/timeconversion.h> | 29 | #include <qpe/timeconversion.h> |
30 | #include <opie/ocontact.h> | 30 | #include <opie/ocontact.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qmultilineedit.h> | 38 | #include <qmultilineedit.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
40 | #include <qtoolbutton.h> | 40 | #include <qtoolbutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | #include <qvaluelist.h> | 43 | #include <qvaluelist.h> |
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qlistbox.h> | 45 | #include <qlistbox.h> |
46 | #include <qhbox.h> | 46 | #include <qhbox.h> |
47 | #include <qaction.h> | 47 | #include <qaction.h> |
48 | #include <qiconset.h> | 48 | #include <qiconset.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | #include <qwhatsthis.h> | 50 | #include <qwhatsthis.h> |
51 | 51 | ||
52 | #include <assert.h> | 52 | #include <assert.h> |
53 | 53 | ||
54 | static inline bool containsAlphaNum( const QString &str ); | 54 | static inline bool containsAlphaNum( const QString &str ); |
55 | static inline bool constainsWhiteSpace( const QString &str ); | 55 | static inline bool constainsWhiteSpace( const QString &str ); |
56 | 56 | ||
57 | // helper functions, convert our comma delimited list to proper | 57 | // helper functions, convert our comma delimited list to proper |
58 | // file format... | 58 | // file format... |
59 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 59 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
60 | QString &strAll ); | 60 | QString &strAll ); |
61 | 61 | ||
62 | // helper convert from file format to comma delimited... | 62 | // helper convert from file format to comma delimited... |
63 | void parseEmailTo( const QString &strDefaultEmail, | 63 | void parseEmailTo( const QString &strDefaultEmail, |
64 | const QString &strOtherEmail, QString &strBack ); | 64 | const QString &strOtherEmail, QString &strBack ); |
65 | 65 | ||
66 | ContactEditor::ContactEditor(const OContact &entry, | 66 | ContactEditor::ContactEditor(const OContact &entry, |
67 | QWidget *parent, | 67 | QWidget *parent, |
68 | const char *name, | 68 | const char *name, |
69 | WFlags ) | 69 | WFlags ) |
70 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 70 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
71 | defaultEmailChooserPosition( -1 ), | 71 | defaultEmailChooserPosition( -1 ), |
72 | m_personalView ( false ), | 72 | m_personalView ( false ), |
73 | cmbDefaultEmail( 0 ), | 73 | cmbDefaultEmail( 0 ), |
74 | initializing ( false ) | 74 | initializing ( false ) |
75 | { | 75 | { |
76 | 76 | ||
77 | initializing = true; | 77 | initializing = true; |
78 | 78 | ||
79 | init(); | 79 | init(); |
80 | setEntry( entry ); | 80 | setEntry( entry ); |
81 | // cmbDefaultEmail = 0; | 81 | // cmbDefaultEmail = 0; |
82 | // defaultEmailChooserPosition = -1; | 82 | // defaultEmailChooserPosition = -1; |
83 | 83 | ||
84 | initializing = false; | 84 | initializing = false; |
85 | } | 85 | } |
86 | 86 | ||
87 | ContactEditor::~ContactEditor() { | 87 | ContactEditor::~ContactEditor() { |
88 | } | 88 | } |
89 | 89 | ||
90 | void ContactEditor::init() { | 90 | void ContactEditor::init() { |
91 | qWarning("init() START"); | 91 | qWarning("init() START"); |
92 | 92 | ||
93 | uint i = 0; | 93 | uint i = 0; |
94 | 94 | ||
95 | QStringList trlChooserNames; | 95 | QStringList trlChooserNames; |
96 | 96 | ||
97 | for (i = 0; i <= 6; i++) { | 97 | for (i = 0; i <= 6; i++) { |
98 | slHomeAddress.append( "" ); | 98 | slHomeAddress.append( "" ); |
99 | slBusinessAddress.append( "" ); | 99 | slBusinessAddress.append( "" ); |
100 | } | 100 | } |
101 | 101 | ||
102 | trlChooserNames = OContactFields::trphonefields( false ); | 102 | trlChooserNames = OContactFields::trphonefields( false ); |
103 | slChooserNames = OContactFields::untrphonefields( false ); | 103 | slChooserNames = OContactFields::untrphonefields( false ); |
104 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 104 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
105 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 105 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
106 | 106 | ||
107 | // Ok, we have to remove elements from the list of dynamic entries | 107 | // Ok, we have to remove elements from the list of dynamic entries |
108 | // which are now stored in special (not dynamic) widgets.. | 108 | // which are now stored in special (not dynamic) widgets.. |
109 | // Otherwise we will get problems with field assignments! (se) | 109 | // Otherwise we will get problems with field assignments! (se) |
110 | slDynamicEntries.remove("Anniversary"); | 110 | slDynamicEntries.remove("Anniversary"); |
111 | slDynamicEntries.remove("Birthday"); | 111 | slDynamicEntries.remove("Birthday"); |
112 | slDynamicEntries.remove("Gender"); | 112 | slDynamicEntries.remove("Gender"); |
113 | 113 | ||
114 | // The same with translated fields.. But I will | 114 | // The same with translated fields.. But I will |
115 | // use the translation map to avoid mismatches.. | 115 | // use the translation map to avoid mismatches.. |
116 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 116 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
117 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 117 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
119 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 119 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
120 | 120 | ||
121 | // Last Check to be sure.. | 121 | // Last Check to be sure.. |
122 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 122 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
123 | assert( slChooserNames.count() == trlChooserNames.count() ); | 123 | assert( slChooserNames.count() == trlChooserNames.count() ); |
124 | 124 | ||
125 | for (i = 0; i < slChooserNames.count(); i++) | 125 | for (i = 0; i < slChooserNames.count(); i++) |
126 | slChooserValues.append(""); | 126 | slChooserValues.append(""); |
127 | 127 | ||
128 | 128 | ||
129 | QVBoxLayout *vb = new QVBoxLayout( this ); | 129 | QVBoxLayout *vb = new QVBoxLayout( this ); |
130 | 130 | ||
131 | tabMain = new QTabWidget( this ); | 131 | tabMain = new QTabWidget( this ); |
132 | vb->addWidget( tabMain ); | 132 | vb->addWidget( tabMain ); |
133 | 133 | ||
134 | QWidget *tabViewport = new QWidget ( tabMain ); | 134 | QWidget *tabViewport = new QWidget ( tabMain ); |
135 | 135 | ||
136 | vb = new QVBoxLayout( tabViewport ); | 136 | vb = new QVBoxLayout( tabViewport ); |
137 | 137 | ||
138 | svGeneral = new QScrollView( tabViewport ); | 138 | svGeneral = new QScrollView( tabViewport ); |
139 | vb->addWidget( svGeneral, 0, 0 ); | 139 | vb->addWidget( svGeneral, 0, 0 ); |
140 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 140 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
141 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 141 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
142 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 142 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
143 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 143 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
144 | 144 | ||
145 | QWidget *container = new QWidget( svGeneral->viewport() ); | 145 | QWidget *container = new QWidget( svGeneral->viewport() ); |
146 | svGeneral->addChild( container ); | 146 | svGeneral->addChild( container ); |
147 | 147 | ||
148 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 148 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
149 | gl->setResizeMode( QLayout::FreeResize ); | 149 | gl->setResizeMode( QLayout::FreeResize ); |
150 | 150 | ||
151 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 151 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
152 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 152 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
153 | gl->addWidget( btnFullName, 0, 0 ); | 153 | gl->addWidget( btnFullName, 0, 0 ); |
154 | txtFullName = new QLineEdit( container ); | 154 | txtFullName = new QLineEdit( container ); |
155 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 155 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
156 | gl->addWidget( txtFullName, 0, 1 ); | 156 | gl->addWidget( txtFullName, 0, 1 ); |
157 | 157 | ||
158 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 158 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
159 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 159 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
160 | gl->addWidget( l, 1, 0 ); | 160 | gl->addWidget( l, 1, 0 ); |
161 | txtJobTitle = new QLineEdit( container ); | 161 | txtJobTitle = new QLineEdit( container ); |
162 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 162 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
163 | gl->addWidget( txtJobTitle, 1, 1 ); | 163 | gl->addWidget( txtJobTitle, 1, 1 ); |
164 | 164 | ||
165 | l = new QLabel( tr("Suffix"), container ); | 165 | l = new QLabel( tr("Suffix"), container ); |
166 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 166 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
167 | gl->addWidget( l, 2, 0 ); | 167 | gl->addWidget( l, 2, 0 ); |
168 | txtSuffix = new QLineEdit( container ); | 168 | txtSuffix = new QLineEdit( container ); |
169 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 169 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
170 | gl->addWidget( txtSuffix, 2, 1 ); | 170 | gl->addWidget( txtSuffix, 2, 1 ); |
171 | 171 | ||
172 | l = new QLabel( tr( "Organization" ), container ); | 172 | l = new QLabel( tr( "Organization" ), container ); |
173 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 173 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
174 | gl->addWidget( l, 3, 0 ); | 174 | gl->addWidget( l, 3, 0 ); |
175 | txtOrganization = new QLineEdit( container ); | 175 | txtOrganization = new QLineEdit( container ); |
176 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 176 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
177 | gl->addWidget( txtOrganization, 3, 1 ); | 177 | gl->addWidget( txtOrganization, 3, 1 ); |
178 | 178 | ||
179 | // Chooser 1 | 179 | // Chooser 1 |
180 | cmbChooserField1 = new QComboBox( FALSE, container ); | 180 | cmbChooserField1 = new QComboBox( FALSE, container ); |
181 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 181 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
182 | cmbChooserField1->setMaximumWidth( 90 ); | 182 | cmbChooserField1->setMaximumWidth( 90 ); |
183 | gl->addWidget( cmbChooserField1, 4, 0 ); | 183 | gl->addWidget( cmbChooserField1, 4, 0 ); |
184 | // Textfield for chooser 1. | 184 | // Textfield for chooser 1. |
185 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 185 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
186 | m_widgetStack1 = new QWidgetStack( container ); | 186 | m_widgetStack1 = new QWidgetStack( container ); |
187 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 187 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
188 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 188 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
189 | gl->addWidget( m_widgetStack1, 4, 1 ); | 189 | gl->addWidget( m_widgetStack1, 4, 1 ); |
190 | m_widgetStack1 -> raiseWidget( TextField ); | 190 | m_widgetStack1 -> raiseWidget( TextField ); |
191 | 191 | ||
192 | // Chooser 2 | 192 | // Chooser 2 |
193 | cmbChooserField2 = new QComboBox( FALSE, container ); | 193 | cmbChooserField2 = new QComboBox( FALSE, container ); |
194 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 194 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
195 | cmbChooserField2->setMaximumWidth( 90 ); | 195 | cmbChooserField2->setMaximumWidth( 90 ); |
196 | gl->addWidget( cmbChooserField2, 5, 0 ); | 196 | gl->addWidget( cmbChooserField2, 5, 0 ); |
197 | // Textfield for chooser 2 | 197 | // Textfield for chooser 2 |
198 | // Now use WidgetStack to contain the textfield and the default-email combo! | 198 | // Now use WidgetStack to contain the textfield and the default-email combo! |
199 | m_widgetStack2 = new QWidgetStack( container ); | 199 | m_widgetStack2 = new QWidgetStack( container ); |
200 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 200 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
201 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 201 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
202 | gl->addWidget( m_widgetStack2, 5, 1 ); | 202 | gl->addWidget( m_widgetStack2, 5, 1 ); |
203 | m_widgetStack2 -> raiseWidget( TextField ); | 203 | m_widgetStack2 -> raiseWidget( TextField ); |
204 | 204 | ||
205 | // Chooser 3 | 205 | // Chooser 3 |
206 | cmbChooserField3 = new QComboBox( FALSE, container ); | 206 | cmbChooserField3 = new QComboBox( FALSE, container ); |
207 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 207 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
208 | cmbChooserField3->setMaximumWidth( 90 ); | 208 | cmbChooserField3->setMaximumWidth( 90 ); |
209 | gl->addWidget( cmbChooserField3, 6, 0 ); | 209 | gl->addWidget( cmbChooserField3, 6, 0 ); |
210 | // Textfield for chooser 2 | 210 | // Textfield for chooser 2 |
211 | // Now use WidgetStack to contain the textfield and the default-email combo! | 211 | // Now use WidgetStack to contain the textfield and the default-email combo! |
212 | m_widgetStack3 = new QWidgetStack( container ); | 212 | m_widgetStack3 = new QWidgetStack( container ); |
213 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 213 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
214 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 214 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
215 | gl->addWidget( m_widgetStack3, 6, 1 ); | 215 | gl->addWidget( m_widgetStack3, 6, 1 ); |
216 | m_widgetStack3 -> raiseWidget( TextField ); | 216 | m_widgetStack3 -> raiseWidget( TextField ); |
217 | 217 | ||
218 | l = new QLabel( tr( "File As" ), container ); | 218 | l = new QLabel( tr( "File As" ), container ); |
219 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 219 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
220 | gl->addWidget( l, 7, 0 ); | 220 | gl->addWidget( l, 7, 0 ); |
221 | cmbFileAs = new QComboBox( TRUE, container ); | 221 | cmbFileAs = new QComboBox( TRUE, container ); |
222 | gl->addWidget( cmbFileAs, 7, 1 ); | 222 | gl->addWidget( cmbFileAs, 7, 1 ); |
223 | 223 | ||
224 | labCat = new QLabel( tr( "Category" ), container ); | 224 | labCat = new QLabel( tr( "Category" ), container ); |
225 | gl->addWidget( labCat, 8, 0 ); | 225 | gl->addWidget( labCat, 8, 0 ); |
226 | cmbCat = new CategorySelect( container ); | 226 | cmbCat = new CategorySelect( container ); |
227 | gl->addWidget( cmbCat, 8, 1 ); | 227 | gl->addWidget( cmbCat, 8, 1 ); |
228 | labCat->show(); | 228 | labCat->show(); |
229 | cmbCat->show(); | 229 | cmbCat->show(); |
230 | 230 | ||
231 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 231 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
232 | gl->addWidget( btnNote, 9, 1 ); | 232 | gl->addWidget( btnNote, 9, 1 ); |
233 | 233 | ||
234 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 234 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
235 | 235 | ||
236 | tabViewport = new QWidget ( tabMain ); | 236 | tabViewport = new QWidget ( tabMain ); |
237 | 237 | ||
238 | vb = new QVBoxLayout( tabViewport ); | 238 | vb = new QVBoxLayout( tabViewport ); |
239 | 239 | ||
240 | svAddress = new QScrollView( tabViewport ); | 240 | svAddress = new QScrollView( tabViewport ); |
241 | vb->addWidget( svAddress, 0, 0 ); | 241 | vb->addWidget( svAddress, 0, 0 ); |
242 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 242 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
243 | svAddress->setFrameStyle( QFrame::NoFrame ); | 243 | svAddress->setFrameStyle( QFrame::NoFrame ); |
244 | 244 | ||
245 | container = new QWidget( svAddress->viewport() ); | 245 | container = new QWidget( svAddress->viewport() ); |
246 | svAddress->addChild( container ); | 246 | svAddress->addChild( container ); |
247 | 247 | ||
248 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 248 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
249 | 249 | ||
250 | cmbAddress = new QComboBox( FALSE, container ); | 250 | cmbAddress = new QComboBox( FALSE, container ); |
251 | cmbAddress->insertItem( tr( "Business" ) ); | 251 | cmbAddress->insertItem( tr( "Business" ) ); |
252 | cmbAddress->insertItem( tr( "Home" ) ); | 252 | cmbAddress->insertItem( tr( "Home" ) ); |
253 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 253 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
254 | 254 | ||
255 | l = new QLabel( tr( "Address" ), container ); | 255 | l = new QLabel( tr( "Address" ), container ); |
256 | gl->addWidget( l, 1, 0 ); | 256 | gl->addWidget( l, 1, 0 ); |
257 | txtAddress = new QLineEdit( container ); | 257 | txtAddress = new QLineEdit( container ); |
258 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 258 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
259 | 259 | ||
260 | l = new QLabel( tr( "City" ), container ); | 260 | l = new QLabel( tr( "City" ), container ); |
261 | gl->addWidget( l, 2, 0 ); | 261 | gl->addWidget( l, 2, 0 ); |
262 | txtCity = new QLineEdit( container ); | 262 | txtCity = new QLineEdit( container ); |
263 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 263 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
264 | 264 | ||
265 | l = new QLabel( tr( "State" ), container ); | 265 | l = new QLabel( tr( "State" ), container ); |
266 | gl->addWidget( l, 3, 0 ); | 266 | gl->addWidget( l, 3, 0 ); |
267 | txtState = new QLineEdit( container ); | 267 | txtState = new QLineEdit( container ); |
268 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 268 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
269 | 269 | ||
270 | l = new QLabel( tr( "Zip Code" ), container ); | 270 | l = new QLabel( tr( "Zip Code" ), container ); |
271 | gl->addWidget( l, 4, 0 ); | 271 | gl->addWidget( l, 4, 0 ); |
272 | txtZip = new QLineEdit( container ); | 272 | txtZip = new QLineEdit( container ); |
273 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 273 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
274 | 274 | ||
275 | l = new QLabel( tr( "Country" ), container ); | 275 | l = new QLabel( tr( "Country" ), container ); |
276 | gl->addWidget( l, 5, 0 ); | 276 | gl->addWidget( l, 5, 0 ); |
277 | cmbCountry = new QComboBox( TRUE, container ); | 277 | cmbCountry = new QComboBox( TRUE, container ); |
278 | cmbCountry->insertItem( tr( "" ) ); | 278 | cmbCountry->insertItem( tr( "" ) ); |
279 | cmbCountry->insertItem( tr ( "United States" ) ); | 279 | cmbCountry->insertItem( tr ( "United States" ) ); |
280 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 280 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
281 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 281 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
282 | cmbCountry->insertItem( tr ( "Albania" ) ); | 282 | cmbCountry->insertItem( tr ( "Albania" ) ); |
283 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 283 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
284 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 284 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
285 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 285 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
286 | cmbCountry->insertItem( tr ( "Angola" ) ); | 286 | cmbCountry->insertItem( tr ( "Angola" ) ); |
287 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 287 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
288 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 288 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
289 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 289 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
290 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 290 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
291 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 291 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
292 | cmbCountry->insertItem( tr ( "Australia" ) ); | 292 | cmbCountry->insertItem( tr ( "Australia" ) ); |
293 | cmbCountry->insertItem( tr ( "Austria" ) ); | 293 | cmbCountry->insertItem( tr ( "Austria" ) ); |
294 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 294 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
295 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 295 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
296 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 296 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
297 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 297 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
298 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 298 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
299 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 299 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
300 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 300 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
301 | cmbCountry->insertItem( tr ( "Belize" ) ); | 301 | cmbCountry->insertItem( tr ( "Belize" ) ); |
302 | cmbCountry->insertItem( tr ( "Benin" ) ); | 302 | cmbCountry->insertItem( tr ( "Benin" ) ); |
303 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 303 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
304 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 304 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
305 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 305 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
306 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 306 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
307 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 307 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
308 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 308 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
309 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 309 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
310 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 310 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
311 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 311 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
312 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 312 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
313 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 313 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
314 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 314 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
315 | cmbCountry->insertItem( tr ( "Canada" ) ); | 315 | cmbCountry->insertItem( tr ( "Canada" ) ); |
316 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 316 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
317 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 317 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
318 | cmbCountry->insertItem( tr ( "Chad" ) ); | 318 | cmbCountry->insertItem( tr ( "Chad" ) ); |
319 | cmbCountry->insertItem( tr ( "Chile" ) ); | 319 | cmbCountry->insertItem( tr ( "Chile" ) ); |
320 | cmbCountry->insertItem( tr ( "China" ) ); | 320 | cmbCountry->insertItem( tr ( "China" ) ); |
321 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 321 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
322 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 322 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
323 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 323 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
324 | cmbCountry->insertItem( tr ( "Congo" ) ); | 324 | cmbCountry->insertItem( tr ( "Congo" ) ); |
325 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 325 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
326 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 326 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
327 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 327 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
328 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 328 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
329 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 329 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
330 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 330 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
331 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 331 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
332 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 332 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
333 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 333 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
334 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 334 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
335 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 335 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
336 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 336 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
337 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 337 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
338 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 338 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
339 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 339 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
340 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 340 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
341 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 341 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
342 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 342 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
343 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 343 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
344 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 344 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
345 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 345 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
346 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 346 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
347 | cmbCountry->insertItem( tr ( "Finland" ) ); | 347 | cmbCountry->insertItem( tr ( "Finland" ) ); |
348 | cmbCountry->insertItem( tr ( "France" ) ); | 348 | cmbCountry->insertItem( tr ( "France" ) ); |
349 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 349 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
350 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 350 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
351 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 351 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
352 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 352 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
353 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 353 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
354 | cmbCountry->insertItem( tr ( "Germany" ) ); | 354 | cmbCountry->insertItem( tr ( "Germany" ) ); |
355 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 355 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
356 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 356 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
357 | cmbCountry->insertItem( tr ( "Greece" ) ); | 357 | cmbCountry->insertItem( tr ( "Greece" ) ); |
358 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 358 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
359 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 359 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
360 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 360 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
361 | cmbCountry->insertItem( tr ( "Guam" ) ); | 361 | cmbCountry->insertItem( tr ( "Guam" ) ); |
362 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 362 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
363 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 363 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
364 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 364 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
365 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 365 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
366 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 366 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
367 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 367 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
368 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 368 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
369 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 369 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
370 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 370 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
371 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 371 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
372 | cmbCountry->insertItem( tr ( "India" ) ); | 372 | cmbCountry->insertItem( tr ( "India" ) ); |
373 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 373 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
374 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 374 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
375 | cmbCountry->insertItem( tr ( "Israel" ) ); | 375 | cmbCountry->insertItem( tr ( "Israel" ) ); |
376 | cmbCountry->insertItem( tr ( "Italy" ) ); | 376 | cmbCountry->insertItem( tr ( "Italy" ) ); |
377 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 377 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
378 | cmbCountry->insertItem( tr ( "Japan" ) ); | 378 | cmbCountry->insertItem( tr ( "Japan" ) ); |
379 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 379 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
380 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 380 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
381 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 381 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
382 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 382 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
383 | cmbCountry->insertItem( tr ( "Korea" ) ); | 383 | cmbCountry->insertItem( tr ( "Korea" ) ); |
384 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 384 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
385 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 385 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
386 | cmbCountry->insertItem( tr ( "Laos" ) ); | 386 | cmbCountry->insertItem( tr ( "Laos" ) ); |
387 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 387 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
388 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 388 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
389 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 389 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
390 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 390 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
391 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 391 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
392 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 392 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
393 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 393 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
394 | cmbCountry->insertItem( tr ( "Macau" ) ); | 394 | cmbCountry->insertItem( tr ( "Macau" ) ); |
395 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 395 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
396 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 396 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
397 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 397 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
398 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 398 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
399 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 399 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
400 | cmbCountry->insertItem( tr ( "Mali" ) ); | 400 | cmbCountry->insertItem( tr ( "Mali" ) ); |
401 | cmbCountry->insertItem( tr ( "Malta" ) ); | 401 | cmbCountry->insertItem( tr ( "Malta" ) ); |
402 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 402 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
403 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 403 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
404 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 404 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
405 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 405 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
406 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 406 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
407 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 407 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
408 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 408 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
409 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 409 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
410 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 410 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
411 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 411 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
412 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 412 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
413 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 413 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
414 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 414 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
415 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 415 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
416 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 416 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
417 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 417 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
418 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 418 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
419 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 419 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
420 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 420 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
421 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 421 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
422 | cmbCountry->insertItem( tr ( "Niger" ) ); | 422 | cmbCountry->insertItem( tr ( "Niger" ) ); |
423 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 423 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
424 | cmbCountry->insertItem( tr ( "Niue" ) ); | 424 | cmbCountry->insertItem( tr ( "Niue" ) ); |
425 | cmbCountry->insertItem( tr ( "Norway" ) ); | 425 | cmbCountry->insertItem( tr ( "Norway" ) ); |
426 | cmbCountry->insertItem( tr ( "Oman" ) ); | 426 | cmbCountry->insertItem( tr ( "Oman" ) ); |
427 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 427 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
428 | cmbCountry->insertItem( tr ( "Palau" ) ); | 428 | cmbCountry->insertItem( tr ( "Palau" ) ); |
429 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 429 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
430 | cmbCountry->insertItem( tr ( "Panama" ) ); | 430 | cmbCountry->insertItem( tr ( "Panama" ) ); |
431 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 431 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
432 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 432 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
433 | cmbCountry->insertItem( tr ( "Peru" ) ); | 433 | cmbCountry->insertItem( tr ( "Peru" ) ); |
434 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 434 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
435 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 435 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
436 | cmbCountry->insertItem( tr ( "Poland" ) ); | 436 | cmbCountry->insertItem( tr ( "Poland" ) ); |
437 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 437 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
438 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 438 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
439 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 439 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
440 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 440 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
441 | cmbCountry->insertItem( tr ( "Romania" ) ); | 441 | cmbCountry->insertItem( tr ( "Romania" ) ); |
442 | cmbCountry->insertItem( tr ( "Russia" ) ); | 442 | cmbCountry->insertItem( tr ( "Russia" ) ); |
443 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 443 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
444 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 444 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
445 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 445 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
446 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 446 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
447 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 447 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
448 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 448 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
449 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 449 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
450 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 450 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
451 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 451 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
452 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 452 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
453 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 453 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
454 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 454 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
455 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 455 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
456 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 456 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
457 | cmbCountry->insertItem( tr ( "Spain" ) ); | 457 | cmbCountry->insertItem( tr ( "Spain" ) ); |
458 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 458 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
459 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 459 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
460 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 460 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
461 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 461 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
462 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 462 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
463 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 463 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
464 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 464 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
465 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 465 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
466 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 466 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
467 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 467 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
468 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 468 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
469 | cmbCountry->insertItem( tr ( "Togo" ) ); | 469 | cmbCountry->insertItem( tr ( "Togo" ) ); |
470 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 470 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
471 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 471 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
472 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 472 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
473 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 473 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
474 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 474 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
475 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 475 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
476 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 476 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
477 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 477 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
478 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 478 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
479 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 479 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
480 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 480 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
481 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 481 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
482 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 482 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
483 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 483 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
484 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 484 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
485 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 485 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
486 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 486 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
487 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 487 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
488 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 488 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
489 | if (cmbCountry->listBox()!=0) | 489 | if (cmbCountry->listBox()!=0) |
490 | cmbCountry->listBox()->sort(); | 490 | cmbCountry->listBox()->sort(); |
491 | 491 | ||
492 | cmbCountry->setMaximumWidth( 135 ); | 492 | cmbCountry->setMaximumWidth( 135 ); |
493 | 493 | ||
494 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 494 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
495 | 495 | ||
496 | // Chooser 4 | 496 | // Chooser 4 |
497 | cmbChooserField4 = new QComboBox( FALSE, container ); | 497 | cmbChooserField4 = new QComboBox( FALSE, container ); |
498 | cmbChooserField4->setMaximumWidth( 90 ); | 498 | cmbChooserField4->setMaximumWidth( 90 ); |
499 | gl->addWidget( cmbChooserField4, 6, 0 ); | 499 | gl->addWidget( cmbChooserField4, 6, 0 ); |
500 | // Textfield for chooser 2 | 500 | // Textfield for chooser 2 |
501 | // Now use WidgetStack to contain the textfield and the default-email combo! | 501 | // Now use WidgetStack to contain the textfield and the default-email combo! |
502 | m_widgetStack4 = new QWidgetStack( container ); | 502 | m_widgetStack4 = new QWidgetStack( container ); |
503 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 503 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
504 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 504 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
505 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 505 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
506 | m_widgetStack4 -> raiseWidget( TextField ); | 506 | m_widgetStack4 -> raiseWidget( TextField ); |
507 | 507 | ||
508 | QSpacerItem *space = new QSpacerItem(1,1, | 508 | QSpacerItem *space = new QSpacerItem(1,1, |
509 | QSizePolicy::Maximum, | 509 | QSizePolicy::Maximum, |
510 | QSizePolicy::MinimumExpanding ); | 510 | QSizePolicy::MinimumExpanding ); |
511 | gl->addItem( space, 7, 0 ); | 511 | gl->addItem( space, 7, 0 ); |
512 | 512 | ||
513 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 513 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
514 | 514 | ||
515 | tabViewport = new QWidget ( tabMain ); | 515 | tabViewport = new QWidget ( tabMain ); |
516 | 516 | ||
517 | vb = new QVBoxLayout( tabViewport ); | 517 | vb = new QVBoxLayout( tabViewport ); |
518 | 518 | ||
519 | svDetails = new QScrollView( tabViewport ); | 519 | svDetails = new QScrollView( tabViewport ); |
520 | vb->addWidget( svDetails, 0, 0 ); | 520 | vb->addWidget( svDetails, 0, 0 ); |
521 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 521 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
522 | svDetails->setFrameStyle( QFrame::NoFrame ); | 522 | svDetails->setFrameStyle( QFrame::NoFrame ); |
523 | 523 | ||
524 | container = new QWidget( svDetails->viewport() ); | 524 | container = new QWidget( svDetails->viewport() ); |
525 | svDetails->addChild( container ); | 525 | svDetails->addChild( container ); |
526 | 526 | ||
527 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 527 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
528 | 528 | ||
529 | int counter = 0; | 529 | int counter = 0; |
530 | 530 | ||
531 | // Birthday | 531 | // Birthday |
532 | QHBox* hBox = new QHBox( container ); | 532 | QHBox* hBox = new QHBox( container ); |
533 | l = new QLabel( tr("Birthday"), container ); | 533 | l = new QLabel( tr("Birthday"), container ); |
534 | gl->addWidget( l, counter, 0 ); | 534 | gl->addWidget( l, counter, 0 ); |
535 | 535 | ||
536 | QPopupMenu* m1 = new QPopupMenu( container ); | 536 | QPopupMenu* m1 = new QPopupMenu( container ); |
537 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 537 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
538 | m1->insertItem( birthdayPicker ); | 538 | m1->insertItem( birthdayPicker ); |
539 | 539 | ||
540 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 540 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
541 | birthdayButton->setPopup( m1 ); | 541 | birthdayButton->setPopup( m1 ); |
542 | birthdayButton->setPopupDelay(0); | 542 | birthdayButton->setPopupDelay(0); |
543 | 543 | ||
544 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 544 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
545 | tr( "Delete" ), | 545 | tr( "Delete" ), |
546 | hBox, 0 ); | 546 | hBox, 0 ); |
547 | 547 | ||
548 | gl->addWidget( hBox, counter , 1 ); | 548 | gl->addWidget( hBox, counter , 1 ); |
549 | 549 | ||
550 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), | 550 | connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), |
551 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); | 551 | this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); |
552 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 552 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
553 | 553 | ||
554 | ++counter; | 554 | ++counter; |
555 | 555 | ||
556 | // Anniversary | 556 | // Anniversary |
557 | hBox = new QHBox( container ); | 557 | hBox = new QHBox( container ); |
558 | l = new QLabel( tr("Anniversary"), container ); | 558 | l = new QLabel( tr("Anniversary"), container ); |
559 | gl->addWidget( l, counter, 0 ); | 559 | gl->addWidget( l, counter, 0 ); |
560 | 560 | ||
561 | m1 = new QPopupMenu( container ); | 561 | m1 = new QPopupMenu( container ); |
562 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 562 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
563 | m1->insertItem( anniversaryPicker ); | 563 | m1->insertItem( anniversaryPicker ); |
564 | 564 | ||
565 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 565 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
566 | anniversaryButton->setPopup( m1 ); | 566 | anniversaryButton->setPopup( m1 ); |
567 | anniversaryButton->setPopupDelay(0); | 567 | anniversaryButton->setPopupDelay(0); |
568 | 568 | ||
569 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 569 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
570 | tr( "Delete" ), | 570 | tr( "Delete" ), |
571 | hBox, 0 ); | 571 | hBox, 0 ); |
572 | gl->addWidget( hBox, counter , 1 ); | 572 | gl->addWidget( hBox, counter , 1 ); |
573 | 573 | ||
574 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), | 574 | connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), |
575 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); | 575 | this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); |
576 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 576 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
577 | 577 | ||
578 | ++counter; | 578 | ++counter; |
579 | 579 | ||
580 | // Gender | 580 | // Gender |
581 | l = new QLabel( tr("Gender"), container ); | 581 | l = new QLabel( tr("Gender"), container ); |
582 | gl->addWidget( l, counter, 0 ); | 582 | gl->addWidget( l, counter, 0 ); |
583 | cmbGender = new QComboBox( container ); | 583 | cmbGender = new QComboBox( container ); |
584 | cmbGender->insertItem( "", 0 ); | 584 | cmbGender->insertItem( "", 0 ); |
585 | cmbGender->insertItem( tr("Male"), 1); | 585 | cmbGender->insertItem( tr("Male"), 1); |
586 | cmbGender->insertItem( tr("Female"), 2); | 586 | cmbGender->insertItem( tr("Female"), 2); |
587 | gl->addWidget( cmbGender, counter, 1 ); | 587 | gl->addWidget( cmbGender, counter, 1 ); |
588 | 588 | ||
589 | ++counter; | 589 | ++counter; |
590 | 590 | ||
591 | // Create Labels and lineedit fields for every dynamic entry | 591 | // Create Labels and lineedit fields for every dynamic entry |
592 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 592 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
593 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 593 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); |
594 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 594 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); |
595 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 595 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
596 | 596 | ||
597 | if (((*it) == "Anniversary") || | 597 | if (((*it) == "Anniversary") || |
598 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 598 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
599 | 599 | ||
600 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); | 600 | l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); |
601 | listName.append( l ); | 601 | listName.append( l ); |
602 | gl->addWidget( l, i, 0 ); | 602 | gl->addWidget( l, i, 0 ); |
603 | QLineEdit *e = new QLineEdit( container ); | 603 | QLineEdit *e = new QLineEdit( container ); |
604 | listValue.append( e ); | 604 | listValue.append( e ); |
605 | gl->addWidget( e, i, 1); | 605 | gl->addWidget( e, i, 1); |
606 | } | 606 | } |
607 | // Fill labels with names.. | 607 | // Fill labels with names.. |
608 | //loadFields(); | 608 | //loadFields(); |
609 | 609 | ||
610 | 610 | ||
611 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 611 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
612 | 612 | ||
613 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 613 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
614 | dlgNote->setCaption( tr("Enter Note") ); | 614 | dlgNote->setCaption( tr("Enter Note") ); |
615 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 615 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
616 | txtNote = new QMultiLineEdit( dlgNote ); | 616 | txtNote = new QMultiLineEdit( dlgNote ); |
617 | vbNote->addWidget( txtNote ); | 617 | vbNote->addWidget( txtNote ); |
618 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 618 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
619 | 619 | ||
620 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 620 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
621 | dlgName->setCaption( tr("Edit Name") ); | 621 | dlgName->setCaption( tr("Edit Name") ); |
622 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 622 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
623 | 623 | ||
624 | l = new QLabel( tr("First Name"), dlgName ); | 624 | l = new QLabel( tr("First Name"), dlgName ); |
625 | gl->addWidget( l, 0, 0 ); | 625 | gl->addWidget( l, 0, 0 ); |
626 | txtFirstName = new QLineEdit( dlgName ); | 626 | txtFirstName = new QLineEdit( dlgName ); |
627 | gl->addWidget( txtFirstName, 0, 1 ); | 627 | gl->addWidget( txtFirstName, 0, 1 ); |
628 | 628 | ||
629 | l = new QLabel( tr("Middle Name"), dlgName ); | 629 | l = new QLabel( tr("Middle Name"), dlgName ); |
630 | gl->addWidget( l, 1, 0 ); | 630 | gl->addWidget( l, 1, 0 ); |
631 | txtMiddleName = new QLineEdit( dlgName ); | 631 | txtMiddleName = new QLineEdit( dlgName ); |
632 | gl->addWidget( txtMiddleName, 1, 1 ); | 632 | gl->addWidget( txtMiddleName, 1, 1 ); |
633 | 633 | ||
634 | l = new QLabel( tr("Last Name"), dlgName ); | 634 | l = new QLabel( tr("Last Name"), dlgName ); |
635 | gl->addWidget( l, 2, 0 ); | 635 | gl->addWidget( l, 2, 0 ); |
636 | txtLastName = new QLineEdit( dlgName ); | 636 | txtLastName = new QLineEdit( dlgName ); |
637 | gl->addWidget( txtLastName, 2, 1 ); | 637 | gl->addWidget( txtLastName, 2, 1 ); |
638 | 638 | ||
639 | // l = new QLabel( tr("Suffix"), dlgName ); | 639 | // l = new QLabel( tr("Suffix"), dlgName ); |
640 | // gl->addWidget( l, 3, 0 ); | 640 | // gl->addWidget( l, 3, 0 ); |
641 | // txtSuffix = new QLineEdit( dlgName ); | 641 | // txtSuffix = new QLineEdit( dlgName ); |
642 | // gl->addWidget( txtSuffix, 3, 1 ); | 642 | // gl->addWidget( txtSuffix, 3, 1 ); |
643 | space = new QSpacerItem(1,1, | 643 | space = new QSpacerItem(1,1, |
644 | QSizePolicy::Maximum, | 644 | QSizePolicy::Maximum, |
645 | QSizePolicy::MinimumExpanding ); | 645 | QSizePolicy::MinimumExpanding ); |
646 | gl->addItem( space, 4, 0 ); | 646 | gl->addItem( space, 4, 0 ); |
647 | 647 | ||
648 | cmbChooserField1->insertStringList( trlChooserNames ); | 648 | cmbChooserField1->insertStringList( trlChooserNames ); |
649 | cmbChooserField2->insertStringList( trlChooserNames ); | 649 | cmbChooserField2->insertStringList( trlChooserNames ); |
650 | cmbChooserField3->insertStringList( trlChooserNames ); | 650 | cmbChooserField3->insertStringList( trlChooserNames ); |
651 | cmbChooserField4->insertStringList( trlChooserNames ); | 651 | cmbChooserField4->insertStringList( trlChooserNames ); |
652 | 652 | ||
653 | cmbChooserField1->setCurrentItem( 0 ); | 653 | cmbChooserField1->setCurrentItem( 0 ); |
654 | cmbChooserField2->setCurrentItem( 1 ); | 654 | cmbChooserField2->setCurrentItem( 1 ); |
655 | cmbChooserField3->setCurrentItem( 2 ); | 655 | cmbChooserField3->setCurrentItem( 2 ); |
656 | 656 | ||
657 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 657 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
658 | 658 | ||
659 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 659 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
660 | 660 | ||
661 | connect( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) ); | 661 | connect( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) ); |
662 | 662 | ||
663 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), | 663 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), |
664 | this, SLOT(slotChooser1Change(const QString &)) ); | 664 | this, SLOT(slotChooser1Change(const QString &)) ); |
665 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), | 665 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), |
666 | this, SLOT(slotChooser2Change(const QString &)) ); | 666 | this, SLOT(slotChooser2Change(const QString &)) ); |
667 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), | 667 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), |
668 | this, SLOT(slotChooser3Change(const QString &)) ); | 668 | this, SLOT(slotChooser3Change(const QString &)) ); |
669 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), | 669 | connect( txtChooserField4, SIGNAL(textChanged(const QString &)), |
670 | this, SLOT(slotChooser4Change(const QString &)) ); | 670 | this, SLOT(slotChooser4Change(const QString &)) ); |
671 | connect( txtAddress, SIGNAL(textChanged(const QString &)), | 671 | connect( txtAddress, SIGNAL(textChanged(const QString &)), |
672 | this, SLOT(slotAddressChange(const QString &)) ); | 672 | this, SLOT(slotAddressChange(const QString &)) ); |
673 | connect( txtCity, SIGNAL(textChanged(const QString &)), | 673 | connect( txtCity, SIGNAL(textChanged(const QString &)), |
674 | this, SLOT(slotCityChange(const QString &)) ); | 674 | this, SLOT(slotCityChange(const QString &)) ); |
675 | connect( txtState, SIGNAL(textChanged(const QString &)), | 675 | connect( txtState, SIGNAL(textChanged(const QString &)), |
676 | this, SLOT(slotStateChange(const QString &)) ); | 676 | this, SLOT(slotStateChange(const QString &)) ); |
677 | connect( txtZip, SIGNAL(textChanged(const QString &)), | 677 | connect( txtZip, SIGNAL(textChanged(const QString &)), |
678 | this, SLOT(slotZipChange(const QString &)) ); | 678 | this, SLOT(slotZipChange(const QString &)) ); |
679 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), | 679 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), |
680 | this, SLOT(slotCountryChange(const QString &)) ); | 680 | this, SLOT(slotCountryChange(const QString &)) ); |
681 | connect( cmbCountry, SIGNAL(activated(const QString &)), | 681 | connect( cmbCountry, SIGNAL(activated(const QString &)), |
682 | this, SLOT(slotCountryChange(const QString &)) ); | 682 | this, SLOT(slotCountryChange(const QString &)) ); |
683 | connect( cmbChooserField1, SIGNAL(activated(int)), | 683 | connect( cmbChooserField1, SIGNAL(activated(int)), |
684 | this, SLOT(slotCmbChooser1Change(int)) ); | 684 | this, SLOT(slotCmbChooser1Change(int)) ); |
685 | connect( cmbChooserField2, SIGNAL(activated(int)), | 685 | connect( cmbChooserField2, SIGNAL(activated(int)), |
686 | this, SLOT(slotCmbChooser2Change(int)) ); | 686 | this, SLOT(slotCmbChooser2Change(int)) ); |
687 | connect( cmbChooserField3, SIGNAL(activated(int)), | 687 | connect( cmbChooserField3, SIGNAL(activated(int)), |
688 | this, SLOT(slotCmbChooser3Change(int)) ); | 688 | this, SLOT(slotCmbChooser3Change(int)) ); |
689 | connect( cmbChooserField4, SIGNAL(activated(int)), | 689 | connect( cmbChooserField4, SIGNAL(activated(int)), |
690 | this, SLOT(slotCmbChooser4Change(int)) ); | 690 | this, SLOT(slotCmbChooser4Change(int)) ); |
691 | connect( cmbAddress, SIGNAL(activated(int)), | 691 | connect( cmbAddress, SIGNAL(activated(int)), |
692 | this, SLOT(slotAddressTypeChange(int)) ); | 692 | this, SLOT(slotAddressTypeChange(int)) ); |
693 | 693 | ||
694 | new QPEDialogListener(this); | 694 | new QPEDialogListener(this); |
695 | 695 | ||
696 | setPersonalView ( m_personalView ); | 696 | setPersonalView ( m_personalView ); |
697 | 697 | ||
698 | qWarning("init() END"); | 698 | qWarning("init() END"); |
699 | } | 699 | } |
700 | 700 | ||
701 | void ContactEditor::defaultEmailChanged(int i){ | 701 | void ContactEditor::defaultEmailChanged(int i){ |
702 | qDebug("defaultEmailChanged"); | 702 | qDebug("defaultEmailChanged"); |
703 | 703 | ||
704 | // was sollte das ? (se) | 704 | // was sollte das ? (se) |
705 | // int index = cmbChooserField1->currentItem(); | 705 | // int index = cmbChooserField1->currentItem(); |
706 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 706 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
707 | 707 | ||
708 | defaultEmail = cmbDefaultEmail->text(i); | 708 | defaultEmail = cmbDefaultEmail->text(i); |
709 | qDebug ("Changed to: %s", defaultEmail.latin1()); | 709 | qDebug ("Changed to: %s", defaultEmail.latin1()); |
710 | 710 | ||
711 | } | 711 | } |
712 | 712 | ||
713 | void ContactEditor::populateDefaultEmailCmb(){ | 713 | void ContactEditor::populateDefaultEmailCmb(){ |
714 | 714 | ||
715 | // if the default-email combo was not selected and therfore not created | 715 | // if the default-email combo was not selected and therfore not created |
716 | // we get a lot of trouble.. Therfore create an invisible one.. | 716 | // we get a lot of trouble.. Therfore create an invisible one.. |
717 | if ( !cmbDefaultEmail ){ | 717 | if ( !cmbDefaultEmail ){ |
718 | cmbDefaultEmail = new QComboBox(this); | 718 | cmbDefaultEmail = new QComboBox(this); |
719 | cmbDefaultEmail -> hide(); | 719 | cmbDefaultEmail -> hide(); |
720 | } | 720 | } |
721 | cmbDefaultEmail->clear(); | 721 | cmbDefaultEmail->clear(); |
722 | cmbDefaultEmail->insertStringList( emails ); | 722 | cmbDefaultEmail->insertStringList( emails ); |
723 | // cmbDefaultEmail->show(); | 723 | // cmbDefaultEmail->show(); |
724 | 724 | ||
725 | // Select default email in combo.. | 725 | // Select default email in combo.. |
726 | bool found = false; | 726 | bool found = false; |
727 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 727 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
728 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", | 728 | qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", |
729 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); | 729 | cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); |
730 | 730 | ||
731 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 731 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
732 | cmbDefaultEmail->setCurrentItem( i ); | 732 | cmbDefaultEmail->setCurrentItem( i ); |
733 | qDebug("set"); | 733 | qDebug("set"); |
734 | found = true; | 734 | found = true; |
735 | } | 735 | } |
736 | } | 736 | } |
737 | 737 | ||
738 | // If the current default email is not found in the list, we choose the | 738 | // If the current default email is not found in the list, we choose the |
739 | // first one.. | 739 | // first one.. |
740 | if ( !found ) | 740 | if ( !found ) |
741 | defaultEmail = cmbDefaultEmail->text(0); | 741 | defaultEmail = cmbDefaultEmail->text(0); |
742 | } | 742 | } |
743 | 743 | ||
744 | // Called when any combobox was changed. | 744 | // Called when any combobox was changed. |
745 | // "true" returned if the change was chandled by this function, else it should | 745 | // "true" returned if the change was chandled by this function, else it should |
746 | // be handled by something else.. | 746 | // be handled by something else.. |
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 |